forked from standardnotes/decrypt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
decrypt.html
342 lines (273 loc) · 269 KB
/
decrypt.html
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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type"/>
<meta charset="UTF-8"/>
</head>
<style>
body {
font-family: sans-serif;
margin: 30px;
}
li {
margin-bottom: 10px;
}
#password {
height: 25px;
padding-left: 6px;
width: 220px;
}
</style>
<body>
<h1>Decrypt your Standard Notes files </h1>
<div>
<p>Use this offline tool to decrypt your encrypted Standard Notes backup file(s).</p>
<p>Any questions? Send an email to <a href="mailto:[email protected]">[email protected]</a>.
</div>
<div style="margin-top: 30px;">
<ol>
<li>
Choose file to decrypt:
<input type="file" id="chooser" name="files[]" />
</li>
<li>
<input type="password" id="password" placeholder="Account password at time of backup" autocomplete="off" />
</li>
<li>
<button onclick="downloadAsImportFile()">Download as decrypted import file</button>
or
<button onclick="downloadAsPlain()">Download as zipped plaintext files</button>
</li>
</ol>
</div>
</body>
<script>
var files;
function handleFileSelect(evt) {
files = evt.target.files;
}
function downloadAsImportFile() {
if(!files) {
alert("You must select a file first.");
return;
}
try {
decryptFiles(files).then((data) => {
if(data) {
downloadData(data, "decrypted-sn-data.txt", true);
}
})
} catch (e) {
alert("An error occurred while trying to decrypt your data. Ensure your password is correct and try again.");
}
}
function downloadAsPlain() {
if(!files) {
alert("You must select a file first.");
return;
}
try {
decryptFiles(files).then((data) => {
if(data) {
downloadPlaintextDataZip(data, "decrypted-notes-archive");
}
})
} catch (e) {
alert("An error occurred while trying to decrypt your data. Ensure your password is correct and try again.");
}
}
async function readFile(file) {
return new Promise((resolve, reject) => {
var reader = new FileReader();
reader.onload = function(e) {
var data = JSON.parse(e.target.result);
resolve(data);
};
reader.readAsText(file);
})
}
async function loadKeys(password, data) {
var auth_params = data.auth_params;
if(!auth_params || !auth_params.pw_cost) {
alert("Invalid file selected. Ensure you have selected the right file and try again.");
return;
}
var keys = await SFJS.crypto.computeEncryptionKeysForUser(password, auth_params);
return {auth_params, keys};
}
async function decryptFiles(files, completion) {
var password = document.getElementById("password").value;
if(!password) {
alert("Enter the account password used to encrypt these files.");
return;
}
var auth_params, keys;
var index = 0;
var processedData = [];
for(let file of files) {
var data = await readFile(file);
var credentials = await loadKeys(password, data);
var keys = credentials.keys;
var auth_params = credentials.auth_params;
var showErrorAlert = false;
var errorCount = 0;
for(let item of data.items) {
try {
await SFJS.itemTransformer.decryptItem(item, keys);
if(typeof item.content == "string") {
item.content = JSON.parse(item.content);
}
} catch(error) {
showErrorAlert = true;
errorCount++;
console.error("Error decrypting:", error);
continue;
}
delete item.auth_params;
processedData.push(item);
}
}
if(showErrorAlert) {
if(errorCount === data.items.length) {
alert("Unable to decrypt contents. Ensure your password is correct and try again.");
return null;
} else {
alert("Some items could not be decrypted.");
}
}
return {items: processedData};
}
function downloadData(data, filename, json) {
var textFile = null;
var makeTextFile = function (text) {
var data = new Blob([text], {type: 'text/json'});
// If we are replacing a previously generated file we need to
// manually revoke the object URL to avoid memory leaks.
if (textFile !== null) {
window.URL.revokeObjectURL(textFile);
}
textFile = window.URL.createObjectURL(data);
// returns a URL you can use as a href
return textFile;
}
if(json) {
data = JSON.stringify(data, null, 2 /* pretty print */);
}
var file = makeTextFile(data);
var link = document.createElement('a');
link.setAttribute('download', filename);
link.href = file;
document.body.appendChild(link);
link.click();
link.remove();
}
function downloadPlaintextDataZip(data, filename) {
var zip = new JSZip();
for(var item of data.items) {
var name;
var contents;
if(item.content_type == "Note") {
name = item.content.title;
contents = item.content.text;
} else {
name = item.content_type;
contents = JSON.stringify(item.content, null, 2);
}
if(!name) {
name = "";
}
// Remove slashes
name = name.replace(/\//g, "").replace(/\\+/g, "");
// ('-' + first section of UUID + '.txt')
var filenameEnd = `-${item.uuid.split("-")[0]}.txt`
// Standard max filename length is 255
// Slice the note name down to allow filenameEnd
name = name.slice(0, (255 - filenameEnd.length));
name = `${item.content_type}/${name}${filenameEnd}`
zip.file(name, contents);
}
zip.generateAsync({type:"blob"}).then(function(content) {
downloadData(content, filename + ".zip");
});
}
document.getElementById('chooser').addEventListener('change', handleFileSelect, false);
</script>
<!-- Lodash -->
<script>
/**
* @license
* Lodash (Custom Build) lodash.com/license | Underscore.js 1.8.3 underscorejs.org/LICENSE
* Build: `lodash include="includes,merge,filter,map,remove,find,omit,pull,cloneDeep,pick,uniq,sortedIndexBy,mergeWith"`
*/
;(function(){function t(t,e){return t.set(e[0],e[1]),t}function e(t,e){return t.add(e),t}function n(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}function r(t,e){for(var n=-1,r=null==t?0:t.length;++n<r&&false!==e(t[n],n,t););}function o(t,e){for(var n=-1,r=null==t?0:t.length,o=0,u=[];++n<r;){var c=t[n];e(c,n,t)&&(u[o++]=c)}return u}function u(t,e){return!(null==t||!t.length)&&-1<s(t,e,0);
}function c(t,e){for(var n=-1,r=null==t?0:t.length,o=Array(r);++n<r;)o[n]=e(t[n],n,t);return o}function i(t,e){for(var n=-1,r=e.length,o=t.length;++n<r;)t[o+n]=e[n];return t}function a(t,e,n){for(var r=-1,o=null==t?0:t.length;++r<o;)n=e(n,t[r],r,t);return n}function f(t,e){for(var n=-1,r=null==t?0:t.length;++n<r;)if(e(t[n],n,t))return true;return false}function l(t,e,n){var r=t.length;for(n+=-1;++n<r;)if(e(t[n],n,t))return n;return-1}function s(t,e,n){if(e===e)t:{--n;for(var r=t.length;++n<r;)if(t[n]===e){
t=n;break t}t=-1}else t=l(t,b,n);return t}function b(t){return t!==t}function h(t){return function(e){return null==e?ae:e[t]}}function p(t){return function(e){return t(e)}}function y(t,e){return c(e,function(e){return t[e]})}function j(t,e){return t.has(e)}function v(t){var e=-1,n=Array(t.size);return t.forEach(function(t,r){n[++e]=[r,t]}),n}function g(t){var e=Object;return function(n){return t(e(n))}}function _(t){var e=-1,n=Array(t.size);return t.forEach(function(t){n[++e]=t}),n}function d(){}
function A(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function w(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function m(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function O(t){var e=-1,n=null==t?0:t.length;for(this.__data__=new m;++e<n;)this.add(t[e])}function S(t){this.size=(this.__data__=new w(t)).size}function k(t,e){var n=Dn(t),r=!n&&Bn(t),o=!n&&!r&&Pn(t),u=!n&&!r&&!o&&Ln(t);
if(n=n||r||o||u){for(var r=t.length,c=String,i=-1,a=Array(r);++i<r;)a[i]=c(i);r=a}else r=[];var f,c=r.length;for(f in t)!e&&!Ne.call(t,f)||n&&("length"==f||o&&("offset"==f||"parent"==f)||u&&("buffer"==f||"byteLength"==f||"byteOffset"==f)||mt(f,c))||r.push(f);return r}function z(t,e,n){(n===ae||Bt(t[e],n))&&(n!==ae||e in t)||M(t,e,n)}function x(t,e,n){var r=t[e];Ne.call(t,e)&&Bt(r,n)&&(n!==ae||e in t)||M(t,e,n)}function I(t,e){for(var n=t.length;n--;)if(Bt(t[n][0],e))return n;return-1}function F(t,e){
return t&&ut(e,Yt(e),t)}function E(t,e){return t&&ut(e,Zt(e),t)}function M(t,e,n){"__proto__"==e&&tn?tn(t,e,{configurable:true,enumerable:true,value:n,writable:true}):t[e]=n}function $(t,e,n,o,u,c){var i,a=1&e,f=2&e,l=4&e;if(n&&(i=u?n(t,o,u,c):n(t)),i!==ae)return i;if(!Vt(t))return t;if(o=Dn(t)){if(i=_t(t),!a)return ot(t,i)}else{var s=Fn(t),b="[object Function]"==s||"[object GeneratorFunction]"==s;if(Pn(t))return et(t,a);if("[object Object]"==s||"[object Arguments]"==s||b&&!u){if(i=f||b?{}:dt(t),!a)return f?it(t,E(i,t)):ct(t,F(i,t));
}else{if(!Oe[s])return u?t:{};i=At(t,s,$,a)}}if(c||(c=new S),u=c.get(t))return u;c.set(t,i);var f=l?f?pt:ht:f?Zt:Yt,h=o?ae:f(t);return r(h||t,function(r,o){h&&(o=r,r=t[o]),x(i,o,$(r,e,n,o,t,c))}),i}function U(t,e){var n=[];return On(t,function(t,r,o){e(t,r,o)&&n.push(t)}),n}function B(t,e,n,r,o){var u=-1,c=t.length;for(n||(n=wt),o||(o=[]);++u<c;){var a=t[u];0<e&&n(a)?1<e?B(a,e-1,n,r,o):i(o,a):r||(o[o.length]=a)}return o}function D(t,e){e=tt(e,t);for(var n=0,r=e.length;null!=t&&n<r;)t=t[xt(e[n++])];
return n&&n==r?t:ae}function P(t,e,n){return e=e(t),Dn(t)?e:i(e,n(t))}function L(t){if(null==t)t=t===ae?"[object Undefined]":"[object Null]";else if(Ze&&Ze in Object(t)){var e=Ne.call(t,Ze),n=t[Ze];try{t[Ze]=ae;var r=true}catch(t){}var o=Ce.call(t);r&&(e?t[Ze]=n:delete t[Ze]),t=o}else t=Ce.call(t);return t}function N(t){return Ct(t)&&"[object Arguments]"==L(t)}function V(t,e,n,r,o){if(t===e)e=true;else if(null==t||null==e||!Ct(t)&&!Ct(e))e=t!==t&&e!==e;else t:{var u=Dn(t),c=Dn(e),i=u?"[object Array]":Fn(t),a=c?"[object Array]":Fn(e),i="[object Arguments]"==i?"[object Object]":i,a="[object Arguments]"==a?"[object Object]":a,f="[object Object]"==i,c="[object Object]"==a;
if((a=i==a)&&Pn(t)){if(!Pn(e)){e=false;break t}u=true,f=false}if(a&&!f)o||(o=new S),e=u||Ln(t)?lt(t,e,n,r,V,o):st(t,e,i,n,r,V,o);else{if(!(1&n)&&(u=f&&Ne.call(t,"__wrapped__"),i=c&&Ne.call(e,"__wrapped__"),u||i)){t=u?t.value():t,e=i?e.value():e,o||(o=new S),e=V(t,e,n,r,o);break t}if(a)e:if(o||(o=new S),u=1&n,i=ht(t),c=i.length,a=ht(e).length,c==a||u){for(f=c;f--;){var l=i[f];if(!(u?l in e:Ne.call(e,l))){e=false;break e}}if((a=o.get(t))&&o.get(e))e=a==e;else{a=true,o.set(t,e),o.set(e,t);for(var s=u;++f<c;){var l=i[f],b=t[l],h=e[l];
if(r)var p=u?r(h,b,l,e,t,o):r(b,h,l,t,e,o);if(p===ae?b!==h&&!V(b,h,n,r,o):!p){a=false;break}s||(s="constructor"==l)}a&&!s&&(n=t.constructor,r=e.constructor,n!=r&&"constructor"in t&&"constructor"in e&&!(typeof n=="function"&&n instanceof n&&typeof r=="function"&&r instanceof r)&&(a=false)),o.delete(t),o.delete(e),e=a}}else e=false;else e=false}}return e}function C(t,e){var n=e.length,r=n;if(null==t)return!r;for(t=Object(t);n--;){var o=e[n];if(o[2]?o[1]!==t[o[0]]:!(o[0]in t))return false}for(;++n<r;){var o=e[n],u=o[0],c=t[u],i=o[1];
if(o[2]){if(c===ae&&!(u in t))return false}else if(o=new S,void 0===ae?!V(i,c,3,void 0,o):1)return false}return true}function R(t){return Ct(t)&&Nt(t.length)&&!!me[L(t)]}function T(t){return typeof t=="function"?t:null==t?ne:typeof t=="object"?Dn(t)?G(t[0],t[1]):q(t):ue(t)}function W(t,e){var n=-1,r=Dt(t)?Array(t.length):[];return On(t,function(t,o,u){r[++n]=e(t,o,u)}),r}function q(t){var e=vt(t);return 1==e.length&&e[0][2]?kt(e[0][0],e[0][1]):function(n){return n===t||C(n,e)}}function G(t,e){return Ot(t)&&e===e&&!Vt(e)?kt(xt(t),e):function(n){
var r=Qt(n,t);return r===ae&&r===e?Xt(n,t):V(e,r,3)}}function H(t,e,n,r,o){t!==e&&Sn(e,function(u,c){if(Vt(u)){o||(o=new S);var i=o,a=t[c],f=e[c],l=i.get(f);if(l)z(t,c,l);else{var l=r?r(a,f,c+"",t,e,i):ae,s=l===ae;if(s){var b=Dn(f),h=!b&&Pn(f),p=!b&&!h&&Ln(f),l=f;b||h||p?Dn(a)?l=a:Pt(a)?l=ot(a):h?(s=false,l=et(f,true)):p?(s=false,l=rt(f,true)):l=[]:Rt(f)||Bn(f)?(l=a,Bn(a)?l=Jt(a):(!Vt(a)||n&&Lt(a))&&(l=dt(f))):s=false}s&&(i.set(f,l),H(l,f,n,r,i),i.delete(f)),z(t,c,l)}}else i=r?r(t[c],u,c+"",t,e,o):ae,i===ae&&(i=u),
z(t,c,i)},Zt)}function J(t,e){return K(t,e,function(e,n){return Xt(t,n)})}function K(t,e,n){for(var r=-1,o=e.length,u={};++r<o;){var c=e[r],i=D(t,c);if(n(i,c)){var a=u,c=tt(c,t);if(Vt(a))for(var c=tt(c,a),f=-1,l=c.length,s=l-1;null!=a&&++f<l;){var b=xt(c[f]),h=i;if(f!=s){var p=a[b],h=ae;h===ae&&(h=Vt(p)?p:mt(c[f+1])?[]:{})}x(a,b,h),a=a[b]}}}return u}function Q(t){return function(e){return D(e,t)}}function X(t){return En(zt(t,void 0,ne),t+"")}function Y(t){if(typeof t=="string")return t;if(Dn(t))return c(t,Y)+"";
if(Wt(t))return wn?wn.call(t):"";var e=t+"";return"0"==e&&1/t==-fe?"-0":e}function Z(t,e){e=tt(e,t);var n;if(2>e.length)n=t;else{n=e;var r=0,o=-1,u=-1,c=n.length;for(0>r&&(r=-r>c?0:c+r),o=o>c?c:o,0>o&&(o+=c),c=r>o?0:o-r>>>0,r>>>=0,o=Array(c);++u<c;)o[u]=n[u+r];n=D(t,o)}t=n,null==t||delete t[xt(Mt(e))]}function tt(t,e){return Dn(t)?t:Ot(t,e)?[t]:Mn(Kt(t))}function et(t,e){if(e)return t.slice();var n=t.length,n=He?He(n):new t.constructor(n);return t.copy(n),n}function nt(t){var e=new t.constructor(t.byteLength);
return new Ge(e).set(new Ge(t)),e}function rt(t,e){return new t.constructor(e?nt(t.buffer):t.buffer,t.byteOffset,t.length)}function ot(t,e){var n=-1,r=t.length;for(e||(e=Array(r));++n<r;)e[n]=t[n];return e}function ut(t,e,n){var r=!n;n||(n={});for(var o=-1,u=e.length;++o<u;){var c=e[o],i=ae;i===ae&&(i=t[c]),r?M(n,c,i):x(n,c,i)}return n}function ct(t,e){return ut(t,xn(t),e)}function it(t,e){return ut(t,In(t),e)}function at(t){return X(function(e,n){var r,o=-1,u=n.length,c=1<u?n[u-1]:ae,i=2<u?n[2]:ae,c=3<t.length&&typeof c=="function"?(u--,
c):ae;if(r=i){r=n[0];var a=n[1];if(Vt(i)){var f=typeof a;r=!!("number"==f?Dt(i)&&mt(a,i.length):"string"==f&&a in i)&&Bt(i[a],r)}else r=false}for(r&&(c=3>u?ae:c,u=1),e=Object(e);++o<u;)(i=n[o])&&t(e,i,o,c);return e})}function ft(t){return Rt(t)?ae:t}function lt(t,e,n,r,o,u){var c=1&n,i=t.length,a=e.length;if(i!=a&&!(c&&a>i))return false;if((a=u.get(t))&&u.get(e))return a==e;var a=-1,l=true,s=2&n?new O:ae;for(u.set(t,e),u.set(e,t);++a<i;){var b=t[a],h=e[a];if(r)var p=c?r(h,b,a,e,t,u):r(b,h,a,t,e,u);if(p!==ae){
if(p)continue;l=false;break}if(s){if(!f(e,function(t,e){if(!j(s,e)&&(b===t||o(b,t,n,r,u)))return s.push(e)})){l=false;break}}else if(b!==h&&!o(b,h,n,r,u)){l=false;break}}return u.delete(t),u.delete(e),l}function st(t,e,n,r,o,u,c){switch(n){case"[object DataView]":if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)break;t=t.buffer,e=e.buffer;case"[object ArrayBuffer]":if(t.byteLength!=e.byteLength||!u(new Ge(t),new Ge(e)))break;return true;case"[object Boolean]":case"[object Date]":case"[object Number]":
return Bt(+t,+e);case"[object Error]":return t.name==e.name&&t.message==e.message;case"[object RegExp]":case"[object String]":return t==e+"";case"[object Map]":var i=v;case"[object Set]":if(i||(i=_),t.size!=e.size&&!(1&r))break;return(n=c.get(t))?n==e:(r|=2,c.set(t,e),e=lt(i(t),i(e),r,o,u,c),c.delete(t),e);case"[object Symbol]":if(An)return An.call(t)==An.call(e)}return false}function bt(t){return En(zt(t,ae,Et),t+"")}function ht(t){return P(t,Yt,xn)}function pt(t){return P(t,Zt,In)}function yt(){var t=d.iteratee||re,t=t===re?T:t;
return arguments.length?t(arguments[0],arguments[1]):t}function jt(t,e){var n=t.__data__,r=typeof e;return("string"==r||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==e:null===e)?n[typeof e=="string"?"string":"hash"]:n.map}function vt(t){for(var e=Yt(t),n=e.length;n--;){var r=e[n],o=t[r];e[n]=[r,o,o===o&&!Vt(o)]}return e}function gt(t,e){var n=null==t?ae:t[e];return(!Vt(n)||Ve&&Ve in n?0:(Lt(n)?Te:de).test(It(n)))?n:ae}function _t(t){var e=t.length,n=t.constructor(e);return e&&"string"==typeof t[0]&&Ne.call(t,"index")&&(n.index=t.index,
n.input=t.input),n}function dt(t){return typeof t.constructor!="function"||St(t)?{}:mn(Je(t))}function At(n,r,o,u){var c=n.constructor;switch(r){case"[object ArrayBuffer]":return nt(n);case"[object Boolean]":case"[object Date]":return new c(+n);case"[object DataView]":return r=u?nt(n.buffer):n.buffer,new n.constructor(r,n.byteOffset,n.byteLength);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":
case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return rt(n,u);case"[object Map]":return r=u?o(v(n),1):v(n),a(r,t,new n.constructor);case"[object Number]":case"[object String]":return new c(n);case"[object RegExp]":return r=new n.constructor(n.source,ve.exec(n)),r.lastIndex=n.lastIndex,r;case"[object Set]":return r=u?o(_(n),1):_(n),a(r,e,new n.constructor);case"[object Symbol]":return An?Object(An.call(n)):{}}}function wt(t){return Dn(t)||Bn(t)||!!(Ye&&t&&t[Ye]);
}function mt(t,e){return e=null==e?9007199254740991:e,!!e&&(typeof t=="number"||we.test(t))&&-1<t&&0==t%1&&t<e}function Ot(t,e){if(Dn(t))return false;var n=typeof t;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=t&&!Wt(t))||(be.test(t)||!se.test(t)||null!=e&&t in Object(e))}function St(t){var e=t&&t.constructor;return t===(typeof e=="function"&&e.prototype||De)}function kt(t,e){return function(n){return null!=n&&(n[t]===e&&(e!==ae||t in Object(n)))}}function zt(t,e,r){return e=un(e===ae?t.length-1:e,0),
function(){for(var o=arguments,u=-1,c=un(o.length-e,0),i=Array(c);++u<c;)i[u]=o[e+u];for(u=-1,c=Array(e+1);++u<e;)c[u]=o[u];return c[e]=r(i),n(t,this,c)}}function xt(t){if(typeof t=="string"||Wt(t))return t;var e=t+"";return"0"==e&&1/t==-fe?"-0":e}function It(t){if(null!=t){try{return Le.call(t)}catch(t){}return t+""}return""}function Ft(t,e,n){var r=null==t?0:t.length;return r?(n=null==n?0:Gt(n),0>n&&(n=un(r+n,0)),l(t,yt(e,3),n)):-1}function Et(t){return(null==t?0:t.length)?B(t,1):[]}function Mt(t){
var e=null==t?0:t.length;return e?t[e-1]:ae}function $t(t,e){var n;if(t&&t.length&&e&&e.length){n=e;var r=s,o=-1,u=n.length;for(t===n&&(n=ot(n));++o<u;)for(var c=0,i=n[o];-1<(c=r(t,i,c,void 0));)t!==t&&Xe.call(t,c,1),Xe.call(t,c,1);n=t}else n=t;return n}function Ut(t,e){function n(){var r=arguments,o=e?e.apply(this,r):r[0],u=n.cache;return u.has(o)?u.get(o):(r=t.apply(this,r),n.cache=u.set(o,r)||u,r)}if(typeof t!="function"||null!=e&&typeof e!="function")throw new TypeError("Expected a function");
return n.cache=new(Ut.Cache||m),n}function Bt(t,e){return t===e||t!==t&&e!==e}function Dt(t){return null!=t&&Nt(t.length)&&!Lt(t)}function Pt(t){return Ct(t)&&Dt(t)}function Lt(t){return!!Vt(t)&&(t=L(t),"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t)}function Nt(t){return typeof t=="number"&&-1<t&&0==t%1&&9007199254740991>=t}function Vt(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function Ct(t){return null!=t&&typeof t=="object";
}function Rt(t){return!(!Ct(t)||"[object Object]"!=L(t))&&(t=Je(t),null===t||(t=Ne.call(t,"constructor")&&t.constructor,typeof t=="function"&&t instanceof t&&Le.call(t)==Re))}function Tt(t){return typeof t=="string"||!Dn(t)&&Ct(t)&&"[object String]"==L(t)}function Wt(t){return typeof t=="symbol"||Ct(t)&&"[object Symbol]"==L(t)}function qt(t){return t?(t=Ht(t),t===fe||t===-fe?1.7976931348623157e308*(0>t?-1:1):t===t?t:0):0===t?t:0}function Gt(t){t=qt(t);var e=t%1;return t===t?e?t-e:t:0}function Ht(t){
if(typeof t=="number")return t;if(Wt(t))return le;if(Vt(t)&&(t=typeof t.valueOf=="function"?t.valueOf():t,t=Vt(t)?t+"":t),typeof t!="string")return 0===t?t:+t;t=t.replace(ye,"");var e=_e.test(t);return e||Ae.test(t)?ke(t.slice(2),e?2:8):ge.test(t)?le:+t}function Jt(t){return ut(t,Zt(t))}function Kt(t){return null==t?"":Y(t)}function Qt(t,e,n){return t=null==t?ae:D(t,e),t===ae?n:t}function Xt(t,e){var n;if(n=null!=t){n=t;var r;r=tt(e,n);for(var o=-1,u=r.length,c=false;++o<u;){var i=xt(r[o]);if(!(c=null!=n&&null!=n&&i in Object(n)))break;
n=n[i]}c||++o!=u?n=c:(u=null==n?0:n.length,n=!!u&&Nt(u)&&mt(i,u)&&(Dn(n)||Bn(n)))}return n}function Yt(t){if(Dt(t))t=k(t);else if(St(t)){var e,n=[];for(e in Object(t))Ne.call(t,e)&&"constructor"!=e&&n.push(e);t=n}else t=on(t);return t}function Zt(t){if(Dt(t))t=k(t,true);else if(Vt(t)){var e,n=St(t),r=[];for(e in t)("constructor"!=e||!n&&Ne.call(t,e))&&r.push(e);t=r}else{if(e=[],null!=t)for(n in Object(t))e.push(n);t=e}return t}function te(t){return null==t?[]:y(t,Yt(t))}function ee(t){return function(){
return t}}function ne(t){return t}function re(t){return T(typeof t=="function"?t:$(t,1))}function oe(){}function ue(t){return Ot(t)?h(xt(t)):Q(t)}function ce(){return[]}function ie(){return false}var ae,fe=1/0,le=NaN,se=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,be=/^\w*$/,he=/^\./,pe=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,ye=/^\s+|\s+$/g,je=/\\(\\)?/g,ve=/\w*$/,ge=/^[-+]0x[0-9a-f]+$/i,_e=/^0b[01]+$/i,de=/^\[object .+?Constructor\]$/,Ae=/^0o[0-7]+$/i,we=/^(?:0|[1-9]\d*)$/,me={};
me["[object Float32Array]"]=me["[object Float64Array]"]=me["[object Int8Array]"]=me["[object Int16Array]"]=me["[object Int32Array]"]=me["[object Uint8Array]"]=me["[object Uint8ClampedArray]"]=me["[object Uint16Array]"]=me["[object Uint32Array]"]=true,me["[object Arguments]"]=me["[object Array]"]=me["[object ArrayBuffer]"]=me["[object Boolean]"]=me["[object DataView]"]=me["[object Date]"]=me["[object Error]"]=me["[object Function]"]=me["[object Map]"]=me["[object Number]"]=me["[object Object]"]=me["[object RegExp]"]=me["[object Set]"]=me["[object String]"]=me["[object WeakMap]"]=false;
var Oe={};Oe["[object Arguments]"]=Oe["[object Array]"]=Oe["[object ArrayBuffer]"]=Oe["[object DataView]"]=Oe["[object Boolean]"]=Oe["[object Date]"]=Oe["[object Float32Array]"]=Oe["[object Float64Array]"]=Oe["[object Int8Array]"]=Oe["[object Int16Array]"]=Oe["[object Int32Array]"]=Oe["[object Map]"]=Oe["[object Number]"]=Oe["[object Object]"]=Oe["[object RegExp]"]=Oe["[object Set]"]=Oe["[object String]"]=Oe["[object Symbol]"]=Oe["[object Uint8Array]"]=Oe["[object Uint8ClampedArray]"]=Oe["[object Uint16Array]"]=Oe["[object Uint32Array]"]=true,
Oe["[object Error]"]=Oe["[object Function]"]=Oe["[object WeakMap]"]=false;var Se,ke=parseInt,ze=typeof global=="object"&&global&&global.Object===Object&&global,xe=typeof self=="object"&&self&&self.Object===Object&&self,Ie=ze||xe||Function("return this")(),Fe=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Ee=Fe&&typeof module=="object"&&module&&!module.nodeType&&module,Me=Ee&&Ee.exports===Fe,$e=Me&&ze.process;t:{try{Se=$e&&$e.binding&&$e.binding("util");break t}catch(t){}Se=void 0}var Ue=Se&&Se.isTypedArray,Be=Array.prototype,De=Object.prototype,Pe=Ie["__core-js_shared__"],Le=Function.prototype.toString,Ne=De.hasOwnProperty,Ve=function(){
var t=/[^.]+$/.exec(Pe&&Pe.keys&&Pe.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}(),Ce=De.toString,Re=Le.call(Object),Te=RegExp("^"+Le.call(Ne).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),We=Me?Ie.Buffer:ae,qe=Ie.Symbol,Ge=Ie.Uint8Array,He=We?We.a:ae,Je=g(Object.getPrototypeOf),Ke=Object.create,Qe=De.propertyIsEnumerable,Xe=Be.splice,Ye=qe?qe.isConcatSpreadable:ae,Ze=qe?qe.toStringTag:ae,tn=function(){try{var t=gt(Object,"defineProperty");
return t({},"",{}),t}catch(t){}}(),en=Math.floor,nn=Object.getOwnPropertySymbols,rn=We?We.isBuffer:ae,on=g(Object.keys),un=Math.max,cn=Math.min,an=Date.now,fn=gt(Ie,"DataView"),ln=gt(Ie,"Map"),sn=gt(Ie,"Promise"),bn=gt(Ie,"Set"),hn=gt(Ie,"WeakMap"),pn=gt(Object,"create"),yn=It(fn),jn=It(ln),vn=It(sn),gn=It(bn),_n=It(hn),dn=qe?qe.prototype:ae,An=dn?dn.valueOf:ae,wn=dn?dn.toString:ae,mn=function(){function t(){}return function(e){return Vt(e)?Ke?Ke(e):(t.prototype=e,e=new t,t.prototype=ae,e):{}}}();
A.prototype.clear=function(){this.__data__=pn?pn(null):{},this.size=0},A.prototype.delete=function(t){return t=this.has(t)&&delete this.__data__[t],this.size-=t?1:0,t},A.prototype.get=function(t){var e=this.__data__;return pn?(t=e[t],"__lodash_hash_undefined__"===t?ae:t):Ne.call(e,t)?e[t]:ae},A.prototype.has=function(t){var e=this.__data__;return pn?e[t]!==ae:Ne.call(e,t)},A.prototype.set=function(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=pn&&e===ae?"__lodash_hash_undefined__":e,
this},w.prototype.clear=function(){this.__data__=[],this.size=0},w.prototype.delete=function(t){var e=this.__data__;return t=I(e,t),!(0>t)&&(t==e.length-1?e.pop():Xe.call(e,t,1),--this.size,true)},w.prototype.get=function(t){var e=this.__data__;return t=I(e,t),0>t?ae:e[t][1]},w.prototype.has=function(t){return-1<I(this.__data__,t)},w.prototype.set=function(t,e){var n=this.__data__,r=I(n,t);return 0>r?(++this.size,n.push([t,e])):n[r][1]=e,this},m.prototype.clear=function(){this.size=0,this.__data__={
hash:new A,map:new(ln||w),string:new A}},m.prototype.delete=function(t){return t=jt(this,t).delete(t),this.size-=t?1:0,t},m.prototype.get=function(t){return jt(this,t).get(t)},m.prototype.has=function(t){return jt(this,t).has(t)},m.prototype.set=function(t,e){var n=jt(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,this},O.prototype.add=O.prototype.push=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this},O.prototype.has=function(t){return this.__data__.has(t)},S.prototype.clear=function(){
this.__data__=new w,this.size=0},S.prototype.delete=function(t){var e=this.__data__;return t=e.delete(t),this.size=e.size,t},S.prototype.get=function(t){return this.__data__.get(t)},S.prototype.has=function(t){return this.__data__.has(t)},S.prototype.set=function(t,e){var n=this.__data__;if(n instanceof w){var r=n.__data__;if(!ln||199>r.length)return r.push([t,e]),this.size=++n.size,this;n=this.__data__=new m(r)}return n.set(t,e),this.size=n.size,this};var On=function(t,e){return function(n,r){if(null==n)return n;
if(!Dt(n))return t(n,r);for(var o=n.length,u=e?o:-1,c=Object(n);(e?u--:++u<o)&&false!==r(c[u],u,c););return n}}(function(t,e){return t&&Sn(t,e,Yt)}),Sn=function(t){return function(e,n,r){var o=-1,u=Object(e);r=r(e);for(var c=r.length;c--;){var i=r[t?c:++o];if(false===n(u[i],i,u))break}return e}}(),kn=tn?function(t,e){return tn(t,"toString",{configurable:true,enumerable:false,value:ee(e),writable:true})}:ne,zn=bn&&1/_(new bn([,-0]))[1]==fe?function(t){return new bn(t)}:oe,xn=nn?function(t){return null==t?[]:(t=Object(t),
o(nn(t),function(e){return Qe.call(t,e)}))}:ce,In=nn?function(t){for(var e=[];t;)i(e,xn(t)),t=Je(t);return e}:ce,Fn=L;(fn&&"[object DataView]"!=Fn(new fn(new ArrayBuffer(1)))||ln&&"[object Map]"!=Fn(new ln)||sn&&"[object Promise]"!=Fn(sn.resolve())||bn&&"[object Set]"!=Fn(new bn)||hn&&"[object WeakMap]"!=Fn(new hn))&&(Fn=function(t){var e=L(t);if(t=(t="[object Object]"==e?t.constructor:ae)?It(t):"")switch(t){case yn:return"[object DataView]";case jn:return"[object Map]";case vn:return"[object Promise]";
case gn:return"[object Set]";case _n:return"[object WeakMap]"}return e});var En=function(t){var e=0,n=0;return function(){var r=an(),o=16-(r-n);if(n=r,0<o){if(800<=++e)return arguments[0]}else e=0;return t.apply(ae,arguments)}}(kn),Mn=function(t){t=Ut(t,function(t){return 500===e.size&&e.clear(),t});var e=t.cache;return t}(function(t){var e=[];return he.test(t)&&e.push(""),t.replace(pe,function(t,n,r,o){e.push(r?o.replace(je,"$1"):n||t)}),e}),$n=X($t),Un=function(t){return function(e,n,r){var o=Object(e);
if(!Dt(e)){var u=yt(n,3);e=Yt(e),n=function(t){return u(o[t],t,o)}}return n=t(e,n,r),-1<n?o[u?e[n]:n]:ae}}(Ft);Ut.Cache=m;var Bn=N(function(){return arguments}())?N:function(t){return Ct(t)&&Ne.call(t,"callee")&&!Qe.call(t,"callee")},Dn=Array.isArray,Pn=rn||ie,Ln=Ue?p(Ue):R,Nn=at(function(t,e,n){H(t,e,n)}),Vn=at(function(t,e,n,r){H(t,e,n,r)}),Cn=bt(function(t,e){var n={};if(null==t)return n;var r=false;e=c(e,function(e){return e=tt(e,t),r||(r=1<e.length),e}),ut(t,pt(t),n),r&&(n=$(n,7,ft));for(var o=e.length;o--;)Z(n,e[o]);
return n}),Rn=bt(function(t,e){return null==t?{}:J(t,e)});d.constant=ee,d.filter=function(t,e){return(Dn(t)?o:U)(t,yt(e,3))},d.flatten=Et,d.iteratee=re,d.keys=Yt,d.keysIn=Zt,d.map=function(t,e){return(Dn(t)?c:W)(t,yt(e,3))},d.memoize=Ut,d.merge=Nn,d.mergeWith=Vn,d.omit=Cn,d.pick=Rn,d.property=ue,d.pull=$n,d.pullAll=$t,d.remove=function(t,e){var n=[];if(!t||!t.length)return n;var r=-1,o=[],u=t.length;for(e=yt(e,3);++r<u;){var c=t[r];e(c,r,t)&&(n.push(c),o.push(r))}for(r=t?o.length:0,u=r-1;r--;)if(c=o[r],
r==u||c!==i){var i=c;mt(c)?Xe.call(t,c,1):Z(t,c)}return n},d.toPlainObject=Jt,d.uniq=function(t){if(t&&t.length)t:{var e=-1,n=u,r=t.length,o=true,c=[],i=c;if(200<=r){if(n=zn(t)){t=_(n);break t}o=false,n=j,i=new O}else i=c;e:for(;++e<r;){var a=t[e],f=a,a=0!==a?a:0;if(o&&f===f){for(var l=i.length;l--;)if(i[l]===f)continue e;c.push(a)}else n(i,f,void 0)||(i!==c&&i.push(f),c.push(a))}t=c}else t=[];return t},d.values=te,d.cloneDeep=function(t){return $(t,5)},d.eq=Bt,d.find=Un,d.findIndex=Ft,d.get=Qt,d.hasIn=Xt,
d.identity=ne,d.includes=function(t,e,n,r){return t=Dt(t)?t:te(t),n=n&&!r?Gt(n):0,r=t.length,0>n&&(n=un(r+n,0)),Tt(t)?n<=r&&-1<t.indexOf(e,n):!!r&&-1<s(t,e,n)},d.isArguments=Bn,d.isArray=Dn,d.isArrayLike=Dt,d.isArrayLikeObject=Pt,d.isBuffer=Pn,d.isFunction=Lt,d.isLength=Nt,d.isObject=Vt,d.isObjectLike=Ct,d.isPlainObject=Rt,d.isString=Tt,d.isSymbol=Wt,d.isTypedArray=Ln,d.last=Mt,d.stubArray=ce,d.stubFalse=ie,d.noop=oe,d.sortedIndexBy=function(t,e,n){n=yt(n,2),e=n(e);for(var r=0,o=null==t?0:t.length,u=e!==e,c=null===e,i=Wt(e),a=e===ae;r<o;){
var f=en((r+o)/2),l=n(t[f]),s=l!==ae,b=null===l,h=l===l,p=Wt(l);(u?h:a?h&&s:c?h&&s&&!b:i?h&&s&&!b&&!p:b||p?0:l<e)?r=f+1:o=f}return cn(o,4294967294)},d.toFinite=qt,d.toInteger=Gt,d.toNumber=Ht,d.toString=Kt,d.VERSION="4.17.4",typeof define=="function"&&typeof define.amd=="object"&&define.amd?(Ie._=d, define(function(){return d})):Ee?((Ee.exports=d)._=d,Fe._=d):Ie._=d}).call(this);
</script>
<!-- End Lodash -->
<!-- SFJS -->
<script>
!function(a){"use strict";function b(a,b,c,e){var f=b&&b.prototype instanceof d?b:d,g=Object.create(f.prototype),h=new m(e||[]);return g._invoke=i(a,c,h),g}function c(a,b,c){try{return{type:"normal",arg:a.call(b,c)}}catch(a){return{type:"throw",arg:a}}}function d(){}function e(){}function f(){}function g(a){["next","throw","return"].forEach(function(b){a[b]=function(a){return this._invoke(b,a)}})}function h(a){function b(d,e,f,g){var h=c(a[d],a,e);if("throw"!==h.type){var i=h.arg,j=i.value;return j&&"object"==typeof j&&r.call(j,"__await")?Promise.resolve(j.__await).then(function(a){b("next",a,f,g)},function(a){b("throw",a,f,g)}):Promise.resolve(j).then(function(a){i.value=a,f(i)},g)}g(h.arg)}function d(a,c){function d(){return new Promise(function(d,e){b(a,c,d,e)})}return e=e?e.then(d,d):d()}var e;this._invoke=d}function i(a,b,d){var e=y;return function(f,g){if(e===A)throw new Error("Generator is already running");if(e===B){if("throw"===f)throw g;return o()}for(d.method=f,d.arg=g;;){var h=d.delegate;if(h){var i=j(h,d);if(i){if(i===C)continue;return i}}if("next"===d.method)d.sent=d._sent=d.arg;else if("throw"===d.method){if(e===y)throw e=B,d.arg;d.dispatchException(d.arg)}else"return"===d.method&&d.abrupt("return",d.arg);e=A;var k=c(a,b,d);if("normal"===k.type){if(e=d.done?B:z,k.arg===C)continue;return{value:k.arg,done:d.done}}"throw"===k.type&&(e=B,d.method="throw",d.arg=k.arg)}}}function j(a,b){var d=a.iterator[b.method];if(d===p){if(b.delegate=null,"throw"===b.method){if(a.iterator.return&&(b.method="return",b.arg=p,j(a,b),"throw"===b.method))return C;b.method="throw",b.arg=new TypeError("The iterator does not provide a 'throw' method")}return C}var e=c(d,a.iterator,b.arg);if("throw"===e.type)return b.method="throw",b.arg=e.arg,b.delegate=null,C;var f=e.arg;return f?f.done?(b[a.resultName]=f.value,b.next=a.nextLoc,"return"!==b.method&&(b.method="next",b.arg=p),b.delegate=null,C):f:(b.method="throw",b.arg=new TypeError("iterator result is not an object"),b.delegate=null,C)}function k(a){var b={tryLoc:a[0]};1 in a&&(b.catchLoc=a[1]),2 in a&&(b.finallyLoc=a[2],b.afterLoc=a[3]),this.tryEntries.push(b)}function l(a){var b=a.completion||{};b.type="normal",delete b.arg,a.completion=b}function m(a){this.tryEntries=[{tryLoc:"root"}],a.forEach(k,this),this.reset(!0)}function n(a){if(a){var b=a[t];if(b)return b.call(a);if("function"==typeof a.next)return a;if(!isNaN(a.length)){var c=-1,d=function b(){for(;++c<a.length;)if(r.call(a,c))return b.value=a[c],b.done=!1,b;return b.value=p,b.done=!0,b};return d.next=d}}return{next:o}}function o(){return{value:p,done:!0}}var p,q=Object.prototype,r=q.hasOwnProperty,s="function"==typeof Symbol?Symbol:{},t=s.iterator||"@@iterator",u=s.asyncIterator||"@@asyncIterator",v=s.toStringTag||"@@toStringTag",w="object"==typeof module,x=a.regeneratorRuntime;if(x)return void(w&&(module.exports=x));x=a.regeneratorRuntime=w?module.exports:{},x.wrap=b;var y="suspendedStart",z="suspendedYield",A="executing",B="completed",C={},D={};D[t]=function(){return this};var E=Object.getPrototypeOf,F=E&&E(E(n([])));F&&F!==q&&r.call(F,t)&&(D=F);var G=f.prototype=d.prototype=Object.create(D);e.prototype=G.constructor=f,f.constructor=e,f[v]=e.displayName="GeneratorFunction",x.isGeneratorFunction=function(a){var b="function"==typeof a&&a.constructor;return!!b&&(b===e||"GeneratorFunction"===(b.displayName||b.name))},x.mark=function(a){return Object.setPrototypeOf?Object.setPrototypeOf(a,f):(a.__proto__=f,v in a||(a[v]="GeneratorFunction")),a.prototype=Object.create(G),a},x.awrap=function(a){return{__await:a}},g(h.prototype),h.prototype[u]=function(){return this},x.AsyncIterator=h,x.async=function(a,c,d,e){var f=new h(b(a,c,d,e));return x.isGeneratorFunction(c)?f:f.next().then(function(a){return a.done?a.value:f.next()})},g(G),G[v]="Generator",G[t]=function(){return this},G.toString=function(){return"[object Generator]"},x.keys=function(a){var b=[];for(var c in a)b.push(c);return b.reverse(),function c(){for(;b.length;){var d=b.pop();if(d in a)return c.value=d,c.done=!1,c}return c.done=!0,c}},x.values=n,m.prototype={constructor:m,reset:function(a){if(this.prev=0,this.next=0,this.sent=this._sent=p,this.done=!1,this.delegate=null,this.method="next",this.arg=p,this.tryEntries.forEach(l),!a)for(var b in this)"t"===b.charAt(0)&&r.call(this,b)&&!isNaN(+b.slice(1))&&(this[b]=p)},stop:function(){this.done=!0;var a=this.tryEntries[0],b=a.completion;if("throw"===b.type)throw b.arg;return this.rval},dispatchException:function(a){function b(b,d){return f.type="throw",f.arg=a,c.next=b,d&&(c.method="next",c.arg=p),!!d}if(this.done)throw a;for(var c=this,d=this.tryEntries.length-1;d>=0;--d){var e=this.tryEntries[d],f=e.completion;if("root"===e.tryLoc)return b("end");if(e.tryLoc<=this.prev){var g=r.call(e,"catchLoc"),h=r.call(e,"finallyLoc");if(g&&h){if(this.prev<e.catchLoc)return b(e.catchLoc,!0);if(this.prev<e.finallyLoc)return b(e.finallyLoc)}else if(g){if(this.prev<e.catchLoc)return b(e.catchLoc,!0)}else{if(!h)throw new Error("try statement without catch or finally");if(this.prev<e.finallyLoc)return b(e.finallyLoc)}}}},abrupt:function(a,b){for(var c=this.tryEntries.length-1;c>=0;--c){var d=this.tryEntries[c];if(d.tryLoc<=this.prev&&r.call(d,"finallyLoc")&&this.prev<d.finallyLoc){var e=d;break}}e&&("break"===a||"continue"===a)&&e.tryLoc<=b&&b<=e.finallyLoc&&(e=null);var f=e?e.completion:{};return f.type=a,f.arg=b,e?(this.method="next",this.next=e.finallyLoc,C):this.complete(f)},complete:function(a,b){if("throw"===a.type)throw a.arg;return"break"===a.type||"continue"===a.type?this.next=a.arg:"return"===a.type?(this.rval=this.arg=a.arg,this.method="return",this.next="end"):"normal"===a.type&&b&&(this.next=b),C},finish:function(a){for(var b=this.tryEntries.length-1;b>=0;--b){var c=this.tryEntries[b];if(c.finallyLoc===a)return this.complete(c.completion,c.afterLoc),l(c),C}},catch:function(a){for(var b=this.tryEntries.length-1;b>=0;--b){var c=this.tryEntries[b];if(c.tryLoc===a){var d=c.completion;if("throw"===d.type){var e=d.arg;l(c)}return e}}throw new Error("illegal catch attempt")},delegateYield:function(a,b,c){return this.delegate={iterator:n(a),resultName:b,nextLoc:c},"next"===this.method&&(this.arg=p),C}}}(function(){return this}()||Function("return this")()),function(a){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=a();else if("function"==typeof define&&define.amd)define([],a);else{var b;b="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,b.SF=a()}}(function(){return function(){function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};b[g][0].call(k.exports,function(a){return e(b[g][1][a]||a)},k,k.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g<d.length;g++)e(d[g]);return e}return a}()({1:[function(a,b,c){(function(a){function b(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!=typeof b&&"function"!=typeof b?a:b}function d(a,b){if("function"!=typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function e(a){return function(){var b=a.apply(this,arguments);return new Promise(function(a,c){function d(e,f){try{var g=b[e](f),h=g.value}catch(a){return void c(a)}if(!g.done)return Promise.resolve(h).then(function(a){d("next",a)},function(a){d("throw",a)});a(h)}return d("next")})}}function f(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}var g=g||function(a,b){var c={},d=c.lib={},e=function(){},f=d.Base={extend:function(a){e.prototype=this;var b=new e;return a&&b.mixIn(a),b.hasOwnProperty("init")||(b.init=function(){b.$super.init.apply(this,arguments)}),b.init.prototype=b,b.$super=this,b},create:function(){var a=this.extend();return a.init.apply(a,arguments),a},init:function(){},mixIn:function(a){for(var b in a)a.hasOwnProperty(b)&&(this[b]=a[b]);a.hasOwnProperty("toString")&&(this.toString=a.toString)},clone:function(){return this.init.prototype.extend(this)}},g=d.WordArray=f.extend({init:function(a,b){a=this.words=a||[],this.sigBytes=void 0!=b?b:4*a.length},toString:function(a){return(a||i).stringify(this)},concat:function(a){var b=this.words,c=a.words,d=this.sigBytes;if(a=a.sigBytes,this.clamp(),d%4)for(var e=0;e<a;e++)b[d+e>>>2]|=(c[e>>>2]>>>24-e%4*8&255)<<24-(d+e)%4*8;else if(65535<c.length)for(e=0;e<a;e+=4)b[d+e>>>2]=c[e>>>2];else b.push.apply(b,c);return this.sigBytes+=a,this},clamp:function(){var b=this.words,c=this.sigBytes;b[c>>>2]&=4294967295<<32-c%4*8,b.length=a.ceil(c/4)},clone:function(){var a=f.clone.call(this);return a.words=this.words.slice(0),a},random:function(b){for(var c=[],d=0;d<b;d+=4)c.push(4294967296*a.random()|0);return new g.init(c,b)}}),h=c.enc={},i=h.Hex={stringify:function(a){var b=a.words;a=a.sigBytes;for(var c=[],d=0;d<a;d++){var e=b[d>>>2]>>>24-d%4*8&255;c.push((e>>>4).toString(16)),c.push((15&e).toString(16))}return c.join("")},parse:function(a){for(var b=a.length,c=[],d=0;d<b;d+=2)c[d>>>3]|=parseInt(a.substr(d,2),16)<<24-d%8*4;return new g.init(c,b/2)}},j=h.Latin1={stringify:function(a){var b=a.words;a=a.sigBytes;for(var c=[],d=0;d<a;d++)c.push(String.fromCharCode(b[d>>>2]>>>24-d%4*8&255));return c.join("")},parse:function(a){for(var b=a.length,c=[],d=0;d<b;d++)c[d>>>2]|=(255&a.charCodeAt(d))<<24-d%4*8;return new g.init(c,b)}},k=h.Utf8={stringify:function(a){try{return decodeURIComponent(escape(j.stringify(a)))}catch(a){throw Error("Malformed UTF-8 data")}},parse:function(a){return j.parse(unescape(encodeURIComponent(a)))}},l=d.BufferedBlockAlgorithm=f.extend({reset:function(){this._data=new g.init,this._nDataBytes=0},_append:function(a){"string"==typeof a&&(a=k.parse(a)),this._data.concat(a),this._nDataBytes+=a.sigBytes},_process:function(b){var c=this._data,d=c.words,e=c.sigBytes,f=this.blockSize,h=e/(4*f),h=b?a.ceil(h):a.max((0|h)-this._minBufferSize,0);if(b=h*f,e=a.min(4*b,e),b){for(var i=0;i<b;i+=f)this._doProcessBlock(d,i);i=d.splice(0,b),c.sigBytes-=e}return new g.init(i,e)},clone:function(){var a=f.clone.call(this);return a._data=this._data.clone(),a},_minBufferSize:0});d.Hasher=l.extend({cfg:f.extend(),init:function(a){this.cfg=this.cfg.extend(a),this.reset()},reset:function(){l.reset.call(this),this._doReset()},update:function(a){return this._append(a),this._process(),this},finalize:function(a){return a&&this._append(a),this._doFinalize()},blockSize:16,_createHelper:function(a){return function(b,c){return new a.init(c).finalize(b)}},_createHmacHelper:function(a){return function(b,c){return new m.HMAC.init(a,c).finalize(b)}}});var m=c.algo={};return c}(Math);!function(){var a=g,b=a.lib.WordArray;a.enc.Base64={stringify:function(a){var b=a.words,c=a.sigBytes,d=this._map;a.clamp(),a=[];for(var e=0;e<c;e+=3)for(var f=(b[e>>>2]>>>24-e%4*8&255)<<16|(b[e+1>>>2]>>>24-(e+1)%4*8&255)<<8|b[e+2>>>2]>>>24-(e+2)%4*8&255,g=0;4>g&&e+.75*g<c;g++)a.push(d.charAt(f>>>6*(3-g)&63));if(b=d.charAt(64))for(;a.length%4;)a.push(b);return a.join("")},parse:function(a){var c=a.length,d=this._map,e=d.charAt(64);e&&-1!=(e=a.indexOf(e))&&(c=e);for(var e=[],f=0,g=0;g<c;g++)if(g%4){var h=d.indexOf(a.charAt(g-1))<<g%4*2,i=d.indexOf(a.charAt(g))>>>6-g%4*2;e[f>>>2]|=(h|i)<<24-f%4*8,f++}return b.create(e,f)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}}(),function(a){function b(a,b,c,d,e,f,g){return((a=a+(b&c|~b&d)+e+g)<<f|a>>>32-f)+b}function c(a,b,c,d,e,f,g){return((a=a+(b&d|c&~d)+e+g)<<f|a>>>32-f)+b}function d(a,b,c,d,e,f,g){return((a=a+(b^c^d)+e+g)<<f|a>>>32-f)+b}function e(a,b,c,d,e,f,g){return((a=a+(c^(b|~d))+e+g)<<f|a>>>32-f)+b}for(var f=g,h=f.lib,i=h.WordArray,j=h.Hasher,h=f.algo,k=[],l=0;64>l;l++)k[l]=4294967296*a.abs(a.sin(l+1))|0;h=h.MD5=j.extend({_doReset:function(){this._hash=new i.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(a,f){for(var g=0;16>g;g++){var h=f+g,i=a[h];a[h]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8)}var g=this._hash.words,h=a[f+0],i=a[f+1],j=a[f+2],l=a[f+3],m=a[f+4],n=a[f+5],o=a[f+6],p=a[f+7],q=a[f+8],r=a[f+9],s=a[f+10],t=a[f+11],u=a[f+12],v=a[f+13],w=a[f+14],x=a[f+15],y=g[0],z=g[1],A=g[2],B=g[3],y=b(y,z,A,B,h,7,k[0]),B=b(B,y,z,A,i,12,k[1]),A=b(A,B,y,z,j,17,k[2]),z=b(z,A,B,y,l,22,k[3]),y=b(y,z,A,B,m,7,k[4]),B=b(B,y,z,A,n,12,k[5]),A=b(A,B,y,z,o,17,k[6]),z=b(z,A,B,y,p,22,k[7]),y=b(y,z,A,B,q,7,k[8]),B=b(B,y,z,A,r,12,k[9]),A=b(A,B,y,z,s,17,k[10]),z=b(z,A,B,y,t,22,k[11]),y=b(y,z,A,B,u,7,k[12]),B=b(B,y,z,A,v,12,k[13]),A=b(A,B,y,z,w,17,k[14]),z=b(z,A,B,y,x,22,k[15]),y=c(y,z,A,B,i,5,k[16]),B=c(B,y,z,A,o,9,k[17]),A=c(A,B,y,z,t,14,k[18]),z=c(z,A,B,y,h,20,k[19]),y=c(y,z,A,B,n,5,k[20]),B=c(B,y,z,A,s,9,k[21]),A=c(A,B,y,z,x,14,k[22]),z=c(z,A,B,y,m,20,k[23]),y=c(y,z,A,B,r,5,k[24]),B=c(B,y,z,A,w,9,k[25]),A=c(A,B,y,z,l,14,k[26]),z=c(z,A,B,y,q,20,k[27]),y=c(y,z,A,B,v,5,k[28]),B=c(B,y,z,A,j,9,k[29]),A=c(A,B,y,z,p,14,k[30]),z=c(z,A,B,y,u,20,k[31]),y=d(y,z,A,B,n,4,k[32]),B=d(B,y,z,A,q,11,k[33]),A=d(A,B,y,z,t,16,k[34]),z=d(z,A,B,y,w,23,k[35]),y=d(y,z,A,B,i,4,k[36]),B=d(B,y,z,A,m,11,k[37]),A=d(A,B,y,z,p,16,k[38]),z=d(z,A,B,y,s,23,k[39]),y=d(y,z,A,B,v,4,k[40]),B=d(B,y,z,A,h,11,k[41]),A=d(A,B,y,z,l,16,k[42]),z=d(z,A,B,y,o,23,k[43]),y=d(y,z,A,B,r,4,k[44]),B=d(B,y,z,A,u,11,k[45]),A=d(A,B,y,z,x,16,k[46]),z=d(z,A,B,y,j,23,k[47]),y=e(y,z,A,B,h,6,k[48]),B=e(B,y,z,A,p,10,k[49]),A=e(A,B,y,z,w,15,k[50]),z=e(z,A,B,y,n,21,k[51]),y=e(y,z,A,B,u,6,k[52]),B=e(B,y,z,A,l,10,k[53]),A=e(A,B,y,z,s,15,k[54]),z=e(z,A,B,y,i,21,k[55]),y=e(y,z,A,B,q,6,k[56]),B=e(B,y,z,A,x,10,k[57]),A=e(A,B,y,z,o,15,k[58]),z=e(z,A,B,y,v,21,k[59]),y=e(y,z,A,B,m,6,k[60]),B=e(B,y,z,A,t,10,k[61]),A=e(A,B,y,z,j,15,k[62]),z=e(z,A,B,y,r,21,k[63]);g[0]=g[0]+y|0,g[1]=g[1]+z|0,g[2]=g[2]+A|0,g[3]=g[3]+B|0},_doFinalize:function(){var b=this._data,c=b.words,d=8*this._nDataBytes,e=8*b.sigBytes;c[e>>>5]|=128<<24-e%32;var f=a.floor(d/4294967296);for(c[15+(e+64>>>9<<4)]=16711935&(f<<8|f>>>24)|4278255360&(f<<24|f>>>8),c[14+(e+64>>>9<<4)]=16711935&(d<<8|d>>>24)|4278255360&(d<<24|d>>>8),b.sigBytes=4*(c.length+1),this._process(),b=this._hash,c=b.words,d=0;4>d;d++)e=c[d],c[d]=16711935&(e<<8|e>>>24)|4278255360&(e<<24|e>>>8);return b},clone:function(){var a=j.clone.call(this);return a._hash=this._hash.clone(),a}}),f.MD5=j._createHelper(h),f.HmacMD5=j._createHmacHelper(h)}(Math),function(){var a=g,b=a.lib,c=b.Base,d=b.WordArray,b=a.algo,e=b.EvpKDF=c.extend({cfg:c.extend({keySize:4,hasher:b.MD5,iterations:1}),init:function(a){this.cfg=this.cfg.extend(a)},compute:function(a,b){for(var c=this.cfg,e=c.hasher.create(),f=d.create(),g=f.words,h=c.keySize,c=c.iterations;g.length<h;){i&&e.update(i);var i=e.update(a).finalize(b);e.reset();for(var j=1;j<c;j++)i=e.finalize(i),e.reset();f.concat(i)}return f.sigBytes=4*h,f}});a.EvpKDF=function(a,b,c){return e.create(c).compute(a,b)}}(),g.lib.Cipher||function(a){var b=g,c=b.lib,d=c.Base,e=c.WordArray,f=c.BufferedBlockAlgorithm,h=b.enc.Base64,i=b.algo.EvpKDF,j=c.Cipher=f.extend({cfg:d.extend(),createEncryptor:function(a,b){return this.create(this._ENC_XFORM_MODE,a,b)},createDecryptor:function(a,b){return this.create(this._DEC_XFORM_MODE,a,b)},init:function(a,b,c){this.cfg=this.cfg.extend(c),this._xformMode=a,this._key=b,this.reset()},reset:function(){f.reset.call(this),this._doReset()},process:function(a){return this._append(a),this._process()},finalize:function(a){return a&&this._append(a),this._doFinalize()},keySize:4,ivSize:4,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(a){return{encrypt:function(b,c,d){return("string"==typeof c?p:o).encrypt(a,b,c,d)},decrypt:function(b,c,d){return("string"==typeof c?p:o).decrypt(a,b,c,d)}}}});c.StreamCipher=j.extend({_doFinalize:function(){return this._process(!0)},blockSize:1});var k=b.mode={},l=function(a,b,c){var d=this._iv;d?this._iv=void 0:d=this._prevBlock;for(var e=0;e<c;e++)a[b+e]^=d[e]},m=(c.BlockCipherMode=d.extend({createEncryptor:function(a,b){return this.Encryptor.create(a,b)},createDecryptor:function(a,b){return this.Decryptor.create(a,b)},init:function(a,b){this._cipher=a,this._iv=b}})).extend();m.Encryptor=m.extend({processBlock:function(a,b){var c=this._cipher,d=c.blockSize;l.call(this,a,b,d),c.encryptBlock(a,b),this._prevBlock=a.slice(b,b+d)}}),m.Decryptor=m.extend({processBlock:function(a,b){var c=this._cipher,d=c.blockSize,e=a.slice(b,b+d);c.decryptBlock(a,b),l.call(this,a,b,d),this._prevBlock=e}}),k=k.CBC=m,m=(b.pad={}).Pkcs7={pad:function(a,b){for(var c=4*b,c=c-a.sigBytes%c,d=c<<24|c<<16|c<<8|c,f=[],g=0;g<c;g+=4)f.push(d);c=e.create(f,c),a.concat(c)},unpad:function(a){a.sigBytes-=255&a.words[a.sigBytes-1>>>2]}},c.BlockCipher=j.extend({cfg:j.cfg.extend({mode:k,padding:m}),reset:function(){j.reset.call(this);var a=this.cfg,b=a.iv,a=a.mode;if(this._xformMode==this._ENC_XFORM_MODE)var c=a.createEncryptor;else c=a.createDecryptor,this._minBufferSize=1;this._mode=c.call(a,this,b&&b.words)},_doProcessBlock:function(a,b){this._mode.processBlock(a,b)},_doFinalize:function(){var a=this.cfg.padding;if(this._xformMode==this._ENC_XFORM_MODE){a.pad(this._data,this.blockSize);var b=this._process(!0)}else b=this._process(!0),a.unpad(b);return b},blockSize:4});var n=c.CipherParams=d.extend({init:function(a){this.mixIn(a)},toString:function(a){return(a||this.formatter).stringify(this)}}),k=(b.format={}).OpenSSL={stringify:function(a){var b=a.ciphertext;return a=a.salt,(a?e.create([1398893684,1701076831]).concat(a).concat(b):b).toString(h)},parse:function(a){a=h.parse(a);var b=a.words;if(1398893684==b[0]&&1701076831==b[1]){var c=e.create(b.slice(2,4));b.splice(0,4),a.sigBytes-=16}return n.create({ciphertext:a,salt:c})}},o=c.SerializableCipher=d.extend({cfg:d.extend({format:k}),encrypt:function(a,b,c,d){d=this.cfg.extend(d);var e=a.createEncryptor(c,d);return b=e.finalize(b),e=e.cfg,n.create({ciphertext:b,key:c,iv:e.iv,algorithm:a,mode:e.mode,padding:e.padding,blockSize:a.blockSize,formatter:d.format})},decrypt:function(a,b,c,d){return d=this.cfg.extend(d),b=this._parse(b,d.format),a.createDecryptor(c,d).finalize(b.ciphertext)},_parse:function(a,b){return"string"==typeof a?b.parse(a,this):a}}),b=(b.kdf={}).OpenSSL={execute:function(a,b,c,d){return d||(d=e.random(8)),a=i.create({keySize:b+c}).compute(a,d),c=e.create(a.words.slice(b),4*c),a.sigBytes=4*b,n.create({key:a,iv:c,salt:d})}},p=c.PasswordBasedCipher=o.extend({cfg:o.cfg.extend({kdf:b}),encrypt:function(a,b,c,d){return d=this.cfg.extend(d),c=d.kdf.execute(c,a.keySize,a.ivSize),d.iv=c.iv,a=o.encrypt.call(this,a,b,c.key,d),a.mixIn(c),a},decrypt:function(a,b,c,d){return d=this.cfg.extend(d),b=this._parse(b,d.format),c=d.kdf.execute(c,a.keySize,a.ivSize,b.salt),d.iv=c.iv,o.decrypt.call(this,a,b,c.key,d)}})}(),function(){for(var a=g,b=a.lib.BlockCipher,c=a.algo,d=[],e=[],f=[],h=[],i=[],j=[],k=[],l=[],m=[],n=[],o=[],p=0;256>p;p++)o[p]=128>p?p<<1:p<<1^283;for(var q=0,r=0,p=0;256>p;p++){var s=r^r<<1^r<<2^r<<3^r<<4,s=s>>>8^255&s^99;d[q]=s,e[s]=q;var t=o[q],u=o[t],v=o[u],w=257*o[s]^16843008*s;f[q]=w<<24|w>>>8,h[q]=w<<16|w>>>16,i[q]=w<<8|w>>>24,j[q]=w,w=16843009*v^65537*u^257*t^16843008*q,k[s]=w<<24|w>>>8,l[s]=w<<16|w>>>16,m[s]=w<<8|w>>>24,n[s]=w,q?(q=t^o[o[o[v^t]]],r^=o[o[r]]):q=r=1}var x=[0,1,2,4,8,16,32,64,128,27,54],c=c.AES=b.extend({_doReset:function(){for(var a=this._key,b=a.words,c=a.sigBytes/4,a=4*((this._nRounds=c+6)+1),e=this._keySchedule=[],f=0;f<a;f++)if(f<c)e[f]=b[f];else{var g=e[f-1];f%c?6<c&&4==f%c&&(g=d[g>>>24]<<24|d[g>>>16&255]<<16|d[g>>>8&255]<<8|d[255&g]):(g=g<<8|g>>>24,g=d[g>>>24]<<24|d[g>>>16&255]<<16|d[g>>>8&255]<<8|d[255&g],g^=x[f/c|0]<<24),e[f]=e[f-c]^g}for(b=this._invKeySchedule=[],c=0;c<a;c++)f=a-c,g=c%4?e[f]:e[f-4],b[c]=4>c||4>=f?g:k[d[g>>>24]]^l[d[g>>>16&255]]^m[d[g>>>8&255]]^n[d[255&g]]},encryptBlock:function(a,b){this._doCryptBlock(a,b,this._keySchedule,f,h,i,j,d)},decryptBlock:function(a,b){var c=a[b+1];a[b+1]=a[b+3],a[b+3]=c,this._doCryptBlock(a,b,this._invKeySchedule,k,l,m,n,e),c=a[b+1],a[b+1]=a[b+3],a[b+3]=c},_doCryptBlock:function(a,b,c,d,e,f,g,h){for(var i=this._nRounds,j=a[b]^c[0],k=a[b+1]^c[1],l=a[b+2]^c[2],m=a[b+3]^c[3],n=4,o=1;o<i;o++)var p=d[j>>>24]^e[k>>>16&255]^f[l>>>8&255]^g[255&m]^c[n++],q=d[k>>>24]^e[l>>>16&255]^f[m>>>8&255]^g[255&j]^c[n++],r=d[l>>>24]^e[m>>>16&255]^f[j>>>8&255]^g[255&k]^c[n++],m=d[m>>>24]^e[j>>>16&255]^f[k>>>8&255]^g[255&l]^c[n++],j=p,k=q,l=r;p=(h[j>>>24]<<24|h[k>>>16&255]<<16|h[l>>>8&255]<<8|h[255&m])^c[n++],q=(h[k>>>24]<<24|h[l>>>16&255]<<16|h[m>>>8&255]<<8|h[255&j])^c[n++],r=(h[l>>>24]<<24|h[m>>>16&255]<<16|h[j>>>8&255]<<8|h[255&k])^c[n++],m=(h[m>>>24]<<24|h[j>>>16&255]<<16|h[k>>>8&255]<<8|h[255&l])^c[n++],a[b]=p,a[b+1]=q,a[b+2]=r,a[b+3]=m},keySize:8});a.AES=b._createHelper(c)}();var g=g||function(a,b){var c={},d=c.lib={},e=function(){},f=d.Base={extend:function(a){e.prototype=this;var b=new e;return a&&b.mixIn(a),b.hasOwnProperty("init")||(b.init=function(){b.$super.init.apply(this,arguments)}),b.init.prototype=b,b.$super=this,b},create:function(){var a=this.extend();return a.init.apply(a,arguments),a},init:function(){},mixIn:function(a){for(var b in a)a.hasOwnProperty(b)&&(this[b]=a[b]);a.hasOwnProperty("toString")&&(this.toString=a.toString)},clone:function(){return this.init.prototype.extend(this)}},g=d.WordArray=f.extend({init:function(a,b){a=this.words=a||[],this.sigBytes=void 0!=b?b:4*a.length},toString:function(a){return(a||i).stringify(this)},concat:function(a){var b=this.words,c=a.words,d=this.sigBytes;if(a=a.sigBytes,this.clamp(),d%4)for(var e=0;e<a;e++)b[d+e>>>2]|=(c[e>>>2]>>>24-e%4*8&255)<<24-(d+e)%4*8;else if(65535<c.length)for(e=0;e<a;e+=4)b[d+e>>>2]=c[e>>>2];else b.push.apply(b,c);return this.sigBytes+=a,this},clamp:function(){var b=this.words,c=this.sigBytes;b[c>>>2]&=4294967295<<32-c%4*8,b.length=a.ceil(c/4)},clone:function(){var a=f.clone.call(this);return a.words=this.words.slice(0),a},random:function(b){for(var c=[],d=0;d<b;d+=4)c.push(4294967296*a.random()|0);return new g.init(c,b)}}),h=c.enc={},i=h.Hex={stringify:function(a){var b=a.words;a=a.sigBytes;for(var c=[],d=0;d<a;d++){var e=b[d>>>2]>>>24-d%4*8&255;c.push((e>>>4).toString(16)),c.push((15&e).toString(16))}return c.join("")},parse:function(a){for(var b=a.length,c=[],d=0;d<b;d+=2)c[d>>>3]|=parseInt(a.substr(d,2),16)<<24-d%8*4;return new g.init(c,b/2)}},j=h.Latin1={stringify:function(a){var b=a.words;a=a.sigBytes;for(var c=[],d=0;d<a;d++)c.push(String.fromCharCode(b[d>>>2]>>>24-d%4*8&255));return c.join("")},parse:function(a){for(var b=a.length,c=[],d=0;d<b;d++)c[d>>>2]|=(255&a.charCodeAt(d))<<24-d%4*8;return new g.init(c,b)}},k=h.Utf8={stringify:function(a){try{return decodeURIComponent(escape(j.stringify(a)))}catch(a){throw Error("Malformed UTF-8 data")}},parse:function(a){return j.parse(unescape(encodeURIComponent(a)))}},l=d.BufferedBlockAlgorithm=f.extend({reset:function(){this._data=new g.init,this._nDataBytes=0},_append:function(a){"string"==typeof a&&(a=k.parse(a)),this._data.concat(a),this._nDataBytes+=a.sigBytes},_process:function(b){var c=this._data,d=c.words,e=c.sigBytes,f=this.blockSize,h=e/(4*f),h=b?a.ceil(h):a.max((0|h)-this._minBufferSize,0);if(b=h*f,e=a.min(4*b,e),b){for(var i=0;i<b;i+=f)this._doProcessBlock(d,i);i=d.splice(0,b),c.sigBytes-=e}return new g.init(i,e)},clone:function(){var a=f.clone.call(this);return a._data=this._data.clone(),a},_minBufferSize:0});d.Hasher=l.extend({cfg:f.extend(),init:function(a){this.cfg=this.cfg.extend(a),this.reset()},reset:function(){l.reset.call(this),this._doReset()},update:function(a){return this._append(a),this._process(),this},finalize:function(a){return a&&this._append(a),this._doFinalize()},blockSize:16,_createHelper:function(a){return function(b,c){return new a.init(c).finalize(b)}},_createHmacHelper:function(a){return function(b,c){return new m.HMAC.init(a,c).finalize(b)}}});var m=c.algo={};return c}(Math);!function(a){for(var b=g,c=b.lib,d=c.WordArray,e=c.Hasher,c=b.algo,f=[],h=[],i=function(a){return 4294967296*(a-(0|a))|0},j=2,k=0;64>k;){var l;a:{l=j;for(var m=a.sqrt(l),n=2;n<=m;n++)if(!(l%n)){l=!1;break a}l=!0}l&&(8>k&&(f[k]=i(a.pow(j,.5))),h[k]=i(a.pow(j,1/3)),k++),j++}var o=[],c=c.SHA256=e.extend({_doReset:function(){this._hash=new d.init(f.slice(0))},_doProcessBlock:function(a,b){for(var c=this._hash.words,d=c[0],e=c[1],f=c[2],g=c[3],i=c[4],j=c[5],k=c[6],l=c[7],m=0;64>m;m++){if(16>m)o[m]=0|a[b+m];else{var n=o[m-15],p=o[m-2];o[m]=((n<<25|n>>>7)^(n<<14|n>>>18)^n>>>3)+o[m-7]+((p<<15|p>>>17)^(p<<13|p>>>19)^p>>>10)+o[m-16]}n=l+((i<<26|i>>>6)^(i<<21|i>>>11)^(i<<7|i>>>25))+(i&j^~i&k)+h[m]+o[m],p=((d<<30|d>>>2)^(d<<19|d>>>13)^(d<<10|d>>>22))+(d&e^d&f^e&f),l=k,k=j,j=i,i=g+n|0,g=f,f=e,e=d,d=n+p|0}c[0]=c[0]+d|0,c[1]=c[1]+e|0,c[2]=c[2]+f|0,c[3]=c[3]+g|0,c[4]=c[4]+i|0,c[5]=c[5]+j|0,c[6]=c[6]+k|0,c[7]=c[7]+l|0},_doFinalize:function(){var b=this._data,c=b.words,d=8*this._nDataBytes,e=8*b.sigBytes;return c[e>>>5]|=128<<24-e%32,c[14+(e+64>>>9<<4)]=a.floor(d/4294967296),c[15+(e+64>>>9<<4)]=d,b.sigBytes=4*c.length,this._process(),this._hash},clone:function(){var a=e.clone.call(this);return a._hash=this._hash.clone(),a}});b.SHA256=e._createHelper(c),b.HmacSHA256=e._createHmacHelper(c)}(Math),function(){var a=g,b=a.enc.Utf8;a.algo.HMAC=a.lib.Base.extend({init:function(a,c){a=this._hasher=new a.init,"string"==typeof c&&(c=b.parse(c));var d=a.blockSize,e=4*d;c.sigBytes>e&&(c=a.finalize(c)),c.clamp();for(var f=this._oKey=c.clone(),g=this._iKey=c.clone(),h=f.words,i=g.words,j=0;j<d;j++)h[j]^=1549556828,i[j]^=909522486;f.sigBytes=g.sigBytes=e,this.reset()},reset:function(){var a=this._hasher;a.reset(),a.update(this._iKey)},update:function(a){return this._hasher.update(a),this},finalize:function(a){var b=this._hasher;return a=b.finalize(a),b.reset(),b.finalize(this._oKey.clone().concat(a))}})}();var g=g||function(a,b){var c={},d=c.lib={},e=function(){},f=d.Base={extend:function(a){e.prototype=this;var b=new e;return a&&b.mixIn(a),b.hasOwnProperty("init")||(b.init=function(){b.$super.init.apply(this,arguments)}),b.init.prototype=b,b.$super=this,b},create:function(){var a=this.extend();return a.init.apply(a,arguments),a},init:function(){},mixIn:function(a){for(var b in a)a.hasOwnProperty(b)&&(this[b]=a[b]);a.hasOwnProperty("toString")&&(this.toString=a.toString)},clone:function(){return this.init.prototype.extend(this)}},g=d.WordArray=f.extend({init:function(a,b){a=this.words=a||[],this.sigBytes=void 0!=b?b:4*a.length},toString:function(a){return(a||i).stringify(this)},concat:function(a){var b=this.words,c=a.words,d=this.sigBytes;if(a=a.sigBytes,this.clamp(),d%4)for(var e=0;e<a;e++)b[d+e>>>2]|=(c[e>>>2]>>>24-e%4*8&255)<<24-(d+e)%4*8;else if(65535<c.length)for(e=0;e<a;e+=4)b[d+e>>>2]=c[e>>>2];else b.push.apply(b,c);return this.sigBytes+=a,this},clamp:function(){var b=this.words,c=this.sigBytes;b[c>>>2]&=4294967295<<32-c%4*8,b.length=a.ceil(c/4)},clone:function(){var a=f.clone.call(this);return a.words=this.words.slice(0),a},random:function(b){for(var c=[],d=0;d<b;d+=4)c.push(4294967296*a.random()|0);return new g.init(c,b)}}),h=c.enc={},i=h.Hex={stringify:function(a){var b=a.words;a=a.sigBytes;for(var c=[],d=0;d<a;d++){var e=b[d>>>2]>>>24-d%4*8&255;c.push((e>>>4).toString(16)),c.push((15&e).toString(16))}return c.join("")},parse:function(a){for(var b=a.length,c=[],d=0;d<b;d+=2)c[d>>>3]|=parseInt(a.substr(d,2),16)<<24-d%8*4;return new g.init(c,b/2)}},j=h.Latin1={stringify:function(a){var b=a.words;a=a.sigBytes;for(var c=[],d=0;d<a;d++)c.push(String.fromCharCode(b[d>>>2]>>>24-d%4*8&255));return c.join("")},parse:function(a){for(var b=a.length,c=[],d=0;d<b;d++)c[d>>>2]|=(255&a.charCodeAt(d))<<24-d%4*8;return new g.init(c,b)}},k=h.Utf8={stringify:function(a){try{return decodeURIComponent(escape(j.stringify(a)))}catch(a){throw Error("Malformed UTF-8 data")}},parse:function(a){return j.parse(unescape(encodeURIComponent(a)))}},l=d.BufferedBlockAlgorithm=f.extend({reset:function(){this._data=new g.init,this._nDataBytes=0},_append:function(a){"string"==typeof a&&(a=k.parse(a)),this._data.concat(a),this._nDataBytes+=a.sigBytes},_process:function(b){var c=this._data,d=c.words,e=c.sigBytes,f=this.blockSize,h=e/(4*f),h=b?a.ceil(h):a.max((0|h)-this._minBufferSize,0);if(b=h*f,e=a.min(4*b,e),b){for(var i=0;i<b;i+=f)this._doProcessBlock(d,i);i=d.splice(0,b),c.sigBytes-=e}return new g.init(i,e)},clone:function(){var a=f.clone.call(this);return a._data=this._data.clone(),a},_minBufferSize:0});d.Hasher=l.extend({cfg:f.extend(),init:function(a){this.cfg=this.cfg.extend(a),this.reset()},reset:function(){l.reset.call(this),this._doReset()},update:function(a){return this._append(a),this._process(),this},finalize:function(a){return a&&this._append(a),this._doFinalize()},blockSize:16,_createHelper:function(a){return function(b,c){return new a.init(c).finalize(b)}},_createHmacHelper:function(a){return function(b,c){return new m.HMAC.init(a,c).finalize(b)}}});var m=c.algo={};return c}(Math);!function(a){var b=g,c=b.lib,d=c.Base,e=c.WordArray,b=b.x64={};b.Word=d.extend({init:function(a,b){this.high=a,this.low=b}}),b.WordArray=d.extend({init:function(a,b){a=this.words=a||[],this.sigBytes=void 0!=b?b:8*a.length},toX32:function(){for(var a=this.words,b=a.length,c=[],d=0;d<b;d++){var f=a[d];c.push(f.high),c.push(f.low)}return e.create(c,this.sigBytes)},clone:function(){for(var a=d.clone.call(this),b=a.words=this.words.slice(0),c=b.length,e=0;e<c;e++)b[e]=b[e].clone();return a}})}(),function(){function a(){return e.create.apply(e,arguments)}for(var b=g,c=b.lib.Hasher,d=b.x64,e=d.Word,f=d.WordArray,d=b.algo,h=[a(1116352408,3609767458),a(1899447441,602891725),a(3049323471,3964484399),a(3921009573,2173295548),a(961987163,4081628472),a(1508970993,3053834265),a(2453635748,2937671579),a(2870763221,3664609560),a(3624381080,2734883394),a(310598401,1164996542),a(607225278,1323610764),a(1426881987,3590304994),a(1925078388,4068182383),a(2162078206,991336113),a(2614888103,633803317),a(3248222580,3479774868),a(3835390401,2666613458),a(4022224774,944711139),a(264347078,2341262773),a(604807628,2007800933),a(770255983,1495990901),a(1249150122,1856431235),a(1555081692,3175218132),a(1996064986,2198950837),a(2554220882,3999719339),a(2821834349,766784016),a(2952996808,2566594879),a(3210313671,3203337956),a(3336571891,1034457026),a(3584528711,2466948901),a(113926993,3758326383),a(338241895,168717936),a(666307205,1188179964),a(773529912,1546045734),a(1294757372,1522805485),a(1396182291,2643833823),a(1695183700,2343527390),a(1986661051,1014477480),a(2177026350,1206759142),a(2456956037,344077627),a(2730485921,1290863460),a(2820302411,3158454273),a(3259730800,3505952657),a(3345764771,106217008),a(3516065817,3606008344),a(3600352804,1432725776),a(4094571909,1467031594),a(275423344,851169720),a(430227734,3100823752),a(506948616,1363258195),a(659060556,3750685593),a(883997877,3785050280),a(958139571,3318307427),a(1322822218,3812723403),a(1537002063,2003034995),a(1747873779,3602036899),a(1955562222,1575990012),a(2024104815,1125592928),a(2227730452,2716904306),a(2361852424,442776044),a(2428436474,593698344),a(2756734187,3733110249),a(3204031479,2999351573),a(3329325298,3815920427),a(3391569614,3928383900),a(3515267271,566280711),a(3940187606,3454069534),a(4118630271,4000239992),a(116418474,1914138554),a(174292421,2731055270),a(289380356,3203993006),a(460393269,320620315),a(685471733,587496836),a(852142971,1086792851),a(1017036298,365543100),a(1126000580,2618297676),a(1288033470,3409855158),a(1501505948,4234509866),a(1607167915,987167468),a(1816402316,1246189591)],i=[],j=0;80>j;j++)i[j]=a();d=d.SHA512=c.extend({_doReset:function(){
this._hash=new f.init([new e.init(1779033703,4089235720),new e.init(3144134277,2227873595),new e.init(1013904242,4271175723),new e.init(2773480762,1595750129),new e.init(1359893119,2917565137),new e.init(2600822924,725511199),new e.init(528734635,4215389547),new e.init(1541459225,327033209)])},_doProcessBlock:function(a,b){for(var c=this._hash.words,d=c[0],e=c[1],f=c[2],g=c[3],j=c[4],k=c[5],l=c[6],c=c[7],m=d.high,n=d.low,o=e.high,p=e.low,q=f.high,r=f.low,s=g.high,t=g.low,u=j.high,v=j.low,w=k.high,x=k.low,y=l.high,z=l.low,A=c.high,B=c.low,C=m,D=n,E=o,F=p,G=q,H=r,I=s,J=t,K=u,L=v,M=w,N=x,O=y,P=z,Q=A,R=B,S=0;80>S;S++){var T=i[S];if(16>S)var U=T.high=0|a[b+2*S],V=T.low=0|a[b+2*S+1];else{var U=i[S-15],V=U.high,W=U.low,U=(V>>>1|W<<31)^(V>>>8|W<<24)^V>>>7,W=(W>>>1|V<<31)^(W>>>8|V<<24)^(W>>>7|V<<25),X=i[S-2],V=X.high,Y=X.low,X=(V>>>19|Y<<13)^(V<<3|Y>>>29)^V>>>6,Y=(Y>>>19|V<<13)^(Y<<3|V>>>29)^(Y>>>6|V<<26),V=i[S-7],Z=V.high,$=i[S-16],_=$.high,$=$.low,V=W+V.low,U=U+Z+(V>>>0<W>>>0?1:0),V=V+Y,U=U+X+(V>>>0<Y>>>0?1:0),V=V+$,U=U+_+(V>>>0<$>>>0?1:0);T.high=U,T.low=V}var Z=K&M^~K&O,$=L&N^~L&P,T=C&E^C&G^E&G,aa=D&F^D&H^F&H,W=(C>>>28|D<<4)^(C<<30|D>>>2)^(C<<25|D>>>7),X=(D>>>28|C<<4)^(D<<30|C>>>2)^(D<<25|C>>>7),Y=h[S],ba=Y.high,ca=Y.low,Y=R+((L>>>14|K<<18)^(L>>>18|K<<14)^(L<<23|K>>>9)),_=Q+((K>>>14|L<<18)^(K>>>18|L<<14)^(K<<23|L>>>9))+(Y>>>0<R>>>0?1:0),Y=Y+$,_=_+Z+(Y>>>0<$>>>0?1:0),Y=Y+ca,_=_+ba+(Y>>>0<ca>>>0?1:0),Y=Y+V,_=_+U+(Y>>>0<V>>>0?1:0),V=X+aa,T=W+T+(V>>>0<X>>>0?1:0),Q=O,R=P,O=M,P=N,M=K,N=L,L=J+Y|0,K=I+_+(L>>>0<J>>>0?1:0)|0,I=G,J=H,G=E,H=F,E=C,F=D,D=Y+V|0,C=_+T+(D>>>0<Y>>>0?1:0)|0}n=d.low=n+D,d.high=m+C+(n>>>0<D>>>0?1:0),p=e.low=p+F,e.high=o+E+(p>>>0<F>>>0?1:0),r=f.low=r+H,f.high=q+G+(r>>>0<H>>>0?1:0),t=g.low=t+J,g.high=s+I+(t>>>0<J>>>0?1:0),v=j.low=v+L,j.high=u+K+(v>>>0<L>>>0?1:0),x=k.low=x+N,k.high=w+M+(x>>>0<N>>>0?1:0),z=l.low=z+P,l.high=y+O+(z>>>0<P>>>0?1:0),B=c.low=B+R,c.high=A+Q+(B>>>0<R>>>0?1:0)},_doFinalize:function(){var a=this._data,b=a.words,c=8*this._nDataBytes,d=8*a.sigBytes;return b[d>>>5]|=128<<24-d%32,b[30+(d+128>>>10<<5)]=Math.floor(c/4294967296),b[31+(d+128>>>10<<5)]=c,a.sigBytes=4*b.length,this._process(),this._hash.toX32()},clone:function(){var a=c.clone.call(this);return a._hash=this._hash.clone(),a},blockSize:32}),b.SHA512=c._createHelper(d),b.HmacSHA512=c._createHmacHelper(d)}(),function(){var a=g,b=a.enc.Utf8;a.algo.HMAC=a.lib.Base.extend({init:function(a,c){a=this._hasher=new a.init,"string"==typeof c&&(c=b.parse(c));var d=a.blockSize,e=4*d;c.sigBytes>e&&(c=a.finalize(c)),c.clamp();for(var f=this._oKey=c.clone(),g=this._iKey=c.clone(),h=f.words,i=g.words,j=0;j<d;j++)h[j]^=1549556828,i[j]^=909522486;f.sigBytes=g.sigBytes=e,this.reset()},reset:function(){var a=this._hasher;a.reset(),a.update(this._iKey)},update:function(a){return this._hasher.update(a),this},finalize:function(a){var b=this._hasher;return a=b.finalize(a),b.reset(),b.finalize(this._oKey.clone().concat(a))}})}();var g=g||function(a,b){var c={},d=c.lib={},e=function(){},f=d.Base={extend:function(a){e.prototype=this;var b=new e;return a&&b.mixIn(a),b.hasOwnProperty("init")||(b.init=function(){b.$super.init.apply(this,arguments)}),b.init.prototype=b,b.$super=this,b},create:function(){var a=this.extend();return a.init.apply(a,arguments),a},init:function(){},mixIn:function(a){for(var b in a)a.hasOwnProperty(b)&&(this[b]=a[b]);a.hasOwnProperty("toString")&&(this.toString=a.toString)},clone:function(){return this.init.prototype.extend(this)}},g=d.WordArray=f.extend({init:function(a,b){a=this.words=a||[],this.sigBytes=void 0!=b?b:4*a.length},toString:function(a){return(a||i).stringify(this)},concat:function(a){var b=this.words,c=a.words,d=this.sigBytes;if(a=a.sigBytes,this.clamp(),d%4)for(var e=0;e<a;e++)b[d+e>>>2]|=(c[e>>>2]>>>24-e%4*8&255)<<24-(d+e)%4*8;else if(65535<c.length)for(e=0;e<a;e+=4)b[d+e>>>2]=c[e>>>2];else b.push.apply(b,c);return this.sigBytes+=a,this},clamp:function(){var b=this.words,c=this.sigBytes;b[c>>>2]&=4294967295<<32-c%4*8,b.length=a.ceil(c/4)},clone:function(){var a=f.clone.call(this);return a.words=this.words.slice(0),a},random:function(b){for(var c=[],d=0;d<b;d+=4)c.push(4294967296*a.random()|0);return new g.init(c,b)}}),h=c.enc={},i=h.Hex={stringify:function(a){var b=a.words;a=a.sigBytes;for(var c=[],d=0;d<a;d++){var e=b[d>>>2]>>>24-d%4*8&255;c.push((e>>>4).toString(16)),c.push((15&e).toString(16))}return c.join("")},parse:function(a){for(var b=a.length,c=[],d=0;d<b;d+=2)c[d>>>3]|=parseInt(a.substr(d,2),16)<<24-d%8*4;return new g.init(c,b/2)}},j=h.Latin1={stringify:function(a){var b=a.words;a=a.sigBytes;for(var c=[],d=0;d<a;d++)c.push(String.fromCharCode(b[d>>>2]>>>24-d%4*8&255));return c.join("")},parse:function(a){for(var b=a.length,c=[],d=0;d<b;d++)c[d>>>2]|=(255&a.charCodeAt(d))<<24-d%4*8;return new g.init(c,b)}},k=h.Utf8={stringify:function(a){try{return decodeURIComponent(escape(j.stringify(a)))}catch(a){throw Error("Malformed UTF-8 data")}},parse:function(a){return j.parse(unescape(encodeURIComponent(a)))}},l=d.BufferedBlockAlgorithm=f.extend({reset:function(){this._data=new g.init,this._nDataBytes=0},_append:function(a){"string"==typeof a&&(a=k.parse(a)),this._data.concat(a),this._nDataBytes+=a.sigBytes},_process:function(b){var c=this._data,d=c.words,e=c.sigBytes,f=this.blockSize,h=e/(4*f),h=b?a.ceil(h):a.max((0|h)-this._minBufferSize,0);if(b=h*f,e=a.min(4*b,e),b){for(var i=0;i<b;i+=f)this._doProcessBlock(d,i);i=d.splice(0,b),c.sigBytes-=e}return new g.init(i,e)},clone:function(){var a=f.clone.call(this);return a._data=this._data.clone(),a},_minBufferSize:0});d.Hasher=l.extend({cfg:f.extend(),init:function(a){this.cfg=this.cfg.extend(a),this.reset()},reset:function(){l.reset.call(this),this._doReset()},update:function(a){return this._append(a),this._process(),this},finalize:function(a){return a&&this._append(a),this._doFinalize()},blockSize:16,_createHelper:function(a){return function(b,c){return new a.init(c).finalize(b)}},_createHmacHelper:function(a){return function(b,c){return new m.HMAC.init(a,c).finalize(b)}}});var m=c.algo={};return c}(Math);!function(){var a=g,b=a.lib,c=b.WordArray,d=b.Hasher,e=[],b=a.algo.SHA1=d.extend({_doReset:function(){this._hash=new c.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(a,b){for(var c=this._hash.words,d=c[0],f=c[1],g=c[2],h=c[3],i=c[4],j=0;80>j;j++){if(16>j)e[j]=0|a[b+j];else{var k=e[j-3]^e[j-8]^e[j-14]^e[j-16];e[j]=k<<1|k>>>31}k=(d<<5|d>>>27)+i+e[j],k=20>j?k+(1518500249+(f&g|~f&h)):40>j?k+(1859775393+(f^g^h)):60>j?k+((f&g|f&h|g&h)-1894007588):k+((f^g^h)-899497514),i=h,h=g,g=f<<30|f>>>2,f=d,d=k}c[0]=c[0]+d|0,c[1]=c[1]+f|0,c[2]=c[2]+g|0,c[3]=c[3]+h|0,c[4]=c[4]+i|0},_doFinalize:function(){var a=this._data,b=a.words,c=8*this._nDataBytes,d=8*a.sigBytes;return b[d>>>5]|=128<<24-d%32,b[14+(d+64>>>9<<4)]=Math.floor(c/4294967296),b[15+(d+64>>>9<<4)]=c,a.sigBytes=4*b.length,this._process(),this._hash},clone:function(){var a=d.clone.call(this);return a._hash=this._hash.clone(),a}});a.SHA1=d._createHelper(b),a.HmacSHA1=d._createHmacHelper(b)}(),function(){var a=g,b=a.enc.Utf8;a.algo.HMAC=a.lib.Base.extend({init:function(a,c){a=this._hasher=new a.init,"string"==typeof c&&(c=b.parse(c));var d=a.blockSize,e=4*d;c.sigBytes>e&&(c=a.finalize(c)),c.clamp();for(var f=this._oKey=c.clone(),g=this._iKey=c.clone(),h=f.words,i=g.words,j=0;j<d;j++)h[j]^=1549556828,i[j]^=909522486;f.sigBytes=g.sigBytes=e,this.reset()},reset:function(){var a=this._hasher;a.reset(),a.update(this._iKey)},update:function(a){return this._hasher.update(a),this},finalize:function(a){var b=this._hasher;return a=b.finalize(a),b.reset(),b.finalize(this._oKey.clone().concat(a))}})}(),function(){var a=g,b=a.lib,c=b.Base,d=b.WordArray,b=a.algo,e=b.HMAC,f=b.PBKDF2=c.extend({cfg:c.extend({keySize:4,hasher:b.SHA1,iterations:1}),init:function(a){this.cfg=this.cfg.extend(a)},compute:function(a,b){for(var c=this.cfg,f=e.create(c.hasher,a),g=d.create(),h=d.create([1]),i=g.words,j=h.words,k=c.keySize,c=c.iterations;i.length<k;){var l=f.update(b).finalize(h);f.reset();for(var m=l.words,n=m.length,o=l,p=1;p<c;p++){o=f.finalize(o),f.reset();for(var q=o.words,r=0;r<n;r++)m[r]^=q[r]}g.concat(l),j[0]++}return g.sigBytes=4*k,g}});a.PBKDF2=function(a,b,c){return f.create(c).compute(a,b)}}();var g=g||function(a,b){var c={},d=c.lib={},e=function(){},f=d.Base={extend:function(a){e.prototype=this;var b=new e;return a&&b.mixIn(a),b.hasOwnProperty("init")||(b.init=function(){b.$super.init.apply(this,arguments)}),b.init.prototype=b,b.$super=this,b},create:function(){var a=this.extend();return a.init.apply(a,arguments),a},init:function(){},mixIn:function(a){for(var b in a)a.hasOwnProperty(b)&&(this[b]=a[b]);a.hasOwnProperty("toString")&&(this.toString=a.toString)},clone:function(){return this.init.prototype.extend(this)}},g=d.WordArray=f.extend({init:function(a,b){a=this.words=a||[],this.sigBytes=void 0!=b?b:4*a.length},toString:function(a){return(a||i).stringify(this)},concat:function(a){var b=this.words,c=a.words,d=this.sigBytes;if(a=a.sigBytes,this.clamp(),d%4)for(var e=0;e<a;e++)b[d+e>>>2]|=(c[e>>>2]>>>24-e%4*8&255)<<24-(d+e)%4*8;else if(65535<c.length)for(e=0;e<a;e+=4)b[d+e>>>2]=c[e>>>2];else b.push.apply(b,c);return this.sigBytes+=a,this},clamp:function(){var b=this.words,c=this.sigBytes;b[c>>>2]&=4294967295<<32-c%4*8,b.length=a.ceil(c/4)},clone:function(){var a=f.clone.call(this);return a.words=this.words.slice(0),a},random:function(b){for(var c=[],d=0;d<b;d+=4)c.push(4294967296*a.random()|0);return new g.init(c,b)}}),h=c.enc={},i=h.Hex={stringify:function(a){var b=a.words;a=a.sigBytes;for(var c=[],d=0;d<a;d++){var e=b[d>>>2]>>>24-d%4*8&255;c.push((e>>>4).toString(16)),c.push((15&e).toString(16))}return c.join("")},parse:function(a){for(var b=a.length,c=[],d=0;d<b;d+=2)c[d>>>3]|=parseInt(a.substr(d,2),16)<<24-d%8*4;return new g.init(c,b/2)}},j=h.Latin1={stringify:function(a){var b=a.words;a=a.sigBytes;for(var c=[],d=0;d<a;d++)c.push(String.fromCharCode(b[d>>>2]>>>24-d%4*8&255));return c.join("")},parse:function(a){for(var b=a.length,c=[],d=0;d<b;d++)c[d>>>2]|=(255&a.charCodeAt(d))<<24-d%4*8;return new g.init(c,b)}},k=h.Utf8={stringify:function(a){try{return decodeURIComponent(escape(j.stringify(a)))}catch(a){throw Error("Malformed UTF-8 data")}},parse:function(a){return j.parse(unescape(encodeURIComponent(a)))}},l=d.BufferedBlockAlgorithm=f.extend({reset:function(){this._data=new g.init,this._nDataBytes=0},_append:function(a){"string"==typeof a&&(a=k.parse(a)),this._data.concat(a),this._nDataBytes+=a.sigBytes},_process:function(b){var c=this._data,d=c.words,e=c.sigBytes,f=this.blockSize,h=e/(4*f),h=b?a.ceil(h):a.max((0|h)-this._minBufferSize,0);if(b=h*f,e=a.min(4*b,e),b){for(var i=0;i<b;i+=f)this._doProcessBlock(d,i);i=d.splice(0,b),c.sigBytes-=e}return new g.init(i,e)},clone:function(){var a=f.clone.call(this);return a._data=this._data.clone(),a},_minBufferSize:0});d.Hasher=l.extend({cfg:f.extend(),init:function(a){this.cfg=this.cfg.extend(a),this.reset()},reset:function(){l.reset.call(this),this._doReset()},update:function(a){return this._append(a),this._process(),this},finalize:function(a){return a&&this._append(a),this._doFinalize()},blockSize:16,_createHelper:function(a){return function(b,c){return new a.init(c).finalize(b)}},_createHmacHelper:function(a){return function(b,c){return new m.HMAC.init(a,c).finalize(b)}}});var m=c.algo={};return c}(Math);!function(){var a=g,b=a.lib,c=b.WordArray,d=b.Hasher,e=[],b=a.algo.SHA1=d.extend({_doReset:function(){this._hash=new c.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(a,b){for(var c=this._hash.words,d=c[0],f=c[1],g=c[2],h=c[3],i=c[4],j=0;80>j;j++){if(16>j)e[j]=0|a[b+j];else{var k=e[j-3]^e[j-8]^e[j-14]^e[j-16];e[j]=k<<1|k>>>31}k=(d<<5|d>>>27)+i+e[j],k=20>j?k+(1518500249+(f&g|~f&h)):40>j?k+(1859775393+(f^g^h)):60>j?k+((f&g|f&h|g&h)-1894007588):k+((f^g^h)-899497514),i=h,h=g,g=f<<30|f>>>2,f=d,d=k}c[0]=c[0]+d|0,c[1]=c[1]+f|0,c[2]=c[2]+g|0,c[3]=c[3]+h|0,c[4]=c[4]+i|0},_doFinalize:function(){var a=this._data,b=a.words,c=8*this._nDataBytes,d=8*a.sigBytes;return b[d>>>5]|=128<<24-d%32,b[14+(d+64>>>9<<4)]=Math.floor(c/4294967296),b[15+(d+64>>>9<<4)]=c,a.sigBytes=4*b.length,this._process(),this._hash},clone:function(){var a=d.clone.call(this);return a._hash=this._hash.clone(),a}});a.SHA1=d._createHelper(b),a.HmacSHA1=d._createHmacHelper(b)}(),Object.defineProperty(c,"__esModule",{value:!0});var h,i=function(){function a(a,b){var c=[],d=!0,e=!1,f=void 0;try{for(var g,h=a[Symbol.iterator]();!(d=(g=h.next()).done)&&(c.push(g.value),!b||c.length!==b);d=!0);}catch(a){e=!0,f=a}finally{try{!d&&h.return&&h.return()}finally{if(e)throw f}}return c}return function(b,c){if(Array.isArray(b))return b;if(Symbol.iterator in Object(b))return a(b,c);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),j="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},k=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(a,d.key,d)}}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}(),l=c.SFAlertManager=function(){function a(){f(this,a)}return k(a,[{key:"alert",value:function(){function a(a){return b.apply(this,arguments)}var b=e(regeneratorRuntime.mark(function a(b){return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.abrupt("return",new Promise(function(a,c){window.alert(b.text),a()}));case 1:case"end":return a.stop()}},a,this)}));return a}()},{key:"confirm",value:function(){function a(a){return b.apply(this,arguments)}var b=e(regeneratorRuntime.mark(function a(b){return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.abrupt("return",new Promise(function(a,c){window.confirm(b.text)?a():c()}));case 1:case"end":return a.stop()}},a,this)}));return a}()}]),a}(),m=c.SFAuthManager=function(){function a(b,c,d,e){f(this,a),a.DidSignOutEvent="DidSignOutEvent",a.WillSignInEvent="WillSignInEvent",a.DidSignInEvent="DidSignInEvent",this.httpManager=c,this.storageManager=b,this.alertManager=d||new l,this.$timeout=e||setTimeout.bind(window),this.eventHandlers=[]}return k(a,[{key:"addEventHandler",value:function(a){return this.eventHandlers.push(a),a}},{key:"removeEventHandler",value:function(a){_.pull(this.eventHandlers,a)}},{key:"notifyEvent",value:function(a,b){var c=!0,d=!1,e=void 0;try{for(var f,g=this.eventHandlers[Symbol.iterator]();!(c=(f=g.next()).done);c=!0){(0,f.value)(a,b||{})}}catch(a){d=!0,e=a}finally{try{!c&&g.return&&g.return()}finally{if(d)throw e}}}},{key:"saveKeys",value:function(){function a(a){return b.apply(this,arguments)}var b=e(regeneratorRuntime.mark(function a(b){return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return this._keys=b,a.next=3,this.storageManager.setItem("mk",b.mk);case 3:return a.next=5,this.storageManager.setItem("ak",b.ak);case 5:case"end":return a.stop()}},a,this)}));return a}()},{key:"signout",value:function(){function b(a){return c.apply(this,arguments)}var c=e(regeneratorRuntime.mark(function b(c){var d=this;return regeneratorRuntime.wrap(function(b){for(;;)switch(b.prev=b.next){case 0:if(this._keys=null,this._authParams=null,!c){b.next=6;break}return b.abrupt("return",this.storageManager.clearAllData().then(function(){d.notifyEvent(a.DidSignOutEvent)}));case 6:this.notifyEvent(a.DidSignOutEvent);case 7:case"end":return b.stop()}},b,this)}));return b}()},{key:"keys",value:function(){function a(){return b.apply(this,arguments)}var b=e(regeneratorRuntime.mark(function a(){var b;return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:if(this._keys){a.next=11;break}return a.next=3,this.storageManager.getItem("mk");case 3:if(b=a.sent){a.next=6;break}return a.abrupt("return",null);case 6:return a.t0=b,a.next=9,this.storageManager.getItem("ak");case 9:a.t1=a.sent,this._keys={mk:a.t0,ak:a.t1};case 11:return a.abrupt("return",this._keys);case 12:case"end":return a.stop()}},a,this)}));return a}()},{key:"getAuthParams",value:function(){function a(){return b.apply(this,arguments)}var b=e(regeneratorRuntime.mark(function a(){var b;return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:if(this._authParams){a.next=5;break}return a.next=3,this.storageManager.getItem("auth_params");case 3:b=a.sent,this._authParams=JSON.parse(b);case 5:if(!this._authParams||this._authParams.version){a.next=9;break}return a.next=8,this.defaultProtocolVersion();case 8:this._authParams.version=a.sent;case 9:return a.abrupt("return",this._authParams);case 10:case"end":return a.stop()}},a,this)}));return a}()},{key:"defaultProtocolVersion",value:function(){function a(){return b.apply(this,arguments)}var b=e(regeneratorRuntime.mark(function a(){var b;return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,this.keys();case 2:if(!(b=a.sent)||!b.ak){a.next=7;break}return a.abrupt("return","002");case 7:return a.abrupt("return","001");case 8:case"end":return a.stop()}},a,this)}));return a}()},{key:"protocolVersion",value:function(){function a(){return b.apply(this,arguments)}var b=e(regeneratorRuntime.mark(function a(){var b;return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,this.getAuthParams();case 2:if(!(b=a.sent)||!b.version){a.next=5;break}return a.abrupt("return",b.version);case 5:return a.abrupt("return",this.defaultProtocolVersion());case 6:case"end":return a.stop()}},a,this)}));return a}()},{key:"getAuthParamsForEmail",value:function(){function a(a,c,d){return b.apply(this,arguments)}var b=e(regeneratorRuntime.mark(function a(b,c,d){var e=this;return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.abrupt("return",new Promise(function(a,f){var g=b+"/auth/params";e.httpManager.getAbsolute(g,_.merge({email:c},d),function(b){a(b)},function(b){console.error("Error getting auth params",b),"object"!==(void 0===b?"undefined":j(b))&&(b={error:{message:"A server error occurred while trying to sign in. Please try again."}}),a(b)})}));case 1:case"end":return a.stop()}},a,this)}));return a}()},{key:"login",value:function(){function b(a,b,d,e,f){return c.apply(this,arguments)}var c=e(regeneratorRuntime.mark(function b(c,d,f,g,h){var i=this;return regeneratorRuntime.wrap(function(b){for(;;)switch(b.prev=b.next){case 0:return b.abrupt("return",new Promise(function(){var b=e(regeneratorRuntime.mark(function b(k,l){var m,n,o,p,q,r,s,t,u,v,w,x;return regeneratorRuntime.wrap(function(b){for(;;)switch(b.prev=b.next){case 0:return i.notifyEvent(a.WillSignInEvent),b.next=3,i.getAuthParamsForEmail(c,d,h);case 3:if(m=b.sent,m.identifier=d,!m.error){b.next=8;break}return k(m),b.abrupt("return");case 8:if(m&&m.pw_cost){b.next=11;break}return k({error:{message:"Invalid email or password."}}),b.abrupt("return");case 11:if(SFJS.supportedVersions().includes(m.version)){b.next=15;break}return n=SFJS.isVersionNewerThanLibraryVersion(m.version)?"This version of the application does not support your newer account type. Please upgrade to the latest version of Standard Notes to sign in.":"The protocol version associated with your account is outdated and no longer supported by this application. Please visit standardnotes.org/help/security for more information.",k({error:{message:n}}),b.abrupt("return");case 15:if(!SFJS.isProtocolVersionOutdated(m.version)){b.next=22;break}return o="The encryption version for your account, "+m.version+", is outdated and requires upgrade. You may proceed with login, but are advised to perform a security update using the web or desktop application. Please visit standardnotes.org/help/security for more information.",p=!1,b.next=20,i.alertManager.confirm({title:"Update Needed",text:o,confirmButtonText:"Sign In"}).catch(function(){k({error:{}}),p=!0});case 20:if(!p){b.next=22;break}return b.abrupt("return");case 22:if(SFJS.supportsPasswordDerivationCost(m.pw_cost)){b.next=26;break}return q="Your account was created on a platform with higher security capabilities than this browser supports. If we attempted to generate your login keys here, it would take hours. Please use a browser with more up to date security capabilities, like Google Chrome or Firefox, to log in.",k({error:{message:q}}),b.abrupt("return");case 26:if(r=SFJS.costMinimumForVersion(m.version),!(m.pw_cost<r)){b.next=31;break}return s="Unable to login due to insecure password parameters. Please visit standardnotes.org/help/security for more information.",k({error:{message:s}}),b.abrupt("return");case 31:if(!g){b.next=37;break}if(t=SFJS.version(),m.version===t){b.next=37;break}return u="Strict sign in refused server sign in parameters. The latest security version is "+t+", but your account is reported to have version "+m.version+". If you'd like to proceed with sign in anyway, please disable strict sign in and try again.",k({error:{message:u}}),b.abrupt("return");case 37:return b.next=39,SFJS.crypto.computeEncryptionKeysForUser(f,m);case 39:v=b.sent,w=c+"/auth/sign_in",x=_.merge({password:v.pw,email:d},h),i.httpManager.postAbsolute(w,x,function(){var b=e(regeneratorRuntime.mark(function b(e){return regeneratorRuntime.wrap(function(b){for(;;)switch(b.prev=b.next){case 0:return i.notifyEvent(a.DidSignInEvent),b.next=3,i.handleAuthResponse(e,d,c,m,v);case 3:i.$timeout(function(){return k(e)});case 4:case"end":return b.stop()}},b,i)}));return function(a){return b.apply(this,arguments)}}(),function(a){console.error("Error logging in",a),"object"!==(void 0===a?"undefined":j(a))&&(a={error:{message:"A server error occurred while trying to sign in. Please try again."}}),i.$timeout(function(){return k(a)})});case 43:case"end":return b.stop()}},b,i)}));return function(a,c){return b.apply(this,arguments)}}()));case 1:case"end":return b.stop()}},b,this)}));return b}()},{key:"register",value:function(a,b,c){var d=this;return new Promise(function(){var f=e(regeneratorRuntime.mark(function f(g,h){var i,k,l,m,n;return regeneratorRuntime.wrap(function(f){for(;;)switch(f.prev=f.next){case 0:return f.next=2,SFJS.crypto.generateInitialKeysAndAuthParamsForUser(b,c);case 2:i=f.sent,k=i.keys,l=i.authParams,m=a+"/auth",n=_.merge({password:k.pw,email:b},l),d.httpManager.postAbsolute(m,n,function(){var c=e(regeneratorRuntime.mark(function c(e){return regeneratorRuntime.wrap(function(c){for(;;)switch(c.prev=c.next){case 0:return c.next=2,d.handleAuthResponse(e,b,a,l,k);case 2:g(e);case 3:case"end":return c.stop()}},c,d)}));return function(a){return c.apply(this,arguments)}}(),function(a){console.error("Registration error",a),"object"!==(void 0===a?"undefined":j(a))&&(a={error:{message:"A server error occurred while trying to register. Please try again."}}),g(a)});case 8:case"end":return f.stop()}},f,d)}));return function(a,b){return f.apply(this,arguments)}}())}},{key:"changePassword",value:function(){function a(a,c,d,e,f){return b.apply(this,arguments)}var b=e(regeneratorRuntime.mark(function a(b,c,d,f,g){var h=this;return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.abrupt("return",new Promise(function(){var a=e(regeneratorRuntime.mark(function a(i,k){var l,m,n;return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:l=f.pw,m=b+"/auth/change_pw",n=_.merge({new_password:l,current_password:d},g),h.httpManager.postAbsolute(m,n,function(){var a=e(regeneratorRuntime.mark(function a(b){return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,h.handleAuthResponse(b,c,null,g,f);case 2:i(b);case 3:case"end":return a.stop()}},a,h)}));return function(b){return a.apply(this,arguments)}}(),function(a){"object"!==(void 0===a?"undefined":j(a))&&(a={error:{message:"Something went wrong while changing your password. Your password was not changed. Please try again."}}),i(a)});case 4:case"end":return a.stop()}},a,h)}));return function(b,c){return a.apply(this,arguments)}}()));case 1:case"end":return a.stop()}},a,this)}));return a}()},{key:"handleAuthResponse",value:function(){function a(a,c,d,e,f){return b.apply(this,arguments)}var b=e(regeneratorRuntime.mark(function a(b,c,d,e,f){return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:if(!d){a.next=3;break}return a.next=3,this.storageManager.setItem("server",d);case 3:return this._authParams=e,a.next=6,this.storageManager.setItem("auth_params",JSON.stringify(e));case 6:return a.next=8,this.storageManager.setItem("jwt",b.token);case 8:return a.abrupt("return",this.saveKeys(f));case 9:case"end":return a.stop()}},a,this)}));return a}()}]),a}(),n="undefined"!=typeof window?window:void 0!==a?a:null,o=c.SFHttpManager=function(){function a(b){f(this,a),this.$timeout=b||setTimeout.bind(n)}return k(a,[{key:"setJWTRequestHandler",value:function(a){this.jwtRequestHandler=a}},{key:"setAuthHeadersForRequest",value:function(){function a(a){return b.apply(this,arguments)}var b=e(regeneratorRuntime.mark(function a(b){var c;return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,this.jwtRequestHandler();case 2:c=a.sent,c&&b.setRequestHeader("Authorization","Bearer "+c);case 4:case"end":return a.stop()}},a,this)}));return a}()},{key:"postAbsolute",value:function(a,b,c,d){this.httpRequest("post",a,b,c,d)}},{key:"patchAbsolute",value:function(a,b,c,d){this.httpRequest("patch",a,b,c,d)}},{key:"getAbsolute",value:function(a,b,c,d){this.httpRequest("get",a,b,c,d)}},{key:"httpRequest",value:function(){function a(a,c,d,e,f){return b.apply(this,arguments)}var b=e(regeneratorRuntime.mark(function a(b,c,d,e,f){var g;return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return g=new XMLHttpRequest,g.onreadystatechange=function(){if(4==g.readyState){var a=g.responseText;if(a)try{a=JSON.parse(a)}catch(a){}g.status>=200&&g.status<=299?this.$timeout(function(){e(a)}):(console.error("Request error:",a),this.$timeout(function(){f(a,g.status)}))}}.bind(this),"get"==b&&Object.keys(d).length>0&&(c+=this.formatParams(d)),g.open(b,c,!0),a.next=6,this.setAuthHeadersForRequest(g);case 6:g.setRequestHeader("Content-type","application/json"),"post"==b||"patch"==b?g.send(JSON.stringify(d)):g.send();case 8:case"end":return a.stop()}},a,this)}));return a}()},{key:"formatParams",value:function(a){return"?"+Object.keys(a).map(function(b){return b+"="+encodeURIComponent(a[b])}).join("&")}}]),a}(),p=c.SFMigrationManager=function(){function a(b,c,d){var g=this;f(this,a),this.modelManager=b,this.syncManager=c,this.storageManager=d,this.loadMigrations(),this.syncManager.addEventHandler(function(){var a=e(regeneratorRuntime.mark(function a(b,c){var d,e;return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:if(d="local-data-loaded"==b,e="sync:completed"==b,!d&&!e){a.next=9;break}if(d?g.receivedLocalDataEvent=!0:e&&(g.receivedSyncCompletedEvent=!0),!g.receivedLocalDataEvent||!g.receivedSyncCompletedEvent){a.next=9;break}if(!c||!c.initialSync){a.next=8;break}return a.next=8,g.clearCompletedMigrations();case 8:g.runPendingMigrations();case 9:case"end":return a.stop()}},a,g)}));return function(b,c){return a.apply(this,arguments)}}())}return k(a,[{key:"clearCompletedMigrations",value:function(){function a(){return b.apply(this,arguments)}var b=e(regeneratorRuntime.mark(function a(){var b;return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,this.getCompletedMigrations();case 2:b=a.sent,b.length=0;case 4:case"end":return a.stop()}},a,this)}));return a}()},{key:"loadMigrations",value:function(){this.migrations=this.registeredMigrations()}},{key:"registeredMigrations",value:function(){}},{key:"runPendingMigrations",value:function(){function a(){return b.apply(this,arguments)}var b=e(regeneratorRuntime.mark(function a(){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x;return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,this.getPendingMigrations();case 2:for(b=a.sent,c=!0,d=!1,e=void 0,a.prev=6,f=b[Symbol.iterator]();!(c=(g=f.next()).done);c=!0)h=g.value,h.items=[];a.next=14;break;case 10:a.prev=10,a.t0=a.catch(6),d=!0,e=a.t0;case 14:a.prev=14,a.prev=15,!c&&f.return&&f.return();case 17:if(a.prev=17,!d){a.next=20;break}throw e;case 20:return a.finish(17);case 21:return a.finish(14);case 22:i=!0,j=!1,k=void 0,a.prev=25,l=this.modelManager.allItems[Symbol.iterator]();case 27:if(i=(m=l.next()).done){a.next=51;break}for(n=m.value,o=!0,p=!1,q=void 0,a.prev=32,r=b[Symbol.iterator]();!(o=(s=r.next()).done);o=!0)h=s.value,n.content_type==h.content_type&&h.items.push(n);a.next=40;break;case 36:a.prev=36,a.t1=a.catch(32),p=!0,q=a.t1;case 40:a.prev=40,a.prev=41,!o&&r.return&&r.return();case 43:if(a.prev=43,!p){a.next=46;break}throw q;case 46:return a.finish(43);case 47:return a.finish(40);case 48:i=!0,a.next=27;break;case 51:a.next=57;break;case 53:a.prev=53,a.t2=a.catch(25),j=!0,k=a.t2;case 57:a.prev=57,a.prev=58,!i&&l.return&&l.return();case 60:if(a.prev=60,!j){a.next=63;break}throw k;case 63:return a.finish(60);case 64:return a.finish(57);case 65:for(t=!0,u=!1,v=void 0,a.prev=68,w=b[Symbol.iterator]();!(t=(x=w.next()).done);t=!0)h=x.value,h.items&&h.items.length>0?this.runMigration(h,h.items):this.markMigrationCompleted(h);a.next=76;break;case 72:a.prev=72,a.t3=a.catch(68),u=!0,v=a.t3;case 76:a.prev=76,a.prev=77,!t&&w.return&&w.return();case 79:if(a.prev=79,!u){a.next=82;break}throw v;case 82:return a.finish(79);case 83:return a.finish(76);case 84:case"end":return a.stop()}},a,this,[[6,10,14,22],[15,,17,21],[25,53,57,65],[32,36,40,48],[41,,43,47],[58,,60,64],[68,72,76,84],[77,,79,83]])}));return a}()},{key:"encode",value:function(a){return window.btoa(a)}},{key:"decode",value:function(a){return window.atob(a)}},{key:"getCompletedMigrations",value:function(){function a(){return b.apply(this,arguments)}var b=e(regeneratorRuntime.mark(function a(){var b;return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:if(this._completed){a.next=5;break}return a.next=3,this.storageManager.getItem("migrations");case 3:b=a.sent,this._completed=b?JSON.parse(b):[];case 5:return a.abrupt("return",this._completed);case 6:case"end":return a.stop()}},a,this)}));return a}()},{key:"getPendingMigrations",value:function(){function a(){return b.apply(this,arguments)}var b=e(regeneratorRuntime.mark(function a(){var b,c=this;return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,this.getCompletedMigrations();case 2:return b=a.sent,a.abrupt("return",this.migrations.filter(function(a){return-1==b.indexOf(c.encode(a.name))}));case 4:case"end":return a.stop()}},a,this)}));return a}()},{key:"markMigrationCompleted",value:function(){function a(a){return b.apply(this,arguments)}var b=e(regeneratorRuntime.mark(function a(b){var c;return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,this.getCompletedMigrations();case 2:c=a.sent,c.push(this.encode(b.name)),this.storageManager.setItem("migrations",JSON.stringify(c));case 5:case"end":return a.stop()}},a,this)}));return a}()},{key:"runMigration",value:function(){function a(a,c){return b.apply(this,arguments)}var b=e(regeneratorRuntime.mark(function a(b,c){return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:console.log("Running migration:",b.name),b.handler(c),this.markMigrationCompleted(b);case 3:case"end":return a.stop()}},a,this)}));return a}()}]),a}(),q=c.SFModelManager=function(){function a(b){f(this,a),a.MappingSourceRemoteRetrieved="MappingSourceRemoteRetrieved",a.MappingSourceRemoteSaved="MappingSourceRemoteSaved",a.MappingSourceLocalSaved="MappingSourceLocalSaved",a.MappingSourceLocalRetrieved="MappingSourceLocalRetrieved",
a.MappingSourceComponentRetrieved="MappingSourceComponentRetrieved",a.MappingSourceDesktopInstalled="MappingSourceDesktopInstalled",a.MappingSourceRemoteActionRetrieved="MappingSourceRemoteActionRetrieved",a.MappingSourceFileImport="MappingSourceFileImport",a.isMappingSourceRetrieved=function(b){return[a.MappingSourceRemoteRetrieved,a.MappingSourceComponentRetrieved,a.MappingSourceRemoteActionRetrieved].includes(b)},this.$timeout=b||setTimeout.bind(window),this.itemSyncObservers=[],this.itemsPendingRemoval=[],this.items=[],this.itemsHash={},this.missedReferences={}}return k(a,[{key:"handleSignout",value:function(){this.items.length=0,this.itemsHash={},this.itemsPendingRemoval.length=0,this.missedReferences={}}},{key:"alternateUUIDForItem",value:function(){function b(a){return c.apply(this,arguments)}var c=e(regeneratorRuntime.mark(function b(c){var d;return regeneratorRuntime.wrap(function(b){for(;;)switch(b.prev=b.next){case 0:return d=this.createItem(c),b.next=3,SFJS.crypto.generateUUID();case 3:return d.uuid=b.sent,d.informReferencesOfUUIDChange(c.uuid,d.uuid),this.informModelsOfUUIDChangeForItem(d,c.uuid,d.uuid),console.log(c.uuid,"--\x3e",d.uuid),c.deleted=!0,c.content.references=[],c.setDirty(!1),this.mapResponseItemsToLocalModels([c],a.MappingSourceLocalSaved),this.addItem(d),d.setDirty(!0),this.resolveReferencesForItem(d),b.abrupt("return",d);case 15:case"end":return b.stop()}},b,this)}));return b}()},{key:"informModelsOfUUIDChangeForItem",value:function(a,b,c){var d=!0,e=!1,f=void 0;try{for(var g,h=this.items[Symbol.iterator]();!(d=(g=h.next()).done);d=!0){g.value.potentialItemOfInterestHasChangedItsUUID(a,b,c)}}catch(a){e=!0,f=a}finally{try{!d&&h.return&&h.return()}finally{if(e)throw f}}}},{key:"didSyncModelsOffline",value:function(b){this.notifySyncObserversOfModels(b,a.MappingSourceLocalSaved)}},{key:"mapResponseItemsToLocalModels",value:function(a,b,c){return this.mapResponseItemsToLocalModelsOmittingFields(a,null,b,c)}},{key:"mapResponseItemsToLocalModelsOmittingFields",value:function(a,b,c,d){var e=[],f=[],g=[],h=!0,j=!1,k=void 0;try{for(var l,m=a[Symbol.iterator]();!(h=(l=m.next()).done);h=!0){var n=l.value;if(n)if(n.content_type&&n.content&&n.uuid||n.deleted||n.errorDecrypting){if(Array.isArray(b)){var o=!0,p=!1,q=void 0;try{for(var r,s=b[Symbol.iterator]();!(o=(r=s.next()).done);o=!0){var t=r.value;delete n[t]}}catch(a){p=!0,q=a}finally{try{!o&&s.return&&s.return()}finally{if(p)throw q}}}var u=this.findItem(n.uuid);if(u&&(u.updateFromJSON(n),u.dummy=!1),this.itemsPendingRemoval.includes(n.uuid))_.pull(this.itemsPendingRemoval,n.uuid);else{var v=n.content_type||u&&u.content_type,w=this.acceptableContentTypes&&!this.acceptableContentTypes.includes(v);if(!w){var x=!1;if(1==n.deleted){if(!n.dirty){u&&(g.push(u),this.removeItemLocally(u));continue}x=!0}u||(u=this.createItem(n,!0)),this.addItem(u,x),u.errorDecrypting||g.push(u),e.push(u),f.push(n)}}}else console.error("Server response item is corrupt:",n)}}catch(a){j=!0,k=a}finally{try{!h&&m.return&&m.return()}finally{if(j)throw k}}var y=!0,z=!1,A=void 0;try{for(var B,C=f.entries()[Symbol.iterator]();!(y=(B=C.next()).done);y=!0){var D=B.value,E=i(D,2),F=E[0],G=E[1],H=e[F];G.content&&this.resolveReferencesForItem(H);var I=this.popMissedReferenceStructsForObject(G),J=!0,K=!1,L=void 0;try{for(var M,N=I[Symbol.iterator]();!(J=(M=N.next()).done);J=!0){var O=M.value;this.resolveReferencesForItem(O.for_item)}}catch(a){K=!0,L=a}finally{try{!J&&N.return&&N.return()}finally{if(K)throw L}}H.didFinishSyncing()}}catch(a){z=!0,A=a}finally{try{!y&&C.return&&C.return()}finally{if(z)throw A}}return this.notifySyncObserversOfModels(g,c,d),e}},{key:"missedReferenceBuildKey",value:function(a,b){return a+":"+b}},{key:"popMissedReferenceStructsForObject",value:function(a){var b=[],c=[],d=!0,e=!1,f=void 0;try{for(var g,h=Object.keys(this.missedReferences)[Symbol.iterator]();!(d=(g=h.next()).done);d=!0){var i=g.value;i.split(":")[0]==a.uuid&&(b.push(this.missedReferences[i]),c.push(i))}}catch(a){e=!0,f=a}finally{try{!d&&h.return&&h.return()}finally{if(e)throw f}}var j=!0,k=!1,l=void 0;try{for(var m,n=c[Symbol.iterator]();!(j=(m=n.next()).done);j=!0){var o=m.value;delete this.missedReferences[o]}}catch(a){k=!0,l=a}finally{try{!j&&n.return&&n.return()}finally{if(k)throw l}}return b}},{key:"resolveReferencesForItem",value:function(a){var b=arguments.length>1&&void 0!==arguments[1]&&arguments[1],c=a.contentObject;if(a.updateLocalRelationships(),c.references){var d=c.references.slice(),e=d.map(function(a){return a.uuid}),f=this.findItems(e,!0),g=!0,h=!1,j=void 0;try{for(var k,l=f.entries()[Symbol.iterator]();!(g=(k=l.next()).done);g=!0){var m=k.value,n=i(m,2),o=n[0],p=n[1];if(p)a.addItemAsRelationship(p),b&&p.setDirty(!0);else{var q=e[o],r=this.missedReferenceBuildKey(q,a.uuid);if(!this.missedReferences[r]){var s={reference_uuid:q,for_item:a};this.missedReferences[r]=s}}}}catch(a){h=!0,j=a}finally{try{!g&&l.return&&l.return()}finally{if(h)throw j}}}}},{key:"notifySyncObserversOfModels",value:function(a,b,c){var d=this,e=!0,f=!1,g=void 0;try{for(var h,i=this.itemSyncObservers[Symbol.iterator]();!(e=(h=i.next()).done);e=!0){var j,k,l,m=h.value;!function(e){j=e.types.includes("*")?a:a.filter(function(a){return e.types.includes(a.content_type)}),k=[],l=[];var f=!0,g=!1,h=void 0;try{for(var i,m=j[Symbol.iterator]();!(f=(i=m.next()).done);f=!0){var n=i.value;n.deleted?l.push(n):k.push(n)}}catch(a){g=!0,h=a}finally{try{!f&&m.return&&m.return()}finally{if(g)throw h}}j.length>0&&d._callSyncObserverCallbackWithTimeout(e,j,k,l,b,c)}(m)}}catch(a){f=!0,g=a}finally{try{!e&&i.return&&i.return()}finally{if(f)throw g}}}},{key:"_callSyncObserverCallbackWithTimeout",value:function(a,b,c,d,e,f){this.$timeout(function(){a.callback(b,c,d,e,f)})}},{key:"createItem",value:function(b,c){var d=a.ContentTypeClassMapping&&a.ContentTypeClassMapping[b.content_type];d||(d=u);var e=new d(b);return c||this.notifySyncObserversOfModels([e],a.MappingSourceLocalSaved),e}},{key:"createDuplicateItem",value:function(a){return this.createItem(a,!0)}},{key:"addDuplicatedItem",value:function(a,b){this.addItem(a);var c=!0,d=!1,e=void 0;try{for(var f,g=b.referencingObjects[Symbol.iterator]();!(c=(f=g.next()).done);c=!0){var h=f.value;h.addItemAsRelationship(a),h.setDirty(!0)}}catch(a){d=!0,e=a}finally{try{!c&&g.return&&g.return()}finally{if(d)throw e}}this.resolveReferencesForItem(a),a.conflict_of=b.uuid,a.setDirty(!0)}},{key:"addItem",value:function(a){var b=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.addItems([a],b)}},{key:"addItems",value:function(a){var b=this;arguments.length>1&&void 0!==arguments[1]&&arguments[1];a.forEach(function(a){b.itemsHash[a.uuid]||(b.itemsHash[a.uuid]=a,b.items.push(a))})}},{key:"addItemSyncObserver",value:function(a,b,c){Array.isArray(b)||(b=[b]),this.itemSyncObservers.push({id:a,types:b,callback:c})}},{key:"removeItemSyncObserver",value:function(a){_.remove(this.itemSyncObservers,_.find(this.itemSyncObservers,{id:a}))}},{key:"getDirtyItems",value:function(){return this.items.filter(function(a){return 1==a.dirty&&!a.dummy&&(!a.errorDecrypting||a.deleted)})}},{key:"clearDirtyItems",value:function(a){var b=!0,c=!1,d=void 0;try{for(var e,f=a[Symbol.iterator]();!(b=(e=f.next()).done);b=!0){e.value.setDirty(!1)}}catch(a){c=!0,d=a}finally{try{!b&&f.return&&f.return()}finally{if(c)throw d}}}},{key:"setItemToBeDeleted",value:function(a){a.deleted=!0,a.dummy||a.setDirty(!0),this.removeAndDirtyAllRelationshipsForItem(a)}},{key:"removeAndDirtyAllRelationshipsForItem",value:function(a){var b=!0,c=!1,d=void 0;try{for(var e,f=a.content.references[Symbol.iterator]();!(b=(e=f.next()).done);b=!0){var g=e.value,h=this.findItem(g.uuid);h&&(a.removeItemAsRelationship(h),h.hasRelationshipWithItem(a)&&(h.removeItemAsRelationship(a),h.setDirty(!0)))}}catch(a){c=!0,d=a}finally{try{!b&&f.return&&f.return()}finally{if(c)throw d}}var i=!0,j=!1,k=void 0;try{for(var l,m=a.referencingObjects[Symbol.iterator]();!(i=(l=m.next()).done);i=!0){var n=l.value;n.removeItemAsRelationship(a),n.setDirty(!0)}}catch(a){j=!0,k=a}finally{try{!i&&m.return&&m.return()}finally{if(j)throw k}}a.referencingObjects=[]}},{key:"setAllItemsDirty",value:function(){var a=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],b=this.allItems,c=!0,d=!1,e=void 0;try{for(var f,g=b[Symbol.iterator]();!(c=(f=g.next()).done);c=!0){f.value.setDirty(!0,a)}}catch(a){d=!0,e=a}finally{try{!c&&g.return&&g.return()}finally{if(d)throw e}}}},{key:"removeItemLocally",value:function(a,b){_.remove(this.items,{uuid:a.uuid}),delete this.itemsHash[a.uuid],a.isBeingRemovedLocally(),this.itemsPendingRemoval.push(a.uuid)}},{key:"allItemsMatchingTypes",value:function(a){return this.allItems.filter(function(b){return(_.includes(a,b.content_type)||_.includes(a,"*"))&&!b.dummy})}},{key:"invalidItems",value:function(){return this.allItems.filter(function(a){return a.errorDecrypting})}},{key:"validItemsForContentType",value:function(a){return this.allItems.filter(function(b){return b.content_type==a&&!b.errorDecrypting})}},{key:"findItem",value:function(a){return this.itemsHash[a]}},{key:"findItems",value:function(a){var b=arguments.length>1&&void 0!==arguments[1]&&arguments[1],c=[],d=!0,e=!1,f=void 0;try{for(var g,h=a[Symbol.iterator]();!(d=(g=h.next()).done);d=!0){var i=g.value,j=this.itemsHash[i];(j||b)&&c.push(j)}}catch(a){e=!0,f=a}finally{try{!d&&h.return&&h.return()}finally{if(e)throw f}}return c}},{key:"itemsMatchingPredicate",value:function(a){return this.itemsMatchingPredicates([a])}},{key:"itemsMatchingPredicates",value:function(a){return this.filterItemsWithPredicates(this.allItems,a)}},{key:"filterItemsWithPredicates",value:function(a,b){return a.filter(function(a){var c=!0,d=!1,e=void 0;try{for(var f,g=b[Symbol.iterator]();!(c=(f=g.next()).done);c=!0){var h=f.value;if(!a.satisfiesPredicate(h))return!1}}catch(a){d=!0,e=a}finally{try{!c&&g.return&&g.return()}finally{if(d)throw e}}return!0})}},{key:"importItems",value:function(b){var c=[],d=!0,e=!1,f=void 0;try{for(var g,h=b[Symbol.iterator]();!(d=(g=h.next()).done);d=!0){var i=g.value,j=this.findItem(i.uuid);if(j&&!j.errorDecrypting){i.uuid=null;var k=this.createDuplicateItem(i);i.deleted||j.isItemContentEqualWith(k)||(this.addDuplicatedItem(k,j),c.push(k))}else c.push(i),j&&j.errorDecrypting&&(j.errorDecrypting=!1)}}catch(a){e=!0,f=a}finally{try{!d&&h.return&&h.return()}finally{if(e)throw f}}var l=this.mapResponseItemsToLocalModels(c,a.MappingSourceFileImport),m=!0,n=!1,o=void 0;try{for(var p,q=l[Symbol.iterator]();!(m=(p=q.next()).done);m=!0){var r=p.value;r.setDirty(!0,!0),r.deleted=!1}}catch(a){n=!0,o=a}finally{try{!m&&q.return&&q.return()}finally{if(n)throw o}}return l}},{key:"getAllItemsJSONData",value:function(){function a(a,c,d){return b.apply(this,arguments)}var b=e(regeneratorRuntime.mark(function a(b,c,d){return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.abrupt("return",Promise.all(this.allItems.map(function(a){return new v(a,b,c).paramsForExportFile()})).then(function(a){if(d&&0==a.length)return null;var e={items:a};return b&&(e.auth_params=c),JSON.stringify(e,null,2)}));case 1:case"end":return a.stop()}},a,this)}));return a}()},{key:"allItems",get:function(){return this.items.filter(function(a){return!a.dummy})}}]),a}(),r=c.SFSessionHistoryManager=function(){function a(b,c,d,e,g){var h=this;f(this,a),this.modelManager=b,this.storageManager=c,this.$timeout=g||setTimeout.bind(window),this.keyRequestHandler=d,this.loadFromDisk().then(function(){h.modelManager.addItemSyncObserver("session-history",e,function(a,b,c,d,e){var f=!0,g=!1,i=void 0;try{for(var j,k=a[Symbol.iterator]();!(f=(j=k.next()).done);f=!0){var l=j.value;try{h.addHistoryEntryForItem(l)}catch(a){console.log("Caught exception while trying to add item history entry",a)}}}catch(a){g=!0,i=a}finally{try{!f&&k.return&&k.return()}finally{if(g)throw i}}})})}return k(a,[{key:"encryptionParams",value:function(){function a(){return b.apply(this,arguments)}var b=e(regeneratorRuntime.mark(function a(){return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.abrupt("return",this.keyRequestHandler());case 1:case"end":return a.stop()}},a,this)}));return a}()},{key:"addHistoryEntryForItem",value:function(a){var b=this,c={uuid:a.uuid,content_type:a.content_type,updated_at:a.updated_at,content:a.content},d=this.historySession.addEntryForItem(c);this.autoOptimize&&this.historySession.optimizeHistoryForItem(a),d&&this.diskEnabled&&(this.diskTimeout&&(this.$timeout.hasOwnProperty("cancel")?this.$timeout.cancel(this.diskTimeout):clearTimeout(this.diskTimeout)),this.diskTimeout=this.$timeout(function(){b.saveToDisk()},2e3))}},{key:"historyForItem",value:function(a){return this.historySession.historyForItem(a)}},{key:"clearHistoryForItem",value:function(){function a(a){return b.apply(this,arguments)}var b=e(regeneratorRuntime.mark(function a(b){return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return this.historySession.clearItemHistory(b),a.abrupt("return",this.saveToDisk());case 2:case"end":return a.stop()}},a,this)}));return a}()},{key:"clearAllHistory",value:function(){function a(){return b.apply(this,arguments)}var b=e(regeneratorRuntime.mark(function a(){return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return this.historySession.clearAllHistory(),a.abrupt("return",this.storageManager.removeItem("sessionHistory_revisions"));case 2:case"end":return a.stop()}},a,this)}));return a}()},{key:"toggleDiskSaving",value:function(){function a(){return b.apply(this,arguments)}var b=e(regeneratorRuntime.mark(function a(){return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:if(this.diskEnabled=!this.diskEnabled,!this.diskEnabled){a.next=6;break}this.storageManager.setItem("sessionHistory_persist",JSON.stringify(!0)),this.saveToDisk(),a.next=8;break;case 6:return this.storageManager.setItem("sessionHistory_persist",JSON.stringify(!1)),a.abrupt("return",this.storageManager.removeItem("sessionHistory_revisions"));case 8:case"end":return a.stop()}},a,this)}));return a}()},{key:"saveToDisk",value:function(){function a(){return b.apply(this,arguments)}var b=e(regeneratorRuntime.mark(function a(){var b,c,d=this;return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:if(this.diskEnabled){a.next=2;break}return a.abrupt("return");case 2:return a.next=4,this.encryptionParams();case 4:b=a.sent,c=new v(this.historySession,b.keys,b.auth_params),c.paramsForSync().then(function(a){d.storageManager.setItem("sessionHistory_revisions",JSON.stringify(a))});case 7:case"end":return a.stop()}},a,this)}));return a}()},{key:"loadFromDisk",value:function(){function a(){return b.apply(this,arguments)}var b=e(regeneratorRuntime.mark(function a(){var b,c,d,e,f;return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,this.storageManager.getItem("sessionHistory_persist");case 2:return b=a.sent,b&&(this.diskEnabled=JSON.parse(b)),a.next=6,this.storageManager.getItem("sessionHistory_revisions");case 6:if(!(c=a.sent)){a.next=18;break}return c=JSON.parse(c),a.next=11,this.encryptionParams();case 11:return d=a.sent,a.next=14,SFJS.itemTransformer.decryptItem(c,d.keys);case 14:e=new x(c),this.historySession=e,a.next=19;break;case 18:this.historySession=new x;case 19:return a.next=21,this.storageManager.getItem("sessionHistory_autoOptimize");case 21:f=a.sent,this.autoOptimize=!f||JSON.parse(f);case 23:case"end":return a.stop()}},a,this)}));return a}()},{key:"toggleAutoOptimize",value:function(){function a(){return b.apply(this,arguments)}var b=e(regeneratorRuntime.mark(function a(){return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:this.autoOptimize=!this.autoOptimize,this.autoOptimize?this.storageManager.setItem("sessionHistory_autoOptimize",JSON.stringify(!0)):this.storageManager.setItem("sessionHistory_autoOptimize",JSON.stringify(!1));case 2:case"end":return a.stop()}},a,this)}));return a}()}]),a}(),s=c.SFStorageManager=function(){function a(){f(this,a)}return k(a,[{key:"setItem",value:function(){function a(a,c){return b.apply(this,arguments)}var b=e(regeneratorRuntime.mark(function a(b,c){return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:case"end":return a.stop()}},a,this)}));return a}()},{key:"getItem",value:function(){function a(a){return b.apply(this,arguments)}var b=e(regeneratorRuntime.mark(function a(b){return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:case"end":return a.stop()}},a,this)}));return a}()},{key:"removeItem",value:function(){function a(a){return b.apply(this,arguments)}var b=e(regeneratorRuntime.mark(function a(b){return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:case"end":return a.stop()}},a,this)}));return a}()},{key:"clear",value:function(){function a(){return b.apply(this,arguments)}var b=e(regeneratorRuntime.mark(function a(){return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:case"end":return a.stop()}},a,this)}));return a}()},{key:"getAllModels",value:function(){function a(){return b.apply(this,arguments)}var b=e(regeneratorRuntime.mark(function a(){return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:case"end":return a.stop()}},a,this)}));return a}()},{key:"saveModel",value:function(){function a(a){return b.apply(this,arguments)}var b=e(regeneratorRuntime.mark(function a(b){return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.abrupt("return",this.saveModels([b]));case 1:case"end":return a.stop()}},a,this)}));return a}()},{key:"saveModels",value:function(){function a(a){return b.apply(this,arguments)}var b=e(regeneratorRuntime.mark(function a(b){return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:case"end":return a.stop()}},a,this)}));return a}()},{key:"deleteModel",value:function(){function a(a){return b.apply(this,arguments)}var b=e(regeneratorRuntime.mark(function a(b){return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:case"end":return a.stop()}},a,this)}));return a}()},{key:"clearAllModels",value:function(){function a(){return b.apply(this,arguments)}var b=e(regeneratorRuntime.mark(function a(){return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:case"end":return a.stop()}},a,this)}));return a}()},{key:"clearAllData",value:function(){function a(){return b.apply(this,arguments)}var b=e(regeneratorRuntime.mark(function a(){return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.abrupt("return",Promise.all([this.clear(),this.clearAllModels()]));case 1:case"end":return a.stop()}},a,this)}));return a}()}]),a}(),t=c.SFSyncManager=function(){function a(b,c,d,e,g){f(this,a),a.KeyRequestLoadLocal="KeyRequestLoadLocal",a.KeyRequestSaveLocal="KeyRequestSaveLocal",a.KeyRequestLoadSaveAccount="KeyRequestLoadSaveAccount",this.httpManager=d,this.modelManager=b,this.storageManager=c,this.$interval=g||setInterval.bind(window),this.$timeout=e||setTimeout.bind(window),this.syncStatus={},this.syncStatusObservers=[],this.eventHandlers=[]}return k(a,[{key:"getServerURL",value:function(){function a(){return b.apply(this,arguments)}var b=e(regeneratorRuntime.mark(function a(){return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,this.storageManager.getItem("server");case 2:if(a.t0=a.sent,a.t0){a.next=5;break}a.t0=window._default_sf_server;case 5:return a.abrupt("return",a.t0);case 6:case"end":return a.stop()}},a,this)}));return a}()},{key:"getSyncURL",value:function(){function a(){return b.apply(this,arguments)}var b=e(regeneratorRuntime.mark(function a(){return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,this.getServerURL();case 2:return a.t0=a.sent,a.abrupt("return",a.t0+"/items/sync");case 4:case"end":return a.stop()}},a,this)}));return a}()},{key:"registerSyncStatusObserver",value:function(a){var b={key:new Date,callback:a};return this.syncStatusObservers.push(b),b}},{key:"removeSyncStatusObserver",value:function(a){_.pull(this.syncStatusObservers,a)}},{key:"syncStatusDidChange",value:function(){var a=this;this.syncStatusObservers.forEach(function(b){b.callback(a.syncStatus)})}},{key:"addEventHandler",value:function(a){return this.eventHandlers.push(a),a}},{key:"removeEventHandler",value:function(a){_.pull(this.eventHandlers,a)}},{key:"notifyEvent",value:function(a,b){var c=!0,d=!1,e=void 0;try{for(var f,g=this.eventHandlers[Symbol.iterator]();!(c=(f=g.next()).done);c=!0){(0,f.value)(a,b||{})}}catch(a){d=!0,e=a}finally{try{!c&&g.return&&g.return()}finally{if(d)throw e}}}},{key:"setKeyRequestHandler",value:function(a){this.keyRequestHandler=a}},{key:"getActiveKeyInfo",value:function(){function a(a){return b.apply(this,arguments)}var b=e(regeneratorRuntime.mark(function a(b){return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.abrupt("return",this.keyRequestHandler(b));case 1:case"end":return a.stop()}},a,this)}));return a}()},{key:"initialDataLoaded",value:function(){return this._initialDataLoaded}},{key:"loadLocalItems",value:function(){function b(a){return c.apply(this,arguments)}var c=e(regeneratorRuntime.mark(function b(c){var d=this,f=arguments.length>1&&void 0!==arguments[1]?arguments[1]:100;return regeneratorRuntime.wrap(function(b){for(;;)switch(b.prev=b.next){case 0:return b.abrupt("return",this.storageManager.getAllModels().then(function(b){var g=b.length,h=0,i=[],j=function(){var k=e(regeneratorRuntime.mark(function e(){var k,l;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return k=b.slice(h,h+f),e.next=3,d.handleItemsResponse(k,null,q.MappingSourceLocalRetrieved,a.KeyRequestLoadLocal);case 3:if(l=e.sent,i.push(l),!((h+=k.length)<g)){e.next=10;break}return e.abrupt("return",new Promise(function(a,b){d.$timeout(function(){c&&c(h,g),j().then(a)})}));case 10:d.notifyEvent("local-data-loaded"),d._initialDataLoaded=!0;case 12:case"end":return e.stop()}},e,d)}));return function(){return k.apply(this,arguments)}}();return j()}));case 1:case"end":return b.stop()}},b,this)}));return b}()},{key:"writeItemsToLocalStorage",value:function(){function b(a,b){return c.apply(this,arguments)}var c=e(regeneratorRuntime.mark(function b(c,d){var f=this;return regeneratorRuntime.wrap(function(b){for(;;)switch(b.prev=b.next){case 0:return b.abrupt("return",new Promise(function(){var b=e(regeneratorRuntime.mark(function b(g,h){var i;return regeneratorRuntime.wrap(function(b){for(;;)switch(b.prev=b.next){case 0:if(0!=c.length){b.next=3;break}return g(),b.abrupt("return");case 3:return b.next=5,f.getActiveKeyInfo(a.KeyRequestSaveLocal);case 5:i=b.sent,Promise.all(c.map(function(){var a=e(regeneratorRuntime.mark(function a(b){var c;return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return c=new v(b,i.keys,i.auth_params),a.next=3,c.paramsForLocalStorage();case 3:return c=a.sent,d&&delete c.dirty,a.abrupt("return",c);case 6:case"end":return a.stop()}},a,f)}));return function(b){return a.apply(this,arguments)}}())).then(function(a){f.storageManager.saveModels(a).then(function(){f.syncStatus.localError&&(f.syncStatus.localError=null,f.syncStatusDidChange()),g()}).catch(function(a){console.error("Error writing items",a),f.syncStatus.localError=a,f.syncStatusDidChange(),h()})}).catch(function(a){h(a)});case 7:case"end":return b.stop()}},b,f)}));return function(a,c){return b.apply(this,arguments)}}()));case 1:case"end":return b.stop()}},b,this)}));return b}()},{key:"syncOffline",value:function(){function a(a){return b.apply(this,arguments)}var b=e(regeneratorRuntime.mark(function a(b){var c,d,e,f,g,h,i=this;return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:for(c=!0,d=!1,e=void 0,a.prev=3,f=b[Symbol.iterator]();!(c=(g=f.next()).done);c=!0)h=g.value,h.updated_at=new Date;a.next=11;break;case 7:a.prev=7,a.t0=a.catch(3),d=!0,e=a.t0;case 11:a.prev=11,a.prev=12,!c&&f.return&&f.return();case 14:if(a.prev=14,!d){a.next=17;break}throw e;case 17:return a.finish(14);case 18:return a.finish(11);case 19:return a.abrupt("return",this.writeItemsToLocalStorage(b,!0).then(function(a){var c=!0,d=!1,e=void 0;try{for(var f,g=b[Symbol.iterator]();!(c=(f=g.next()).done);c=!0){var h=f.value;h.deleted&&i.modelManager.removeItemLocally(h)}}catch(a){d=!0,e=a}finally{try{!c&&g.return&&g.return()}finally{if(d)throw e}}return i.notifyEvent("sync:completed"),i.modelManager.didSyncModelsOffline(b),{saved_items:b}}));case 20:case"end":return a.stop()}},a,this,[[3,7,11,19],[12,,14,18]])}));return a}()},{key:"markAllItemsDirtyAndSaveOffline",value:function(){function a(a){return b.apply(this,arguments)}var b=e(regeneratorRuntime.mark(function a(b){var c,d,e,f,g,h,i,j,k,l,m,n,o;return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:if(c=this.modelManager.allItems.filter(function(a){return!a.errorDecrypting}).slice(),!b){a.next=28;break}d=!0,e=!1,f=void 0,a.prev=5,g=c[Symbol.iterator]();case 7:if(d=(h=g.next()).done){a.next=14;break}return i=h.value,a.next=11,this.modelManager.alternateUUIDForItem(i);case 11:d=!0,a.next=7;break;case 14:a.next=20;break;case 16:a.prev=16,a.t0=a.catch(5),e=!0,f=a.t0;case 20:a.prev=20,a.prev=21,!d&&g.return&&g.return();case 23:if(a.prev=23,!e){a.next=26;break}throw f;case 26:return a.finish(23);case 27:return a.finish(20);case 28:for(j=this.modelManager.allItems,k=!0,l=!1,m=void 0,a.prev=32,n=j[Symbol.iterator]();!(k=(o=n.next()).done);k=!0)i=o.value,i.setDirty(!0);a.next=40;break;case 36:a.prev=36,a.t1=a.catch(32),l=!0,m=a.t1;case 40:a.prev=40,a.prev=41,!k&&n.return&&n.return();case 43:if(a.prev=43,!l){a.next=46;break}throw m;case 46:return a.finish(43);case 47:return a.finish(40);case 48:return a.abrupt("return",this.writeItemsToLocalStorage(j,!1));case 49:case"end":return a.stop()}},a,this,[[5,16,20,28],[21,,23,27],[32,36,40,48],[41,,43,47]])}));return a}()},{key:"setSyncToken",value:function(){function a(a){return b.apply(this,arguments)}var b=e(regeneratorRuntime.mark(function a(b){return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return this._syncToken=b,a.next=3,this.storageManager.setItem("syncToken",b);case 3:case"end":return a.stop()}},a,this)}));return a}()},{key:"getSyncToken",value:function(){function a(){return b.apply(this,arguments)}var b=e(regeneratorRuntime.mark(function a(){return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:if(this._syncToken){a.next=4;break}return a.next=3,this.storageManager.getItem("syncToken");case 3:this._syncToken=a.sent;case 4:return a.abrupt("return",this._syncToken);case 5:case"end":return a.stop()}},a,this)}));return a}()},{key:"setCursorToken",value:function(){function a(a){return b.apply(this,arguments)}var b=e(regeneratorRuntime.mark(function a(b){return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:if(this._cursorToken=b,!b){a.next=6;break}return a.next=4,this.storageManager.setItem("cursorToken",b);case 4:a.next=8;break;case 6:return a.next=8,this.storageManager.removeItem("cursorToken");case 8:case"end":return a.stop()}},a,this)}));return a}()},{key:"getCursorToken",value:function(){function a(){return b.apply(this,arguments)}var b=e(regeneratorRuntime.mark(function a(){return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:if(this._cursorToken){a.next=4;break}return a.next=3,this.storageManager.getItem("cursorToken");case 3:this._cursorToken=a.sent;case 4:return a.abrupt("return",this._cursorToken);case 5:case"end":return a.stop()}},a,this)}));return a}()},{key:"clearQueuedCallbacks",value:function(){this._queuedCallbacks=[]}},{key:"callQueuedCallbacks",value:function(a){var b=this.queuedCallbacks;if(b.length){var c=!0,d=!1,e=void 0;try{for(var f,g=b[Symbol.iterator]();!(c=(f=g.next()).done);c=!0){(0,f.value)(a)}}catch(a){d=!0,e=a}finally{try{!c&&g.return&&g.return()}finally{if(d)throw e}}this.clearQueuedCallbacks()}}},{key:"beginCheckingIfSyncIsTakingTooLong",value:function(){this.syncStatus.checker&&this.stopCheckingIfSyncIsTakingTooLong(),this.syncStatus.checker=this.$interval(function(){(new Date-this.syncStatus.syncStart)/1e3>5&&(this.notifyEvent("sync:taking-too-long"),this.stopCheckingIfSyncIsTakingTooLong())}.bind(this),500)}},{key:"stopCheckingIfSyncIsTakingTooLong",value:function(){this.$interval.hasOwnProperty("cancel")?this.$interval.cancel(this.syncStatus.checker):clearInterval(this.syncStatus.checker),this.syncStatus.checker=null}},{key:"lockSyncing",value:function(){this.syncLocked=!0}},{key:"unlockSyncing",value:function(){this.syncLocked=!1}},{key:"sync",value:function(){function b(){return c.apply(this,arguments)}var c=e(regeneratorRuntime.mark(function b(){var c=this,d=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return regeneratorRuntime.wrap(function(b){for(;;)switch(b.prev=b.next){case 0:return b.abrupt("return",new Promise(function(){var b=e(regeneratorRuntime.mark(function b(e,f){var g,h,i,j,k,l,m,n,o,p,q,r;return regeneratorRuntime.wrap(function(b){for(;;)switch(b.prev=b.next){case 0:if(!c.syncLocked){b.next=4;break}return console.log("Sync Locked, Returning;"),e(),b.abrupt("return");case 4:if(d||(d={}),g=c.modelManager.getDirtyItems(),!c.syncStatus.syncOpInProgress||d.force){b.next=12;break}return c.repeatOnCompletion=!0,c.queuedCallbacks.push(e),c.writeItemsToLocalStorage(g,!1),console.log("Sync op in progress; returning."),b.abrupt("return");case 12:return b.next=14,c.getActiveKeyInfo(a.KeyRequestLoadSaveAccount);case 14:if(h=b.sent,!h.offline){b.next=18;break}return c.syncOffline(g).then(function(a){c.modelManager.clearDirtyItems(g),e(a)}).catch(function(a){c.notifyEvent("sync-exception",a)}),b.abrupt("return");case 18:return i=c.syncStatus.needsMoreSync,c.syncStatus.syncOpInProgress=!0,c.syncStatus.syncStart=new Date,c.beginCheckingIfSyncIsTakingTooLong(),j=100,k=g.slice(0,j),k.length<g.length?c.syncStatus.needsMoreSync=!0:c.syncStatus.needsMoreSync=!1,i||(c.syncStatus.total=g.length,c.syncStatus.current=0),c.syncStatus.current>c.syncStatus.total&&(c.syncStatus.total=c.syncStatus.current),c.syncStatusDidChange(),c.allRetreivedItems||(c.allRetreivedItems=[]),c.allSavedItems||(c.allSavedItems=[]),l={},l.limit=150,b.prev=32,b.next=35,Promise.all(k.map(function(a){var b=new v(a,h.keys,h.auth_params);return b.additionalFields=d.additionalFields,b.paramsForSync()})).then(function(a){l.items=a});case 35:b.next=40;break;case 37:b.prev=37,b.t0=b.catch(32),c.notifyEvent("sync-exception",b.t0);case 40:for(m=!0,n=!1,o=void 0,b.prev=43,p=k[Symbol.iterator]();!(m=(q=p.next()).done);m=!0)r=q.value,r.dirtyCount=0;b.next=51;break;case 47:b.prev=47,b.t1=b.catch(43),n=!0,o=b.t1;case 51:b.prev=51,b.prev=52,!m&&p.return&&p.return();case 54:if(b.prev=54,!n){b.next=57;break}throw o;case 57:return b.finish(54);case 58:return b.finish(51);case 59:return b.next=61,c.getSyncToken();case 61:return l.sync_token=b.sent,b.next=64,c.getCursorToken();case 64:return l.cursor_token=b.sent,b.prev=65,b.t2=c.httpManager,b.next=69,c.getSyncURL();case 69:b.t3=b.sent,b.t4=l,b.t5=function(a){try{c.handleSyncSuccess(k,a,d).then(function(){e(a)})}catch(a){console.log("Caught sync success exception:",a)}},b.t6=function(a,b){c.handleSyncError(a,b,g).then(function(a){e(a)})},b.t2.postAbsolute.call(b.t2,b.t3,b.t4,b.t5,b.t6),b.next=79;break;case 76:b.prev=76,b.t7=b.catch(65),console.log("Sync exception caught:",b.t7);case 79:case"end":return b.stop()}},b,c,[[32,37],[43,47,51,59],[52,,54,58],[65,76]])}));return function(a,c){return b.apply(this,arguments)}}()));case 1:case"end":return b.stop()}},b,this)}));return b}()},{key:"handleSyncSuccess",value:function(){function b(a,b,d){return c.apply(this,arguments)}var c=e(regeneratorRuntime.mark(function b(c,d,e){
var f,g,h,i,j,k,l,m,n,o,p,r,s,t,u=this;return regeneratorRuntime.wrap(function(b){for(;;)switch(b.prev=b.next){case 0:for(f=[],g=!0,h=!1,i=void 0,b.prev=4,j=c[Symbol.iterator]();!(g=(k=j.next()).done);g=!0)l=k.value,0==l.dirtyCount&&f.push(l);b.next=12;break;case 8:b.prev=8,b.t0=b.catch(4),h=!0,i=b.t0;case 12:b.prev=12,b.prev=13,!g&&j.return&&j.return();case 15:if(b.prev=15,!h){b.next=18;break}throw i;case 18:return b.finish(15);case 19:return b.finish(12);case 20:return this.modelManager.clearDirtyItems(f),this.syncStatus.error=null,m=this.allSavedItems.map(function(a){return a.uuid}),d.retrieved_items=d.retrieved_items.filter(function(a){return!m.includes(a.uuid)}),b.next=26,this.handleItemsResponse(d.retrieved_items,null,q.MappingSourceRemoteRetrieved,a.KeyRequestLoadSaveAccount);case 26:return n=b.sent,this.allRetreivedItems=this.allRetreivedItems.concat(n),this.syncStatus.retrievedCount=this.allRetreivedItems.length,o=["content","auth_hash"],b.next=32,this.handleItemsResponse(d.saved_items,o,q.MappingSourceRemoteSaved,a.KeyRequestLoadSaveAccount);case 32:return p=b.sent,this.allSavedItems=this.allSavedItems.concat(p),r=d.unsaved,this.handleUnsavedItemsResponse(r),b.next=38,this.writeItemsToLocalStorage(p,!1);case 38:return this.syncStatus.syncOpInProgress=!1,this.syncStatus.current+=c.length,this.syncStatusDidChange(),b.next=43,this.getSyncToken();case 43:return b.t1=b.sent,s=null==b.t1,this.setSyncToken(d.sync_token),this.setCursorToken(d.cursor_token),this.stopCheckingIfSyncIsTakingTooLong(),b.next=50,this.getCursorToken();case 50:if(b.t2=b.sent,b.t2){b.next=53;break}b.t2=this.syncStatus.needsMoreSync;case 53:if(!b.t2){b.next=57;break}return b.abrupt("return",new Promise(function(a,b){setTimeout(function(){this.sync(e).then(a)}.bind(u),10)}));case 57:if(!this.repeatOnCompletion){b.next=62;break}return this.repeatOnCompletion=!1,b.abrupt("return",new Promise(function(a,b){setTimeout(function(){this.sync(e).then(a)}.bind(u),10)}));case 62:return b.next=64,this.writeItemsToLocalStorage(this.allRetreivedItems,!1);case 64:return this.syncStatus.retrievedCount=0,this.syncStatusDidChange(),t=10,(this.allRetreivedItems.length>=t||p.length>=t||r.length>=t)&&this.notifyEvent("major-data-change"),this.callQueuedCallbacks(d),this.notifyEvent("sync:completed",{retrievedItems:this.allRetreivedItems,savedItems:this.allSavedItems,unsavedItems:r,initialSync:s}),this.allRetreivedItems=[],this.allSavedItems=[],b.abrupt("return",d);case 73:case"end":return b.stop()}},b,this,[[4,8,12,20],[13,,15,19]])}));return b}()},{key:"handleSyncError",value:function(){function a(a,c,d){return b.apply(this,arguments)}var b=e(regeneratorRuntime.mark(function a(b,c,d){return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return console.log("Sync error",b),401==c&&this.notifyEvent("sync-session-invalid"),console.log("Sync error: ",b),b||(b={error:{message:"Could not connect to server."}}),this.syncStatus.syncOpInProgress=!1,this.syncStatus.error=b.error,this.syncStatusDidChange(),this.writeItemsToLocalStorage(d,!1),this.modelManager.didSyncModelsOffline(d),this.stopCheckingIfSyncIsTakingTooLong(),this.notifyEvent("sync:error",b.error),this.callQueuedCallbacks({error:"Sync error"}),a.abrupt("return",b);case 13:case"end":return a.stop()}},a,this)}));return a}()},{key:"handleItemsResponse",value:function(){function a(a,c,d,e){return b.apply(this,arguments)}var b=e(regeneratorRuntime.mark(function a(b,c,d,e){var f,g,h;return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,this.getActiveKeyInfo(e);case 2:return f=a.sent.keys,a.next=5,SFJS.itemTransformer.decryptMultipleItems(b,f);case 5:return g=this.modelManager.mapResponseItemsToLocalModelsOmittingFields(b,c,d),h=g.filter(function(a){var b=a.errorDecryptingValueChanged;return a.errorDecryptingValueChanged=!1,b}),h.length>0&&this.writeItemsToLocalStorage(h,!1),a.abrupt("return",g);case 9:case"end":return a.stop()}},a,this)}));return a}()},{key:"refreshErroredItems",value:function(){function b(){return c.apply(this,arguments)}var c=e(regeneratorRuntime.mark(function b(){var c;return regeneratorRuntime.wrap(function(b){for(;;)switch(b.prev=b.next){case 0:if(c=this.modelManager.allItems.filter(function(a){return 1==a.errorDecrypting}),!(c.length>0)){b.next=3;break}return b.abrupt("return",this.handleItemsResponse(c,null,q.MappingSourceLocalRetrieved,a.KeyRequestLoadSaveAccount));case 3:case"end":return b.stop()}},b,this)}));return b}()},{key:"handleUnsavedItemsResponse",value:function(){function b(a){return c.apply(this,arguments)}var c=e(regeneratorRuntime.mark(function b(c){var d,e,f,g,h,i,j,k,l,m;return regeneratorRuntime.wrap(function(b){for(;;)switch(b.prev=b.next){case 0:if(0!=c.length){b.next=2;break}return b.abrupt("return");case 2:console.log("Handle Conflicted Items:",c),d=!0,e=!1,f=void 0,b.prev=6,g=c[Symbol.iterator]();case 8:if(d=(h=g.next()).done){b.next=36;break}return i=h.value,j=i.item,b.t0=SFJS.itemTransformer,b.t1=[j],b.next=15,this.getActiveKeyInfo(a.KeyRequestLoadSaveAccount);case 15:return b.t2=b.sent.keys,b.next=18,b.t0.decryptMultipleItems.call(b.t0,b.t1,b.t2);case 18:if(k=this.modelManager.findItem(j.uuid)){b.next=21;break}return b.abrupt("continue",33);case 21:if(l=i.error,"uuid_conflict"!==l.tag){b.next=27;break}return b.next=25,this.modelManager.alternateUUIDForItem(k);case 25:b.next=33;break;case 27:if("sync_conflict"!==l.tag){b.next=33;break}return b.next=30,SFJS.crypto.generateUUID();case 30:j.uuid=b.sent,m=this.modelManager.createDuplicateItem(j),j.deleted||k.isItemContentEqualWith(m)||this.modelManager.addDuplicatedItem(m,k);case 33:d=!0,b.next=8;break;case 36:b.next=42;break;case 38:b.prev=38,b.t3=b.catch(6),e=!0,f=b.t3;case 42:b.prev=42,b.prev=43,!d&&g.return&&g.return();case 45:if(b.prev=45,!e){b.next=48;break}throw f;case 48:return b.finish(45);case 49:return b.finish(42);case 50:this.sync(null,{additionalFields:["created_at","updated_at"]});case 51:case"end":return b.stop()}},b,this,[[6,38,42,50],[43,,45,49]])}));return b}()},{key:"handleSignout",value:function(){function a(){return b.apply(this,arguments)}var b=e(regeneratorRuntime.mark(function a(){return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:this._syncToken=null,this._cursorToken=null,this._queuedCallbacks=[],this.syncStatus={};case 4:case"end":return a.stop()}},a,this)}));return a}()},{key:"clearSyncToken",value:function(){function a(){return b.apply(this,arguments)}var b=e(regeneratorRuntime.mark(function a(){return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return this._syncToken=null,this._cursorToken=null,a.abrupt("return",this.storageManager.removeItem("syncToken"));case 3:case"end":return a.stop()}},a,this)}));return a}()},{key:"queuedCallbacks",get:function(){return this._queuedCallbacks||(this._queuedCallbacks=[]),this._queuedCallbacks}}]),a}(),u=c.SFItem=function(){function a(){var b=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};f(this,a),this.appData={},this.content={},this.referencingObjects=[],this.updateFromJSON(b),this.uuid||"undefined"!=typeof SFJS&&SFJS.crypto.generateUUIDSync&&(this.uuid=SFJS.crypto.generateUUIDSync()),this.content.references||(this.content.references=[])}return k(a,[{key:"updateFromJSON",value:function(b){this.created_at=b.created_at,this.updated_at=b.updated_at,this.deleted=b.deleted,this.uuid=b.uuid,this.enc_item_key=b.enc_item_key,this.auth_hash=b.auth_hash,this.auth_params=b.auth_params;var c=["errorDecrypting","conflict_of","dirty","dirtyCount"],d=!0,e=!1,f=void 0;try{for(var g,h=c[Symbol.iterator]();!(d=(g=h.next()).done);d=!0){var i=g.value;void 0!==b[i]&&(this[i]=b[i])}}catch(a){e=!0,f=a}finally{try{!d&&h.return&&h.return()}finally{if(e)throw f}}this.content_type||(this.content_type=b.content_type);try{var j="string"==typeof b.content?JSON.parse(b.content):b.content;a.deepMerge(this.contentObject,j)}catch(a){console.log("Error while updating item from json",a)}this.created_at?(this.created_at=new Date(this.created_at),this.updated_at=new Date(this.updated_at)):(this.created_at=new Date,this.updated_at=new Date),this._client_updated_at=null,b.content?this.mapContentToLocalProperties(this.contentObject):1==b.deleted&&this.handleDeletedContent()}},{key:"mapContentToLocalProperties",value:function(a){a.appData&&(this.appData=a.appData),this.appData||(this.appData={})}},{key:"createContentJSONFromProperties",value:function(){return this.structureParams()}},{key:"structureParams",value:function(){var a=this.contentObject;return a.appData=this.appData,a}},{key:"handleDeletedContent",value:function(){}},{key:"setDirty",value:function(a,b){this.dirty=a,this.dirtyCount||(this.dirtyCount=0),a?this.dirtyCount++:this.dirtyCount=0,a&&!b?this.client_updated_at=new Date:this.hasRawClientUpdatedAtValue()||(this.client_updated_at=new Date(this.updated_at))}},{key:"updateLocalRelationships",value:function(){}},{key:"addItemAsRelationship",value:function(a){if(a.setIsBeingReferencedBy(this),!this.hasRelationshipWithItem(a)){var b=this.content.references||[];b.push({uuid:a.uuid,content_type:a.content_type}),this.content.references=b}}},{key:"removeItemAsRelationship",value:function(a){a.setIsNoLongerBeingReferencedBy(this),this.removeReferenceWithUuid(a.uuid)}},{key:"setIsBeingReferencedBy",value:function(a){_.find(this.referencingObjects,{uuid:a.uuid})||this.referencingObjects.push(a)}},{key:"setIsNoLongerBeingReferencedBy",value:function(a){_.remove(this.referencingObjects,{uuid:a.uuid}),this.hasRelationshipWithItem(a)&&(this.removeReferenceWithUuid(a.uuid),this.setDirty(!0))}},{key:"removeReferenceWithUuid",value:function(a){var b=this.content.references||[];b=b.filter(function(b){return b.uuid!=a}),this.content.references=b}},{key:"hasRelationshipWithItem",value:function(a){return null!=this.content.references.find(function(b){return b.uuid==a.uuid})}},{key:"isBeingRemovedLocally",value:function(){}},{key:"didFinishSyncing",value:function(){}},{key:"informReferencesOfUUIDChange",value:function(a,b){}},{key:"potentialItemOfInterestHasChangedItsUUID",value:function(a,b,c){var d=!0,e=!1,f=void 0;try{for(var g,h=this.content.references[Symbol.iterator]();!(d=(g=h.next()).done);d=!0){var i=g.value;i.uuid==b&&(i.uuid=c,this.setDirty(!0))}}catch(a){e=!0,f=a}finally{try{!d&&h.return&&h.return()}finally{if(e)throw f}}}},{key:"doNotEncrypt",value:function(){return!1}},{key:"setDomainDataItem",value:function(a,b,c){if(!c)return void console.error("SFItem.AppDomain needs to be set.");var d=this.appData[c];d||(d={}),d[a]=b,this.appData[c]=d}},{key:"getDomainDataItem",value:function(a,b){if(!b)return void console.error("SFItem.AppDomain needs to be set.");var c=this.appData[b];return c?c[a]:null}},{key:"setAppDataItem",value:function(b,c){this.setDomainDataItem(b,c,a.AppDomain)}},{key:"getAppDataItem",value:function(b){return this.getDomainDataItem(b,a.AppDomain)}},{key:"hasRawClientUpdatedAtValue",value:function(){return null!=this.getAppDataItem("client_updated_at")}},{key:"keysToIgnoreWhenCheckingContentEquality",value:function(){return[]}},{key:"appDataKeysToIgnoreWhenCheckingContentEquality",value:function(){return["client_updated_at"]}},{key:"isItemContentEqualWith",value:function(b){var c=function(a,b){if(!a)return a;var c=!0,d=!1,e=void 0;try{for(var f,g=b[Symbol.iterator]();!(c=(f=g.next()).done);c=!0){delete a[f.value]}}catch(a){d=!0,e=a}finally{try{!c&&g.return&&g.return()}finally{if(d)throw e}}return a},d=this.structureParams();d.appData[a.AppDomain]=c(d.appData[a.AppDomain],this.appDataKeysToIgnoreWhenCheckingContentEquality()),d=c(d,this.keysToIgnoreWhenCheckingContentEquality());var e=b.structureParams();return e.appData[a.AppDomain]=c(e.appData[a.AppDomain],b.appDataKeysToIgnoreWhenCheckingContentEquality()),e=c(e,b.keysToIgnoreWhenCheckingContentEquality()),JSON.stringify(d)===JSON.stringify(e)}},{key:"satisfiesPredicate",value:function(a){return w.ItemSatisfiesPredicate(this,a)}},{key:"createdAtString",value:function(){return this.dateToLocalizedString(this.created_at)}},{key:"updatedAtString",value:function(){return this.dateToLocalizedString(this.client_updated_at)}},{key:"dateToLocalizedString",value:function(a){if("undefined"!=typeof Intl&&Intl.DateTimeFormat){if(!h){var b=navigator.languages&&navigator.languages.length?navigator.languages[0]:navigator.language;h=new Intl.DateTimeFormat(b,{year:"numeric",month:"short",day:"2-digit",weekday:"long",hour:"2-digit",minute:"2-digit"})}return h.format(a)}return a.toDateString()+" "+a.toLocaleTimeString()}},{key:"contentObject",get:function(){if(!this.content)return this.content={},this.content;if(null!==this.content&&"object"===j(this.content))return this.content;try{var a=JSON.parse(this.content);return this.content=a,this.content}catch(a){return console.log("Error parsing json",a,this),this.content={},this.content}}},{key:"pinned",get:function(){return this.getAppDataItem("pinned")}},{key:"archived",get:function(){return this.getAppDataItem("archived")}},{key:"locked",get:function(){return this.getAppDataItem("locked")}},{key:"displayName",get:function(){return"Item"}},{key:"client_updated_at",get:function(){if(!this._client_updated_at){var a=this.getAppDataItem("client_updated_at");this._client_updated_at=a?new Date(a):new Date(this.updated_at)}return this._client_updated_at},set:function(a){this._client_updated_at=a,this.setAppDataItem("client_updated_at",a)}}],[{key:"sortItemsByDate",value:function(a){a.sort(function(a,b){return new Date(b.created_at)-new Date(a.created_at)})}},{key:"deepMerge",value:function(a,b){function c(a,b){if(_.isArray(a))return b}return _.mergeWith(a,b,c),a}}]),a}(),v=c.SFItemParams=function(){function a(b,c,d){if(f(this,a),this.item=b,this.keys=c,this.auth_params=d,this.keys&&!this.auth_params)throw"SFItemParams.auth_params must be supplied if supplying keys.";if(this.auth_params&&!this.auth_params.version)throw"SFItemParams.auth_params is missing version"}return k(a,[{key:"paramsForExportFile",value:function(){function a(a){return b.apply(this,arguments)}var b=e(regeneratorRuntime.mark(function a(b){var c;return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:if(this.additionalFields=["updated_at"],this.forExportFile=!0,!b){a.next=6;break}return a.abrupt("return",this.__params());case 6:return a.next=8,this.__params();case 8:return c=a.sent,a.abrupt("return",_.omit(c,["deleted"]));case 10:case"end":return a.stop()}},a,this)}));return a}()},{key:"paramsForExtension",value:function(){function a(){return b.apply(this,arguments)}var b=e(regeneratorRuntime.mark(function a(){return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.abrupt("return",this.paramsForExportFile());case 1:case"end":return a.stop()}},a,this)}));return a}()},{key:"paramsForLocalStorage",value:function(){function a(){return b.apply(this,arguments)}var b=e(regeneratorRuntime.mark(function a(){return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return this.additionalFields=["updated_at","dirty","errorDecrypting"],this.forExportFile=!0,a.abrupt("return",this.__params());case 3:case"end":return a.stop()}},a,this)}));return a}()},{key:"paramsForSync",value:function(){function a(){return b.apply(this,arguments)}var b=e(regeneratorRuntime.mark(function a(){return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.abrupt("return",this.__params());case 1:case"end":return a.stop()}},a,this)}));return a}()},{key:"__params",value:function(){function a(){return b.apply(this,arguments)}var b=e(regeneratorRuntime.mark(function a(){var b,c,d;return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:if(b={uuid:this.item.uuid,content_type:this.item.content_type,deleted:this.item.deleted,created_at:this.item.created_at},this.item.errorDecrypting){a.next=23;break}if(c=this.item.doNotEncrypt()&&!this.forExportFile,!this.keys||c){a.next=11;break}return a.next=6,SFJS.itemTransformer.encryptItem(this.item,this.keys,this.auth_params);case 6:d=a.sent,_.merge(b,d),"001"!==this.auth_params.version&&(b.auth_hash=null),a.next=21;break;case 11:if(!this.forExportFile){a.next=15;break}a.t0=this.item.createContentJSONFromProperties(),a.next=19;break;case 15:return a.next=17,SFJS.crypto.base64(JSON.stringify(this.item.createContentJSONFromProperties()));case 17:a.t1=a.sent,a.t0="000"+a.t1;case 19:b.content=a.t0,this.forExportFile||(b.enc_item_key=null,b.auth_hash=null);case 21:a.next=26;break;case 23:b.content=this.item.content,b.enc_item_key=this.item.enc_item_key,b.auth_hash=this.item.auth_hash;case 26:return this.additionalFields&&_.merge(b,_.pick(this.item,this.additionalFields)),a.abrupt("return",b);case 28:case"end":return a.stop()}},a,this)}));return a}()}]),a}(),w=c.SFPredicate=function(){function a(b,c,d){f(this,a),this.keypath=b,this.operator=c,this.value=d}return k(a,null,[{key:"fromArray",value:function(b){var c=new a;return c.keypath=b[0],c.operator=b[1],c.value=b[2],c}},{key:"ObjectSatisfiesPredicate",value:function(a,b){var c=b.keypath.split(".").reduce(function(a,b){return a&&a[b]},a),d=b.value;"string"==typeof d&&d.includes(".ago")&&(d=this.DateFromString(d));var e=[!1,"",null,void 0,NaN];if(void 0==c)return e.includes(b.value);if("="==b.operator)return Array.isArray(c)?JSON.stringify(c)==JSON.stringify(d):c==d;if("<"==b.operator)return c<d;if(">"==b.operator)return c>d;if("<="==b.operator)return c<=d;if(">="==b.operator)return c>=d;if("startsWith"==b.operator)return c.startsWith(d);if("in"==b.operator)return-1!=d.indexOf(c);if("includes"==b.operator)return this.resolveIncludesPredicate(c,d);if("matches"==b.operator){return new RegExp(d).test(c)}return!1}},{key:"resolveIncludesPredicate",value:function(b,c){if("string"==typeof c)return b.includes(c);var d;d=Array.isArray(c)?a.fromArray(c):c;var e=!0,f=!1,g=void 0;try{for(var h,i=b[Symbol.iterator]();!(e=(h=i.next()).done);e=!0){var j=h.value;if(this.ObjectSatisfiesPredicate(j,d))return!0}}catch(a){f=!0,g=a}finally{try{!e&&i.return&&i.return()}finally{if(f)throw g}}return!1}},{key:"ItemSatisfiesPredicate",value:function(b,c){return Array.isArray(c)&&(c=a.fromArray(c)),this.ObjectSatisfiesPredicate(b,c)}},{key:"DateFromString",value:function(a){var b=a.split("."),c=b[1],d=new Date,e=parseInt(b[0]);return"days"==c?d.setDate(d.getDate()-e):"hours"==c&&d.setHours(d.getHours()-e),d}}]),a}(),x=c.SFHistorySession=function(a){function c(a){f(this,c);var d=b(this,(c.__proto__||Object.getPrototypeOf(c)).call(this,a));return d.content.itemUUIDToItemHistoryMapping||(d.content.itemUUIDToItemHistoryMapping={}),Object.keys(d.content.itemUUIDToItemHistoryMapping).forEach(function(a){var b=d.content.itemUUIDToItemHistoryMapping[a];d.content.itemUUIDToItemHistoryMapping[a]=new y(b)}),d}return d(c,a),k(c,[{key:"addEntryForItem",value:function(a){return this.historyForItem(a).addHistoryEntryForItem(a)}},{key:"historyForItem",value:function(a){var b=this.content.itemUUIDToItemHistoryMapping[a.uuid];return b||(b=this.content.itemUUIDToItemHistoryMapping[a.uuid]=new y),b}},{key:"clearItemHistory",value:function(a){this.historyForItem(a).clear()}},{key:"clearAllHistory",value:function(){this.content.itemUUIDToItemHistoryMapping={}}},{key:"optimizeHistoryForItem",value:function(a){var b=this.historyForItem(a);b.entries.length>c.LargeItemEntryAmountThreshold&&b.optimize()}}]),c}(u);x.LargeItemEntryAmountThreshold=60;var y=c.SFItemHistory=function(){function a(){var b=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(f(this,a),this.entries||(this.entries=[]),b.entries){var c=!0,d=!1,e=void 0;try{for(var g,h=b.entries[Symbol.iterator]();!(c=(g=h.next()).done);c=!0){var i=g.value,j=this.createEntryForItem(i.item);j.setPreviousEntry(this.getLastEntry()),this.entries.push(j)}}catch(a){d=!0,e=a}finally{try{!c&&h.return&&h.return()}finally{if(d)throw e}}}}return k(a,[{key:"createEntryForItem",value:function(b){var c=a.HistoryEntryClassMapping&&a.HistoryEntryClassMapping[b.content_type];return c||(c=z),new c(b)}},{key:"getLastEntry",value:function(){return this.entries[this.entries.length-1]}},{key:"addHistoryEntryForItem",value:function(a){var b=this.createEntryForItem(a),c=this.getLastEntry();if(b.setPreviousEntry(c),!b.isSameAsEntry(c))return this.entries.push(b),b}},{key:"clear",value:function(){this.entries.length=0}},{key:"optimize",value:function(){var b=this,c=[],d=function(b){return b.deltaSize()>a.LargeEntryDeltaThreshold},e=function(a,e,f){if(f)c.push(a);else{var e=c.indexOf(a);-1!==e&&c.splice(e,1)}if(f&&d(a)&&-1==a.operationVector()){var g=b.entries[e-1];g&&c.push(g)}};this.entries.forEach(function(a,c){if(0==c||c==b.entries.length-1)e(a,c,!0);else{var f=d(a);e(a,c,f)}}),this.entries=this.entries.filter(function(a,b){return-1!==c.indexOf(a)})}}]),a}();y.LargeEntryDeltaThreshold=15;var z=c.SFItemHistoryEntry=function(){function a(b){f(this,a),this.item=u.deepMerge({},b),this.defaultContentKeyToDiffOn="text",this.textCharDiffLength=0,"string"==typeof this.item.updated_at&&(this.item.updated_at=new Date(this.item.updated_at))}return k(a,[{key:"setPreviousEntry",value:function(a){this.hasPreviousEntry=null!=a,this.item.content[this.defaultContentKeyToDiffOn]&&(this.textCharDiffLength=a?this.item.content[this.defaultContentKeyToDiffOn].length-a.item.content[this.defaultContentKeyToDiffOn].length:this.item.content[this.defaultContentKeyToDiffOn].length)}},{key:"operationVector",value:function(){return void 0!=this.textCharDiffLength?this.hasPreviousEntry&&0!=this.textCharDiffLength?this.textCharDiffLength<0?-1:1:0:1}},{key:"deltaSize",value:function(){return void 0!=this.textCharDiffLength?Math.abs(this.textCharDiffLength):1}},{key:"isSameAsEntry",value:function(a){if(!a)return!1;var b=new u(this.item),c=new u(a.item);return b.isItemContentEqualWith(c)}}]),a}(),n="undefined"!=typeof window?window:void 0!==a?a:null,A=c.SFAbstractCrypto=function(){function a(){f(this,a),this.DefaultPBKDF2Length=768}return k(a,[{key:"generateUUIDSync",value:function(){var a=n.crypto||n.msCrypto;if(a){var b=new Uint32Array(4);a.getRandomValues(b);var c=-1;return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(a){c++;var d=b[c>>3]>>c%8*4&15;return("x"==a?d:3&d|8).toString(16)})}var d=(new Date).getTime();return n.performance&&"function"==typeof n.performance.now&&(d+=performance.now()),"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(a){var b=(d+16*Math.random())%16|0;return d=Math.floor(d/16),("x"==a?b:3&b|8).toString(16)})}},{key:"generateUUID",value:function(){function a(){return b.apply(this,arguments)}var b=e(regeneratorRuntime.mark(function a(){return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.abrupt("return",this.generateUUIDSync());case 1:case"end":return a.stop()}},a,this)}));return a}()},{key:"decryptText",value:function(){function a(){return b.apply(this,arguments)}var b=e(regeneratorRuntime.mark(function a(){var b,c,d,e,f=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},h=f.ciphertextToAuth,i=f.contentCiphertext,j=f.encryptionKey,k=f.iv,l=f.authHash,m=f.authKey,n=arguments[1];return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:if(!n||l){a.next=3;break}return console.error("Auth hash is required."),a.abrupt("return");case 3:if(!l){a.next=10;break}return a.next=6,this.hmac256(h,m);case 6:if(b=a.sent,l===b){a.next=10;break}return console.error("Auth hash does not match, returning null."),a.abrupt("return",null);case 10:return c=g.enc.Hex.parse(j),d=g.enc.Hex.parse(k||""),e=g.AES.decrypt(i,c,{iv:d,mode:g.mode.CBC,padding:g.pad.Pkcs7}),a.abrupt("return",e.toString(g.enc.Utf8));case 14:case"end":return a.stop()}},a,this)}));return a}()},{key:"encryptText",value:function(){function a(a,c,d){return b.apply(this,arguments)}var b=e(regeneratorRuntime.mark(function a(b,c,d){var e,f,h;return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return e=g.enc.Hex.parse(c),f=g.enc.Hex.parse(d||""),h=g.AES.encrypt(b,e,{iv:f,mode:g.mode.CBC,padding:g.pad.Pkcs7}),a.abrupt("return",h.toString());case 4:case"end":return a.stop()}},a,this)}));return a}()},{key:"generateRandomKey",value:function(){function a(a){return b.apply(this,arguments)}var b=e(regeneratorRuntime.mark(function a(b){return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.abrupt("return",g.lib.WordArray.random(b/8).toString());case 1:case"end":return a.stop()}},a,this)}));return a}()},{key:"generateItemEncryptionKey",value:function(){function a(){return b.apply(this,arguments)}var b=e(regeneratorRuntime.mark(function a(){var b,c,d,e;return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return b=512,c=1,a.next=4,this.generateRandomKey(b);case 4:return d=a.sent,a.next=7,this.generateRandomKey(b);case 7:return e=a.sent,a.abrupt("return",this.pbkdf2(e,d,c,b));case 9:case"end":return a.stop()}},a,this)}));return a}()},{key:"firstHalfOfKey",value:function(){function a(a){return b.apply(this,arguments)}var b=e(regeneratorRuntime.mark(function a(b){return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.abrupt("return",b.substring(0,b.length/2));case 1:case"end":return a.stop()}},a,this)}));return a}()},{key:"secondHalfOfKey",value:function(){function a(a){return b.apply(this,arguments)}var b=e(regeneratorRuntime.mark(function a(b){return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.abrupt("return",b.substring(b.length/2,b.length));case 1:case"end":return a.stop()}},a,this)}));return a}()},{key:"base64",value:function(){function a(a){return b.apply(this,arguments)}var b=e(regeneratorRuntime.mark(function a(b){return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.abrupt("return",n.btoa(encodeURIComponent(b).replace(/%([0-9A-F]{2})/g,function(a,b){return String.fromCharCode("0x"+b)})));case 1:case"end":return a.stop()}},a,this)}));return a}()},{key:"base64Decode",value:function(){function a(a){return b.apply(this,arguments)}var b=e(regeneratorRuntime.mark(function a(b){return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.abrupt("return",n.atob(b));case 1:case"end":return a.stop()}},a,this)}));return a}()},{key:"sha256",value:function(){function a(a){return b.apply(this,arguments)}var b=e(regeneratorRuntime.mark(function a(b){return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.abrupt("return",g.SHA256(b).toString());case 1:case"end":return a.stop()}},a,this)}));return a}()},{key:"hmac256",value:function(){function a(a,c){return b.apply(this,arguments)}var b=e(regeneratorRuntime.mark(function a(b,c){var d,e,f;return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return d=g.enc.Hex.parse(c),e=g.enc.Utf8.parse(b),f=g.HmacSHA256(e,d).toString(),a.abrupt("return",f);case 4:case"end":return a.stop()}},a,this)}));return a}()},{key:"generateSalt",value:function(){function a(a,c,d,e){return b.apply(this,arguments)}var b=e(regeneratorRuntime.mark(function a(b,c,d,e){var f;return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,this.sha256([b,"SF",c,d,e].join(":"));case 2:return f=a.sent,a.abrupt("return",f);case 4:case"end":return a.stop()}},a,this)}));return a}()},{key:"generateSymmetricKeyPair",value:function(){function a(){return b.apply(this,arguments)}var b=e(regeneratorRuntime.mark(function a(){var b,c,d,e,f,g,h=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=h.password,j=h.pw_salt,k=h.pw_cost;return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,this.pbkdf2(i,j,k,this.DefaultPBKDF2Length);case 2:return b=a.sent,c=b.length,d=c/3,e=b.slice(0,d),f=b.slice(d,2*d),g=b.slice(2*d,3*d),a.abrupt("return",[e,f,g]);case 9:case"end":return a.stop()}},a,this)}));return a}()},{key:"computeEncryptionKeysForUser",value:function(){function a(a,c){return b.apply(this,arguments)}var b=e(regeneratorRuntime.mark(function a(b,c){var d;return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:if("003"!=c.version){a.next=9;break}if(c.identifier){a.next=4;break}return console.error("authParams is missing identifier."),a.abrupt("return");case 4:return a.next=6,this.generateSalt(c.identifier,c.version,c.pw_cost,c.pw_nonce);case 6:d=a.sent,a.next=10;break;case 9:d=c.pw_salt;case 10:return a.abrupt("return",this.generateSymmetricKeyPair({password:b,pw_salt:d,pw_cost:c.pw_cost}).then(function(a){return{pw:a[0],mk:a[1],ak:a[2]}}));case 11:case"end":return a.stop()}},a,this)}));return a}()},{key:"generateInitialKeysAndAuthParamsForUser",value:function(){function a(a,c){return b.apply(this,arguments)}var b=e(regeneratorRuntime.mark(function a(b,c){var d,e,f,g;return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return d=this.SFJS.version,e=this.SFJS.defaultPasswordGenerationCost,a.next=4,this.generateRandomKey(256);case 4:return f=a.sent,a.next=7,this.generateSalt(b,d,e,f);case 7:return g=a.sent,a.abrupt("return",this.generateSymmetricKeyPair({password:c,pw_salt:g,pw_cost:e}).then(function(a){var c={pw_nonce:f,pw_cost:e,identifier:b,version:d};return{keys:{pw:a[0],mk:a[1],ak:a[2]},authParams:c}}));case 9:case"end":return a.stop()}},a,this)}));return a}()}]),a}(),B=c.SFCryptoJS=function(a){function c(){return f(this,c),b(this,(c.__proto__||Object.getPrototypeOf(c)).apply(this,arguments))}return d(c,a),k(c,[{key:"pbkdf2",value:function(){function a(a,c,d,e){return b.apply(this,arguments)}var b=e(regeneratorRuntime.mark(function a(b,c,d,e){var f;return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return f={keySize:e/32,hasher:g.algo.SHA512,iterations:d},a.abrupt("return",g.PBKDF2(b,c,f).toString());case 2:case"end":return a.stop()}},a,this)}));return a}()}]),c}(A),n="undefined"!=typeof window?window:void 0!==a?a:null,C=n.crypto?n.crypto.subtle:null,D=c.SFCryptoWeb=function(a){function c(){return f(this,c),b(this,(c.__proto__||Object.getPrototypeOf(c)).apply(this,arguments))}return d(c,a),k(c,[{key:"pbkdf2",value:function(){function a(a,c,d,e){return b.apply(this,arguments)}var b=e(regeneratorRuntime.mark(function a(b,c,d,e){var f;return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,this.webCryptoImportKey(b,"PBKDF2",["deriveBits"]);case 2:if(f=a.sent){a.next=6;break}return console.log("Key is null, unable to continue"),a.abrupt("return",null);case 6:return a.abrupt("return",this.webCryptoDeriveBits(f,c,d,e));case 7:case"end":return a.stop()}},a,this)}));return a}()},{key:"generateRandomKey",value:function(){function a(a){return b.apply(this,arguments)}var b=e(regeneratorRuntime.mark(function a(b){var c,d=this;return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return c=!0,a.abrupt("return",C.generateKey({name:"AES-CBC",length:b},c,["encrypt","decrypt"]).then(function(a){return C.exportKey("raw",a).then(function(){var a=e(regeneratorRuntime.mark(function a(b){var c;return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,d.arrayBufferToHexString(new Uint8Array(b));case 2:return c=a.sent,a.abrupt("return",c);case 4:case"end":return a.stop()}},a,d)}));return function(b){return a.apply(this,arguments)}}()).catch(function(a){console.error("Error exporting key",a)})}).catch(function(a){console.error("Error generating key",a)}));case 2:case"end":return a.stop()}},a,this)}));return a}()},{key:"generateItemEncryptionKey",value:function(){function a(){return b.apply(this,arguments)}var b=e(regeneratorRuntime.mark(function a(){var b;return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return b=256,a.abrupt("return",Promise.all([this.generateRandomKey(b),this.generateRandomKey(b)]).then(function(a){return a.join("")}));case 2:case"end":return a.stop()}},a,this)}))
;return a}()},{key:"encryptText",value:function(){function a(a,c,d){return b.apply(this,arguments)}var b=e(regeneratorRuntime.mark(function a(b,c,d){var f,g,h,i,j,k=this;return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,this.hexStringToArrayBuffer(d);case 2:return f=a.sent,g={name:"AES-CBC",iv:f},a.next=6,this.hexStringToArrayBuffer(c);case 6:return h=a.sent,a.next=9,this.webCryptoImportKey(h,g.name,["encrypt"]);case 9:return i=a.sent,a.next=12,this.stringToArrayBuffer(b);case 12:return j=a.sent,a.abrupt("return",crypto.subtle.encrypt(g,i,j).then(function(){var a=e(regeneratorRuntime.mark(function a(b){var c;return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,k.arrayBufferToBase64(b);case 2:return c=a.sent,a.abrupt("return",c);case 4:case"end":return a.stop()}},a,k)}));return function(b){return a.apply(this,arguments)}}()));case 14:case"end":return a.stop()}},a,this)}));return a}()},{key:"decryptText",value:function(){function a(){return b.apply(this,arguments)}var b=e(regeneratorRuntime.mark(function a(){var b,c,d,f,g,h,i=this,j=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},k=j.ciphertextToAuth,l=j.contentCiphertext,m=j.encryptionKey,n=j.iv,o=j.authHash,p=j.authKey,q=arguments[1];return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:if(!q||o){a.next=3;break}return console.error("Auth hash is required."),a.abrupt("return");case 3:if(!o){a.next=10;break}return a.next=6,this.hmac256(k,p);case 6:if(b=a.sent,o===b){a.next=10;break}return console.error("Auth hash does not match, returning null. "+o+" != "+b),a.abrupt("return",null);case 10:return a.next=12,this.hexStringToArrayBuffer(n);case 12:return c=a.sent,d={name:"AES-CBC",iv:c},a.next=16,this.hexStringToArrayBuffer(m);case 16:return f=a.sent,a.next=19,this.webCryptoImportKey(f,d.name,["decrypt"]);case 19:return g=a.sent,a.next=22,this.base64ToArrayBuffer(l);case 22:return h=a.sent,a.abrupt("return",crypto.subtle.decrypt(d,g,h).then(function(){var a=e(regeneratorRuntime.mark(function a(b){var c;return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,i.arrayBufferToString(b);case 2:return c=a.sent,a.abrupt("return",c);case 4:case"end":return a.stop()}},a,i)}));return function(b){return a.apply(this,arguments)}}()).catch(function(a){console.error("Error decrypting:",a)}));case 24:case"end":return a.stop()}},a,this)}));return a}()},{key:"webCryptoImportKey",value:function(){function a(a,c,d,e){return b.apply(this,arguments)}var b=e(regeneratorRuntime.mark(function a(b,c,d,e){var f;return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:if("string"!=typeof b){a.next=6;break}return a.next=3,this.stringToArrayBuffer(b);case 3:a.t0=a.sent,a.next=7;break;case 6:a.t0=b;case 7:return f=a.t0,a.abrupt("return",C.importKey("raw",f,{name:c,hash:e},!1,d).then(function(a){return a}).catch(function(a){return console.error(a),null}));case 9:case"end":return a.stop()}},a,this)}));return a}()},{key:"webCryptoDeriveBits",value:function(){function a(a,c,d,e){return b.apply(this,arguments)}var b=e(regeneratorRuntime.mark(function a(b,c,d,f){var g,h=this;return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,this.stringToArrayBuffer(c);case 2:return a.t0=a.sent,a.t1=d,a.t2={name:"SHA-512"},g={name:"PBKDF2",salt:a.t0,iterations:a.t1,hash:a.t2},a.abrupt("return",C.deriveBits(g,b,f).then(function(){var a=e(regeneratorRuntime.mark(function a(b){var c;return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,h.arrayBufferToHexString(new Uint8Array(b));case 2:return c=a.sent,a.abrupt("return",c);case 4:case"end":return a.stop()}},a,h)}));return function(b){return a.apply(this,arguments)}}()).catch(function(a){return console.error(a),null}));case 7:case"end":return a.stop()}},a,this)}));return a}()},{key:"stringToArrayBuffer",value:function(){function a(a){return b.apply(this,arguments)}var b=e(regeneratorRuntime.mark(function a(b){return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.abrupt("return",new Promise(function(a,c){var d=new Blob([b]),e=new FileReader;e.onload=function(b){a(b.target.result)},e.readAsArrayBuffer(d)}));case 1:case"end":return a.stop()}},a,this)}));return a}()},{key:"arrayBufferToString",value:function(){function a(a){return b.apply(this,arguments)}var b=e(regeneratorRuntime.mark(function a(b){return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.abrupt("return",new Promise(function(a,c){var d=new Blob([b]),e=new FileReader;e.onload=function(b){a(b.target.result)},e.readAsText(d)}));case 1:case"end":return a.stop()}},a,this)}));return a}()},{key:"arrayBufferToHexString",value:function(){function a(a){return b.apply(this,arguments)}var b=e(regeneratorRuntime.mark(function a(b){var c,d,e,f;return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:for(c=new Uint8Array(b),d="",f=0;f<c.byteLength;f++)e=c[f].toString(16),e.length<2&&(e="0"+e),d+=e;return a.abrupt("return",d);case 4:case"end":return a.stop()}},a,this)}));return a}()},{key:"hexStringToArrayBuffer",value:function(){function a(a){return b.apply(this,arguments)}var b=e(regeneratorRuntime.mark(function a(b){var c,d;return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:for(c=[],d=0;d<b.length;d+=2)c.push(parseInt(b.substr(d,2),16));return a.abrupt("return",new Uint8Array(c));case 2:case"end":return a.stop()}},a,this)}));return a}()},{key:"base64ToArrayBuffer",value:function(){function a(a){return b.apply(this,arguments)}var b=e(regeneratorRuntime.mark(function a(b){var c,d,e,f;return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,this.base64Decode(b);case 2:for(c=a.sent,d=c.length,e=new Uint8Array(d),f=0;f<d;f++)e[f]=c.charCodeAt(f);return a.abrupt("return",e.buffer);case 7:case"end":return a.stop()}},a,this)}));return a}()},{key:"arrayBufferToBase64",value:function(){function a(a){return b.apply(this,arguments)}var b=e(regeneratorRuntime.mark(function a(b){return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.abrupt("return",new Promise(function(a,c){var d=new Blob([b],{type:"application/octet-binary"}),e=new FileReader;e.onload=function(b){var c=b.target.result;a(c.substr(c.indexOf(",")+1))},e.readAsDataURL(d)}));case 1:case"end":return a.stop()}},a,this)}));return a}()},{key:"hmac256",value:function(){function a(a,c){return b.apply(this,arguments)}var b=e(regeneratorRuntime.mark(function a(b,c){var d,f,g,h=this;return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,this.hexStringToArrayBuffer(c);case 2:return d=a.sent,a.next=5,this.webCryptoImportKey(d,"HMAC",["sign"],{name:"SHA-256"});case 5:return f=a.sent,a.next=8,this.stringToArrayBuffer(b);case 8:return g=a.sent,a.abrupt("return",crypto.subtle.sign({name:"HMAC"},f,g).then(function(){var a=e(regeneratorRuntime.mark(function a(b){var c;return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,h.arrayBufferToHexString(b);case 2:return c=a.sent,a.abrupt("return",c);case 4:case"end":return a.stop()}},a,h)}));return function(b){return a.apply(this,arguments)}}()).catch(function(a){console.error("Error computing hmac")}));case 10:case"end":return a.stop()}},a,this)}));return a}()}]),c}(A),E=c.SFItemTransformer=function(){function a(b){f(this,a),this.crypto=b}return k(a,[{key:"_private_encryptString",value:function(){function a(a,c,d,e,f){return b.apply(this,arguments)}var b=e(regeneratorRuntime.mark(function a(b,c,d,e,f){var g,h,i,j,k,l;return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:if("001"!==f.version){a.next=7;break}return a.next=3,this.crypto.encryptText(b,c,null);case 3:h=a.sent,g=f.version+h,a.next=21;break;case 7:return a.next=9,this.crypto.generateRandomKey(128);case 9:return i=a.sent,a.next=12,this.crypto.encryptText(b,c,i);case 12:return h=a.sent,j=[f.version,e,i,h].join(":"),a.next=16,this.crypto.hmac256(j,d);case 16:return k=a.sent,a.next=19,this.crypto.base64(JSON.stringify(f));case 19:l=a.sent,g=[f.version,k,e,i,h,l].join(":");case 21:return a.abrupt("return",g);case 22:case"end":return a.stop()}},a,this)}));return a}()},{key:"encryptItem",value:function(){function a(a,c,d){return b.apply(this,arguments)}var b=e(regeneratorRuntime.mark(function a(b,c,d){var e,f,g,h,i,j;return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return e={},a.next=3,this.crypto.generateItemEncryptionKey();case 3:if(f=a.sent,"001"!==d.version){a.next=10;break}return a.next=7,this.crypto.encryptText(f,c.mk,null);case 7:e.enc_item_key=a.sent,a.next=13;break;case 10:return a.next=12,this._private_encryptString(f,c.mk,c.ak,b.uuid,d);case 12:e.enc_item_key=a.sent;case 13:return a.next=15,this.crypto.firstHalfOfKey(f);case 15:return g=a.sent,a.next=18,this.crypto.secondHalfOfKey(f);case 18:return h=a.sent,a.next=21,this._private_encryptString(JSON.stringify(b.createContentJSONFromProperties()),g,h,b.uuid,d);case 21:if(i=a.sent,"001"!==d.version){a.next=27;break}return a.next=25,this.crypto.hmac256(i,h);case 25:j=a.sent,e.auth_hash=j;case 27:return e.content=i,a.abrupt("return",e);case 29:case"end":return a.stop()}},a,this)}));return a}()},{key:"encryptionComponentsFromString",value:function(a,b,c){var d=a.substring(0,3);if("001"===d)return{contentCiphertext:a.substring(3,a.length),encryptionVersion:d,ciphertextToAuth:a,iv:null,authHash:null,encryptionKey:b,authKey:c};var e=a.split(":");return{encryptionVersion:e[0],authHash:e[1],uuid:e[2],iv:e[3],contentCiphertext:e[4],authParams:e[5],ciphertextToAuth:[e[0],e[2],e[3],e[4]].join(":"),encryptionKey:b,authKey:c}}},{key:"decryptItem",value:function(){function a(a,c){return b.apply(this,arguments)}var b=e(regeneratorRuntime.mark(function a(b,c){var d,e,f,g,h,i,j,k;return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:if("string"==typeof b.content){a.next=2;break}return a.abrupt("return");case 2:if(!b.content.startsWith("000")){a.next=14;break}return a.prev=3,a.t0=JSON,a.next=7,this.crypto.base64Decode(b.content.substring(3,b.content.length));case 7:a.t1=a.sent,b.content=a.t0.parse.call(a.t0,a.t1),a.next=13;break;case 11:a.prev=11,a.t2=a.catch(3);case 13:return a.abrupt("return");case 14:if(b.enc_item_key){a.next=17;break}return console.log("Missing item encryption key, skipping decryption."),a.abrupt("return");case 17:if(d=b.enc_item_key,e=!0,d.startsWith("002")||d.startsWith("003")||(d="001"+d,e=!1),f=this.encryptionComponentsFromString(d,c.mk,c.ak),!f.uuid||f.uuid===b.uuid){a.next=26;break}return console.error("Item key params UUID does not match item UUID"),b.errorDecrypting||(b.errorDecryptingValueChanged=!0),b.errorDecrypting=!0,a.abrupt("return");case 26:return a.next=28,this.crypto.decryptText(f,e);case 28:if(g=a.sent){a.next=34;break}return console.log("Error decrypting item",b),b.errorDecrypting||(b.errorDecryptingValueChanged=!0),b.errorDecrypting=!0,a.abrupt("return");case 34:return a.next=36,this.crypto.firstHalfOfKey(g);case 36:return h=a.sent,a.next=39,this.crypto.secondHalfOfKey(g);case 39:return i=a.sent,j=this.encryptionComponentsFromString(b.content,h,i),a.prev=41,a.t3=JSON,a.next=45,this.crypto.base64Decode(j.authParams);case 45:a.t4=a.sent,b.auth_params=a.t3.parse.call(a.t3,a.t4),a.next=51;break;case 49:a.prev=49,a.t5=a.catch(41);case 51:if(!j.uuid||j.uuid===b.uuid){a.next=55;break}return b.errorDecrypting||(b.errorDecryptingValueChanged=!0),b.errorDecrypting=!0,a.abrupt("return");case 55:return j.authHash||(j.authHash=b.auth_hash),a.next=58,this.crypto.decryptText(j,!0);case 58:k=a.sent,k?(1==b.errorDecrypting&&(b.errorDecryptingValueChanged=!0),b.errorDecrypting=!1,b.content=k):(b.errorDecrypting||(b.errorDecryptingValueChanged=!0),b.errorDecrypting=!0);case 60:case"end":return a.stop()}},a,this,[[3,11],[41,49]])}));return a}()},{key:"decryptMultipleItems",value:function(){function a(a,c,d){return b.apply(this,arguments)}var b=e(regeneratorRuntime.mark(function a(b,c,d){var f,g=this;return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return f=function(){var a=e(regeneratorRuntime.mark(function a(b){var e;return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:if(b){a.next=2;break}return a.abrupt("return");case 2:if(1!=b.deleted||null!=b.content){a.next=4;break}return a.abrupt("return");case 4:if(!(e="string"==typeof b.content||b.content instanceof String)){a.next=19;break}return a.prev=6,a.next=9,g.decryptItem(b,c);case 9:a.next=19;break;case 11:if(a.prev=11,a.t0=a.catch(6),b.errorDecrypting||(b.errorDecryptingValueChanged=!0),b.errorDecrypting=!0,!d){a.next=17;break}throw a.t0;case 17:return console.error("Error decrypting item",b,a.t0),a.abrupt("return");case 19:case"end":return a.stop()}},a,g,[[6,11]])}));return function(b){return a.apply(this,arguments)}}(),a.abrupt("return",Promise.all(b.map(function(a){return f(a)})));case 2:case"end":return a.stop()}},a,this)}));return a}()}]),a}(),n="undefined"!=typeof window?window:void 0!==a?a:null,F=c.StandardFile=function(){function a(b){if(f(this,a),n){!("undefined"!=typeof document&&document.documentMode||/Edge/.test(navigator.userAgent))&&n.crypto&&n.crypto.subtle?this.crypto=new D:this.crypto=new B}b&&(this.crypto=b),this.itemTransformer=new E(this.crypto),this.crypto.SFJS={version:this.version(),defaultPasswordGenerationCost:this.defaultPasswordGenerationCost()}}return k(a,[{key:"version",value:function(){return"003"}},{key:"supportsPasswordDerivationCost",value:function(a){return!(a>5e3)||this.crypto instanceof D}},{key:"supportedVersions",value:function(){return["001","002","003"]}},{key:"isVersionNewerThanLibraryVersion",value:function(a){var b=this.version();return parseInt(a)>parseInt(b)}},{key:"isProtocolVersionOutdated",value:function(a){var b={"001":Date.parse("2018-01-01"),"002":Date.parse("2020-01-01")},c=b[a];return!!c&&new Date>c}},{key:"costMinimumForVersion",value:function(a){return{"001":3e3,"002":3e3,"003":11e4}[a]}},{key:"defaultPasswordGenerationCost",value:function(){return this.costMinimumForVersion(this.version())}}]),a}();if(n)try{n.StandardFile=F,n.SFJS=new F,n.SFCryptoWeb=D,n.SFCryptoJS=B,n.SFItemTransformer=E,n.SFModelManager=q,n.SFItem=u,n.SFItemParams=v,n.SFHttpManager=o,n.SFStorageManager=s,n.SFSyncManager=t,n.SFAuthManager=m,n.SFMigrationManager=p,n.SFAlertManager=l,n.SFPredicate=w,n.SFHistorySession=x,n.SFSessionHistoryManager=r,n.SFItemHistory=y,n.SFItemHistoryEntry=z}catch(a){console.log("Exception while exporting window variables",a)}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}]},{},[1])(1)});
</script>
<!-- JSZip -->
<script>
/*!
JSZip v3.1.3 - A Javascript class for generating and reading zip files
<http://stuartk.com/jszip>
(c) 2009-2016 Stuart Knightley <stuart [at] stuartk.com>
Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip/master/LICENSE.markdown.
JSZip uses the library pako released under the MIT license :
https://github.com/nodeca/pako/blob/master/LICENSE
*/
!function(a){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=a();else if("function"==typeof define&&define.amd)define([],a);else{var b;b="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,b.JSZip=a()}}(function(){return function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};b[g][0].call(k.exports,function(a){var c=b[g][1][a];return e(c?c:a)},k,k.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g<d.length;g++)e(d[g]);return e}({1:[function(a,b,c){"use strict";var d=a("./utils"),e=a("./support"),f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";c.encode=function(a){for(var b,c,e,g,h,i,j,k=[],l=0,m=a.length,n=m,o="string"!==d.getTypeOf(a);l<a.length;)n=m-l,o?(b=a[l++],c=l<m?a[l++]:0,e=l<m?a[l++]:0):(b=a.charCodeAt(l++),c=l<m?a.charCodeAt(l++):0,e=l<m?a.charCodeAt(l++):0),g=b>>2,h=(3&b)<<4|c>>4,i=n>1?(15&c)<<2|e>>6:64,j=n>2?63&e:64,k.push(f.charAt(g)+f.charAt(h)+f.charAt(i)+f.charAt(j));return k.join("")},c.decode=function(a){var b,c,d,g,h,i,j,k=0,l=0,m="data:";if(a.substr(0,m.length)===m)throw new Error("Invalid base64 input, it looks like a data url.");a=a.replace(/[^A-Za-z0-9\+\/\=]/g,"");var n=3*a.length/4;if(a.charAt(a.length-1)===f.charAt(64)&&n--,a.charAt(a.length-2)===f.charAt(64)&&n--,n%1!==0)throw new Error("Invalid base64 input, bad content length.");var o;for(o=e.uint8array?new Uint8Array(0|n):new Array(0|n);k<a.length;)g=f.indexOf(a.charAt(k++)),h=f.indexOf(a.charAt(k++)),i=f.indexOf(a.charAt(k++)),j=f.indexOf(a.charAt(k++)),b=g<<2|h>>4,c=(15&h)<<4|i>>2,d=(3&i)<<6|j,o[l++]=b,64!==i&&(o[l++]=c),64!==j&&(o[l++]=d);return o}},{"./support":30,"./utils":32}],2:[function(a,b,c){"use strict";function d(a,b,c,d,e){this.compressedSize=a,this.uncompressedSize=b,this.crc32=c,this.compression=d,this.compressedContent=e}var e=a("./external"),f=a("./stream/DataWorker"),g=a("./stream/DataLengthProbe"),h=a("./stream/Crc32Probe"),g=a("./stream/DataLengthProbe");d.prototype={getContentWorker:function(){var a=new f(e.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new g("data_length")),b=this;return a.on("end",function(){if(this.streamInfo.data_length!==b.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),a},getCompressedWorker:function(){return new f(e.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},d.createWorkerFrom=function(a,b,c){return a.pipe(new h).pipe(new g("uncompressedSize")).pipe(b.compressWorker(c)).pipe(new g("compressedSize")).withStreamInfo("compression",b)},b.exports=d},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(a,b,c){"use strict";var d=a("./stream/GenericWorker");c.STORE={magic:"\0\0",compressWorker:function(a){return new d("STORE compression")},uncompressWorker:function(){return new d("STORE decompression")}},c.DEFLATE=a("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(a,b,c){"use strict";function d(){for(var a,b=[],c=0;c<256;c++){a=c;for(var d=0;d<8;d++)a=1&a?3988292384^a>>>1:a>>>1;b[c]=a}return b}function e(a,b,c,d){var e=h,f=d+c;a^=-1;for(var g=d;g<f;g++)a=a>>>8^e[255&(a^b[g])];return a^-1}function f(a,b,c,d){var e=h,f=d+c;a^=-1;for(var g=d;g<f;g++)a=a>>>8^e[255&(a^b.charCodeAt(g))];return a^-1}var g=a("./utils"),h=d();b.exports=function(a,b){if("undefined"==typeof a||!a.length)return 0;var c="string"!==g.getTypeOf(a);return c?e(0|b,a,a.length,0):f(0|b,a,a.length,0)}},{"./utils":32}],5:[function(a,b,c){"use strict";c.base64=!1,c.binary=!1,c.dir=!1,c.createFolders=!0,c.date=null,c.compression=null,c.compressionOptions=null,c.comment=null,c.unixPermissions=null,c.dosPermissions=null},{}],6:[function(a,b,c){"use strict";var d=null;d="undefined"!=typeof Promise?Promise:a("lie"),b.exports={Promise:d}},{lie:58}],7:[function(a,b,c){"use strict";function d(a,b){h.call(this,"FlateWorker/"+a),this._pako=new f[a]({raw:!0,level:b.level||-1}),this.meta={};var c=this;this._pako.onData=function(a){c.push({data:a,meta:c.meta})}}var e="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Uint32Array,f=a("pako"),g=a("./utils"),h=a("./stream/GenericWorker"),i=e?"uint8array":"array";c.magic="\b\0",g.inherits(d,h),d.prototype.processChunk=function(a){this.meta=a.meta,this._pako.push(g.transformTo(i,a.data),!1)},d.prototype.flush=function(){h.prototype.flush.call(this),this._pako.push([],!0)},d.prototype.cleanUp=function(){h.prototype.cleanUp.call(this),this._pako=null},c.compressWorker=function(a){return new d("Deflate",a)},c.uncompressWorker=function(){return new d("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:59}],8:[function(a,b,c){"use strict";function d(a,b,c,d){f.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=b,this.zipPlatform=c,this.encodeFileName=d,this.streamFiles=a,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}var e=a("../utils"),f=a("../stream/GenericWorker"),g=a("../utf8"),h=a("../crc32"),i=a("../signature"),j=function(a,b){var c,d="";for(c=0;c<b;c++)d+=String.fromCharCode(255&a),a>>>=8;return d},k=function(a,b){var c=a;return a||(c=b?16893:33204),(65535&c)<<16},l=function(a,b){return 63&(a||0)},m=function(a,b,c,d,f,m){var n,o,p=a.file,q=a.compression,r=m!==g.utf8encode,s=e.transformTo("string",m(p.name)),t=e.transformTo("string",g.utf8encode(p.name)),u=p.comment,v=e.transformTo("string",m(u)),w=e.transformTo("string",g.utf8encode(u)),x=t.length!==p.name.length,y=w.length!==u.length,z="",A="",B="",C=p.dir,D=p.date,E={crc32:0,compressedSize:0,uncompressedSize:0};b&&!c||(E.crc32=a.crc32,E.compressedSize=a.compressedSize,E.uncompressedSize=a.uncompressedSize);var F=0;b&&(F|=8),r||!x&&!y||(F|=2048);var G=0,H=0;C&&(G|=16),"UNIX"===f?(H=798,G|=k(p.unixPermissions,C)):(H=20,G|=l(p.dosPermissions,C)),n=D.getUTCHours(),n<<=6,n|=D.getUTCMinutes(),n<<=5,n|=D.getUTCSeconds()/2,o=D.getUTCFullYear()-1980,o<<=4,o|=D.getUTCMonth()+1,o<<=5,o|=D.getUTCDate(),x&&(A=j(1,1)+j(h(s),4)+t,z+="up"+j(A.length,2)+A),y&&(B=j(1,1)+j(h(v),4)+w,z+="uc"+j(B.length,2)+B);var I="";I+="\n\0",I+=j(F,2),I+=q.magic,I+=j(n,2),I+=j(o,2),I+=j(E.crc32,4),I+=j(E.compressedSize,4),I+=j(E.uncompressedSize,4),I+=j(s.length,2),I+=j(z.length,2);var J=i.LOCAL_FILE_HEADER+I+s+z,K=i.CENTRAL_FILE_HEADER+j(H,2)+I+j(v.length,2)+"\0\0\0\0"+j(G,4)+j(d,4)+s+z+v;return{fileRecord:J,dirRecord:K}},n=function(a,b,c,d,f){var g="",h=e.transformTo("string",f(d));return g=i.CENTRAL_DIRECTORY_END+"\0\0\0\0"+j(a,2)+j(a,2)+j(b,4)+j(c,4)+j(h.length,2)+h},o=function(a){var b="";return b=i.DATA_DESCRIPTOR+j(a.crc32,4)+j(a.compressedSize,4)+j(a.uncompressedSize,4)};e.inherits(d,f),d.prototype.push=function(a){var b=a.meta.percent||0,c=this.entriesCount,d=this._sources.length;this.accumulate?this.contentBuffer.push(a):(this.bytesWritten+=a.data.length,f.prototype.push.call(this,{data:a.data,meta:{currentFile:this.currentFile,percent:c?(b+100*(c-d-1))/c:100}}))},d.prototype.openedSource=function(a){this.currentSourceOffset=this.bytesWritten,this.currentFile=a.file.name;var b=this.streamFiles&&!a.file.dir;if(b){var c=m(a,b,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:c.fileRecord,meta:{percent:0}})}else this.accumulate=!0},d.prototype.closedSource=function(a){this.accumulate=!1;var b=this.streamFiles&&!a.file.dir,c=m(a,b,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(c.dirRecord),b)this.push({data:o(a),meta:{percent:100}});else for(this.push({data:c.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},d.prototype.flush=function(){for(var a=this.bytesWritten,b=0;b<this.dirRecords.length;b++)this.push({data:this.dirRecords[b],meta:{percent:100}});var c=this.bytesWritten-a,d=n(this.dirRecords.length,c,a,this.zipComment,this.encodeFileName);this.push({data:d,meta:{percent:100}})},d.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},d.prototype.registerPrevious=function(a){this._sources.push(a);var b=this;return a.on("data",function(a){b.processChunk(a)}),a.on("end",function(){b.closedSource(b.previous.streamInfo),b._sources.length?b.prepareNextSource():b.end()}),a.on("error",function(a){b.error(a)}),this},d.prototype.resume=function(){return!!f.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},d.prototype.error=function(a){var b=this._sources;if(!f.prototype.error.call(this,a))return!1;for(var c=0;c<b.length;c++)try{b[c].error(a)}catch(a){}return!0},d.prototype.lock=function(){f.prototype.lock.call(this);for(var a=this._sources,b=0;b<a.length;b++)a[b].lock()},b.exports=d},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(a,b,c){"use strict";var d=a("../compressions"),e=a("./ZipFileWorker"),f=function(a,b){var c=a||b,e=d[c];if(!e)throw new Error(c+" is not a valid compression method !");return e};c.generateWorker=function(a,b,c){var d=new e(b.streamFiles,c,b.platform,b.encodeFileName),g=0;try{a.forEach(function(a,c){g++;var e=f(c.options.compression,b.compression),h=c.options.compressionOptions||b.compressionOptions||{},i=c.dir,j=c.date;c._compressWorker(e,h).withStreamInfo("file",{name:a,dir:i,date:j,comment:c.comment||"",unixPermissions:c.unixPermissions,dosPermissions:c.dosPermissions}).pipe(d)}),d.entriesCount=g}catch(h){d.error(h)}return d}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(a,b,c){"use strict";function d(){if(!(this instanceof d))return new d;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files={},this.comment=null,this.root="",this.clone=function(){var a=new d;for(var b in this)"function"!=typeof this[b]&&(a[b]=this[b]);return a}}d.prototype=a("./object"),d.prototype.loadAsync=a("./load"),d.support=a("./support"),d.defaults=a("./defaults"),d.version="3.1.3",d.loadAsync=function(a,b){return(new d).loadAsync(a,b)},d.external=a("./external"),b.exports=d},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(a,b,c){"use strict";function d(a){return new f.Promise(function(b,c){var d=a.decompressed.getContentWorker().pipe(new i);d.on("error",function(a){c(a)}).on("end",function(){d.streamInfo.crc32!==a.decompressed.crc32?c(new Error("Corrupted zip : CRC32 mismatch")):b()}).resume()})}var e=a("./utils"),f=a("./external"),g=a("./utf8"),e=a("./utils"),h=a("./zipEntries"),i=a("./stream/Crc32Probe"),j=a("./nodejsUtils");b.exports=function(a,b){var c=this;return b=e.extend(b||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:g.utf8decode}),j.isNode&&j.isStream(a)?f.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):e.prepareContent("the loaded zip file",a,!0,b.optimizedBinaryString,b.base64).then(function(a){var c=new h(b);return c.load(a),c}).then(function(a){var c=[f.Promise.resolve(a)],e=a.files;if(b.checkCRC32)for(var g=0;g<e.length;g++)c.push(d(e[g]));return f.Promise.all(c)}).then(function(a){for(var d=a.shift(),e=d.files,f=0;f<e.length;f++){var g=e[f];c.file(g.fileNameStr,g.decompressed,{binary:!0,optimizedBinaryString:!0,date:g.date,dir:g.dir,comment:g.fileCommentStr.length?g.fileCommentStr:null,unixPermissions:g.unixPermissions,dosPermissions:g.dosPermissions,createFolders:b.createFolders})}return d.zipComment.length&&(c.comment=d.zipComment),c})}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(a,b,c){"use strict";function d(a,b){f.call(this,"Nodejs stream input adapter for "+a),this._upstreamEnded=!1,this._bindStream(b)}var e=a("../utils"),f=a("../stream/GenericWorker");e.inherits(d,f),d.prototype._bindStream=function(a){var b=this;this._stream=a,a.pause(),a.on("data",function(a){b.push({data:a,meta:{percent:0}})}).on("error",function(a){b.isPaused?this.generatedError=a:b.error(a)}).on("end",function(){b.isPaused?b._upstreamEnded=!0:b.end()})},d.prototype.pause=function(){return!!f.prototype.pause.call(this)&&(this._stream.pause(),!0)},d.prototype.resume=function(){return!!f.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},b.exports=d},{"../stream/GenericWorker":28,"../utils":32}],13:[function(a,b,c){"use strict";function d(a,b,c){e.call(this,b),this._helper=a;var d=this;a.on("data",function(a,b){d.push(a)||d._helper.pause(),c&&c(b)}).on("error",function(a){d.emit("error",a)}).on("end",function(){d.push(null)})}var e=a("readable-stream").Readable,f=a("util");f.inherits(d,e),d.prototype._read=function(){this._helper.resume()},b.exports=d},{"readable-stream":16,util:void 0}],14:[function(a,b,c){"use strict";b.exports={isNode:"undefined"!=typeof Buffer,newBuffer:function(a,b){return new Buffer(a,b)},isBuffer:function(a){return Buffer.isBuffer(a)},isStream:function(a){return a&&"function"==typeof a.on&&"function"==typeof a.pause&&"function"==typeof a.resume}}},{}],15:[function(a,b,c){"use strict";function d(a){return"[object RegExp]"===Object.prototype.toString.call(a)}var e=a("./utf8"),f=a("./utils"),g=a("./stream/GenericWorker"),h=a("./stream/StreamHelper"),i=a("./defaults"),j=a("./compressedObject"),k=a("./zipObject"),l=a("./generate"),m=a("./nodejsUtils"),n=a("./nodejs/NodejsStreamInputAdapter"),o=function(a,b,c){var d,e=f.getTypeOf(b),h=f.extend(c||{},i);h.date=h.date||new Date,null!==h.compression&&(h.compression=h.compression.toUpperCase()),"string"==typeof h.unixPermissions&&(h.unixPermissions=parseInt(h.unixPermissions,8)),h.unixPermissions&&16384&h.unixPermissions&&(h.dir=!0),h.dosPermissions&&16&h.dosPermissions&&(h.dir=!0),h.dir&&(a=q(a)),h.createFolders&&(d=p(a))&&r.call(this,d,!0);var l="string"===e&&h.binary===!1&&h.base64===!1;c&&"undefined"!=typeof c.binary||(h.binary=!l);var o=b instanceof j&&0===b.uncompressedSize;(o||h.dir||!b||0===b.length)&&(h.base64=!1,h.binary=!0,b="",h.compression="STORE",e="string");var s=null;s=b instanceof j||b instanceof g?b:m.isNode&&m.isStream(b)?new n(a,b):f.prepareContent(a,b,h.binary,h.optimizedBinaryString,h.base64);var t=new k(a,s,h);this.files[a]=t},p=function(a){"/"===a.slice(-1)&&(a=a.substring(0,a.length-1));var b=a.lastIndexOf("/");return b>0?a.substring(0,b):""},q=function(a){return"/"!==a.slice(-1)&&(a+="/"),a},r=function(a,b){return b="undefined"!=typeof b?b:i.createFolders,a=q(a),this.files[a]||o.call(this,a,null,{dir:!0,createFolders:b}),this.files[a]},s={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(a){var b,c,d;for(b in this.files)this.files.hasOwnProperty(b)&&(d=this.files[b],c=b.slice(this.root.length,b.length),c&&b.slice(0,this.root.length)===this.root&&a(c,d))},filter:function(a){var b=[];return this.forEach(function(c,d){a(c,d)&&b.push(d)}),b},file:function(a,b,c){if(1===arguments.length){if(d(a)){var e=a;return this.filter(function(a,b){return!b.dir&&e.test(a)})}var f=this.files[this.root+a];return f&&!f.dir?f:null}return a=this.root+a,o.call(this,a,b,c),this},folder:function(a){if(!a)return this;if(d(a))return this.filter(function(b,c){return c.dir&&a.test(b)});var b=this.root+a,c=r.call(this,b),e=this.clone();return e.root=c.name,e},remove:function(a){a=this.root+a;var b=this.files[a];if(b||("/"!==a.slice(-1)&&(a+="/"),b=this.files[a]),b&&!b.dir)delete this.files[a];else for(var c=this.filter(function(b,c){return c.name.slice(0,a.length)===a}),d=0;d<c.length;d++)delete this.files[c[d].name];return this},generate:function(a){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(a){var b,c={};try{if(c=f.extend(a||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:e.utf8encode}),c.type=c.type.toLowerCase(),c.compression=c.compression.toUpperCase(),"binarystring"===c.type&&(c.type="string"),!c.type)throw new Error("No output type specified.");f.checkSupport(c.type),"darwin"!==c.platform&&"freebsd"!==c.platform&&"linux"!==c.platform&&"sunos"!==c.platform||(c.platform="UNIX"),"win32"===c.platform&&(c.platform="DOS");var d=c.comment||this.comment||"";b=l.generateWorker(this,c,d)}catch(i){b=new g("error"),b.error(i)}return new h(b,c.type||"string",c.mimeType)},generateAsync:function(a,b){return this.generateInternalStream(a).accumulate(b)},generateNodeStream:function(a,b){return a=a||{},a.type||(a.type="nodebuffer"),this.generateInternalStream(a).toNodejsStream(b)}};b.exports=s},{"./compressedObject":2,"./defaults":5,"./generate":9,"./nodejs/NodejsStreamInputAdapter":12,"./nodejsUtils":14,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31,"./utils":32,"./zipObject":35}],16:[function(a,b,c){b.exports=a("stream")},{stream:void 0}],17:[function(a,b,c){"use strict";function d(a){e.call(this,a);for(var b=0;b<this.data.length;b++)a[b]=255&a[b]}var e=a("./DataReader"),f=a("../utils");f.inherits(d,e),d.prototype.byteAt=function(a){return this.data[this.zero+a]},d.prototype.lastIndexOfSignature=function(a){for(var b=a.charCodeAt(0),c=a.charCodeAt(1),d=a.charCodeAt(2),e=a.charCodeAt(3),f=this.length-4;f>=0;--f)if(this.data[f]===b&&this.data[f+1]===c&&this.data[f+2]===d&&this.data[f+3]===e)return f-this.zero;return-1},d.prototype.readAndCheckSignature=function(a){var b=a.charCodeAt(0),c=a.charCodeAt(1),d=a.charCodeAt(2),e=a.charCodeAt(3),f=this.readData(4);return b===f[0]&&c===f[1]&&d===f[2]&&e===f[3]},d.prototype.readData=function(a){if(this.checkOffset(a),0===a)return[];var b=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,b},b.exports=d},{"../utils":32,"./DataReader":18}],18:[function(a,b,c){"use strict";function d(a){this.data=a,this.length=a.length,this.index=0,this.zero=0}var e=a("../utils");d.prototype={checkOffset:function(a){this.checkIndex(this.index+a)},checkIndex:function(a){if(this.length<this.zero+a||a<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+a+"). Corrupted zip ?")},setIndex:function(a){this.checkIndex(a),this.index=a},skip:function(a){this.setIndex(this.index+a)},byteAt:function(a){},readInt:function(a){var b,c=0;for(this.checkOffset(a),b=this.index+a-1;b>=this.index;b--)c=(c<<8)+this.byteAt(b);return this.index+=a,c},readString:function(a){return e.transformTo("string",this.readData(a))},readData:function(a){},lastIndexOfSignature:function(a){},readAndCheckSignature:function(a){},readDate:function(){var a=this.readInt(4);return new Date(Date.UTC((a>>25&127)+1980,(a>>21&15)-1,a>>16&31,a>>11&31,a>>5&63,(31&a)<<1))}},b.exports=d},{"../utils":32}],19:[function(a,b,c){"use strict";function d(a){e.call(this,a)}var e=a("./Uint8ArrayReader"),f=a("../utils");f.inherits(d,e),d.prototype.readData=function(a){this.checkOffset(a);var b=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,b},b.exports=d},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(a,b,c){"use strict";function d(a){e.call(this,a)}var e=a("./DataReader"),f=a("../utils");f.inherits(d,e),d.prototype.byteAt=function(a){return this.data.charCodeAt(this.zero+a)},d.prototype.lastIndexOfSignature=function(a){return this.data.lastIndexOf(a)-this.zero},d.prototype.readAndCheckSignature=function(a){var b=this.readData(4);return a===b},d.prototype.readData=function(a){this.checkOffset(a);var b=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,b},b.exports=d},{"../utils":32,"./DataReader":18}],21:[function(a,b,c){"use strict";function d(a){e.call(this,a)}var e=a("./ArrayReader"),f=a("../utils");f.inherits(d,e),d.prototype.readData=function(a){if(this.checkOffset(a),0===a)return new Uint8Array(0);var b=this.data.subarray(this.zero+this.index,this.zero+this.index+a);return this.index+=a,b},b.exports=d},{"../utils":32,"./ArrayReader":17}],22:[function(a,b,c){"use strict";var d=a("../utils"),e=a("../support"),f=a("./ArrayReader"),g=a("./StringReader"),h=a("./NodeBufferReader"),i=a("./Uint8ArrayReader");b.exports=function(a){var b=d.getTypeOf(a);return d.checkSupport(b),"string"!==b||e.uint8array?"nodebuffer"===b?new h(a):e.uint8array?new i(d.transformTo("uint8array",a)):new f(d.transformTo("array",a)):new g(a)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(a,b,c){"use strict";c.LOCAL_FILE_HEADER="PK",c.CENTRAL_FILE_HEADER="PK",c.CENTRAL_DIRECTORY_END="PK",c.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK",c.ZIP64_CENTRAL_DIRECTORY_END="PK",c.DATA_DESCRIPTOR="PK\b"},{}],24:[function(a,b,c){"use strict";function d(a){e.call(this,"ConvertWorker to "+a),this.destType=a}var e=a("./GenericWorker"),f=a("../utils");f.inherits(d,e),d.prototype.processChunk=function(a){this.push({data:f.transformTo(this.destType,a.data),meta:a.meta})},b.exports=d},{"../utils":32,"./GenericWorker":28}],25:[function(a,b,c){"use strict";function d(){e.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}var e=a("./GenericWorker"),f=a("../crc32"),g=a("../utils");g.inherits(d,e),d.prototype.processChunk=function(a){this.streamInfo.crc32=f(a.data,this.streamInfo.crc32||0),this.push(a)},b.exports=d},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(a,b,c){"use strict";function d(a){f.call(this,"DataLengthProbe for "+a),this.propName=a,this.withStreamInfo(a,0)}var e=a("../utils"),f=a("./GenericWorker");e.inherits(d,f),d.prototype.processChunk=function(a){if(a){var b=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=b+a.data.length}f.prototype.processChunk.call(this,a)},b.exports=d},{"../utils":32,"./GenericWorker":28}],27:[function(a,b,c){"use strict";function d(a){f.call(this,"DataWorker");var b=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,a.then(function(a){b.dataIsReady=!0,b.data=a,b.max=a&&a.length||0,b.type=e.getTypeOf(a),b.isPaused||b._tickAndRepeat()},function(a){b.error(a)})}var e=a("../utils"),f=a("./GenericWorker"),g=16384;e.inherits(d,f),d.prototype.cleanUp=function(){f.prototype.cleanUp.call(this),this.data=null},d.prototype.resume=function(){return!!f.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,e.delay(this._tickAndRepeat,[],this)),!0)},d.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(e.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},d.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var a=g,b=null,c=Math.min(this.max,this.index+a);if(this.index>=this.max)return this.end();switch(this.type){case"string":b=this.data.substring(this.index,c);break;case"uint8array":b=this.data.subarray(this.index,c);break;case"array":case"nodebuffer":b=this.data.slice(this.index,c)}return this.index=c,this.push({data:b,meta:{percent:this.max?this.index/this.max*100:0}})},b.exports=d},{"../utils":32,"./GenericWorker":28}],28:[function(a,b,c){"use strict";function d(a){this.name=a||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}d.prototype={push:function(a){this.emit("data",a)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(a){this.emit("error",a)}return!0},error:function(a){return!this.isFinished&&(this.isPaused?this.generatedError=a:(this.isFinished=!0,this.emit("error",a),this.previous&&this.previous.error(a),this.cleanUp()),!0)},on:function(a,b){return this._listeners[a].push(b),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(a,b){if(this._listeners[a])for(var c=0;c<this._listeners[a].length;c++)this._listeners[a][c].call(this,b)},pipe:function(a){return a.registerPrevious(this)},registerPrevious:function(a){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=a.streamInfo,this.mergeStreamInfo(),this.previous=a;var b=this;return a.on("data",function(a){b.processChunk(a)}),a.on("end",function(){b.end()}),a.on("error",function(a){b.error(a)}),this},pause:function(){return!this.isPaused&&!this.isFinished&&(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return!1;this.isPaused=!1;var a=!1;return this.generatedError&&(this.error(this.generatedError),a=!0),this.previous&&this.previous.resume(),!a},flush:function(){},processChunk:function(a){this.push(a)},withStreamInfo:function(a,b){return this.extraStreamInfo[a]=b,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var a in this.extraStreamInfo)this.extraStreamInfo.hasOwnProperty(a)&&(this.streamInfo[a]=this.extraStreamInfo[a])},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var a="Worker "+this.name;return this.previous?this.previous+" -> "+a:a}},b.exports=d},{}],29:[function(a,b,c){"use strict";function d(a,b,c,d){var f=null;switch(a){case"blob":return h.newBlob(c,d);case"base64":return f=e(b,c),k.encode(f);default:return f=e(b,c),h.transformTo(a,f)}}function e(a,b){var c,d=0,e=null,f=0;for(c=0;c<b.length;c++)f+=b[c].length;switch(a){case"string":return b.join("");case"array":return Array.prototype.concat.apply([],b);case"uint8array":for(e=new Uint8Array(f),c=0;c<b.length;c++)e.set(b[c],d),d+=b[c].length;return e;case"nodebuffer":return Buffer.concat(b);default:throw new Error("concat : unsupported type '"+a+"'")}}function f(a,b){return new m.Promise(function(c,e){var f=[],g=a._internalType,h=a._outputType,i=a._mimeType;a.on("data",function(a,c){f.push(a),b&&b(c)}).on("error",function(a){f=[],e(a)}).on("end",function(){try{var a=d(h,g,f,i);c(a)}catch(b){e(b)}f=[]}).resume()})}function g(a,b,c){var d=b;switch(b){case"blob":d="arraybuffer";break;case"arraybuffer":d="uint8array";break;case"base64":d="string"}try{this._internalType=d,this._outputType=b,this._mimeType=c,h.checkSupport(d),this._worker=a.pipe(new i(d)),a.lock()}catch(e){this._worker=new j("error"),this._worker.error(e)}}var h=a("../utils"),i=a("./ConvertWorker"),j=a("./GenericWorker"),k=a("../base64"),l=a("../support"),m=a("../external"),n=null;if(l.nodestream)try{n=a("../nodejs/NodejsStreamOutputAdapter")}catch(o){}g.prototype={accumulate:function(a){return f(this,a)},on:function(a,b){var c=this;return"data"===a?this._worker.on(a,function(a){b.call(c,a.data,a.meta)}):this._worker.on(a,function(){h.delay(b,arguments,c)}),this},resume:function(){return h.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(a){if(h.checkSupport("nodestream"),"nodebuffer"!==this._outputType)throw new Error(this._outputType+" is not supported by this method");return new n(this,{objectMode:"nodebuffer"!==this._outputType},a)}},b.exports=g},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(a,b,c){"use strict";if(c.base64=!0,c.array=!0,c.string=!0,c.arraybuffer="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof Uint8Array,c.nodebuffer="undefined"!=typeof Buffer,c.uint8array="undefined"!=typeof Uint8Array,"undefined"==typeof ArrayBuffer)c.blob=!1;else{var d=new ArrayBuffer(0);try{c.blob=0===new Blob([d],{type:"application/zip"}).size}catch(e){try{var f=window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder,g=new f;g.append(d),c.blob=0===g.getBlob("application/zip").size}catch(e){c.blob=!1}}}try{c.nodestream=!!a("readable-stream").Readable}catch(e){c.nodestream=!1}},{"readable-stream":16}],31:[function(a,b,c){"use strict";function d(){i.call(this,"utf-8 decode"),this.leftOver=null}function e(){i.call(this,"utf-8 encode")}for(var f=a("./utils"),g=a("./support"),h=a("./nodejsUtils"),i=a("./stream/GenericWorker"),j=new Array(256),k=0;k<256;k++)j[k]=k>=252?6:k>=248?5:k>=240?4:k>=224?3:k>=192?2:1;j[254]=j[254]=1;var l=function(a){var b,c,d,e,f,h=a.length,i=0;for(e=0;e<h;e++)c=a.charCodeAt(e),55296===(64512&c)&&e+1<h&&(d=a.charCodeAt(e+1),56320===(64512&d)&&(c=65536+(c-55296<<10)+(d-56320),e++)),i+=c<128?1:c<2048?2:c<65536?3:4;for(b=g.uint8array?new Uint8Array(i):new Array(i),f=0,e=0;f<i;e++)c=a.charCodeAt(e),55296===(64512&c)&&e+1<h&&(d=a.charCodeAt(e+1),56320===(64512&d)&&(c=65536+(c-55296<<10)+(d-56320),e++)),c<128?b[f++]=c:c<2048?(b[f++]=192|c>>>6,b[f++]=128|63&c):c<65536?(b[f++]=224|c>>>12,b[f++]=128|c>>>6&63,b[f++]=128|63&c):(b[f++]=240|c>>>18,b[f++]=128|c>>>12&63,b[f++]=128|c>>>6&63,b[f++]=128|63&c);return b},m=function(a,b){var c;for(b=b||a.length,b>a.length&&(b=a.length),c=b-1;c>=0&&128===(192&a[c]);)c--;return c<0?b:0===c?b:c+j[a[c]]>b?c:b},n=function(a){var b,c,d,e,g=a.length,h=new Array(2*g);for(c=0,b=0;b<g;)if(d=a[b++],d<128)h[c++]=d;else if(e=j[d],e>4)h[c++]=65533,b+=e-1;else{for(d&=2===e?31:3===e?15:7;e>1&&b<g;)d=d<<6|63&a[b++],e--;e>1?h[c++]=65533:d<65536?h[c++]=d:(d-=65536,h[c++]=55296|d>>10&1023,h[c++]=56320|1023&d)}return h.length!==c&&(h.subarray?h=h.subarray(0,c):h.length=c),f.applyFromCharCode(h)};c.utf8encode=function(a){return g.nodebuffer?h.newBuffer(a,"utf-8"):l(a)},c.utf8decode=function(a){return g.nodebuffer?f.transformTo("nodebuffer",a).toString("utf-8"):(a=f.transformTo(g.uint8array?"uint8array":"array",a),n(a))},f.inherits(d,i),d.prototype.processChunk=function(a){var b=f.transformTo(g.uint8array?"uint8array":"array",a.data);if(this.leftOver&&this.leftOver.length){if(g.uint8array){var d=b;b=new Uint8Array(d.length+this.leftOver.length),b.set(this.leftOver,0),b.set(d,this.leftOver.length)}else b=this.leftOver.concat(b);this.leftOver=null}var e=m(b),h=b;e!==b.length&&(g.uint8array?(h=b.subarray(0,e),this.leftOver=b.subarray(e,b.length)):(h=b.slice(0,e),this.leftOver=b.slice(e,b.length))),this.push({data:c.utf8decode(h),meta:a.meta})},d.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:c.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},c.Utf8DecodeWorker=d,f.inherits(e,i),e.prototype.processChunk=function(a){this.push({data:c.utf8encode(a.data),meta:a.meta})},c.Utf8EncodeWorker=e},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(a,b,c){"use strict";function d(a){var b=null;return b=i.uint8array?new Uint8Array(a.length):new Array(a.length),f(a,b)}function e(a){return a}function f(a,b){for(var c=0;c<a.length;++c)b[c]=255&a.charCodeAt(c);return b}function g(a){var b=65536,d=c.getTypeOf(a),e=!0;if("uint8array"===d?e=n.applyCanBeUsed.uint8array:"nodebuffer"===d&&(e=n.applyCanBeUsed.nodebuffer),e)for(;b>1;)try{return n.stringifyByChunk(a,d,b)}catch(f){b=Math.floor(b/2)}return n.stringifyByChar(a)}function h(a,b){for(var c=0;c<a.length;c++)b[c]=a[c];return b}var i=a("./support"),j=a("./base64"),k=a("./nodejsUtils"),l=a("core-js/library/fn/set-immediate"),m=a("./external");c.newBlob=function(a,b){c.checkSupport("blob");try{return new Blob(a,{type:b})}catch(d){try{for(var e=window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder,f=new e,g=0;g<a.length;g++)f.append(a[g]);
return f.getBlob(b)}catch(d){throw new Error("Bug : can't construct the Blob.")}}};var n={stringifyByChunk:function(a,b,c){var d=[],e=0,f=a.length;if(f<=c)return String.fromCharCode.apply(null,a);for(;e<f;)"array"===b||"nodebuffer"===b?d.push(String.fromCharCode.apply(null,a.slice(e,Math.min(e+c,f)))):d.push(String.fromCharCode.apply(null,a.subarray(e,Math.min(e+c,f)))),e+=c;return d.join("")},stringifyByChar:function(a){for(var b="",c=0;c<a.length;c++)b+=String.fromCharCode(a[c]);return b},applyCanBeUsed:{uint8array:function(){try{return i.uint8array&&1===String.fromCharCode.apply(null,new Uint8Array(1)).length}catch(a){return!1}}(),nodebuffer:function(){try{return i.nodebuffer&&1===String.fromCharCode.apply(null,k.newBuffer(1)).length}catch(a){return!1}}()}};c.applyFromCharCode=g;var o={};o.string={string:e,array:function(a){return f(a,new Array(a.length))},arraybuffer:function(a){return o.string.uint8array(a).buffer},uint8array:function(a){return f(a,new Uint8Array(a.length))},nodebuffer:function(a){return f(a,k.newBuffer(a.length))}},o.array={string:g,array:e,arraybuffer:function(a){return new Uint8Array(a).buffer},uint8array:function(a){return new Uint8Array(a)},nodebuffer:function(a){return k.newBuffer(a)}},o.arraybuffer={string:function(a){return g(new Uint8Array(a))},array:function(a){return h(new Uint8Array(a),new Array(a.byteLength))},arraybuffer:e,uint8array:function(a){return new Uint8Array(a)},nodebuffer:function(a){return k.newBuffer(new Uint8Array(a))}},o.uint8array={string:g,array:function(a){return h(a,new Array(a.length))},arraybuffer:function(a){var b=new Uint8Array(a.length);return a.length&&b.set(a,0),b.buffer},uint8array:e,nodebuffer:function(a){return k.newBuffer(a)}},o.nodebuffer={string:g,array:function(a){return h(a,new Array(a.length))},arraybuffer:function(a){return o.nodebuffer.uint8array(a).buffer},uint8array:function(a){return h(a,new Uint8Array(a.length))},nodebuffer:e},c.transformTo=function(a,b){if(b||(b=""),!a)return b;c.checkSupport(a);var d=c.getTypeOf(b),e=o[d][a](b);return e},c.getTypeOf=function(a){return"string"==typeof a?"string":"[object Array]"===Object.prototype.toString.call(a)?"array":i.nodebuffer&&k.isBuffer(a)?"nodebuffer":i.uint8array&&a instanceof Uint8Array?"uint8array":i.arraybuffer&&a instanceof ArrayBuffer?"arraybuffer":void 0},c.checkSupport=function(a){var b=i[a.toLowerCase()];if(!b)throw new Error(a+" is not supported by this platform")},c.MAX_VALUE_16BITS=65535,c.MAX_VALUE_32BITS=-1,c.pretty=function(a){var b,c,d="";for(c=0;c<(a||"").length;c++)b=a.charCodeAt(c),d+="\\x"+(b<16?"0":"")+b.toString(16).toUpperCase();return d},c.delay=function(a,b,c){l(function(){a.apply(c||null,b||[])})},c.inherits=function(a,b){var c=function(){};c.prototype=b.prototype,a.prototype=new c},c.extend=function(){var a,b,c={};for(a=0;a<arguments.length;a++)for(b in arguments[a])arguments[a].hasOwnProperty(b)&&"undefined"==typeof c[b]&&(c[b]=arguments[a][b]);return c},c.prepareContent=function(a,b,e,f,g){var h=m.Promise.resolve(b).then(function(a){var b=i.blob&&(a instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(a))!==-1);return b&&"undefined"!=typeof FileReader?new m.Promise(function(b,c){var d=new FileReader;d.onload=function(a){b(a.target.result)},d.onerror=function(a){c(a.target.error)},d.readAsArrayBuffer(a)}):a});return h.then(function(b){var h=c.getTypeOf(b);return h?("arraybuffer"===h?b=c.transformTo("uint8array",b):"string"===h&&(g?b=j.decode(b):e&&f!==!0&&(b=d(b))),b):m.Promise.reject(new Error("The data of '"+a+"' is in an unsupported format !"))})}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,"core-js/library/fn/set-immediate":36}],33:[function(a,b,c){"use strict";function d(a){this.files=[],this.loadOptions=a}var e=a("./reader/readerFor"),f=a("./utils"),g=a("./signature"),h=a("./zipEntry"),i=(a("./utf8"),a("./support"));d.prototype={checkSignature:function(a){if(!this.reader.readAndCheckSignature(a)){this.reader.index-=4;var b=this.reader.readString(4);throw new Error("Corrupted zip or bug : unexpected signature ("+f.pretty(b)+", expected "+f.pretty(a)+")")}},isSignature:function(a,b){var c=this.reader.index;this.reader.setIndex(a);var d=this.reader.readString(4),e=d===b;return this.reader.setIndex(c),e},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var a=this.reader.readData(this.zipCommentLength),b=i.uint8array?"uint8array":"array",c=f.transformTo(b,a);this.zipComment=this.loadOptions.decodeFileName(c)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var a,b,c,d=this.zip64EndOfCentralSize-44,e=0;e<d;)a=this.reader.readInt(2),b=this.reader.readInt(4),c=this.reader.readData(b),this.zip64ExtensibleData[a]={id:a,length:b,value:c}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),this.disksCount>1)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var a,b;for(a=0;a<this.files.length;a++)b=this.files[a],this.reader.setIndex(b.localHeaderOffset),this.checkSignature(g.LOCAL_FILE_HEADER),b.readLocalPart(this.reader),b.handleUTF8(),b.processAttributes()},readCentralDir:function(){var a;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(g.CENTRAL_FILE_HEADER);)a=new h({zip64:this.zip64},this.loadOptions),a.readCentralPart(this.reader),this.files.push(a);if(this.centralDirRecords!==this.files.length&&0!==this.centralDirRecords&&0===this.files.length)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var a=this.reader.lastIndexOfSignature(g.CENTRAL_DIRECTORY_END);if(a<0){var b=!this.isSignature(0,g.LOCAL_FILE_HEADER);throw b?new Error("Can't find end of central directory : is this a zip file ? If it is, see http://stuk.github.io/jszip/documentation/howto/read_zip.html"):new Error("Corrupted zip : can't find end of central directory")}this.reader.setIndex(a);var c=a;if(this.checkSignature(g.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===f.MAX_VALUE_16BITS||this.diskWithCentralDirStart===f.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===f.MAX_VALUE_16BITS||this.centralDirRecords===f.MAX_VALUE_16BITS||this.centralDirSize===f.MAX_VALUE_32BITS||this.centralDirOffset===f.MAX_VALUE_32BITS){if(this.zip64=!0,a=this.reader.lastIndexOfSignature(g.ZIP64_CENTRAL_DIRECTORY_LOCATOR),a<0)throw new Error("Corrupted zip : can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(a),this.checkSignature(g.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,g.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(g.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip : can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(g.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var d=this.centralDirOffset+this.centralDirSize;this.zip64&&(d+=20,d+=12+this.zip64EndOfCentralSize);var e=c-d;if(e>0)this.isSignature(c,g.CENTRAL_FILE_HEADER)||(this.reader.zero=e);else if(e<0)throw new Error("Corrupted zip: missing "+Math.abs(e)+" bytes.")},prepareReader:function(a){this.reader=e(a)},load:function(a){this.prepareReader(a),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},b.exports=d},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utf8":31,"./utils":32,"./zipEntry":34}],34:[function(a,b,c){"use strict";function d(a,b){this.options=a,this.loadOptions=b}var e=a("./reader/readerFor"),f=a("./utils"),g=a("./compressedObject"),h=a("./crc32"),i=a("./utf8"),j=a("./compressions"),k=a("./support"),l=0,m=3,n=function(a){for(var b in j)if(j.hasOwnProperty(b)&&j[b].magic===a)return j[b];return null};d.prototype={isEncrypted:function(){return 1===(1&this.bitFlag)},useUTF8:function(){return 2048===(2048&this.bitFlag)},readLocalPart:function(a){var b,c;if(a.skip(22),this.fileNameLength=a.readInt(2),c=a.readInt(2),this.fileName=a.readData(this.fileNameLength),a.skip(c),this.compressedSize===-1||this.uncompressedSize===-1)throw new Error("Bug or corrupted zip : didn't get enough informations from the central directory (compressedSize === -1 || uncompressedSize === -1)");if(b=n(this.compressionMethod),null===b)throw new Error("Corrupted zip : compression "+f.pretty(this.compressionMethod)+" unknown (inner file : "+f.transformTo("string",this.fileName)+")");this.decompressed=new g(this.compressedSize,this.uncompressedSize,this.crc32,b,a.readData(this.compressedSize))},readCentralPart:function(a){this.versionMadeBy=a.readInt(2),a.skip(2),this.bitFlag=a.readInt(2),this.compressionMethod=a.readString(2),this.date=a.readDate(),this.crc32=a.readInt(4),this.compressedSize=a.readInt(4),this.uncompressedSize=a.readInt(4);var b=a.readInt(2);if(this.extraFieldsLength=a.readInt(2),this.fileCommentLength=a.readInt(2),this.diskNumberStart=a.readInt(2),this.internalFileAttributes=a.readInt(2),this.externalFileAttributes=a.readInt(4),this.localHeaderOffset=a.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");a.skip(b),this.readExtraFields(a),this.parseZIP64ExtraField(a),this.fileComment=a.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var a=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),a===l&&(this.dosPermissions=63&this.externalFileAttributes),a===m&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||"/"!==this.fileNameStr.slice(-1)||(this.dir=!0)},parseZIP64ExtraField:function(a){if(this.extraFields[1]){var b=e(this.extraFields[1].value);this.uncompressedSize===f.MAX_VALUE_32BITS&&(this.uncompressedSize=b.readInt(8)),this.compressedSize===f.MAX_VALUE_32BITS&&(this.compressedSize=b.readInt(8)),this.localHeaderOffset===f.MAX_VALUE_32BITS&&(this.localHeaderOffset=b.readInt(8)),this.diskNumberStart===f.MAX_VALUE_32BITS&&(this.diskNumberStart=b.readInt(4))}},readExtraFields:function(a){var b,c,d,e=a.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});a.index<e;)b=a.readInt(2),c=a.readInt(2),d=a.readData(c),this.extraFields[b]={id:b,length:c,value:d}},handleUTF8:function(){var a=k.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=i.utf8decode(this.fileName),this.fileCommentStr=i.utf8decode(this.fileComment);else{var b=this.findExtraFieldUnicodePath();if(null!==b)this.fileNameStr=b;else{var c=f.transformTo(a,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(c)}var d=this.findExtraFieldUnicodeComment();if(null!==d)this.fileCommentStr=d;else{var e=f.transformTo(a,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(e)}}},findExtraFieldUnicodePath:function(){var a=this.extraFields[28789];if(a){var b=e(a.value);return 1!==b.readInt(1)?null:h(this.fileName)!==b.readInt(4)?null:i.utf8decode(b.readData(a.length-5))}return null},findExtraFieldUnicodeComment:function(){var a=this.extraFields[25461];if(a){var b=e(a.value);return 1!==b.readInt(1)?null:h(this.fileComment)!==b.readInt(4)?null:i.utf8decode(b.readData(a.length-5))}return null}},b.exports=d},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(a,b,c){"use strict";var d=a("./stream/StreamHelper"),e=a("./stream/DataWorker"),f=a("./utf8"),g=a("./compressedObject"),h=a("./stream/GenericWorker"),i=function(a,b,c){this.name=a,this.dir=c.dir,this.date=c.date,this.comment=c.comment,this.unixPermissions=c.unixPermissions,this.dosPermissions=c.dosPermissions,this._data=b,this._dataBinary=c.binary,this.options={compression:c.compression,compressionOptions:c.compressionOptions}};i.prototype={internalStream:function(a){var b=a.toLowerCase(),c="string"===b||"text"===b;"binarystring"!==b&&"text"!==b||(b="string");var e=this._decompressWorker(),g=!this._dataBinary;return g&&!c&&(e=e.pipe(new f.Utf8EncodeWorker)),!g&&c&&(e=e.pipe(new f.Utf8DecodeWorker)),new d(e,b,"")},async:function(a,b){return this.internalStream(a).accumulate(b)},nodeStream:function(a,b){return this.internalStream(a||"nodebuffer").toNodejsStream(b)},_compressWorker:function(a,b){if(this._data instanceof g&&this._data.compression.magic===a.magic)return this._data.getCompressedWorker();var c=this._decompressWorker();return this._dataBinary||(c=c.pipe(new f.Utf8EncodeWorker)),g.createWorkerFrom(c,a,b)},_decompressWorker:function(){return this._data instanceof g?this._data.getContentWorker():this._data instanceof h?this._data:new e(this._data)}};for(var j=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],k=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},l=0;l<j.length;l++)i.prototype[j[l]]=k;b.exports=i},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(a,b,c){a("../modules/web.immediate"),b.exports=a("../modules/_core").setImmediate},{"../modules/_core":40,"../modules/web.immediate":56}],37:[function(a,b,c){b.exports=function(a){if("function"!=typeof a)throw TypeError(a+" is not a function!");return a}},{}],38:[function(a,b,c){var d=a("./_is-object");b.exports=function(a){if(!d(a))throw TypeError(a+" is not an object!");return a}},{"./_is-object":51}],39:[function(a,b,c){var d={}.toString;b.exports=function(a){return d.call(a).slice(8,-1)}},{}],40:[function(a,b,c){var d=b.exports={version:"2.3.0"};"number"==typeof __e&&(__e=d)},{}],41:[function(a,b,c){var d=a("./_a-function");b.exports=function(a,b,c){if(d(a),void 0===b)return a;switch(c){case 1:return function(c){return a.call(b,c)};case 2:return function(c,d){return a.call(b,c,d)};case 3:return function(c,d,e){return a.call(b,c,d,e)}}return function(){return a.apply(b,arguments)}}},{"./_a-function":37}],42:[function(a,b,c){b.exports=!a("./_fails")(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},{"./_fails":45}],43:[function(a,b,c){var d=a("./_is-object"),e=a("./_global").document,f=d(e)&&d(e.createElement);b.exports=function(a){return f?e.createElement(a):{}}},{"./_global":46,"./_is-object":51}],44:[function(a,b,c){var d=a("./_global"),e=a("./_core"),f=a("./_ctx"),g=a("./_hide"),h="prototype",i=function(a,b,c){var j,k,l,m=a&i.F,n=a&i.G,o=a&i.S,p=a&i.P,q=a&i.B,r=a&i.W,s=n?e:e[b]||(e[b]={}),t=s[h],u=n?d:o?d[b]:(d[b]||{})[h];n&&(c=b);for(j in c)k=!m&&u&&void 0!==u[j],k&&j in s||(l=k?u[j]:c[j],s[j]=n&&"function"!=typeof u[j]?c[j]:q&&k?f(l,d):r&&u[j]==l?function(a){var b=function(b,c,d){if(this instanceof a){switch(arguments.length){case 0:return new a;case 1:return new a(b);case 2:return new a(b,c)}return new a(b,c,d)}return a.apply(this,arguments)};return b[h]=a[h],b}(l):p&&"function"==typeof l?f(Function.call,l):l,p&&((s.virtual||(s.virtual={}))[j]=l,a&i.R&&t&&!t[j]&&g(t,j,l)))};i.F=1,i.G=2,i.S=4,i.P=8,i.B=16,i.W=32,i.U=64,i.R=128,b.exports=i},{"./_core":40,"./_ctx":41,"./_global":46,"./_hide":47}],45:[function(a,b,c){b.exports=function(a){try{return!!a()}catch(b){return!0}}},{}],46:[function(a,b,c){var d=b.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=d)},{}],47:[function(a,b,c){var d=a("./_object-dp"),e=a("./_property-desc");b.exports=a("./_descriptors")?function(a,b,c){return d.f(a,b,e(1,c))}:function(a,b,c){return a[b]=c,a}},{"./_descriptors":42,"./_object-dp":52,"./_property-desc":53}],48:[function(a,b,c){b.exports=a("./_global").document&&document.documentElement},{"./_global":46}],49:[function(a,b,c){b.exports=!a("./_descriptors")&&!a("./_fails")(function(){return 7!=Object.defineProperty(a("./_dom-create")("div"),"a",{get:function(){return 7}}).a})},{"./_descriptors":42,"./_dom-create":43,"./_fails":45}],50:[function(a,b,c){b.exports=function(a,b,c){var d=void 0===c;switch(b.length){case 0:return d?a():a.call(c);case 1:return d?a(b[0]):a.call(c,b[0]);case 2:return d?a(b[0],b[1]):a.call(c,b[0],b[1]);case 3:return d?a(b[0],b[1],b[2]):a.call(c,b[0],b[1],b[2]);case 4:return d?a(b[0],b[1],b[2],b[3]):a.call(c,b[0],b[1],b[2],b[3])}return a.apply(c,b)}},{}],51:[function(a,b,c){b.exports=function(a){return"object"==typeof a?null!==a:"function"==typeof a}},{}],52:[function(a,b,c){var d=a("./_an-object"),e=a("./_ie8-dom-define"),f=a("./_to-primitive"),g=Object.defineProperty;c.f=a("./_descriptors")?Object.defineProperty:function(a,b,c){if(d(a),b=f(b,!0),d(c),e)try{return g(a,b,c)}catch(h){}if("get"in c||"set"in c)throw TypeError("Accessors not supported!");return"value"in c&&(a[b]=c.value),a}},{"./_an-object":38,"./_descriptors":42,"./_ie8-dom-define":49,"./_to-primitive":55}],53:[function(a,b,c){b.exports=function(a,b){return{enumerable:!(1&a),configurable:!(2&a),writable:!(4&a),value:b}}},{}],54:[function(a,b,c){var d,e,f,g=a("./_ctx"),h=a("./_invoke"),i=a("./_html"),j=a("./_dom-create"),k=a("./_global"),l=k.process,m=k.setImmediate,n=k.clearImmediate,o=k.MessageChannel,p=0,q={},r="onreadystatechange",s=function(){var a=+this;if(q.hasOwnProperty(a)){var b=q[a];delete q[a],b()}},t=function(a){s.call(a.data)};m&&n||(m=function(a){for(var b=[],c=1;arguments.length>c;)b.push(arguments[c++]);return q[++p]=function(){h("function"==typeof a?a:Function(a),b)},d(p),p},n=function(a){delete q[a]},"process"==a("./_cof")(l)?d=function(a){l.nextTick(g(s,a,1))}:o?(e=new o,f=e.port2,e.port1.onmessage=t,d=g(f.postMessage,f,1)):k.addEventListener&&"function"==typeof postMessage&&!k.importScripts?(d=function(a){k.postMessage(a+"","*")},k.addEventListener("message",t,!1)):d=r in j("script")?function(a){i.appendChild(j("script"))[r]=function(){i.removeChild(this),s.call(a)}}:function(a){setTimeout(g(s,a,1),0)}),b.exports={set:m,clear:n}},{"./_cof":39,"./_ctx":41,"./_dom-create":43,"./_global":46,"./_html":48,"./_invoke":50}],55:[function(a,b,c){var d=a("./_is-object");b.exports=function(a,b){if(!d(a))return a;var c,e;if(b&&"function"==typeof(c=a.toString)&&!d(e=c.call(a)))return e;if("function"==typeof(c=a.valueOf)&&!d(e=c.call(a)))return e;if(!b&&"function"==typeof(c=a.toString)&&!d(e=c.call(a)))return e;throw TypeError("Can't convert object to primitive value")}},{"./_is-object":51}],56:[function(a,b,c){var d=a("./_export"),e=a("./_task");d(d.G+d.B,{setImmediate:e.set,clearImmediate:e.clear})},{"./_export":44,"./_task":54}],57:[function(a,b,c){(function(a){"use strict";function c(){k=!0;for(var a,b,c=l.length;c;){for(b=l,l=[],a=-1;++a<c;)b[a]();c=l.length}k=!1}function d(a){1!==l.push(a)||k||e()}var e,f=a.MutationObserver||a.WebKitMutationObserver;if(f){var g=0,h=new f(c),i=a.document.createTextNode("");h.observe(i,{characterData:!0}),e=function(){i.data=g=++g%2}}else if(a.setImmediate||"undefined"==typeof a.MessageChannel)e="document"in a&&"onreadystatechange"in a.document.createElement("script")?function(){var b=a.document.createElement("script");b.onreadystatechange=function(){c(),b.onreadystatechange=null,b.parentNode.removeChild(b),b=null},a.document.documentElement.appendChild(b)}:function(){setTimeout(c,0)};else{var j=new a.MessageChannel;j.port1.onmessage=c,e=function(){j.port2.postMessage(0)}}var k,l=[];b.exports=d}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],58:[function(a,b,c){"use strict";function d(){}function e(a){if("function"!=typeof a)throw new TypeError("resolver must be a function");this.state=s,this.queue=[],this.outcome=void 0,a!==d&&i(this,a)}function f(a,b,c){this.promise=a,"function"==typeof b&&(this.onFulfilled=b,this.callFulfilled=this.otherCallFulfilled),"function"==typeof c&&(this.onRejected=c,this.callRejected=this.otherCallRejected)}function g(a,b,c){o(function(){var d;try{d=b(c)}catch(e){return p.reject(a,e)}d===a?p.reject(a,new TypeError("Cannot resolve promise with itself")):p.resolve(a,d)})}function h(a){var b=a&&a.then;if(a&&"object"==typeof a&&"function"==typeof b)return function(){b.apply(a,arguments)}}function i(a,b){function c(b){f||(f=!0,p.reject(a,b))}function d(b){f||(f=!0,p.resolve(a,b))}function e(){b(d,c)}var f=!1,g=j(e);"error"===g.status&&c(g.value)}function j(a,b){var c={};try{c.value=a(b),c.status="success"}catch(d){c.status="error",c.value=d}return c}function k(a){return a instanceof this?a:p.resolve(new this(d),a)}function l(a){var b=new this(d);return p.reject(b,a)}function m(a){function b(a,b){function d(a){g[b]=a,++h!==e||f||(f=!0,p.resolve(j,g))}c.resolve(a).then(d,function(a){f||(f=!0,p.reject(j,a))})}var c=this;if("[object Array]"!==Object.prototype.toString.call(a))return this.reject(new TypeError("must be an array"));var e=a.length,f=!1;if(!e)return this.resolve([]);for(var g=new Array(e),h=0,i=-1,j=new this(d);++i<e;)b(a[i],i);return j}function n(a){function b(a){c.resolve(a).then(function(a){f||(f=!0,p.resolve(h,a))},function(a){f||(f=!0,p.reject(h,a))})}var c=this;if("[object Array]"!==Object.prototype.toString.call(a))return this.reject(new TypeError("must be an array"));var e=a.length,f=!1;if(!e)return this.resolve([]);for(var g=-1,h=new this(d);++g<e;)b(a[g]);return h}var o=a("immediate"),p={},q=["REJECTED"],r=["FULFILLED"],s=["PENDING"];b.exports=e,e.prototype["catch"]=function(a){return this.then(null,a)},e.prototype.then=function(a,b){if("function"!=typeof a&&this.state===r||"function"!=typeof b&&this.state===q)return this;var c=new this.constructor(d);if(this.state!==s){var e=this.state===r?a:b;g(c,e,this.outcome)}else this.queue.push(new f(c,a,b));return c},f.prototype.callFulfilled=function(a){p.resolve(this.promise,a)},f.prototype.otherCallFulfilled=function(a){g(this.promise,this.onFulfilled,a)},f.prototype.callRejected=function(a){p.reject(this.promise,a)},f.prototype.otherCallRejected=function(a){g(this.promise,this.onRejected,a)},p.resolve=function(a,b){var c=j(h,b);if("error"===c.status)return p.reject(a,c.value);var d=c.value;if(d)i(a,d);else{a.state=r,a.outcome=b;for(var e=-1,f=a.queue.length;++e<f;)a.queue[e].callFulfilled(b)}return a},p.reject=function(a,b){a.state=q,a.outcome=b;for(var c=-1,d=a.queue.length;++c<d;)a.queue[c].callRejected(b);return a},e.resolve=k,e.reject=l,e.all=m,e.race=n},{immediate:57}],59:[function(a,b,c){"use strict";var d=a("./lib/utils/common").assign,e=a("./lib/deflate"),f=a("./lib/inflate"),g=a("./lib/zlib/constants"),h={};d(h,e,f,g),b.exports=h},{"./lib/deflate":60,"./lib/inflate":61,"./lib/utils/common":62,"./lib/zlib/constants":65}],60:[function(a,b,c){"use strict";function d(a){if(!(this instanceof d))return new d(a);this.options=i.assign({level:s,method:u,chunkSize:16384,windowBits:15,memLevel:8,strategy:t,to:""},a||{});var b=this.options;b.raw&&b.windowBits>0?b.windowBits=-b.windowBits:b.gzip&&b.windowBits>0&&b.windowBits<16&&(b.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new l,this.strm.avail_out=0;var c=h.deflateInit2(this.strm,b.level,b.method,b.windowBits,b.memLevel,b.strategy);if(c!==p)throw new Error(k[c]);if(b.header&&h.deflateSetHeader(this.strm,b.header),b.dictionary){var e;if(e="string"==typeof b.dictionary?j.string2buf(b.dictionary):"[object ArrayBuffer]"===m.call(b.dictionary)?new Uint8Array(b.dictionary):b.dictionary,c=h.deflateSetDictionary(this.strm,e),c!==p)throw new Error(k[c]);this._dict_set=!0}}function e(a,b){var c=new d(b);if(c.push(a,!0),c.err)throw c.msg;return c.result}function f(a,b){return b=b||{},b.raw=!0,e(a,b)}function g(a,b){return b=b||{},b.gzip=!0,e(a,b)}var h=a("./zlib/deflate"),i=a("./utils/common"),j=a("./utils/strings"),k=a("./zlib/messages"),l=a("./zlib/zstream"),m=Object.prototype.toString,n=0,o=4,p=0,q=1,r=2,s=-1,t=0,u=8;d.prototype.push=function(a,b){var c,d,e=this.strm,f=this.options.chunkSize;if(this.ended)return!1;d=b===~~b?b:b===!0?o:n,"string"==typeof a?e.input=j.string2buf(a):"[object ArrayBuffer]"===m.call(a)?e.input=new Uint8Array(a):e.input=a,e.next_in=0,e.avail_in=e.input.length;do{if(0===e.avail_out&&(e.output=new i.Buf8(f),e.next_out=0,e.avail_out=f),c=h.deflate(e,d),c!==q&&c!==p)return this.onEnd(c),this.ended=!0,!1;0!==e.avail_out&&(0!==e.avail_in||d!==o&&d!==r)||("string"===this.options.to?this.onData(j.buf2binstring(i.shrinkBuf(e.output,e.next_out))):this.onData(i.shrinkBuf(e.output,e.next_out)))}while((e.avail_in>0||0===e.avail_out)&&c!==q);return d===o?(c=h.deflateEnd(this.strm),this.onEnd(c),this.ended=!0,c===p):d!==r||(this.onEnd(p),e.avail_out=0,!0)},d.prototype.onData=function(a){this.chunks.push(a)},d.prototype.onEnd=function(a){a===p&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=i.flattenChunks(this.chunks)),this.chunks=[],this.err=a,this.msg=this.strm.msg},c.Deflate=d,c.deflate=e,c.deflateRaw=f,c.gzip=g},{"./utils/common":62,"./utils/strings":63,"./zlib/deflate":67,"./zlib/messages":72,"./zlib/zstream":74}],61:[function(a,b,c){"use strict";function d(a){if(!(this instanceof d))return new d(a);this.options=h.assign({chunkSize:16384,windowBits:0,to:""},a||{});var b=this.options;b.raw&&b.windowBits>=0&&b.windowBits<16&&(b.windowBits=-b.windowBits,0===b.windowBits&&(b.windowBits=-15)),!(b.windowBits>=0&&b.windowBits<16)||a&&a.windowBits||(b.windowBits+=32),b.windowBits>15&&b.windowBits<48&&0===(15&b.windowBits)&&(b.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new l,this.strm.avail_out=0;var c=g.inflateInit2(this.strm,b.windowBits);if(c!==j.Z_OK)throw new Error(k[c]);this.header=new m,g.inflateGetHeader(this.strm,this.header)}function e(a,b){var c=new d(b);if(c.push(a,!0),c.err)throw c.msg;return c.result}function f(a,b){return b=b||{},b.raw=!0,e(a,b)}var g=a("./zlib/inflate"),h=a("./utils/common"),i=a("./utils/strings"),j=a("./zlib/constants"),k=a("./zlib/messages"),l=a("./zlib/zstream"),m=a("./zlib/gzheader"),n=Object.prototype.toString;d.prototype.push=function(a,b){var c,d,e,f,k,l,m=this.strm,o=this.options.chunkSize,p=this.options.dictionary,q=!1;if(this.ended)return!1;d=b===~~b?b:b===!0?j.Z_FINISH:j.Z_NO_FLUSH,"string"==typeof a?m.input=i.binstring2buf(a):"[object ArrayBuffer]"===n.call(a)?m.input=new Uint8Array(a):m.input=a,m.next_in=0,m.avail_in=m.input.length;do{if(0===m.avail_out&&(m.output=new h.Buf8(o),m.next_out=0,m.avail_out=o),c=g.inflate(m,j.Z_NO_FLUSH),c===j.Z_NEED_DICT&&p&&(l="string"==typeof p?i.string2buf(p):"[object ArrayBuffer]"===n.call(p)?new Uint8Array(p):p,c=g.inflateSetDictionary(this.strm,l)),c===j.Z_BUF_ERROR&&q===!0&&(c=j.Z_OK,q=!1),c!==j.Z_STREAM_END&&c!==j.Z_OK)return this.onEnd(c),this.ended=!0,!1;m.next_out&&(0!==m.avail_out&&c!==j.Z_STREAM_END&&(0!==m.avail_in||d!==j.Z_FINISH&&d!==j.Z_SYNC_FLUSH)||("string"===this.options.to?(e=i.utf8border(m.output,m.next_out),f=m.next_out-e,k=i.buf2string(m.output,e),m.next_out=f,m.avail_out=o-f,f&&h.arraySet(m.output,m.output,e,f,0),this.onData(k)):this.onData(h.shrinkBuf(m.output,m.next_out)))),0===m.avail_in&&0===m.avail_out&&(q=!0)}while((m.avail_in>0||0===m.avail_out)&&c!==j.Z_STREAM_END);return c===j.Z_STREAM_END&&(d=j.Z_FINISH),d===j.Z_FINISH?(c=g.inflateEnd(this.strm),this.onEnd(c),this.ended=!0,c===j.Z_OK):d!==j.Z_SYNC_FLUSH||(this.onEnd(j.Z_OK),m.avail_out=0,!0)},d.prototype.onData=function(a){this.chunks.push(a)},d.prototype.onEnd=function(a){a===j.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=h.flattenChunks(this.chunks)),this.chunks=[],this.err=a,this.msg=this.strm.msg},c.Inflate=d,c.inflate=e,c.inflateRaw=f,c.ungzip=e},{"./utils/common":62,"./utils/strings":63,"./zlib/constants":65,"./zlib/gzheader":68,"./zlib/inflate":70,"./zlib/messages":72,"./zlib/zstream":74}],62:[function(a,b,c){"use strict";var d="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;c.assign=function(a){for(var b=Array.prototype.slice.call(arguments,1);b.length;){var c=b.shift();if(c){if("object"!=typeof c)throw new TypeError(c+"must be non-object");for(var d in c)c.hasOwnProperty(d)&&(a[d]=c[d])}}return a},c.shrinkBuf=function(a,b){return a.length===b?a:a.subarray?a.subarray(0,b):(a.length=b,a)};var e={arraySet:function(a,b,c,d,e){if(b.subarray&&a.subarray)return void a.set(b.subarray(c,c+d),e);for(var f=0;f<d;f++)a[e+f]=b[c+f]},flattenChunks:function(a){var b,c,d,e,f,g;for(d=0,b=0,c=a.length;b<c;b++)d+=a[b].length;for(g=new Uint8Array(d),e=0,b=0,c=a.length;b<c;b++)f=a[b],g.set(f,e),e+=f.length;return g}},f={arraySet:function(a,b,c,d,e){for(var f=0;f<d;f++)a[e+f]=b[c+f]},flattenChunks:function(a){return[].concat.apply([],a)}};c.setTyped=function(a){a?(c.Buf8=Uint8Array,c.Buf16=Uint16Array,c.Buf32=Int32Array,c.assign(c,e)):(c.Buf8=Array,c.Buf16=Array,c.Buf32=Array,c.assign(c,f))},c.setTyped(d)},{}],63:[function(a,b,c){"use strict";function d(a,b){if(b<65537&&(a.subarray&&g||!a.subarray&&f))return String.fromCharCode.apply(null,e.shrinkBuf(a,b));for(var c="",d=0;d<b;d++)c+=String.fromCharCode(a[d]);return c}var e=a("./common"),f=!0,g=!0;try{String.fromCharCode.apply(null,[0])}catch(h){f=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(h){g=!1}for(var i=new e.Buf8(256),j=0;j<256;j++)i[j]=j>=252?6:j>=248?5:j>=240?4:j>=224?3:j>=192?2:1;i[254]=i[254]=1,c.string2buf=function(a){var b,c,d,f,g,h=a.length,i=0;for(f=0;f<h;f++)c=a.charCodeAt(f),55296===(64512&c)&&f+1<h&&(d=a.charCodeAt(f+1),56320===(64512&d)&&(c=65536+(c-55296<<10)+(d-56320),f++)),i+=c<128?1:c<2048?2:c<65536?3:4;for(b=new e.Buf8(i),g=0,f=0;g<i;f++)c=a.charCodeAt(f),55296===(64512&c)&&f+1<h&&(d=a.charCodeAt(f+1),56320===(64512&d)&&(c=65536+(c-55296<<10)+(d-56320),f++)),c<128?b[g++]=c:c<2048?(b[g++]=192|c>>>6,b[g++]=128|63&c):c<65536?(b[g++]=224|c>>>12,b[g++]=128|c>>>6&63,b[g++]=128|63&c):(b[g++]=240|c>>>18,b[g++]=128|c>>>12&63,b[g++]=128|c>>>6&63,b[g++]=128|63&c);return b},c.buf2binstring=function(a){return d(a,a.length)},c.binstring2buf=function(a){for(var b=new e.Buf8(a.length),c=0,d=b.length;c<d;c++)b[c]=a.charCodeAt(c);return b},c.buf2string=function(a,b){var c,e,f,g,h=b||a.length,j=new Array(2*h);for(e=0,c=0;c<h;)if(f=a[c++],f<128)j[e++]=f;else if(g=i[f],g>4)j[e++]=65533,c+=g-1;else{for(f&=2===g?31:3===g?15:7;g>1&&c<h;)f=f<<6|63&a[c++],g--;g>1?j[e++]=65533:f<65536?j[e++]=f:(f-=65536,j[e++]=55296|f>>10&1023,j[e++]=56320|1023&f)}return d(j,e)},c.utf8border=function(a,b){var c;for(b=b||a.length,b>a.length&&(b=a.length),c=b-1;c>=0&&128===(192&a[c]);)c--;return c<0?b:0===c?b:c+i[a[c]]>b?c:b}},{"./common":62}],64:[function(a,b,c){"use strict";function d(a,b,c,d){for(var e=65535&a|0,f=a>>>16&65535|0,g=0;0!==c;){g=c>2e3?2e3:c,c-=g;do e=e+b[d++]|0,f=f+e|0;while(--g);e%=65521,f%=65521}return e|f<<16|0}b.exports=d},{}],65:[function(a,b,c){"use strict";b.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],66:[function(a,b,c){"use strict";function d(){
for(var a,b=[],c=0;c<256;c++){a=c;for(var d=0;d<8;d++)a=1&a?3988292384^a>>>1:a>>>1;b[c]=a}return b}function e(a,b,c,d){var e=f,g=d+c;a^=-1;for(var h=d;h<g;h++)a=a>>>8^e[255&(a^b[h])];return a^-1}var f=d();b.exports=e},{}],67:[function(a,b,c){"use strict";function d(a,b){return a.msg=I[b],b}function e(a){return(a<<1)-(a>4?9:0)}function f(a){for(var b=a.length;--b>=0;)a[b]=0}function g(a){var b=a.state,c=b.pending;c>a.avail_out&&(c=a.avail_out),0!==c&&(E.arraySet(a.output,b.pending_buf,b.pending_out,c,a.next_out),a.next_out+=c,b.pending_out+=c,a.total_out+=c,a.avail_out-=c,b.pending-=c,0===b.pending&&(b.pending_out=0))}function h(a,b){F._tr_flush_block(a,a.block_start>=0?a.block_start:-1,a.strstart-a.block_start,b),a.block_start=a.strstart,g(a.strm)}function i(a,b){a.pending_buf[a.pending++]=b}function j(a,b){a.pending_buf[a.pending++]=b>>>8&255,a.pending_buf[a.pending++]=255&b}function k(a,b,c,d){var e=a.avail_in;return e>d&&(e=d),0===e?0:(a.avail_in-=e,E.arraySet(b,a.input,a.next_in,e,c),1===a.state.wrap?a.adler=G(a.adler,b,e,c):2===a.state.wrap&&(a.adler=H(a.adler,b,e,c)),a.next_in+=e,a.total_in+=e,e)}function l(a,b){var c,d,e=a.max_chain_length,f=a.strstart,g=a.prev_length,h=a.nice_match,i=a.strstart>a.w_size-la?a.strstart-(a.w_size-la):0,j=a.window,k=a.w_mask,l=a.prev,m=a.strstart+ka,n=j[f+g-1],o=j[f+g];a.prev_length>=a.good_match&&(e>>=2),h>a.lookahead&&(h=a.lookahead);do if(c=b,j[c+g]===o&&j[c+g-1]===n&&j[c]===j[f]&&j[++c]===j[f+1]){f+=2,c++;do;while(j[++f]===j[++c]&&j[++f]===j[++c]&&j[++f]===j[++c]&&j[++f]===j[++c]&&j[++f]===j[++c]&&j[++f]===j[++c]&&j[++f]===j[++c]&&j[++f]===j[++c]&&f<m);if(d=ka-(m-f),f=m-ka,d>g){if(a.match_start=b,g=d,d>=h)break;n=j[f+g-1],o=j[f+g]}}while((b=l[b&k])>i&&0!==--e);return g<=a.lookahead?g:a.lookahead}function m(a){var b,c,d,e,f,g=a.w_size;do{if(e=a.window_size-a.lookahead-a.strstart,a.strstart>=g+(g-la)){E.arraySet(a.window,a.window,g,g,0),a.match_start-=g,a.strstart-=g,a.block_start-=g,c=a.hash_size,b=c;do d=a.head[--b],a.head[b]=d>=g?d-g:0;while(--c);c=g,b=c;do d=a.prev[--b],a.prev[b]=d>=g?d-g:0;while(--c);e+=g}if(0===a.strm.avail_in)break;if(c=k(a.strm,a.window,a.strstart+a.lookahead,e),a.lookahead+=c,a.lookahead+a.insert>=ja)for(f=a.strstart-a.insert,a.ins_h=a.window[f],a.ins_h=(a.ins_h<<a.hash_shift^a.window[f+1])&a.hash_mask;a.insert&&(a.ins_h=(a.ins_h<<a.hash_shift^a.window[f+ja-1])&a.hash_mask,a.prev[f&a.w_mask]=a.head[a.ins_h],a.head[a.ins_h]=f,f++,a.insert--,!(a.lookahead+a.insert<ja)););}while(a.lookahead<la&&0!==a.strm.avail_in)}function n(a,b){var c=65535;for(c>a.pending_buf_size-5&&(c=a.pending_buf_size-5);;){if(a.lookahead<=1){if(m(a),0===a.lookahead&&b===J)return ua;if(0===a.lookahead)break}a.strstart+=a.lookahead,a.lookahead=0;var d=a.block_start+c;if((0===a.strstart||a.strstart>=d)&&(a.lookahead=a.strstart-d,a.strstart=d,h(a,!1),0===a.strm.avail_out))return ua;if(a.strstart-a.block_start>=a.w_size-la&&(h(a,!1),0===a.strm.avail_out))return ua}return a.insert=0,b===M?(h(a,!0),0===a.strm.avail_out?wa:xa):a.strstart>a.block_start&&(h(a,!1),0===a.strm.avail_out)?ua:ua}function o(a,b){for(var c,d;;){if(a.lookahead<la){if(m(a),a.lookahead<la&&b===J)return ua;if(0===a.lookahead)break}if(c=0,a.lookahead>=ja&&(a.ins_h=(a.ins_h<<a.hash_shift^a.window[a.strstart+ja-1])&a.hash_mask,c=a.prev[a.strstart&a.w_mask]=a.head[a.ins_h],a.head[a.ins_h]=a.strstart),0!==c&&a.strstart-c<=a.w_size-la&&(a.match_length=l(a,c)),a.match_length>=ja)if(d=F._tr_tally(a,a.strstart-a.match_start,a.match_length-ja),a.lookahead-=a.match_length,a.match_length<=a.max_lazy_match&&a.lookahead>=ja){a.match_length--;do a.strstart++,a.ins_h=(a.ins_h<<a.hash_shift^a.window[a.strstart+ja-1])&a.hash_mask,c=a.prev[a.strstart&a.w_mask]=a.head[a.ins_h],a.head[a.ins_h]=a.strstart;while(0!==--a.match_length);a.strstart++}else a.strstart+=a.match_length,a.match_length=0,a.ins_h=a.window[a.strstart],a.ins_h=(a.ins_h<<a.hash_shift^a.window[a.strstart+1])&a.hash_mask;else d=F._tr_tally(a,0,a.window[a.strstart]),a.lookahead--,a.strstart++;if(d&&(h(a,!1),0===a.strm.avail_out))return ua}return a.insert=a.strstart<ja-1?a.strstart:ja-1,b===M?(h(a,!0),0===a.strm.avail_out?wa:xa):a.last_lit&&(h(a,!1),0===a.strm.avail_out)?ua:va}function p(a,b){for(var c,d,e;;){if(a.lookahead<la){if(m(a),a.lookahead<la&&b===J)return ua;if(0===a.lookahead)break}if(c=0,a.lookahead>=ja&&(a.ins_h=(a.ins_h<<a.hash_shift^a.window[a.strstart+ja-1])&a.hash_mask,c=a.prev[a.strstart&a.w_mask]=a.head[a.ins_h],a.head[a.ins_h]=a.strstart),a.prev_length=a.match_length,a.prev_match=a.match_start,a.match_length=ja-1,0!==c&&a.prev_length<a.max_lazy_match&&a.strstart-c<=a.w_size-la&&(a.match_length=l(a,c),a.match_length<=5&&(a.strategy===U||a.match_length===ja&&a.strstart-a.match_start>4096)&&(a.match_length=ja-1)),a.prev_length>=ja&&a.match_length<=a.prev_length){e=a.strstart+a.lookahead-ja,d=F._tr_tally(a,a.strstart-1-a.prev_match,a.prev_length-ja),a.lookahead-=a.prev_length-1,a.prev_length-=2;do++a.strstart<=e&&(a.ins_h=(a.ins_h<<a.hash_shift^a.window[a.strstart+ja-1])&a.hash_mask,c=a.prev[a.strstart&a.w_mask]=a.head[a.ins_h],a.head[a.ins_h]=a.strstart);while(0!==--a.prev_length);if(a.match_available=0,a.match_length=ja-1,a.strstart++,d&&(h(a,!1),0===a.strm.avail_out))return ua}else if(a.match_available){if(d=F._tr_tally(a,0,a.window[a.strstart-1]),d&&h(a,!1),a.strstart++,a.lookahead--,0===a.strm.avail_out)return ua}else a.match_available=1,a.strstart++,a.lookahead--}return a.match_available&&(d=F._tr_tally(a,0,a.window[a.strstart-1]),a.match_available=0),a.insert=a.strstart<ja-1?a.strstart:ja-1,b===M?(h(a,!0),0===a.strm.avail_out?wa:xa):a.last_lit&&(h(a,!1),0===a.strm.avail_out)?ua:va}function q(a,b){for(var c,d,e,f,g=a.window;;){if(a.lookahead<=ka){if(m(a),a.lookahead<=ka&&b===J)return ua;if(0===a.lookahead)break}if(a.match_length=0,a.lookahead>=ja&&a.strstart>0&&(e=a.strstart-1,d=g[e],d===g[++e]&&d===g[++e]&&d===g[++e])){f=a.strstart+ka;do;while(d===g[++e]&&d===g[++e]&&d===g[++e]&&d===g[++e]&&d===g[++e]&&d===g[++e]&&d===g[++e]&&d===g[++e]&&e<f);a.match_length=ka-(f-e),a.match_length>a.lookahead&&(a.match_length=a.lookahead)}if(a.match_length>=ja?(c=F._tr_tally(a,1,a.match_length-ja),a.lookahead-=a.match_length,a.strstart+=a.match_length,a.match_length=0):(c=F._tr_tally(a,0,a.window[a.strstart]),a.lookahead--,a.strstart++),c&&(h(a,!1),0===a.strm.avail_out))return ua}return a.insert=0,b===M?(h(a,!0),0===a.strm.avail_out?wa:xa):a.last_lit&&(h(a,!1),0===a.strm.avail_out)?ua:va}function r(a,b){for(var c;;){if(0===a.lookahead&&(m(a),0===a.lookahead)){if(b===J)return ua;break}if(a.match_length=0,c=F._tr_tally(a,0,a.window[a.strstart]),a.lookahead--,a.strstart++,c&&(h(a,!1),0===a.strm.avail_out))return ua}return a.insert=0,b===M?(h(a,!0),0===a.strm.avail_out?wa:xa):a.last_lit&&(h(a,!1),0===a.strm.avail_out)?ua:va}function s(a,b,c,d,e){this.good_length=a,this.max_lazy=b,this.nice_length=c,this.max_chain=d,this.func=e}function t(a){a.window_size=2*a.w_size,f(a.head),a.max_lazy_match=D[a.level].max_lazy,a.good_match=D[a.level].good_length,a.nice_match=D[a.level].nice_length,a.max_chain_length=D[a.level].max_chain,a.strstart=0,a.block_start=0,a.lookahead=0,a.insert=0,a.match_length=a.prev_length=ja-1,a.match_available=0,a.ins_h=0}function u(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=$,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new E.Buf16(2*ha),this.dyn_dtree=new E.Buf16(2*(2*fa+1)),this.bl_tree=new E.Buf16(2*(2*ga+1)),f(this.dyn_ltree),f(this.dyn_dtree),f(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new E.Buf16(ia+1),this.heap=new E.Buf16(2*ea+1),f(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new E.Buf16(2*ea+1),f(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function v(a){var b;return a&&a.state?(a.total_in=a.total_out=0,a.data_type=Z,b=a.state,b.pending=0,b.pending_out=0,b.wrap<0&&(b.wrap=-b.wrap),b.status=b.wrap?na:sa,a.adler=2===b.wrap?0:1,b.last_flush=J,F._tr_init(b),O):d(a,Q)}function w(a){var b=v(a);return b===O&&t(a.state),b}function x(a,b){return a&&a.state?2!==a.state.wrap?Q:(a.state.gzhead=b,O):Q}function y(a,b,c,e,f,g){if(!a)return Q;var h=1;if(b===T&&(b=6),e<0?(h=0,e=-e):e>15&&(h=2,e-=16),f<1||f>_||c!==$||e<8||e>15||b<0||b>9||g<0||g>X)return d(a,Q);8===e&&(e=9);var i=new u;return a.state=i,i.strm=a,i.wrap=h,i.gzhead=null,i.w_bits=e,i.w_size=1<<i.w_bits,i.w_mask=i.w_size-1,i.hash_bits=f+7,i.hash_size=1<<i.hash_bits,i.hash_mask=i.hash_size-1,i.hash_shift=~~((i.hash_bits+ja-1)/ja),i.window=new E.Buf8(2*i.w_size),i.head=new E.Buf16(i.hash_size),i.prev=new E.Buf16(i.w_size),i.lit_bufsize=1<<f+6,i.pending_buf_size=4*i.lit_bufsize,i.pending_buf=new E.Buf8(i.pending_buf_size),i.d_buf=1*i.lit_bufsize,i.l_buf=3*i.lit_bufsize,i.level=b,i.strategy=g,i.method=c,w(a)}function z(a,b){return y(a,b,$,aa,ba,Y)}function A(a,b){var c,h,k,l;if(!a||!a.state||b>N||b<0)return a?d(a,Q):Q;if(h=a.state,!a.output||!a.input&&0!==a.avail_in||h.status===ta&&b!==M)return d(a,0===a.avail_out?S:Q);if(h.strm=a,c=h.last_flush,h.last_flush=b,h.status===na)if(2===h.wrap)a.adler=0,i(h,31),i(h,139),i(h,8),h.gzhead?(i(h,(h.gzhead.text?1:0)+(h.gzhead.hcrc?2:0)+(h.gzhead.extra?4:0)+(h.gzhead.name?8:0)+(h.gzhead.comment?16:0)),i(h,255&h.gzhead.time),i(h,h.gzhead.time>>8&255),i(h,h.gzhead.time>>16&255),i(h,h.gzhead.time>>24&255),i(h,9===h.level?2:h.strategy>=V||h.level<2?4:0),i(h,255&h.gzhead.os),h.gzhead.extra&&h.gzhead.extra.length&&(i(h,255&h.gzhead.extra.length),i(h,h.gzhead.extra.length>>8&255)),h.gzhead.hcrc&&(a.adler=H(a.adler,h.pending_buf,h.pending,0)),h.gzindex=0,h.status=oa):(i(h,0),i(h,0),i(h,0),i(h,0),i(h,0),i(h,9===h.level?2:h.strategy>=V||h.level<2?4:0),i(h,ya),h.status=sa);else{var m=$+(h.w_bits-8<<4)<<8,n=-1;n=h.strategy>=V||h.level<2?0:h.level<6?1:6===h.level?2:3,m|=n<<6,0!==h.strstart&&(m|=ma),m+=31-m%31,h.status=sa,j(h,m),0!==h.strstart&&(j(h,a.adler>>>16),j(h,65535&a.adler)),a.adler=1}if(h.status===oa)if(h.gzhead.extra){for(k=h.pending;h.gzindex<(65535&h.gzhead.extra.length)&&(h.pending!==h.pending_buf_size||(h.gzhead.hcrc&&h.pending>k&&(a.adler=H(a.adler,h.pending_buf,h.pending-k,k)),g(a),k=h.pending,h.pending!==h.pending_buf_size));)i(h,255&h.gzhead.extra[h.gzindex]),h.gzindex++;h.gzhead.hcrc&&h.pending>k&&(a.adler=H(a.adler,h.pending_buf,h.pending-k,k)),h.gzindex===h.gzhead.extra.length&&(h.gzindex=0,h.status=pa)}else h.status=pa;if(h.status===pa)if(h.gzhead.name){k=h.pending;do{if(h.pending===h.pending_buf_size&&(h.gzhead.hcrc&&h.pending>k&&(a.adler=H(a.adler,h.pending_buf,h.pending-k,k)),g(a),k=h.pending,h.pending===h.pending_buf_size)){l=1;break}l=h.gzindex<h.gzhead.name.length?255&h.gzhead.name.charCodeAt(h.gzindex++):0,i(h,l)}while(0!==l);h.gzhead.hcrc&&h.pending>k&&(a.adler=H(a.adler,h.pending_buf,h.pending-k,k)),0===l&&(h.gzindex=0,h.status=qa)}else h.status=qa;if(h.status===qa)if(h.gzhead.comment){k=h.pending;do{if(h.pending===h.pending_buf_size&&(h.gzhead.hcrc&&h.pending>k&&(a.adler=H(a.adler,h.pending_buf,h.pending-k,k)),g(a),k=h.pending,h.pending===h.pending_buf_size)){l=1;break}l=h.gzindex<h.gzhead.comment.length?255&h.gzhead.comment.charCodeAt(h.gzindex++):0,i(h,l)}while(0!==l);h.gzhead.hcrc&&h.pending>k&&(a.adler=H(a.adler,h.pending_buf,h.pending-k,k)),0===l&&(h.status=ra)}else h.status=ra;if(h.status===ra&&(h.gzhead.hcrc?(h.pending+2>h.pending_buf_size&&g(a),h.pending+2<=h.pending_buf_size&&(i(h,255&a.adler),i(h,a.adler>>8&255),a.adler=0,h.status=sa)):h.status=sa),0!==h.pending){if(g(a),0===a.avail_out)return h.last_flush=-1,O}else if(0===a.avail_in&&e(b)<=e(c)&&b!==M)return d(a,S);if(h.status===ta&&0!==a.avail_in)return d(a,S);if(0!==a.avail_in||0!==h.lookahead||b!==J&&h.status!==ta){var o=h.strategy===V?r(h,b):h.strategy===W?q(h,b):D[h.level].func(h,b);if(o!==wa&&o!==xa||(h.status=ta),o===ua||o===wa)return 0===a.avail_out&&(h.last_flush=-1),O;if(o===va&&(b===K?F._tr_align(h):b!==N&&(F._tr_stored_block(h,0,0,!1),b===L&&(f(h.head),0===h.lookahead&&(h.strstart=0,h.block_start=0,h.insert=0))),g(a),0===a.avail_out))return h.last_flush=-1,O}return b!==M?O:h.wrap<=0?P:(2===h.wrap?(i(h,255&a.adler),i(h,a.adler>>8&255),i(h,a.adler>>16&255),i(h,a.adler>>24&255),i(h,255&a.total_in),i(h,a.total_in>>8&255),i(h,a.total_in>>16&255),i(h,a.total_in>>24&255)):(j(h,a.adler>>>16),j(h,65535&a.adler)),g(a),h.wrap>0&&(h.wrap=-h.wrap),0!==h.pending?O:P)}function B(a){var b;return a&&a.state?(b=a.state.status,b!==na&&b!==oa&&b!==pa&&b!==qa&&b!==ra&&b!==sa&&b!==ta?d(a,Q):(a.state=null,b===sa?d(a,R):O)):Q}function C(a,b){var c,d,e,g,h,i,j,k,l=b.length;if(!a||!a.state)return Q;if(c=a.state,g=c.wrap,2===g||1===g&&c.status!==na||c.lookahead)return Q;for(1===g&&(a.adler=G(a.adler,b,l,0)),c.wrap=0,l>=c.w_size&&(0===g&&(f(c.head),c.strstart=0,c.block_start=0,c.insert=0),k=new E.Buf8(c.w_size),E.arraySet(k,b,l-c.w_size,c.w_size,0),b=k,l=c.w_size),h=a.avail_in,i=a.next_in,j=a.input,a.avail_in=l,a.next_in=0,a.input=b,m(c);c.lookahead>=ja;){d=c.strstart,e=c.lookahead-(ja-1);do c.ins_h=(c.ins_h<<c.hash_shift^c.window[d+ja-1])&c.hash_mask,c.prev[d&c.w_mask]=c.head[c.ins_h],c.head[c.ins_h]=d,d++;while(--e);c.strstart=d,c.lookahead=ja-1,m(c)}return c.strstart+=c.lookahead,c.block_start=c.strstart,c.insert=c.lookahead,c.lookahead=0,c.match_length=c.prev_length=ja-1,c.match_available=0,a.next_in=i,a.input=j,a.avail_in=h,c.wrap=g,O}var D,E=a("../utils/common"),F=a("./trees"),G=a("./adler32"),H=a("./crc32"),I=a("./messages"),J=0,K=1,L=3,M=4,N=5,O=0,P=1,Q=-2,R=-3,S=-5,T=-1,U=1,V=2,W=3,X=4,Y=0,Z=2,$=8,_=9,aa=15,ba=8,ca=29,da=256,ea=da+1+ca,fa=30,ga=19,ha=2*ea+1,ia=15,ja=3,ka=258,la=ka+ja+1,ma=32,na=42,oa=69,pa=73,qa=91,ra=103,sa=113,ta=666,ua=1,va=2,wa=3,xa=4,ya=3;D=[new s(0,0,0,0,n),new s(4,4,8,4,o),new s(4,5,16,8,o),new s(4,6,32,32,o),new s(4,4,16,16,p),new s(8,16,32,32,p),new s(8,16,128,128,p),new s(8,32,128,256,p),new s(32,128,258,1024,p),new s(32,258,258,4096,p)],c.deflateInit=z,c.deflateInit2=y,c.deflateReset=w,c.deflateResetKeep=v,c.deflateSetHeader=x,c.deflate=A,c.deflateEnd=B,c.deflateSetDictionary=C,c.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":62,"./adler32":64,"./crc32":66,"./messages":72,"./trees":73}],68:[function(a,b,c){"use strict";function d(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}b.exports=d},{}],69:[function(a,b,c){"use strict";var d=30,e=12;b.exports=function(a,b){var c,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C;c=a.state,f=a.next_in,B=a.input,g=f+(a.avail_in-5),h=a.next_out,C=a.output,i=h-(b-a.avail_out),j=h+(a.avail_out-257),k=c.dmax,l=c.wsize,m=c.whave,n=c.wnext,o=c.window,p=c.hold,q=c.bits,r=c.lencode,s=c.distcode,t=(1<<c.lenbits)-1,u=(1<<c.distbits)-1;a:do{q<15&&(p+=B[f++]<<q,q+=8,p+=B[f++]<<q,q+=8),v=r[p&t];b:for(;;){if(w=v>>>24,p>>>=w,q-=w,w=v>>>16&255,0===w)C[h++]=65535&v;else{if(!(16&w)){if(0===(64&w)){v=r[(65535&v)+(p&(1<<w)-1)];continue b}if(32&w){c.mode=e;break a}a.msg="invalid literal/length code",c.mode=d;break a}x=65535&v,w&=15,w&&(q<w&&(p+=B[f++]<<q,q+=8),x+=p&(1<<w)-1,p>>>=w,q-=w),q<15&&(p+=B[f++]<<q,q+=8,p+=B[f++]<<q,q+=8),v=s[p&u];c:for(;;){if(w=v>>>24,p>>>=w,q-=w,w=v>>>16&255,!(16&w)){if(0===(64&w)){v=s[(65535&v)+(p&(1<<w)-1)];continue c}a.msg="invalid distance code",c.mode=d;break a}if(y=65535&v,w&=15,q<w&&(p+=B[f++]<<q,q+=8,q<w&&(p+=B[f++]<<q,q+=8)),y+=p&(1<<w)-1,y>k){a.msg="invalid distance too far back",c.mode=d;break a}if(p>>>=w,q-=w,w=h-i,y>w){if(w=y-w,w>m&&c.sane){a.msg="invalid distance too far back",c.mode=d;break a}if(z=0,A=o,0===n){if(z+=l-w,w<x){x-=w;do C[h++]=o[z++];while(--w);z=h-y,A=C}}else if(n<w){if(z+=l+n-w,w-=n,w<x){x-=w;do C[h++]=o[z++];while(--w);if(z=0,n<x){w=n,x-=w;do C[h++]=o[z++];while(--w);z=h-y,A=C}}}else if(z+=n-w,w<x){x-=w;do C[h++]=o[z++];while(--w);z=h-y,A=C}for(;x>2;)C[h++]=A[z++],C[h++]=A[z++],C[h++]=A[z++],x-=3;x&&(C[h++]=A[z++],x>1&&(C[h++]=A[z++]))}else{z=h-y;do C[h++]=C[z++],C[h++]=C[z++],C[h++]=C[z++],x-=3;while(x>2);x&&(C[h++]=C[z++],x>1&&(C[h++]=C[z++]))}break}}break}}while(f<g&&h<j);x=q>>3,f-=x,q-=x<<3,p&=(1<<q)-1,a.next_in=f,a.next_out=h,a.avail_in=f<g?5+(g-f):5-(f-g),a.avail_out=h<j?257+(j-h):257-(h-j),c.hold=p,c.bits=q}},{}],70:[function(a,b,c){"use strict";function d(a){return(a>>>24&255)+(a>>>8&65280)+((65280&a)<<8)+((255&a)<<24)}function e(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new s.Buf16(320),this.work=new s.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function f(a){var b;return a&&a.state?(b=a.state,a.total_in=a.total_out=b.total=0,a.msg="",b.wrap&&(a.adler=1&b.wrap),b.mode=L,b.last=0,b.havedict=0,b.dmax=32768,b.head=null,b.hold=0,b.bits=0,b.lencode=b.lendyn=new s.Buf32(pa),b.distcode=b.distdyn=new s.Buf32(qa),b.sane=1,b.back=-1,D):G}function g(a){var b;return a&&a.state?(b=a.state,b.wsize=0,b.whave=0,b.wnext=0,f(a)):G}function h(a,b){var c,d;return a&&a.state?(d=a.state,b<0?(c=0,b=-b):(c=(b>>4)+1,b<48&&(b&=15)),b&&(b<8||b>15)?G:(null!==d.window&&d.wbits!==b&&(d.window=null),d.wrap=c,d.wbits=b,g(a))):G}function i(a,b){var c,d;return a?(d=new e,a.state=d,d.window=null,c=h(a,b),c!==D&&(a.state=null),c):G}function j(a){return i(a,sa)}function k(a){if(ta){var b;for(q=new s.Buf32(512),r=new s.Buf32(32),b=0;b<144;)a.lens[b++]=8;for(;b<256;)a.lens[b++]=9;for(;b<280;)a.lens[b++]=7;for(;b<288;)a.lens[b++]=8;for(w(y,a.lens,0,288,q,0,a.work,{bits:9}),b=0;b<32;)a.lens[b++]=5;w(z,a.lens,0,32,r,0,a.work,{bits:5}),ta=!1}a.lencode=q,a.lenbits=9,a.distcode=r,a.distbits=5}function l(a,b,c,d){var e,f=a.state;return null===f.window&&(f.wsize=1<<f.wbits,f.wnext=0,f.whave=0,f.window=new s.Buf8(f.wsize)),d>=f.wsize?(s.arraySet(f.window,b,c-f.wsize,f.wsize,0),f.wnext=0,f.whave=f.wsize):(e=f.wsize-f.wnext,e>d&&(e=d),s.arraySet(f.window,b,c-d,e,f.wnext),d-=e,d?(s.arraySet(f.window,b,c-d,d,0),f.wnext=d,f.whave=f.wsize):(f.wnext+=e,f.wnext===f.wsize&&(f.wnext=0),f.whave<f.wsize&&(f.whave+=e))),0}function m(a,b){var c,e,f,g,h,i,j,m,n,o,p,q,r,pa,qa,ra,sa,ta,ua,va,wa,xa,ya,za,Aa=0,Ba=new s.Buf8(4),Ca=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!a||!a.state||!a.output||!a.input&&0!==a.avail_in)return G;c=a.state,c.mode===W&&(c.mode=X),h=a.next_out,f=a.output,j=a.avail_out,g=a.next_in,e=a.input,i=a.avail_in,m=c.hold,n=c.bits,o=i,p=j,xa=D;a:for(;;)switch(c.mode){case L:if(0===c.wrap){c.mode=X;break}for(;n<16;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}if(2&c.wrap&&35615===m){c.check=0,Ba[0]=255&m,Ba[1]=m>>>8&255,c.check=u(c.check,Ba,2,0),m=0,n=0,c.mode=M;break}if(c.flags=0,c.head&&(c.head.done=!1),!(1&c.wrap)||(((255&m)<<8)+(m>>8))%31){a.msg="incorrect header check",c.mode=ma;break}if((15&m)!==K){a.msg="unknown compression method",c.mode=ma;break}if(m>>>=4,n-=4,wa=(15&m)+8,0===c.wbits)c.wbits=wa;else if(wa>c.wbits){a.msg="invalid window size",c.mode=ma;break}c.dmax=1<<wa,a.adler=c.check=1,c.mode=512&m?U:W,m=0,n=0;break;case M:for(;n<16;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}if(c.flags=m,(255&c.flags)!==K){a.msg="unknown compression method",c.mode=ma;break}if(57344&c.flags){a.msg="unknown header flags set",c.mode=ma;break}c.head&&(c.head.text=m>>8&1),512&c.flags&&(Ba[0]=255&m,Ba[1]=m>>>8&255,c.check=u(c.check,Ba,2,0)),m=0,n=0,c.mode=N;case N:for(;n<32;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}c.head&&(c.head.time=m),512&c.flags&&(Ba[0]=255&m,Ba[1]=m>>>8&255,Ba[2]=m>>>16&255,Ba[3]=m>>>24&255,c.check=u(c.check,Ba,4,0)),m=0,n=0,c.mode=O;case O:for(;n<16;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}c.head&&(c.head.xflags=255&m,c.head.os=m>>8),512&c.flags&&(Ba[0]=255&m,Ba[1]=m>>>8&255,c.check=u(c.check,Ba,2,0)),m=0,n=0,c.mode=P;case P:if(1024&c.flags){for(;n<16;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}c.length=m,c.head&&(c.head.extra_len=m),512&c.flags&&(Ba[0]=255&m,Ba[1]=m>>>8&255,c.check=u(c.check,Ba,2,0)),m=0,n=0}else c.head&&(c.head.extra=null);c.mode=Q;case Q:if(1024&c.flags&&(q=c.length,q>i&&(q=i),q&&(c.head&&(wa=c.head.extra_len-c.length,c.head.extra||(c.head.extra=new Array(c.head.extra_len)),s.arraySet(c.head.extra,e,g,q,wa)),512&c.flags&&(c.check=u(c.check,e,q,g)),i-=q,g+=q,c.length-=q),c.length))break a;c.length=0,c.mode=R;case R:if(2048&c.flags){if(0===i)break a;q=0;do wa=e[g+q++],c.head&&wa&&c.length<65536&&(c.head.name+=String.fromCharCode(wa));while(wa&&q<i);if(512&c.flags&&(c.check=u(c.check,e,q,g)),i-=q,g+=q,wa)break a}else c.head&&(c.head.name=null);c.length=0,c.mode=S;case S:if(4096&c.flags){if(0===i)break a;q=0;do wa=e[g+q++],c.head&&wa&&c.length<65536&&(c.head.comment+=String.fromCharCode(wa));while(wa&&q<i);if(512&c.flags&&(c.check=u(c.check,e,q,g)),i-=q,g+=q,wa)break a}else c.head&&(c.head.comment=null);c.mode=T;case T:if(512&c.flags){for(;n<16;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}if(m!==(65535&c.check)){a.msg="header crc mismatch",c.mode=ma;break}m=0,n=0}c.head&&(c.head.hcrc=c.flags>>9&1,c.head.done=!0),a.adler=c.check=0,c.mode=W;break;case U:for(;n<32;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}a.adler=c.check=d(m),m=0,n=0,c.mode=V;case V:if(0===c.havedict)return a.next_out=h,a.avail_out=j,a.next_in=g,a.avail_in=i,c.hold=m,c.bits=n,F;a.adler=c.check=1,c.mode=W;case W:if(b===B||b===C)break a;case X:if(c.last){m>>>=7&n,n-=7&n,c.mode=ja;break}for(;n<3;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}switch(c.last=1&m,m>>>=1,n-=1,3&m){case 0:c.mode=Y;break;case 1:if(k(c),c.mode=ca,b===C){m>>>=2,n-=2;break a}break;case 2:c.mode=_;break;case 3:a.msg="invalid block type",c.mode=ma}m>>>=2,n-=2;break;case Y:for(m>>>=7&n,n-=7&n;n<32;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}if((65535&m)!==(m>>>16^65535)){a.msg="invalid stored block lengths",c.mode=ma;break}if(c.length=65535&m,m=0,n=0,c.mode=Z,b===C)break a;case Z:c.mode=$;case $:if(q=c.length){if(q>i&&(q=i),q>j&&(q=j),0===q)break a;s.arraySet(f,e,g,q,h),i-=q,g+=q,j-=q,h+=q,c.length-=q;break}c.mode=W;break;case _:for(;n<14;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}if(c.nlen=(31&m)+257,m>>>=5,n-=5,c.ndist=(31&m)+1,m>>>=5,n-=5,c.ncode=(15&m)+4,m>>>=4,n-=4,c.nlen>286||c.ndist>30){a.msg="too many length or distance symbols",c.mode=ma;break}c.have=0,c.mode=aa;case aa:for(;c.have<c.ncode;){for(;n<3;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}c.lens[Ca[c.have++]]=7&m,m>>>=3,n-=3}for(;c.have<19;)c.lens[Ca[c.have++]]=0;if(c.lencode=c.lendyn,c.lenbits=7,ya={bits:c.lenbits},xa=w(x,c.lens,0,19,c.lencode,0,c.work,ya),c.lenbits=ya.bits,xa){a.msg="invalid code lengths set",c.mode=ma;break}c.have=0,c.mode=ba;case ba:for(;c.have<c.nlen+c.ndist;){for(;Aa=c.lencode[m&(1<<c.lenbits)-1],qa=Aa>>>24,ra=Aa>>>16&255,sa=65535&Aa,!(qa<=n);){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}if(sa<16)m>>>=qa,n-=qa,c.lens[c.have++]=sa;else{if(16===sa){for(za=qa+2;n<za;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}if(m>>>=qa,n-=qa,0===c.have){a.msg="invalid bit length repeat",c.mode=ma;break}wa=c.lens[c.have-1],q=3+(3&m),m>>>=2,n-=2}else if(17===sa){for(za=qa+3;n<za;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}m>>>=qa,n-=qa,wa=0,q=3+(7&m),m>>>=3,n-=3}else{for(za=qa+7;n<za;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}m>>>=qa,n-=qa,wa=0,q=11+(127&m),m>>>=7,n-=7}if(c.have+q>c.nlen+c.ndist){a.msg="invalid bit length repeat",c.mode=ma;break}for(;q--;)c.lens[c.have++]=wa}}if(c.mode===ma)break;if(0===c.lens[256]){a.msg="invalid code -- missing end-of-block",c.mode=ma;break}if(c.lenbits=9,ya={bits:c.lenbits},xa=w(y,c.lens,0,c.nlen,c.lencode,0,c.work,ya),c.lenbits=ya.bits,xa){a.msg="invalid literal/lengths set",c.mode=ma;break}if(c.distbits=6,c.distcode=c.distdyn,ya={bits:c.distbits},xa=w(z,c.lens,c.nlen,c.ndist,c.distcode,0,c.work,ya),c.distbits=ya.bits,xa){a.msg="invalid distances set",c.mode=ma;break}if(c.mode=ca,b===C)break a;case ca:c.mode=da;case da:if(i>=6&&j>=258){a.next_out=h,a.avail_out=j,a.next_in=g,a.avail_in=i,c.hold=m,c.bits=n,v(a,p),h=a.next_out,f=a.output,j=a.avail_out,g=a.next_in,e=a.input,i=a.avail_in,m=c.hold,n=c.bits,c.mode===W&&(c.back=-1);break}for(c.back=0;Aa=c.lencode[m&(1<<c.lenbits)-1],qa=Aa>>>24,ra=Aa>>>16&255,sa=65535&Aa,!(qa<=n);){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}if(ra&&0===(240&ra)){for(ta=qa,ua=ra,va=sa;Aa=c.lencode[va+((m&(1<<ta+ua)-1)>>ta)],qa=Aa>>>24,ra=Aa>>>16&255,sa=65535&Aa,!(ta+qa<=n);){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}m>>>=ta,n-=ta,c.back+=ta}if(m>>>=qa,n-=qa,c.back+=qa,c.length=sa,0===ra){c.mode=ia;break}if(32&ra){c.back=-1,c.mode=W;break}if(64&ra){a.msg="invalid literal/length code",c.mode=ma;break}c.extra=15&ra,c.mode=ea;case ea:if(c.extra){for(za=c.extra;n<za;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}c.length+=m&(1<<c.extra)-1,m>>>=c.extra,n-=c.extra,c.back+=c.extra}c.was=c.length,c.mode=fa;case fa:for(;Aa=c.distcode[m&(1<<c.distbits)-1],qa=Aa>>>24,ra=Aa>>>16&255,sa=65535&Aa,!(qa<=n);){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}if(0===(240&ra)){for(ta=qa,ua=ra,va=sa;Aa=c.distcode[va+((m&(1<<ta+ua)-1)>>ta)],qa=Aa>>>24,ra=Aa>>>16&255,sa=65535&Aa,!(ta+qa<=n);){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}m>>>=ta,n-=ta,c.back+=ta}if(m>>>=qa,n-=qa,c.back+=qa,64&ra){a.msg="invalid distance code",c.mode=ma;break}c.offset=sa,c.extra=15&ra,c.mode=ga;case ga:if(c.extra){for(za=c.extra;n<za;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}c.offset+=m&(1<<c.extra)-1,m>>>=c.extra,n-=c.extra,c.back+=c.extra}if(c.offset>c.dmax){a.msg="invalid distance too far back",c.mode=ma;break}c.mode=ha;case ha:if(0===j)break a;if(q=p-j,c.offset>q){if(q=c.offset-q,q>c.whave&&c.sane){a.msg="invalid distance too far back",c.mode=ma;break}q>c.wnext?(q-=c.wnext,r=c.wsize-q):r=c.wnext-q,q>c.length&&(q=c.length),pa=c.window}else pa=f,r=h-c.offset,q=c.length;q>j&&(q=j),j-=q,c.length-=q;do f[h++]=pa[r++];while(--q);0===c.length&&(c.mode=da);break;case ia:if(0===j)break a;f[h++]=c.length,j--,c.mode=da;break;case ja:if(c.wrap){for(;n<32;){if(0===i)break a;i--,m|=e[g++]<<n,n+=8}if(p-=j,a.total_out+=p,c.total+=p,p&&(a.adler=c.check=c.flags?u(c.check,f,p,h-p):t(c.check,f,p,h-p)),p=j,(c.flags?m:d(m))!==c.check){a.msg="incorrect data check",c.mode=ma;break}m=0,n=0}c.mode=ka;case ka:if(c.wrap&&c.flags){for(;n<32;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}if(m!==(4294967295&c.total)){a.msg="incorrect length check",c.mode=ma;break}m=0,n=0}c.mode=la;case la:xa=E;break a;case ma:xa=H;break a;case na:return I;case oa:default:return G}return a.next_out=h,a.avail_out=j,a.next_in=g,a.avail_in=i,c.hold=m,c.bits=n,(c.wsize||p!==a.avail_out&&c.mode<ma&&(c.mode<ja||b!==A))&&l(a,a.output,a.next_out,p-a.avail_out)?(c.mode=na,I):(o-=a.avail_in,p-=a.avail_out,a.total_in+=o,a.total_out+=p,c.total+=p,c.wrap&&p&&(a.adler=c.check=c.flags?u(c.check,f,p,a.next_out-p):t(c.check,f,p,a.next_out-p)),a.data_type=c.bits+(c.last?64:0)+(c.mode===W?128:0)+(c.mode===ca||c.mode===Z?256:0),(0===o&&0===p||b===A)&&xa===D&&(xa=J),xa)}function n(a){if(!a||!a.state)return G;var b=a.state;return b.window&&(b.window=null),a.state=null,D}function o(a,b){var c;return a&&a.state?(c=a.state,0===(2&c.wrap)?G:(c.head=b,b.done=!1,D)):G}function p(a,b){var c,d,e,f=b.length;return a&&a.state?(c=a.state,0!==c.wrap&&c.mode!==V?G:c.mode===V&&(d=1,d=t(d,b,f,0),d!==c.check)?H:(e=l(a,b,f,f))?(c.mode=na,I):(c.havedict=1,D)):G}var q,r,s=a("../utils/common"),t=a("./adler32"),u=a("./crc32"),v=a("./inffast"),w=a("./inftrees"),x=0,y=1,z=2,A=4,B=5,C=6,D=0,E=1,F=2,G=-2,H=-3,I=-4,J=-5,K=8,L=1,M=2,N=3,O=4,P=5,Q=6,R=7,S=8,T=9,U=10,V=11,W=12,X=13,Y=14,Z=15,$=16,_=17,aa=18,ba=19,ca=20,da=21,ea=22,fa=23,ga=24,ha=25,ia=26,ja=27,ka=28,la=29,ma=30,na=31,oa=32,pa=852,qa=592,ra=15,sa=ra,ta=!0;c.inflateReset=g,c.inflateReset2=h,c.inflateResetKeep=f,c.inflateInit=j,c.inflateInit2=i,c.inflate=m,c.inflateEnd=n,c.inflateGetHeader=o,c.inflateSetDictionary=p,c.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":62,"./adler32":64,"./crc32":66,"./inffast":69,"./inftrees":71}],71:[function(a,b,c){"use strict";var d=a("../utils/common"),e=15,f=852,g=592,h=0,i=1,j=2,k=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],l=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],m=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],n=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];b.exports=function(a,b,c,o,p,q,r,s){var t,u,v,w,x,y,z,A,B,C=s.bits,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=null,O=0,P=new d.Buf16(e+1),Q=new d.Buf16(e+1),R=null,S=0;for(D=0;D<=e;D++)P[D]=0;for(E=0;E<o;E++)P[b[c+E]]++;for(H=C,G=e;G>=1&&0===P[G];G--);if(H>G&&(H=G),0===G)return p[q++]=20971520,p[q++]=20971520,s.bits=1,0;for(F=1;F<G&&0===P[F];F++);for(H<F&&(H=F),K=1,D=1;D<=e;D++)if(K<<=1,K-=P[D],K<0)return-1;if(K>0&&(a===h||1!==G))return-1;for(Q[1]=0,D=1;D<e;D++)Q[D+1]=Q[D]+P[D];for(E=0;E<o;E++)0!==b[c+E]&&(r[Q[b[c+E]]++]=E);if(a===h?(N=R=r,y=19):a===i?(N=k,O-=257,R=l,S-=257,y=256):(N=m,R=n,y=-1),M=0,E=0,D=F,x=q,I=H,J=0,v=-1,L=1<<H,w=L-1,a===i&&L>f||a===j&&L>g)return 1;for(var T=0;;){T++,z=D-J,r[E]<y?(A=0,B=r[E]):r[E]>y?(A=R[S+r[E]],B=N[O+r[E]]):(A=96,B=0),t=1<<D-J,u=1<<I,F=u;do u-=t,p[x+(M>>J)+u]=z<<24|A<<16|B|0;while(0!==u);for(t=1<<D-1;M&t;)t>>=1;if(0!==t?(M&=t-1,M+=t):M=0,E++,0===--P[D]){if(D===G)break;D=b[c+r[E]]}if(D>H&&(M&w)!==v){for(0===J&&(J=H),x+=F,I=D-J,K=1<<I;I+J<G&&(K-=P[I+J],!(K<=0));)I++,K<<=1;if(L+=1<<I,a===i&&L>f||a===j&&L>g)return 1;v=M&w,p[v]=H<<24|I<<16|x-q|0}}return 0!==M&&(p[x+M]=D-J<<24|64<<16|0),s.bits=H,0}},{"../utils/common":62}],72:[function(a,b,c){"use strict";b.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],73:[function(a,b,c){"use strict";function d(a){for(var b=a.length;--b>=0;)a[b]=0}function e(a,b,c,d,e){this.static_tree=a,this.extra_bits=b,this.extra_base=c,this.elems=d,this.max_length=e,this.has_stree=a&&a.length}function f(a,b){this.dyn_tree=a,this.max_code=0,this.stat_desc=b}function g(a){return a<256?ia[a]:ia[256+(a>>>7)]}function h(a,b){a.pending_buf[a.pending++]=255&b,a.pending_buf[a.pending++]=b>>>8&255}function i(a,b,c){a.bi_valid>X-c?(a.bi_buf|=b<<a.bi_valid&65535,h(a,a.bi_buf),a.bi_buf=b>>X-a.bi_valid,a.bi_valid+=c-X):(a.bi_buf|=b<<a.bi_valid&65535,a.bi_valid+=c)}function j(a,b,c){i(a,c[2*b],c[2*b+1])}function k(a,b){var c=0;do c|=1&a,a>>>=1,c<<=1;while(--b>0);return c>>>1}function l(a){16===a.bi_valid?(h(a,a.bi_buf),a.bi_buf=0,a.bi_valid=0):a.bi_valid>=8&&(a.pending_buf[a.pending++]=255&a.bi_buf,a.bi_buf>>=8,a.bi_valid-=8)}function m(a,b){var c,d,e,f,g,h,i=b.dyn_tree,j=b.max_code,k=b.stat_desc.static_tree,l=b.stat_desc.has_stree,m=b.stat_desc.extra_bits,n=b.stat_desc.extra_base,o=b.stat_desc.max_length,p=0;for(f=0;f<=W;f++)a.bl_count[f]=0;for(i[2*a.heap[a.heap_max]+1]=0,c=a.heap_max+1;c<V;c++)d=a.heap[c],f=i[2*i[2*d+1]+1]+1,f>o&&(f=o,p++),i[2*d+1]=f,d>j||(a.bl_count[f]++,g=0,d>=n&&(g=m[d-n]),h=i[2*d],a.opt_len+=h*(f+g),l&&(a.static_len+=h*(k[2*d+1]+g)));if(0!==p){do{for(f=o-1;0===a.bl_count[f];)f--;a.bl_count[f]--,a.bl_count[f+1]+=2,a.bl_count[o]--,p-=2}while(p>0);for(f=o;0!==f;f--)for(d=a.bl_count[f];0!==d;)e=a.heap[--c],e>j||(i[2*e+1]!==f&&(a.opt_len+=(f-i[2*e+1])*i[2*e],i[2*e+1]=f),d--)}}function n(a,b,c){var d,e,f=new Array(W+1),g=0;
for(d=1;d<=W;d++)f[d]=g=g+c[d-1]<<1;for(e=0;e<=b;e++){var h=a[2*e+1];0!==h&&(a[2*e]=k(f[h]++,h))}}function o(){var a,b,c,d,f,g=new Array(W+1);for(c=0,d=0;d<Q-1;d++)for(ka[d]=c,a=0;a<1<<ba[d];a++)ja[c++]=d;for(ja[c-1]=d,f=0,d=0;d<16;d++)for(la[d]=f,a=0;a<1<<ca[d];a++)ia[f++]=d;for(f>>=7;d<T;d++)for(la[d]=f<<7,a=0;a<1<<ca[d]-7;a++)ia[256+f++]=d;for(b=0;b<=W;b++)g[b]=0;for(a=0;a<=143;)ga[2*a+1]=8,a++,g[8]++;for(;a<=255;)ga[2*a+1]=9,a++,g[9]++;for(;a<=279;)ga[2*a+1]=7,a++,g[7]++;for(;a<=287;)ga[2*a+1]=8,a++,g[8]++;for(n(ga,S+1,g),a=0;a<T;a++)ha[2*a+1]=5,ha[2*a]=k(a,5);ma=new e(ga,ba,R+1,S,W),na=new e(ha,ca,0,T,W),oa=new e(new Array(0),da,0,U,Y)}function p(a){var b;for(b=0;b<S;b++)a.dyn_ltree[2*b]=0;for(b=0;b<T;b++)a.dyn_dtree[2*b]=0;for(b=0;b<U;b++)a.bl_tree[2*b]=0;a.dyn_ltree[2*Z]=1,a.opt_len=a.static_len=0,a.last_lit=a.matches=0}function q(a){a.bi_valid>8?h(a,a.bi_buf):a.bi_valid>0&&(a.pending_buf[a.pending++]=a.bi_buf),a.bi_buf=0,a.bi_valid=0}function r(a,b,c,d){q(a),d&&(h(a,c),h(a,~c)),G.arraySet(a.pending_buf,a.window,b,c,a.pending),a.pending+=c}function s(a,b,c,d){var e=2*b,f=2*c;return a[e]<a[f]||a[e]===a[f]&&d[b]<=d[c]}function t(a,b,c){for(var d=a.heap[c],e=c<<1;e<=a.heap_len&&(e<a.heap_len&&s(b,a.heap[e+1],a.heap[e],a.depth)&&e++,!s(b,d,a.heap[e],a.depth));)a.heap[c]=a.heap[e],c=e,e<<=1;a.heap[c]=d}function u(a,b,c){var d,e,f,h,k=0;if(0!==a.last_lit)do d=a.pending_buf[a.d_buf+2*k]<<8|a.pending_buf[a.d_buf+2*k+1],e=a.pending_buf[a.l_buf+k],k++,0===d?j(a,e,b):(f=ja[e],j(a,f+R+1,b),h=ba[f],0!==h&&(e-=ka[f],i(a,e,h)),d--,f=g(d),j(a,f,c),h=ca[f],0!==h&&(d-=la[f],i(a,d,h)));while(k<a.last_lit);j(a,Z,b)}function v(a,b){var c,d,e,f=b.dyn_tree,g=b.stat_desc.static_tree,h=b.stat_desc.has_stree,i=b.stat_desc.elems,j=-1;for(a.heap_len=0,a.heap_max=V,c=0;c<i;c++)0!==f[2*c]?(a.heap[++a.heap_len]=j=c,a.depth[c]=0):f[2*c+1]=0;for(;a.heap_len<2;)e=a.heap[++a.heap_len]=j<2?++j:0,f[2*e]=1,a.depth[e]=0,a.opt_len--,h&&(a.static_len-=g[2*e+1]);for(b.max_code=j,c=a.heap_len>>1;c>=1;c--)t(a,f,c);e=i;do c=a.heap[1],a.heap[1]=a.heap[a.heap_len--],t(a,f,1),d=a.heap[1],a.heap[--a.heap_max]=c,a.heap[--a.heap_max]=d,f[2*e]=f[2*c]+f[2*d],a.depth[e]=(a.depth[c]>=a.depth[d]?a.depth[c]:a.depth[d])+1,f[2*c+1]=f[2*d+1]=e,a.heap[1]=e++,t(a,f,1);while(a.heap_len>=2);a.heap[--a.heap_max]=a.heap[1],m(a,b),n(f,j,a.bl_count)}function w(a,b,c){var d,e,f=-1,g=b[1],h=0,i=7,j=4;for(0===g&&(i=138,j=3),b[2*(c+1)+1]=65535,d=0;d<=c;d++)e=g,g=b[2*(d+1)+1],++h<i&&e===g||(h<j?a.bl_tree[2*e]+=h:0!==e?(e!==f&&a.bl_tree[2*e]++,a.bl_tree[2*$]++):h<=10?a.bl_tree[2*_]++:a.bl_tree[2*aa]++,h=0,f=e,0===g?(i=138,j=3):e===g?(i=6,j=3):(i=7,j=4))}function x(a,b,c){var d,e,f=-1,g=b[1],h=0,k=7,l=4;for(0===g&&(k=138,l=3),d=0;d<=c;d++)if(e=g,g=b[2*(d+1)+1],!(++h<k&&e===g)){if(h<l){do j(a,e,a.bl_tree);while(0!==--h)}else 0!==e?(e!==f&&(j(a,e,a.bl_tree),h--),j(a,$,a.bl_tree),i(a,h-3,2)):h<=10?(j(a,_,a.bl_tree),i(a,h-3,3)):(j(a,aa,a.bl_tree),i(a,h-11,7));h=0,f=e,0===g?(k=138,l=3):e===g?(k=6,l=3):(k=7,l=4)}}function y(a){var b;for(w(a,a.dyn_ltree,a.l_desc.max_code),w(a,a.dyn_dtree,a.d_desc.max_code),v(a,a.bl_desc),b=U-1;b>=3&&0===a.bl_tree[2*ea[b]+1];b--);return a.opt_len+=3*(b+1)+5+5+4,b}function z(a,b,c,d){var e;for(i(a,b-257,5),i(a,c-1,5),i(a,d-4,4),e=0;e<d;e++)i(a,a.bl_tree[2*ea[e]+1],3);x(a,a.dyn_ltree,b-1),x(a,a.dyn_dtree,c-1)}function A(a){var b,c=4093624447;for(b=0;b<=31;b++,c>>>=1)if(1&c&&0!==a.dyn_ltree[2*b])return I;if(0!==a.dyn_ltree[18]||0!==a.dyn_ltree[20]||0!==a.dyn_ltree[26])return J;for(b=32;b<R;b++)if(0!==a.dyn_ltree[2*b])return J;return I}function B(a){pa||(o(),pa=!0),a.l_desc=new f(a.dyn_ltree,ma),a.d_desc=new f(a.dyn_dtree,na),a.bl_desc=new f(a.bl_tree,oa),a.bi_buf=0,a.bi_valid=0,p(a)}function C(a,b,c,d){i(a,(L<<1)+(d?1:0),3),r(a,b,c,!0)}function D(a){i(a,M<<1,3),j(a,Z,ga),l(a)}function E(a,b,c,d){var e,f,g=0;a.level>0?(a.strm.data_type===K&&(a.strm.data_type=A(a)),v(a,a.l_desc),v(a,a.d_desc),g=y(a),e=a.opt_len+3+7>>>3,f=a.static_len+3+7>>>3,f<=e&&(e=f)):e=f=c+5,c+4<=e&&b!==-1?C(a,b,c,d):a.strategy===H||f===e?(i(a,(M<<1)+(d?1:0),3),u(a,ga,ha)):(i(a,(N<<1)+(d?1:0),3),z(a,a.l_desc.max_code+1,a.d_desc.max_code+1,g+1),u(a,a.dyn_ltree,a.dyn_dtree)),p(a),d&&q(a)}function F(a,b,c){return a.pending_buf[a.d_buf+2*a.last_lit]=b>>>8&255,a.pending_buf[a.d_buf+2*a.last_lit+1]=255&b,a.pending_buf[a.l_buf+a.last_lit]=255&c,a.last_lit++,0===b?a.dyn_ltree[2*c]++:(a.matches++,b--,a.dyn_ltree[2*(ja[c]+R+1)]++,a.dyn_dtree[2*g(b)]++),a.last_lit===a.lit_bufsize-1}var G=a("../utils/common"),H=4,I=0,J=1,K=2,L=0,M=1,N=2,O=3,P=258,Q=29,R=256,S=R+1+Q,T=30,U=19,V=2*S+1,W=15,X=16,Y=7,Z=256,$=16,_=17,aa=18,ba=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],ca=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],da=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],ea=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],fa=512,ga=new Array(2*(S+2));d(ga);var ha=new Array(2*T);d(ha);var ia=new Array(fa);d(ia);var ja=new Array(P-O+1);d(ja);var ka=new Array(Q);d(ka);var la=new Array(T);d(la);var ma,na,oa,pa=!1;c._tr_init=B,c._tr_stored_block=C,c._tr_flush_block=E,c._tr_tally=F,c._tr_align=D},{"../utils/common":62}],74:[function(a,b,c){"use strict";function d(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}b.exports=d},{}]},{},[10])(10)});
</script>
</html>