-
Notifications
You must be signed in to change notification settings - Fork 7
/
Compress.cpp
535 lines (496 loc) · 31.3 KB
/
Compress.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
#include <string>
#include <stdexcept>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <string.h>
#include <zlib.h>
#include <zstd.h>
#include "Compress.h"
static unsigned char dictionary[] = {
0x37, 0xa4, 0x30, 0xec, 0xa8, 0x45, 0x98, 0x38, 0x25, 0x10, 0xd8, 0xda,
0x06, 0x0c, 0xc3, 0x30, 0x0c, 0x83, 0x37, 0x8a, 0x36, 0x6a, 0xe7, 0x26,
0x22, 0x8c, 0x08, 0x69, 0x2c, 0xae, 0xc3, 0x1a, 0x78, 0xd2, 0xe8, 0xdd,
0xdd, 0x52, 0x4a, 0x29, 0xcd, 0x14, 0x48, 0x93, 0x24, 0x40, 0x33, 0x04,
0x28, 0x1c, 0x16, 0x0d, 0xc9, 0x46, 0x42, 0x59, 0xa7, 0x06, 0x00, 0x24,
0x80, 0x81, 0x03, 0x05, 0x02, 0x8e, 0x8d, 0x1d, 0x13, 0x05, 0x13, 0x89,
0x8b, 0x08, 0xc6, 0x83, 0xd1, 0x28, 0x10, 0x06, 0x13, 0x43, 0x83, 0x81,
0x28, 0x8a, 0xe2, 0x20, 0x88, 0xa3, 0x68, 0x84, 0xc4, 0x50, 0x8c, 0x39,
0x89, 0x95, 0x24, 0x49, 0x07, 0x04, 0x16, 0xae, 0x14, 0x34, 0x84, 0x10,
0x62, 0x88, 0x88, 0x88, 0x8c, 0xc8, 0x88, 0x88, 0x48, 0x92, 0x24, 0xe9,
0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
0x2c, 0x5b, 0x5d, 0x5d, 0x2c, 0x22, 0x73, 0x69, 0x67, 0x6e, 0x73, 0x22,
0x3a, 0x5b, 0x5d, 0x7d, 0x2c, 0x22, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74,
0x69, 0x6f, 0x6e, 0x22, 0x3a, 0x31, 0x2c, 0x22, 0x6c, 0x65, 0x76, 0x65,
0x6c, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x22, 0x3a, 0x31, 0x33, 0x2c,
0x22, 0x74, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x3a, 0x31, 0x30, 0x2c,
0x22, 0x74, 0x79, 0x70, 0x65, 0x22, 0x3a, 0x30, 0x7d, 0x2c, 0x7b, 0x22,
0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x3a, 0x30,
0x2c, 0x22, 0x74, 0x79, 0x70, 0x65, 0x22, 0x3a, 0x31, 0x7d, 0x5d, 0x2c,
0x5b, 0x7b, 0x22, 0x74, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x3a,
0x33, 0x2c, 0x22, 0x74, 0x79, 0x70, 0x65, 0x22, 0x3a, 0x30, 0x7d, 0x2c,
0x7b, 0x22, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x22,
0x3a, 0x32, 0x2c, 0x22, 0x74, 0x79, 0x70, 0x65, 0x22, 0x3a, 0x32, 0x7d,
0x2c, 0x7b, 0x22, 0x63, 0x69, 0x72, 0x3a, 0x32, 0x2c, 0x22, 0x74, 0x79,
0x70, 0x65, 0x22, 0x3a, 0x30, 0x7d, 0x2c, 0x7b, 0x22, 0x64, 0x69, 0x72,
0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x3a, 0x37, 0x2c, 0x22, 0x6c,
0x65, 0x76, 0x65, 0x6c, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x22, 0x3a,
0x33, 0x33, 0x2c, 0x22, 0x74, 0x79, 0x70, 0x65, 0x7b, 0x22, 0x63, 0x6f,
0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x3a, 0x35,
0x2c, 0x22, 0x74, 0x79, 0x70, 0x65, 0x22, 0x3a, 0x30, 0x7d, 0x2c, 0x7b,
0x22, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73,
0x22, 0x3a, 0x31, 0x32, 0x2c, 0x22, 0x74, 0x79, 0x70, 0x65, 0x73, 0x22,
0x3a, 0x31, 0x31, 0x2c, 0x22, 0x74, 0x79, 0x70, 0x65, 0x22, 0x3a, 0x30,
0x7d, 0x2c, 0x7b, 0x22, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f,
0x6e, 0x22, 0x3a, 0x31, 0x2c, 0x22, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x5f,
0x69, 0x6e, 0x64, 0x65, 0x78, 0x22, 0x3a, 0x33, 0x2c, 0x22, 0x74, 0x79,
0x62, 0x65, 0x73, 0x74, 0x5f, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x22, 0x3a,
0x36, 0x35, 0x35, 0x33, 0x36, 0x30, 0x30, 0x2c, 0x22, 0x63, 0x69, 0x72,
0x63, 0x75, 0x69, 0x74, 0x22, 0x3a, 0x7b, 0x22, 0x65, 0x6c, 0x65, 0x6d,
0x65, 0x6e, 0x74, 0x73, 0x22, 0x3a, 0x5b, 0x5b, 0x7b, 0x22, 0x63, 0x6f,
0x6e, 0x6e, 0x31, 0x36, 0x2c, 0x22, 0x74, 0x79, 0x70, 0x65, 0x22, 0x3a,
0x33, 0x7d, 0x2c, 0x7b, 0x22, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69,
0x6f, 0x6e, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x6c, 0x65, 0x76, 0x65, 0x6c,
0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x22, 0x3a, 0x32, 0x37, 0x2c, 0x22,
0x74, 0x79, 0x70, 0x65, 0x75, 0x6c, 0x6c, 0x2c, 0x7b, 0x22, 0x62, 0x65,
0x73, 0x74, 0x5f, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x22, 0x3a, 0x30, 0x2c,
0x22, 0x63, 0x69, 0x72, 0x63, 0x75, 0x69, 0x74, 0x22, 0x3a, 0x7b, 0x22,
0x65, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x22, 0x3a, 0x5b, 0x5b,
0x7b, 0x22, 0x64, 0x69, 0x72, 0x65, 0x30, 0x7d, 0x5d, 0x5d, 0x2c, 0x22,
0x73, 0x69, 0x67, 0x6e, 0x73, 0x22, 0x3a, 0x5b, 0x5d, 0x7d, 0x2c, 0x22,
0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x3a, 0x34,
0x2c, 0x22, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x5f, 0x69, 0x6e, 0x64, 0x65,
0x78, 0x22, 0x3a, 0x34, 0x2c, 0x22, 0x74, 0x79, 0x3a, 0x30, 0x7d, 0x2c,
0x7b, 0x22, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x22,
0x3a, 0x30, 0x2c, 0x22, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x5f, 0x69, 0x6e,
0x64, 0x65, 0x78, 0x22, 0x3a, 0x37, 0x2c, 0x22, 0x74, 0x79, 0x70, 0x65,
0x22, 0x3a, 0x33, 0x7d, 0x2c, 0x7b, 0x22, 0x63, 0x69, 0x72, 0x7d, 0x2c,
0x7b, 0x22, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e,
0x73, 0x22, 0x3a, 0x32, 0x2c, 0x22, 0x74, 0x79, 0x70, 0x65, 0x22, 0x3a,
0x30, 0x7d, 0x2c, 0x7b, 0x22, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69,
0x6f, 0x6e, 0x22, 0x3a, 0x32, 0x2c, 0x22, 0x6c, 0x65, 0x76, 0x65, 0x6c,
0x2c, 0x5b, 0x5d, 0x5d, 0x2c, 0x22, 0x73, 0x69, 0x67, 0x6e, 0x73, 0x22,
0x3a, 0x5b, 0x5d, 0x7d, 0x2c, 0x22, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74,
0x69, 0x6f, 0x6e, 0x22, 0x3a, 0x35, 0x2c, 0x22, 0x6c, 0x65, 0x76, 0x65,
0x6c, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x22, 0x3a, 0x32, 0x2c, 0x22,
0x74, 0x79, 0x3a, 0x34, 0x2c, 0x22, 0x74, 0x79, 0x70, 0x65, 0x22, 0x3a,
0x30, 0x7d, 0x2c, 0x7b, 0x22, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69,
0x6f, 0x6e, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x6c, 0x65, 0x76, 0x65, 0x6c,
0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x22, 0x3a, 0x32, 0x33, 0x2c, 0x22,
0x74, 0x79, 0x70, 0x65, 0x7b, 0x22, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74,
0x69, 0x6f, 0x6e, 0x22, 0x3a, 0x37, 0x2c, 0x22, 0x6c, 0x65, 0x76, 0x65,
0x6c, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x22, 0x3a, 0x31, 0x39, 0x2c,
0x22, 0x74, 0x79, 0x70, 0x65, 0x22, 0x3a, 0x33, 0x7d, 0x5d, 0x2c, 0x5b,
0x7b, 0x22, 0x63, 0x7d, 0x2c, 0x7b, 0x22, 0x63, 0x6f, 0x6e, 0x6e, 0x65,
0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x3a, 0x39, 0x2c, 0x22, 0x74,
0x79, 0x70, 0x65, 0x22, 0x3a, 0x30, 0x7d, 0x2c, 0x7b, 0x22, 0x64, 0x69,
0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x3a, 0x34, 0x2c, 0x22,
0x6c, 0x65, 0x76, 0x65, 0x6c, 0x70, 0x6f, 0x73, 0x2e, 0x79, 0x22, 0x3a,
0x33, 0x37, 0x2c, 0x22, 0x74, 0x65, 0x78, 0x74, 0x22, 0x3a, 0x22, 0x30,
0x2d, 0x32, 0x30, 0x5c, 0x6e, 0x32, 0x30, 0x2d, 0x34, 0x30, 0x5c, 0x6e,
0x34, 0x30, 0x2d, 0x36, 0x30, 0x5c, 0x6e, 0x36, 0x30, 0x2d, 0x38, 0x30,
0x5c, 0x6e, 0x38, 0x30, 0x2d, 0x31, 0x30, 0x31, 0x31, 0x2c, 0x22, 0x74,
0x79, 0x70, 0x65, 0x22, 0x3a, 0x30, 0x7d, 0x2c, 0x7b, 0x22, 0x64, 0x69,
0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x3a, 0x30, 0x2c, 0x22,
0x6c, 0x65, 0x76, 0x65, 0x6c, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x22,
0x3a, 0x32, 0x31, 0x2c, 0x22, 0x74, 0x79, 0x70, 0x65, 0x2c, 0x5b, 0x7b,
0x22, 0x74, 0x79, 0x70, 0x65, 0x22, 0x3a, 0x34, 0x7d, 0x2c, 0x7b, 0x22,
0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x3a, 0x31,
0x2c, 0x22, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x5f, 0x69, 0x6e, 0x64, 0x65,
0x78, 0x22, 0x3a, 0x32, 0x30, 0x2c, 0x22, 0x74, 0x79, 0x70, 0x65, 0x70,
0x6f, 0x73, 0x2e, 0x78, 0x22, 0x3a, 0x34, 0x35, 0x2c, 0x22, 0x70, 0x6f,
0x73, 0x2e, 0x79, 0x22, 0x3a, 0x36, 0x32, 0x2c, 0x22, 0x74, 0x65, 0x78,
0x74, 0x22, 0x3a, 0x22, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x20,
0x64, 0x65, 0x73, 0x69, 0x67, 0x6e, 0x3a, 0x5c, 0x6e, 0x69, 0x66, 0x20,
0x67, 0x30, 0x7d, 0x2c, 0x7b, 0x22, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74,
0x69, 0x6f, 0x6e, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x6c, 0x65, 0x76, 0x65,
0x6c, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x22, 0x3a, 0x31, 0x36, 0x2c,
0x22, 0x74, 0x79, 0x70, 0x65, 0x22, 0x3a, 0x33, 0x7d, 0x2c, 0x7b, 0x22,
0x64, 0x69, 0x72, 0x3a, 0x32, 0x7d, 0x5d, 0x2c, 0x5b, 0x5d, 0x5d, 0x2c,
0x22, 0x73, 0x69, 0x67, 0x6e, 0x73, 0x22, 0x3a, 0x5b, 0x7b, 0x22, 0x64,
0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x3a, 0x31, 0x2c,
0x22, 0x70, 0x6f, 0x73, 0x2e, 0x78, 0x22, 0x3a, 0x32, 0x38, 0x37, 0x2c,
0x22, 0x70, 0x6f, 0x73, 0x2e, 0x22, 0x3a, 0x34, 0x7d, 0x2c, 0x7b, 0x22,
0x74, 0x79, 0x70, 0x65, 0x22, 0x3a, 0x34, 0x7d, 0x2c, 0x7b, 0x22, 0x64,
0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x3a, 0x30, 0x2c,
0x22, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78,
0x22, 0x3a, 0x37, 0x2c, 0x22, 0x74, 0x79, 0x5c, 0x6e, 0x62, 0x72, 0x6f,
0x77, 0x6e, 0x20, 0x3d, 0x20, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x22,
0x7d, 0x2c, 0x7b, 0x22, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f,
0x6e, 0x22, 0x3a, 0x31, 0x2c, 0x22, 0x70, 0x6f, 0x73, 0x2e, 0x78, 0x22,
0x3a, 0x30, 0x2c, 0x22, 0x70, 0x6f, 0x73, 0x2e, 0x79, 0x30, 0x7d, 0x5d,
0x2c, 0x5b, 0x7b, 0x22, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69,
0x6f, 0x6e, 0x73, 0x22, 0x3a, 0x38, 0x2c, 0x22, 0x74, 0x79, 0x70, 0x65,
0x22, 0x3a, 0x30, 0x7d, 0x2c, 0x7b, 0x22, 0x64, 0x69, 0x72, 0x65, 0x63,
0x74, 0x69, 0x6f, 0x6e, 0x22, 0x3a, 0x35, 0x2c, 0x22, 0x74, 0x79, 0x30,
0x7d, 0x5d, 0x2c, 0x5b, 0x7b, 0x22, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63,
0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x3a, 0x35, 0x2c, 0x22, 0x74, 0x79,
0x70, 0x65, 0x22, 0x3a, 0x30, 0x7d, 0x2c, 0x7b, 0x22, 0x64, 0x69, 0x72,
0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x3a, 0x37, 0x2c, 0x22, 0x74,
0x79, 0x22, 0x74, 0x79, 0x70, 0x65, 0x22, 0x3a, 0x30, 0x7d, 0x5d, 0x5d,
0x2c, 0x22, 0x73, 0x69, 0x67, 0x6e, 0x73, 0x22, 0x3a, 0x5b, 0x5d, 0x7d,
0x2c, 0x22, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x5f, 0x76, 0x65, 0x72, 0x73,
0x69, 0x6f, 0x6e, 0x22, 0x3a, 0x33, 0x32, 0x7d, 0x2c, 0x6e, 0x75, 0x6c,
0x6c, 0x2c, 0x7b, 0x3a, 0x39, 0x2c, 0x22, 0x74, 0x79, 0x70, 0x65, 0x22,
0x3a, 0x30, 0x7d, 0x2c, 0x7b, 0x22, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74,
0x69, 0x6f, 0x6e, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x6c, 0x65, 0x76, 0x65,
0x6c, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x22, 0x3a, 0x31, 0x35, 0x2c,
0x22, 0x74, 0x79, 0x70, 0x65, 0x6e, 0x73, 0x22, 0x3a, 0x32, 0x2c, 0x22,
0x74, 0x79, 0x70, 0x65, 0x22, 0x3a, 0x30, 0x7d, 0x2c, 0x7b, 0x22, 0x64,
0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x3a, 0x30, 0x2c,
0x22, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78,
0x22, 0x3a, 0x31, 0x34, 0x2c, 0x22, 0x74, 0x63, 0x74, 0x69, 0x6f, 0x6e,
0x73, 0x22, 0x3a, 0x37, 0x2c, 0x22, 0x74, 0x79, 0x70, 0x65, 0x22, 0x3a,
0x30, 0x7d, 0x2c, 0x7b, 0x22, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69,
0x6f, 0x6e, 0x22, 0x3a, 0x36, 0x2c, 0x22, 0x74, 0x79, 0x70, 0x65, 0x22,
0x3a, 0x31, 0x7d, 0x2c, 0x7b, 0x22, 0x74, 0x79, 0x70, 0x22, 0x3a, 0x31,
0x2c, 0x22, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x5f, 0x69, 0x6e, 0x64, 0x65,
0x78, 0x22, 0x3a, 0x31, 0x2c, 0x22, 0x74, 0x79, 0x70, 0x65, 0x22, 0x3a,
0x33, 0x7d, 0x5d, 0x2c, 0x5b, 0x7b, 0x22, 0x64, 0x69, 0x72, 0x65, 0x63,
0x74, 0x69, 0x6f, 0x6e, 0x22, 0x3a, 0x34, 0x2c, 0x22, 0x74, 0x79, 0x74,
0x79, 0x70, 0x65, 0x22, 0x3a, 0x34, 0x7d, 0x2c, 0x7b, 0x22, 0x74, 0x79,
0x70, 0x65, 0x22, 0x3a, 0x34, 0x7d, 0x2c, 0x7b, 0x22, 0x64, 0x69, 0x72,
0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x3a, 0x32, 0x2c, 0x22, 0x74,
0x79, 0x70, 0x65, 0x22, 0x3a, 0x32, 0x7d, 0x2c, 0x7b, 0x22, 0x74, 0x79,
0x70, 0x69, 0x6f, 0x6e, 0x22, 0x3a, 0x33, 0x2c, 0x22, 0x6c, 0x65, 0x76,
0x65, 0x6c, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x22, 0x3a, 0x38, 0x2c,
0x22, 0x74, 0x79, 0x2c, 0x22, 0x74, 0x65, 0x78, 0x74, 0x22, 0x3a, 0x22,
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x69, 0x76, 0x65, 0x20, 0x64,
0x65, 0x73, 0x69, 0x67, 0x6e, 0x2c, 0x5c, 0x6e, 0x73, 0x6c, 0x6f, 0x77,
0x20, 0x6e, 0x65, 0x61, 0x72, 0x20, 0x35, 0x30, 0x22, 0x7d, 0x5d, 0x7d,
0x2c, 0x22, 0x6c, 0x65, 0x76, 0x22, 0x3a, 0x33, 0x2c, 0x22, 0x70, 0x6f,
0x73, 0x2e, 0x78, 0x22, 0x3a, 0x31, 0x2c, 0x22, 0x70, 0x6f, 0x73, 0x2e,
0x79, 0x22, 0x3a, 0x34, 0x2c, 0x22, 0x74, 0x65, 0x78, 0x74, 0x22, 0x3a,
0x22, 0x69, 0x66, 0x20, 0x70, 0x20, 0x3e, 0x20, 0x35, 0x30, 0x3a, 0x20,
0x62, 0x72, 0x6f, 0x77, 0x6e, 0x20, 0x3d, 0x6e, 0x73, 0x22, 0x3a, 0x33,
0x2c, 0x22, 0x74, 0x79, 0x70, 0x65, 0x22, 0x3a, 0x30, 0x7d, 0x5d, 0x5d,
0x2c, 0x22, 0x73, 0x69, 0x67, 0x6e, 0x73, 0x22, 0x3a, 0x5b, 0x5d, 0x7d,
0x2c, 0x22, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x22,
0x3a, 0x31, 0x2c, 0x22, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x30, 0x7d, 0x5d,
0x5d, 0x2c, 0x22, 0x73, 0x69, 0x67, 0x6e, 0x73, 0x22, 0x3a, 0x5b, 0x5d,
0x7d, 0x2c, 0x22, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e,
0x22, 0x3a, 0x30, 0x2c, 0x22, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x5f, 0x69,
0x6e, 0x64, 0x65, 0x78, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x74, 0x79, 0x69,
0x6f, 0x6e, 0x73, 0x22, 0x3a, 0x34, 0x2c, 0x22, 0x74, 0x79, 0x70, 0x65,
0x22, 0x3a, 0x30, 0x7d, 0x2c, 0x7b, 0x22, 0x63, 0x6f, 0x6e, 0x6e, 0x65,
0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x3a, 0x36, 0x2c, 0x22, 0x74,
0x79, 0x70, 0x65, 0x22, 0x3a, 0x30, 0x7d, 0x2c, 0x7b, 0x22, 0x63, 0x69,
0x72, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x3a, 0x32, 0x2c, 0x22,
0x74, 0x79, 0x70, 0x65, 0x22, 0x3a, 0x30, 0x7d, 0x2c, 0x7b, 0x22, 0x64,
0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x3a, 0x31, 0x2c,
0x22, 0x74, 0x79, 0x70, 0x65, 0x22, 0x3a, 0x31, 0x7d, 0x2c, 0x7b, 0x22,
0x64, 0x69, 0x72, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x3a, 0x35,
0x2c, 0x22, 0x74, 0x79, 0x70, 0x65, 0x22, 0x3a, 0x30, 0x7d, 0x2c, 0x7b,
0x22, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x3a,
0x33, 0x2c, 0x22, 0x74, 0x79, 0x70, 0x65, 0x22, 0x3a, 0x31, 0x7d, 0x5d,
0x2c, 0x5b, 0x7b, 0x22, 0x63, 0x65, 0x73, 0x74, 0x5f, 0x73, 0x63, 0x6f,
0x72, 0x65, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x63, 0x69, 0x72, 0x63, 0x75,
0x69, 0x74, 0x22, 0x3a, 0x7b, 0x22, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x6e,
0x74, 0x73, 0x22, 0x3a, 0x5b, 0x5b, 0x5d, 0x2c, 0x5b, 0x5d, 0x2c, 0x5b,
0x5d, 0x2c, 0x5b, 0x7b, 0x22, 0x74, 0x79, 0x5d, 0x2c, 0x5b, 0x5d, 0x2c,
0x5b, 0x5d, 0x2c, 0x5b, 0x5d, 0x5d, 0x2c, 0x22, 0x73, 0x69, 0x67, 0x6e,
0x73, 0x22, 0x3a, 0x5b, 0x5d, 0x7d, 0x2c, 0x22, 0x6c, 0x65, 0x76, 0x65,
0x6c, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x3a, 0x33,
0x32, 0x7d, 0x2c, 0x7b, 0x22, 0x62, 0x65, 0x73, 0x74, 0x31, 0x30, 0x30,
0x2c, 0x22, 0x57, 0x46, 0x22, 0x3a, 0x34, 0x35, 0x7d, 0x2c, 0x7b, 0x22,
0x45, 0x22, 0x3a, 0x31, 0x30, 0x30, 0x2c, 0x22, 0x53, 0x22, 0x3a, 0x39,
0x32, 0x2c, 0x22, 0x53, 0x46, 0x22, 0x3a, 0x34, 0x38, 0x2c, 0x22, 0x57,
0x22, 0x3a, 0x39, 0x32, 0x2c, 0x22, 0x57, 0x46, 0x22, 0x3a, 0x34, 0x2c,
0x22, 0x57, 0x46, 0x22, 0x3a, 0x34, 0x35, 0x7d, 0x5d, 0x7d, 0x2c, 0x7b,
0x22, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x73, 0x22, 0x3a, 0x5b, 0x7b, 0x22,
0x53, 0x22, 0x3a, 0x35, 0x30, 0x2c, 0x22, 0x53, 0x46, 0x22, 0x3a, 0x34,
0x38, 0x2c, 0x22, 0x57, 0x22, 0x3a, 0x31, 0x30, 0x30, 0x2c, 0x22, 0x57,
0x46, 0x22, 0x3a, 0x34, 0x38, 0x2c, 0x22, 0x57, 0x46, 0x22, 0x3a, 0x34,
0x35, 0x7d, 0x2c, 0x7b, 0x22, 0x53, 0x22, 0x3a, 0x31, 0x30, 0x30, 0x2c,
0x22, 0x53, 0x46, 0x22, 0x3a, 0x34, 0x38, 0x2c, 0x22, 0x57, 0x22, 0x3a,
0x37, 0x34, 0x2c, 0x22, 0x57, 0x46, 0x22, 0x3a, 0x34, 0x35, 0x7d, 0x5d,
0x7d, 0x2c, 0x7b, 0x2c, 0x33, 0x2c, 0x33, 0x2c, 0x33, 0x2c, 0x33, 0x2c,
0x36, 0x2c, 0x30, 0x2c, 0x30, 0x2c, 0x30, 0x2c, 0x30, 0x2c, 0x30, 0x2c,
0x30, 0x2c, 0x30, 0x2c, 0x36, 0x2c, 0x36, 0x2c, 0x34, 0x2c, 0x34, 0x2c,
0x34, 0x2c, 0x34, 0x2c, 0x34, 0x2c, 0x34, 0x5d, 0x2c, 0x5b, 0x33, 0x2c,
0x33, 0x2c, 0x33, 0x2c, 0x33, 0x38, 0x2c, 0x38, 0x2c, 0x38, 0x2c, 0x38,
0x2c, 0x38, 0x2c, 0x38, 0x2c, 0x38, 0x2c, 0x38, 0x2c, 0x38, 0x2c, 0x38,
0x2c, 0x38, 0x2c, 0x38, 0x2c, 0x38, 0x2c, 0x38, 0x2c, 0x38, 0x2c, 0x38,
0x2c, 0x38, 0x2c, 0x38, 0x2c, 0x37, 0x5d, 0x2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 0x6c, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x22, 0x3a, 0x31, 0x2c,
0x22, 0x74, 0x79, 0x70, 0x65, 0x22, 0x3a, 0x33, 0x7d, 0x5d, 0x2c, 0x5b,
0x7b, 0x22, 0x74, 0x74, 0x79, 0x70, 0x65, 0x22, 0x3a, 0x34, 0x7d, 0x2c,
0x7b, 0x22, 0x74, 0x79, 0x70, 0x65, 0x22, 0x3a, 0x34, 0x7d, 0x2c, 0x7b,
0x22, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x3a,
0x32, 0x2c, 0x22, 0x74, 0x79, 0x70, 0x65, 0x22, 0x3a, 0x32, 0x7d, 0x5d,
0x2c, 0x5b, 0x7b, 0x22, 0x74, 0x7b, 0x22, 0x63, 0x6f, 0x6e, 0x6e, 0x65,
0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x3a, 0x34, 0x2c, 0x22, 0x74,
0x79, 0x70, 0x65, 0x22, 0x3a, 0x30, 0x7d, 0x2c, 0x7b, 0x22, 0x63, 0x6f,
0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x3a, 0x31,
0x33, 0x2c, 0x22, 0x74, 0x79, 0x70, 0x65, 0x65, 0x63, 0x74, 0x69, 0x6f,
0x6e, 0x22, 0x3a, 0x33, 0x2c, 0x22, 0x74, 0x79, 0x70, 0x65, 0x22, 0x3a,
0x32, 0x7d, 0x5d, 0x2c, 0x5b, 0x5d, 0x2c, 0x5b, 0x5d, 0x2c, 0x5b, 0x5d,
0x5d, 0x2c, 0x22, 0x73, 0x69, 0x67, 0x6e, 0x73, 0x22, 0x3a, 0x5b, 0x5d,
0x7d, 0x2c, 0x22, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x74, 0x79, 0x70,
0x65, 0x22, 0x3a, 0x34, 0x7d, 0x2c, 0x7b, 0x22, 0x63, 0x69, 0x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 0x73, 0x69, 0x67, 0x6e, 0x73, 0x22, 0x3a, 0x5b,
0x5d, 0x7d, 0x2c, 0x22, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69,
0x6f, 0x6e, 0x73, 0x22, 0x3a, 0x5b, 0x30, 0x2c, 0x31, 0x7d, 0x2c, 0x7b,
0x22, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x3a,
0x31, 0x2c, 0x22, 0x74, 0x79, 0x70, 0x65, 0x22, 0x3a, 0x31, 0x7d, 0x2c,
0x7b, 0x22, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e,
0x73, 0x22, 0x3a, 0x37, 0x2c, 0x22, 0x74, 0x79, 0x70, 0x65, 0x22, 0x69,
0x6f, 0x6e, 0x73, 0x22, 0x3a, 0x31, 0x34, 0x2c, 0x22, 0x74, 0x79, 0x70,
0x65, 0x22, 0x3a, 0x30, 0x7d, 0x2c, 0x7b, 0x22, 0x64, 0x69, 0x72, 0x65,
0x63, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x3a, 0x33, 0x2c, 0x22, 0x74, 0x79,
0x6e, 0x22, 0x3a, 0x31, 0x2c, 0x22, 0x74, 0x79, 0x70, 0x65, 0x22, 0x3a,
0x31, 0x7d, 0x2c, 0x7b, 0x22, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74,
0x69, 0x6f, 0x6e, 0x73, 0x22, 0x3a, 0x36, 0x2c, 0x22, 0x74, 0x79, 0x70,
0x65, 0x22, 0x3a, 0x30, 0x7d, 0x5d, 0x2c, 0x5b, 0x7b, 0x22, 0x74, 0x79,
0x70, 0x65, 0x30, 0x2c, 0x22, 0x53, 0x46, 0x22, 0x3a, 0x30, 0x2c, 0x22,
0x57, 0x22, 0x3a, 0x35, 0x30, 0x2c, 0x22, 0x57, 0x46, 0x22, 0x3a, 0x30,
0x7d, 0x5d, 0x2c, 0x22, 0x74, 0x65, 0x73, 0x74, 0x65, 0x64, 0x5f, 0x64,
0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x3a, 0x30, 0x7d,
0x2c, 0x7b, 0x22, 0x70, 0x3a, 0x30, 0x7d, 0x2c, 0x7b, 0x22, 0x70, 0x6f,
0x69, 0x6e, 0x74, 0x73, 0x22, 0x3a, 0x5b, 0x7b, 0x22, 0x45, 0x46, 0x22,
0x3a, 0x30, 0x2c, 0x22, 0x4e, 0x46, 0x22, 0x3a, 0x35, 0x30, 0x2c, 0x22,
0x53, 0x46, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x57, 0x22, 0x3a, 0x35, 0x30,
0x2c, 0x22, 0x57, 0x46, 0x22, 0x3a, 0x36, 0x2c, 0x36, 0x2c, 0x36, 0x2c,
0x36, 0x2c, 0x36, 0x2c, 0x36, 0x2c, 0x37, 0x5d, 0x2c, 0x5b, 0x38, 0x2c,
0x38, 0x2c, 0x38, 0x2c, 0x38, 0x2c, 0x38, 0x2c, 0x38, 0x2c, 0x37, 0x2c,
0x37, 0x2c, 0x37, 0x2c, 0x37, 0x2c, 0x37, 0x2c, 0x31, 0x2c, 0x31, 0x2c,
0x37, 0x2c, 0x37, 0x5d, 0x2c, 0x5b, 0x38, 0x2c, 0x36, 0x2c, 0x30, 0x2c,
0x30, 0x2c, 0x30, 0x2c, 0x36, 0x2c, 0x36, 0x2c, 0x36, 0x2c, 0x30, 0x2c,
0x30, 0x2c, 0x30, 0x2c, 0x36, 0x2c, 0x37, 0x5d, 0x2c, 0x5b, 0x38, 0x2c,
0x38, 0x2c, 0x38, 0x2c, 0x38, 0x2c, 0x38, 0x2c, 0x37, 0x2c, 0x36, 0x2c,
0x30, 0x2c, 0x30, 0x2c, 0x36, 0x2c, 0x30, 0x2c, 0x30, 0x2c, 0x69, 0x6e,
0x64, 0x65, 0x78, 0x22, 0x3a, 0x31, 0x36, 0x2c, 0x22, 0x74, 0x79, 0x70,
0x65, 0x22, 0x3a, 0x33, 0x7d, 0x5d, 0x2c, 0x5b, 0x5d, 0x2c, 0x5b, 0x5d,
0x2c, 0x5b, 0x5d, 0x5d, 0x2c, 0x22, 0x73, 0x69, 0x67, 0x6e, 0x73, 0x22,
0x3a, 0x5b, 0x5d, 0x7d, 0x2c, 0x22, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63,
0x70, 0x65, 0x22, 0x3a, 0x30, 0x7d, 0x2c, 0x7b, 0x22, 0x64, 0x69, 0x72,
0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x3a, 0x31, 0x2c, 0x22, 0x74,
0x79, 0x70, 0x65, 0x22, 0x3a, 0x32, 0x7d, 0x2c, 0x7b, 0x22, 0x64, 0x69,
0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x3a, 0x32, 0x2c, 0x22,
0x74, 0x79, 0x3a, 0x30, 0x7d, 0x2c, 0x7b, 0x22, 0x53, 0x46, 0x22, 0x3a,
0x30, 0x2c, 0x22, 0x57, 0x46, 0x22, 0x3a, 0x30, 0x7d, 0x5d, 0x2c, 0x22,
0x72, 0x65, 0x73, 0x65, 0x74, 0x22, 0x3a, 0x31, 0x7d, 0x2c, 0x7b, 0x22,
0x66, 0x69, 0x72, 0x73, 0x74, 0x5f, 0x73, 0x69, 0x6d, 0x70, 0x6f, 0x69,
0x6e, 0x74, 0x22, 0x3a, 0x6f, 0x69, 0x6e, 0x74, 0x22, 0x3a, 0x31, 0x2c,
0x22, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x73, 0x22, 0x3a, 0x5b, 0x7b, 0x22,
0x53, 0x46, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x57, 0x46, 0x22, 0x3a, 0x30,
0x7d, 0x2c, 0x7b, 0x22, 0x45, 0x22, 0x3a, 0x31, 0x30, 0x30, 0x2c, 0x22,
0x53, 0x46, 0x22, 0x3a, 0x30, 0x2c, 0x2c, 0x30, 0x2c, 0x30, 0x2c, 0x30,
0x2c, 0x30, 0x2c, 0x30, 0x5d, 0x2c, 0x5b, 0x30, 0x2c, 0x36, 0x2c, 0x36,
0x2c, 0x36, 0x2c, 0x30, 0x2c, 0x36, 0x2c, 0x36, 0x2c, 0x36, 0x2c, 0x30,
0x2c, 0x36, 0x2c, 0x36, 0x2c, 0x36, 0x5d, 0x2c, 0x5b, 0x30, 0x2c, 0x36,
0x2c, 0x30, 0x2c, 0x36, 0x2c, 0x30, 0x2c, 0x36, 0x30, 0x7d, 0x2c, 0x7b,
0x22, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x3a,
0x30, 0x2c, 0x22, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x5f, 0x69, 0x6e, 0x64,
0x65, 0x78, 0x22, 0x3a, 0x34, 0x33, 0x2c, 0x22, 0x74, 0x79, 0x70, 0x65,
0x22, 0x3a, 0x33, 0x7d, 0x2c, 0x7b, 0x22, 0x63, 0x6f, 0x6e, 0x6c, 0x6c,
0x2c, 0x7b, 0x22, 0x62, 0x65, 0x73, 0x74, 0x5f, 0x73, 0x63, 0x6f, 0x72,
0x65, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x63, 0x69, 0x72, 0x63, 0x75, 0x69,
0x74, 0x22, 0x3a, 0x7b, 0x22, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74,
0x73, 0x22, 0x3a, 0x5b, 0x5b, 0x7b, 0x22, 0x74, 0x79, 0x70, 0x65, 0x22,
0x22, 0x3a, 0x30, 0x7d, 0x5d, 0x5d, 0x2c, 0x22, 0x73, 0x69, 0x67, 0x6e,
0x73, 0x22, 0x3a, 0x5b, 0x5d, 0x7d, 0x2c, 0x22, 0x6c, 0x65, 0x76, 0x65,
0x6c, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x3a, 0x33,
0x32, 0x7d, 0x2c, 0x6e, 0x75, 0x6c, 0x6c, 0x2c, 0x6e, 0x75, 0x6c, 0x6c,
0x2c, 0x6e, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x3a, 0x35, 0x2c, 0x22,
0x74, 0x79, 0x70, 0x65, 0x22, 0x3a, 0x30, 0x7d, 0x2c, 0x7b, 0x22, 0x63,
0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x3a,
0x39, 0x2c, 0x22, 0x74, 0x79, 0x70, 0x65, 0x22, 0x3a, 0x30, 0x7d, 0x2c,
0x7b, 0x22, 0x74, 0x79, 0x7b, 0x22, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63,
0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x3a, 0x33, 0x2c, 0x22, 0x74, 0x79,
0x70, 0x65, 0x22, 0x3a, 0x30, 0x7d, 0x2c, 0x7b, 0x22, 0x63, 0x6f, 0x6e,
0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x3a, 0x32, 0x2c,
0x22, 0x74, 0x79, 0x70, 0x65, 0x22, 0x69, 0x6f, 0x6e, 0x22, 0x3a, 0x36,
0x2c, 0x22, 0x74, 0x79, 0x70, 0x65, 0x22, 0x3a, 0x31, 0x7d, 0x2c, 0x7b,
0x22, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73,
0x22, 0x3a, 0x31, 0x30, 0x2c, 0x22, 0x74, 0x79, 0x70, 0x65, 0x22, 0x3a,
0x30, 0x7d, 0x2c, 0x7b, 0x22, 0x64, 0x69, 0x72, 0x22, 0x63, 0x6f, 0x6e,
0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x3a, 0x31, 0x31,
0x2c, 0x22, 0x74, 0x79, 0x70, 0x65, 0x22, 0x3a, 0x30, 0x7d, 0x2c, 0x7b,
0x22, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73,
0x22, 0x3a, 0x39, 0x2c, 0x22, 0x74, 0x79, 0x70, 0x65, 0x22, 0x22, 0x3a,
0x34, 0x7d, 0x2c, 0x7b, 0x22, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69,
0x6f, 0x6e, 0x22, 0x3a, 0x37, 0x2c, 0x22, 0x6c, 0x65, 0x76, 0x65, 0x6c,
0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x22, 0x3a, 0x31, 0x2c, 0x22, 0x74,
0x79, 0x70, 0x65, 0x22, 0x3a, 0x33, 0x7d, 0x5d, 0x2c, 0x5b, 0x7b, 0x22,
0x22, 0x3a, 0x34, 0x2c, 0x22, 0x74, 0x79, 0x70, 0x65, 0x22, 0x3a, 0x30,
0x7d, 0x2c, 0x7b, 0x22, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69,
0x6f, 0x6e, 0x73, 0x22, 0x3a, 0x34, 0x2c, 0x22, 0x74, 0x79, 0x70, 0x65,
0x22, 0x3a, 0x30, 0x7d, 0x5d, 0x2c, 0x5b, 0x7b, 0x22, 0x63, 0x6f, 0x6e,
0x6e, 0x65, 0x22, 0x3a, 0x34, 0x7d, 0x2c, 0x7b, 0x22, 0x74, 0x79, 0x70,
0x65, 0x22, 0x3a, 0x34, 0x7d, 0x2c, 0x7b, 0x22, 0x63, 0x6f, 0x6e, 0x6e,
0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x3a, 0x38, 0x2c, 0x22,
0x74, 0x79, 0x70, 0x65, 0x22, 0x3a, 0x30, 0x7d, 0x5d, 0x2c, 0x5b, 0x7b,
0x22, 0x74, 0x79, 0x70
};
static unsigned int dictionary_len = 4492;
std::string compress_string_zlib(const std::string& str)
{
if (str.empty())
return "";
z_stream zs; // z_stream is zlib's control structure
memset(&zs, 0, sizeof(zs));
zs.zalloc = Z_NULL;
zs.zfree = Z_NULL;
if (deflateInit(&zs, Z_BEST_COMPRESSION) != Z_OK)
throw(std::runtime_error("deflateInit failed while compressing."));
zs.next_in = (Bytef*)str.data();
zs.avail_in = str.size(); // set the z_stream's input
int ret;
char outbuffer[32768];
std::string outstring;
// retrieve the compressed bytes blockwise
do {
zs.next_out = reinterpret_cast<Bytef*>(outbuffer);
zs.avail_out = sizeof(outbuffer);
ret = deflate(&zs, Z_FINISH);
if (outstring.size() < zs.total_out) {
// append the block to the output string
outstring.append(outbuffer,
zs.total_out - outstring.size());
}
} while (ret == Z_OK);
deflateEnd(&zs);
if (ret != Z_STREAM_END) { // an error occurred that was not EOF
std::ostringstream oss;
oss << "ERROR zlib compress: " << ret << " " << zs.msg;
throw(std::runtime_error(oss.str()));
}
return outstring;
}
std::string decompress_string_zlib(const std::string& str)
{
if (str.empty())
return "";
z_stream zs; // z_stream is zlib's control structure
memset(&zs, 0, sizeof(zs));
if (inflateInit(&zs) != Z_OK)
throw(std::runtime_error("inflateInit failed while decompressing."));
zs.next_in = (Bytef*)str.data();
zs.avail_in = str.size();
int ret;
char outbuffer[32768];
std::string outstring;
// get the decompressed bytes blockwise using repeated calls to inflate
do {
zs.next_out = reinterpret_cast<Bytef*>(outbuffer);
zs.avail_out = sizeof(outbuffer);
ret = inflate(&zs, 0);
if (outstring.size() < zs.total_out) {
outstring.append(outbuffer,
zs.total_out - outstring.size());
}
} while (ret == Z_OK);
inflateEnd(&zs);
if (ret != Z_STREAM_END) { // an error occurred that was not EOF
std::ostringstream oss;
oss << "ERROR zlib decompress " << ret << " " << zs.msg;
throw(std::runtime_error(oss.str()));
}
return outstring;
}
std::string compress_string_zstd(const std::string& str)
{
size_t buf_size = ZSTD_compressBound(str.size());
char* buf = (char*) malloc(buf_size);
ZSTD_CCtx* const cctx = ZSTD_createCCtx();
ZSTD_CDict* const cdict = ZSTD_createCDict(dictionary, dictionary_len, ZSTD_maxCLevel());
size_t got_size = ZSTD_compress_usingCDict(cctx, buf, buf_size, str.c_str(), str.size(), cdict);
std::string outstring;
outstring.append(buf, got_size);
ZSTD_freeCCtx(cctx);
ZSTD_freeCDict(cdict);
free(buf);
return outstring;
}
std::string decompress_string_zstd(const std::string& str)
{
unsigned long long buf_size = ZSTD_getFrameContentSize(str.c_str(), str.size());
if (!buf_size || buf_size > 10000000)
throw(std::runtime_error("ZSTD failed"));
char* buf = (char*) malloc(buf_size);
ZSTD_DCtx* const dctx = ZSTD_createDCtx();
ZSTD_DDict* const ddict = ZSTD_createDDict(dictionary, dictionary_len);
size_t got_size = ZSTD_decompress_usingDDict(dctx, buf, buf_size, str.c_str(), str.size(), ddict);
if (!got_size)
throw(std::runtime_error("ZSTD failed"));
if (got_size > 10000000)
throw(std::runtime_error("ZSTD failed"));
std::string outstring;
outstring.append(buf, got_size);
ZSTD_freeDCtx(dctx);
ZSTD_freeDDict(ddict);
free(buf);
return outstring;
}
std::string decompress_string(const std::string& str)
{
if (str[0] == 0x78)
return decompress_string_zlib(str);
return decompress_string_zstd(str);
}
std::string compress_string(const std::string& str)
{
return compress_string_zstd(str);
}