@realsee/live 0.5.4-alpha.1 → 0.5.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/realsee-live.cjs.development.js +9 -6
- package/dist/realsee-live.cjs.development.js.map +1 -1
- package/dist/realsee-live.cjs.production.js +1 -1
- package/dist/realsee-live.cjs.production.js.map +1 -1
- package/dist/realsee-live.esm.js +9 -6
- package/dist/realsee-live.esm.js.map +1 -1
- package/dist/realsee-live.umd.development.js +712 -527
- package/dist/realsee-live.umd.development.js.map +1 -1
- package/dist/realsee-live.umd.production.js +1 -1
- package/dist/realsee-live.umd.production.js.map +1 -1
- package/docs/classes/BrowserRTC4Chime.html +5 -5
- package/package.json +2 -2
|
@@ -1915,7 +1915,7 @@
|
|
|
1915
1915
|
|
|
1916
1916
|
var uaParser = createCommonjsModule(function (module, exports) {
|
|
1917
1917
|
/////////////////////////////////////////////////////////////////////////////////
|
|
1918
|
-
/* UAParser.js v1.0.
|
|
1918
|
+
/* UAParser.js v1.0.33
|
|
1919
1919
|
Copyright © 2012-2021 Faisal Salman <f@faisalman.com>
|
|
1920
1920
|
MIT License *//*
|
|
1921
1921
|
Detect Browser, Engine, OS, CPU, and Device type/model from User-Agent data.
|
|
@@ -1931,7 +1931,7 @@
|
|
|
1931
1931
|
/////////////
|
|
1932
1932
|
|
|
1933
1933
|
|
|
1934
|
-
var LIBVERSION = '1.0.
|
|
1934
|
+
var LIBVERSION = '1.0.33',
|
|
1935
1935
|
EMPTY = '',
|
|
1936
1936
|
UNKNOWN = '?',
|
|
1937
1937
|
FUNC_TYPE = 'function',
|
|
@@ -1951,7 +1951,7 @@
|
|
|
1951
1951
|
SMARTTV = 'smarttv',
|
|
1952
1952
|
WEARABLE = 'wearable',
|
|
1953
1953
|
EMBEDDED = 'embedded',
|
|
1954
|
-
UA_MAX_LENGTH =
|
|
1954
|
+
UA_MAX_LENGTH = 350;
|
|
1955
1955
|
|
|
1956
1956
|
var AMAZON = 'Amazon',
|
|
1957
1957
|
APPLE = 'Apple',
|
|
@@ -1968,6 +1968,7 @@
|
|
|
1968
1968
|
MOTOROLA = 'Motorola',
|
|
1969
1969
|
OPERA = 'Opera',
|
|
1970
1970
|
SAMSUNG = 'Samsung',
|
|
1971
|
+
SHARP = 'Sharp',
|
|
1971
1972
|
SONY = 'Sony',
|
|
1972
1973
|
XIAOMI = 'Xiaomi',
|
|
1973
1974
|
ZEBRA = 'Zebra',
|
|
@@ -2006,7 +2007,7 @@
|
|
|
2006
2007
|
},
|
|
2007
2008
|
trim = function (str, len) {
|
|
2008
2009
|
if (typeof(str) === STR_TYPE) {
|
|
2009
|
-
str = str.replace(/^\s\s*/, EMPTY)
|
|
2010
|
+
str = str.replace(/^\s\s*/, EMPTY);
|
|
2010
2011
|
return typeof(len) === UNDEF_TYPE ? str : str.substring(0, UA_MAX_LENGTH);
|
|
2011
2012
|
}
|
|
2012
2013
|
};
|
|
@@ -2145,13 +2146,14 @@
|
|
|
2145
2146
|
/(?:ms|\()(ie) ([\w\.]+)/i, // Internet Explorer
|
|
2146
2147
|
|
|
2147
2148
|
// Webkit/KHTML based // Flock/RockMelt/Midori/Epiphany/Silk/Skyfire/Bolt/Iron/Iridium/PhantomJS/Bowser/QupZilla/Falkon
|
|
2148
|
-
/(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark|qupzilla|falkon|rekonq|puffin|brave|whale|qqbrowserlite|qq)\/([-\w\.]+)/i,
|
|
2149
|
+
/(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark|qupzilla|falkon|rekonq|puffin|brave|whale|qqbrowserlite|qq|duckduckgo)\/([-\w\.]+)/i,
|
|
2149
2150
|
// Rekonq/Puffin/Brave/Whale/QQBrowserLite/QQ, aka ShouQ
|
|
2150
2151
|
/(weibo)__([\d\.]+)/i // Weibo
|
|
2151
2152
|
], [NAME, VERSION], [
|
|
2152
2153
|
/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i // UCBrowser
|
|
2153
2154
|
], [VERSION, [NAME, 'UC'+BROWSER]], [
|
|
2154
|
-
|
|
2155
|
+
/microm.+\bqbcore\/([\w\.]+)/i, // WeChat Desktop for Windows Built-in Browser
|
|
2156
|
+
/\bqbcore\/([\w\.]+).+microm/i
|
|
2155
2157
|
], [VERSION, [NAME, 'WeChat(Win) Desktop']], [
|
|
2156
2158
|
/micromessenger\/([\w\.]+)/i // WeChat
|
|
2157
2159
|
], [VERSION, [NAME, 'WeChat']], [
|
|
@@ -2179,8 +2181,8 @@
|
|
|
2179
2181
|
], [VERSION, [NAME, FIREFOX]], [
|
|
2180
2182
|
/\bqihu|(qi?ho?o?|360)browser/i // 360
|
|
2181
2183
|
], [[NAME, '360 '+BROWSER]], [
|
|
2182
|
-
/(oculus|samsung|sailfish)browser\/([\w\.]+)/i
|
|
2183
|
-
], [[NAME, /(.+)/, '$1 '+BROWSER], VERSION], [ // Oculus/Samsung/Sailfish Browser
|
|
2184
|
+
/(oculus|samsung|sailfish|huawei)browser\/([\w\.]+)/i
|
|
2185
|
+
], [[NAME, /(.+)/, '$1 '+BROWSER], VERSION], [ // Oculus/Samsung/Sailfish/Huawei Browser
|
|
2184
2186
|
/(comodo_dragon)\/([\w\.]+)/i // Comodo Dragon
|
|
2185
2187
|
], [[NAME, /_/g, ' '], VERSION], [
|
|
2186
2188
|
/(electron)\/([\w\.]+) safari/i, // Electron-based App
|
|
@@ -2188,7 +2190,8 @@
|
|
|
2188
2190
|
/m?(qqbrowser|baiduboxapp|2345Explorer)[\/ ]?([\w\.]+)/i // QQBrowser/Baidu App/2345 Browser
|
|
2189
2191
|
], [NAME, VERSION], [
|
|
2190
2192
|
/(metasr)[\/ ]?([\w\.]+)/i, // SouGouBrowser
|
|
2191
|
-
/(lbbrowser)/i
|
|
2193
|
+
/(lbbrowser)/i, // LieBao Browser
|
|
2194
|
+
/\[(linkedin)app\]/i // LinkedIn App for iOS & Android
|
|
2192
2195
|
], [NAME], [
|
|
2193
2196
|
|
|
2194
2197
|
// WebView
|
|
@@ -2213,9 +2216,9 @@
|
|
|
2213
2216
|
/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i // Chrome/OmniWeb/Arora/Tizen/Nokia
|
|
2214
2217
|
], [NAME, VERSION], [
|
|
2215
2218
|
|
|
2216
|
-
/version\/([\w
|
|
2219
|
+
/version\/([\w\.\,]+) .*mobile\/\w+ (safari)/i // Mobile Safari
|
|
2217
2220
|
], [VERSION, [NAME, 'Mobile Safari']], [
|
|
2218
|
-
/version\/([\w
|
|
2221
|
+
/version\/([\w(\.|\,)]+) .*(mobile ?safari|safari)/i // Safari & Safari Mobile
|
|
2219
2222
|
], [VERSION, NAME], [
|
|
2220
2223
|
/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i // Safari < 3.0
|
|
2221
2224
|
], [NAME, [VERSION, strMapper, oldSafariMap]], [
|
|
@@ -2241,7 +2244,10 @@
|
|
|
2241
2244
|
/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|sleipnir|obigo|mosaic|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,
|
|
2242
2245
|
// Polaris/Lynx/Dillo/iCab/Doris/Amaya/w3m/NetSurf/Sleipnir/Obigo/Mosaic/Go/ICE/UP.Browser
|
|
2243
2246
|
/(links) \(([\w\.]+)/i // Links
|
|
2244
|
-
], [NAME, VERSION]
|
|
2247
|
+
], [NAME, VERSION], [
|
|
2248
|
+
|
|
2249
|
+
/(cobalt)\/([\w\.]+)/i // Cobalt
|
|
2250
|
+
], [NAME, [VERSION, /master.|lts./, ""]]
|
|
2245
2251
|
],
|
|
2246
2252
|
|
|
2247
2253
|
cpu : [[
|
|
@@ -2284,7 +2290,7 @@
|
|
|
2284
2290
|
/////////////////////////
|
|
2285
2291
|
|
|
2286
2292
|
// Samsung
|
|
2287
|
-
/\b(sch-i[89]0\d|shw-m380s|sm-[
|
|
2293
|
+
/\b(sch-i[89]0\d|shw-m380s|sm-[ptx]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i
|
|
2288
2294
|
], [MODEL, [VENDOR, SAMSUNG], [TYPE, TABLET]], [
|
|
2289
2295
|
/\b((?:s[cgp]h|gt|sm)-\w+|galaxy nexus)/i,
|
|
2290
2296
|
/samsung[- ]([-\w]+)/i,
|
|
@@ -2298,12 +2304,14 @@
|
|
|
2298
2304
|
/applecoremedia\/[\w\.]+ \((ipad)/i,
|
|
2299
2305
|
/\b(ipad)\d\d?,\d\d?[;\]].+ios/i
|
|
2300
2306
|
], [MODEL, [VENDOR, APPLE], [TYPE, TABLET]], [
|
|
2307
|
+
/(macintosh);/i
|
|
2308
|
+
], [MODEL, [VENDOR, APPLE]], [
|
|
2301
2309
|
|
|
2302
2310
|
// Huawei
|
|
2303
2311
|
/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i
|
|
2304
2312
|
], [MODEL, [VENDOR, HUAWEI], [TYPE, TABLET]], [
|
|
2305
2313
|
/(?:huawei|honor)([-\w ]+)[;\)]/i,
|
|
2306
|
-
/\b(nexus 6p|\w{2,4}
|
|
2314
|
+
/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i
|
|
2307
2315
|
], [MODEL, [VENDOR, HUAWEI], [TYPE, MOBILE]], [
|
|
2308
2316
|
|
|
2309
2317
|
// Xiaomi
|
|
@@ -2311,7 +2319,7 @@
|
|
|
2311
2319
|
/\b; (\w+) build\/hm\1/i, // Xiaomi Hongmi 'numeric' models
|
|
2312
2320
|
/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i, // Xiaomi Hongmi
|
|
2313
2321
|
/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i, // Xiaomi Redmi
|
|
2314
|
-
/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite)?)(?: bui|\))/i // Xiaomi Mi
|
|
2322
|
+
/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite)?)(?: bui|\))/i // Xiaomi Mi
|
|
2315
2323
|
], [[MODEL, /_/g, ' '], [VENDOR, XIAOMI], [TYPE, MOBILE]], [
|
|
2316
2324
|
/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i // Mi Pad tablets
|
|
2317
2325
|
],[[MODEL, /_/g, ' '], [VENDOR, XIAOMI], [TYPE, TABLET]], [
|
|
@@ -2363,7 +2371,7 @@
|
|
|
2363
2371
|
], [MODEL, [VENDOR, GOOGLE], [TYPE, MOBILE]], [
|
|
2364
2372
|
|
|
2365
2373
|
// Sony
|
|
2366
|
-
/droid.+ ([c-g]\d{4}|so[-gl]\w+|xq-a\w[4-7][12])(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i
|
|
2374
|
+
/droid.+ (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-a\w[4-7][12])(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i
|
|
2367
2375
|
], [MODEL, [VENDOR, SONY], [TYPE, MOBILE]], [
|
|
2368
2376
|
/sony tablet [ps]/i,
|
|
2369
2377
|
/\b(?:sony)?sgp\w+(?: bui|\))/i
|
|
@@ -2402,7 +2410,7 @@
|
|
|
2402
2410
|
|
|
2403
2411
|
// ZTE
|
|
2404
2412
|
/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,
|
|
2405
|
-
/(alcatel|geeksphone|nexian|panasonic|sony)[-_ ]?([-\w]*)/i // Alcatel/GeeksPhone/Nexian/Panasonic/Sony
|
|
2413
|
+
/(alcatel|geeksphone|nexian|panasonic|sony(?!-bra))[-_ ]?([-\w]*)/i // Alcatel/GeeksPhone/Nexian/Panasonic/Sony
|
|
2406
2414
|
], [VENDOR, [MODEL, /_/g, ' '], [TYPE, MOBILE]], [
|
|
2407
2415
|
|
|
2408
2416
|
// Acer
|
|
@@ -2416,7 +2424,7 @@
|
|
|
2416
2424
|
|
|
2417
2425
|
// Sharp
|
|
2418
2426
|
/\b(sh-?[altvz]?\d\d[a-ekm]?)/i
|
|
2419
|
-
], [MODEL, [VENDOR,
|
|
2427
|
+
], [MODEL, [VENDOR, SHARP], [TYPE, MOBILE]], [
|
|
2420
2428
|
|
|
2421
2429
|
// MIXED
|
|
2422
2430
|
/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron)[-_ ]?([-\w]*)/i,
|
|
@@ -2528,8 +2536,13 @@
|
|
|
2528
2536
|
], [[MODEL, CHROME+'cast'], [VENDOR, GOOGLE], [TYPE, SMARTTV]], [
|
|
2529
2537
|
/droid.+aft(\w)( bui|\))/i // Fire TV
|
|
2530
2538
|
], [MODEL, [VENDOR, AMAZON], [TYPE, SMARTTV]], [
|
|
2531
|
-
/\(dtv[\);].+(aquos)/i
|
|
2532
|
-
|
|
2539
|
+
/\(dtv[\);].+(aquos)/i,
|
|
2540
|
+
/(aquos-tv[\w ]+)\)/i // Sharp
|
|
2541
|
+
], [MODEL, [VENDOR, SHARP], [TYPE, SMARTTV]],[
|
|
2542
|
+
/(bravia[\w ]+)( bui|\))/i // Sony
|
|
2543
|
+
], [MODEL, [VENDOR, SONY], [TYPE, SMARTTV]], [
|
|
2544
|
+
/(mitv-\w{5}) bui/i // Xiaomi
|
|
2545
|
+
], [MODEL, [VENDOR, XIAOMI], [TYPE, SMARTTV]], [
|
|
2533
2546
|
/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i, // Roku
|
|
2534
2547
|
/hbbtv\/\d+\.\d+\.\d+ +\([\w ]*; *(\w[^;]*);([^;]*)/i // HbbTV devices
|
|
2535
2548
|
], [[VENDOR, trim], [MODEL, trim], [TYPE, SMARTTV]], [
|
|
@@ -2566,7 +2579,7 @@
|
|
|
2566
2579
|
], [MODEL, [TYPE, TABLET]], [
|
|
2567
2580
|
/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i // Unidentifiable Tablet
|
|
2568
2581
|
], [[TYPE, TABLET]], [
|
|
2569
|
-
/(phone|mobile(?:[;\/]| safari)|pda(?=.+windows ce))/i
|
|
2582
|
+
/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i // Unidentifiable Mobile
|
|
2570
2583
|
], [[TYPE, MOBILE]], [
|
|
2571
2584
|
/(android[-\w\. ]{0,9});.+buil/i // Generic Android Device
|
|
2572
2585
|
], [MODEL, [VENDOR, 'Generic']]
|
|
@@ -2612,7 +2625,7 @@
|
|
|
2612
2625
|
], [[NAME, 'Mac OS'], [VERSION, /_/g, '.']], [
|
|
2613
2626
|
|
|
2614
2627
|
// Mobile OSes
|
|
2615
|
-
/droid ([\w\.]+)\b.+(android[- ]x86)/i
|
|
2628
|
+
/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i // Android-x86/HarmonyOS
|
|
2616
2629
|
], [VERSION, NAME], [ // Android/WebOS/QNX/Bada/RIM/Maemo/MeeGo/Sailfish OS
|
|
2617
2630
|
/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-\/ ]?([\w\.]*)/i,
|
|
2618
2631
|
/(blackberry)\w*\/([\w\.]*)/i, // Blackberry
|
|
@@ -31023,10 +31036,10 @@
|
|
|
31023
31036
|
* The length opt_len is updated; static_len is also updated if stree is
|
|
31024
31037
|
* not null.
|
|
31025
31038
|
*/
|
|
31026
|
-
const gen_bitlen = (s, desc) =>
|
|
31039
|
+
const gen_bitlen = (s, desc) => {
|
|
31027
31040
|
// deflate_state *s;
|
|
31028
31041
|
// tree_desc *desc; /* the tree descriptor */
|
|
31029
|
-
|
|
31042
|
+
|
|
31030
31043
|
const tree = desc.dyn_tree;
|
|
31031
31044
|
const max_code = desc.max_code;
|
|
31032
31045
|
const stree = desc.stat_desc.static_tree;
|
|
@@ -31075,7 +31088,7 @@
|
|
|
31075
31088
|
}
|
|
31076
31089
|
if (overflow === 0) { return; }
|
|
31077
31090
|
|
|
31078
|
-
//
|
|
31091
|
+
// Tracev((stderr,"\nbit length overflow\n"));
|
|
31079
31092
|
/* This happens for example on obj2 and pic of the Calgary corpus */
|
|
31080
31093
|
|
|
31081
31094
|
/* Find the first bit length which could increase: */
|
|
@@ -31102,7 +31115,7 @@
|
|
|
31102
31115
|
m = s.heap[--h];
|
|
31103
31116
|
if (m > max_code) { continue; }
|
|
31104
31117
|
if (tree[m * 2 + 1]/*.Len*/ !== bits) {
|
|
31105
|
-
//
|
|
31118
|
+
// Tracev((stderr,"code %d bits %d->%d\n", m, tree[m].Len, bits));
|
|
31106
31119
|
s.opt_len += (bits - tree[m * 2 + 1]/*.Len*/) * tree[m * 2]/*.Freq*/;
|
|
31107
31120
|
tree[m * 2 + 1]/*.Len*/ = bits;
|
|
31108
31121
|
}
|
|
@@ -31120,11 +31133,11 @@
|
|
|
31120
31133
|
* OUT assertion: the field code is set for all tree elements of non
|
|
31121
31134
|
* zero code length.
|
|
31122
31135
|
*/
|
|
31123
|
-
const gen_codes = (tree, max_code, bl_count) =>
|
|
31136
|
+
const gen_codes = (tree, max_code, bl_count) => {
|
|
31124
31137
|
// ct_data *tree; /* the tree to decorate */
|
|
31125
31138
|
// int max_code; /* largest code with non zero frequency */
|
|
31126
31139
|
// ushf *bl_count; /* number of codes at each bit length */
|
|
31127
|
-
|
|
31140
|
+
|
|
31128
31141
|
const next_code = new Array(MAX_BITS$1 + 1); /* next code value for each bit length */
|
|
31129
31142
|
let code = 0; /* running code value */
|
|
31130
31143
|
let bits; /* bit index */
|
|
@@ -31134,7 +31147,8 @@
|
|
|
31134
31147
|
* without bit reversal.
|
|
31135
31148
|
*/
|
|
31136
31149
|
for (bits = 1; bits <= MAX_BITS$1; bits++) {
|
|
31137
|
-
|
|
31150
|
+
code = (code + bl_count[bits - 1]) << 1;
|
|
31151
|
+
next_code[bits] = code;
|
|
31138
31152
|
}
|
|
31139
31153
|
/* Check that the bit counts in bl_count are consistent. The last code
|
|
31140
31154
|
* must be all ones.
|
|
@@ -31274,7 +31288,7 @@
|
|
|
31274
31288
|
|
|
31275
31289
|
s.dyn_ltree[END_BLOCK * 2]/*.Freq*/ = 1;
|
|
31276
31290
|
s.opt_len = s.static_len = 0;
|
|
31277
|
-
s.
|
|
31291
|
+
s.sym_next = s.matches = 0;
|
|
31278
31292
|
};
|
|
31279
31293
|
|
|
31280
31294
|
|
|
@@ -31293,29 +31307,6 @@
|
|
|
31293
31307
|
s.bi_valid = 0;
|
|
31294
31308
|
};
|
|
31295
31309
|
|
|
31296
|
-
/* ===========================================================================
|
|
31297
|
-
* Copy a stored block, storing first the length and its
|
|
31298
|
-
* one's complement if requested.
|
|
31299
|
-
*/
|
|
31300
|
-
const copy_block = (s, buf, len, header) =>
|
|
31301
|
-
//DeflateState *s;
|
|
31302
|
-
//charf *buf; /* the input data */
|
|
31303
|
-
//unsigned len; /* its length */
|
|
31304
|
-
//int header; /* true if block header must be written */
|
|
31305
|
-
{
|
|
31306
|
-
bi_windup(s); /* align on byte boundary */
|
|
31307
|
-
|
|
31308
|
-
if (header) {
|
|
31309
|
-
put_short(s, len);
|
|
31310
|
-
put_short(s, ~len);
|
|
31311
|
-
}
|
|
31312
|
-
// while (len--) {
|
|
31313
|
-
// put_byte(s, *buf++);
|
|
31314
|
-
// }
|
|
31315
|
-
s.pending_buf.set(s.window.subarray(buf, buf + len), s.pending);
|
|
31316
|
-
s.pending += len;
|
|
31317
|
-
};
|
|
31318
|
-
|
|
31319
31310
|
/* ===========================================================================
|
|
31320
31311
|
* Compares to subtrees, using the tree depth as tie breaker when
|
|
31321
31312
|
* the subtrees have equal frequency. This minimizes the worst case length.
|
|
@@ -31334,11 +31325,11 @@
|
|
|
31334
31325
|
* when the heap property is re-established (each father smaller than its
|
|
31335
31326
|
* two sons).
|
|
31336
31327
|
*/
|
|
31337
|
-
const pqdownheap = (s, tree, k) =>
|
|
31328
|
+
const pqdownheap = (s, tree, k) => {
|
|
31338
31329
|
// deflate_state *s;
|
|
31339
31330
|
// ct_data *tree; /* the tree to restore */
|
|
31340
31331
|
// int k; /* node to move down */
|
|
31341
|
-
|
|
31332
|
+
|
|
31342
31333
|
const v = s.heap[k];
|
|
31343
31334
|
let j = k << 1; /* left son of k */
|
|
31344
31335
|
while (j <= s.heap_len) {
|
|
@@ -31367,23 +31358,22 @@
|
|
|
31367
31358
|
/* ===========================================================================
|
|
31368
31359
|
* Send the block data compressed using the given Huffman trees
|
|
31369
31360
|
*/
|
|
31370
|
-
const compress_block = (s, ltree, dtree) =>
|
|
31361
|
+
const compress_block = (s, ltree, dtree) => {
|
|
31371
31362
|
// deflate_state *s;
|
|
31372
31363
|
// const ct_data *ltree; /* literal tree */
|
|
31373
31364
|
// const ct_data *dtree; /* distance tree */
|
|
31374
|
-
|
|
31365
|
+
|
|
31375
31366
|
let dist; /* distance of matched string */
|
|
31376
31367
|
let lc; /* match length or unmatched char (if dist == 0) */
|
|
31377
|
-
let
|
|
31368
|
+
let sx = 0; /* running index in sym_buf */
|
|
31378
31369
|
let code; /* the code to send */
|
|
31379
31370
|
let extra; /* number of extra bits to send */
|
|
31380
31371
|
|
|
31381
|
-
if (s.
|
|
31372
|
+
if (s.sym_next !== 0) {
|
|
31382
31373
|
do {
|
|
31383
|
-
dist =
|
|
31384
|
-
|
|
31385
|
-
|
|
31386
|
-
|
|
31374
|
+
dist = s.pending_buf[s.sym_buf + sx++] & 0xff;
|
|
31375
|
+
dist += (s.pending_buf[s.sym_buf + sx++] & 0xff) << 8;
|
|
31376
|
+
lc = s.pending_buf[s.sym_buf + sx++];
|
|
31387
31377
|
if (dist === 0) {
|
|
31388
31378
|
send_code(s, lc, ltree); /* send a literal byte */
|
|
31389
31379
|
//Tracecv(isgraph(lc), (stderr," '%c' ", lc));
|
|
@@ -31408,11 +31398,10 @@
|
|
|
31408
31398
|
}
|
|
31409
31399
|
} /* literal or match pair ? */
|
|
31410
31400
|
|
|
31411
|
-
/* Check that the overlay between pending_buf and
|
|
31412
|
-
//Assert(
|
|
31413
|
-
// "pendingBuf overflow");
|
|
31401
|
+
/* Check that the overlay between pending_buf and sym_buf is ok: */
|
|
31402
|
+
//Assert(s->pending < s->lit_bufsize + sx, "pendingBuf overflow");
|
|
31414
31403
|
|
|
31415
|
-
} while (
|
|
31404
|
+
} while (sx < s.sym_next);
|
|
31416
31405
|
}
|
|
31417
31406
|
|
|
31418
31407
|
send_code(s, END_BLOCK, ltree);
|
|
@@ -31427,10 +31416,10 @@
|
|
|
31427
31416
|
* and corresponding code. The length opt_len is updated; static_len is
|
|
31428
31417
|
* also updated if stree is not null. The field max_code is set.
|
|
31429
31418
|
*/
|
|
31430
|
-
const build_tree = (s, desc) =>
|
|
31419
|
+
const build_tree = (s, desc) => {
|
|
31431
31420
|
// deflate_state *s;
|
|
31432
31421
|
// tree_desc *desc; /* the tree descriptor */
|
|
31433
|
-
|
|
31422
|
+
|
|
31434
31423
|
const tree = desc.dyn_tree;
|
|
31435
31424
|
const stree = desc.stat_desc.static_tree;
|
|
31436
31425
|
const has_stree = desc.stat_desc.has_stree;
|
|
@@ -31523,11 +31512,11 @@
|
|
|
31523
31512
|
* Scan a literal or distance tree to determine the frequencies of the codes
|
|
31524
31513
|
* in the bit length tree.
|
|
31525
31514
|
*/
|
|
31526
|
-
const scan_tree = (s, tree, max_code) =>
|
|
31515
|
+
const scan_tree = (s, tree, max_code) => {
|
|
31527
31516
|
// deflate_state *s;
|
|
31528
31517
|
// ct_data *tree; /* the tree to be scanned */
|
|
31529
31518
|
// int max_code; /* and its largest code of non zero frequency */
|
|
31530
|
-
|
|
31519
|
+
|
|
31531
31520
|
let n; /* iterates over all tree elements */
|
|
31532
31521
|
let prevlen = -1; /* last emitted length */
|
|
31533
31522
|
let curlen; /* length of current code */
|
|
@@ -31589,11 +31578,11 @@
|
|
|
31589
31578
|
* Send a literal or distance tree in compressed form, using the codes in
|
|
31590
31579
|
* bl_tree.
|
|
31591
31580
|
*/
|
|
31592
|
-
const send_tree = (s, tree, max_code) =>
|
|
31581
|
+
const send_tree = (s, tree, max_code) => {
|
|
31593
31582
|
// deflate_state *s;
|
|
31594
31583
|
// ct_data *tree; /* the tree to be scanned */
|
|
31595
31584
|
// int max_code; /* and its largest code of non zero frequency */
|
|
31596
|
-
|
|
31585
|
+
|
|
31597
31586
|
let n; /* iterates over all tree elements */
|
|
31598
31587
|
let prevlen = -1; /* last emitted length */
|
|
31599
31588
|
let curlen; /* length of current code */
|
|
@@ -31697,10 +31686,10 @@
|
|
|
31697
31686
|
* lengths of the bit length codes, the literal tree and the distance tree.
|
|
31698
31687
|
* IN assertion: lcodes >= 257, dcodes >= 1, blcodes >= 4.
|
|
31699
31688
|
*/
|
|
31700
|
-
const send_all_trees = (s, lcodes, dcodes, blcodes) =>
|
|
31689
|
+
const send_all_trees = (s, lcodes, dcodes, blcodes) => {
|
|
31701
31690
|
// deflate_state *s;
|
|
31702
31691
|
// int lcodes, dcodes, blcodes; /* number of codes for each tree */
|
|
31703
|
-
|
|
31692
|
+
|
|
31704
31693
|
let rank; /* index in bl_order */
|
|
31705
31694
|
|
|
31706
31695
|
//Assert (lcodes >= 257 && dcodes >= 1 && blcodes >= 4, "not enough codes");
|
|
@@ -31728,9 +31717,9 @@
|
|
|
31728
31717
|
* Check if the data type is TEXT or BINARY, using the following algorithm:
|
|
31729
31718
|
* - TEXT if the two conditions below are satisfied:
|
|
31730
31719
|
* a) There are no non-portable control characters belonging to the
|
|
31731
|
-
* "
|
|
31720
|
+
* "block list" (0..6, 14..25, 28..31).
|
|
31732
31721
|
* b) There is at least one printable character belonging to the
|
|
31733
|
-
* "
|
|
31722
|
+
* "allow list" (9 {TAB}, 10 {LF}, 13 {CR}, 32..255).
|
|
31734
31723
|
* - BINARY otherwise.
|
|
31735
31724
|
* - The following partially-portable control characters form a
|
|
31736
31725
|
* "gray list" that is ignored in this detection algorithm:
|
|
@@ -31738,21 +31727,21 @@
|
|
|
31738
31727
|
* IN assertion: the fields Freq of dyn_ltree are set.
|
|
31739
31728
|
*/
|
|
31740
31729
|
const detect_data_type = (s) => {
|
|
31741
|
-
/*
|
|
31730
|
+
/* block_mask is the bit mask of block-listed bytes
|
|
31742
31731
|
* set bits 0..6, 14..25, and 28..31
|
|
31743
31732
|
* 0xf3ffc07f = binary 11110011111111111100000001111111
|
|
31744
31733
|
*/
|
|
31745
|
-
let
|
|
31734
|
+
let block_mask = 0xf3ffc07f;
|
|
31746
31735
|
let n;
|
|
31747
31736
|
|
|
31748
|
-
/* Check for non-textual ("
|
|
31749
|
-
for (n = 0; n <= 31; n++,
|
|
31750
|
-
if ((
|
|
31737
|
+
/* Check for non-textual ("block-listed") bytes. */
|
|
31738
|
+
for (n = 0; n <= 31; n++, block_mask >>>= 1) {
|
|
31739
|
+
if ((block_mask & 1) && (s.dyn_ltree[n * 2]/*.Freq*/ !== 0)) {
|
|
31751
31740
|
return Z_BINARY;
|
|
31752
31741
|
}
|
|
31753
31742
|
}
|
|
31754
31743
|
|
|
31755
|
-
/* Check for textual ("
|
|
31744
|
+
/* Check for textual ("allow-listed") bytes. */
|
|
31756
31745
|
if (s.dyn_ltree[9 * 2]/*.Freq*/ !== 0 || s.dyn_ltree[10 * 2]/*.Freq*/ !== 0 ||
|
|
31757
31746
|
s.dyn_ltree[13 * 2]/*.Freq*/ !== 0) {
|
|
31758
31747
|
return Z_TEXT;
|
|
@@ -31763,7 +31752,7 @@
|
|
|
31763
31752
|
}
|
|
31764
31753
|
}
|
|
31765
31754
|
|
|
31766
|
-
/* There are no "
|
|
31755
|
+
/* There are no "block-listed" or "allow-listed" bytes:
|
|
31767
31756
|
* this stream either is empty or has tolerated ("gray-listed") bytes only.
|
|
31768
31757
|
*/
|
|
31769
31758
|
return Z_BINARY;
|
|
@@ -31798,14 +31787,20 @@
|
|
|
31798
31787
|
/* ===========================================================================
|
|
31799
31788
|
* Send a stored block
|
|
31800
31789
|
*/
|
|
31801
|
-
const _tr_stored_block$1 = (s, buf, stored_len, last) =>
|
|
31790
|
+
const _tr_stored_block$1 = (s, buf, stored_len, last) => {
|
|
31802
31791
|
//DeflateState *s;
|
|
31803
31792
|
//charf *buf; /* input block */
|
|
31804
31793
|
//ulg stored_len; /* length of input block */
|
|
31805
31794
|
//int last; /* one if this is the last block for a file */
|
|
31806
|
-
|
|
31795
|
+
|
|
31807
31796
|
send_bits(s, (STORED_BLOCK << 1) + (last ? 1 : 0), 3); /* send block type */
|
|
31808
|
-
|
|
31797
|
+
bi_windup(s); /* align on byte boundary */
|
|
31798
|
+
put_short(s, stored_len);
|
|
31799
|
+
put_short(s, ~stored_len);
|
|
31800
|
+
if (stored_len) {
|
|
31801
|
+
s.pending_buf.set(s.window.subarray(buf, buf + stored_len), s.pending);
|
|
31802
|
+
}
|
|
31803
|
+
s.pending += stored_len;
|
|
31809
31804
|
};
|
|
31810
31805
|
|
|
31811
31806
|
|
|
@@ -31822,14 +31817,14 @@
|
|
|
31822
31817
|
|
|
31823
31818
|
/* ===========================================================================
|
|
31824
31819
|
* Determine the best encoding for the current block: dynamic trees, static
|
|
31825
|
-
* trees or store, and
|
|
31820
|
+
* trees or store, and write out the encoded block.
|
|
31826
31821
|
*/
|
|
31827
|
-
const _tr_flush_block$1 = (s, buf, stored_len, last) =>
|
|
31822
|
+
const _tr_flush_block$1 = (s, buf, stored_len, last) => {
|
|
31828
31823
|
//DeflateState *s;
|
|
31829
31824
|
//charf *buf; /* input block, or NULL if too old */
|
|
31830
31825
|
//ulg stored_len; /* length of input block */
|
|
31831
31826
|
//int last; /* one if this is the last block for a file */
|
|
31832
|
-
|
|
31827
|
+
|
|
31833
31828
|
let opt_lenb, static_lenb; /* opt_len and static_len in bytes */
|
|
31834
31829
|
let max_blindex = 0; /* index of last bit length code of non zero freq */
|
|
31835
31830
|
|
|
@@ -31864,7 +31859,7 @@
|
|
|
31864
31859
|
|
|
31865
31860
|
// Tracev((stderr, "\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u ",
|
|
31866
31861
|
// opt_lenb, s->opt_len, static_lenb, s->static_len, stored_len,
|
|
31867
|
-
// s->
|
|
31862
|
+
// s->sym_next / 3));
|
|
31868
31863
|
|
|
31869
31864
|
if (static_lenb <= opt_lenb) { opt_lenb = static_lenb; }
|
|
31870
31865
|
|
|
@@ -31911,19 +31906,14 @@
|
|
|
31911
31906
|
* Save the match info and tally the frequency counts. Return true if
|
|
31912
31907
|
* the current block must be flushed.
|
|
31913
31908
|
*/
|
|
31914
|
-
const _tr_tally$1 = (s, dist, lc) =>
|
|
31909
|
+
const _tr_tally$1 = (s, dist, lc) => {
|
|
31915
31910
|
// deflate_state *s;
|
|
31916
31911
|
// unsigned dist; /* distance of matched string */
|
|
31917
31912
|
// unsigned lc; /* match length-MIN_MATCH or unmatched char (if dist==0) */
|
|
31918
|
-
{
|
|
31919
|
-
//let out_length, in_length, dcode;
|
|
31920
|
-
|
|
31921
|
-
s.pending_buf[s.d_buf + s.last_lit * 2] = (dist >>> 8) & 0xff;
|
|
31922
|
-
s.pending_buf[s.d_buf + s.last_lit * 2 + 1] = dist & 0xff;
|
|
31923
|
-
|
|
31924
|
-
s.pending_buf[s.l_buf + s.last_lit] = lc & 0xff;
|
|
31925
|
-
s.last_lit++;
|
|
31926
31913
|
|
|
31914
|
+
s.pending_buf[s.sym_buf + s.sym_next++] = dist;
|
|
31915
|
+
s.pending_buf[s.sym_buf + s.sym_next++] = dist >> 8;
|
|
31916
|
+
s.pending_buf[s.sym_buf + s.sym_next++] = lc;
|
|
31927
31917
|
if (dist === 0) {
|
|
31928
31918
|
/* lc is the unmatched char */
|
|
31929
31919
|
s.dyn_ltree[lc * 2]/*.Freq*/++;
|
|
@@ -31939,34 +31929,7 @@
|
|
|
31939
31929
|
s.dyn_dtree[d_code(dist) * 2]/*.Freq*/++;
|
|
31940
31930
|
}
|
|
31941
31931
|
|
|
31942
|
-
|
|
31943
|
-
// don't enable it for binary compatibility
|
|
31944
|
-
|
|
31945
|
-
//#ifdef TRUNCATE_BLOCK
|
|
31946
|
-
// /* Try to guess if it is profitable to stop the current block here */
|
|
31947
|
-
// if ((s.last_lit & 0x1fff) === 0 && s.level > 2) {
|
|
31948
|
-
// /* Compute an upper bound for the compressed length */
|
|
31949
|
-
// out_length = s.last_lit*8;
|
|
31950
|
-
// in_length = s.strstart - s.block_start;
|
|
31951
|
-
//
|
|
31952
|
-
// for (dcode = 0; dcode < D_CODES; dcode++) {
|
|
31953
|
-
// out_length += s.dyn_dtree[dcode*2]/*.Freq*/ * (5 + extra_dbits[dcode]);
|
|
31954
|
-
// }
|
|
31955
|
-
// out_length >>>= 3;
|
|
31956
|
-
// //Tracev((stderr,"\nlast_lit %u, in %ld, out ~%ld(%ld%%) ",
|
|
31957
|
-
// // s->last_lit, in_length, out_length,
|
|
31958
|
-
// // 100L - out_length*100L/in_length));
|
|
31959
|
-
// if (s.matches < (s.last_lit>>1)/*int /2*/ && out_length < (in_length>>1)/*int /2*/) {
|
|
31960
|
-
// return true;
|
|
31961
|
-
// }
|
|
31962
|
-
// }
|
|
31963
|
-
//#endif
|
|
31964
|
-
|
|
31965
|
-
return (s.last_lit === s.lit_bufsize - 1);
|
|
31966
|
-
/* We avoid equality with lit_bufsize because of wraparound at 64K
|
|
31967
|
-
* on 16 bit machines and because stored blocks are restricted to
|
|
31968
|
-
* 64K-1 bytes.
|
|
31969
|
-
*/
|
|
31932
|
+
return (s.sym_next === s.sym_end);
|
|
31970
31933
|
};
|
|
31971
31934
|
|
|
31972
31935
|
var _tr_init_1 = _tr_init$1;
|
|
@@ -32266,13 +32229,16 @@
|
|
|
32266
32229
|
|
|
32267
32230
|
const PRESET_DICT = 0x20;
|
|
32268
32231
|
|
|
32269
|
-
const INIT_STATE
|
|
32270
|
-
|
|
32271
|
-
const
|
|
32272
|
-
|
|
32273
|
-
const
|
|
32274
|
-
const
|
|
32275
|
-
const
|
|
32232
|
+
const INIT_STATE = 42; /* zlib header -> BUSY_STATE */
|
|
32233
|
+
//#ifdef GZIP
|
|
32234
|
+
const GZIP_STATE = 57; /* gzip header -> BUSY_STATE | EXTRA_STATE */
|
|
32235
|
+
//#endif
|
|
32236
|
+
const EXTRA_STATE = 69; /* gzip extra block -> NAME_STATE */
|
|
32237
|
+
const NAME_STATE = 73; /* gzip file name -> COMMENT_STATE */
|
|
32238
|
+
const COMMENT_STATE = 91; /* gzip comment -> HCRC_STATE */
|
|
32239
|
+
const HCRC_STATE = 103; /* gzip header CRC -> BUSY_STATE */
|
|
32240
|
+
const BUSY_STATE = 113; /* deflate -> FINISH_STATE */
|
|
32241
|
+
const FINISH_STATE = 666; /* stream complete */
|
|
32276
32242
|
|
|
32277
32243
|
const BS_NEED_MORE = 1; /* block not completed, need more input or more output */
|
|
32278
32244
|
const BS_BLOCK_DONE = 2; /* block flush performed */
|
|
@@ -32287,13 +32253,41 @@
|
|
|
32287
32253
|
};
|
|
32288
32254
|
|
|
32289
32255
|
const rank = (f) => {
|
|
32290
|
-
return ((f)
|
|
32256
|
+
return ((f) * 2) - ((f) > 4 ? 9 : 0);
|
|
32291
32257
|
};
|
|
32292
32258
|
|
|
32293
32259
|
const zero = (buf) => {
|
|
32294
32260
|
let len = buf.length; while (--len >= 0) { buf[len] = 0; }
|
|
32295
32261
|
};
|
|
32296
32262
|
|
|
32263
|
+
/* ===========================================================================
|
|
32264
|
+
* Slide the hash table when sliding the window down (could be avoided with 32
|
|
32265
|
+
* bit values at the expense of memory usage). We slide even when level == 0 to
|
|
32266
|
+
* keep the hash table consistent if we switch back to level > 0 later.
|
|
32267
|
+
*/
|
|
32268
|
+
const slide_hash = (s) => {
|
|
32269
|
+
let n, m;
|
|
32270
|
+
let p;
|
|
32271
|
+
let wsize = s.w_size;
|
|
32272
|
+
|
|
32273
|
+
n = s.hash_size;
|
|
32274
|
+
p = n;
|
|
32275
|
+
do {
|
|
32276
|
+
m = s.head[--p];
|
|
32277
|
+
s.head[p] = (m >= wsize ? m - wsize : 0);
|
|
32278
|
+
} while (--n);
|
|
32279
|
+
n = wsize;
|
|
32280
|
+
//#ifndef FASTEST
|
|
32281
|
+
p = n;
|
|
32282
|
+
do {
|
|
32283
|
+
m = s.prev[--p];
|
|
32284
|
+
s.prev[p] = (m >= wsize ? m - wsize : 0);
|
|
32285
|
+
/* If n is not on any hash chain, prev[n] is garbage but
|
|
32286
|
+
* its value will never be used.
|
|
32287
|
+
*/
|
|
32288
|
+
} while (--n);
|
|
32289
|
+
//#endif
|
|
32290
|
+
};
|
|
32297
32291
|
|
|
32298
32292
|
/* eslint-disable new-cap */
|
|
32299
32293
|
let HASH_ZLIB = (s, prev, data) => ((prev << s.hash_shift) ^ data) & s.hash_mask;
|
|
@@ -32302,11 +32296,12 @@
|
|
|
32302
32296
|
//let HASH_FAST = (s, prev, data) => ((prev << 8) + (prev >> 8) + (data << 4)) & s.hash_mask;
|
|
32303
32297
|
let HASH = HASH_ZLIB;
|
|
32304
32298
|
|
|
32299
|
+
|
|
32305
32300
|
/* =========================================================================
|
|
32306
|
-
* Flush as much pending output as possible. All deflate() output
|
|
32307
|
-
* through this function so some
|
|
32308
|
-
*
|
|
32309
|
-
* (See also read_buf()).
|
|
32301
|
+
* Flush as much pending output as possible. All deflate() output, except for
|
|
32302
|
+
* some deflate_stored() output, goes through this function so some
|
|
32303
|
+
* applications may wish to modify it to avoid allocating a large
|
|
32304
|
+
* strm->next_out buffer and copying into it. (See also read_buf()).
|
|
32310
32305
|
*/
|
|
32311
32306
|
const flush_pending = (strm) => {
|
|
32312
32307
|
const s = strm.state;
|
|
@@ -32319,11 +32314,11 @@
|
|
|
32319
32314
|
if (len === 0) { return; }
|
|
32320
32315
|
|
|
32321
32316
|
strm.output.set(s.pending_buf.subarray(s.pending_out, s.pending_out + len), strm.next_out);
|
|
32322
|
-
strm.next_out
|
|
32323
|
-
s.pending_out
|
|
32317
|
+
strm.next_out += len;
|
|
32318
|
+
s.pending_out += len;
|
|
32324
32319
|
strm.total_out += len;
|
|
32325
32320
|
strm.avail_out -= len;
|
|
32326
|
-
s.pending
|
|
32321
|
+
s.pending -= len;
|
|
32327
32322
|
if (s.pending === 0) {
|
|
32328
32323
|
s.pending_out = 0;
|
|
32329
32324
|
}
|
|
@@ -32515,7 +32510,7 @@
|
|
|
32515
32510
|
const fill_window = (s) => {
|
|
32516
32511
|
|
|
32517
32512
|
const _w_size = s.w_size;
|
|
32518
|
-
let
|
|
32513
|
+
let n, more, str;
|
|
32519
32514
|
|
|
32520
32515
|
//Assert(s->lookahead < MIN_LOOKAHEAD, "already enough lookahead");
|
|
32521
32516
|
|
|
@@ -32542,38 +32537,15 @@
|
|
|
32542
32537
|
*/
|
|
32543
32538
|
if (s.strstart >= _w_size + (_w_size - MIN_LOOKAHEAD)) {
|
|
32544
32539
|
|
|
32545
|
-
s.window.set(s.window.subarray(_w_size, _w_size + _w_size), 0);
|
|
32540
|
+
s.window.set(s.window.subarray(_w_size, _w_size + _w_size - more), 0);
|
|
32546
32541
|
s.match_start -= _w_size;
|
|
32547
32542
|
s.strstart -= _w_size;
|
|
32548
32543
|
/* we now have strstart >= MAX_DIST */
|
|
32549
32544
|
s.block_start -= _w_size;
|
|
32550
|
-
|
|
32551
|
-
|
|
32552
|
-
|
|
32553
|
-
|
|
32554
|
-
later. (Using level 0 permanently is not an optimal usage of
|
|
32555
|
-
zlib, so we don't care about this pathological case.)
|
|
32556
|
-
*/
|
|
32557
|
-
|
|
32558
|
-
n = s.hash_size;
|
|
32559
|
-
p = n;
|
|
32560
|
-
|
|
32561
|
-
do {
|
|
32562
|
-
m = s.head[--p];
|
|
32563
|
-
s.head[p] = (m >= _w_size ? m - _w_size : 0);
|
|
32564
|
-
} while (--n);
|
|
32565
|
-
|
|
32566
|
-
n = _w_size;
|
|
32567
|
-
p = n;
|
|
32568
|
-
|
|
32569
|
-
do {
|
|
32570
|
-
m = s.prev[--p];
|
|
32571
|
-
s.prev[p] = (m >= _w_size ? m - _w_size : 0);
|
|
32572
|
-
/* If n is not on any hash chain, prev[n] is garbage but
|
|
32573
|
-
* its value will never be used.
|
|
32574
|
-
*/
|
|
32575
|
-
} while (--n);
|
|
32576
|
-
|
|
32545
|
+
if (s.insert > s.strstart) {
|
|
32546
|
+
s.insert = s.strstart;
|
|
32547
|
+
}
|
|
32548
|
+
slide_hash(s);
|
|
32577
32549
|
more += _w_size;
|
|
32578
32550
|
}
|
|
32579
32551
|
if (s.strm.avail_in === 0) {
|
|
@@ -32665,104 +32637,216 @@
|
|
|
32665
32637
|
/* ===========================================================================
|
|
32666
32638
|
* Copy without compression as much as possible from the input stream, return
|
|
32667
32639
|
* the current block state.
|
|
32668
|
-
*
|
|
32669
|
-
*
|
|
32670
|
-
*
|
|
32671
|
-
*
|
|
32672
|
-
*
|
|
32640
|
+
*
|
|
32641
|
+
* In case deflateParams() is used to later switch to a non-zero compression
|
|
32642
|
+
* level, s->matches (otherwise unused when storing) keeps track of the number
|
|
32643
|
+
* of hash table slides to perform. If s->matches is 1, then one hash table
|
|
32644
|
+
* slide will be done when switching. If s->matches is 2, the maximum value
|
|
32645
|
+
* allowed here, then the hash table will be cleared, since two or more slides
|
|
32646
|
+
* is the same as a clear.
|
|
32647
|
+
*
|
|
32648
|
+
* deflate_stored() is written to minimize the number of times an input byte is
|
|
32649
|
+
* copied. It is most efficient with large input and output buffers, which
|
|
32650
|
+
* maximizes the opportunites to have a single copy from next_in to next_out.
|
|
32673
32651
|
*/
|
|
32674
32652
|
const deflate_stored = (s, flush) => {
|
|
32675
32653
|
|
|
32676
|
-
/*
|
|
32677
|
-
*
|
|
32654
|
+
/* Smallest worthy block size when not flushing or finishing. By default
|
|
32655
|
+
* this is 32K. This can be as small as 507 bytes for memLevel == 1. For
|
|
32656
|
+
* large input and output buffers, the stored block size will be larger.
|
|
32678
32657
|
*/
|
|
32679
|
-
let
|
|
32680
|
-
|
|
32681
|
-
if (max_block_size > s.pending_buf_size - 5) {
|
|
32682
|
-
max_block_size = s.pending_buf_size - 5;
|
|
32683
|
-
}
|
|
32658
|
+
let min_block = s.pending_buf_size - 5 > s.w_size ? s.w_size : s.pending_buf_size - 5;
|
|
32684
32659
|
|
|
32685
|
-
/* Copy as
|
|
32686
|
-
|
|
32687
|
-
|
|
32688
|
-
|
|
32689
|
-
|
|
32690
|
-
|
|
32691
|
-
|
|
32692
|
-
|
|
32693
|
-
|
|
32694
|
-
|
|
32695
|
-
|
|
32696
|
-
|
|
32697
|
-
|
|
32698
|
-
|
|
32699
|
-
|
|
32700
|
-
|
|
32660
|
+
/* Copy as many min_block or larger stored blocks directly to next_out as
|
|
32661
|
+
* possible. If flushing, copy the remaining available input to next_out as
|
|
32662
|
+
* stored blocks, if there is enough space.
|
|
32663
|
+
*/
|
|
32664
|
+
let len, left, have, last = 0;
|
|
32665
|
+
let used = s.strm.avail_in;
|
|
32666
|
+
do {
|
|
32667
|
+
/* Set len to the maximum size block that we can copy directly with the
|
|
32668
|
+
* available input data and output space. Set left to how much of that
|
|
32669
|
+
* would be copied from what's left in the window.
|
|
32670
|
+
*/
|
|
32671
|
+
len = 65535/* MAX_STORED */; /* maximum deflate stored block length */
|
|
32672
|
+
have = (s.bi_valid + 42) >> 3; /* number of header bytes */
|
|
32673
|
+
if (s.strm.avail_out < have) { /* need room for header */
|
|
32674
|
+
break;
|
|
32675
|
+
}
|
|
32676
|
+
/* maximum stored block length that will fit in avail_out: */
|
|
32677
|
+
have = s.strm.avail_out - have;
|
|
32678
|
+
left = s.strstart - s.block_start; /* bytes left in window */
|
|
32679
|
+
if (len > left + s.strm.avail_in) {
|
|
32680
|
+
len = left + s.strm.avail_in; /* limit len to the input */
|
|
32681
|
+
}
|
|
32682
|
+
if (len > have) {
|
|
32683
|
+
len = have; /* limit len to the output */
|
|
32684
|
+
}
|
|
32701
32685
|
|
|
32702
|
-
|
|
32703
|
-
|
|
32704
|
-
|
|
32705
|
-
|
|
32686
|
+
/* If the stored block would be less than min_block in length, or if
|
|
32687
|
+
* unable to copy all of the available input when flushing, then try
|
|
32688
|
+
* copying to the window and the pending buffer instead. Also don't
|
|
32689
|
+
* write an empty block when flushing -- deflate() does that.
|
|
32690
|
+
*/
|
|
32691
|
+
if (len < min_block && ((len === 0 && flush !== Z_FINISH$3) ||
|
|
32692
|
+
flush === Z_NO_FLUSH$2 ||
|
|
32693
|
+
len !== left + s.strm.avail_in)) {
|
|
32694
|
+
break;
|
|
32706
32695
|
}
|
|
32707
|
-
//Assert(s->block_start >= 0L, "block gone");
|
|
32708
|
-
// if (s.block_start < 0) throw new Error("block gone");
|
|
32709
32696
|
|
|
32710
|
-
|
|
32711
|
-
|
|
32697
|
+
/* Make a dummy stored block in pending to get the header bytes,
|
|
32698
|
+
* including any pending bits. This also updates the debugging counts.
|
|
32699
|
+
*/
|
|
32700
|
+
last = flush === Z_FINISH$3 && len === left + s.strm.avail_in ? 1 : 0;
|
|
32701
|
+
_tr_stored_block(s, 0, 0, last);
|
|
32712
32702
|
|
|
32713
|
-
/*
|
|
32714
|
-
|
|
32703
|
+
/* Replace the lengths in the dummy stored block with len. */
|
|
32704
|
+
s.pending_buf[s.pending - 4] = len;
|
|
32705
|
+
s.pending_buf[s.pending - 3] = len >> 8;
|
|
32706
|
+
s.pending_buf[s.pending - 2] = ~len;
|
|
32707
|
+
s.pending_buf[s.pending - 1] = ~len >> 8;
|
|
32715
32708
|
|
|
32716
|
-
|
|
32717
|
-
|
|
32718
|
-
s.lookahead = s.strstart - max_start;
|
|
32719
|
-
s.strstart = max_start;
|
|
32720
|
-
/*** FLUSH_BLOCK(s, 0); ***/
|
|
32721
|
-
flush_block_only(s, false);
|
|
32722
|
-
if (s.strm.avail_out === 0) {
|
|
32723
|
-
return BS_NEED_MORE;
|
|
32724
|
-
}
|
|
32725
|
-
/***/
|
|
32709
|
+
/* Write the stored block header bytes. */
|
|
32710
|
+
flush_pending(s.strm);
|
|
32726
32711
|
|
|
32712
|
+
//#ifdef ZLIB_DEBUG
|
|
32713
|
+
// /* Update debugging counts for the data about to be copied. */
|
|
32714
|
+
// s->compressed_len += len << 3;
|
|
32715
|
+
// s->bits_sent += len << 3;
|
|
32716
|
+
//#endif
|
|
32727
32717
|
|
|
32718
|
+
/* Copy uncompressed bytes from the window to next_out. */
|
|
32719
|
+
if (left) {
|
|
32720
|
+
if (left > len) {
|
|
32721
|
+
left = len;
|
|
32722
|
+
}
|
|
32723
|
+
//zmemcpy(s->strm->next_out, s->window + s->block_start, left);
|
|
32724
|
+
s.strm.output.set(s.window.subarray(s.block_start, s.block_start + left), s.strm.next_out);
|
|
32725
|
+
s.strm.next_out += left;
|
|
32726
|
+
s.strm.avail_out -= left;
|
|
32727
|
+
s.strm.total_out += left;
|
|
32728
|
+
s.block_start += left;
|
|
32729
|
+
len -= left;
|
|
32728
32730
|
}
|
|
32729
|
-
|
|
32730
|
-
|
|
32731
|
+
|
|
32732
|
+
/* Copy uncompressed bytes directly from next_in to next_out, updating
|
|
32733
|
+
* the check value.
|
|
32731
32734
|
*/
|
|
32732
|
-
if (
|
|
32733
|
-
|
|
32734
|
-
|
|
32735
|
-
|
|
32736
|
-
|
|
32735
|
+
if (len) {
|
|
32736
|
+
read_buf(s.strm, s.strm.output, s.strm.next_out, len);
|
|
32737
|
+
s.strm.next_out += len;
|
|
32738
|
+
s.strm.avail_out -= len;
|
|
32739
|
+
s.strm.total_out += len;
|
|
32740
|
+
}
|
|
32741
|
+
} while (last === 0);
|
|
32742
|
+
|
|
32743
|
+
/* Update the sliding window with the last s->w_size bytes of the copied
|
|
32744
|
+
* data, or append all of the copied data to the existing window if less
|
|
32745
|
+
* than s->w_size bytes were copied. Also update the number of bytes to
|
|
32746
|
+
* insert in the hash tables, in the event that deflateParams() switches to
|
|
32747
|
+
* a non-zero compression level.
|
|
32748
|
+
*/
|
|
32749
|
+
used -= s.strm.avail_in; /* number of input bytes directly copied */
|
|
32750
|
+
if (used) {
|
|
32751
|
+
/* If any input was used, then no unused input remains in the window,
|
|
32752
|
+
* therefore s->block_start == s->strstart.
|
|
32753
|
+
*/
|
|
32754
|
+
if (used >= s.w_size) { /* supplant the previous history */
|
|
32755
|
+
s.matches = 2; /* clear hash */
|
|
32756
|
+
//zmemcpy(s->window, s->strm->next_in - s->w_size, s->w_size);
|
|
32757
|
+
s.window.set(s.strm.input.subarray(s.strm.next_in - s.w_size, s.strm.next_in), 0);
|
|
32758
|
+
s.strstart = s.w_size;
|
|
32759
|
+
s.insert = s.strstart;
|
|
32760
|
+
}
|
|
32761
|
+
else {
|
|
32762
|
+
if (s.window_size - s.strstart <= used) {
|
|
32763
|
+
/* Slide the window down. */
|
|
32764
|
+
s.strstart -= s.w_size;
|
|
32765
|
+
//zmemcpy(s->window, s->window + s->w_size, s->strstart);
|
|
32766
|
+
s.window.set(s.window.subarray(s.w_size, s.w_size + s.strstart), 0);
|
|
32767
|
+
if (s.matches < 2) {
|
|
32768
|
+
s.matches++; /* add a pending slide_hash() */
|
|
32769
|
+
}
|
|
32770
|
+
if (s.insert > s.strstart) {
|
|
32771
|
+
s.insert = s.strstart;
|
|
32772
|
+
}
|
|
32737
32773
|
}
|
|
32738
|
-
|
|
32774
|
+
//zmemcpy(s->window + s->strstart, s->strm->next_in - used, used);
|
|
32775
|
+
s.window.set(s.strm.input.subarray(s.strm.next_in - used, s.strm.next_in), s.strstart);
|
|
32776
|
+
s.strstart += used;
|
|
32777
|
+
s.insert += used > s.w_size - s.insert ? s.w_size - s.insert : used;
|
|
32739
32778
|
}
|
|
32779
|
+
s.block_start = s.strstart;
|
|
32780
|
+
}
|
|
32781
|
+
if (s.high_water < s.strstart) {
|
|
32782
|
+
s.high_water = s.strstart;
|
|
32740
32783
|
}
|
|
32741
32784
|
|
|
32742
|
-
|
|
32743
|
-
|
|
32744
|
-
if (flush === Z_FINISH$3) {
|
|
32745
|
-
/*** FLUSH_BLOCK(s, 1); ***/
|
|
32746
|
-
flush_block_only(s, true);
|
|
32747
|
-
if (s.strm.avail_out === 0) {
|
|
32748
|
-
return BS_FINISH_STARTED;
|
|
32749
|
-
}
|
|
32750
|
-
/***/
|
|
32785
|
+
/* If the last block was written to next_out, then done. */
|
|
32786
|
+
if (last) {
|
|
32751
32787
|
return BS_FINISH_DONE;
|
|
32752
32788
|
}
|
|
32753
32789
|
|
|
32754
|
-
|
|
32755
|
-
|
|
32756
|
-
|
|
32757
|
-
|
|
32758
|
-
|
|
32790
|
+
/* If flushing and all input has been consumed, then done. */
|
|
32791
|
+
if (flush !== Z_NO_FLUSH$2 && flush !== Z_FINISH$3 &&
|
|
32792
|
+
s.strm.avail_in === 0 && s.strstart === s.block_start) {
|
|
32793
|
+
return BS_BLOCK_DONE;
|
|
32794
|
+
}
|
|
32795
|
+
|
|
32796
|
+
/* Fill the window with any remaining input. */
|
|
32797
|
+
have = s.window_size - s.strstart;
|
|
32798
|
+
if (s.strm.avail_in > have && s.block_start >= s.w_size) {
|
|
32799
|
+
/* Slide the window down. */
|
|
32800
|
+
s.block_start -= s.w_size;
|
|
32801
|
+
s.strstart -= s.w_size;
|
|
32802
|
+
//zmemcpy(s->window, s->window + s->w_size, s->strstart);
|
|
32803
|
+
s.window.set(s.window.subarray(s.w_size, s.w_size + s.strstart), 0);
|
|
32804
|
+
if (s.matches < 2) {
|
|
32805
|
+
s.matches++; /* add a pending slide_hash() */
|
|
32806
|
+
}
|
|
32807
|
+
have += s.w_size; /* more space now */
|
|
32808
|
+
if (s.insert > s.strstart) {
|
|
32809
|
+
s.insert = s.strstart;
|
|
32759
32810
|
}
|
|
32760
|
-
|
|
32811
|
+
}
|
|
32812
|
+
if (have > s.strm.avail_in) {
|
|
32813
|
+
have = s.strm.avail_in;
|
|
32814
|
+
}
|
|
32815
|
+
if (have) {
|
|
32816
|
+
read_buf(s.strm, s.window, s.strstart, have);
|
|
32817
|
+
s.strstart += have;
|
|
32818
|
+
s.insert += have > s.w_size - s.insert ? s.w_size - s.insert : have;
|
|
32819
|
+
}
|
|
32820
|
+
if (s.high_water < s.strstart) {
|
|
32821
|
+
s.high_water = s.strstart;
|
|
32822
|
+
}
|
|
32823
|
+
|
|
32824
|
+
/* There was not enough avail_out to write a complete worthy or flushed
|
|
32825
|
+
* stored block to next_out. Write a stored block to pending instead, if we
|
|
32826
|
+
* have enough input for a worthy block, or if flushing and there is enough
|
|
32827
|
+
* room for the remaining input as a stored block in the pending buffer.
|
|
32828
|
+
*/
|
|
32829
|
+
have = (s.bi_valid + 42) >> 3; /* number of header bytes */
|
|
32830
|
+
/* maximum stored block length that will fit in pending: */
|
|
32831
|
+
have = s.pending_buf_size - have > 65535/* MAX_STORED */ ? 65535/* MAX_STORED */ : s.pending_buf_size - have;
|
|
32832
|
+
min_block = have > s.w_size ? s.w_size : have;
|
|
32833
|
+
left = s.strstart - s.block_start;
|
|
32834
|
+
if (left >= min_block ||
|
|
32835
|
+
((left || flush === Z_FINISH$3) && flush !== Z_NO_FLUSH$2 &&
|
|
32836
|
+
s.strm.avail_in === 0 && left <= have)) {
|
|
32837
|
+
len = left > have ? have : left;
|
|
32838
|
+
last = flush === Z_FINISH$3 && s.strm.avail_in === 0 &&
|
|
32839
|
+
len === left ? 1 : 0;
|
|
32840
|
+
_tr_stored_block(s, s.block_start, len, last);
|
|
32841
|
+
s.block_start += len;
|
|
32842
|
+
flush_pending(s.strm);
|
|
32761
32843
|
}
|
|
32762
32844
|
|
|
32763
|
-
|
|
32845
|
+
/* We've done all we can with the available input and output. */
|
|
32846
|
+
return last ? BS_FINISH_STARTED : BS_NEED_MORE;
|
|
32764
32847
|
};
|
|
32765
32848
|
|
|
32849
|
+
|
|
32766
32850
|
/* ===========================================================================
|
|
32767
32851
|
* Compress as much as possible from the input stream, return the current
|
|
32768
32852
|
* block state.
|
|
@@ -32883,7 +32967,7 @@
|
|
|
32883
32967
|
/***/
|
|
32884
32968
|
return BS_FINISH_DONE;
|
|
32885
32969
|
}
|
|
32886
|
-
if (s.
|
|
32970
|
+
if (s.sym_next) {
|
|
32887
32971
|
/*** FLUSH_BLOCK(s, 0); ***/
|
|
32888
32972
|
flush_block_only(s, false);
|
|
32889
32973
|
if (s.strm.avail_out === 0) {
|
|
@@ -33044,7 +33128,7 @@
|
|
|
33044
33128
|
/***/
|
|
33045
33129
|
return BS_FINISH_DONE;
|
|
33046
33130
|
}
|
|
33047
|
-
if (s.
|
|
33131
|
+
if (s.sym_next) {
|
|
33048
33132
|
/*** FLUSH_BLOCK(s, 0); ***/
|
|
33049
33133
|
flush_block_only(s, false);
|
|
33050
33134
|
if (s.strm.avail_out === 0) {
|
|
@@ -33143,7 +33227,7 @@
|
|
|
33143
33227
|
/***/
|
|
33144
33228
|
return BS_FINISH_DONE;
|
|
33145
33229
|
}
|
|
33146
|
-
if (s.
|
|
33230
|
+
if (s.sym_next) {
|
|
33147
33231
|
/*** FLUSH_BLOCK(s, 0); ***/
|
|
33148
33232
|
flush_block_only(s, false);
|
|
33149
33233
|
if (s.strm.avail_out === 0) {
|
|
@@ -33200,7 +33284,7 @@
|
|
|
33200
33284
|
/***/
|
|
33201
33285
|
return BS_FINISH_DONE;
|
|
33202
33286
|
}
|
|
33203
|
-
if (s.
|
|
33287
|
+
if (s.sym_next) {
|
|
33204
33288
|
/*** FLUSH_BLOCK(s, 0); ***/
|
|
33205
33289
|
flush_block_only(s, false);
|
|
33206
33290
|
if (s.strm.avail_out === 0) {
|
|
@@ -33401,7 +33485,7 @@
|
|
|
33401
33485
|
/* Depth of each subtree used as tie breaker for trees of equal frequency
|
|
33402
33486
|
*/
|
|
33403
33487
|
|
|
33404
|
-
this.
|
|
33488
|
+
this.sym_buf = 0; /* buffer for distances and literals/lengths */
|
|
33405
33489
|
|
|
33406
33490
|
this.lit_bufsize = 0;
|
|
33407
33491
|
/* Size of match buffer for literals/lengths. There are 4 reasons for
|
|
@@ -33423,13 +33507,8 @@
|
|
|
33423
33507
|
* - I can't count above 4
|
|
33424
33508
|
*/
|
|
33425
33509
|
|
|
33426
|
-
this.
|
|
33427
|
-
|
|
33428
|
-
this.d_buf = 0;
|
|
33429
|
-
/* Buffer index for distances. To simplify the code, d_buf and l_buf have
|
|
33430
|
-
* the same number of elements. To use different lengths, an extra flag
|
|
33431
|
-
* array would be necessary.
|
|
33432
|
-
*/
|
|
33510
|
+
this.sym_next = 0; /* running index in sym_buf */
|
|
33511
|
+
this.sym_end = 0; /* symbol table full when sym_next reaches this */
|
|
33433
33512
|
|
|
33434
33513
|
this.opt_len = 0; /* bit length of current block with optimal trees */
|
|
33435
33514
|
this.static_len = 0; /* bit length of current block with static trees */
|
|
@@ -33457,9 +33536,34 @@
|
|
|
33457
33536
|
}
|
|
33458
33537
|
|
|
33459
33538
|
|
|
33539
|
+
/* =========================================================================
|
|
33540
|
+
* Check for a valid deflate stream state. Return 0 if ok, 1 if not.
|
|
33541
|
+
*/
|
|
33542
|
+
const deflateStateCheck = (strm) => {
|
|
33543
|
+
|
|
33544
|
+
if (!strm) {
|
|
33545
|
+
return 1;
|
|
33546
|
+
}
|
|
33547
|
+
const s = strm.state;
|
|
33548
|
+
if (!s || s.strm !== strm || (s.status !== INIT_STATE &&
|
|
33549
|
+
//#ifdef GZIP
|
|
33550
|
+
s.status !== GZIP_STATE &&
|
|
33551
|
+
//#endif
|
|
33552
|
+
s.status !== EXTRA_STATE &&
|
|
33553
|
+
s.status !== NAME_STATE &&
|
|
33554
|
+
s.status !== COMMENT_STATE &&
|
|
33555
|
+
s.status !== HCRC_STATE &&
|
|
33556
|
+
s.status !== BUSY_STATE &&
|
|
33557
|
+
s.status !== FINISH_STATE)) {
|
|
33558
|
+
return 1;
|
|
33559
|
+
}
|
|
33560
|
+
return 0;
|
|
33561
|
+
};
|
|
33562
|
+
|
|
33563
|
+
|
|
33460
33564
|
const deflateResetKeep = (strm) => {
|
|
33461
33565
|
|
|
33462
|
-
if (
|
|
33566
|
+
if (deflateStateCheck(strm)) {
|
|
33463
33567
|
return err(strm, Z_STREAM_ERROR$2);
|
|
33464
33568
|
}
|
|
33465
33569
|
|
|
@@ -33474,12 +33578,16 @@
|
|
|
33474
33578
|
s.wrap = -s.wrap;
|
|
33475
33579
|
/* was made negative by deflate(..., Z_FINISH); */
|
|
33476
33580
|
}
|
|
33477
|
-
s.status =
|
|
33581
|
+
s.status =
|
|
33582
|
+
//#ifdef GZIP
|
|
33583
|
+
s.wrap === 2 ? GZIP_STATE :
|
|
33584
|
+
//#endif
|
|
33585
|
+
s.wrap ? INIT_STATE : BUSY_STATE;
|
|
33478
33586
|
strm.adler = (s.wrap === 2) ?
|
|
33479
33587
|
0 // crc32(0, Z_NULL, 0)
|
|
33480
33588
|
:
|
|
33481
33589
|
1; // adler32(0, Z_NULL, 0)
|
|
33482
|
-
s.last_flush =
|
|
33590
|
+
s.last_flush = -2;
|
|
33483
33591
|
_tr_init(s);
|
|
33484
33592
|
return Z_OK$3;
|
|
33485
33593
|
};
|
|
@@ -33497,8 +33605,9 @@
|
|
|
33497
33605
|
|
|
33498
33606
|
const deflateSetHeader = (strm, head) => {
|
|
33499
33607
|
|
|
33500
|
-
if (
|
|
33501
|
-
|
|
33608
|
+
if (deflateStateCheck(strm) || strm.state.wrap !== 2) {
|
|
33609
|
+
return Z_STREAM_ERROR$2;
|
|
33610
|
+
}
|
|
33502
33611
|
strm.state.gzhead = head;
|
|
33503
33612
|
return Z_OK$3;
|
|
33504
33613
|
};
|
|
@@ -33528,7 +33637,7 @@
|
|
|
33528
33637
|
|
|
33529
33638
|
if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method !== Z_DEFLATED$2 ||
|
|
33530
33639
|
windowBits < 8 || windowBits > 15 || level < 0 || level > 9 ||
|
|
33531
|
-
strategy < 0 || strategy > Z_FIXED) {
|
|
33640
|
+
strategy < 0 || strategy > Z_FIXED || (windowBits === 8 && wrap !== 1)) {
|
|
33532
33641
|
return err(strm, Z_STREAM_ERROR$2);
|
|
33533
33642
|
}
|
|
33534
33643
|
|
|
@@ -33542,6 +33651,7 @@
|
|
|
33542
33651
|
|
|
33543
33652
|
strm.state = s;
|
|
33544
33653
|
s.strm = strm;
|
|
33654
|
+
s.status = INIT_STATE; /* to pass state test in deflateReset() */
|
|
33545
33655
|
|
|
33546
33656
|
s.wrap = wrap;
|
|
33547
33657
|
s.gzhead = null;
|
|
@@ -33563,18 +33673,58 @@
|
|
|
33563
33673
|
|
|
33564
33674
|
s.lit_bufsize = 1 << (memLevel + 6); /* 16K elements by default */
|
|
33565
33675
|
|
|
33566
|
-
|
|
33676
|
+
/* We overlay pending_buf and sym_buf. This works since the average size
|
|
33677
|
+
* for length/distance pairs over any compressed block is assured to be 31
|
|
33678
|
+
* bits or less.
|
|
33679
|
+
*
|
|
33680
|
+
* Analysis: The longest fixed codes are a length code of 8 bits plus 5
|
|
33681
|
+
* extra bits, for lengths 131 to 257. The longest fixed distance codes are
|
|
33682
|
+
* 5 bits plus 13 extra bits, for distances 16385 to 32768. The longest
|
|
33683
|
+
* possible fixed-codes length/distance pair is then 31 bits total.
|
|
33684
|
+
*
|
|
33685
|
+
* sym_buf starts one-fourth of the way into pending_buf. So there are
|
|
33686
|
+
* three bytes in sym_buf for every four bytes in pending_buf. Each symbol
|
|
33687
|
+
* in sym_buf is three bytes -- two for the distance and one for the
|
|
33688
|
+
* literal/length. As each symbol is consumed, the pointer to the next
|
|
33689
|
+
* sym_buf value to read moves forward three bytes. From that symbol, up to
|
|
33690
|
+
* 31 bits are written to pending_buf. The closest the written pending_buf
|
|
33691
|
+
* bits gets to the next sym_buf symbol to read is just before the last
|
|
33692
|
+
* code is written. At that time, 31*(n-2) bits have been written, just
|
|
33693
|
+
* after 24*(n-2) bits have been consumed from sym_buf. sym_buf starts at
|
|
33694
|
+
* 8*n bits into pending_buf. (Note that the symbol buffer fills when n-1
|
|
33695
|
+
* symbols are written.) The closest the writing gets to what is unread is
|
|
33696
|
+
* then n+14 bits. Here n is lit_bufsize, which is 16384 by default, and
|
|
33697
|
+
* can range from 128 to 32768.
|
|
33698
|
+
*
|
|
33699
|
+
* Therefore, at a minimum, there are 142 bits of space between what is
|
|
33700
|
+
* written and what is read in the overlain buffers, so the symbols cannot
|
|
33701
|
+
* be overwritten by the compressed data. That space is actually 139 bits,
|
|
33702
|
+
* due to the three-bit fixed-code block header.
|
|
33703
|
+
*
|
|
33704
|
+
* That covers the case where either Z_FIXED is specified, forcing fixed
|
|
33705
|
+
* codes, or when the use of fixed codes is chosen, because that choice
|
|
33706
|
+
* results in a smaller compressed block than dynamic codes. That latter
|
|
33707
|
+
* condition then assures that the above analysis also covers all dynamic
|
|
33708
|
+
* blocks. A dynamic-code block will only be chosen to be emitted if it has
|
|
33709
|
+
* fewer bits than a fixed-code block would for the same set of symbols.
|
|
33710
|
+
* Therefore its average symbol length is assured to be less than 31. So
|
|
33711
|
+
* the compressed data for a dynamic block also cannot overwrite the
|
|
33712
|
+
* symbols from which it is being constructed.
|
|
33713
|
+
*/
|
|
33567
33714
|
|
|
33568
|
-
|
|
33569
|
-
//s->pending_buf = (uchf *) overlay;
|
|
33715
|
+
s.pending_buf_size = s.lit_bufsize * 4;
|
|
33570
33716
|
s.pending_buf = new Uint8Array(s.pending_buf_size);
|
|
33571
33717
|
|
|
33572
33718
|
// It is offset from `s.pending_buf` (size is `s.lit_bufsize * 2`)
|
|
33573
|
-
//s->
|
|
33574
|
-
s.
|
|
33719
|
+
//s->sym_buf = s->pending_buf + s->lit_bufsize;
|
|
33720
|
+
s.sym_buf = s.lit_bufsize;
|
|
33575
33721
|
|
|
33576
|
-
//s->
|
|
33577
|
-
s.
|
|
33722
|
+
//s->sym_end = (s->lit_bufsize - 1) * 3;
|
|
33723
|
+
s.sym_end = (s.lit_bufsize - 1) * 3;
|
|
33724
|
+
/* We avoid equality with lit_bufsize*3 because of wraparound at 64K
|
|
33725
|
+
* on 16 bit machines and because stored blocks are restricted to
|
|
33726
|
+
* 64K-1 bytes.
|
|
33727
|
+
*/
|
|
33578
33728
|
|
|
33579
33729
|
s.level = level;
|
|
33580
33730
|
s.strategy = strategy;
|
|
@@ -33589,150 +33739,200 @@
|
|
|
33589
33739
|
};
|
|
33590
33740
|
|
|
33591
33741
|
|
|
33742
|
+
/* ========================================================================= */
|
|
33592
33743
|
const deflate$2 = (strm, flush) => {
|
|
33593
33744
|
|
|
33594
|
-
|
|
33595
|
-
|
|
33596
|
-
if (!strm || !strm.state ||
|
|
33597
|
-
flush > Z_BLOCK$1 || flush < 0) {
|
|
33745
|
+
if (deflateStateCheck(strm) || flush > Z_BLOCK$1 || flush < 0) {
|
|
33598
33746
|
return strm ? err(strm, Z_STREAM_ERROR$2) : Z_STREAM_ERROR$2;
|
|
33599
33747
|
}
|
|
33600
33748
|
|
|
33601
33749
|
const s = strm.state;
|
|
33602
33750
|
|
|
33603
33751
|
if (!strm.output ||
|
|
33604
|
-
(
|
|
33752
|
+
(strm.avail_in !== 0 && !strm.input) ||
|
|
33605
33753
|
(s.status === FINISH_STATE && flush !== Z_FINISH$3)) {
|
|
33606
33754
|
return err(strm, (strm.avail_out === 0) ? Z_BUF_ERROR$1 : Z_STREAM_ERROR$2);
|
|
33607
33755
|
}
|
|
33608
33756
|
|
|
33609
|
-
s.strm = strm; /* just in case */
|
|
33610
33757
|
const old_flush = s.last_flush;
|
|
33611
33758
|
s.last_flush = flush;
|
|
33612
33759
|
|
|
33760
|
+
/* Flush as much pending output as possible */
|
|
33761
|
+
if (s.pending !== 0) {
|
|
33762
|
+
flush_pending(strm);
|
|
33763
|
+
if (strm.avail_out === 0) {
|
|
33764
|
+
/* Since avail_out is 0, deflate will be called again with
|
|
33765
|
+
* more output space, but possibly with both pending and
|
|
33766
|
+
* avail_in equal to zero. There won't be anything to do,
|
|
33767
|
+
* but this is not an error situation so make sure we
|
|
33768
|
+
* return OK instead of BUF_ERROR at next call of deflate:
|
|
33769
|
+
*/
|
|
33770
|
+
s.last_flush = -1;
|
|
33771
|
+
return Z_OK$3;
|
|
33772
|
+
}
|
|
33773
|
+
|
|
33774
|
+
/* Make sure there is something to do and avoid duplicate consecutive
|
|
33775
|
+
* flushes. For repeated and useless calls with Z_FINISH, we keep
|
|
33776
|
+
* returning Z_STREAM_END instead of Z_BUF_ERROR.
|
|
33777
|
+
*/
|
|
33778
|
+
} else if (strm.avail_in === 0 && rank(flush) <= rank(old_flush) &&
|
|
33779
|
+
flush !== Z_FINISH$3) {
|
|
33780
|
+
return err(strm, Z_BUF_ERROR$1);
|
|
33781
|
+
}
|
|
33782
|
+
|
|
33783
|
+
/* User must not provide more input after the first FINISH: */
|
|
33784
|
+
if (s.status === FINISH_STATE && strm.avail_in !== 0) {
|
|
33785
|
+
return err(strm, Z_BUF_ERROR$1);
|
|
33786
|
+
}
|
|
33787
|
+
|
|
33613
33788
|
/* Write the header */
|
|
33789
|
+
if (s.status === INIT_STATE && s.wrap === 0) {
|
|
33790
|
+
s.status = BUSY_STATE;
|
|
33791
|
+
}
|
|
33614
33792
|
if (s.status === INIT_STATE) {
|
|
33793
|
+
/* zlib header */
|
|
33794
|
+
let header = (Z_DEFLATED$2 + ((s.w_bits - 8) << 4)) << 8;
|
|
33795
|
+
let level_flags = -1;
|
|
33796
|
+
|
|
33797
|
+
if (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2) {
|
|
33798
|
+
level_flags = 0;
|
|
33799
|
+
} else if (s.level < 6) {
|
|
33800
|
+
level_flags = 1;
|
|
33801
|
+
} else if (s.level === 6) {
|
|
33802
|
+
level_flags = 2;
|
|
33803
|
+
} else {
|
|
33804
|
+
level_flags = 3;
|
|
33805
|
+
}
|
|
33806
|
+
header |= (level_flags << 6);
|
|
33807
|
+
if (s.strstart !== 0) { header |= PRESET_DICT; }
|
|
33808
|
+
header += 31 - (header % 31);
|
|
33615
33809
|
|
|
33616
|
-
|
|
33617
|
-
|
|
33618
|
-
|
|
33619
|
-
|
|
33620
|
-
|
|
33621
|
-
|
|
33622
|
-
put_byte(s, 0);
|
|
33623
|
-
put_byte(s, 0);
|
|
33624
|
-
put_byte(s, 0);
|
|
33625
|
-
put_byte(s, 0);
|
|
33626
|
-
put_byte(s, 0);
|
|
33627
|
-
put_byte(s, s.level === 9 ? 2 :
|
|
33628
|
-
(s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 ?
|
|
33629
|
-
4 : 0));
|
|
33630
|
-
put_byte(s, OS_CODE);
|
|
33631
|
-
s.status = BUSY_STATE;
|
|
33632
|
-
}
|
|
33633
|
-
else {
|
|
33634
|
-
put_byte(s, (s.gzhead.text ? 1 : 0) +
|
|
33635
|
-
(s.gzhead.hcrc ? 2 : 0) +
|
|
33636
|
-
(!s.gzhead.extra ? 0 : 4) +
|
|
33637
|
-
(!s.gzhead.name ? 0 : 8) +
|
|
33638
|
-
(!s.gzhead.comment ? 0 : 16)
|
|
33639
|
-
);
|
|
33640
|
-
put_byte(s, s.gzhead.time & 0xff);
|
|
33641
|
-
put_byte(s, (s.gzhead.time >> 8) & 0xff);
|
|
33642
|
-
put_byte(s, (s.gzhead.time >> 16) & 0xff);
|
|
33643
|
-
put_byte(s, (s.gzhead.time >> 24) & 0xff);
|
|
33644
|
-
put_byte(s, s.level === 9 ? 2 :
|
|
33645
|
-
(s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 ?
|
|
33646
|
-
4 : 0));
|
|
33647
|
-
put_byte(s, s.gzhead.os & 0xff);
|
|
33648
|
-
if (s.gzhead.extra && s.gzhead.extra.length) {
|
|
33649
|
-
put_byte(s, s.gzhead.extra.length & 0xff);
|
|
33650
|
-
put_byte(s, (s.gzhead.extra.length >> 8) & 0xff);
|
|
33651
|
-
}
|
|
33652
|
-
if (s.gzhead.hcrc) {
|
|
33653
|
-
strm.adler = crc32(strm.adler, s.pending_buf, s.pending, 0);
|
|
33654
|
-
}
|
|
33655
|
-
s.gzindex = 0;
|
|
33656
|
-
s.status = EXTRA_STATE;
|
|
33657
|
-
}
|
|
33810
|
+
putShortMSB(s, header);
|
|
33811
|
+
|
|
33812
|
+
/* Save the adler32 of the preset dictionary: */
|
|
33813
|
+
if (s.strstart !== 0) {
|
|
33814
|
+
putShortMSB(s, strm.adler >>> 16);
|
|
33815
|
+
putShortMSB(s, strm.adler & 0xffff);
|
|
33658
33816
|
}
|
|
33659
|
-
|
|
33660
|
-
|
|
33661
|
-
let header = (Z_DEFLATED$2 + ((s.w_bits - 8) << 4)) << 8;
|
|
33662
|
-
let level_flags = -1;
|
|
33663
|
-
|
|
33664
|
-
if (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2) {
|
|
33665
|
-
level_flags = 0;
|
|
33666
|
-
} else if (s.level < 6) {
|
|
33667
|
-
level_flags = 1;
|
|
33668
|
-
} else if (s.level === 6) {
|
|
33669
|
-
level_flags = 2;
|
|
33670
|
-
} else {
|
|
33671
|
-
level_flags = 3;
|
|
33672
|
-
}
|
|
33673
|
-
header |= (level_flags << 6);
|
|
33674
|
-
if (s.strstart !== 0) { header |= PRESET_DICT; }
|
|
33675
|
-
header += 31 - (header % 31);
|
|
33817
|
+
strm.adler = 1; // adler32(0L, Z_NULL, 0);
|
|
33818
|
+
s.status = BUSY_STATE;
|
|
33676
33819
|
|
|
33820
|
+
/* Compression must start with an empty pending buffer */
|
|
33821
|
+
flush_pending(strm);
|
|
33822
|
+
if (s.pending !== 0) {
|
|
33823
|
+
s.last_flush = -1;
|
|
33824
|
+
return Z_OK$3;
|
|
33825
|
+
}
|
|
33826
|
+
}
|
|
33827
|
+
//#ifdef GZIP
|
|
33828
|
+
if (s.status === GZIP_STATE) {
|
|
33829
|
+
/* gzip header */
|
|
33830
|
+
strm.adler = 0; //crc32(0L, Z_NULL, 0);
|
|
33831
|
+
put_byte(s, 31);
|
|
33832
|
+
put_byte(s, 139);
|
|
33833
|
+
put_byte(s, 8);
|
|
33834
|
+
if (!s.gzhead) { // s->gzhead == Z_NULL
|
|
33835
|
+
put_byte(s, 0);
|
|
33836
|
+
put_byte(s, 0);
|
|
33837
|
+
put_byte(s, 0);
|
|
33838
|
+
put_byte(s, 0);
|
|
33839
|
+
put_byte(s, 0);
|
|
33840
|
+
put_byte(s, s.level === 9 ? 2 :
|
|
33841
|
+
(s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 ?
|
|
33842
|
+
4 : 0));
|
|
33843
|
+
put_byte(s, OS_CODE);
|
|
33677
33844
|
s.status = BUSY_STATE;
|
|
33678
|
-
putShortMSB(s, header);
|
|
33679
33845
|
|
|
33680
|
-
/*
|
|
33681
|
-
|
|
33682
|
-
|
|
33683
|
-
|
|
33846
|
+
/* Compression must start with an empty pending buffer */
|
|
33847
|
+
flush_pending(strm);
|
|
33848
|
+
if (s.pending !== 0) {
|
|
33849
|
+
s.last_flush = -1;
|
|
33850
|
+
return Z_OK$3;
|
|
33684
33851
|
}
|
|
33685
|
-
|
|
33852
|
+
}
|
|
33853
|
+
else {
|
|
33854
|
+
put_byte(s, (s.gzhead.text ? 1 : 0) +
|
|
33855
|
+
(s.gzhead.hcrc ? 2 : 0) +
|
|
33856
|
+
(!s.gzhead.extra ? 0 : 4) +
|
|
33857
|
+
(!s.gzhead.name ? 0 : 8) +
|
|
33858
|
+
(!s.gzhead.comment ? 0 : 16)
|
|
33859
|
+
);
|
|
33860
|
+
put_byte(s, s.gzhead.time & 0xff);
|
|
33861
|
+
put_byte(s, (s.gzhead.time >> 8) & 0xff);
|
|
33862
|
+
put_byte(s, (s.gzhead.time >> 16) & 0xff);
|
|
33863
|
+
put_byte(s, (s.gzhead.time >> 24) & 0xff);
|
|
33864
|
+
put_byte(s, s.level === 9 ? 2 :
|
|
33865
|
+
(s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 ?
|
|
33866
|
+
4 : 0));
|
|
33867
|
+
put_byte(s, s.gzhead.os & 0xff);
|
|
33868
|
+
if (s.gzhead.extra && s.gzhead.extra.length) {
|
|
33869
|
+
put_byte(s, s.gzhead.extra.length & 0xff);
|
|
33870
|
+
put_byte(s, (s.gzhead.extra.length >> 8) & 0xff);
|
|
33871
|
+
}
|
|
33872
|
+
if (s.gzhead.hcrc) {
|
|
33873
|
+
strm.adler = crc32(strm.adler, s.pending_buf, s.pending, 0);
|
|
33874
|
+
}
|
|
33875
|
+
s.gzindex = 0;
|
|
33876
|
+
s.status = EXTRA_STATE;
|
|
33686
33877
|
}
|
|
33687
33878
|
}
|
|
33688
|
-
|
|
33689
|
-
//#ifdef GZIP
|
|
33690
33879
|
if (s.status === EXTRA_STATE) {
|
|
33691
33880
|
if (s.gzhead.extra/* != Z_NULL*/) {
|
|
33692
|
-
beg = s.pending;
|
|
33693
|
-
|
|
33694
|
-
while (s.
|
|
33695
|
-
|
|
33696
|
-
|
|
33697
|
-
|
|
33698
|
-
|
|
33699
|
-
|
|
33700
|
-
|
|
33701
|
-
|
|
33702
|
-
|
|
33703
|
-
|
|
33881
|
+
let beg = s.pending; /* start of bytes to update crc */
|
|
33882
|
+
let left = (s.gzhead.extra.length & 0xffff) - s.gzindex;
|
|
33883
|
+
while (s.pending + left > s.pending_buf_size) {
|
|
33884
|
+
let copy = s.pending_buf_size - s.pending;
|
|
33885
|
+
// zmemcpy(s.pending_buf + s.pending,
|
|
33886
|
+
// s.gzhead.extra + s.gzindex, copy);
|
|
33887
|
+
s.pending_buf.set(s.gzhead.extra.subarray(s.gzindex, s.gzindex + copy), s.pending);
|
|
33888
|
+
s.pending = s.pending_buf_size;
|
|
33889
|
+
//--- HCRC_UPDATE(beg) ---//
|
|
33890
|
+
if (s.gzhead.hcrc && s.pending > beg) {
|
|
33891
|
+
strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);
|
|
33892
|
+
}
|
|
33893
|
+
//---//
|
|
33894
|
+
s.gzindex += copy;
|
|
33895
|
+
flush_pending(strm);
|
|
33896
|
+
if (s.pending !== 0) {
|
|
33897
|
+
s.last_flush = -1;
|
|
33898
|
+
return Z_OK$3;
|
|
33704
33899
|
}
|
|
33705
|
-
|
|
33706
|
-
|
|
33900
|
+
beg = 0;
|
|
33901
|
+
left -= copy;
|
|
33707
33902
|
}
|
|
33903
|
+
// JS specific: s.gzhead.extra may be TypedArray or Array for backward compatibility
|
|
33904
|
+
// TypedArray.slice and TypedArray.from don't exist in IE10-IE11
|
|
33905
|
+
let gzhead_extra = new Uint8Array(s.gzhead.extra);
|
|
33906
|
+
// zmemcpy(s->pending_buf + s->pending,
|
|
33907
|
+
// s->gzhead->extra + s->gzindex, left);
|
|
33908
|
+
s.pending_buf.set(gzhead_extra.subarray(s.gzindex, s.gzindex + left), s.pending);
|
|
33909
|
+
s.pending += left;
|
|
33910
|
+
//--- HCRC_UPDATE(beg) ---//
|
|
33708
33911
|
if (s.gzhead.hcrc && s.pending > beg) {
|
|
33709
33912
|
strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);
|
|
33710
33913
|
}
|
|
33711
|
-
|
|
33712
|
-
|
|
33713
|
-
s.status = NAME_STATE;
|
|
33714
|
-
}
|
|
33715
|
-
}
|
|
33716
|
-
else {
|
|
33717
|
-
s.status = NAME_STATE;
|
|
33914
|
+
//---//
|
|
33915
|
+
s.gzindex = 0;
|
|
33718
33916
|
}
|
|
33917
|
+
s.status = NAME_STATE;
|
|
33719
33918
|
}
|
|
33720
33919
|
if (s.status === NAME_STATE) {
|
|
33721
33920
|
if (s.gzhead.name/* != Z_NULL*/) {
|
|
33722
|
-
beg = s.pending;
|
|
33723
|
-
|
|
33724
|
-
|
|
33921
|
+
let beg = s.pending; /* start of bytes to update crc */
|
|
33922
|
+
let val;
|
|
33725
33923
|
do {
|
|
33726
33924
|
if (s.pending === s.pending_buf_size) {
|
|
33925
|
+
//--- HCRC_UPDATE(beg) ---//
|
|
33727
33926
|
if (s.gzhead.hcrc && s.pending > beg) {
|
|
33728
33927
|
strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);
|
|
33729
33928
|
}
|
|
33929
|
+
//---//
|
|
33730
33930
|
flush_pending(strm);
|
|
33731
|
-
|
|
33732
|
-
|
|
33733
|
-
|
|
33734
|
-
break;
|
|
33931
|
+
if (s.pending !== 0) {
|
|
33932
|
+
s.last_flush = -1;
|
|
33933
|
+
return Z_OK$3;
|
|
33735
33934
|
}
|
|
33935
|
+
beg = 0;
|
|
33736
33936
|
}
|
|
33737
33937
|
// JS specific: little magic to add zero terminator to end of string
|
|
33738
33938
|
if (s.gzindex < s.gzhead.name.length) {
|
|
@@ -33742,35 +33942,32 @@
|
|
|
33742
33942
|
}
|
|
33743
33943
|
put_byte(s, val);
|
|
33744
33944
|
} while (val !== 0);
|
|
33745
|
-
|
|
33945
|
+
//--- HCRC_UPDATE(beg) ---//
|
|
33746
33946
|
if (s.gzhead.hcrc && s.pending > beg) {
|
|
33747
33947
|
strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);
|
|
33748
33948
|
}
|
|
33749
|
-
|
|
33750
|
-
|
|
33751
|
-
s.status = COMMENT_STATE;
|
|
33752
|
-
}
|
|
33753
|
-
}
|
|
33754
|
-
else {
|
|
33755
|
-
s.status = COMMENT_STATE;
|
|
33949
|
+
//---//
|
|
33950
|
+
s.gzindex = 0;
|
|
33756
33951
|
}
|
|
33952
|
+
s.status = COMMENT_STATE;
|
|
33757
33953
|
}
|
|
33758
33954
|
if (s.status === COMMENT_STATE) {
|
|
33759
33955
|
if (s.gzhead.comment/* != Z_NULL*/) {
|
|
33760
|
-
beg = s.pending;
|
|
33761
|
-
|
|
33762
|
-
|
|
33956
|
+
let beg = s.pending; /* start of bytes to update crc */
|
|
33957
|
+
let val;
|
|
33763
33958
|
do {
|
|
33764
33959
|
if (s.pending === s.pending_buf_size) {
|
|
33960
|
+
//--- HCRC_UPDATE(beg) ---//
|
|
33765
33961
|
if (s.gzhead.hcrc && s.pending > beg) {
|
|
33766
33962
|
strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);
|
|
33767
33963
|
}
|
|
33964
|
+
//---//
|
|
33768
33965
|
flush_pending(strm);
|
|
33769
|
-
|
|
33770
|
-
|
|
33771
|
-
|
|
33772
|
-
break;
|
|
33966
|
+
if (s.pending !== 0) {
|
|
33967
|
+
s.last_flush = -1;
|
|
33968
|
+
return Z_OK$3;
|
|
33773
33969
|
}
|
|
33970
|
+
beg = 0;
|
|
33774
33971
|
}
|
|
33775
33972
|
// JS specific: little magic to add zero terminator to end of string
|
|
33776
33973
|
if (s.gzindex < s.gzhead.comment.length) {
|
|
@@ -33780,71 +33977,46 @@
|
|
|
33780
33977
|
}
|
|
33781
33978
|
put_byte(s, val);
|
|
33782
33979
|
} while (val !== 0);
|
|
33783
|
-
|
|
33980
|
+
//--- HCRC_UPDATE(beg) ---//
|
|
33784
33981
|
if (s.gzhead.hcrc && s.pending > beg) {
|
|
33785
33982
|
strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);
|
|
33786
33983
|
}
|
|
33787
|
-
|
|
33788
|
-
s.status = HCRC_STATE;
|
|
33789
|
-
}
|
|
33790
|
-
}
|
|
33791
|
-
else {
|
|
33792
|
-
s.status = HCRC_STATE;
|
|
33984
|
+
//---//
|
|
33793
33985
|
}
|
|
33986
|
+
s.status = HCRC_STATE;
|
|
33794
33987
|
}
|
|
33795
33988
|
if (s.status === HCRC_STATE) {
|
|
33796
33989
|
if (s.gzhead.hcrc) {
|
|
33797
33990
|
if (s.pending + 2 > s.pending_buf_size) {
|
|
33798
33991
|
flush_pending(strm);
|
|
33992
|
+
if (s.pending !== 0) {
|
|
33993
|
+
s.last_flush = -1;
|
|
33994
|
+
return Z_OK$3;
|
|
33995
|
+
}
|
|
33799
33996
|
}
|
|
33800
|
-
|
|
33801
|
-
|
|
33802
|
-
|
|
33803
|
-
strm.adler = 0; //crc32(0L, Z_NULL, 0);
|
|
33804
|
-
s.status = BUSY_STATE;
|
|
33805
|
-
}
|
|
33997
|
+
put_byte(s, strm.adler & 0xff);
|
|
33998
|
+
put_byte(s, (strm.adler >> 8) & 0xff);
|
|
33999
|
+
strm.adler = 0; //crc32(0L, Z_NULL, 0);
|
|
33806
34000
|
}
|
|
33807
|
-
|
|
33808
|
-
s.status = BUSY_STATE;
|
|
33809
|
-
}
|
|
33810
|
-
}
|
|
33811
|
-
//#endif
|
|
34001
|
+
s.status = BUSY_STATE;
|
|
33812
34002
|
|
|
33813
|
-
|
|
33814
|
-
if (s.pending !== 0) {
|
|
34003
|
+
/* Compression must start with an empty pending buffer */
|
|
33815
34004
|
flush_pending(strm);
|
|
33816
|
-
if (
|
|
33817
|
-
/* Since avail_out is 0, deflate will be called again with
|
|
33818
|
-
* more output space, but possibly with both pending and
|
|
33819
|
-
* avail_in equal to zero. There won't be anything to do,
|
|
33820
|
-
* but this is not an error situation so make sure we
|
|
33821
|
-
* return OK instead of BUF_ERROR at next call of deflate:
|
|
33822
|
-
*/
|
|
34005
|
+
if (s.pending !== 0) {
|
|
33823
34006
|
s.last_flush = -1;
|
|
33824
34007
|
return Z_OK$3;
|
|
33825
34008
|
}
|
|
33826
|
-
|
|
33827
|
-
/* Make sure there is something to do and avoid duplicate consecutive
|
|
33828
|
-
* flushes. For repeated and useless calls with Z_FINISH, we keep
|
|
33829
|
-
* returning Z_STREAM_END instead of Z_BUF_ERROR.
|
|
33830
|
-
*/
|
|
33831
|
-
} else if (strm.avail_in === 0 && rank(flush) <= rank(old_flush) &&
|
|
33832
|
-
flush !== Z_FINISH$3) {
|
|
33833
|
-
return err(strm, Z_BUF_ERROR$1);
|
|
33834
|
-
}
|
|
33835
|
-
|
|
33836
|
-
/* User must not provide more input after the first FINISH: */
|
|
33837
|
-
if (s.status === FINISH_STATE && strm.avail_in !== 0) {
|
|
33838
|
-
return err(strm, Z_BUF_ERROR$1);
|
|
33839
34009
|
}
|
|
34010
|
+
//#endif
|
|
33840
34011
|
|
|
33841
34012
|
/* Start a new block or continue the current one.
|
|
33842
34013
|
*/
|
|
33843
34014
|
if (strm.avail_in !== 0 || s.lookahead !== 0 ||
|
|
33844
34015
|
(flush !== Z_NO_FLUSH$2 && s.status !== FINISH_STATE)) {
|
|
33845
|
-
let bstate =
|
|
33846
|
-
|
|
33847
|
-
|
|
34016
|
+
let bstate = s.level === 0 ? deflate_stored(s, flush) :
|
|
34017
|
+
s.strategy === Z_HUFFMAN_ONLY ? deflate_huff(s, flush) :
|
|
34018
|
+
s.strategy === Z_RLE ? deflate_rle(s, flush) :
|
|
34019
|
+
configuration_table[s.level].func(s, flush);
|
|
33848
34020
|
|
|
33849
34021
|
if (bstate === BS_FINISH_STARTED || bstate === BS_FINISH_DONE) {
|
|
33850
34022
|
s.status = FINISH_STATE;
|
|
@@ -33891,8 +34063,6 @@
|
|
|
33891
34063
|
}
|
|
33892
34064
|
}
|
|
33893
34065
|
}
|
|
33894
|
-
//Assert(strm->avail_out > 0, "bug2");
|
|
33895
|
-
//if (strm.avail_out <= 0) { throw new Error("bug2");}
|
|
33896
34066
|
|
|
33897
34067
|
if (flush !== Z_FINISH$3) { return Z_OK$3; }
|
|
33898
34068
|
if (s.wrap <= 0) { return Z_STREAM_END$3; }
|
|
@@ -33926,21 +34096,11 @@
|
|
|
33926
34096
|
|
|
33927
34097
|
const deflateEnd = (strm) => {
|
|
33928
34098
|
|
|
33929
|
-
if (
|
|
34099
|
+
if (deflateStateCheck(strm)) {
|
|
33930
34100
|
return Z_STREAM_ERROR$2;
|
|
33931
34101
|
}
|
|
33932
34102
|
|
|
33933
34103
|
const status = strm.state.status;
|
|
33934
|
-
if (status !== INIT_STATE &&
|
|
33935
|
-
status !== EXTRA_STATE &&
|
|
33936
|
-
status !== NAME_STATE &&
|
|
33937
|
-
status !== COMMENT_STATE &&
|
|
33938
|
-
status !== HCRC_STATE &&
|
|
33939
|
-
status !== BUSY_STATE &&
|
|
33940
|
-
status !== FINISH_STATE
|
|
33941
|
-
) {
|
|
33942
|
-
return err(strm, Z_STREAM_ERROR$2);
|
|
33943
|
-
}
|
|
33944
34104
|
|
|
33945
34105
|
strm.state = null;
|
|
33946
34106
|
|
|
@@ -33956,7 +34116,7 @@
|
|
|
33956
34116
|
|
|
33957
34117
|
let dictLength = dictionary.length;
|
|
33958
34118
|
|
|
33959
|
-
if (
|
|
34119
|
+
if (deflateStateCheck(strm)) {
|
|
33960
34120
|
return Z_STREAM_ERROR$2;
|
|
33961
34121
|
}
|
|
33962
34122
|
|
|
@@ -34042,6 +34202,7 @@
|
|
|
34042
34202
|
/* Not implemented
|
|
34043
34203
|
module.exports.deflateBound = deflateBound;
|
|
34044
34204
|
module.exports.deflateCopy = deflateCopy;
|
|
34205
|
+
module.exports.deflateGetDictionary = deflateGetDictionary;
|
|
34045
34206
|
module.exports.deflateParams = deflateParams;
|
|
34046
34207
|
module.exports.deflatePending = deflatePending;
|
|
34047
34208
|
module.exports.deflatePrime = deflatePrime;
|
|
@@ -34639,7 +34800,7 @@
|
|
|
34639
34800
|
|
|
34640
34801
|
/**
|
|
34641
34802
|
* deflate(data[, options]) -> Uint8Array
|
|
34642
|
-
* - data (Uint8Array|String): input data to compress.
|
|
34803
|
+
* - data (Uint8Array|ArrayBuffer|String): input data to compress.
|
|
34643
34804
|
* - options (Object): zlib deflate options.
|
|
34644
34805
|
*
|
|
34645
34806
|
* Compress `data` with deflate algorithm and `options`.
|
|
@@ -34683,7 +34844,7 @@
|
|
|
34683
34844
|
|
|
34684
34845
|
/**
|
|
34685
34846
|
* deflateRaw(data[, options]) -> Uint8Array
|
|
34686
|
-
* - data (Uint8Array|String): input data to compress.
|
|
34847
|
+
* - data (Uint8Array|ArrayBuffer|String): input data to compress.
|
|
34687
34848
|
* - options (Object): zlib deflate options.
|
|
34688
34849
|
*
|
|
34689
34850
|
* The same as [[deflate]], but creates raw data, without wrapper
|
|
@@ -34698,7 +34859,7 @@
|
|
|
34698
34859
|
|
|
34699
34860
|
/**
|
|
34700
34861
|
* gzip(data[, options]) -> Uint8Array
|
|
34701
|
-
* - data (Uint8Array|String): input data to compress.
|
|
34862
|
+
* - data (Uint8Array|ArrayBuffer|String): input data to compress.
|
|
34702
34863
|
* - options (Object): zlib deflate options.
|
|
34703
34864
|
*
|
|
34704
34865
|
* The same as [[deflate]], but create gzip wrapper instead of
|
|
@@ -34745,8 +34906,8 @@
|
|
|
34745
34906
|
// 3. This notice may not be removed or altered from any source distribution.
|
|
34746
34907
|
|
|
34747
34908
|
// See state defs from inflate.js
|
|
34748
|
-
const BAD$1 =
|
|
34749
|
-
const TYPE$1 =
|
|
34909
|
+
const BAD$1 = 16209; /* got a data error -- remain here until reset */
|
|
34910
|
+
const TYPE$1 = 16191; /* i: waiting for type bits, including last-flag bit */
|
|
34750
34911
|
|
|
34751
34912
|
/*
|
|
34752
34913
|
Decode literal, length, and distance codes and write out the resulting
|
|
@@ -35138,13 +35299,11 @@
|
|
|
35138
35299
|
let mask; /* mask for low root bits */
|
|
35139
35300
|
let next; /* next available space in table */
|
|
35140
35301
|
let base = null; /* base value table to use */
|
|
35141
|
-
let base_index = 0;
|
|
35142
35302
|
// let shoextra; /* extra bits table to use */
|
|
35143
|
-
let
|
|
35303
|
+
let match; /* use base and extra for symbol >= match */
|
|
35144
35304
|
const count = new Uint16Array(MAXBITS + 1); //[MAXBITS+1]; /* number of codes of each length */
|
|
35145
35305
|
const offs = new Uint16Array(MAXBITS + 1); //[MAXBITS+1]; /* offsets in table for each length */
|
|
35146
35306
|
let extra = null;
|
|
35147
|
-
let extra_index = 0;
|
|
35148
35307
|
|
|
35149
35308
|
let here_bits, here_op, here_val;
|
|
35150
35309
|
|
|
@@ -35279,19 +35438,17 @@
|
|
|
35279
35438
|
// to avoid deopts in old v8
|
|
35280
35439
|
if (type === CODES$1) {
|
|
35281
35440
|
base = extra = work; /* dummy value--not used */
|
|
35282
|
-
|
|
35441
|
+
match = 20;
|
|
35283
35442
|
|
|
35284
35443
|
} else if (type === LENS$1) {
|
|
35285
35444
|
base = lbase;
|
|
35286
|
-
base_index -= 257;
|
|
35287
35445
|
extra = lext;
|
|
35288
|
-
|
|
35289
|
-
end = 256;
|
|
35446
|
+
match = 257;
|
|
35290
35447
|
|
|
35291
35448
|
} else { /* DISTS */
|
|
35292
35449
|
base = dbase;
|
|
35293
35450
|
extra = dext;
|
|
35294
|
-
|
|
35451
|
+
match = 0;
|
|
35295
35452
|
}
|
|
35296
35453
|
|
|
35297
35454
|
/* initialize opts for loop */
|
|
@@ -35315,13 +35472,13 @@
|
|
|
35315
35472
|
for (;;) {
|
|
35316
35473
|
/* create table entry */
|
|
35317
35474
|
here_bits = len - drop;
|
|
35318
|
-
if (work[sym] <
|
|
35475
|
+
if (work[sym] + 1 < match) {
|
|
35319
35476
|
here_op = 0;
|
|
35320
35477
|
here_val = work[sym];
|
|
35321
35478
|
}
|
|
35322
|
-
else if (work[sym]
|
|
35323
|
-
here_op = extra[
|
|
35324
|
-
here_val = base[
|
|
35479
|
+
else if (work[sym] >= match) {
|
|
35480
|
+
here_op = extra[work[sym] - match];
|
|
35481
|
+
here_val = base[work[sym] - match];
|
|
35325
35482
|
}
|
|
35326
35483
|
else {
|
|
35327
35484
|
here_op = 32 + 64; /* end of block */
|
|
@@ -35457,38 +35614,38 @@
|
|
|
35457
35614
|
/* ===========================================================================*/
|
|
35458
35615
|
|
|
35459
35616
|
|
|
35460
|
-
const HEAD =
|
|
35461
|
-
const FLAGS =
|
|
35462
|
-
const TIME =
|
|
35463
|
-
const OS =
|
|
35464
|
-
const EXLEN =
|
|
35465
|
-
const EXTRA =
|
|
35466
|
-
const NAME =
|
|
35467
|
-
const COMMENT =
|
|
35468
|
-
const HCRC =
|
|
35469
|
-
const DICTID =
|
|
35470
|
-
const DICT =
|
|
35471
|
-
const TYPE =
|
|
35472
|
-
const TYPEDO =
|
|
35473
|
-
const STORED =
|
|
35474
|
-
const COPY_ =
|
|
35475
|
-
const COPY =
|
|
35476
|
-
const TABLE =
|
|
35477
|
-
const LENLENS =
|
|
35478
|
-
const CODELENS =
|
|
35479
|
-
const LEN_ =
|
|
35480
|
-
const LEN =
|
|
35481
|
-
const LENEXT =
|
|
35482
|
-
const DIST =
|
|
35483
|
-
const DISTEXT =
|
|
35484
|
-
const MATCH =
|
|
35485
|
-
const LIT =
|
|
35486
|
-
const CHECK =
|
|
35487
|
-
const LENGTH =
|
|
35488
|
-
const DONE =
|
|
35489
|
-
const BAD =
|
|
35490
|
-
const MEM =
|
|
35491
|
-
const SYNC =
|
|
35617
|
+
const HEAD = 16180; /* i: waiting for magic header */
|
|
35618
|
+
const FLAGS = 16181; /* i: waiting for method and flags (gzip) */
|
|
35619
|
+
const TIME = 16182; /* i: waiting for modification time (gzip) */
|
|
35620
|
+
const OS = 16183; /* i: waiting for extra flags and operating system (gzip) */
|
|
35621
|
+
const EXLEN = 16184; /* i: waiting for extra length (gzip) */
|
|
35622
|
+
const EXTRA = 16185; /* i: waiting for extra bytes (gzip) */
|
|
35623
|
+
const NAME = 16186; /* i: waiting for end of file name (gzip) */
|
|
35624
|
+
const COMMENT = 16187; /* i: waiting for end of comment (gzip) */
|
|
35625
|
+
const HCRC = 16188; /* i: waiting for header crc (gzip) */
|
|
35626
|
+
const DICTID = 16189; /* i: waiting for dictionary check value */
|
|
35627
|
+
const DICT = 16190; /* waiting for inflateSetDictionary() call */
|
|
35628
|
+
const TYPE = 16191; /* i: waiting for type bits, including last-flag bit */
|
|
35629
|
+
const TYPEDO = 16192; /* i: same, but skip check to exit inflate on new block */
|
|
35630
|
+
const STORED = 16193; /* i: waiting for stored size (length and complement) */
|
|
35631
|
+
const COPY_ = 16194; /* i/o: same as COPY below, but only first time in */
|
|
35632
|
+
const COPY = 16195; /* i/o: waiting for input or output to copy stored block */
|
|
35633
|
+
const TABLE = 16196; /* i: waiting for dynamic block table lengths */
|
|
35634
|
+
const LENLENS = 16197; /* i: waiting for code length code lengths */
|
|
35635
|
+
const CODELENS = 16198; /* i: waiting for length/lit and distance code lengths */
|
|
35636
|
+
const LEN_ = 16199; /* i: same as LEN below, but only first time in */
|
|
35637
|
+
const LEN = 16200; /* i: waiting for length/lit/eob code */
|
|
35638
|
+
const LENEXT = 16201; /* i: waiting for length extra bits */
|
|
35639
|
+
const DIST = 16202; /* i: waiting for distance code */
|
|
35640
|
+
const DISTEXT = 16203; /* i: waiting for distance extra bits */
|
|
35641
|
+
const MATCH = 16204; /* o: waiting for output space to copy string */
|
|
35642
|
+
const LIT = 16205; /* o: waiting for output space to write literal */
|
|
35643
|
+
const CHECK = 16206; /* i: waiting for 32-bit check value */
|
|
35644
|
+
const LENGTH = 16207; /* i: waiting for 32-bit length (gzip) */
|
|
35645
|
+
const DONE = 16208; /* finished check, done -- remain here until reset */
|
|
35646
|
+
const BAD = 16209; /* got a data error -- remain here until reset */
|
|
35647
|
+
const MEM = 16210; /* got an inflate() memory error -- remain here until reset */
|
|
35648
|
+
const SYNC = 16211; /* looking for synchronization bytes to restart inflate() */
|
|
35492
35649
|
|
|
35493
35650
|
/* ===========================================================================*/
|
|
35494
35651
|
|
|
@@ -35513,11 +35670,14 @@
|
|
|
35513
35670
|
|
|
35514
35671
|
|
|
35515
35672
|
function InflateState() {
|
|
35516
|
-
this.
|
|
35673
|
+
this.strm = null; /* pointer back to this zlib stream */
|
|
35674
|
+
this.mode = 0; /* current inflate mode */
|
|
35517
35675
|
this.last = false; /* true if processing last block */
|
|
35518
|
-
this.wrap = 0; /* bit 0 true for zlib, bit 1 true for gzip
|
|
35676
|
+
this.wrap = 0; /* bit 0 true for zlib, bit 1 true for gzip,
|
|
35677
|
+
bit 2 true to validate check value */
|
|
35519
35678
|
this.havedict = false; /* true if dictionary provided */
|
|
35520
|
-
this.flags = 0; /* gzip header method and flags (0 if zlib)
|
|
35679
|
+
this.flags = 0; /* gzip header method and flags (0 if zlib), or
|
|
35680
|
+
-1 if raw or no header yet */
|
|
35521
35681
|
this.dmax = 0; /* zlib header max distance (INFLATE_STRICT) */
|
|
35522
35682
|
this.check = 0; /* protected copy of check value */
|
|
35523
35683
|
this.total = 0; /* protected copy of output count */
|
|
@@ -35571,9 +35731,23 @@
|
|
|
35571
35731
|
}
|
|
35572
35732
|
|
|
35573
35733
|
|
|
35734
|
+
const inflateStateCheck = (strm) => {
|
|
35735
|
+
|
|
35736
|
+
if (!strm) {
|
|
35737
|
+
return 1;
|
|
35738
|
+
}
|
|
35739
|
+
const state = strm.state;
|
|
35740
|
+
if (!state || state.strm !== strm ||
|
|
35741
|
+
state.mode < HEAD || state.mode > SYNC) {
|
|
35742
|
+
return 1;
|
|
35743
|
+
}
|
|
35744
|
+
return 0;
|
|
35745
|
+
};
|
|
35746
|
+
|
|
35747
|
+
|
|
35574
35748
|
const inflateResetKeep = (strm) => {
|
|
35575
35749
|
|
|
35576
|
-
if (
|
|
35750
|
+
if (inflateStateCheck(strm)) { return Z_STREAM_ERROR$1; }
|
|
35577
35751
|
const state = strm.state;
|
|
35578
35752
|
strm.total_in = strm.total_out = state.total = 0;
|
|
35579
35753
|
strm.msg = ''; /*Z_NULL*/
|
|
@@ -35583,6 +35757,7 @@
|
|
|
35583
35757
|
state.mode = HEAD;
|
|
35584
35758
|
state.last = 0;
|
|
35585
35759
|
state.havedict = 0;
|
|
35760
|
+
state.flags = -1;
|
|
35586
35761
|
state.dmax = 32768;
|
|
35587
35762
|
state.head = null/*Z_NULL*/;
|
|
35588
35763
|
state.hold = 0;
|
|
@@ -35600,7 +35775,7 @@
|
|
|
35600
35775
|
|
|
35601
35776
|
const inflateReset = (strm) => {
|
|
35602
35777
|
|
|
35603
|
-
if (
|
|
35778
|
+
if (inflateStateCheck(strm)) { return Z_STREAM_ERROR$1; }
|
|
35604
35779
|
const state = strm.state;
|
|
35605
35780
|
state.wsize = 0;
|
|
35606
35781
|
state.whave = 0;
|
|
@@ -35614,7 +35789,7 @@
|
|
|
35614
35789
|
let wrap;
|
|
35615
35790
|
|
|
35616
35791
|
/* get the state */
|
|
35617
|
-
if (
|
|
35792
|
+
if (inflateStateCheck(strm)) { return Z_STREAM_ERROR$1; }
|
|
35618
35793
|
const state = strm.state;
|
|
35619
35794
|
|
|
35620
35795
|
/* extract wrap request from windowBits parameter */
|
|
@@ -35623,7 +35798,7 @@
|
|
|
35623
35798
|
windowBits = -windowBits;
|
|
35624
35799
|
}
|
|
35625
35800
|
else {
|
|
35626
|
-
wrap = (windowBits >> 4) +
|
|
35801
|
+
wrap = (windowBits >> 4) + 5;
|
|
35627
35802
|
if (windowBits < 48) {
|
|
35628
35803
|
windowBits &= 15;
|
|
35629
35804
|
}
|
|
@@ -35654,7 +35829,9 @@
|
|
|
35654
35829
|
//if (state === Z_NULL) return Z_MEM_ERROR;
|
|
35655
35830
|
//Tracev((stderr, "inflate: allocated\n"));
|
|
35656
35831
|
strm.state = state;
|
|
35832
|
+
state.strm = strm;
|
|
35657
35833
|
state.window = null/*Z_NULL*/;
|
|
35834
|
+
state.mode = HEAD; /* to pass state test in inflateReset2() */
|
|
35658
35835
|
const ret = inflateReset2(strm, windowBits);
|
|
35659
35836
|
if (ret !== Z_OK$1) {
|
|
35660
35837
|
strm.state = null/*Z_NULL*/;
|
|
@@ -35803,7 +35980,7 @@
|
|
|
35803
35980
|
new Uint8Array([ 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15 ]);
|
|
35804
35981
|
|
|
35805
35982
|
|
|
35806
|
-
if (
|
|
35983
|
+
if (inflateStateCheck(strm) || !strm.output ||
|
|
35807
35984
|
(!strm.input && strm.avail_in !== 0)) {
|
|
35808
35985
|
return Z_STREAM_ERROR$1;
|
|
35809
35986
|
}
|
|
@@ -35844,6 +36021,9 @@
|
|
|
35844
36021
|
}
|
|
35845
36022
|
//===//
|
|
35846
36023
|
if ((state.wrap & 2) && hold === 0x8b1f) { /* gzip header */
|
|
36024
|
+
if (state.wbits === 0) {
|
|
36025
|
+
state.wbits = 15;
|
|
36026
|
+
}
|
|
35847
36027
|
state.check = 0/*crc32(0L, Z_NULL, 0)*/;
|
|
35848
36028
|
//=== CRC2(state.check, hold);
|
|
35849
36029
|
hbuf[0] = hold & 0xff;
|
|
@@ -35858,7 +36038,6 @@
|
|
|
35858
36038
|
state.mode = FLAGS;
|
|
35859
36039
|
break;
|
|
35860
36040
|
}
|
|
35861
|
-
state.flags = 0; /* expect zlib header */
|
|
35862
36041
|
if (state.head) {
|
|
35863
36042
|
state.head.done = false;
|
|
35864
36043
|
}
|
|
@@ -35881,7 +36060,7 @@
|
|
|
35881
36060
|
if (state.wbits === 0) {
|
|
35882
36061
|
state.wbits = len;
|
|
35883
36062
|
}
|
|
35884
|
-
|
|
36063
|
+
if (len > 15 || len > state.wbits) {
|
|
35885
36064
|
strm.msg = 'invalid window size';
|
|
35886
36065
|
state.mode = BAD;
|
|
35887
36066
|
break;
|
|
@@ -35892,6 +36071,7 @@
|
|
|
35892
36071
|
state.dmax = 1 << state.wbits;
|
|
35893
36072
|
//state.dmax = 1 << len;
|
|
35894
36073
|
|
|
36074
|
+
state.flags = 0; /* indicate zlib header */
|
|
35895
36075
|
//Tracev((stderr, "inflate: zlib header ok\n"));
|
|
35896
36076
|
strm.adler = state.check = 1/*adler32(0L, Z_NULL, 0)*/;
|
|
35897
36077
|
state.mode = hold & 0x200 ? DICTID : TYPE;
|
|
@@ -35923,7 +36103,7 @@
|
|
|
35923
36103
|
if (state.head) {
|
|
35924
36104
|
state.head.text = ((hold >> 8) & 1);
|
|
35925
36105
|
}
|
|
35926
|
-
if (state.flags & 0x0200) {
|
|
36106
|
+
if ((state.flags & 0x0200) && (state.wrap & 4)) {
|
|
35927
36107
|
//=== CRC2(state.check, hold);
|
|
35928
36108
|
hbuf[0] = hold & 0xff;
|
|
35929
36109
|
hbuf[1] = (hold >>> 8) & 0xff;
|
|
@@ -35948,7 +36128,7 @@
|
|
|
35948
36128
|
if (state.head) {
|
|
35949
36129
|
state.head.time = hold;
|
|
35950
36130
|
}
|
|
35951
|
-
if (state.flags & 0x0200) {
|
|
36131
|
+
if ((state.flags & 0x0200) && (state.wrap & 4)) {
|
|
35952
36132
|
//=== CRC4(state.check, hold)
|
|
35953
36133
|
hbuf[0] = hold & 0xff;
|
|
35954
36134
|
hbuf[1] = (hold >>> 8) & 0xff;
|
|
@@ -35976,7 +36156,7 @@
|
|
|
35976
36156
|
state.head.xflags = (hold & 0xff);
|
|
35977
36157
|
state.head.os = (hold >> 8);
|
|
35978
36158
|
}
|
|
35979
|
-
if (state.flags & 0x0200) {
|
|
36159
|
+
if ((state.flags & 0x0200) && (state.wrap & 4)) {
|
|
35980
36160
|
//=== CRC2(state.check, hold);
|
|
35981
36161
|
hbuf[0] = hold & 0xff;
|
|
35982
36162
|
hbuf[1] = (hold >>> 8) & 0xff;
|
|
@@ -36003,7 +36183,7 @@
|
|
|
36003
36183
|
if (state.head) {
|
|
36004
36184
|
state.head.extra_len = hold;
|
|
36005
36185
|
}
|
|
36006
|
-
if (state.flags & 0x0200) {
|
|
36186
|
+
if ((state.flags & 0x0200) && (state.wrap & 4)) {
|
|
36007
36187
|
//=== CRC2(state.check, hold);
|
|
36008
36188
|
hbuf[0] = hold & 0xff;
|
|
36009
36189
|
hbuf[1] = (hold >>> 8) & 0xff;
|
|
@@ -36045,7 +36225,7 @@
|
|
|
36045
36225
|
// len + copy > state.head.extra_max ?
|
|
36046
36226
|
// state.head.extra_max - len : copy);
|
|
36047
36227
|
}
|
|
36048
|
-
if (state.flags & 0x0200) {
|
|
36228
|
+
if ((state.flags & 0x0200) && (state.wrap & 4)) {
|
|
36049
36229
|
state.check = crc32(state.check, input, copy, next);
|
|
36050
36230
|
}
|
|
36051
36231
|
have -= copy;
|
|
@@ -36071,7 +36251,7 @@
|
|
|
36071
36251
|
}
|
|
36072
36252
|
} while (len && copy < have);
|
|
36073
36253
|
|
|
36074
|
-
if (state.flags & 0x0200) {
|
|
36254
|
+
if ((state.flags & 0x0200) && (state.wrap & 4)) {
|
|
36075
36255
|
state.check = crc32(state.check, input, copy, next);
|
|
36076
36256
|
}
|
|
36077
36257
|
have -= copy;
|
|
@@ -36096,7 +36276,7 @@
|
|
|
36096
36276
|
state.head.comment += String.fromCharCode(len);
|
|
36097
36277
|
}
|
|
36098
36278
|
} while (len && copy < have);
|
|
36099
|
-
if (state.flags & 0x0200) {
|
|
36279
|
+
if ((state.flags & 0x0200) && (state.wrap & 4)) {
|
|
36100
36280
|
state.check = crc32(state.check, input, copy, next);
|
|
36101
36281
|
}
|
|
36102
36282
|
have -= copy;
|
|
@@ -36118,7 +36298,7 @@
|
|
|
36118
36298
|
bits += 8;
|
|
36119
36299
|
}
|
|
36120
36300
|
//===//
|
|
36121
|
-
if (hold !== (state.check & 0xffff)) {
|
|
36301
|
+
if ((state.wrap & 4) && hold !== (state.check & 0xffff)) {
|
|
36122
36302
|
strm.msg = 'header crc mismatch';
|
|
36123
36303
|
state.mode = BAD;
|
|
36124
36304
|
break;
|
|
@@ -36771,15 +36951,15 @@
|
|
|
36771
36951
|
_out -= left;
|
|
36772
36952
|
strm.total_out += _out;
|
|
36773
36953
|
state.total += _out;
|
|
36774
|
-
if (_out) {
|
|
36954
|
+
if ((state.wrap & 4) && _out) {
|
|
36775
36955
|
strm.adler = state.check =
|
|
36776
|
-
/*
|
|
36956
|
+
/*UPDATE_CHECK(state.check, put - _out, _out);*/
|
|
36777
36957
|
(state.flags ? crc32(state.check, output, _out, put - _out) : adler32(state.check, output, _out, put - _out));
|
|
36778
36958
|
|
|
36779
36959
|
}
|
|
36780
36960
|
_out = left;
|
|
36781
36961
|
// NB: crc32 stored as signed 32-bit int, zswap32 returns signed too
|
|
36782
|
-
if ((state.flags ? hold : zswap32(hold)) !== state.check) {
|
|
36962
|
+
if ((state.wrap & 4) && (state.flags ? hold : zswap32(hold)) !== state.check) {
|
|
36783
36963
|
strm.msg = 'incorrect data check';
|
|
36784
36964
|
state.mode = BAD;
|
|
36785
36965
|
break;
|
|
@@ -36802,7 +36982,7 @@
|
|
|
36802
36982
|
bits += 8;
|
|
36803
36983
|
}
|
|
36804
36984
|
//===//
|
|
36805
|
-
if (hold !== (state.total & 0xffffffff)) {
|
|
36985
|
+
if ((state.wrap & 4) && hold !== (state.total & 0xffffffff)) {
|
|
36806
36986
|
strm.msg = 'incorrect length check';
|
|
36807
36987
|
state.mode = BAD;
|
|
36808
36988
|
break;
|
|
@@ -36857,8 +37037,8 @@
|
|
|
36857
37037
|
strm.total_in += _in;
|
|
36858
37038
|
strm.total_out += _out;
|
|
36859
37039
|
state.total += _out;
|
|
36860
|
-
if (state.wrap && _out) {
|
|
36861
|
-
strm.adler = state.check = /*
|
|
37040
|
+
if ((state.wrap & 4) && _out) {
|
|
37041
|
+
strm.adler = state.check = /*UPDATE_CHECK(state.check, strm.next_out - _out, _out);*/
|
|
36862
37042
|
(state.flags ? crc32(state.check, output, _out, strm.next_out - _out) : adler32(state.check, output, _out, strm.next_out - _out));
|
|
36863
37043
|
}
|
|
36864
37044
|
strm.data_type = state.bits + (state.last ? 64 : 0) +
|
|
@@ -36873,7 +37053,7 @@
|
|
|
36873
37053
|
|
|
36874
37054
|
const inflateEnd = (strm) => {
|
|
36875
37055
|
|
|
36876
|
-
if (
|
|
37056
|
+
if (inflateStateCheck(strm)) {
|
|
36877
37057
|
return Z_STREAM_ERROR$1;
|
|
36878
37058
|
}
|
|
36879
37059
|
|
|
@@ -36889,7 +37069,7 @@
|
|
|
36889
37069
|
const inflateGetHeader = (strm, head) => {
|
|
36890
37070
|
|
|
36891
37071
|
/* check state */
|
|
36892
|
-
if (
|
|
37072
|
+
if (inflateStateCheck(strm)) { return Z_STREAM_ERROR$1; }
|
|
36893
37073
|
const state = strm.state;
|
|
36894
37074
|
if ((state.wrap & 2) === 0) { return Z_STREAM_ERROR$1; }
|
|
36895
37075
|
|
|
@@ -36908,7 +37088,7 @@
|
|
|
36908
37088
|
let ret;
|
|
36909
37089
|
|
|
36910
37090
|
/* check state */
|
|
36911
|
-
if (
|
|
37091
|
+
if (inflateStateCheck(strm)) { return Z_STREAM_ERROR$1; }
|
|
36912
37092
|
state = strm.state;
|
|
36913
37093
|
|
|
36914
37094
|
if (state.wrap !== 0 && state.mode !== DICT) {
|
|
@@ -36949,6 +37129,7 @@
|
|
|
36949
37129
|
var inflateInfo = 'pako inflate (from Nodeca project)';
|
|
36950
37130
|
|
|
36951
37131
|
/* Not implemented
|
|
37132
|
+
module.exports.inflateCodesUsed = inflateCodesUsed;
|
|
36952
37133
|
module.exports.inflateCopy = inflateCopy;
|
|
36953
37134
|
module.exports.inflateGetDictionary = inflateGetDictionary;
|
|
36954
37135
|
module.exports.inflateMark = inflateMark;
|
|
@@ -36956,6 +37137,7 @@
|
|
|
36956
37137
|
module.exports.inflateSync = inflateSync;
|
|
36957
37138
|
module.exports.inflateSyncPoint = inflateSyncPoint;
|
|
36958
37139
|
module.exports.inflateUndermine = inflateUndermine;
|
|
37140
|
+
module.exports.inflateValidate = inflateValidate;
|
|
36959
37141
|
*/
|
|
36960
37142
|
|
|
36961
37143
|
var inflate_1$2 = {
|
|
@@ -37362,7 +37544,7 @@
|
|
|
37362
37544
|
|
|
37363
37545
|
/**
|
|
37364
37546
|
* inflate(data[, options]) -> Uint8Array|String
|
|
37365
|
-
* - data (Uint8Array): input data to decompress.
|
|
37547
|
+
* - data (Uint8Array|ArrayBuffer): input data to decompress.
|
|
37366
37548
|
* - options (Object): zlib inflate options.
|
|
37367
37549
|
*
|
|
37368
37550
|
* Decompress `data` with inflate/ungzip and `options`. Autodetect
|
|
@@ -37413,7 +37595,7 @@
|
|
|
37413
37595
|
|
|
37414
37596
|
/**
|
|
37415
37597
|
* inflateRaw(data[, options]) -> Uint8Array|String
|
|
37416
|
-
* - data (Uint8Array): input data to decompress.
|
|
37598
|
+
* - data (Uint8Array|ArrayBuffer): input data to decompress.
|
|
37417
37599
|
* - options (Object): zlib inflate options.
|
|
37418
37600
|
*
|
|
37419
37601
|
* The same as [[inflate]], but creates raw data, without wrapper
|
|
@@ -37428,7 +37610,7 @@
|
|
|
37428
37610
|
|
|
37429
37611
|
/**
|
|
37430
37612
|
* ungzip(data[, options]) -> Uint8Array|String
|
|
37431
|
-
* - data (Uint8Array): input data to decompress.
|
|
37613
|
+
* - data (Uint8Array|ArrayBuffer): input data to decompress.
|
|
37432
37614
|
* - options (Object): zlib inflate options.
|
|
37433
37615
|
*
|
|
37434
37616
|
* Just shortcut to [[inflate]], because it autodetects format
|
|
@@ -67830,7 +68012,7 @@ ${toHex(hashedRequest)}`;
|
|
|
67830
68012
|
this.emit('joinWillStart');
|
|
67831
68013
|
_d.label = 1;
|
|
67832
68014
|
case 1:
|
|
67833
|
-
_d.trys.push([1,
|
|
68015
|
+
_d.trys.push([1, 6, , 7]);
|
|
67834
68016
|
return [4 /*yield*/, this._getVoiceSign(__assign$2(__assign$2({}, options), { roomId: options.roomId || 0 }))];
|
|
67835
68017
|
case 2:
|
|
67836
68018
|
_a = _d.sent(), userId = _a.userId, userSig = _a.userSig;
|
|
@@ -67874,18 +68056,21 @@ ${toHex(hashedRequest)}`;
|
|
|
67874
68056
|
defaultAudioInput = audioInputDevices.find(function (device) { return device.deviceId === 'default'; });
|
|
67875
68057
|
otherAudioInput = audioInputDevices.find(function (device) { return device.deviceId !== ''; });
|
|
67876
68058
|
this.audioInput = defaultAudioInput || otherAudioInput;
|
|
67877
|
-
return [4 /*yield*/, this.meetingSession.audioVideo.
|
|
68059
|
+
return [4 /*yield*/, this.meetingSession.audioVideo.stopVideoInput()];
|
|
67878
68060
|
case 4:
|
|
67879
68061
|
_d.sent();
|
|
67880
|
-
this.meetingSession.audioVideo.
|
|
67881
|
-
return [3 /*break*/, 6];
|
|
68062
|
+
return [4 /*yield*/, this.meetingSession.audioVideo.startAudioInput(((_c = this.audioInput) === null || _c === void 0 ? void 0 : _c.deviceId) || 'default')];
|
|
67882
68063
|
case 5:
|
|
68064
|
+
_d.sent();
|
|
68065
|
+
this.meetingSession.audioVideo.start();
|
|
68066
|
+
return [3 /*break*/, 7];
|
|
68067
|
+
case 6:
|
|
67883
68068
|
e_1 = _d.sent();
|
|
67884
68069
|
this.emit('error', e_1);
|
|
67885
68070
|
this.logger.error(e_1.message);
|
|
67886
68071
|
success(false);
|
|
67887
|
-
return [3 /*break*/,
|
|
67888
|
-
case
|
|
68072
|
+
return [3 /*break*/, 7];
|
|
68073
|
+
case 7: return [2 /*return*/];
|
|
67889
68074
|
}
|
|
67890
68075
|
});
|
|
67891
68076
|
}); })];
|