zhui-plus 1.0.0 → 1.0.10

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 (820) hide show
  1. package/dist/Heatmap.js +689 -0
  2. package/dist/WSPlayer/PlaySDKInterface.js +1 -0
  3. package/dist/WSPlayer/WSPlayer.js +1 -0
  4. package/dist/WSPlayer/audioTalkWorker.js +1 -0
  5. package/dist/WSPlayer/commonThread/libH264Enc.js +21 -0
  6. package/dist/WSPlayer/commonThread/libH264Enc.wasm +0 -0
  7. package/dist/WSPlayer/commonThread/libIVSDrawer.js +21 -0
  8. package/dist/WSPlayer/commonThread/libIVSDrawer.wasm +0 -0
  9. package/dist/WSPlayer/commonThread/libRenderEngine.js +21 -0
  10. package/dist/WSPlayer/commonThread/libRenderEngine.wasm +0 -0
  11. package/dist/WSPlayer/commonThread/libmavasp_litepacket.data +50 -0
  12. package/dist/WSPlayer/commonThread/libmavasp_litepacket.js +21 -0
  13. package/dist/WSPlayer/commonThread/libmavasp_litepacket.wasm +0 -0
  14. package/dist/WSPlayer/icon/IotComboBackGround-alarm.png +0 -0
  15. package/dist/WSPlayer/icon/IotComboBackGround.png +0 -0
  16. package/dist/WSPlayer/icon/RecordHover.svg +13 -0
  17. package/dist/WSPlayer/icon/RecordNormal.svg +13 -0
  18. package/dist/WSPlayer/icon/Recording.svg +15 -0
  19. package/dist/WSPlayer/icon/arrow-b.svg +9 -0
  20. package/dist/WSPlayer/icon/arrow-l.svg +9 -0
  21. package/dist/WSPlayer/icon/arrow-lb.svg +10 -0
  22. package/dist/WSPlayer/icon/arrow-lt.svg +10 -0
  23. package/dist/WSPlayer/icon/arrow-r.svg +9 -0
  24. package/dist/WSPlayer/icon/arrow-rb.svg +10 -0
  25. package/dist/WSPlayer/icon/arrow-rt.svg +10 -0
  26. package/dist/WSPlayer/icon/arrow-t.svg +9 -0
  27. package/dist/WSPlayer/icon/close-all-hover.svg +18 -0
  28. package/dist/WSPlayer/icon/close-all.svg +18 -0
  29. package/dist/WSPlayer/icon/close.svg +16 -0
  30. package/dist/WSPlayer/icon/close_hover.svg +16 -0
  31. package/dist/WSPlayer/icon/default.png +0 -0
  32. package/dist/WSPlayer/icon/draw-triangle_off.svg +14 -0
  33. package/dist/WSPlayer/icon/draw-triangle_off_hover.svg +14 -0
  34. package/dist/WSPlayer/icon/draw-triangle_on.svg +15 -0
  35. package/dist/WSPlayer/icon/draw-triangle_on_hover.svg +15 -0
  36. package/dist/WSPlayer/icon/drops.png +0 -0
  37. package/dist/WSPlayer/icon/fullscreen-hover.svg +13 -0
  38. package/dist/WSPlayer/icon/fullscreen.svg +13 -0
  39. package/dist/WSPlayer/icon/hide-pantilt-on.svg +13 -0
  40. package/dist/WSPlayer/icon/hide-pantilt.svg +13 -0
  41. package/dist/WSPlayer/icon/mobile-speed-control-icon.svg +13 -0
  42. package/dist/WSPlayer/icon/more.svg +13 -0
  43. package/dist/WSPlayer/icon/play-h.png +0 -0
  44. package/dist/WSPlayer/icon/play-n.png +0 -0
  45. package/dist/WSPlayer/icon/play-p.png +0 -0
  46. package/dist/WSPlayer/icon/ptz-icon1.svg +4 -0
  47. package/dist/WSPlayer/icon/ptz-icon2.svg +13 -0
  48. package/dist/WSPlayer/icon/ptz-icon3.svg +10 -0
  49. package/dist/WSPlayer/icon/ptz-icon4.svg +10 -0
  50. package/dist/WSPlayer/icon/ptz-icon5.svg +12 -0
  51. package/dist/WSPlayer/icon/ptz-icon6.svg +14 -0
  52. package/dist/WSPlayer/icon/ptz-select-hover.svg +3 -0
  53. package/dist/WSPlayer/icon/ptz-select.svg +3 -0
  54. package/dist/WSPlayer/icon/record_pause.svg +5 -0
  55. package/dist/WSPlayer/icon/record_play.svg +5 -0
  56. package/dist/WSPlayer/icon/refresh-replay.svg +11 -0
  57. package/dist/WSPlayer/icon/refresh-replay_hover.svg +11 -0
  58. package/dist/WSPlayer/icon/screen-more-icon.svg +15 -0
  59. package/dist/WSPlayer/icon/screen_1.svg +11 -0
  60. package/dist/WSPlayer/icon/screen_16.svg +18 -0
  61. package/dist/WSPlayer/icon/screen_16_hover.svg +18 -0
  62. package/dist/WSPlayer/icon/screen_1_hover.svg +11 -0
  63. package/dist/WSPlayer/icon/screen_2.svg +18 -0
  64. package/dist/WSPlayer/icon/screen_25.svg +19 -0
  65. package/dist/WSPlayer/icon/screen_25_hover.svg +19 -0
  66. package/dist/WSPlayer/icon/screen_2_hover.svg +18 -0
  67. package/dist/WSPlayer/icon/screen_3.svg +13 -0
  68. package/dist/WSPlayer/icon/screen_3_hover.svg +13 -0
  69. package/dist/WSPlayer/icon/screen_4.svg +12 -0
  70. package/dist/WSPlayer/icon/screen_4_hover.svg +12 -0
  71. package/dist/WSPlayer/icon/screen_6.svg +16 -0
  72. package/dist/WSPlayer/icon/screen_6_hover.svg +16 -0
  73. package/dist/WSPlayer/icon/screen_8.svg +18 -0
  74. package/dist/WSPlayer/icon/screen_8_hover.svg +18 -0
  75. package/dist/WSPlayer/icon/screen_9.svg +17 -0
  76. package/dist/WSPlayer/icon/screen_9_hover.svg +17 -0
  77. package/dist/WSPlayer/icon/screen_custom_division.svg +9 -0
  78. package/dist/WSPlayer/icon/screen_custom_division_hover.svg +9 -0
  79. package/dist/WSPlayer/icon/screen_custom_division_merge.svg +3 -0
  80. package/dist/WSPlayer/icon/screen_custom_division_split.svg +6 -0
  81. package/dist/WSPlayer/icon/snapshot.svg +38 -0
  82. package/dist/WSPlayer/icon/snapshot_hover.svg +38 -0
  83. package/dist/WSPlayer/icon/speed_left.svg +15 -0
  84. package/dist/WSPlayer/icon/speed_right.svg +15 -0
  85. package/dist/WSPlayer/icon/spread.png +0 -0
  86. package/dist/WSPlayer/icon/tag-left-alarm.png +0 -0
  87. package/dist/WSPlayer/icon/tag-left-normal.png +0 -0
  88. package/dist/WSPlayer/icon/tag-middle-alarm.png +0 -0
  89. package/dist/WSPlayer/icon/tag-middle-normal.png +0 -0
  90. package/dist/WSPlayer/icon/tag-right-alarm.png +0 -0
  91. package/dist/WSPlayer/icon/tag-right-normal.png +0 -0
  92. package/dist/WSPlayer/icon/talk-off-hover.svg +11 -0
  93. package/dist/WSPlayer/icon/talk-off.svg +11 -0
  94. package/dist/WSPlayer/icon/talk-on.svg +9 -0
  95. package/dist/WSPlayer/icon/voice-have.svg +43 -0
  96. package/dist/WSPlayer/icon/voice-have_hover.svg +43 -0
  97. package/dist/WSPlayer/icon/voice-null.svg +38 -0
  98. package/dist/WSPlayer/icon/voice-null_hover.svg +38 -0
  99. package/dist/WSPlayer/icon/ws-ctrl-ellipsis-hover.svg +14 -0
  100. package/dist/WSPlayer/icon/ws-ctrl-ellipsis.svg +14 -0
  101. package/dist/WSPlayer/icon/wsplayer-mobile-pantilt-b-bg.png +0 -0
  102. package/dist/WSPlayer/icon/wsplayer-mobile-pantilt-bg.png +0 -0
  103. package/dist/WSPlayer/icon/wsplayer-mobile-pantilt-l-bg.png +0 -0
  104. package/dist/WSPlayer/icon/wsplayer-mobile-pantilt-lb-bg.png +0 -0
  105. package/dist/WSPlayer/icon/wsplayer-mobile-pantilt-lt-bg.png +0 -0
  106. package/dist/WSPlayer/icon/wsplayer-mobile-pantilt-r-bg.png +0 -0
  107. package/dist/WSPlayer/icon/wsplayer-mobile-pantilt-rb-bg.png +0 -0
  108. package/dist/WSPlayer/icon/wsplayer-mobile-pantilt-rt-bg.png +0 -0
  109. package/dist/WSPlayer/icon/wsplayer-mobile-pantilt-t-bg.png +0 -0
  110. package/dist/WSPlayer/jquery-3.6.0.min.js +2 -0
  111. package/dist/WSPlayer/multiThread/libStreamClient.js +21 -0
  112. package/dist/WSPlayer/multiThread/libStreamClient.wasm +0 -0
  113. package/dist/WSPlayer/multiThread/libStreamClient.worker.js +1 -0
  114. package/dist/WSPlayer/multiThread/libplay.data +0 -0
  115. package/dist/WSPlayer/multiThread/libplay.js +1 -0
  116. package/dist/WSPlayer/multiThread/libplay.wasm +0 -0
  117. package/dist/WSPlayer/multiThread/libplay.worker.js +1 -0
  118. package/dist/WSPlayer/player.css +1490 -0
  119. package/dist/WSPlayer/singleThread/VideoDecodeWorker.js +1439 -0
  120. package/dist/WSPlayer/singleThread/libStreamClient.js +21 -0
  121. package/dist/WSPlayer/singleThread/libStreamClient.wasm +0 -0
  122. package/dist/WSPlayer/singleThread/libplay.data +0 -0
  123. package/dist/WSPlayer/singleThread/libplay.js +1 -0
  124. package/dist/WSPlayer/singleThread/libplay.wasm +0 -0
  125. package/dist/WSPlayer/window.division.css +80 -0
  126. package/dist/index.js +467 -0
  127. package/dist/locale/af.js +193 -0
  128. package/dist/locale/af.min.js +3 -0
  129. package/dist/locale/af.min.js.map +1 -0
  130. package/dist/locale/af.min.mjs +3 -0
  131. package/dist/locale/af.min.mjs.map +1 -0
  132. package/dist/locale/af.mjs +186 -0
  133. package/dist/locale/ar-eg.js +193 -0
  134. package/dist/locale/ar-eg.min.js +3 -0
  135. package/dist/locale/ar-eg.min.js.map +1 -0
  136. package/dist/locale/ar-eg.min.mjs +3 -0
  137. package/dist/locale/ar-eg.min.mjs.map +1 -0
  138. package/dist/locale/ar-eg.mjs +186 -0
  139. package/dist/locale/ar.js +193 -0
  140. package/dist/locale/ar.min.js +3 -0
  141. package/dist/locale/ar.min.js.map +1 -0
  142. package/dist/locale/ar.min.mjs +3 -0
  143. package/dist/locale/ar.min.mjs.map +1 -0
  144. package/dist/locale/ar.mjs +186 -0
  145. package/dist/locale/az.js +194 -0
  146. package/dist/locale/az.min.js +3 -0
  147. package/dist/locale/az.min.js.map +1 -0
  148. package/dist/locale/az.min.mjs +3 -0
  149. package/dist/locale/az.min.mjs.map +1 -0
  150. package/dist/locale/az.mjs +187 -0
  151. package/dist/locale/bg.js +193 -0
  152. package/dist/locale/bg.min.js +3 -0
  153. package/dist/locale/bg.min.js.map +1 -0
  154. package/dist/locale/bg.min.mjs +3 -0
  155. package/dist/locale/bg.min.mjs.map +1 -0
  156. package/dist/locale/bg.mjs +186 -0
  157. package/dist/locale/bn.js +193 -0
  158. package/dist/locale/bn.min.js +3 -0
  159. package/dist/locale/bn.min.js.map +1 -0
  160. package/dist/locale/bn.min.mjs +3 -0
  161. package/dist/locale/bn.min.mjs.map +1 -0
  162. package/dist/locale/bn.mjs +186 -0
  163. package/dist/locale/ca.js +193 -0
  164. package/dist/locale/ca.min.js +3 -0
  165. package/dist/locale/ca.min.js.map +1 -0
  166. package/dist/locale/ca.min.mjs +3 -0
  167. package/dist/locale/ca.min.mjs.map +1 -0
  168. package/dist/locale/ca.mjs +186 -0
  169. package/dist/locale/ckb.js +193 -0
  170. package/dist/locale/ckb.min.js +3 -0
  171. package/dist/locale/ckb.min.js.map +1 -0
  172. package/dist/locale/ckb.min.mjs +3 -0
  173. package/dist/locale/ckb.min.mjs.map +1 -0
  174. package/dist/locale/ckb.mjs +186 -0
  175. package/dist/locale/cs.js +195 -0
  176. package/dist/locale/cs.min.js +3 -0
  177. package/dist/locale/cs.min.js.map +1 -0
  178. package/dist/locale/cs.min.mjs +3 -0
  179. package/dist/locale/cs.min.mjs.map +1 -0
  180. package/dist/locale/cs.mjs +188 -0
  181. package/dist/locale/da.js +193 -0
  182. package/dist/locale/da.min.js +3 -0
  183. package/dist/locale/da.min.js.map +1 -0
  184. package/dist/locale/da.min.mjs +3 -0
  185. package/dist/locale/da.min.mjs.map +1 -0
  186. package/dist/locale/da.mjs +186 -0
  187. package/dist/locale/de.js +195 -0
  188. package/dist/locale/de.min.js +3 -0
  189. package/dist/locale/de.min.js.map +1 -0
  190. package/dist/locale/de.min.mjs +3 -0
  191. package/dist/locale/de.min.mjs.map +1 -0
  192. package/dist/locale/de.mjs +188 -0
  193. package/dist/locale/el.js +193 -0
  194. package/dist/locale/el.min.js +3 -0
  195. package/dist/locale/el.min.js.map +1 -0
  196. package/dist/locale/el.min.mjs +3 -0
  197. package/dist/locale/el.min.mjs.map +1 -0
  198. package/dist/locale/el.mjs +186 -0
  199. package/dist/locale/en.js +193 -0
  200. package/dist/locale/en.min.js +3 -0
  201. package/dist/locale/en.min.js.map +1 -0
  202. package/dist/locale/en.min.mjs +3 -0
  203. package/dist/locale/en.min.mjs.map +1 -0
  204. package/dist/locale/en.mjs +186 -0
  205. package/dist/locale/eo.js +193 -0
  206. package/dist/locale/eo.min.js +3 -0
  207. package/dist/locale/eo.min.js.map +1 -0
  208. package/dist/locale/eo.min.mjs +3 -0
  209. package/dist/locale/eo.min.mjs.map +1 -0
  210. package/dist/locale/eo.mjs +186 -0
  211. package/dist/locale/es.js +193 -0
  212. package/dist/locale/es.min.js +3 -0
  213. package/dist/locale/es.min.js.map +1 -0
  214. package/dist/locale/es.min.mjs +3 -0
  215. package/dist/locale/es.min.mjs.map +1 -0
  216. package/dist/locale/es.mjs +186 -0
  217. package/dist/locale/et.js +193 -0
  218. package/dist/locale/et.min.js +3 -0
  219. package/dist/locale/et.min.js.map +1 -0
  220. package/dist/locale/et.min.mjs +3 -0
  221. package/dist/locale/et.min.mjs.map +1 -0
  222. package/dist/locale/et.mjs +186 -0
  223. package/dist/locale/eu.js +193 -0
  224. package/dist/locale/eu.min.js +3 -0
  225. package/dist/locale/eu.min.js.map +1 -0
  226. package/dist/locale/eu.min.mjs +3 -0
  227. package/dist/locale/eu.min.mjs.map +1 -0
  228. package/dist/locale/eu.mjs +186 -0
  229. package/dist/locale/fa.js +193 -0
  230. package/dist/locale/fa.min.js +3 -0
  231. package/dist/locale/fa.min.js.map +1 -0
  232. package/dist/locale/fa.min.mjs +3 -0
  233. package/dist/locale/fa.min.mjs.map +1 -0
  234. package/dist/locale/fa.mjs +186 -0
  235. package/dist/locale/fi.js +193 -0
  236. package/dist/locale/fi.min.js +3 -0
  237. package/dist/locale/fi.min.js.map +1 -0
  238. package/dist/locale/fi.min.mjs +3 -0
  239. package/dist/locale/fi.min.mjs.map +1 -0
  240. package/dist/locale/fi.mjs +186 -0
  241. package/dist/locale/fr.js +193 -0
  242. package/dist/locale/fr.min.js +3 -0
  243. package/dist/locale/fr.min.js.map +1 -0
  244. package/dist/locale/fr.min.mjs +3 -0
  245. package/dist/locale/fr.min.mjs.map +1 -0
  246. package/dist/locale/fr.mjs +186 -0
  247. package/dist/locale/he.js +193 -0
  248. package/dist/locale/he.min.js +3 -0
  249. package/dist/locale/he.min.js.map +1 -0
  250. package/dist/locale/he.min.mjs +3 -0
  251. package/dist/locale/he.min.mjs.map +1 -0
  252. package/dist/locale/he.mjs +186 -0
  253. package/dist/locale/hi.js +193 -0
  254. package/dist/locale/hi.min.js +3 -0
  255. package/dist/locale/hi.min.js.map +1 -0
  256. package/dist/locale/hi.min.mjs +3 -0
  257. package/dist/locale/hi.min.mjs.map +1 -0
  258. package/dist/locale/hi.mjs +186 -0
  259. package/dist/locale/hr.js +193 -0
  260. package/dist/locale/hr.min.js +3 -0
  261. package/dist/locale/hr.min.js.map +1 -0
  262. package/dist/locale/hr.min.mjs +3 -0
  263. package/dist/locale/hr.min.mjs.map +1 -0
  264. package/dist/locale/hr.mjs +186 -0
  265. package/dist/locale/hu.js +193 -0
  266. package/dist/locale/hu.min.js +3 -0
  267. package/dist/locale/hu.min.js.map +1 -0
  268. package/dist/locale/hu.min.mjs +3 -0
  269. package/dist/locale/hu.min.mjs.map +1 -0
  270. package/dist/locale/hu.mjs +186 -0
  271. package/dist/locale/hy-am.js +193 -0
  272. package/dist/locale/hy-am.min.js +3 -0
  273. package/dist/locale/hy-am.min.js.map +1 -0
  274. package/dist/locale/hy-am.min.mjs +3 -0
  275. package/dist/locale/hy-am.min.mjs.map +1 -0
  276. package/dist/locale/hy-am.mjs +186 -0
  277. package/dist/locale/id.js +193 -0
  278. package/dist/locale/id.min.js +3 -0
  279. package/dist/locale/id.min.js.map +1 -0
  280. package/dist/locale/id.min.mjs +3 -0
  281. package/dist/locale/id.min.mjs.map +1 -0
  282. package/dist/locale/id.mjs +186 -0
  283. package/dist/locale/it.js +193 -0
  284. package/dist/locale/it.min.js +3 -0
  285. package/dist/locale/it.min.js.map +1 -0
  286. package/dist/locale/it.min.mjs +3 -0
  287. package/dist/locale/it.min.mjs.map +1 -0
  288. package/dist/locale/it.mjs +186 -0
  289. package/dist/locale/ja.js +193 -0
  290. package/dist/locale/ja.min.js +3 -0
  291. package/dist/locale/ja.min.js.map +1 -0
  292. package/dist/locale/ja.min.mjs +3 -0
  293. package/dist/locale/ja.min.mjs.map +1 -0
  294. package/dist/locale/ja.mjs +186 -0
  295. package/dist/locale/kk.js +193 -0
  296. package/dist/locale/kk.min.js +3 -0
  297. package/dist/locale/kk.min.js.map +1 -0
  298. package/dist/locale/kk.min.mjs +3 -0
  299. package/dist/locale/kk.min.mjs.map +1 -0
  300. package/dist/locale/kk.mjs +186 -0
  301. package/dist/locale/km.js +193 -0
  302. package/dist/locale/km.min.js +3 -0
  303. package/dist/locale/km.min.js.map +1 -0
  304. package/dist/locale/km.min.mjs +3 -0
  305. package/dist/locale/km.min.mjs.map +1 -0
  306. package/dist/locale/km.mjs +186 -0
  307. package/dist/locale/ko.js +193 -0
  308. package/dist/locale/ko.min.js +3 -0
  309. package/dist/locale/ko.min.js.map +1 -0
  310. package/dist/locale/ko.min.mjs +3 -0
  311. package/dist/locale/ko.min.mjs.map +1 -0
  312. package/dist/locale/ko.mjs +186 -0
  313. package/dist/locale/ku.js +193 -0
  314. package/dist/locale/ku.min.js +3 -0
  315. package/dist/locale/ku.min.js.map +1 -0
  316. package/dist/locale/ku.min.mjs +3 -0
  317. package/dist/locale/ku.min.mjs.map +1 -0
  318. package/dist/locale/ku.mjs +186 -0
  319. package/dist/locale/ky.js +193 -0
  320. package/dist/locale/ky.min.js +3 -0
  321. package/dist/locale/ky.min.js.map +1 -0
  322. package/dist/locale/ky.min.mjs +3 -0
  323. package/dist/locale/ky.min.mjs.map +1 -0
  324. package/dist/locale/ky.mjs +186 -0
  325. package/dist/locale/lo.js +193 -0
  326. package/dist/locale/lo.min.js +3 -0
  327. package/dist/locale/lo.min.js.map +1 -0
  328. package/dist/locale/lo.min.mjs +3 -0
  329. package/dist/locale/lo.min.mjs.map +1 -0
  330. package/dist/locale/lo.mjs +186 -0
  331. package/dist/locale/lt.js +193 -0
  332. package/dist/locale/lt.min.js +3 -0
  333. package/dist/locale/lt.min.js.map +1 -0
  334. package/dist/locale/lt.min.mjs +3 -0
  335. package/dist/locale/lt.min.mjs.map +1 -0
  336. package/dist/locale/lt.mjs +186 -0
  337. package/dist/locale/lv.js +193 -0
  338. package/dist/locale/lv.min.js +3 -0
  339. package/dist/locale/lv.min.js.map +1 -0
  340. package/dist/locale/lv.min.mjs +3 -0
  341. package/dist/locale/lv.min.mjs.map +1 -0
  342. package/dist/locale/lv.mjs +186 -0
  343. package/dist/locale/mg.js +193 -0
  344. package/dist/locale/mg.min.js +3 -0
  345. package/dist/locale/mg.min.js.map +1 -0
  346. package/dist/locale/mg.min.mjs +3 -0
  347. package/dist/locale/mg.min.mjs.map +1 -0
  348. package/dist/locale/mg.mjs +186 -0
  349. package/dist/locale/mn.js +193 -0
  350. package/dist/locale/mn.min.js +3 -0
  351. package/dist/locale/mn.min.js.map +1 -0
  352. package/dist/locale/mn.min.mjs +3 -0
  353. package/dist/locale/mn.min.mjs.map +1 -0
  354. package/dist/locale/mn.mjs +186 -0
  355. package/dist/locale/ms.js +195 -0
  356. package/dist/locale/ms.min.js +3 -0
  357. package/dist/locale/ms.min.js.map +1 -0
  358. package/dist/locale/ms.min.mjs +3 -0
  359. package/dist/locale/ms.min.mjs.map +1 -0
  360. package/dist/locale/ms.mjs +188 -0
  361. package/dist/locale/my.js +193 -0
  362. package/dist/locale/my.min.js +3 -0
  363. package/dist/locale/my.min.js.map +1 -0
  364. package/dist/locale/my.min.mjs +3 -0
  365. package/dist/locale/my.min.mjs.map +1 -0
  366. package/dist/locale/my.mjs +186 -0
  367. package/dist/locale/nb-no.js +193 -0
  368. package/dist/locale/nb-no.min.js +3 -0
  369. package/dist/locale/nb-no.min.js.map +1 -0
  370. package/dist/locale/nb-no.min.mjs +3 -0
  371. package/dist/locale/nb-no.min.mjs.map +1 -0
  372. package/dist/locale/nb-no.mjs +186 -0
  373. package/dist/locale/nl.js +193 -0
  374. package/dist/locale/nl.min.js +3 -0
  375. package/dist/locale/nl.min.js.map +1 -0
  376. package/dist/locale/nl.min.mjs +3 -0
  377. package/dist/locale/nl.min.mjs.map +1 -0
  378. package/dist/locale/nl.mjs +186 -0
  379. package/dist/locale/no.js +193 -0
  380. package/dist/locale/no.min.js +3 -0
  381. package/dist/locale/no.min.js.map +1 -0
  382. package/dist/locale/no.min.mjs +3 -0
  383. package/dist/locale/no.min.mjs.map +1 -0
  384. package/dist/locale/no.mjs +186 -0
  385. package/dist/locale/pa.js +193 -0
  386. package/dist/locale/pa.min.js +3 -0
  387. package/dist/locale/pa.min.js.map +1 -0
  388. package/dist/locale/pa.min.mjs +3 -0
  389. package/dist/locale/pa.min.mjs.map +1 -0
  390. package/dist/locale/pa.mjs +186 -0
  391. package/dist/locale/pl.js +193 -0
  392. package/dist/locale/pl.min.js +3 -0
  393. package/dist/locale/pl.min.js.map +1 -0
  394. package/dist/locale/pl.min.mjs +3 -0
  395. package/dist/locale/pl.min.mjs.map +1 -0
  396. package/dist/locale/pl.mjs +186 -0
  397. package/dist/locale/pt-br.js +193 -0
  398. package/dist/locale/pt-br.min.js +3 -0
  399. package/dist/locale/pt-br.min.js.map +1 -0
  400. package/dist/locale/pt-br.min.mjs +3 -0
  401. package/dist/locale/pt-br.min.mjs.map +1 -0
  402. package/dist/locale/pt-br.mjs +186 -0
  403. package/dist/locale/pt.js +193 -0
  404. package/dist/locale/pt.min.js +3 -0
  405. package/dist/locale/pt.min.js.map +1 -0
  406. package/dist/locale/pt.min.mjs +3 -0
  407. package/dist/locale/pt.min.mjs.map +1 -0
  408. package/dist/locale/pt.mjs +186 -0
  409. package/dist/locale/ro.js +193 -0
  410. package/dist/locale/ro.min.js +3 -0
  411. package/dist/locale/ro.min.js.map +1 -0
  412. package/dist/locale/ro.min.mjs +3 -0
  413. package/dist/locale/ro.min.mjs.map +1 -0
  414. package/dist/locale/ro.mjs +186 -0
  415. package/dist/locale/ru.js +193 -0
  416. package/dist/locale/ru.min.js +3 -0
  417. package/dist/locale/ru.min.js.map +1 -0
  418. package/dist/locale/ru.min.mjs +3 -0
  419. package/dist/locale/ru.min.mjs.map +1 -0
  420. package/dist/locale/ru.mjs +186 -0
  421. package/dist/locale/sk.js +195 -0
  422. package/dist/locale/sk.min.js +3 -0
  423. package/dist/locale/sk.min.js.map +1 -0
  424. package/dist/locale/sk.min.mjs +3 -0
  425. package/dist/locale/sk.min.mjs.map +1 -0
  426. package/dist/locale/sk.mjs +188 -0
  427. package/dist/locale/sl.js +193 -0
  428. package/dist/locale/sl.min.js +3 -0
  429. package/dist/locale/sl.min.js.map +1 -0
  430. package/dist/locale/sl.min.mjs +3 -0
  431. package/dist/locale/sl.min.mjs.map +1 -0
  432. package/dist/locale/sl.mjs +186 -0
  433. package/dist/locale/sr.js +193 -0
  434. package/dist/locale/sr.min.js +3 -0
  435. package/dist/locale/sr.min.js.map +1 -0
  436. package/dist/locale/sr.min.mjs +3 -0
  437. package/dist/locale/sr.min.mjs.map +1 -0
  438. package/dist/locale/sr.mjs +186 -0
  439. package/dist/locale/sv.js +193 -0
  440. package/dist/locale/sv.min.js +3 -0
  441. package/dist/locale/sv.min.js.map +1 -0
  442. package/dist/locale/sv.min.mjs +3 -0
  443. package/dist/locale/sv.min.mjs.map +1 -0
  444. package/dist/locale/sv.mjs +186 -0
  445. package/dist/locale/sw.js +193 -0
  446. package/dist/locale/sw.min.js +3 -0
  447. package/dist/locale/sw.min.js.map +1 -0
  448. package/dist/locale/sw.min.mjs +3 -0
  449. package/dist/locale/sw.min.mjs.map +1 -0
  450. package/dist/locale/sw.mjs +186 -0
  451. package/dist/locale/ta.js +193 -0
  452. package/dist/locale/ta.min.js +3 -0
  453. package/dist/locale/ta.min.js.map +1 -0
  454. package/dist/locale/ta.min.mjs +3 -0
  455. package/dist/locale/ta.min.mjs.map +1 -0
  456. package/dist/locale/ta.mjs +186 -0
  457. package/dist/locale/te.js +193 -0
  458. package/dist/locale/te.min.js +3 -0
  459. package/dist/locale/te.min.js.map +1 -0
  460. package/dist/locale/te.min.mjs +3 -0
  461. package/dist/locale/te.min.mjs.map +1 -0
  462. package/dist/locale/te.mjs +186 -0
  463. package/dist/locale/th.js +193 -0
  464. package/dist/locale/th.min.js +3 -0
  465. package/dist/locale/th.min.js.map +1 -0
  466. package/dist/locale/th.min.mjs +3 -0
  467. package/dist/locale/th.min.mjs.map +1 -0
  468. package/dist/locale/th.mjs +186 -0
  469. package/dist/locale/tk.js +193 -0
  470. package/dist/locale/tk.min.js +3 -0
  471. package/dist/locale/tk.min.js.map +1 -0
  472. package/dist/locale/tk.min.mjs +3 -0
  473. package/dist/locale/tk.min.mjs.map +1 -0
  474. package/dist/locale/tk.mjs +186 -0
  475. package/dist/locale/tr.js +193 -0
  476. package/dist/locale/tr.min.js +3 -0
  477. package/dist/locale/tr.min.js.map +1 -0
  478. package/dist/locale/tr.min.mjs +3 -0
  479. package/dist/locale/tr.min.mjs.map +1 -0
  480. package/dist/locale/tr.mjs +186 -0
  481. package/dist/locale/ug-cn.js +193 -0
  482. package/dist/locale/ug-cn.min.js +3 -0
  483. package/dist/locale/ug-cn.min.js.map +1 -0
  484. package/dist/locale/ug-cn.min.mjs +3 -0
  485. package/dist/locale/ug-cn.min.mjs.map +1 -0
  486. package/dist/locale/ug-cn.mjs +186 -0
  487. package/dist/locale/uk.js +193 -0
  488. package/dist/locale/uk.min.js +3 -0
  489. package/dist/locale/uk.min.js.map +1 -0
  490. package/dist/locale/uk.min.mjs +3 -0
  491. package/dist/locale/uk.min.mjs.map +1 -0
  492. package/dist/locale/uk.mjs +186 -0
  493. package/dist/locale/uz-uz.js +193 -0
  494. package/dist/locale/uz-uz.min.js +3 -0
  495. package/dist/locale/uz-uz.min.js.map +1 -0
  496. package/dist/locale/uz-uz.min.mjs +3 -0
  497. package/dist/locale/uz-uz.min.mjs.map +1 -0
  498. package/dist/locale/uz-uz.mjs +186 -0
  499. package/dist/locale/vi.js +193 -0
  500. package/dist/locale/vi.min.js +3 -0
  501. package/dist/locale/vi.min.js.map +1 -0
  502. package/dist/locale/vi.min.mjs +3 -0
  503. package/dist/locale/vi.min.mjs.map +1 -0
  504. package/dist/locale/vi.mjs +186 -0
  505. package/dist/locale/zh-cn.js +193 -0
  506. package/dist/locale/zh-cn.min.js +3 -0
  507. package/dist/locale/zh-cn.min.js.map +1 -0
  508. package/dist/locale/zh-cn.min.mjs +3 -0
  509. package/dist/locale/zh-cn.min.mjs.map +1 -0
  510. package/dist/locale/zh-cn.mjs +186 -0
  511. package/dist/locale/zh-hk.js +193 -0
  512. package/dist/locale/zh-hk.min.js +3 -0
  513. package/dist/locale/zh-hk.min.js.map +1 -0
  514. package/dist/locale/zh-hk.min.mjs +3 -0
  515. package/dist/locale/zh-hk.min.mjs.map +1 -0
  516. package/dist/locale/zh-hk.mjs +186 -0
  517. package/dist/locale/zh-mo.js +193 -0
  518. package/dist/locale/zh-mo.min.js +3 -0
  519. package/dist/locale/zh-mo.min.js.map +1 -0
  520. package/dist/locale/zh-mo.min.mjs +3 -0
  521. package/dist/locale/zh-mo.min.mjs.map +1 -0
  522. package/dist/locale/zh-mo.mjs +186 -0
  523. package/dist/locale/zh-tw.js +193 -0
  524. package/dist/locale/zh-tw.min.js +3 -0
  525. package/dist/locale/zh-tw.min.js.map +1 -0
  526. package/dist/locale/zh-tw.min.mjs +3 -0
  527. package/dist/locale/zh-tw.min.mjs.map +1 -0
  528. package/dist/locale/zh-tw.mjs +186 -0
  529. package/dist/style.css +1 -1
  530. package/dist/test/demo.docx +0 -0
  531. package/dist/test/demo.et +0 -0
  532. package/dist/test/demo.ofd +0 -0
  533. package/dist/test/demo.pdf +0 -0
  534. package/dist/test/test.ofd +0 -0
  535. package/dist/test/unzip.ofd +0 -0
  536. package/dist/test/zip.ofd +0 -0
  537. package/dist/types/auto-imports.d.ts +9 -0
  538. package/dist/types/components.d.ts +55 -0
  539. package/dist/zhui-plus.cjs.js +1 -0
  540. package/dist/zhui-plus.es.js +2 -0
  541. package/dist/zhui.svg +1 -0
  542. package/package.json +90 -4
  543. package/packages/components/AI/index.ts +10 -0
  544. package/packages/components/AI/src/zh-aiChat.vue +841 -0
  545. package/packages/components/badge/__tests__/badge.test.ts +38 -0
  546. package/packages/components/badge/index.ts +10 -0
  547. package/packages/components/badge/src/zh-badge.vue +86 -0
  548. package/packages/components/badge/style.scss +1 -0
  549. package/packages/components/button/__tests__/button.test.ts +94 -0
  550. package/packages/components/button/__tests__/buttonGroup.test.ts +46 -0
  551. package/packages/components/button/index.ts +11 -0
  552. package/packages/components/button/src/zh-button-group.vue +50 -0
  553. package/packages/components/button/src/zh-button.vue +152 -0
  554. package/packages/components/button/style/index.css +140 -0
  555. package/packages/components/charts/geo.json +11147 -0
  556. package/packages/components/charts/index.ts +35 -0
  557. package/packages/components/charts/src/zh-barChart.vue +97 -0
  558. package/packages/components/charts/src/zh-baseChart.vue +196 -0
  559. package/packages/components/charts/src/zh-lineBarChart.vue +113 -0
  560. package/packages/components/charts/src/zh-lineChart.vue +93 -0
  561. package/packages/components/charts/src/zh-mapChart.vue +214 -0
  562. package/packages/components/charts/src/zh-pictorialBar.vue +72 -0
  563. package/packages/components/charts/src/zh-pieChart.vue +67 -0
  564. package/packages/components/charts/src/zh-radarChart.vue +131 -0
  565. package/packages/components/charts/src/zh-scatterChart.vue +152 -0
  566. package/packages/components/chat/index.ts +10 -0
  567. package/packages/components/chat/src/zh-chat.vue +889 -0
  568. package/packages/components/container/index.ts +18 -0
  569. package/packages/components/container/src/zh-aside.vue +34 -0
  570. package/packages/components/container/src/zh-container.vue +45 -0
  571. package/packages/components/container/src/zh-footer.vue +33 -0
  572. package/packages/components/container/src/zh-header.vue +34 -0
  573. package/packages/components/container/src/zh-main.vue +26 -0
  574. package/packages/components/directive/focus.ts +14 -0
  575. package/packages/components/directive/idCard.ts +12 -0
  576. package/packages/components/directive/index.ts +19 -0
  577. package/packages/components/directive/number.ts +10 -0
  578. package/packages/components/directive/permission.ts +57 -0
  579. package/packages/components/directive/phone.ts +12 -0
  580. package/packages/components/drawer/index.ts +10 -0
  581. package/packages/components/drawer/src/zh-drawer.vue +78 -0
  582. package/packages/components/drawer/style/animation.scss +35 -0
  583. package/packages/components/drawer/style/index.scss +52 -0
  584. package/packages/components/drawer/style/media.scss +6 -0
  585. package/packages/components/fileViewer/index.ts +9 -0
  586. package/packages/components/fileViewer/src/liteofd/annotLayer.ts +203 -0
  587. package/packages/components/fileViewer/src/liteofd/asn1js/LICENSE +15 -0
  588. package/packages/components/fileViewer/src/liteofd/asn1js/README.md +108 -0
  589. package/packages/components/fileViewer/src/liteofd/asn1js/asn1.js +627 -0
  590. package/packages/components/fileViewer/src/liteofd/asn1js/base64.js +103 -0
  591. package/packages/components/fileViewer/src/liteofd/asn1js/defs.js +138 -0
  592. package/packages/components/fileViewer/src/liteofd/asn1js/dumpASN1.js +79 -0
  593. package/packages/components/fileViewer/src/liteofd/asn1js/hex.js +69 -0
  594. package/packages/components/fileViewer/src/liteofd/asn1js/int10.js +106 -0
  595. package/packages/components/fileViewer/src/liteofd/asn1js/oids.js +2725 -0
  596. package/packages/components/fileViewer/src/liteofd/asn1js/rfcdef.js +10377 -0
  597. package/packages/components/fileViewer/src/liteofd/attrType.ts +173 -0
  598. package/packages/components/fileViewer/src/liteofd/contentLayer.ts +203 -0
  599. package/packages/components/fileViewer/src/liteofd/elements/AnnotationPathSvg.ts +122 -0
  600. package/packages/components/fileViewer/src/liteofd/elements/BaseSvg.ts +6 -0
  601. package/packages/components/fileViewer/src/liteofd/elements/ImageSvg.ts +212 -0
  602. package/packages/components/fileViewer/src/liteofd/elements/PathSvg.ts +460 -0
  603. package/packages/components/fileViewer/src/liteofd/elements/SignatureElement.ts +231 -0
  604. package/packages/components/fileViewer/src/liteofd/elements/TextSvg.ts +235 -0
  605. package/packages/components/fileViewer/src/liteofd/elements/ofdAnnotationElement.ts +133 -0
  606. package/packages/components/fileViewer/src/liteofd/elements/ofdPageContainer.ts +183 -0
  607. package/packages/components/fileViewer/src/liteofd/elements/ofdPageRender.ts +71 -0
  608. package/packages/components/fileViewer/src/liteofd/elements/signObject.json +10084 -0
  609. package/packages/components/fileViewer/src/liteofd/elements/signature.json +381 -0
  610. package/packages/components/fileViewer/src/liteofd/font/arithmetic_decoder.js +182 -0
  611. package/packages/components/fileViewer/src/liteofd/font/ascii_85_stream.js +98 -0
  612. package/packages/components/fileViewer/src/liteofd/font/ascii_hex_stream.js +79 -0
  613. package/packages/components/fileViewer/src/liteofd/font/base_stream.js +110 -0
  614. package/packages/components/fileViewer/src/liteofd/font/bidi.js +440 -0
  615. package/packages/components/fileViewer/src/liteofd/font/binary_cmap.js +326 -0
  616. package/packages/components/fileViewer/src/liteofd/font/calibri_factors.js +309 -0
  617. package/packages/components/fileViewer/src/liteofd/font/ccitt.js +1059 -0
  618. package/packages/components/fileViewer/src/liteofd/font/ccitt_stream.js +60 -0
  619. package/packages/components/fileViewer/src/liteofd/font/cff_font.js +139 -0
  620. package/packages/components/fileViewer/src/liteofd/font/cff_parser.js +1940 -0
  621. package/packages/components/fileViewer/src/liteofd/font/charsets.js +119 -0
  622. package/packages/components/fileViewer/src/liteofd/font/chunked_stream.js +94 -0
  623. package/packages/components/fileViewer/src/liteofd/font/cmap.js +726 -0
  624. package/packages/components/fileViewer/src/liteofd/font/colorspace.js +1336 -0
  625. package/packages/components/fileViewer/src/liteofd/font/core_utils.js +636 -0
  626. package/packages/components/fileViewer/src/liteofd/font/decode_stream.js +177 -0
  627. package/packages/components/fileViewer/src/liteofd/font/differences.js +906 -0
  628. package/packages/components/fileViewer/src/liteofd/font/encodings.js +301 -0
  629. package/packages/components/fileViewer/src/liteofd/font/flate_stream.js +413 -0
  630. package/packages/components/fileViewer/src/liteofd/font/font_loader.js +455 -0
  631. package/packages/components/fileViewer/src/liteofd/font/font_renderer.js +900 -0
  632. package/packages/components/fileViewer/src/liteofd/font/font_substitutions.js +553 -0
  633. package/packages/components/fileViewer/src/liteofd/font/fonts copy.js +3391 -0
  634. package/packages/components/fileViewer/src/liteofd/font/fonts.js +3585 -0
  635. package/packages/components/fileViewer/src/liteofd/font/fonts_utils.js +178 -0
  636. package/packages/components/fileViewer/src/liteofd/font/function.js +1241 -0
  637. package/packages/components/fileViewer/src/liteofd/font/glyf.js +701 -0
  638. package/packages/components/fileViewer/src/liteofd/font/glyphlist.js +4557 -0
  639. package/packages/components/fileViewer/src/liteofd/font/helvetica_factors.js +352 -0
  640. package/packages/components/fileViewer/src/liteofd/font/image.js +986 -0
  641. package/packages/components/fileViewer/src/liteofd/font/image_resizer.js +398 -0
  642. package/packages/components/fileViewer/src/liteofd/font/image_utils.js +286 -0
  643. package/packages/components/fileViewer/src/liteofd/font/jbig2_stream.js +74 -0
  644. package/packages/components/fileViewer/src/liteofd/font/jpeg_stream.js +106 -0
  645. package/packages/components/fileViewer/src/liteofd/font/jpg.js +1590 -0
  646. package/packages/components/fileViewer/src/liteofd/font/jpx.js +2349 -0
  647. package/packages/components/fileViewer/src/liteofd/font/jpx_stream.js +87 -0
  648. package/packages/components/fileViewer/src/liteofd/font/liberationsans_widths.js +429 -0
  649. package/packages/components/fileViewer/src/liteofd/font/lzw_stream.js +150 -0
  650. package/packages/components/fileViewer/src/liteofd/font/metrics.d.ts +1 -0
  651. package/packages/components/fileViewer/src/liteofd/font/metrics.js +3057 -0
  652. package/packages/components/fileViewer/src/liteofd/font/murmurhash3.js +135 -0
  653. package/packages/components/fileViewer/src/liteofd/font/myriadpro_factors.js +291 -0
  654. package/packages/components/fileViewer/src/liteofd/font/ofd_stream.js +402 -0
  655. package/packages/components/fileViewer/src/liteofd/font/opentype_file_builder.js +154 -0
  656. package/packages/components/fileViewer/src/liteofd/font/parser.js +1409 -0
  657. package/packages/components/fileViewer/src/liteofd/font/pattern.js +1005 -0
  658. package/packages/components/fileViewer/src/liteofd/font/predictor_stream.js +234 -0
  659. package/packages/components/fileViewer/src/liteofd/font/primitives.js +354 -0
  660. package/packages/components/fileViewer/src/liteofd/font/properties.json +2110 -0
  661. package/packages/components/fileViewer/src/liteofd/font/ps_parser.js +268 -0
  662. package/packages/components/fileViewer/src/liteofd/font/run_length_stream.js +61 -0
  663. package/packages/components/fileViewer/src/liteofd/font/segoeui_factors.js +308 -0
  664. package/packages/components/fileViewer/src/liteofd/font/standard_fonts.js +915 -0
  665. package/packages/components/fileViewer/src/liteofd/font/stream.js +99 -0
  666. package/packages/components/fileViewer/src/liteofd/font/to_unicode_map.js +111 -0
  667. package/packages/components/fileViewer/src/liteofd/font/translatedFont.js +3125 -0
  668. package/packages/components/fileViewer/src/liteofd/font/type1_font.js +443 -0
  669. package/packages/components/fileViewer/src/liteofd/font/type1_parser.js +804 -0
  670. package/packages/components/fileViewer/src/liteofd/font/unicode.js +274 -0
  671. package/packages/components/fileViewer/src/liteofd/font/util.js +1159 -0
  672. package/packages/components/fileViewer/src/liteofd/font/xfa_fonts.js +296 -0
  673. package/packages/components/fileViewer/src/liteofd/jbig2/arithmetic_decoder.js +183 -0
  674. package/packages/components/fileViewer/src/liteofd/jbig2/ccitt.js +1070 -0
  675. package/packages/components/fileViewer/src/liteofd/jbig2/core_utils.js +180 -0
  676. package/packages/components/fileViewer/src/liteofd/jbig2/is_node.js +27 -0
  677. package/packages/components/fileViewer/src/liteofd/jbig2/jbig2.js +2589 -0
  678. package/packages/components/fileViewer/src/liteofd/jbig2/jbig2_stream.js +81 -0
  679. package/packages/components/fileViewer/src/liteofd/jbig2/primitives.js +371 -0
  680. package/packages/components/fileViewer/src/liteofd/jbig2/stream.js +1348 -0
  681. package/packages/components/fileViewer/src/liteofd/jbig2/util.js +970 -0
  682. package/packages/components/fileViewer/src/liteofd/layer.ts +12 -0
  683. package/packages/components/fileViewer/src/liteofd/liteOfd.ts +185 -0
  684. package/packages/components/fileViewer/src/liteofd/ofdActions.ts +29 -0
  685. package/packages/components/fileViewer/src/liteofd/ofdCanvas.ts +19 -0
  686. package/packages/components/fileViewer/src/liteofd/ofdData.ts +28 -0
  687. package/packages/components/fileViewer/src/liteofd/ofdDocument.ts +109 -0
  688. package/packages/components/fileViewer/src/liteofd/ofdFont.ts +425 -0
  689. package/packages/components/fileViewer/src/liteofd/ofdRender.ts +259 -0
  690. package/packages/components/fileViewer/src/liteofd/ofdWriter.ts +142 -0
  691. package/packages/components/fileViewer/src/liteofd/ofdtools.ts +43 -0
  692. package/packages/components/fileViewer/src/liteofd/parser.ts +499 -0
  693. package/packages/components/fileViewer/src/liteofd/promiseCapability.ts +47 -0
  694. package/packages/components/fileViewer/src/liteofd/utils/commonFont.ts +15 -0
  695. package/packages/components/fileViewer/src/liteofd/utils/elementUtils.ts +362 -0
  696. package/packages/components/fileViewer/src/liteofd/utils/jsonToXml.ts +95 -0
  697. package/packages/components/fileViewer/src/liteofd/utils/ofdUtils.ts +301 -0
  698. package/packages/components/fileViewer/src/liteofd/utils/signatureUtil.ts +246 -0
  699. package/packages/components/fileViewer/src/liteofd/utils/sm3.ts +235 -0
  700. package/packages/components/fileViewer/src/liteofd/utils/utils.ts +489 -0
  701. package/packages/components/fileViewer/src/liteofd/utils/verify_signature_util.ts +41 -0
  702. package/packages/components/fileViewer/src/ofd/CircleLoading.vue +64 -0
  703. package/packages/components/fileViewer/src/ofd/OfdPreview.vue +456 -0
  704. package/packages/components/fileViewer/src/ofd/OfdViewer.vue +211 -0
  705. package/packages/components/fileViewer/src/ofd/PageIndicator.vue +88 -0
  706. package/packages/components/fileViewer/src/ofd/RatioIndicator.vue +271 -0
  707. package/packages/components/fileViewer/src/ofd/ToolTip.vue +81 -0
  708. package/packages/components/fileViewer/src/zh-fileViewer.vue +426 -0
  709. package/packages/components/form/index.ts +11 -0
  710. package/packages/components/form/src/zh-form-item.vue +299 -0
  711. package/packages/components/form/src/zh-form.vue +90 -0
  712. package/packages/components/hideNumber/index.ts +9 -0
  713. package/packages/components/hideNumber/src/zh-hide-number.vue +37 -0
  714. package/packages/components/icon/index.ts +10 -0
  715. package/packages/components/icon/src/zh-icon.vue +32 -0
  716. package/packages/components/image/index.ts +9 -0
  717. package/packages/components/image/src/zh-image.vue +245 -0
  718. package/packages/components/index.ts +112 -0
  719. package/packages/components/input/index.ts +10 -0
  720. package/packages/components/input/src/input.com.ts +30 -0
  721. package/packages/components/input/src/input.type.ts +1 -0
  722. package/packages/components/input/src/zh-input.vue +92 -0
  723. package/packages/components/input/style/index.scss +30 -0
  724. package/packages/components/layout/index.ts +12 -0
  725. package/packages/components/layout/src/zh-col.tsx +81 -0
  726. package/packages/components/layout/src/zh-row.tsx +58 -0
  727. package/packages/components/layout/style/row.scss +6 -0
  728. package/packages/components/map/index.ts +18 -0
  729. package/packages/components/map/src/zh-amap.vue +999 -0
  730. package/packages/components/map/src/zh-bmap.vue +1578 -0
  731. package/packages/components/map/src/zh-omap.vue +1522 -0
  732. package/packages/components/map/src/zh-smap.vue +1555 -0
  733. package/packages/components/map/src/zh-tmap.vue +1058 -0
  734. package/packages/components/message/index.ts +8 -0
  735. package/packages/components/message/src/data.com.ts +61 -0
  736. package/packages/components/message/src/message-icon.vue +60 -0
  737. package/packages/components/message/src/message.ts +89 -0
  738. package/packages/components/message/src/message.type.ts +40 -0
  739. package/packages/components/message/src/zh-message.vue +133 -0
  740. package/packages/components/message-box/index.ts +12 -0
  741. package/packages/components/message-box/src/messageBox.help.ts +40 -0
  742. package/packages/components/message-box/src/messageBox.ts +126 -0
  743. package/packages/components/message-box/src/zh-message-box.vue +94 -0
  744. package/packages/components/message-box/style/index.css +29 -0
  745. package/packages/components/noData/index.ts +9 -0
  746. package/packages/components/noData/src/zh-no-data.vue +42 -0
  747. package/packages/components/operationColumn/index.ts +9 -0
  748. package/packages/components/operationColumn/src/zh-operationColumn.vue +113 -0
  749. package/packages/components/provider/index.ts +11 -0
  750. package/packages/components/provider/src/zh-authControl.vue +28 -0
  751. package/packages/components/provider/src/zh-authProvider.vue +36 -0
  752. package/packages/components/qrcode/index.ts +9 -0
  753. package/packages/components/qrcode/src/zh-qrcode.vue +271 -0
  754. package/packages/components/radio/index.ts +10 -0
  755. package/packages/components/radio/src/zh-radio.vue +86 -0
  756. package/packages/components/searchForm/index.ts +9 -0
  757. package/packages/components/searchForm/src/zh-search-form.vue +340 -0
  758. package/packages/components/signature/index.ts +10 -0
  759. package/packages/components/signature/src/zh-signature.vue +355 -0
  760. package/packages/components/switch/index.ts +10 -0
  761. package/packages/components/switch/src/zh-switch.vue +162 -0
  762. package/packages/components/table/index.ts +10 -0
  763. package/packages/components/table/src/types.ts +62 -0
  764. package/packages/components/table/src/zh-table.vue +220 -0
  765. package/packages/components/upload/index.ts +15 -0
  766. package/packages/components/upload/src/zh-cupload.vue +147 -0
  767. package/packages/components/upload/src/zh-upload.vue +258 -0
  768. package/packages/components/upload/src/zh-uploadCard.vue +176 -0
  769. package/packages/components/upload/src/zh-uploadDialog.vue +165 -0
  770. package/packages/components/videoPlayer/index.ts +12 -0
  771. package/packages/components/videoPlayer/src/PlayerManager.js +706 -0
  772. package/packages/components/videoPlayer/src/api.js +354 -0
  773. package/packages/components/videoPlayer/src/errorHandler.ts +39 -0
  774. package/packages/components/videoPlayer/src/resourceLoader.ts +68 -0
  775. package/packages/components/videoPlayer/src/useDahuaPlayer.ts +242 -0
  776. package/packages/components/videoPlayer/src/zh-dhPlayer.vue +119 -0
  777. package/packages/components/videoPlayer/src/zh-hlsPlayer.vue +575 -0
  778. package/packages/resolver/index.ts +324 -0
  779. package/packages/styles/_element.scss +324 -0
  780. package/packages/styles/_variable.scss +136 -0
  781. package/packages/styles/index.scss +3 -0
  782. package/packages/tokens/tokens.ts +2 -0
  783. package/packages/types/form.ts +205 -0
  784. package/packages/types/index.ts +4 -0
  785. package/packages/types/player.ts +80 -0
  786. package/packages/types/provider.ts +4 -0
  787. package/packages/types/searchForm.ts +24 -0
  788. package/packages/utils/common/__tests__/common.test.ts +12 -0
  789. package/packages/utils/common/common.ts +68 -0
  790. package/packages/utils/constant.ts +12 -0
  791. package/packages/utils/copy.ts +20 -0
  792. package/packages/utils/data.ts +62 -0
  793. package/packages/utils/echarts/echarts.ts +34 -0
  794. package/packages/utils/event.ts +37 -0
  795. package/packages/utils/hooks/__tests__/hooks.test.ts +24 -0
  796. package/packages/utils/hooks/data.ts +100 -0
  797. package/packages/utils/hooks/hooks.util.ts +39 -0
  798. package/packages/utils/hooks/index.ts +1 -0
  799. package/packages/utils/hooks/useBreakpoint.ts +89 -0
  800. package/packages/utils/hooks/useEcharts.ts +56 -0
  801. package/packages/utils/hooks/useEventListener.ts +57 -0
  802. package/packages/utils/hooks/useLegendProcessor.ts +92 -0
  803. package/packages/utils/hooks/usePermission.ts +22 -0
  804. package/packages/utils/hooks/useTimeout.ts +45 -0
  805. package/packages/utils/is.ts +79 -0
  806. package/packages/utils/utils.ts +136 -0
  807. package/packages/utils/vue/util-modal.vue +61 -0
  808. package/types/auto-imports.d.ts +9 -0
  809. package/types/component.d.ts +6 -0
  810. package/types/components.d.ts +131 -0
  811. package/types/defaults.d.ts +5 -0
  812. package/types/el-components.d.ts +23 -0
  813. package/types/global.d.ts +130 -0
  814. package/types/index.d.ts +11 -0
  815. package/types/zh-components.d.ts +23 -0
  816. package/types/zhui.d.ts +76 -0
  817. package/.idea/workspace.xml +0 -72
  818. package/README.md +0 -1
  819. package/dist/zh-ui.es.js +0 -56706
  820. package/dist/zh-ui.umd.js +0 -67
@@ -0,0 +1,1336 @@
1
+ /* Copyright 2012 Mozilla Foundation
2
+ *
3
+ * Licensed under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License.
5
+ * You may obtain a copy of the License at
6
+ *
7
+ * http://www.apache.org/licenses/LICENSE-2.0
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software
10
+ * distributed under the License is distributed on an "AS IS" BASIS,
11
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ * See the License for the specific language governing permissions and
13
+ * limitations under the License.
14
+ */
15
+
16
+ import {
17
+ assert,
18
+ FormatError,
19
+ info,
20
+ shadow,
21
+ unreachable,
22
+ warn,
23
+ } from "./util.js";
24
+ import { Dict, Name, Ref } from "./primitives.js";
25
+ import { BaseStream } from "./base_stream.js";
26
+ import { MissingDataException } from "./core_utils.js";
27
+
28
+ /**
29
+ * Resizes an RGB image with 3 components.
30
+ * @param {TypedArray} src - The source buffer.
31
+ * @param {TypedArray} dest - The destination buffer.
32
+ * @param {number} w1 - Original width.
33
+ * @param {number} h1 - Original height.
34
+ * @param {number} w2 - New width.
35
+ * @param {number} h2 - New height.
36
+ * @param {number} alpha01 - Size reserved for the alpha channel.
37
+ */
38
+ function resizeRgbImage(src, dest, w1, h1, w2, h2, alpha01) {
39
+ const COMPONENTS = 3;
40
+ alpha01 = alpha01 !== 1 ? 0 : alpha01;
41
+ const xRatio = w1 / w2;
42
+ const yRatio = h1 / h2;
43
+ let newIndex = 0,
44
+ oldIndex;
45
+ const xScaled = new Uint16Array(w2);
46
+ const w1Scanline = w1 * COMPONENTS;
47
+
48
+ for (let i = 0; i < w2; i++) {
49
+ xScaled[i] = Math.floor(i * xRatio) * COMPONENTS;
50
+ }
51
+ for (let i = 0; i < h2; i++) {
52
+ const py = Math.floor(i * yRatio) * w1Scanline;
53
+ for (let j = 0; j < w2; j++) {
54
+ oldIndex = py + xScaled[j];
55
+ dest[newIndex++] = src[oldIndex++];
56
+ dest[newIndex++] = src[oldIndex++];
57
+ dest[newIndex++] = src[oldIndex++];
58
+ newIndex += alpha01;
59
+ }
60
+ }
61
+ }
62
+
63
+ class ColorSpace {
64
+ constructor(name, numComps) {
65
+ if (this.constructor === ColorSpace) {
66
+ unreachable("Cannot initialize ColorSpace.");
67
+ }
68
+ this.name = name;
69
+ this.numComps = numComps;
70
+ }
71
+
72
+ /**
73
+ * Converts the color value to the RGB color. The color components are
74
+ * located in the src array starting from the srcOffset. Returns the array
75
+ * of the rgb components, each value ranging from [0,255].
76
+ */
77
+ getRgb(src, srcOffset) {
78
+ const rgb = new Uint8ClampedArray(3);
79
+ this.getRgbItem(src, srcOffset, rgb, 0);
80
+ return rgb;
81
+ }
82
+
83
+ /**
84
+ * Converts the color value to the RGB color, similar to the getRgb method.
85
+ * The result placed into the dest array starting from the destOffset.
86
+ */
87
+ getRgbItem(src, srcOffset, dest, destOffset) {
88
+ unreachable("Should not call ColorSpace.getRgbItem");
89
+ }
90
+
91
+ /**
92
+ * Converts the specified number of the color values to the RGB colors.
93
+ * The colors are located in the src array starting from the srcOffset.
94
+ * The result is placed into the dest array starting from the destOffset.
95
+ * The src array items shall be in [0,2^bits) range, the dest array items
96
+ * will be in [0,255] range. alpha01 indicates how many alpha components
97
+ * there are in the dest array; it will be either 0 (RGB array) or 1 (RGBA
98
+ * array).
99
+ */
100
+ getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
101
+ unreachable("Should not call ColorSpace.getRgbBuffer");
102
+ }
103
+
104
+ /**
105
+ * Determines the number of bytes required to store the result of the
106
+ * conversion done by the getRgbBuffer method. As in getRgbBuffer,
107
+ * |alpha01| is either 0 (RGB output) or 1 (RGBA output).
108
+ */
109
+ getOutputLength(inputLength, alpha01) {
110
+ unreachable("Should not call ColorSpace.getOutputLength");
111
+ }
112
+
113
+ /**
114
+ * Returns true if source data will be equal the result/output data.
115
+ */
116
+ isPassthrough(bits) {
117
+ return false;
118
+ }
119
+
120
+ /**
121
+ * Refer to the static `ColorSpace.isDefaultDecode` method below.
122
+ */
123
+ isDefaultDecode(decodeMap, bpc) {
124
+ return ColorSpace.isDefaultDecode(decodeMap, this.numComps);
125
+ }
126
+
127
+ /**
128
+ * Fills in the RGB colors in the destination buffer. alpha01 indicates
129
+ * how many alpha components there are in the dest array; it will be either
130
+ * 0 (RGB array) or 1 (RGBA array).
131
+ */
132
+ fillRgb(
133
+ dest,
134
+ originalWidth,
135
+ originalHeight,
136
+ width,
137
+ height,
138
+ actualHeight,
139
+ bpc,
140
+ comps,
141
+ alpha01
142
+ ) {
143
+ const count = originalWidth * originalHeight;
144
+ let rgbBuf = null;
145
+ const numComponentColors = 1 << bpc;
146
+ const needsResizing = originalHeight !== height || originalWidth !== width;
147
+
148
+ if (this.isPassthrough(bpc)) {
149
+ rgbBuf = comps;
150
+ } else if (
151
+ this.numComps === 1 &&
152
+ count > numComponentColors &&
153
+ this.name !== "DeviceGray" &&
154
+ this.name !== "DeviceRGB"
155
+ ) {
156
+ // Optimization: create a color map when there is just one component and
157
+ // we are converting more colors than the size of the color map. We
158
+ // don't build the map if the colorspace is gray or rgb since those
159
+ // methods are faster than building a map. This mainly offers big speed
160
+ // ups for indexed and alternate colorspaces.
161
+ //
162
+ // TODO it may be worth while to cache the color map. While running
163
+ // testing I never hit a cache so I will leave that out for now (perhaps
164
+ // we are reparsing colorspaces too much?).
165
+ const allColors =
166
+ bpc <= 8
167
+ ? new Uint8Array(numComponentColors)
168
+ : new Uint16Array(numComponentColors);
169
+ for (let i = 0; i < numComponentColors; i++) {
170
+ allColors[i] = i;
171
+ }
172
+ const colorMap = new Uint8ClampedArray(numComponentColors * 3);
173
+ this.getRgbBuffer(
174
+ allColors,
175
+ 0,
176
+ numComponentColors,
177
+ colorMap,
178
+ 0,
179
+ bpc,
180
+ /* alpha01 = */ 0
181
+ );
182
+
183
+ if (!needsResizing) {
184
+ // Fill in the RGB values directly into |dest|.
185
+ let destPos = 0;
186
+ for (let i = 0; i < count; ++i) {
187
+ const key = comps[i] * 3;
188
+ dest[destPos++] = colorMap[key];
189
+ dest[destPos++] = colorMap[key + 1];
190
+ dest[destPos++] = colorMap[key + 2];
191
+ destPos += alpha01;
192
+ }
193
+ } else {
194
+ rgbBuf = new Uint8Array(count * 3);
195
+ let rgbPos = 0;
196
+ for (let i = 0; i < count; ++i) {
197
+ const key = comps[i] * 3;
198
+ rgbBuf[rgbPos++] = colorMap[key];
199
+ rgbBuf[rgbPos++] = colorMap[key + 1];
200
+ rgbBuf[rgbPos++] = colorMap[key + 2];
201
+ }
202
+ }
203
+ } else if (!needsResizing) {
204
+ // Fill in the RGB values directly into |dest|.
205
+ this.getRgbBuffer(comps, 0, width * actualHeight, dest, 0, bpc, alpha01);
206
+ } else {
207
+ rgbBuf = new Uint8ClampedArray(count * 3);
208
+ this.getRgbBuffer(comps, 0, count, rgbBuf, 0, bpc, /* alpha01 = */ 0);
209
+ }
210
+
211
+ if (rgbBuf) {
212
+ if (needsResizing) {
213
+ resizeRgbImage(
214
+ rgbBuf,
215
+ dest,
216
+ originalWidth,
217
+ originalHeight,
218
+ width,
219
+ height,
220
+ alpha01
221
+ );
222
+ } else {
223
+ let destPos = 0,
224
+ rgbPos = 0;
225
+ for (let i = 0, ii = width * actualHeight; i < ii; i++) {
226
+ dest[destPos++] = rgbBuf[rgbPos++];
227
+ dest[destPos++] = rgbBuf[rgbPos++];
228
+ dest[destPos++] = rgbBuf[rgbPos++];
229
+ destPos += alpha01;
230
+ }
231
+ }
232
+ }
233
+ }
234
+
235
+ /**
236
+ * True if the colorspace has components in the default range of [0, 1].
237
+ * This should be true for all colorspaces except for lab color spaces
238
+ * which are [0,100], [-128, 127], [-128, 127].
239
+ */
240
+ get usesZeroToOneRange() {
241
+ return shadow(this, "usesZeroToOneRange", true);
242
+ }
243
+
244
+ /**
245
+ * @private
246
+ */
247
+ static _cache(cacheKey, xref, localColorSpaceCache, parsedColorSpace) {
248
+ if (!localColorSpaceCache) {
249
+ throw new Error(
250
+ 'ColorSpace._cache - expected "localColorSpaceCache" argument.'
251
+ );
252
+ }
253
+ if (!parsedColorSpace) {
254
+ throw new Error(
255
+ 'ColorSpace._cache - expected "parsedColorSpace" argument.'
256
+ );
257
+ }
258
+ let csName, csRef;
259
+ if (cacheKey instanceof Ref) {
260
+ csRef = cacheKey;
261
+
262
+ // If parsing succeeded, we know that this call cannot throw.
263
+ cacheKey = xref.fetch(cacheKey);
264
+ }
265
+ if (cacheKey instanceof Name) {
266
+ csName = cacheKey.name;
267
+ }
268
+ if (csName || csRef) {
269
+ localColorSpaceCache.set(csName, csRef, parsedColorSpace);
270
+ }
271
+ }
272
+
273
+ static getCached(cacheKey, xref, localColorSpaceCache) {
274
+ if (!localColorSpaceCache) {
275
+ throw new Error(
276
+ 'ColorSpace.getCached - expected "localColorSpaceCache" argument.'
277
+ );
278
+ }
279
+ if (cacheKey instanceof Ref) {
280
+ const localColorSpace = localColorSpaceCache.getByRef(cacheKey);
281
+ if (localColorSpace) {
282
+ return localColorSpace;
283
+ }
284
+
285
+ try {
286
+ cacheKey = xref.fetch(cacheKey);
287
+ } catch (ex) {
288
+ if (ex instanceof MissingDataException) {
289
+ throw ex;
290
+ }
291
+ // Any errors should be handled during parsing, rather than here.
292
+ }
293
+ }
294
+ if (cacheKey instanceof Name) {
295
+ const localColorSpace = localColorSpaceCache.getByName(cacheKey.name);
296
+ if (localColorSpace) {
297
+ return localColorSpace;
298
+ }
299
+ }
300
+ return null;
301
+ }
302
+
303
+ static async parseAsync({
304
+ cs,
305
+ xref,
306
+ resources = null,
307
+ pdfFunctionFactory,
308
+ localColorSpaceCache,
309
+ }) {
310
+
311
+ const parsedColorSpace = this._parse(
312
+ cs,
313
+ xref,
314
+ resources,
315
+ pdfFunctionFactory
316
+ );
317
+
318
+ // Attempt to cache the parsed ColorSpace, by name and/or reference.
319
+ this._cache(cs, xref, localColorSpaceCache, parsedColorSpace);
320
+
321
+ return parsedColorSpace;
322
+ }
323
+
324
+ static parse({
325
+ cs,
326
+ xref,
327
+ resources = null,
328
+ pdfFunctionFactory,
329
+ localColorSpaceCache,
330
+ }) {
331
+ const cachedColorSpace = this.getCached(cs, xref, localColorSpaceCache);
332
+ if (cachedColorSpace) {
333
+ return cachedColorSpace;
334
+ }
335
+ const parsedColorSpace = this._parse(
336
+ cs,
337
+ xref,
338
+ resources,
339
+ pdfFunctionFactory
340
+ );
341
+
342
+ // Attempt to cache the parsed ColorSpace, by name and/or reference.
343
+ this._cache(cs, xref, localColorSpaceCache, parsedColorSpace);
344
+
345
+ return parsedColorSpace;
346
+ }
347
+
348
+ /**
349
+ * @private
350
+ */
351
+ static _parse(cs, xref, resources = null, pdfFunctionFactory) {
352
+ cs = xref.fetchIfRef(cs);
353
+ if (cs instanceof Name) {
354
+ switch (cs.name) {
355
+ case "G":
356
+ case "DeviceGray":
357
+ return this.singletons.gray;
358
+ case "RGB":
359
+ case "DeviceRGB":
360
+ return this.singletons.rgb;
361
+ case "CMYK":
362
+ case "DeviceCMYK":
363
+ return this.singletons.cmyk;
364
+ case "Pattern":
365
+ return new PatternCS(/* baseCS = */ null);
366
+ default:
367
+ if (resources instanceof Dict) {
368
+ const colorSpaces = resources.get("ColorSpace");
369
+ if (colorSpaces instanceof Dict) {
370
+ const resourcesCS = colorSpaces.get(cs.name);
371
+ if (resourcesCS) {
372
+ if (resourcesCS instanceof Name) {
373
+ return this._parse(
374
+ resourcesCS,
375
+ xref,
376
+ resources,
377
+ pdfFunctionFactory
378
+ );
379
+ }
380
+ cs = resourcesCS;
381
+ break;
382
+ }
383
+ }
384
+ }
385
+ throw new FormatError(`Unrecognized ColorSpace: ${cs.name}`);
386
+ }
387
+ }
388
+ if (Array.isArray(cs)) {
389
+ const mode = xref.fetchIfRef(cs[0]).name;
390
+ let params, numComps, baseCS, whitePoint, blackPoint, gamma;
391
+
392
+ switch (mode) {
393
+ case "G":
394
+ case "DeviceGray":
395
+ return this.singletons.gray;
396
+ case "RGB":
397
+ case "DeviceRGB":
398
+ return this.singletons.rgb;
399
+ case "CMYK":
400
+ case "DeviceCMYK":
401
+ return this.singletons.cmyk;
402
+ case "CalGray":
403
+ params = xref.fetchIfRef(cs[1]);
404
+ whitePoint = params.getArray("WhitePoint");
405
+ blackPoint = params.getArray("BlackPoint");
406
+ gamma = params.get("Gamma");
407
+ return new CalGrayCS(whitePoint, blackPoint, gamma);
408
+ case "CalRGB":
409
+ params = xref.fetchIfRef(cs[1]);
410
+ whitePoint = params.getArray("WhitePoint");
411
+ blackPoint = params.getArray("BlackPoint");
412
+ gamma = params.getArray("Gamma");
413
+ const matrix = params.getArray("Matrix");
414
+ return new CalRGBCS(whitePoint, blackPoint, gamma, matrix);
415
+ case "ICCBased":
416
+ const stream = xref.fetchIfRef(cs[1]);
417
+ const dict = stream.dict;
418
+ numComps = dict.get("N");
419
+ const alt = dict.get("Alternate");
420
+ if (alt) {
421
+ const altCS = this._parse(alt, xref, resources, pdfFunctionFactory);
422
+ // Ensure that the number of components are correct,
423
+ // and also (indirectly) that it is not a PatternCS.
424
+ if (altCS.numComps === numComps) {
425
+ return altCS;
426
+ }
427
+ warn("ICCBased color space: Ignoring incorrect /Alternate entry.");
428
+ }
429
+ if (numComps === 1) {
430
+ return this.singletons.gray;
431
+ } else if (numComps === 3) {
432
+ return this.singletons.rgb;
433
+ } else if (numComps === 4) {
434
+ return this.singletons.cmyk;
435
+ }
436
+ break;
437
+ case "Pattern":
438
+ baseCS = cs[1] || null;
439
+ if (baseCS) {
440
+ baseCS = this._parse(baseCS, xref, resources, pdfFunctionFactory);
441
+ }
442
+ return new PatternCS(baseCS);
443
+ case "I":
444
+ case "Indexed":
445
+ baseCS = this._parse(cs[1], xref, resources, pdfFunctionFactory);
446
+ const hiVal = xref.fetchIfRef(cs[2]) + 1;
447
+ const lookup = xref.fetchIfRef(cs[3]);
448
+ return new IndexedCS(baseCS, hiVal, lookup);
449
+ case "Separation":
450
+ case "DeviceN":
451
+ const name = xref.fetchIfRef(cs[1]);
452
+ numComps = Array.isArray(name) ? name.length : 1;
453
+ baseCS = this._parse(cs[2], xref, resources, pdfFunctionFactory);
454
+ const tintFn = pdfFunctionFactory.create(cs[3]);
455
+ return new AlternateCS(numComps, baseCS, tintFn);
456
+ case "Lab":
457
+ params = xref.fetchIfRef(cs[1]);
458
+ whitePoint = params.getArray("WhitePoint");
459
+ blackPoint = params.getArray("BlackPoint");
460
+ const range = params.getArray("Range");
461
+ return new LabCS(whitePoint, blackPoint, range);
462
+ default:
463
+ throw new FormatError(`Unimplemented ColorSpace object: ${mode}`);
464
+ }
465
+ }
466
+ throw new FormatError(`Unrecognized ColorSpace object: ${cs}`);
467
+ }
468
+
469
+ /**
470
+ * Checks if a decode map matches the default decode map for a color space.
471
+ * This handles the general decode maps where there are two values per
472
+ * component, e.g. [0, 1, 0, 1, 0, 1] for a RGB color.
473
+ * This does not handle Lab, Indexed, or Pattern decode maps since they are
474
+ * slightly different.
475
+ * @param {Array} decode - Decode map (usually from an image).
476
+ * @param {number} numComps - Number of components the color space has.
477
+ */
478
+ static isDefaultDecode(decode, numComps) {
479
+ if (!Array.isArray(decode)) {
480
+ return true;
481
+ }
482
+ if (numComps * 2 !== decode.length) {
483
+ warn("The decode map is not the correct length");
484
+ return true;
485
+ }
486
+ for (let i = 0, ii = decode.length; i < ii; i += 2) {
487
+ if (decode[i] !== 0 || decode[i + 1] !== 1) {
488
+ return false;
489
+ }
490
+ }
491
+ return true;
492
+ }
493
+
494
+ static get singletons() {
495
+ return shadow(this, "singletons", {
496
+ get gray() {
497
+ return shadow(this, "gray", new DeviceGrayCS());
498
+ },
499
+ get rgb() {
500
+ return shadow(this, "rgb", new DeviceRgbCS());
501
+ },
502
+ get cmyk() {
503
+ return shadow(this, "cmyk", new DeviceCmykCS());
504
+ },
505
+ });
506
+ }
507
+ }
508
+
509
+ /**
510
+ * Alternate color space handles both Separation and DeviceN color spaces. A
511
+ * Separation color space is actually just a DeviceN with one color component.
512
+ * Both color spaces use a tinting function to convert colors to a base color
513
+ * space.
514
+ *
515
+ * The default color is `new Float32Array(new Array(numComps).fill(1))`.
516
+ */
517
+ class AlternateCS extends ColorSpace {
518
+ constructor(numComps, base, tintFn) {
519
+ super("Alternate", numComps);
520
+ this.base = base;
521
+ this.tintFn = tintFn;
522
+ this.tmpBuf = new Float32Array(base.numComps);
523
+ }
524
+
525
+ getRgbItem(src, srcOffset, dest, destOffset) {
526
+ const tmpBuf = this.tmpBuf;
527
+ this.tintFn(src, srcOffset, tmpBuf, 0);
528
+ this.base.getRgbItem(tmpBuf, 0, dest, destOffset);
529
+ }
530
+
531
+ getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
532
+ const tintFn = this.tintFn;
533
+ const base = this.base;
534
+ const scale = 1 / ((1 << bits) - 1);
535
+ const baseNumComps = base.numComps;
536
+ const usesZeroToOneRange = base.usesZeroToOneRange;
537
+ const isPassthrough =
538
+ (base.isPassthrough(8) || !usesZeroToOneRange) && alpha01 === 0;
539
+ let pos = isPassthrough ? destOffset : 0;
540
+ const baseBuf = isPassthrough
541
+ ? dest
542
+ : new Uint8ClampedArray(baseNumComps * count);
543
+ const numComps = this.numComps;
544
+
545
+ const scaled = new Float32Array(numComps);
546
+ const tinted = new Float32Array(baseNumComps);
547
+ let i, j;
548
+
549
+ for (i = 0; i < count; i++) {
550
+ for (j = 0; j < numComps; j++) {
551
+ scaled[j] = src[srcOffset++] * scale;
552
+ }
553
+ tintFn(scaled, 0, tinted, 0);
554
+ if (usesZeroToOneRange) {
555
+ for (j = 0; j < baseNumComps; j++) {
556
+ baseBuf[pos++] = tinted[j] * 255;
557
+ }
558
+ } else {
559
+ base.getRgbItem(tinted, 0, baseBuf, pos);
560
+ pos += baseNumComps;
561
+ }
562
+ }
563
+
564
+ if (!isPassthrough) {
565
+ base.getRgbBuffer(baseBuf, 0, count, dest, destOffset, 8, alpha01);
566
+ }
567
+ }
568
+
569
+ getOutputLength(inputLength, alpha01) {
570
+ return this.base.getOutputLength(
571
+ (inputLength * this.base.numComps) / this.numComps,
572
+ alpha01
573
+ );
574
+ }
575
+ }
576
+
577
+ class PatternCS extends ColorSpace {
578
+ constructor(baseCS) {
579
+ super("Pattern", null);
580
+ this.base = baseCS;
581
+ }
582
+
583
+ isDefaultDecode(decodeMap, bpc) {
584
+ unreachable("Should not call PatternCS.isDefaultDecode");
585
+ }
586
+ }
587
+
588
+ /**
589
+ * The default color is `new Uint8Array([0])`.
590
+ */
591
+ class IndexedCS extends ColorSpace {
592
+ constructor(base, highVal, lookup) {
593
+ super("Indexed", 1);
594
+ this.base = base;
595
+ this.highVal = highVal;
596
+
597
+ const length = base.numComps * highVal;
598
+ this.lookup = new Uint8Array(length);
599
+
600
+ if (lookup instanceof BaseStream) {
601
+ const bytes = lookup.getBytes(length);
602
+ this.lookup.set(bytes);
603
+ } else if (typeof lookup === "string") {
604
+ for (let i = 0; i < length; ++i) {
605
+ this.lookup[i] = lookup.charCodeAt(i) & 0xff;
606
+ }
607
+ } else {
608
+ throw new FormatError(`IndexedCS - unrecognized lookup table: ${lookup}`);
609
+ }
610
+ }
611
+
612
+ getRgbItem(src, srcOffset, dest, destOffset) {
613
+
614
+ const numComps = this.base.numComps;
615
+ const start = src[srcOffset] * numComps;
616
+ this.base.getRgbBuffer(this.lookup, start, 1, dest, destOffset, 8, 0);
617
+ }
618
+
619
+ getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
620
+
621
+ const base = this.base;
622
+ const numComps = base.numComps;
623
+ const outputDelta = base.getOutputLength(numComps, alpha01);
624
+ const lookup = this.lookup;
625
+
626
+ for (let i = 0; i < count; ++i) {
627
+ const lookupPos = src[srcOffset++] * numComps;
628
+ base.getRgbBuffer(lookup, lookupPos, 1, dest, destOffset, 8, alpha01);
629
+ destOffset += outputDelta;
630
+ }
631
+ }
632
+
633
+ getOutputLength(inputLength, alpha01) {
634
+ return this.base.getOutputLength(inputLength * this.base.numComps, alpha01);
635
+ }
636
+
637
+ isDefaultDecode(decodeMap, bpc) {
638
+ if (!Array.isArray(decodeMap)) {
639
+ return true;
640
+ }
641
+ if (decodeMap.length !== 2) {
642
+ warn("Decode map length is not correct");
643
+ return true;
644
+ }
645
+ if (!Number.isInteger(bpc) || bpc < 1) {
646
+ warn("Bits per component is not correct");
647
+ return true;
648
+ }
649
+ return decodeMap[0] === 0 && decodeMap[1] === (1 << bpc) - 1;
650
+ }
651
+ }
652
+
653
+ /**
654
+ * The default color is `new Float32Array([0])`.
655
+ */
656
+ class DeviceGrayCS extends ColorSpace {
657
+ constructor() {
658
+ super("DeviceGray", 1);
659
+ }
660
+
661
+ getRgbItem(src, srcOffset, dest, destOffset) {
662
+
663
+ const c = src[srcOffset] * 255;
664
+ dest[destOffset] = dest[destOffset + 1] = dest[destOffset + 2] = c;
665
+ }
666
+
667
+ getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
668
+
669
+ const scale = 255 / ((1 << bits) - 1);
670
+ let j = srcOffset,
671
+ q = destOffset;
672
+ for (let i = 0; i < count; ++i) {
673
+ const c = scale * src[j++];
674
+ dest[q++] = c;
675
+ dest[q++] = c;
676
+ dest[q++] = c;
677
+ q += alpha01;
678
+ }
679
+ }
680
+
681
+ getOutputLength(inputLength, alpha01) {
682
+ return inputLength * (3 + alpha01);
683
+ }
684
+ }
685
+
686
+ /**
687
+ * The default color is `new Float32Array([0, 0, 0])`.
688
+ */
689
+ class DeviceRgbCS extends ColorSpace {
690
+ constructor() {
691
+ super("DeviceRGB", 3);
692
+ }
693
+
694
+ getRgbItem(src, srcOffset, dest, destOffset) {
695
+
696
+ dest[destOffset] = src[srcOffset] * 255;
697
+ dest[destOffset + 1] = src[srcOffset + 1] * 255;
698
+ dest[destOffset + 2] = src[srcOffset + 2] * 255;
699
+ }
700
+
701
+ getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
702
+
703
+ if (bits === 8 && alpha01 === 0) {
704
+ dest.set(src.subarray(srcOffset, srcOffset + count * 3), destOffset);
705
+ return;
706
+ }
707
+ const scale = 255 / ((1 << bits) - 1);
708
+ let j = srcOffset,
709
+ q = destOffset;
710
+ for (let i = 0; i < count; ++i) {
711
+ dest[q++] = scale * src[j++];
712
+ dest[q++] = scale * src[j++];
713
+ dest[q++] = scale * src[j++];
714
+ q += alpha01;
715
+ }
716
+ }
717
+
718
+ getOutputLength(inputLength, alpha01) {
719
+ return ((inputLength * (3 + alpha01)) / 3) | 0;
720
+ }
721
+
722
+ isPassthrough(bits) {
723
+ return bits === 8;
724
+ }
725
+ }
726
+
727
+ /**
728
+ * The default color is `new Float32Array([0, 0, 0, 1])`.
729
+ */
730
+ class DeviceCmykCS extends ColorSpace {
731
+ constructor() {
732
+ super("DeviceCMYK", 4);
733
+ }
734
+
735
+ // The coefficients below was found using numerical analysis: the method of
736
+ // steepest descent for the sum((f_i - color_value_i)^2) for r/g/b colors,
737
+ // where color_value is the tabular value from the table of sampled RGB colors
738
+ // from CMYK US Web Coated (SWOP) colorspace, and f_i is the corresponding
739
+ // CMYK color conversion using the estimation below:
740
+ // f(A, B,.. N) = Acc+Bcm+Ccy+Dck+c+Fmm+Gmy+Hmk+Im+Jyy+Kyk+Ly+Mkk+Nk+255
741
+ #toRgb(src, srcOffset, srcScale, dest, destOffset) {
742
+ const c = src[srcOffset] * srcScale;
743
+ const m = src[srcOffset + 1] * srcScale;
744
+ const y = src[srcOffset + 2] * srcScale;
745
+ const k = src[srcOffset + 3] * srcScale;
746
+
747
+ dest[destOffset] =
748
+ 255 +
749
+ c *
750
+ (-4.387332384609988 * c +
751
+ 54.48615194189176 * m +
752
+ 18.82290502165302 * y +
753
+ 212.25662451639585 * k +
754
+ -285.2331026137004) +
755
+ m *
756
+ (1.7149763477362134 * m -
757
+ 5.6096736904047315 * y +
758
+ -17.873870861415444 * k -
759
+ 5.497006427196366) +
760
+ y *
761
+ (-2.5217340131683033 * y - 21.248923337353073 * k + 17.5119270841813) +
762
+ k * (-21.86122147463605 * k - 189.48180835922747);
763
+
764
+ dest[destOffset + 1] =
765
+ 255 +
766
+ c *
767
+ (8.841041422036149 * c +
768
+ 60.118027045597366 * m +
769
+ 6.871425592049007 * y +
770
+ 31.159100130055922 * k +
771
+ -79.2970844816548) +
772
+ m *
773
+ (-15.310361306967817 * m +
774
+ 17.575251261109482 * y +
775
+ 131.35250912493976 * k -
776
+ 190.9453302588951) +
777
+ y * (4.444339102852739 * y + 9.8632861493405 * k - 24.86741582555878) +
778
+ k * (-20.737325471181034 * k - 187.80453709719578);
779
+
780
+ dest[destOffset + 2] =
781
+ 255 +
782
+ c *
783
+ (0.8842522430003296 * c +
784
+ 8.078677503112928 * m +
785
+ 30.89978309703729 * y -
786
+ 0.23883238689178934 * k +
787
+ -14.183576799673286) +
788
+ m *
789
+ (10.49593273432072 * m +
790
+ 63.02378494754052 * y +
791
+ 50.606957656360734 * k -
792
+ 112.23884253719248) +
793
+ y *
794
+ (0.03296041114873217 * y +
795
+ 115.60384449646641 * k +
796
+ -193.58209356861505) +
797
+ k * (-22.33816807309886 * k - 180.12613974708367);
798
+ }
799
+
800
+ getRgbItem(src, srcOffset, dest, destOffset) {
801
+
802
+ this.#toRgb(src, srcOffset, 1, dest, destOffset);
803
+ }
804
+
805
+ getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
806
+
807
+ const scale = 1 / ((1 << bits) - 1);
808
+ for (let i = 0; i < count; i++) {
809
+ this.#toRgb(src, srcOffset, scale, dest, destOffset);
810
+ srcOffset += 4;
811
+ destOffset += 3 + alpha01;
812
+ }
813
+ }
814
+
815
+ getOutputLength(inputLength, alpha01) {
816
+ return ((inputLength / 4) * (3 + alpha01)) | 0;
817
+ }
818
+ }
819
+
820
+ /**
821
+ * CalGrayCS: Based on "PDF Reference, Sixth Ed", p.245
822
+ *
823
+ * The default color is `new Float32Array([0])`.
824
+ */
825
+ class CalGrayCS extends ColorSpace {
826
+ constructor(whitePoint, blackPoint, gamma) {
827
+ super("CalGray", 1);
828
+
829
+ if (!whitePoint) {
830
+ throw new FormatError(
831
+ "WhitePoint missing - required for color space CalGray"
832
+ );
833
+ }
834
+ // Translate arguments to spec variables.
835
+ [this.XW, this.YW, this.ZW] = whitePoint;
836
+ [this.XB, this.YB, this.ZB] = blackPoint || [0, 0, 0];
837
+ this.G = gamma || 1;
838
+
839
+ // Validate variables as per spec.
840
+ if (this.XW < 0 || this.ZW < 0 || this.YW !== 1) {
841
+ throw new FormatError(
842
+ `Invalid WhitePoint components for ${this.name}, no fallback available`
843
+ );
844
+ }
845
+
846
+ if (this.XB < 0 || this.YB < 0 || this.ZB < 0) {
847
+ info(`Invalid BlackPoint for ${this.name}, falling back to default.`);
848
+ this.XB = this.YB = this.ZB = 0;
849
+ }
850
+
851
+ if (this.XB !== 0 || this.YB !== 0 || this.ZB !== 0) {
852
+ warn(
853
+ `${this.name}, BlackPoint: XB: ${this.XB}, YB: ${this.YB}, ` +
854
+ `ZB: ${this.ZB}, only default values are supported.`
855
+ );
856
+ }
857
+
858
+ if (this.G < 1) {
859
+ info(
860
+ `Invalid Gamma: ${this.G} for ${this.name}, falling back to default.`
861
+ );
862
+ this.G = 1;
863
+ }
864
+ }
865
+
866
+ #toRgb(src, srcOffset, dest, destOffset, scale) {
867
+ // A represents a gray component of a calibrated gray space.
868
+ // A <---> AG in the spec
869
+ const A = src[srcOffset] * scale;
870
+ const AG = A ** this.G;
871
+
872
+ // Computes L as per spec. ( = this.YW * AG )
873
+ // Except if other than default BlackPoint values are used.
874
+ const L = this.YW * AG;
875
+ // http://www.poynton.com/notes/colour_and_gamma/ColorFAQ.html, Ch 4.
876
+ // Convert values to rgb range [0, 255].
877
+ const val = Math.max(295.8 * L ** 0.3333333333333333 - 40.8, 0);
878
+ dest[destOffset] = val;
879
+ dest[destOffset + 1] = val;
880
+ dest[destOffset + 2] = val;
881
+ }
882
+
883
+ getRgbItem(src, srcOffset, dest, destOffset) {
884
+
885
+ this.#toRgb(src, srcOffset, dest, destOffset, 1);
886
+ }
887
+
888
+ getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
889
+
890
+ const scale = 1 / ((1 << bits) - 1);
891
+
892
+ for (let i = 0; i < count; ++i) {
893
+ this.#toRgb(src, srcOffset, dest, destOffset, scale);
894
+ srcOffset += 1;
895
+ destOffset += 3 + alpha01;
896
+ }
897
+ }
898
+
899
+ getOutputLength(inputLength, alpha01) {
900
+ return inputLength * (3 + alpha01);
901
+ }
902
+ }
903
+
904
+ /**
905
+ * CalRGBCS: Based on "PDF Reference, Sixth Ed", p.247
906
+ *
907
+ * The default color is `new Float32Array([0, 0, 0])`.
908
+ */
909
+ class CalRGBCS extends ColorSpace {
910
+ // See http://www.brucelindbloom.com/index.html?Eqn_ChromAdapt.html for these
911
+ // matrices.
912
+ // prettier-ignore
913
+ static #BRADFORD_SCALE_MATRIX = new Float32Array([
914
+ 0.8951, 0.2664, -0.1614,
915
+ -0.7502, 1.7135, 0.0367,
916
+ 0.0389, -0.0685, 1.0296]);
917
+
918
+ // prettier-ignore
919
+ static #BRADFORD_SCALE_INVERSE_MATRIX = new Float32Array([
920
+ 0.9869929, -0.1470543, 0.1599627,
921
+ 0.4323053, 0.5183603, 0.0492912,
922
+ -0.0085287, 0.0400428, 0.9684867]);
923
+
924
+ // See http://www.brucelindbloom.com/index.html?Eqn_RGB_XYZ_Matrix.html.
925
+ // prettier-ignore
926
+ static #SRGB_D65_XYZ_TO_RGB_MATRIX = new Float32Array([
927
+ 3.2404542, -1.5371385, -0.4985314,
928
+ -0.9692660, 1.8760108, 0.0415560,
929
+ 0.0556434, -0.2040259, 1.0572252]);
930
+
931
+ static #FLAT_WHITEPOINT_MATRIX = new Float32Array([1, 1, 1]);
932
+
933
+ static #tempNormalizeMatrix = new Float32Array(3);
934
+
935
+ static #tempConvertMatrix1 = new Float32Array(3);
936
+
937
+ static #tempConvertMatrix2 = new Float32Array(3);
938
+
939
+ static #DECODE_L_CONSTANT = ((8 + 16) / 116) ** 3 / 8.0;
940
+
941
+ constructor(whitePoint, blackPoint, gamma, matrix) {
942
+ super("CalRGB", 3);
943
+
944
+ if (!whitePoint) {
945
+ throw new FormatError(
946
+ "WhitePoint missing - required for color space CalRGB"
947
+ );
948
+ }
949
+ // Translate arguments to spec variables.
950
+ const [XW, YW, ZW] = (this.whitePoint = whitePoint);
951
+ const [XB, YB, ZB] = (this.blackPoint = blackPoint || new Float32Array(3));
952
+
953
+ [this.GR, this.GG, this.GB] = gamma || new Float32Array([1, 1, 1]);
954
+ [
955
+ this.MXA,
956
+ this.MYA,
957
+ this.MZA,
958
+ this.MXB,
959
+ this.MYB,
960
+ this.MZB,
961
+ this.MXC,
962
+ this.MYC,
963
+ this.MZC,
964
+ ] = matrix || new Float32Array([1, 0, 0, 0, 1, 0, 0, 0, 1]);
965
+
966
+ // Validate variables as per spec.
967
+ if (XW < 0 || ZW < 0 || YW !== 1) {
968
+ throw new FormatError(
969
+ `Invalid WhitePoint components for ${this.name}, no fallback available`
970
+ );
971
+ }
972
+
973
+ if (XB < 0 || YB < 0 || ZB < 0) {
974
+ info(
975
+ `Invalid BlackPoint for ${this.name} [${XB}, ${YB}, ${ZB}], ` +
976
+ "falling back to default."
977
+ );
978
+ this.blackPoint = new Float32Array(3);
979
+ }
980
+
981
+ if (this.GR < 0 || this.GG < 0 || this.GB < 0) {
982
+ info(
983
+ `Invalid Gamma [${this.GR}, ${this.GG}, ${this.GB}] for ` +
984
+ `${this.name}, falling back to default.`
985
+ );
986
+ this.GR = this.GG = this.GB = 1;
987
+ }
988
+ }
989
+
990
+ #matrixProduct(a, b, result) {
991
+ result[0] = a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
992
+ result[1] = a[3] * b[0] + a[4] * b[1] + a[5] * b[2];
993
+ result[2] = a[6] * b[0] + a[7] * b[1] + a[8] * b[2];
994
+ }
995
+
996
+ #toFlat(sourceWhitePoint, LMS, result) {
997
+ result[0] = (LMS[0] * 1) / sourceWhitePoint[0];
998
+ result[1] = (LMS[1] * 1) / sourceWhitePoint[1];
999
+ result[2] = (LMS[2] * 1) / sourceWhitePoint[2];
1000
+ }
1001
+
1002
+ #toD65(sourceWhitePoint, LMS, result) {
1003
+ const D65X = 0.95047;
1004
+ const D65Y = 1;
1005
+ const D65Z = 1.08883;
1006
+
1007
+ result[0] = (LMS[0] * D65X) / sourceWhitePoint[0];
1008
+ result[1] = (LMS[1] * D65Y) / sourceWhitePoint[1];
1009
+ result[2] = (LMS[2] * D65Z) / sourceWhitePoint[2];
1010
+ }
1011
+
1012
+ #sRGBTransferFunction(color) {
1013
+ // See http://en.wikipedia.org/wiki/SRGB.
1014
+ if (color <= 0.0031308) {
1015
+ return this.#adjustToRange(0, 1, 12.92 * color);
1016
+ }
1017
+ // Optimization:
1018
+ // If color is close enough to 1, skip calling the following transform
1019
+ // since calling Math.pow is expensive. If color is larger than
1020
+ // the threshold, the final result is larger than 254.5 since
1021
+ // ((1 + 0.055) * 0.99554525 ** (1 / 2.4) - 0.055) * 255 ===
1022
+ // 254.50000003134699
1023
+ if (color >= 0.99554525) {
1024
+ return 1;
1025
+ }
1026
+ return this.#adjustToRange(0, 1, (1 + 0.055) * color ** (1 / 2.4) - 0.055);
1027
+ }
1028
+
1029
+ #adjustToRange(min, max, value) {
1030
+ return Math.max(min, Math.min(max, value));
1031
+ }
1032
+
1033
+ #decodeL(L) {
1034
+ if (L < 0) {
1035
+ return -this.#decodeL(-L);
1036
+ }
1037
+ if (L > 8.0) {
1038
+ return ((L + 16) / 116) ** 3;
1039
+ }
1040
+ return L * CalRGBCS.#DECODE_L_CONSTANT;
1041
+ }
1042
+
1043
+ #compensateBlackPoint(sourceBlackPoint, XYZ_Flat, result) {
1044
+ // In case the blackPoint is already the default blackPoint then there is
1045
+ // no need to do compensation.
1046
+ if (
1047
+ sourceBlackPoint[0] === 0 &&
1048
+ sourceBlackPoint[1] === 0 &&
1049
+ sourceBlackPoint[2] === 0
1050
+ ) {
1051
+ result[0] = XYZ_Flat[0];
1052
+ result[1] = XYZ_Flat[1];
1053
+ result[2] = XYZ_Flat[2];
1054
+ return;
1055
+ }
1056
+
1057
+ // For the blackPoint calculation details, please see
1058
+ // http://www.adobe.com/content/dam/Adobe/en/devnet/photoshop/sdk/
1059
+ // AdobeBPC.pdf.
1060
+ // The destination blackPoint is the default blackPoint [0, 0, 0].
1061
+ const zeroDecodeL = this.#decodeL(0);
1062
+
1063
+ const X_DST = zeroDecodeL;
1064
+ const X_SRC = this.#decodeL(sourceBlackPoint[0]);
1065
+
1066
+ const Y_DST = zeroDecodeL;
1067
+ const Y_SRC = this.#decodeL(sourceBlackPoint[1]);
1068
+
1069
+ const Z_DST = zeroDecodeL;
1070
+ const Z_SRC = this.#decodeL(sourceBlackPoint[2]);
1071
+
1072
+ const X_Scale = (1 - X_DST) / (1 - X_SRC);
1073
+ const X_Offset = 1 - X_Scale;
1074
+
1075
+ const Y_Scale = (1 - Y_DST) / (1 - Y_SRC);
1076
+ const Y_Offset = 1 - Y_Scale;
1077
+
1078
+ const Z_Scale = (1 - Z_DST) / (1 - Z_SRC);
1079
+ const Z_Offset = 1 - Z_Scale;
1080
+
1081
+ result[0] = XYZ_Flat[0] * X_Scale + X_Offset;
1082
+ result[1] = XYZ_Flat[1] * Y_Scale + Y_Offset;
1083
+ result[2] = XYZ_Flat[2] * Z_Scale + Z_Offset;
1084
+ }
1085
+
1086
+ #normalizeWhitePointToFlat(sourceWhitePoint, XYZ_In, result) {
1087
+ // In case the whitePoint is already flat then there is no need to do
1088
+ // normalization.
1089
+ if (sourceWhitePoint[0] === 1 && sourceWhitePoint[2] === 1) {
1090
+ result[0] = XYZ_In[0];
1091
+ result[1] = XYZ_In[1];
1092
+ result[2] = XYZ_In[2];
1093
+ return;
1094
+ }
1095
+
1096
+ const LMS = result;
1097
+ this.#matrixProduct(CalRGBCS.#BRADFORD_SCALE_MATRIX, XYZ_In, LMS);
1098
+
1099
+ const LMS_Flat = CalRGBCS.#tempNormalizeMatrix;
1100
+ this.#toFlat(sourceWhitePoint, LMS, LMS_Flat);
1101
+
1102
+ this.#matrixProduct(
1103
+ CalRGBCS.#BRADFORD_SCALE_INVERSE_MATRIX,
1104
+ LMS_Flat,
1105
+ result
1106
+ );
1107
+ }
1108
+
1109
+ #normalizeWhitePointToD65(sourceWhitePoint, XYZ_In, result) {
1110
+ const LMS = result;
1111
+ this.#matrixProduct(CalRGBCS.#BRADFORD_SCALE_MATRIX, XYZ_In, LMS);
1112
+
1113
+ const LMS_D65 = CalRGBCS.#tempNormalizeMatrix;
1114
+ this.#toD65(sourceWhitePoint, LMS, LMS_D65);
1115
+
1116
+ this.#matrixProduct(
1117
+ CalRGBCS.#BRADFORD_SCALE_INVERSE_MATRIX,
1118
+ LMS_D65,
1119
+ result
1120
+ );
1121
+ }
1122
+
1123
+ #toRgb(src, srcOffset, dest, destOffset, scale) {
1124
+ // A, B and C represent a red, green and blue components of a calibrated
1125
+ // rgb space.
1126
+ const A = this.#adjustToRange(0, 1, src[srcOffset] * scale);
1127
+ const B = this.#adjustToRange(0, 1, src[srcOffset + 1] * scale);
1128
+ const C = this.#adjustToRange(0, 1, src[srcOffset + 2] * scale);
1129
+
1130
+ // A <---> AGR in the spec
1131
+ // B <---> BGG in the spec
1132
+ // C <---> CGB in the spec
1133
+ const AGR = A === 1 ? 1 : A ** this.GR;
1134
+ const BGG = B === 1 ? 1 : B ** this.GG;
1135
+ const CGB = C === 1 ? 1 : C ** this.GB;
1136
+
1137
+ // Computes intermediate variables L, M, N as per spec.
1138
+ // To decode X, Y, Z values map L, M, N directly to them.
1139
+ const X = this.MXA * AGR + this.MXB * BGG + this.MXC * CGB;
1140
+ const Y = this.MYA * AGR + this.MYB * BGG + this.MYC * CGB;
1141
+ const Z = this.MZA * AGR + this.MZB * BGG + this.MZC * CGB;
1142
+
1143
+ // The following calculations are based on this document:
1144
+ // http://www.adobe.com/content/dam/Adobe/en/devnet/photoshop/sdk/
1145
+ // AdobeBPC.pdf.
1146
+ const XYZ = CalRGBCS.#tempConvertMatrix1;
1147
+ XYZ[0] = X;
1148
+ XYZ[1] = Y;
1149
+ XYZ[2] = Z;
1150
+ const XYZ_Flat = CalRGBCS.#tempConvertMatrix2;
1151
+
1152
+ this.#normalizeWhitePointToFlat(this.whitePoint, XYZ, XYZ_Flat);
1153
+
1154
+ const XYZ_Black = CalRGBCS.#tempConvertMatrix1;
1155
+ this.#compensateBlackPoint(this.blackPoint, XYZ_Flat, XYZ_Black);
1156
+
1157
+ const XYZ_D65 = CalRGBCS.#tempConvertMatrix2;
1158
+ this.#normalizeWhitePointToD65(
1159
+ CalRGBCS.#FLAT_WHITEPOINT_MATRIX,
1160
+ XYZ_Black,
1161
+ XYZ_D65
1162
+ );
1163
+
1164
+ const SRGB = CalRGBCS.#tempConvertMatrix1;
1165
+ this.#matrixProduct(CalRGBCS.#SRGB_D65_XYZ_TO_RGB_MATRIX, XYZ_D65, SRGB);
1166
+
1167
+ // Convert the values to rgb range [0, 255].
1168
+ dest[destOffset] = this.#sRGBTransferFunction(SRGB[0]) * 255;
1169
+ dest[destOffset + 1] = this.#sRGBTransferFunction(SRGB[1]) * 255;
1170
+ dest[destOffset + 2] = this.#sRGBTransferFunction(SRGB[2]) * 255;
1171
+ }
1172
+
1173
+ getRgbItem(src, srcOffset, dest, destOffset) {
1174
+
1175
+ this.#toRgb(src, srcOffset, dest, destOffset, 1);
1176
+ }
1177
+
1178
+ getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
1179
+
1180
+ const scale = 1 / ((1 << bits) - 1);
1181
+
1182
+ for (let i = 0; i < count; ++i) {
1183
+ this.#toRgb(src, srcOffset, dest, destOffset, scale);
1184
+ srcOffset += 3;
1185
+ destOffset += 3 + alpha01;
1186
+ }
1187
+ }
1188
+
1189
+ getOutputLength(inputLength, alpha01) {
1190
+ return ((inputLength * (3 + alpha01)) / 3) | 0;
1191
+ }
1192
+ }
1193
+
1194
+ /**
1195
+ * LabCS: Based on "PDF Reference, Sixth Ed", p.250
1196
+ *
1197
+ * The default color is `new Float32Array([0, 0, 0])`.
1198
+ */
1199
+ class LabCS extends ColorSpace {
1200
+ constructor(whitePoint, blackPoint, range) {
1201
+ super("Lab", 3);
1202
+
1203
+ if (!whitePoint) {
1204
+ throw new FormatError(
1205
+ "WhitePoint missing - required for color space Lab"
1206
+ );
1207
+ }
1208
+ // Translate args to spec variables
1209
+ [this.XW, this.YW, this.ZW] = whitePoint;
1210
+ [this.amin, this.amax, this.bmin, this.bmax] = range || [
1211
+ -100, 100, -100, 100,
1212
+ ];
1213
+
1214
+ // These are here just for completeness - the spec doesn't offer any
1215
+ // formulas that use BlackPoint in Lab
1216
+ [this.XB, this.YB, this.ZB] = blackPoint || [0, 0, 0];
1217
+
1218
+ // Validate vars as per spec
1219
+ if (this.XW < 0 || this.ZW < 0 || this.YW !== 1) {
1220
+ throw new FormatError(
1221
+ "Invalid WhitePoint components, no fallback available"
1222
+ );
1223
+ }
1224
+
1225
+ if (this.XB < 0 || this.YB < 0 || this.ZB < 0) {
1226
+ info("Invalid BlackPoint, falling back to default");
1227
+ this.XB = this.YB = this.ZB = 0;
1228
+ }
1229
+
1230
+ if (this.amin > this.amax || this.bmin > this.bmax) {
1231
+ info("Invalid Range, falling back to defaults");
1232
+ this.amin = -100;
1233
+ this.amax = 100;
1234
+ this.bmin = -100;
1235
+ this.bmax = 100;
1236
+ }
1237
+ }
1238
+
1239
+ // Function g(x) from spec
1240
+ #fn_g(x) {
1241
+ return x >= 6 / 29 ? x ** 3 : (108 / 841) * (x - 4 / 29);
1242
+ }
1243
+
1244
+ #decode(value, high1, low2, high2) {
1245
+ return low2 + (value * (high2 - low2)) / high1;
1246
+ }
1247
+
1248
+ // If decoding is needed maxVal should be 2^bits per component - 1.
1249
+ #toRgb(src, srcOffset, maxVal, dest, destOffset) {
1250
+ // XXX: Lab input is in the range of [0, 100], [amin, amax], [bmin, bmax]
1251
+ // not the usual [0, 1]. If a command like setFillColor is used the src
1252
+ // values will already be within the correct range. However, if we are
1253
+ // converting an image we have to map the values to the correct range given
1254
+ // above.
1255
+ // Ls,as,bs <---> L*,a*,b* in the spec
1256
+ let Ls = src[srcOffset];
1257
+ let as = src[srcOffset + 1];
1258
+ let bs = src[srcOffset + 2];
1259
+ if (maxVal !== false) {
1260
+ Ls = this.#decode(Ls, maxVal, 0, 100);
1261
+ as = this.#decode(as, maxVal, this.amin, this.amax);
1262
+ bs = this.#decode(bs, maxVal, this.bmin, this.bmax);
1263
+ }
1264
+
1265
+ // Adjust limits of 'as' and 'bs'
1266
+ if (as > this.amax) {
1267
+ as = this.amax;
1268
+ } else if (as < this.amin) {
1269
+ as = this.amin;
1270
+ }
1271
+ if (bs > this.bmax) {
1272
+ bs = this.bmax;
1273
+ } else if (bs < this.bmin) {
1274
+ bs = this.bmin;
1275
+ }
1276
+
1277
+ // Computes intermediate variables X,Y,Z as per spec
1278
+ const M = (Ls + 16) / 116;
1279
+ const L = M + as / 500;
1280
+ const N = M - bs / 200;
1281
+
1282
+ const X = this.XW * this.#fn_g(L);
1283
+ const Y = this.YW * this.#fn_g(M);
1284
+ const Z = this.ZW * this.#fn_g(N);
1285
+
1286
+ let r, g, b;
1287
+ // Using different conversions for D50 and D65 white points,
1288
+ // per http://www.color.org/srgb.pdf
1289
+ if (this.ZW < 1) {
1290
+ // Assuming D50 (X=0.9642, Y=1.00, Z=0.8249)
1291
+ r = X * 3.1339 + Y * -1.617 + Z * -0.4906;
1292
+ g = X * -0.9785 + Y * 1.916 + Z * 0.0333;
1293
+ b = X * 0.072 + Y * -0.229 + Z * 1.4057;
1294
+ } else {
1295
+ // Assuming D65 (X=0.9505, Y=1.00, Z=1.0888)
1296
+ r = X * 3.2406 + Y * -1.5372 + Z * -0.4986;
1297
+ g = X * -0.9689 + Y * 1.8758 + Z * 0.0415;
1298
+ b = X * 0.0557 + Y * -0.204 + Z * 1.057;
1299
+ }
1300
+ // Convert the color values to the [0,255] range (clamping is automatic).
1301
+ dest[destOffset] = Math.sqrt(r) * 255;
1302
+ dest[destOffset + 1] = Math.sqrt(g) * 255;
1303
+ dest[destOffset + 2] = Math.sqrt(b) * 255;
1304
+ }
1305
+
1306
+ getRgbItem(src, srcOffset, dest, destOffset) {
1307
+
1308
+ this.#toRgb(src, srcOffset, false, dest, destOffset);
1309
+ }
1310
+
1311
+ getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
1312
+
1313
+ const maxVal = (1 << bits) - 1;
1314
+ for (let i = 0; i < count; i++) {
1315
+ this.#toRgb(src, srcOffset, maxVal, dest, destOffset);
1316
+ srcOffset += 3;
1317
+ destOffset += 3 + alpha01;
1318
+ }
1319
+ }
1320
+
1321
+ getOutputLength(inputLength, alpha01) {
1322
+ return ((inputLength * (3 + alpha01)) / 3) | 0;
1323
+ }
1324
+
1325
+ isDefaultDecode(decodeMap, bpc) {
1326
+ // XXX: Decoding is handled with the lab conversion because of the strange
1327
+ // ranges that are used.
1328
+ return true;
1329
+ }
1330
+
1331
+ get usesZeroToOneRange() {
1332
+ return shadow(this, "usesZeroToOneRange", false);
1333
+ }
1334
+ }
1335
+
1336
+ export { ColorSpace };