@corellium/corellium-cli 1.0.2 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (673) hide show
  1. package/README.md +4 -16
  2. package/docs/OVERVIEW.md +2 -2
  3. package/example/WebPlayerSample.js +93 -37
  4. package/jenkinsbuild/build.sh +1 -1
  5. package/node_modules/@babel/cli/node_modules/commander/package.json +27 -58
  6. package/node_modules/@babel/cli/node_modules/make-dir/package.json +62 -93
  7. package/node_modules/@babel/cli/node_modules/pify/package.json +54 -85
  8. package/node_modules/@babel/cli/node_modules/semver/package.json +20 -51
  9. package/node_modules/@babel/cli/node_modules/slash/package.json +37 -68
  10. package/node_modules/@babel/cli/package.json +37 -69
  11. package/node_modules/@corellium/client-api/package.json +15 -40
  12. package/node_modules/@jridgewell/resolve-uri/package.json +40 -75
  13. package/node_modules/@jridgewell/sourcemap-codec/package.json +43 -74
  14. package/node_modules/@jridgewell/trace-mapping/package.json +40 -72
  15. package/node_modules/@mapbox/node-pre-gyp/package.json +27 -61
  16. package/node_modules/@nicolo-ribaudo/chokidar-2/package.json +22 -55
  17. package/node_modules/abbrev/package.json +18 -52
  18. package/node_modules/agent-base/package.json +33 -62
  19. package/node_modules/ansi-regex/package.json +58 -89
  20. package/node_modules/ansi-styles/package.json +59 -95
  21. package/node_modules/anymatch/package.json +28 -56
  22. package/node_modules/aproba/package.json +23 -50
  23. package/node_modules/are-we-there-yet/node_modules/readable-stream/package.json +32 -60
  24. package/node_modules/are-we-there-yet/package.json +32 -62
  25. package/node_modules/ascii-art/package.json +51 -83
  26. package/node_modules/ascii-art-ansi/package.json +30 -61
  27. package/node_modules/ascii-art-braille/package.json +7 -32
  28. package/node_modules/ascii-art-font/package.json +17 -47
  29. package/node_modules/ascii-art-graph/package.json +10 -34
  30. package/node_modules/ascii-art-image/node_modules/ascii-art-braille/package.json +7 -32
  31. package/node_modules/ascii-art-image/package.json +11 -36
  32. package/node_modules/ascii-art-table/package.json +10 -35
  33. package/node_modules/ascii-art-utf/package.json +18 -47
  34. package/node_modules/async/package.json +29 -55
  35. package/node_modules/async-arrays/package.json +34 -62
  36. package/node_modules/asynckit/package.json +45 -74
  37. package/node_modules/axios/package.json +46 -72
  38. package/node_modules/balanced-match/package.json +22 -49
  39. package/node_modules/binary-extensions/package.json +41 -73
  40. package/node_modules/brace-expansion/package.json +23 -50
  41. package/node_modules/braces/package.json +30 -76
  42. package/node_modules/call-bind/package.json +83 -125
  43. package/node_modules/canvas/package.json +43 -86
  44. package/node_modules/chokidar/package.json +40 -74
  45. package/node_modules/chownr/package.json +24 -56
  46. package/node_modules/cli/package.json +23 -70
  47. package/node_modules/cliui/package.json +53 -87
  48. package/node_modules/color/node_modules/color-convert/package.json +26 -60
  49. package/node_modules/color/node_modules/color-name/package.json +18 -45
  50. package/node_modules/color/package.json +26 -57
  51. package/node_modules/color-convert/package.json +25 -59
  52. package/node_modules/color-difference/package.json +26 -52
  53. package/node_modules/color-model/package.json +17 -44
  54. package/node_modules/color-name/package.json +32 -60
  55. package/node_modules/color-string/package.json +26 -67
  56. package/node_modules/color-support/package.json +26 -60
  57. package/node_modules/combined-stream/package.json +19 -52
  58. package/node_modules/component-emitter/package.json +17 -45
  59. package/node_modules/concat-map/package.json +45 -89
  60. package/node_modules/console-control-strings/package.json +22 -55
  61. package/node_modules/convert-source-map/package.json +28 -55
  62. package/node_modules/cookiejar/package.json +16 -44
  63. package/node_modules/core-util-is/package.json +21 -51
  64. package/node_modules/d3/package.json +43 -70
  65. package/node_modules/d3-array/package.json +24 -55
  66. package/node_modules/d3-axis/package.json +27 -54
  67. package/node_modules/d3-brush/package.json +33 -60
  68. package/node_modules/d3-chord/package.json +28 -55
  69. package/node_modules/d3-collection/package.json +25 -54
  70. package/node_modules/d3-color/package.json +2 -2
  71. package/node_modules/d3-contour/package.json +27 -54
  72. package/node_modules/d3-dispatch/package.json +28 -60
  73. package/node_modules/d3-drag/package.json +32 -61
  74. package/node_modules/d3-dsv/node_modules/commander/package.json +25 -56
  75. package/node_modules/d3-dsv/package.json +36 -64
  76. package/node_modules/d3-ease/package.json +28 -56
  77. package/node_modules/d3-fetch/package.json +31 -58
  78. package/node_modules/d3-force/package.json +30 -57
  79. package/node_modules/d3-format/package.json +29 -57
  80. package/node_modules/d3-geo/package.json +35 -62
  81. package/node_modules/d3-hierarchy/package.json +33 -60
  82. package/node_modules/d3-interpolate/package.json +31 -63
  83. package/node_modules/d3-path/package.json +28 -57
  84. package/node_modules/d3-polygon/package.json +28 -55
  85. package/node_modules/d3-quadtree/package.json +29 -57
  86. package/node_modules/d3-random/package.json +26 -53
  87. package/node_modules/d3-scale/package.json +29 -56
  88. package/node_modules/d3-scale-chromatic/package.json +33 -60
  89. package/node_modules/d3-selection/package.json +29 -60
  90. package/node_modules/d3-shape/package.json +32 -59
  91. package/node_modules/d3-time/package.json +28 -57
  92. package/node_modules/d3-time-format/package.json +33 -61
  93. package/node_modules/d3-timer/package.json +28 -57
  94. package/node_modules/d3-transition/package.json +35 -64
  95. package/node_modules/d3-voronoi/package.json +24 -51
  96. package/node_modules/d3-zoom/package.json +34 -61
  97. package/node_modules/debug/package.json +37 -87
  98. package/node_modules/decompress-response/package.json +53 -84
  99. package/node_modules/delayed-stream/package.json +19 -53
  100. package/node_modules/delegates/package.json +11 -45
  101. package/node_modules/detect-libc/package.json +26 -60
  102. package/node_modules/dirname-shim/package.json +26 -60
  103. package/node_modules/dotenv/package.json +37 -64
  104. package/node_modules/duplexer/package.json +18 -49
  105. package/node_modules/emoji-regex/package.json +32 -58
  106. package/node_modules/escalade/package.json +28 -59
  107. package/node_modules/extended-emitter/package.json +37 -65
  108. package/node_modules/fast-safe-stringify/package.json +33 -73
  109. package/node_modules/fill-range/package.json +28 -72
  110. package/node_modules/follow-redirects/package.json +42 -77
  111. package/node_modules/form-data/package.json +42 -74
  112. package/node_modules/formidable/package.json +22 -52
  113. package/node_modules/fs-minipass/package.json +24 -52
  114. package/node_modules/fs-readdir-recursive/package.json +20 -50
  115. package/node_modules/fs.realpath/package.json +21 -53
  116. package/node_modules/fsevents/package.json +38 -63
  117. package/node_modules/ftp-response-parser/node_modules/isarray/package.json +22 -54
  118. package/node_modules/ftp-response-parser/node_modules/readable-stream/package.json +22 -55
  119. package/node_modules/ftp-response-parser/node_modules/string_decoder/package.json +17 -45
  120. package/node_modules/ftp-response-parser/package.json +23 -64
  121. package/node_modules/function-bind/package.json +28 -61
  122. package/node_modules/gauge/package.json +25 -52
  123. package/node_modules/generate-password/package.json +28 -54
  124. package/node_modules/get-caller-file/package.json +27 -53
  125. package/node_modules/get-intrinsic/package.json +91 -124
  126. package/node_modules/glob/package.json +34 -68
  127. package/node_modules/glob-parent/package.json +27 -70
  128. package/node_modules/has/package.json +26 -55
  129. package/node_modules/has-symbols/package.json +104 -133
  130. package/node_modules/has-unicode/package.json +25 -52
  131. package/node_modules/https-proxy-agent/package.json +30 -59
  132. package/node_modules/iconv-lite/package.json +48 -77
  133. package/node_modules/inflight/package.json +20 -48
  134. package/node_modules/inherits/package.json +17 -54
  135. package/node_modules/is-binary-path/package.json +43 -75
  136. package/node_modules/is-extglob/package.json +22 -52
  137. package/node_modules/is-fullwidth-code-point/package.json +45 -79
  138. package/node_modules/is-glob/package.json +26 -68
  139. package/node_modules/is-number/package.json +26 -65
  140. package/node_modules/jsftp/node_modules/debug/package.json +28 -67
  141. package/node_modules/jsftp/package.json +22 -59
  142. package/node_modules/json2csv/node_modules/commander/package.json +25 -56
  143. package/node_modules/json2csv/package.json +37 -64
  144. package/node_modules/jsonparse/package.json +18 -53
  145. package/node_modules/lodash/package.json +15 -61
  146. package/node_modules/lodash.get/package.json +16 -67
  147. package/node_modules/lru-cache/package.json +27 -61
  148. package/node_modules/make-dir/node_modules/semver/package.json +20 -51
  149. package/node_modules/make-dir/package.json +62 -93
  150. package/node_modules/maplex/package.json +22 -54
  151. package/node_modules/methods/package.json +22 -64
  152. package/node_modules/mime/package.json +20 -48
  153. package/node_modules/mime-db/package.json +25 -67
  154. package/node_modules/mime-types/package.json +20 -64
  155. package/node_modules/mimic-response/package.json +45 -76
  156. package/node_modules/minimatch/package.json +25 -61
  157. package/node_modules/minipass/package.json +30 -64
  158. package/node_modules/minizlib/package.json +27 -59
  159. package/node_modules/mkdirp/package.json +27 -57
  160. package/node_modules/ms/package.json +24 -58
  161. package/node_modules/multi-progress/package.json +20 -46
  162. package/node_modules/nan/package.json +27 -87
  163. package/node_modules/node-fetch/package.json +77 -104
  164. package/node_modules/nopt/package.json +22 -54
  165. package/node_modules/normalize-path/package.json +25 -63
  166. package/node_modules/npmlog/package.json +23 -55
  167. package/node_modules/object-assign/package.json +20 -51
  168. package/node_modules/object-inspect/package.json +53 -81
  169. package/node_modules/once/package.json +19 -56
  170. package/node_modules/parse-listing/package.json +27 -56
  171. package/node_modules/path-is-absolute/package.json +16 -47
  172. package/node_modules/picomatch/package.json +28 -60
  173. package/node_modules/progress/package.json +21 -65
  174. package/node_modules/qs/package.json +78 -105
  175. package/node_modules/readdirp/package.json +47 -83
  176. package/node_modules/require-directory/package.json +29 -57
  177. package/node_modules/rimraf/package.json +23 -61
  178. package/node_modules/rw/package.json +19 -46
  179. package/node_modules/safe-buffer/package.json +10 -38
  180. package/node_modules/safer-buffer/package.json +18 -43
  181. package/node_modules/semver/package.json +36 -70
  182. package/node_modules/set-blocking/package.json +29 -56
  183. package/node_modules/side-channel/package.json +70 -98
  184. package/node_modules/sift/package.json +30 -62
  185. package/node_modules/signal-exit/package.json +29 -58
  186. package/node_modules/simple-concat/package.json +22 -46
  187. package/node_modules/simple-get/package.json +9 -33
  188. package/node_modules/simple-swizzle/node_modules/is-arrayish/package.json +28 -59
  189. package/node_modules/simple-swizzle/package.json +23 -57
  190. package/node_modules/strangler/package.json +39 -67
  191. package/node_modules/stream-combiner/package.json +15 -48
  192. package/node_modules/string-tools/package.json +16 -50
  193. package/node_modules/string-width/package.json +59 -97
  194. package/node_modules/string_decoder/package.json +18 -47
  195. package/node_modules/strip-ansi/package.json +57 -94
  196. package/node_modules/superagent/node_modules/form-data/package.json +42 -74
  197. package/node_modules/superagent/node_modules/readable-stream/package.json +32 -60
  198. package/node_modules/superagent/package.json +13 -59
  199. package/node_modules/tar/package.json +27 -59
  200. package/node_modules/through/package.json +17 -50
  201. package/node_modules/to-regex-range/package.json +25 -61
  202. package/node_modules/tr46/package.json +24 -51
  203. package/node_modules/unorm/package.json +34 -75
  204. package/node_modules/util-deprecate/package.json +19 -49
  205. package/node_modules/uuid/package.json +74 -102
  206. package/node_modules/webidl-conversions/package.json +18 -53
  207. package/node_modules/whatwg-url/package.json +15 -49
  208. package/node_modules/wide-align/package.json +21 -53
  209. package/node_modules/wolfy87-eventemitter/package.json +25 -49
  210. package/node_modules/wrap-ansi/package.json +65 -97
  211. package/node_modules/wrappy/package.json +21 -50
  212. package/node_modules/y18n/package.json +43 -73
  213. package/node_modules/yallist/package.json +20 -55
  214. package/node_modules/yargs/package.json +72 -99
  215. package/node_modules/yargs-parser/package.json +52 -83
  216. package/package.json +2 -3
  217. package/src/TrialAccount.js +76 -0
  218. package/src/commands/agent/Agent.js +10 -19
  219. package/src/commands/agent/index.js +1 -0
  220. package/src/commands/agent/ready.js +42 -0
  221. package/src/commands/instances/list.js +8 -3
  222. package/src/commands/signup.js +14 -5
  223. package/src/commands/webplayer/WebPlayer.js +2 -1
  224. package/src/commands/webplayer/create.js +6 -0
  225. package/src/commands/webplayer/list.js +17 -16
  226. package/src/logging.js +1 -1
  227. package/src/profile.js +12 -9
  228. package/src/resumable.js +1314 -0
  229. package/src/table.js +7 -2
  230. package/src/upload.js +64 -2
  231. package/test/test.js +89 -0
  232. package/node_modules/@corellium/corellium-api/README.md +0 -1210
  233. package/node_modules/@corellium/corellium-api/node_modules/form-data/License +0 -19
  234. package/node_modules/@corellium/corellium-api/node_modules/form-data/README.md.bak +0 -356
  235. package/node_modules/@corellium/corellium-api/node_modules/form-data/Readme.md +0 -356
  236. package/node_modules/@corellium/corellium-api/node_modules/form-data/index.d.ts +0 -62
  237. package/node_modules/@corellium/corellium-api/node_modules/form-data/lib/browser.js +0 -2
  238. package/node_modules/@corellium/corellium-api/node_modules/form-data/lib/form_data.js +0 -498
  239. package/node_modules/@corellium/corellium-api/node_modules/form-data/lib/populate.js +0 -10
  240. package/node_modules/@corellium/corellium-api/node_modules/form-data/package.json +0 -104
  241. package/node_modules/@corellium/corellium-api/node_modules/uuid/AUTHORS +0 -5
  242. package/node_modules/@corellium/corellium-api/node_modules/uuid/CHANGELOG.md +0 -119
  243. package/node_modules/@corellium/corellium-api/node_modules/uuid/LICENSE.md +0 -21
  244. package/node_modules/@corellium/corellium-api/node_modules/uuid/README.md +0 -276
  245. package/node_modules/@corellium/corellium-api/node_modules/uuid/bin/uuid +0 -65
  246. package/node_modules/@corellium/corellium-api/node_modules/uuid/index.js +0 -8
  247. package/node_modules/@corellium/corellium-api/node_modules/uuid/lib/bytesToUuid.js +0 -26
  248. package/node_modules/@corellium/corellium-api/node_modules/uuid/lib/md5-browser.js +0 -216
  249. package/node_modules/@corellium/corellium-api/node_modules/uuid/lib/md5.js +0 -25
  250. package/node_modules/@corellium/corellium-api/node_modules/uuid/lib/rng-browser.js +0 -34
  251. package/node_modules/@corellium/corellium-api/node_modules/uuid/lib/rng.js +0 -8
  252. package/node_modules/@corellium/corellium-api/node_modules/uuid/lib/sha1-browser.js +0 -89
  253. package/node_modules/@corellium/corellium-api/node_modules/uuid/lib/sha1.js +0 -25
  254. package/node_modules/@corellium/corellium-api/node_modules/uuid/lib/v35.js +0 -57
  255. package/node_modules/@corellium/corellium-api/node_modules/uuid/package.json +0 -103
  256. package/node_modules/@corellium/corellium-api/node_modules/uuid/v1.js +0 -109
  257. package/node_modules/@corellium/corellium-api/node_modules/uuid/v3.js +0 -4
  258. package/node_modules/@corellium/corellium-api/node_modules/uuid/v4.js +0 -29
  259. package/node_modules/@corellium/corellium-api/node_modules/uuid/v5.js +0 -3
  260. package/node_modules/@corellium/corellium-api/package.json +0 -106
  261. package/node_modules/@corellium/corellium-api/resumable.js +0 -1312
  262. package/node_modules/@corellium/corellium-api/src/agent.js +0 -962
  263. package/node_modules/@corellium/corellium-api/src/corellium.js +0 -444
  264. package/node_modules/@corellium/corellium-api/src/images.js +0 -131
  265. package/node_modules/@corellium/corellium-api/src/input.js +0 -178
  266. package/node_modules/@corellium/corellium-api/src/instance-updater.js +0 -56
  267. package/node_modules/@corellium/corellium-api/src/instance.js +0 -1031
  268. package/node_modules/@corellium/corellium-api/src/netmon.js +0 -308
  269. package/node_modules/@corellium/corellium-api/src/project.js +0 -393
  270. package/node_modules/@corellium/corellium-api/src/role.js +0 -65
  271. package/node_modules/@corellium/corellium-api/src/snapshot.js +0 -77
  272. package/node_modules/@corellium/corellium-api/src/team.js +0 -29
  273. package/node_modules/@corellium/corellium-api/src/user.js +0 -51
  274. package/node_modules/@corellium/corellium-api/src/util/fetch.js +0 -62
  275. package/node_modules/@corellium/corellium-api/src/util/sleep.js +0 -7
  276. package/node_modules/@corellium/corellium-api/test/integration-tests.js +0 -1292
  277. package/node_modules/@corellium/corellium-api/test/root-hook-set-flag-if-test-failed.js +0 -7
  278. package/node_modules/async-limiter/.eslintignore +0 -2
  279. package/node_modules/async-limiter/.nycrc +0 -10
  280. package/node_modules/async-limiter/.travis.yml +0 -9
  281. package/node_modules/async-limiter/LICENSE +0 -8
  282. package/node_modules/async-limiter/index.js +0 -67
  283. package/node_modules/async-limiter/package.json +0 -72
  284. package/node_modules/async-limiter/readme.md +0 -132
  285. package/node_modules/buffer-crc32/LICENSE +0 -19
  286. package/node_modules/buffer-crc32/README.md +0 -47
  287. package/node_modules/buffer-crc32/index.js +0 -111
  288. package/node_modules/buffer-crc32/package.json +0 -72
  289. package/node_modules/cross-fetch/LICENSE +0 -21
  290. package/node_modules/cross-fetch/README.md +0 -169
  291. package/node_modules/cross-fetch/dist/browser-polyfill.js +0 -532
  292. package/node_modules/cross-fetch/dist/browser-ponyfill.js +0 -554
  293. package/node_modules/cross-fetch/dist/cross-fetch.js +0 -2
  294. package/node_modules/cross-fetch/dist/cross-fetch.js.map +0 -1
  295. package/node_modules/cross-fetch/dist/node-polyfill.js +0 -11
  296. package/node_modules/cross-fetch/dist/node-ponyfill.js +0 -22
  297. package/node_modules/cross-fetch/dist/react-native-polyfill.js +0 -12
  298. package/node_modules/cross-fetch/dist/react-native-ponyfill.js +0 -6
  299. package/node_modules/cross-fetch/index.d.ts +0 -14
  300. package/node_modules/cross-fetch/package.json +0 -160
  301. package/node_modules/cross-fetch/polyfill/package.json +0 -8
  302. package/node_modules/duplexify/.travis.yml +0 -6
  303. package/node_modules/duplexify/LICENSE +0 -21
  304. package/node_modules/duplexify/README.md +0 -97
  305. package/node_modules/duplexify/example.js +0 -21
  306. package/node_modules/duplexify/index.js +0 -234
  307. package/node_modules/duplexify/package.json +0 -69
  308. package/node_modules/duplexify/test.js +0 -295
  309. package/node_modules/end-of-stream/LICENSE +0 -21
  310. package/node_modules/end-of-stream/README.md +0 -54
  311. package/node_modules/end-of-stream/index.js +0 -94
  312. package/node_modules/end-of-stream/package.json +0 -69
  313. package/node_modules/fast-stable-stringify/.npmignore +0 -4
  314. package/node_modules/fast-stable-stringify/.travis.yml +0 -10
  315. package/node_modules/fast-stable-stringify/LICENSE +0 -21
  316. package/node_modules/fast-stable-stringify/README.md +0 -81
  317. package/node_modules/fast-stable-stringify/cli/files-to-comparison-results.js +0 -67
  318. package/node_modules/fast-stable-stringify/cli/format-table.js +0 -70
  319. package/node_modules/fast-stable-stringify/cli/index.js +0 -19
  320. package/node_modules/fast-stable-stringify/fixtures/index.js +0 -5
  321. package/node_modules/fast-stable-stringify/fixtures/input-data-types.js +0 -191
  322. package/node_modules/fast-stable-stringify/fixtures/log-result.json +0 -22
  323. package/node_modules/fast-stable-stringify/fixtures/log.txt +0 -24
  324. package/node_modules/fast-stable-stringify/index.js +0 -73
  325. package/node_modules/fast-stable-stringify/karma.conf.js +0 -124
  326. package/node_modules/fast-stable-stringify/karma.conf.travis.js +0 -95
  327. package/node_modules/fast-stable-stringify/package.json +0 -77
  328. package/node_modules/fast-stable-stringify/results/escape-long/Chrome 60.0.3112 (Windows 7 0.0.0).json +0 -57
  329. package/node_modules/fast-stable-stringify/results/escape-long/Chrome Mobile 55.0.2883 (Android 6.0.0).json +0 -57
  330. package/node_modules/fast-stable-stringify/results/escape-long/Edge 14.14393.0 (Windows 10 0.0.0).json +0 -57
  331. package/node_modules/fast-stable-stringify/results/escape-long/Firefox 54.0.0 (Windows 7 0.0.0).json +0 -57
  332. package/node_modules/fast-stable-stringify/results/escape-long/IE 10.0.0 (Windows 7 0.0.0).json +0 -57
  333. package/node_modules/fast-stable-stringify/results/escape-long/IE 11.0.0 (Windows 7 0.0.0).json +0 -57
  334. package/node_modules/fast-stable-stringify/results/escape-long/IE 9.0.0 (Windows 7 0.0.0).json +0 -57
  335. package/node_modules/fast-stable-stringify/results/escape-long/Mobile Safari 10.0.0 (iOS 10.3.0).json +0 -57
  336. package/node_modules/fast-stable-stringify/results/escape-long/Safari 10.0.1 (Mac OS X 10.12.1).json +0 -57
  337. package/node_modules/fast-stable-stringify/results/escape-short/Chrome 60.0.3112 (Windows 7 0.0.0).json +0 -57
  338. package/node_modules/fast-stable-stringify/results/escape-short/Chrome Mobile 55.0.2883 (Android 6.0.0).json +0 -57
  339. package/node_modules/fast-stable-stringify/results/escape-short/Edge 14.14393.0 (Windows 10 0.0.0).json +0 -57
  340. package/node_modules/fast-stable-stringify/results/escape-short/Firefox 54.0.0 (Windows 7 0.0.0).json +0 -57
  341. package/node_modules/fast-stable-stringify/results/escape-short/IE 10.0.0 (Windows 7 0.0.0).json +0 -57
  342. package/node_modules/fast-stable-stringify/results/escape-short/IE 11.0.0 (Windows 7 0.0.0).json +0 -57
  343. package/node_modules/fast-stable-stringify/results/escape-short/IE 9.0.0 (Windows 7 0.0.0).json +0 -57
  344. package/node_modules/fast-stable-stringify/results/escape-short/Mobile Safari 10.0.0 (iOS 10.3.0).json +0 -57
  345. package/node_modules/fast-stable-stringify/results/escape-short/Safari 10.0.1 (Mac OS X 10.12.1).json +0 -57
  346. package/node_modules/fast-stable-stringify/results/escape.md +0 -20
  347. package/node_modules/fast-stable-stringify/results/itar-long/Chrome 60.0.3112 (Windows 7 0.0.0).json +0 -35
  348. package/node_modules/fast-stable-stringify/results/itar-long/Chrome Mobile 55.0.2883 (Android 6.0.0).json +0 -35
  349. package/node_modules/fast-stable-stringify/results/itar-long/Edge 14.14393.0 (Windows 10 0.0.0).json +0 -35
  350. package/node_modules/fast-stable-stringify/results/itar-long/Firefox 54.0.0 (Windows 7 0.0.0).json +0 -35
  351. package/node_modules/fast-stable-stringify/results/itar-long/IE 10.0.0 (Windows 7 0.0.0).json +0 -35
  352. package/node_modules/fast-stable-stringify/results/itar-long/IE 11.0.0 (Windows 7 0.0.0).json +0 -35
  353. package/node_modules/fast-stable-stringify/results/itar-long/IE 9.0.0 (Windows 7 0.0.0).json +0 -35
  354. package/node_modules/fast-stable-stringify/results/itar-long/Mobile Safari 10.0.0 (iOS 10.3.0).json +0 -35
  355. package/node_modules/fast-stable-stringify/results/itar-long/Safari 10.0.1 (Mac OS X 10.12.1).json +0 -35
  356. package/node_modules/fast-stable-stringify/results/itar-short/Chrome 60.0.3112 (Windows 7 0.0.0).json +0 -35
  357. package/node_modules/fast-stable-stringify/results/itar-short/Chrome Mobile 55.0.2883 (Android 6.0.0).json +0 -35
  358. package/node_modules/fast-stable-stringify/results/itar-short/Edge 14.14393.0 (Windows 10 0.0.0).json +0 -35
  359. package/node_modules/fast-stable-stringify/results/itar-short/Firefox 54.0.0 (Windows 7 0.0.0).json +0 -35
  360. package/node_modules/fast-stable-stringify/results/itar-short/IE 10.0.0 (Windows 7 0.0.0).json +0 -35
  361. package/node_modules/fast-stable-stringify/results/itar-short/IE 11.0.0 (Windows 7 0.0.0).json +0 -35
  362. package/node_modules/fast-stable-stringify/results/itar-short/IE 9.0.0 (Windows 7 0.0.0).json +0 -35
  363. package/node_modules/fast-stable-stringify/results/itar-short/Mobile Safari 10.0.0 (iOS 10.3.0).json +0 -35
  364. package/node_modules/fast-stable-stringify/results/itar-short/Safari 10.0.1 (Mac OS X 10.12.1).json +0 -35
  365. package/node_modules/fast-stable-stringify/results/itar.md +0 -20
  366. package/node_modules/fast-stable-stringify/results/iter/Chrome 60.0.3112 (Windows 7 0.0.0).json +0 -35
  367. package/node_modules/fast-stable-stringify/results/iter/Chrome Mobile 39.0.0 (Android 5.1.1).json +0 -35
  368. package/node_modules/fast-stable-stringify/results/iter/Chrome Mobile 55.0.2883 (Android 6.0.0).json +0 -35
  369. package/node_modules/fast-stable-stringify/results/iter/Edge 14.14393.0 (Windows 10 0.0.0).json +0 -35
  370. package/node_modules/fast-stable-stringify/results/iter/Firefox 54.0.0 (Windows 7 0.0.0).json +0 -35
  371. package/node_modules/fast-stable-stringify/results/iter/IE 10.0.0 (Windows 7 0.0.0).json +0 -35
  372. package/node_modules/fast-stable-stringify/results/iter/IE 11.0.0 (Windows 7 0.0.0).json +0 -35
  373. package/node_modules/fast-stable-stringify/results/iter/IE 9.0.0 (Windows 7 0.0.0).json +0 -35
  374. package/node_modules/fast-stable-stringify/results/iter/Mobile Safari 10.0.0 (iOS 10.3.0).json +0 -35
  375. package/node_modules/fast-stable-stringify/results/iter/Mobile Safari 9.0.0 (iOS 9.2.0).json +0 -35
  376. package/node_modules/fast-stable-stringify/results/iter/Safari 10.0.1 (Mac OS X 10.12.1).json +0 -35
  377. package/node_modules/fast-stable-stringify/results/iter/Safari 9.1.2 (Mac OS X 10.11.6).json +0 -35
  378. package/node_modules/fast-stable-stringify/results/iter.md +0 -14
  379. package/node_modules/fast-stable-stringify/results/libs/Chrome 60.0.3112 (Windows 7 0.0.0).json +0 -46
  380. package/node_modules/fast-stable-stringify/results/libs/Chrome Mobile 55.0.2883 (Android 6.0.0).json +0 -46
  381. package/node_modules/fast-stable-stringify/results/libs/Edge 14.14393.0 (Windows 10 0.0.0).json +0 -46
  382. package/node_modules/fast-stable-stringify/results/libs/Firefox 54.0.0 (Windows 7 0.0.0).json +0 -46
  383. package/node_modules/fast-stable-stringify/results/libs/IE 10.0.0 (Windows 7 0.0.0).json +0 -35
  384. package/node_modules/fast-stable-stringify/results/libs/IE 11.0.0 (Windows 7 0.0.0).json +0 -35
  385. package/node_modules/fast-stable-stringify/results/libs/IE 9.0.0 (Windows 7 0.0.0).json +0 -35
  386. package/node_modules/fast-stable-stringify/results/libs/Mobile Safari 10.0.0 (iOS 10.3.0).json +0 -46
  387. package/node_modules/fast-stable-stringify/results/libs/Safari 10.0.1 (Mac OS X 10.12.1).json +0 -46
  388. package/node_modules/fast-stable-stringify/results/libs.md +0 -15
  389. package/node_modules/fast-stable-stringify/test/escape-long.js +0 -147
  390. package/node_modules/fast-stable-stringify/test/escape-short.js +0 -147
  391. package/node_modules/fast-stable-stringify/test/index.js +0 -6
  392. package/node_modules/fast-stable-stringify/test/itar-long.js +0 -52
  393. package/node_modules/fast-stable-stringify/test/itar-short.js +0 -52
  394. package/node_modules/fast-stable-stringify/test/iter.js +0 -84
  395. package/node_modules/fast-stable-stringify/test/libs.js +0 -57
  396. package/node_modules/fast-stable-stringify/test/travis.js +0 -43
  397. package/node_modules/fast-stable-stringify/test/validate.js +0 -24
  398. package/node_modules/fast-stable-stringify/util/eachRecursive.js +0 -9
  399. package/node_modules/fast-stable-stringify/util/get-git-hash-sync.js +0 -21
  400. package/node_modules/fast-stable-stringify/util/get-lib-info.js +0 -22
  401. package/node_modules/fast-stable-stringify/util/object-path.js +0 -47
  402. package/node_modules/fast-stable-stringify/v8-profile/bench.js +0 -8
  403. package/node_modules/fast-stable-stringify/v8-profile/run.sh +0 -2
  404. package/node_modules/fast-stable-stringify/zuul-local.sh +0 -2
  405. package/node_modules/hkdf/.npmignore +0 -2
  406. package/node_modules/hkdf/README.md +0 -23
  407. package/node_modules/hkdf/hkdf.py +0 -171
  408. package/node_modules/hkdf/hkdf.pyc +0 -0
  409. package/node_modules/hkdf/index.js +0 -1
  410. package/node_modules/hkdf/lib/hkdf.js +0 -55
  411. package/node_modules/hkdf/package.json +0 -55
  412. package/node_modules/hkdf/scripts/run_all_tests.sh +0 -19
  413. package/node_modules/hkdf/test/all-test.js +0 -79
  414. package/node_modules/hkdf/test.py +0 -11
  415. package/node_modules/immediate/LICENSE.txt +0 -20
  416. package/node_modules/immediate/README.md +0 -93
  417. package/node_modules/immediate/dist/immediate.js +0 -75
  418. package/node_modules/immediate/dist/immediate.min.js +0 -1
  419. package/node_modules/immediate/lib/browser.js +0 -69
  420. package/node_modules/immediate/lib/index.js +0 -73
  421. package/node_modules/immediate/package.json +0 -86
  422. package/node_modules/isarray/.npmignore +0 -1
  423. package/node_modules/isarray/.travis.yml +0 -4
  424. package/node_modules/isarray/Makefile +0 -6
  425. package/node_modules/isarray/README.md +0 -60
  426. package/node_modules/isarray/component.json +0 -19
  427. package/node_modules/isarray/index.js +0 -5
  428. package/node_modules/isarray/package.json +0 -77
  429. package/node_modules/isarray/test.js +0 -20
  430. package/node_modules/jszip/.codeclimate.yml +0 -16
  431. package/node_modules/jszip/.editorconfig +0 -8
  432. package/node_modules/jszip/.github/workflows/pr.yaml +0 -41
  433. package/node_modules/jszip/.jshintignore +0 -1
  434. package/node_modules/jszip/.jshintrc +0 -21
  435. package/node_modules/jszip/.travis.yml +0 -17
  436. package/node_modules/jszip/CHANGES.md +0 -192
  437. package/node_modules/jszip/LICENSE.markdown +0 -651
  438. package/node_modules/jszip/README.markdown +0 -33
  439. package/node_modules/jszip/dist/jszip.js +0 -11583
  440. package/node_modules/jszip/dist/jszip.min.js +0 -13
  441. package/node_modules/jszip/index.d.ts +0 -335
  442. package/node_modules/jszip/lib/base64.js +0 -106
  443. package/node_modules/jszip/lib/compressedObject.js +0 -74
  444. package/node_modules/jszip/lib/compressions.js +0 -14
  445. package/node_modules/jszip/lib/crc32.js +0 -77
  446. package/node_modules/jszip/lib/defaults.js +0 -11
  447. package/node_modules/jszip/lib/external.js +0 -19
  448. package/node_modules/jszip/lib/flate.js +0 -85
  449. package/node_modules/jszip/lib/generate/ZipFileWorker.js +0 -540
  450. package/node_modules/jszip/lib/generate/index.js +0 -57
  451. package/node_modules/jszip/lib/index.js +0 -55
  452. package/node_modules/jszip/lib/license_header.js +0 -11
  453. package/node_modules/jszip/lib/load.js +0 -88
  454. package/node_modules/jszip/lib/nodejs/NodejsStreamInputAdapter.js +0 -74
  455. package/node_modules/jszip/lib/nodejs/NodejsStreamOutputAdapter.js +0 -42
  456. package/node_modules/jszip/lib/nodejsUtils.js +0 -57
  457. package/node_modules/jszip/lib/object.js +0 -389
  458. package/node_modules/jszip/lib/readable-stream-browser.js +0 -9
  459. package/node_modules/jszip/lib/reader/ArrayReader.js +0 -57
  460. package/node_modules/jszip/lib/reader/DataReader.js +0 -116
  461. package/node_modules/jszip/lib/reader/NodeBufferReader.js +0 -19
  462. package/node_modules/jszip/lib/reader/StringReader.js +0 -38
  463. package/node_modules/jszip/lib/reader/Uint8ArrayReader.js +0 -22
  464. package/node_modules/jszip/lib/reader/readerFor.js +0 -28
  465. package/node_modules/jszip/lib/signature.js +0 -7
  466. package/node_modules/jszip/lib/stream/ConvertWorker.js +0 -26
  467. package/node_modules/jszip/lib/stream/Crc32Probe.js +0 -24
  468. package/node_modules/jszip/lib/stream/DataLengthProbe.js +0 -29
  469. package/node_modules/jszip/lib/stream/DataWorker.js +0 -116
  470. package/node_modules/jszip/lib/stream/GenericWorker.js +0 -263
  471. package/node_modules/jszip/lib/stream/StreamHelper.js +0 -212
  472. package/node_modules/jszip/lib/support.js +0 -38
  473. package/node_modules/jszip/lib/utf8.js +0 -275
  474. package/node_modules/jszip/lib/utils.js +0 -501
  475. package/node_modules/jszip/lib/zipEntries.js +0 -262
  476. package/node_modules/jszip/lib/zipEntry.js +0 -294
  477. package/node_modules/jszip/lib/zipObject.js +0 -133
  478. package/node_modules/jszip/package.json +0 -99
  479. package/node_modules/jszip/tsconfig.json +0 -101
  480. package/node_modules/jszip/vendor/FileSaver.js +0 -247
  481. package/node_modules/lie/README.md +0 -62
  482. package/node_modules/lie/dist/lie.js +0 -350
  483. package/node_modules/lie/dist/lie.min.js +0 -1
  484. package/node_modules/lie/dist/lie.polyfill.js +0 -358
  485. package/node_modules/lie/dist/lie.polyfill.min.js +0 -1
  486. package/node_modules/lie/lib/browser.js +0 -273
  487. package/node_modules/lie/lib/index.js +0 -298
  488. package/node_modules/lie/license.md +0 -7
  489. package/node_modules/lie/lie.d.ts +0 -244
  490. package/node_modules/lie/package.json +0 -98
  491. package/node_modules/lie/polyfill.js +0 -4
  492. package/node_modules/p-finally/index.js +0 -15
  493. package/node_modules/p-finally/license +0 -21
  494. package/node_modules/p-finally/package.json +0 -77
  495. package/node_modules/p-finally/readme.md +0 -47
  496. package/node_modules/p-retry/index.js +0 -52
  497. package/node_modules/p-retry/license +0 -9
  498. package/node_modules/p-retry/package.json +0 -83
  499. package/node_modules/p-retry/readme.md +0 -109
  500. package/node_modules/p-timeout/index.d.ts +0 -72
  501. package/node_modules/p-timeout/index.js +0 -57
  502. package/node_modules/p-timeout/license +0 -9
  503. package/node_modules/p-timeout/package.json +0 -80
  504. package/node_modules/p-timeout/readme.md +0 -87
  505. package/node_modules/pako/CHANGELOG.md +0 -164
  506. package/node_modules/pako/LICENSE +0 -21
  507. package/node_modules/pako/README.md +0 -191
  508. package/node_modules/pako/dist/pako.js +0 -6818
  509. package/node_modules/pako/dist/pako.min.js +0 -1
  510. package/node_modules/pako/dist/pako_deflate.js +0 -3997
  511. package/node_modules/pako/dist/pako_deflate.min.js +0 -1
  512. package/node_modules/pako/dist/pako_inflate.js +0 -3300
  513. package/node_modules/pako/dist/pako_inflate.min.js +0 -1
  514. package/node_modules/pako/index.js +0 -14
  515. package/node_modules/pako/lib/deflate.js +0 -400
  516. package/node_modules/pako/lib/inflate.js +0 -423
  517. package/node_modules/pako/lib/utils/common.js +0 -105
  518. package/node_modules/pako/lib/utils/strings.js +0 -187
  519. package/node_modules/pako/lib/zlib/README +0 -59
  520. package/node_modules/pako/lib/zlib/adler32.js +0 -51
  521. package/node_modules/pako/lib/zlib/constants.js +0 -68
  522. package/node_modules/pako/lib/zlib/crc32.js +0 -59
  523. package/node_modules/pako/lib/zlib/deflate.js +0 -1874
  524. package/node_modules/pako/lib/zlib/gzheader.js +0 -58
  525. package/node_modules/pako/lib/zlib/inffast.js +0 -345
  526. package/node_modules/pako/lib/zlib/inflate.js +0 -1556
  527. package/node_modules/pako/lib/zlib/inftrees.js +0 -343
  528. package/node_modules/pako/lib/zlib/messages.js +0 -32
  529. package/node_modules/pako/lib/zlib/trees.js +0 -1222
  530. package/node_modules/pako/lib/zlib/zstream.js +0 -47
  531. package/node_modules/pako/package.json +0 -94
  532. package/node_modules/process-nextick-args/index.js +0 -45
  533. package/node_modules/process-nextick-args/license.md +0 -19
  534. package/node_modules/process-nextick-args/package.json +0 -53
  535. package/node_modules/process-nextick-args/readme.md +0 -18
  536. package/node_modules/readable-stream/.travis.yml +0 -34
  537. package/node_modules/readable-stream/CONTRIBUTING.md +0 -38
  538. package/node_modules/readable-stream/GOVERNANCE.md +0 -136
  539. package/node_modules/readable-stream/LICENSE +0 -47
  540. package/node_modules/readable-stream/README.md +0 -58
  541. package/node_modules/readable-stream/doc/wg-meetings/2015-01-30.md +0 -60
  542. package/node_modules/readable-stream/duplex-browser.js +0 -1
  543. package/node_modules/readable-stream/duplex.js +0 -1
  544. package/node_modules/readable-stream/lib/_stream_duplex.js +0 -131
  545. package/node_modules/readable-stream/lib/_stream_passthrough.js +0 -47
  546. package/node_modules/readable-stream/lib/_stream_readable.js +0 -1019
  547. package/node_modules/readable-stream/lib/_stream_transform.js +0 -214
  548. package/node_modules/readable-stream/lib/_stream_writable.js +0 -687
  549. package/node_modules/readable-stream/lib/internal/streams/BufferList.js +0 -79
  550. package/node_modules/readable-stream/lib/internal/streams/destroy.js +0 -74
  551. package/node_modules/readable-stream/lib/internal/streams/stream-browser.js +0 -1
  552. package/node_modules/readable-stream/lib/internal/streams/stream.js +0 -1
  553. package/node_modules/readable-stream/package.json +0 -86
  554. package/node_modules/readable-stream/passthrough.js +0 -1
  555. package/node_modules/readable-stream/readable-browser.js +0 -7
  556. package/node_modules/readable-stream/readable.js +0 -19
  557. package/node_modules/readable-stream/transform.js +0 -1
  558. package/node_modules/readable-stream/writable-browser.js +0 -1
  559. package/node_modules/readable-stream/writable.js +0 -8
  560. package/node_modules/retry/.npmignore +0 -3
  561. package/node_modules/retry/.travis.yml +0 -15
  562. package/node_modules/retry/License +0 -21
  563. package/node_modules/retry/Makefile +0 -18
  564. package/node_modules/retry/README.md +0 -227
  565. package/node_modules/retry/equation.gif +0 -0
  566. package/node_modules/retry/example/dns.js +0 -31
  567. package/node_modules/retry/example/stop.js +0 -40
  568. package/node_modules/retry/index.js +0 -1
  569. package/node_modules/retry/lib/retry.js +0 -100
  570. package/node_modules/retry/lib/retry_operation.js +0 -158
  571. package/node_modules/retry/package.json +0 -67
  572. package/node_modules/retry/test/common.js +0 -10
  573. package/node_modules/retry/test/integration/test-forever.js +0 -24
  574. package/node_modules/retry/test/integration/test-retry-operation.js +0 -258
  575. package/node_modules/retry/test/integration/test-retry-wrap.js +0 -101
  576. package/node_modules/retry/test/integration/test-timeouts.js +0 -69
  577. package/node_modules/setimmediate/LICENSE.txt +0 -20
  578. package/node_modules/setimmediate/package.json +0 -77
  579. package/node_modules/setimmediate/setImmediate.js +0 -186
  580. package/node_modules/split/.npmignore +0 -3
  581. package/node_modules/split/.travis.yml +0 -3
  582. package/node_modules/split/LICENCE +0 -22
  583. package/node_modules/split/examples/pretty.js +0 -26
  584. package/node_modules/split/index.js +0 -63
  585. package/node_modules/split/package.json +0 -65
  586. package/node_modules/split/readme.markdown +0 -72
  587. package/node_modules/split/test/options.asynct.js +0 -46
  588. package/node_modules/split/test/partitioned_unicode.js +0 -34
  589. package/node_modules/split/test/split.asynct.js +0 -137
  590. package/node_modules/split/test/try_catch.asynct.js +0 -51
  591. package/node_modules/stream-shift/.travis.yml +0 -6
  592. package/node_modules/stream-shift/LICENSE +0 -21
  593. package/node_modules/stream-shift/README.md +0 -25
  594. package/node_modules/stream-shift/index.js +0 -20
  595. package/node_modules/stream-shift/package.json +0 -56
  596. package/node_modules/stream-shift/test.js +0 -48
  597. package/node_modules/ultron/LICENSE +0 -22
  598. package/node_modules/ultron/README.md +0 -113
  599. package/node_modules/ultron/index.js +0 -136
  600. package/node_modules/ultron/package.json +0 -71
  601. package/node_modules/websocket-stream/LICENSE +0 -8
  602. package/node_modules/websocket-stream/collaborators.md +0 -11
  603. package/node_modules/websocket-stream/echo-server.js +0 -51
  604. package/node_modules/websocket-stream/index.d.ts +0 -27
  605. package/node_modules/websocket-stream/index.js +0 -6
  606. package/node_modules/websocket-stream/package.json +0 -82
  607. package/node_modules/websocket-stream/readme.md +0 -148
  608. package/node_modules/websocket-stream/server.js +0 -29
  609. package/node_modules/websocket-stream/stream.js +0 -189
  610. package/node_modules/websocket-stream/test-client.js +0 -74
  611. package/node_modules/websocket-stream/test-server.js +0 -56
  612. package/node_modules/websocket-stream/test.js +0 -338
  613. package/node_modules/websocket-stream/ts-tests.ts +0 -69
  614. package/node_modules/websocket-stream/ws-fallback.js +0 -12
  615. package/node_modules/ws/LICENSE +0 -21
  616. package/node_modules/ws/README.md +0 -341
  617. package/node_modules/ws/index.js +0 -15
  618. package/node_modules/ws/lib/.DS_Store +0 -0
  619. package/node_modules/ws/lib/BufferUtil.js +0 -71
  620. package/node_modules/ws/lib/Constants.js +0 -10
  621. package/node_modules/ws/lib/ErrorCodes.js +0 -28
  622. package/node_modules/ws/lib/EventTarget.js +0 -151
  623. package/node_modules/ws/lib/Extensions.js +0 -203
  624. package/node_modules/ws/lib/PerMessageDeflate.js +0 -507
  625. package/node_modules/ws/lib/Receiver.js +0 -553
  626. package/node_modules/ws/lib/Sender.js +0 -412
  627. package/node_modules/ws/lib/Validation.js +0 -17
  628. package/node_modules/ws/lib/WebSocket.js +0 -717
  629. package/node_modules/ws/lib/WebSocketServer.js +0 -326
  630. package/node_modules/ws/package.json +0 -83
  631. package/node_modules/xhr2/CONTRIBUTING.md +0 -33
  632. package/node_modules/xhr2/Cakefile +0 -131
  633. package/node_modules/xhr2/LICENSE.txt +0 -19
  634. package/node_modules/xhr2/README.md +0 -142
  635. package/node_modules/xhr2/lib/browser.js +0 -1
  636. package/node_modules/xhr2/lib/xhr2.js +0 -1244
  637. package/node_modules/xhr2/package.json +0 -103
  638. package/node_modules/xhr2/src/000-xml_http_request_event_target.coffee +0 -89
  639. package/node_modules/xhr2/src/001-xml_http_request.coffee +0 -781
  640. package/node_modules/xhr2/src/errors.coffee +0 -31
  641. package/node_modules/xhr2/src/progress_event.coffee +0 -39
  642. package/node_modules/xhr2/src/xml_http_request_upload.coffee +0 -95
  643. package/node_modules/xhr2/test/fixtures/hello.json +0 -1
  644. package/node_modules/xhr2/test/fixtures/hello.txt +0 -1
  645. package/node_modules/xhr2/test/fixtures/xhr2.png +0 -0
  646. package/node_modules/xhr2/test/html/browser_test.html +0 -30
  647. package/node_modules/xhr2/test/src/event_target_test.coffee +0 -85
  648. package/node_modules/xhr2/test/src/events_test.coffee +0 -204
  649. package/node_modules/xhr2/test/src/headers_test.coffee +0 -168
  650. package/node_modules/xhr2/test/src/helpers/browser_mocha_runner.coffee +0 -10
  651. package/node_modules/xhr2/test/src/helpers/browser_mocha_setup.coffee +0 -1
  652. package/node_modules/xhr2/test/src/helpers/setup.coffee +0 -38
  653. package/node_modules/xhr2/test/src/helpers/xhr_server.coffee +0 -156
  654. package/node_modules/xhr2/test/src/nodejs_set_test.coffee +0 -162
  655. package/node_modules/xhr2/test/src/redirect_test.coffee +0 -57
  656. package/node_modules/xhr2/test/src/response_type_test.coffee +0 -88
  657. package/node_modules/xhr2/test/src/responseurl_test.coffee +0 -18
  658. package/node_modules/xhr2/test/src/send_test.coffee +0 -89
  659. package/node_modules/xhr2/test/src/status_test.coffee +0 -47
  660. package/node_modules/xhr2/test/src/xhr_test.coffee +0 -102
  661. package/node_modules/xtend/.jshintrc +0 -30
  662. package/node_modules/xtend/LICENSE +0 -20
  663. package/node_modules/xtend/README.md +0 -32
  664. package/node_modules/xtend/immutable.js +0 -19
  665. package/node_modules/xtend/mutable.js +0 -17
  666. package/node_modules/xtend/package.json +0 -89
  667. package/node_modules/xtend/test.js +0 -103
  668. package/node_modules/yazl/LICENSE +0 -21
  669. package/node_modules/yazl/README.md +0 -389
  670. package/node_modules/yazl/index.js +0 -749
  671. package/node_modules/yazl/package.json +0 -69
  672. package/src/commands/CorelliumAPI.js +0 -76
  673. package/src/subscriberInvite.js +0 -140
@@ -1,1874 +0,0 @@
1
- 'use strict';
2
-
3
- // (C) 1995-2013 Jean-loup Gailly and Mark Adler
4
- // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin
5
- //
6
- // This software is provided 'as-is', without any express or implied
7
- // warranty. In no event will the authors be held liable for any damages
8
- // arising from the use of this software.
9
- //
10
- // Permission is granted to anyone to use this software for any purpose,
11
- // including commercial applications, and to alter it and redistribute it
12
- // freely, subject to the following restrictions:
13
- //
14
- // 1. The origin of this software must not be misrepresented; you must not
15
- // claim that you wrote the original software. If you use this software
16
- // in a product, an acknowledgment in the product documentation would be
17
- // appreciated but is not required.
18
- // 2. Altered source versions must be plainly marked as such, and must not be
19
- // misrepresented as being the original software.
20
- // 3. This notice may not be removed or altered from any source distribution.
21
-
22
- var utils = require('../utils/common');
23
- var trees = require('./trees');
24
- var adler32 = require('./adler32');
25
- var crc32 = require('./crc32');
26
- var msg = require('./messages');
27
-
28
- /* Public constants ==========================================================*/
29
- /* ===========================================================================*/
30
-
31
-
32
- /* Allowed flush values; see deflate() and inflate() below for details */
33
- var Z_NO_FLUSH = 0;
34
- var Z_PARTIAL_FLUSH = 1;
35
- //var Z_SYNC_FLUSH = 2;
36
- var Z_FULL_FLUSH = 3;
37
- var Z_FINISH = 4;
38
- var Z_BLOCK = 5;
39
- //var Z_TREES = 6;
40
-
41
-
42
- /* Return codes for the compression/decompression functions. Negative values
43
- * are errors, positive values are used for special but normal events.
44
- */
45
- var Z_OK = 0;
46
- var Z_STREAM_END = 1;
47
- //var Z_NEED_DICT = 2;
48
- //var Z_ERRNO = -1;
49
- var Z_STREAM_ERROR = -2;
50
- var Z_DATA_ERROR = -3;
51
- //var Z_MEM_ERROR = -4;
52
- var Z_BUF_ERROR = -5;
53
- //var Z_VERSION_ERROR = -6;
54
-
55
-
56
- /* compression levels */
57
- //var Z_NO_COMPRESSION = 0;
58
- //var Z_BEST_SPEED = 1;
59
- //var Z_BEST_COMPRESSION = 9;
60
- var Z_DEFAULT_COMPRESSION = -1;
61
-
62
-
63
- var Z_FILTERED = 1;
64
- var Z_HUFFMAN_ONLY = 2;
65
- var Z_RLE = 3;
66
- var Z_FIXED = 4;
67
- var Z_DEFAULT_STRATEGY = 0;
68
-
69
- /* Possible values of the data_type field (though see inflate()) */
70
- //var Z_BINARY = 0;
71
- //var Z_TEXT = 1;
72
- //var Z_ASCII = 1; // = Z_TEXT
73
- var Z_UNKNOWN = 2;
74
-
75
-
76
- /* The deflate compression method */
77
- var Z_DEFLATED = 8;
78
-
79
- /*============================================================================*/
80
-
81
-
82
- var MAX_MEM_LEVEL = 9;
83
- /* Maximum value for memLevel in deflateInit2 */
84
- var MAX_WBITS = 15;
85
- /* 32K LZ77 window */
86
- var DEF_MEM_LEVEL = 8;
87
-
88
-
89
- var LENGTH_CODES = 29;
90
- /* number of length codes, not counting the special END_BLOCK code */
91
- var LITERALS = 256;
92
- /* number of literal bytes 0..255 */
93
- var L_CODES = LITERALS + 1 + LENGTH_CODES;
94
- /* number of Literal or Length codes, including the END_BLOCK code */
95
- var D_CODES = 30;
96
- /* number of distance codes */
97
- var BL_CODES = 19;
98
- /* number of codes used to transfer the bit lengths */
99
- var HEAP_SIZE = 2 * L_CODES + 1;
100
- /* maximum heap size */
101
- var MAX_BITS = 15;
102
- /* All codes must not exceed MAX_BITS bits */
103
-
104
- var MIN_MATCH = 3;
105
- var MAX_MATCH = 258;
106
- var MIN_LOOKAHEAD = (MAX_MATCH + MIN_MATCH + 1);
107
-
108
- var PRESET_DICT = 0x20;
109
-
110
- var INIT_STATE = 42;
111
- var EXTRA_STATE = 69;
112
- var NAME_STATE = 73;
113
- var COMMENT_STATE = 91;
114
- var HCRC_STATE = 103;
115
- var BUSY_STATE = 113;
116
- var FINISH_STATE = 666;
117
-
118
- var BS_NEED_MORE = 1; /* block not completed, need more input or more output */
119
- var BS_BLOCK_DONE = 2; /* block flush performed */
120
- var BS_FINISH_STARTED = 3; /* finish started, need only more output at next deflate */
121
- var BS_FINISH_DONE = 4; /* finish done, accept no more input or output */
122
-
123
- var OS_CODE = 0x03; // Unix :) . Don't detect, use this default.
124
-
125
- function err(strm, errorCode) {
126
- strm.msg = msg[errorCode];
127
- return errorCode;
128
- }
129
-
130
- function rank(f) {
131
- return ((f) << 1) - ((f) > 4 ? 9 : 0);
132
- }
133
-
134
- function zero(buf) { var len = buf.length; while (--len >= 0) { buf[len] = 0; } }
135
-
136
-
137
- /* =========================================================================
138
- * Flush as much pending output as possible. All deflate() output goes
139
- * through this function so some applications may wish to modify it
140
- * to avoid allocating a large strm->output buffer and copying into it.
141
- * (See also read_buf()).
142
- */
143
- function flush_pending(strm) {
144
- var s = strm.state;
145
-
146
- //_tr_flush_bits(s);
147
- var len = s.pending;
148
- if (len > strm.avail_out) {
149
- len = strm.avail_out;
150
- }
151
- if (len === 0) { return; }
152
-
153
- utils.arraySet(strm.output, s.pending_buf, s.pending_out, len, strm.next_out);
154
- strm.next_out += len;
155
- s.pending_out += len;
156
- strm.total_out += len;
157
- strm.avail_out -= len;
158
- s.pending -= len;
159
- if (s.pending === 0) {
160
- s.pending_out = 0;
161
- }
162
- }
163
-
164
-
165
- function flush_block_only(s, last) {
166
- trees._tr_flush_block(s, (s.block_start >= 0 ? s.block_start : -1), s.strstart - s.block_start, last);
167
- s.block_start = s.strstart;
168
- flush_pending(s.strm);
169
- }
170
-
171
-
172
- function put_byte(s, b) {
173
- s.pending_buf[s.pending++] = b;
174
- }
175
-
176
-
177
- /* =========================================================================
178
- * Put a short in the pending buffer. The 16-bit value is put in MSB order.
179
- * IN assertion: the stream state is correct and there is enough room in
180
- * pending_buf.
181
- */
182
- function putShortMSB(s, b) {
183
- // put_byte(s, (Byte)(b >> 8));
184
- // put_byte(s, (Byte)(b & 0xff));
185
- s.pending_buf[s.pending++] = (b >>> 8) & 0xff;
186
- s.pending_buf[s.pending++] = b & 0xff;
187
- }
188
-
189
-
190
- /* ===========================================================================
191
- * Read a new buffer from the current input stream, update the adler32
192
- * and total number of bytes read. All deflate() input goes through
193
- * this function so some applications may wish to modify it to avoid
194
- * allocating a large strm->input buffer and copying from it.
195
- * (See also flush_pending()).
196
- */
197
- function read_buf(strm, buf, start, size) {
198
- var len = strm.avail_in;
199
-
200
- if (len > size) { len = size; }
201
- if (len === 0) { return 0; }
202
-
203
- strm.avail_in -= len;
204
-
205
- // zmemcpy(buf, strm->next_in, len);
206
- utils.arraySet(buf, strm.input, strm.next_in, len, start);
207
- if (strm.state.wrap === 1) {
208
- strm.adler = adler32(strm.adler, buf, len, start);
209
- }
210
-
211
- else if (strm.state.wrap === 2) {
212
- strm.adler = crc32(strm.adler, buf, len, start);
213
- }
214
-
215
- strm.next_in += len;
216
- strm.total_in += len;
217
-
218
- return len;
219
- }
220
-
221
-
222
- /* ===========================================================================
223
- * Set match_start to the longest match starting at the given string and
224
- * return its length. Matches shorter or equal to prev_length are discarded,
225
- * in which case the result is equal to prev_length and match_start is
226
- * garbage.
227
- * IN assertions: cur_match is the head of the hash chain for the current
228
- * string (strstart) and its distance is <= MAX_DIST, and prev_length >= 1
229
- * OUT assertion: the match length is not greater than s->lookahead.
230
- */
231
- function longest_match(s, cur_match) {
232
- var chain_length = s.max_chain_length; /* max hash chain length */
233
- var scan = s.strstart; /* current string */
234
- var match; /* matched string */
235
- var len; /* length of current match */
236
- var best_len = s.prev_length; /* best match length so far */
237
- var nice_match = s.nice_match; /* stop if match long enough */
238
- var limit = (s.strstart > (s.w_size - MIN_LOOKAHEAD)) ?
239
- s.strstart - (s.w_size - MIN_LOOKAHEAD) : 0/*NIL*/;
240
-
241
- var _win = s.window; // shortcut
242
-
243
- var wmask = s.w_mask;
244
- var prev = s.prev;
245
-
246
- /* Stop when cur_match becomes <= limit. To simplify the code,
247
- * we prevent matches with the string of window index 0.
248
- */
249
-
250
- var strend = s.strstart + MAX_MATCH;
251
- var scan_end1 = _win[scan + best_len - 1];
252
- var scan_end = _win[scan + best_len];
253
-
254
- /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16.
255
- * It is easy to get rid of this optimization if necessary.
256
- */
257
- // Assert(s->hash_bits >= 8 && MAX_MATCH == 258, "Code too clever");
258
-
259
- /* Do not waste too much time if we already have a good match: */
260
- if (s.prev_length >= s.good_match) {
261
- chain_length >>= 2;
262
- }
263
- /* Do not look for matches beyond the end of the input. This is necessary
264
- * to make deflate deterministic.
265
- */
266
- if (nice_match > s.lookahead) { nice_match = s.lookahead; }
267
-
268
- // Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, "need lookahead");
269
-
270
- do {
271
- // Assert(cur_match < s->strstart, "no future");
272
- match = cur_match;
273
-
274
- /* Skip to next match if the match length cannot increase
275
- * or if the match length is less than 2. Note that the checks below
276
- * for insufficient lookahead only occur occasionally for performance
277
- * reasons. Therefore uninitialized memory will be accessed, and
278
- * conditional jumps will be made that depend on those values.
279
- * However the length of the match is limited to the lookahead, so
280
- * the output of deflate is not affected by the uninitialized values.
281
- */
282
-
283
- if (_win[match + best_len] !== scan_end ||
284
- _win[match + best_len - 1] !== scan_end1 ||
285
- _win[match] !== _win[scan] ||
286
- _win[++match] !== _win[scan + 1]) {
287
- continue;
288
- }
289
-
290
- /* The check at best_len-1 can be removed because it will be made
291
- * again later. (This heuristic is not always a win.)
292
- * It is not necessary to compare scan[2] and match[2] since they
293
- * are always equal when the other bytes match, given that
294
- * the hash keys are equal and that HASH_BITS >= 8.
295
- */
296
- scan += 2;
297
- match++;
298
- // Assert(*scan == *match, "match[2]?");
299
-
300
- /* We check for insufficient lookahead only every 8th comparison;
301
- * the 256th check will be made at strstart+258.
302
- */
303
- do {
304
- /*jshint noempty:false*/
305
- } while (_win[++scan] === _win[++match] && _win[++scan] === _win[++match] &&
306
- _win[++scan] === _win[++match] && _win[++scan] === _win[++match] &&
307
- _win[++scan] === _win[++match] && _win[++scan] === _win[++match] &&
308
- _win[++scan] === _win[++match] && _win[++scan] === _win[++match] &&
309
- scan < strend);
310
-
311
- // Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan");
312
-
313
- len = MAX_MATCH - (strend - scan);
314
- scan = strend - MAX_MATCH;
315
-
316
- if (len > best_len) {
317
- s.match_start = cur_match;
318
- best_len = len;
319
- if (len >= nice_match) {
320
- break;
321
- }
322
- scan_end1 = _win[scan + best_len - 1];
323
- scan_end = _win[scan + best_len];
324
- }
325
- } while ((cur_match = prev[cur_match & wmask]) > limit && --chain_length !== 0);
326
-
327
- if (best_len <= s.lookahead) {
328
- return best_len;
329
- }
330
- return s.lookahead;
331
- }
332
-
333
-
334
- /* ===========================================================================
335
- * Fill the window when the lookahead becomes insufficient.
336
- * Updates strstart and lookahead.
337
- *
338
- * IN assertion: lookahead < MIN_LOOKAHEAD
339
- * OUT assertions: strstart <= window_size-MIN_LOOKAHEAD
340
- * At least one byte has been read, or avail_in == 0; reads are
341
- * performed for at least two bytes (required for the zip translate_eol
342
- * option -- not supported here).
343
- */
344
- function fill_window(s) {
345
- var _w_size = s.w_size;
346
- var p, n, m, more, str;
347
-
348
- //Assert(s->lookahead < MIN_LOOKAHEAD, "already enough lookahead");
349
-
350
- do {
351
- more = s.window_size - s.lookahead - s.strstart;
352
-
353
- // JS ints have 32 bit, block below not needed
354
- /* Deal with !@#$% 64K limit: */
355
- //if (sizeof(int) <= 2) {
356
- // if (more == 0 && s->strstart == 0 && s->lookahead == 0) {
357
- // more = wsize;
358
- //
359
- // } else if (more == (unsigned)(-1)) {
360
- // /* Very unlikely, but possible on 16 bit machine if
361
- // * strstart == 0 && lookahead == 1 (input done a byte at time)
362
- // */
363
- // more--;
364
- // }
365
- //}
366
-
367
-
368
- /* If the window is almost full and there is insufficient lookahead,
369
- * move the upper half to the lower one to make room in the upper half.
370
- */
371
- if (s.strstart >= _w_size + (_w_size - MIN_LOOKAHEAD)) {
372
-
373
- utils.arraySet(s.window, s.window, _w_size, _w_size, 0);
374
- s.match_start -= _w_size;
375
- s.strstart -= _w_size;
376
- /* we now have strstart >= MAX_DIST */
377
- s.block_start -= _w_size;
378
-
379
- /* Slide the hash table (could be avoided with 32 bit values
380
- at the expense of memory usage). We slide even when level == 0
381
- to keep the hash table consistent if we switch back to level > 0
382
- later. (Using level 0 permanently is not an optimal usage of
383
- zlib, so we don't care about this pathological case.)
384
- */
385
-
386
- n = s.hash_size;
387
- p = n;
388
- do {
389
- m = s.head[--p];
390
- s.head[p] = (m >= _w_size ? m - _w_size : 0);
391
- } while (--n);
392
-
393
- n = _w_size;
394
- p = n;
395
- do {
396
- m = s.prev[--p];
397
- s.prev[p] = (m >= _w_size ? m - _w_size : 0);
398
- /* If n is not on any hash chain, prev[n] is garbage but
399
- * its value will never be used.
400
- */
401
- } while (--n);
402
-
403
- more += _w_size;
404
- }
405
- if (s.strm.avail_in === 0) {
406
- break;
407
- }
408
-
409
- /* If there was no sliding:
410
- * strstart <= WSIZE+MAX_DIST-1 && lookahead <= MIN_LOOKAHEAD - 1 &&
411
- * more == window_size - lookahead - strstart
412
- * => more >= window_size - (MIN_LOOKAHEAD-1 + WSIZE + MAX_DIST-1)
413
- * => more >= window_size - 2*WSIZE + 2
414
- * In the BIG_MEM or MMAP case (not yet supported),
415
- * window_size == input_size + MIN_LOOKAHEAD &&
416
- * strstart + s->lookahead <= input_size => more >= MIN_LOOKAHEAD.
417
- * Otherwise, window_size == 2*WSIZE so more >= 2.
418
- * If there was sliding, more >= WSIZE. So in all cases, more >= 2.
419
- */
420
- //Assert(more >= 2, "more < 2");
421
- n = read_buf(s.strm, s.window, s.strstart + s.lookahead, more);
422
- s.lookahead += n;
423
-
424
- /* Initialize the hash value now that we have some input: */
425
- if (s.lookahead + s.insert >= MIN_MATCH) {
426
- str = s.strstart - s.insert;
427
- s.ins_h = s.window[str];
428
-
429
- /* UPDATE_HASH(s, s->ins_h, s->window[str + 1]); */
430
- s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[str + 1]) & s.hash_mask;
431
- //#if MIN_MATCH != 3
432
- // Call update_hash() MIN_MATCH-3 more times
433
- //#endif
434
- while (s.insert) {
435
- /* UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]); */
436
- s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[str + MIN_MATCH - 1]) & s.hash_mask;
437
-
438
- s.prev[str & s.w_mask] = s.head[s.ins_h];
439
- s.head[s.ins_h] = str;
440
- str++;
441
- s.insert--;
442
- if (s.lookahead + s.insert < MIN_MATCH) {
443
- break;
444
- }
445
- }
446
- }
447
- /* If the whole input has less than MIN_MATCH bytes, ins_h is garbage,
448
- * but this is not important since only literal bytes will be emitted.
449
- */
450
-
451
- } while (s.lookahead < MIN_LOOKAHEAD && s.strm.avail_in !== 0);
452
-
453
- /* If the WIN_INIT bytes after the end of the current data have never been
454
- * written, then zero those bytes in order to avoid memory check reports of
455
- * the use of uninitialized (or uninitialised as Julian writes) bytes by
456
- * the longest match routines. Update the high water mark for the next
457
- * time through here. WIN_INIT is set to MAX_MATCH since the longest match
458
- * routines allow scanning to strstart + MAX_MATCH, ignoring lookahead.
459
- */
460
- // if (s.high_water < s.window_size) {
461
- // var curr = s.strstart + s.lookahead;
462
- // var init = 0;
463
- //
464
- // if (s.high_water < curr) {
465
- // /* Previous high water mark below current data -- zero WIN_INIT
466
- // * bytes or up to end of window, whichever is less.
467
- // */
468
- // init = s.window_size - curr;
469
- // if (init > WIN_INIT)
470
- // init = WIN_INIT;
471
- // zmemzero(s->window + curr, (unsigned)init);
472
- // s->high_water = curr + init;
473
- // }
474
- // else if (s->high_water < (ulg)curr + WIN_INIT) {
475
- // /* High water mark at or above current data, but below current data
476
- // * plus WIN_INIT -- zero out to current data plus WIN_INIT, or up
477
- // * to end of window, whichever is less.
478
- // */
479
- // init = (ulg)curr + WIN_INIT - s->high_water;
480
- // if (init > s->window_size - s->high_water)
481
- // init = s->window_size - s->high_water;
482
- // zmemzero(s->window + s->high_water, (unsigned)init);
483
- // s->high_water += init;
484
- // }
485
- // }
486
- //
487
- // Assert((ulg)s->strstart <= s->window_size - MIN_LOOKAHEAD,
488
- // "not enough room for search");
489
- }
490
-
491
- /* ===========================================================================
492
- * Copy without compression as much as possible from the input stream, return
493
- * the current block state.
494
- * This function does not insert new strings in the dictionary since
495
- * uncompressible data is probably not useful. This function is used
496
- * only for the level=0 compression option.
497
- * NOTE: this function should be optimized to avoid extra copying from
498
- * window to pending_buf.
499
- */
500
- function deflate_stored(s, flush) {
501
- /* Stored blocks are limited to 0xffff bytes, pending_buf is limited
502
- * to pending_buf_size, and each stored block has a 5 byte header:
503
- */
504
- var max_block_size = 0xffff;
505
-
506
- if (max_block_size > s.pending_buf_size - 5) {
507
- max_block_size = s.pending_buf_size - 5;
508
- }
509
-
510
- /* Copy as much as possible from input to output: */
511
- for (;;) {
512
- /* Fill the window as much as possible: */
513
- if (s.lookahead <= 1) {
514
-
515
- //Assert(s->strstart < s->w_size+MAX_DIST(s) ||
516
- // s->block_start >= (long)s->w_size, "slide too late");
517
- // if (!(s.strstart < s.w_size + (s.w_size - MIN_LOOKAHEAD) ||
518
- // s.block_start >= s.w_size)) {
519
- // throw new Error("slide too late");
520
- // }
521
-
522
- fill_window(s);
523
- if (s.lookahead === 0 && flush === Z_NO_FLUSH) {
524
- return BS_NEED_MORE;
525
- }
526
-
527
- if (s.lookahead === 0) {
528
- break;
529
- }
530
- /* flush the current block */
531
- }
532
- //Assert(s->block_start >= 0L, "block gone");
533
- // if (s.block_start < 0) throw new Error("block gone");
534
-
535
- s.strstart += s.lookahead;
536
- s.lookahead = 0;
537
-
538
- /* Emit a stored block if pending_buf will be full: */
539
- var max_start = s.block_start + max_block_size;
540
-
541
- if (s.strstart === 0 || s.strstart >= max_start) {
542
- /* strstart == 0 is possible when wraparound on 16-bit machine */
543
- s.lookahead = s.strstart - max_start;
544
- s.strstart = max_start;
545
- /*** FLUSH_BLOCK(s, 0); ***/
546
- flush_block_only(s, false);
547
- if (s.strm.avail_out === 0) {
548
- return BS_NEED_MORE;
549
- }
550
- /***/
551
-
552
-
553
- }
554
- /* Flush if we may have to slide, otherwise block_start may become
555
- * negative and the data will be gone:
556
- */
557
- if (s.strstart - s.block_start >= (s.w_size - MIN_LOOKAHEAD)) {
558
- /*** FLUSH_BLOCK(s, 0); ***/
559
- flush_block_only(s, false);
560
- if (s.strm.avail_out === 0) {
561
- return BS_NEED_MORE;
562
- }
563
- /***/
564
- }
565
- }
566
-
567
- s.insert = 0;
568
-
569
- if (flush === Z_FINISH) {
570
- /*** FLUSH_BLOCK(s, 1); ***/
571
- flush_block_only(s, true);
572
- if (s.strm.avail_out === 0) {
573
- return BS_FINISH_STARTED;
574
- }
575
- /***/
576
- return BS_FINISH_DONE;
577
- }
578
-
579
- if (s.strstart > s.block_start) {
580
- /*** FLUSH_BLOCK(s, 0); ***/
581
- flush_block_only(s, false);
582
- if (s.strm.avail_out === 0) {
583
- return BS_NEED_MORE;
584
- }
585
- /***/
586
- }
587
-
588
- return BS_NEED_MORE;
589
- }
590
-
591
- /* ===========================================================================
592
- * Compress as much as possible from the input stream, return the current
593
- * block state.
594
- * This function does not perform lazy evaluation of matches and inserts
595
- * new strings in the dictionary only for unmatched strings or for short
596
- * matches. It is used only for the fast compression options.
597
- */
598
- function deflate_fast(s, flush) {
599
- var hash_head; /* head of the hash chain */
600
- var bflush; /* set if current block must be flushed */
601
-
602
- for (;;) {
603
- /* Make sure that we always have enough lookahead, except
604
- * at the end of the input file. We need MAX_MATCH bytes
605
- * for the next match, plus MIN_MATCH bytes to insert the
606
- * string following the next match.
607
- */
608
- if (s.lookahead < MIN_LOOKAHEAD) {
609
- fill_window(s);
610
- if (s.lookahead < MIN_LOOKAHEAD && flush === Z_NO_FLUSH) {
611
- return BS_NEED_MORE;
612
- }
613
- if (s.lookahead === 0) {
614
- break; /* flush the current block */
615
- }
616
- }
617
-
618
- /* Insert the string window[strstart .. strstart+2] in the
619
- * dictionary, and set hash_head to the head of the hash chain:
620
- */
621
- hash_head = 0/*NIL*/;
622
- if (s.lookahead >= MIN_MATCH) {
623
- /*** INSERT_STRING(s, s.strstart, hash_head); ***/
624
- s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask;
625
- hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];
626
- s.head[s.ins_h] = s.strstart;
627
- /***/
628
- }
629
-
630
- /* Find the longest match, discarding those <= prev_length.
631
- * At this point we have always match_length < MIN_MATCH
632
- */
633
- if (hash_head !== 0/*NIL*/ && ((s.strstart - hash_head) <= (s.w_size - MIN_LOOKAHEAD))) {
634
- /* To simplify the code, we prevent matches with the string
635
- * of window index 0 (in particular we have to avoid a match
636
- * of the string with itself at the start of the input file).
637
- */
638
- s.match_length = longest_match(s, hash_head);
639
- /* longest_match() sets match_start */
640
- }
641
- if (s.match_length >= MIN_MATCH) {
642
- // check_match(s, s.strstart, s.match_start, s.match_length); // for debug only
643
-
644
- /*** _tr_tally_dist(s, s.strstart - s.match_start,
645
- s.match_length - MIN_MATCH, bflush); ***/
646
- bflush = trees._tr_tally(s, s.strstart - s.match_start, s.match_length - MIN_MATCH);
647
-
648
- s.lookahead -= s.match_length;
649
-
650
- /* Insert new strings in the hash table only if the match length
651
- * is not too large. This saves time but degrades compression.
652
- */
653
- if (s.match_length <= s.max_lazy_match/*max_insert_length*/ && s.lookahead >= MIN_MATCH) {
654
- s.match_length--; /* string at strstart already in table */
655
- do {
656
- s.strstart++;
657
- /*** INSERT_STRING(s, s.strstart, hash_head); ***/
658
- s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask;
659
- hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];
660
- s.head[s.ins_h] = s.strstart;
661
- /***/
662
- /* strstart never exceeds WSIZE-MAX_MATCH, so there are
663
- * always MIN_MATCH bytes ahead.
664
- */
665
- } while (--s.match_length !== 0);
666
- s.strstart++;
667
- } else
668
- {
669
- s.strstart += s.match_length;
670
- s.match_length = 0;
671
- s.ins_h = s.window[s.strstart];
672
- /* UPDATE_HASH(s, s.ins_h, s.window[s.strstart+1]); */
673
- s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + 1]) & s.hash_mask;
674
-
675
- //#if MIN_MATCH != 3
676
- // Call UPDATE_HASH() MIN_MATCH-3 more times
677
- //#endif
678
- /* If lookahead < MIN_MATCH, ins_h is garbage, but it does not
679
- * matter since it will be recomputed at next deflate call.
680
- */
681
- }
682
- } else {
683
- /* No match, output a literal byte */
684
- //Tracevv((stderr,"%c", s.window[s.strstart]));
685
- /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/
686
- bflush = trees._tr_tally(s, 0, s.window[s.strstart]);
687
-
688
- s.lookahead--;
689
- s.strstart++;
690
- }
691
- if (bflush) {
692
- /*** FLUSH_BLOCK(s, 0); ***/
693
- flush_block_only(s, false);
694
- if (s.strm.avail_out === 0) {
695
- return BS_NEED_MORE;
696
- }
697
- /***/
698
- }
699
- }
700
- s.insert = ((s.strstart < (MIN_MATCH - 1)) ? s.strstart : MIN_MATCH - 1);
701
- if (flush === Z_FINISH) {
702
- /*** FLUSH_BLOCK(s, 1); ***/
703
- flush_block_only(s, true);
704
- if (s.strm.avail_out === 0) {
705
- return BS_FINISH_STARTED;
706
- }
707
- /***/
708
- return BS_FINISH_DONE;
709
- }
710
- if (s.last_lit) {
711
- /*** FLUSH_BLOCK(s, 0); ***/
712
- flush_block_only(s, false);
713
- if (s.strm.avail_out === 0) {
714
- return BS_NEED_MORE;
715
- }
716
- /***/
717
- }
718
- return BS_BLOCK_DONE;
719
- }
720
-
721
- /* ===========================================================================
722
- * Same as above, but achieves better compression. We use a lazy
723
- * evaluation for matches: a match is finally adopted only if there is
724
- * no better match at the next window position.
725
- */
726
- function deflate_slow(s, flush) {
727
- var hash_head; /* head of hash chain */
728
- var bflush; /* set if current block must be flushed */
729
-
730
- var max_insert;
731
-
732
- /* Process the input block. */
733
- for (;;) {
734
- /* Make sure that we always have enough lookahead, except
735
- * at the end of the input file. We need MAX_MATCH bytes
736
- * for the next match, plus MIN_MATCH bytes to insert the
737
- * string following the next match.
738
- */
739
- if (s.lookahead < MIN_LOOKAHEAD) {
740
- fill_window(s);
741
- if (s.lookahead < MIN_LOOKAHEAD && flush === Z_NO_FLUSH) {
742
- return BS_NEED_MORE;
743
- }
744
- if (s.lookahead === 0) { break; } /* flush the current block */
745
- }
746
-
747
- /* Insert the string window[strstart .. strstart+2] in the
748
- * dictionary, and set hash_head to the head of the hash chain:
749
- */
750
- hash_head = 0/*NIL*/;
751
- if (s.lookahead >= MIN_MATCH) {
752
- /*** INSERT_STRING(s, s.strstart, hash_head); ***/
753
- s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask;
754
- hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];
755
- s.head[s.ins_h] = s.strstart;
756
- /***/
757
- }
758
-
759
- /* Find the longest match, discarding those <= prev_length.
760
- */
761
- s.prev_length = s.match_length;
762
- s.prev_match = s.match_start;
763
- s.match_length = MIN_MATCH - 1;
764
-
765
- if (hash_head !== 0/*NIL*/ && s.prev_length < s.max_lazy_match &&
766
- s.strstart - hash_head <= (s.w_size - MIN_LOOKAHEAD)/*MAX_DIST(s)*/) {
767
- /* To simplify the code, we prevent matches with the string
768
- * of window index 0 (in particular we have to avoid a match
769
- * of the string with itself at the start of the input file).
770
- */
771
- s.match_length = longest_match(s, hash_head);
772
- /* longest_match() sets match_start */
773
-
774
- if (s.match_length <= 5 &&
775
- (s.strategy === Z_FILTERED || (s.match_length === MIN_MATCH && s.strstart - s.match_start > 4096/*TOO_FAR*/))) {
776
-
777
- /* If prev_match is also MIN_MATCH, match_start is garbage
778
- * but we will ignore the current match anyway.
779
- */
780
- s.match_length = MIN_MATCH - 1;
781
- }
782
- }
783
- /* If there was a match at the previous step and the current
784
- * match is not better, output the previous match:
785
- */
786
- if (s.prev_length >= MIN_MATCH && s.match_length <= s.prev_length) {
787
- max_insert = s.strstart + s.lookahead - MIN_MATCH;
788
- /* Do not insert strings in hash table beyond this. */
789
-
790
- //check_match(s, s.strstart-1, s.prev_match, s.prev_length);
791
-
792
- /***_tr_tally_dist(s, s.strstart - 1 - s.prev_match,
793
- s.prev_length - MIN_MATCH, bflush);***/
794
- bflush = trees._tr_tally(s, s.strstart - 1 - s.prev_match, s.prev_length - MIN_MATCH);
795
- /* Insert in hash table all strings up to the end of the match.
796
- * strstart-1 and strstart are already inserted. If there is not
797
- * enough lookahead, the last two strings are not inserted in
798
- * the hash table.
799
- */
800
- s.lookahead -= s.prev_length - 1;
801
- s.prev_length -= 2;
802
- do {
803
- if (++s.strstart <= max_insert) {
804
- /*** INSERT_STRING(s, s.strstart, hash_head); ***/
805
- s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask;
806
- hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];
807
- s.head[s.ins_h] = s.strstart;
808
- /***/
809
- }
810
- } while (--s.prev_length !== 0);
811
- s.match_available = 0;
812
- s.match_length = MIN_MATCH - 1;
813
- s.strstart++;
814
-
815
- if (bflush) {
816
- /*** FLUSH_BLOCK(s, 0); ***/
817
- flush_block_only(s, false);
818
- if (s.strm.avail_out === 0) {
819
- return BS_NEED_MORE;
820
- }
821
- /***/
822
- }
823
-
824
- } else if (s.match_available) {
825
- /* If there was no match at the previous position, output a
826
- * single literal. If there was a match but the current match
827
- * is longer, truncate the previous match to a single literal.
828
- */
829
- //Tracevv((stderr,"%c", s->window[s->strstart-1]));
830
- /*** _tr_tally_lit(s, s.window[s.strstart-1], bflush); ***/
831
- bflush = trees._tr_tally(s, 0, s.window[s.strstart - 1]);
832
-
833
- if (bflush) {
834
- /*** FLUSH_BLOCK_ONLY(s, 0) ***/
835
- flush_block_only(s, false);
836
- /***/
837
- }
838
- s.strstart++;
839
- s.lookahead--;
840
- if (s.strm.avail_out === 0) {
841
- return BS_NEED_MORE;
842
- }
843
- } else {
844
- /* There is no previous match to compare with, wait for
845
- * the next step to decide.
846
- */
847
- s.match_available = 1;
848
- s.strstart++;
849
- s.lookahead--;
850
- }
851
- }
852
- //Assert (flush != Z_NO_FLUSH, "no flush?");
853
- if (s.match_available) {
854
- //Tracevv((stderr,"%c", s->window[s->strstart-1]));
855
- /*** _tr_tally_lit(s, s.window[s.strstart-1], bflush); ***/
856
- bflush = trees._tr_tally(s, 0, s.window[s.strstart - 1]);
857
-
858
- s.match_available = 0;
859
- }
860
- s.insert = s.strstart < MIN_MATCH - 1 ? s.strstart : MIN_MATCH - 1;
861
- if (flush === Z_FINISH) {
862
- /*** FLUSH_BLOCK(s, 1); ***/
863
- flush_block_only(s, true);
864
- if (s.strm.avail_out === 0) {
865
- return BS_FINISH_STARTED;
866
- }
867
- /***/
868
- return BS_FINISH_DONE;
869
- }
870
- if (s.last_lit) {
871
- /*** FLUSH_BLOCK(s, 0); ***/
872
- flush_block_only(s, false);
873
- if (s.strm.avail_out === 0) {
874
- return BS_NEED_MORE;
875
- }
876
- /***/
877
- }
878
-
879
- return BS_BLOCK_DONE;
880
- }
881
-
882
-
883
- /* ===========================================================================
884
- * For Z_RLE, simply look for runs of bytes, generate matches only of distance
885
- * one. Do not maintain a hash table. (It will be regenerated if this run of
886
- * deflate switches away from Z_RLE.)
887
- */
888
- function deflate_rle(s, flush) {
889
- var bflush; /* set if current block must be flushed */
890
- var prev; /* byte at distance one to match */
891
- var scan, strend; /* scan goes up to strend for length of run */
892
-
893
- var _win = s.window;
894
-
895
- for (;;) {
896
- /* Make sure that we always have enough lookahead, except
897
- * at the end of the input file. We need MAX_MATCH bytes
898
- * for the longest run, plus one for the unrolled loop.
899
- */
900
- if (s.lookahead <= MAX_MATCH) {
901
- fill_window(s);
902
- if (s.lookahead <= MAX_MATCH && flush === Z_NO_FLUSH) {
903
- return BS_NEED_MORE;
904
- }
905
- if (s.lookahead === 0) { break; } /* flush the current block */
906
- }
907
-
908
- /* See how many times the previous byte repeats */
909
- s.match_length = 0;
910
- if (s.lookahead >= MIN_MATCH && s.strstart > 0) {
911
- scan = s.strstart - 1;
912
- prev = _win[scan];
913
- if (prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan]) {
914
- strend = s.strstart + MAX_MATCH;
915
- do {
916
- /*jshint noempty:false*/
917
- } while (prev === _win[++scan] && prev === _win[++scan] &&
918
- prev === _win[++scan] && prev === _win[++scan] &&
919
- prev === _win[++scan] && prev === _win[++scan] &&
920
- prev === _win[++scan] && prev === _win[++scan] &&
921
- scan < strend);
922
- s.match_length = MAX_MATCH - (strend - scan);
923
- if (s.match_length > s.lookahead) {
924
- s.match_length = s.lookahead;
925
- }
926
- }
927
- //Assert(scan <= s->window+(uInt)(s->window_size-1), "wild scan");
928
- }
929
-
930
- /* Emit match if have run of MIN_MATCH or longer, else emit literal */
931
- if (s.match_length >= MIN_MATCH) {
932
- //check_match(s, s.strstart, s.strstart - 1, s.match_length);
933
-
934
- /*** _tr_tally_dist(s, 1, s.match_length - MIN_MATCH, bflush); ***/
935
- bflush = trees._tr_tally(s, 1, s.match_length - MIN_MATCH);
936
-
937
- s.lookahead -= s.match_length;
938
- s.strstart += s.match_length;
939
- s.match_length = 0;
940
- } else {
941
- /* No match, output a literal byte */
942
- //Tracevv((stderr,"%c", s->window[s->strstart]));
943
- /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/
944
- bflush = trees._tr_tally(s, 0, s.window[s.strstart]);
945
-
946
- s.lookahead--;
947
- s.strstart++;
948
- }
949
- if (bflush) {
950
- /*** FLUSH_BLOCK(s, 0); ***/
951
- flush_block_only(s, false);
952
- if (s.strm.avail_out === 0) {
953
- return BS_NEED_MORE;
954
- }
955
- /***/
956
- }
957
- }
958
- s.insert = 0;
959
- if (flush === Z_FINISH) {
960
- /*** FLUSH_BLOCK(s, 1); ***/
961
- flush_block_only(s, true);
962
- if (s.strm.avail_out === 0) {
963
- return BS_FINISH_STARTED;
964
- }
965
- /***/
966
- return BS_FINISH_DONE;
967
- }
968
- if (s.last_lit) {
969
- /*** FLUSH_BLOCK(s, 0); ***/
970
- flush_block_only(s, false);
971
- if (s.strm.avail_out === 0) {
972
- return BS_NEED_MORE;
973
- }
974
- /***/
975
- }
976
- return BS_BLOCK_DONE;
977
- }
978
-
979
- /* ===========================================================================
980
- * For Z_HUFFMAN_ONLY, do not look for matches. Do not maintain a hash table.
981
- * (It will be regenerated if this run of deflate switches away from Huffman.)
982
- */
983
- function deflate_huff(s, flush) {
984
- var bflush; /* set if current block must be flushed */
985
-
986
- for (;;) {
987
- /* Make sure that we have a literal to write. */
988
- if (s.lookahead === 0) {
989
- fill_window(s);
990
- if (s.lookahead === 0) {
991
- if (flush === Z_NO_FLUSH) {
992
- return BS_NEED_MORE;
993
- }
994
- break; /* flush the current block */
995
- }
996
- }
997
-
998
- /* Output a literal byte */
999
- s.match_length = 0;
1000
- //Tracevv((stderr,"%c", s->window[s->strstart]));
1001
- /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/
1002
- bflush = trees._tr_tally(s, 0, s.window[s.strstart]);
1003
- s.lookahead--;
1004
- s.strstart++;
1005
- if (bflush) {
1006
- /*** FLUSH_BLOCK(s, 0); ***/
1007
- flush_block_only(s, false);
1008
- if (s.strm.avail_out === 0) {
1009
- return BS_NEED_MORE;
1010
- }
1011
- /***/
1012
- }
1013
- }
1014
- s.insert = 0;
1015
- if (flush === Z_FINISH) {
1016
- /*** FLUSH_BLOCK(s, 1); ***/
1017
- flush_block_only(s, true);
1018
- if (s.strm.avail_out === 0) {
1019
- return BS_FINISH_STARTED;
1020
- }
1021
- /***/
1022
- return BS_FINISH_DONE;
1023
- }
1024
- if (s.last_lit) {
1025
- /*** FLUSH_BLOCK(s, 0); ***/
1026
- flush_block_only(s, false);
1027
- if (s.strm.avail_out === 0) {
1028
- return BS_NEED_MORE;
1029
- }
1030
- /***/
1031
- }
1032
- return BS_BLOCK_DONE;
1033
- }
1034
-
1035
- /* Values for max_lazy_match, good_match and max_chain_length, depending on
1036
- * the desired pack level (0..9). The values given below have been tuned to
1037
- * exclude worst case performance for pathological files. Better values may be
1038
- * found for specific files.
1039
- */
1040
- function Config(good_length, max_lazy, nice_length, max_chain, func) {
1041
- this.good_length = good_length;
1042
- this.max_lazy = max_lazy;
1043
- this.nice_length = nice_length;
1044
- this.max_chain = max_chain;
1045
- this.func = func;
1046
- }
1047
-
1048
- var configuration_table;
1049
-
1050
- configuration_table = [
1051
- /* good lazy nice chain */
1052
- new Config(0, 0, 0, 0, deflate_stored), /* 0 store only */
1053
- new Config(4, 4, 8, 4, deflate_fast), /* 1 max speed, no lazy matches */
1054
- new Config(4, 5, 16, 8, deflate_fast), /* 2 */
1055
- new Config(4, 6, 32, 32, deflate_fast), /* 3 */
1056
-
1057
- new Config(4, 4, 16, 16, deflate_slow), /* 4 lazy matches */
1058
- new Config(8, 16, 32, 32, deflate_slow), /* 5 */
1059
- new Config(8, 16, 128, 128, deflate_slow), /* 6 */
1060
- new Config(8, 32, 128, 256, deflate_slow), /* 7 */
1061
- new Config(32, 128, 258, 1024, deflate_slow), /* 8 */
1062
- new Config(32, 258, 258, 4096, deflate_slow) /* 9 max compression */
1063
- ];
1064
-
1065
-
1066
- /* ===========================================================================
1067
- * Initialize the "longest match" routines for a new zlib stream
1068
- */
1069
- function lm_init(s) {
1070
- s.window_size = 2 * s.w_size;
1071
-
1072
- /*** CLEAR_HASH(s); ***/
1073
- zero(s.head); // Fill with NIL (= 0);
1074
-
1075
- /* Set the default configuration parameters:
1076
- */
1077
- s.max_lazy_match = configuration_table[s.level].max_lazy;
1078
- s.good_match = configuration_table[s.level].good_length;
1079
- s.nice_match = configuration_table[s.level].nice_length;
1080
- s.max_chain_length = configuration_table[s.level].max_chain;
1081
-
1082
- s.strstart = 0;
1083
- s.block_start = 0;
1084
- s.lookahead = 0;
1085
- s.insert = 0;
1086
- s.match_length = s.prev_length = MIN_MATCH - 1;
1087
- s.match_available = 0;
1088
- s.ins_h = 0;
1089
- }
1090
-
1091
-
1092
- function DeflateState() {
1093
- this.strm = null; /* pointer back to this zlib stream */
1094
- this.status = 0; /* as the name implies */
1095
- this.pending_buf = null; /* output still pending */
1096
- this.pending_buf_size = 0; /* size of pending_buf */
1097
- this.pending_out = 0; /* next pending byte to output to the stream */
1098
- this.pending = 0; /* nb of bytes in the pending buffer */
1099
- this.wrap = 0; /* bit 0 true for zlib, bit 1 true for gzip */
1100
- this.gzhead = null; /* gzip header information to write */
1101
- this.gzindex = 0; /* where in extra, name, or comment */
1102
- this.method = Z_DEFLATED; /* can only be DEFLATED */
1103
- this.last_flush = -1; /* value of flush param for previous deflate call */
1104
-
1105
- this.w_size = 0; /* LZ77 window size (32K by default) */
1106
- this.w_bits = 0; /* log2(w_size) (8..16) */
1107
- this.w_mask = 0; /* w_size - 1 */
1108
-
1109
- this.window = null;
1110
- /* Sliding window. Input bytes are read into the second half of the window,
1111
- * and move to the first half later to keep a dictionary of at least wSize
1112
- * bytes. With this organization, matches are limited to a distance of
1113
- * wSize-MAX_MATCH bytes, but this ensures that IO is always
1114
- * performed with a length multiple of the block size.
1115
- */
1116
-
1117
- this.window_size = 0;
1118
- /* Actual size of window: 2*wSize, except when the user input buffer
1119
- * is directly used as sliding window.
1120
- */
1121
-
1122
- this.prev = null;
1123
- /* Link to older string with same hash index. To limit the size of this
1124
- * array to 64K, this link is maintained only for the last 32K strings.
1125
- * An index in this array is thus a window index modulo 32K.
1126
- */
1127
-
1128
- this.head = null; /* Heads of the hash chains or NIL. */
1129
-
1130
- this.ins_h = 0; /* hash index of string to be inserted */
1131
- this.hash_size = 0; /* number of elements in hash table */
1132
- this.hash_bits = 0; /* log2(hash_size) */
1133
- this.hash_mask = 0; /* hash_size-1 */
1134
-
1135
- this.hash_shift = 0;
1136
- /* Number of bits by which ins_h must be shifted at each input
1137
- * step. It must be such that after MIN_MATCH steps, the oldest
1138
- * byte no longer takes part in the hash key, that is:
1139
- * hash_shift * MIN_MATCH >= hash_bits
1140
- */
1141
-
1142
- this.block_start = 0;
1143
- /* Window position at the beginning of the current output block. Gets
1144
- * negative when the window is moved backwards.
1145
- */
1146
-
1147
- this.match_length = 0; /* length of best match */
1148
- this.prev_match = 0; /* previous match */
1149
- this.match_available = 0; /* set if previous match exists */
1150
- this.strstart = 0; /* start of string to insert */
1151
- this.match_start = 0; /* start of matching string */
1152
- this.lookahead = 0; /* number of valid bytes ahead in window */
1153
-
1154
- this.prev_length = 0;
1155
- /* Length of the best match at previous step. Matches not greater than this
1156
- * are discarded. This is used in the lazy match evaluation.
1157
- */
1158
-
1159
- this.max_chain_length = 0;
1160
- /* To speed up deflation, hash chains are never searched beyond this
1161
- * length. A higher limit improves compression ratio but degrades the
1162
- * speed.
1163
- */
1164
-
1165
- this.max_lazy_match = 0;
1166
- /* Attempt to find a better match only when the current match is strictly
1167
- * smaller than this value. This mechanism is used only for compression
1168
- * levels >= 4.
1169
- */
1170
- // That's alias to max_lazy_match, don't use directly
1171
- //this.max_insert_length = 0;
1172
- /* Insert new strings in the hash table only if the match length is not
1173
- * greater than this length. This saves time but degrades compression.
1174
- * max_insert_length is used only for compression levels <= 3.
1175
- */
1176
-
1177
- this.level = 0; /* compression level (1..9) */
1178
- this.strategy = 0; /* favor or force Huffman coding*/
1179
-
1180
- this.good_match = 0;
1181
- /* Use a faster search when the previous match is longer than this */
1182
-
1183
- this.nice_match = 0; /* Stop searching when current match exceeds this */
1184
-
1185
- /* used by trees.c: */
1186
-
1187
- /* Didn't use ct_data typedef below to suppress compiler warning */
1188
-
1189
- // struct ct_data_s dyn_ltree[HEAP_SIZE]; /* literal and length tree */
1190
- // struct ct_data_s dyn_dtree[2*D_CODES+1]; /* distance tree */
1191
- // struct ct_data_s bl_tree[2*BL_CODES+1]; /* Huffman tree for bit lengths */
1192
-
1193
- // Use flat array of DOUBLE size, with interleaved fata,
1194
- // because JS does not support effective
1195
- this.dyn_ltree = new utils.Buf16(HEAP_SIZE * 2);
1196
- this.dyn_dtree = new utils.Buf16((2 * D_CODES + 1) * 2);
1197
- this.bl_tree = new utils.Buf16((2 * BL_CODES + 1) * 2);
1198
- zero(this.dyn_ltree);
1199
- zero(this.dyn_dtree);
1200
- zero(this.bl_tree);
1201
-
1202
- this.l_desc = null; /* desc. for literal tree */
1203
- this.d_desc = null; /* desc. for distance tree */
1204
- this.bl_desc = null; /* desc. for bit length tree */
1205
-
1206
- //ush bl_count[MAX_BITS+1];
1207
- this.bl_count = new utils.Buf16(MAX_BITS + 1);
1208
- /* number of codes at each bit length for an optimal tree */
1209
-
1210
- //int heap[2*L_CODES+1]; /* heap used to build the Huffman trees */
1211
- this.heap = new utils.Buf16(2 * L_CODES + 1); /* heap used to build the Huffman trees */
1212
- zero(this.heap);
1213
-
1214
- this.heap_len = 0; /* number of elements in the heap */
1215
- this.heap_max = 0; /* element of largest frequency */
1216
- /* The sons of heap[n] are heap[2*n] and heap[2*n+1]. heap[0] is not used.
1217
- * The same heap array is used to build all trees.
1218
- */
1219
-
1220
- this.depth = new utils.Buf16(2 * L_CODES + 1); //uch depth[2*L_CODES+1];
1221
- zero(this.depth);
1222
- /* Depth of each subtree used as tie breaker for trees of equal frequency
1223
- */
1224
-
1225
- this.l_buf = 0; /* buffer index for literals or lengths */
1226
-
1227
- this.lit_bufsize = 0;
1228
- /* Size of match buffer for literals/lengths. There are 4 reasons for
1229
- * limiting lit_bufsize to 64K:
1230
- * - frequencies can be kept in 16 bit counters
1231
- * - if compression is not successful for the first block, all input
1232
- * data is still in the window so we can still emit a stored block even
1233
- * when input comes from standard input. (This can also be done for
1234
- * all blocks if lit_bufsize is not greater than 32K.)
1235
- * - if compression is not successful for a file smaller than 64K, we can
1236
- * even emit a stored file instead of a stored block (saving 5 bytes).
1237
- * This is applicable only for zip (not gzip or zlib).
1238
- * - creating new Huffman trees less frequently may not provide fast
1239
- * adaptation to changes in the input data statistics. (Take for
1240
- * example a binary file with poorly compressible code followed by
1241
- * a highly compressible string table.) Smaller buffer sizes give
1242
- * fast adaptation but have of course the overhead of transmitting
1243
- * trees more frequently.
1244
- * - I can't count above 4
1245
- */
1246
-
1247
- this.last_lit = 0; /* running index in l_buf */
1248
-
1249
- this.d_buf = 0;
1250
- /* Buffer index for distances. To simplify the code, d_buf and l_buf have
1251
- * the same number of elements. To use different lengths, an extra flag
1252
- * array would be necessary.
1253
- */
1254
-
1255
- this.opt_len = 0; /* bit length of current block with optimal trees */
1256
- this.static_len = 0; /* bit length of current block with static trees */
1257
- this.matches = 0; /* number of string matches in current block */
1258
- this.insert = 0; /* bytes at end of window left to insert */
1259
-
1260
-
1261
- this.bi_buf = 0;
1262
- /* Output buffer. bits are inserted starting at the bottom (least
1263
- * significant bits).
1264
- */
1265
- this.bi_valid = 0;
1266
- /* Number of valid bits in bi_buf. All bits above the last valid bit
1267
- * are always zero.
1268
- */
1269
-
1270
- // Used for window memory init. We safely ignore it for JS. That makes
1271
- // sense only for pointers and memory check tools.
1272
- //this.high_water = 0;
1273
- /* High water mark offset in window for initialized bytes -- bytes above
1274
- * this are set to zero in order to avoid memory check warnings when
1275
- * longest match routines access bytes past the input. This is then
1276
- * updated to the new high water mark.
1277
- */
1278
- }
1279
-
1280
-
1281
- function deflateResetKeep(strm) {
1282
- var s;
1283
-
1284
- if (!strm || !strm.state) {
1285
- return err(strm, Z_STREAM_ERROR);
1286
- }
1287
-
1288
- strm.total_in = strm.total_out = 0;
1289
- strm.data_type = Z_UNKNOWN;
1290
-
1291
- s = strm.state;
1292
- s.pending = 0;
1293
- s.pending_out = 0;
1294
-
1295
- if (s.wrap < 0) {
1296
- s.wrap = -s.wrap;
1297
- /* was made negative by deflate(..., Z_FINISH); */
1298
- }
1299
- s.status = (s.wrap ? INIT_STATE : BUSY_STATE);
1300
- strm.adler = (s.wrap === 2) ?
1301
- 0 // crc32(0, Z_NULL, 0)
1302
- :
1303
- 1; // adler32(0, Z_NULL, 0)
1304
- s.last_flush = Z_NO_FLUSH;
1305
- trees._tr_init(s);
1306
- return Z_OK;
1307
- }
1308
-
1309
-
1310
- function deflateReset(strm) {
1311
- var ret = deflateResetKeep(strm);
1312
- if (ret === Z_OK) {
1313
- lm_init(strm.state);
1314
- }
1315
- return ret;
1316
- }
1317
-
1318
-
1319
- function deflateSetHeader(strm, head) {
1320
- if (!strm || !strm.state) { return Z_STREAM_ERROR; }
1321
- if (strm.state.wrap !== 2) { return Z_STREAM_ERROR; }
1322
- strm.state.gzhead = head;
1323
- return Z_OK;
1324
- }
1325
-
1326
-
1327
- function deflateInit2(strm, level, method, windowBits, memLevel, strategy) {
1328
- if (!strm) { // === Z_NULL
1329
- return Z_STREAM_ERROR;
1330
- }
1331
- var wrap = 1;
1332
-
1333
- if (level === Z_DEFAULT_COMPRESSION) {
1334
- level = 6;
1335
- }
1336
-
1337
- if (windowBits < 0) { /* suppress zlib wrapper */
1338
- wrap = 0;
1339
- windowBits = -windowBits;
1340
- }
1341
-
1342
- else if (windowBits > 15) {
1343
- wrap = 2; /* write gzip wrapper instead */
1344
- windowBits -= 16;
1345
- }
1346
-
1347
-
1348
- if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method !== Z_DEFLATED ||
1349
- windowBits < 8 || windowBits > 15 || level < 0 || level > 9 ||
1350
- strategy < 0 || strategy > Z_FIXED) {
1351
- return err(strm, Z_STREAM_ERROR);
1352
- }
1353
-
1354
-
1355
- if (windowBits === 8) {
1356
- windowBits = 9;
1357
- }
1358
- /* until 256-byte window bug fixed */
1359
-
1360
- var s = new DeflateState();
1361
-
1362
- strm.state = s;
1363
- s.strm = strm;
1364
-
1365
- s.wrap = wrap;
1366
- s.gzhead = null;
1367
- s.w_bits = windowBits;
1368
- s.w_size = 1 << s.w_bits;
1369
- s.w_mask = s.w_size - 1;
1370
-
1371
- s.hash_bits = memLevel + 7;
1372
- s.hash_size = 1 << s.hash_bits;
1373
- s.hash_mask = s.hash_size - 1;
1374
- s.hash_shift = ~~((s.hash_bits + MIN_MATCH - 1) / MIN_MATCH);
1375
-
1376
- s.window = new utils.Buf8(s.w_size * 2);
1377
- s.head = new utils.Buf16(s.hash_size);
1378
- s.prev = new utils.Buf16(s.w_size);
1379
-
1380
- // Don't need mem init magic for JS.
1381
- //s.high_water = 0; /* nothing written to s->window yet */
1382
-
1383
- s.lit_bufsize = 1 << (memLevel + 6); /* 16K elements by default */
1384
-
1385
- s.pending_buf_size = s.lit_bufsize * 4;
1386
-
1387
- //overlay = (ushf *) ZALLOC(strm, s->lit_bufsize, sizeof(ush)+2);
1388
- //s->pending_buf = (uchf *) overlay;
1389
- s.pending_buf = new utils.Buf8(s.pending_buf_size);
1390
-
1391
- // It is offset from `s.pending_buf` (size is `s.lit_bufsize * 2`)
1392
- //s->d_buf = overlay + s->lit_bufsize/sizeof(ush);
1393
- s.d_buf = 1 * s.lit_bufsize;
1394
-
1395
- //s->l_buf = s->pending_buf + (1+sizeof(ush))*s->lit_bufsize;
1396
- s.l_buf = (1 + 2) * s.lit_bufsize;
1397
-
1398
- s.level = level;
1399
- s.strategy = strategy;
1400
- s.method = method;
1401
-
1402
- return deflateReset(strm);
1403
- }
1404
-
1405
- function deflateInit(strm, level) {
1406
- return deflateInit2(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY);
1407
- }
1408
-
1409
-
1410
- function deflate(strm, flush) {
1411
- var old_flush, s;
1412
- var beg, val; // for gzip header write only
1413
-
1414
- if (!strm || !strm.state ||
1415
- flush > Z_BLOCK || flush < 0) {
1416
- return strm ? err(strm, Z_STREAM_ERROR) : Z_STREAM_ERROR;
1417
- }
1418
-
1419
- s = strm.state;
1420
-
1421
- if (!strm.output ||
1422
- (!strm.input && strm.avail_in !== 0) ||
1423
- (s.status === FINISH_STATE && flush !== Z_FINISH)) {
1424
- return err(strm, (strm.avail_out === 0) ? Z_BUF_ERROR : Z_STREAM_ERROR);
1425
- }
1426
-
1427
- s.strm = strm; /* just in case */
1428
- old_flush = s.last_flush;
1429
- s.last_flush = flush;
1430
-
1431
- /* Write the header */
1432
- if (s.status === INIT_STATE) {
1433
-
1434
- if (s.wrap === 2) { // GZIP header
1435
- strm.adler = 0; //crc32(0L, Z_NULL, 0);
1436
- put_byte(s, 31);
1437
- put_byte(s, 139);
1438
- put_byte(s, 8);
1439
- if (!s.gzhead) { // s->gzhead == Z_NULL
1440
- put_byte(s, 0);
1441
- put_byte(s, 0);
1442
- put_byte(s, 0);
1443
- put_byte(s, 0);
1444
- put_byte(s, 0);
1445
- put_byte(s, s.level === 9 ? 2 :
1446
- (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 ?
1447
- 4 : 0));
1448
- put_byte(s, OS_CODE);
1449
- s.status = BUSY_STATE;
1450
- }
1451
- else {
1452
- put_byte(s, (s.gzhead.text ? 1 : 0) +
1453
- (s.gzhead.hcrc ? 2 : 0) +
1454
- (!s.gzhead.extra ? 0 : 4) +
1455
- (!s.gzhead.name ? 0 : 8) +
1456
- (!s.gzhead.comment ? 0 : 16)
1457
- );
1458
- put_byte(s, s.gzhead.time & 0xff);
1459
- put_byte(s, (s.gzhead.time >> 8) & 0xff);
1460
- put_byte(s, (s.gzhead.time >> 16) & 0xff);
1461
- put_byte(s, (s.gzhead.time >> 24) & 0xff);
1462
- put_byte(s, s.level === 9 ? 2 :
1463
- (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 ?
1464
- 4 : 0));
1465
- put_byte(s, s.gzhead.os & 0xff);
1466
- if (s.gzhead.extra && s.gzhead.extra.length) {
1467
- put_byte(s, s.gzhead.extra.length & 0xff);
1468
- put_byte(s, (s.gzhead.extra.length >> 8) & 0xff);
1469
- }
1470
- if (s.gzhead.hcrc) {
1471
- strm.adler = crc32(strm.adler, s.pending_buf, s.pending, 0);
1472
- }
1473
- s.gzindex = 0;
1474
- s.status = EXTRA_STATE;
1475
- }
1476
- }
1477
- else // DEFLATE header
1478
- {
1479
- var header = (Z_DEFLATED + ((s.w_bits - 8) << 4)) << 8;
1480
- var level_flags = -1;
1481
-
1482
- if (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2) {
1483
- level_flags = 0;
1484
- } else if (s.level < 6) {
1485
- level_flags = 1;
1486
- } else if (s.level === 6) {
1487
- level_flags = 2;
1488
- } else {
1489
- level_flags = 3;
1490
- }
1491
- header |= (level_flags << 6);
1492
- if (s.strstart !== 0) { header |= PRESET_DICT; }
1493
- header += 31 - (header % 31);
1494
-
1495
- s.status = BUSY_STATE;
1496
- putShortMSB(s, header);
1497
-
1498
- /* Save the adler32 of the preset dictionary: */
1499
- if (s.strstart !== 0) {
1500
- putShortMSB(s, strm.adler >>> 16);
1501
- putShortMSB(s, strm.adler & 0xffff);
1502
- }
1503
- strm.adler = 1; // adler32(0L, Z_NULL, 0);
1504
- }
1505
- }
1506
-
1507
- //#ifdef GZIP
1508
- if (s.status === EXTRA_STATE) {
1509
- if (s.gzhead.extra/* != Z_NULL*/) {
1510
- beg = s.pending; /* start of bytes to update crc */
1511
-
1512
- while (s.gzindex < (s.gzhead.extra.length & 0xffff)) {
1513
- if (s.pending === s.pending_buf_size) {
1514
- if (s.gzhead.hcrc && s.pending > beg) {
1515
- strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);
1516
- }
1517
- flush_pending(strm);
1518
- beg = s.pending;
1519
- if (s.pending === s.pending_buf_size) {
1520
- break;
1521
- }
1522
- }
1523
- put_byte(s, s.gzhead.extra[s.gzindex] & 0xff);
1524
- s.gzindex++;
1525
- }
1526
- if (s.gzhead.hcrc && s.pending > beg) {
1527
- strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);
1528
- }
1529
- if (s.gzindex === s.gzhead.extra.length) {
1530
- s.gzindex = 0;
1531
- s.status = NAME_STATE;
1532
- }
1533
- }
1534
- else {
1535
- s.status = NAME_STATE;
1536
- }
1537
- }
1538
- if (s.status === NAME_STATE) {
1539
- if (s.gzhead.name/* != Z_NULL*/) {
1540
- beg = s.pending; /* start of bytes to update crc */
1541
- //int val;
1542
-
1543
- do {
1544
- if (s.pending === s.pending_buf_size) {
1545
- if (s.gzhead.hcrc && s.pending > beg) {
1546
- strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);
1547
- }
1548
- flush_pending(strm);
1549
- beg = s.pending;
1550
- if (s.pending === s.pending_buf_size) {
1551
- val = 1;
1552
- break;
1553
- }
1554
- }
1555
- // JS specific: little magic to add zero terminator to end of string
1556
- if (s.gzindex < s.gzhead.name.length) {
1557
- val = s.gzhead.name.charCodeAt(s.gzindex++) & 0xff;
1558
- } else {
1559
- val = 0;
1560
- }
1561
- put_byte(s, val);
1562
- } while (val !== 0);
1563
-
1564
- if (s.gzhead.hcrc && s.pending > beg) {
1565
- strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);
1566
- }
1567
- if (val === 0) {
1568
- s.gzindex = 0;
1569
- s.status = COMMENT_STATE;
1570
- }
1571
- }
1572
- else {
1573
- s.status = COMMENT_STATE;
1574
- }
1575
- }
1576
- if (s.status === COMMENT_STATE) {
1577
- if (s.gzhead.comment/* != Z_NULL*/) {
1578
- beg = s.pending; /* start of bytes to update crc */
1579
- //int val;
1580
-
1581
- do {
1582
- if (s.pending === s.pending_buf_size) {
1583
- if (s.gzhead.hcrc && s.pending > beg) {
1584
- strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);
1585
- }
1586
- flush_pending(strm);
1587
- beg = s.pending;
1588
- if (s.pending === s.pending_buf_size) {
1589
- val = 1;
1590
- break;
1591
- }
1592
- }
1593
- // JS specific: little magic to add zero terminator to end of string
1594
- if (s.gzindex < s.gzhead.comment.length) {
1595
- val = s.gzhead.comment.charCodeAt(s.gzindex++) & 0xff;
1596
- } else {
1597
- val = 0;
1598
- }
1599
- put_byte(s, val);
1600
- } while (val !== 0);
1601
-
1602
- if (s.gzhead.hcrc && s.pending > beg) {
1603
- strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);
1604
- }
1605
- if (val === 0) {
1606
- s.status = HCRC_STATE;
1607
- }
1608
- }
1609
- else {
1610
- s.status = HCRC_STATE;
1611
- }
1612
- }
1613
- if (s.status === HCRC_STATE) {
1614
- if (s.gzhead.hcrc) {
1615
- if (s.pending + 2 > s.pending_buf_size) {
1616
- flush_pending(strm);
1617
- }
1618
- if (s.pending + 2 <= s.pending_buf_size) {
1619
- put_byte(s, strm.adler & 0xff);
1620
- put_byte(s, (strm.adler >> 8) & 0xff);
1621
- strm.adler = 0; //crc32(0L, Z_NULL, 0);
1622
- s.status = BUSY_STATE;
1623
- }
1624
- }
1625
- else {
1626
- s.status = BUSY_STATE;
1627
- }
1628
- }
1629
- //#endif
1630
-
1631
- /* Flush as much pending output as possible */
1632
- if (s.pending !== 0) {
1633
- flush_pending(strm);
1634
- if (strm.avail_out === 0) {
1635
- /* Since avail_out is 0, deflate will be called again with
1636
- * more output space, but possibly with both pending and
1637
- * avail_in equal to zero. There won't be anything to do,
1638
- * but this is not an error situation so make sure we
1639
- * return OK instead of BUF_ERROR at next call of deflate:
1640
- */
1641
- s.last_flush = -1;
1642
- return Z_OK;
1643
- }
1644
-
1645
- /* Make sure there is something to do and avoid duplicate consecutive
1646
- * flushes. For repeated and useless calls with Z_FINISH, we keep
1647
- * returning Z_STREAM_END instead of Z_BUF_ERROR.
1648
- */
1649
- } else if (strm.avail_in === 0 && rank(flush) <= rank(old_flush) &&
1650
- flush !== Z_FINISH) {
1651
- return err(strm, Z_BUF_ERROR);
1652
- }
1653
-
1654
- /* User must not provide more input after the first FINISH: */
1655
- if (s.status === FINISH_STATE && strm.avail_in !== 0) {
1656
- return err(strm, Z_BUF_ERROR);
1657
- }
1658
-
1659
- /* Start a new block or continue the current one.
1660
- */
1661
- if (strm.avail_in !== 0 || s.lookahead !== 0 ||
1662
- (flush !== Z_NO_FLUSH && s.status !== FINISH_STATE)) {
1663
- var bstate = (s.strategy === Z_HUFFMAN_ONLY) ? deflate_huff(s, flush) :
1664
- (s.strategy === Z_RLE ? deflate_rle(s, flush) :
1665
- configuration_table[s.level].func(s, flush));
1666
-
1667
- if (bstate === BS_FINISH_STARTED || bstate === BS_FINISH_DONE) {
1668
- s.status = FINISH_STATE;
1669
- }
1670
- if (bstate === BS_NEED_MORE || bstate === BS_FINISH_STARTED) {
1671
- if (strm.avail_out === 0) {
1672
- s.last_flush = -1;
1673
- /* avoid BUF_ERROR next call, see above */
1674
- }
1675
- return Z_OK;
1676
- /* If flush != Z_NO_FLUSH && avail_out == 0, the next call
1677
- * of deflate should use the same flush parameter to make sure
1678
- * that the flush is complete. So we don't have to output an
1679
- * empty block here, this will be done at next call. This also
1680
- * ensures that for a very small output buffer, we emit at most
1681
- * one empty block.
1682
- */
1683
- }
1684
- if (bstate === BS_BLOCK_DONE) {
1685
- if (flush === Z_PARTIAL_FLUSH) {
1686
- trees._tr_align(s);
1687
- }
1688
- else if (flush !== Z_BLOCK) { /* FULL_FLUSH or SYNC_FLUSH */
1689
-
1690
- trees._tr_stored_block(s, 0, 0, false);
1691
- /* For a full flush, this empty block will be recognized
1692
- * as a special marker by inflate_sync().
1693
- */
1694
- if (flush === Z_FULL_FLUSH) {
1695
- /*** CLEAR_HASH(s); ***/ /* forget history */
1696
- zero(s.head); // Fill with NIL (= 0);
1697
-
1698
- if (s.lookahead === 0) {
1699
- s.strstart = 0;
1700
- s.block_start = 0;
1701
- s.insert = 0;
1702
- }
1703
- }
1704
- }
1705
- flush_pending(strm);
1706
- if (strm.avail_out === 0) {
1707
- s.last_flush = -1; /* avoid BUF_ERROR at next call, see above */
1708
- return Z_OK;
1709
- }
1710
- }
1711
- }
1712
- //Assert(strm->avail_out > 0, "bug2");
1713
- //if (strm.avail_out <= 0) { throw new Error("bug2");}
1714
-
1715
- if (flush !== Z_FINISH) { return Z_OK; }
1716
- if (s.wrap <= 0) { return Z_STREAM_END; }
1717
-
1718
- /* Write the trailer */
1719
- if (s.wrap === 2) {
1720
- put_byte(s, strm.adler & 0xff);
1721
- put_byte(s, (strm.adler >> 8) & 0xff);
1722
- put_byte(s, (strm.adler >> 16) & 0xff);
1723
- put_byte(s, (strm.adler >> 24) & 0xff);
1724
- put_byte(s, strm.total_in & 0xff);
1725
- put_byte(s, (strm.total_in >> 8) & 0xff);
1726
- put_byte(s, (strm.total_in >> 16) & 0xff);
1727
- put_byte(s, (strm.total_in >> 24) & 0xff);
1728
- }
1729
- else
1730
- {
1731
- putShortMSB(s, strm.adler >>> 16);
1732
- putShortMSB(s, strm.adler & 0xffff);
1733
- }
1734
-
1735
- flush_pending(strm);
1736
- /* If avail_out is zero, the application will call deflate again
1737
- * to flush the rest.
1738
- */
1739
- if (s.wrap > 0) { s.wrap = -s.wrap; }
1740
- /* write the trailer only once! */
1741
- return s.pending !== 0 ? Z_OK : Z_STREAM_END;
1742
- }
1743
-
1744
- function deflateEnd(strm) {
1745
- var status;
1746
-
1747
- if (!strm/*== Z_NULL*/ || !strm.state/*== Z_NULL*/) {
1748
- return Z_STREAM_ERROR;
1749
- }
1750
-
1751
- status = strm.state.status;
1752
- if (status !== INIT_STATE &&
1753
- status !== EXTRA_STATE &&
1754
- status !== NAME_STATE &&
1755
- status !== COMMENT_STATE &&
1756
- status !== HCRC_STATE &&
1757
- status !== BUSY_STATE &&
1758
- status !== FINISH_STATE
1759
- ) {
1760
- return err(strm, Z_STREAM_ERROR);
1761
- }
1762
-
1763
- strm.state = null;
1764
-
1765
- return status === BUSY_STATE ? err(strm, Z_DATA_ERROR) : Z_OK;
1766
- }
1767
-
1768
-
1769
- /* =========================================================================
1770
- * Initializes the compression dictionary from the given byte
1771
- * sequence without producing any compressed output.
1772
- */
1773
- function deflateSetDictionary(strm, dictionary) {
1774
- var dictLength = dictionary.length;
1775
-
1776
- var s;
1777
- var str, n;
1778
- var wrap;
1779
- var avail;
1780
- var next;
1781
- var input;
1782
- var tmpDict;
1783
-
1784
- if (!strm/*== Z_NULL*/ || !strm.state/*== Z_NULL*/) {
1785
- return Z_STREAM_ERROR;
1786
- }
1787
-
1788
- s = strm.state;
1789
- wrap = s.wrap;
1790
-
1791
- if (wrap === 2 || (wrap === 1 && s.status !== INIT_STATE) || s.lookahead) {
1792
- return Z_STREAM_ERROR;
1793
- }
1794
-
1795
- /* when using zlib wrappers, compute Adler-32 for provided dictionary */
1796
- if (wrap === 1) {
1797
- /* adler32(strm->adler, dictionary, dictLength); */
1798
- strm.adler = adler32(strm.adler, dictionary, dictLength, 0);
1799
- }
1800
-
1801
- s.wrap = 0; /* avoid computing Adler-32 in read_buf */
1802
-
1803
- /* if dictionary would fill window, just replace the history */
1804
- if (dictLength >= s.w_size) {
1805
- if (wrap === 0) { /* already empty otherwise */
1806
- /*** CLEAR_HASH(s); ***/
1807
- zero(s.head); // Fill with NIL (= 0);
1808
- s.strstart = 0;
1809
- s.block_start = 0;
1810
- s.insert = 0;
1811
- }
1812
- /* use the tail */
1813
- // dictionary = dictionary.slice(dictLength - s.w_size);
1814
- tmpDict = new utils.Buf8(s.w_size);
1815
- utils.arraySet(tmpDict, dictionary, dictLength - s.w_size, s.w_size, 0);
1816
- dictionary = tmpDict;
1817
- dictLength = s.w_size;
1818
- }
1819
- /* insert dictionary into window and hash */
1820
- avail = strm.avail_in;
1821
- next = strm.next_in;
1822
- input = strm.input;
1823
- strm.avail_in = dictLength;
1824
- strm.next_in = 0;
1825
- strm.input = dictionary;
1826
- fill_window(s);
1827
- while (s.lookahead >= MIN_MATCH) {
1828
- str = s.strstart;
1829
- n = s.lookahead - (MIN_MATCH - 1);
1830
- do {
1831
- /* UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]); */
1832
- s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[str + MIN_MATCH - 1]) & s.hash_mask;
1833
-
1834
- s.prev[str & s.w_mask] = s.head[s.ins_h];
1835
-
1836
- s.head[s.ins_h] = str;
1837
- str++;
1838
- } while (--n);
1839
- s.strstart = str;
1840
- s.lookahead = MIN_MATCH - 1;
1841
- fill_window(s);
1842
- }
1843
- s.strstart += s.lookahead;
1844
- s.block_start = s.strstart;
1845
- s.insert = s.lookahead;
1846
- s.lookahead = 0;
1847
- s.match_length = s.prev_length = MIN_MATCH - 1;
1848
- s.match_available = 0;
1849
- strm.next_in = next;
1850
- strm.input = input;
1851
- strm.avail_in = avail;
1852
- s.wrap = wrap;
1853
- return Z_OK;
1854
- }
1855
-
1856
-
1857
- exports.deflateInit = deflateInit;
1858
- exports.deflateInit2 = deflateInit2;
1859
- exports.deflateReset = deflateReset;
1860
- exports.deflateResetKeep = deflateResetKeep;
1861
- exports.deflateSetHeader = deflateSetHeader;
1862
- exports.deflate = deflate;
1863
- exports.deflateEnd = deflateEnd;
1864
- exports.deflateSetDictionary = deflateSetDictionary;
1865
- exports.deflateInfo = 'pako deflate (from Nodeca project)';
1866
-
1867
- /* Not implemented
1868
- exports.deflateBound = deflateBound;
1869
- exports.deflateCopy = deflateCopy;
1870
- exports.deflateParams = deflateParams;
1871
- exports.deflatePending = deflatePending;
1872
- exports.deflatePrime = deflatePrime;
1873
- exports.deflateTune = deflateTune;
1874
- */