@xrkseek/harness-cli 0.0.11 → 0.1.1

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 (1000) hide show
  1. package/dist/plugin/install-client.d.ts.map +1 -1
  2. package/dist/plugin/install-client.js +80 -2
  3. package/dist/plugin/install-client.js.map +1 -1
  4. package/node_modules/@img/colour/LICENSE.md +82 -0
  5. package/node_modules/@img/colour/README.md +15 -0
  6. package/node_modules/@img/colour/color.cjs +1596 -0
  7. package/node_modules/@img/colour/index.cjs +1 -0
  8. package/node_modules/@img/colour/index.d.ts +929 -0
  9. package/node_modules/@img/colour/package.json +58 -0
  10. package/node_modules/@img/sharp-win32-x64/LICENSE +191 -0
  11. package/node_modules/@img/sharp-win32-x64/README.md +59 -0
  12. package/node_modules/@img/sharp-win32-x64/index.cjs +1 -0
  13. package/node_modules/@img/sharp-win32-x64/lib/libvips-42.dll +0 -0
  14. package/node_modules/@img/sharp-win32-x64/lib/libvips-cpp-8.18.3.dll +0 -0
  15. package/node_modules/@img/sharp-win32-x64/lib/sharp-win32-x64-0.35.3.node +0 -0
  16. package/node_modules/@img/sharp-win32-x64/package.json +40 -0
  17. package/node_modules/@img/sharp-win32-x64/versions.json +30 -0
  18. package/node_modules/@types/node/LICENSE +21 -0
  19. package/node_modules/@types/node/README.md +15 -0
  20. package/node_modules/@types/node/assert/strict.d.ts +111 -0
  21. package/node_modules/@types/node/assert.d.ts +1115 -0
  22. package/node_modules/@types/node/async_hooks.d.ts +623 -0
  23. package/node_modules/@types/node/buffer.buffer.d.ts +472 -0
  24. package/node_modules/@types/node/buffer.d.ts +1934 -0
  25. package/node_modules/@types/node/child_process.d.ts +1476 -0
  26. package/node_modules/@types/node/cluster.d.ts +578 -0
  27. package/node_modules/@types/node/compatibility/iterators.d.ts +21 -0
  28. package/node_modules/@types/node/console.d.ts +453 -0
  29. package/node_modules/@types/node/constants.d.ts +21 -0
  30. package/node_modules/@types/node/crypto.d.ts +5417 -0
  31. package/node_modules/@types/node/dgram.d.ts +600 -0
  32. package/node_modules/@types/node/diagnostics_channel.d.ts +576 -0
  33. package/node_modules/@types/node/dns/promises.d.ts +503 -0
  34. package/node_modules/@types/node/dns.d.ts +923 -0
  35. package/node_modules/@types/node/domain.d.ts +166 -0
  36. package/node_modules/@types/node/events.d.ts +976 -0
  37. package/node_modules/@types/node/fs/promises.d.ts +1341 -0
  38. package/node_modules/@types/node/fs.d.ts +4714 -0
  39. package/node_modules/@types/node/globals.d.ts +170 -0
  40. package/node_modules/@types/node/globals.typedarray.d.ts +41 -0
  41. package/node_modules/@types/node/http.d.ts +2154 -0
  42. package/node_modules/@types/node/http2.d.ts +2835 -0
  43. package/node_modules/@types/node/https.d.ts +585 -0
  44. package/node_modules/@types/node/index.d.ts +101 -0
  45. package/node_modules/@types/node/inspector.d.ts +277 -0
  46. package/node_modules/@types/node/inspector.generated.d.ts +4239 -0
  47. package/node_modules/@types/node/module.d.ts +843 -0
  48. package/node_modules/@types/node/net.d.ts +1073 -0
  49. package/node_modules/@types/node/os.d.ts +507 -0
  50. package/node_modules/@types/node/package.json +155 -0
  51. package/node_modules/@types/node/path.d.ts +200 -0
  52. package/node_modules/@types/node/perf_hooks.d.ts +1042 -0
  53. package/node_modules/@types/node/process.d.ts +2102 -0
  54. package/node_modules/@types/node/punycode.d.ts +117 -0
  55. package/node_modules/@types/node/querystring.d.ts +152 -0
  56. package/node_modules/@types/node/readline/promises.d.ts +161 -0
  57. package/node_modules/@types/node/readline.d.ts +600 -0
  58. package/node_modules/@types/node/repl.d.ts +438 -0
  59. package/node_modules/@types/node/sea.d.ts +162 -0
  60. package/node_modules/@types/node/sqlite.d.ts +1040 -0
  61. package/node_modules/@types/node/stream/consumers.d.ts +38 -0
  62. package/node_modules/@types/node/stream/promises.d.ts +90 -0
  63. package/node_modules/@types/node/stream/web.d.ts +573 -0
  64. package/node_modules/@types/node/stream.d.ts +1706 -0
  65. package/node_modules/@types/node/string_decoder.d.ts +67 -0
  66. package/node_modules/@types/node/test.d.ts +2349 -0
  67. package/node_modules/@types/node/timers/promises.d.ts +108 -0
  68. package/node_modules/@types/node/timers.d.ts +285 -0
  69. package/node_modules/@types/node/tls.d.ts +1279 -0
  70. package/node_modules/@types/node/trace_events.d.ts +197 -0
  71. package/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +468 -0
  72. package/node_modules/@types/node/ts5.6/compatibility/float16array.d.ts +71 -0
  73. package/node_modules/@types/node/ts5.6/globals.typedarray.d.ts +36 -0
  74. package/node_modules/@types/node/ts5.6/index.d.ts +103 -0
  75. package/node_modules/@types/node/ts5.7/compatibility/float16array.d.ts +72 -0
  76. package/node_modules/@types/node/ts5.7/index.d.ts +103 -0
  77. package/node_modules/@types/node/tty.d.ts +208 -0
  78. package/node_modules/@types/node/url.d.ts +1079 -0
  79. package/node_modules/@types/node/util.d.ts +2336 -0
  80. package/node_modules/@types/node/v8.d.ts +982 -0
  81. package/node_modules/@types/node/vm.d.ts +1195 -0
  82. package/node_modules/@types/node/wasi.d.ts +202 -0
  83. package/node_modules/@types/node/web-globals/abortcontroller.d.ts +34 -0
  84. package/node_modules/@types/node/web-globals/crypto.d.ts +32 -0
  85. package/node_modules/@types/node/web-globals/domexception.d.ts +68 -0
  86. package/node_modules/@types/node/web-globals/events.d.ts +97 -0
  87. package/node_modules/@types/node/web-globals/fetch.d.ts +62 -0
  88. package/node_modules/@types/node/web-globals/navigator.d.ts +25 -0
  89. package/node_modules/@types/node/web-globals/storage.d.ts +24 -0
  90. package/node_modules/@types/node/web-globals/streams.d.ts +22 -0
  91. package/node_modules/@types/node/worker_threads.d.ts +894 -0
  92. package/node_modules/@types/node/zlib.d.ts +745 -0
  93. package/node_modules/@xrkseek/attachment/dist/error.d.ts +3 -2
  94. package/node_modules/@xrkseek/attachment/dist/error.d.ts.map +1 -1
  95. package/node_modules/@xrkseek/attachment/dist/error.js +17 -2
  96. package/node_modules/@xrkseek/attachment/dist/error.js.map +1 -1
  97. package/node_modules/@xrkseek/attachment/dist/index.d.ts +2 -2
  98. package/node_modules/@xrkseek/attachment/dist/index.d.ts.map +1 -1
  99. package/node_modules/@xrkseek/attachment/dist/index.js +1 -1
  100. package/node_modules/@xrkseek/attachment/dist/index.js.map +1 -1
  101. package/node_modules/@xrkseek/attachment/dist/memory.d.ts.map +1 -1
  102. package/node_modules/@xrkseek/attachment/dist/memory.js +6 -0
  103. package/node_modules/@xrkseek/attachment/dist/memory.js.map +1 -1
  104. package/node_modules/@xrkseek/attachment/dist/store.d.ts +6 -1
  105. package/node_modules/@xrkseek/attachment/dist/store.d.ts.map +1 -1
  106. package/node_modules/@xrkseek/attachment/dist/types.d.ts +19 -0
  107. package/node_modules/@xrkseek/attachment/dist/types.d.ts.map +1 -1
  108. package/node_modules/@xrkseek/attachment/dist/types.js.map +1 -1
  109. package/node_modules/@xrkseek/attachment-local/README.md +3 -0
  110. package/node_modules/@xrkseek/attachment-local/dist/compression-limiter.d.ts +18 -0
  111. package/node_modules/@xrkseek/attachment-local/dist/compression-limiter.d.ts.map +1 -0
  112. package/node_modules/@xrkseek/attachment-local/dist/compression-limiter.js +43 -0
  113. package/node_modules/@xrkseek/attachment-local/dist/compression-limiter.js.map +1 -0
  114. package/node_modules/@xrkseek/attachment-local/dist/encoding.d.ts +23 -0
  115. package/node_modules/@xrkseek/attachment-local/dist/encoding.d.ts.map +1 -0
  116. package/node_modules/@xrkseek/attachment-local/dist/encoding.js +33 -0
  117. package/node_modules/@xrkseek/attachment-local/dist/encoding.js.map +1 -0
  118. package/node_modules/@xrkseek/attachment-local/dist/image.d.ts +54 -0
  119. package/node_modules/@xrkseek/attachment-local/dist/image.d.ts.map +1 -0
  120. package/node_modules/@xrkseek/attachment-local/dist/image.js +97 -0
  121. package/node_modules/@xrkseek/attachment-local/dist/image.js.map +1 -0
  122. package/node_modules/@xrkseek/attachment-local/dist/index.d.ts +32 -0
  123. package/node_modules/@xrkseek/attachment-local/dist/index.d.ts.map +1 -0
  124. package/node_modules/@xrkseek/attachment-local/dist/index.js +188 -0
  125. package/node_modules/@xrkseek/attachment-local/dist/index.js.map +1 -0
  126. package/node_modules/@xrkseek/attachment-local/dist/normalization.d.ts +44 -0
  127. package/node_modules/@xrkseek/attachment-local/dist/normalization.d.ts.map +1 -0
  128. package/node_modules/@xrkseek/attachment-local/dist/normalization.js +148 -0
  129. package/node_modules/@xrkseek/attachment-local/dist/normalization.js.map +1 -0
  130. package/node_modules/@xrkseek/attachment-local/dist/request-image.d.ts +34 -0
  131. package/node_modules/@xrkseek/attachment-local/dist/request-image.d.ts.map +1 -0
  132. package/node_modules/@xrkseek/attachment-local/dist/request-image.js +208 -0
  133. package/node_modules/@xrkseek/attachment-local/dist/request-image.js.map +1 -0
  134. package/node_modules/@xrkseek/attachment-local/dist/store.d.ts +58 -0
  135. package/node_modules/@xrkseek/attachment-local/dist/store.d.ts.map +1 -0
  136. package/node_modules/@xrkseek/attachment-local/dist/store.js +290 -0
  137. package/node_modules/@xrkseek/attachment-local/dist/store.js.map +1 -0
  138. package/node_modules/@xrkseek/attachment-local/package.json +25 -0
  139. package/node_modules/@xrkseek/exec-fs/dist/index.d.ts +3 -0
  140. package/node_modules/@xrkseek/exec-fs/dist/index.d.ts.map +1 -1
  141. package/node_modules/@xrkseek/exec-fs/dist/index.js +10 -0
  142. package/node_modules/@xrkseek/exec-fs/dist/index.js.map +1 -1
  143. package/node_modules/@xrkseek/exec-fs/dist/read-image.d.ts +35 -0
  144. package/node_modules/@xrkseek/exec-fs/dist/read-image.d.ts.map +1 -0
  145. package/node_modules/@xrkseek/exec-fs/dist/read-image.js +120 -0
  146. package/node_modules/@xrkseek/exec-fs/dist/read-image.js.map +1 -0
  147. package/node_modules/@xrkseek/exec-fs/package.json +3 -1
  148. package/node_modules/@xrkseek/llm/dist/index.d.ts +1 -0
  149. package/node_modules/@xrkseek/llm/dist/index.d.ts.map +1 -1
  150. package/node_modules/@xrkseek/llm/dist/index.js.map +1 -1
  151. package/node_modules/@xrkseek/llm-deepseek/README.md +3 -1
  152. package/node_modules/@xrkseek/llm-deepseek/dist/file-id.d.ts +10 -0
  153. package/node_modules/@xrkseek/llm-deepseek/dist/file-id.d.ts.map +1 -0
  154. package/node_modules/@xrkseek/llm-deepseek/dist/file-id.js +8 -0
  155. package/node_modules/@xrkseek/llm-deepseek/dist/file-id.js.map +1 -0
  156. package/node_modules/@xrkseek/llm-deepseek/dist/file-store.d.ts +40 -0
  157. package/node_modules/@xrkseek/llm-deepseek/dist/file-store.d.ts.map +1 -0
  158. package/node_modules/@xrkseek/llm-deepseek/dist/file-store.js +164 -0
  159. package/node_modules/@xrkseek/llm-deepseek/dist/file-store.js.map +1 -0
  160. package/node_modules/@xrkseek/llm-deepseek/dist/files-api.d.ts +56 -0
  161. package/node_modules/@xrkseek/llm-deepseek/dist/files-api.d.ts.map +1 -0
  162. package/node_modules/@xrkseek/llm-deepseek/dist/files-api.js +180 -0
  163. package/node_modules/@xrkseek/llm-deepseek/dist/files-api.js.map +1 -0
  164. package/node_modules/@xrkseek/llm-deepseek/dist/index.d.ts +15 -6
  165. package/node_modules/@xrkseek/llm-deepseek/dist/index.d.ts.map +1 -1
  166. package/node_modules/@xrkseek/llm-deepseek/dist/index.js +63 -13
  167. package/node_modules/@xrkseek/llm-deepseek/dist/index.js.map +1 -1
  168. package/node_modules/@xrkseek/llm-deepseek/dist/request-policy.d.ts +8 -0
  169. package/node_modules/@xrkseek/llm-deepseek/dist/request-policy.d.ts.map +1 -0
  170. package/node_modules/@xrkseek/llm-deepseek/dist/request-policy.js +12 -0
  171. package/node_modules/@xrkseek/llm-deepseek/dist/request-policy.js.map +1 -0
  172. package/node_modules/@xrkseek/llm-deepseek/dist/upload-index.d.ts +28 -0
  173. package/node_modules/@xrkseek/llm-deepseek/dist/upload-index.d.ts.map +1 -0
  174. package/node_modules/@xrkseek/llm-deepseek/dist/upload-index.js +142 -0
  175. package/node_modules/@xrkseek/llm-deepseek/dist/upload-index.js.map +1 -0
  176. package/node_modules/@xrkseek/llm-deepseek/package.json +3 -1
  177. package/node_modules/@xrkseek/llm-openai-compatible/dist/index.d.ts +27 -0
  178. package/node_modules/@xrkseek/llm-openai-compatible/dist/index.d.ts.map +1 -1
  179. package/node_modules/@xrkseek/llm-openai-compatible/dist/index.js +20 -5
  180. package/node_modules/@xrkseek/llm-openai-compatible/dist/index.js.map +1 -1
  181. package/node_modules/@xrkseek/llm-registry/dist/registry.d.ts +1 -0
  182. package/node_modules/@xrkseek/llm-registry/dist/registry.d.ts.map +1 -1
  183. package/node_modules/@xrkseek/llm-registry/dist/registry.js +15 -1
  184. package/node_modules/@xrkseek/llm-registry/dist/registry.js.map +1 -1
  185. package/node_modules/@xrkseek/preset-harness/dist/preset.d.ts +5 -0
  186. package/node_modules/@xrkseek/preset-harness/dist/preset.d.ts.map +1 -1
  187. package/node_modules/@xrkseek/preset-harness/dist/preset.js +10 -1
  188. package/node_modules/@xrkseek/preset-harness/dist/preset.js.map +1 -1
  189. package/node_modules/@xrkseek/preset-harness/dist/tsconfig.tsbuildinfo +1 -1
  190. package/node_modules/@xrkseek/preset-harness/package.json +1 -0
  191. package/node_modules/@xrkseek/preset-minimal/dist/tsconfig.tsbuildinfo +1 -1
  192. package/node_modules/@xrkseek/preset-server/dist/preset.d.ts.map +1 -1
  193. package/node_modules/@xrkseek/preset-server/dist/preset.js +3 -1
  194. package/node_modules/@xrkseek/preset-server/dist/preset.js.map +1 -1
  195. package/node_modules/@xrkseek/preset-server/dist/tsconfig.tsbuildinfo +1 -1
  196. package/node_modules/@xrkseek/protocol/dist/content.d.ts +5 -0
  197. package/node_modules/@xrkseek/protocol/dist/content.d.ts.map +1 -1
  198. package/node_modules/@xrkseek/protocol/dist/content.js +8 -1
  199. package/node_modules/@xrkseek/protocol/dist/content.js.map +1 -1
  200. package/node_modules/@xrkseek/server-face/dist/context.d.ts +6 -3
  201. package/node_modules/@xrkseek/server-face/dist/context.d.ts.map +1 -1
  202. package/node_modules/@xrkseek/server-face/dist/cordis-bridge.d.ts +9 -0
  203. package/node_modules/@xrkseek/server-face/dist/cordis-bridge.d.ts.map +1 -0
  204. package/node_modules/@xrkseek/server-face/dist/cordis-bridge.js +28 -0
  205. package/node_modules/@xrkseek/server-face/dist/cordis-bridge.js.map +1 -0
  206. package/node_modules/@xrkseek/server-face/dist/cost-meter-balance.d.ts +16 -0
  207. package/node_modules/@xrkseek/server-face/dist/cost-meter-balance.d.ts.map +1 -0
  208. package/node_modules/@xrkseek/server-face/dist/cost-meter-balance.js +141 -0
  209. package/node_modules/@xrkseek/server-face/dist/cost-meter-balance.js.map +1 -0
  210. package/node_modules/@xrkseek/server-face/dist/cost-meter-coding-plan-service.d.ts +13 -0
  211. package/node_modules/@xrkseek/server-face/dist/cost-meter-coding-plan-service.d.ts.map +1 -0
  212. package/node_modules/@xrkseek/server-face/dist/cost-meter-coding-plan-service.js +158 -0
  213. package/node_modules/@xrkseek/server-face/dist/cost-meter-coding-plan-service.js.map +1 -0
  214. package/node_modules/@xrkseek/server-face/dist/cost-meter-coding-plans.d.ts +284 -0
  215. package/node_modules/@xrkseek/server-face/dist/cost-meter-coding-plans.d.ts.map +1 -0
  216. package/node_modules/@xrkseek/server-face/dist/cost-meter-coding-plans.js +696 -0
  217. package/node_modules/@xrkseek/server-face/dist/cost-meter-coding-plans.js.map +1 -0
  218. package/node_modules/@xrkseek/server-face/dist/cost-meter-custom-balance.d.ts +15 -0
  219. package/node_modules/@xrkseek/server-face/dist/cost-meter-custom-balance.d.ts.map +1 -0
  220. package/node_modules/@xrkseek/server-face/dist/cost-meter-custom-balance.js +196 -0
  221. package/node_modules/@xrkseek/server-face/dist/cost-meter-custom-balance.js.map +1 -0
  222. package/node_modules/@xrkseek/server-face/dist/cost-meter-go-quota.d.ts +19 -0
  223. package/node_modules/@xrkseek/server-face/dist/cost-meter-go-quota.d.ts.map +1 -0
  224. package/node_modules/@xrkseek/server-face/dist/cost-meter-go-quota.js +143 -0
  225. package/node_modules/@xrkseek/server-face/dist/cost-meter-go-quota.js.map +1 -0
  226. package/node_modules/@xrkseek/server-face/dist/cost-meter-pricing.d.ts +16 -0
  227. package/node_modules/@xrkseek/server-face/dist/cost-meter-pricing.d.ts.map +1 -0
  228. package/node_modules/@xrkseek/server-face/dist/cost-meter-pricing.js +84 -0
  229. package/node_modules/@xrkseek/server-face/dist/cost-meter-pricing.js.map +1 -0
  230. package/node_modules/@xrkseek/server-face/dist/cost-meter-record.d.ts +19 -0
  231. package/node_modules/@xrkseek/server-face/dist/cost-meter-record.d.ts.map +1 -0
  232. package/node_modules/@xrkseek/server-face/dist/cost-meter-record.js +221 -0
  233. package/node_modules/@xrkseek/server-face/dist/cost-meter-record.js.map +1 -0
  234. package/node_modules/@xrkseek/server-face/dist/cost-meter-store.d.ts +133 -0
  235. package/node_modules/@xrkseek/server-face/dist/cost-meter-store.d.ts.map +1 -0
  236. package/node_modules/@xrkseek/server-face/dist/cost-meter-store.js +561 -0
  237. package/node_modules/@xrkseek/server-face/dist/cost-meter-store.js.map +1 -0
  238. package/node_modules/@xrkseek/server-face/dist/dispatch.d.ts.map +1 -1
  239. package/node_modules/@xrkseek/server-face/dist/dispatch.js +15 -0
  240. package/node_modules/@xrkseek/server-face/dist/dispatch.js.map +1 -1
  241. package/node_modules/@xrkseek/server-face/dist/handlers/cordis-stub.d.ts +0 -5
  242. package/node_modules/@xrkseek/server-face/dist/handlers/cordis-stub.d.ts.map +1 -1
  243. package/node_modules/@xrkseek/server-face/dist/handlers/cordis-stub.js +277 -24
  244. package/node_modules/@xrkseek/server-face/dist/handlers/cordis-stub.js.map +1 -1
  245. package/node_modules/@xrkseek/server-face/dist/handlers/cost-meter.d.ts +30 -0
  246. package/node_modules/@xrkseek/server-face/dist/handlers/cost-meter.d.ts.map +1 -0
  247. package/node_modules/@xrkseek/server-face/dist/handlers/cost-meter.js +48 -0
  248. package/node_modules/@xrkseek/server-face/dist/handlers/cost-meter.js.map +1 -0
  249. package/node_modules/@xrkseek/server-face/dist/handlers/references.d.ts +6 -0
  250. package/node_modules/@xrkseek/server-face/dist/handlers/references.d.ts.map +1 -0
  251. package/node_modules/@xrkseek/server-face/dist/handlers/references.js +42 -0
  252. package/node_modules/@xrkseek/server-face/dist/handlers/references.js.map +1 -0
  253. package/node_modules/@xrkseek/server-face/dist/handlers/staged-client-code.d.ts +6 -0
  254. package/node_modules/@xrkseek/server-face/dist/handlers/staged-client-code.d.ts.map +1 -0
  255. package/node_modules/@xrkseek/server-face/dist/handlers/staged-client-code.js +24 -0
  256. package/node_modules/@xrkseek/server-face/dist/handlers/staged-client-code.js.map +1 -0
  257. package/node_modules/@xrkseek/server-face/dist/index.d.ts +1 -0
  258. package/node_modules/@xrkseek/server-face/dist/index.d.ts.map +1 -1
  259. package/node_modules/@xrkseek/server-face/dist/index.js +1 -0
  260. package/node_modules/@xrkseek/server-face/dist/index.js.map +1 -1
  261. package/node_modules/@xrkseek/server-face/dist/llm-resolve.d.ts.map +1 -1
  262. package/node_modules/@xrkseek/server-face/dist/llm-resolve.js +5 -3
  263. package/node_modules/@xrkseek/server-face/dist/llm-resolve.js.map +1 -1
  264. package/node_modules/@xrkseek/server-face/dist/plugin-inventory.d.ts +2 -2
  265. package/node_modules/@xrkseek/server-face/dist/plugin-inventory.d.ts.map +1 -1
  266. package/node_modules/@xrkseek/server-face/dist/plugin-inventory.js +7 -3
  267. package/node_modules/@xrkseek/server-face/dist/plugin-inventory.js.map +1 -1
  268. package/node_modules/@xrkseek/server-face/dist/projections/index.d.ts +2 -0
  269. package/node_modules/@xrkseek/server-face/dist/projections/index.d.ts.map +1 -1
  270. package/node_modules/@xrkseek/server-face/dist/projections/index.js +2 -0
  271. package/node_modules/@xrkseek/server-face/dist/projections/index.js.map +1 -1
  272. package/node_modules/@xrkseek/server-face/dist/projections/install-defaults.d.ts.map +1 -1
  273. package/node_modules/@xrkseek/server-face/dist/projections/install-defaults.js +12 -0
  274. package/node_modules/@xrkseek/server-face/dist/projections/install-defaults.js.map +1 -1
  275. package/node_modules/@xrkseek/server-face/dist/projections/registry.d.ts +45 -0
  276. package/node_modules/@xrkseek/server-face/dist/projections/registry.d.ts.map +1 -1
  277. package/node_modules/@xrkseek/server-face/dist/projections/registry.js.map +1 -1
  278. package/node_modules/@xrkseek/server-face/dist/projections/units/auto-review.d.ts +40 -0
  279. package/node_modules/@xrkseek/server-face/dist/projections/units/auto-review.d.ts.map +1 -0
  280. package/node_modules/@xrkseek/server-face/dist/projections/units/auto-review.js +103 -0
  281. package/node_modules/@xrkseek/server-face/dist/projections/units/auto-review.js.map +1 -0
  282. package/node_modules/@xrkseek/server-face/dist/projections/units/context-headers.d.ts +9 -0
  283. package/node_modules/@xrkseek/server-face/dist/projections/units/context-headers.d.ts.map +1 -0
  284. package/node_modules/@xrkseek/server-face/dist/projections/units/context-headers.js +24 -0
  285. package/node_modules/@xrkseek/server-face/dist/projections/units/context-headers.js.map +1 -0
  286. package/node_modules/@xrkseek/server-face/dist/projections/units/context-timeline.d.ts +37 -0
  287. package/node_modules/@xrkseek/server-face/dist/projections/units/context-timeline.d.ts.map +1 -0
  288. package/node_modules/@xrkseek/server-face/dist/projections/units/context-timeline.js +109 -0
  289. package/node_modules/@xrkseek/server-face/dist/projections/units/context-timeline.js.map +1 -0
  290. package/node_modules/@xrkseek/server-face/dist/projections/units/cost-usage.d.ts +35 -0
  291. package/node_modules/@xrkseek/server-face/dist/projections/units/cost-usage.d.ts.map +1 -0
  292. package/node_modules/@xrkseek/server-face/dist/projections/units/cost-usage.js +151 -0
  293. package/node_modules/@xrkseek/server-face/dist/projections/units/cost-usage.js.map +1 -0
  294. package/node_modules/@xrkseek/server-face/dist/reference-discovery.d.ts +13 -0
  295. package/node_modules/@xrkseek/server-face/dist/reference-discovery.d.ts.map +1 -0
  296. package/node_modules/@xrkseek/server-face/dist/reference-discovery.js +81 -0
  297. package/node_modules/@xrkseek/server-face/dist/reference-discovery.js.map +1 -0
  298. package/node_modules/@xrkseek/server-face/dist/runtime.d.ts +5 -1
  299. package/node_modules/@xrkseek/server-face/dist/runtime.d.ts.map +1 -1
  300. package/node_modules/@xrkseek/server-face/dist/runtime.js +25 -0
  301. package/node_modules/@xrkseek/server-face/dist/runtime.js.map +1 -1
  302. package/node_modules/@xrkseek/server-face/dist/settings-credentials.d.ts +15 -0
  303. package/node_modules/@xrkseek/server-face/dist/settings-credentials.d.ts.map +1 -1
  304. package/node_modules/@xrkseek/server-face/dist/settings-credentials.js.map +1 -1
  305. package/node_modules/@xrkseek/server-face/dist/slash.d.ts.map +1 -1
  306. package/node_modules/@xrkseek/server-face/dist/slash.js +19 -0
  307. package/node_modules/@xrkseek/server-face/dist/slash.js.map +1 -1
  308. package/node_modules/@xrkseek/server-face/dist/wire/paths.d.ts.map +1 -1
  309. package/node_modules/@xrkseek/server-face/dist/wire/paths.js +3 -0
  310. package/node_modules/@xrkseek/server-face/dist/wire/paths.js.map +1 -1
  311. package/node_modules/@xrkseek/server-face/package.json +3 -0
  312. package/node_modules/@xrkseek/server-host/dist/auto-review-bridge.d.ts +4 -0
  313. package/node_modules/@xrkseek/server-host/dist/auto-review-bridge.d.ts.map +1 -0
  314. package/node_modules/@xrkseek/server-host/dist/auto-review-bridge.js +10 -0
  315. package/node_modules/@xrkseek/server-host/dist/auto-review-bridge.js.map +1 -0
  316. package/node_modules/@xrkseek/server-host/dist/cost-meter-bridge.d.ts +11 -0
  317. package/node_modules/@xrkseek/server-host/dist/cost-meter-bridge.d.ts.map +1 -0
  318. package/node_modules/@xrkseek/server-host/dist/cost-meter-bridge.js +29 -0
  319. package/node_modules/@xrkseek/server-host/dist/cost-meter-bridge.js.map +1 -0
  320. package/node_modules/@xrkseek/server-host/dist/harness-connector-bridge.d.ts +15 -0
  321. package/node_modules/@xrkseek/server-host/dist/harness-connector-bridge.d.ts.map +1 -0
  322. package/node_modules/@xrkseek/server-host/dist/harness-connector-bridge.js +34 -0
  323. package/node_modules/@xrkseek/server-host/dist/harness-connector-bridge.js.map +1 -0
  324. package/node_modules/@xrkseek/server-host/dist/index.d.ts +6 -1
  325. package/node_modules/@xrkseek/server-host/dist/index.d.ts.map +1 -1
  326. package/node_modules/@xrkseek/server-host/dist/index.js +126 -19
  327. package/node_modules/@xrkseek/server-host/dist/index.js.map +1 -1
  328. package/node_modules/@xrkseek/server-host/dist/sidebar-pty.d.ts +17 -0
  329. package/node_modules/@xrkseek/server-host/dist/sidebar-pty.d.ts.map +1 -0
  330. package/node_modules/@xrkseek/server-host/dist/sidebar-pty.js +201 -0
  331. package/node_modules/@xrkseek/server-host/dist/sidebar-pty.js.map +1 -0
  332. package/node_modules/@xrkseek/server-host/dist/usage-stats-bridge.d.ts +10 -0
  333. package/node_modules/@xrkseek/server-host/dist/usage-stats-bridge.d.ts.map +1 -0
  334. package/node_modules/@xrkseek/server-host/dist/usage-stats-bridge.js +31 -0
  335. package/node_modules/@xrkseek/server-host/dist/usage-stats-bridge.js.map +1 -0
  336. package/node_modules/@xrkseek/server-host/dist/wallet-bridge.d.ts +7 -0
  337. package/node_modules/@xrkseek/server-host/dist/wallet-bridge.d.ts.map +1 -0
  338. package/node_modules/@xrkseek/server-host/dist/wallet-bridge.js +40 -0
  339. package/node_modules/@xrkseek/server-host/dist/wallet-bridge.js.map +1 -0
  340. package/node_modules/@xrkseek/server-host/package.json +8 -1
  341. package/node_modules/@xrkseek/server-http/dist/boot-inject.d.ts +12 -0
  342. package/node_modules/@xrkseek/server-http/dist/boot-inject.d.ts.map +1 -1
  343. package/node_modules/@xrkseek/server-http/dist/boot-inject.js +54 -0
  344. package/node_modules/@xrkseek/server-http/dist/boot-inject.js.map +1 -1
  345. package/node_modules/@xrkseek/server-http/dist/dsh-compat/adapter-compose.d.ts +6 -0
  346. package/node_modules/@xrkseek/server-http/dist/dsh-compat/adapter-compose.d.ts.map +1 -0
  347. package/node_modules/@xrkseek/server-http/dist/dsh-compat/adapter-compose.js +141 -0
  348. package/node_modules/@xrkseek/server-http/dist/dsh-compat/adapter-compose.js.map +1 -0
  349. package/node_modules/@xrkseek/server-http/dist/dsh-compat/adapter-providers.d.ts +3 -0
  350. package/node_modules/@xrkseek/server-http/dist/dsh-compat/adapter-providers.d.ts.map +1 -0
  351. package/node_modules/@xrkseek/server-http/dist/dsh-compat/adapter-providers.js +445 -0
  352. package/node_modules/@xrkseek/server-http/dist/dsh-compat/adapter-providers.js.map +1 -0
  353. package/node_modules/@xrkseek/server-http/dist/dsh-compat/adapter-registry.d.ts +7 -0
  354. package/node_modules/@xrkseek/server-http/dist/dsh-compat/adapter-registry.d.ts.map +1 -0
  355. package/node_modules/@xrkseek/server-http/dist/dsh-compat/adapter-registry.js +15 -0
  356. package/node_modules/@xrkseek/server-http/dist/dsh-compat/adapter-registry.js.map +1 -0
  357. package/node_modules/@xrkseek/server-http/dist/dsh-compat/adapter-types.d.ts +57 -0
  358. package/node_modules/@xrkseek/server-http/dist/dsh-compat/adapter-types.d.ts.map +1 -0
  359. package/node_modules/@xrkseek/server-http/dist/dsh-compat/adapter-types.js +2 -0
  360. package/node_modules/@xrkseek/server-http/dist/dsh-compat/adapter-types.js.map +1 -0
  361. package/node_modules/@xrkseek/server-http/dist/dsh-compat/adapters/builtin.d.ts +10 -0
  362. package/node_modules/@xrkseek/server-http/dist/dsh-compat/adapters/builtin.d.ts.map +1 -0
  363. package/node_modules/@xrkseek/server-http/dist/dsh-compat/adapters/builtin.js +275 -0
  364. package/node_modules/@xrkseek/server-http/dist/dsh-compat/adapters/builtin.js.map +1 -0
  365. package/node_modules/@xrkseek/server-http/dist/dsh-compat/audit-community-client.d.ts +10 -0
  366. package/node_modules/@xrkseek/server-http/dist/dsh-compat/audit-community-client.d.ts.map +1 -0
  367. package/node_modules/@xrkseek/server-http/dist/dsh-compat/audit-community-client.js +41 -0
  368. package/node_modules/@xrkseek/server-http/dist/dsh-compat/audit-community-client.js.map +1 -0
  369. package/node_modules/@xrkseek/server-http/dist/dsh-compat/auto-review-http.d.ts +17 -0
  370. package/node_modules/@xrkseek/server-http/dist/dsh-compat/auto-review-http.d.ts.map +1 -0
  371. package/node_modules/@xrkseek/server-http/dist/dsh-compat/auto-review-http.js +184 -0
  372. package/node_modules/@xrkseek/server-http/dist/dsh-compat/auto-review-http.js.map +1 -0
  373. package/node_modules/@xrkseek/server-http/dist/dsh-compat/barrel.d.ts +5 -0
  374. package/node_modules/@xrkseek/server-http/dist/dsh-compat/barrel.d.ts.map +1 -0
  375. package/node_modules/@xrkseek/server-http/dist/dsh-compat/barrel.js +5 -0
  376. package/node_modules/@xrkseek/server-http/dist/dsh-compat/barrel.js.map +1 -0
  377. package/node_modules/@xrkseek/server-http/dist/dsh-compat/bundle-chunk-stub.d.ts +21 -0
  378. package/node_modules/@xrkseek/server-http/dist/dsh-compat/bundle-chunk-stub.d.ts.map +1 -0
  379. package/node_modules/@xrkseek/server-http/dist/dsh-compat/bundle-chunk-stub.js +122 -0
  380. package/node_modules/@xrkseek/server-http/dist/dsh-compat/bundle-chunk-stub.js.map +1 -0
  381. package/node_modules/@xrkseek/server-http/dist/dsh-compat/chat-import.d.ts +10 -0
  382. package/node_modules/@xrkseek/server-http/dist/dsh-compat/chat-import.d.ts.map +1 -0
  383. package/node_modules/@xrkseek/server-http/dist/dsh-compat/chat-import.js +58 -0
  384. package/node_modules/@xrkseek/server-http/dist/dsh-compat/chat-import.js.map +1 -0
  385. package/node_modules/@xrkseek/server-http/dist/dsh-compat/community-root-http.d.ts +7 -0
  386. package/node_modules/@xrkseek/server-http/dist/dsh-compat/community-root-http.d.ts.map +1 -0
  387. package/node_modules/@xrkseek/server-http/dist/dsh-compat/community-root-http.js +59 -0
  388. package/node_modules/@xrkseek/server-http/dist/dsh-compat/community-root-http.js.map +1 -0
  389. package/node_modules/@xrkseek/server-http/dist/dsh-compat/cordis-fiber-runner.d.ts +25 -0
  390. package/node_modules/@xrkseek/server-http/dist/dsh-compat/cordis-fiber-runner.d.ts.map +1 -0
  391. package/node_modules/@xrkseek/server-http/dist/dsh-compat/cordis-fiber-runner.js +154 -0
  392. package/node_modules/@xrkseek/server-http/dist/dsh-compat/cordis-fiber-runner.js.map +1 -0
  393. package/node_modules/@xrkseek/server-http/dist/dsh-compat/cordis-fiber-worker.d.ts +2 -0
  394. package/node_modules/@xrkseek/server-http/dist/dsh-compat/cordis-fiber-worker.d.ts.map +1 -0
  395. package/node_modules/@xrkseek/server-http/dist/dsh-compat/cordis-fiber-worker.js +77 -0
  396. package/node_modules/@xrkseek/server-http/dist/dsh-compat/cordis-fiber-worker.js.map +1 -0
  397. package/node_modules/@xrkseek/server-http/dist/dsh-compat/cordis-registry.d.ts +16 -0
  398. package/node_modules/@xrkseek/server-http/dist/dsh-compat/cordis-registry.d.ts.map +1 -0
  399. package/node_modules/@xrkseek/server-http/dist/dsh-compat/cordis-registry.js +121 -0
  400. package/node_modules/@xrkseek/server-http/dist/dsh-compat/cordis-registry.js.map +1 -0
  401. package/node_modules/@xrkseek/server-http/dist/dsh-compat/cordis-settings-fallback.d.ts +12 -0
  402. package/node_modules/@xrkseek/server-http/dist/dsh-compat/cordis-settings-fallback.d.ts.map +1 -0
  403. package/node_modules/@xrkseek/server-http/dist/dsh-compat/cordis-settings-fallback.js +48 -0
  404. package/node_modules/@xrkseek/server-http/dist/dsh-compat/cordis-settings-fallback.js.map +1 -0
  405. package/node_modules/@xrkseek/server-http/dist/dsh-compat/create-host-plugin.d.ts +18 -0
  406. package/node_modules/@xrkseek/server-http/dist/dsh-compat/create-host-plugin.d.ts.map +1 -0
  407. package/node_modules/@xrkseek/server-http/dist/dsh-compat/create-host-plugin.js +62 -0
  408. package/node_modules/@xrkseek/server-http/dist/dsh-compat/create-host-plugin.js.map +1 -0
  409. package/node_modules/@xrkseek/server-http/dist/dsh-compat/dream-skin.d.ts +9 -0
  410. package/node_modules/@xrkseek/server-http/dist/dsh-compat/dream-skin.d.ts.map +1 -0
  411. package/node_modules/@xrkseek/server-http/dist/dsh-compat/dream-skin.js +42 -0
  412. package/node_modules/@xrkseek/server-http/dist/dsh-compat/dream-skin.js.map +1 -0
  413. package/node_modules/@xrkseek/server-http/dist/dsh-compat/dsh-client-scan.d.ts +6 -0
  414. package/node_modules/@xrkseek/server-http/dist/dsh-compat/dsh-client-scan.d.ts.map +1 -0
  415. package/node_modules/@xrkseek/server-http/dist/dsh-compat/dsh-client-scan.js +88 -0
  416. package/node_modules/@xrkseek/server-http/dist/dsh-compat/dsh-client-scan.js.map +1 -0
  417. package/node_modules/@xrkseek/server-http/dist/dsh-compat/dsh-community-infer.d.ts +9 -0
  418. package/node_modules/@xrkseek/server-http/dist/dsh-compat/dsh-community-infer.d.ts.map +1 -0
  419. package/node_modules/@xrkseek/server-http/dist/dsh-compat/dsh-community-infer.js +67 -0
  420. package/node_modules/@xrkseek/server-http/dist/dsh-compat/dsh-community-infer.js.map +1 -0
  421. package/node_modules/@xrkseek/server-http/dist/dsh-compat/dsh-compat-matrix.d.ts +18 -0
  422. package/node_modules/@xrkseek/server-http/dist/dsh-compat/dsh-compat-matrix.d.ts.map +1 -0
  423. package/node_modules/@xrkseek/server-http/dist/dsh-compat/dsh-compat-matrix.js +198 -0
  424. package/node_modules/@xrkseek/server-http/dist/dsh-compat/dsh-compat-matrix.js.map +1 -0
  425. package/node_modules/@xrkseek/server-http/dist/dsh-compat/dsh-compat-upgrades.d.ts +27 -0
  426. package/node_modules/@xrkseek/server-http/dist/dsh-compat/dsh-compat-upgrades.d.ts.map +1 -0
  427. package/node_modules/@xrkseek/server-http/dist/dsh-compat/dsh-compat-upgrades.js +71 -0
  428. package/node_modules/@xrkseek/server-http/dist/dsh-compat/dsh-compat-upgrades.js.map +1 -0
  429. package/node_modules/@xrkseek/server-http/dist/dsh-compat/dsh-envelope.d.ts +8 -0
  430. package/node_modules/@xrkseek/server-http/dist/dsh-compat/dsh-envelope.d.ts.map +1 -0
  431. package/node_modules/@xrkseek/server-http/dist/dsh-compat/dsh-envelope.js +12 -0
  432. package/node_modules/@xrkseek/server-http/dist/dsh-compat/dsh-envelope.js.map +1 -0
  433. package/node_modules/@xrkseek/server-http/dist/dsh-compat/dsh-package-names.d.ts +2 -0
  434. package/node_modules/@xrkseek/server-http/dist/dsh-compat/dsh-package-names.d.ts.map +1 -0
  435. package/node_modules/@xrkseek/server-http/dist/dsh-compat/dsh-package-names.js +6 -0
  436. package/node_modules/@xrkseek/server-http/dist/dsh-compat/dsh-package-names.js.map +1 -0
  437. package/node_modules/@xrkseek/server-http/dist/dsh-compat/dsh-path-capabilities.d.ts +22 -0
  438. package/node_modules/@xrkseek/server-http/dist/dsh-compat/dsh-path-capabilities.d.ts.map +1 -0
  439. package/node_modules/@xrkseek/server-http/dist/dsh-compat/dsh-path-capabilities.js +219 -0
  440. package/node_modules/@xrkseek/server-http/dist/dsh-compat/dsh-path-capabilities.js.map +1 -0
  441. package/node_modules/@xrkseek/server-http/dist/dsh-compat/dsh-plugin-presets.d.ts +4 -0
  442. package/node_modules/@xrkseek/server-http/dist/dsh-compat/dsh-plugin-presets.d.ts.map +1 -0
  443. package/node_modules/@xrkseek/server-http/dist/dsh-compat/dsh-plugin-presets.js +53 -0
  444. package/node_modules/@xrkseek/server-http/dist/dsh-compat/dsh-plugin-presets.js.map +1 -0
  445. package/node_modules/@xrkseek/server-http/dist/dsh-compat/generic-dsh-http.d.ts +11 -0
  446. package/node_modules/@xrkseek/server-http/dist/dsh-compat/generic-dsh-http.d.ts.map +1 -0
  447. package/node_modules/@xrkseek/server-http/dist/dsh-compat/generic-dsh-http.js +61 -0
  448. package/node_modules/@xrkseek/server-http/dist/dsh-compat/generic-dsh-http.js.map +1 -0
  449. package/node_modules/@xrkseek/server-http/dist/dsh-compat/generic-plugin-http.d.ts +7 -0
  450. package/node_modules/@xrkseek/server-http/dist/dsh-compat/generic-plugin-http.d.ts.map +1 -0
  451. package/node_modules/@xrkseek/server-http/dist/dsh-compat/generic-plugin-http.js +150 -0
  452. package/node_modules/@xrkseek/server-http/dist/dsh-compat/generic-plugin-http.js.map +1 -0
  453. package/node_modules/@xrkseek/server-http/dist/dsh-compat/genui.d.ts +10 -0
  454. package/node_modules/@xrkseek/server-http/dist/dsh-compat/genui.d.ts.map +1 -0
  455. package/node_modules/@xrkseek/server-http/dist/dsh-compat/genui.js +239 -0
  456. package/node_modules/@xrkseek/server-http/dist/dsh-compat/genui.js.map +1 -0
  457. package/node_modules/@xrkseek/server-http/dist/dsh-compat/harness-connector-store.d.ts +22 -0
  458. package/node_modules/@xrkseek/server-http/dist/dsh-compat/harness-connector-store.d.ts.map +1 -0
  459. package/node_modules/@xrkseek/server-http/dist/dsh-compat/harness-connector-store.js +83 -0
  460. package/node_modules/@xrkseek/server-http/dist/dsh-compat/harness-connector-store.js.map +1 -0
  461. package/node_modules/@xrkseek/server-http/dist/dsh-compat/harness-connector.d.ts +18 -0
  462. package/node_modules/@xrkseek/server-http/dist/dsh-compat/harness-connector.d.ts.map +1 -0
  463. package/node_modules/@xrkseek/server-http/dist/dsh-compat/harness-connector.js +191 -0
  464. package/node_modules/@xrkseek/server-http/dist/dsh-compat/harness-connector.js.map +1 -0
  465. package/node_modules/@xrkseek/server-http/dist/dsh-compat/honest-envelope.d.ts +21 -0
  466. package/node_modules/@xrkseek/server-http/dist/dsh-compat/honest-envelope.d.ts.map +1 -0
  467. package/node_modules/@xrkseek/server-http/dist/dsh-compat/honest-envelope.js +105 -0
  468. package/node_modules/@xrkseek/server-http/dist/dsh-compat/honest-envelope.js.map +1 -0
  469. package/node_modules/@xrkseek/server-http/dist/dsh-compat/honest-http-catchall.d.ts +7 -0
  470. package/node_modules/@xrkseek/server-http/dist/dsh-compat/honest-http-catchall.d.ts.map +1 -0
  471. package/node_modules/@xrkseek/server-http/dist/dsh-compat/honest-http-catchall.js +57 -0
  472. package/node_modules/@xrkseek/server-http/dist/dsh-compat/honest-http-catchall.js.map +1 -0
  473. package/node_modules/@xrkseek/server-http/dist/dsh-compat/host-apply-bridge.d.ts +6 -0
  474. package/node_modules/@xrkseek/server-http/dist/dsh-compat/host-apply-bridge.d.ts.map +1 -0
  475. package/node_modules/@xrkseek/server-http/dist/dsh-compat/host-apply-bridge.js +74 -0
  476. package/node_modules/@xrkseek/server-http/dist/dsh-compat/host-apply-bridge.js.map +1 -0
  477. package/node_modules/@xrkseek/server-http/dist/dsh-compat/host-apply-registry.d.ts +14 -0
  478. package/node_modules/@xrkseek/server-http/dist/dsh-compat/host-apply-registry.d.ts.map +1 -0
  479. package/node_modules/@xrkseek/server-http/dist/dsh-compat/host-apply-registry.js +17 -0
  480. package/node_modules/@xrkseek/server-http/dist/dsh-compat/host-apply-registry.js.map +1 -0
  481. package/node_modules/@xrkseek/server-http/dist/dsh-compat/host-feature-bridge.d.ts +76 -0
  482. package/node_modules/@xrkseek/server-http/dist/dsh-compat/host-feature-bridge.d.ts.map +1 -0
  483. package/node_modules/@xrkseek/server-http/dist/dsh-compat/host-feature-bridge.js +551 -0
  484. package/node_modules/@xrkseek/server-http/dist/dsh-compat/host-feature-bridge.js.map +1 -0
  485. package/node_modules/@xrkseek/server-http/dist/dsh-compat/host-manifest.d.ts +7 -0
  486. package/node_modules/@xrkseek/server-http/dist/dsh-compat/host-manifest.d.ts.map +1 -0
  487. package/node_modules/@xrkseek/server-http/dist/dsh-compat/host-manifest.js +136 -0
  488. package/node_modules/@xrkseek/server-http/dist/dsh-compat/host-manifest.js.map +1 -0
  489. package/node_modules/@xrkseek/server-http/dist/dsh-compat/im-channels.d.ts +21 -0
  490. package/node_modules/@xrkseek/server-http/dist/dsh-compat/im-channels.d.ts.map +1 -0
  491. package/node_modules/@xrkseek/server-http/dist/dsh-compat/im-channels.js +281 -0
  492. package/node_modules/@xrkseek/server-http/dist/dsh-compat/im-channels.js.map +1 -0
  493. package/node_modules/@xrkseek/server-http/dist/dsh-compat/im-messaging-bridge.d.ts +16 -0
  494. package/node_modules/@xrkseek/server-http/dist/dsh-compat/im-messaging-bridge.d.ts.map +1 -0
  495. package/node_modules/@xrkseek/server-http/dist/dsh-compat/im-messaging-bridge.js +163 -0
  496. package/node_modules/@xrkseek/server-http/dist/dsh-compat/im-messaging-bridge.js.map +1 -0
  497. package/node_modules/@xrkseek/server-http/dist/dsh-compat/im-office.d.ts +5 -0
  498. package/node_modules/@xrkseek/server-http/dist/dsh-compat/im-office.d.ts.map +1 -0
  499. package/node_modules/@xrkseek/server-http/dist/dsh-compat/im-office.js +125 -0
  500. package/node_modules/@xrkseek/server-http/dist/dsh-compat/im-office.js.map +1 -0
  501. package/node_modules/@xrkseek/server-http/dist/dsh-compat/im-provision-bridge.d.ts +17 -0
  502. package/node_modules/@xrkseek/server-http/dist/dsh-compat/im-provision-bridge.d.ts.map +1 -0
  503. package/node_modules/@xrkseek/server-http/dist/dsh-compat/im-provision-bridge.js +188 -0
  504. package/node_modules/@xrkseek/server-http/dist/dsh-compat/im-provision-bridge.js.map +1 -0
  505. package/node_modules/@xrkseek/server-http/dist/dsh-compat/im-rpc-adapter.d.ts +9 -0
  506. package/node_modules/@xrkseek/server-http/dist/dsh-compat/im-rpc-adapter.d.ts.map +1 -0
  507. package/node_modules/@xrkseek/server-http/dist/dsh-compat/im-rpc-adapter.js +55 -0
  508. package/node_modules/@xrkseek/server-http/dist/dsh-compat/im-rpc-adapter.js.map +1 -0
  509. package/node_modules/@xrkseek/server-http/dist/dsh-compat/index.d.ts +37 -0
  510. package/node_modules/@xrkseek/server-http/dist/dsh-compat/index.d.ts.map +1 -0
  511. package/node_modules/@xrkseek/server-http/dist/dsh-compat/index.js +36 -0
  512. package/node_modules/@xrkseek/server-http/dist/dsh-compat/index.js.map +1 -0
  513. package/node_modules/@xrkseek/server-http/dist/dsh-compat/json-store.d.ts +5 -0
  514. package/node_modules/@xrkseek/server-http/dist/dsh-compat/json-store.d.ts.map +1 -0
  515. package/node_modules/@xrkseek/server-http/dist/dsh-compat/json-store.js +28 -0
  516. package/node_modules/@xrkseek/server-http/dist/dsh-compat/json-store.js.map +1 -0
  517. package/node_modules/@xrkseek/server-http/dist/dsh-compat/market-adapter.d.ts +7 -0
  518. package/node_modules/@xrkseek/server-http/dist/dsh-compat/market-adapter.d.ts.map +1 -0
  519. package/node_modules/@xrkseek/server-http/dist/dsh-compat/market-adapter.js +108 -0
  520. package/node_modules/@xrkseek/server-http/dist/dsh-compat/market-adapter.js.map +1 -0
  521. package/node_modules/@xrkseek/server-http/dist/dsh-compat/market.d.ts +7 -0
  522. package/node_modules/@xrkseek/server-http/dist/dsh-compat/market.d.ts.map +1 -0
  523. package/node_modules/@xrkseek/server-http/dist/dsh-compat/market.js +218 -0
  524. package/node_modules/@xrkseek/server-http/dist/dsh-compat/market.js.map +1 -0
  525. package/node_modules/@xrkseek/server-http/dist/dsh-compat/memento.d.ts +10 -0
  526. package/node_modules/@xrkseek/server-http/dist/dsh-compat/memento.d.ts.map +1 -0
  527. package/node_modules/@xrkseek/server-http/dist/dsh-compat/memento.js +81 -0
  528. package/node_modules/@xrkseek/server-http/dist/dsh-compat/memento.js.map +1 -0
  529. package/node_modules/@xrkseek/server-http/dist/dsh-compat/meta.d.ts +10 -0
  530. package/node_modules/@xrkseek/server-http/dist/dsh-compat/meta.d.ts.map +1 -0
  531. package/node_modules/@xrkseek/server-http/dist/dsh-compat/meta.js +15 -0
  532. package/node_modules/@xrkseek/server-http/dist/dsh-compat/meta.js.map +1 -0
  533. package/node_modules/@xrkseek/server-http/dist/dsh-compat/mnemon-adapter.d.ts +8 -0
  534. package/node_modules/@xrkseek/server-http/dist/dsh-compat/mnemon-adapter.d.ts.map +1 -0
  535. package/node_modules/@xrkseek/server-http/dist/dsh-compat/mnemon-adapter.js +83 -0
  536. package/node_modules/@xrkseek/server-http/dist/dsh-compat/mnemon-adapter.js.map +1 -0
  537. package/node_modules/@xrkseek/server-http/dist/dsh-compat/mnemon-shapes.d.ts +9 -0
  538. package/node_modules/@xrkseek/server-http/dist/dsh-compat/mnemon-shapes.d.ts.map +1 -0
  539. package/node_modules/@xrkseek/server-http/dist/dsh-compat/mnemon-shapes.js +144 -0
  540. package/node_modules/@xrkseek/server-http/dist/dsh-compat/mnemon-shapes.js.map +1 -0
  541. package/node_modules/@xrkseek/server-http/dist/dsh-compat/mnemon-store.d.ts +17 -0
  542. package/node_modules/@xrkseek/server-http/dist/dsh-compat/mnemon-store.d.ts.map +1 -0
  543. package/node_modules/@xrkseek/server-http/dist/dsh-compat/mnemon-store.js +52 -0
  544. package/node_modules/@xrkseek/server-http/dist/dsh-compat/mnemon-store.js.map +1 -0
  545. package/node_modules/@xrkseek/server-http/dist/dsh-compat/mnemon.d.ts +11 -0
  546. package/node_modules/@xrkseek/server-http/dist/dsh-compat/mnemon.d.ts.map +1 -0
  547. package/node_modules/@xrkseek/server-http/dist/dsh-compat/mnemon.js +221 -0
  548. package/node_modules/@xrkseek/server-http/dist/dsh-compat/mnemon.js.map +1 -0
  549. package/node_modules/@xrkseek/server-http/dist/dsh-compat/mobile-access.d.ts +22 -0
  550. package/node_modules/@xrkseek/server-http/dist/dsh-compat/mobile-access.d.ts.map +1 -0
  551. package/node_modules/@xrkseek/server-http/dist/dsh-compat/mobile-access.js +155 -0
  552. package/node_modules/@xrkseek/server-http/dist/dsh-compat/mobile-access.js.map +1 -0
  553. package/node_modules/@xrkseek/server-http/dist/dsh-compat/modlens.d.ts +14 -0
  554. package/node_modules/@xrkseek/server-http/dist/dsh-compat/modlens.d.ts.map +1 -0
  555. package/node_modules/@xrkseek/server-http/dist/dsh-compat/modlens.js +213 -0
  556. package/node_modules/@xrkseek/server-http/dist/dsh-compat/modlens.js.map +1 -0
  557. package/node_modules/@xrkseek/server-http/dist/dsh-compat/modsearch.d.ts +14 -0
  558. package/node_modules/@xrkseek/server-http/dist/dsh-compat/modsearch.d.ts.map +1 -0
  559. package/node_modules/@xrkseek/server-http/dist/dsh-compat/modsearch.js +200 -0
  560. package/node_modules/@xrkseek/server-http/dist/dsh-compat/modsearch.js.map +1 -0
  561. package/node_modules/@xrkseek/server-http/dist/dsh-compat/noema.d.ts +11 -0
  562. package/node_modules/@xrkseek/server-http/dist/dsh-compat/noema.d.ts.map +1 -0
  563. package/node_modules/@xrkseek/server-http/dist/dsh-compat/noema.js +200 -0
  564. package/node_modules/@xrkseek/server-http/dist/dsh-compat/noema.js.map +1 -0
  565. package/node_modules/@xrkseek/server-http/dist/dsh-compat/persisted-settings-store.d.ts +6 -0
  566. package/node_modules/@xrkseek/server-http/dist/dsh-compat/persisted-settings-store.d.ts.map +1 -0
  567. package/node_modules/@xrkseek/server-http/dist/dsh-compat/persisted-settings-store.js +47 -0
  568. package/node_modules/@xrkseek/server-http/dist/dsh-compat/persisted-settings-store.js.map +1 -0
  569. package/node_modules/@xrkseek/server-http/dist/dsh-compat/plugin-host-manifest.d.ts +15 -0
  570. package/node_modules/@xrkseek/server-http/dist/dsh-compat/plugin-host-manifest.d.ts.map +1 -0
  571. package/node_modules/@xrkseek/server-http/dist/dsh-compat/plugin-host-manifest.js +132 -0
  572. package/node_modules/@xrkseek/server-http/dist/dsh-compat/plugin-host-manifest.js.map +1 -0
  573. package/node_modules/@xrkseek/server-http/dist/dsh-compat/plugin-surface-adapter.d.ts +13 -0
  574. package/node_modules/@xrkseek/server-http/dist/dsh-compat/plugin-surface-adapter.d.ts.map +1 -0
  575. package/node_modules/@xrkseek/server-http/dist/dsh-compat/plugin-surface-adapter.js +336 -0
  576. package/node_modules/@xrkseek/server-http/dist/dsh-compat/plugin-surface-adapter.js.map +1 -0
  577. package/node_modules/@xrkseek/server-http/dist/dsh-compat/pocket.d.ts +10 -0
  578. package/node_modules/@xrkseek/server-http/dist/dsh-compat/pocket.d.ts.map +1 -0
  579. package/node_modules/@xrkseek/server-http/dist/dsh-compat/pocket.js +86 -0
  580. package/node_modules/@xrkseek/server-http/dist/dsh-compat/pocket.js.map +1 -0
  581. package/node_modules/@xrkseek/server-http/dist/dsh-compat/releases.d.ts +8 -0
  582. package/node_modules/@xrkseek/server-http/dist/dsh-compat/releases.d.ts.map +1 -0
  583. package/node_modules/@xrkseek/server-http/dist/dsh-compat/releases.js +34 -0
  584. package/node_modules/@xrkseek/server-http/dist/dsh-compat/releases.js.map +1 -0
  585. package/node_modules/@xrkseek/server-http/dist/dsh-compat/settings-defaults.d.ts +4 -0
  586. package/node_modules/@xrkseek/server-http/dist/dsh-compat/settings-defaults.d.ts.map +1 -0
  587. package/node_modules/@xrkseek/server-http/dist/dsh-compat/settings-defaults.js +170 -0
  588. package/node_modules/@xrkseek/server-http/dist/dsh-compat/settings-defaults.js.map +1 -0
  589. package/node_modules/@xrkseek/server-http/dist/dsh-compat/settings-store.d.ts +33 -0
  590. package/node_modules/@xrkseek/server-http/dist/dsh-compat/settings-store.d.ts.map +1 -0
  591. package/node_modules/@xrkseek/server-http/dist/dsh-compat/settings-store.js +108 -0
  592. package/node_modules/@xrkseek/server-http/dist/dsh-compat/settings-store.js.map +1 -0
  593. package/node_modules/@xrkseek/server-http/dist/dsh-compat/shared-registry.d.ts +10 -0
  594. package/node_modules/@xrkseek/server-http/dist/dsh-compat/shared-registry.d.ts.map +1 -0
  595. package/node_modules/@xrkseek/server-http/dist/dsh-compat/shared-registry.js +38 -0
  596. package/node_modules/@xrkseek/server-http/dist/dsh-compat/shared-registry.js.map +1 -0
  597. package/node_modules/@xrkseek/server-http/dist/dsh-compat/sidebar-adapter.d.ts +10 -0
  598. package/node_modules/@xrkseek/server-http/dist/dsh-compat/sidebar-adapter.d.ts.map +1 -0
  599. package/node_modules/@xrkseek/server-http/dist/dsh-compat/sidebar-adapter.js +358 -0
  600. package/node_modules/@xrkseek/server-http/dist/dsh-compat/sidebar-adapter.js.map +1 -0
  601. package/node_modules/@xrkseek/server-http/dist/dsh-compat/sidebar-git.d.ts +25 -0
  602. package/node_modules/@xrkseek/server-http/dist/dsh-compat/sidebar-git.d.ts.map +1 -0
  603. package/node_modules/@xrkseek/server-http/dist/dsh-compat/sidebar-git.js +78 -0
  604. package/node_modules/@xrkseek/server-http/dist/dsh-compat/sidebar-git.js.map +1 -0
  605. package/node_modules/@xrkseek/server-http/dist/dsh-compat/sidebar-prefs-store.d.ts +9 -0
  606. package/node_modules/@xrkseek/server-http/dist/dsh-compat/sidebar-prefs-store.d.ts.map +1 -0
  607. package/node_modules/@xrkseek/server-http/dist/dsh-compat/sidebar-prefs-store.js +56 -0
  608. package/node_modules/@xrkseek/server-http/dist/dsh-compat/sidebar-prefs-store.js.map +1 -0
  609. package/node_modules/@xrkseek/server-http/dist/dsh-compat/skin-market.d.ts +11 -0
  610. package/node_modules/@xrkseek/server-http/dist/dsh-compat/skin-market.d.ts.map +1 -0
  611. package/node_modules/@xrkseek/server-http/dist/dsh-compat/skin-market.js +106 -0
  612. package/node_modules/@xrkseek/server-http/dist/dsh-compat/skin-market.js.map +1 -0
  613. package/node_modules/@xrkseek/server-http/dist/dsh-compat/surface-registry.d.ts +18 -0
  614. package/node_modules/@xrkseek/server-http/dist/dsh-compat/surface-registry.d.ts.map +1 -0
  615. package/node_modules/@xrkseek/server-http/dist/dsh-compat/surface-registry.js +240 -0
  616. package/node_modules/@xrkseek/server-http/dist/dsh-compat/surface-registry.js.map +1 -0
  617. package/node_modules/@xrkseek/server-http/dist/dsh-compat/surfaces.d.ts +5 -0
  618. package/node_modules/@xrkseek/server-http/dist/dsh-compat/surfaces.d.ts.map +1 -0
  619. package/node_modules/@xrkseek/server-http/dist/dsh-compat/surfaces.js +78 -0
  620. package/node_modules/@xrkseek/server-http/dist/dsh-compat/surfaces.js.map +1 -0
  621. package/node_modules/@xrkseek/server-http/dist/dsh-compat/tokenledger.d.ts +42 -0
  622. package/node_modules/@xrkseek/server-http/dist/dsh-compat/tokenledger.d.ts.map +1 -0
  623. package/node_modules/@xrkseek/server-http/dist/dsh-compat/tokenledger.js +117 -0
  624. package/node_modules/@xrkseek/server-http/dist/dsh-compat/tokenledger.js.map +1 -0
  625. package/node_modules/@xrkseek/server-http/dist/dsh-compat/tongflow-node-runtime.d.ts +11 -0
  626. package/node_modules/@xrkseek/server-http/dist/dsh-compat/tongflow-node-runtime.d.ts.map +1 -0
  627. package/node_modules/@xrkseek/server-http/dist/dsh-compat/tongflow-node-runtime.js +111 -0
  628. package/node_modules/@xrkseek/server-http/dist/dsh-compat/tongflow-node-runtime.js.map +1 -0
  629. package/node_modules/@xrkseek/server-http/dist/dsh-compat/tongflow.d.ts +16 -0
  630. package/node_modules/@xrkseek/server-http/dist/dsh-compat/tongflow.d.ts.map +1 -0
  631. package/node_modules/@xrkseek/server-http/dist/dsh-compat/tongflow.js +455 -0
  632. package/node_modules/@xrkseek/server-http/dist/dsh-compat/tongflow.js.map +1 -0
  633. package/node_modules/@xrkseek/server-http/dist/dsh-compat/turn-rewind-store.d.ts +26 -0
  634. package/node_modules/@xrkseek/server-http/dist/dsh-compat/turn-rewind-store.d.ts.map +1 -0
  635. package/node_modules/@xrkseek/server-http/dist/dsh-compat/turn-rewind-store.js +22 -0
  636. package/node_modules/@xrkseek/server-http/dist/dsh-compat/turn-rewind-store.js.map +1 -0
  637. package/node_modules/@xrkseek/server-http/dist/dsh-compat/turn-rewind-workspace.d.ts +12 -0
  638. package/node_modules/@xrkseek/server-http/dist/dsh-compat/turn-rewind-workspace.d.ts.map +1 -0
  639. package/node_modules/@xrkseek/server-http/dist/dsh-compat/turn-rewind-workspace.js +123 -0
  640. package/node_modules/@xrkseek/server-http/dist/dsh-compat/turn-rewind-workspace.js.map +1 -0
  641. package/node_modules/@xrkseek/server-http/dist/dsh-compat/turn-rewind.d.ts +16 -0
  642. package/node_modules/@xrkseek/server-http/dist/dsh-compat/turn-rewind.d.ts.map +1 -0
  643. package/node_modules/@xrkseek/server-http/dist/dsh-compat/turn-rewind.js +99 -0
  644. package/node_modules/@xrkseek/server-http/dist/dsh-compat/turn-rewind.js.map +1 -0
  645. package/node_modules/@xrkseek/server-http/dist/dsh-compat/underlying/contracts/wallet-port.d.ts +106 -0
  646. package/node_modules/@xrkseek/server-http/dist/dsh-compat/underlying/contracts/wallet-port.d.ts.map +1 -0
  647. package/node_modules/@xrkseek/server-http/dist/dsh-compat/underlying/contracts/wallet-port.js +6 -0
  648. package/node_modules/@xrkseek/server-http/dist/dsh-compat/underlying/contracts/wallet-port.js.map +1 -0
  649. package/node_modules/@xrkseek/server-http/dist/dsh-compat/underlying/doc-store.d.ts +14 -0
  650. package/node_modules/@xrkseek/server-http/dist/dsh-compat/underlying/doc-store.d.ts.map +1 -0
  651. package/node_modules/@xrkseek/server-http/dist/dsh-compat/underlying/doc-store.js +21 -0
  652. package/node_modules/@xrkseek/server-http/dist/dsh-compat/underlying/doc-store.js.map +1 -0
  653. package/node_modules/@xrkseek/server-http/dist/dsh-compat/underlying/http-kit.d.ts +9 -0
  654. package/node_modules/@xrkseek/server-http/dist/dsh-compat/underlying/http-kit.d.ts.map +1 -0
  655. package/node_modules/@xrkseek/server-http/dist/dsh-compat/underlying/http-kit.js +22 -0
  656. package/node_modules/@xrkseek/server-http/dist/dsh-compat/underlying/http-kit.js.map +1 -0
  657. package/node_modules/@xrkseek/server-http/dist/dsh-compat/underlying/index.d.ts +22 -0
  658. package/node_modules/@xrkseek/server-http/dist/dsh-compat/underlying/index.d.ts.map +1 -0
  659. package/node_modules/@xrkseek/server-http/dist/dsh-compat/underlying/index.js +13 -0
  660. package/node_modules/@xrkseek/server-http/dist/dsh-compat/underlying/index.js.map +1 -0
  661. package/node_modules/@xrkseek/server-http/dist/dsh-compat/underlying/wallet-service.d.ts +21 -0
  662. package/node_modules/@xrkseek/server-http/dist/dsh-compat/underlying/wallet-service.d.ts.map +1 -0
  663. package/node_modules/@xrkseek/server-http/dist/dsh-compat/underlying/wallet-service.js +190 -0
  664. package/node_modules/@xrkseek/server-http/dist/dsh-compat/underlying/wallet-service.js.map +1 -0
  665. package/node_modules/@xrkseek/server-http/dist/dsh-compat/undo.d.ts +10 -0
  666. package/node_modules/@xrkseek/server-http/dist/dsh-compat/undo.d.ts.map +1 -0
  667. package/node_modules/@xrkseek/server-http/dist/dsh-compat/undo.js +438 -0
  668. package/node_modules/@xrkseek/server-http/dist/dsh-compat/undo.js.map +1 -0
  669. package/node_modules/@xrkseek/server-http/dist/dsh-compat/usage-stats.d.ts +8 -0
  670. package/node_modules/@xrkseek/server-http/dist/dsh-compat/usage-stats.d.ts.map +1 -0
  671. package/node_modules/@xrkseek/server-http/dist/dsh-compat/usage-stats.js +69 -0
  672. package/node_modules/@xrkseek/server-http/dist/dsh-compat/usage-stats.js.map +1 -0
  673. package/node_modules/@xrkseek/server-http/dist/dsh-compat/vision-adapter.d.ts +6 -0
  674. package/node_modules/@xrkseek/server-http/dist/dsh-compat/vision-adapter.d.ts.map +1 -0
  675. package/node_modules/@xrkseek/server-http/dist/dsh-compat/vision-adapter.js +62 -0
  676. package/node_modules/@xrkseek/server-http/dist/dsh-compat/vision-adapter.js.map +1 -0
  677. package/node_modules/@xrkseek/server-http/dist/dsh-compat/vision-defaults.d.ts +5 -0
  678. package/node_modules/@xrkseek/server-http/dist/dsh-compat/vision-defaults.d.ts.map +1 -0
  679. package/node_modules/@xrkseek/server-http/dist/dsh-compat/vision-defaults.js +17 -0
  680. package/node_modules/@xrkseek/server-http/dist/dsh-compat/vision-defaults.js.map +1 -0
  681. package/node_modules/@xrkseek/server-http/dist/dsh-compat/vision-router-adapter.d.ts +7 -0
  682. package/node_modules/@xrkseek/server-http/dist/dsh-compat/vision-router-adapter.d.ts.map +1 -0
  683. package/node_modules/@xrkseek/server-http/dist/dsh-compat/vision-router-adapter.js +67 -0
  684. package/node_modules/@xrkseek/server-http/dist/dsh-compat/vision-router-adapter.js.map +1 -0
  685. package/node_modules/@xrkseek/server-http/dist/dsh-compat/vision.d.ts +12 -0
  686. package/node_modules/@xrkseek/server-http/dist/dsh-compat/vision.d.ts.map +1 -0
  687. package/node_modules/@xrkseek/server-http/dist/dsh-compat/vision.js +198 -0
  688. package/node_modules/@xrkseek/server-http/dist/dsh-compat/vision.js.map +1 -0
  689. package/node_modules/@xrkseek/server-http/dist/dsh-compat/wallet.d.ts +15 -0
  690. package/node_modules/@xrkseek/server-http/dist/dsh-compat/wallet.d.ts.map +1 -0
  691. package/node_modules/@xrkseek/server-http/dist/dsh-compat/wallet.js +111 -0
  692. package/node_modules/@xrkseek/server-http/dist/dsh-compat/wallet.js.map +1 -0
  693. package/node_modules/@xrkseek/server-http/dist/dsh-compat/wallpaper.d.ts +9 -0
  694. package/node_modules/@xrkseek/server-http/dist/dsh-compat/wallpaper.d.ts.map +1 -0
  695. package/node_modules/@xrkseek/server-http/dist/dsh-compat/wallpaper.js +161 -0
  696. package/node_modules/@xrkseek/server-http/dist/dsh-compat/wallpaper.js.map +1 -0
  697. package/node_modules/@xrkseek/server-http/dist/dsh-compat/wire/settings-provider.d.ts +6 -0
  698. package/node_modules/@xrkseek/server-http/dist/dsh-compat/wire/settings-provider.d.ts.map +1 -0
  699. package/node_modules/@xrkseek/server-http/dist/dsh-compat/wire/settings-provider.js +31 -0
  700. package/node_modules/@xrkseek/server-http/dist/dsh-compat/wire/settings-provider.js.map +1 -0
  701. package/node_modules/@xrkseek/server-http/dist/dsh-compat/wire/stub-handlers.d.ts +9 -0
  702. package/node_modules/@xrkseek/server-http/dist/dsh-compat/wire/stub-handlers.d.ts.map +1 -0
  703. package/node_modules/@xrkseek/server-http/dist/dsh-compat/wire/stub-handlers.js +103 -0
  704. package/node_modules/@xrkseek/server-http/dist/dsh-compat/wire/stub-handlers.js.map +1 -0
  705. package/node_modules/@xrkseek/server-http/dist/dsh-compat/xrk-host-apply.d.ts +49 -0
  706. package/node_modules/@xrkseek/server-http/dist/dsh-compat/xrk-host-apply.d.ts.map +1 -0
  707. package/node_modules/@xrkseek/server-http/dist/dsh-compat/xrk-host-apply.js +190 -0
  708. package/node_modules/@xrkseek/server-http/dist/dsh-compat/xrk-host-apply.js.map +1 -0
  709. package/node_modules/@xrkseek/server-http/dist/dsh-compat/xrk-json-store.d.ts +9 -0
  710. package/node_modules/@xrkseek/server-http/dist/dsh-compat/xrk-json-store.d.ts.map +1 -0
  711. package/node_modules/@xrkseek/server-http/dist/dsh-compat/xrk-json-store.js +44 -0
  712. package/node_modules/@xrkseek/server-http/dist/dsh-compat/xrk-json-store.js.map +1 -0
  713. package/node_modules/@xrkseek/server-http/dist/dsh-compat.d.ts +6 -0
  714. package/node_modules/@xrkseek/server-http/dist/dsh-compat.d.ts.map +1 -0
  715. package/node_modules/@xrkseek/server-http/dist/dsh-compat.js +6 -0
  716. package/node_modules/@xrkseek/server-http/dist/dsh-compat.js.map +1 -0
  717. package/node_modules/@xrkseek/server-http/dist/host-wire.d.ts +14 -0
  718. package/node_modules/@xrkseek/server-http/dist/host-wire.d.ts.map +1 -0
  719. package/node_modules/@xrkseek/server-http/dist/host-wire.js +15 -0
  720. package/node_modules/@xrkseek/server-http/dist/host-wire.js.map +1 -0
  721. package/node_modules/@xrkseek/server-http/dist/http-json.d.ts +12 -0
  722. package/node_modules/@xrkseek/server-http/dist/http-json.d.ts.map +1 -0
  723. package/node_modules/@xrkseek/server-http/dist/http-json.js +40 -0
  724. package/node_modules/@xrkseek/server-http/dist/http-json.js.map +1 -0
  725. package/node_modules/@xrkseek/server-http/dist/index.d.ts +12 -1
  726. package/node_modules/@xrkseek/server-http/dist/index.d.ts.map +1 -1
  727. package/node_modules/@xrkseek/server-http/dist/index.js +12 -1
  728. package/node_modules/@xrkseek/server-http/dist/index.js.map +1 -1
  729. package/node_modules/@xrkseek/server-http/dist/public-routes.d.ts +19 -0
  730. package/node_modules/@xrkseek/server-http/dist/public-routes.d.ts.map +1 -0
  731. package/node_modules/@xrkseek/server-http/dist/public-routes.js +34 -0
  732. package/node_modules/@xrkseek/server-http/dist/public-routes.js.map +1 -0
  733. package/node_modules/@xrkseek/server-http/dist/xrk/plugin-mutate.d.ts +13 -0
  734. package/node_modules/@xrkseek/server-http/dist/xrk/plugin-mutate.d.ts.map +1 -0
  735. package/node_modules/@xrkseek/server-http/dist/xrk/plugin-mutate.js +58 -0
  736. package/node_modules/@xrkseek/server-http/dist/xrk/plugin-mutate.js.map +1 -0
  737. package/node_modules/@xrkseek/server-http/dist/xrk/plugin-routes.d.ts +16 -0
  738. package/node_modules/@xrkseek/server-http/dist/xrk/plugin-routes.d.ts.map +1 -0
  739. package/node_modules/@xrkseek/server-http/dist/xrk/plugin-routes.js +49 -0
  740. package/node_modules/@xrkseek/server-http/dist/xrk/plugin-routes.js.map +1 -0
  741. package/node_modules/@xrkseek/server-http/dist/xrk/plugin-services.d.ts +35 -0
  742. package/node_modules/@xrkseek/server-http/dist/xrk/plugin-services.d.ts.map +1 -0
  743. package/node_modules/@xrkseek/server-http/dist/xrk/plugin-services.js +103 -0
  744. package/node_modules/@xrkseek/server-http/dist/xrk/plugin-services.js.map +1 -0
  745. package/node_modules/@xrkseek/server-http/package.json +2 -1
  746. package/node_modules/@xrkseek/server-loader/dist/host.d.ts +6 -0
  747. package/node_modules/@xrkseek/server-loader/dist/host.d.ts.map +1 -0
  748. package/node_modules/@xrkseek/server-loader/dist/host.js +11 -0
  749. package/node_modules/@xrkseek/server-loader/dist/host.js.map +1 -0
  750. package/node_modules/@xrkseek/server-loader/dist/index.d.ts +2 -1
  751. package/node_modules/@xrkseek/server-loader/dist/index.d.ts.map +1 -1
  752. package/node_modules/@xrkseek/server-loader/dist/index.js +1 -0
  753. package/node_modules/@xrkseek/server-loader/dist/index.js.map +1 -1
  754. package/node_modules/@xrkseek/server-loader/dist/kinds.d.ts +5 -0
  755. package/node_modules/@xrkseek/server-loader/dist/kinds.d.ts.map +1 -1
  756. package/node_modules/@xrkseek/server-loader/dist/kinds.js +5 -0
  757. package/node_modules/@xrkseek/server-loader/dist/kinds.js.map +1 -1
  758. package/node_modules/@xrkseek/server-loader/dist/load.d.ts.map +1 -1
  759. package/node_modules/@xrkseek/server-loader/dist/load.js +5 -0
  760. package/node_modules/@xrkseek/server-loader/dist/load.js.map +1 -1
  761. package/node_modules/@xrkseek/server-loader/dist/types.d.ts +40 -0
  762. package/node_modules/@xrkseek/server-loader/dist/types.d.ts.map +1 -1
  763. package/node_modules/@xrkseek/xrk-file-reference/README.i18n.yaml +6 -0
  764. package/node_modules/@xrkseek/xrk-file-reference/README.md +22 -0
  765. package/node_modules/@xrkseek/xrk-file-reference/README.zh.md +22 -0
  766. package/node_modules/@xrkseek/xrk-file-reference/dist/grammar.d.ts +33 -0
  767. package/node_modules/@xrkseek/xrk-file-reference/dist/grammar.d.ts.map +1 -0
  768. package/node_modules/@xrkseek/xrk-file-reference/dist/grammar.js +43 -0
  769. package/node_modules/@xrkseek/xrk-file-reference/dist/grammar.js.map +1 -0
  770. package/node_modules/@xrkseek/xrk-file-reference/dist/types.d.ts +13 -0
  771. package/node_modules/@xrkseek/xrk-file-reference/dist/types.d.ts.map +1 -0
  772. package/node_modules/@xrkseek/xrk-file-reference/dist/types.js +7 -0
  773. package/node_modules/@xrkseek/xrk-file-reference/dist/types.js.map +1 -0
  774. package/node_modules/@xrkseek/xrk-file-reference/package.json +31 -0
  775. package/node_modules/@xrkseek/xrk-file-reference-local/README.i18n.yaml +6 -0
  776. package/node_modules/@xrkseek/xrk-file-reference-local/README.md +45 -0
  777. package/node_modules/@xrkseek/xrk-file-reference-local/README.zh.md +45 -0
  778. package/node_modules/@xrkseek/xrk-file-reference-local/dist/search.d.ts +52 -0
  779. package/node_modules/@xrkseek/xrk-file-reference-local/dist/search.d.ts.map +1 -0
  780. package/node_modules/@xrkseek/xrk-file-reference-local/dist/search.js +258 -0
  781. package/node_modules/@xrkseek/xrk-file-reference-local/dist/search.js.map +1 -0
  782. package/node_modules/@xrkseek/xrk-file-reference-local/package.json +29 -0
  783. package/node_modules/@xrkseek/xrk-session-reference/README.i18n.yaml +6 -0
  784. package/node_modules/@xrkseek/xrk-session-reference/README.md +50 -0
  785. package/node_modules/@xrkseek/xrk-session-reference/README.zh.md +50 -0
  786. package/node_modules/@xrkseek/xrk-session-reference/dist/config.d.ts +25 -0
  787. package/node_modules/@xrkseek/xrk-session-reference/dist/config.d.ts.map +1 -0
  788. package/node_modules/@xrkseek/xrk-session-reference/dist/config.js +18 -0
  789. package/node_modules/@xrkseek/xrk-session-reference/dist/config.js.map +1 -0
  790. package/node_modules/@xrkseek/xrk-session-reference/dist/types.d.ts +70 -0
  791. package/node_modules/@xrkseek/xrk-session-reference/dist/types.d.ts.map +1 -0
  792. package/node_modules/@xrkseek/xrk-session-reference/dist/types.js +11 -0
  793. package/node_modules/@xrkseek/xrk-session-reference/dist/types.js.map +1 -0
  794. package/node_modules/@xrkseek/xrk-session-reference/dist/uri.d.ts +40 -0
  795. package/node_modules/@xrkseek/xrk-session-reference/dist/uri.d.ts.map +1 -0
  796. package/node_modules/@xrkseek/xrk-session-reference/dist/uri.js +81 -0
  797. package/node_modules/@xrkseek/xrk-session-reference/dist/uri.js.map +1 -0
  798. package/node_modules/@xrkseek/xrk-session-reference/package.json +39 -0
  799. package/node_modules/detect-libc/LICENSE +201 -0
  800. package/node_modules/detect-libc/README.md +163 -0
  801. package/node_modules/detect-libc/index.d.ts +14 -0
  802. package/node_modules/detect-libc/lib/detect-libc.js +313 -0
  803. package/node_modules/detect-libc/lib/elf.js +39 -0
  804. package/node_modules/detect-libc/lib/filesystem.js +51 -0
  805. package/node_modules/detect-libc/lib/process.js +24 -0
  806. package/node_modules/detect-libc/package.json +44 -0
  807. package/node_modules/semver/LICENSE +15 -0
  808. package/node_modules/semver/README.md +680 -0
  809. package/node_modules/semver/bin/semver.js +195 -0
  810. package/node_modules/semver/classes/comparator.js +143 -0
  811. package/node_modules/semver/classes/index.js +7 -0
  812. package/node_modules/semver/classes/range.js +577 -0
  813. package/node_modules/semver/classes/semver.js +350 -0
  814. package/node_modules/semver/functions/clean.js +8 -0
  815. package/node_modules/semver/functions/cmp.js +54 -0
  816. package/node_modules/semver/functions/coerce.js +62 -0
  817. package/node_modules/semver/functions/compare-build.js +9 -0
  818. package/node_modules/semver/functions/compare-loose.js +5 -0
  819. package/node_modules/semver/functions/compare.js +7 -0
  820. package/node_modules/semver/functions/diff.js +60 -0
  821. package/node_modules/semver/functions/eq.js +5 -0
  822. package/node_modules/semver/functions/gt.js +5 -0
  823. package/node_modules/semver/functions/gte.js +5 -0
  824. package/node_modules/semver/functions/inc.js +21 -0
  825. package/node_modules/semver/functions/lt.js +5 -0
  826. package/node_modules/semver/functions/lte.js +5 -0
  827. package/node_modules/semver/functions/major.js +5 -0
  828. package/node_modules/semver/functions/minor.js +5 -0
  829. package/node_modules/semver/functions/neq.js +5 -0
  830. package/node_modules/semver/functions/parse.js +18 -0
  831. package/node_modules/semver/functions/patch.js +5 -0
  832. package/node_modules/semver/functions/prerelease.js +8 -0
  833. package/node_modules/semver/functions/rcompare.js +5 -0
  834. package/node_modules/semver/functions/rsort.js +5 -0
  835. package/node_modules/semver/functions/satisfies.js +12 -0
  836. package/node_modules/semver/functions/sort.js +5 -0
  837. package/node_modules/semver/functions/truncate.js +48 -0
  838. package/node_modules/semver/functions/valid.js +8 -0
  839. package/node_modules/semver/index.js +93 -0
  840. package/node_modules/semver/internal/constants.js +37 -0
  841. package/node_modules/semver/internal/debug.js +11 -0
  842. package/node_modules/semver/internal/identifiers.js +29 -0
  843. package/node_modules/semver/internal/lrucache.js +42 -0
  844. package/node_modules/semver/internal/parse-options.js +17 -0
  845. package/node_modules/semver/internal/re.js +223 -0
  846. package/node_modules/semver/package.json +78 -0
  847. package/node_modules/semver/preload.js +4 -0
  848. package/node_modules/semver/range.bnf +17 -0
  849. package/node_modules/semver/ranges/gtr.js +6 -0
  850. package/node_modules/semver/ranges/intersects.js +9 -0
  851. package/node_modules/semver/ranges/ltr.js +6 -0
  852. package/node_modules/semver/ranges/max-satisfying.js +27 -0
  853. package/node_modules/semver/ranges/min-satisfying.js +26 -0
  854. package/node_modules/semver/ranges/min-version.js +63 -0
  855. package/node_modules/semver/ranges/outside.js +82 -0
  856. package/node_modules/semver/ranges/simplify.js +49 -0
  857. package/node_modules/semver/ranges/subset.js +249 -0
  858. package/node_modules/semver/ranges/to-comparators.js +10 -0
  859. package/node_modules/semver/ranges/valid.js +13 -0
  860. package/node_modules/sharp/LICENSE +191 -0
  861. package/node_modules/sharp/README.md +112 -0
  862. package/node_modules/sharp/dist/channel.cjs +177 -0
  863. package/node_modules/sharp/dist/channel.mjs +177 -0
  864. package/node_modules/sharp/dist/colour.cjs +199 -0
  865. package/node_modules/sharp/dist/colour.mjs +199 -0
  866. package/node_modules/sharp/dist/composite.cjs +213 -0
  867. package/node_modules/sharp/dist/composite.mjs +213 -0
  868. package/node_modules/sharp/dist/constructor.cjs +511 -0
  869. package/node_modules/sharp/dist/constructor.mjs +511 -0
  870. package/node_modules/sharp/dist/index.cjs +25 -0
  871. package/node_modules/sharp/dist/index.d.cts +1999 -0
  872. package/node_modules/sharp/dist/index.d.mts +2046 -0
  873. package/node_modules/sharp/dist/index.mjs +25 -0
  874. package/node_modules/sharp/dist/input.cjs +814 -0
  875. package/node_modules/sharp/dist/input.mjs +814 -0
  876. package/node_modules/sharp/dist/is.cjs +143 -0
  877. package/node_modules/sharp/dist/is.mjs +143 -0
  878. package/node_modules/sharp/dist/libvips.cjs +212 -0
  879. package/node_modules/sharp/dist/libvips.mjs +212 -0
  880. package/node_modules/sharp/dist/operation.cjs +998 -0
  881. package/node_modules/sharp/dist/operation.mjs +998 -0
  882. package/node_modules/sharp/dist/output.cjs +1788 -0
  883. package/node_modules/sharp/dist/output.mjs +1788 -0
  884. package/node_modules/sharp/dist/resize.cjs +617 -0
  885. package/node_modules/sharp/dist/resize.mjs +617 -0
  886. package/node_modules/sharp/dist/sharp.cjs +174 -0
  887. package/node_modules/sharp/dist/sharp.mjs +174 -0
  888. package/node_modules/sharp/dist/utility.cjs +301 -0
  889. package/node_modules/sharp/dist/utility.mjs +301 -0
  890. package/node_modules/sharp/install/build.js +38 -0
  891. package/node_modules/sharp/lib/index.d.ts +1999 -0
  892. package/node_modules/sharp/package.json +227 -0
  893. package/node_modules/sharp/src/binding.gyp +303 -0
  894. package/node_modules/sharp/src/common.cc +1183 -0
  895. package/node_modules/sharp/src/common.h +421 -0
  896. package/node_modules/sharp/src/metadata.cc +404 -0
  897. package/node_modules/sharp/src/metadata.h +95 -0
  898. package/node_modules/sharp/src/operations.cc +516 -0
  899. package/node_modules/sharp/src/operations.h +137 -0
  900. package/node_modules/sharp/src/pipeline.cc +1948 -0
  901. package/node_modules/sharp/src/pipeline.h +422 -0
  902. package/node_modules/sharp/src/sharp.cc +43 -0
  903. package/node_modules/sharp/src/stats.cc +186 -0
  904. package/node_modules/sharp/src/stats.h +62 -0
  905. package/node_modules/sharp/src/utilities.cc +289 -0
  906. package/node_modules/sharp/src/utilities.h +22 -0
  907. package/node_modules/undici-types/LICENSE +21 -0
  908. package/node_modules/undici-types/README.md +6 -0
  909. package/node_modules/undici-types/agent.d.ts +32 -0
  910. package/node_modules/undici-types/api.d.ts +43 -0
  911. package/node_modules/undici-types/balanced-pool.d.ts +30 -0
  912. package/node_modules/undici-types/cache-interceptor.d.ts +173 -0
  913. package/node_modules/undici-types/cache.d.ts +36 -0
  914. package/node_modules/undici-types/client-stats.d.ts +15 -0
  915. package/node_modules/undici-types/client.d.ts +108 -0
  916. package/node_modules/undici-types/connector.d.ts +34 -0
  917. package/node_modules/undici-types/content-type.d.ts +21 -0
  918. package/node_modules/undici-types/cookies.d.ts +30 -0
  919. package/node_modules/undici-types/diagnostics-channel.d.ts +74 -0
  920. package/node_modules/undici-types/dispatcher.d.ts +276 -0
  921. package/node_modules/undici-types/env-http-proxy-agent.d.ts +22 -0
  922. package/node_modules/undici-types/errors.d.ts +161 -0
  923. package/node_modules/undici-types/eventsource.d.ts +66 -0
  924. package/node_modules/undici-types/fetch.d.ts +211 -0
  925. package/node_modules/undici-types/formdata.d.ts +108 -0
  926. package/node_modules/undici-types/global-dispatcher.d.ts +9 -0
  927. package/node_modules/undici-types/global-origin.d.ts +7 -0
  928. package/node_modules/undici-types/h2c-client.d.ts +73 -0
  929. package/node_modules/undici-types/handlers.d.ts +15 -0
  930. package/node_modules/undici-types/header.d.ts +160 -0
  931. package/node_modules/undici-types/index.d.ts +88 -0
  932. package/node_modules/undici-types/interceptors.d.ts +73 -0
  933. package/node_modules/undici-types/mock-agent.d.ts +68 -0
  934. package/node_modules/undici-types/mock-call-history.d.ts +111 -0
  935. package/node_modules/undici-types/mock-client.d.ts +27 -0
  936. package/node_modules/undici-types/mock-errors.d.ts +12 -0
  937. package/node_modules/undici-types/mock-interceptor.d.ts +94 -0
  938. package/node_modules/undici-types/mock-pool.d.ts +27 -0
  939. package/node_modules/undici-types/package.json +55 -0
  940. package/node_modules/undici-types/patch.d.ts +29 -0
  941. package/node_modules/undici-types/pool-stats.d.ts +19 -0
  942. package/node_modules/undici-types/pool.d.ts +41 -0
  943. package/node_modules/undici-types/proxy-agent.d.ts +29 -0
  944. package/node_modules/undici-types/readable.d.ts +68 -0
  945. package/node_modules/undici-types/retry-agent.d.ts +8 -0
  946. package/node_modules/undici-types/retry-handler.d.ts +125 -0
  947. package/node_modules/undici-types/round-robin-pool.d.ts +41 -0
  948. package/node_modules/undici-types/snapshot-agent.d.ts +109 -0
  949. package/node_modules/undici-types/util.d.ts +18 -0
  950. package/node_modules/undici-types/utility.d.ts +7 -0
  951. package/node_modules/undici-types/webidl.d.ts +341 -0
  952. package/node_modules/undici-types/websocket.d.ts +186 -0
  953. package/package.json +23 -1
  954. package/product-web/assets/{index-CSGf6Qzd.css → index-C0u-TtQQ.css} +1 -1
  955. package/product-web/assets/index-CHKZdZNt.js +112 -0
  956. package/product-web/assets/index-CHKZdZNt.js.map +1 -0
  957. package/product-web/assets/langs/{php-DY2VakOf.js → php-9bx0az3O.js} +2 -2
  958. package/product-web/assets/langs/{php-DY2VakOf.js.map → php-9bx0az3O.js.map} +1 -1
  959. package/product-web/assets/langs/{ruby-hwtoiFmS.js → ruby-HDLHRjSL.js} +2 -2
  960. package/product-web/assets/langs/{ruby-hwtoiFmS.js.map → ruby-HDLHRjSL.js.map} +1 -1
  961. package/product-web/assets/{vendor-CldRVjca.js → vendor-CeMKrCZm.js} +36 -35
  962. package/product-web/assets/vendor-CeMKrCZm.js.map +1 -0
  963. package/product-web/boot.json +20 -1
  964. package/product-web/index.html +3 -3
  965. package/product-web/plugins/@xrkseek/client-connection/client.js +7 -164
  966. package/product-web/plugins/@xrkseek/client-locale/client.js +3 -3
  967. package/product-web/plugins/@xrkseek/client-modules/client.js +83 -12
  968. package/product-web/plugins/@xrkseek/client-runtime/client.js +8 -56
  969. package/product-web/plugins/@xrkseek/client-ui-agent-preset/client.js +34 -34
  970. package/product-web/plugins/@xrkseek/client-ui-attachment/client.js +782 -0
  971. package/product-web/plugins/@xrkseek/client-ui-commands/client.js +7 -7
  972. package/product-web/plugins/@xrkseek/client-ui-conversation/client.js +967 -563
  973. package/product-web/plugins/@xrkseek/client-ui-deliverables/client.js +4 -4
  974. package/product-web/plugins/@xrkseek/client-ui-directory-picker-browse/client.js +27 -27
  975. package/product-web/plugins/@xrkseek/client-ui-goal/client.js +7 -7
  976. package/product-web/plugins/@xrkseek/client-ui-input-trigger/client.js +82 -26
  977. package/product-web/plugins/@xrkseek/client-ui-jobs/client.js +8 -8
  978. package/product-web/plugins/@xrkseek/client-ui-layout/client.js +2 -2
  979. package/product-web/plugins/@xrkseek/client-ui-message-feedback/client.js +4 -4
  980. package/product-web/plugins/@xrkseek/client-ui-model-selection/client.js +18 -18
  981. package/product-web/plugins/@xrkseek/client-ui-permission-presets/client.js +2 -2
  982. package/product-web/plugins/@xrkseek/client-ui-plan/client.js +1 -1
  983. package/product-web/plugins/@xrkseek/client-ui-reference/client.js +148 -0
  984. package/product-web/plugins/@xrkseek/client-ui-settings-general/client.js +13 -13
  985. package/product-web/plugins/@xrkseek/client-ui-settings-models/client.js +58 -58
  986. package/product-web/plugins/@xrkseek/client-ui-settings-plugin-inventory/client.js +10 -10
  987. package/product-web/plugins/@xrkseek/client-ui-settings-plugins/client.js +42 -42
  988. package/product-web/plugins/@xrkseek/client-ui-sidebar/client.js +13 -13
  989. package/product-web/plugins/@xrkseek/client-ui-skill/client.js +11 -11
  990. package/product-web/plugins/@xrkseek/client-ui-subagent/client.js +289 -157
  991. package/product-web/plugins/@xrkseek/client-ui-theme/client.js +1 -1
  992. package/product-web/plugins/@xrkseek/client-ui-tool/client.js +37 -37
  993. package/product-web/plugins/@xrkseek/client-ui-trajectory/client.js +147 -168
  994. package/product-web/plugins/@xrkseek/client-ui-user-questions/client.js +27 -27
  995. package/product-web/plugins/@xrkseek/client-ui-workflow-run/client.js +16 -16
  996. package/product-web/plugins/@xrkseek/client-ui-workspace/client.js +56 -56
  997. package/product-web/plugins/@xrkseek/xrk-api-remotes/client.js +20 -1
  998. package/product-web/assets/index-CcF0Sxxg.js +0 -297
  999. package/product-web/assets/index-CcF0Sxxg.js.map +0 -1
  1000. package/product-web/assets/vendor-CldRVjca.js.map +0 -1
@@ -0,0 +1,1948 @@
1
+ /*!
2
+ Copyright 2013 Lovell Fuller and others.
3
+ SPDX-License-Identifier: Apache-2.0
4
+ */
5
+
6
+ #include <algorithm>
7
+ #include <cmath>
8
+ #include <filesystem> // NOLINT(build/c++17)
9
+ #include <map>
10
+ #include <memory>
11
+ #include <numeric>
12
+ #include <string>
13
+ #include <tuple>
14
+ #include <utility>
15
+ #include <vector>
16
+ #include <sys/types.h>
17
+ #include <sys/stat.h>
18
+
19
+ #include <vips/vips8>
20
+ #include <napi.h>
21
+
22
+ #include "./common.h"
23
+ #include "./operations.h"
24
+ #include "./pipeline.h"
25
+
26
+ class PipelineWorker : public Napi::AsyncWorker {
27
+ public:
28
+ PipelineWorker(Napi::Function callback, PipelineBaton *baton,
29
+ Napi::Function debuglog, Napi::Function queueListener) :
30
+ Napi::AsyncWorker(callback),
31
+ baton(baton),
32
+ debuglog(Napi::Persistent(debuglog)),
33
+ queueListener(Napi::Persistent(queueListener)) {}
34
+ ~PipelineWorker() {}
35
+
36
+ // libuv worker
37
+ void Execute() {
38
+ // Decrement queued task counter
39
+ sharp::counterQueue--;
40
+ // Increment processing task counter
41
+ sharp::counterProcess++;
42
+
43
+ try {
44
+ // Open input
45
+ vips::VImage image;
46
+ sharp::ImageType inputImageType;
47
+ if (baton->join.empty()) {
48
+ std::tie(image, inputImageType) = sharp::OpenInput(baton->input);
49
+ } else {
50
+ std::vector<VImage> images;
51
+ bool hasAlpha = false;
52
+ for (auto &join : baton->join) {
53
+ std::tie(image, inputImageType) = sharp::OpenInput(join);
54
+ image = sharp::EnsureColourspace(image, baton->colourspacePipeline);
55
+ images.push_back(image);
56
+ hasAlpha |= image.has_alpha();
57
+ }
58
+ if (hasAlpha) {
59
+ for (auto &image : images) {
60
+ if (!image.has_alpha()) {
61
+ image = sharp::EnsureAlpha(image, 1);
62
+ }
63
+ }
64
+ } else {
65
+ baton->input->joinBackground.pop_back();
66
+ }
67
+ inputImageType = sharp::ImageType::PNG;
68
+ image = VImage::arrayjoin(images, VImage::option()
69
+ ->set("across", baton->input->joinAcross)
70
+ ->set("shim", baton->input->joinShim)
71
+ ->set("background", baton->input->joinBackground)
72
+ ->set("halign", baton->input->joinHalign)
73
+ ->set("valign", baton->input->joinValign));
74
+ if (baton->input->joinAnimated) {
75
+ image = image.copy();
76
+ image.set(VIPS_META_N_PAGES, static_cast<int>(images.size()));
77
+ image.set(VIPS_META_PAGE_HEIGHT, static_cast<int>(image.height() / images.size()));
78
+ }
79
+ }
80
+ VipsAccess access = baton->input->access;
81
+ image = sharp::EnsureColourspace(image, baton->colourspacePipeline);
82
+
83
+ int nPages = baton->input->pages;
84
+ if (nPages == -1) {
85
+ // Resolve the number of pages if we need to render until the end of the document
86
+ nPages = image.get_typeof(VIPS_META_N_PAGES) != 0
87
+ ? image.get_int(VIPS_META_N_PAGES) - std::max(0, baton->input->page)
88
+ : 1;
89
+ }
90
+
91
+ // Get pre-resize page height
92
+ int pageHeight = sharp::GetPageHeight(image);
93
+
94
+ // Calculate angle of rotation
95
+ VipsAngle rotation = VIPS_ANGLE_D0;
96
+ VipsAngle autoRotation = VIPS_ANGLE_D0;
97
+ bool autoFlop = false;
98
+
99
+ if (baton->input->autoOrient) {
100
+ // Rotate and flip image according to Exif orientation
101
+ std::tie(autoRotation, autoFlop) = CalculateExifRotationAndFlop(sharp::ExifOrientation(image));
102
+ }
103
+
104
+ rotation = CalculateAngleRotation(baton->angle);
105
+
106
+ bool const shouldRotateBefore = baton->rotateBefore &&
107
+ (rotation != VIPS_ANGLE_D0 || baton->flip || baton->flop || baton->rotationAngle != 0.0);
108
+ bool const shouldOrientBefore = (shouldRotateBefore || baton->orientBefore) &&
109
+ (autoRotation != VIPS_ANGLE_D0 || autoFlop);
110
+
111
+ if (shouldOrientBefore) {
112
+ image = sharp::StaySequential(image, autoRotation != VIPS_ANGLE_D0);
113
+ if (autoRotation != VIPS_ANGLE_D0) {
114
+ if (autoRotation != VIPS_ANGLE_D180) {
115
+ MultiPageUnsupported(nPages, "Rotate");
116
+ }
117
+ image = image.rot(autoRotation);
118
+ autoRotation = VIPS_ANGLE_D0;
119
+ }
120
+ if (autoFlop) {
121
+ image = image.flip(VIPS_DIRECTION_HORIZONTAL);
122
+ autoFlop = false;
123
+ }
124
+ }
125
+
126
+ if (shouldRotateBefore) {
127
+ image = sharp::StaySequential(image, rotation != VIPS_ANGLE_D0 || baton->flip || baton->rotationAngle != 0.0);
128
+ if (baton->flip) {
129
+ image = image.flip(VIPS_DIRECTION_VERTICAL);
130
+ baton->flip = false;
131
+ }
132
+ if (baton->flop) {
133
+ image = image.flip(VIPS_DIRECTION_HORIZONTAL);
134
+ baton->flop = false;
135
+ }
136
+ if (rotation != VIPS_ANGLE_D0) {
137
+ if (rotation != VIPS_ANGLE_D180) {
138
+ MultiPageUnsupported(nPages, "Rotate");
139
+ }
140
+ image = image.rot(rotation);
141
+ rotation = VIPS_ANGLE_D0;
142
+ }
143
+ if (baton->rotationAngle != 0.0) {
144
+ MultiPageUnsupported(nPages, "Rotate");
145
+ std::vector<double> background;
146
+ std::tie(image, background) = sharp::ApplyAlpha(image, baton->rotationBackground, false);
147
+ image = image.rotate(baton->rotationAngle, VImage::option()->set("background", background)).copy_memory();
148
+ baton->rotationAngle = 0.0;
149
+ }
150
+ }
151
+
152
+ // Trim
153
+ if (baton->trimThreshold >= 0.0) {
154
+ MultiPageUnsupported(nPages, "Trim");
155
+ image = sharp::StaySequential(image);
156
+ image = sharp::Trim(image, baton->trimBackground, baton->trimThreshold, baton->trimLineArt, baton->trimMargin);
157
+ baton->trimOffsetLeft = image.xoffset();
158
+ baton->trimOffsetTop = image.yoffset();
159
+ }
160
+
161
+ // Pre extraction
162
+ if (baton->topOffsetPre != -1) {
163
+ image = nPages > 1
164
+ ? sharp::CropMultiPage(image,
165
+ baton->leftOffsetPre, baton->topOffsetPre, baton->widthPre, baton->heightPre, nPages, &pageHeight)
166
+ : image.extract_area(baton->leftOffsetPre, baton->topOffsetPre, baton->widthPre, baton->heightPre);
167
+ }
168
+
169
+ // Get pre-resize image width and height
170
+ int inputWidth = image.width();
171
+ int inputHeight = image.height();
172
+
173
+ // Is there just one page? Shrink to inputHeight instead
174
+ if (nPages == 1) {
175
+ pageHeight = inputHeight;
176
+ }
177
+
178
+ // Scaling calculations
179
+ double hshrink;
180
+ double vshrink;
181
+ int targetResizeWidth = baton->width;
182
+ int targetResizeHeight = baton->height;
183
+
184
+ // When auto-rotating by 90 or 270 degrees, swap the target width and
185
+ // height to ensure the behavior aligns with how it would have been if
186
+ // the rotation had taken place *before* resizing.
187
+ if (autoRotation == VIPS_ANGLE_D90 || autoRotation == VIPS_ANGLE_D270) {
188
+ std::swap(targetResizeWidth, targetResizeHeight);
189
+ }
190
+
191
+ // Shrink to pageHeight, so we work for multi-page images
192
+ std::tie(hshrink, vshrink) = sharp::ResolveShrink(
193
+ inputWidth, pageHeight, targetResizeWidth, targetResizeHeight,
194
+ baton->canvas, baton->withoutEnlargement, baton->withoutReduction);
195
+
196
+ // The jpeg preload shrink.
197
+ int jpegShrinkOnLoad = 1;
198
+
199
+ // WebP, PDF, SVG scale
200
+ double scale = 1.0;
201
+
202
+ // Try to reload input using shrink-on-load for JPEG, WebP, SVG and PDF, when:
203
+ // - the width or height parameters are specified;
204
+ // - gamma correction doesn't need to be applied;
205
+ // - trimming or pre-resize extract isn't required;
206
+ // - gain map processing is not required;
207
+ // - input colourspace is not specified;
208
+ bool const shouldPreShrink = (targetResizeWidth > 0 || targetResizeHeight > 0) &&
209
+ baton->gamma == 0 && baton->topOffsetPre == -1 && baton->trimThreshold < 0.0 &&
210
+ !baton->keepGainMap && !baton->withGainMap &&
211
+ baton->colourspacePipeline == VIPS_INTERPRETATION_LAST && !(shouldOrientBefore || shouldRotateBefore);
212
+
213
+ if (shouldPreShrink) {
214
+ // The common part of the shrink: the bit by which both axes must be shrunk
215
+ double shrink = std::min(hshrink, vshrink);
216
+
217
+ if (inputImageType == sharp::ImageType::JPEG) {
218
+ // Leave at least a factor of two for the final resize step, when fastShrinkOnLoad: false
219
+ // for more consistent results and to avoid extra sharpness to the image
220
+ int factor = baton->fastShrinkOnLoad ? 1 : 2;
221
+ if (shrink >= 8 * factor) {
222
+ jpegShrinkOnLoad = 8;
223
+ } else if (shrink >= 4 * factor) {
224
+ jpegShrinkOnLoad = 4;
225
+ } else if (shrink >= 2 * factor) {
226
+ jpegShrinkOnLoad = 2;
227
+ }
228
+ // Lower shrink-on-load for known libjpeg rounding errors
229
+ if (jpegShrinkOnLoad > 1 && static_cast<int>(shrink) == jpegShrinkOnLoad) {
230
+ jpegShrinkOnLoad /= 2;
231
+ }
232
+ } else if (inputImageType == sharp::ImageType::WEBP && baton->fastShrinkOnLoad && shrink > 1.0) {
233
+ // Avoid upscaling via webp
234
+ scale = 1.0 / shrink;
235
+ } else if (inputImageType == sharp::ImageType::SVG ||
236
+ inputImageType == sharp::ImageType::PDF) {
237
+ scale = 1.0 / shrink;
238
+ }
239
+ }
240
+
241
+ // Reload input using shrink-on-load, it'll be an integer shrink
242
+ // factor for jpegload*, a double scale factor for webpload*,
243
+ // pdfload* and svgload*
244
+ if (jpegShrinkOnLoad > 1) {
245
+ vips::VOption *option = GetOptionsForImageType(inputImageType, baton->input)->set("shrink", jpegShrinkOnLoad);
246
+ if (baton->input->buffer != nullptr) {
247
+ // Reload JPEG buffer
248
+ VipsBlob *blob = vips_blob_new(nullptr, baton->input->buffer, baton->input->bufferLength);
249
+ image = VImage::jpegload_buffer(blob, option);
250
+ vips_area_unref(reinterpret_cast<VipsArea*>(blob));
251
+ } else {
252
+ // Reload JPEG file
253
+ image = VImage::jpegload(const_cast<char*>(baton->input->file.data()), option);
254
+ }
255
+ } else if (scale != 1.0) {
256
+ vips::VOption *option = GetOptionsForImageType(inputImageType, baton->input)->set("scale", scale);
257
+ if (inputImageType == sharp::ImageType::WEBP) {
258
+ if (baton->input->buffer != nullptr) {
259
+ // Reload WebP buffer
260
+ VipsBlob *blob = vips_blob_new(nullptr, baton->input->buffer, baton->input->bufferLength);
261
+ image = VImage::webpload_buffer(blob, option);
262
+ vips_area_unref(reinterpret_cast<VipsArea*>(blob));
263
+ } else {
264
+ // Reload WebP file
265
+ image = VImage::webpload(const_cast<char*>(baton->input->file.data()), option);
266
+ }
267
+ } else if (inputImageType == sharp::ImageType::SVG) {
268
+ if (baton->input->buffer != nullptr) {
269
+ // Reload SVG buffer
270
+ VipsBlob *blob = vips_blob_new(nullptr, baton->input->buffer, baton->input->bufferLength);
271
+ image = VImage::svgload_buffer(blob, option);
272
+ vips_area_unref(reinterpret_cast<VipsArea*>(blob));
273
+ } else {
274
+ // Reload SVG file
275
+ image = VImage::svgload(const_cast<char*>(baton->input->file.data()), option);
276
+ }
277
+ sharp::SetDensity(image, baton->input->density);
278
+ if (image.width() > 32767 || image.height() > 32767) {
279
+ throw std::runtime_error("Input SVG image will exceed 32767x32767 pixel limit when scaled");
280
+ }
281
+ } else if (inputImageType == sharp::ImageType::PDF) {
282
+ if (baton->input->buffer != nullptr) {
283
+ // Reload PDF buffer
284
+ VipsBlob *blob = vips_blob_new(nullptr, baton->input->buffer, baton->input->bufferLength);
285
+ image = VImage::pdfload_buffer(blob, option);
286
+ vips_area_unref(reinterpret_cast<VipsArea*>(blob));
287
+ } else {
288
+ // Reload PDF file
289
+ image = VImage::pdfload(const_cast<char*>(baton->input->file.data()), option);
290
+ }
291
+ sharp::SetDensity(image, baton->input->density);
292
+ }
293
+ } else {
294
+ if (inputImageType == sharp::ImageType::SVG && (image.width() > 32767 || image.height() > 32767)) {
295
+ throw std::runtime_error("Input SVG image exceeds 32767x32767 pixel limit");
296
+ }
297
+ }
298
+ if (baton->input->autoOrient) {
299
+ image = sharp::RemoveExifOrientation(image);
300
+ }
301
+ VImage gainMap;
302
+ int gainMapScaleFactor = 1;
303
+ if (sharp::HasGainMap(image)) {
304
+ if (baton->keepGainMap) {
305
+ gainMap = image.gainmap();
306
+ if (image.get_typeof("gainmap-scale-factor") == G_TYPE_INT) {
307
+ gainMapScaleFactor = image.get_int("gainmap-scale-factor");
308
+ }
309
+ } else if (baton->withGainMap) {
310
+ image = image.uhdr2scRGB();
311
+ }
312
+ image = sharp::RemoveGainMap(image);
313
+ } else {
314
+ baton->keepGainMap = false;
315
+ baton->withGainMap = false;
316
+ }
317
+
318
+ // Any pre-shrinking may already have been done
319
+ inputWidth = image.width();
320
+ inputHeight = image.height();
321
+
322
+ // After pre-shrink, but before the main shrink stage
323
+ // Reuse the initial pageHeight if we didn't pre-shrink
324
+ if (shouldPreShrink) {
325
+ pageHeight = sharp::GetPageHeight(image);
326
+ }
327
+
328
+ // Shrink to pageHeight, so we work for multi-page images
329
+ std::tie(hshrink, vshrink) = sharp::ResolveShrink(
330
+ inputWidth, pageHeight, targetResizeWidth, targetResizeHeight,
331
+ baton->canvas, baton->withoutEnlargement, baton->withoutReduction);
332
+
333
+ int targetHeight = static_cast<int>(std::rint(static_cast<double>(pageHeight) / vshrink));
334
+ int targetPageHeight = targetHeight;
335
+
336
+ // In toilet-roll mode, we must adjust vshrink so that we exactly hit
337
+ // pageHeight or we'll have pixels straddling pixel boundaries
338
+ if (inputHeight > pageHeight) {
339
+ targetHeight *= nPages;
340
+ vshrink = static_cast<double>(inputHeight) / targetHeight;
341
+ }
342
+
343
+ // Ensure we're using a device-independent colour space
344
+ std::pair<char*, size_t> inputProfile(nullptr, 0);
345
+ if ((baton->keepMetadata & VIPS_FOREIGN_KEEP_ICC) && baton->withIccProfile.empty()) {
346
+ // Cache input profile for use with output
347
+ inputProfile = sharp::GetProfile(image);
348
+ baton->input->ignoreIcc = true;
349
+ }
350
+ char const *processingProfile = image.interpretation() == VIPS_INTERPRETATION_RGB16 ? "p3" : "srgb";
351
+ if (
352
+ sharp::HasProfile(image) &&
353
+ image.interpretation() != VIPS_INTERPRETATION_LABS &&
354
+ image.interpretation() != VIPS_INTERPRETATION_GREY16 &&
355
+ baton->colourspacePipeline != VIPS_INTERPRETATION_CMYK &&
356
+ !baton->input->ignoreIcc && !baton->withGainMap
357
+ ) {
358
+ // Convert to sRGB/P3 using embedded profile
359
+ try {
360
+ image = image.icc_transform(processingProfile, VImage::option()
361
+ ->set("embedded", true)
362
+ ->set("depth", sharp::Is16Bit(image.interpretation()) ? 16 : 8)
363
+ ->set("intent", VIPS_INTENT_PERCEPTUAL));
364
+ } catch(...) {
365
+ sharp::VipsWarningCallback(nullptr, G_LOG_LEVEL_WARNING, "Invalid embedded profile", nullptr);
366
+ }
367
+ } else if (
368
+ image.interpretation() == VIPS_INTERPRETATION_CMYK &&
369
+ baton->colourspacePipeline != VIPS_INTERPRETATION_CMYK
370
+ ) {
371
+ image = image.icc_transform(processingProfile, VImage::option()
372
+ ->set("input_profile", "cmyk")
373
+ ->set("intent", VIPS_INTENT_PERCEPTUAL));
374
+ }
375
+
376
+ // Flatten image to remove alpha channel
377
+ if (baton->flatten && image.has_alpha()) {
378
+ image = sharp::Flatten(image, baton->flattenBackground);
379
+ }
380
+
381
+ // Gamma encoding (darken)
382
+ if (baton->gamma >= 1 && baton->gamma <= 3) {
383
+ image = sharp::Gamma(image, 1.0 / baton->gamma);
384
+ }
385
+
386
+ // Convert to greyscale (linear, therefore after gamma encoding, if any)
387
+ if (baton->greyscale) {
388
+ image = image.colourspace(VIPS_INTERPRETATION_B_W);
389
+ }
390
+
391
+ bool const shouldResize = hshrink != 1.0 || vshrink != 1.0;
392
+ bool const shouldBlur = baton->blurSigma != 0.0;
393
+ bool const shouldConv = baton->convKernelWidth * baton->convKernelHeight > 0;
394
+ bool const shouldSharpen = baton->sharpenSigma != 0.0;
395
+ bool const shouldComposite = !baton->composite.empty();
396
+
397
+ if (shouldComposite && !image.has_alpha()) {
398
+ image = sharp::EnsureAlpha(image, 1);
399
+ }
400
+
401
+ VipsBandFormat premultiplyFormat = image.format();
402
+ bool const shouldPremultiplyAlpha = image.has_alpha() &&
403
+ (shouldResize || shouldBlur || shouldConv || shouldSharpen);
404
+
405
+ if (shouldPremultiplyAlpha) {
406
+ image = image.premultiply().cast(premultiplyFormat);
407
+ }
408
+
409
+ // Resize
410
+ if (shouldResize) {
411
+ image = image.resize(1.0 / hshrink, VImage::option()
412
+ ->set("vscale", 1.0 / vshrink)
413
+ ->set("kernel", baton->kernel));
414
+ if (baton->keepGainMap) {
415
+ gainMap = gainMap.resize(1.0 / hshrink, VImage::option()
416
+ ->set("vscale", 1.0 / vshrink)
417
+ ->set("kernel", baton->kernel));
418
+ }
419
+ }
420
+
421
+ image = sharp::StaySequential(image,
422
+ autoRotation != VIPS_ANGLE_D0 ||
423
+ baton->flip ||
424
+ rotation != VIPS_ANGLE_D0);
425
+ // Auto-rotate post-extract
426
+ if (autoRotation != VIPS_ANGLE_D0) {
427
+ if (autoRotation != VIPS_ANGLE_D180) {
428
+ MultiPageUnsupported(nPages, "Rotate");
429
+ }
430
+ image = image.rot(autoRotation);
431
+ if (baton->keepGainMap) {
432
+ gainMap = gainMap.rot(autoRotation);
433
+ }
434
+ }
435
+ // Mirror vertically (up-down) about the x-axis
436
+ if (baton->flip) {
437
+ image = image.flip(VIPS_DIRECTION_VERTICAL);
438
+ if (baton->keepGainMap) {
439
+ gainMap = gainMap.flip(VIPS_DIRECTION_VERTICAL);
440
+ }
441
+ }
442
+ // Mirror horizontally (left-right) about the y-axis
443
+ if (baton->flop != autoFlop) {
444
+ image = image.flip(VIPS_DIRECTION_HORIZONTAL);
445
+ if (baton->keepGainMap) {
446
+ gainMap = gainMap.flip(VIPS_DIRECTION_HORIZONTAL);
447
+ }
448
+ }
449
+ // Rotate post-extract 90-angle
450
+ if (rotation != VIPS_ANGLE_D0) {
451
+ if (rotation != VIPS_ANGLE_D180) {
452
+ MultiPageUnsupported(nPages, "Rotate");
453
+ }
454
+ image = image.rot(rotation);
455
+ if (baton->keepGainMap) {
456
+ gainMap = gainMap.rot(rotation);
457
+ }
458
+ }
459
+
460
+ // Join additional color channels to the image
461
+ if (!baton->joinChannelIn.empty()) {
462
+ VImage joinImage;
463
+ sharp::ImageType joinImageType = sharp::ImageType::UNKNOWN;
464
+
465
+ for (unsigned int i = 0; i < baton->joinChannelIn.size(); i++) {
466
+ baton->joinChannelIn[i]->access = access;
467
+ std::tie(joinImage, joinImageType) = sharp::OpenInput(baton->joinChannelIn[i]);
468
+ joinImage = sharp::EnsureColourspace(joinImage, baton->colourspacePipeline);
469
+ image = image.bandjoin(joinImage);
470
+ }
471
+ image = image.copy(VImage::option()->set("interpretation", baton->colourspace));
472
+ image = sharp::RemoveGifPalette(image);
473
+ }
474
+
475
+ inputWidth = image.width();
476
+ inputHeight = nPages > 1 ? targetPageHeight : image.height();
477
+
478
+ // Resolve dimensions
479
+ if (baton->width <= 0) {
480
+ baton->width = inputWidth;
481
+ }
482
+ if (baton->height <= 0) {
483
+ baton->height = inputHeight;
484
+ }
485
+
486
+ // Crop/embed
487
+ if (inputWidth != baton->width || inputHeight != baton->height) {
488
+ if (baton->canvas == sharp::Canvas::EMBED) {
489
+ std::vector<double> background;
490
+ std::tie(image, background) = sharp::ApplyAlpha(image, baton->resizeBackground, shouldPremultiplyAlpha);
491
+
492
+ // Embed
493
+ const auto& [left, top] = sharp::CalculateEmbedPosition(
494
+ inputWidth, inputHeight, baton->width, baton->height, baton->position);
495
+ const int width = std::max(inputWidth, baton->width);
496
+ const int height = std::max(inputHeight, baton->height);
497
+
498
+ image = nPages > 1
499
+ ? sharp::EmbedMultiPage(image,
500
+ left, top, width, height, VIPS_EXTEND_BACKGROUND, background, nPages, &targetPageHeight)
501
+ : image.embed(left, top, width, height, VImage::option()
502
+ ->set("extend", VIPS_EXTEND_BACKGROUND)
503
+ ->set("background", background));
504
+ if (baton->keepGainMap) {
505
+ gainMap = gainMap.embed(left / gainMapScaleFactor, top / gainMapScaleFactor,
506
+ width / gainMapScaleFactor, height / gainMapScaleFactor, VImage::option()
507
+ ->set("extend", VIPS_EXTEND_BACKGROUND)
508
+ ->set("background", 0));
509
+ }
510
+ } else if (baton->canvas == sharp::Canvas::CROP) {
511
+ if (baton->width > inputWidth) {
512
+ baton->width = inputWidth;
513
+ }
514
+ if (baton->height > inputHeight) {
515
+ baton->height = inputHeight;
516
+ }
517
+
518
+ // Crop
519
+ if (baton->position < 9) {
520
+ // Gravity-based crop
521
+ const auto& [left, top] = sharp::CalculateCrop(
522
+ inputWidth, inputHeight, baton->width, baton->height, baton->position);
523
+ const int width = std::min(inputWidth, baton->width);
524
+ const int height = std::min(inputHeight, baton->height);
525
+
526
+ image = nPages > 1
527
+ ? sharp::CropMultiPage(image,
528
+ left, top, width, height, nPages, &targetPageHeight)
529
+ : image.extract_area(left, top, width, height);
530
+ if (baton->keepGainMap) {
531
+ gainMap = gainMap.extract_area(left / gainMapScaleFactor, top / gainMapScaleFactor,
532
+ width / gainMapScaleFactor, height / gainMapScaleFactor);
533
+ }
534
+ } else {
535
+ int attention_x;
536
+ int attention_y;
537
+
538
+ // Attention-based or Entropy-based crop
539
+ MultiPageUnsupported(nPages, "Resize strategy");
540
+ KeepGainMapUnsupported(baton->keepGainMap, "Resize strategy");
541
+ image = sharp::StaySequential(image);
542
+ image = image.smartcrop(baton->width, baton->height, VImage::option()
543
+ ->set("interesting", baton->position == 16 ? VIPS_INTERESTING_ENTROPY : VIPS_INTERESTING_ATTENTION)
544
+ ->set("premultiplied", shouldPremultiplyAlpha)
545
+ ->set("attention_x", &attention_x)
546
+ ->set("attention_y", &attention_y));
547
+ baton->hasCropOffset = true;
548
+ baton->cropOffsetLeft = static_cast<int>(image.xoffset());
549
+ baton->cropOffsetTop = static_cast<int>(image.yoffset());
550
+ baton->hasAttentionCenter = true;
551
+ baton->attentionX = static_cast<int>(attention_x * jpegShrinkOnLoad / scale);
552
+ baton->attentionY = static_cast<int>(attention_y * jpegShrinkOnLoad / scale);
553
+ }
554
+ }
555
+ }
556
+
557
+ // Rotate post-extract non-90 angle
558
+ if (!baton->rotateBefore && baton->rotationAngle != 0.0) {
559
+ MultiPageUnsupported(nPages, "Rotate");
560
+ image = sharp::StaySequential(image);
561
+ std::vector<double> background;
562
+ std::tie(image, background) = sharp::ApplyAlpha(image, baton->rotationBackground, shouldPremultiplyAlpha);
563
+ image = image.rotate(baton->rotationAngle, VImage::option()->set("background", background));
564
+ if (baton->keepGainMap) {
565
+ gainMap = gainMap.rotate(baton->rotationAngle, VImage::option()->set("background", 0));
566
+ }
567
+ }
568
+
569
+ // Post extraction
570
+ if (baton->topOffsetPost != -1) {
571
+ if (nPages > 1) {
572
+ image = sharp::CropMultiPage(image,
573
+ baton->leftOffsetPost, baton->topOffsetPost, baton->widthPost, baton->heightPost,
574
+ nPages, &targetPageHeight);
575
+ // heightPost is used in the info object, so update to reflect the number of pages
576
+ baton->heightPost *= nPages;
577
+ } else {
578
+ image = image.extract_area(
579
+ baton->leftOffsetPost, baton->topOffsetPost, baton->widthPost, baton->heightPost);
580
+ if (baton->keepGainMap) {
581
+ gainMap = gainMap.extract_area(baton->leftOffsetPost / gainMapScaleFactor,
582
+ baton->topOffsetPost / gainMapScaleFactor, baton->widthPost / gainMapScaleFactor,
583
+ baton->heightPost / gainMapScaleFactor);
584
+ }
585
+ }
586
+ }
587
+
588
+ // Affine transform
589
+ if (!baton->affineMatrix.empty()) {
590
+ MultiPageUnsupported(nPages, "Affine");
591
+ KeepGainMapUnsupported(baton->keepGainMap, "Affine");
592
+ image = sharp::StaySequential(image);
593
+ std::vector<double> background;
594
+ std::tie(image, background) = sharp::ApplyAlpha(image, baton->affineBackground, shouldPremultiplyAlpha);
595
+ vips::VInterpolate interp = vips::VInterpolate::new_from_name(
596
+ const_cast<char*>(baton->affineInterpolator.data()));
597
+ image = image.affine(baton->affineMatrix, VImage::option()->set("background", background)
598
+ ->set("idx", baton->affineIdx)
599
+ ->set("idy", baton->affineIdy)
600
+ ->set("odx", baton->affineOdx)
601
+ ->set("ody", baton->affineOdy)
602
+ ->set("interpolate", interp));
603
+ }
604
+
605
+ // Extend edges
606
+ if (baton->extendTop > 0 || baton->extendBottom > 0 || baton->extendLeft > 0 || baton->extendRight > 0) {
607
+ // Embed
608
+ baton->width = image.width() + baton->extendLeft + baton->extendRight;
609
+ baton->height = (nPages > 1 ? targetPageHeight : image.height()) + baton->extendTop + baton->extendBottom;
610
+
611
+ std::vector<double> background;
612
+ if (baton->extendWith == VIPS_EXTEND_BACKGROUND) {
613
+ std::tie(image, background) = sharp::ApplyAlpha(image, baton->extendBackground, shouldPremultiplyAlpha);
614
+ }
615
+ image = sharp::StaySequential(image, nPages > 1 || baton->extendWith != VIPS_EXTEND_BACKGROUND);
616
+ auto options = VImage::option()->set("extend", baton->extendWith);
617
+ if (baton->extendWith == VIPS_EXTEND_BACKGROUND) {
618
+ options->set("background", background);
619
+ }
620
+ image = nPages > 1
621
+ ? sharp::EmbedMultiPage(image,
622
+ baton->extendLeft, baton->extendTop, baton->width, baton->height,
623
+ baton->extendWith, background, nPages, &targetPageHeight)
624
+ : image.embed(baton->extendLeft, baton->extendTop, baton->width, baton->height, options);
625
+ if (baton->keepGainMap) {
626
+ gainMap = gainMap.embed(baton->extendLeft / gainMapScaleFactor, baton->extendTop / gainMapScaleFactor,
627
+ baton->width / gainMapScaleFactor, baton->height / gainMapScaleFactor, VImage::option()
628
+ ->set("extend", baton->extendWith)
629
+ ->set("background", 0));
630
+ }
631
+ }
632
+ // Median - must happen before blurring, due to the utility of blurring after thresholding
633
+ if (baton->medianSize > 0) {
634
+ image = image.median(baton->medianSize);
635
+ }
636
+
637
+ // Threshold - must happen before blurring, due to the utility of blurring after thresholding
638
+ // Threshold - must happen before unflatten to enable non-white unflattening
639
+ if (baton->threshold != 0) {
640
+ image = sharp::Threshold(image, baton->threshold, baton->thresholdGrayscale);
641
+ }
642
+
643
+ // Dilate - must happen before blurring, due to the utility of dilating after thresholding
644
+ if (baton->dilateWidth != 0) {
645
+ image = sharp::Dilate(image, baton->dilateWidth);
646
+ }
647
+
648
+ // Erode - must happen before blurring, due to the utility of eroding after thresholding
649
+ if (baton->erodeWidth != 0) {
650
+ image = sharp::Erode(image, baton->erodeWidth);
651
+ }
652
+
653
+ // Blur
654
+ if (shouldBlur) {
655
+ image = sharp::Blur(image, baton->blurSigma, baton->precision, baton->minAmpl);
656
+ if (baton->keepGainMap) {
657
+ gainMap = sharp::Blur(gainMap, baton->blurSigma, baton->precision, baton->minAmpl);
658
+ }
659
+ }
660
+
661
+ // Unflatten the image
662
+ if (baton->unflatten) {
663
+ image = sharp::Unflatten(image);
664
+ }
665
+
666
+ // Convolve
667
+ if (shouldConv) {
668
+ KeepGainMapUnsupported(baton->keepGainMap, "Convolve");
669
+ image = sharp::Convolve(image,
670
+ baton->convKernelWidth, baton->convKernelHeight,
671
+ baton->convKernelScale, baton->convKernelOffset,
672
+ baton->convKernel);
673
+ }
674
+
675
+ // Recomb
676
+ if (!baton->recombMatrix.empty()) {
677
+ KeepGainMapUnsupported(baton->keepGainMap, "Recomb");
678
+ image = sharp::Recomb(image, baton->recombMatrix);
679
+ }
680
+
681
+ // Modulate
682
+ if (baton->brightness != 1.0 || baton->saturation != 1.0 || baton->hue != 0.0 || baton->lightness != 0.0) {
683
+ KeepGainMapUnsupported(baton->keepGainMap, "Modulate");
684
+ image = sharp::Modulate(image, baton->brightness, baton->saturation, baton->hue, baton->lightness);
685
+ }
686
+
687
+ // Sharpen
688
+ if (shouldSharpen) {
689
+ image = sharp::Sharpen(image, baton->sharpenSigma, baton->sharpenM1, baton->sharpenM2,
690
+ baton->sharpenX1, baton->sharpenY2, baton->sharpenY3);
691
+ }
692
+
693
+ // Reverse premultiplication after all transformations
694
+ if (shouldPremultiplyAlpha) {
695
+ image = image.unpremultiply().cast(premultiplyFormat);
696
+ }
697
+ baton->premultiplied = shouldPremultiplyAlpha;
698
+
699
+ // Composite
700
+ if (shouldComposite) {
701
+ KeepGainMapUnsupported(baton->keepGainMap, "Composite");
702
+ std::vector<VImage> images = { image };
703
+ std::vector<int> modes, xs, ys;
704
+ for (Composite *composite : baton->composite) {
705
+ VImage compositeImage;
706
+ sharp::ImageType compositeImageType = sharp::ImageType::UNKNOWN;
707
+ composite->input->access = access;
708
+ std::tie(compositeImage, compositeImageType) = sharp::OpenInput(composite->input);
709
+
710
+ if (composite->input->autoOrient) {
711
+ // Respect EXIF Orientation
712
+ VipsAngle compositeAutoRotation = VIPS_ANGLE_D0;
713
+ bool compositeAutoFlop = false;
714
+ std::tie(compositeAutoRotation, compositeAutoFlop) =
715
+ CalculateExifRotationAndFlop(sharp::ExifOrientation(compositeImage));
716
+
717
+ compositeImage = sharp::RemoveExifOrientation(compositeImage);
718
+ compositeImage = sharp::StaySequential(compositeImage, compositeAutoRotation != VIPS_ANGLE_D0);
719
+
720
+ if (compositeAutoRotation != VIPS_ANGLE_D0) {
721
+ compositeImage = compositeImage.rot(compositeAutoRotation);
722
+ }
723
+ if (compositeAutoFlop) {
724
+ compositeImage = compositeImage.flip(VIPS_DIRECTION_HORIZONTAL);
725
+ }
726
+ }
727
+
728
+ // Verify within current dimensions
729
+ if (compositeImage.width() > image.width() || compositeImage.height() > image.height()) {
730
+ throw std::runtime_error("Image to composite must have same dimensions or smaller");
731
+ }
732
+ // Check if overlay is tiled
733
+ if (composite->tile) {
734
+ int across = 0;
735
+ int down = 0;
736
+ // Use gravity in overlay
737
+ if (compositeImage.width() <= image.width()) {
738
+ across = static_cast<int>(ceil(static_cast<double>(image.width()) / compositeImage.width()));
739
+ // Ensure odd number of tiles across when gravity is centre, north or south
740
+ if (composite->gravity == 0 || composite->gravity == 1 || composite->gravity == 3) {
741
+ across |= 1;
742
+ }
743
+ }
744
+ if (compositeImage.height() <= image.height()) {
745
+ down = static_cast<int>(ceil(static_cast<double>(image.height()) / compositeImage.height()));
746
+ // Ensure odd number of tiles down when gravity is centre, east or west
747
+ if (composite->gravity == 0 || composite->gravity == 2 || composite->gravity == 4) {
748
+ down |= 1;
749
+ }
750
+ }
751
+ if (across != 0 || down != 0) {
752
+ int left;
753
+ int top;
754
+ compositeImage = sharp::StaySequential(compositeImage).replicate(across, down);
755
+ if (composite->hasOffset) {
756
+ std::tie(left, top) = sharp::CalculateCrop(
757
+ compositeImage.width(), compositeImage.height(), image.width(), image.height(),
758
+ composite->left, composite->top);
759
+ } else {
760
+ std::tie(left, top) = sharp::CalculateCrop(
761
+ compositeImage.width(), compositeImage.height(), image.width(), image.height(), composite->gravity);
762
+ }
763
+ compositeImage = compositeImage.extract_area(left, top, image.width(), image.height());
764
+ }
765
+ // gravity was used for extract_area, set it back to its default value of 0
766
+ composite->gravity = 0;
767
+ }
768
+ // Ensure image to composite is with unpremultiplied alpha
769
+ compositeImage = sharp::EnsureAlpha(compositeImage, 1);
770
+ if (composite->premultiplied) compositeImage = compositeImage.unpremultiply();
771
+ // Calculate position
772
+ int left;
773
+ int top;
774
+ if (composite->hasOffset) {
775
+ // Composite image at given offsets
776
+ if (composite->tile) {
777
+ std::tie(left, top) = sharp::CalculateCrop(image.width(), image.height(),
778
+ compositeImage.width(), compositeImage.height(), composite->left, composite->top);
779
+ } else {
780
+ left = composite->left;
781
+ top = composite->top;
782
+ }
783
+ } else {
784
+ // Composite image with given gravity
785
+ std::tie(left, top) = sharp::CalculateCrop(image.width(), image.height(),
786
+ compositeImage.width(), compositeImage.height(), composite->gravity);
787
+ }
788
+ images.push_back(compositeImage);
789
+ modes.push_back(composite->mode);
790
+ xs.push_back(left);
791
+ ys.push_back(top);
792
+ }
793
+ image = VImage::composite(images, modes, VImage::option()
794
+ ->set("compositing_space", baton->colourspacePipeline == VIPS_INTERPRETATION_LAST
795
+ ? VIPS_INTERPRETATION_sRGB
796
+ : baton->colourspacePipeline)
797
+ ->set("x", xs)
798
+ ->set("y", ys));
799
+ image = sharp::RemoveGifPalette(image);
800
+ }
801
+
802
+ // Gamma decoding (brighten)
803
+ if (baton->gammaOut >= 1 && baton->gammaOut <= 3) {
804
+ image = sharp::Gamma(image, baton->gammaOut);
805
+ }
806
+
807
+ // Linear adjustment (a * in + b)
808
+ if (!baton->linearA.empty()) {
809
+ image = sharp::Linear(image, baton->linearA, baton->linearB);
810
+ }
811
+
812
+ // Apply normalisation - stretch luminance to cover full dynamic range
813
+ if (baton->normalise) {
814
+ KeepGainMapUnsupported(baton->keepGainMap, "Normalise");
815
+ image = sharp::StaySequential(image);
816
+ image = sharp::Normalise(image, baton->normaliseLower, baton->normaliseUpper);
817
+ }
818
+
819
+ // Apply contrast limiting adaptive histogram equalization (CLAHE)
820
+ if (baton->claheWidth != 0 && baton->claheHeight != 0) {
821
+ KeepGainMapUnsupported(baton->keepGainMap, "Clahe");
822
+ image = sharp::StaySequential(image);
823
+ image = sharp::Clahe(image, baton->claheWidth, baton->claheHeight, baton->claheMaxSlope);
824
+ }
825
+
826
+ // Apply bitwise boolean operation between images
827
+ if (baton->boolean != nullptr) {
828
+ KeepGainMapUnsupported(baton->keepGainMap, "Boolean");
829
+ VImage booleanImage;
830
+ sharp::ImageType booleanImageType = sharp::ImageType::UNKNOWN;
831
+ baton->boolean->access = access;
832
+ std::tie(booleanImage, booleanImageType) = sharp::OpenInput(baton->boolean);
833
+ booleanImage = sharp::EnsureColourspace(booleanImage, baton->colourspacePipeline);
834
+ image = sharp::Boolean(image, booleanImage, baton->booleanOp);
835
+ image = sharp::RemoveGifPalette(image);
836
+ }
837
+
838
+ // Apply per-channel Bandbool bitwise operations after all other operations
839
+ if (baton->bandBoolOp >= VIPS_OPERATION_BOOLEAN_AND && baton->bandBoolOp < VIPS_OPERATION_BOOLEAN_LAST) {
840
+ image = sharp::Bandbool(image, baton->bandBoolOp);
841
+ }
842
+
843
+ // Tint the image
844
+ if (baton->tint[0] >= 0.0) {
845
+ image = sharp::Tint(image, baton->tint);
846
+ }
847
+
848
+ // Remove alpha channel, if any
849
+ if (baton->removeAlpha) {
850
+ image = sharp::RemoveAlpha(image);
851
+ }
852
+
853
+ // Ensure alpha channel, if missing
854
+ if (baton->ensureAlpha != -1) {
855
+ image = sharp::EnsureAlpha(image, baton->ensureAlpha);
856
+ }
857
+
858
+ // Ensure output colour space
859
+ if (sharp::Is16Bit(image.interpretation())) {
860
+ image = image.cast(VIPS_FORMAT_USHORT);
861
+ }
862
+ if (image.interpretation() != baton->colourspace) {
863
+ image = image.colourspace(baton->colourspace, VImage::option()->set("source_space", image.interpretation()));
864
+ if (inputProfile.first != nullptr && baton->withIccProfile.empty()) {
865
+ image = sharp::SetProfile(image, inputProfile);
866
+ }
867
+ }
868
+
869
+ // Extract channel
870
+ if (baton->extractChannel > -1) {
871
+ KeepGainMapUnsupported(baton->keepGainMap, "Extract channel");
872
+ if (baton->extractChannel >= image.bands()) {
873
+ if (baton->extractChannel == 3 && image.has_alpha()) {
874
+ baton->extractChannel = image.bands() - 1;
875
+ } else {
876
+ (baton->err)
877
+ .append("Cannot extract channel ").append(std::to_string(baton->extractChannel))
878
+ .append(" from image with channels 0-").append(std::to_string(image.bands() - 1));
879
+ return Error();
880
+ }
881
+ }
882
+ VipsInterpretation colourspace = sharp::Is16Bit(image.interpretation())
883
+ ? VIPS_INTERPRETATION_GREY16
884
+ : VIPS_INTERPRETATION_B_W;
885
+ image = image
886
+ .extract_band(baton->extractChannel)
887
+ .copy(VImage::option()->set("interpretation", colourspace));
888
+ }
889
+
890
+ // Apply output ICC profile
891
+ if (!baton->withIccProfile.empty()) {
892
+ try {
893
+ image = image.icc_transform(const_cast<char*>(baton->withIccProfile.data()), VImage::option()
894
+ ->set("input_profile", processingProfile)
895
+ ->set("embedded", true)
896
+ ->set("depth", sharp::Is16Bit(image.interpretation()) ? 16 : 8)
897
+ ->set("intent", VIPS_INTENT_PERCEPTUAL));
898
+ } catch(...) {
899
+ sharp::VipsWarningCallback(nullptr, G_LOG_LEVEL_WARNING, "Invalid profile", nullptr);
900
+ }
901
+ }
902
+
903
+ // Negate the colours in the image
904
+ if (baton->negate) {
905
+ image = sharp::Negate(image, baton->negateAlpha);
906
+ if (baton->keepGainMap) {
907
+ gainMap = sharp::Negate(gainMap, false);
908
+ }
909
+ }
910
+
911
+ // Override EXIF Orientation tag
912
+ if (baton->withMetadataOrientation != -1) {
913
+ image = sharp::SetExifOrientation(image, baton->withMetadataOrientation);
914
+ }
915
+ // Override pixel density
916
+ if (baton->withMetadataDensity > 0) {
917
+ image = sharp::SetDensity(image, baton->withMetadataDensity);
918
+ }
919
+ // EXIF key/value pairs
920
+ if (baton->keepMetadata & VIPS_FOREIGN_KEEP_EXIF) {
921
+ image = image.copy();
922
+ if (!baton->withExifMerge) {
923
+ image = sharp::RemoveExif(image);
924
+ }
925
+ for (const auto& [key, value] : baton->withExif) {
926
+ image.set(key.c_str(), value.c_str());
927
+ }
928
+ }
929
+ // XMP buffer
930
+ if ((baton->keepMetadata & VIPS_FOREIGN_KEEP_XMP) && !baton->withXmp.empty()) {
931
+ image = image.copy();
932
+ image.set(VIPS_META_XMP_NAME, nullptr,
933
+ const_cast<void*>(static_cast<void const*>(baton->withXmp.c_str())), baton->withXmp.size());
934
+ }
935
+ // Number of channels used in output image
936
+ baton->channels = image.bands();
937
+ baton->width = image.width();
938
+ baton->height = image.height();
939
+
940
+ image = sharp::SetAnimationProperties(
941
+ image, nPages, targetPageHeight, baton->delay, baton->loop);
942
+
943
+ if (image.get_typeof(VIPS_META_PAGE_HEIGHT) == G_TYPE_INT) {
944
+ baton->pageHeightOut = image.get_int(VIPS_META_PAGE_HEIGHT);
945
+ baton->pagesOut = image.get_int(VIPS_META_N_PAGES);
946
+ }
947
+ baton->hasAlphaOut = image.has_alpha();
948
+
949
+ // Output
950
+ sharp::SetTimeout(image, baton->timeoutSeconds);
951
+ if (baton->fileOut.empty()) {
952
+ // Buffer output
953
+ if (baton->formatOut == "jpeg" || (baton->formatOut == "input" && inputImageType == sharp::ImageType::JPEG)) {
954
+ // Write JPEG to buffer
955
+ sharp::AssertImageTypeDimensions(image, sharp::ImageType::JPEG);
956
+ VipsArea *area;
957
+ if (baton->keepGainMap) {
958
+ image = ReattachGainMap(image, gainMap, baton);
959
+ area = reinterpret_cast<VipsArea*>(image.uhdrsave_buffer(VImage::option()
960
+ ->set("keep", baton->keepMetadata)
961
+ ->set("Q", baton->jpegQuality)
962
+ ->set("gainmap_scale_factor", gainMapScaleFactor)));
963
+ } else {
964
+ area = reinterpret_cast<VipsArea*>(image.jpegsave_buffer(VImage::option()
965
+ ->set("keep", baton->keepMetadata)
966
+ ->set("Q", baton->jpegQuality)
967
+ ->set("interlace", baton->jpegProgressive)
968
+ ->set("subsample_mode", baton->jpegChromaSubsampling == "4:4:4"
969
+ ? VIPS_FOREIGN_SUBSAMPLE_OFF
970
+ : VIPS_FOREIGN_SUBSAMPLE_ON)
971
+ ->set("trellis_quant", baton->jpegTrellisQuantisation)
972
+ ->set("quant_table", baton->jpegQuantisationTable)
973
+ ->set("overshoot_deringing", baton->jpegOvershootDeringing)
974
+ ->set("optimize_scans", baton->jpegOptimiseScans)
975
+ ->set("optimize_coding", baton->jpegOptimiseCoding)));
976
+ }
977
+ baton->bufferOut = static_cast<char*>(area->data);
978
+ baton->bufferOutLength = area->length;
979
+ area->free_fn = nullptr;
980
+ vips_area_unref(area);
981
+ baton->formatOut = "jpeg";
982
+ if (baton->colourspace == VIPS_INTERPRETATION_CMYK) {
983
+ baton->channels = std::min(baton->channels, 4);
984
+ } else {
985
+ baton->channels = std::min(baton->channels, 3);
986
+ }
987
+ baton->hasAlphaOut = false;
988
+ } else if (baton->formatOut == "jp2" || (baton->formatOut == "input"
989
+ && inputImageType == sharp::ImageType::JP2)) {
990
+ // Write JP2 to Buffer
991
+ sharp::AssertImageTypeDimensions(image, sharp::ImageType::JP2);
992
+ VipsArea *area = reinterpret_cast<VipsArea*>(image.jp2ksave_buffer(VImage::option()
993
+ ->set("Q", baton->jp2Quality)
994
+ ->set("lossless", baton->jp2Lossless)
995
+ ->set("subsample_mode", baton->jp2ChromaSubsampling == "4:4:4"
996
+ ? VIPS_FOREIGN_SUBSAMPLE_OFF : VIPS_FOREIGN_SUBSAMPLE_ON)
997
+ ->set("tile_height", baton->jp2TileHeight)
998
+ ->set("tile_width", baton->jp2TileWidth)));
999
+ baton->bufferOut = static_cast<char*>(area->data);
1000
+ baton->bufferOutLength = area->length;
1001
+ area->free_fn = nullptr;
1002
+ vips_area_unref(area);
1003
+ baton->formatOut = "jp2";
1004
+ } else if (baton->formatOut == "png" || (baton->formatOut == "input" &&
1005
+ (inputImageType == sharp::ImageType::PNG || inputImageType == sharp::ImageType::SVG))) {
1006
+ // Write PNG to buffer
1007
+ sharp::AssertImageTypeDimensions(image, sharp::ImageType::PNG);
1008
+ VipsArea *area = reinterpret_cast<VipsArea*>(image.pngsave_buffer(VImage::option()
1009
+ ->set("keep", baton->keepMetadata)
1010
+ ->set("interlace", baton->pngProgressive)
1011
+ ->set("compression", baton->pngCompressionLevel)
1012
+ ->set("filter", baton->pngAdaptiveFiltering ? VIPS_FOREIGN_PNG_FILTER_ALL : VIPS_FOREIGN_PNG_FILTER_NONE)
1013
+ ->set("palette", baton->pngPalette)
1014
+ ->set("Q", baton->pngQuality)
1015
+ ->set("effort", baton->pngEffort)
1016
+ ->set("bitdepth", sharp::Is16Bit(image.interpretation()) ? 16 : baton->pngBitdepth)
1017
+ ->set("dither", baton->pngDither)));
1018
+ baton->bufferOut = static_cast<char*>(area->data);
1019
+ baton->bufferOutLength = area->length;
1020
+ area->free_fn = nullptr;
1021
+ vips_area_unref(area);
1022
+ baton->formatOut = "png";
1023
+ } else if (baton->formatOut == "webp" ||
1024
+ (baton->formatOut == "input" && inputImageType == sharp::ImageType::WEBP)) {
1025
+ // Write WEBP to buffer
1026
+ sharp::AssertImageTypeDimensions(image, sharp::ImageType::WEBP);
1027
+ VipsArea *area = reinterpret_cast<VipsArea*>(image.webpsave_buffer(VImage::option()
1028
+ ->set("keep", baton->keepMetadata)
1029
+ ->set("Q", baton->webpQuality)
1030
+ ->set("lossless", baton->webpLossless)
1031
+ ->set("near_lossless", baton->webpNearLossless)
1032
+ ->set("smart_subsample", baton->webpSmartSubsample)
1033
+ ->set("smart_deblock", baton->webpSmartDeblock)
1034
+ ->set("preset", baton->webpPreset)
1035
+ ->set("effort", baton->webpEffort)
1036
+ ->set("min_size", baton->webpMinSize)
1037
+ ->set("mixed", baton->webpMixed)
1038
+ ->set("exact", baton->webpExact)
1039
+ ->set("alpha_q", baton->webpAlphaQuality)));
1040
+ baton->bufferOut = static_cast<char*>(area->data);
1041
+ baton->bufferOutLength = area->length;
1042
+ area->free_fn = nullptr;
1043
+ vips_area_unref(area);
1044
+ baton->formatOut = "webp";
1045
+ } else if (baton->formatOut == "gif" ||
1046
+ (baton->formatOut == "input" && inputImageType == sharp::ImageType::GIF)) {
1047
+ // Write GIF to buffer
1048
+ sharp::AssertImageTypeDimensions(image, sharp::ImageType::GIF);
1049
+ VipsArea *area = reinterpret_cast<VipsArea*>(image.gifsave_buffer(VImage::option()
1050
+ ->set("keep", baton->keepMetadata)
1051
+ ->set("bitdepth", baton->gifBitdepth)
1052
+ ->set("effort", baton->gifEffort)
1053
+ ->set("reuse", baton->gifReuse)
1054
+ ->set("interlace", baton->gifProgressive)
1055
+ ->set("interframe_maxerror", baton->gifInterFrameMaxError)
1056
+ ->set("interpalette_maxerror", baton->gifInterPaletteMaxError)
1057
+ ->set("keep_duplicate_frames", baton->gifKeepDuplicateFrames)
1058
+ ->set("dither", baton->gifDither)));
1059
+ baton->bufferOut = static_cast<char*>(area->data);
1060
+ baton->bufferOutLength = area->length;
1061
+ area->free_fn = nullptr;
1062
+ vips_area_unref(area);
1063
+ baton->formatOut = "gif";
1064
+ } else if (baton->formatOut == "tiff" ||
1065
+ (baton->formatOut == "input" && inputImageType == sharp::ImageType::TIFF)) {
1066
+ // Write TIFF to buffer
1067
+ if (baton->tiffCompression == VIPS_FOREIGN_TIFF_COMPRESSION_JPEG) {
1068
+ sharp::AssertImageTypeDimensions(image, sharp::ImageType::JPEG);
1069
+ baton->channels = std::min(baton->channels, 3);
1070
+ baton->hasAlphaOut = false;
1071
+ }
1072
+ // Cast pixel values to float, if required
1073
+ if (baton->tiffPredictor == VIPS_FOREIGN_TIFF_PREDICTOR_FLOAT) {
1074
+ image = image.cast(VIPS_FORMAT_FLOAT);
1075
+ }
1076
+ VipsArea *area = reinterpret_cast<VipsArea*>(image.tiffsave_buffer(VImage::option()
1077
+ ->set("keep", baton->keepMetadata)
1078
+ ->set("Q", baton->tiffQuality)
1079
+ ->set("bitdepth", baton->tiffBitdepth)
1080
+ ->set("compression", baton->tiffCompression)
1081
+ ->set("bigtiff", baton->tiffBigtiff)
1082
+ ->set("miniswhite", baton->tiffMiniswhite)
1083
+ ->set("predictor", baton->tiffPredictor)
1084
+ ->set("pyramid", baton->tiffPyramid)
1085
+ ->set("tile", baton->tiffTile)
1086
+ ->set("tile_height", baton->tiffTileHeight)
1087
+ ->set("tile_width", baton->tiffTileWidth)
1088
+ ->set("xres", baton->tiffXres)
1089
+ ->set("yres", baton->tiffYres)
1090
+ ->set("resunit", baton->tiffResolutionUnit)));
1091
+ baton->bufferOut = static_cast<char*>(area->data);
1092
+ baton->bufferOutLength = area->length;
1093
+ area->free_fn = nullptr;
1094
+ vips_area_unref(area);
1095
+ baton->formatOut = "tiff";
1096
+ } else if (baton->formatOut == "heif" ||
1097
+ (baton->formatOut == "input" && inputImageType == sharp::ImageType::HEIF)) {
1098
+ // Write HEIF to buffer
1099
+ sharp::AssertImageTypeDimensions(image, sharp::ImageType::HEIF);
1100
+ image = sharp::RemoveAnimationProperties(image);
1101
+ VipsArea *area = reinterpret_cast<VipsArea*>(image.heifsave_buffer(VImage::option()
1102
+ ->set("keep", baton->keepMetadata)
1103
+ ->set("Q", baton->heifQuality)
1104
+ ->set("compression", baton->heifCompression)
1105
+ ->set("effort", baton->heifEffort)
1106
+ ->set("bitdepth", baton->heifBitdepth)
1107
+ ->set("tune", baton->heifTune.c_str())
1108
+ ->set("subsample_mode", baton->heifChromaSubsampling == "4:4:4"
1109
+ ? VIPS_FOREIGN_SUBSAMPLE_OFF : VIPS_FOREIGN_SUBSAMPLE_ON)
1110
+ ->set("lossless", baton->heifLossless)));
1111
+ baton->bufferOut = static_cast<char*>(area->data);
1112
+ baton->bufferOutLength = area->length;
1113
+ area->free_fn = nullptr;
1114
+ vips_area_unref(area);
1115
+ baton->formatOut = "heif";
1116
+ } else if (baton->formatOut == "dz") {
1117
+ // Write DZ to buffer
1118
+ baton->tileContainer = VIPS_FOREIGN_DZ_CONTAINER_ZIP;
1119
+ if (!image.has_alpha()) {
1120
+ baton->tileBackground.pop_back();
1121
+ }
1122
+ image = sharp::StaySequential(image, baton->tileAngle != 0);
1123
+ vips::VOption *options = BuildOptionsDZ(baton);
1124
+ VipsArea *area = reinterpret_cast<VipsArea*>(image.dzsave_buffer(options));
1125
+ baton->bufferOut = static_cast<char*>(area->data);
1126
+ baton->bufferOutLength = area->length;
1127
+ area->free_fn = nullptr;
1128
+ vips_area_unref(area);
1129
+ baton->formatOut = "dz";
1130
+ if (baton->tileFormat == "jpeg") {
1131
+ baton->hasAlphaOut = false;
1132
+ }
1133
+ } else if (baton->formatOut == "jxl" ||
1134
+ (baton->formatOut == "input" && inputImageType == sharp::ImageType::JXL)) {
1135
+ // Write JXL to buffer
1136
+ image = sharp::RemoveAnimationProperties(image);
1137
+ VipsArea *area = reinterpret_cast<VipsArea*>(image.jxlsave_buffer(VImage::option()
1138
+ ->set("keep", baton->keepMetadata)
1139
+ ->set("distance", baton->jxlDistance)
1140
+ ->set("tier", baton->jxlDecodingTier)
1141
+ ->set("effort", baton->jxlEffort)
1142
+ ->set("lossless", baton->jxlLossless)));
1143
+ baton->bufferOut = static_cast<char*>(area->data);
1144
+ baton->bufferOutLength = area->length;
1145
+ area->free_fn = nullptr;
1146
+ vips_area_unref(area);
1147
+ baton->formatOut = "jxl";
1148
+ } else if (baton->formatOut == "raw" ||
1149
+ (baton->formatOut == "input" && inputImageType == sharp::ImageType::RAW)) {
1150
+ // Write raw, uncompressed image data to buffer
1151
+ if (baton->greyscale || image.interpretation() == VIPS_INTERPRETATION_B_W) {
1152
+ // Extract first band for greyscale image
1153
+ image = image[0];
1154
+ baton->channels = 1;
1155
+ }
1156
+ if (image.format() != baton->rawDepth) {
1157
+ // Cast pixels to requested format
1158
+ image = image.cast(baton->rawDepth);
1159
+ }
1160
+ // Get raw image data
1161
+ baton->bufferOut = static_cast<char*>(image.write_to_memory(&baton->bufferOutLength));
1162
+ if (baton->bufferOut == nullptr) {
1163
+ throw std::runtime_error("Could not allocate enough memory for raw output");
1164
+ }
1165
+ baton->formatOut = "raw";
1166
+ } else {
1167
+ // Unsupported output format
1168
+ auto unsupported = std::string("Unsupported output format ");
1169
+ if (baton->formatOut == "input") {
1170
+ unsupported.append("when trying to match input format of ");
1171
+ unsupported.append(ImageTypeId(inputImageType));
1172
+ } else {
1173
+ unsupported.append(baton->formatOut);
1174
+ }
1175
+ throw std::runtime_error(unsupported);
1176
+ }
1177
+ } else {
1178
+ // File output
1179
+ bool const isJpeg = sharp::IsJpeg(baton->fileOut);
1180
+ bool const isPng = sharp::IsPng(baton->fileOut);
1181
+ bool const isWebp = sharp::IsWebp(baton->fileOut);
1182
+ bool const isGif = sharp::IsGif(baton->fileOut);
1183
+ bool const isTiff = sharp::IsTiff(baton->fileOut);
1184
+ bool const isJp2 = sharp::IsJp2(baton->fileOut);
1185
+ bool const isHeif = sharp::IsHeif(baton->fileOut);
1186
+ bool const isJxl = sharp::IsJxl(baton->fileOut);
1187
+ bool const isDz = sharp::IsDz(baton->fileOut);
1188
+ bool const isDzZip = sharp::IsDzZip(baton->fileOut);
1189
+ bool const isV = sharp::IsV(baton->fileOut);
1190
+ bool const mightMatchInput = baton->formatOut == "input";
1191
+ bool const willMatchInput = mightMatchInput &&
1192
+ !(isJpeg || isPng || isWebp || isGif || isTiff || isJp2 || isHeif || isDz || isDzZip || isV);
1193
+
1194
+ if (baton->formatOut == "jpeg" || (mightMatchInput && isJpeg) ||
1195
+ (willMatchInput && inputImageType == sharp::ImageType::JPEG)) {
1196
+ // Write JPEG to file
1197
+ sharp::AssertImageTypeDimensions(image, sharp::ImageType::JPEG);
1198
+ if (baton->keepGainMap) {
1199
+ image = ReattachGainMap(image, gainMap, baton);
1200
+ image.uhdrsave(const_cast<char*>(baton->fileOut.data()), VImage::option()
1201
+ ->set("keep", baton->keepMetadata)
1202
+ ->set("Q", baton->jpegQuality)
1203
+ ->set("gainmap_scale_factor", gainMapScaleFactor));
1204
+ } else {
1205
+ image.jpegsave(const_cast<char*>(baton->fileOut.data()), VImage::option()
1206
+ ->set("keep", baton->keepMetadata)
1207
+ ->set("Q", baton->jpegQuality)
1208
+ ->set("interlace", baton->jpegProgressive)
1209
+ ->set("subsample_mode", baton->jpegChromaSubsampling == "4:4:4"
1210
+ ? VIPS_FOREIGN_SUBSAMPLE_OFF
1211
+ : VIPS_FOREIGN_SUBSAMPLE_ON)
1212
+ ->set("trellis_quant", baton->jpegTrellisQuantisation)
1213
+ ->set("quant_table", baton->jpegQuantisationTable)
1214
+ ->set("overshoot_deringing", baton->jpegOvershootDeringing)
1215
+ ->set("optimize_scans", baton->jpegOptimiseScans)
1216
+ ->set("optimize_coding", baton->jpegOptimiseCoding));
1217
+ }
1218
+ baton->formatOut = "jpeg";
1219
+ baton->channels = std::min(baton->channels, 3);
1220
+ baton->hasAlphaOut = false;
1221
+ } else if (baton->formatOut == "jp2" || (mightMatchInput && isJp2) ||
1222
+ (willMatchInput && (inputImageType == sharp::ImageType::JP2))) {
1223
+ // Write JP2 to file
1224
+ sharp::AssertImageTypeDimensions(image, sharp::ImageType::JP2);
1225
+ image.jp2ksave(const_cast<char*>(baton->fileOut.data()), VImage::option()
1226
+ ->set("Q", baton->jp2Quality)
1227
+ ->set("lossless", baton->jp2Lossless)
1228
+ ->set("subsample_mode", baton->jp2ChromaSubsampling == "4:4:4"
1229
+ ? VIPS_FOREIGN_SUBSAMPLE_OFF : VIPS_FOREIGN_SUBSAMPLE_ON)
1230
+ ->set("tile_height", baton->jp2TileHeight)
1231
+ ->set("tile_width", baton->jp2TileWidth));
1232
+ baton->formatOut = "jp2";
1233
+ } else if (baton->formatOut == "png" || (mightMatchInput && isPng) || (willMatchInput &&
1234
+ (inputImageType == sharp::ImageType::PNG || inputImageType == sharp::ImageType::SVG))) {
1235
+ // Write PNG to file
1236
+ sharp::AssertImageTypeDimensions(image, sharp::ImageType::PNG);
1237
+ image.pngsave(const_cast<char*>(baton->fileOut.data()), VImage::option()
1238
+ ->set("keep", baton->keepMetadata)
1239
+ ->set("interlace", baton->pngProgressive)
1240
+ ->set("compression", baton->pngCompressionLevel)
1241
+ ->set("filter", baton->pngAdaptiveFiltering ? VIPS_FOREIGN_PNG_FILTER_ALL : VIPS_FOREIGN_PNG_FILTER_NONE)
1242
+ ->set("palette", baton->pngPalette)
1243
+ ->set("Q", baton->pngQuality)
1244
+ ->set("bitdepth", sharp::Is16Bit(image.interpretation()) ? 16 : baton->pngBitdepth)
1245
+ ->set("effort", baton->pngEffort)
1246
+ ->set("dither", baton->pngDither));
1247
+ baton->formatOut = "png";
1248
+ } else if (baton->formatOut == "webp" || (mightMatchInput && isWebp) ||
1249
+ (willMatchInput && inputImageType == sharp::ImageType::WEBP)) {
1250
+ // Write WEBP to file
1251
+ sharp::AssertImageTypeDimensions(image, sharp::ImageType::WEBP);
1252
+ image.webpsave(const_cast<char*>(baton->fileOut.data()), VImage::option()
1253
+ ->set("keep", baton->keepMetadata)
1254
+ ->set("Q", baton->webpQuality)
1255
+ ->set("lossless", baton->webpLossless)
1256
+ ->set("near_lossless", baton->webpNearLossless)
1257
+ ->set("smart_subsample", baton->webpSmartSubsample)
1258
+ ->set("smart_deblock", baton->webpSmartDeblock)
1259
+ ->set("preset", baton->webpPreset)
1260
+ ->set("effort", baton->webpEffort)
1261
+ ->set("min_size", baton->webpMinSize)
1262
+ ->set("mixed", baton->webpMixed)
1263
+ ->set("exact", baton->webpExact)
1264
+ ->set("alpha_q", baton->webpAlphaQuality));
1265
+ baton->formatOut = "webp";
1266
+ } else if (baton->formatOut == "gif" || (mightMatchInput && isGif) ||
1267
+ (willMatchInput && inputImageType == sharp::ImageType::GIF)) {
1268
+ // Write GIF to file
1269
+ sharp::AssertImageTypeDimensions(image, sharp::ImageType::GIF);
1270
+ image.gifsave(const_cast<char*>(baton->fileOut.data()), VImage::option()
1271
+ ->set("keep", baton->keepMetadata)
1272
+ ->set("bitdepth", baton->gifBitdepth)
1273
+ ->set("effort", baton->gifEffort)
1274
+ ->set("reuse", baton->gifReuse)
1275
+ ->set("interlace", baton->gifProgressive)
1276
+ ->set("interframe_maxerror", baton->gifInterFrameMaxError)
1277
+ ->set("interpalette_maxerror", baton->gifInterPaletteMaxError)
1278
+ ->set("keep_duplicate_frames", baton->gifKeepDuplicateFrames)
1279
+ ->set("dither", baton->gifDither));
1280
+ baton->formatOut = "gif";
1281
+ } else if (baton->formatOut == "tiff" || (mightMatchInput && isTiff) ||
1282
+ (willMatchInput && inputImageType == sharp::ImageType::TIFF)) {
1283
+ // Write TIFF to file
1284
+ if (baton->tiffCompression == VIPS_FOREIGN_TIFF_COMPRESSION_JPEG) {
1285
+ sharp::AssertImageTypeDimensions(image, sharp::ImageType::JPEG);
1286
+ baton->channels = std::min(baton->channels, 3);
1287
+ baton->hasAlphaOut = false;
1288
+ }
1289
+ // Cast pixel values to float, if required
1290
+ if (baton->tiffPredictor == VIPS_FOREIGN_TIFF_PREDICTOR_FLOAT) {
1291
+ image = image.cast(VIPS_FORMAT_FLOAT);
1292
+ }
1293
+ image.tiffsave(const_cast<char*>(baton->fileOut.data()), VImage::option()
1294
+ ->set("keep", baton->keepMetadata)
1295
+ ->set("Q", baton->tiffQuality)
1296
+ ->set("bitdepth", baton->tiffBitdepth)
1297
+ ->set("compression", baton->tiffCompression)
1298
+ ->set("bigtiff", baton->tiffBigtiff)
1299
+ ->set("miniswhite", baton->tiffMiniswhite)
1300
+ ->set("predictor", baton->tiffPredictor)
1301
+ ->set("pyramid", baton->tiffPyramid)
1302
+ ->set("tile", baton->tiffTile)
1303
+ ->set("tile_height", baton->tiffTileHeight)
1304
+ ->set("tile_width", baton->tiffTileWidth)
1305
+ ->set("xres", baton->tiffXres)
1306
+ ->set("yres", baton->tiffYres)
1307
+ ->set("resunit", baton->tiffResolutionUnit));
1308
+ baton->formatOut = "tiff";
1309
+ } else if (baton->formatOut == "heif" || (mightMatchInput && isHeif) ||
1310
+ (willMatchInput && inputImageType == sharp::ImageType::HEIF)) {
1311
+ // Write HEIF to file
1312
+ sharp::AssertImageTypeDimensions(image, sharp::ImageType::HEIF);
1313
+ image = sharp::RemoveAnimationProperties(image);
1314
+ image.heifsave(const_cast<char*>(baton->fileOut.data()), VImage::option()
1315
+ ->set("keep", baton->keepMetadata)
1316
+ ->set("Q", baton->heifQuality)
1317
+ ->set("compression", baton->heifCompression)
1318
+ ->set("effort", baton->heifEffort)
1319
+ ->set("bitdepth", baton->heifBitdepth)
1320
+ ->set("tune", baton->heifTune.c_str())
1321
+ ->set("subsample_mode", baton->heifChromaSubsampling == "4:4:4"
1322
+ ? VIPS_FOREIGN_SUBSAMPLE_OFF : VIPS_FOREIGN_SUBSAMPLE_ON)
1323
+ ->set("lossless", baton->heifLossless));
1324
+ baton->formatOut = "heif";
1325
+ } else if (baton->formatOut == "jxl" || (mightMatchInput && isJxl) ||
1326
+ (willMatchInput && inputImageType == sharp::ImageType::JXL)) {
1327
+ // Write JXL to file
1328
+ image = sharp::RemoveAnimationProperties(image);
1329
+ image.jxlsave(const_cast<char*>(baton->fileOut.data()), VImage::option()
1330
+ ->set("keep", baton->keepMetadata)
1331
+ ->set("distance", baton->jxlDistance)
1332
+ ->set("tier", baton->jxlDecodingTier)
1333
+ ->set("effort", baton->jxlEffort)
1334
+ ->set("lossless", baton->jxlLossless));
1335
+ baton->formatOut = "jxl";
1336
+ } else if (baton->formatOut == "dz" || isDz || isDzZip) {
1337
+ // Write DZ to file
1338
+ if (isDzZip) {
1339
+ baton->tileContainer = VIPS_FOREIGN_DZ_CONTAINER_ZIP;
1340
+ }
1341
+ if (!image.has_alpha()) {
1342
+ baton->tileBackground.pop_back();
1343
+ }
1344
+ image = sharp::StaySequential(image, baton->tileAngle != 0);
1345
+ vips::VOption *options = BuildOptionsDZ(baton);
1346
+ image.dzsave(const_cast<char*>(baton->fileOut.data()), options);
1347
+ baton->formatOut = "dz";
1348
+ if (baton->tileFormat == "jpeg") {
1349
+ baton->hasAlphaOut = false;
1350
+ }
1351
+ } else if (baton->formatOut == "v" || (mightMatchInput && isV) ||
1352
+ (willMatchInput && inputImageType == sharp::ImageType::VIPS)) {
1353
+ // Write V to file
1354
+ image.vipssave(const_cast<char*>(baton->fileOut.data()), VImage::option()
1355
+ ->set("keep", baton->keepMetadata));
1356
+ baton->formatOut = "v";
1357
+ } else {
1358
+ // Unsupported output format
1359
+ (baton->err).append("Unsupported output format " + baton->fileOut);
1360
+ return Error();
1361
+ }
1362
+ }
1363
+ } catch (std::runtime_error const &err) {
1364
+ char const *what = err.what();
1365
+ if (what && what[0]) {
1366
+ (baton->err).append(what);
1367
+ } else {
1368
+ if (baton->input->failOn == VIPS_FAIL_ON_WARNING) {
1369
+ (baton->err).append("Warning treated as error due to failOn setting");
1370
+ baton->errUseWarning = true;
1371
+ } else {
1372
+ (baton->err).append("Unknown error");
1373
+ }
1374
+ }
1375
+ }
1376
+ // Clean up libvips' per-request data and threads
1377
+ vips_error_clear();
1378
+ vips_thread_shutdown();
1379
+ }
1380
+
1381
+ void OnOK() {
1382
+ Napi::Env env = Env();
1383
+ Napi::HandleScope scope(env);
1384
+
1385
+ // Handle warnings
1386
+ std::string warning = sharp::VipsWarningPop();
1387
+ while (!warning.empty()) {
1388
+ if (baton->errUseWarning) {
1389
+ (baton->err).append("\n").append(warning);
1390
+ } else {
1391
+ debuglog.SHARP_CALLBACK_FN_NAME(Receiver().Value(), { Napi::String::New(env, warning) });
1392
+ }
1393
+ warning = sharp::VipsWarningPop();
1394
+ }
1395
+ if (baton->err.empty()) {
1396
+ int width = baton->width;
1397
+ int height = baton->height;
1398
+ if (baton->topOffsetPre != -1 && (baton->width == -1 || baton->height == -1)) {
1399
+ width = baton->widthPre;
1400
+ height = baton->heightPre;
1401
+ }
1402
+ if (baton->topOffsetPost != -1) {
1403
+ width = baton->widthPost;
1404
+ height = baton->heightPost;
1405
+ }
1406
+ // Info Object
1407
+ Napi::Object info = Napi::Object::New(env);
1408
+ info.Set("format", baton->formatOut);
1409
+ info.Set("width", static_cast<uint32_t>(width));
1410
+ info.Set("height", static_cast<uint32_t>(height));
1411
+ info.Set("channels", static_cast<uint32_t>(baton->channels));
1412
+ if (baton->formatOut == "raw") {
1413
+ info.Set("depth", vips_enum_nick(VIPS_TYPE_BAND_FORMAT, baton->rawDepth));
1414
+ }
1415
+ info.Set("premultiplied", baton->premultiplied);
1416
+ if (baton->hasCropOffset) {
1417
+ info.Set("cropOffsetLeft", static_cast<int32_t>(baton->cropOffsetLeft));
1418
+ info.Set("cropOffsetTop", static_cast<int32_t>(baton->cropOffsetTop));
1419
+ }
1420
+ if (baton->hasAttentionCenter) {
1421
+ info.Set("attentionX", static_cast<int32_t>(baton->attentionX));
1422
+ info.Set("attentionY", static_cast<int32_t>(baton->attentionY));
1423
+ }
1424
+ if (baton->trimThreshold >= 0.0) {
1425
+ info.Set("trimOffsetLeft", static_cast<int32_t>(baton->trimOffsetLeft));
1426
+ info.Set("trimOffsetTop", static_cast<int32_t>(baton->trimOffsetTop));
1427
+ }
1428
+ if (baton->input->textAutofitDpi) {
1429
+ info.Set("textAutofitDpi", static_cast<uint32_t>(baton->input->textAutofitDpi));
1430
+ }
1431
+ if (baton->pageHeightOut) {
1432
+ info.Set("pageHeight", static_cast<int32_t>(baton->pageHeightOut));
1433
+ info.Set("pages", static_cast<int32_t>(baton->pagesOut));
1434
+ }
1435
+ info.Set("hasAlpha", baton->hasAlphaOut);
1436
+
1437
+ if (baton->bufferOutLength > 0) {
1438
+ info.Set("size", static_cast<uint32_t>(baton->bufferOutLength));
1439
+ if (baton->typedArrayOut) {
1440
+ // ECMAScript ArrayBuffer with Uint8Array view
1441
+ Napi::TypedArrayOf<uint8_t> data = Napi::Buffer<char>::Copy(env,
1442
+ static_cast<char*>(baton->bufferOut), baton->bufferOutLength);
1443
+ sharp::FreeCallback(static_cast<char*>(baton->bufferOut), nullptr);
1444
+ Callback().SHARP_CALLBACK_FN_NAME(Receiver().Value(), { env.Null(), data, info });
1445
+ } else {
1446
+ // Node.js Buffer
1447
+ Napi::Buffer<char> data = Napi::Buffer<char>::NewOrCopy(env, static_cast<char*>(baton->bufferOut),
1448
+ baton->bufferOutLength, sharp::FreeCallback);
1449
+ Callback().SHARP_CALLBACK_FN_NAME(Receiver().Value(), { env.Null(), data, info });
1450
+ }
1451
+ } else {
1452
+ // Add file size to info
1453
+ if (baton->formatOut != "dz" || sharp::IsDzZip(baton->fileOut)) {
1454
+ try {
1455
+ uint32_t const size = static_cast<uint32_t>(
1456
+ std::filesystem::file_size(std::filesystem::u8path(baton->fileOut)));
1457
+ info.Set("size", size);
1458
+ } catch (...) {}
1459
+ }
1460
+ Callback().SHARP_CALLBACK_FN_NAME(Receiver().Value(), { env.Null(), info });
1461
+ }
1462
+ } else {
1463
+ Callback().SHARP_CALLBACK_FN_NAME(Receiver().Value(),
1464
+ { Napi::Error::New(env, sharp::TrimEnd(baton->err)).Value() });
1465
+ }
1466
+
1467
+ // Delete baton
1468
+ delete baton->input;
1469
+ delete baton->boolean;
1470
+ for (Composite *composite : baton->composite) {
1471
+ delete composite->input;
1472
+ delete composite;
1473
+ }
1474
+ for (sharp::InputDescriptor *input : baton->joinChannelIn) {
1475
+ delete input;
1476
+ }
1477
+ for (sharp::InputDescriptor *input : baton->join) {
1478
+ delete input;
1479
+ }
1480
+ delete baton;
1481
+
1482
+ // Decrement processing task counter
1483
+ sharp::counterProcess--;
1484
+ Napi::Number queueLength = Napi::Number::New(env, static_cast<int>(sharp::counterQueue));
1485
+ queueListener.SHARP_CALLBACK_FN_NAME(Receiver().Value(), { queueLength });
1486
+ }
1487
+
1488
+ private:
1489
+ PipelineBaton *baton;
1490
+ Napi::FunctionReference debuglog;
1491
+ Napi::FunctionReference queueListener;
1492
+
1493
+ void MultiPageUnsupported(int const pages, std::string op) {
1494
+ if (pages > 1) {
1495
+ throw std::runtime_error(op + " is not supported for multi-page images");
1496
+ }
1497
+ }
1498
+
1499
+ void KeepGainMapUnsupported(bool const keepGainMap, std::string op) {
1500
+ if (keepGainMap) {
1501
+ throw std::runtime_error(op + " is not supported when keeping gain maps");
1502
+ }
1503
+ }
1504
+
1505
+ /*
1506
+ Calculate the angle of rotation and need-to-flip for the given Exif orientation
1507
+ By default, returns zero, i.e. no rotation.
1508
+ */
1509
+ std::tuple<VipsAngle, bool>
1510
+ CalculateExifRotationAndFlop(int const exifOrientation) {
1511
+ VipsAngle rotate = VIPS_ANGLE_D0;
1512
+ bool flop = false;
1513
+ switch (exifOrientation) {
1514
+ case 6: rotate = VIPS_ANGLE_D90; break;
1515
+ case 3: rotate = VIPS_ANGLE_D180; break;
1516
+ case 8: rotate = VIPS_ANGLE_D270; break;
1517
+ case 2: flop = true; break;
1518
+ case 7: flop = true; rotate = VIPS_ANGLE_D270; break;
1519
+ case 4: flop = true; rotate = VIPS_ANGLE_D180; break;
1520
+ case 5: flop = true; rotate = VIPS_ANGLE_D90; break;
1521
+ }
1522
+ return std::make_tuple(rotate, flop);
1523
+ }
1524
+
1525
+ /*
1526
+ Calculate the rotation for the given angle.
1527
+ Supports any positive or negative angle that is a multiple of 90.
1528
+ */
1529
+ VipsAngle
1530
+ CalculateAngleRotation(int angle) {
1531
+ angle = angle % 360;
1532
+ if (angle < 0)
1533
+ angle = 360 + angle;
1534
+ switch (angle) {
1535
+ case 90: return VIPS_ANGLE_D90;
1536
+ case 180: return VIPS_ANGLE_D180;
1537
+ case 270: return VIPS_ANGLE_D270;
1538
+ }
1539
+ return VIPS_ANGLE_D0;
1540
+ }
1541
+
1542
+ /*
1543
+ Assemble the suffix argument to dzsave, which is the format (by extname)
1544
+ alongside comma-separated arguments to the corresponding `formatsave` vips
1545
+ action.
1546
+ */
1547
+ std::string
1548
+ AssembleSuffixString(std::string extname, std::vector<std::pair<std::string, std::string>> options) {
1549
+ std::string argument;
1550
+ for (const auto& [key, value] : options) {
1551
+ if (!argument.empty()) {
1552
+ argument += ",";
1553
+ }
1554
+ argument += key + "=" + value;
1555
+ }
1556
+ return extname + "[" + argument + "]";
1557
+ }
1558
+
1559
+ /*
1560
+ Build VOption for dzsave
1561
+ */
1562
+ vips::VOption*
1563
+ BuildOptionsDZ(PipelineBaton *baton) {
1564
+ // Forward format options through suffix
1565
+ std::string suffix;
1566
+ if (baton->tileFormat == "png") {
1567
+ std::vector<std::pair<std::string, std::string>> options {
1568
+ {"interlace", baton->pngProgressive ? "true" : "false"},
1569
+ {"compression", std::to_string(baton->pngCompressionLevel)},
1570
+ {"filter", baton->pngAdaptiveFiltering ? "all" : "none"}
1571
+ };
1572
+ suffix = AssembleSuffixString(".png", options);
1573
+ } else if (baton->tileFormat == "webp") {
1574
+ std::vector<std::pair<std::string, std::string>> options {
1575
+ {"Q", std::to_string(baton->webpQuality)},
1576
+ {"alpha_q", std::to_string(baton->webpAlphaQuality)},
1577
+ {"lossless", baton->webpLossless ? "true" : "false"},
1578
+ {"near_lossless", baton->webpNearLossless ? "true" : "false"},
1579
+ {"smart_subsample", baton->webpSmartSubsample ? "true" : "false"},
1580
+ {"smart_deblock", baton->webpSmartDeblock ? "true" : "false"},
1581
+ {"preset", vips_enum_nick(VIPS_TYPE_FOREIGN_WEBP_PRESET, baton->webpPreset)},
1582
+ {"min_size", baton->webpMinSize ? "true" : "false"},
1583
+ {"mixed", baton->webpMixed ? "true" : "false"},
1584
+ {"exact", baton->webpExact ? "true" : "false"},
1585
+ {"effort", std::to_string(baton->webpEffort)}
1586
+ };
1587
+ suffix = AssembleSuffixString(".webp", options);
1588
+ } else {
1589
+ std::vector<std::pair<std::string, std::string>> options {
1590
+ {"Q", std::to_string(baton->jpegQuality)},
1591
+ {"interlace", baton->jpegProgressive ? "true" : "false"},
1592
+ {"subsample_mode", baton->jpegChromaSubsampling == "4:4:4" ? "off" : "on"},
1593
+ {"trellis_quant", baton->jpegTrellisQuantisation ? "true" : "false"},
1594
+ {"quant_table", std::to_string(baton->jpegQuantisationTable)},
1595
+ {"overshoot_deringing", baton->jpegOvershootDeringing ? "true": "false"},
1596
+ {"optimize_scans", baton->jpegOptimiseScans ? "true": "false"},
1597
+ {"optimize_coding", baton->jpegOptimiseCoding ? "true": "false"}
1598
+ };
1599
+ std::string extname = baton->tileLayout == VIPS_FOREIGN_DZ_LAYOUT_DZ ? ".jpeg" : ".jpg";
1600
+ suffix = AssembleSuffixString(extname, options);
1601
+ }
1602
+ vips::VOption *options = VImage::option()
1603
+ ->set("keep", baton->keepMetadata)
1604
+ ->set("tile_size", baton->tileSize)
1605
+ ->set("overlap", baton->tileOverlap)
1606
+ ->set("container", baton->tileContainer)
1607
+ ->set("layout", baton->tileLayout)
1608
+ ->set("suffix", const_cast<char*>(suffix.data()))
1609
+ ->set("angle", CalculateAngleRotation(baton->tileAngle))
1610
+ ->set("background", baton->tileBackground)
1611
+ ->set("centre", baton->tileCentre)
1612
+ ->set("id", const_cast<char*>(baton->tileId.data()))
1613
+ ->set("skip_blanks", baton->tileSkipBlanks);
1614
+ if (baton->tileDepth < VIPS_FOREIGN_DZ_DEPTH_LAST) {
1615
+ options->set("depth", baton->tileDepth);
1616
+ }
1617
+ if (!baton->tileBasename.empty()) {
1618
+ options->set("basename", const_cast<char*>(baton->tileBasename.data()));
1619
+ }
1620
+ return options;
1621
+ }
1622
+
1623
+ VImage ReattachGainMap(VImage image, VImage gainMap, PipelineBaton *baton) {
1624
+ VipsArea *gainMapJpeg = reinterpret_cast<VipsArea*>(gainMap.jpegsave_buffer(VImage::option()
1625
+ ->set("keep", FALSE)
1626
+ ->set("Q", baton->jpegQuality)
1627
+ ->set("subsample_mode", VIPS_FOREIGN_SUBSAMPLE_OFF)
1628
+ ->set("trellis_quant", baton->jpegTrellisQuantisation)
1629
+ ->set("quant_table", baton->jpegQuantisationTable)
1630
+ ->set("overshoot_deringing", baton->jpegOvershootDeringing)
1631
+ ->set("optimize_coding", baton->jpegOptimiseCoding)));
1632
+ image = image.copy();
1633
+ image.set("gainmap-data", reinterpret_cast<VipsCallbackFn>(vips_area_free_cb),
1634
+ gainMapJpeg->data, gainMapJpeg->length);
1635
+ return image;
1636
+ }
1637
+
1638
+ /*
1639
+ Clear all thread-local data.
1640
+ */
1641
+ void Error() {
1642
+ // Clean up libvips' per-request data and threads
1643
+ vips_error_clear();
1644
+ vips_thread_shutdown();
1645
+ }
1646
+ };
1647
+
1648
+ /*
1649
+ pipeline(options, output, callback)
1650
+ */
1651
+ Napi::Value pipeline(const Napi::CallbackInfo& info) {
1652
+ // V8 objects are converted to non-V8 types held in the baton struct
1653
+ PipelineBaton *baton = new PipelineBaton;
1654
+ Napi::Object options = info[size_t(0)].As<Napi::Object>();
1655
+
1656
+ // Input
1657
+ baton->input = sharp::CreateInputDescriptor(options.Get("input").As<Napi::Object>());
1658
+ // Join images together
1659
+ if (sharp::HasAttr(options, "join")) {
1660
+ Napi::Array join = options.Get("join").As<Napi::Array>();
1661
+ for (unsigned int i = 0; i < join.Length(); i++) {
1662
+ baton->join.push_back(
1663
+ sharp::CreateInputDescriptor(join.Get(i).As<Napi::Object>()));
1664
+ }
1665
+ }
1666
+ // Extract image options
1667
+ baton->topOffsetPre = sharp::AttrAsInt32(options, "topOffsetPre");
1668
+ baton->leftOffsetPre = sharp::AttrAsInt32(options, "leftOffsetPre");
1669
+ baton->widthPre = sharp::AttrAsInt32(options, "widthPre");
1670
+ baton->heightPre = sharp::AttrAsInt32(options, "heightPre");
1671
+ baton->topOffsetPost = sharp::AttrAsInt32(options, "topOffsetPost");
1672
+ baton->leftOffsetPost = sharp::AttrAsInt32(options, "leftOffsetPost");
1673
+ baton->widthPost = sharp::AttrAsInt32(options, "widthPost");
1674
+ baton->heightPost = sharp::AttrAsInt32(options, "heightPost");
1675
+ // Output image dimensions
1676
+ baton->width = sharp::AttrAsInt32(options, "width");
1677
+ baton->height = sharp::AttrAsInt32(options, "height");
1678
+ // Canvas option
1679
+ std::string canvas = sharp::AttrAsStr(options, "canvas");
1680
+ if (canvas == "crop") {
1681
+ baton->canvas = sharp::Canvas::CROP;
1682
+ } else if (canvas == "embed") {
1683
+ baton->canvas = sharp::Canvas::EMBED;
1684
+ } else if (canvas == "max") {
1685
+ baton->canvas = sharp::Canvas::MAX;
1686
+ } else if (canvas == "min") {
1687
+ baton->canvas = sharp::Canvas::MIN;
1688
+ } else if (canvas == "ignore_aspect") {
1689
+ baton->canvas = sharp::Canvas::IGNORE_ASPECT;
1690
+ }
1691
+ // Composite
1692
+ Napi::Array compositeArray = options.Get("composite").As<Napi::Array>();
1693
+ for (unsigned int i = 0; i < compositeArray.Length(); i++) {
1694
+ Napi::Object compositeObject = compositeArray.Get(i).As<Napi::Object>();
1695
+ Composite *composite = new Composite;
1696
+ composite->input = sharp::CreateInputDescriptor(compositeObject.Get("input").As<Napi::Object>());
1697
+ composite->mode = sharp::AttrAsEnum<VipsBlendMode>(compositeObject, "blend", VIPS_TYPE_BLEND_MODE);
1698
+ composite->gravity = sharp::AttrAsUint32(compositeObject, "gravity");
1699
+ composite->left = sharp::AttrAsInt32(compositeObject, "left");
1700
+ composite->top = sharp::AttrAsInt32(compositeObject, "top");
1701
+ composite->hasOffset = sharp::AttrAsBool(compositeObject, "hasOffset");
1702
+ composite->tile = sharp::AttrAsBool(compositeObject, "tile");
1703
+ composite->premultiplied = sharp::AttrAsBool(compositeObject, "premultiplied");
1704
+ baton->composite.push_back(composite);
1705
+ }
1706
+ // Resize options
1707
+ baton->withoutEnlargement = sharp::AttrAsBool(options, "withoutEnlargement");
1708
+ baton->withoutReduction = sharp::AttrAsBool(options, "withoutReduction");
1709
+ baton->position = sharp::AttrAsInt32(options, "position");
1710
+ baton->resizeBackground = sharp::AttrAsVectorOfDouble(options, "resizeBackground");
1711
+ baton->kernel = sharp::AttrAsEnum<VipsKernel>(options, "kernel", VIPS_TYPE_KERNEL);
1712
+ baton->fastShrinkOnLoad = sharp::AttrAsBool(options, "fastShrinkOnLoad");
1713
+ // Join Channel Options
1714
+ if (options.Has("joinChannelIn")) {
1715
+ Napi::Array joinChannelArray = options.Get("joinChannelIn").As<Napi::Array>();
1716
+ for (unsigned int i = 0; i < joinChannelArray.Length(); i++) {
1717
+ baton->joinChannelIn.push_back(
1718
+ sharp::CreateInputDescriptor(joinChannelArray.Get(i).As<Napi::Object>()));
1719
+ }
1720
+ }
1721
+ // Operators
1722
+ baton->flatten = sharp::AttrAsBool(options, "flatten");
1723
+ baton->flattenBackground = sharp::AttrAsVectorOfDouble(options, "flattenBackground");
1724
+ baton->unflatten = sharp::AttrAsBool(options, "unflatten");
1725
+ baton->negate = sharp::AttrAsBool(options, "negate");
1726
+ baton->negateAlpha = sharp::AttrAsBool(options, "negateAlpha");
1727
+ baton->blurSigma = sharp::AttrAsDouble(options, "blurSigma");
1728
+ baton->precision = sharp::AttrAsEnum<VipsPrecision>(options, "precision", VIPS_TYPE_PRECISION);
1729
+ baton->minAmpl = sharp::AttrAsDouble(options, "minAmpl");
1730
+ baton->brightness = sharp::AttrAsDouble(options, "brightness");
1731
+ baton->saturation = sharp::AttrAsDouble(options, "saturation");
1732
+ baton->hue = sharp::AttrAsInt32(options, "hue");
1733
+ baton->lightness = sharp::AttrAsDouble(options, "lightness");
1734
+ baton->medianSize = sharp::AttrAsUint32(options, "medianSize");
1735
+ baton->sharpenSigma = sharp::AttrAsDouble(options, "sharpenSigma");
1736
+ baton->sharpenM1 = sharp::AttrAsDouble(options, "sharpenM1");
1737
+ baton->sharpenM2 = sharp::AttrAsDouble(options, "sharpenM2");
1738
+ baton->sharpenX1 = sharp::AttrAsDouble(options, "sharpenX1");
1739
+ baton->sharpenY2 = sharp::AttrAsDouble(options, "sharpenY2");
1740
+ baton->sharpenY3 = sharp::AttrAsDouble(options, "sharpenY3");
1741
+ baton->threshold = sharp::AttrAsInt32(options, "threshold");
1742
+ baton->thresholdGrayscale = sharp::AttrAsBool(options, "thresholdGrayscale");
1743
+ baton->trimBackground = sharp::AttrAsVectorOfDouble(options, "trimBackground");
1744
+ baton->trimThreshold = sharp::AttrAsDouble(options, "trimThreshold");
1745
+ baton->trimLineArt = sharp::AttrAsBool(options, "trimLineArt");
1746
+ baton->trimMargin = sharp::AttrAsUint32(options, "trimMargin");
1747
+ baton->gamma = sharp::AttrAsDouble(options, "gamma");
1748
+ baton->gammaOut = sharp::AttrAsDouble(options, "gammaOut");
1749
+ baton->linearA = sharp::AttrAsVectorOfDouble(options, "linearA");
1750
+ baton->linearB = sharp::AttrAsVectorOfDouble(options, "linearB");
1751
+ baton->dilateWidth = sharp::AttrAsUint32(options, "dilateWidth");
1752
+ baton->erodeWidth = sharp::AttrAsUint32(options, "erodeWidth");
1753
+ baton->greyscale = sharp::AttrAsBool(options, "greyscale");
1754
+ baton->normalise = sharp::AttrAsBool(options, "normalise");
1755
+ baton->normaliseLower = sharp::AttrAsUint32(options, "normaliseLower");
1756
+ baton->normaliseUpper = sharp::AttrAsUint32(options, "normaliseUpper");
1757
+ baton->tint = sharp::AttrAsVectorOfDouble(options, "tint");
1758
+ baton->claheWidth = sharp::AttrAsUint32(options, "claheWidth");
1759
+ baton->claheHeight = sharp::AttrAsUint32(options, "claheHeight");
1760
+ baton->claheMaxSlope = sharp::AttrAsUint32(options, "claheMaxSlope");
1761
+ baton->angle = sharp::AttrAsInt32(options, "angle");
1762
+ baton->rotationAngle = sharp::AttrAsDouble(options, "rotationAngle");
1763
+ baton->rotationBackground = sharp::AttrAsVectorOfDouble(options, "rotationBackground");
1764
+ baton->rotateBefore = sharp::AttrAsBool(options, "rotateBefore");
1765
+ baton->orientBefore = sharp::AttrAsBool(options, "orientBefore");
1766
+ baton->flip = sharp::AttrAsBool(options, "flip");
1767
+ baton->flop = sharp::AttrAsBool(options, "flop");
1768
+ baton->extendTop = sharp::AttrAsInt32(options, "extendTop");
1769
+ baton->extendBottom = sharp::AttrAsInt32(options, "extendBottom");
1770
+ baton->extendLeft = sharp::AttrAsInt32(options, "extendLeft");
1771
+ baton->extendRight = sharp::AttrAsInt32(options, "extendRight");
1772
+ baton->extendBackground = sharp::AttrAsVectorOfDouble(options, "extendBackground");
1773
+ baton->extendWith = sharp::AttrAsEnum<VipsExtend>(options, "extendWith", VIPS_TYPE_EXTEND);
1774
+ baton->extractChannel = sharp::AttrAsInt32(options, "extractChannel");
1775
+ baton->affineMatrix = sharp::AttrAsVectorOfDouble(options, "affineMatrix");
1776
+ baton->affineBackground = sharp::AttrAsVectorOfDouble(options, "affineBackground");
1777
+ baton->affineIdx = sharp::AttrAsDouble(options, "affineIdx");
1778
+ baton->affineIdy = sharp::AttrAsDouble(options, "affineIdy");
1779
+ baton->affineOdx = sharp::AttrAsDouble(options, "affineOdx");
1780
+ baton->affineOdy = sharp::AttrAsDouble(options, "affineOdy");
1781
+ baton->affineInterpolator = sharp::AttrAsStr(options, "affineInterpolator");
1782
+ baton->removeAlpha = sharp::AttrAsBool(options, "removeAlpha");
1783
+ baton->ensureAlpha = sharp::AttrAsDouble(options, "ensureAlpha");
1784
+ if (options.Has("boolean")) {
1785
+ baton->boolean = sharp::CreateInputDescriptor(options.Get("boolean").As<Napi::Object>());
1786
+ baton->booleanOp = sharp::AttrAsEnum<VipsOperationBoolean>(options, "booleanOp", VIPS_TYPE_OPERATION_BOOLEAN);
1787
+ }
1788
+ if (options.Has("bandBoolOp")) {
1789
+ baton->bandBoolOp = sharp::AttrAsEnum<VipsOperationBoolean>(options, "bandBoolOp", VIPS_TYPE_OPERATION_BOOLEAN);
1790
+ }
1791
+ if (options.Has("convKernel")) {
1792
+ Napi::Object kernel = options.Get("convKernel").As<Napi::Object>();
1793
+ baton->convKernelWidth = sharp::AttrAsUint32(kernel, "width");
1794
+ baton->convKernelHeight = sharp::AttrAsUint32(kernel, "height");
1795
+ baton->convKernelScale = sharp::AttrAsDouble(kernel, "scale");
1796
+ baton->convKernelOffset = sharp::AttrAsDouble(kernel, "offset");
1797
+ size_t const kernelSize = static_cast<size_t>(baton->convKernelWidth * baton->convKernelHeight);
1798
+ baton->convKernel.resize(kernelSize);
1799
+ Napi::Array kdata = kernel.Get("kernel").As<Napi::Array>();
1800
+ for (unsigned int i = 0; i < kernelSize; i++) {
1801
+ baton->convKernel[i] = sharp::AttrAsDouble(kdata, i);
1802
+ }
1803
+ }
1804
+ if (options.Has("recombMatrix")) {
1805
+ Napi::Array recombMatrix = options.Get("recombMatrix").As<Napi::Array>();
1806
+ unsigned int matrixElements = recombMatrix.Length();
1807
+ baton->recombMatrix.resize(matrixElements);
1808
+ for (unsigned int i = 0; i < matrixElements; i++) {
1809
+ baton->recombMatrix[i] = sharp::AttrAsDouble(recombMatrix, i);
1810
+ }
1811
+ }
1812
+ baton->colourspacePipeline = sharp::AttrAsEnum<VipsInterpretation>(
1813
+ options, "colourspacePipeline", VIPS_TYPE_INTERPRETATION);
1814
+ if (baton->colourspacePipeline == VIPS_INTERPRETATION_ERROR) {
1815
+ baton->colourspacePipeline = VIPS_INTERPRETATION_LAST;
1816
+ }
1817
+ baton->colourspace = sharp::AttrAsEnum<VipsInterpretation>(options, "colourspace", VIPS_TYPE_INTERPRETATION);
1818
+ if (baton->colourspace == VIPS_INTERPRETATION_ERROR) {
1819
+ baton->colourspace = VIPS_INTERPRETATION_sRGB;
1820
+ }
1821
+ // Output
1822
+ baton->formatOut = sharp::AttrAsStr(options, "formatOut");
1823
+ baton->fileOut = sharp::AttrAsStr(options, "fileOut");
1824
+ baton->typedArrayOut = sharp::AttrAsBool(options, "typedArrayOut");
1825
+ baton->keepMetadata = sharp::AttrAsUint32(options, "keepMetadata");
1826
+ baton->withMetadataOrientation = sharp::AttrAsUint32(options, "withMetadataOrientation");
1827
+ baton->withMetadataDensity = sharp::AttrAsDouble(options, "withMetadataDensity");
1828
+ baton->withIccProfile = sharp::AttrAsStr(options, "withIccProfile");
1829
+ Napi::Object withExif = options.Get("withExif").As<Napi::Object>();
1830
+ Napi::Array withExifKeys = withExif.GetPropertyNames();
1831
+ for (unsigned int i = 0; i < withExifKeys.Length(); i++) {
1832
+ std::string k = sharp::AttrAsStr(withExifKeys, i);
1833
+ if (withExif.HasOwnProperty(k)) {
1834
+ baton->withExif.insert(std::make_pair(k, sharp::AttrAsStr(withExif, k)));
1835
+ }
1836
+ }
1837
+ baton->withExifMerge = sharp::AttrAsBool(options, "withExifMerge");
1838
+ baton->withXmp = sharp::AttrAsStr(options, "withXmp");
1839
+ baton->keepGainMap = sharp::AttrAsBool(options, "keepGainMap");
1840
+ baton->withGainMap = sharp::AttrAsBool(options, "withGainMap");
1841
+ baton->timeoutSeconds = sharp::AttrAsUint32(options, "timeoutSeconds");
1842
+ baton->loop = sharp::AttrAsUint32(options, "loop");
1843
+ baton->delay = sharp::AttrAsInt32Vector(options, "delay");
1844
+ // Format-specific
1845
+ baton->jpegQuality = sharp::AttrAsUint32(options, "jpegQuality");
1846
+ baton->jpegProgressive = sharp::AttrAsBool(options, "jpegProgressive");
1847
+ baton->jpegChromaSubsampling = sharp::AttrAsStr(options, "jpegChromaSubsampling");
1848
+ baton->jpegTrellisQuantisation = sharp::AttrAsBool(options, "jpegTrellisQuantisation");
1849
+ baton->jpegQuantisationTable = sharp::AttrAsUint32(options, "jpegQuantisationTable");
1850
+ baton->jpegOvershootDeringing = sharp::AttrAsBool(options, "jpegOvershootDeringing");
1851
+ baton->jpegOptimiseScans = sharp::AttrAsBool(options, "jpegOptimiseScans");
1852
+ baton->jpegOptimiseCoding = sharp::AttrAsBool(options, "jpegOptimiseCoding");
1853
+ baton->pngProgressive = sharp::AttrAsBool(options, "pngProgressive");
1854
+ baton->pngCompressionLevel = sharp::AttrAsUint32(options, "pngCompressionLevel");
1855
+ baton->pngAdaptiveFiltering = sharp::AttrAsBool(options, "pngAdaptiveFiltering");
1856
+ baton->pngPalette = sharp::AttrAsBool(options, "pngPalette");
1857
+ baton->pngQuality = sharp::AttrAsUint32(options, "pngQuality");
1858
+ baton->pngEffort = sharp::AttrAsUint32(options, "pngEffort");
1859
+ baton->pngBitdepth = sharp::AttrAsUint32(options, "pngBitdepth");
1860
+ baton->pngDither = sharp::AttrAsDouble(options, "pngDither");
1861
+ baton->jp2Quality = sharp::AttrAsUint32(options, "jp2Quality");
1862
+ baton->jp2Lossless = sharp::AttrAsBool(options, "jp2Lossless");
1863
+ baton->jp2TileHeight = sharp::AttrAsUint32(options, "jp2TileHeight");
1864
+ baton->jp2TileWidth = sharp::AttrAsUint32(options, "jp2TileWidth");
1865
+ baton->jp2ChromaSubsampling = sharp::AttrAsStr(options, "jp2ChromaSubsampling");
1866
+ baton->webpQuality = sharp::AttrAsUint32(options, "webpQuality");
1867
+ baton->webpAlphaQuality = sharp::AttrAsUint32(options, "webpAlphaQuality");
1868
+ baton->webpLossless = sharp::AttrAsBool(options, "webpLossless");
1869
+ baton->webpNearLossless = sharp::AttrAsBool(options, "webpNearLossless");
1870
+ baton->webpSmartSubsample = sharp::AttrAsBool(options, "webpSmartSubsample");
1871
+ baton->webpSmartDeblock = sharp::AttrAsBool(options, "webpSmartDeblock");
1872
+ baton->webpPreset = sharp::AttrAsEnum<VipsForeignWebpPreset>(options, "webpPreset", VIPS_TYPE_FOREIGN_WEBP_PRESET);
1873
+ baton->webpEffort = sharp::AttrAsUint32(options, "webpEffort");
1874
+ baton->webpMinSize = sharp::AttrAsBool(options, "webpMinSize");
1875
+ baton->webpMixed = sharp::AttrAsBool(options, "webpMixed");
1876
+ baton->webpExact = sharp::AttrAsBool(options, "webpExact");
1877
+ baton->gifBitdepth = sharp::AttrAsUint32(options, "gifBitdepth");
1878
+ baton->gifEffort = sharp::AttrAsUint32(options, "gifEffort");
1879
+ baton->gifDither = sharp::AttrAsDouble(options, "gifDither");
1880
+ baton->gifInterFrameMaxError = sharp::AttrAsDouble(options, "gifInterFrameMaxError");
1881
+ baton->gifInterPaletteMaxError = sharp::AttrAsDouble(options, "gifInterPaletteMaxError");
1882
+ baton->gifKeepDuplicateFrames = sharp::AttrAsBool(options, "gifKeepDuplicateFrames");
1883
+ baton->gifReuse = sharp::AttrAsBool(options, "gifReuse");
1884
+ baton->gifProgressive = sharp::AttrAsBool(options, "gifProgressive");
1885
+ baton->tiffQuality = sharp::AttrAsUint32(options, "tiffQuality");
1886
+ baton->tiffBigtiff = sharp::AttrAsBool(options, "tiffBigtiff");
1887
+ baton->tiffPyramid = sharp::AttrAsBool(options, "tiffPyramid");
1888
+ baton->tiffMiniswhite = sharp::AttrAsBool(options, "tiffMiniswhite");
1889
+ baton->tiffBitdepth = sharp::AttrAsUint32(options, "tiffBitdepth");
1890
+ baton->tiffTile = sharp::AttrAsBool(options, "tiffTile");
1891
+ baton->tiffTileWidth = sharp::AttrAsUint32(options, "tiffTileWidth");
1892
+ baton->tiffTileHeight = sharp::AttrAsUint32(options, "tiffTileHeight");
1893
+ baton->tiffXres = sharp::AttrAsDouble(options, "tiffXres");
1894
+ baton->tiffYres = sharp::AttrAsDouble(options, "tiffYres");
1895
+ if (baton->tiffXres == 1.0 && baton->tiffYres == 1.0 && baton->withMetadataDensity > 0) {
1896
+ baton->tiffXres = baton->tiffYres = baton->withMetadataDensity / 25.4;
1897
+ }
1898
+ baton->tiffCompression = sharp::AttrAsEnum<VipsForeignTiffCompression>(
1899
+ options, "tiffCompression", VIPS_TYPE_FOREIGN_TIFF_COMPRESSION);
1900
+ baton->tiffPredictor = sharp::AttrAsEnum<VipsForeignTiffPredictor>(
1901
+ options, "tiffPredictor", VIPS_TYPE_FOREIGN_TIFF_PREDICTOR);
1902
+ baton->tiffResolutionUnit = sharp::AttrAsEnum<VipsForeignTiffResunit>(
1903
+ options, "tiffResolutionUnit", VIPS_TYPE_FOREIGN_TIFF_RESUNIT);
1904
+ baton->heifQuality = sharp::AttrAsUint32(options, "heifQuality");
1905
+ baton->heifLossless = sharp::AttrAsBool(options, "heifLossless");
1906
+ baton->heifCompression = sharp::AttrAsEnum<VipsForeignHeifCompression>(
1907
+ options, "heifCompression", VIPS_TYPE_FOREIGN_HEIF_COMPRESSION);
1908
+ baton->heifEffort = sharp::AttrAsUint32(options, "heifEffort");
1909
+ baton->heifChromaSubsampling = sharp::AttrAsStr(options, "heifChromaSubsampling");
1910
+ baton->heifBitdepth = sharp::AttrAsUint32(options, "heifBitdepth");
1911
+ baton->heifTune = sharp::AttrAsStr(options, "heifTune");
1912
+ baton->jxlDistance = sharp::AttrAsDouble(options, "jxlDistance");
1913
+ baton->jxlDecodingTier = sharp::AttrAsUint32(options, "jxlDecodingTier");
1914
+ baton->jxlEffort = sharp::AttrAsUint32(options, "jxlEffort");
1915
+ baton->jxlLossless = sharp::AttrAsBool(options, "jxlLossless");
1916
+ baton->rawDepth = sharp::AttrAsEnum<VipsBandFormat>(options, "rawDepth", VIPS_TYPE_BAND_FORMAT);
1917
+ baton->tileSize = sharp::AttrAsUint32(options, "tileSize");
1918
+ baton->tileOverlap = sharp::AttrAsUint32(options, "tileOverlap");
1919
+ baton->tileAngle = sharp::AttrAsInt32(options, "tileAngle");
1920
+ baton->tileBackground = sharp::AttrAsVectorOfDouble(options, "tileBackground");
1921
+ baton->tileSkipBlanks = sharp::AttrAsInt32(options, "tileSkipBlanks");
1922
+ baton->tileContainer = sharp::AttrAsEnum<VipsForeignDzContainer>(
1923
+ options, "tileContainer", VIPS_TYPE_FOREIGN_DZ_CONTAINER);
1924
+ baton->tileLayout = sharp::AttrAsEnum<VipsForeignDzLayout>(options, "tileLayout", VIPS_TYPE_FOREIGN_DZ_LAYOUT);
1925
+ baton->tileFormat = sharp::AttrAsStr(options, "tileFormat");
1926
+ baton->tileDepth = sharp::AttrAsEnum<VipsForeignDzDepth>(options, "tileDepth", VIPS_TYPE_FOREIGN_DZ_DEPTH);
1927
+ baton->tileCentre = sharp::AttrAsBool(options, "tileCentre");
1928
+ baton->tileId = sharp::AttrAsStr(options, "tileId");
1929
+ baton->tileBasename = sharp::AttrAsStr(options, "tileBasename");
1930
+
1931
+ // Function to notify of libvips warnings
1932
+ Napi::Function debuglog = options.Get("debuglog").As<Napi::Function>();
1933
+
1934
+ // Function to notify of queue length changes
1935
+ Napi::Function queueListener = options.Get("queueListener").As<Napi::Function>();
1936
+
1937
+ // Join queue for worker thread
1938
+ Napi::Function callback = info[size_t(1)].As<Napi::Function>();
1939
+ PipelineWorker *worker = new PipelineWorker(callback, baton, debuglog, queueListener);
1940
+ worker->Receiver().Set("options", options);
1941
+ worker->Queue();
1942
+
1943
+ // Increment queued task counter
1944
+ Napi::Number queueLength = Napi::Number::New(info.Env(), static_cast<int>(++sharp::counterQueue));
1945
+ queueListener.SHARP_CALLBACK_FN_NAME(info.This(), { queueLength });
1946
+
1947
+ return info.Env().Undefined();
1948
+ }