@corellium/corellium-cli 1.0.2 → 1.0.4
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +4 -16
- package/docs/OVERVIEW.md +2 -2
- package/example/WebPlayerSample.js +93 -37
- package/jenkinsbuild/build.sh +1 -1
- package/node_modules/@babel/cli/node_modules/commander/package.json +27 -58
- package/node_modules/@babel/cli/node_modules/make-dir/package.json +62 -93
- package/node_modules/@babel/cli/node_modules/pify/package.json +54 -85
- package/node_modules/@babel/cli/node_modules/semver/package.json +20 -51
- package/node_modules/@babel/cli/node_modules/slash/package.json +37 -68
- package/node_modules/@babel/cli/package.json +37 -69
- package/node_modules/@corellium/client-api/package.json +15 -40
- package/node_modules/@jridgewell/resolve-uri/package.json +40 -75
- package/node_modules/@jridgewell/sourcemap-codec/package.json +43 -74
- package/node_modules/@jridgewell/trace-mapping/package.json +40 -72
- package/node_modules/@mapbox/node-pre-gyp/package.json +27 -61
- package/node_modules/@nicolo-ribaudo/chokidar-2/package.json +22 -55
- package/node_modules/abbrev/package.json +18 -52
- package/node_modules/agent-base/package.json +33 -62
- package/node_modules/ansi-regex/package.json +58 -89
- package/node_modules/ansi-styles/package.json +59 -95
- package/node_modules/anymatch/package.json +28 -56
- package/node_modules/aproba/package.json +23 -50
- package/node_modules/are-we-there-yet/node_modules/readable-stream/package.json +32 -60
- package/node_modules/are-we-there-yet/package.json +32 -62
- package/node_modules/ascii-art/package.json +51 -83
- package/node_modules/ascii-art-ansi/package.json +30 -61
- package/node_modules/ascii-art-braille/package.json +7 -32
- package/node_modules/ascii-art-font/package.json +17 -47
- package/node_modules/ascii-art-graph/package.json +10 -34
- package/node_modules/ascii-art-image/node_modules/ascii-art-braille/package.json +7 -32
- package/node_modules/ascii-art-image/package.json +11 -36
- package/node_modules/ascii-art-table/package.json +10 -35
- package/node_modules/ascii-art-utf/package.json +18 -47
- package/node_modules/async/package.json +29 -55
- package/node_modules/async-arrays/package.json +34 -62
- package/node_modules/asynckit/package.json +45 -74
- package/node_modules/axios/package.json +46 -72
- package/node_modules/balanced-match/package.json +22 -49
- package/node_modules/binary-extensions/package.json +41 -73
- package/node_modules/brace-expansion/package.json +23 -50
- package/node_modules/braces/package.json +30 -76
- package/node_modules/call-bind/package.json +83 -125
- package/node_modules/canvas/package.json +43 -86
- package/node_modules/chokidar/package.json +40 -74
- package/node_modules/chownr/package.json +24 -56
- package/node_modules/cli/package.json +23 -70
- package/node_modules/cliui/package.json +53 -87
- package/node_modules/color/node_modules/color-convert/package.json +26 -60
- package/node_modules/color/node_modules/color-name/package.json +18 -45
- package/node_modules/color/package.json +26 -57
- package/node_modules/color-convert/package.json +25 -59
- package/node_modules/color-difference/package.json +26 -52
- package/node_modules/color-model/package.json +17 -44
- package/node_modules/color-name/package.json +32 -60
- package/node_modules/color-string/package.json +26 -67
- package/node_modules/color-support/package.json +26 -60
- package/node_modules/combined-stream/package.json +19 -52
- package/node_modules/component-emitter/package.json +17 -45
- package/node_modules/concat-map/package.json +45 -89
- package/node_modules/console-control-strings/package.json +22 -55
- package/node_modules/convert-source-map/package.json +28 -55
- package/node_modules/cookiejar/package.json +16 -44
- package/node_modules/core-util-is/package.json +21 -51
- package/node_modules/d3/package.json +43 -70
- package/node_modules/d3-array/package.json +24 -55
- package/node_modules/d3-axis/package.json +27 -54
- package/node_modules/d3-brush/package.json +33 -60
- package/node_modules/d3-chord/package.json +28 -55
- package/node_modules/d3-collection/package.json +25 -54
- package/node_modules/d3-color/package.json +2 -2
- package/node_modules/d3-contour/package.json +27 -54
- package/node_modules/d3-dispatch/package.json +28 -60
- package/node_modules/d3-drag/package.json +32 -61
- package/node_modules/d3-dsv/node_modules/commander/package.json +25 -56
- package/node_modules/d3-dsv/package.json +36 -64
- package/node_modules/d3-ease/package.json +28 -56
- package/node_modules/d3-fetch/package.json +31 -58
- package/node_modules/d3-force/package.json +30 -57
- package/node_modules/d3-format/package.json +29 -57
- package/node_modules/d3-geo/package.json +35 -62
- package/node_modules/d3-hierarchy/package.json +33 -60
- package/node_modules/d3-interpolate/package.json +31 -63
- package/node_modules/d3-path/package.json +28 -57
- package/node_modules/d3-polygon/package.json +28 -55
- package/node_modules/d3-quadtree/package.json +29 -57
- package/node_modules/d3-random/package.json +26 -53
- package/node_modules/d3-scale/package.json +29 -56
- package/node_modules/d3-scale-chromatic/package.json +33 -60
- package/node_modules/d3-selection/package.json +29 -60
- package/node_modules/d3-shape/package.json +32 -59
- package/node_modules/d3-time/package.json +28 -57
- package/node_modules/d3-time-format/package.json +33 -61
- package/node_modules/d3-timer/package.json +28 -57
- package/node_modules/d3-transition/package.json +35 -64
- package/node_modules/d3-voronoi/package.json +24 -51
- package/node_modules/d3-zoom/package.json +34 -61
- package/node_modules/debug/package.json +37 -87
- package/node_modules/decompress-response/package.json +53 -84
- package/node_modules/delayed-stream/package.json +19 -53
- package/node_modules/delegates/package.json +11 -45
- package/node_modules/detect-libc/package.json +26 -60
- package/node_modules/dirname-shim/package.json +26 -60
- package/node_modules/dotenv/package.json +37 -64
- package/node_modules/duplexer/package.json +18 -49
- package/node_modules/emoji-regex/package.json +32 -58
- package/node_modules/escalade/package.json +28 -59
- package/node_modules/extended-emitter/package.json +37 -65
- package/node_modules/fast-safe-stringify/package.json +33 -73
- package/node_modules/fill-range/package.json +28 -72
- package/node_modules/follow-redirects/package.json +42 -77
- package/node_modules/form-data/package.json +42 -74
- package/node_modules/formidable/package.json +22 -52
- package/node_modules/fs-minipass/package.json +24 -52
- package/node_modules/fs-readdir-recursive/package.json +20 -50
- package/node_modules/fs.realpath/package.json +21 -53
- package/node_modules/fsevents/package.json +38 -63
- package/node_modules/ftp-response-parser/node_modules/isarray/package.json +22 -54
- package/node_modules/ftp-response-parser/node_modules/readable-stream/package.json +22 -55
- package/node_modules/ftp-response-parser/node_modules/string_decoder/package.json +17 -45
- package/node_modules/ftp-response-parser/package.json +23 -64
- package/node_modules/function-bind/package.json +28 -61
- package/node_modules/gauge/package.json +25 -52
- package/node_modules/generate-password/package.json +28 -54
- package/node_modules/get-caller-file/package.json +27 -53
- package/node_modules/get-intrinsic/package.json +91 -124
- package/node_modules/glob/package.json +34 -68
- package/node_modules/glob-parent/package.json +27 -70
- package/node_modules/has/package.json +26 -55
- package/node_modules/has-symbols/package.json +104 -133
- package/node_modules/has-unicode/package.json +25 -52
- package/node_modules/https-proxy-agent/package.json +30 -59
- package/node_modules/iconv-lite/package.json +48 -77
- package/node_modules/inflight/package.json +20 -48
- package/node_modules/inherits/package.json +17 -54
- package/node_modules/is-binary-path/package.json +43 -75
- package/node_modules/is-extglob/package.json +22 -52
- package/node_modules/is-fullwidth-code-point/package.json +45 -79
- package/node_modules/is-glob/package.json +26 -68
- package/node_modules/is-number/package.json +26 -65
- package/node_modules/jsftp/node_modules/debug/package.json +28 -67
- package/node_modules/jsftp/package.json +22 -59
- package/node_modules/json2csv/node_modules/commander/package.json +25 -56
- package/node_modules/json2csv/package.json +37 -64
- package/node_modules/jsonparse/package.json +18 -53
- package/node_modules/lodash/package.json +15 -61
- package/node_modules/lodash.get/package.json +16 -67
- package/node_modules/lru-cache/package.json +27 -61
- package/node_modules/make-dir/node_modules/semver/package.json +20 -51
- package/node_modules/make-dir/package.json +62 -93
- package/node_modules/maplex/package.json +22 -54
- package/node_modules/methods/package.json +22 -64
- package/node_modules/mime/package.json +20 -48
- package/node_modules/mime-db/package.json +25 -67
- package/node_modules/mime-types/package.json +20 -64
- package/node_modules/mimic-response/package.json +45 -76
- package/node_modules/minimatch/package.json +25 -61
- package/node_modules/minipass/package.json +30 -64
- package/node_modules/minizlib/package.json +27 -59
- package/node_modules/mkdirp/package.json +27 -57
- package/node_modules/ms/package.json +24 -58
- package/node_modules/multi-progress/package.json +20 -46
- package/node_modules/nan/package.json +27 -87
- package/node_modules/node-fetch/package.json +77 -104
- package/node_modules/nopt/package.json +22 -54
- package/node_modules/normalize-path/package.json +25 -63
- package/node_modules/npmlog/package.json +23 -55
- package/node_modules/object-assign/package.json +20 -51
- package/node_modules/object-inspect/package.json +53 -81
- package/node_modules/once/package.json +19 -56
- package/node_modules/parse-listing/package.json +27 -56
- package/node_modules/path-is-absolute/package.json +16 -47
- package/node_modules/picomatch/package.json +28 -60
- package/node_modules/progress/package.json +21 -65
- package/node_modules/qs/package.json +78 -105
- package/node_modules/readdirp/package.json +47 -83
- package/node_modules/require-directory/package.json +29 -57
- package/node_modules/rimraf/package.json +23 -61
- package/node_modules/rw/package.json +19 -46
- package/node_modules/safe-buffer/package.json +10 -38
- package/node_modules/safer-buffer/package.json +18 -43
- package/node_modules/semver/package.json +36 -70
- package/node_modules/set-blocking/package.json +29 -56
- package/node_modules/side-channel/package.json +70 -98
- package/node_modules/sift/package.json +30 -62
- package/node_modules/signal-exit/package.json +29 -58
- package/node_modules/simple-concat/package.json +22 -46
- package/node_modules/simple-get/package.json +9 -33
- package/node_modules/simple-swizzle/node_modules/is-arrayish/package.json +28 -59
- package/node_modules/simple-swizzle/package.json +23 -57
- package/node_modules/strangler/package.json +39 -67
- package/node_modules/stream-combiner/package.json +15 -48
- package/node_modules/string-tools/package.json +16 -50
- package/node_modules/string-width/package.json +59 -97
- package/node_modules/string_decoder/package.json +18 -47
- package/node_modules/strip-ansi/package.json +57 -94
- package/node_modules/superagent/node_modules/form-data/package.json +42 -74
- package/node_modules/superagent/node_modules/readable-stream/package.json +32 -60
- package/node_modules/superagent/package.json +13 -59
- package/node_modules/tar/package.json +27 -59
- package/node_modules/through/package.json +17 -50
- package/node_modules/to-regex-range/package.json +25 -61
- package/node_modules/tr46/package.json +24 -51
- package/node_modules/unorm/package.json +34 -75
- package/node_modules/util-deprecate/package.json +19 -49
- package/node_modules/uuid/package.json +74 -102
- package/node_modules/webidl-conversions/package.json +18 -53
- package/node_modules/whatwg-url/package.json +15 -49
- package/node_modules/wide-align/package.json +21 -53
- package/node_modules/wolfy87-eventemitter/package.json +25 -49
- package/node_modules/wrap-ansi/package.json +65 -97
- package/node_modules/wrappy/package.json +21 -50
- package/node_modules/y18n/package.json +43 -73
- package/node_modules/yallist/package.json +20 -55
- package/node_modules/yargs/package.json +72 -99
- package/node_modules/yargs-parser/package.json +52 -83
- package/package.json +2 -3
- package/src/TrialAccount.js +76 -0
- package/src/commands/agent/Agent.js +10 -19
- package/src/commands/agent/index.js +1 -0
- package/src/commands/agent/ready.js +42 -0
- package/src/commands/instances/list.js +8 -3
- package/src/commands/signup.js +14 -5
- package/src/commands/webplayer/WebPlayer.js +2 -1
- package/src/commands/webplayer/create.js +6 -0
- package/src/commands/webplayer/list.js +17 -16
- package/src/logging.js +1 -1
- package/src/profile.js +12 -9
- package/src/resumable.js +1314 -0
- package/src/table.js +7 -2
- package/src/upload.js +64 -2
- package/test/test.js +89 -0
- package/node_modules/@corellium/corellium-api/README.md +0 -1210
- package/node_modules/@corellium/corellium-api/node_modules/form-data/License +0 -19
- package/node_modules/@corellium/corellium-api/node_modules/form-data/README.md.bak +0 -356
- package/node_modules/@corellium/corellium-api/node_modules/form-data/Readme.md +0 -356
- package/node_modules/@corellium/corellium-api/node_modules/form-data/index.d.ts +0 -62
- package/node_modules/@corellium/corellium-api/node_modules/form-data/lib/browser.js +0 -2
- package/node_modules/@corellium/corellium-api/node_modules/form-data/lib/form_data.js +0 -498
- package/node_modules/@corellium/corellium-api/node_modules/form-data/lib/populate.js +0 -10
- package/node_modules/@corellium/corellium-api/node_modules/form-data/package.json +0 -104
- package/node_modules/@corellium/corellium-api/node_modules/uuid/AUTHORS +0 -5
- package/node_modules/@corellium/corellium-api/node_modules/uuid/CHANGELOG.md +0 -119
- package/node_modules/@corellium/corellium-api/node_modules/uuid/LICENSE.md +0 -21
- package/node_modules/@corellium/corellium-api/node_modules/uuid/README.md +0 -276
- package/node_modules/@corellium/corellium-api/node_modules/uuid/bin/uuid +0 -65
- package/node_modules/@corellium/corellium-api/node_modules/uuid/index.js +0 -8
- package/node_modules/@corellium/corellium-api/node_modules/uuid/lib/bytesToUuid.js +0 -26
- package/node_modules/@corellium/corellium-api/node_modules/uuid/lib/md5-browser.js +0 -216
- package/node_modules/@corellium/corellium-api/node_modules/uuid/lib/md5.js +0 -25
- package/node_modules/@corellium/corellium-api/node_modules/uuid/lib/rng-browser.js +0 -34
- package/node_modules/@corellium/corellium-api/node_modules/uuid/lib/rng.js +0 -8
- package/node_modules/@corellium/corellium-api/node_modules/uuid/lib/sha1-browser.js +0 -89
- package/node_modules/@corellium/corellium-api/node_modules/uuid/lib/sha1.js +0 -25
- package/node_modules/@corellium/corellium-api/node_modules/uuid/lib/v35.js +0 -57
- package/node_modules/@corellium/corellium-api/node_modules/uuid/package.json +0 -103
- package/node_modules/@corellium/corellium-api/node_modules/uuid/v1.js +0 -109
- package/node_modules/@corellium/corellium-api/node_modules/uuid/v3.js +0 -4
- package/node_modules/@corellium/corellium-api/node_modules/uuid/v4.js +0 -29
- package/node_modules/@corellium/corellium-api/node_modules/uuid/v5.js +0 -3
- package/node_modules/@corellium/corellium-api/package.json +0 -106
- package/node_modules/@corellium/corellium-api/resumable.js +0 -1312
- package/node_modules/@corellium/corellium-api/src/agent.js +0 -962
- package/node_modules/@corellium/corellium-api/src/corellium.js +0 -444
- package/node_modules/@corellium/corellium-api/src/images.js +0 -131
- package/node_modules/@corellium/corellium-api/src/input.js +0 -178
- package/node_modules/@corellium/corellium-api/src/instance-updater.js +0 -56
- package/node_modules/@corellium/corellium-api/src/instance.js +0 -1031
- package/node_modules/@corellium/corellium-api/src/netmon.js +0 -308
- package/node_modules/@corellium/corellium-api/src/project.js +0 -393
- package/node_modules/@corellium/corellium-api/src/role.js +0 -65
- package/node_modules/@corellium/corellium-api/src/snapshot.js +0 -77
- package/node_modules/@corellium/corellium-api/src/team.js +0 -29
- package/node_modules/@corellium/corellium-api/src/user.js +0 -51
- package/node_modules/@corellium/corellium-api/src/util/fetch.js +0 -62
- package/node_modules/@corellium/corellium-api/src/util/sleep.js +0 -7
- package/node_modules/@corellium/corellium-api/test/integration-tests.js +0 -1292
- package/node_modules/@corellium/corellium-api/test/root-hook-set-flag-if-test-failed.js +0 -7
- package/node_modules/async-limiter/.eslintignore +0 -2
- package/node_modules/async-limiter/.nycrc +0 -10
- package/node_modules/async-limiter/.travis.yml +0 -9
- package/node_modules/async-limiter/LICENSE +0 -8
- package/node_modules/async-limiter/index.js +0 -67
- package/node_modules/async-limiter/package.json +0 -72
- package/node_modules/async-limiter/readme.md +0 -132
- package/node_modules/buffer-crc32/LICENSE +0 -19
- package/node_modules/buffer-crc32/README.md +0 -47
- package/node_modules/buffer-crc32/index.js +0 -111
- package/node_modules/buffer-crc32/package.json +0 -72
- package/node_modules/cross-fetch/LICENSE +0 -21
- package/node_modules/cross-fetch/README.md +0 -169
- package/node_modules/cross-fetch/dist/browser-polyfill.js +0 -532
- package/node_modules/cross-fetch/dist/browser-ponyfill.js +0 -554
- package/node_modules/cross-fetch/dist/cross-fetch.js +0 -2
- package/node_modules/cross-fetch/dist/cross-fetch.js.map +0 -1
- package/node_modules/cross-fetch/dist/node-polyfill.js +0 -11
- package/node_modules/cross-fetch/dist/node-ponyfill.js +0 -22
- package/node_modules/cross-fetch/dist/react-native-polyfill.js +0 -12
- package/node_modules/cross-fetch/dist/react-native-ponyfill.js +0 -6
- package/node_modules/cross-fetch/index.d.ts +0 -14
- package/node_modules/cross-fetch/package.json +0 -160
- package/node_modules/cross-fetch/polyfill/package.json +0 -8
- package/node_modules/duplexify/.travis.yml +0 -6
- package/node_modules/duplexify/LICENSE +0 -21
- package/node_modules/duplexify/README.md +0 -97
- package/node_modules/duplexify/example.js +0 -21
- package/node_modules/duplexify/index.js +0 -234
- package/node_modules/duplexify/package.json +0 -69
- package/node_modules/duplexify/test.js +0 -295
- package/node_modules/end-of-stream/LICENSE +0 -21
- package/node_modules/end-of-stream/README.md +0 -54
- package/node_modules/end-of-stream/index.js +0 -94
- package/node_modules/end-of-stream/package.json +0 -69
- package/node_modules/fast-stable-stringify/.npmignore +0 -4
- package/node_modules/fast-stable-stringify/.travis.yml +0 -10
- package/node_modules/fast-stable-stringify/LICENSE +0 -21
- package/node_modules/fast-stable-stringify/README.md +0 -81
- package/node_modules/fast-stable-stringify/cli/files-to-comparison-results.js +0 -67
- package/node_modules/fast-stable-stringify/cli/format-table.js +0 -70
- package/node_modules/fast-stable-stringify/cli/index.js +0 -19
- package/node_modules/fast-stable-stringify/fixtures/index.js +0 -5
- package/node_modules/fast-stable-stringify/fixtures/input-data-types.js +0 -191
- package/node_modules/fast-stable-stringify/fixtures/log-result.json +0 -22
- package/node_modules/fast-stable-stringify/fixtures/log.txt +0 -24
- package/node_modules/fast-stable-stringify/index.js +0 -73
- package/node_modules/fast-stable-stringify/karma.conf.js +0 -124
- package/node_modules/fast-stable-stringify/karma.conf.travis.js +0 -95
- package/node_modules/fast-stable-stringify/package.json +0 -77
- package/node_modules/fast-stable-stringify/results/escape-long/Chrome 60.0.3112 (Windows 7 0.0.0).json +0 -57
- package/node_modules/fast-stable-stringify/results/escape-long/Chrome Mobile 55.0.2883 (Android 6.0.0).json +0 -57
- package/node_modules/fast-stable-stringify/results/escape-long/Edge 14.14393.0 (Windows 10 0.0.0).json +0 -57
- package/node_modules/fast-stable-stringify/results/escape-long/Firefox 54.0.0 (Windows 7 0.0.0).json +0 -57
- package/node_modules/fast-stable-stringify/results/escape-long/IE 10.0.0 (Windows 7 0.0.0).json +0 -57
- package/node_modules/fast-stable-stringify/results/escape-long/IE 11.0.0 (Windows 7 0.0.0).json +0 -57
- package/node_modules/fast-stable-stringify/results/escape-long/IE 9.0.0 (Windows 7 0.0.0).json +0 -57
- package/node_modules/fast-stable-stringify/results/escape-long/Mobile Safari 10.0.0 (iOS 10.3.0).json +0 -57
- package/node_modules/fast-stable-stringify/results/escape-long/Safari 10.0.1 (Mac OS X 10.12.1).json +0 -57
- package/node_modules/fast-stable-stringify/results/escape-short/Chrome 60.0.3112 (Windows 7 0.0.0).json +0 -57
- package/node_modules/fast-stable-stringify/results/escape-short/Chrome Mobile 55.0.2883 (Android 6.0.0).json +0 -57
- package/node_modules/fast-stable-stringify/results/escape-short/Edge 14.14393.0 (Windows 10 0.0.0).json +0 -57
- package/node_modules/fast-stable-stringify/results/escape-short/Firefox 54.0.0 (Windows 7 0.0.0).json +0 -57
- package/node_modules/fast-stable-stringify/results/escape-short/IE 10.0.0 (Windows 7 0.0.0).json +0 -57
- package/node_modules/fast-stable-stringify/results/escape-short/IE 11.0.0 (Windows 7 0.0.0).json +0 -57
- package/node_modules/fast-stable-stringify/results/escape-short/IE 9.0.0 (Windows 7 0.0.0).json +0 -57
- package/node_modules/fast-stable-stringify/results/escape-short/Mobile Safari 10.0.0 (iOS 10.3.0).json +0 -57
- package/node_modules/fast-stable-stringify/results/escape-short/Safari 10.0.1 (Mac OS X 10.12.1).json +0 -57
- package/node_modules/fast-stable-stringify/results/escape.md +0 -20
- package/node_modules/fast-stable-stringify/results/itar-long/Chrome 60.0.3112 (Windows 7 0.0.0).json +0 -35
- package/node_modules/fast-stable-stringify/results/itar-long/Chrome Mobile 55.0.2883 (Android 6.0.0).json +0 -35
- package/node_modules/fast-stable-stringify/results/itar-long/Edge 14.14393.0 (Windows 10 0.0.0).json +0 -35
- package/node_modules/fast-stable-stringify/results/itar-long/Firefox 54.0.0 (Windows 7 0.0.0).json +0 -35
- package/node_modules/fast-stable-stringify/results/itar-long/IE 10.0.0 (Windows 7 0.0.0).json +0 -35
- package/node_modules/fast-stable-stringify/results/itar-long/IE 11.0.0 (Windows 7 0.0.0).json +0 -35
- package/node_modules/fast-stable-stringify/results/itar-long/IE 9.0.0 (Windows 7 0.0.0).json +0 -35
- package/node_modules/fast-stable-stringify/results/itar-long/Mobile Safari 10.0.0 (iOS 10.3.0).json +0 -35
- package/node_modules/fast-stable-stringify/results/itar-long/Safari 10.0.1 (Mac OS X 10.12.1).json +0 -35
- package/node_modules/fast-stable-stringify/results/itar-short/Chrome 60.0.3112 (Windows 7 0.0.0).json +0 -35
- package/node_modules/fast-stable-stringify/results/itar-short/Chrome Mobile 55.0.2883 (Android 6.0.0).json +0 -35
- package/node_modules/fast-stable-stringify/results/itar-short/Edge 14.14393.0 (Windows 10 0.0.0).json +0 -35
- package/node_modules/fast-stable-stringify/results/itar-short/Firefox 54.0.0 (Windows 7 0.0.0).json +0 -35
- package/node_modules/fast-stable-stringify/results/itar-short/IE 10.0.0 (Windows 7 0.0.0).json +0 -35
- package/node_modules/fast-stable-stringify/results/itar-short/IE 11.0.0 (Windows 7 0.0.0).json +0 -35
- package/node_modules/fast-stable-stringify/results/itar-short/IE 9.0.0 (Windows 7 0.0.0).json +0 -35
- package/node_modules/fast-stable-stringify/results/itar-short/Mobile Safari 10.0.0 (iOS 10.3.0).json +0 -35
- package/node_modules/fast-stable-stringify/results/itar-short/Safari 10.0.1 (Mac OS X 10.12.1).json +0 -35
- package/node_modules/fast-stable-stringify/results/itar.md +0 -20
- package/node_modules/fast-stable-stringify/results/iter/Chrome 60.0.3112 (Windows 7 0.0.0).json +0 -35
- package/node_modules/fast-stable-stringify/results/iter/Chrome Mobile 39.0.0 (Android 5.1.1).json +0 -35
- package/node_modules/fast-stable-stringify/results/iter/Chrome Mobile 55.0.2883 (Android 6.0.0).json +0 -35
- package/node_modules/fast-stable-stringify/results/iter/Edge 14.14393.0 (Windows 10 0.0.0).json +0 -35
- package/node_modules/fast-stable-stringify/results/iter/Firefox 54.0.0 (Windows 7 0.0.0).json +0 -35
- package/node_modules/fast-stable-stringify/results/iter/IE 10.0.0 (Windows 7 0.0.0).json +0 -35
- package/node_modules/fast-stable-stringify/results/iter/IE 11.0.0 (Windows 7 0.0.0).json +0 -35
- package/node_modules/fast-stable-stringify/results/iter/IE 9.0.0 (Windows 7 0.0.0).json +0 -35
- package/node_modules/fast-stable-stringify/results/iter/Mobile Safari 10.0.0 (iOS 10.3.0).json +0 -35
- package/node_modules/fast-stable-stringify/results/iter/Mobile Safari 9.0.0 (iOS 9.2.0).json +0 -35
- package/node_modules/fast-stable-stringify/results/iter/Safari 10.0.1 (Mac OS X 10.12.1).json +0 -35
- package/node_modules/fast-stable-stringify/results/iter/Safari 9.1.2 (Mac OS X 10.11.6).json +0 -35
- package/node_modules/fast-stable-stringify/results/iter.md +0 -14
- package/node_modules/fast-stable-stringify/results/libs/Chrome 60.0.3112 (Windows 7 0.0.0).json +0 -46
- package/node_modules/fast-stable-stringify/results/libs/Chrome Mobile 55.0.2883 (Android 6.0.0).json +0 -46
- package/node_modules/fast-stable-stringify/results/libs/Edge 14.14393.0 (Windows 10 0.0.0).json +0 -46
- package/node_modules/fast-stable-stringify/results/libs/Firefox 54.0.0 (Windows 7 0.0.0).json +0 -46
- package/node_modules/fast-stable-stringify/results/libs/IE 10.0.0 (Windows 7 0.0.0).json +0 -35
- package/node_modules/fast-stable-stringify/results/libs/IE 11.0.0 (Windows 7 0.0.0).json +0 -35
- package/node_modules/fast-stable-stringify/results/libs/IE 9.0.0 (Windows 7 0.0.0).json +0 -35
- package/node_modules/fast-stable-stringify/results/libs/Mobile Safari 10.0.0 (iOS 10.3.0).json +0 -46
- package/node_modules/fast-stable-stringify/results/libs/Safari 10.0.1 (Mac OS X 10.12.1).json +0 -46
- package/node_modules/fast-stable-stringify/results/libs.md +0 -15
- package/node_modules/fast-stable-stringify/test/escape-long.js +0 -147
- package/node_modules/fast-stable-stringify/test/escape-short.js +0 -147
- package/node_modules/fast-stable-stringify/test/index.js +0 -6
- package/node_modules/fast-stable-stringify/test/itar-long.js +0 -52
- package/node_modules/fast-stable-stringify/test/itar-short.js +0 -52
- package/node_modules/fast-stable-stringify/test/iter.js +0 -84
- package/node_modules/fast-stable-stringify/test/libs.js +0 -57
- package/node_modules/fast-stable-stringify/test/travis.js +0 -43
- package/node_modules/fast-stable-stringify/test/validate.js +0 -24
- package/node_modules/fast-stable-stringify/util/eachRecursive.js +0 -9
- package/node_modules/fast-stable-stringify/util/get-git-hash-sync.js +0 -21
- package/node_modules/fast-stable-stringify/util/get-lib-info.js +0 -22
- package/node_modules/fast-stable-stringify/util/object-path.js +0 -47
- package/node_modules/fast-stable-stringify/v8-profile/bench.js +0 -8
- package/node_modules/fast-stable-stringify/v8-profile/run.sh +0 -2
- package/node_modules/fast-stable-stringify/zuul-local.sh +0 -2
- package/node_modules/hkdf/.npmignore +0 -2
- package/node_modules/hkdf/README.md +0 -23
- package/node_modules/hkdf/hkdf.py +0 -171
- package/node_modules/hkdf/hkdf.pyc +0 -0
- package/node_modules/hkdf/index.js +0 -1
- package/node_modules/hkdf/lib/hkdf.js +0 -55
- package/node_modules/hkdf/package.json +0 -55
- package/node_modules/hkdf/scripts/run_all_tests.sh +0 -19
- package/node_modules/hkdf/test/all-test.js +0 -79
- package/node_modules/hkdf/test.py +0 -11
- package/node_modules/immediate/LICENSE.txt +0 -20
- package/node_modules/immediate/README.md +0 -93
- package/node_modules/immediate/dist/immediate.js +0 -75
- package/node_modules/immediate/dist/immediate.min.js +0 -1
- package/node_modules/immediate/lib/browser.js +0 -69
- package/node_modules/immediate/lib/index.js +0 -73
- package/node_modules/immediate/package.json +0 -86
- package/node_modules/isarray/.npmignore +0 -1
- package/node_modules/isarray/.travis.yml +0 -4
- package/node_modules/isarray/Makefile +0 -6
- package/node_modules/isarray/README.md +0 -60
- package/node_modules/isarray/component.json +0 -19
- package/node_modules/isarray/index.js +0 -5
- package/node_modules/isarray/package.json +0 -77
- package/node_modules/isarray/test.js +0 -20
- package/node_modules/jszip/.codeclimate.yml +0 -16
- package/node_modules/jszip/.editorconfig +0 -8
- package/node_modules/jszip/.github/workflows/pr.yaml +0 -41
- package/node_modules/jszip/.jshintignore +0 -1
- package/node_modules/jszip/.jshintrc +0 -21
- package/node_modules/jszip/.travis.yml +0 -17
- package/node_modules/jszip/CHANGES.md +0 -192
- package/node_modules/jszip/LICENSE.markdown +0 -651
- package/node_modules/jszip/README.markdown +0 -33
- package/node_modules/jszip/dist/jszip.js +0 -11583
- package/node_modules/jszip/dist/jszip.min.js +0 -13
- package/node_modules/jszip/index.d.ts +0 -335
- package/node_modules/jszip/lib/base64.js +0 -106
- package/node_modules/jszip/lib/compressedObject.js +0 -74
- package/node_modules/jszip/lib/compressions.js +0 -14
- package/node_modules/jszip/lib/crc32.js +0 -77
- package/node_modules/jszip/lib/defaults.js +0 -11
- package/node_modules/jszip/lib/external.js +0 -19
- package/node_modules/jszip/lib/flate.js +0 -85
- package/node_modules/jszip/lib/generate/ZipFileWorker.js +0 -540
- package/node_modules/jszip/lib/generate/index.js +0 -57
- package/node_modules/jszip/lib/index.js +0 -55
- package/node_modules/jszip/lib/license_header.js +0 -11
- package/node_modules/jszip/lib/load.js +0 -88
- package/node_modules/jszip/lib/nodejs/NodejsStreamInputAdapter.js +0 -74
- package/node_modules/jszip/lib/nodejs/NodejsStreamOutputAdapter.js +0 -42
- package/node_modules/jszip/lib/nodejsUtils.js +0 -57
- package/node_modules/jszip/lib/object.js +0 -389
- package/node_modules/jszip/lib/readable-stream-browser.js +0 -9
- package/node_modules/jszip/lib/reader/ArrayReader.js +0 -57
- package/node_modules/jszip/lib/reader/DataReader.js +0 -116
- package/node_modules/jszip/lib/reader/NodeBufferReader.js +0 -19
- package/node_modules/jszip/lib/reader/StringReader.js +0 -38
- package/node_modules/jszip/lib/reader/Uint8ArrayReader.js +0 -22
- package/node_modules/jszip/lib/reader/readerFor.js +0 -28
- package/node_modules/jszip/lib/signature.js +0 -7
- package/node_modules/jszip/lib/stream/ConvertWorker.js +0 -26
- package/node_modules/jszip/lib/stream/Crc32Probe.js +0 -24
- package/node_modules/jszip/lib/stream/DataLengthProbe.js +0 -29
- package/node_modules/jszip/lib/stream/DataWorker.js +0 -116
- package/node_modules/jszip/lib/stream/GenericWorker.js +0 -263
- package/node_modules/jszip/lib/stream/StreamHelper.js +0 -212
- package/node_modules/jszip/lib/support.js +0 -38
- package/node_modules/jszip/lib/utf8.js +0 -275
- package/node_modules/jszip/lib/utils.js +0 -501
- package/node_modules/jszip/lib/zipEntries.js +0 -262
- package/node_modules/jszip/lib/zipEntry.js +0 -294
- package/node_modules/jszip/lib/zipObject.js +0 -133
- package/node_modules/jszip/package.json +0 -99
- package/node_modules/jszip/tsconfig.json +0 -101
- package/node_modules/jszip/vendor/FileSaver.js +0 -247
- package/node_modules/lie/README.md +0 -62
- package/node_modules/lie/dist/lie.js +0 -350
- package/node_modules/lie/dist/lie.min.js +0 -1
- package/node_modules/lie/dist/lie.polyfill.js +0 -358
- package/node_modules/lie/dist/lie.polyfill.min.js +0 -1
- package/node_modules/lie/lib/browser.js +0 -273
- package/node_modules/lie/lib/index.js +0 -298
- package/node_modules/lie/license.md +0 -7
- package/node_modules/lie/lie.d.ts +0 -244
- package/node_modules/lie/package.json +0 -98
- package/node_modules/lie/polyfill.js +0 -4
- package/node_modules/p-finally/index.js +0 -15
- package/node_modules/p-finally/license +0 -21
- package/node_modules/p-finally/package.json +0 -77
- package/node_modules/p-finally/readme.md +0 -47
- package/node_modules/p-retry/index.js +0 -52
- package/node_modules/p-retry/license +0 -9
- package/node_modules/p-retry/package.json +0 -83
- package/node_modules/p-retry/readme.md +0 -109
- package/node_modules/p-timeout/index.d.ts +0 -72
- package/node_modules/p-timeout/index.js +0 -57
- package/node_modules/p-timeout/license +0 -9
- package/node_modules/p-timeout/package.json +0 -80
- package/node_modules/p-timeout/readme.md +0 -87
- package/node_modules/pako/CHANGELOG.md +0 -164
- package/node_modules/pako/LICENSE +0 -21
- package/node_modules/pako/README.md +0 -191
- package/node_modules/pako/dist/pako.js +0 -6818
- package/node_modules/pako/dist/pako.min.js +0 -1
- package/node_modules/pako/dist/pako_deflate.js +0 -3997
- package/node_modules/pako/dist/pako_deflate.min.js +0 -1
- package/node_modules/pako/dist/pako_inflate.js +0 -3300
- package/node_modules/pako/dist/pako_inflate.min.js +0 -1
- package/node_modules/pako/index.js +0 -14
- package/node_modules/pako/lib/deflate.js +0 -400
- package/node_modules/pako/lib/inflate.js +0 -423
- package/node_modules/pako/lib/utils/common.js +0 -105
- package/node_modules/pako/lib/utils/strings.js +0 -187
- package/node_modules/pako/lib/zlib/README +0 -59
- package/node_modules/pako/lib/zlib/adler32.js +0 -51
- package/node_modules/pako/lib/zlib/constants.js +0 -68
- package/node_modules/pako/lib/zlib/crc32.js +0 -59
- package/node_modules/pako/lib/zlib/deflate.js +0 -1874
- package/node_modules/pako/lib/zlib/gzheader.js +0 -58
- package/node_modules/pako/lib/zlib/inffast.js +0 -345
- package/node_modules/pako/lib/zlib/inflate.js +0 -1556
- package/node_modules/pako/lib/zlib/inftrees.js +0 -343
- package/node_modules/pako/lib/zlib/messages.js +0 -32
- package/node_modules/pako/lib/zlib/trees.js +0 -1222
- package/node_modules/pako/lib/zlib/zstream.js +0 -47
- package/node_modules/pako/package.json +0 -94
- package/node_modules/process-nextick-args/index.js +0 -45
- package/node_modules/process-nextick-args/license.md +0 -19
- package/node_modules/process-nextick-args/package.json +0 -53
- package/node_modules/process-nextick-args/readme.md +0 -18
- package/node_modules/readable-stream/.travis.yml +0 -34
- package/node_modules/readable-stream/CONTRIBUTING.md +0 -38
- package/node_modules/readable-stream/GOVERNANCE.md +0 -136
- package/node_modules/readable-stream/LICENSE +0 -47
- package/node_modules/readable-stream/README.md +0 -58
- package/node_modules/readable-stream/doc/wg-meetings/2015-01-30.md +0 -60
- package/node_modules/readable-stream/duplex-browser.js +0 -1
- package/node_modules/readable-stream/duplex.js +0 -1
- package/node_modules/readable-stream/lib/_stream_duplex.js +0 -131
- package/node_modules/readable-stream/lib/_stream_passthrough.js +0 -47
- package/node_modules/readable-stream/lib/_stream_readable.js +0 -1019
- package/node_modules/readable-stream/lib/_stream_transform.js +0 -214
- package/node_modules/readable-stream/lib/_stream_writable.js +0 -687
- package/node_modules/readable-stream/lib/internal/streams/BufferList.js +0 -79
- package/node_modules/readable-stream/lib/internal/streams/destroy.js +0 -74
- package/node_modules/readable-stream/lib/internal/streams/stream-browser.js +0 -1
- package/node_modules/readable-stream/lib/internal/streams/stream.js +0 -1
- package/node_modules/readable-stream/package.json +0 -86
- package/node_modules/readable-stream/passthrough.js +0 -1
- package/node_modules/readable-stream/readable-browser.js +0 -7
- package/node_modules/readable-stream/readable.js +0 -19
- package/node_modules/readable-stream/transform.js +0 -1
- package/node_modules/readable-stream/writable-browser.js +0 -1
- package/node_modules/readable-stream/writable.js +0 -8
- package/node_modules/retry/.npmignore +0 -3
- package/node_modules/retry/.travis.yml +0 -15
- package/node_modules/retry/License +0 -21
- package/node_modules/retry/Makefile +0 -18
- package/node_modules/retry/README.md +0 -227
- package/node_modules/retry/equation.gif +0 -0
- package/node_modules/retry/example/dns.js +0 -31
- package/node_modules/retry/example/stop.js +0 -40
- package/node_modules/retry/index.js +0 -1
- package/node_modules/retry/lib/retry.js +0 -100
- package/node_modules/retry/lib/retry_operation.js +0 -158
- package/node_modules/retry/package.json +0 -67
- package/node_modules/retry/test/common.js +0 -10
- package/node_modules/retry/test/integration/test-forever.js +0 -24
- package/node_modules/retry/test/integration/test-retry-operation.js +0 -258
- package/node_modules/retry/test/integration/test-retry-wrap.js +0 -101
- package/node_modules/retry/test/integration/test-timeouts.js +0 -69
- package/node_modules/setimmediate/LICENSE.txt +0 -20
- package/node_modules/setimmediate/package.json +0 -77
- package/node_modules/setimmediate/setImmediate.js +0 -186
- package/node_modules/split/.npmignore +0 -3
- package/node_modules/split/.travis.yml +0 -3
- package/node_modules/split/LICENCE +0 -22
- package/node_modules/split/examples/pretty.js +0 -26
- package/node_modules/split/index.js +0 -63
- package/node_modules/split/package.json +0 -65
- package/node_modules/split/readme.markdown +0 -72
- package/node_modules/split/test/options.asynct.js +0 -46
- package/node_modules/split/test/partitioned_unicode.js +0 -34
- package/node_modules/split/test/split.asynct.js +0 -137
- package/node_modules/split/test/try_catch.asynct.js +0 -51
- package/node_modules/stream-shift/.travis.yml +0 -6
- package/node_modules/stream-shift/LICENSE +0 -21
- package/node_modules/stream-shift/README.md +0 -25
- package/node_modules/stream-shift/index.js +0 -20
- package/node_modules/stream-shift/package.json +0 -56
- package/node_modules/stream-shift/test.js +0 -48
- package/node_modules/ultron/LICENSE +0 -22
- package/node_modules/ultron/README.md +0 -113
- package/node_modules/ultron/index.js +0 -136
- package/node_modules/ultron/package.json +0 -71
- package/node_modules/websocket-stream/LICENSE +0 -8
- package/node_modules/websocket-stream/collaborators.md +0 -11
- package/node_modules/websocket-stream/echo-server.js +0 -51
- package/node_modules/websocket-stream/index.d.ts +0 -27
- package/node_modules/websocket-stream/index.js +0 -6
- package/node_modules/websocket-stream/package.json +0 -82
- package/node_modules/websocket-stream/readme.md +0 -148
- package/node_modules/websocket-stream/server.js +0 -29
- package/node_modules/websocket-stream/stream.js +0 -189
- package/node_modules/websocket-stream/test-client.js +0 -74
- package/node_modules/websocket-stream/test-server.js +0 -56
- package/node_modules/websocket-stream/test.js +0 -338
- package/node_modules/websocket-stream/ts-tests.ts +0 -69
- package/node_modules/websocket-stream/ws-fallback.js +0 -12
- package/node_modules/ws/LICENSE +0 -21
- package/node_modules/ws/README.md +0 -341
- package/node_modules/ws/index.js +0 -15
- package/node_modules/ws/lib/.DS_Store +0 -0
- package/node_modules/ws/lib/BufferUtil.js +0 -71
- package/node_modules/ws/lib/Constants.js +0 -10
- package/node_modules/ws/lib/ErrorCodes.js +0 -28
- package/node_modules/ws/lib/EventTarget.js +0 -151
- package/node_modules/ws/lib/Extensions.js +0 -203
- package/node_modules/ws/lib/PerMessageDeflate.js +0 -507
- package/node_modules/ws/lib/Receiver.js +0 -553
- package/node_modules/ws/lib/Sender.js +0 -412
- package/node_modules/ws/lib/Validation.js +0 -17
- package/node_modules/ws/lib/WebSocket.js +0 -717
- package/node_modules/ws/lib/WebSocketServer.js +0 -326
- package/node_modules/ws/package.json +0 -83
- package/node_modules/xhr2/CONTRIBUTING.md +0 -33
- package/node_modules/xhr2/Cakefile +0 -131
- package/node_modules/xhr2/LICENSE.txt +0 -19
- package/node_modules/xhr2/README.md +0 -142
- package/node_modules/xhr2/lib/browser.js +0 -1
- package/node_modules/xhr2/lib/xhr2.js +0 -1244
- package/node_modules/xhr2/package.json +0 -103
- package/node_modules/xhr2/src/000-xml_http_request_event_target.coffee +0 -89
- package/node_modules/xhr2/src/001-xml_http_request.coffee +0 -781
- package/node_modules/xhr2/src/errors.coffee +0 -31
- package/node_modules/xhr2/src/progress_event.coffee +0 -39
- package/node_modules/xhr2/src/xml_http_request_upload.coffee +0 -95
- package/node_modules/xhr2/test/fixtures/hello.json +0 -1
- package/node_modules/xhr2/test/fixtures/hello.txt +0 -1
- package/node_modules/xhr2/test/fixtures/xhr2.png +0 -0
- package/node_modules/xhr2/test/html/browser_test.html +0 -30
- package/node_modules/xhr2/test/src/event_target_test.coffee +0 -85
- package/node_modules/xhr2/test/src/events_test.coffee +0 -204
- package/node_modules/xhr2/test/src/headers_test.coffee +0 -168
- package/node_modules/xhr2/test/src/helpers/browser_mocha_runner.coffee +0 -10
- package/node_modules/xhr2/test/src/helpers/browser_mocha_setup.coffee +0 -1
- package/node_modules/xhr2/test/src/helpers/setup.coffee +0 -38
- package/node_modules/xhr2/test/src/helpers/xhr_server.coffee +0 -156
- package/node_modules/xhr2/test/src/nodejs_set_test.coffee +0 -162
- package/node_modules/xhr2/test/src/redirect_test.coffee +0 -57
- package/node_modules/xhr2/test/src/response_type_test.coffee +0 -88
- package/node_modules/xhr2/test/src/responseurl_test.coffee +0 -18
- package/node_modules/xhr2/test/src/send_test.coffee +0 -89
- package/node_modules/xhr2/test/src/status_test.coffee +0 -47
- package/node_modules/xhr2/test/src/xhr_test.coffee +0 -102
- package/node_modules/xtend/.jshintrc +0 -30
- package/node_modules/xtend/LICENSE +0 -20
- package/node_modules/xtend/README.md +0 -32
- package/node_modules/xtend/immutable.js +0 -19
- package/node_modules/xtend/mutable.js +0 -17
- package/node_modules/xtend/package.json +0 -89
- package/node_modules/xtend/test.js +0 -103
- package/node_modules/yazl/LICENSE +0 -21
- package/node_modules/yazl/README.md +0 -389
- package/node_modules/yazl/index.js +0 -749
- package/node_modules/yazl/package.json +0 -69
- package/src/commands/CorelliumAPI.js +0 -76
- package/src/subscriberInvite.js +0 -140
@@ -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
|
-
});
|