UrgentcareCLI 0.1.1 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (317) hide show
  1. checksums.yaml +4 -4
  2. data/lib/UrgentCare/CLI.rb +1 -2
  3. data/lib/UrgentCare/Scraper.rb +65 -0
  4. data/lib/UrgentCare/version.rb +2 -2
  5. data/lib/UrgentCare.rb +1 -0
  6. metadata +3 -313
  7. data/.gitignore +0 -11
  8. data/.rspec +0 -3
  9. data/.travis.yml +0 -5
  10. data/CODE_OF_CONDUCT.md +0 -74
  11. data/Gemfile +0 -12
  12. data/Gemfile.lock +0 -84
  13. data/LICENSE.txt +0 -21
  14. data/Notes +0 -41
  15. data/README.md +0 -41
  16. data/Rakefile +0 -8
  17. data/UrgentCare.gemspec +0 -39
  18. data/background.jpg +0 -0
  19. data/data.txt +0 -4
  20. data/lib/Urgentcare/Scraper.rb +0 -78
  21. data/node_modules/.bin/rimraf +0 -1
  22. data/node_modules/.package-lock.json +0 -250
  23. data/node_modules/balanced-match/.github/FUNDING.yml +0 -2
  24. data/node_modules/balanced-match/LICENSE.md +0 -21
  25. data/node_modules/balanced-match/README.md +0 -97
  26. data/node_modules/balanced-match/index.js +0 -62
  27. data/node_modules/balanced-match/package.json +0 -48
  28. data/node_modules/brace-expansion/LICENSE +0 -21
  29. data/node_modules/brace-expansion/README.md +0 -129
  30. data/node_modules/brace-expansion/index.js +0 -201
  31. data/node_modules/brace-expansion/package.json +0 -47
  32. data/node_modules/concat-map/.travis.yml +0 -4
  33. data/node_modules/concat-map/LICENSE +0 -18
  34. data/node_modules/concat-map/README.markdown +0 -62
  35. data/node_modules/concat-map/example/map.js +0 -6
  36. data/node_modules/concat-map/index.js +0 -13
  37. data/node_modules/concat-map/package.json +0 -43
  38. data/node_modules/concat-map/test/map.js +0 -39
  39. data/node_modules/core-util-is/LICENSE +0 -19
  40. data/node_modules/core-util-is/README.md +0 -3
  41. data/node_modules/core-util-is/float.patch +0 -604
  42. data/node_modules/core-util-is/lib/util.js +0 -107
  43. data/node_modules/core-util-is/package.json +0 -32
  44. data/node_modules/core-util-is/test.js +0 -68
  45. data/node_modules/fs.realpath/LICENSE +0 -43
  46. data/node_modules/fs.realpath/README.md +0 -33
  47. data/node_modules/fs.realpath/index.js +0 -66
  48. data/node_modules/fs.realpath/old.js +0 -303
  49. data/node_modules/fs.realpath/package.json +0 -26
  50. data/node_modules/glob/LICENSE +0 -21
  51. data/node_modules/glob/README.md +0 -375
  52. data/node_modules/glob/changelog.md +0 -67
  53. data/node_modules/glob/common.js +0 -234
  54. data/node_modules/glob/glob.js +0 -788
  55. data/node_modules/glob/package.json +0 -51
  56. data/node_modules/glob/sync.js +0 -484
  57. data/node_modules/immediate/LICENSE.txt +0 -20
  58. data/node_modules/immediate/README.md +0 -93
  59. data/node_modules/immediate/dist/immediate.js +0 -75
  60. data/node_modules/immediate/dist/immediate.min.js +0 -1
  61. data/node_modules/immediate/lib/browser.js +0 -69
  62. data/node_modules/immediate/lib/index.js +0 -73
  63. data/node_modules/immediate/package.json +0 -42
  64. data/node_modules/inflight/LICENSE +0 -15
  65. data/node_modules/inflight/README.md +0 -37
  66. data/node_modules/inflight/inflight.js +0 -54
  67. data/node_modules/inflight/package.json +0 -29
  68. data/node_modules/inherits/LICENSE +0 -16
  69. data/node_modules/inherits/README.md +0 -42
  70. data/node_modules/inherits/inherits.js +0 -9
  71. data/node_modules/inherits/inherits_browser.js +0 -27
  72. data/node_modules/inherits/package.json +0 -29
  73. data/node_modules/isarray/.npmignore +0 -1
  74. data/node_modules/isarray/.travis.yml +0 -4
  75. data/node_modules/isarray/Makefile +0 -6
  76. data/node_modules/isarray/README.md +0 -60
  77. data/node_modules/isarray/component.json +0 -19
  78. data/node_modules/isarray/index.js +0 -5
  79. data/node_modules/isarray/package.json +0 -45
  80. data/node_modules/isarray/test.js +0 -20
  81. data/node_modules/jszip/.codeclimate.yml +0 -16
  82. data/node_modules/jszip/.editorconfig +0 -8
  83. data/node_modules/jszip/.jshintignore +0 -1
  84. data/node_modules/jszip/.jshintrc +0 -21
  85. data/node_modules/jszip/.travis.yml +0 -17
  86. data/node_modules/jszip/CHANGES.md +0 -163
  87. data/node_modules/jszip/LICENSE.markdown +0 -651
  88. data/node_modules/jszip/README.markdown +0 -35
  89. data/node_modules/jszip/dist/jszip.js +0 -30
  90. data/node_modules/jszip/dist/jszip.min.js +0 -13
  91. data/node_modules/jszip/index.d.ts +0 -270
  92. data/node_modules/jszip/lib/base64.js +0 -106
  93. data/node_modules/jszip/lib/compressedObject.js +0 -74
  94. data/node_modules/jszip/lib/compressions.js +0 -14
  95. data/node_modules/jszip/lib/crc32.js +0 -77
  96. data/node_modules/jszip/lib/defaults.js +0 -11
  97. data/node_modules/jszip/lib/external.js +0 -19
  98. data/node_modules/jszip/lib/flate.js +0 -85
  99. data/node_modules/jszip/lib/generate/ZipFileWorker.js +0 -540
  100. data/node_modules/jszip/lib/generate/index.js +0 -57
  101. data/node_modules/jszip/lib/index.js +0 -52
  102. data/node_modules/jszip/lib/license_header.js +0 -11
  103. data/node_modules/jszip/lib/load.js +0 -81
  104. data/node_modules/jszip/lib/nodejs/NodejsStreamInputAdapter.js +0 -74
  105. data/node_modules/jszip/lib/nodejs/NodejsStreamOutputAdapter.js +0 -42
  106. data/node_modules/jszip/lib/nodejsUtils.js +0 -57
  107. data/node_modules/jszip/lib/object.js +0 -389
  108. data/node_modules/jszip/lib/readable-stream-browser.js +0 -9
  109. data/node_modules/jszip/lib/reader/ArrayReader.js +0 -57
  110. data/node_modules/jszip/lib/reader/DataReader.js +0 -116
  111. data/node_modules/jszip/lib/reader/NodeBufferReader.js +0 -19
  112. data/node_modules/jszip/lib/reader/StringReader.js +0 -38
  113. data/node_modules/jszip/lib/reader/Uint8ArrayReader.js +0 -22
  114. data/node_modules/jszip/lib/reader/readerFor.js +0 -28
  115. data/node_modules/jszip/lib/signature.js +0 -7
  116. data/node_modules/jszip/lib/stream/ConvertWorker.js +0 -26
  117. data/node_modules/jszip/lib/stream/Crc32Probe.js +0 -24
  118. data/node_modules/jszip/lib/stream/DataLengthProbe.js +0 -29
  119. data/node_modules/jszip/lib/stream/DataWorker.js +0 -116
  120. data/node_modules/jszip/lib/stream/GenericWorker.js +0 -263
  121. data/node_modules/jszip/lib/stream/StreamHelper.js +0 -212
  122. data/node_modules/jszip/lib/support.js +0 -38
  123. data/node_modules/jszip/lib/utf8.js +0 -275
  124. data/node_modules/jszip/lib/utils.js +0 -476
  125. data/node_modules/jszip/lib/zipEntries.js +0 -262
  126. data/node_modules/jszip/lib/zipEntry.js +0 -294
  127. data/node_modules/jszip/lib/zipObject.js +0 -133
  128. data/node_modules/jszip/package.json +0 -63
  129. data/node_modules/jszip/vendor/FileSaver.js +0 -247
  130. data/node_modules/lie/README.md +0 -62
  131. data/node_modules/lie/dist/lie.js +0 -350
  132. data/node_modules/lie/dist/lie.min.js +0 -1
  133. data/node_modules/lie/dist/lie.polyfill.js +0 -358
  134. data/node_modules/lie/dist/lie.polyfill.min.js +0 -1
  135. data/node_modules/lie/lib/browser.js +0 -273
  136. data/node_modules/lie/lib/index.js +0 -298
  137. data/node_modules/lie/license.md +0 -7
  138. data/node_modules/lie/lie.d.ts +0 -244
  139. data/node_modules/lie/package.json +0 -69
  140. data/node_modules/lie/polyfill.js +0 -4
  141. data/node_modules/minimatch/LICENSE +0 -15
  142. data/node_modules/minimatch/README.md +0 -209
  143. data/node_modules/minimatch/minimatch.js +0 -923
  144. data/node_modules/minimatch/package.json +0 -30
  145. data/node_modules/once/LICENSE +0 -15
  146. data/node_modules/once/README.md +0 -79
  147. data/node_modules/once/once.js +0 -42
  148. data/node_modules/once/package.json +0 -33
  149. data/node_modules/pako/CHANGELOG.md +0 -164
  150. data/node_modules/pako/LICENSE +0 -21
  151. data/node_modules/pako/README.md +0 -191
  152. data/node_modules/pako/dist/pako.js +0 -6818
  153. data/node_modules/pako/dist/pako.min.js +0 -1
  154. data/node_modules/pako/dist/pako_deflate.js +0 -3997
  155. data/node_modules/pako/dist/pako_deflate.min.js +0 -1
  156. data/node_modules/pako/dist/pako_inflate.js +0 -3300
  157. data/node_modules/pako/dist/pako_inflate.min.js +0 -1
  158. data/node_modules/pako/index.js +0 -14
  159. data/node_modules/pako/lib/deflate.js +0 -400
  160. data/node_modules/pako/lib/inflate.js +0 -423
  161. data/node_modules/pako/lib/utils/common.js +0 -105
  162. data/node_modules/pako/lib/utils/strings.js +0 -187
  163. data/node_modules/pako/lib/zlib/README +0 -59
  164. data/node_modules/pako/lib/zlib/adler32.js +0 -51
  165. data/node_modules/pako/lib/zlib/constants.js +0 -68
  166. data/node_modules/pako/lib/zlib/crc32.js +0 -59
  167. data/node_modules/pako/lib/zlib/deflate.js +0 -1874
  168. data/node_modules/pako/lib/zlib/gzheader.js +0 -58
  169. data/node_modules/pako/lib/zlib/inffast.js +0 -345
  170. data/node_modules/pako/lib/zlib/inflate.js +0 -1556
  171. data/node_modules/pako/lib/zlib/inftrees.js +0 -343
  172. data/node_modules/pako/lib/zlib/messages.js +0 -32
  173. data/node_modules/pako/lib/zlib/trees.js +0 -1222
  174. data/node_modules/pako/lib/zlib/zstream.js +0 -47
  175. data/node_modules/pako/package.json +0 -44
  176. data/node_modules/path-is-absolute/index.js +0 -20
  177. data/node_modules/path-is-absolute/license +0 -21
  178. data/node_modules/path-is-absolute/package.json +0 -43
  179. data/node_modules/path-is-absolute/readme.md +0 -59
  180. data/node_modules/process-nextick-args/index.js +0 -45
  181. data/node_modules/process-nextick-args/license.md +0 -19
  182. data/node_modules/process-nextick-args/package.json +0 -25
  183. data/node_modules/process-nextick-args/readme.md +0 -18
  184. data/node_modules/readable-stream/.travis.yml +0 -34
  185. data/node_modules/readable-stream/CONTRIBUTING.md +0 -38
  186. data/node_modules/readable-stream/GOVERNANCE.md +0 -136
  187. data/node_modules/readable-stream/LICENSE +0 -47
  188. data/node_modules/readable-stream/README.md +0 -58
  189. data/node_modules/readable-stream/doc/wg-meetings/2015-01-30.md +0 -60
  190. data/node_modules/readable-stream/duplex-browser.js +0 -1
  191. data/node_modules/readable-stream/duplex.js +0 -1
  192. data/node_modules/readable-stream/lib/_stream_duplex.js +0 -131
  193. data/node_modules/readable-stream/lib/_stream_passthrough.js +0 -47
  194. data/node_modules/readable-stream/lib/_stream_readable.js +0 -1019
  195. data/node_modules/readable-stream/lib/_stream_transform.js +0 -214
  196. data/node_modules/readable-stream/lib/_stream_writable.js +0 -687
  197. data/node_modules/readable-stream/lib/internal/streams/BufferList.js +0 -79
  198. data/node_modules/readable-stream/lib/internal/streams/destroy.js +0 -74
  199. data/node_modules/readable-stream/lib/internal/streams/stream-browser.js +0 -1
  200. data/node_modules/readable-stream/lib/internal/streams/stream.js +0 -1
  201. data/node_modules/readable-stream/package.json +0 -52
  202. data/node_modules/readable-stream/passthrough.js +0 -1
  203. data/node_modules/readable-stream/readable-browser.js +0 -7
  204. data/node_modules/readable-stream/readable.js +0 -19
  205. data/node_modules/readable-stream/transform.js +0 -1
  206. data/node_modules/readable-stream/writable-browser.js +0 -1
  207. data/node_modules/readable-stream/writable.js +0 -8
  208. data/node_modules/rimraf/LICENSE +0 -15
  209. data/node_modules/rimraf/README.md +0 -101
  210. data/node_modules/rimraf/bin.js +0 -50
  211. data/node_modules/rimraf/package.json +0 -29
  212. data/node_modules/rimraf/rimraf.js +0 -372
  213. data/node_modules/safe-buffer/LICENSE +0 -21
  214. data/node_modules/safe-buffer/README.md +0 -584
  215. data/node_modules/safe-buffer/index.d.ts +0 -187
  216. data/node_modules/safe-buffer/index.js +0 -62
  217. data/node_modules/safe-buffer/package.json +0 -37
  218. data/node_modules/selenium-webdriver/CHANGES.md +0 -1114
  219. data/node_modules/selenium-webdriver/LICENSE +0 -202
  220. data/node_modules/selenium-webdriver/NOTICE +0 -2
  221. data/node_modules/selenium-webdriver/README.md +0 -229
  222. data/node_modules/selenium-webdriver/chrome.js +0 -295
  223. data/node_modules/selenium-webdriver/chromium.js +0 -829
  224. data/node_modules/selenium-webdriver/devtools/CDPConnection.js +0 -35
  225. data/node_modules/selenium-webdriver/edge.js +0 -224
  226. data/node_modules/selenium-webdriver/example/chrome_android.js +0 -45
  227. data/node_modules/selenium-webdriver/example/chrome_mobile_emulation.js +0 -46
  228. data/node_modules/selenium-webdriver/example/firefox_channels.js +0 -84
  229. data/node_modules/selenium-webdriver/example/google_search.js +0 -50
  230. data/node_modules/selenium-webdriver/example/google_search_test.js +0 -70
  231. data/node_modules/selenium-webdriver/example/headless.js +0 -63
  232. data/node_modules/selenium-webdriver/example/logging.js +0 -64
  233. data/node_modules/selenium-webdriver/firefox.js +0 -789
  234. data/node_modules/selenium-webdriver/http/index.js +0 -324
  235. data/node_modules/selenium-webdriver/http/util.js +0 -172
  236. data/node_modules/selenium-webdriver/ie.js +0 -503
  237. data/node_modules/selenium-webdriver/index.js +0 -825
  238. data/node_modules/selenium-webdriver/io/exec.js +0 -162
  239. data/node_modules/selenium-webdriver/io/index.js +0 -348
  240. data/node_modules/selenium-webdriver/io/zip.js +0 -223
  241. data/node_modules/selenium-webdriver/lib/atoms/find-elements.js +0 -123
  242. data/node_modules/selenium-webdriver/lib/atoms/get-attribute.js +0 -101
  243. data/node_modules/selenium-webdriver/lib/atoms/is-displayed.js +0 -101
  244. data/node_modules/selenium-webdriver/lib/atoms/mutation-listener.js +0 -55
  245. data/node_modules/selenium-webdriver/lib/by.js +0 -415
  246. data/node_modules/selenium-webdriver/lib/capabilities.js +0 -553
  247. data/node_modules/selenium-webdriver/lib/command.js +0 -206
  248. data/node_modules/selenium-webdriver/lib/error.js +0 -605
  249. data/node_modules/selenium-webdriver/lib/http.js +0 -704
  250. data/node_modules/selenium-webdriver/lib/input.js +0 -946
  251. data/node_modules/selenium-webdriver/lib/logging.js +0 -661
  252. data/node_modules/selenium-webdriver/lib/promise.js +0 -285
  253. data/node_modules/selenium-webdriver/lib/proxy.js +0 -212
  254. data/node_modules/selenium-webdriver/lib/session.js +0 -77
  255. data/node_modules/selenium-webdriver/lib/symbols.js +0 -37
  256. data/node_modules/selenium-webdriver/lib/until.js +0 -429
  257. data/node_modules/selenium-webdriver/lib/webdriver.js +0 -2919
  258. data/node_modules/selenium-webdriver/net/index.js +0 -107
  259. data/node_modules/selenium-webdriver/net/portprober.js +0 -75
  260. data/node_modules/selenium-webdriver/opera.js +0 -406
  261. data/node_modules/selenium-webdriver/package.json +0 -54
  262. data/node_modules/selenium-webdriver/proxy.js +0 -32
  263. data/node_modules/selenium-webdriver/remote/index.js +0 -624
  264. data/node_modules/selenium-webdriver/safari.js +0 -168
  265. data/node_modules/selenium-webdriver/testing/index.js +0 -504
  266. data/node_modules/set-immediate-shim/index.js +0 -7
  267. data/node_modules/set-immediate-shim/package.json +0 -34
  268. data/node_modules/set-immediate-shim/readme.md +0 -31
  269. data/node_modules/string_decoder/.travis.yml +0 -50
  270. data/node_modules/string_decoder/LICENSE +0 -48
  271. data/node_modules/string_decoder/README.md +0 -47
  272. data/node_modules/string_decoder/lib/string_decoder.js +0 -296
  273. data/node_modules/string_decoder/package.json +0 -31
  274. data/node_modules/tmp/CHANGELOG.md +0 -288
  275. data/node_modules/tmp/LICENSE +0 -21
  276. data/node_modules/tmp/README.md +0 -365
  277. data/node_modules/tmp/lib/tmp.js +0 -780
  278. data/node_modules/tmp/node_modules/.bin/rimraf +0 -1
  279. data/node_modules/tmp/node_modules/rimraf/CHANGELOG.md +0 -65
  280. data/node_modules/tmp/node_modules/rimraf/LICENSE +0 -15
  281. data/node_modules/tmp/node_modules/rimraf/README.md +0 -101
  282. data/node_modules/tmp/node_modules/rimraf/bin.js +0 -68
  283. data/node_modules/tmp/node_modules/rimraf/package.json +0 -32
  284. data/node_modules/tmp/node_modules/rimraf/rimraf.js +0 -360
  285. data/node_modules/tmp/package.json +0 -58
  286. data/node_modules/util-deprecate/History.md +0 -16
  287. data/node_modules/util-deprecate/LICENSE +0 -24
  288. data/node_modules/util-deprecate/README.md +0 -53
  289. data/node_modules/util-deprecate/browser.js +0 -67
  290. data/node_modules/util-deprecate/node.js +0 -6
  291. data/node_modules/util-deprecate/package.json +0 -27
  292. data/node_modules/wrappy/LICENSE +0 -15
  293. data/node_modules/wrappy/README.md +0 -36
  294. data/node_modules/wrappy/package.json +0 -29
  295. data/node_modules/wrappy/wrappy.js +0 -33
  296. data/node_modules/ws/LICENSE +0 -21
  297. data/node_modules/ws/README.md +0 -496
  298. data/node_modules/ws/browser.js +0 -8
  299. data/node_modules/ws/index.js +0 -10
  300. data/node_modules/ws/lib/buffer-util.js +0 -129
  301. data/node_modules/ws/lib/constants.js +0 -10
  302. data/node_modules/ws/lib/event-target.js +0 -184
  303. data/node_modules/ws/lib/extension.js +0 -223
  304. data/node_modules/ws/lib/limiter.js +0 -55
  305. data/node_modules/ws/lib/permessage-deflate.js +0 -517
  306. data/node_modules/ws/lib/receiver.js +0 -507
  307. data/node_modules/ws/lib/sender.js +0 -405
  308. data/node_modules/ws/lib/stream.js +0 -165
  309. data/node_modules/ws/lib/validation.js +0 -104
  310. data/node_modules/ws/lib/websocket-server.js +0 -418
  311. data/node_modules/ws/lib/websocket.js +0 -942
  312. data/node_modules/ws/package.json +0 -56
  313. data/package-lock.json +0 -458
  314. data/package.json +0 -5
  315. data/selenium.log +0 -1
  316. data/spec.md +0 -6
  317. data/test.data +0 -2110
@@ -1 +0,0 @@
1
- !function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).pako=t()}}(function(){return function i(s,h,l){function o(e,t){if(!h[e]){if(!s[e]){var a="function"==typeof require&&require;if(!t&&a)return a(e,!0);if(_)return _(e,!0);var n=new Error("Cannot find module '"+e+"'");throw n.code="MODULE_NOT_FOUND",n}var r=h[e]={exports:{}};s[e][0].call(r.exports,function(t){return o(s[e][1][t]||t)},r,r.exports,i,s,h,l)}return h[e].exports}for(var _="function"==typeof require&&require,t=0;t<l.length;t++)o(l[t]);return o}({1:[function(t,e,a){"use strict";var n="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;a.assign=function(t){for(var e,a,n=Array.prototype.slice.call(arguments,1);n.length;){var r=n.shift();if(r){if("object"!=typeof r)throw new TypeError(r+"must be non-object");for(var i in r)e=r,a=i,Object.prototype.hasOwnProperty.call(e,a)&&(t[i]=r[i])}}return t},a.shrinkBuf=function(t,e){return t.length===e?t:t.subarray?t.subarray(0,e):(t.length=e,t)};var r={arraySet:function(t,e,a,n,r){if(e.subarray&&t.subarray)t.set(e.subarray(a,a+n),r);else for(var i=0;i<n;i++)t[r+i]=e[a+i]},flattenChunks:function(t){var e,a,n,r,i,s;for(e=n=0,a=t.length;e<a;e++)n+=t[e].length;for(s=new Uint8Array(n),e=r=0,a=t.length;e<a;e++)i=t[e],s.set(i,r),r+=i.length;return s}},i={arraySet:function(t,e,a,n,r){for(var i=0;i<n;i++)t[r+i]=e[a+i]},flattenChunks:function(t){return[].concat.apply([],t)}};a.setTyped=function(t){t?(a.Buf8=Uint8Array,a.Buf16=Uint16Array,a.Buf32=Int32Array,a.assign(a,r)):(a.Buf8=Array,a.Buf16=Array,a.Buf32=Array,a.assign(a,i))},a.setTyped(n)},{}],2:[function(t,e,a){"use strict";var l=t("./common"),r=!0,i=!0;try{String.fromCharCode.apply(null,[0])}catch(t){r=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(t){i=!1}for(var o=new l.Buf8(256),n=0;n<256;n++)o[n]=252<=n?6:248<=n?5:240<=n?4:224<=n?3:192<=n?2:1;function _(t,e){if(e<65534&&(t.subarray&&i||!t.subarray&&r))return String.fromCharCode.apply(null,l.shrinkBuf(t,e));for(var a="",n=0;n<e;n++)a+=String.fromCharCode(t[n]);return a}o[254]=o[254]=1,a.string2buf=function(t){var e,a,n,r,i,s=t.length,h=0;for(r=0;r<s;r++)55296==(64512&(a=t.charCodeAt(r)))&&r+1<s&&56320==(64512&(n=t.charCodeAt(r+1)))&&(a=65536+(a-55296<<10)+(n-56320),r++),h+=a<128?1:a<2048?2:a<65536?3:4;for(e=new l.Buf8(h),r=i=0;i<h;r++)55296==(64512&(a=t.charCodeAt(r)))&&r+1<s&&56320==(64512&(n=t.charCodeAt(r+1)))&&(a=65536+(a-55296<<10)+(n-56320),r++),a<128?e[i++]=a:(a<2048?e[i++]=192|a>>>6:(a<65536?e[i++]=224|a>>>12:(e[i++]=240|a>>>18,e[i++]=128|a>>>12&63),e[i++]=128|a>>>6&63),e[i++]=128|63&a);return e},a.buf2binstring=function(t){return _(t,t.length)},a.binstring2buf=function(t){for(var e=new l.Buf8(t.length),a=0,n=e.length;a<n;a++)e[a]=t.charCodeAt(a);return e},a.buf2string=function(t,e){var a,n,r,i,s=e||t.length,h=new Array(2*s);for(a=n=0;a<s;)if((r=t[a++])<128)h[n++]=r;else if(4<(i=o[r]))h[n++]=65533,a+=i-1;else{for(r&=2===i?31:3===i?15:7;1<i&&a<s;)r=r<<6|63&t[a++],i--;1<i?h[n++]=65533:r<65536?h[n++]=r:(r-=65536,h[n++]=55296|r>>10&1023,h[n++]=56320|1023&r)}return _(h,n)},a.utf8border=function(t,e){var a;for((e=e||t.length)>t.length&&(e=t.length),a=e-1;0<=a&&128==(192&t[a]);)a--;return a<0?e:0===a?e:a+o[t[a]]>e?a:e}},{"./common":1}],3:[function(t,e,a){"use strict";e.exports=function(t,e,a,n){for(var r=65535&t|0,i=t>>>16&65535|0,s=0;0!==a;){for(a-=s=2e3<a?2e3:a;i=i+(r=r+e[n++]|0)|0,--s;);r%=65521,i%=65521}return r|i<<16|0}},{}],4:[function(t,e,a){"use strict";var h=function(){for(var t,e=[],a=0;a<256;a++){t=a;for(var n=0;n<8;n++)t=1&t?3988292384^t>>>1:t>>>1;e[a]=t}return e}();e.exports=function(t,e,a,n){var r=h,i=n+a;t^=-1;for(var s=n;s<i;s++)t=t>>>8^r[255&(t^e[s])];return-1^t}},{}],5:[function(t,e,a){"use strict";var l,u=t("../utils/common"),o=t("./trees"),f=t("./adler32"),c=t("./crc32"),n=t("./messages"),_=0,d=4,p=0,g=-2,m=-1,b=4,r=2,v=8,w=9,i=286,s=30,h=19,y=2*i+1,k=15,z=3,x=258,B=x+z+1,A=42,C=113,S=1,j=2,E=3,U=4;function D(t,e){return t.msg=n[e],e}function I(t){return(t<<1)-(4<t?9:0)}function O(t){for(var e=t.length;0<=--e;)t[e]=0}function q(t){var e=t.state,a=e.pending;a>t.avail_out&&(a=t.avail_out),0!==a&&(u.arraySet(t.output,e.pending_buf,e.pending_out,a,t.next_out),t.next_out+=a,e.pending_out+=a,t.total_out+=a,t.avail_out-=a,e.pending-=a,0===e.pending&&(e.pending_out=0))}function T(t,e){o._tr_flush_block(t,0<=t.block_start?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,q(t.strm)}function L(t,e){t.pending_buf[t.pending++]=e}function N(t,e){t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=255&e}function R(t,e){var a,n,r=t.max_chain_length,i=t.strstart,s=t.prev_length,h=t.nice_match,l=t.strstart>t.w_size-B?t.strstart-(t.w_size-B):0,o=t.window,_=t.w_mask,d=t.prev,u=t.strstart+x,f=o[i+s-1],c=o[i+s];t.prev_length>=t.good_match&&(r>>=2),h>t.lookahead&&(h=t.lookahead);do{if(o[(a=e)+s]===c&&o[a+s-1]===f&&o[a]===o[i]&&o[++a]===o[i+1]){i+=2,a++;do{}while(o[++i]===o[++a]&&o[++i]===o[++a]&&o[++i]===o[++a]&&o[++i]===o[++a]&&o[++i]===o[++a]&&o[++i]===o[++a]&&o[++i]===o[++a]&&o[++i]===o[++a]&&i<u);if(n=x-(u-i),i=u-x,s<n){if(t.match_start=e,h<=(s=n))break;f=o[i+s-1],c=o[i+s]}}}while((e=d[e&_])>l&&0!=--r);return s<=t.lookahead?s:t.lookahead}function H(t){var e,a,n,r,i,s,h,l,o,_,d=t.w_size;do{if(r=t.window_size-t.lookahead-t.strstart,t.strstart>=d+(d-B)){for(u.arraySet(t.window,t.window,d,d,0),t.match_start-=d,t.strstart-=d,t.block_start-=d,e=a=t.hash_size;n=t.head[--e],t.head[e]=d<=n?n-d:0,--a;);for(e=a=d;n=t.prev[--e],t.prev[e]=d<=n?n-d:0,--a;);r+=d}if(0===t.strm.avail_in)break;if(s=t.strm,h=t.window,l=t.strstart+t.lookahead,o=r,_=void 0,_=s.avail_in,o<_&&(_=o),a=0===_?0:(s.avail_in-=_,u.arraySet(h,s.input,s.next_in,_,l),1===s.state.wrap?s.adler=f(s.adler,h,_,l):2===s.state.wrap&&(s.adler=c(s.adler,h,_,l)),s.next_in+=_,s.total_in+=_,_),t.lookahead+=a,t.lookahead+t.insert>=z)for(i=t.strstart-t.insert,t.ins_h=t.window[i],t.ins_h=(t.ins_h<<t.hash_shift^t.window[i+1])&t.hash_mask;t.insert&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[i+z-1])&t.hash_mask,t.prev[i&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=i,i++,t.insert--,!(t.lookahead+t.insert<z)););}while(t.lookahead<B&&0!==t.strm.avail_in)}function F(t,e){for(var a,n;;){if(t.lookahead<B){if(H(t),t.lookahead<B&&e===_)return S;if(0===t.lookahead)break}if(a=0,t.lookahead>=z&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+z-1])&t.hash_mask,a=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),0!==a&&t.strstart-a<=t.w_size-B&&(t.match_length=R(t,a)),t.match_length>=z)if(n=o._tr_tally(t,t.strstart-t.match_start,t.match_length-z),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=z){for(t.match_length--;t.strstart++,t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+z-1])&t.hash_mask,a=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart,0!=--t.match_length;);t.strstart++}else t.strstart+=t.match_length,t.match_length=0,t.ins_h=t.window[t.strstart],t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+1])&t.hash_mask;else n=o._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(n&&(T(t,!1),0===t.strm.avail_out))return S}return t.insert=t.strstart<z-1?t.strstart:z-1,e===d?(T(t,!0),0===t.strm.avail_out?E:U):t.last_lit&&(T(t,!1),0===t.strm.avail_out)?S:j}function K(t,e){for(var a,n,r;;){if(t.lookahead<B){if(H(t),t.lookahead<B&&e===_)return S;if(0===t.lookahead)break}if(a=0,t.lookahead>=z&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+z-1])&t.hash_mask,a=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),t.prev_length=t.match_length,t.prev_match=t.match_start,t.match_length=z-1,0!==a&&t.prev_length<t.max_lazy_match&&t.strstart-a<=t.w_size-B&&(t.match_length=R(t,a),t.match_length<=5&&(1===t.strategy||t.match_length===z&&4096<t.strstart-t.match_start)&&(t.match_length=z-1)),t.prev_length>=z&&t.match_length<=t.prev_length){for(r=t.strstart+t.lookahead-z,n=o._tr_tally(t,t.strstart-1-t.prev_match,t.prev_length-z),t.lookahead-=t.prev_length-1,t.prev_length-=2;++t.strstart<=r&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+z-1])&t.hash_mask,a=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),0!=--t.prev_length;);if(t.match_available=0,t.match_length=z-1,t.strstart++,n&&(T(t,!1),0===t.strm.avail_out))return S}else if(t.match_available){if((n=o._tr_tally(t,0,t.window[t.strstart-1]))&&T(t,!1),t.strstart++,t.lookahead--,0===t.strm.avail_out)return S}else t.match_available=1,t.strstart++,t.lookahead--}return t.match_available&&(n=o._tr_tally(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<z-1?t.strstart:z-1,e===d?(T(t,!0),0===t.strm.avail_out?E:U):t.last_lit&&(T(t,!1),0===t.strm.avail_out)?S:j}function M(t,e,a,n,r){this.good_length=t,this.max_lazy=e,this.nice_length=a,this.max_chain=n,this.func=r}function P(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=v,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new u.Buf16(2*y),this.dyn_dtree=new u.Buf16(2*(2*s+1)),this.bl_tree=new u.Buf16(2*(2*h+1)),O(this.dyn_ltree),O(this.dyn_dtree),O(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new u.Buf16(k+1),this.heap=new u.Buf16(2*i+1),O(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new u.Buf16(2*i+1),O(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function G(t){var e;return t&&t.state?(t.total_in=t.total_out=0,t.data_type=r,(e=t.state).pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=e.wrap?A:C,t.adler=2===e.wrap?0:1,e.last_flush=_,o._tr_init(e),p):D(t,g)}function J(t){var e,a=G(t);return a===p&&((e=t.state).window_size=2*e.w_size,O(e.head),e.max_lazy_match=l[e.level].max_lazy,e.good_match=l[e.level].good_length,e.nice_match=l[e.level].nice_length,e.max_chain_length=l[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=z-1,e.match_available=0,e.ins_h=0),a}function Q(t,e,a,n,r,i){if(!t)return g;var s=1;if(e===m&&(e=6),n<0?(s=0,n=-n):15<n&&(s=2,n-=16),r<1||w<r||a!==v||n<8||15<n||e<0||9<e||i<0||b<i)return D(t,g);8===n&&(n=9);var h=new P;return(t.state=h).strm=t,h.wrap=s,h.gzhead=null,h.w_bits=n,h.w_size=1<<h.w_bits,h.w_mask=h.w_size-1,h.hash_bits=r+7,h.hash_size=1<<h.hash_bits,h.hash_mask=h.hash_size-1,h.hash_shift=~~((h.hash_bits+z-1)/z),h.window=new u.Buf8(2*h.w_size),h.head=new u.Buf16(h.hash_size),h.prev=new u.Buf16(h.w_size),h.lit_bufsize=1<<r+6,h.pending_buf_size=4*h.lit_bufsize,h.pending_buf=new u.Buf8(h.pending_buf_size),h.d_buf=1*h.lit_bufsize,h.l_buf=3*h.lit_bufsize,h.level=e,h.strategy=i,h.method=a,J(t)}l=[new M(0,0,0,0,function(t,e){var a=65535;for(a>t.pending_buf_size-5&&(a=t.pending_buf_size-5);;){if(t.lookahead<=1){if(H(t),0===t.lookahead&&e===_)return S;if(0===t.lookahead)break}t.strstart+=t.lookahead,t.lookahead=0;var n=t.block_start+a;if((0===t.strstart||t.strstart>=n)&&(t.lookahead=t.strstart-n,t.strstart=n,T(t,!1),0===t.strm.avail_out))return S;if(t.strstart-t.block_start>=t.w_size-B&&(T(t,!1),0===t.strm.avail_out))return S}return t.insert=0,e===d?(T(t,!0),0===t.strm.avail_out?E:U):(t.strstart>t.block_start&&(T(t,!1),t.strm.avail_out),S)}),new M(4,4,8,4,F),new M(4,5,16,8,F),new M(4,6,32,32,F),new M(4,4,16,16,K),new M(8,16,32,32,K),new M(8,16,128,128,K),new M(8,32,128,256,K),new M(32,128,258,1024,K),new M(32,258,258,4096,K)],a.deflateInit=function(t,e){return Q(t,e,v,15,8,0)},a.deflateInit2=Q,a.deflateReset=J,a.deflateResetKeep=G,a.deflateSetHeader=function(t,e){return t&&t.state?2!==t.state.wrap?g:(t.state.gzhead=e,p):g},a.deflate=function(t,e){var a,n,r,i;if(!t||!t.state||5<e||e<0)return t?D(t,g):g;if(n=t.state,!t.output||!t.input&&0!==t.avail_in||666===n.status&&e!==d)return D(t,0===t.avail_out?-5:g);if(n.strm=t,a=n.last_flush,n.last_flush=e,n.status===A)if(2===n.wrap)t.adler=0,L(n,31),L(n,139),L(n,8),n.gzhead?(L(n,(n.gzhead.text?1:0)+(n.gzhead.hcrc?2:0)+(n.gzhead.extra?4:0)+(n.gzhead.name?8:0)+(n.gzhead.comment?16:0)),L(n,255&n.gzhead.time),L(n,n.gzhead.time>>8&255),L(n,n.gzhead.time>>16&255),L(n,n.gzhead.time>>24&255),L(n,9===n.level?2:2<=n.strategy||n.level<2?4:0),L(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(L(n,255&n.gzhead.extra.length),L(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(t.adler=c(t.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=69):(L(n,0),L(n,0),L(n,0),L(n,0),L(n,0),L(n,9===n.level?2:2<=n.strategy||n.level<2?4:0),L(n,3),n.status=C);else{var s=v+(n.w_bits-8<<4)<<8;s|=(2<=n.strategy||n.level<2?0:n.level<6?1:6===n.level?2:3)<<6,0!==n.strstart&&(s|=32),s+=31-s%31,n.status=C,N(n,s),0!==n.strstart&&(N(n,t.adler>>>16),N(n,65535&t.adler)),t.adler=1}if(69===n.status)if(n.gzhead.extra){for(r=n.pending;n.gzindex<(65535&n.gzhead.extra.length)&&(n.pending!==n.pending_buf_size||(n.gzhead.hcrc&&n.pending>r&&(t.adler=c(t.adler,n.pending_buf,n.pending-r,r)),q(t),r=n.pending,n.pending!==n.pending_buf_size));)L(n,255&n.gzhead.extra[n.gzindex]),n.gzindex++;n.gzhead.hcrc&&n.pending>r&&(t.adler=c(t.adler,n.pending_buf,n.pending-r,r)),n.gzindex===n.gzhead.extra.length&&(n.gzindex=0,n.status=73)}else n.status=73;if(73===n.status)if(n.gzhead.name){r=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>r&&(t.adler=c(t.adler,n.pending_buf,n.pending-r,r)),q(t),r=n.pending,n.pending===n.pending_buf_size)){i=1;break}L(n,i=n.gzindex<n.gzhead.name.length?255&n.gzhead.name.charCodeAt(n.gzindex++):0)}while(0!==i);n.gzhead.hcrc&&n.pending>r&&(t.adler=c(t.adler,n.pending_buf,n.pending-r,r)),0===i&&(n.gzindex=0,n.status=91)}else n.status=91;if(91===n.status)if(n.gzhead.comment){r=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>r&&(t.adler=c(t.adler,n.pending_buf,n.pending-r,r)),q(t),r=n.pending,n.pending===n.pending_buf_size)){i=1;break}L(n,i=n.gzindex<n.gzhead.comment.length?255&n.gzhead.comment.charCodeAt(n.gzindex++):0)}while(0!==i);n.gzhead.hcrc&&n.pending>r&&(t.adler=c(t.adler,n.pending_buf,n.pending-r,r)),0===i&&(n.status=103)}else n.status=103;if(103===n.status&&(n.gzhead.hcrc?(n.pending+2>n.pending_buf_size&&q(t),n.pending+2<=n.pending_buf_size&&(L(n,255&t.adler),L(n,t.adler>>8&255),t.adler=0,n.status=C)):n.status=C),0!==n.pending){if(q(t),0===t.avail_out)return n.last_flush=-1,p}else if(0===t.avail_in&&I(e)<=I(a)&&e!==d)return D(t,-5);if(666===n.status&&0!==t.avail_in)return D(t,-5);if(0!==t.avail_in||0!==n.lookahead||e!==_&&666!==n.status){var h=2===n.strategy?function(t,e){for(var a;;){if(0===t.lookahead&&(H(t),0===t.lookahead)){if(e===_)return S;break}if(t.match_length=0,a=o._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,a&&(T(t,!1),0===t.strm.avail_out))return S}return t.insert=0,e===d?(T(t,!0),0===t.strm.avail_out?E:U):t.last_lit&&(T(t,!1),0===t.strm.avail_out)?S:j}(n,e):3===n.strategy?function(t,e){for(var a,n,r,i,s=t.window;;){if(t.lookahead<=x){if(H(t),t.lookahead<=x&&e===_)return S;if(0===t.lookahead)break}if(t.match_length=0,t.lookahead>=z&&0<t.strstart&&(n=s[r=t.strstart-1])===s[++r]&&n===s[++r]&&n===s[++r]){i=t.strstart+x;do{}while(n===s[++r]&&n===s[++r]&&n===s[++r]&&n===s[++r]&&n===s[++r]&&n===s[++r]&&n===s[++r]&&n===s[++r]&&r<i);t.match_length=x-(i-r),t.match_length>t.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=z?(a=o._tr_tally(t,1,t.match_length-z),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(a=o._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),a&&(T(t,!1),0===t.strm.avail_out))return S}return t.insert=0,e===d?(T(t,!0),0===t.strm.avail_out?E:U):t.last_lit&&(T(t,!1),0===t.strm.avail_out)?S:j}(n,e):l[n.level].func(n,e);if(h!==E&&h!==U||(n.status=666),h===S||h===E)return 0===t.avail_out&&(n.last_flush=-1),p;if(h===j&&(1===e?o._tr_align(n):5!==e&&(o._tr_stored_block(n,0,0,!1),3===e&&(O(n.head),0===n.lookahead&&(n.strstart=0,n.block_start=0,n.insert=0))),q(t),0===t.avail_out))return n.last_flush=-1,p}return e!==d?p:n.wrap<=0?1:(2===n.wrap?(L(n,255&t.adler),L(n,t.adler>>8&255),L(n,t.adler>>16&255),L(n,t.adler>>24&255),L(n,255&t.total_in),L(n,t.total_in>>8&255),L(n,t.total_in>>16&255),L(n,t.total_in>>24&255)):(N(n,t.adler>>>16),N(n,65535&t.adler)),q(t),0<n.wrap&&(n.wrap=-n.wrap),0!==n.pending?p:1)},a.deflateEnd=function(t){var e;return t&&t.state?(e=t.state.status)!==A&&69!==e&&73!==e&&91!==e&&103!==e&&e!==C&&666!==e?D(t,g):(t.state=null,e===C?D(t,-3):p):g},a.deflateSetDictionary=function(t,e){var a,n,r,i,s,h,l,o,_=e.length;if(!t||!t.state)return g;if(2===(i=(a=t.state).wrap)||1===i&&a.status!==A||a.lookahead)return g;for(1===i&&(t.adler=f(t.adler,e,_,0)),a.wrap=0,_>=a.w_size&&(0===i&&(O(a.head),a.strstart=0,a.block_start=0,a.insert=0),o=new u.Buf8(a.w_size),u.arraySet(o,e,_-a.w_size,a.w_size,0),e=o,_=a.w_size),s=t.avail_in,h=t.next_in,l=t.input,t.avail_in=_,t.next_in=0,t.input=e,H(a);a.lookahead>=z;){for(n=a.strstart,r=a.lookahead-(z-1);a.ins_h=(a.ins_h<<a.hash_shift^a.window[n+z-1])&a.hash_mask,a.prev[n&a.w_mask]=a.head[a.ins_h],a.head[a.ins_h]=n,n++,--r;);a.strstart=n,a.lookahead=z-1,H(a)}return a.strstart+=a.lookahead,a.block_start=a.strstart,a.insert=a.lookahead,a.lookahead=0,a.match_length=a.prev_length=z-1,a.match_available=0,t.next_in=h,t.input=l,t.avail_in=s,a.wrap=i,p},a.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":1,"./adler32":3,"./crc32":4,"./messages":6,"./trees":7}],6:[function(t,e,a){"use strict";e.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],7:[function(t,e,a){"use strict";var l=t("../utils/common"),h=0,o=1;function n(t){for(var e=t.length;0<=--e;)t[e]=0}var _=0,s=29,d=256,u=d+1+s,f=30,c=19,g=2*u+1,m=15,r=16,p=7,b=256,v=16,w=17,y=18,k=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],z=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],x=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],B=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],A=new Array(2*(u+2));n(A);var C=new Array(2*f);n(C);var S=new Array(512);n(S);var j=new Array(256);n(j);var E=new Array(s);n(E);var U,D,I,O=new Array(f);function q(t,e,a,n,r){this.static_tree=t,this.extra_bits=e,this.extra_base=a,this.elems=n,this.max_length=r,this.has_stree=t&&t.length}function i(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}function T(t){return t<256?S[t]:S[256+(t>>>7)]}function L(t,e){t.pending_buf[t.pending++]=255&e,t.pending_buf[t.pending++]=e>>>8&255}function N(t,e,a){t.bi_valid>r-a?(t.bi_buf|=e<<t.bi_valid&65535,L(t,t.bi_buf),t.bi_buf=e>>r-t.bi_valid,t.bi_valid+=a-r):(t.bi_buf|=e<<t.bi_valid&65535,t.bi_valid+=a)}function R(t,e,a){N(t,a[2*e],a[2*e+1])}function H(t,e){for(var a=0;a|=1&t,t>>>=1,a<<=1,0<--e;);return a>>>1}function F(t,e,a){var n,r,i=new Array(m+1),s=0;for(n=1;n<=m;n++)i[n]=s=s+a[n-1]<<1;for(r=0;r<=e;r++){var h=t[2*r+1];0!==h&&(t[2*r]=H(i[h]++,h))}}function K(t){var e;for(e=0;e<u;e++)t.dyn_ltree[2*e]=0;for(e=0;e<f;e++)t.dyn_dtree[2*e]=0;for(e=0;e<c;e++)t.bl_tree[2*e]=0;t.dyn_ltree[2*b]=1,t.opt_len=t.static_len=0,t.last_lit=t.matches=0}function M(t){8<t.bi_valid?L(t,t.bi_buf):0<t.bi_valid&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0}function P(t,e,a,n){var r=2*e,i=2*a;return t[r]<t[i]||t[r]===t[i]&&n[e]<=n[a]}function G(t,e,a){for(var n=t.heap[a],r=a<<1;r<=t.heap_len&&(r<t.heap_len&&P(e,t.heap[r+1],t.heap[r],t.depth)&&r++,!P(e,n,t.heap[r],t.depth));)t.heap[a]=t.heap[r],a=r,r<<=1;t.heap[a]=n}function J(t,e,a){var n,r,i,s,h=0;if(0!==t.last_lit)for(;n=t.pending_buf[t.d_buf+2*h]<<8|t.pending_buf[t.d_buf+2*h+1],r=t.pending_buf[t.l_buf+h],h++,0===n?R(t,r,e):(R(t,(i=j[r])+d+1,e),0!==(s=k[i])&&N(t,r-=E[i],s),R(t,i=T(--n),a),0!==(s=z[i])&&N(t,n-=O[i],s)),h<t.last_lit;);R(t,b,e)}function Q(t,e){var a,n,r,i=e.dyn_tree,s=e.stat_desc.static_tree,h=e.stat_desc.has_stree,l=e.stat_desc.elems,o=-1;for(t.heap_len=0,t.heap_max=g,a=0;a<l;a++)0!==i[2*a]?(t.heap[++t.heap_len]=o=a,t.depth[a]=0):i[2*a+1]=0;for(;t.heap_len<2;)i[2*(r=t.heap[++t.heap_len]=o<2?++o:0)]=1,t.depth[r]=0,t.opt_len--,h&&(t.static_len-=s[2*r+1]);for(e.max_code=o,a=t.heap_len>>1;1<=a;a--)G(t,i,a);for(r=l;a=t.heap[1],t.heap[1]=t.heap[t.heap_len--],G(t,i,1),n=t.heap[1],t.heap[--t.heap_max]=a,t.heap[--t.heap_max]=n,i[2*r]=i[2*a]+i[2*n],t.depth[r]=(t.depth[a]>=t.depth[n]?t.depth[a]:t.depth[n])+1,i[2*a+1]=i[2*n+1]=r,t.heap[1]=r++,G(t,i,1),2<=t.heap_len;);t.heap[--t.heap_max]=t.heap[1],function(t,e){var a,n,r,i,s,h,l=e.dyn_tree,o=e.max_code,_=e.stat_desc.static_tree,d=e.stat_desc.has_stree,u=e.stat_desc.extra_bits,f=e.stat_desc.extra_base,c=e.stat_desc.max_length,p=0;for(i=0;i<=m;i++)t.bl_count[i]=0;for(l[2*t.heap[t.heap_max]+1]=0,a=t.heap_max+1;a<g;a++)c<(i=l[2*l[2*(n=t.heap[a])+1]+1]+1)&&(i=c,p++),l[2*n+1]=i,o<n||(t.bl_count[i]++,s=0,f<=n&&(s=u[n-f]),h=l[2*n],t.opt_len+=h*(i+s),d&&(t.static_len+=h*(_[2*n+1]+s)));if(0!==p){do{for(i=c-1;0===t.bl_count[i];)i--;t.bl_count[i]--,t.bl_count[i+1]+=2,t.bl_count[c]--,p-=2}while(0<p);for(i=c;0!==i;i--)for(n=t.bl_count[i];0!==n;)o<(r=t.heap[--a])||(l[2*r+1]!==i&&(t.opt_len+=(i-l[2*r+1])*l[2*r],l[2*r+1]=i),n--)}}(t,e),F(i,o,t.bl_count)}function V(t,e,a){var n,r,i=-1,s=e[1],h=0,l=7,o=4;for(0===s&&(l=138,o=3),e[2*(a+1)+1]=65535,n=0;n<=a;n++)r=s,s=e[2*(n+1)+1],++h<l&&r===s||(h<o?t.bl_tree[2*r]+=h:0!==r?(r!==i&&t.bl_tree[2*r]++,t.bl_tree[2*v]++):h<=10?t.bl_tree[2*w]++:t.bl_tree[2*y]++,i=r,(h=0)===s?(l=138,o=3):r===s?(l=6,o=3):(l=7,o=4))}function W(t,e,a){var n,r,i=-1,s=e[1],h=0,l=7,o=4;for(0===s&&(l=138,o=3),n=0;n<=a;n++)if(r=s,s=e[2*(n+1)+1],!(++h<l&&r===s)){if(h<o)for(;R(t,r,t.bl_tree),0!=--h;);else 0!==r?(r!==i&&(R(t,r,t.bl_tree),h--),R(t,v,t.bl_tree),N(t,h-3,2)):h<=10?(R(t,w,t.bl_tree),N(t,h-3,3)):(R(t,y,t.bl_tree),N(t,h-11,7));i=r,(h=0)===s?(l=138,o=3):r===s?(l=6,o=3):(l=7,o=4)}}n(O);var X=!1;function Y(t,e,a,n){var r,i,s,h;N(t,(_<<1)+(n?1:0),3),i=e,s=a,h=!0,M(r=t),h&&(L(r,s),L(r,~s)),l.arraySet(r.pending_buf,r.window,i,s,r.pending),r.pending+=s}a._tr_init=function(t){X||(function(){var t,e,a,n,r,i=new Array(m+1);for(n=a=0;n<s-1;n++)for(E[n]=a,t=0;t<1<<k[n];t++)j[a++]=n;for(j[a-1]=n,n=r=0;n<16;n++)for(O[n]=r,t=0;t<1<<z[n];t++)S[r++]=n;for(r>>=7;n<f;n++)for(O[n]=r<<7,t=0;t<1<<z[n]-7;t++)S[256+r++]=n;for(e=0;e<=m;e++)i[e]=0;for(t=0;t<=143;)A[2*t+1]=8,t++,i[8]++;for(;t<=255;)A[2*t+1]=9,t++,i[9]++;for(;t<=279;)A[2*t+1]=7,t++,i[7]++;for(;t<=287;)A[2*t+1]=8,t++,i[8]++;for(F(A,u+1,i),t=0;t<f;t++)C[2*t+1]=5,C[2*t]=H(t,5);U=new q(A,k,d+1,u,m),D=new q(C,z,0,f,m),I=new q(new Array(0),x,0,c,p)}(),X=!0),t.l_desc=new i(t.dyn_ltree,U),t.d_desc=new i(t.dyn_dtree,D),t.bl_desc=new i(t.bl_tree,I),t.bi_buf=0,t.bi_valid=0,K(t)},a._tr_stored_block=Y,a._tr_flush_block=function(t,e,a,n){var r,i,s=0;0<t.level?(2===t.strm.data_type&&(t.strm.data_type=function(t){var e,a=4093624447;for(e=0;e<=31;e++,a>>>=1)if(1&a&&0!==t.dyn_ltree[2*e])return h;if(0!==t.dyn_ltree[18]||0!==t.dyn_ltree[20]||0!==t.dyn_ltree[26])return o;for(e=32;e<d;e++)if(0!==t.dyn_ltree[2*e])return o;return h}(t)),Q(t,t.l_desc),Q(t,t.d_desc),s=function(t){var e;for(V(t,t.dyn_ltree,t.l_desc.max_code),V(t,t.dyn_dtree,t.d_desc.max_code),Q(t,t.bl_desc),e=c-1;3<=e&&0===t.bl_tree[2*B[e]+1];e--);return t.opt_len+=3*(e+1)+5+5+4,e}(t),r=t.opt_len+3+7>>>3,(i=t.static_len+3+7>>>3)<=r&&(r=i)):r=i=a+5,a+4<=r&&-1!==e?Y(t,e,a,n):4===t.strategy||i===r?(N(t,2+(n?1:0),3),J(t,A,C)):(N(t,4+(n?1:0),3),function(t,e,a,n){var r;for(N(t,e-257,5),N(t,a-1,5),N(t,n-4,4),r=0;r<n;r++)N(t,t.bl_tree[2*B[r]+1],3);W(t,t.dyn_ltree,e-1),W(t,t.dyn_dtree,a-1)}(t,t.l_desc.max_code+1,t.d_desc.max_code+1,s+1),J(t,t.dyn_ltree,t.dyn_dtree)),K(t),n&&M(t)},a._tr_tally=function(t,e,a){return t.pending_buf[t.d_buf+2*t.last_lit]=e>>>8&255,t.pending_buf[t.d_buf+2*t.last_lit+1]=255&e,t.pending_buf[t.l_buf+t.last_lit]=255&a,t.last_lit++,0===e?t.dyn_ltree[2*a]++:(t.matches++,e--,t.dyn_ltree[2*(j[a]+d+1)]++,t.dyn_dtree[2*T(e)]++),t.last_lit===t.lit_bufsize-1},a._tr_align=function(t){var e;N(t,2,3),R(t,b,A),16===(e=t).bi_valid?(L(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):8<=e.bi_valid&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)}},{"../utils/common":1}],8:[function(t,e,a){"use strict";e.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],"/lib/deflate.js":[function(t,e,a){"use strict";var s=t("./zlib/deflate"),h=t("./utils/common"),l=t("./utils/strings"),r=t("./zlib/messages"),i=t("./zlib/zstream"),o=Object.prototype.toString,_=0,d=-1,u=0,f=8;function c(t){if(!(this instanceof c))return new c(t);this.options=h.assign({level:d,method:f,chunkSize:16384,windowBits:15,memLevel:8,strategy:u,to:""},t||{});var e=this.options;e.raw&&0<e.windowBits?e.windowBits=-e.windowBits:e.gzip&&0<e.windowBits&&e.windowBits<16&&(e.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new i,this.strm.avail_out=0;var a=s.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(a!==_)throw new Error(r[a]);if(e.header&&s.deflateSetHeader(this.strm,e.header),e.dictionary){var n;if(n="string"==typeof e.dictionary?l.string2buf(e.dictionary):"[object ArrayBuffer]"===o.call(e.dictionary)?new Uint8Array(e.dictionary):e.dictionary,(a=s.deflateSetDictionary(this.strm,n))!==_)throw new Error(r[a]);this._dict_set=!0}}function n(t,e){var a=new c(e);if(a.push(t,!0),a.err)throw a.msg||r[a.err];return a.result}c.prototype.push=function(t,e){var a,n,r=this.strm,i=this.options.chunkSize;if(this.ended)return!1;n=e===~~e?e:!0===e?4:0,"string"==typeof t?r.input=l.string2buf(t):"[object ArrayBuffer]"===o.call(t)?r.input=new Uint8Array(t):r.input=t,r.next_in=0,r.avail_in=r.input.length;do{if(0===r.avail_out&&(r.output=new h.Buf8(i),r.next_out=0,r.avail_out=i),1!==(a=s.deflate(r,n))&&a!==_)return this.onEnd(a),!(this.ended=!0);0!==r.avail_out&&(0!==r.avail_in||4!==n&&2!==n)||("string"===this.options.to?this.onData(l.buf2binstring(h.shrinkBuf(r.output,r.next_out))):this.onData(h.shrinkBuf(r.output,r.next_out)))}while((0<r.avail_in||0===r.avail_out)&&1!==a);return 4===n?(a=s.deflateEnd(this.strm),this.onEnd(a),this.ended=!0,a===_):2!==n||(this.onEnd(_),!(r.avail_out=0))},c.prototype.onData=function(t){this.chunks.push(t)},c.prototype.onEnd=function(t){t===_&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=h.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg},a.Deflate=c,a.deflate=n,a.deflateRaw=function(t,e){return(e=e||{}).raw=!0,n(t,e)},a.gzip=function(t,e){return(e=e||{}).gzip=!0,n(t,e)}},{"./utils/common":1,"./utils/strings":2,"./zlib/deflate":5,"./zlib/messages":6,"./zlib/zstream":8}]},{},[])("/lib/deflate.js")});
@@ -1,3300 +0,0 @@
1
- /* pako 1.0.11 nodeca/pako */(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.pako = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
2
- 'use strict';
3
-
4
-
5
- var TYPED_OK = (typeof Uint8Array !== 'undefined') &&
6
- (typeof Uint16Array !== 'undefined') &&
7
- (typeof Int32Array !== 'undefined');
8
-
9
- function _has(obj, key) {
10
- return Object.prototype.hasOwnProperty.call(obj, key);
11
- }
12
-
13
- exports.assign = function (obj /*from1, from2, from3, ...*/) {
14
- var sources = Array.prototype.slice.call(arguments, 1);
15
- while (sources.length) {
16
- var source = sources.shift();
17
- if (!source) { continue; }
18
-
19
- if (typeof source !== 'object') {
20
- throw new TypeError(source + 'must be non-object');
21
- }
22
-
23
- for (var p in source) {
24
- if (_has(source, p)) {
25
- obj[p] = source[p];
26
- }
27
- }
28
- }
29
-
30
- return obj;
31
- };
32
-
33
-
34
- // reduce buffer size, avoiding mem copy
35
- exports.shrinkBuf = function (buf, size) {
36
- if (buf.length === size) { return buf; }
37
- if (buf.subarray) { return buf.subarray(0, size); }
38
- buf.length = size;
39
- return buf;
40
- };
41
-
42
-
43
- var fnTyped = {
44
- arraySet: function (dest, src, src_offs, len, dest_offs) {
45
- if (src.subarray && dest.subarray) {
46
- dest.set(src.subarray(src_offs, src_offs + len), dest_offs);
47
- return;
48
- }
49
- // Fallback to ordinary array
50
- for (var i = 0; i < len; i++) {
51
- dest[dest_offs + i] = src[src_offs + i];
52
- }
53
- },
54
- // Join array of chunks to single array.
55
- flattenChunks: function (chunks) {
56
- var i, l, len, pos, chunk, result;
57
-
58
- // calculate data length
59
- len = 0;
60
- for (i = 0, l = chunks.length; i < l; i++) {
61
- len += chunks[i].length;
62
- }
63
-
64
- // join chunks
65
- result = new Uint8Array(len);
66
- pos = 0;
67
- for (i = 0, l = chunks.length; i < l; i++) {
68
- chunk = chunks[i];
69
- result.set(chunk, pos);
70
- pos += chunk.length;
71
- }
72
-
73
- return result;
74
- }
75
- };
76
-
77
- var fnUntyped = {
78
- arraySet: function (dest, src, src_offs, len, dest_offs) {
79
- for (var i = 0; i < len; i++) {
80
- dest[dest_offs + i] = src[src_offs + i];
81
- }
82
- },
83
- // Join array of chunks to single array.
84
- flattenChunks: function (chunks) {
85
- return [].concat.apply([], chunks);
86
- }
87
- };
88
-
89
-
90
- // Enable/Disable typed arrays use, for testing
91
- //
92
- exports.setTyped = function (on) {
93
- if (on) {
94
- exports.Buf8 = Uint8Array;
95
- exports.Buf16 = Uint16Array;
96
- exports.Buf32 = Int32Array;
97
- exports.assign(exports, fnTyped);
98
- } else {
99
- exports.Buf8 = Array;
100
- exports.Buf16 = Array;
101
- exports.Buf32 = Array;
102
- exports.assign(exports, fnUntyped);
103
- }
104
- };
105
-
106
- exports.setTyped(TYPED_OK);
107
-
108
- },{}],2:[function(require,module,exports){
109
- // String encode/decode helpers
110
- 'use strict';
111
-
112
-
113
- var utils = require('./common');
114
-
115
-
116
- // Quick check if we can use fast array to bin string conversion
117
- //
118
- // - apply(Array) can fail on Android 2.2
119
- // - apply(Uint8Array) can fail on iOS 5.1 Safari
120
- //
121
- var STR_APPLY_OK = true;
122
- var STR_APPLY_UIA_OK = true;
123
-
124
- try { String.fromCharCode.apply(null, [ 0 ]); } catch (__) { STR_APPLY_OK = false; }
125
- try { String.fromCharCode.apply(null, new Uint8Array(1)); } catch (__) { STR_APPLY_UIA_OK = false; }
126
-
127
-
128
- // Table with utf8 lengths (calculated by first byte of sequence)
129
- // Note, that 5 & 6-byte values and some 4-byte values can not be represented in JS,
130
- // because max possible codepoint is 0x10ffff
131
- var _utf8len = new utils.Buf8(256);
132
- for (var q = 0; q < 256; q++) {
133
- _utf8len[q] = (q >= 252 ? 6 : q >= 248 ? 5 : q >= 240 ? 4 : q >= 224 ? 3 : q >= 192 ? 2 : 1);
134
- }
135
- _utf8len[254] = _utf8len[254] = 1; // Invalid sequence start
136
-
137
-
138
- // convert string to array (typed, when possible)
139
- exports.string2buf = function (str) {
140
- var buf, c, c2, m_pos, i, str_len = str.length, buf_len = 0;
141
-
142
- // count binary size
143
- for (m_pos = 0; m_pos < str_len; m_pos++) {
144
- c = str.charCodeAt(m_pos);
145
- if ((c & 0xfc00) === 0xd800 && (m_pos + 1 < str_len)) {
146
- c2 = str.charCodeAt(m_pos + 1);
147
- if ((c2 & 0xfc00) === 0xdc00) {
148
- c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00);
149
- m_pos++;
150
- }
151
- }
152
- buf_len += c < 0x80 ? 1 : c < 0x800 ? 2 : c < 0x10000 ? 3 : 4;
153
- }
154
-
155
- // allocate buffer
156
- buf = new utils.Buf8(buf_len);
157
-
158
- // convert
159
- for (i = 0, m_pos = 0; i < buf_len; m_pos++) {
160
- c = str.charCodeAt(m_pos);
161
- if ((c & 0xfc00) === 0xd800 && (m_pos + 1 < str_len)) {
162
- c2 = str.charCodeAt(m_pos + 1);
163
- if ((c2 & 0xfc00) === 0xdc00) {
164
- c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00);
165
- m_pos++;
166
- }
167
- }
168
- if (c < 0x80) {
169
- /* one byte */
170
- buf[i++] = c;
171
- } else if (c < 0x800) {
172
- /* two bytes */
173
- buf[i++] = 0xC0 | (c >>> 6);
174
- buf[i++] = 0x80 | (c & 0x3f);
175
- } else if (c < 0x10000) {
176
- /* three bytes */
177
- buf[i++] = 0xE0 | (c >>> 12);
178
- buf[i++] = 0x80 | (c >>> 6 & 0x3f);
179
- buf[i++] = 0x80 | (c & 0x3f);
180
- } else {
181
- /* four bytes */
182
- buf[i++] = 0xf0 | (c >>> 18);
183
- buf[i++] = 0x80 | (c >>> 12 & 0x3f);
184
- buf[i++] = 0x80 | (c >>> 6 & 0x3f);
185
- buf[i++] = 0x80 | (c & 0x3f);
186
- }
187
- }
188
-
189
- return buf;
190
- };
191
-
192
- // Helper (used in 2 places)
193
- function buf2binstring(buf, len) {
194
- // On Chrome, the arguments in a function call that are allowed is `65534`.
195
- // If the length of the buffer is smaller than that, we can use this optimization,
196
- // otherwise we will take a slower path.
197
- if (len < 65534) {
198
- if ((buf.subarray && STR_APPLY_UIA_OK) || (!buf.subarray && STR_APPLY_OK)) {
199
- return String.fromCharCode.apply(null, utils.shrinkBuf(buf, len));
200
- }
201
- }
202
-
203
- var result = '';
204
- for (var i = 0; i < len; i++) {
205
- result += String.fromCharCode(buf[i]);
206
- }
207
- return result;
208
- }
209
-
210
-
211
- // Convert byte array to binary string
212
- exports.buf2binstring = function (buf) {
213
- return buf2binstring(buf, buf.length);
214
- };
215
-
216
-
217
- // Convert binary string (typed, when possible)
218
- exports.binstring2buf = function (str) {
219
- var buf = new utils.Buf8(str.length);
220
- for (var i = 0, len = buf.length; i < len; i++) {
221
- buf[i] = str.charCodeAt(i);
222
- }
223
- return buf;
224
- };
225
-
226
-
227
- // convert array to string
228
- exports.buf2string = function (buf, max) {
229
- var i, out, c, c_len;
230
- var len = max || buf.length;
231
-
232
- // Reserve max possible length (2 words per char)
233
- // NB: by unknown reasons, Array is significantly faster for
234
- // String.fromCharCode.apply than Uint16Array.
235
- var utf16buf = new Array(len * 2);
236
-
237
- for (out = 0, i = 0; i < len;) {
238
- c = buf[i++];
239
- // quick process ascii
240
- if (c < 0x80) { utf16buf[out++] = c; continue; }
241
-
242
- c_len = _utf8len[c];
243
- // skip 5 & 6 byte codes
244
- if (c_len > 4) { utf16buf[out++] = 0xfffd; i += c_len - 1; continue; }
245
-
246
- // apply mask on first byte
247
- c &= c_len === 2 ? 0x1f : c_len === 3 ? 0x0f : 0x07;
248
- // join the rest
249
- while (c_len > 1 && i < len) {
250
- c = (c << 6) | (buf[i++] & 0x3f);
251
- c_len--;
252
- }
253
-
254
- // terminated by end of string?
255
- if (c_len > 1) { utf16buf[out++] = 0xfffd; continue; }
256
-
257
- if (c < 0x10000) {
258
- utf16buf[out++] = c;
259
- } else {
260
- c -= 0x10000;
261
- utf16buf[out++] = 0xd800 | ((c >> 10) & 0x3ff);
262
- utf16buf[out++] = 0xdc00 | (c & 0x3ff);
263
- }
264
- }
265
-
266
- return buf2binstring(utf16buf, out);
267
- };
268
-
269
-
270
- // Calculate max possible position in utf8 buffer,
271
- // that will not break sequence. If that's not possible
272
- // - (very small limits) return max size as is.
273
- //
274
- // buf[] - utf8 bytes array
275
- // max - length limit (mandatory);
276
- exports.utf8border = function (buf, max) {
277
- var pos;
278
-
279
- max = max || buf.length;
280
- if (max > buf.length) { max = buf.length; }
281
-
282
- // go back from last position, until start of sequence found
283
- pos = max - 1;
284
- while (pos >= 0 && (buf[pos] & 0xC0) === 0x80) { pos--; }
285
-
286
- // Very small and broken sequence,
287
- // return max, because we should return something anyway.
288
- if (pos < 0) { return max; }
289
-
290
- // If we came to start of buffer - that means buffer is too small,
291
- // return max too.
292
- if (pos === 0) { return max; }
293
-
294
- return (pos + _utf8len[buf[pos]] > max) ? pos : max;
295
- };
296
-
297
- },{"./common":1}],3:[function(require,module,exports){
298
- 'use strict';
299
-
300
- // Note: adler32 takes 12% for level 0 and 2% for level 6.
301
- // It isn't worth it to make additional optimizations as in original.
302
- // Small size is preferable.
303
-
304
- // (C) 1995-2013 Jean-loup Gailly and Mark Adler
305
- // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin
306
- //
307
- // This software is provided 'as-is', without any express or implied
308
- // warranty. In no event will the authors be held liable for any damages
309
- // arising from the use of this software.
310
- //
311
- // Permission is granted to anyone to use this software for any purpose,
312
- // including commercial applications, and to alter it and redistribute it
313
- // freely, subject to the following restrictions:
314
- //
315
- // 1. The origin of this software must not be misrepresented; you must not
316
- // claim that you wrote the original software. If you use this software
317
- // in a product, an acknowledgment in the product documentation would be
318
- // appreciated but is not required.
319
- // 2. Altered source versions must be plainly marked as such, and must not be
320
- // misrepresented as being the original software.
321
- // 3. This notice may not be removed or altered from any source distribution.
322
-
323
- function adler32(adler, buf, len, pos) {
324
- var s1 = (adler & 0xffff) |0,
325
- s2 = ((adler >>> 16) & 0xffff) |0,
326
- n = 0;
327
-
328
- while (len !== 0) {
329
- // Set limit ~ twice less than 5552, to keep
330
- // s2 in 31-bits, because we force signed ints.
331
- // in other case %= will fail.
332
- n = len > 2000 ? 2000 : len;
333
- len -= n;
334
-
335
- do {
336
- s1 = (s1 + buf[pos++]) |0;
337
- s2 = (s2 + s1) |0;
338
- } while (--n);
339
-
340
- s1 %= 65521;
341
- s2 %= 65521;
342
- }
343
-
344
- return (s1 | (s2 << 16)) |0;
345
- }
346
-
347
-
348
- module.exports = adler32;
349
-
350
- },{}],4:[function(require,module,exports){
351
- 'use strict';
352
-
353
- // (C) 1995-2013 Jean-loup Gailly and Mark Adler
354
- // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin
355
- //
356
- // This software is provided 'as-is', without any express or implied
357
- // warranty. In no event will the authors be held liable for any damages
358
- // arising from the use of this software.
359
- //
360
- // Permission is granted to anyone to use this software for any purpose,
361
- // including commercial applications, and to alter it and redistribute it
362
- // freely, subject to the following restrictions:
363
- //
364
- // 1. The origin of this software must not be misrepresented; you must not
365
- // claim that you wrote the original software. If you use this software
366
- // in a product, an acknowledgment in the product documentation would be
367
- // appreciated but is not required.
368
- // 2. Altered source versions must be plainly marked as such, and must not be
369
- // misrepresented as being the original software.
370
- // 3. This notice may not be removed or altered from any source distribution.
371
-
372
- module.exports = {
373
-
374
- /* Allowed flush values; see deflate() and inflate() below for details */
375
- Z_NO_FLUSH: 0,
376
- Z_PARTIAL_FLUSH: 1,
377
- Z_SYNC_FLUSH: 2,
378
- Z_FULL_FLUSH: 3,
379
- Z_FINISH: 4,
380
- Z_BLOCK: 5,
381
- Z_TREES: 6,
382
-
383
- /* Return codes for the compression/decompression functions. Negative values
384
- * are errors, positive values are used for special but normal events.
385
- */
386
- Z_OK: 0,
387
- Z_STREAM_END: 1,
388
- Z_NEED_DICT: 2,
389
- Z_ERRNO: -1,
390
- Z_STREAM_ERROR: -2,
391
- Z_DATA_ERROR: -3,
392
- //Z_MEM_ERROR: -4,
393
- Z_BUF_ERROR: -5,
394
- //Z_VERSION_ERROR: -6,
395
-
396
- /* compression levels */
397
- Z_NO_COMPRESSION: 0,
398
- Z_BEST_SPEED: 1,
399
- Z_BEST_COMPRESSION: 9,
400
- Z_DEFAULT_COMPRESSION: -1,
401
-
402
-
403
- Z_FILTERED: 1,
404
- Z_HUFFMAN_ONLY: 2,
405
- Z_RLE: 3,
406
- Z_FIXED: 4,
407
- Z_DEFAULT_STRATEGY: 0,
408
-
409
- /* Possible values of the data_type field (though see inflate()) */
410
- Z_BINARY: 0,
411
- Z_TEXT: 1,
412
- //Z_ASCII: 1, // = Z_TEXT (deprecated)
413
- Z_UNKNOWN: 2,
414
-
415
- /* The deflate compression method */
416
- Z_DEFLATED: 8
417
- //Z_NULL: null // Use -1 or null inline, depending on var type
418
- };
419
-
420
- },{}],5:[function(require,module,exports){
421
- 'use strict';
422
-
423
- // Note: we can't get significant speed boost here.
424
- // So write code to minimize size - no pregenerated tables
425
- // and array tools dependencies.
426
-
427
- // (C) 1995-2013 Jean-loup Gailly and Mark Adler
428
- // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin
429
- //
430
- // This software is provided 'as-is', without any express or implied
431
- // warranty. In no event will the authors be held liable for any damages
432
- // arising from the use of this software.
433
- //
434
- // Permission is granted to anyone to use this software for any purpose,
435
- // including commercial applications, and to alter it and redistribute it
436
- // freely, subject to the following restrictions:
437
- //
438
- // 1. The origin of this software must not be misrepresented; you must not
439
- // claim that you wrote the original software. If you use this software
440
- // in a product, an acknowledgment in the product documentation would be
441
- // appreciated but is not required.
442
- // 2. Altered source versions must be plainly marked as such, and must not be
443
- // misrepresented as being the original software.
444
- // 3. This notice may not be removed or altered from any source distribution.
445
-
446
- // Use ordinary array, since untyped makes no boost here
447
- function makeTable() {
448
- var c, table = [];
449
-
450
- for (var n = 0; n < 256; n++) {
451
- c = n;
452
- for (var k = 0; k < 8; k++) {
453
- c = ((c & 1) ? (0xEDB88320 ^ (c >>> 1)) : (c >>> 1));
454
- }
455
- table[n] = c;
456
- }
457
-
458
- return table;
459
- }
460
-
461
- // Create table on load. Just 255 signed longs. Not a problem.
462
- var crcTable = makeTable();
463
-
464
-
465
- function crc32(crc, buf, len, pos) {
466
- var t = crcTable,
467
- end = pos + len;
468
-
469
- crc ^= -1;
470
-
471
- for (var i = pos; i < end; i++) {
472
- crc = (crc >>> 8) ^ t[(crc ^ buf[i]) & 0xFF];
473
- }
474
-
475
- return (crc ^ (-1)); // >>> 0;
476
- }
477
-
478
-
479
- module.exports = crc32;
480
-
481
- },{}],6:[function(require,module,exports){
482
- 'use strict';
483
-
484
- // (C) 1995-2013 Jean-loup Gailly and Mark Adler
485
- // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin
486
- //
487
- // This software is provided 'as-is', without any express or implied
488
- // warranty. In no event will the authors be held liable for any damages
489
- // arising from the use of this software.
490
- //
491
- // Permission is granted to anyone to use this software for any purpose,
492
- // including commercial applications, and to alter it and redistribute it
493
- // freely, subject to the following restrictions:
494
- //
495
- // 1. The origin of this software must not be misrepresented; you must not
496
- // claim that you wrote the original software. If you use this software
497
- // in a product, an acknowledgment in the product documentation would be
498
- // appreciated but is not required.
499
- // 2. Altered source versions must be plainly marked as such, and must not be
500
- // misrepresented as being the original software.
501
- // 3. This notice may not be removed or altered from any source distribution.
502
-
503
- function GZheader() {
504
- /* true if compressed data believed to be text */
505
- this.text = 0;
506
- /* modification time */
507
- this.time = 0;
508
- /* extra flags (not used when writing a gzip file) */
509
- this.xflags = 0;
510
- /* operating system */
511
- this.os = 0;
512
- /* pointer to extra field or Z_NULL if none */
513
- this.extra = null;
514
- /* extra field length (valid if extra != Z_NULL) */
515
- this.extra_len = 0; // Actually, we don't need it in JS,
516
- // but leave for few code modifications
517
-
518
- //
519
- // Setup limits is not necessary because in js we should not preallocate memory
520
- // for inflate use constant limit in 65536 bytes
521
- //
522
-
523
- /* space at extra (only when reading header) */
524
- // this.extra_max = 0;
525
- /* pointer to zero-terminated file name or Z_NULL */
526
- this.name = '';
527
- /* space at name (only when reading header) */
528
- // this.name_max = 0;
529
- /* pointer to zero-terminated comment or Z_NULL */
530
- this.comment = '';
531
- /* space at comment (only when reading header) */
532
- // this.comm_max = 0;
533
- /* true if there was or will be a header crc */
534
- this.hcrc = 0;
535
- /* true when done reading gzip header (not used when writing a gzip file) */
536
- this.done = false;
537
- }
538
-
539
- module.exports = GZheader;
540
-
541
- },{}],7:[function(require,module,exports){
542
- 'use strict';
543
-
544
- // (C) 1995-2013 Jean-loup Gailly and Mark Adler
545
- // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin
546
- //
547
- // This software is provided 'as-is', without any express or implied
548
- // warranty. In no event will the authors be held liable for any damages
549
- // arising from the use of this software.
550
- //
551
- // Permission is granted to anyone to use this software for any purpose,
552
- // including commercial applications, and to alter it and redistribute it
553
- // freely, subject to the following restrictions:
554
- //
555
- // 1. The origin of this software must not be misrepresented; you must not
556
- // claim that you wrote the original software. If you use this software
557
- // in a product, an acknowledgment in the product documentation would be
558
- // appreciated but is not required.
559
- // 2. Altered source versions must be plainly marked as such, and must not be
560
- // misrepresented as being the original software.
561
- // 3. This notice may not be removed or altered from any source distribution.
562
-
563
- // See state defs from inflate.js
564
- var BAD = 30; /* got a data error -- remain here until reset */
565
- var TYPE = 12; /* i: waiting for type bits, including last-flag bit */
566
-
567
- /*
568
- Decode literal, length, and distance codes and write out the resulting
569
- literal and match bytes until either not enough input or output is
570
- available, an end-of-block is encountered, or a data error is encountered.
571
- When large enough input and output buffers are supplied to inflate(), for
572
- example, a 16K input buffer and a 64K output buffer, more than 95% of the
573
- inflate execution time is spent in this routine.
574
-
575
- Entry assumptions:
576
-
577
- state.mode === LEN
578
- strm.avail_in >= 6
579
- strm.avail_out >= 258
580
- start >= strm.avail_out
581
- state.bits < 8
582
-
583
- On return, state.mode is one of:
584
-
585
- LEN -- ran out of enough output space or enough available input
586
- TYPE -- reached end of block code, inflate() to interpret next block
587
- BAD -- error in block data
588
-
589
- Notes:
590
-
591
- - The maximum input bits used by a length/distance pair is 15 bits for the
592
- length code, 5 bits for the length extra, 15 bits for the distance code,
593
- and 13 bits for the distance extra. This totals 48 bits, or six bytes.
594
- Therefore if strm.avail_in >= 6, then there is enough input to avoid
595
- checking for available input while decoding.
596
-
597
- - The maximum bytes that a single length/distance pair can output is 258
598
- bytes, which is the maximum length that can be coded. inflate_fast()
599
- requires strm.avail_out >= 258 for each loop to avoid checking for
600
- output space.
601
- */
602
- module.exports = function inflate_fast(strm, start) {
603
- var state;
604
- var _in; /* local strm.input */
605
- var last; /* have enough input while in < last */
606
- var _out; /* local strm.output */
607
- var beg; /* inflate()'s initial strm.output */
608
- var end; /* while out < end, enough space available */
609
- //#ifdef INFLATE_STRICT
610
- var dmax; /* maximum distance from zlib header */
611
- //#endif
612
- var wsize; /* window size or zero if not using window */
613
- var whave; /* valid bytes in the window */
614
- var wnext; /* window write index */
615
- // Use `s_window` instead `window`, avoid conflict with instrumentation tools
616
- var s_window; /* allocated sliding window, if wsize != 0 */
617
- var hold; /* local strm.hold */
618
- var bits; /* local strm.bits */
619
- var lcode; /* local strm.lencode */
620
- var dcode; /* local strm.distcode */
621
- var lmask; /* mask for first level of length codes */
622
- var dmask; /* mask for first level of distance codes */
623
- var here; /* retrieved table entry */
624
- var op; /* code bits, operation, extra bits, or */
625
- /* window position, window bytes to copy */
626
- var len; /* match length, unused bytes */
627
- var dist; /* match distance */
628
- var from; /* where to copy match from */
629
- var from_source;
630
-
631
-
632
- var input, output; // JS specific, because we have no pointers
633
-
634
- /* copy state to local variables */
635
- state = strm.state;
636
- //here = state.here;
637
- _in = strm.next_in;
638
- input = strm.input;
639
- last = _in + (strm.avail_in - 5);
640
- _out = strm.next_out;
641
- output = strm.output;
642
- beg = _out - (start - strm.avail_out);
643
- end = _out + (strm.avail_out - 257);
644
- //#ifdef INFLATE_STRICT
645
- dmax = state.dmax;
646
- //#endif
647
- wsize = state.wsize;
648
- whave = state.whave;
649
- wnext = state.wnext;
650
- s_window = state.window;
651
- hold = state.hold;
652
- bits = state.bits;
653
- lcode = state.lencode;
654
- dcode = state.distcode;
655
- lmask = (1 << state.lenbits) - 1;
656
- dmask = (1 << state.distbits) - 1;
657
-
658
-
659
- /* decode literals and length/distances until end-of-block or not enough
660
- input data or output space */
661
-
662
- top:
663
- do {
664
- if (bits < 15) {
665
- hold += input[_in++] << bits;
666
- bits += 8;
667
- hold += input[_in++] << bits;
668
- bits += 8;
669
- }
670
-
671
- here = lcode[hold & lmask];
672
-
673
- dolen:
674
- for (;;) { // Goto emulation
675
- op = here >>> 24/*here.bits*/;
676
- hold >>>= op;
677
- bits -= op;
678
- op = (here >>> 16) & 0xff/*here.op*/;
679
- if (op === 0) { /* literal */
680
- //Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?
681
- // "inflate: literal '%c'\n" :
682
- // "inflate: literal 0x%02x\n", here.val));
683
- output[_out++] = here & 0xffff/*here.val*/;
684
- }
685
- else if (op & 16) { /* length base */
686
- len = here & 0xffff/*here.val*/;
687
- op &= 15; /* number of extra bits */
688
- if (op) {
689
- if (bits < op) {
690
- hold += input[_in++] << bits;
691
- bits += 8;
692
- }
693
- len += hold & ((1 << op) - 1);
694
- hold >>>= op;
695
- bits -= op;
696
- }
697
- //Tracevv((stderr, "inflate: length %u\n", len));
698
- if (bits < 15) {
699
- hold += input[_in++] << bits;
700
- bits += 8;
701
- hold += input[_in++] << bits;
702
- bits += 8;
703
- }
704
- here = dcode[hold & dmask];
705
-
706
- dodist:
707
- for (;;) { // goto emulation
708
- op = here >>> 24/*here.bits*/;
709
- hold >>>= op;
710
- bits -= op;
711
- op = (here >>> 16) & 0xff/*here.op*/;
712
-
713
- if (op & 16) { /* distance base */
714
- dist = here & 0xffff/*here.val*/;
715
- op &= 15; /* number of extra bits */
716
- if (bits < op) {
717
- hold += input[_in++] << bits;
718
- bits += 8;
719
- if (bits < op) {
720
- hold += input[_in++] << bits;
721
- bits += 8;
722
- }
723
- }
724
- dist += hold & ((1 << op) - 1);
725
- //#ifdef INFLATE_STRICT
726
- if (dist > dmax) {
727
- strm.msg = 'invalid distance too far back';
728
- state.mode = BAD;
729
- break top;
730
- }
731
- //#endif
732
- hold >>>= op;
733
- bits -= op;
734
- //Tracevv((stderr, "inflate: distance %u\n", dist));
735
- op = _out - beg; /* max distance in output */
736
- if (dist > op) { /* see if copy from window */
737
- op = dist - op; /* distance back in window */
738
- if (op > whave) {
739
- if (state.sane) {
740
- strm.msg = 'invalid distance too far back';
741
- state.mode = BAD;
742
- break top;
743
- }
744
-
745
- // (!) This block is disabled in zlib defaults,
746
- // don't enable it for binary compatibility
747
- //#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR
748
- // if (len <= op - whave) {
749
- // do {
750
- // output[_out++] = 0;
751
- // } while (--len);
752
- // continue top;
753
- // }
754
- // len -= op - whave;
755
- // do {
756
- // output[_out++] = 0;
757
- // } while (--op > whave);
758
- // if (op === 0) {
759
- // from = _out - dist;
760
- // do {
761
- // output[_out++] = output[from++];
762
- // } while (--len);
763
- // continue top;
764
- // }
765
- //#endif
766
- }
767
- from = 0; // window index
768
- from_source = s_window;
769
- if (wnext === 0) { /* very common case */
770
- from += wsize - op;
771
- if (op < len) { /* some from window */
772
- len -= op;
773
- do {
774
- output[_out++] = s_window[from++];
775
- } while (--op);
776
- from = _out - dist; /* rest from output */
777
- from_source = output;
778
- }
779
- }
780
- else if (wnext < op) { /* wrap around window */
781
- from += wsize + wnext - op;
782
- op -= wnext;
783
- if (op < len) { /* some from end of window */
784
- len -= op;
785
- do {
786
- output[_out++] = s_window[from++];
787
- } while (--op);
788
- from = 0;
789
- if (wnext < len) { /* some from start of window */
790
- op = wnext;
791
- len -= op;
792
- do {
793
- output[_out++] = s_window[from++];
794
- } while (--op);
795
- from = _out - dist; /* rest from output */
796
- from_source = output;
797
- }
798
- }
799
- }
800
- else { /* contiguous in window */
801
- from += wnext - op;
802
- if (op < len) { /* some from window */
803
- len -= op;
804
- do {
805
- output[_out++] = s_window[from++];
806
- } while (--op);
807
- from = _out - dist; /* rest from output */
808
- from_source = output;
809
- }
810
- }
811
- while (len > 2) {
812
- output[_out++] = from_source[from++];
813
- output[_out++] = from_source[from++];
814
- output[_out++] = from_source[from++];
815
- len -= 3;
816
- }
817
- if (len) {
818
- output[_out++] = from_source[from++];
819
- if (len > 1) {
820
- output[_out++] = from_source[from++];
821
- }
822
- }
823
- }
824
- else {
825
- from = _out - dist; /* copy direct from output */
826
- do { /* minimum length is three */
827
- output[_out++] = output[from++];
828
- output[_out++] = output[from++];
829
- output[_out++] = output[from++];
830
- len -= 3;
831
- } while (len > 2);
832
- if (len) {
833
- output[_out++] = output[from++];
834
- if (len > 1) {
835
- output[_out++] = output[from++];
836
- }
837
- }
838
- }
839
- }
840
- else if ((op & 64) === 0) { /* 2nd level distance code */
841
- here = dcode[(here & 0xffff)/*here.val*/ + (hold & ((1 << op) - 1))];
842
- continue dodist;
843
- }
844
- else {
845
- strm.msg = 'invalid distance code';
846
- state.mode = BAD;
847
- break top;
848
- }
849
-
850
- break; // need to emulate goto via "continue"
851
- }
852
- }
853
- else if ((op & 64) === 0) { /* 2nd level length code */
854
- here = lcode[(here & 0xffff)/*here.val*/ + (hold & ((1 << op) - 1))];
855
- continue dolen;
856
- }
857
- else if (op & 32) { /* end-of-block */
858
- //Tracevv((stderr, "inflate: end of block\n"));
859
- state.mode = TYPE;
860
- break top;
861
- }
862
- else {
863
- strm.msg = 'invalid literal/length code';
864
- state.mode = BAD;
865
- break top;
866
- }
867
-
868
- break; // need to emulate goto via "continue"
869
- }
870
- } while (_in < last && _out < end);
871
-
872
- /* return unused bytes (on entry, bits < 8, so in won't go too far back) */
873
- len = bits >> 3;
874
- _in -= len;
875
- bits -= len << 3;
876
- hold &= (1 << bits) - 1;
877
-
878
- /* update state and return */
879
- strm.next_in = _in;
880
- strm.next_out = _out;
881
- strm.avail_in = (_in < last ? 5 + (last - _in) : 5 - (_in - last));
882
- strm.avail_out = (_out < end ? 257 + (end - _out) : 257 - (_out - end));
883
- state.hold = hold;
884
- state.bits = bits;
885
- return;
886
- };
887
-
888
- },{}],8:[function(require,module,exports){
889
- 'use strict';
890
-
891
- // (C) 1995-2013 Jean-loup Gailly and Mark Adler
892
- // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin
893
- //
894
- // This software is provided 'as-is', without any express or implied
895
- // warranty. In no event will the authors be held liable for any damages
896
- // arising from the use of this software.
897
- //
898
- // Permission is granted to anyone to use this software for any purpose,
899
- // including commercial applications, and to alter it and redistribute it
900
- // freely, subject to the following restrictions:
901
- //
902
- // 1. The origin of this software must not be misrepresented; you must not
903
- // claim that you wrote the original software. If you use this software
904
- // in a product, an acknowledgment in the product documentation would be
905
- // appreciated but is not required.
906
- // 2. Altered source versions must be plainly marked as such, and must not be
907
- // misrepresented as being the original software.
908
- // 3. This notice may not be removed or altered from any source distribution.
909
-
910
- var utils = require('../utils/common');
911
- var adler32 = require('./adler32');
912
- var crc32 = require('./crc32');
913
- var inflate_fast = require('./inffast');
914
- var inflate_table = require('./inftrees');
915
-
916
- var CODES = 0;
917
- var LENS = 1;
918
- var DISTS = 2;
919
-
920
- /* Public constants ==========================================================*/
921
- /* ===========================================================================*/
922
-
923
-
924
- /* Allowed flush values; see deflate() and inflate() below for details */
925
- //var Z_NO_FLUSH = 0;
926
- //var Z_PARTIAL_FLUSH = 1;
927
- //var Z_SYNC_FLUSH = 2;
928
- //var Z_FULL_FLUSH = 3;
929
- var Z_FINISH = 4;
930
- var Z_BLOCK = 5;
931
- var Z_TREES = 6;
932
-
933
-
934
- /* Return codes for the compression/decompression functions. Negative values
935
- * are errors, positive values are used for special but normal events.
936
- */
937
- var Z_OK = 0;
938
- var Z_STREAM_END = 1;
939
- var Z_NEED_DICT = 2;
940
- //var Z_ERRNO = -1;
941
- var Z_STREAM_ERROR = -2;
942
- var Z_DATA_ERROR = -3;
943
- var Z_MEM_ERROR = -4;
944
- var Z_BUF_ERROR = -5;
945
- //var Z_VERSION_ERROR = -6;
946
-
947
- /* The deflate compression method */
948
- var Z_DEFLATED = 8;
949
-
950
-
951
- /* STATES ====================================================================*/
952
- /* ===========================================================================*/
953
-
954
-
955
- var HEAD = 1; /* i: waiting for magic header */
956
- var FLAGS = 2; /* i: waiting for method and flags (gzip) */
957
- var TIME = 3; /* i: waiting for modification time (gzip) */
958
- var OS = 4; /* i: waiting for extra flags and operating system (gzip) */
959
- var EXLEN = 5; /* i: waiting for extra length (gzip) */
960
- var EXTRA = 6; /* i: waiting for extra bytes (gzip) */
961
- var NAME = 7; /* i: waiting for end of file name (gzip) */
962
- var COMMENT = 8; /* i: waiting for end of comment (gzip) */
963
- var HCRC = 9; /* i: waiting for header crc (gzip) */
964
- var DICTID = 10; /* i: waiting for dictionary check value */
965
- var DICT = 11; /* waiting for inflateSetDictionary() call */
966
- var TYPE = 12; /* i: waiting for type bits, including last-flag bit */
967
- var TYPEDO = 13; /* i: same, but skip check to exit inflate on new block */
968
- var STORED = 14; /* i: waiting for stored size (length and complement) */
969
- var COPY_ = 15; /* i/o: same as COPY below, but only first time in */
970
- var COPY = 16; /* i/o: waiting for input or output to copy stored block */
971
- var TABLE = 17; /* i: waiting for dynamic block table lengths */
972
- var LENLENS = 18; /* i: waiting for code length code lengths */
973
- var CODELENS = 19; /* i: waiting for length/lit and distance code lengths */
974
- var LEN_ = 20; /* i: same as LEN below, but only first time in */
975
- var LEN = 21; /* i: waiting for length/lit/eob code */
976
- var LENEXT = 22; /* i: waiting for length extra bits */
977
- var DIST = 23; /* i: waiting for distance code */
978
- var DISTEXT = 24; /* i: waiting for distance extra bits */
979
- var MATCH = 25; /* o: waiting for output space to copy string */
980
- var LIT = 26; /* o: waiting for output space to write literal */
981
- var CHECK = 27; /* i: waiting for 32-bit check value */
982
- var LENGTH = 28; /* i: waiting for 32-bit length (gzip) */
983
- var DONE = 29; /* finished check, done -- remain here until reset */
984
- var BAD = 30; /* got a data error -- remain here until reset */
985
- var MEM = 31; /* got an inflate() memory error -- remain here until reset */
986
- var SYNC = 32; /* looking for synchronization bytes to restart inflate() */
987
-
988
- /* ===========================================================================*/
989
-
990
-
991
-
992
- var ENOUGH_LENS = 852;
993
- var ENOUGH_DISTS = 592;
994
- //var ENOUGH = (ENOUGH_LENS+ENOUGH_DISTS);
995
-
996
- var MAX_WBITS = 15;
997
- /* 32K LZ77 window */
998
- var DEF_WBITS = MAX_WBITS;
999
-
1000
-
1001
- function zswap32(q) {
1002
- return (((q >>> 24) & 0xff) +
1003
- ((q >>> 8) & 0xff00) +
1004
- ((q & 0xff00) << 8) +
1005
- ((q & 0xff) << 24));
1006
- }
1007
-
1008
-
1009
- function InflateState() {
1010
- this.mode = 0; /* current inflate mode */
1011
- this.last = false; /* true if processing last block */
1012
- this.wrap = 0; /* bit 0 true for zlib, bit 1 true for gzip */
1013
- this.havedict = false; /* true if dictionary provided */
1014
- this.flags = 0; /* gzip header method and flags (0 if zlib) */
1015
- this.dmax = 0; /* zlib header max distance (INFLATE_STRICT) */
1016
- this.check = 0; /* protected copy of check value */
1017
- this.total = 0; /* protected copy of output count */
1018
- // TODO: may be {}
1019
- this.head = null; /* where to save gzip header information */
1020
-
1021
- /* sliding window */
1022
- this.wbits = 0; /* log base 2 of requested window size */
1023
- this.wsize = 0; /* window size or zero if not using window */
1024
- this.whave = 0; /* valid bytes in the window */
1025
- this.wnext = 0; /* window write index */
1026
- this.window = null; /* allocated sliding window, if needed */
1027
-
1028
- /* bit accumulator */
1029
- this.hold = 0; /* input bit accumulator */
1030
- this.bits = 0; /* number of bits in "in" */
1031
-
1032
- /* for string and stored block copying */
1033
- this.length = 0; /* literal or length of data to copy */
1034
- this.offset = 0; /* distance back to copy string from */
1035
-
1036
- /* for table and code decoding */
1037
- this.extra = 0; /* extra bits needed */
1038
-
1039
- /* fixed and dynamic code tables */
1040
- this.lencode = null; /* starting table for length/literal codes */
1041
- this.distcode = null; /* starting table for distance codes */
1042
- this.lenbits = 0; /* index bits for lencode */
1043
- this.distbits = 0; /* index bits for distcode */
1044
-
1045
- /* dynamic table building */
1046
- this.ncode = 0; /* number of code length code lengths */
1047
- this.nlen = 0; /* number of length code lengths */
1048
- this.ndist = 0; /* number of distance code lengths */
1049
- this.have = 0; /* number of code lengths in lens[] */
1050
- this.next = null; /* next available space in codes[] */
1051
-
1052
- this.lens = new utils.Buf16(320); /* temporary storage for code lengths */
1053
- this.work = new utils.Buf16(288); /* work area for code table building */
1054
-
1055
- /*
1056
- because we don't have pointers in js, we use lencode and distcode directly
1057
- as buffers so we don't need codes
1058
- */
1059
- //this.codes = new utils.Buf32(ENOUGH); /* space for code tables */
1060
- this.lendyn = null; /* dynamic table for length/literal codes (JS specific) */
1061
- this.distdyn = null; /* dynamic table for distance codes (JS specific) */
1062
- this.sane = 0; /* if false, allow invalid distance too far */
1063
- this.back = 0; /* bits back of last unprocessed length/lit */
1064
- this.was = 0; /* initial length of match */
1065
- }
1066
-
1067
- function inflateResetKeep(strm) {
1068
- var state;
1069
-
1070
- if (!strm || !strm.state) { return Z_STREAM_ERROR; }
1071
- state = strm.state;
1072
- strm.total_in = strm.total_out = state.total = 0;
1073
- strm.msg = ''; /*Z_NULL*/
1074
- if (state.wrap) { /* to support ill-conceived Java test suite */
1075
- strm.adler = state.wrap & 1;
1076
- }
1077
- state.mode = HEAD;
1078
- state.last = 0;
1079
- state.havedict = 0;
1080
- state.dmax = 32768;
1081
- state.head = null/*Z_NULL*/;
1082
- state.hold = 0;
1083
- state.bits = 0;
1084
- //state.lencode = state.distcode = state.next = state.codes;
1085
- state.lencode = state.lendyn = new utils.Buf32(ENOUGH_LENS);
1086
- state.distcode = state.distdyn = new utils.Buf32(ENOUGH_DISTS);
1087
-
1088
- state.sane = 1;
1089
- state.back = -1;
1090
- //Tracev((stderr, "inflate: reset\n"));
1091
- return Z_OK;
1092
- }
1093
-
1094
- function inflateReset(strm) {
1095
- var state;
1096
-
1097
- if (!strm || !strm.state) { return Z_STREAM_ERROR; }
1098
- state = strm.state;
1099
- state.wsize = 0;
1100
- state.whave = 0;
1101
- state.wnext = 0;
1102
- return inflateResetKeep(strm);
1103
-
1104
- }
1105
-
1106
- function inflateReset2(strm, windowBits) {
1107
- var wrap;
1108
- var state;
1109
-
1110
- /* get the state */
1111
- if (!strm || !strm.state) { return Z_STREAM_ERROR; }
1112
- state = strm.state;
1113
-
1114
- /* extract wrap request from windowBits parameter */
1115
- if (windowBits < 0) {
1116
- wrap = 0;
1117
- windowBits = -windowBits;
1118
- }
1119
- else {
1120
- wrap = (windowBits >> 4) + 1;
1121
- if (windowBits < 48) {
1122
- windowBits &= 15;
1123
- }
1124
- }
1125
-
1126
- /* set number of window bits, free window if different */
1127
- if (windowBits && (windowBits < 8 || windowBits > 15)) {
1128
- return Z_STREAM_ERROR;
1129
- }
1130
- if (state.window !== null && state.wbits !== windowBits) {
1131
- state.window = null;
1132
- }
1133
-
1134
- /* update state and reset the rest of it */
1135
- state.wrap = wrap;
1136
- state.wbits = windowBits;
1137
- return inflateReset(strm);
1138
- }
1139
-
1140
- function inflateInit2(strm, windowBits) {
1141
- var ret;
1142
- var state;
1143
-
1144
- if (!strm) { return Z_STREAM_ERROR; }
1145
- //strm.msg = Z_NULL; /* in case we return an error */
1146
-
1147
- state = new InflateState();
1148
-
1149
- //if (state === Z_NULL) return Z_MEM_ERROR;
1150
- //Tracev((stderr, "inflate: allocated\n"));
1151
- strm.state = state;
1152
- state.window = null/*Z_NULL*/;
1153
- ret = inflateReset2(strm, windowBits);
1154
- if (ret !== Z_OK) {
1155
- strm.state = null/*Z_NULL*/;
1156
- }
1157
- return ret;
1158
- }
1159
-
1160
- function inflateInit(strm) {
1161
- return inflateInit2(strm, DEF_WBITS);
1162
- }
1163
-
1164
-
1165
- /*
1166
- Return state with length and distance decoding tables and index sizes set to
1167
- fixed code decoding. Normally this returns fixed tables from inffixed.h.
1168
- If BUILDFIXED is defined, then instead this routine builds the tables the
1169
- first time it's called, and returns those tables the first time and
1170
- thereafter. This reduces the size of the code by about 2K bytes, in
1171
- exchange for a little execution time. However, BUILDFIXED should not be
1172
- used for threaded applications, since the rewriting of the tables and virgin
1173
- may not be thread-safe.
1174
- */
1175
- var virgin = true;
1176
-
1177
- var lenfix, distfix; // We have no pointers in JS, so keep tables separate
1178
-
1179
- function fixedtables(state) {
1180
- /* build fixed huffman tables if first call (may not be thread safe) */
1181
- if (virgin) {
1182
- var sym;
1183
-
1184
- lenfix = new utils.Buf32(512);
1185
- distfix = new utils.Buf32(32);
1186
-
1187
- /* literal/length table */
1188
- sym = 0;
1189
- while (sym < 144) { state.lens[sym++] = 8; }
1190
- while (sym < 256) { state.lens[sym++] = 9; }
1191
- while (sym < 280) { state.lens[sym++] = 7; }
1192
- while (sym < 288) { state.lens[sym++] = 8; }
1193
-
1194
- inflate_table(LENS, state.lens, 0, 288, lenfix, 0, state.work, { bits: 9 });
1195
-
1196
- /* distance table */
1197
- sym = 0;
1198
- while (sym < 32) { state.lens[sym++] = 5; }
1199
-
1200
- inflate_table(DISTS, state.lens, 0, 32, distfix, 0, state.work, { bits: 5 });
1201
-
1202
- /* do this just once */
1203
- virgin = false;
1204
- }
1205
-
1206
- state.lencode = lenfix;
1207
- state.lenbits = 9;
1208
- state.distcode = distfix;
1209
- state.distbits = 5;
1210
- }
1211
-
1212
-
1213
- /*
1214
- Update the window with the last wsize (normally 32K) bytes written before
1215
- returning. If window does not exist yet, create it. This is only called
1216
- when a window is already in use, or when output has been written during this
1217
- inflate call, but the end of the deflate stream has not been reached yet.
1218
- It is also called to create a window for dictionary data when a dictionary
1219
- is loaded.
1220
-
1221
- Providing output buffers larger than 32K to inflate() should provide a speed
1222
- advantage, since only the last 32K of output is copied to the sliding window
1223
- upon return from inflate(), and since all distances after the first 32K of
1224
- output will fall in the output data, making match copies simpler and faster.
1225
- The advantage may be dependent on the size of the processor's data caches.
1226
- */
1227
- function updatewindow(strm, src, end, copy) {
1228
- var dist;
1229
- var state = strm.state;
1230
-
1231
- /* if it hasn't been done already, allocate space for the window */
1232
- if (state.window === null) {
1233
- state.wsize = 1 << state.wbits;
1234
- state.wnext = 0;
1235
- state.whave = 0;
1236
-
1237
- state.window = new utils.Buf8(state.wsize);
1238
- }
1239
-
1240
- /* copy state->wsize or less output bytes into the circular window */
1241
- if (copy >= state.wsize) {
1242
- utils.arraySet(state.window, src, end - state.wsize, state.wsize, 0);
1243
- state.wnext = 0;
1244
- state.whave = state.wsize;
1245
- }
1246
- else {
1247
- dist = state.wsize - state.wnext;
1248
- if (dist > copy) {
1249
- dist = copy;
1250
- }
1251
- //zmemcpy(state->window + state->wnext, end - copy, dist);
1252
- utils.arraySet(state.window, src, end - copy, dist, state.wnext);
1253
- copy -= dist;
1254
- if (copy) {
1255
- //zmemcpy(state->window, end - copy, copy);
1256
- utils.arraySet(state.window, src, end - copy, copy, 0);
1257
- state.wnext = copy;
1258
- state.whave = state.wsize;
1259
- }
1260
- else {
1261
- state.wnext += dist;
1262
- if (state.wnext === state.wsize) { state.wnext = 0; }
1263
- if (state.whave < state.wsize) { state.whave += dist; }
1264
- }
1265
- }
1266
- return 0;
1267
- }
1268
-
1269
- function inflate(strm, flush) {
1270
- var state;
1271
- var input, output; // input/output buffers
1272
- var next; /* next input INDEX */
1273
- var put; /* next output INDEX */
1274
- var have, left; /* available input and output */
1275
- var hold; /* bit buffer */
1276
- var bits; /* bits in bit buffer */
1277
- var _in, _out; /* save starting available input and output */
1278
- var copy; /* number of stored or match bytes to copy */
1279
- var from; /* where to copy match bytes from */
1280
- var from_source;
1281
- var here = 0; /* current decoding table entry */
1282
- var here_bits, here_op, here_val; // paked "here" denormalized (JS specific)
1283
- //var last; /* parent table entry */
1284
- var last_bits, last_op, last_val; // paked "last" denormalized (JS specific)
1285
- var len; /* length to copy for repeats, bits to drop */
1286
- var ret; /* return code */
1287
- var hbuf = new utils.Buf8(4); /* buffer for gzip header crc calculation */
1288
- var opts;
1289
-
1290
- var n; // temporary var for NEED_BITS
1291
-
1292
- var order = /* permutation of code lengths */
1293
- [ 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15 ];
1294
-
1295
-
1296
- if (!strm || !strm.state || !strm.output ||
1297
- (!strm.input && strm.avail_in !== 0)) {
1298
- return Z_STREAM_ERROR;
1299
- }
1300
-
1301
- state = strm.state;
1302
- if (state.mode === TYPE) { state.mode = TYPEDO; } /* skip check */
1303
-
1304
-
1305
- //--- LOAD() ---
1306
- put = strm.next_out;
1307
- output = strm.output;
1308
- left = strm.avail_out;
1309
- next = strm.next_in;
1310
- input = strm.input;
1311
- have = strm.avail_in;
1312
- hold = state.hold;
1313
- bits = state.bits;
1314
- //---
1315
-
1316
- _in = have;
1317
- _out = left;
1318
- ret = Z_OK;
1319
-
1320
- inf_leave: // goto emulation
1321
- for (;;) {
1322
- switch (state.mode) {
1323
- case HEAD:
1324
- if (state.wrap === 0) {
1325
- state.mode = TYPEDO;
1326
- break;
1327
- }
1328
- //=== NEEDBITS(16);
1329
- while (bits < 16) {
1330
- if (have === 0) { break inf_leave; }
1331
- have--;
1332
- hold += input[next++] << bits;
1333
- bits += 8;
1334
- }
1335
- //===//
1336
- if ((state.wrap & 2) && hold === 0x8b1f) { /* gzip header */
1337
- state.check = 0/*crc32(0L, Z_NULL, 0)*/;
1338
- //=== CRC2(state.check, hold);
1339
- hbuf[0] = hold & 0xff;
1340
- hbuf[1] = (hold >>> 8) & 0xff;
1341
- state.check = crc32(state.check, hbuf, 2, 0);
1342
- //===//
1343
-
1344
- //=== INITBITS();
1345
- hold = 0;
1346
- bits = 0;
1347
- //===//
1348
- state.mode = FLAGS;
1349
- break;
1350
- }
1351
- state.flags = 0; /* expect zlib header */
1352
- if (state.head) {
1353
- state.head.done = false;
1354
- }
1355
- if (!(state.wrap & 1) || /* check if zlib header allowed */
1356
- (((hold & 0xff)/*BITS(8)*/ << 8) + (hold >> 8)) % 31) {
1357
- strm.msg = 'incorrect header check';
1358
- state.mode = BAD;
1359
- break;
1360
- }
1361
- if ((hold & 0x0f)/*BITS(4)*/ !== Z_DEFLATED) {
1362
- strm.msg = 'unknown compression method';
1363
- state.mode = BAD;
1364
- break;
1365
- }
1366
- //--- DROPBITS(4) ---//
1367
- hold >>>= 4;
1368
- bits -= 4;
1369
- //---//
1370
- len = (hold & 0x0f)/*BITS(4)*/ + 8;
1371
- if (state.wbits === 0) {
1372
- state.wbits = len;
1373
- }
1374
- else if (len > state.wbits) {
1375
- strm.msg = 'invalid window size';
1376
- state.mode = BAD;
1377
- break;
1378
- }
1379
- state.dmax = 1 << len;
1380
- //Tracev((stderr, "inflate: zlib header ok\n"));
1381
- strm.adler = state.check = 1/*adler32(0L, Z_NULL, 0)*/;
1382
- state.mode = hold & 0x200 ? DICTID : TYPE;
1383
- //=== INITBITS();
1384
- hold = 0;
1385
- bits = 0;
1386
- //===//
1387
- break;
1388
- case FLAGS:
1389
- //=== NEEDBITS(16); */
1390
- while (bits < 16) {
1391
- if (have === 0) { break inf_leave; }
1392
- have--;
1393
- hold += input[next++] << bits;
1394
- bits += 8;
1395
- }
1396
- //===//
1397
- state.flags = hold;
1398
- if ((state.flags & 0xff) !== Z_DEFLATED) {
1399
- strm.msg = 'unknown compression method';
1400
- state.mode = BAD;
1401
- break;
1402
- }
1403
- if (state.flags & 0xe000) {
1404
- strm.msg = 'unknown header flags set';
1405
- state.mode = BAD;
1406
- break;
1407
- }
1408
- if (state.head) {
1409
- state.head.text = ((hold >> 8) & 1);
1410
- }
1411
- if (state.flags & 0x0200) {
1412
- //=== CRC2(state.check, hold);
1413
- hbuf[0] = hold & 0xff;
1414
- hbuf[1] = (hold >>> 8) & 0xff;
1415
- state.check = crc32(state.check, hbuf, 2, 0);
1416
- //===//
1417
- }
1418
- //=== INITBITS();
1419
- hold = 0;
1420
- bits = 0;
1421
- //===//
1422
- state.mode = TIME;
1423
- /* falls through */
1424
- case TIME:
1425
- //=== NEEDBITS(32); */
1426
- while (bits < 32) {
1427
- if (have === 0) { break inf_leave; }
1428
- have--;
1429
- hold += input[next++] << bits;
1430
- bits += 8;
1431
- }
1432
- //===//
1433
- if (state.head) {
1434
- state.head.time = hold;
1435
- }
1436
- if (state.flags & 0x0200) {
1437
- //=== CRC4(state.check, hold)
1438
- hbuf[0] = hold & 0xff;
1439
- hbuf[1] = (hold >>> 8) & 0xff;
1440
- hbuf[2] = (hold >>> 16) & 0xff;
1441
- hbuf[3] = (hold >>> 24) & 0xff;
1442
- state.check = crc32(state.check, hbuf, 4, 0);
1443
- //===
1444
- }
1445
- //=== INITBITS();
1446
- hold = 0;
1447
- bits = 0;
1448
- //===//
1449
- state.mode = OS;
1450
- /* falls through */
1451
- case OS:
1452
- //=== NEEDBITS(16); */
1453
- while (bits < 16) {
1454
- if (have === 0) { break inf_leave; }
1455
- have--;
1456
- hold += input[next++] << bits;
1457
- bits += 8;
1458
- }
1459
- //===//
1460
- if (state.head) {
1461
- state.head.xflags = (hold & 0xff);
1462
- state.head.os = (hold >> 8);
1463
- }
1464
- if (state.flags & 0x0200) {
1465
- //=== CRC2(state.check, hold);
1466
- hbuf[0] = hold & 0xff;
1467
- hbuf[1] = (hold >>> 8) & 0xff;
1468
- state.check = crc32(state.check, hbuf, 2, 0);
1469
- //===//
1470
- }
1471
- //=== INITBITS();
1472
- hold = 0;
1473
- bits = 0;
1474
- //===//
1475
- state.mode = EXLEN;
1476
- /* falls through */
1477
- case EXLEN:
1478
- if (state.flags & 0x0400) {
1479
- //=== NEEDBITS(16); */
1480
- while (bits < 16) {
1481
- if (have === 0) { break inf_leave; }
1482
- have--;
1483
- hold += input[next++] << bits;
1484
- bits += 8;
1485
- }
1486
- //===//
1487
- state.length = hold;
1488
- if (state.head) {
1489
- state.head.extra_len = hold;
1490
- }
1491
- if (state.flags & 0x0200) {
1492
- //=== CRC2(state.check, hold);
1493
- hbuf[0] = hold & 0xff;
1494
- hbuf[1] = (hold >>> 8) & 0xff;
1495
- state.check = crc32(state.check, hbuf, 2, 0);
1496
- //===//
1497
- }
1498
- //=== INITBITS();
1499
- hold = 0;
1500
- bits = 0;
1501
- //===//
1502
- }
1503
- else if (state.head) {
1504
- state.head.extra = null/*Z_NULL*/;
1505
- }
1506
- state.mode = EXTRA;
1507
- /* falls through */
1508
- case EXTRA:
1509
- if (state.flags & 0x0400) {
1510
- copy = state.length;
1511
- if (copy > have) { copy = have; }
1512
- if (copy) {
1513
- if (state.head) {
1514
- len = state.head.extra_len - state.length;
1515
- if (!state.head.extra) {
1516
- // Use untyped array for more convenient processing later
1517
- state.head.extra = new Array(state.head.extra_len);
1518
- }
1519
- utils.arraySet(
1520
- state.head.extra,
1521
- input,
1522
- next,
1523
- // extra field is limited to 65536 bytes
1524
- // - no need for additional size check
1525
- copy,
1526
- /*len + copy > state.head.extra_max - len ? state.head.extra_max : copy,*/
1527
- len
1528
- );
1529
- //zmemcpy(state.head.extra + len, next,
1530
- // len + copy > state.head.extra_max ?
1531
- // state.head.extra_max - len : copy);
1532
- }
1533
- if (state.flags & 0x0200) {
1534
- state.check = crc32(state.check, input, copy, next);
1535
- }
1536
- have -= copy;
1537
- next += copy;
1538
- state.length -= copy;
1539
- }
1540
- if (state.length) { break inf_leave; }
1541
- }
1542
- state.length = 0;
1543
- state.mode = NAME;
1544
- /* falls through */
1545
- case NAME:
1546
- if (state.flags & 0x0800) {
1547
- if (have === 0) { break inf_leave; }
1548
- copy = 0;
1549
- do {
1550
- // TODO: 2 or 1 bytes?
1551
- len = input[next + copy++];
1552
- /* use constant limit because in js we should not preallocate memory */
1553
- if (state.head && len &&
1554
- (state.length < 65536 /*state.head.name_max*/)) {
1555
- state.head.name += String.fromCharCode(len);
1556
- }
1557
- } while (len && copy < have);
1558
-
1559
- if (state.flags & 0x0200) {
1560
- state.check = crc32(state.check, input, copy, next);
1561
- }
1562
- have -= copy;
1563
- next += copy;
1564
- if (len) { break inf_leave; }
1565
- }
1566
- else if (state.head) {
1567
- state.head.name = null;
1568
- }
1569
- state.length = 0;
1570
- state.mode = COMMENT;
1571
- /* falls through */
1572
- case COMMENT:
1573
- if (state.flags & 0x1000) {
1574
- if (have === 0) { break inf_leave; }
1575
- copy = 0;
1576
- do {
1577
- len = input[next + copy++];
1578
- /* use constant limit because in js we should not preallocate memory */
1579
- if (state.head && len &&
1580
- (state.length < 65536 /*state.head.comm_max*/)) {
1581
- state.head.comment += String.fromCharCode(len);
1582
- }
1583
- } while (len && copy < have);
1584
- if (state.flags & 0x0200) {
1585
- state.check = crc32(state.check, input, copy, next);
1586
- }
1587
- have -= copy;
1588
- next += copy;
1589
- if (len) { break inf_leave; }
1590
- }
1591
- else if (state.head) {
1592
- state.head.comment = null;
1593
- }
1594
- state.mode = HCRC;
1595
- /* falls through */
1596
- case HCRC:
1597
- if (state.flags & 0x0200) {
1598
- //=== NEEDBITS(16); */
1599
- while (bits < 16) {
1600
- if (have === 0) { break inf_leave; }
1601
- have--;
1602
- hold += input[next++] << bits;
1603
- bits += 8;
1604
- }
1605
- //===//
1606
- if (hold !== (state.check & 0xffff)) {
1607
- strm.msg = 'header crc mismatch';
1608
- state.mode = BAD;
1609
- break;
1610
- }
1611
- //=== INITBITS();
1612
- hold = 0;
1613
- bits = 0;
1614
- //===//
1615
- }
1616
- if (state.head) {
1617
- state.head.hcrc = ((state.flags >> 9) & 1);
1618
- state.head.done = true;
1619
- }
1620
- strm.adler = state.check = 0;
1621
- state.mode = TYPE;
1622
- break;
1623
- case DICTID:
1624
- //=== NEEDBITS(32); */
1625
- while (bits < 32) {
1626
- if (have === 0) { break inf_leave; }
1627
- have--;
1628
- hold += input[next++] << bits;
1629
- bits += 8;
1630
- }
1631
- //===//
1632
- strm.adler = state.check = zswap32(hold);
1633
- //=== INITBITS();
1634
- hold = 0;
1635
- bits = 0;
1636
- //===//
1637
- state.mode = DICT;
1638
- /* falls through */
1639
- case DICT:
1640
- if (state.havedict === 0) {
1641
- //--- RESTORE() ---
1642
- strm.next_out = put;
1643
- strm.avail_out = left;
1644
- strm.next_in = next;
1645
- strm.avail_in = have;
1646
- state.hold = hold;
1647
- state.bits = bits;
1648
- //---
1649
- return Z_NEED_DICT;
1650
- }
1651
- strm.adler = state.check = 1/*adler32(0L, Z_NULL, 0)*/;
1652
- state.mode = TYPE;
1653
- /* falls through */
1654
- case TYPE:
1655
- if (flush === Z_BLOCK || flush === Z_TREES) { break inf_leave; }
1656
- /* falls through */
1657
- case TYPEDO:
1658
- if (state.last) {
1659
- //--- BYTEBITS() ---//
1660
- hold >>>= bits & 7;
1661
- bits -= bits & 7;
1662
- //---//
1663
- state.mode = CHECK;
1664
- break;
1665
- }
1666
- //=== NEEDBITS(3); */
1667
- while (bits < 3) {
1668
- if (have === 0) { break inf_leave; }
1669
- have--;
1670
- hold += input[next++] << bits;
1671
- bits += 8;
1672
- }
1673
- //===//
1674
- state.last = (hold & 0x01)/*BITS(1)*/;
1675
- //--- DROPBITS(1) ---//
1676
- hold >>>= 1;
1677
- bits -= 1;
1678
- //---//
1679
-
1680
- switch ((hold & 0x03)/*BITS(2)*/) {
1681
- case 0: /* stored block */
1682
- //Tracev((stderr, "inflate: stored block%s\n",
1683
- // state.last ? " (last)" : ""));
1684
- state.mode = STORED;
1685
- break;
1686
- case 1: /* fixed block */
1687
- fixedtables(state);
1688
- //Tracev((stderr, "inflate: fixed codes block%s\n",
1689
- // state.last ? " (last)" : ""));
1690
- state.mode = LEN_; /* decode codes */
1691
- if (flush === Z_TREES) {
1692
- //--- DROPBITS(2) ---//
1693
- hold >>>= 2;
1694
- bits -= 2;
1695
- //---//
1696
- break inf_leave;
1697
- }
1698
- break;
1699
- case 2: /* dynamic block */
1700
- //Tracev((stderr, "inflate: dynamic codes block%s\n",
1701
- // state.last ? " (last)" : ""));
1702
- state.mode = TABLE;
1703
- break;
1704
- case 3:
1705
- strm.msg = 'invalid block type';
1706
- state.mode = BAD;
1707
- }
1708
- //--- DROPBITS(2) ---//
1709
- hold >>>= 2;
1710
- bits -= 2;
1711
- //---//
1712
- break;
1713
- case STORED:
1714
- //--- BYTEBITS() ---// /* go to byte boundary */
1715
- hold >>>= bits & 7;
1716
- bits -= bits & 7;
1717
- //---//
1718
- //=== NEEDBITS(32); */
1719
- while (bits < 32) {
1720
- if (have === 0) { break inf_leave; }
1721
- have--;
1722
- hold += input[next++] << bits;
1723
- bits += 8;
1724
- }
1725
- //===//
1726
- if ((hold & 0xffff) !== ((hold >>> 16) ^ 0xffff)) {
1727
- strm.msg = 'invalid stored block lengths';
1728
- state.mode = BAD;
1729
- break;
1730
- }
1731
- state.length = hold & 0xffff;
1732
- //Tracev((stderr, "inflate: stored length %u\n",
1733
- // state.length));
1734
- //=== INITBITS();
1735
- hold = 0;
1736
- bits = 0;
1737
- //===//
1738
- state.mode = COPY_;
1739
- if (flush === Z_TREES) { break inf_leave; }
1740
- /* falls through */
1741
- case COPY_:
1742
- state.mode = COPY;
1743
- /* falls through */
1744
- case COPY:
1745
- copy = state.length;
1746
- if (copy) {
1747
- if (copy > have) { copy = have; }
1748
- if (copy > left) { copy = left; }
1749
- if (copy === 0) { break inf_leave; }
1750
- //--- zmemcpy(put, next, copy); ---
1751
- utils.arraySet(output, input, next, copy, put);
1752
- //---//
1753
- have -= copy;
1754
- next += copy;
1755
- left -= copy;
1756
- put += copy;
1757
- state.length -= copy;
1758
- break;
1759
- }
1760
- //Tracev((stderr, "inflate: stored end\n"));
1761
- state.mode = TYPE;
1762
- break;
1763
- case TABLE:
1764
- //=== NEEDBITS(14); */
1765
- while (bits < 14) {
1766
- if (have === 0) { break inf_leave; }
1767
- have--;
1768
- hold += input[next++] << bits;
1769
- bits += 8;
1770
- }
1771
- //===//
1772
- state.nlen = (hold & 0x1f)/*BITS(5)*/ + 257;
1773
- //--- DROPBITS(5) ---//
1774
- hold >>>= 5;
1775
- bits -= 5;
1776
- //---//
1777
- state.ndist = (hold & 0x1f)/*BITS(5)*/ + 1;
1778
- //--- DROPBITS(5) ---//
1779
- hold >>>= 5;
1780
- bits -= 5;
1781
- //---//
1782
- state.ncode = (hold & 0x0f)/*BITS(4)*/ + 4;
1783
- //--- DROPBITS(4) ---//
1784
- hold >>>= 4;
1785
- bits -= 4;
1786
- //---//
1787
- //#ifndef PKZIP_BUG_WORKAROUND
1788
- if (state.nlen > 286 || state.ndist > 30) {
1789
- strm.msg = 'too many length or distance symbols';
1790
- state.mode = BAD;
1791
- break;
1792
- }
1793
- //#endif
1794
- //Tracev((stderr, "inflate: table sizes ok\n"));
1795
- state.have = 0;
1796
- state.mode = LENLENS;
1797
- /* falls through */
1798
- case LENLENS:
1799
- while (state.have < state.ncode) {
1800
- //=== NEEDBITS(3);
1801
- while (bits < 3) {
1802
- if (have === 0) { break inf_leave; }
1803
- have--;
1804
- hold += input[next++] << bits;
1805
- bits += 8;
1806
- }
1807
- //===//
1808
- state.lens[order[state.have++]] = (hold & 0x07);//BITS(3);
1809
- //--- DROPBITS(3) ---//
1810
- hold >>>= 3;
1811
- bits -= 3;
1812
- //---//
1813
- }
1814
- while (state.have < 19) {
1815
- state.lens[order[state.have++]] = 0;
1816
- }
1817
- // We have separate tables & no pointers. 2 commented lines below not needed.
1818
- //state.next = state.codes;
1819
- //state.lencode = state.next;
1820
- // Switch to use dynamic table
1821
- state.lencode = state.lendyn;
1822
- state.lenbits = 7;
1823
-
1824
- opts = { bits: state.lenbits };
1825
- ret = inflate_table(CODES, state.lens, 0, 19, state.lencode, 0, state.work, opts);
1826
- state.lenbits = opts.bits;
1827
-
1828
- if (ret) {
1829
- strm.msg = 'invalid code lengths set';
1830
- state.mode = BAD;
1831
- break;
1832
- }
1833
- //Tracev((stderr, "inflate: code lengths ok\n"));
1834
- state.have = 0;
1835
- state.mode = CODELENS;
1836
- /* falls through */
1837
- case CODELENS:
1838
- while (state.have < state.nlen + state.ndist) {
1839
- for (;;) {
1840
- here = state.lencode[hold & ((1 << state.lenbits) - 1)];/*BITS(state.lenbits)*/
1841
- here_bits = here >>> 24;
1842
- here_op = (here >>> 16) & 0xff;
1843
- here_val = here & 0xffff;
1844
-
1845
- if ((here_bits) <= bits) { break; }
1846
- //--- PULLBYTE() ---//
1847
- if (have === 0) { break inf_leave; }
1848
- have--;
1849
- hold += input[next++] << bits;
1850
- bits += 8;
1851
- //---//
1852
- }
1853
- if (here_val < 16) {
1854
- //--- DROPBITS(here.bits) ---//
1855
- hold >>>= here_bits;
1856
- bits -= here_bits;
1857
- //---//
1858
- state.lens[state.have++] = here_val;
1859
- }
1860
- else {
1861
- if (here_val === 16) {
1862
- //=== NEEDBITS(here.bits + 2);
1863
- n = here_bits + 2;
1864
- while (bits < n) {
1865
- if (have === 0) { break inf_leave; }
1866
- have--;
1867
- hold += input[next++] << bits;
1868
- bits += 8;
1869
- }
1870
- //===//
1871
- //--- DROPBITS(here.bits) ---//
1872
- hold >>>= here_bits;
1873
- bits -= here_bits;
1874
- //---//
1875
- if (state.have === 0) {
1876
- strm.msg = 'invalid bit length repeat';
1877
- state.mode = BAD;
1878
- break;
1879
- }
1880
- len = state.lens[state.have - 1];
1881
- copy = 3 + (hold & 0x03);//BITS(2);
1882
- //--- DROPBITS(2) ---//
1883
- hold >>>= 2;
1884
- bits -= 2;
1885
- //---//
1886
- }
1887
- else if (here_val === 17) {
1888
- //=== NEEDBITS(here.bits + 3);
1889
- n = here_bits + 3;
1890
- while (bits < n) {
1891
- if (have === 0) { break inf_leave; }
1892
- have--;
1893
- hold += input[next++] << bits;
1894
- bits += 8;
1895
- }
1896
- //===//
1897
- //--- DROPBITS(here.bits) ---//
1898
- hold >>>= here_bits;
1899
- bits -= here_bits;
1900
- //---//
1901
- len = 0;
1902
- copy = 3 + (hold & 0x07);//BITS(3);
1903
- //--- DROPBITS(3) ---//
1904
- hold >>>= 3;
1905
- bits -= 3;
1906
- //---//
1907
- }
1908
- else {
1909
- //=== NEEDBITS(here.bits + 7);
1910
- n = here_bits + 7;
1911
- while (bits < n) {
1912
- if (have === 0) { break inf_leave; }
1913
- have--;
1914
- hold += input[next++] << bits;
1915
- bits += 8;
1916
- }
1917
- //===//
1918
- //--- DROPBITS(here.bits) ---//
1919
- hold >>>= here_bits;
1920
- bits -= here_bits;
1921
- //---//
1922
- len = 0;
1923
- copy = 11 + (hold & 0x7f);//BITS(7);
1924
- //--- DROPBITS(7) ---//
1925
- hold >>>= 7;
1926
- bits -= 7;
1927
- //---//
1928
- }
1929
- if (state.have + copy > state.nlen + state.ndist) {
1930
- strm.msg = 'invalid bit length repeat';
1931
- state.mode = BAD;
1932
- break;
1933
- }
1934
- while (copy--) {
1935
- state.lens[state.have++] = len;
1936
- }
1937
- }
1938
- }
1939
-
1940
- /* handle error breaks in while */
1941
- if (state.mode === BAD) { break; }
1942
-
1943
- /* check for end-of-block code (better have one) */
1944
- if (state.lens[256] === 0) {
1945
- strm.msg = 'invalid code -- missing end-of-block';
1946
- state.mode = BAD;
1947
- break;
1948
- }
1949
-
1950
- /* build code tables -- note: do not change the lenbits or distbits
1951
- values here (9 and 6) without reading the comments in inftrees.h
1952
- concerning the ENOUGH constants, which depend on those values */
1953
- state.lenbits = 9;
1954
-
1955
- opts = { bits: state.lenbits };
1956
- ret = inflate_table(LENS, state.lens, 0, state.nlen, state.lencode, 0, state.work, opts);
1957
- // We have separate tables & no pointers. 2 commented lines below not needed.
1958
- // state.next_index = opts.table_index;
1959
- state.lenbits = opts.bits;
1960
- // state.lencode = state.next;
1961
-
1962
- if (ret) {
1963
- strm.msg = 'invalid literal/lengths set';
1964
- state.mode = BAD;
1965
- break;
1966
- }
1967
-
1968
- state.distbits = 6;
1969
- //state.distcode.copy(state.codes);
1970
- // Switch to use dynamic table
1971
- state.distcode = state.distdyn;
1972
- opts = { bits: state.distbits };
1973
- ret = inflate_table(DISTS, state.lens, state.nlen, state.ndist, state.distcode, 0, state.work, opts);
1974
- // We have separate tables & no pointers. 2 commented lines below not needed.
1975
- // state.next_index = opts.table_index;
1976
- state.distbits = opts.bits;
1977
- // state.distcode = state.next;
1978
-
1979
- if (ret) {
1980
- strm.msg = 'invalid distances set';
1981
- state.mode = BAD;
1982
- break;
1983
- }
1984
- //Tracev((stderr, 'inflate: codes ok\n'));
1985
- state.mode = LEN_;
1986
- if (flush === Z_TREES) { break inf_leave; }
1987
- /* falls through */
1988
- case LEN_:
1989
- state.mode = LEN;
1990
- /* falls through */
1991
- case LEN:
1992
- if (have >= 6 && left >= 258) {
1993
- //--- RESTORE() ---
1994
- strm.next_out = put;
1995
- strm.avail_out = left;
1996
- strm.next_in = next;
1997
- strm.avail_in = have;
1998
- state.hold = hold;
1999
- state.bits = bits;
2000
- //---
2001
- inflate_fast(strm, _out);
2002
- //--- LOAD() ---
2003
- put = strm.next_out;
2004
- output = strm.output;
2005
- left = strm.avail_out;
2006
- next = strm.next_in;
2007
- input = strm.input;
2008
- have = strm.avail_in;
2009
- hold = state.hold;
2010
- bits = state.bits;
2011
- //---
2012
-
2013
- if (state.mode === TYPE) {
2014
- state.back = -1;
2015
- }
2016
- break;
2017
- }
2018
- state.back = 0;
2019
- for (;;) {
2020
- here = state.lencode[hold & ((1 << state.lenbits) - 1)]; /*BITS(state.lenbits)*/
2021
- here_bits = here >>> 24;
2022
- here_op = (here >>> 16) & 0xff;
2023
- here_val = here & 0xffff;
2024
-
2025
- if (here_bits <= bits) { break; }
2026
- //--- PULLBYTE() ---//
2027
- if (have === 0) { break inf_leave; }
2028
- have--;
2029
- hold += input[next++] << bits;
2030
- bits += 8;
2031
- //---//
2032
- }
2033
- if (here_op && (here_op & 0xf0) === 0) {
2034
- last_bits = here_bits;
2035
- last_op = here_op;
2036
- last_val = here_val;
2037
- for (;;) {
2038
- here = state.lencode[last_val +
2039
- ((hold & ((1 << (last_bits + last_op)) - 1))/*BITS(last.bits + last.op)*/ >> last_bits)];
2040
- here_bits = here >>> 24;
2041
- here_op = (here >>> 16) & 0xff;
2042
- here_val = here & 0xffff;
2043
-
2044
- if ((last_bits + here_bits) <= bits) { break; }
2045
- //--- PULLBYTE() ---//
2046
- if (have === 0) { break inf_leave; }
2047
- have--;
2048
- hold += input[next++] << bits;
2049
- bits += 8;
2050
- //---//
2051
- }
2052
- //--- DROPBITS(last.bits) ---//
2053
- hold >>>= last_bits;
2054
- bits -= last_bits;
2055
- //---//
2056
- state.back += last_bits;
2057
- }
2058
- //--- DROPBITS(here.bits) ---//
2059
- hold >>>= here_bits;
2060
- bits -= here_bits;
2061
- //---//
2062
- state.back += here_bits;
2063
- state.length = here_val;
2064
- if (here_op === 0) {
2065
- //Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?
2066
- // "inflate: literal '%c'\n" :
2067
- // "inflate: literal 0x%02x\n", here.val));
2068
- state.mode = LIT;
2069
- break;
2070
- }
2071
- if (here_op & 32) {
2072
- //Tracevv((stderr, "inflate: end of block\n"));
2073
- state.back = -1;
2074
- state.mode = TYPE;
2075
- break;
2076
- }
2077
- if (here_op & 64) {
2078
- strm.msg = 'invalid literal/length code';
2079
- state.mode = BAD;
2080
- break;
2081
- }
2082
- state.extra = here_op & 15;
2083
- state.mode = LENEXT;
2084
- /* falls through */
2085
- case LENEXT:
2086
- if (state.extra) {
2087
- //=== NEEDBITS(state.extra);
2088
- n = state.extra;
2089
- while (bits < n) {
2090
- if (have === 0) { break inf_leave; }
2091
- have--;
2092
- hold += input[next++] << bits;
2093
- bits += 8;
2094
- }
2095
- //===//
2096
- state.length += hold & ((1 << state.extra) - 1)/*BITS(state.extra)*/;
2097
- //--- DROPBITS(state.extra) ---//
2098
- hold >>>= state.extra;
2099
- bits -= state.extra;
2100
- //---//
2101
- state.back += state.extra;
2102
- }
2103
- //Tracevv((stderr, "inflate: length %u\n", state.length));
2104
- state.was = state.length;
2105
- state.mode = DIST;
2106
- /* falls through */
2107
- case DIST:
2108
- for (;;) {
2109
- here = state.distcode[hold & ((1 << state.distbits) - 1)];/*BITS(state.distbits)*/
2110
- here_bits = here >>> 24;
2111
- here_op = (here >>> 16) & 0xff;
2112
- here_val = here & 0xffff;
2113
-
2114
- if ((here_bits) <= bits) { break; }
2115
- //--- PULLBYTE() ---//
2116
- if (have === 0) { break inf_leave; }
2117
- have--;
2118
- hold += input[next++] << bits;
2119
- bits += 8;
2120
- //---//
2121
- }
2122
- if ((here_op & 0xf0) === 0) {
2123
- last_bits = here_bits;
2124
- last_op = here_op;
2125
- last_val = here_val;
2126
- for (;;) {
2127
- here = state.distcode[last_val +
2128
- ((hold & ((1 << (last_bits + last_op)) - 1))/*BITS(last.bits + last.op)*/ >> last_bits)];
2129
- here_bits = here >>> 24;
2130
- here_op = (here >>> 16) & 0xff;
2131
- here_val = here & 0xffff;
2132
-
2133
- if ((last_bits + here_bits) <= bits) { break; }
2134
- //--- PULLBYTE() ---//
2135
- if (have === 0) { break inf_leave; }
2136
- have--;
2137
- hold += input[next++] << bits;
2138
- bits += 8;
2139
- //---//
2140
- }
2141
- //--- DROPBITS(last.bits) ---//
2142
- hold >>>= last_bits;
2143
- bits -= last_bits;
2144
- //---//
2145
- state.back += last_bits;
2146
- }
2147
- //--- DROPBITS(here.bits) ---//
2148
- hold >>>= here_bits;
2149
- bits -= here_bits;
2150
- //---//
2151
- state.back += here_bits;
2152
- if (here_op & 64) {
2153
- strm.msg = 'invalid distance code';
2154
- state.mode = BAD;
2155
- break;
2156
- }
2157
- state.offset = here_val;
2158
- state.extra = (here_op) & 15;
2159
- state.mode = DISTEXT;
2160
- /* falls through */
2161
- case DISTEXT:
2162
- if (state.extra) {
2163
- //=== NEEDBITS(state.extra);
2164
- n = state.extra;
2165
- while (bits < n) {
2166
- if (have === 0) { break inf_leave; }
2167
- have--;
2168
- hold += input[next++] << bits;
2169
- bits += 8;
2170
- }
2171
- //===//
2172
- state.offset += hold & ((1 << state.extra) - 1)/*BITS(state.extra)*/;
2173
- //--- DROPBITS(state.extra) ---//
2174
- hold >>>= state.extra;
2175
- bits -= state.extra;
2176
- //---//
2177
- state.back += state.extra;
2178
- }
2179
- //#ifdef INFLATE_STRICT
2180
- if (state.offset > state.dmax) {
2181
- strm.msg = 'invalid distance too far back';
2182
- state.mode = BAD;
2183
- break;
2184
- }
2185
- //#endif
2186
- //Tracevv((stderr, "inflate: distance %u\n", state.offset));
2187
- state.mode = MATCH;
2188
- /* falls through */
2189
- case MATCH:
2190
- if (left === 0) { break inf_leave; }
2191
- copy = _out - left;
2192
- if (state.offset > copy) { /* copy from window */
2193
- copy = state.offset - copy;
2194
- if (copy > state.whave) {
2195
- if (state.sane) {
2196
- strm.msg = 'invalid distance too far back';
2197
- state.mode = BAD;
2198
- break;
2199
- }
2200
- // (!) This block is disabled in zlib defaults,
2201
- // don't enable it for binary compatibility
2202
- //#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR
2203
- // Trace((stderr, "inflate.c too far\n"));
2204
- // copy -= state.whave;
2205
- // if (copy > state.length) { copy = state.length; }
2206
- // if (copy > left) { copy = left; }
2207
- // left -= copy;
2208
- // state.length -= copy;
2209
- // do {
2210
- // output[put++] = 0;
2211
- // } while (--copy);
2212
- // if (state.length === 0) { state.mode = LEN; }
2213
- // break;
2214
- //#endif
2215
- }
2216
- if (copy > state.wnext) {
2217
- copy -= state.wnext;
2218
- from = state.wsize - copy;
2219
- }
2220
- else {
2221
- from = state.wnext - copy;
2222
- }
2223
- if (copy > state.length) { copy = state.length; }
2224
- from_source = state.window;
2225
- }
2226
- else { /* copy from output */
2227
- from_source = output;
2228
- from = put - state.offset;
2229
- copy = state.length;
2230
- }
2231
- if (copy > left) { copy = left; }
2232
- left -= copy;
2233
- state.length -= copy;
2234
- do {
2235
- output[put++] = from_source[from++];
2236
- } while (--copy);
2237
- if (state.length === 0) { state.mode = LEN; }
2238
- break;
2239
- case LIT:
2240
- if (left === 0) { break inf_leave; }
2241
- output[put++] = state.length;
2242
- left--;
2243
- state.mode = LEN;
2244
- break;
2245
- case CHECK:
2246
- if (state.wrap) {
2247
- //=== NEEDBITS(32);
2248
- while (bits < 32) {
2249
- if (have === 0) { break inf_leave; }
2250
- have--;
2251
- // Use '|' instead of '+' to make sure that result is signed
2252
- hold |= input[next++] << bits;
2253
- bits += 8;
2254
- }
2255
- //===//
2256
- _out -= left;
2257
- strm.total_out += _out;
2258
- state.total += _out;
2259
- if (_out) {
2260
- strm.adler = state.check =
2261
- /*UPDATE(state.check, put - _out, _out);*/
2262
- (state.flags ? crc32(state.check, output, _out, put - _out) : adler32(state.check, output, _out, put - _out));
2263
-
2264
- }
2265
- _out = left;
2266
- // NB: crc32 stored as signed 32-bit int, zswap32 returns signed too
2267
- if ((state.flags ? hold : zswap32(hold)) !== state.check) {
2268
- strm.msg = 'incorrect data check';
2269
- state.mode = BAD;
2270
- break;
2271
- }
2272
- //=== INITBITS();
2273
- hold = 0;
2274
- bits = 0;
2275
- //===//
2276
- //Tracev((stderr, "inflate: check matches trailer\n"));
2277
- }
2278
- state.mode = LENGTH;
2279
- /* falls through */
2280
- case LENGTH:
2281
- if (state.wrap && state.flags) {
2282
- //=== NEEDBITS(32);
2283
- while (bits < 32) {
2284
- if (have === 0) { break inf_leave; }
2285
- have--;
2286
- hold += input[next++] << bits;
2287
- bits += 8;
2288
- }
2289
- //===//
2290
- if (hold !== (state.total & 0xffffffff)) {
2291
- strm.msg = 'incorrect length check';
2292
- state.mode = BAD;
2293
- break;
2294
- }
2295
- //=== INITBITS();
2296
- hold = 0;
2297
- bits = 0;
2298
- //===//
2299
- //Tracev((stderr, "inflate: length matches trailer\n"));
2300
- }
2301
- state.mode = DONE;
2302
- /* falls through */
2303
- case DONE:
2304
- ret = Z_STREAM_END;
2305
- break inf_leave;
2306
- case BAD:
2307
- ret = Z_DATA_ERROR;
2308
- break inf_leave;
2309
- case MEM:
2310
- return Z_MEM_ERROR;
2311
- case SYNC:
2312
- /* falls through */
2313
- default:
2314
- return Z_STREAM_ERROR;
2315
- }
2316
- }
2317
-
2318
- // inf_leave <- here is real place for "goto inf_leave", emulated via "break inf_leave"
2319
-
2320
- /*
2321
- Return from inflate(), updating the total counts and the check value.
2322
- If there was no progress during the inflate() call, return a buffer
2323
- error. Call updatewindow() to create and/or update the window state.
2324
- Note: a memory error from inflate() is non-recoverable.
2325
- */
2326
-
2327
- //--- RESTORE() ---
2328
- strm.next_out = put;
2329
- strm.avail_out = left;
2330
- strm.next_in = next;
2331
- strm.avail_in = have;
2332
- state.hold = hold;
2333
- state.bits = bits;
2334
- //---
2335
-
2336
- if (state.wsize || (_out !== strm.avail_out && state.mode < BAD &&
2337
- (state.mode < CHECK || flush !== Z_FINISH))) {
2338
- if (updatewindow(strm, strm.output, strm.next_out, _out - strm.avail_out)) {
2339
- state.mode = MEM;
2340
- return Z_MEM_ERROR;
2341
- }
2342
- }
2343
- _in -= strm.avail_in;
2344
- _out -= strm.avail_out;
2345
- strm.total_in += _in;
2346
- strm.total_out += _out;
2347
- state.total += _out;
2348
- if (state.wrap && _out) {
2349
- strm.adler = state.check = /*UPDATE(state.check, strm.next_out - _out, _out);*/
2350
- (state.flags ? crc32(state.check, output, _out, strm.next_out - _out) : adler32(state.check, output, _out, strm.next_out - _out));
2351
- }
2352
- strm.data_type = state.bits + (state.last ? 64 : 0) +
2353
- (state.mode === TYPE ? 128 : 0) +
2354
- (state.mode === LEN_ || state.mode === COPY_ ? 256 : 0);
2355
- if (((_in === 0 && _out === 0) || flush === Z_FINISH) && ret === Z_OK) {
2356
- ret = Z_BUF_ERROR;
2357
- }
2358
- return ret;
2359
- }
2360
-
2361
- function inflateEnd(strm) {
2362
-
2363
- if (!strm || !strm.state /*|| strm->zfree == (free_func)0*/) {
2364
- return Z_STREAM_ERROR;
2365
- }
2366
-
2367
- var state = strm.state;
2368
- if (state.window) {
2369
- state.window = null;
2370
- }
2371
- strm.state = null;
2372
- return Z_OK;
2373
- }
2374
-
2375
- function inflateGetHeader(strm, head) {
2376
- var state;
2377
-
2378
- /* check state */
2379
- if (!strm || !strm.state) { return Z_STREAM_ERROR; }
2380
- state = strm.state;
2381
- if ((state.wrap & 2) === 0) { return Z_STREAM_ERROR; }
2382
-
2383
- /* save header structure */
2384
- state.head = head;
2385
- head.done = false;
2386
- return Z_OK;
2387
- }
2388
-
2389
- function inflateSetDictionary(strm, dictionary) {
2390
- var dictLength = dictionary.length;
2391
-
2392
- var state;
2393
- var dictid;
2394
- var ret;
2395
-
2396
- /* check state */
2397
- if (!strm /* == Z_NULL */ || !strm.state /* == Z_NULL */) { return Z_STREAM_ERROR; }
2398
- state = strm.state;
2399
-
2400
- if (state.wrap !== 0 && state.mode !== DICT) {
2401
- return Z_STREAM_ERROR;
2402
- }
2403
-
2404
- /* check for correct dictionary identifier */
2405
- if (state.mode === DICT) {
2406
- dictid = 1; /* adler32(0, null, 0)*/
2407
- /* dictid = adler32(dictid, dictionary, dictLength); */
2408
- dictid = adler32(dictid, dictionary, dictLength, 0);
2409
- if (dictid !== state.check) {
2410
- return Z_DATA_ERROR;
2411
- }
2412
- }
2413
- /* copy dictionary to window using updatewindow(), which will amend the
2414
- existing dictionary if appropriate */
2415
- ret = updatewindow(strm, dictionary, dictLength, dictLength);
2416
- if (ret) {
2417
- state.mode = MEM;
2418
- return Z_MEM_ERROR;
2419
- }
2420
- state.havedict = 1;
2421
- // Tracev((stderr, "inflate: dictionary set\n"));
2422
- return Z_OK;
2423
- }
2424
-
2425
- exports.inflateReset = inflateReset;
2426
- exports.inflateReset2 = inflateReset2;
2427
- exports.inflateResetKeep = inflateResetKeep;
2428
- exports.inflateInit = inflateInit;
2429
- exports.inflateInit2 = inflateInit2;
2430
- exports.inflate = inflate;
2431
- exports.inflateEnd = inflateEnd;
2432
- exports.inflateGetHeader = inflateGetHeader;
2433
- exports.inflateSetDictionary = inflateSetDictionary;
2434
- exports.inflateInfo = 'pako inflate (from Nodeca project)';
2435
-
2436
- /* Not implemented
2437
- exports.inflateCopy = inflateCopy;
2438
- exports.inflateGetDictionary = inflateGetDictionary;
2439
- exports.inflateMark = inflateMark;
2440
- exports.inflatePrime = inflatePrime;
2441
- exports.inflateSync = inflateSync;
2442
- exports.inflateSyncPoint = inflateSyncPoint;
2443
- exports.inflateUndermine = inflateUndermine;
2444
- */
2445
-
2446
- },{"../utils/common":1,"./adler32":3,"./crc32":5,"./inffast":7,"./inftrees":9}],9:[function(require,module,exports){
2447
- 'use strict';
2448
-
2449
- // (C) 1995-2013 Jean-loup Gailly and Mark Adler
2450
- // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin
2451
- //
2452
- // This software is provided 'as-is', without any express or implied
2453
- // warranty. In no event will the authors be held liable for any damages
2454
- // arising from the use of this software.
2455
- //
2456
- // Permission is granted to anyone to use this software for any purpose,
2457
- // including commercial applications, and to alter it and redistribute it
2458
- // freely, subject to the following restrictions:
2459
- //
2460
- // 1. The origin of this software must not be misrepresented; you must not
2461
- // claim that you wrote the original software. If you use this software
2462
- // in a product, an acknowledgment in the product documentation would be
2463
- // appreciated but is not required.
2464
- // 2. Altered source versions must be plainly marked as such, and must not be
2465
- // misrepresented as being the original software.
2466
- // 3. This notice may not be removed or altered from any source distribution.
2467
-
2468
- var utils = require('../utils/common');
2469
-
2470
- var MAXBITS = 15;
2471
- var ENOUGH_LENS = 852;
2472
- var ENOUGH_DISTS = 592;
2473
- //var ENOUGH = (ENOUGH_LENS+ENOUGH_DISTS);
2474
-
2475
- var CODES = 0;
2476
- var LENS = 1;
2477
- var DISTS = 2;
2478
-
2479
- var lbase = [ /* Length codes 257..285 base */
2480
- 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31,
2481
- 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0
2482
- ];
2483
-
2484
- var lext = [ /* Length codes 257..285 extra */
2485
- 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18,
2486
- 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 72, 78
2487
- ];
2488
-
2489
- var dbase = [ /* Distance codes 0..29 base */
2490
- 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
2491
- 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,
2492
- 8193, 12289, 16385, 24577, 0, 0
2493
- ];
2494
-
2495
- var dext = [ /* Distance codes 0..29 extra */
2496
- 16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22,
2497
- 23, 23, 24, 24, 25, 25, 26, 26, 27, 27,
2498
- 28, 28, 29, 29, 64, 64
2499
- ];
2500
-
2501
- module.exports = function inflate_table(type, lens, lens_index, codes, table, table_index, work, opts)
2502
- {
2503
- var bits = opts.bits;
2504
- //here = opts.here; /* table entry for duplication */
2505
-
2506
- var len = 0; /* a code's length in bits */
2507
- var sym = 0; /* index of code symbols */
2508
- var min = 0, max = 0; /* minimum and maximum code lengths */
2509
- var root = 0; /* number of index bits for root table */
2510
- var curr = 0; /* number of index bits for current table */
2511
- var drop = 0; /* code bits to drop for sub-table */
2512
- var left = 0; /* number of prefix codes available */
2513
- var used = 0; /* code entries in table used */
2514
- var huff = 0; /* Huffman code */
2515
- var incr; /* for incrementing code, index */
2516
- var fill; /* index for replicating entries */
2517
- var low; /* low bits for current root entry */
2518
- var mask; /* mask for low root bits */
2519
- var next; /* next available space in table */
2520
- var base = null; /* base value table to use */
2521
- var base_index = 0;
2522
- // var shoextra; /* extra bits table to use */
2523
- var end; /* use base and extra for symbol > end */
2524
- var count = new utils.Buf16(MAXBITS + 1); //[MAXBITS+1]; /* number of codes of each length */
2525
- var offs = new utils.Buf16(MAXBITS + 1); //[MAXBITS+1]; /* offsets in table for each length */
2526
- var extra = null;
2527
- var extra_index = 0;
2528
-
2529
- var here_bits, here_op, here_val;
2530
-
2531
- /*
2532
- Process a set of code lengths to create a canonical Huffman code. The
2533
- code lengths are lens[0..codes-1]. Each length corresponds to the
2534
- symbols 0..codes-1. The Huffman code is generated by first sorting the
2535
- symbols by length from short to long, and retaining the symbol order
2536
- for codes with equal lengths. Then the code starts with all zero bits
2537
- for the first code of the shortest length, and the codes are integer
2538
- increments for the same length, and zeros are appended as the length
2539
- increases. For the deflate format, these bits are stored backwards
2540
- from their more natural integer increment ordering, and so when the
2541
- decoding tables are built in the large loop below, the integer codes
2542
- are incremented backwards.
2543
-
2544
- This routine assumes, but does not check, that all of the entries in
2545
- lens[] are in the range 0..MAXBITS. The caller must assure this.
2546
- 1..MAXBITS is interpreted as that code length. zero means that that
2547
- symbol does not occur in this code.
2548
-
2549
- The codes are sorted by computing a count of codes for each length,
2550
- creating from that a table of starting indices for each length in the
2551
- sorted table, and then entering the symbols in order in the sorted
2552
- table. The sorted table is work[], with that space being provided by
2553
- the caller.
2554
-
2555
- The length counts are used for other purposes as well, i.e. finding
2556
- the minimum and maximum length codes, determining if there are any
2557
- codes at all, checking for a valid set of lengths, and looking ahead
2558
- at length counts to determine sub-table sizes when building the
2559
- decoding tables.
2560
- */
2561
-
2562
- /* accumulate lengths for codes (assumes lens[] all in 0..MAXBITS) */
2563
- for (len = 0; len <= MAXBITS; len++) {
2564
- count[len] = 0;
2565
- }
2566
- for (sym = 0; sym < codes; sym++) {
2567
- count[lens[lens_index + sym]]++;
2568
- }
2569
-
2570
- /* bound code lengths, force root to be within code lengths */
2571
- root = bits;
2572
- for (max = MAXBITS; max >= 1; max--) {
2573
- if (count[max] !== 0) { break; }
2574
- }
2575
- if (root > max) {
2576
- root = max;
2577
- }
2578
- if (max === 0) { /* no symbols to code at all */
2579
- //table.op[opts.table_index] = 64; //here.op = (var char)64; /* invalid code marker */
2580
- //table.bits[opts.table_index] = 1; //here.bits = (var char)1;
2581
- //table.val[opts.table_index++] = 0; //here.val = (var short)0;
2582
- table[table_index++] = (1 << 24) | (64 << 16) | 0;
2583
-
2584
-
2585
- //table.op[opts.table_index] = 64;
2586
- //table.bits[opts.table_index] = 1;
2587
- //table.val[opts.table_index++] = 0;
2588
- table[table_index++] = (1 << 24) | (64 << 16) | 0;
2589
-
2590
- opts.bits = 1;
2591
- return 0; /* no symbols, but wait for decoding to report error */
2592
- }
2593
- for (min = 1; min < max; min++) {
2594
- if (count[min] !== 0) { break; }
2595
- }
2596
- if (root < min) {
2597
- root = min;
2598
- }
2599
-
2600
- /* check for an over-subscribed or incomplete set of lengths */
2601
- left = 1;
2602
- for (len = 1; len <= MAXBITS; len++) {
2603
- left <<= 1;
2604
- left -= count[len];
2605
- if (left < 0) {
2606
- return -1;
2607
- } /* over-subscribed */
2608
- }
2609
- if (left > 0 && (type === CODES || max !== 1)) {
2610
- return -1; /* incomplete set */
2611
- }
2612
-
2613
- /* generate offsets into symbol table for each length for sorting */
2614
- offs[1] = 0;
2615
- for (len = 1; len < MAXBITS; len++) {
2616
- offs[len + 1] = offs[len] + count[len];
2617
- }
2618
-
2619
- /* sort symbols by length, by symbol order within each length */
2620
- for (sym = 0; sym < codes; sym++) {
2621
- if (lens[lens_index + sym] !== 0) {
2622
- work[offs[lens[lens_index + sym]]++] = sym;
2623
- }
2624
- }
2625
-
2626
- /*
2627
- Create and fill in decoding tables. In this loop, the table being
2628
- filled is at next and has curr index bits. The code being used is huff
2629
- with length len. That code is converted to an index by dropping drop
2630
- bits off of the bottom. For codes where len is less than drop + curr,
2631
- those top drop + curr - len bits are incremented through all values to
2632
- fill the table with replicated entries.
2633
-
2634
- root is the number of index bits for the root table. When len exceeds
2635
- root, sub-tables are created pointed to by the root entry with an index
2636
- of the low root bits of huff. This is saved in low to check for when a
2637
- new sub-table should be started. drop is zero when the root table is
2638
- being filled, and drop is root when sub-tables are being filled.
2639
-
2640
- When a new sub-table is needed, it is necessary to look ahead in the
2641
- code lengths to determine what size sub-table is needed. The length
2642
- counts are used for this, and so count[] is decremented as codes are
2643
- entered in the tables.
2644
-
2645
- used keeps track of how many table entries have been allocated from the
2646
- provided *table space. It is checked for LENS and DIST tables against
2647
- the constants ENOUGH_LENS and ENOUGH_DISTS to guard against changes in
2648
- the initial root table size constants. See the comments in inftrees.h
2649
- for more information.
2650
-
2651
- sym increments through all symbols, and the loop terminates when
2652
- all codes of length max, i.e. all codes, have been processed. This
2653
- routine permits incomplete codes, so another loop after this one fills
2654
- in the rest of the decoding tables with invalid code markers.
2655
- */
2656
-
2657
- /* set up for code type */
2658
- // poor man optimization - use if-else instead of switch,
2659
- // to avoid deopts in old v8
2660
- if (type === CODES) {
2661
- base = extra = work; /* dummy value--not used */
2662
- end = 19;
2663
-
2664
- } else if (type === LENS) {
2665
- base = lbase;
2666
- base_index -= 257;
2667
- extra = lext;
2668
- extra_index -= 257;
2669
- end = 256;
2670
-
2671
- } else { /* DISTS */
2672
- base = dbase;
2673
- extra = dext;
2674
- end = -1;
2675
- }
2676
-
2677
- /* initialize opts for loop */
2678
- huff = 0; /* starting code */
2679
- sym = 0; /* starting code symbol */
2680
- len = min; /* starting code length */
2681
- next = table_index; /* current table to fill in */
2682
- curr = root; /* current table index bits */
2683
- drop = 0; /* current bits to drop from code for index */
2684
- low = -1; /* trigger new sub-table when len > root */
2685
- used = 1 << root; /* use root table entries */
2686
- mask = used - 1; /* mask for comparing low */
2687
-
2688
- /* check available table space */
2689
- if ((type === LENS && used > ENOUGH_LENS) ||
2690
- (type === DISTS && used > ENOUGH_DISTS)) {
2691
- return 1;
2692
- }
2693
-
2694
- /* process all codes and make table entries */
2695
- for (;;) {
2696
- /* create table entry */
2697
- here_bits = len - drop;
2698
- if (work[sym] < end) {
2699
- here_op = 0;
2700
- here_val = work[sym];
2701
- }
2702
- else if (work[sym] > end) {
2703
- here_op = extra[extra_index + work[sym]];
2704
- here_val = base[base_index + work[sym]];
2705
- }
2706
- else {
2707
- here_op = 32 + 64; /* end of block */
2708
- here_val = 0;
2709
- }
2710
-
2711
- /* replicate for those indices with low len bits equal to huff */
2712
- incr = 1 << (len - drop);
2713
- fill = 1 << curr;
2714
- min = fill; /* save offset to next table */
2715
- do {
2716
- fill -= incr;
2717
- table[next + (huff >> drop) + fill] = (here_bits << 24) | (here_op << 16) | here_val |0;
2718
- } while (fill !== 0);
2719
-
2720
- /* backwards increment the len-bit code huff */
2721
- incr = 1 << (len - 1);
2722
- while (huff & incr) {
2723
- incr >>= 1;
2724
- }
2725
- if (incr !== 0) {
2726
- huff &= incr - 1;
2727
- huff += incr;
2728
- } else {
2729
- huff = 0;
2730
- }
2731
-
2732
- /* go to next symbol, update count, len */
2733
- sym++;
2734
- if (--count[len] === 0) {
2735
- if (len === max) { break; }
2736
- len = lens[lens_index + work[sym]];
2737
- }
2738
-
2739
- /* create new sub-table if needed */
2740
- if (len > root && (huff & mask) !== low) {
2741
- /* if first time, transition to sub-tables */
2742
- if (drop === 0) {
2743
- drop = root;
2744
- }
2745
-
2746
- /* increment past last table */
2747
- next += min; /* here min is 1 << curr */
2748
-
2749
- /* determine length of next table */
2750
- curr = len - drop;
2751
- left = 1 << curr;
2752
- while (curr + drop < max) {
2753
- left -= count[curr + drop];
2754
- if (left <= 0) { break; }
2755
- curr++;
2756
- left <<= 1;
2757
- }
2758
-
2759
- /* check for enough space */
2760
- used += 1 << curr;
2761
- if ((type === LENS && used > ENOUGH_LENS) ||
2762
- (type === DISTS && used > ENOUGH_DISTS)) {
2763
- return 1;
2764
- }
2765
-
2766
- /* point entry in root table to sub-table */
2767
- low = huff & mask;
2768
- /*table.op[low] = curr;
2769
- table.bits[low] = root;
2770
- table.val[low] = next - opts.table_index;*/
2771
- table[low] = (root << 24) | (curr << 16) | (next - table_index) |0;
2772
- }
2773
- }
2774
-
2775
- /* fill in remaining table entry if code is incomplete (guaranteed to have
2776
- at most one remaining entry, since if the code is incomplete, the
2777
- maximum code length that was allowed to get this far is one bit) */
2778
- if (huff !== 0) {
2779
- //table.op[next + huff] = 64; /* invalid code marker */
2780
- //table.bits[next + huff] = len - drop;
2781
- //table.val[next + huff] = 0;
2782
- table[next + huff] = ((len - drop) << 24) | (64 << 16) |0;
2783
- }
2784
-
2785
- /* set return parameters */
2786
- //opts.table_index += used;
2787
- opts.bits = root;
2788
- return 0;
2789
- };
2790
-
2791
- },{"../utils/common":1}],10:[function(require,module,exports){
2792
- 'use strict';
2793
-
2794
- // (C) 1995-2013 Jean-loup Gailly and Mark Adler
2795
- // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin
2796
- //
2797
- // This software is provided 'as-is', without any express or implied
2798
- // warranty. In no event will the authors be held liable for any damages
2799
- // arising from the use of this software.
2800
- //
2801
- // Permission is granted to anyone to use this software for any purpose,
2802
- // including commercial applications, and to alter it and redistribute it
2803
- // freely, subject to the following restrictions:
2804
- //
2805
- // 1. The origin of this software must not be misrepresented; you must not
2806
- // claim that you wrote the original software. If you use this software
2807
- // in a product, an acknowledgment in the product documentation would be
2808
- // appreciated but is not required.
2809
- // 2. Altered source versions must be plainly marked as such, and must not be
2810
- // misrepresented as being the original software.
2811
- // 3. This notice may not be removed or altered from any source distribution.
2812
-
2813
- module.exports = {
2814
- 2: 'need dictionary', /* Z_NEED_DICT 2 */
2815
- 1: 'stream end', /* Z_STREAM_END 1 */
2816
- 0: '', /* Z_OK 0 */
2817
- '-1': 'file error', /* Z_ERRNO (-1) */
2818
- '-2': 'stream error', /* Z_STREAM_ERROR (-2) */
2819
- '-3': 'data error', /* Z_DATA_ERROR (-3) */
2820
- '-4': 'insufficient memory', /* Z_MEM_ERROR (-4) */
2821
- '-5': 'buffer error', /* Z_BUF_ERROR (-5) */
2822
- '-6': 'incompatible version' /* Z_VERSION_ERROR (-6) */
2823
- };
2824
-
2825
- },{}],11:[function(require,module,exports){
2826
- 'use strict';
2827
-
2828
- // (C) 1995-2013 Jean-loup Gailly and Mark Adler
2829
- // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin
2830
- //
2831
- // This software is provided 'as-is', without any express or implied
2832
- // warranty. In no event will the authors be held liable for any damages
2833
- // arising from the use of this software.
2834
- //
2835
- // Permission is granted to anyone to use this software for any purpose,
2836
- // including commercial applications, and to alter it and redistribute it
2837
- // freely, subject to the following restrictions:
2838
- //
2839
- // 1. The origin of this software must not be misrepresented; you must not
2840
- // claim that you wrote the original software. If you use this software
2841
- // in a product, an acknowledgment in the product documentation would be
2842
- // appreciated but is not required.
2843
- // 2. Altered source versions must be plainly marked as such, and must not be
2844
- // misrepresented as being the original software.
2845
- // 3. This notice may not be removed or altered from any source distribution.
2846
-
2847
- function ZStream() {
2848
- /* next input byte */
2849
- this.input = null; // JS specific, because we have no pointers
2850
- this.next_in = 0;
2851
- /* number of bytes available at input */
2852
- this.avail_in = 0;
2853
- /* total number of input bytes read so far */
2854
- this.total_in = 0;
2855
- /* next output byte should be put there */
2856
- this.output = null; // JS specific, because we have no pointers
2857
- this.next_out = 0;
2858
- /* remaining free space at output */
2859
- this.avail_out = 0;
2860
- /* total number of bytes output so far */
2861
- this.total_out = 0;
2862
- /* last error message, NULL if no error */
2863
- this.msg = ''/*Z_NULL*/;
2864
- /* not visible by applications */
2865
- this.state = null;
2866
- /* best guess about the data type: binary or text */
2867
- this.data_type = 2/*Z_UNKNOWN*/;
2868
- /* adler32 value of the uncompressed data */
2869
- this.adler = 0;
2870
- }
2871
-
2872
- module.exports = ZStream;
2873
-
2874
- },{}],"/lib/inflate.js":[function(require,module,exports){
2875
- 'use strict';
2876
-
2877
-
2878
- var zlib_inflate = require('./zlib/inflate');
2879
- var utils = require('./utils/common');
2880
- var strings = require('./utils/strings');
2881
- var c = require('./zlib/constants');
2882
- var msg = require('./zlib/messages');
2883
- var ZStream = require('./zlib/zstream');
2884
- var GZheader = require('./zlib/gzheader');
2885
-
2886
- var toString = Object.prototype.toString;
2887
-
2888
- /**
2889
- * class Inflate
2890
- *
2891
- * Generic JS-style wrapper for zlib calls. If you don't need
2892
- * streaming behaviour - use more simple functions: [[inflate]]
2893
- * and [[inflateRaw]].
2894
- **/
2895
-
2896
- /* internal
2897
- * inflate.chunks -> Array
2898
- *
2899
- * Chunks of output data, if [[Inflate#onData]] not overridden.
2900
- **/
2901
-
2902
- /**
2903
- * Inflate.result -> Uint8Array|Array|String
2904
- *
2905
- * Uncompressed result, generated by default [[Inflate#onData]]
2906
- * and [[Inflate#onEnd]] handlers. Filled after you push last chunk
2907
- * (call [[Inflate#push]] with `Z_FINISH` / `true` param) or if you
2908
- * push a chunk with explicit flush (call [[Inflate#push]] with
2909
- * `Z_SYNC_FLUSH` param).
2910
- **/
2911
-
2912
- /**
2913
- * Inflate.err -> Number
2914
- *
2915
- * Error code after inflate finished. 0 (Z_OK) on success.
2916
- * Should be checked if broken data possible.
2917
- **/
2918
-
2919
- /**
2920
- * Inflate.msg -> String
2921
- *
2922
- * Error message, if [[Inflate.err]] != 0
2923
- **/
2924
-
2925
-
2926
- /**
2927
- * new Inflate(options)
2928
- * - options (Object): zlib inflate options.
2929
- *
2930
- * Creates new inflator instance with specified params. Throws exception
2931
- * on bad params. Supported options:
2932
- *
2933
- * - `windowBits`
2934
- * - `dictionary`
2935
- *
2936
- * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced)
2937
- * for more information on these.
2938
- *
2939
- * Additional options, for internal needs:
2940
- *
2941
- * - `chunkSize` - size of generated data chunks (16K by default)
2942
- * - `raw` (Boolean) - do raw inflate
2943
- * - `to` (String) - if equal to 'string', then result will be converted
2944
- * from utf8 to utf16 (javascript) string. When string output requested,
2945
- * chunk length can differ from `chunkSize`, depending on content.
2946
- *
2947
- * By default, when no options set, autodetect deflate/gzip data format via
2948
- * wrapper header.
2949
- *
2950
- * ##### Example:
2951
- *
2952
- * ```javascript
2953
- * var pako = require('pako')
2954
- * , chunk1 = Uint8Array([1,2,3,4,5,6,7,8,9])
2955
- * , chunk2 = Uint8Array([10,11,12,13,14,15,16,17,18,19]);
2956
- *
2957
- * var inflate = new pako.Inflate({ level: 3});
2958
- *
2959
- * inflate.push(chunk1, false);
2960
- * inflate.push(chunk2, true); // true -> last chunk
2961
- *
2962
- * if (inflate.err) { throw new Error(inflate.err); }
2963
- *
2964
- * console.log(inflate.result);
2965
- * ```
2966
- **/
2967
- function Inflate(options) {
2968
- if (!(this instanceof Inflate)) return new Inflate(options);
2969
-
2970
- this.options = utils.assign({
2971
- chunkSize: 16384,
2972
- windowBits: 0,
2973
- to: ''
2974
- }, options || {});
2975
-
2976
- var opt = this.options;
2977
-
2978
- // Force window size for `raw` data, if not set directly,
2979
- // because we have no header for autodetect.
2980
- if (opt.raw && (opt.windowBits >= 0) && (opt.windowBits < 16)) {
2981
- opt.windowBits = -opt.windowBits;
2982
- if (opt.windowBits === 0) { opt.windowBits = -15; }
2983
- }
2984
-
2985
- // If `windowBits` not defined (and mode not raw) - set autodetect flag for gzip/deflate
2986
- if ((opt.windowBits >= 0) && (opt.windowBits < 16) &&
2987
- !(options && options.windowBits)) {
2988
- opt.windowBits += 32;
2989
- }
2990
-
2991
- // Gzip header has no info about windows size, we can do autodetect only
2992
- // for deflate. So, if window size not set, force it to max when gzip possible
2993
- if ((opt.windowBits > 15) && (opt.windowBits < 48)) {
2994
- // bit 3 (16) -> gzipped data
2995
- // bit 4 (32) -> autodetect gzip/deflate
2996
- if ((opt.windowBits & 15) === 0) {
2997
- opt.windowBits |= 15;
2998
- }
2999
- }
3000
-
3001
- this.err = 0; // error code, if happens (0 = Z_OK)
3002
- this.msg = ''; // error message
3003
- this.ended = false; // used to avoid multiple onEnd() calls
3004
- this.chunks = []; // chunks of compressed data
3005
-
3006
- this.strm = new ZStream();
3007
- this.strm.avail_out = 0;
3008
-
3009
- var status = zlib_inflate.inflateInit2(
3010
- this.strm,
3011
- opt.windowBits
3012
- );
3013
-
3014
- if (status !== c.Z_OK) {
3015
- throw new Error(msg[status]);
3016
- }
3017
-
3018
- this.header = new GZheader();
3019
-
3020
- zlib_inflate.inflateGetHeader(this.strm, this.header);
3021
-
3022
- // Setup dictionary
3023
- if (opt.dictionary) {
3024
- // Convert data if needed
3025
- if (typeof opt.dictionary === 'string') {
3026
- opt.dictionary = strings.string2buf(opt.dictionary);
3027
- } else if (toString.call(opt.dictionary) === '[object ArrayBuffer]') {
3028
- opt.dictionary = new Uint8Array(opt.dictionary);
3029
- }
3030
- if (opt.raw) { //In raw mode we need to set the dictionary early
3031
- status = zlib_inflate.inflateSetDictionary(this.strm, opt.dictionary);
3032
- if (status !== c.Z_OK) {
3033
- throw new Error(msg[status]);
3034
- }
3035
- }
3036
- }
3037
- }
3038
-
3039
- /**
3040
- * Inflate#push(data[, mode]) -> Boolean
3041
- * - data (Uint8Array|Array|ArrayBuffer|String): input data
3042
- * - mode (Number|Boolean): 0..6 for corresponding Z_NO_FLUSH..Z_TREE modes.
3043
- * See constants. Skipped or `false` means Z_NO_FLUSH, `true` means Z_FINISH.
3044
- *
3045
- * Sends input data to inflate pipe, generating [[Inflate#onData]] calls with
3046
- * new output chunks. Returns `true` on success. The last data block must have
3047
- * mode Z_FINISH (or `true`). That will flush internal pending buffers and call
3048
- * [[Inflate#onEnd]]. For interim explicit flushes (without ending the stream) you
3049
- * can use mode Z_SYNC_FLUSH, keeping the decompression context.
3050
- *
3051
- * On fail call [[Inflate#onEnd]] with error code and return false.
3052
- *
3053
- * We strongly recommend to use `Uint8Array` on input for best speed (output
3054
- * format is detected automatically). Also, don't skip last param and always
3055
- * use the same type in your code (boolean or number). That will improve JS speed.
3056
- *
3057
- * For regular `Array`-s make sure all elements are [0..255].
3058
- *
3059
- * ##### Example
3060
- *
3061
- * ```javascript
3062
- * push(chunk, false); // push one of data chunks
3063
- * ...
3064
- * push(chunk, true); // push last chunk
3065
- * ```
3066
- **/
3067
- Inflate.prototype.push = function (data, mode) {
3068
- var strm = this.strm;
3069
- var chunkSize = this.options.chunkSize;
3070
- var dictionary = this.options.dictionary;
3071
- var status, _mode;
3072
- var next_out_utf8, tail, utf8str;
3073
-
3074
- // Flag to properly process Z_BUF_ERROR on testing inflate call
3075
- // when we check that all output data was flushed.
3076
- var allowBufError = false;
3077
-
3078
- if (this.ended) { return false; }
3079
- _mode = (mode === ~~mode) ? mode : ((mode === true) ? c.Z_FINISH : c.Z_NO_FLUSH);
3080
-
3081
- // Convert data if needed
3082
- if (typeof data === 'string') {
3083
- // Only binary strings can be decompressed on practice
3084
- strm.input = strings.binstring2buf(data);
3085
- } else if (toString.call(data) === '[object ArrayBuffer]') {
3086
- strm.input = new Uint8Array(data);
3087
- } else {
3088
- strm.input = data;
3089
- }
3090
-
3091
- strm.next_in = 0;
3092
- strm.avail_in = strm.input.length;
3093
-
3094
- do {
3095
- if (strm.avail_out === 0) {
3096
- strm.output = new utils.Buf8(chunkSize);
3097
- strm.next_out = 0;
3098
- strm.avail_out = chunkSize;
3099
- }
3100
-
3101
- status = zlib_inflate.inflate(strm, c.Z_NO_FLUSH); /* no bad return value */
3102
-
3103
- if (status === c.Z_NEED_DICT && dictionary) {
3104
- status = zlib_inflate.inflateSetDictionary(this.strm, dictionary);
3105
- }
3106
-
3107
- if (status === c.Z_BUF_ERROR && allowBufError === true) {
3108
- status = c.Z_OK;
3109
- allowBufError = false;
3110
- }
3111
-
3112
- if (status !== c.Z_STREAM_END && status !== c.Z_OK) {
3113
- this.onEnd(status);
3114
- this.ended = true;
3115
- return false;
3116
- }
3117
-
3118
- if (strm.next_out) {
3119
- if (strm.avail_out === 0 || status === c.Z_STREAM_END || (strm.avail_in === 0 && (_mode === c.Z_FINISH || _mode === c.Z_SYNC_FLUSH))) {
3120
-
3121
- if (this.options.to === 'string') {
3122
-
3123
- next_out_utf8 = strings.utf8border(strm.output, strm.next_out);
3124
-
3125
- tail = strm.next_out - next_out_utf8;
3126
- utf8str = strings.buf2string(strm.output, next_out_utf8);
3127
-
3128
- // move tail
3129
- strm.next_out = tail;
3130
- strm.avail_out = chunkSize - tail;
3131
- if (tail) { utils.arraySet(strm.output, strm.output, next_out_utf8, tail, 0); }
3132
-
3133
- this.onData(utf8str);
3134
-
3135
- } else {
3136
- this.onData(utils.shrinkBuf(strm.output, strm.next_out));
3137
- }
3138
- }
3139
- }
3140
-
3141
- // When no more input data, we should check that internal inflate buffers
3142
- // are flushed. The only way to do it when avail_out = 0 - run one more
3143
- // inflate pass. But if output data not exists, inflate return Z_BUF_ERROR.
3144
- // Here we set flag to process this error properly.
3145
- //
3146
- // NOTE. Deflate does not return error in this case and does not needs such
3147
- // logic.
3148
- if (strm.avail_in === 0 && strm.avail_out === 0) {
3149
- allowBufError = true;
3150
- }
3151
-
3152
- } while ((strm.avail_in > 0 || strm.avail_out === 0) && status !== c.Z_STREAM_END);
3153
-
3154
- if (status === c.Z_STREAM_END) {
3155
- _mode = c.Z_FINISH;
3156
- }
3157
-
3158
- // Finalize on the last chunk.
3159
- if (_mode === c.Z_FINISH) {
3160
- status = zlib_inflate.inflateEnd(this.strm);
3161
- this.onEnd(status);
3162
- this.ended = true;
3163
- return status === c.Z_OK;
3164
- }
3165
-
3166
- // callback interim results if Z_SYNC_FLUSH.
3167
- if (_mode === c.Z_SYNC_FLUSH) {
3168
- this.onEnd(c.Z_OK);
3169
- strm.avail_out = 0;
3170
- return true;
3171
- }
3172
-
3173
- return true;
3174
- };
3175
-
3176
-
3177
- /**
3178
- * Inflate#onData(chunk) -> Void
3179
- * - chunk (Uint8Array|Array|String): output data. Type of array depends
3180
- * on js engine support. When string output requested, each chunk
3181
- * will be string.
3182
- *
3183
- * By default, stores data blocks in `chunks[]` property and glue
3184
- * those in `onEnd`. Override this handler, if you need another behaviour.
3185
- **/
3186
- Inflate.prototype.onData = function (chunk) {
3187
- this.chunks.push(chunk);
3188
- };
3189
-
3190
-
3191
- /**
3192
- * Inflate#onEnd(status) -> Void
3193
- * - status (Number): inflate status. 0 (Z_OK) on success,
3194
- * other if not.
3195
- *
3196
- * Called either after you tell inflate that the input stream is
3197
- * complete (Z_FINISH) or should be flushed (Z_SYNC_FLUSH)
3198
- * or if an error happened. By default - join collected chunks,
3199
- * free memory and fill `results` / `err` properties.
3200
- **/
3201
- Inflate.prototype.onEnd = function (status) {
3202
- // On success - join
3203
- if (status === c.Z_OK) {
3204
- if (this.options.to === 'string') {
3205
- // Glue & convert here, until we teach pako to send
3206
- // utf8 aligned strings to onData
3207
- this.result = this.chunks.join('');
3208
- } else {
3209
- this.result = utils.flattenChunks(this.chunks);
3210
- }
3211
- }
3212
- this.chunks = [];
3213
- this.err = status;
3214
- this.msg = this.strm.msg;
3215
- };
3216
-
3217
-
3218
- /**
3219
- * inflate(data[, options]) -> Uint8Array|Array|String
3220
- * - data (Uint8Array|Array|String): input data to decompress.
3221
- * - options (Object): zlib inflate options.
3222
- *
3223
- * Decompress `data` with inflate/ungzip and `options`. Autodetect
3224
- * format via wrapper header by default. That's why we don't provide
3225
- * separate `ungzip` method.
3226
- *
3227
- * Supported options are:
3228
- *
3229
- * - windowBits
3230
- *
3231
- * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced)
3232
- * for more information.
3233
- *
3234
- * Sugar (options):
3235
- *
3236
- * - `raw` (Boolean) - say that we work with raw stream, if you don't wish to specify
3237
- * negative windowBits implicitly.
3238
- * - `to` (String) - if equal to 'string', then result will be converted
3239
- * from utf8 to utf16 (javascript) string. When string output requested,
3240
- * chunk length can differ from `chunkSize`, depending on content.
3241
- *
3242
- *
3243
- * ##### Example:
3244
- *
3245
- * ```javascript
3246
- * var pako = require('pako')
3247
- * , input = pako.deflate([1,2,3,4,5,6,7,8,9])
3248
- * , output;
3249
- *
3250
- * try {
3251
- * output = pako.inflate(input);
3252
- * } catch (err)
3253
- * console.log(err);
3254
- * }
3255
- * ```
3256
- **/
3257
- function inflate(input, options) {
3258
- var inflator = new Inflate(options);
3259
-
3260
- inflator.push(input, true);
3261
-
3262
- // That will never happens, if you don't cheat with options :)
3263
- if (inflator.err) { throw inflator.msg || msg[inflator.err]; }
3264
-
3265
- return inflator.result;
3266
- }
3267
-
3268
-
3269
- /**
3270
- * inflateRaw(data[, options]) -> Uint8Array|Array|String
3271
- * - data (Uint8Array|Array|String): input data to decompress.
3272
- * - options (Object): zlib inflate options.
3273
- *
3274
- * The same as [[inflate]], but creates raw data, without wrapper
3275
- * (header and adler32 crc).
3276
- **/
3277
- function inflateRaw(input, options) {
3278
- options = options || {};
3279
- options.raw = true;
3280
- return inflate(input, options);
3281
- }
3282
-
3283
-
3284
- /**
3285
- * ungzip(data[, options]) -> Uint8Array|Array|String
3286
- * - data (Uint8Array|Array|String): input data to decompress.
3287
- * - options (Object): zlib inflate options.
3288
- *
3289
- * Just shortcut to [[inflate]], because it autodetects format
3290
- * by header.content. Done for convenience.
3291
- **/
3292
-
3293
-
3294
- exports.Inflate = Inflate;
3295
- exports.inflate = inflate;
3296
- exports.inflateRaw = inflateRaw;
3297
- exports.ungzip = inflate;
3298
-
3299
- },{"./utils/common":1,"./utils/strings":2,"./zlib/constants":4,"./zlib/gzheader":6,"./zlib/inflate":8,"./zlib/messages":10,"./zlib/zstream":11}]},{},[])("/lib/inflate.js")
3300
- });