UNPKG

osgearthwasm

Version:

osgEarth ported to WebAssembly to run it on the web platform

38 lines 261 kB
var ss=Object.create;var Fi=Object.defineProperty;var us=Object.getOwnPropertyDescriptor;var fs=Object.getOwnPropertyNames;var cs=Object.getPrototypeOf,ls=Object.prototype.hasOwnProperty;var bi=(O,w)=>()=>(w||O((w={exports:{}}).exports,w),w.exports);var hs=(O,w,_,S)=>{if(w&&typeof w=="object"||typeof w=="function")for(let L of fs(w))!ls.call(O,L)&&L!==_&&Fi(O,L,{get:()=>w[L],enumerable:!(S=us(w,L))||S.enumerable});return O};var Ii=(O,w,_)=>(_=O!=null?ss(cs(O)):{},hs(w||!O||!O.__esModule?Fi(_,"default",{value:O,enumerable:!0}):_,O));var Ai=bi((Sr,un)=>{(function(w,_){typeof Sr=="object"&&typeof un=="object"?un.exports=_():typeof define=="function"&&define.amd?define([],_):typeof Sr=="object"?Sr.BrowserFS=_():w.BrowserFS=_()})(Sr,function(){return function(O){var w={};function _(S){if(w[S])return w[S].exports;var L=w[S]={i:S,l:!1,exports:{}};return O[S].call(L.exports,L,L.exports,_),L.l=!0,L.exports}return _.m=O,_.c=w,_.d=function(S,L,U){_.o(S,L)||Object.defineProperty(S,L,{configurable:!1,enumerable:!0,get:U})},_.n=function(S){var L=S&&S.__esModule?function(){return S.default}:function(){return S};return _.d(L,"a",L),L},_.o=function(S,L){return Object.prototype.hasOwnProperty.call(S,L)},_.p="",_(_.s=19)}([function(O,w,_){"use strict";var S=_(7),L=Object.keys||function(R){var M=[];for(var j in R)M.push(j);return M};O.exports=s;var U=_(3);U.inherits=_(1);var I=_(14),b=_(12);U.inherits(s,I);for(var h=L(b.prototype),f=0;f<h.length;f++){var g=h[f];s.prototype[g]||(s.prototype[g]=b.prototype[g])}function s(R){if(!(this instanceof s))return new s(R);I.call(this,R),b.call(this,R),R&&R.readable===!1&&(this.readable=!1),R&&R.writable===!1&&(this.writable=!1),this.allowHalfOpen=!0,R&&R.allowHalfOpen===!1&&(this.allowHalfOpen=!1),this.once("end",k)}function k(){this.allowHalfOpen||this._writableState.ended||S(T,this)}function T(R){R.end()}Object.defineProperty(s.prototype,"destroyed",{get:function(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set:function(R){this._readableState===void 0||this._writableState===void 0||(this._readableState.destroyed=R,this._writableState.destroyed=R)}}),s.prototype._destroy=function(R,M){this.push(null),this.end(),S(M,R)};function N(R,M){for(var j=0,Q=R.length;j<Q;j++)M(R[j],j)}},function(O,w){typeof Object.create=="function"?O.exports=function(S,L){S.super_=L,S.prototype=Object.create(L.prototype,{constructor:{value:S,enumerable:!1,writable:!0,configurable:!0}})}:O.exports=function(S,L){S.super_=L;var U=function(){};U.prototype=L.prototype,S.prototype=new U,S.prototype.constructor=S}},function(O,w,_){"use strict";var S=_(22),L=new S,U={};function I(h){U[h]||(typeof L[h]=="function"?U[h]=function(){return L[h].apply(L,arguments)}:U[h]=L[h])}for(var b in L)I(b);U.initializeTTYs=function(){L.stdin===null&&(L.initializeTTYs(),U.stdin=L.stdin,U.stdout=L.stdout,U.stderr=L.stderr)},L.nextTick(function(){U.initializeTTYs()}),O.exports=U},function(O,w,_){(function(S){function L(H){return Array.isArray?Array.isArray(H):Q(H)==="[object Array]"}w.isArray=L;function U(H){return typeof H=="boolean"}w.isBoolean=U;function I(H){return H===null}w.isNull=I;function b(H){return H==null}w.isNullOrUndefined=b;function h(H){return typeof H=="number"}w.isNumber=h;function f(H){return typeof H=="string"}w.isString=f;function g(H){return typeof H=="symbol"}w.isSymbol=g;function s(H){return H===void 0}w.isUndefined=s;function k(H){return Q(H)==="[object RegExp]"}w.isRegExp=k;function T(H){return typeof H=="object"&&H!==null}w.isObject=T;function N(H){return Q(H)==="[object Date]"}w.isDate=N;function R(H){return Q(H)==="[object Error]"||H instanceof Error}w.isError=R;function M(H){return typeof H=="function"}w.isFunction=M;function j(H){return H===null||typeof H=="boolean"||typeof H=="number"||typeof H=="string"||typeof H=="symbol"||typeof H>"u"}w.isPrimitive=j,w.isBuffer=S.isBuffer;function Q(H){return Object.prototype.toString.call(H)}}).call(w,_(9))},function(O,w,_){"use strict";var S=_(20),L=_(21);w.Buffer=h,w.SlowBuffer=Q,w.INSPECT_MAX_BYTES=50;var U=2147483647;w.kMaxLength=U,h.TYPED_ARRAY_SUPPORT=I(),!h.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function I(){try{var v=new Uint8Array(1);return v.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},v.foo()===42}catch{return!1}}function b(v){if(v>U)throw new RangeError("Invalid typed array length");var l=new Uint8Array(v);return l.__proto__=h.prototype,l}function h(v,l,c){if(typeof v=="number"){if(typeof l=="string")throw new Error("If encoding is specified then the first argument must be a string");return k(v)}return f(v,l,c)}typeof Symbol<"u"&&Symbol.species&&h[Symbol.species]===h&&Object.defineProperty(h,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),h.poolSize=8192;function f(v,l,c){if(typeof v=="number")throw new TypeError('"value" argument must not be a number');return m(v)?R(v,l,c):typeof v=="string"?T(v,l):M(v)}h.from=function(v,l,c){return f(v,l,c)},h.prototype.__proto__=Uint8Array.prototype,h.__proto__=Uint8Array;function g(v){if(typeof v!="number")throw new TypeError('"size" argument must be a number');if(v<0)throw new RangeError('"size" argument must not be negative')}function s(v,l,c){return g(v),v<=0?b(v):l!==void 0?typeof c=="string"?b(v).fill(l,c):b(v).fill(l):b(v)}h.alloc=function(v,l,c){return s(v,l,c)};function k(v){return g(v),b(v<0?0:j(v)|0)}h.allocUnsafe=function(v){return k(v)},h.allocUnsafeSlow=function(v){return k(v)};function T(v,l){if((typeof l!="string"||l==="")&&(l="utf8"),!h.isEncoding(l))throw new TypeError('"encoding" must be a valid string encoding');var c=H(v,l)|0,E=b(c),C=E.write(v,l);return C!==c&&(E=E.slice(0,C)),E}function N(v){for(var l=v.length<0?0:j(v.length)|0,c=b(l),E=0;E<l;E+=1)c[E]=v[E]&255;return c}function R(v,l,c){if(l<0||v.byteLength<l)throw new RangeError("'offset' is out of bounds");if(v.byteLength<l+(c||0))throw new RangeError("'length' is out of bounds");var E;return l===void 0&&c===void 0?E=new Uint8Array(v):c===void 0?E=new Uint8Array(v,l):E=new Uint8Array(v,l,c),E.__proto__=h.prototype,E}function M(v){if(h.isBuffer(v)){var l=j(v.length)|0,c=b(l);return c.length===0||v.copy(c,0,0,l),c}if(v){if(X(v)||"length"in v)return typeof v.length!="number"||et(v.length)?b(0):N(v);if(v.type==="Buffer"&&Array.isArray(v.data))return N(v.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function j(v){if(v>=U)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+U.toString(16)+" bytes");return v|0}function Q(v){return+v!=v&&(v=0),h.alloc(+v)}h.isBuffer=function(l){return l!=null&&l._isBuffer===!0},h.compare=function(l,c){if(!h.isBuffer(l)||!h.isBuffer(c))throw new TypeError("Arguments must be Buffers");if(l===c)return 0;for(var E=l.length,C=c.length,Y=0,J=Math.min(E,C);Y<J;++Y)if(l[Y]!==c[Y]){E=l[Y],C=c[Y];break}return E<C?-1:C<E?1:0},h.isEncoding=function(l){switch(String(l).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},h.concat=function(l,c){if(!Array.isArray(l))throw new TypeError('"list" argument must be an Array of Buffers');if(l.length===0)return h.alloc(0);var E;if(c===void 0)for(c=0,E=0;E<l.length;++E)c+=l[E].length;var C=h.allocUnsafe(c),Y=0;for(E=0;E<l.length;++E){var J=l[E];if(!h.isBuffer(J))throw new TypeError('"list" argument must be an Array of Buffers');J.copy(C,Y),Y+=J.length}return C};function H(v,l){if(h.isBuffer(v))return v.length;if(X(v)||m(v))return v.byteLength;typeof v!="string"&&(v=""+v);var c=v.length;if(c===0)return 0;for(var E=!1;;)switch(l){case"ascii":case"latin1":case"binary":return c;case"utf8":case"utf-8":case void 0:return Pt(v).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return c*2;case"hex":return c>>>1;case"base64":return ut(v).length;default:if(E)return Pt(v).length;l=(""+l).toLowerCase(),E=!0}}h.byteLength=H;function rt(v,l,c){var E=!1;if((l===void 0||l<0)&&(l=0),l>this.length||((c===void 0||c>this.length)&&(c=this.length),c<=0)||(c>>>=0,l>>>=0,c<=l))return"";for(v||(v="utf8");;)switch(v){case"hex":return jt(this,l,c);case"utf8":case"utf-8":return Lt(this,l,c);case"ascii":return Zt(this,l,c);case"latin1":case"binary":return qt(this,l,c);case"base64":return Tt(this,l,c);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return oe(this,l,c);default:if(E)throw new TypeError("Unknown encoding: "+v);v=(v+"").toLowerCase(),E=!0}}h.prototype._isBuffer=!0;function q(v,l,c){var E=v[l];v[l]=v[c],v[c]=E}h.prototype.swap16=function(){var l=this.length;if(l%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var c=0;c<l;c+=2)q(this,c,c+1);return this},h.prototype.swap32=function(){var l=this.length;if(l%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var c=0;c<l;c+=4)q(this,c,c+3),q(this,c+1,c+2);return this},h.prototype.swap64=function(){var l=this.length;if(l%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var c=0;c<l;c+=8)q(this,c,c+7),q(this,c+1,c+6),q(this,c+2,c+5),q(this,c+3,c+4);return this},h.prototype.toString=function(){var l=this.length;return l===0?"":arguments.length===0?Lt(this,0,l):rt.apply(this,arguments)},h.prototype.equals=function(l){if(!h.isBuffer(l))throw new TypeError("Argument must be a Buffer");return this===l?!0:h.compare(this,l)===0},h.prototype.inspect=function(){var l="",c=w.INSPECT_MAX_BYTES;return this.length>0&&(l=this.toString("hex",0,c).match(/.{2}/g).join(" "),this.length>c&&(l+=" ... ")),"<Buffer "+l+">"},h.prototype.compare=function(l,c,E,C,Y){if(!h.isBuffer(l))throw new TypeError("Argument must be a Buffer");if(c===void 0&&(c=0),E===void 0&&(E=l?l.length:0),C===void 0&&(C=0),Y===void 0&&(Y=this.length),c<0||E>l.length||C<0||Y>this.length)throw new RangeError("out of range index");if(C>=Y&&c>=E)return 0;if(C>=Y)return-1;if(c>=E)return 1;if(c>>>=0,E>>>=0,C>>>=0,Y>>>=0,this===l)return 0;for(var J=Y-C,St=E-c,kt=Math.min(J,St),Ot=this.slice(C,Y),Ut=l.slice(c,E),Ft=0;Ft<kt;++Ft)if(Ot[Ft]!==Ut[Ft]){J=Ot[Ft],St=Ut[Ft];break}return J<St?-1:St<J?1:0};function mt(v,l,c,E,C){if(v.length===0)return-1;if(typeof c=="string"?(E=c,c=0):c>2147483647?c=2147483647:c<-2147483648&&(c=-2147483648),c=+c,et(c)&&(c=C?0:v.length-1),c<0&&(c=v.length+c),c>=v.length){if(C)return-1;c=v.length-1}else if(c<0)if(C)c=0;else return-1;if(typeof l=="string"&&(l=h.from(l,E)),h.isBuffer(l))return l.length===0?-1:ct(v,l,c,E,C);if(typeof l=="number")return l=l&255,typeof Uint8Array.prototype.indexOf=="function"?C?Uint8Array.prototype.indexOf.call(v,l,c):Uint8Array.prototype.lastIndexOf.call(v,l,c):ct(v,[l],c,E,C);throw new TypeError("val must be string, number or Buffer")}function ct(v,l,c,E,C){var Y=1,J=v.length,St=l.length;if(E!==void 0&&(E=String(E).toLowerCase(),E==="ucs2"||E==="ucs-2"||E==="utf16le"||E==="utf-16le")){if(v.length<2||l.length<2)return-1;Y=2,J/=2,St/=2,c/=2}function kt(bt,ne){return Y===1?bt[ne]:bt.readUInt16BE(ne*Y)}var Ot;if(C){var Ut=-1;for(Ot=c;Ot<J;Ot++)if(kt(v,Ot)===kt(l,Ut===-1?0:Ot-Ut)){if(Ut===-1&&(Ut=Ot),Ot-Ut+1===St)return Ut*Y}else Ut!==-1&&(Ot-=Ot-Ut),Ut=-1}else for(c+St>J&&(c=J-St),Ot=c;Ot>=0;Ot--){for(var Ft=!0,Ht=0;Ht<St;Ht++)if(kt(v,Ot+Ht)!==kt(l,Ht)){Ft=!1;break}if(Ft)return Ot}return-1}h.prototype.includes=function(l,c,E){return this.indexOf(l,c,E)!==-1},h.prototype.indexOf=function(l,c,E){return mt(this,l,c,E,!0)},h.prototype.lastIndexOf=function(l,c,E){return mt(this,l,c,E,!1)};function P(v,l,c,E){c=Number(c)||0;var C=v.length-c;E?(E=Number(E),E>C&&(E=C)):E=C;var Y=l.length;if(Y%2!==0)throw new TypeError("Invalid hex string");E>Y/2&&(E=Y/2);for(var J=0;J<E;++J){var St=parseInt(l.substr(J*2,2),16);if(et(St))return J;v[c+J]=St}return J}function ht(v,l,c,E){return x(Pt(l,v.length-c),v,c,E)}function $(v,l,c,E){return x(Ct(l),v,c,E)}function gt(v,l,c,E){return $(v,l,c,E)}function It(v,l,c,E){return x(ut(l),v,c,E)}function vt(v,l,c,E){return x(Mt(l,v.length-c),v,c,E)}h.prototype.write=function(l,c,E,C){if(c===void 0)C="utf8",E=this.length,c=0;else if(E===void 0&&typeof c=="string")C=c,E=this.length,c=0;else if(isFinite(c))c=c>>>0,isFinite(E)?(E=E>>>0,C===void 0&&(C="utf8")):(C=E,E=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var Y=this.length-c;if((E===void 0||E>Y)&&(E=Y),l.length>0&&(E<0||c<0)||c>this.length)throw new RangeError("Attempt to write outside buffer bounds");C||(C="utf8");for(var J=!1;;)switch(C){case"hex":return P(this,l,c,E);case"utf8":case"utf-8":return ht(this,l,c,E);case"ascii":return $(this,l,c,E);case"latin1":case"binary":return gt(this,l,c,E);case"base64":return It(this,l,c,E);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return vt(this,l,c,E);default:if(J)throw new TypeError("Unknown encoding: "+C);C=(""+C).toLowerCase(),J=!0}},h.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Tt(v,l,c){return l===0&&c===v.length?S.fromByteArray(v):S.fromByteArray(v.slice(l,c))}function Lt(v,l,c){c=Math.min(v.length,c);for(var E=[],C=l;C<c;){var Y=v[C],J=null,St=Y>239?4:Y>223?3:Y>191?2:1;if(C+St<=c){var kt,Ot,Ut,Ft;switch(St){case 1:Y<128&&(J=Y);break;case 2:kt=v[C+1],(kt&192)===128&&(Ft=(Y&31)<<6|kt&63,Ft>127&&(J=Ft));break;case 3:kt=v[C+1],Ot=v[C+2],(kt&192)===128&&(Ot&192)===128&&(Ft=(Y&15)<<12|(kt&63)<<6|Ot&63,Ft>2047&&(Ft<55296||Ft>57343)&&(J=Ft));break;case 4:kt=v[C+1],Ot=v[C+2],Ut=v[C+3],(kt&192)===128&&(Ot&192)===128&&(Ut&192)===128&&(Ft=(Y&15)<<18|(kt&63)<<12|(Ot&63)<<6|Ut&63,Ft>65535&&Ft<1114112&&(J=Ft))}}J===null?(J=65533,St=1):J>65535&&(J-=65536,E.push(J>>>10&1023|55296),J=56320|J&1023),E.push(J),C+=St}return Rt(E)}var pt=4096;function Rt(v){var l=v.length;if(l<=pt)return String.fromCharCode.apply(String,v);for(var c="",E=0;E<l;)c+=String.fromCharCode.apply(String,v.slice(E,E+=pt));return c}function Zt(v,l,c){var E="";c=Math.min(v.length,c);for(var C=l;C<c;++C)E+=String.fromCharCode(v[C]&127);return E}function qt(v,l,c){var E="";c=Math.min(v.length,c);for(var C=l;C<c;++C)E+=String.fromCharCode(v[C]);return E}function jt(v,l,c){var E=v.length;(!l||l<0)&&(l=0),(!c||c<0||c>E)&&(c=E);for(var C="",Y=l;Y<c;++Y)C+=te(v[Y]);return C}function oe(v,l,c){for(var E=v.slice(l,c),C="",Y=0;Y<E.length;Y+=2)C+=String.fromCharCode(E[Y]+E[Y+1]*256);return C}h.prototype.slice=function(l,c){var E=this.length;l=~~l,c=c===void 0?E:~~c,l<0?(l+=E,l<0&&(l=0)):l>E&&(l=E),c<0?(c+=E,c<0&&(c=0)):c>E&&(c=E),c<l&&(c=l);var C=this.subarray(l,c);return C.__proto__=h.prototype,C};function xt(v,l,c){if(v%1!==0||v<0)throw new RangeError("offset is not uint");if(v+l>c)throw new RangeError("Trying to access beyond buffer length")}h.prototype.readUIntLE=function(l,c,E){l=l>>>0,c=c>>>0,E||xt(l,c,this.length);for(var C=this[l],Y=1,J=0;++J<c&&(Y*=256);)C+=this[l+J]*Y;return C},h.prototype.readUIntBE=function(l,c,E){l=l>>>0,c=c>>>0,E||xt(l,c,this.length);for(var C=this[l+--c],Y=1;c>0&&(Y*=256);)C+=this[l+--c]*Y;return C},h.prototype.readUInt8=function(l,c){return l=l>>>0,c||xt(l,1,this.length),this[l]},h.prototype.readUInt16LE=function(l,c){return l=l>>>0,c||xt(l,2,this.length),this[l]|this[l+1]<<8},h.prototype.readUInt16BE=function(l,c){return l=l>>>0,c||xt(l,2,this.length),this[l]<<8|this[l+1]},h.prototype.readUInt32LE=function(l,c){return l=l>>>0,c||xt(l,4,this.length),(this[l]|this[l+1]<<8|this[l+2]<<16)+this[l+3]*16777216},h.prototype.readUInt32BE=function(l,c){return l=l>>>0,c||xt(l,4,this.length),this[l]*16777216+(this[l+1]<<16|this[l+2]<<8|this[l+3])},h.prototype.readIntLE=function(l,c,E){l=l>>>0,c=c>>>0,E||xt(l,c,this.length);for(var C=this[l],Y=1,J=0;++J<c&&(Y*=256);)C+=this[l+J]*Y;return Y*=128,C>=Y&&(C-=Math.pow(2,8*c)),C},h.prototype.readIntBE=function(l,c,E){l=l>>>0,c=c>>>0,E||xt(l,c,this.length);for(var C=c,Y=1,J=this[l+--C];C>0&&(Y*=256);)J+=this[l+--C]*Y;return Y*=128,J>=Y&&(J-=Math.pow(2,8*c)),J},h.prototype.readInt8=function(l,c){return l=l>>>0,c||xt(l,1,this.length),this[l]&128?(255-this[l]+1)*-1:this[l]},h.prototype.readInt16LE=function(l,c){l=l>>>0,c||xt(l,2,this.length);var E=this[l]|this[l+1]<<8;return E&32768?E|4294901760:E},h.prototype.readInt16BE=function(l,c){l=l>>>0,c||xt(l,2,this.length);var E=this[l+1]|this[l]<<8;return E&32768?E|4294901760:E},h.prototype.readInt32LE=function(l,c){return l=l>>>0,c||xt(l,4,this.length),this[l]|this[l+1]<<8|this[l+2]<<16|this[l+3]<<24},h.prototype.readInt32BE=function(l,c){return l=l>>>0,c||xt(l,4,this.length),this[l]<<24|this[l+1]<<16|this[l+2]<<8|this[l+3]},h.prototype.readFloatLE=function(l,c){return l=l>>>0,c||xt(l,4,this.length),L.read(this,l,!0,23,4)},h.prototype.readFloatBE=function(l,c){return l=l>>>0,c||xt(l,4,this.length),L.read(this,l,!1,23,4)},h.prototype.readDoubleLE=function(l,c){return l=l>>>0,c||xt(l,8,this.length),L.read(this,l,!0,52,8)},h.prototype.readDoubleBE=function(l,c){return l=l>>>0,c||xt(l,8,this.length),L.read(this,l,!1,52,8)};function A(v,l,c,E,C,Y){if(!h.isBuffer(v))throw new TypeError('"buffer" argument must be a Buffer instance');if(l>C||l<Y)throw new RangeError('"value" argument is out of bounds');if(c+E>v.length)throw new RangeError("Index out of range")}h.prototype.writeUIntLE=function(l,c,E,C){if(l=+l,c=c>>>0,E=E>>>0,!C){var Y=Math.pow(2,8*E)-1;A(this,l,c,E,Y,0)}var J=1,St=0;for(this[c]=l&255;++St<E&&(J*=256);)this[c+St]=l/J&255;return c+E},h.prototype.writeUIntBE=function(l,c,E,C){if(l=+l,c=c>>>0,E=E>>>0,!C){var Y=Math.pow(2,8*E)-1;A(this,l,c,E,Y,0)}var J=E-1,St=1;for(this[c+J]=l&255;--J>=0&&(St*=256);)this[c+J]=l/St&255;return c+E},h.prototype.writeUInt8=function(l,c,E){return l=+l,c=c>>>0,E||A(this,l,c,1,255,0),this[c]=l&255,c+1},h.prototype.writeUInt16LE=function(l,c,E){return l=+l,c=c>>>0,E||A(this,l,c,2,65535,0),this[c]=l&255,this[c+1]=l>>>8,c+2},h.prototype.writeUInt16BE=function(l,c,E){return l=+l,c=c>>>0,E||A(this,l,c,2,65535,0),this[c]=l>>>8,this[c+1]=l&255,c+2},h.prototype.writeUInt32LE=function(l,c,E){return l=+l,c=c>>>0,E||A(this,l,c,4,4294967295,0),this[c+3]=l>>>24,this[c+2]=l>>>16,this[c+1]=l>>>8,this[c]=l&255,c+4},h.prototype.writeUInt32BE=function(l,c,E){return l=+l,c=c>>>0,E||A(this,l,c,4,4294967295,0),this[c]=l>>>24,this[c+1]=l>>>16,this[c+2]=l>>>8,this[c+3]=l&255,c+4},h.prototype.writeIntLE=function(l,c,E,C){if(l=+l,c=c>>>0,!C){var Y=Math.pow(2,8*E-1);A(this,l,c,E,Y-1,-Y)}var J=0,St=1,kt=0;for(this[c]=l&255;++J<E&&(St*=256);)l<0&&kt===0&&this[c+J-1]!==0&&(kt=1),this[c+J]=(l/St>>0)-kt&255;return c+E},h.prototype.writeIntBE=function(l,c,E,C){if(l=+l,c=c>>>0,!C){var Y=Math.pow(2,8*E-1);A(this,l,c,E,Y-1,-Y)}var J=E-1,St=1,kt=0;for(this[c+J]=l&255;--J>=0&&(St*=256);)l<0&&kt===0&&this[c+J+1]!==0&&(kt=1),this[c+J]=(l/St>>0)-kt&255;return c+E},h.prototype.writeInt8=function(l,c,E){return l=+l,c=c>>>0,E||A(this,l,c,1,127,-128),l<0&&(l=255+l+1),this[c]=l&255,c+1},h.prototype.writeInt16LE=function(l,c,E){return l=+l,c=c>>>0,E||A(this,l,c,2,32767,-32768),this[c]=l&255,this[c+1]=l>>>8,c+2},h.prototype.writeInt16BE=function(l,c,E){return l=+l,c=c>>>0,E||A(this,l,c,2,32767,-32768),this[c]=l>>>8,this[c+1]=l&255,c+2},h.prototype.writeInt32LE=function(l,c,E){return l=+l,c=c>>>0,E||A(this,l,c,4,2147483647,-2147483648),this[c]=l&255,this[c+1]=l>>>8,this[c+2]=l>>>16,this[c+3]=l>>>24,c+4},h.prototype.writeInt32BE=function(l,c,E){return l=+l,c=c>>>0,E||A(this,l,c,4,2147483647,-2147483648),l<0&&(l=4294967295+l+1),this[c]=l>>>24,this[c+1]=l>>>16,this[c+2]=l>>>8,this[c+3]=l&255,c+4};function B(v,l,c,E,C,Y){if(c+E>v.length)throw new RangeError("Index out of range");if(c<0)throw new RangeError("Index out of range")}function G(v,l,c,E,C){return l=+l,c=c>>>0,C||B(v,l,c,4,34028234663852886e22,-34028234663852886e22),L.write(v,l,c,E,23,4),c+4}h.prototype.writeFloatLE=function(l,c,E){return G(this,l,c,!0,E)},h.prototype.writeFloatBE=function(l,c,E){return G(this,l,c,!1,E)};function ot(v,l,c,E,C){return l=+l,c=c>>>0,C||B(v,l,c,8,17976931348623157e292,-17976931348623157e292),L.write(v,l,c,E,52,8),c+8}h.prototype.writeDoubleLE=function(l,c,E){return ot(this,l,c,!0,E)},h.prototype.writeDoubleBE=function(l,c,E){return ot(this,l,c,!1,E)},h.prototype.copy=function(l,c,E,C){if(E||(E=0),!C&&C!==0&&(C=this.length),c>=l.length&&(c=l.length),c||(c=0),C>0&&C<E&&(C=E),C===E||l.length===0||this.length===0)return 0;if(c<0)throw new RangeError("targetStart out of bounds");if(E<0||E>=this.length)throw new RangeError("sourceStart out of bounds");if(C<0)throw new RangeError("sourceEnd out of bounds");C>this.length&&(C=this.length),l.length-c<C-E&&(C=l.length-c+E);var Y=C-E,J;if(this===l&&E<c&&c<C)for(J=Y-1;J>=0;--J)l[J+c]=this[J+E];else if(Y<1e3)for(J=0;J<Y;++J)l[J+c]=this[J+E];else Uint8Array.prototype.set.call(l,this.subarray(E,E+Y),c);return Y},h.prototype.fill=function(l,c,E,C){if(typeof l=="string"){if(typeof c=="string"?(C=c,c=0,E=this.length):typeof E=="string"&&(C=E,E=this.length),l.length===1){var Y=l.charCodeAt(0);Y<256&&(l=Y)}if(C!==void 0&&typeof C!="string")throw new TypeError("encoding must be a string");if(typeof C=="string"&&!h.isEncoding(C))throw new TypeError("Unknown encoding: "+C)}else typeof l=="number"&&(l=l&255);if(c<0||this.length<c||this.length<E)throw new RangeError("Out of range index");if(E<=c)return this;c=c>>>0,E=E===void 0?this.length:E>>>0,l||(l=0);var J;if(typeof l=="number")for(J=c;J<E;++J)this[J]=l;else{var St=h.isBuffer(l)?l:new h(l,C),kt=St.length;for(J=0;J<E-c;++J)this[J+c]=St[J%kt]}return this};var wt=/[^+/0-9A-Za-z-_]/g;function _t(v){if(v=v.trim().replace(wt,""),v.length<2)return"";for(;v.length%4!==0;)v=v+"=";return v}function te(v){return v<16?"0"+v.toString(16):v.toString(16)}function Pt(v,l){l=l||1/0;for(var c,E=v.length,C=null,Y=[],J=0;J<E;++J){if(c=v.charCodeAt(J),c>55295&&c<57344){if(!C){if(c>56319){(l-=3)>-1&&Y.push(239,191,189);continue}else if(J+1===E){(l-=3)>-1&&Y.push(239,191,189);continue}C=c;continue}if(c<56320){(l-=3)>-1&&Y.push(239,191,189),C=c;continue}c=(C-55296<<10|c-56320)+65536}else C&&(l-=3)>-1&&Y.push(239,191,189);if(C=null,c<128){if((l-=1)<0)break;Y.push(c)}else if(c<2048){if((l-=2)<0)break;Y.push(c>>6|192,c&63|128)}else if(c<65536){if((l-=3)<0)break;Y.push(c>>12|224,c>>6&63|128,c&63|128)}else if(c<1114112){if((l-=4)<0)break;Y.push(c>>18|240,c>>12&63|128,c>>6&63|128,c&63|128)}else throw new Error("Invalid code point")}return Y}function Ct(v){for(var l=[],c=0;c<v.length;++c)l.push(v.charCodeAt(c)&255);return l}function Mt(v,l){for(var c,E,C,Y=[],J=0;J<v.length&&!((l-=2)<0);++J)c=v.charCodeAt(J),E=c>>8,C=c%256,Y.push(C),Y.push(E);return Y}function ut(v){return S.toByteArray(_t(v))}function x(v,l,c,E){for(var C=0;C<E&&!(C+c>=l.length||C>=v.length);++C)l[C+c]=v[C];return C}function m(v){return v instanceof ArrayBuffer||v!=null&&v.constructor!=null&&v.constructor.name==="ArrayBuffer"&&typeof v.byteLength=="number"}function X(v){return typeof ArrayBuffer.isView=="function"&&ArrayBuffer.isView(v)}function et(v){return v!==v}},function(O,w){var _;_=function(){return this}();try{_=_||Function("return this")()||(0,eval)("this")}catch{typeof window=="object"&&(_=window)}O.exports=_},function(O,w){function _(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}O.exports=_,_.EventEmitter=_,_.prototype._events=void 0,_.prototype._maxListeners=void 0,_.defaultMaxListeners=10,_.prototype.setMaxListeners=function(b){if(!L(b)||b<0||isNaN(b))throw TypeError("n must be a positive number");return this._maxListeners=b,this},_.prototype.emit=function(b){var h,f,g,s,k,T;if(this._events||(this._events={}),b==="error"&&(!this._events.error||U(this._events.error)&&!this._events.error.length)){if(h=arguments[1],h instanceof Error)throw h;var N=new Error('Uncaught, unspecified "error" event. ('+h+")");throw N.context=h,N}if(f=this._events[b],I(f))return!1;if(S(f))switch(arguments.length){case 1:f.call(this);break;case 2:f.call(this,arguments[1]);break;case 3:f.call(this,arguments[1],arguments[2]);break;default:s=Array.prototype.slice.call(arguments,1),f.apply(this,s)}else if(U(f))for(s=Array.prototype.slice.call(arguments,1),T=f.slice(),g=T.length,k=0;k<g;k++)T[k].apply(this,s);return!0},_.prototype.addListener=function(b,h){var f;if(!S(h))throw TypeError("listener must be a function");return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",b,S(h.listener)?h.listener:h),this._events[b]?U(this._events[b])?this._events[b].push(h):this._events[b]=[this._events[b],h]:this._events[b]=h,U(this._events[b])&&!this._events[b].warned&&(I(this._maxListeners)?f=_.defaultMaxListeners:f=this._maxListeners,f&&f>0&&this._events[b].length>f&&(this._events[b].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[b].length),typeof console.trace=="function"&&console.trace())),this},_.prototype.on=_.prototype.addListener,_.prototype.once=function(b,h){if(!S(h))throw TypeError("listener must be a function");var f=!1;function g(){this.removeListener(b,g),f||(f=!0,h.apply(this,arguments))}return g.listener=h,this.on(b,g),this},_.prototype.removeListener=function(b,h){var f,g,s,k;if(!S(h))throw TypeError("listener must be a function");if(!this._events||!this._events[b])return this;if(f=this._events[b],s=f.length,g=-1,f===h||S(f.listener)&&f.listener===h)delete this._events[b],this._events.removeListener&&this.emit("removeListener",b,h);else if(U(f)){for(k=s;k-- >0;)if(f[k]===h||f[k].listener&&f[k].listener===h){g=k;break}if(g<0)return this;f.length===1?(f.length=0,delete this._events[b]):f.splice(g,1),this._events.removeListener&&this.emit("removeListener",b,h)}return this},_.prototype.removeAllListeners=function(b){var h,f;if(!this._events)return this;if(!this._events.removeListener)return arguments.length===0?this._events={}:this._events[b]&&delete this._events[b],this;if(arguments.length===0){for(h in this._events)h!=="removeListener"&&this.removeAllListeners(h);return this.removeAllListeners("removeListener"),this._events={},this}if(f=this._events[b],S(f))this.removeListener(b,f);else if(f)for(;f.length;)this.removeListener(b,f[f.length-1]);return delete this._events[b],this},_.prototype.listeners=function(b){var h;return!this._events||!this._events[b]?h=[]:S(this._events[b])?h=[this._events[b]]:h=this._events[b].slice(),h},_.prototype.listenerCount=function(b){if(this._events){var h=this._events[b];if(S(h))return 1;if(h)return h.length}return 0},_.listenerCount=function(b,h){return b.listenerCount(h)};function S(b){return typeof b=="function"}function L(b){return typeof b=="number"}function U(b){return typeof b=="object"&&b!==null}function I(b){return b===void 0}},function(O,w,_){"use strict";(function(S){!S.version||S.version.indexOf("v0.")===0||S.version.indexOf("v1.")===0&&S.version.indexOf("v1.8.")!==0?O.exports=L:O.exports=S.nextTick;function L(U,I,b,h){if(typeof U!="function")throw new TypeError('"callback" argument must be a function');var f=arguments.length,g,s;switch(f){case 0:case 1:return S.nextTick(U);case 2:return S.nextTick(function(){U.call(null,I)});case 3:return S.nextTick(function(){U.call(null,I,b)});case 4:return S.nextTick(function(){U.call(null,I,b,h)});default:for(g=new Array(f-1),s=0;s<g.length;)g[s++]=arguments[s];return S.nextTick(function(){U.apply(null,g)})}}}).call(w,_(2))},function(O,w,_){"use strict";var S=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";w.assign=function(I){for(var b=Array.prototype.slice.call(arguments,1);b.length;){var h=b.shift();if(h){if(typeof h!="object")throw new TypeError(h+"must be non-object");for(var f in h)h.hasOwnProperty(f)&&(I[f]=h[f])}}return I},w.shrinkBuf=function(I,b){return I.length===b?I:I.subarray?I.subarray(0,b):(I.length=b,I)};var L={arraySet:function(I,b,h,f,g){if(b.subarray&&I.subarray){I.set(b.subarray(h,h+f),g);return}for(var s=0;s<f;s++)I[g+s]=b[h+s]},flattenChunks:function(I){var b,h,f,g,s,k;for(f=0,b=0,h=I.length;b<h;b++)f+=I[b].length;for(k=new Uint8Array(f),g=0,b=0,h=I.length;b<h;b++)s=I[b],k.set(s,g),g+=s.length;return k}},U={arraySet:function(I,b,h,f,g){for(var s=0;s<f;s++)I[g+s]=b[h+s]},flattenChunks:function(I){return[].concat.apply([],I)}};w.setTyped=function(I){I?(w.Buf8=Uint8Array,w.Buf16=Uint16Array,w.Buf32=Int32Array,w.assign(w,L)):(w.Buf8=Array,w.Buf16=Array,w.Buf32=Array,w.assign(w,U))},w.setTyped(S)},function(O,w,_){O.exports=_(4).Buffer},function(O,w,_){w=O.exports=_(14),w.Stream=w,w.Readable=w,w.Writable=_(12),w.Duplex=_(0),w.Transform=_(18),w.PassThrough=_(29)},function(O,w,_){var S=_(4),L=S.Buffer;function U(b,h){for(var f in b)h[f]=b[f]}L.from&&L.alloc&&L.allocUnsafe&&L.allocUnsafeSlow?O.exports=S:(U(S,w),w.Buffer=I);function I(b,h,f){return L(b,h,f)}U(L,I),I.from=function(b,h,f){if(typeof b=="number")throw new TypeError("Argument must not be a number");return L(b,h,f)},I.alloc=function(b,h,f){if(typeof b!="number")throw new TypeError("Argument must be a number");var g=L(b);return h!==void 0?typeof f=="string"?g.fill(h,f):g.fill(h):g.fill(0),g},I.allocUnsafe=function(b){if(typeof b!="number")throw new TypeError("Argument must be a number");return L(b)},I.allocUnsafeSlow=function(b){if(typeof b!="number")throw new TypeError("Argument must be a number");return S.SlowBuffer(b)}},function(O,w,_){"use strict";(function(S,L){var U=_(7);O.exports=q;function I(A,B,G){this.chunk=A,this.encoding=B,this.callback=G,this.next=null}function b(A){var B=this;this.next=null,this.entry=null,this.finish=function(){xt(B,A)}}var h=!S.browser&&["v0.10","v0.9."].indexOf(S.version.slice(0,5))>-1?setImmediate:U,f;q.WritableState=H;var g=_(3);g.inherits=_(1);var s={deprecate:_(28)},k=_(15),T=_(11).Buffer,N=L.Uint8Array||function(){};function R(A){return T.from(A)}function M(A){return T.isBuffer(A)||A instanceof N}var j=_(16);g.inherits(q,k);function Q(){}function H(A,B){f=f||_(0),A=A||{},this.objectMode=!!A.objectMode,B instanceof f&&(this.objectMode=this.objectMode||!!A.writableObjectMode);var G=A.highWaterMark,ot=this.objectMode?16:16*1024;this.highWaterMark=G||G===0?G:ot,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var wt=A.decodeStrings===!1;this.decodeStrings=!wt,this.defaultEncoding=A.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(_t){vt(B,_t)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new b(this)}H.prototype.getBuffer=function(){for(var B=this.bufferedRequest,G=[];B;)G.push(B),B=B.next;return G},function(){try{Object.defineProperty(H.prototype,"buffer",{get:s.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}}();var rt;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(rt=Function.prototype[Symbol.hasInstance],Object.defineProperty(q,Symbol.hasInstance,{value:function(A){return rt.call(this,A)?!0:A&&A._writableState instanceof H}})):rt=function(A){return A instanceof this};function q(A){if(f=f||_(0),!rt.call(q,this)&&!(this instanceof f))return new q(A);this._writableState=new H(A,this),this.writable=!0,A&&(typeof A.write=="function"&&(this._write=A.write),typeof A.writev=="function"&&(this._writev=A.writev),typeof A.destroy=="function"&&(this._destroy=A.destroy),typeof A.final=="function"&&(this._final=A.final)),k.call(this)}q.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))};function mt(A,B){var G=new Error("write after end");A.emit("error",G),U(B,G)}function ct(A,B,G,ot){var wt=!0,_t=!1;return G===null?_t=new TypeError("May not write null values to stream"):typeof G!="string"&&G!==void 0&&!B.objectMode&&(_t=new TypeError("Invalid non-string/buffer chunk")),_t&&(A.emit("error",_t),U(ot,_t),wt=!1),wt}q.prototype.write=function(A,B,G){var ot=this._writableState,wt=!1,_t=M(A)&&!ot.objectMode;return _t&&!T.isBuffer(A)&&(A=R(A)),typeof B=="function"&&(G=B,B=null),_t?B="buffer":B||(B=ot.defaultEncoding),typeof G!="function"&&(G=Q),ot.ended?mt(this,G):(_t||ct(this,ot,A,G))&&(ot.pendingcb++,wt=ht(this,ot,_t,A,B,G)),wt},q.prototype.cork=function(){var A=this._writableState;A.corked++},q.prototype.uncork=function(){var A=this._writableState;A.corked&&(A.corked--,!A.writing&&!A.corked&&!A.finished&&!A.bufferProcessing&&A.bufferedRequest&&pt(this,A))},q.prototype.setDefaultEncoding=function(B){if(typeof B=="string"&&(B=B.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((B+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+B);return this._writableState.defaultEncoding=B,this};function P(A,B,G){return!A.objectMode&&A.decodeStrings!==!1&&typeof B=="string"&&(B=T.from(B,G)),B}function ht(A,B,G,ot,wt,_t){if(!G){var te=P(B,ot,wt);ot!==te&&(G=!0,wt="buffer",ot=te)}var Pt=B.objectMode?1:ot.length;B.length+=Pt;var Ct=B.length<B.highWaterMark;if(Ct||(B.needDrain=!0),B.writing||B.corked){var Mt=B.lastBufferedRequest;B.lastBufferedRequest={chunk:ot,encoding:wt,isBuf:G,callback:_t,next:null},Mt?Mt.next=B.lastBufferedRequest:B.bufferedRequest=B.lastBufferedRequest,B.bufferedRequestCount+=1}else $(A,B,!1,Pt,ot,wt,_t);return Ct}function $(A,B,G,ot,wt,_t,te){B.writelen=ot,B.writecb=te,B.writing=!0,B.sync=!0,G?A._writev(wt,B.onwrite):A._write(wt,_t,B.onwrite),B.sync=!1}function gt(A,B,G,ot,wt){--B.pendingcb,G?(U(wt,ot),U(jt,A,B),A._writableState.errorEmitted=!0,A.emit("error",ot)):(wt(ot),A._writableState.errorEmitted=!0,A.emit("error",ot),jt(A,B))}function It(A){A.writing=!1,A.writecb=null,A.length-=A.writelen,A.writelen=0}function vt(A,B){var G=A._writableState,ot=G.sync,wt=G.writecb;if(It(G),B)gt(A,G,ot,B,wt);else{var _t=Rt(G);!_t&&!G.corked&&!G.bufferProcessing&&G.bufferedRequest&&pt(A,G),ot?h(Tt,A,G,_t,wt):Tt(A,G,_t,wt)}}function Tt(A,B,G,ot){G||Lt(A,B),B.pendingcb--,ot(),jt(A,B)}function Lt(A,B){B.length===0&&B.needDrain&&(B.needDrain=!1,A.emit("drain"))}function pt(A,B){B.bufferProcessing=!0;var G=B.bufferedRequest;if(A._writev&&G&&G.next){var ot=B.bufferedRequestCount,wt=new Array(ot),_t=B.corkedRequestsFree;_t.entry=G;for(var te=0,Pt=!0;G;)wt[te]=G,G.isBuf||(Pt=!1),G=G.next,te+=1;wt.allBuffers=Pt,$(A,B,!0,B.length,wt,"",_t.finish),B.pendingcb++,B.lastBufferedRequest=null,_t.next?(B.corkedRequestsFree=_t.next,_t.next=null):B.corkedRequestsFree=new b(B)}else{for(;G;){var Ct=G.chunk,Mt=G.encoding,ut=G.callback,x=B.objectMode?1:Ct.length;if($(A,B,!1,x,Ct,Mt,ut),G=G.next,B.writing)break}G===null&&(B.lastBufferedRequest=null)}B.bufferedRequestCount=0,B.bufferedRequest=G,B.bufferProcessing=!1}q.prototype._write=function(A,B,G){G(new Error("_write() is not implemented"))},q.prototype._writev=null,q.prototype.end=function(A,B,G){var ot=this._writableState;typeof A=="function"?(G=A,A=null,B=null):typeof B=="function"&&(G=B,B=null),A!=null&&this.write(A,B),ot.corked&&(ot.corked=1,this.uncork()),!ot.ending&&!ot.finished&&oe(this,ot,G)};function Rt(A){return A.ending&&A.length===0&&A.bufferedRequest===null&&!A.finished&&!A.writing}function Zt(A,B){A._final(function(G){B.pendingcb--,G&&A.emit("error",G),B.prefinished=!0,A.emit("prefinish"),jt(A,B)})}function qt(A,B){!B.prefinished&&!B.finalCalled&&(typeof A._final=="function"?(B.pendingcb++,B.finalCalled=!0,U(Zt,A,B)):(B.prefinished=!0,A.emit("prefinish")))}function jt(A,B){var G=Rt(B);return G&&(qt(A,B),B.pendingcb===0&&(B.finished=!0,A.emit("finish"))),G}function oe(A,B,G){B.ending=!0,jt(A,B),G&&(B.finished?U(G):A.once("finish",G)),B.ended=!0,A.writable=!1}function xt(A,B,G){var ot=A.entry;for(A.entry=null;ot;){var wt=ot.callback;B.pendingcb--,wt(G),ot=ot.next}B.corkedRequestsFree?B.corkedRequestsFree.next=A:B.corkedRequestsFree=A}Object.defineProperty(q.prototype,"destroyed",{get:function(){return this._writableState===void 0?!1:this._writableState.destroyed},set:function(A){this._writableState&&(this._writableState.destroyed=A)}}),q.prototype.destroy=j.destroy,q.prototype._undestroy=j.undestroy,q.prototype._destroy=function(A,B){this.end(),B(A)}}).call(w,_(2),_(5))},function(O,w,_){"use strict";(function(S){var L=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;function U(h){var f=L.exec(h);return f.shift(),f}var I=function(){function h(){}return h.normalize=function(f){f===""&&(f=".");var g=f.charAt(0)===h.sep;f=h._removeDuplicateSeps(f);for(var s=f.split(h.sep),k=[],T=0;T<s.length;T++){var N=s[T];N!=="."&&(N===".."&&(g||!g&&k.length>0&&k[0]!=="..")?k.pop():k.push(N))}if(!g&&k.length<2)switch(k.length){case 1:k[0]===""&&k.unshift(".");break;default:k.push(".")}return f=k.join(h.sep),g&&f.charAt(0)!==h.sep&&(f=h.sep+f),f},h.join=function(){for(var f=[],g=0;g<arguments.length;g++)f[g-0]=arguments[g];for(var s=[],k=0;k<f.length;k++){var T=f[k];if(typeof T!="string")throw new TypeError("Invalid argument type to path.join: "+typeof T);T!==""&&s.push(T)}return h.normalize(s.join(h.sep))},h.resolve=function(){for(var f=[],g=0;g<arguments.length;g++)f[g-0]=arguments[g];for(var s=[],k=0;k<f.length;k++){var T=f[k];if(typeof T!="string")throw new TypeError("Invalid argument type to path.join: "+typeof T);T!==""&&(T.charAt(0)===h.sep&&(s=[]),s.push(T))}var N=h.normalize(s.join(h.sep));if(N.length>1&&N.charAt(N.length-1)===h.sep)return N.substr(0,N.length-1);if(N.charAt(0)!==h.sep){N.charAt(0)==="."&&(N.length===1||N.charAt(1)===h.sep)&&(N=N.length===1?"":N.substr(2));var R=S.cwd();N!==""?N=this.normalize(R+(R!=="/"?h.sep:"")+N):N=R}return N},h.relative=function(f,g){var s;f=h.resolve(f),g=h.resolve(g);var k=f.split(h.sep),T=g.split(h.sep);T.shift(),k.shift();var N=0,R=[];for(s=0;s<k.length;s++){var M=k[s];if(M!==T[s]){N=k.length-s;break}}R=T.slice(s),k.length===1&&k[0]===""&&(N=0),N>k.length&&(N=k.length);var j="";for(s=0;s<N;s++)j+="../";return j+=R.join(h.sep),j.length>1&&j.charAt(j.length-1)===h.sep&&(j=j.substr(0,j.length-1)),j},h.dirname=function(f){f=h._removeDuplicateSeps(f);var g=f.charAt(0)===h.sep,s=f.split(h.sep);return s.pop()===""&&s.length>0&&s.pop(),s.length>1||s.length===1&&!g?s.join(h.sep):g?h.sep:"."},h.basename=function(f,g){if(g===void 0&&(g=""),f==="")return f;f=h.normalize(f);var s=f.split(h.sep),k=s[s.length-1];if(k===""&&s.length>1)return s[s.length-2];if(g.length>0){var T=k.substr(k.length-g.length);if(T===g)return k.substr(0,k.length-g.length)}return k},h.extname=function(f){f=h.normalize(f);var g=f.split(h.sep);if(f=g.pop(),f===""&&g.length>0&&(f=g.pop()),f==="..")return"";var s=f.lastIndexOf(".");return s===-1||s===0?"":f.substr(s)},h.isAbsolute=function(f){return f.length>0&&f.charAt(0)===h.sep},h._makeLong=function(f){return f},h.parse=function(f){var g=U(f);return{root:g[0],dir:g[0]+g[1].slice(0,-1),base:g[2],ext:g[3],name:g[2].slice(0,g[2].length-g[3].length)}},h.format=function(f){if(f===null||typeof f!="object")throw new TypeError("Parameter 'pathObject' must be an object, not "+typeof f);var g=f.root||"";if(typeof g!="string")throw new TypeError("'pathObject.root' must be a string or undefined, not "+typeof f.root);var s=f.dir?f.dir+h.sep:"",k=f.base||"";return s+k},h._removeDuplicateSeps=function(f){return f=f.replace(this._replaceRegex,this.sep),f},h.sep="/",h._replaceRegex=new RegExp("//+","g"),h.delimiter=":",h.posix=h,h.win32=h,h}(),b=I;O.exports=I}).call(w,_(2))},function(O,w,_){"use strict";(function(S,L){var U=_(7);O.exports=P;var I=_(25),b;P.ReadableState=ct;var h=_(6).EventEmitter,f=function(x,m){return x.listeners(m).length},g=_(15),s=_(11).Buffer,k=S.Uint8Array||function(){};function T(x){return s.from(x)}function N(x){return s.isBuffer(x)||x instanceof k}var R=_(3);R.inherits=_(1);var M=_(26),j=void 0;M&&M.debuglog?j=M.debuglog("stream"):j=function(){};var Q=_(27),H=_(16),rt;R.inherits(P,g);var q=["error","close","destroy","pause","resume"];function mt(x,m,X){if(typeof x.prependListener=="function")return x.prependListener(m,X);!x._events||!x._events[m]?x.on(m,X):I(x._events[m])?x._events[m].unshift(X):x._events[m]=[X,x._events[m]]}function ct(x,m){b=b||_(0),x=x||{},this.objectMode=!!x.objectMode,m instanceof b&&(this.objectMode=this.objectMode||!!x.readableObjectMode);var X=x.highWaterMark,et=this.objectMode?16:16*1024;this.highWaterMark=X||X===0?X:et,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new Q,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.destroyed=!1,this.defaultEncoding=x.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,x.encoding&&(rt||(rt=_(17).StringDecoder),this.decoder=new rt(x.encoding),this.encoding=x.encoding)}function P(x){if(b=b||_(0),!(this instanceof P))return new P(x);this._readableState=new ct(x,this),this.readable=!0,x&&(typeof x.read=="function"&&(this._read=x.read),typeof x.destroy=="function"&&(this._destroy=x.destroy)),g.call(this)}Object.defineProperty(P.prototype,"destroyed",{get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(x){this._readableState&&(this._readableState.destroyed=x)}}),P.prototype.destroy=H.destroy,P.prototype._undestroy=H.undestroy,P.prototype._destroy=function(x,m){this.push(null),m(x)},P.prototype.push=function(x,m){var X=this._readableState,et;return X.objectMode?et=!0:typeof x=="string"&&(m=m||X.defaultEncoding,m!==X.encoding&&(x=s.from(x,m),m=""),et=!0),ht(this,x,m,!1,et)},P.prototype.unshift=function(x){return ht(this,x,null,!0,!1)};function ht(x,m,X,et,v){var l=x._readableState;if(m===null)l.reading=!1,pt(x,l);else{var c;v||(c=gt(l,m)),c?x.emit("error",c):l.objectMode||m&&m.length>0?(typeof m!="string"&&!l.objectMode&&Object.getPrototypeOf(m)!==s.prototype&&(m=T(m)),et?l.endEmitted?x.emit("error",new Error("stream.unshift() after end event")):$(x,l,m,!0):l.ended?x.emit("error",new Error("stream.push() after EOF")):(l.reading=!1,l.decoder&&!X?(m=l.decoder.write(m),l.objectMode||m.length!==0?$(x,l,m,!1):qt(x,l)):$(x,l,m,!1))):et||(l.reading=!1)}return It(l)}function $(x,m,X,et){m.flowing&&m.length===0&&!m.sync?(x.emit("data",X),x.read(0)):(m.length+=m.objectMode?1:X.length,et?m.buffer.unshift(X):m.buffer.push(X),m.needReadable&&Rt(x)),qt(x,m)}function gt(x,m){var X;return!N(m)&&typeof m!="string"&&m!==void 0&&!x.objectMode&&(X=new TypeError("Invalid non-string/buffer chunk")),X}function It(x){return!x.ended&&(x.needReadable||x.length<x.highWaterMark||x.length===0)}P.prototype.isPaused=function(){return this._readableState.flowing===!1},P.prototype.setEncoding=function(x){return rt||(rt=_(17).StringDecoder),this._readableState.decoder=new rt(x),this._readableState.encoding=x,this};var vt=8388608;function Tt(x){return x>=vt?x=vt:(x--,x|=x>>>1,x|=x>>>2,x|=x>>>4,x|=x>>>8,x|=x>>>16,x++),x}function Lt(x,m){return x<=0||m.length===0&&m.ended?0:m.objectMode?1:x!==x?m.flowing&&m.length?m.buffer.head.data.length:m.length:(x>m.highWaterMark&&(m.highWaterMark=Tt(x)),x<=m.length?x:m.ended?m.length:(m.needReadable=!0,0))}P.prototype.read=function(x){j("read",x),x=parseInt(x,10);var m=this._readableState,X=x;if(x!==0&&(m.emittedReadable=!1),x===0&&m.needReadable&&(m.length>=m.highWaterMark||m.ended))return j("read: emitReadable",m.length,m.ended),m.length===0&&m.ended?Pt(this):Rt(this),null;if(x=Lt(x,m),x===0&&m.ended)return m.length===0&&Pt(this),null;var et=m.needReadable;j("need readable",et),(m.length===0||m.length-x<m.highWaterMark)&&(et=!0,j("length less than watermark",et)),m.ended||m.reading?(et=!1,j("reading or ended",et)):et&&(j("do read"),m.reading=!0,m.sync=!0,m.length===0&&(m.needReadable=!0),this._read(m.highWaterMark),m.sync=!1,m.reading||(x=Lt(X,m)));var v;return x>0?v=ot(x,m):v=null,v===null?(m.needReadable=!0,x=0):m.length-=x,m.length===0&&(m.ended||(m.needReadable=!0),X!==x&&m.ended&&Pt(this)),v!==null&&this.emit("data",v),v};function pt(x,m){if(!m.ended){if(m.decoder){var X=m.decoder.end();X&&X.length&&(m.buffer.push(X),m.length+=m.objectMode?1:X.length)}m.ended=!0,Rt(x)}}function Rt(x){var m=x._readableState;m.needReadable=!1,m.emittedReadable||(j("emitReadable",m.flowing),m.emittedReadable=!0,m.sync?U(Zt,x):Zt(x))}function Zt(x){j("emit readable"),x.emit("readable"),G(x)}function qt(x,m){m.readingMore||(m.readingMore=!0,U(jt,x,m))}function jt(x,m){for(var X=m.length;!m.reading&&!m.flowing&&!m.ended&&m.length<m.highWaterMark&&(j("maybeReadMore read 0"),x.read(0),X!==m.length);)X=m.length;m.readingMore=!1}P.prototype._read=function(x){this.emit("error",new Error("_read() is not implemented"))},P.prototype.pipe=function(x,m){var X=this,et=this._readableState;switch(et.pipesCount){case 0:et.pipes=x;break;case 1:et.pipes=[et.pipes,x];break;default:et.pipes.push(x);break}et.pipesCount+=1,j("pipe count=%d opts=%j",et.pipesCount,m);var v=(!m||m.end!==!1)&&x!==L.stdout&&x!==L.stderr,l=v?E:Ht;et.endEmitted?U(l):X.once("end",l),x.on("unpipe",c);function c(bt,ne){j("onunpipe"),bt===X&&ne&&ne.hasUnpiped===!1&&(ne.hasUnpiped=!0,J())}function E(){j("onend"),x.end()}var C=oe(X);x.on("drain",C);var Y=!1;function J(){j("cleanup"),x.removeListener("close",Ut),x.removeListener("finish",Ft),x.removeListener("drain",C),x.removeListener("error",Ot),x.removeListener("unpipe",c),X.removeListener("end",E),X.removeListener("end",Ht),X.removeListener("data",kt),Y=!0,et.awaitDrain&&(!x._writableState||x._writableState.needDrain)&&C()}var St=!1;X.on("data",kt);function kt(bt){j("ondata"),St=!1;var ne=x.write(bt);ne===!1&&!St&&((et.pipesCount===1&&et.pipes===x||et.pipesCount>1&&ut(et.pipes,x)!==-1)&&!Y&&(j("false write response, pause",X._readableState.awaitDrain),X._readableState.awaitDrain++,St=!0),X.pause())}function Ot(bt){j("onerror",bt),Ht(),x.removeListener("error",Ot),f(x,"error")===0&&x.emit("error",bt)}mt(x,"error",Ot);function Ut(){x.removeListener("finish",Ft),Ht()}x.once("close",Ut);function Ft(){j("onfinish"),x.removeListener("close",Ut),Ht()}x.once("finish",Ft);function Ht(){j("unpipe"),X.unpipe(x)}return x.emit("pipe",X),et.flowing||(j("pipe resume"),X.resume()),x};function oe(x){return function(){var m=x._readableState;j("pipeOnDrain",m.awaitDrain),m.awaitDrain&&m.awaitDrain--,m.awaitDrain===0&&f(x,"data")&&(m.flowing=!0,G(x))}}P.prototype.unpipe=function(x){var m=this._readableState,X={hasUnpiped:!1};if(m.pipesCount===0)return this;if(m.pipesCount===1)return x&&x!==m.pipes?this:(x||(x=m.pipes),m.pipes=null,m.pipesCount=0,m.flowing=!1,x&&x.emit("unpipe",this,X),this);if(!x){var et=m.pipes,v=m.pipesCount;m.pipes=null,m.pipesCount=0,m.flowing=!1;for(var l=0;l<v;l++)et[l].emit("unpipe",this,X);return this}var c=ut(m.pipes,x);return c===-1?this:(m.pipes.splice(c,1),m.pipesCount-=1,m.pipesCount===1&&(m.pipes=m.pipes[0]),x.emit("unpipe",this,X),this)},P.prototype.on=function(x,m){var X=g.prototype.on.call(this,x,m);if(x==="data")this._readableState.flowing!==!1&&this.resume();else if(x==="readable"){var et=this._readableState;!et.endEmitted&&!et.readableListening&&(et.readableListening=et.needReadable=!0,et.emittedReadable=!1,et.reading?et.length&&Rt(this):U(xt,this))}return X},P.prototype.addListener=P.prototype.on;function xt(x){j("readable nexttick read 0"),x.read(0)}P.prototype.resume=function(){var x=this._readableState;return x.flowing||(j("resume"),x.flowing=!0,A(this,x)),this};function A(x,m){m.resumeScheduled||(m.resumeScheduled=!0,U(B,x,m))}function B(x,m){m.reading||(j("resume read 0"),x.read(0)),m.resumeScheduled=!1,m.awaitDrain=0,x.emit("resume"),G(x),m.flowing&&!m.reading&&x.read(0)}P.prototype.pause=function(){return j("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(j("pause"),this._readableState.flowing=!1,this.emit("pause")),this};function G(x){var m=x._readableState;for(j("flow",m.flowing);m.flowing&&x.read()!==null;);}P.prototype.wrap=function(x){var m=this._readableState,X=!1,et=this;x.on("end",function(){if(j("wrapped end"),m.decoder&&!m.ended){var c=m.decoder.end();c&&c.length&&et.push(c)}et.push(null)}),x.on("data",function(c){if(j("wrapped data"),m.decoder&&(c=m.decoder.write(c)),!(m.objectMode&&c==null)&&!(!m.objectMode&&(!c||!c.length))){var E=et.push(c);E||(X=!0,x.pause())}});for(var v in x)this[v]===void 0&&typeof x[v]=="function"&&(this[v]=function(c){return function(){return x[c].apply(x,arguments)}}(v));for(var l=0;l<q.length;l++)x.on(q[l],et.emit.bind(et,q[l]));return et._read=function(c){j("wrapped _read",c),X&&(X=!1,x.resume())},et},P._fromList=ot;function ot(x,m){if(m.length===0)return null;var X;return m.objectMode?X=m.buffer.shift():!x||x>=m.length?(m.decoder?X=m.buffer.join(""):m.buffer.length===1?X=m.buffer.head.data:X=m.buffer.concat(m.length),m.buffer.clear()):X=wt(x,m.buffer,m.decoder),X}function wt(x,m,X){var et;return x<m.head.data.length?(et=m.head.data.slice(0,x),m.head.data=m.head.data.slice(x)):x===m.head.data.length?et=m.shift():et=X?_t(x,m):te(x,m),et}function _t(x,m){var X=m.head,et=1,v=X.data;for(x-=v.length;X=X.next;){var l=X.data,c=x>l.length?l.length:x;if(c===l.length?v+=l:v+=l.slice(0,x),x-=c,x===0){c===l.length?(++et,X.next?m.head=X.next:m.head=m.tail=null):(m.head=X,X.data=l.slice(c));break}++et}return m.length-=et,v}function te(x,m){var X=s.allocUnsafe(x),et=m.head,v=1;for(et.data.copy(X),x-=et.data.length;et=et.next;){var l=et.data,c=x>l.length?l.length:x;if(l.copy(X,X.length-x,0,c),x-=c,x===0){c===l.length?(++v,et.next?m.head=et.next:m.head=m.tail=null):(m.head=et,et.data=l.slice(c));break}++v}return m.length-=v,X}function Pt(x){var m=x._readableState;if(m.length>0)throw new Error('"endReadable()" called on non-empty stream');m.endEmitted||(m.ended=!0,U(Ct,m,x))}function Ct(x,m){!x.endEmitted&&x.length===0&&(x.endEmitted=!0,m.readable=!1,m.emit("end"))}function Mt(x,m){for(var X=0,et=x.length;X<et;X++)m(x[X],X)}function ut(x,m){for(var X=0,et=x.length;X<et;X++)if(x[X]===m)return X;return-1}}).call(w,_(5),_(2))},function(O,w,_){O.exports=_(6).EventEmitter},function(O,w,_){"use strict";var S=_(7);function L(b,h){var f=this,g=this._readableState&&this._readableState.destroyed,s=this._writableState&&this._writableState.destroyed;if(g||s){h?h(b):b&&(!this._writableState||!this._writableState.errorEmitted)&&S(I,this,b);return}this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(b||null,function(k){!h&&k?(S(I,f,k),f._writableState&&(f._writableState.errorEmitted=!0)):h&&h(k)})}function U(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function I(b,h){b.emit("error",h)}O.exports={destroy:L,undestroy:U}},function(O,w,_){var S=_(4).Buffer,L=S.isEncoding||function(g){switch(g&&g.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function U(g){if(g&&!L(g))throw new Error("Unknown encoding: "+g)}var I=w.StringDecoder=function(g){switch(this.encoding=(g||"utf8").toLowerCase().replace(/[-_]/,""),U(g),this.encoding){case"utf8":this.surrogateSize=3;break;case"ucs2":case"utf16le":this.surrogateSize=2,this.detectIncompleteChar=h;break;case"base64":this.surrogateSize=3,this.detectIncompleteChar=f;break;default:this.write=b;return}this.charBuffer=new S(6),this.charReceived=0,this.charLength=0};I.prototype.write=function(g){for(var s="";this.charLength;){var k=g.length>=this.charLength-this.charReceived?this.charLength-this.charReceived:g.length;if(g.copy(this.charBuffer,this.charReceived,0,k),this.charReceived+=k,this.charReceived<this.charLength)return"";g=g.slice(k,g.length),s=this.charBuffer.slice(0,this.charLength).toString(this.encoding);var N=s.charCodeAt(s.length-1);if(N>=55296&&N<=56319){this.charLength+=this.surrogateSize,s="";continue}if(this.charReceived=this.charLength=0,g.length===0)return s;break}this.detectIncompleteChar(g);var T=g.length;this.charLength&&(g.copy(this.charBuffer,0,g.length-this.charReceived,T),T-=this.charReceived),s+=g.toString(this.encoding,0,T);var T=s.length-1,N=s.charCodeAt(T);if(N>=55296&&N<=56319){var R=this.surrogateSize;return this.charLength+=R,this.charReceived+=R,this.charBuffer.copy(this.charBuffer,R,0,R),g.copy(this.charBuffer,0,0,R),s.substring(0,T)}return s},I.prototype.detectIncompleteChar=function(g){for(var s=g.length>=3?3:g.length;s>0;s--){var k=g[g.length-s];if(s==1&&k>>5==6){this.charLength=2;break}if(s<=2&&k>>4==14){this.charLength=3;break}if(s<=3&&k>>3==30){this.charLength=4;break}}this.charReceived=s},I.prototype.end=function(g){var s="";if(g&&g.length&&(s=this.write(g)),this.charReceived){var k=this.charReceived,T=this.charBuffer,N=this.encoding;s+=T.slice(0,k).toString(N)}return s};function b(g){return g.toString(this.encoding)}function h(g){this.charReceived=g.length%2,this.charLength=this.charReceived?2:0}function f(g){this.charReceived=g.length%3,this.charLength=this.charReceived?3:0}},function(O,w,_){"use strict";O.exports=b;var S=_(0),L=_(3);L.inherits=_(1),L.inherits(b,S);function U(f){this.afterTransform=function(g,s){return I(f,g,s)},this.needTransform=!1,this.transforming=!1,this.writecb=null,this.writechunk=null,this.writeencoding=null}function I(f,g,s){var k=f._transformState;k.transforming=!1;var T=k.writecb;if(!T)return f.emit("error",new Error("write callback called multiple times"));k.writechunk=null,k.writecb=null,s!=null&&f.push(s),T(g);var N=f._readableState;N.reading=!1,(N.needReadable||N.length<N.highWaterMark)&&f._read(N.highWaterMark)}function b(f){if(!(this instanceof b))return new b(f);S.call(this,f),this._transformState=new U(this);var g=this;this._readableState.needReadable=!0,this._readableState.sync=!1,f&&(typeof f.transform=="function"&&(this._transform=f.transform),typeof f.flush=="function"&&(this._flush=f.flush)),this.once("prefinish",function(){typeof this._flush=="function"?this._flush(function(s,k){h(g,s,k)}):h(g)})}b.prototype.push=function(f,g){return this._transformState.needTransform=!1,S.prototype.push.call(this,f,g)},b.prototype._transform=function(f,g,s){throw new Error("_transform() is not implemented")},b.prototype._write=function(f,g,s){var k=this._transformState;if(k.writecb=s,k.writechunk=f,k.writeencoding=g,!k.transforming){var T=this._readableState;(k.needTransform||T.needReadable||T.length<T.highWaterMark)&&this._read(T.highWaterMark)}},b.prototype._read=function(f){var g=this._transformState;g.writechunk!==null&&g.writecb&&!g.transforming?(g.transforming=!0,this._transform(g.writechunk,g.writeencoding,g.afterTransform)):g.needTransform=!0},b.prototype._destroy=function(f,g){var s=this;S.prototype._destroy.call(this,f,function(k){g(k),s.emit("close")})};function h(f,g,s){if(g)return f.emit("error",g);s!=null&&f.push(s);var k=f._writableState,T=f._transformState;if(k.length)throw new Error("Calling transform done when ws.length != 0");if(T.transforming)throw new Error("Calling transform done when still transforming");return f.push(null)}},function(O,w,_){"use strict";(function(S,L,U,I){Object.defineProperty(w,"__esModule",{value:!0});var b=_(4),h=_(13),f;(function(n){n[n.EPERM=1]="EPERM",n[n.ENOENT=2]="ENOENT",n[n.EIO=5]="EIO",n[n.EBADF=9]="EBADF",n[n.EACCES=13]="EACCES",n[n.EBUSY=16]="EBUSY",n[n.EEXIST=17]="EEXIST",n[n.ENOTDIR=20]="ENOTDIR",n[n.EISDIR=21]="EISDIR",n[n.EINVAL=22]="EINVAL",n[n.EFBIG=27]="EFBIG",n[n.ENOSPC=28]="ENOSPC",n[n.EROFS=30]="EROFS",n[n.ENOTEMPTY=39]="ENOTEMPTY",n[n.ENOTSUP=95]="ENOTSUP"})(f||(f={}));var g={};g[f.EPERM]="Operation not permitted.",g[f.ENOENT]="No such file or directory.",g[f.EIO]="Input/output error.",g[f.EBADF]="Bad file descriptor.",g[f.EACCES]="Permission denied.",g[f.EBUSY]="Resource busy or locked.",g[f.EEXIST]="File exists.",g[f.ENOTDIR]="File is not a directory.",g[f.EISDIR]="File is a directory.",g[f.EINVAL]="Invalid argument.",g[f.EFBIG]="File is too big.",g[f.ENOSPC]="No space left on disk.",g[f.EROFS]="Cannot modify a read-only file system.",g[f.ENOTEMPTY]="Directory is not empty.",g[f.ENOTSUP]="Operation is not supported.";var s=function(n){function t(r,e,i){e===void 0&&(e=g[r]),n.call(this,e),this.syscall="",this.errno=r,this.code=f[r],this.path=i,this.stack=new n().stack,this.message="Error: "+this.code+": "+e+(this.path?", '"+this.path+"'":"")}return n&&(t.__proto__=n),t.prototype=Object.create(n&&n.prototype),t.prototype.constructor=t,t.fromJSON=function(e){var i=new t(0);return i.errno=e.errno,i.code=e.code,i.path=e.path,i.stack=e.stack,i.message=e.message,i},t.fromBuffer=function(e,i){return i===void 0&&(i=0),t.fromJSON(JSON.parse(e.toString("utf8",i+4,i+4+e.readUInt32LE(i))))},t.FileError=function(e,i){return new t(e,g[e],i)},t.ENOENT=function(e){return this.FileError(f.ENOENT,e)},t.EEXIST=function(e){return this.FileError(f.EEXIST,e)},t.EISDIR=function(e){return this.FileError(f.EISDIR,e)},t.ENOTDIR=function(e){return this.FileError(f.ENOTDIR,e)},t.EPERM=function(e){return this.FileError(f.EPERM,e)},t.ENOTEMPTY=function(e){return this.FileError(f.ENOTEMPTY,e)},t.prototype.toString=function(){return this.message},t.prototype.toJSON=function(){return{errno:this.errno,code:this.code,path:this.path,stack:this.stack,message:this.message}},t.prototype.writeToBuffer=function(e,i){e===void 0&&(e=S.alloc(this.bufferSize())),i===void 0&&(i=0);var o=e.write(JSON.stringify(this.toJSON()),i+4);return e.writeUInt32LE(o,i),e},t.prototype.bufferSize=function(){return 4+S.byteLength(JSON.stringify(this.toJSON()))},t}(Error),k=Object.freeze({get ErrorCode(){return f},ErrorStrings:g,ApiError:s}),T;(function(n){n[n.NOP=0]="NOP",n[n.THROW_EXCEPTION=1]="THROW_EXCEPTION",n[n.TRUNCATE_FILE=2]="TRUNCATE_FILE",n[n.CREATE_FILE=3]="CREATE_FILE"})(T||(T={}));var N=function n(t){if(this.flagStr=t,n.validFlagStrs.indexOf(t)<0)throw new s(f.EINVAL,"Invalid flag: "+t)};N.getFileFlag=function(t){return N.flagCache.hasOwnProperty(t)?N.flagCache[t]:N.flagCache[t]=new N(t)},N.prototype.getFlagString=function(){return this.flagStr},N.prototype.isReadable=function(){return this.flagStr.indexOf("r")!==-1||this.flagStr.indexOf("+")!==-1},N.prototype.isWriteable=function(){return this.flagStr.indexOf("w")!==-1||this.flagStr.indexOf("a")!==-1||this.flagStr.indexOf("+")!==-1},N.prototype.isTruncating=function(){return this.flagStr.indexOf("w")!==-1},N.prototype.isAppendable=function(){return this.flagStr.indexOf("a")!==-1},N.prototype.isSynchronous=function(){return this.flagStr.indexOf("s")!==-1},N.prototype.isExclusive=function(){return this.flagStr.indexOf("x")!==-1},N.prototype.pathExistsAction=function(){return this.isExclusive()?T.THROW_EXCEPTION:this.isTruncating()?T.TRUNCATE_FILE:T.NOP},N.prototype.pathNotExistsAction=function(){return(this.isWriteable()||this.isAppendable())&&this.flagStr!=="r+"?T.CREATE_FILE:T.THROW_EXCEPTION},N.flagCache={},N.validFlagStrs=["r","r+","rs","rs+","w","wx","w+","wx+","a","ax","a+","ax+"];var R;(function(n){n[n.FILE=32768]="FILE",n[n.DIRECTORY=16384]="DIRECTORY",n[n.SYMLINK=40960]="SYMLINK"})(R||(R={}));var M=function(t,r,e,i,o,a){if(i===void 0&&(i=new Date),o===void 0&&(o=new Date),a===void 0&&(a=new Date),this.size=r,this.atime=i,this.mtime=o,this.ctime=a,this.dev=0,this.ino=0,this.rdev=0,this.nlink=1,this.blksize=4096,this.uid=0,this.gid=0,this.birthtime=new Date(0),this.fileData=null,e)this.mode=e;else switch(t){case R.FILE:this.mode=420;break;case R.DIRECTORY:default:this.mode=511}this.blocks=Math.ceil(r/512),this.mode<4096&&(this.mode|=t)};M.fromBuffer=function(t){var r=t.readUInt32LE(0),e=t.readUInt32LE(4),i=t.readDoubleLE(8),o=t.readDoubleLE(16),a=t.readDoubleLE(24);return new M(e&61440,r,e&4095,new Date(i),new Date(o),new Date(a))},M.clone=function(t){return new M(t.mode&61440,t.size,t.mode&4095,t.atime,t.mtime,t.ctime)},M.prototype.toBuffer=function(){var t=S.alloc(32);return t.writeUInt32LE(this.size,0),t.writeUInt32LE(this.mode,4),t.writeDoubleLE(this.atime.getTime(),8),t.writeDoubleLE(this.mtime.getTime(),16),t.writeDoubleLE(this.ctime.getTime(),24),t},M.prototype.isFile=function(){return(this.mode&61440)===R.FILE},M.prototype.isDirectory=function(){return(this.mode&61440)===R.DIRECTORY},M.prototype.isSymbolicLink=function(){return(this.mode&61440)===R.SYMLINK},M.prototype.chmod=function(t){this.mode=this.mode&61440|t},M.prototype.isSocket=function(){return!1},M.prototype.isBlockDevice=function(){return!1},M.prototype.isCharacterDevice=function(){return!1},M.prototype.isFIFO=function(){return!1};var j=function(n,t){return n};function Q(n){if(n)return n;throw new s(f.EIO,"Initialize BrowserFS with a file system using BrowserFS.initialize(filesystem)")}function H(n,t){switch(typeof n){case"number":return n;case"string":var r=parseInt(n,8);return isNaN(r)?t:r;default:return t}}function rt(n){if(n instanceof Date)return n;if(typeof n=="number")return new Date(n*1e3);throw new s(f.EINVAL,"Invalid time.")}function q(n){if(n.indexOf("\0")>=0)throw new s(f.EINVAL,"Path must be a string without null bytes.");if(n==="")throw new s(f.EINVAL,"Path must not be empty.");return h.resolve(n)}function mt(n,t,r,e){switch(typeof n){case"object":return{encoding:typeof n.encoding<"u"?n.encoding:t,flag:typeof n.flag<"u"?n.flag:r,mode:H(n.mode,e)};case"string":return{encoding:n,flag:r,mode:e};default:return{encoding:t,flag:r,mode:e}}}function ct(){}var P=function(){this.F_OK=0,this.R_OK=4,this.W_OK=2,this.X_OK=1,this.root=null,this.fdMap={},this.nextFd=100};P.prototype.initialize=function(t){if(!t.constructor.isAvailable())throw new s(f.EINVAL,"Tried to instantiate BrowserFS with an unavailable file system.");return this.root=t},P.prototype._toUnixTimestamp=function(t){if(typeof t=="number")return t;if(t instanceof Date)return t.getTime()/1e3;throw new Error("Cannot parse time: "+t)},P.prototype.getRootFS=function(){return this.root?this.root:null},P.prototype.rename=function(t,r,e){e===void 0&&(e=ct);var i=j(e,1);try{Q(this.root).rename(q(t),q(r),i)}catch(o){i(o)}},P.prototype.renameSync=function(t,r){Q(this.root).renameSync(q(t),q(r))},P.prototype.exists=function(t,r){r===void 0&&(r=ct);var e=j(r,1);try{return Q(this.root).exists(q(t),e)}catch{return e(!1)}},P.prototype.existsSync=function(t){try{return Q(this.root).existsSync(q(t))}catch{return!1}},P.prototype.stat=function(t,r){r===void 0&&(r=ct);var e=j(r,2);try{return Q(this.root).stat(q(t),!1,e)}catch(i){return e(i)}},P.prototype.statSync=function(t){return Q(this.root).statSync(q(t),!1)},P.prototype.lstat=function(t,r){r===void 0&&(r=ct);var e=j(r,2);try{return Q(this.root).stat(q(t),!0,e)}catch(i){return e(i)}},P.prototype.lstatSync=function(t){return Q(this.root).statSync(q(t),!0)},P.prototype.truncate=function(t,r,e){r===void 0&&(r=0),e===void 0&&(e=ct);var i=0;typeof r=="function"?e=r:typeof r=="number"&&(i=r);var o=j(e,1);try{if(i<0)throw new s(f.EINVAL);return Q(this.root).truncate(q(t),i,o)}catch(a){return o(a)}},P.prototype.truncateSync=function(t,r){if(r===void 0&&(r=0),r<0)throw new s(f.EINVAL);return Q(this.root).truncateSync(q(t),r)},P.prototype.unlink=function(t,r){r===void 0&&(r=ct);var e=j(r,1);try{return Q(this.root).unlink(q(t),e)}catch(i){return e(i)}},P.prototype.unlinkSync=function(t){return Q(this.root).unlinkSync(q(t))},P.prototype.open=function(t,r,e,i){var o=this;i===void 0&&(i=ct);var a=H(e,420);i=typeof e=="function"?e:i;var u=j(i,2);try{Q(this.root).open(q(t),N.getFileFlag(r),a,function(p,d){d?u(p,o.getFdForFile(d)):u(p)})}catch(p){u(p)}},P.prototype.openSync=function(t,r,e){return e===void 0&&(e=420),this.getFdForFile(Q(this.root).openSync(q(t),N.getFileFlag(r),H(e,420)))},P.prototype.readFile=function(t,r,e){r===void 0&&(r={}),e===void 0&&(e=ct);var i=mt(r,null,"r",null);e=typeof r=="function"?r:e;var o=j(e,2);try{var a=N.getFileFlag(i.flag);return a.isReadable()?Q(this.root).readFile(q(t),i.encoding,a,o):o(new s(f.EINVAL,"Flag passed to readFile must allow for reading."))}catch(u){return o(u)}},P.prototype.readFileSync=function(t,r){r===void 0&&(r={});var e=mt(r,null,"r",null),i=N.getFileFlag(e.flag);if(!i.isReadable())throw new s(f.EINVAL,"Flag passed to readFile must allow for reading.");return Q(this.root).readFileSync(q(t),e.encoding,i)},P.prototype.writeFile=function(t,r,e,i){e===void 0&&(e={}),i===void 0&&(i=ct);var o=mt(e,"utf8","w",420);i=typeof e=="function"?e:i;var a=j(i,1);try{var u=N.getFileFlag(o.flag);return u.isWriteable()?Q(this.root).writeFile(q(t),r,o.encoding,u,o.mode,a):a(new s(f.EINVAL,"Flag passed to writeFile must allow for writing."))}catch(p){return a(p)}},P.prototype.writeFileSync=function(t,r,e){var i=mt(e,"utf8","w",420),o=N.getFileFlag(i.flag);if(!o.isWriteable())throw new s(f.EINVAL,"Flag passed to writeFile must allow for writing.");return Q(this.root).writeFileSync(q(t),r,i.encoding,o,i.mode)},P.prototype.appendFile=function(t,r,e,i){i===void 0&&(i=ct);var o=mt(e,"utf8","a",420);i=typeof e=="function"?e:i;var a=j(i,1);try{var u=N.getFileFlag(o.flag);if(!u.isAppendable())return a(new s(f.EINVAL,"Flag passed to appendFile must allow for appending."));Q(this.root).appendFile(q(t),r,o.encoding,u,o.mode,a)}catch(p){a(p)}},P.prototype.appendFileSync=function(t,r,e){var i=mt(e,"utf8","a",420),o=N.getFileFlag(i.flag);if(!o.isAppendable())throw new s(f.EINVAL,"Flag passed to appendFile must allow for appending.");return Q(this.root).appendFileSync(q(t),r,i.encoding,o,i.mode)},P.prototype.fstat=function(t,r){r===void 0&&(r=ct);var e=j(r,2);try{var i=this.fd2file(t);i.stat(e)}catch(o){e(o)}},P.prototype.fstatSync=function(t){return this.fd2file(t).statSync()},P.prototype.close=function(t,r){var e=this;r===void 0&&(r=ct);var i=j(r,1);try{this.fd2file(t).close(function(o){o||e.closeFd(t),i(o)})}catch(o){i(o)}},P.prototype.closeSync=function(t){this.fd2file(t).closeSync(),this.closeFd(t)},P.prototype.ftruncate=function(t,r,e){e===void 0&&(e=ct);var i=typeof r=="number"?r:0;e=typeof r=="function"?r:e;var o=j(e,1);try{var a=this.fd2file(t);if(i<0)throw new s(f.EINVAL);a.truncate(i,o)}catch(u){o(u)}},P.prototype.ftruncateSync=function(t,r){r===void 0&&(r=0);var e=this.fd2file(t);if(r<0)throw new s(f.EINVAL);e.truncateSync(r)},P.prototype.fsync=function(t,r){r===void 0&&(r=ct);var e=j(r,1);try{this.fd2file(t).sync(e)}catch(i){e(i)}},P.prototype.fsyncSync=function(t){this.fd2file(t).syncSync()},P.prototype.fdatasync=function(t,r){r===void 0&&(r=ct);var e=j(r,1);try{this.fd2file(t).datasync(e)}catch(i){e(i)}},P.prototype.fdatasyncSync=function(t){this.fd2file(t).datasyncSync()},P.prototype.write=function(t,r,e,i,o,a){a===void 0&&(a=ct);var u,p,d,F=null;if(typeof r=="string"){var D="utf8";switch(typeof e){case"function":a=e;break;case"number":F=e,D=typeof i=="string"?i:"utf8",a=typeof o=="function"?o:a;break;default:return a=typeof i=="function"?i:typeof o=="function"?o:a,a(new s(f.EINVAL,"Invalid arguments."))}u=S.from(r,D),p=0,d=u.length}else u=r,p=e,d=i,F=typeof o=="number"?o:null,a=typeof o=="function"?o:a;var W=j(a,3);try{var tt=this.fd2file(t);F==null&&(F=tt.getPos()),tt.write(u,p,d,F,W)}catch(nt){W(nt)}},P.prototype.writeSync=function(t,r,e,i,o){var a,u=0,p,d;if(typeof r=="string"){d=typeof e=="number"?e:null;var F=typeof i=="string"?i:"utf8";u=0,a=S.from(r,F),p=a.length}else a=r,u=e,p=i,d=typeof o=="number"?o:null;var D=this.fd2file(t);return d==null&&(d=D.getPos()),D.writeSync(a,u,p,d)},P.prototype.read=function(t,r,e,i,o,a){a===void 0&&(a=ct);var u,p,d,F,D;if(typeof r=="number"){d=r,u=e;var W=i;a=typeof o=="function"?o:a,p=0,F=S.alloc(d),D=j(function(nt,ft,yt){if(nt)return a(nt);a(nt,yt.toString(W),ft)},3)}else F=r,p=e,d=i,u=o,D=j(a,3);try{var tt=this.fd2file(t);u==null&&(u=tt.getPos()),tt.read(F,p,d,u,D)}catch(nt){D(nt)}},P.prototype.readSync=function(t,r,e,i,o){var a=!1,u,p,d,F,D="utf8";typeof r=="number"?(d=r,F=e,D=i,p=0,u=S.alloc(d),a=!0):(u=r,p=e,d=i,F=o);var W=this.fd2file(t);F==null&&(F=W.getPos());var tt=W.readSync(u,p,d,F);return a?[u.toString(D),tt]:tt},P.prototype.fchown=function(t,r,e,i){i===void 0&&(i=ct);var o=j(i,1);try{this.fd2file(t).chown(r,e,o)}catch(a){o(a)}},P.prototype.fchownSync=function(t,r,e){this.fd2file(t).chownSync(r,e)},P.prototype.fchmod=function(t,r,e){var i=j(e,1);try{var o=typeof r=="string"?parseInt(r,8):r;this.fd2file(t).chmod(o,i)}catch(a){i(a)}},P.prototype.fchmodSync=function(t,r){var e=typeof r=="string"?parseInt(r,8):r;this.fd2file(t).chmodSync(e)},P.prototype.futimes=function(t,r,e,i){i===void 0&&(i=ct);var o=j(i,1);try{var a=this.fd2file(t);typeof r=="number"&&(r=new Date(r*1e3)),typeof e=="number"&&(e=new Date(e*1e3)),a.utimes(r,e,o)}catch(u){o(u)}},P.prototype.futimesSync=function(t,r,e){this.fd2file(t).utimesSync(rt(r),rt(e))},P.prototype.rmdir=function(t,r){r===void 0&&(r=ct);var e=j(r,1);try{t=q(t),Q(this.root).rmdir(t,e)}catch(i){e(i)}},P.prototype.rmdirSync=function(t){return t=q(t),Q(this.root).rmdirSync(t)},P.prototype.mkdir=function(t,r,e){e===void 0&&(e=ct),typeof r=="function"&&(e=r,r=511);var i=j(e,1);try{t=q(t),Q(this.root).mkdir(t,r,i)}catch(o){i(o)}},P.prototype.mkdirSync=function(t,r){Q(this.root).mkdirSync(q(t),H(r,511))},P.prototype.readdir=function(t,r){r===void 0&&(r=ct);var e=j(r,2);try{t=q(t),Q(this.root).readdir(t,e)}catch(i){e(i)}},P.prototype.readdirSync=function(t){return t=q(t),Q(this.root).readdirSync(t)},P.prototype.link=function(t,r,e){e===void 0&&(e=ct);var i=j(e,1);try{t=q(t),r=q(r),Q(this.root).link(t,r,i)}catch(o){i(o)}},P.prototype.linkSync=function(t,r){return t=q(t),r=q(r),Q(this.root).linkSync(t,r)},P.prototype.symlink=function(t,r,e,i){i===void 0&&(i=ct);var o=typeof e=="string"?e:"file";i=typeof e=="function"?e:i;var a=j(i,1);try{if(o!=="file"&&o!=="dir")return a(new s(f.EINVAL,"Invalid type: "+o));t=q(t),r=q(r),Q(this.root).symlink(t,r,o,a)}catch(u){a(u)}},P.prototype.symlinkSync=function(t,r,e){if(!e)e="file";else if(e!=="file"&&e!=="dir")throw new s(f.EINVAL,"Invalid type: "+e);return t=q(t),r=q(r),Q(this.root).symlinkSync(t,r,e)},P.prototype.readlink=function(t,r){r===void 0&&(r=ct);var e=j(r,2);try{t=q(t),Q(this.root).readlink(t,e)}catch(i){e(i)}},P.prototype.readlinkSync=function(t){return t=q(t),Q(this.root).readlinkSync(t)},P.prototype.chown=function(t,r,e,i){i===void 0&&(i=ct);var o=j(i,1);try{t=q(t),Q(this.root).chown(t,!1,r,e,o)}catch(a){o(a)}},P.prototype.chownSync=function(t,r,e){t=q(t),Q(this.root).chownSync(t,!1,r,e)},P.prototype.lchown=function(t,r,e,i){i===void 0&&(i=ct);var o=j(i,1);try{t=q(t),Q(this.root).chown(t,!0,r,e,o)}catch(a){o(a)}},P.prototype.lchownSync=function(t,r,e){t=q(t),Q(this.root).chownSync(t,!0,r,e)},P.prototype.chmod=function(t,r,e){e===void 0&&(e=ct);var i=j(e,1);try{var o=H(r,-1);if(o<0)throw new s(f.EINVAL,"Invalid mode.");Q(this.root).chmod(q(t),!1,o,i)}catch(a){i(a)}},P.prototype.chmodSync=function(t,r){var e=H(r,-1);if(e<0)throw new s(f.EINVAL,"Invalid mode.");t=q(t),Q(this.root).chmodSync(t,!1,e)},P.prototype.lchmod=function(t,r,e){e===void 0&&(e=ct);var i=j(e,1);try{var o=H(r,-1);if(o<0)throw new s(f.EINVAL,"Invalid mode.");Q(this.root).chmod(q(t),!0,o,i)}catch(a){i(a)}},P.prototype.lchmodSync=function(t,r){var e=H(r,-1);if(e<1)throw new s(f.EINVAL,"Invalid mode.");Q(this.root).chmodSync(q(t),!0,e)},P.prototype.utimes=function(t,r,e,i){i===void 0&&(i=ct);var o=j(i,1);try{Q(this.root).utimes(q(t),rt(r),rt(e),o)}catch(a){o(a)}},P.prototype.utimesSync=function(t,r,e){Q(this.root).utimesSync(q(t),rt(r),rt(e))},P.prototype.realpath=function(t,r,e){e===void 0&&(e=ct);var i=typeof r=="object"?r:{};e=typeof r=="function"?r:ct;var o=j(e,2);try{t=q(t),Q(this.root).realpath(t,i,o)}catch(a){o(a)}},P.prototype.realpathSync=function(t,r){return r===void 0&&(r={}),t=q(t),Q(this.root).realpathSync(t,r)},P.prototype.watchFile=function(t,r,e){throw e===void 0&&(e=ct),new s(f.ENOTSUP)},P.prototype.unwatchFile=function(t,r){throw r===void 0&&(r=ct),new s(f.ENOTSUP)},P.prototype.watch=function(t,r,e){throw e===void 0&&(e=ct),new s(f.ENOTSUP)},P.prototype.access=function(t,r,e){throw e===void 0&&(e=ct),new s(f.ENOTSUP)},P.prototype.accessSync=function(t,r){throw new s(f.ENOTSUP)},P.prototype.createReadStream=function(t,r){throw new s(f.ENOTSUP)},P.prototype.createWriteStream=function(t,r){throw new s(f.ENOTSUP)},P.prototype.wrapCallbacks=function(t){j=t},P.prototype.getFdForFile=function(t){var r=this.nextFd++;return this.fdMap[r]=t,r},P.prototype.fd2file=function(t){var r=this.fdMap[t];if(r)return r;throw new s(f.EBADF,"Invalid file descriptor.")},P.prototype.closeFd=function(t){delete this.fdMap[t]},P.Stats=M;var ht=new P,$={},gt=P.prototype;Object.keys(gt).forEach(function(n){typeof ht[n]=="function"?$[n]=function(){return ht[n].apply(ht,arguments)}:$[n]=ht[n]}),$.changeFSModule=function(n){ht=n},$.getFSModule=function(){return ht},$.FS=P;function It(n,t,r,e,i){return n<t||r<t?n>r?r+1:n+1:e===i?t:t+1}function vt(n,t){if(n===t)return 0;if(n.length>t.length){var r=n;n=t,t=r}for(var e=n.length,i=t.length;e>0&&n.charCodeAt(e-1)===t.charCodeAt(i-1);)e--,i--;for(var o=0;o<e&&n.charCodeAt(o)===t.charCodeAt(o);)o++;if(e-=o,i-=o,e===0||i===1)return i;for(var a=new Array(e<<1),u=0;u<e;)a[e+u]=n.charCodeAt(o+u),a[u]=++u;var p,d,F,D,W;for(p=0;p+3<i;)for(var tt=t.charCodeAt(o+(d=p)),nt=t.charCodeAt(o+(F=p+1)),ft=t.charCodeAt(o+(D=p+2)),yt=t.charCodeAt(o+(W=p+3)),Et=p+=4,Kt=0;Kt<e;){var re=a[e+Kt],Ee=a[Kt];d=It(Ee,d,F,tt,re),F=It(d,F,D,nt,re),D=It(F,D,W,ft,re),Et=It(D,W,Et,yt,re),a[Kt++]=Et,W=D,D=F,F=d,d=Ee}for(var xe=0;p<i;){var or=t.charCodeAt(o+(d=p));xe=++p;for(var Te=0;Te<e;Te++){var Le=a[Te];a[Te]=xe=Le<d||xe<d?Le>xe?xe+1:Le+1:or===a[e+Te]?d:d+1,d=Le}}return xe}function Tt(n,t,r){n&&console.warn("["+t+"] Direct file system constructor usage is deprecated for this file system, and will be removed in the next major version. Please use the '"+t+".Create("+JSON.stringify(r)+", callback)' method instead. See https://github.com/jvilk/BrowserFS/issues/176 for more details.")}var Lt=typeof navigator<"u"&&!!(/(msie) ([\w.]+)/.exec(navigator.userAgent.toLowerCase())||navigator.userAgent.indexOf("Trident")!==-1),pt=typeof window>"u";function Rt(){throw new Error("BFS has reached an impossible code path; please file a bug.")}function Zt(n,t,r){r.existsSync(n)||(Zt(h.dirname(n),t,r),r.mkdirSync(n,t))}function qt(n){var t=jt(n),r=t.byteOffset,e=t.byteLength;return r===0&&e===t.buffer.byteLength?t.buffer:t.buffer.slice(r,r+e)}function jt(n){return n instanceof Uint8Array?n:new Uint8Array(n)}function oe(n){return n instanceof S?n:n instanceof Uint8Array?xt(n):S.from(n)}function xt(n){return n instanceof S?n:n.byteOffset===0&&n.byteLength===n.buffer.byteLength?A(n.buffer):S.from(n.buffer,n.byteOffset,n.byteLength)}function A(n){return S.from(n)}function B(n,t,r){if(t===void 0&&(t=0),r===void 0&&(r=n.length),t<0||r<0||r>n.length||t>r)throw new TypeError("Invalid slice bounds on buffer of length "+n.length+": ["+t+", "+r+"]");if(n.length===0)return ot();var e=jt(n),i=n[0],o=(i+1)%255;return n[0]=o,e[0]===o?(e[0]=i,xt(e.slice(t,r))):(n[0]=i,xt(e.subarray(t,r)))}var G=null;function ot(){return G||(G=S.alloc(0))}function wt(n,t){S.isBuffer(n)?t():t(new s(f.EINVAL,"option must be a Buffer."))}function _t(n,t,r){var e=n.Options,i=n.Name,o=0,a=!1,u=!1;function p(W){a||(W&&(a=!0,r(W)),o--,o===0&&u&&r())}var d=function(W){if(e.hasOwnProperty(W)){var tt=e[W],nt=t[W];if(nt==null){if(!tt.optional){var ft=Object.keys(t).filter(function(Et){return!(Et in e)}).map(function(Et){return{str:Et,distance:vt(W,Et)}}).filter(function(Et){return Et.distance<5}).sort(function(Et,Kt){return Et.distance-Kt.distance});return a?{}:(a=!0,{v:r(new s(f.EINVAL,"["+i+"] Required option '"+W+"' not provided."+(ft.length>0?" You provided unrecognized option '"+ft[0].str+"'; perhaps you meant to type '"+W+"'.":"")+`
Option description: `+tt.description))})}}else{var yt=!1;if(Array.isArray(tt.type)?yt=tt.type.indexOf(typeof nt)!==-1:yt=typeof nt===tt.type,yt)tt.validator&&(o++,tt.validator(nt,p));else return a?{}:(a=!0,{v:r(new s(f.EINVAL,"["+i+"] Value provided for option "+W+" is not the proper type. Expected "+(Array.isArray(tt.type)?"one of {"+tt.type.join(", ")+"}":tt.type)+", but received "+typeof nt+`
Option description: `+tt.description))})}}};for(var F in e){var D=d(F);if(D)return D.v}u=!0,o===0&&!a&&r()}var te=Object.freeze({deprecationMessage:Tt,isIE:Lt,isWebWorker:pt,fail:Rt,mkdirpSync:Zt,buffer2ArrayBuffer:qt,buffer2Uint8array:jt,arrayish2Buffer:oe,uint8Array2Buffer:xt,arrayBuffer2Buffer:A,copyingSlice:B,emptyBuffer:ot,bufferValidator:wt,checkOptions:_t}),Pt=function(t){this.fs=t,this.nodefs=t.getNodeFS(),this.FS=t.getFS(),this.PATH=t.getPATH(),this.ERRNO_CODES=t.getERRNO_CODES()};Pt.prototype.open=function(t){var r=this.fs.realPath(t.node),e=this.FS;try{e.isFile(t.node.mode)&&(t.nfd=this.nodefs.openSync(r,this.fs.flagsToPermissionString(t.flags)))}catch(i){throw i.code?new e.ErrnoError(this.ERRNO_CODES[i.code]):i}},Pt.prototype.close=function(t){var r=this.FS;try{r.isFile(t.node.mode)&&t.nfd&&this.nodefs.closeSync(t.nfd)}catch(e){throw e.code?new r.ErrnoError(this.ERRNO_CODES[e.code]):e}},Pt.prototype.read=function(t,r,e,i,o){try{return this.nodefs.readSync(t.nfd,xt(r),e,i,o)}catch(a){throw new this.FS.ErrnoError(this.ERRNO_CODES[a.code])}},Pt.prototype.write=function(t,r,e,i,o){try{return this.nodefs.writeSync(t.nfd,xt(r),e,i,o)}catch(a){throw new this.FS.ErrnoError(this.ERRNO_CODES[a.code])}},Pt.prototype.llseek=function(t,r,e){var i=r;if(e===1)i+=t.position;else if(e===2&&this.FS.isFile(t.node.mode))try{var o=this.nodefs.fstatSync(t.nfd);i+=o.size}catch(a){throw new this.FS.ErrnoError(this.ERRNO_CODES[a.code])}if(i<0)throw new this.FS.ErrnoError(this.ERRNO_CODES.EINVAL);return t.position=i,i};var Ct=function(t){this.fs=t,this.nodefs=t.getNodeFS(),this.FS=t.getFS(),this.PATH=t.getPATH(),this.ERRNO_CODES=t.getERRNO_CODES()};Ct.prototype.getattr=function(t){var r=this.fs.realPath(t),e;try{e=this.nodefs.lstatSync(r)}catch(i){throw i.code?new this.FS.ErrnoError(this.ERRNO_CODES[i.code]):i}return{dev:e.dev,ino:e.ino,mode:e.mode,nlink:e.nlink,uid:e.uid,gid:e.gid,rdev:e.rdev,size:e.size,atime:e.atime,mtime:e.mtime,ctime:e.ctime,blksize:e.blksize,blocks:e.blocks}},Ct.prototype.setattr=function(t,r){var e=this.fs.realPath(t);try{if(r.mode!==void 0&&(this.nodefs.chmodSync(e,r.mode),t.mode=r.mode),r.timestamp!==void 0){var i=new Date(r.timestamp);this.nodefs.utimesSync(e,i,i)}}catch(o){if(!o.code)throw o;if(o.code!=="ENOTSUP")throw new this.FS.ErrnoError(this.ERRNO_CODES[o.code])}if(r.size!==void 0)try{this.nodefs.truncateSync(e,r.size)}catch(o){throw o.code?new this.FS.ErrnoError(this.ERRNO_CODES[o.code]):o}},Ct.prototype.lookup=function(t,r){var e=this.PATH.join2(this.fs.realPath(t),r),i=this.fs.getMode(e);return this.fs.createNode(t,r,i)},Ct.prototype.mknod=function(t,r,e,i){var o=this.fs.createNode(t,r,e,i),a=this.fs.realPath(o);try{this.FS.isDir(o.mode)?this.nodefs.mkdirSync(a,o.mode):this.nodefs.writeFileSync(a,"",{mode:o.mode})}catch(u){throw u.code?new this.FS.ErrnoError(this.ERRNO_CODES[u.code]):u}return o},Ct.prototype.rename=function(t,r,e){var i=this.fs.realPath(t),o=this.PATH.join2(this.fs.realPath(r),e);try{this.nodefs.renameSync(i,o),t.name=e,t.parent=r}catch(a){throw a.code?new this.FS.ErrnoError(this.ERRNO_CODES[a.code]):a}},Ct.prototype.unlink=function(t,r){var e=this.PATH.join2(this.fs.realPath(t),r);try{this.nodefs.unlinkSync(e)}catch(i){throw i.code?new this.FS.ErrnoError(this.ERRNO_CODES[i.code]):i}},Ct.prototype.rmdir=function(t,r){var e=this.PATH.join2(this.fs.realPath(t),r);try{this.nodefs.rmdirSync(e)}catch(i){throw i.code?new this.FS.ErrnoError(this.ERRNO_CODES[i.code]):i}},Ct.prototype.readdir=function(t){var r=this.fs.realPath(t);try{var e=this.nodefs.readdirSync(r);return e.push(".",".."),e}catch(i){throw i.code?new this.FS.ErrnoError(this.ERRNO_CODES[i.code]):i}},Ct.prototype.symlink=function(t,r,e){var i=this.PATH.join2(this.fs.realPath(t),r);try{this.nodefs.symlinkSync(e,i)}catch(o){throw o.code?new this.FS.ErrnoError(this.ERRNO_CODES[o.code]):o}},Ct.prototype.readlink=function(t){var r=this.fs.realPath(t);try{return this.nodefs.readlinkSync(r)}catch(e){throw e.code?new this.FS.ErrnoError(this.ERRNO_CODES[e.code]):e}};var Mt=function(t,r,e,i){t===void 0&&(t=self.FS),r===void 0&&(r=self.PATH),e===void 0&&(e=self.ERRNO_CODES),i===void 0&&(i=$),this.flagsToPermissionStringMap={0:"r",1:"r+",2:"r+",64:"r",65:"r+",66:"r+",129:"rx+",193:"rx+",514:"w+",577:"w",578:"w+",705:"wx",706:"wx+",1024:"a",1025:"a",1026:"a+",1089:"a",1090:"a+",1153:"ax",1154:"ax+",1217:"ax",1218:"ax+",4096:"rs",4098:"rs+"},this.nodefs=i,this.FS=t,this.PATH=r,this.ERRNO_CODES=e,this.node_ops=new Ct(this),this.stream_ops=new Pt(this)};Mt.prototype.mount=function(t){return this.createNode(null,"/",this.getMode(t.opts.root),0)},Mt.prototype.createNode=function(t,r,e,i){var o=this.FS;if(!o.isDir(e)&&!o.isFile(e)&&!o.isLink(e))throw new o.ErrnoError(this.ERRNO_CODES.EINVAL);var a=o.createNode(t,r,e);return a.node_ops=this.node_ops,a.stream_ops=this.stream_ops,a},Mt.prototype.getMode=function(t){var r;try{r=this.nodefs.lstatSync(t)}catch(e){throw e.code?new this.FS.ErrnoError(this.ERRNO_CODES[e.code]):e}return r.mode},Mt.prototype.realPath=function(t){for(var r=[];t.parent!==t;)r.push(t.name),t=t.parent;return r.push(t.mount.opts.root),r.reverse(),this.PATH.join.apply(null,r)},Mt.prototype.flagsToPermissionString=function(t){var r=typeof t=="string"?parseInt(t,10):t;return r&=8191,r in this.flagsToPermissionStringMap?this.flagsToPermissionStringMap[r]:t},Mt.prototype.getNodeFS=function(){return this.nodefs},Mt.prototype.getFS=function(){return this.FS},Mt.prototype.getPATH=function(){return this.PATH},Mt.prototype.getERRNO_CODES=function(){return this.ERRNO_CODES};var ut=function(){};ut.prototype.supportsLinks=function(){return!1},ut.prototype.diskSpace=function(t,r){r(0,0)},ut.prototype.openFile=function(t,r,e){throw new s(f.ENOTSUP)},ut.prototype.createFile=function(t,r,e,i){throw new s(f.ENOTSUP)},ut.prototype.open=function(t,r,e,i){var o=this,a=function(u,p){if(u)switch(r.pathNotExistsAction()){case T.CREATE_FILE:return o.stat(h.dirname(t),!1,function(d,F){d?i(d):F&&!F.isDirectory()?i(s.ENOTDIR(h.dirname(t))):o.createFile(t,r,e,i)});case T.THROW_EXCEPTION:return i(s.ENOENT(t));default:return i(new s(f.EINVAL,"Invalid FileFlag object."))}else{if(p&&p.isDirectory())return i(s.EISDIR(t));switch(r.pathExistsAction()){case T.THROW_EXCEPTION:return i(s.EEXIST(t));case T.TRUNCATE_FILE:return o.openFile(t,r,function(d,F){d?i(d):F?F.truncate(0,function(){F.sync(function(){i(null,F)})}):Rt()});case T.NOP:return o.openFile(t,r,i);default:return i(new s(f.EINVAL,"Invalid FileFlag object."))}}};this.stat(t,!1,a)},ut.prototype.rename=function(t,r,e){e(new s(f.ENOTSUP))},ut.prototype.renameSync=function(t,r){throw new s(f.ENOTSUP)},ut.prototype.stat=function(t,r,e){e(new s(f.ENOTSUP))},ut.prototype.statSync=function(t,r){throw new s(f.ENOTSUP)},ut.prototype.openFileSync=function(t,r,e){throw new s(f.ENOTSUP)},ut.prototype.createFileSync=function(t,r,e){throw new s(f.ENOTSUP)},ut.prototype.openSync=function(t,r,e){var i;try{i=this.statSync(t,!1)}catch{switch(r.pathNotExistsAction()){case T.CREATE_FILE:var o=this.statSync(h.dirname(t),!1);if(!o.isDirectory())throw s.ENOTDIR(h.dirname(t));return this.createFileSync(t,r,e);case T.THROW_EXCEPTION:throw s.ENOENT(t);default:throw new s(f.EINVAL,"Invalid FileFlag object.")}}if(i.isDirectory())throw s.EISDIR(t);switch(r.pathExistsAction()){case T.THROW_EXCEPTION:throw s.EEXIST(t);case T.TRUNCATE_FILE:return this.unlinkSync(t),this.createFileSync(t,r,i.mode);case T.NOP:return this.openFileSync(t,r,e);default:throw new s(f.EINVAL,"Invalid FileFlag object.")}},ut.prototype.unlink=function(t,r){r(new s(f.ENOTSUP))},ut.prototype.unlinkSync=function(t){throw new s(f.ENOTSUP)},ut.prototype.rmdir=function(t,r){r(new s(f.ENOTSUP))},ut.prototype.rmdirSync=function(t){throw new s(f.ENOTSUP)},ut.prototype.mkdir=function(t,r,e){e(new s(f.ENOTSUP))},ut.prototype.mkdirSync=function(t,r){throw new s(f.ENOTSUP)},ut.prototype.readdir=function(t,r){r(new s(f.ENOTSUP))},ut.prototype.readdirSync=function(t){throw new s(f.ENOTSUP)},ut.prototype.exists=function(t,r){this.stat(t,null,function(e){r(!e)})},ut.prototype.existsSync=function(t){try{return this.statSync(t,!0),!0}catch{return!1}},ut.prototype.realpath=function(t,r,e){if(this.supportsLinks())for(var i=t.split(h.sep),o=0;o<i.length;o++){var a=i.slice(0,o+1);i[o]=h.join.apply(null,a)}else this.exists(t,function(u){u?e(null,t):e(s.ENOENT(t))})},ut.prototype.realpathSync=function(t,r){if(this.supportsLinks()){for(var e=t.split(h.sep),i=0;i<e.length;i++){var o=e.slice(0,i+1);e[i]=h.join.apply(h,o)}return e.join(h.sep)}else{if(this.existsSync(t))return t;throw s.ENOENT(t)}},ut.prototype.truncate=function(t,r,e){this.open(t,N.getFileFlag("r+"),420,function(i,o){if(i)return e(i);o.truncate(r,function(a){o.close(function(u){e(a||u)})})})},ut.prototype.truncateSync=function(t,r){var e=this.openSync(t,N.getFileFlag("r+"),420);try{e.truncateSync(r)}catch(i){throw i}finally{e.closeSync()}},ut.prototype.readFile=function(t,r,e,i){var o=i;this.open(t,e,420,function(a,u){if(a)return i(a);i=function(p,d){u.close(function(F){return p||(p=F),o(p,d)})},u.stat(function(p,d){if(p)return i(p);var F=S.alloc(d.size);u.read(F,0,d.size,0,function(D){if(D)return i(D);if(r===null)return i(D,F);try{i(null,F.toString(r))}catch(W){i(W)}})})})},ut.prototype.readFileSync=function(t,r,e){var i=this.openSync(t,e,420);try{var o=i.statSync(),a=S.alloc(o.size);return i.readSync(a,0,o.size,0),i.closeSync(),r===null?a:a.toString(r)}finally{i.closeSync()}},ut.prototype.writeFile=function(t,r,e,i,o,a){var u=a;this.open(t,i,420,function(p,d){if(p)return a(p);a=function(F){d.close(function(D){u(F||D)})};try{typeof r=="string"&&(r=S.from(r,e))}catch(F){return a(F)}d.write(r,0,r.length,0,a)})},ut.prototype.writeFileSync=function(t,r,e,i,o){var a=this.openSync(t,i,o);try{typeof r=="string"&&(r=S.from(r,e)),a.writeSync(r,0,r.length,0)}finally{a.closeSync()}},ut.prototype.appendFile=function(t,r,e,i,o,a){var u=a;this.open(t,i,o,function(p,d){if(p)return a(p);a=function(F){d.close(function(D){u(F||D)})},typeof r=="string"&&(r=S.from(r,e)),d.write(r,0,r.length,null,a)})},ut.prototype.appendFileSync=function(t,r,e,i,o){var a=this.openSync(t,i,o);try{typeof r=="string"&&(r=S.from(r,e)),a.writeSync(r,0,r.length,null)}finally{a.closeSync()}},ut.prototype.chmod=function(t,r,e,i){i(new s(f.ENOTSUP))},ut.prototype.chmodSync=function(t,r,e){throw new s(f.ENOTSUP)},ut.prototype.chown=function(t,r,e,i,o){o(new s(f.ENOTSUP))},ut.prototype.chownSync=function(t,r,e,i){throw new s(f.ENOTSUP)},ut.prototype.utimes=function(t,r,e,i){i(new s(f.ENOTSUP))},ut.prototype.utimesSync=function(t,r,e){throw new s(f.ENOTSUP)},ut.prototype.link=function(t,r,e){e(new s(f.ENOTSUP))},ut.prototype.linkSync=function(t,r){throw new s(f.ENOTSUP)},ut.prototype.symlink=function(t,r,e,i){i(new s(f.ENOTSUP))},ut.prototype.symlinkSync=function(t,r,e){throw new s(f.ENOTSUP)},ut.prototype.readlink=function(t,r){r(new s(f.ENOTSUP))},ut.prototype.readlinkSync=function(t){throw new s(f.ENOTSUP)};var x=function(n){function t(){n.apply(this,arguments)}return n&&(t.__proto__=n),t.prototype=Object.create(n&&n.prototype),t.prototype.constructor=t,t.prototype.supportsSynch=function(){return!0},t.prototype.rename=function(e,i,o){try{this.renameSync(e,i),o()}catch(a){o(a)}},t.prototype.stat=function(e,i,o){try{o(null,this.statSync(e,i))}catch(a){o(a)}},t.prototype.open=function(e,i,o,a){try{a(null,this.openSync(e,i,o))}catch(u){a(u)}},t.prototype.unlink=function(e,i){try{this.unlinkSync(e),i()}catch(o){i(o)}},t.prototype.rmdir=function(e,i){try{this.rmdirSync(e),i()}catch(o){i(o)}},t.prototype.mkdir=function(e,i,o){try{this.mkdirSync(e,i),o()}catch(a){o(a)}},t.prototype.readdir=function(e,i){try{i(null,this.readdirSync(e))}catch(o){i(o)}},t.prototype.chmod=function(e,i,o,a){try{this.chmodSync(e,i,o),a()}catch(u){a(u)}},t.prototype.chown=function(e,i,o,a,u){try{this.chownSync(e,i,o,a),u()}catch(p){u(p)}},t.prototype.utimes=function(e,i,o,a){try{this.utimesSync(e,i,o),a()}catch(u){a(u)}},t.prototype.link=function(e,i,o){try{this.linkSync(e,i),o()}catch(a){o(a)}},t.prototype.symlink=function(e,i,o,a){try{this.symlinkSync(e,i,o),a()}catch(u){a(u)}},t.prototype.readlink=function(e,i){try{i(null,this.readlinkSync(e))}catch(o){i(o)}},t}(ut),m=function(){};m.prototype.sync=function(t){t(new s(f.ENOTSUP))},m.prototype.syncSync=function(){throw new s(f.ENOTSUP)},m.prototype.datasync=function(t){this.sync(t)},m.prototype.datasyncSync=function(){return this.syncSync()},m.prototype.chown=function(t,r,e){e(new s(f.ENOTSUP))},m.prototype.chownSync=function(t,r){throw new s(f.ENOTSUP)},m.prototype.chmod=function(t,r){r(new s(f.ENOTSUP))},m.prototype.chmodSync=function(t){throw new s(f.ENOTSUP)},m.prototype.utimes=function(t,r,e){e(new s(f.ENOTSUP))},m.prototype.utimesSync=function(t,r){throw new s(f.ENOTSUP)};var X=function(n){function t(r,e,i,o,a){if(n.call(this),this._pos=0,this._dirty=!1,this._fs=r,this._path=e,this._flag=i,this._stat=o,this._buffer=a||ot(),this._stat.size!==this._buffer.length&&this._flag.isReadable())throw new Error("Invalid buffer: Buffer is "+this._buffer.length+" long, yet Stats object specifies that file is "+this._stat.size+" long.")}return n&&(t.__proto__=n),t.prototype=Object.create(n&&n.prototype),t.prototype.constructor=t,t.prototype.getBuffer=function(){return this._buffer},t.prototype.getStats=function(){return this._stat},t.prototype.getFlag=function(){return this._flag},t.prototype.getPath=function(){return this._path},t.prototype.getPos=function(){return this._flag.isAppendable()?this._stat.size:this._pos},t.prototype.advancePos=function(e){return this._pos+=e},t.prototype.setPos=function(e){return this._pos=e},t.prototype.sync=function(e){try{this.syncSync(),e()}catch(i){e(i)}},t.prototype.syncSync=function(){throw new s(f.ENOTSUP)},t.prototype.close=function(e){try{this.closeSync(),e()}catch(i){e(i)}},t.prototype.closeSync=function(){throw new s(f.ENOTSUP)},t.prototype.stat=function(e){try{e(null,M.clone(this._stat))}catch(i){e(i)}},t.prototype.statSync=function(){return M.clone(this._stat)},t.prototype.truncate=function(e,i){try{this.truncateSync(e),this._flag.isSynchronous()&&!$.getRootFS().supportsSynch()&&this.sync(i),i()}catch(o){return i(o)}},t.prototype.truncateSync=function(e){if(this._dirty=!0,!this._flag.isWriteable())throw new s(f.EPERM,"File not opened with a writeable mode.");if(this._stat.mtime=new Date,e>this._buffer.length){var i=S.alloc(e-this._buffer.length,0);this.writeSync(i,0,i.length,this._buffer.length),this._flag.isSynchronous()&&$.getRootFS().supportsSynch()&&this.syncSync();return}this._stat.size=e;var o=S.alloc(e);this._buffer.copy(o,0,0,e),this._buffer=o,this._flag.isSynchronous()&&$.getRootFS().supportsSynch()&&this.syncSync()},t.prototype.write=function(e,i,o,a,u){try{u(null,this.writeSync(e,i,o,a),e)}catch(p){u(p)}},t.prototype.writeSync=function(e,i,o,a){if(this._dirty=!0,a==null&&(a=this.getPos()),!this._flag.isWriteable())throw new s(f.EPERM,"File not opened with a writeable mode.");var u=a+o;if(u>this._stat.size&&(this._stat.size=u,u>this._buffer.length)){var p=S.alloc(u);this._buffer.copy(p),this._buffer=p}var d=e.copy(this._buffer,a,i,i+o);return this._stat.mtime=new Date,this._flag.isSynchronous()?(this.syncSync(),d):(this.setPos(a+d),d)},t.prototype.read=function(e,i,o,a,u){try{u(null,this.readSync(e,i,o,a),e)}catch(p){u(p)}},t.prototype.readSync=function(e,i,o,a){if(!this._flag.isReadable())throw new s(f.EPERM,"File not opened with a readable mode.");a==null&&(a=this.getPos());var u=a+o;u>this._stat.size&&(o=this._stat.size-a);var p=this._buffer.copy(e,i,a,a+o);return this._stat.atime=new Date,this._pos=a+o,p},t.prototype.chmod=function(e,i){try{this.chmodSync(e),i()}catch(o){i(o)}},t.prototype.chmodSync=function(e){if(!this._fs.supportsProps())throw new s(f.ENOTSUP);this._dirty=!0,this._stat.chmod(e),this.syncSync()},t.prototype.isDirty=function(){return this._dirty},t.prototype.resetDirty=function(){this._dirty=!1},t}(m),et=function(n){function t(r,e,i,o,a){n.call(this,r,e,i,o,a)}return n&&(t.__proto__=n),t.prototype=Object.create(n&&n.prototype),t.prototype.constructor=t,t.prototype.sync=function(e){e()},t.prototype.syncSync=function(){},t.prototype.close=function(e){e()},t.prototype.closeSync=function(){},t}(X),v=function(n){function t(r,e,i,o,a){n.call(this,r,e,i,o,a)}return n&&(t.__proto__=n),t.prototype=Object.create(n&&n.prototype),t.prototype.constructor=t,t.prototype.syncSync=function(){this.isDirty()&&(this._fs._syncSync(this),this.resetDirty())},t.prototype.closeSync=function(){this.syncSync()},t}(X),l=function(n){function t(r,e){n.call(this),this._queue=[],this._queueRunning=!1,this._isInitialized=!1,this._initializeCallbacks=[],this._sync=r,this._async=e}return n&&(t.__proto__=n),t.prototype=Object.create(n&&n.prototype),t.prototype.constructor=t,t.Create=function(e,i){try{var o=new t(e.sync,e.async);o._initialize(function(a){a?i(a):i(null,o)})}catch(a){i(a)}},t.isAvailable=function(){return!0},t.prototype.getName=function(){return t.Name},t.prototype._syncSync=function(e){this._sync.writeFileSync(e.getPath(),e.getBuffer(),null,N.getFileFlag("w"),e.getStats().mode),this.enqueueOp({apiMethod:"writeFile",arguments:[e.getPath(),e.getBuffer(),null,e.getFlag(),e.getStats().mode]})},t.prototype.isReadOnly=function(){return!1},t.prototype.supportsSynch=function(){return!0},t.prototype.supportsLinks=function(){return!1},t.prototype.supportsProps=function(){return this._sync.supportsProps()&&this._async.supportsProps()},t.prototype.renameSync=function(e,i){this._sync.renameSync(e,i),this.enqueueOp({apiMethod:"rename",arguments:[e,i]})},t.prototype.statSync=function(e,i){return this._sync.statSync(e,i)},t.prototype.openSync=function(e,i,o){var a=this._sync.openSync(e,i,o);return a.closeSync(),new v(this,e,i,this._sync.statSync(e,!1),this._sync.readFileSync(e,null,N.getFileFlag("r")))},t.prototype.unlinkSync=function(e){this._sync.unlinkSync(e),this.enqueueOp({apiMethod:"unlink",arguments:[e]})},t.prototype.rmdirSync=function(e){this._sync.rmdirSync(e),this.enqueueOp({apiMethod:"rmdir",arguments:[e]})},t.prototype.mkdirSync=function(e,i){this._sync.mkdirSync(e,i),this.enqueueOp({apiMethod:"mkdir",arguments:[e,i]})},t.prototype.readdirSync=function(e){return this._sync.readdirSync(e)},t.prototype.existsSync=function(e){return this._sync.existsSync(e)},t.prototype.chmodSync=function(e,i,o){this._sync.chmodSync(e,i,o),this.enqueueOp({apiMethod:"chmod",arguments:[e,i,o]})},t.prototype.chownSync=function(e,i,o,a){this._sync.chownSync(e,i,o,a),this.enqueueOp({apiMethod:"chown",arguments:[e,i,o,a]})},t.prototype.utimesSync=function(e,i,o){this._sync.utimesSync(e,i,o),this.enqueueOp({apiMethod:"utimes",arguments:[e,i,o]})},t.prototype._initialize=function(e){var i=this,o=this._initializeCallbacks,a=function(F){i._isInitialized=!F,i._initializeCallbacks=[],o.forEach(function(D){return D(F)})};if(this._isInitialized)e();else if(o.push(e)===1){var u=function(F,D,W){F!=="/"&&i._sync.mkdirSync(F,D),i._async.readdir(F,function(tt,nt){var ft=0;function yt(Et){Et?W(Et):ft<nt.length?(d(h.join(F,nt[ft]),yt),ft++):W()}tt?W(tt):yt()})},p=function(F,D,W){i._async.readFile(F,null,N.getFileFlag("r"),function(tt,nt){if(tt)W(tt);else try{i._sync.writeFileSync(F,nt,null,N.getFileFlag("w"),D)}catch(ft){tt=ft}finally{W(tt)}})},d=function(F,D){i._async.stat(F,!1,function(W,tt){W?D(W):tt.isDirectory()?u(F,tt.mode,D):p(F,tt.mode,D)})};u("/",0,a)}},t.prototype.enqueueOp=function(e){var i=this;if(this._queue.push(e),!this._queueRunning){this._queueRunning=!0;var o=function(a){if(a)throw new Error("WARNING: File system has desynchronized. Received following error: "+a+`
$`);if(i._queue.length>0){var u=i._queue.shift(),p=u.arguments;p.push(o),i._async[u.apiMethod].apply(i._async,p)}else i._queueRunning=!1};o()}},t}(x);l.Name="AsyncMirror",l.Options={sync:{type:"object",description:"The synchronous file system to mirror the asynchronous file system to.",validator:function(n,t){n&&typeof n.supportsSynch=="function"&&n.supportsSynch()?t():t(new s(f.EINVAL,"'sync' option must be a file system that supports synchronous operations"))}},async:{type:"object",description:"The asynchronous file system to mirror."}};var c=typeof window<"u"?window:typeof self<"u"?self:L,E;if(typeof setImmediate<"u")E=setImmediate;else{var C=c,Y=[],J="zero-timeout-message",St=function(){if(typeof C.importScripts<"u"||!C.postMessage)return!1;var n=!0,t=C.onmessage;return C.onmessage=function(){n=!1},C.postMessage("","*"),C.onmessage=t,n};if(St()){E=function(n){Y.push(n),C.postMessage(J,"*")};var kt=function(n){if(n.source===self&&n.data===J&&(n.stopPropagation?n.stopPropagation():n.cancelBubble=!0,Y.length>0)){var t=Y.shift();return t()}};C.addEventListener?C.addEventListener("message",kt,!0):C.attachEvent("onmessage",kt)}else if(C.MessageChannel){var Ot=new C.MessageChannel;Ot.port1.onmessage=function(n){if(Y.length>0)return Y.shift()()},E=function(n){Y.push(n),Ot.port2.postMessage("")}}else E=function(n){return setTimeout(n,0)}}var Ut=E;function Ft(n){return n==="/"?"":n}function Ht(n){var t=n.error;if(t[".tag"])return t;if(t.error){var r=t.error;return r[".tag"]?r:r.reason&&r.reason[".tag"]?r.reason:r}else if(typeof t=="string")try{var e=JSON.parse(t);if(e.error&&e.error.reason&&e.error.reason[".tag"])return e.error.reason}catch{}return t}function bt(n){if(n.user_message)return n.user_message.text;if(n.error_summary)return n.error_summary;if(typeof n.error=="string")return n.error;if(typeof n.error=="object")return bt(n.error);throw new Error("Dropbox's servers gave us a garbage error message: "+JSON.stringify(n))}function ne(n,t,r){switch(n[".tag"]){case"malformed_path":return new s(f.EBADF,r,t);case"not_found":return s.ENOENT(t);case"not_file":return s.EISDIR(t);case"not_folder":return s.ENOTDIR(t);case"restricted_content":return s.EPERM(t);case"other":default:return new s(f.EIO,r,t)}}function Ie(n,t,r){switch(n[".tag"]){case"malformed_path":case"disallowed_name":return new s(f.EBADF,r,t);case"conflict":case"no_write_permission":case"team_folder":return s.EPERM(t);case"insufficient_space":return new s(f.ENOSPC,r);case"other":default:return new s(f.EIO,r,t)}}function Ge(n,t,r){var e={path:Ft(t)};n.filesDeleteV2(e).then(function(){r()}).catch(function(i){var o=Ht(i);switch(o[".tag"]){case"path_lookup":r(ne(o.path_lookup,t,bt(i)));break;case"path_write":r(Ie(o.path_write,t,bt(i)));break;case"too_many_write_operations":setTimeout(function(){return Ge(n,t,r)},500+300*Math.random());break;case"other":default:r(new s(f.EIO,bt(i),t));break}})}var xr=function(n){function t(r,e,i,o,a){n.call(this,r,e,i,o,a)}return n&&(t.__proto__=n),t.prototype=Object.create(n&&n.prototype),t.prototype.constructor=t,t.prototype.sync=function(e){this._fs._syncFile(this.getPath(),this.getBuffer(),e)},t.prototype.close=function(e){this.sync(e)},t}(X),Je=function(n){function t(r){n.call(this),this._client=r}return n&&(t.__proto__=n),t.prototype=Object.create(n&&n.prototype),t.prototype.constructor=t,t.Create=function(e,i){i(null,new t(e.client))},t.isAvailable=function(){return typeof Dropbox<"u"},t.prototype.getName=function(){return t.Name},t.prototype.isReadOnly=function(){return!1},t.prototype.supportsSymlinks=function(){return!1},t.prototype.supportsProps=function(){return!1},t.prototype.supportsSynch=function(){return!1},t.prototype.empty=function(e){var i=this;this.readdir("/",function(o,a){if(a){var u=function(p){a.length===0?e():Ge(i._client,a.shift(),u)};u()}else e(o)})},t.prototype.rename=function(e,i,o){var a=this;this.stat(i,!1,function(u,p){var d=function(){var F={from_path:Ft(e),to_path:Ft(i)};a._client.filesMoveV2(F).then(function(){return o()}).catch(function(D){var W=Ht(D);switch(W[".tag"]){case"from_lookup":o(ne(W.from_lookup,e,bt(D)));break;case"from_write":o(Ie(W.from_write,e,bt(D)));break;case"to":o(Ie(W.to,i,bt(D)));break;case"cant_copy_shared_folder":case"cant_nest_shared_folder":o(new s(f.EPERM,bt(D),e));break;case"cant_move_folder_into_itself":case"duplicated_or_nested_paths":o(new s(f.EBADF,bt(D),e));break;case"too_many_files":o(new s(f.ENOSPC,bt(D),e));break;case"other":default:o(new s(f.EIO,bt(D),e));break}})};u?d():e===i?u?o(s.ENOENT(i)):o():p&&p.isDirectory()?o(s.EISDIR(i)):a.unlink(i,function(F){F?o(F):d()})})},t.prototype.stat=function(e,i,o){if(e==="/"){Ut(function(){o(null,new M(R.DIRECTORY,4096))});return}var a={path:Ft(e)};this._client.filesGetMetadata(a).then(function(u){switch(u[".tag"]){case"file":var p=u;o(null,new M(R.FILE,p.size));break;case"folder":o(null,new M(R.DIRECTORY,4096));break;case"deleted":o(s.ENOENT(e));break;default:break}}).catch(function(u){var p=Ht(u);switch(p[".tag"]){case"path":o(ne(p.path,e,bt(u)));break;default:o(new s(f.EIO,bt(u),e));break}})},t.prototype.openFile=function(e,i,o){var a=this,u={path:Ft(e)};this._client.filesDownload(u).then(function(p){var d=p.fileBlob,F=new FileReader;F.onload=function(){var D=F.result;o(null,new xr(a,e,i,new M(R.FILE,D.byteLength),A(D)))},F.readAsArrayBuffer(d)}).catch(function(p){var d=Ht(p);switch(d[".tag"]){case"path":var F=d;o(ne(F.path,e,bt(p)));break;case"other":default:o(new s(f.EIO,bt(p),e));break}})},t.prototype.createFile=function(e,i,o,a){var u=this,p=S.alloc(0),d=new Blob([qt(p)],{type:"octet/stream"}),F={contents:d,path:Ft(e)};this._client.filesUpload(F).then(function(D){a(null,new xr(u,e,i,new M(R.FILE,0),p))}).catch(function(D){var W=Ht(D);switch(W[".tag"]){case"path":var tt=W;a(Ie(tt.path.reason,e,bt(D)));break;case"too_many_write_operations":setTimeout(function(){return u.createFile(e,i,o,a)},500+300*Math.random());break;case"other":default:a(new s(f.EIO,bt(D),e));break}})},t.prototype.unlink=function(e,i){var o=this;this.stat(e,!1,function(a,u){u?u.isDirectory()?i(s.EISDIR(e)):Ge(o._client,e,i):i(a)})},t.prototype.rmdir=function(e,i){var o=this;this.readdir(e,function(a,u){u?u.length>0?i(s.ENOTEMPTY(e)):Ge(o._client,e,i):i(a)})},t.prototype.mkdir=function(e,i,o){var a=this,u=h.dirname(e);this.stat(u,!1,function(p,d){if(p)o(p);else if(d&&!d.isDirectory())o(s.ENOTDIR(u));else{var F={path:Ft(e)};a._client.filesCreateFolderV2(F).then(function(){return o()}).catch(function(D){var W=Ht(D);W[".tag"]==="too_many_write_operations"?setTimeout(function(){return a.mkdir(e,i,o)},500+300*Math.random()):o(Ie(Ht(D).path,e,bt(D)))})}})},t.prototype.readdir=function(e,i){var o=this,a={path:Ft(e)};this._client.filesListFolder(a).then(function(u){z(o._client,e,u,[],i)}).catch(function(u){Fr(u,e,i)})},t.prototype._syncFile=function(e,i,o){var a=this,u=new Blob([qt(i)],{type:"octet/stream"}),p={contents:u,path:Ft(e),mode:{".tag":"overwrite"}};this._client.filesUpload(p).then(function(){o()}).catch(function(d){var F=Ht(d);switch(F[".tag"]){case"path":var D=F;o(Ie(D.path.reason,e,bt(d)));break;case"too_many_write_operations":setTimeout(function(){return a._syncFile(e,i,o)},500+300*Math.random());break;case"other":default:o(new s(f.EIO,bt(d),e));break}})},t}(ut);Je.Name="DropboxV2",Je.Options={client:{type:"object",description:"An *authenticated* Dropbox client. Must be from the 2.5.x JS SDK."}};function Fr(n,t,r){var e=Ht(n);switch(e[".tag"]){case"path":var i=e;r(ne(i.path,t,bt(n)));break;case"other":default:r(new s(f.EIO,bt(n),t));break}}function z(n,t,r,e,i){var o=r.entries.map(function(p){return p.path_display}).filter(function(p){return!!p}),a=e.concat(o);if(!r.has_more)i(null,a);else{var u={cursor:r.cursor};n.filesListFolderContinue(u).then(function(p){z(n,t,p,a,i)}).catch(function(p){Fr(p,t,i)})}}function K(n,t){t===void 0&&(t="");for(var r=n.errno,e=n.node,i=[];e&&(i.unshift(e.name),e!==e.parent);)e=e.parent;return new s(r,g[r],i.length>0?"/"+i.join("/"):t)}var y=function(n){function t(r,e,i,o){n.call(this),this._fs=r,this._FS=e,this._path=i,this._stream=o}return n&&(t.__proto__=n),t.prototype=Object.create(n&&n.prototype),t.prototype.constructor=t,t.prototype.getPos=function(){},t.prototype.close=function(e){var i=null;try{this.closeSync()}catch(o){i=o}finally{e(i)}},t.prototype.closeSync=function(){try{this._FS.close(this._stream)}catch(e){throw K(e,this._path)}},t.prototype.stat=function(e){try{e(null,this.statSync())}catch(i){e(i)}},t.prototype.statSync=function(){try{return this._fs.statSync(this._path,!1)}catch(e){throw K(e,this._path)}},t.prototype.truncate=function(e,i){var o=null;try{this.truncateSync(e)}catch(a){o=a}finally{i(o)}},t.prototype.truncateSync=function(e){try{this._FS.ftruncate(this._stream.fd,e)}catch(i){throw K(i,this._path)}},t.prototype.write=function(e,i,o,a,u){try{u(null,this.writeSync(e,i,o,a),e)}catch(p){u(p)}},t.prototype.writeSync=function(e,i,o,a){try{var u=jt(e),p=a===null?void 0:a;return this._FS.write(this._stream,u,i,o,p)}catch(d){throw K(d,this._path)}},t.prototype.read=function(e,i,o,a,u){try{u(null,this.readSync(e,i,o,a),e)}catch(p){u(p)}},t.prototype.readSync=function(e,i,o,a){try{var u=jt(e),p=a===null?void 0:a;return this._FS.read(this._stream,u,i,o,p)}catch(d){throw K(d,this._path)}},t.prototype.sync=function(e){e()},t.prototype.syncSync=function(){},t.prototype.chown=function(e,i,o){var a=null;try{this.chownSync(e,i)}catch(u){a=u}finally{o(a)}},t.prototype.chownSync=function(e,i){try{this._FS.fchown(this._stream.fd,e,i)}catch(o){throw K(o,this._path)}},t.prototype.chmod=function(e,i){var o=null;try{this.chmodSync(e)}catch(a){o=a}finally{i(o)}},t.prototype.chmodSync=function(e){try{this._FS.fchmod(this._stream.fd,e)}catch(i){throw K(i,this._path)}},t.prototype.utimes=function(e,i,o){var a=null;try{this.utimesSync(e,i)}catch(u){a=u}finally{o(a)}},t.prototype.utimesSync=function(e,i){this._fs.utimesSync(this._path,e,i)},t}(m),st=function(n){function t(r){n.call(this),this._FS=r}return n&&(t.__proto__=n),t.prototype=Object.create(n&&n.prototype),t.prototype.constructor=t,t.Create=function(e,i){i(null,new t(e.FS))},t.isAvailable=function(){return!0},t.prototype.getName=function(){return this._FS.DB_NAME()},t.prototype.isReadOnly=function(){return!1},t.prototype.supportsLinks=function(){return!0},t.prototype.supportsProps=function(){return!0},t.prototype.supportsSynch=function(){return!0},t.prototype.renameSync=function(e,i){try{this._FS.rename(e,i)}catch(o){throw o.errno===f.ENOENT?K(o,this.existsSync(e)?i:e):K(o)}},t.prototype.statSync=function(e,i){try{var o=i?this._FS.lstat(e):this._FS.stat(e),a=this.modeToFileType(o.mode);return new M(a,o.size,o.mode,o.atime,o.mtime,o.ctime)}catch(u){throw K(u,e)}},t.prototype.openSync=function(e,i,o){try{var a=this._FS.open(e,i.getFlagString(),o);if(this._FS.isDir(a.node.mode))throw this._FS.close(a),s.EISDIR(e);return new y(this,this._FS,e,a)}catch(u){throw K(u,e)}},t.prototype.unlinkSync=function(e){try{this._FS.unlink(e)}catch(i){throw K(i,e)}},t.prototype.rmdirSync=function(e){try{this._FS.rmdir(e)}catch(i){throw K(i,e)}},t.prototype.mkdirSync=function(e,i){try{this._FS.mkdir(e,i)}catch(o){throw K(o,e)}},t.prototype.readdirSync=function(e){try{return this._FS.readdir(e).filter(function(i){return i!=="."&&i!==".."})}catch(i){throw K(i,e)}},t.prototype.truncateSync=function(e,i){try{this._FS.truncate(e,i)}catch(o){throw K(o,e)}},t.prototype.readFileSync=function(e,i,o){try{var a=this._FS.readFile(e,{flags:o.getFlagString()}),u=xt(a);return i?u.toString(i):u}catch(p){throw K(p,e)}},t.prototype.writeFileSync=function(e,i,o,a,u){try{o&&(i=S.from(i,o));var p=jt(i);this._FS.writeFile(e,p,{flags:a.getFlagString(),encoding:"binary"}),this._FS.chmod(e,u)}catch(d){throw K(d,e)}},t.prototype.chmodSync=function(e,i,o){try{i?this._FS.lchmod(e,o):this._FS.chmod(e,o)}catch(a){throw K(a,e)}},t.prototype.chownSync=function(e,i,o,a){try{i?this._FS.lchown(e,o,a):this._FS.chown(e,o,a)}catch(u){throw K(u,e)}},t.prototype.symlinkSync=function(e,i,o){try{this._FS.symlink(e,i)}catch(a){throw K(a)}},t.prototype.readlinkSync=function(e){try{return this._FS.readlink(e)}catch(i){throw K(i,e)}},t.prototype.utimesSync=function(e,i,o){try{this._FS.utime(e,i.getTime(),o.getTime())}catch(a){throw K(a,e)}},t.prototype.modeToFileType=function(e){if(this._FS.isDir(e))return R.DIRECTORY;if(this._FS.isFile(e))return R.FILE;if(this._FS.isLink(e))return R.SYMLINK;throw s.EPERM("Invalid mode: "+e)},t}(x);st.Name="EmscriptenFileSystem",st.Options={FS:{type:"object",description:"The Emscripten file system to use (the `FS` variable)"}};var At=function(n){function t(r,e){n.call(this),this._folder=r,this._wrapped=e}return n&&(t.__proto__=n),t.prototype=Object.create(n&&n.prototype),t.prototype.constructor=t,t.Create=function(e,i){var o=new t(e.folder,e.wrapped);o._initialize(function(a){a?i(a):i(null,o)})},t.isAvailable=function(){return!0},t.prototype.getName=function(){return this._wrapped.getName()},t.prototype.isReadOnly=function(){return this._wrapped.isReadOnly()},t.prototype.supportsProps=function(){return this._wrapped.supportsProps()},t.prototype.supportsSynch=function(){return this._wrapped.supportsSynch()},t.prototype.supportsLinks=function(){return!1},t.prototype._initialize=function(e){var i=this;this._wrapped.exists(this._folder,function(o){o?e():i._wrapped.isReadOnly()?e(s.ENOENT(i._folder)):i._wrapped.mkdir(i._folder,511,e)})},t}(ut);At.Name="FolderAdapter",At.Options={folder:{type:"string",description:"The folder to use as the root directory"},wrapped:{type:"object",description:"The file system to wrap"}};function it(n,t){if(t!==null&&typeof t=="object"){var r=t,e=r.path;e&&(e="/"+h.relative(n,e),r.message=r.message.replace(r.path,e),r.path=e)}return t}function se(n,t){return typeof t=="function"?function(r){arguments.length>0&&(arguments[0]=it(n,r)),t.apply(null,arguments)}:t}function at(n,t,r){return n.slice(n.length-4)!=="Sync"?function(){return arguments.length>0&&(t&&(arguments[0]=h.join(this._folder,arguments[0])),r&&(arguments[1]=h.join(this._folder,arguments[1])),arguments[arguments.length-1]=se(this._folder,arguments[arguments.length-1])),this._wrapped[n].apply(this._wrapped,arguments)}:function(){try{return t&&(arguments[0]=h.join(this._folder,arguments[0])),r&&(arguments[1]=h.join(this._folder,arguments[1])),this._wrapped[n].apply(this._wrapped,arguments)}catch(e){throw it(this._folder,e)}}}["diskSpace","stat","statSync","open","openSync","unlink","unlinkSync","rmdir","rmdirSync","mkdir","mkdirSync","readdir","readdirSync","exists","existsSync","realpath","realpathSync","truncate","truncateSync","readFile","readFileSync","writeFile","writeFileSync","appendFile","appendFileSync","chmod","chmodSync","chown","chownSync","utimes","utimesSync","readlink","readlinkSync"].forEach(function(n){At.prototype[n]=at(n,!0,!1)}),["rename","renameSync","link","linkSync","symlink","symlinkSync"].forEach(function(n){At.prototype[n]=at(n,!0,!0)});function Xt(n,t){t=t|0;for(var r=Math.max(n.length-t,0),e=Array(r),i=0;i<r;i++)e[i]=n[t+i];return e}var Z=function(n){return function(){var t=Xt(arguments),r=t.pop();n.call(this,t,r)}};function V(n){var t=typeof n;return n!=null&&(t=="object"||t=="function")}var Ue=typeof setImmediate=="function"&&setImmediate,Bt=typeof U=="object"&&typeof U.nextTick=="function";function lt(n){setTimeout(n,0)}function Ke(n){return function(t){var r=Xt(arguments,1);n(function(){t.apply(null,r)})}}var De;Ue?De=setImmediate:Bt?De=U.nextTick:De=lt;var Gt=Ke(De);function Dt(n){return Z(function(t,r){var e;try{e=n.apply(this,t)}catch(i){return r(i)}V(e)&&typeof e.then=="function"?e.then(function(i){ee(r,null,i)},function(i){ee(r,i.message?i:new Error(i))}):r(null,e)})}function ee(n,t,r){try{n(t,r)}catch(e){Gt(ae,e)}}function ae(n){throw n}var ie=typeof Symbol=="function";function Qe(n){return ie&&n[Symbol.toStringTag]==="AsyncFunction"}function Ae(n){return Qe(n)?Dt(n):n}var Yt=typeof L=="object"&&L&&L.Object===Object&&L,ue=typeof self=="object"&&self&&self.Object===Object&&self,Qt=Yt||ue||Function("return this")(),fe=Qt.Symbol,pe=Object.prototype,br=pe.hasOwnProperty,zi=pe.toString,sr=fe?fe.toStringTag:void 0;function Wi(n){var t=br.call(n,sr),r=n[sr];try{n[sr]=void 0;var e=!0}catch{}var i=zi.call(n);return e&&(t?n[sr]=r:delete n[sr]),i}var Hi=Object.prototype,Vi=Hi.toString;function Zi(n){return Vi.call(n)}var Yi="[object Null]",qi="[object Undefined]",ln=fe?fe.toStringTag:void 0;function Ur(n){return n==null?n===void 0?qi:Yi:ln&&ln in Object(n)?Wi(n):Zi(n)}var Xi="[object AsyncFunction]",Gi="[object Function]",Ji="[object GeneratorFunction]",Ki="[object Proxy]";function Qi(n){if(!V(n))return!1;var t=Ur(n);return t==Gi||t==Ji||t==Xi||t==Ki}var $i=9007199254740991;function hn(n){return typeof n=="number"&&n>-1&&n%1==0&&n<=$i}function Pr(n){return n!=null&&hn(n.length)&&!Qi(n)}var pn={};function dn(){}function yn(n){return function(){if(n!==null){var t=n;n=null,t.apply(this,arguments)}}}var Br=typeof Symbol=="function"&&Symbol.iterator,to=function(n){return Br&&n[Br]&&n[Br]()};function eo(n,t){for(var r=-1,e=Array(n);++r<n;)e[r]=t(r);return e}function jr(n){return n!=null&&typeof n=="object"}var ro="[object Arguments]";function vn(n){return jr(n)&&Ur(n)==ro}var gn=Object.prototype,no=gn.hasOwnProperty,io=gn.propertyIsEnumerable,oo=vn(function(){return arguments}())?vn:function(n){return jr(n)&&no.call(n,"callee")&&!io.call(n,"callee")},ao=Array.isArray;function so(){return!1}var wn=typeof w=="object"&&w&&!w.nodeType&&w,mn=wn&&typeof I=="object"&&I&&!I.nodeType&&I,uo=mn&&mn.exports===wn,_n=uo?Qt.Buffer:void 0,fo=_n?_n.isBuffer:void 0,co=fo||so,lo=9007199254740991,ho=/^(?:0|[1-9]\d*)$/;function po(n,t){return t=t==null?lo:t,!!t&&(typeof n=="number"||ho.test(n))&&n>-1&&n%1==0&&n<t}var yo="[object Arguments]",vo="[object Array]",go="[object Boolean]",wo="[object Date]",mo="[object Error]",_o="[object Function]",So="[object Map]",Eo="[object Number]",xo="[object Object]",Fo="[object RegExp]",bo="[object Set]",Io="[object String]",ko="[object WeakMap]",Oo="[object ArrayBuffer]",Ro="[object DataView]",To="[object Float32Array]",Lo="[object Float64Array]",No="[object Int8Array]",Do="[object Int16Array]",Ao="[object Int32Array]",Co="[object Uint8Array]",Mo="[object Uint8ClampedArray]",Uo="[object Uint16Array]",Po="[object Uint32Array]",zt={};zt[To]=zt[Lo]=zt[No]=zt[Do]=zt[Ao]=zt[Co]=zt[Mo]=zt[Uo]=zt[Po]=!0,zt[yo]=zt[vo]=zt[Oo]=zt[go]=zt[Ro]=zt[wo]=zt[mo]=zt[_o]=zt[So]=zt[Eo]=zt[xo]=zt[Fo]=zt[bo]=zt[Io]=zt[ko]=!1;function Bo(n){return jr(n)&&hn(n.length)&&!!zt[Ur(n)]}function jo(n){return function(t){return n(t)}}var Sn=typeof w=="object"&&w&&!w.nodeType&&w,En=Sn&&typeof I=="object"&&I&&!I.nodeType&&I,zo=En&&En.exports===Sn,zr=zo&&Yt.process,xn=function(){try{return zr&&zr.binding&&zr.binding("util")}catch{}}(),Fn=xn&&xn.isTypedArray,Wo=Fn?jo(Fn):Bo,Ho=Object.prototype,Vo=Ho.hasOwnProperty;function Zo(n,t){var r=ao(n),e=!r&&oo(n),i=!r&&!e&&co(n),o=!r&&!e&&!i&&Wo(n),a=r||e||i||o,u=a?eo(n.length,String):[],p=u.length;for(var d in n)(t||Vo.call(n,d))&&!(a&&(d=="length"||i&&(d=="offset"||d=="parent")||o&&(d=="buffer"||d=="byteLength"||d=="byteOffset")||po(d,p)))&&u.push(d);return u}var Yo=Object.prototype;function qo(n){var t=n&&n.constructor,r=typeof t=="function"&&t.prototype||Yo;return n===r}function Xo(n,t){return function(r){return n(t(r))}}var Go=Xo(Object.keys,Object),Jo=Object.prototype,Ko=Jo.hasOwnProperty;function Qo(n){if(!qo(n))return Go(n);var t=[];for(var r in Object(n))Ko.call(n,r)&&r!="constructor"&&t.push(r);return t}function bn(n){return Pr(n)?Zo(n):Qo(n)}function $o(n){var t=-1,r=n.length;return function(){return++t<r?{value:n[t],key:t}:null}}function ta(n){var t=-1;return function(){var e=n.next();return e.done?null:(t++,{value:e.value,key:t})}}function ea(n){var t=bn(n),r=-1,e=t.length;return function(){var o=t[++r];return r<e?{value:n[o],key:o}:null}}function ra(n){if(Pr(n))return $o(n);var t=to(n);return t?ta(t):ea(n)}function In(n){return function(){if(n===null)throw new Error("Callback was already called.");var t=n;n=null,t.apply(this,arguments)}}function na(n){return function(t,r,e){if(e=yn(e||dn),n<=0||!t)return e(null);var i=ra(t),o=!1,a=0;function u(d,F){if(a-=1,d)o=!0,e(d);else{if(F===pn||o&&a<=0)return o=!0,e(null);p()}}function p(){for(;a<n&&!o;){var d=i();if(d===null){o=!0,a<=0&&e(null);return}a+=1,r(d.value,d.key,In(u))}}p()}}function ia(n,t,r,e){na(t)(n,Ae(r),e)}function oa(n,t){return function(r,e,i){return n(r,t,e,i)}}function aa(n,t,r){r=yn(r||dn);var e=0,i=0,o=n.length;o===0&&r(null);function a(u,p){u?r(u):(++i===o||p===pn)&&r(null)}for(;e<o;e++)t(n[e],e,In(a))}var sa=oa(ia,1/0),ua=function(n,t,r){var e=Pr(n)?aa:sa;e(n,Ae(t),r)};function Ls(n,t){for(var r=-1,e=n==null?0:n.length;++r<e&&t(n[r],r,n)!==!1;);return n}function fa(n){return function(t,r,e){for(var i=-1,o=Object(t),a=e(t),u=a.length;u--;){var p=a[n?u:++i];if(r(o[p],p,o)===!1)break}return t}}var ca=fa();function Ns(n,t){return n&&ca(n,t,bn)}function la(n,t,r,e){for(var i=n.length,o=r+(e?1:-1);e?o--:++o<i;)if(t(n[o],o,n))return o;return-1}function ha(n){return n!==n}function pa(n,t,r){for(var e=r-1,i=n.length;++e<i;)if(n[e]===t)return e;return-1}function Ds(n,t,r){return t===t?pa(n,t,r):la(n,ha,r)}var kn="\\ud800-\\udfff",da="\\u0300-\\u036f",ya="\\ufe20-\\ufe2f",va="\\u20d0-\\u20ff",ga=da+ya+va,wa="\\ufe0e\\ufe0f",ma="["+kn+"]",Wr="["+ga+"]",_a="\\ud83c[\\udffb-\\udfff]",Sa="(?:"+Wr+"|"+_a+")",On="[^"+kn+"]",Rn="(?:\\ud83c[\\udde6-\\uddff]){2}",Tn="[\\ud800-\\udbff][\\udc00-\\udfff]",Ea="\\u200d",Ln=Sa+"?",Nn="["+wa+"]?",xa="(?:"+Ea+"(?:"+[On,Rn,Tn].join("|")+")"+Nn+Ln+")*",As=Nn+Ln+xa,Cs="(?:"+[On+Wr+"?",Wr,Rn,Tn,ma].join("|")+")";function Fa(n){return function(t,r,e){return n(t,e)}}function ba(n,t,r){ua(n,Fa(Ae(t)),r)}var Hr;Bt?Hr=U.nextTick:Ue?Hr=setImmediate:Hr=lt;var Ms=Math.ceil,Us=Math.max;function Ia(n){return n.isDirectory}var Vr=c.webkitRequestFileSystem||c.requestFileSystem||null;function ka(n,t,r,e){if(typeof navigator.webkitPersistentStorage<"u")switch(n){case c.PERSISTENT:navigator.webkitPersistentStorage.requestQuota(t,r,e);break;case c.TEMPORARY:navigator.webkitTemporaryStorage.requestQuota(t,r,e);break;default:e(new TypeError("Invalid storage type: "+n));break}else c.webkitStorageInfo.requestQuota(n,t,r,e)}function Oa(n){return Array.prototype.slice.call(n||[],0)}function me(n,t,r){switch(n.name){case"PathExistsError":return s.EEXIST(t);case"QuotaExceededError":return s.FileError(f.ENOSPC,t);case"NotFoundError":return s.ENOENT(t);case"SecurityError":return s.FileError(f.EACCES,t);case"InvalidModificationError":return s.FileError(f.EPERM,t);case"TypeMismatchError":return s.FileError(r?f.ENOTDIR:f.EISDIR,t);case"EncodingError":case"InvalidStateError":case"NoModificationAllowedError":default:return s.FileError(f.EINVAL,t)}}var Ra=function(n){function t(r,e,i,o,a,u){n.call(this,r,i,o,a,u),this._entry=e}return n&&(t.__proto__=n),t.prototype=Object.create(n&&n.prototype),t.prototype.constructor=t,t.prototype.sync=function(e){var i=this;if(!this.isDirty())return e();this._entry.createWriter(function(o){var a=i.getBuffer(),u=new Blob([qt(a)]),p=u.size;o.onwriteend=function(d){o.onwriteend=null,o.onerror=null,o.truncate(p),i.resetDirty(),e()},o.onerror=function(d){e(me(d,i.getPath(),!1))},o.write(u)})},t.prototype.close=function(e){this.sync(e)},t}(X),Ir=function(n){function t(r,e){r===void 0&&(r=5),e===void 0&&(e=c.PERSISTENT),n.call(this),this.size=1024*1024*r,this.type=e}return n&&(t.__proto__=n),t.prototype=Object.create(n&&n.prototype),t.prototype.constructor=t,t.Create=function(e,i){var o=new t(e.size,e.type);o._allocate(function(a){return a?i(a):i(null,o)})},t.isAvailable=function(){return!!Vr},t.prototype.getName=function(){return t.Name},t.prototype.isReadOnly=function(){return!1},t.prototype.supportsSymlinks=function(){return!1},t.prototype.supportsProps=function(){return!1},t.prototype.supportsSynch=function(){return!1},t.prototype.empty=function(e){this._readdir("/",function(i,o){if(i)e(i);else{var a=function(p){i?e(i):e()},u=function(p,d){var F=function(){d()},D=function(W){d(me(W,p.fullPath,!p.isDirectory))};Ia(p)?p.removeRecursively(F,D):p.remove(F,D)};ba(o,u,a)}})},t.prototype.rename=function(e,i,o){var a=this,u=2,p=0,d=this.fs.root,F=e,D=function(tt){--u<=0&&o(me(tt,F,!1))},W=function(tt){if(++p===2)return o(new s(f.EINVAL,"Something was identified as both a file and a directory. This should never happen."));if(e===i)return o();F=h.dirname(i),d.getDirectory(F,{},function(nt){F=h.basename(i),tt.moveTo(nt,F,function(ft){o()},function(ft){tt.isDirectory?(F=i,a.unlink(i,function(yt){yt?D(ft):a.rename(e,i,o)})):D(ft)})},D)};d.getFile(e,{},W,D),d.getDirectory(e,{},W,D)},t.prototype.stat=function(e,i,o){var a=this,u={create:!1},p=function(W){var tt=function(nt){var ft=new M(R.FILE,nt.size);o(null,ft)};W.file(tt,F)},d=function(W){var tt=4096,nt=new M(R.DIRECTORY,tt);o(null,nt)},F=function(W){o(me(W,e,!1))},D=function(){a.fs.root.getDirectory(e,u,d,F)};this.fs.root.getFile(e,u,p,D)},t.prototype.open=function(e,i,o,a){var u=this,p=function(d){d.name==="InvalidModificationError"&&i.isExclusive()?a(s.EEXIST(e)):a(me(d,e,!1))};this.fs.root.getFile(e,{create:i.pathNotExistsAction()===T.CREATE_FILE,exclusive:i.isExclusive()},function(d){d.file(function(F){var D=new FileReader;D.onloadend=function(W){var tt=u._makeFile(e,d,i,F,D.result);a(null,tt)},D.onerror=function(W){p(D.error)},D.readAsArrayBuffer(F)},p)},p)},t.prototype.unlink=function(e,i){this._remove(e,i,!0)},t.prototype.rmdir=function(e,i){var o=this;this.readdir(e,function(a,u){a?i(a):u.length>0?i(s.ENOTEMPTY(e)):o._remove(e,i,!1)})},t.prototype.mkdir=function(e,i,o){var a={create:!0,exclusive:!0},u=function(d){o()},p=function(d){o(me(d,e,!0))};this.fs.root.getDirectory(e,a,u,p)},t.prototype.readdir=function(e,i){this._readdir(e,function(o,a){if(a){for(var u=[],p=0,d=a;p<d.length;p+=1){var F=d[p];u.push(F.name)}i(null,u)}else return i(o)})},t.prototype._makeFile=function(e,i,o,a,u){u===void 0&&(u=new ArrayBuffer(0));var p=new M(R.FILE,a.size),d=A(u);return new Ra(this,i,e,o,p,d)},t.prototype._readdir=function(e,i){var o=function(a){i(me(a,e,!0))};this.fs.root.getDirectory(e,{create:!1},function(a){var u=a.createReader(),p=[],d=function(){u.readEntries(function(F){F.length?(p=p.concat(Oa(F)),d()):i(null,p)},o)};d()},o)},t.prototype._allocate=function(e){var i=this,o=function(u){i.fs=u,e()},a=function(u){e(me(u,"/",!0))};this.type===c.PERSISTENT?ka(this.type,this.size,function(u){Vr(i.type,u,o,a)},a):Vr(this.type,this.size,o,a)},t.prototype._remove=function(e,i,o){var a=function(d){var F=function(){i()},D=function(W){i(me(W,e,!o))};d.remove(F,D)},u=function(d){i(me(d,e,!o))},p={create:!1};o?this.fs.root.getFile(e,p,a,u):this.fs.root.getDirectory(e,p,a,u)},t}(ut);Ir.Name="HTML5FS",Ir.Options={size:{type:"number",optional:!0,description:"Storage quota to request, in megabytes. Allocated value may be less. Defaults to 5."},type:{type:"number",optional:!0,description:"window.PERSISTENT or window.TEMPORARY. Defaults to PERSISTENT."}};var ce=function(t,r,e,i,o,a){this.id=t,this.size=r,this.mode=e,this.atime=i,this.mtime=o,this.ctime=a};ce.fromBuffer=function(t){if(t===void 0)throw new Error("NO");return new ce(t.toString("ascii",30),t.readUInt32LE(0),t.readUInt16LE(4),t.readDoubleLE(6),t.readDoubleLE(14),t.readDoubleLE(22))},ce.prototype.toStats=function(){return new M((this.mode&61440)===R.DIRECTORY?R.DIRECTORY:R.FILE,this.size,this.mode,new Date(this.atime),new Date(this.mtime),new Date(this.ctime))},ce.prototype.getSize=function(){return 30+this.id.length},ce.prototype.toBuffer=function(t){return t===void 0&&(t=S.alloc(this.getSize())),t.writeUInt32LE(this.size,0),t.writeUInt16LE(this.mode,4),t.writeDoubleLE(this.atime,6),t.writeDoubleLE(this.mtime,14),t.writeDoubleLE(this.ctime,22),t.write(this.id,30,this.id.length,"ascii"),t},ce.prototype.update=function(t){var r=!1;this.size!==t.size&&(this.size=t.size,r=!0),this.mode!==t.mode&&(this.mode=t.mode,r=!0);var e=t.atime.getTime();this.atime!==e&&(this.atime=e,r=!0);var i=t.mtime.getTime();this.mtime!==i&&(this.mtime=i,r=!0);var o=t.ctime.getTime();return this.ctime!==o&&(this.ctime=o,r=!0),r},ce.prototype.isFile=function(){return(this.mode&61440)===R.FILE},ce.prototype.isDirectory=function(){return(this.mode&61440)===R.DIRECTORY};var Ce="/",Zr=null;function Dn(){return Zr||(Zr=S.from("{}"))}function kr(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(n){var t=Math.random()*16|0,r=n==="x"?t:t&3|8;return r.toString(16)})}function de(n,t){return n?(t(n),!1):!0}function $t(n,t,r){return n?(t.abort(function(){r(n)}),!1):!0}var ke=function(t){this.store=t,this.originalData={},this.modifiedKeys=[]};ke.prototype.get=function(t){var r=this.store.get(t);return this.stashOldValue(t,r),r},ke.prototype.put=function(t,r,e){return this.markModified(t),this.store.put(t,r,e)},ke.prototype.del=function(t){this.markModified(t),this.store.del(t)},ke.prototype.commit=function(){},ke.prototype.abort=function(){for(var t=this,r=0,e=t.modifiedKeys;r<e.length;r+=1){var i=e[r],o=t.originalData[i];o?t.store.put(i,o,!0):t.store.del(i)}},ke.prototype.stashOldValue=function(t,r){this.originalData.hasOwnProperty(t)||(this.originalData[t]=r)},ke.prototype.markModified=function(t){this.modifiedKeys.indexOf(t)===-1&&(this.modifiedKeys.push(t),this.originalData.hasOwnProperty(t)||(this.originalData[t]=this.store.get(t)))};var An=function(n){function t(r,e,i,o,a){n.call(this,r,e,i,o,a)}return n&&(t.__proto__=n),t.prototype=Object.create(n&&n.prototype),t.prototype.constructor=t,t.prototype.syncSync=function(){this.isDirty()&&(this._fs._syncSync(this.getPath(),this.getBuffer(),this.getStats()),this.resetDirty())},t.prototype.closeSync=function(){this.syncSync()},t}(X),Cn=function(n){function t(r){n.call(this),this.store=r.store,this.makeRootDirectory()}return n&&(t.__proto__=n),t.prototype=Object.create(n&&n.prototype),t.prototype.constructor=t,t.isAvailable=function(){return!0},t.prototype.getName=function(){return this.store.name()},t.prototype.isReadOnly=function(){return!1},t.prototype.supportsSymlinks=function(){return!1},t.prototype.supportsProps=function(){return!1},t.prototype.supportsSynch=function(){return!0},t.prototype.empty=function(){this.store.clear(),this.makeRootDirectory()},t.prototype.renameSync=function(e,i){var o=this.store.beginTransaction("readwrite"),a=h.dirname(e),u=h.basename(e),p=h.dirname(i),d=h.basename(i),F=this.findINode(o,a),D=this.getDirListing(o,a,F);if(!D[u])throw s.ENOENT(e);var W=D[u];if(delete D[u],(p+"/").indexOf(e+"/")===0)throw new s(f.EBUSY,a);var tt,nt;if(p===a?(tt=F,nt=D):(tt=this.findINode(o,p),nt=this.getDirListing(o,p,tt)),nt[d]){var ft=this.getINode(o,i,nt[d]);if(ft.isFile())try{o.del(ft.id),o.del(nt[d])}catch(yt){throw o.abort(),yt}else throw s.EPERM(i)}nt[d]=W;try{o.put(F.id,S.from(JSON.stringify(D)),!0),o.put(tt.id,S.from(JSON.stringify(nt)),!0)}catch(yt){throw o.abort(),yt}o.commit()},t.prototype.statSync=function(e,i){return this.findINode(this.store.beginTransaction("readonly"),e).toStats()},t.prototype.createFileSync=function(e,i,o){var a=this.store.beginTransaction("readwrite"),u=ot(),p=this.commitNewFile(a,e,R.FILE,o,u);return new An(this,e,i,p.toStats(),u)},t.prototype.openFileSync=function(e,i){var o=this.store.beginTransaction("readonly"),a=this.findINode(o,e),u=o.get(a.id);if(u===void 0)throw s.ENOENT(e);return new An(this,e,i,a.toStats(),u)},t.prototype.unlinkSync=function(e){this.removeEntry(e,!1)},t.prototype.rmdirSync=function(e){if(this.readdirSync(e).length>0)throw s.ENOTEMPTY(e);this.removeEntry(e,!0)},t.prototype.mkdirSync=function(e,i){var o=this.store.beginTransaction("readwrite"),a=S.from("{}");this.commitNewFile(o,e,R.DIRECTORY,i,a)},t.prototype.readdirSync=function(e){var i=this.store.beginTransaction("readonly");return Object.keys(this.getDirListing(i,e,this.findINode(i,e)))},t.prototype._syncSync=function(e,i,o){var a=this.store.beginTransaction("readwrite"),u=this._findINode(a,h.dirname(e),h.basename(e)),p=this.getINode(a,e,u),d=p.update(o);try{a.put(p.id,i,!0),d&&a.put(u,p.toBuffer(),!0)}catch(F){throw a.abort(),F}a.commit()},t.prototype.makeRootDirectory=function(){var e=this.store.beginTransaction("readwrite");if(e.get(Ce)===void 0){var i=new Date().getTime(),o=new ce(kr(),4096,511|R.DIRECTORY,i,i,i);e.put(o.id,Dn(),!1),e.put(Ce,o.toBuffer(),!1),e.commit()}},t.prototype._findINode=function(e,i,o){var a=this,u=function(p){var d=a.getDirListing(e,i,p);if(d[o])return d[o];throw s.ENOENT(h.resolve(i,o))};return i==="/"?o===""?Ce:u(this.getINode(e,i,Ce)):u(this.getINode(e,i+h.sep+o,this._findINode(e,h.dirname(i),h.basename(i))))},t.prototype.findINode=function(e,i){return this.getINode(e,i,this._findINode(e,h.dirname(i),h.basename(i)))},t.prototype.getINode=function(e,i,o){var a=e.get(o);if(a===void 0)throw s.ENOENT(i);return ce.fromBuffer(a)},t.prototype.getDirListing=function(e,i,o){if(!o.isDirectory())throw s.ENOTDIR(i);var a=e.get(o.id);if(a===void 0)throw s.ENOENT(i);return JSON.parse(a.toString())},t.prototype.addNewNode=function(e,i){for(var o=0,a;o<5;)try{return a=kr(),e.put(a,i,!1),a}catch{}throw new s(f.EIO,"Unable to commit data to key-value store.")},t.prototype.commitNewFile=function(e,i,o,a,u){var p=h.dirname(i),d=h.basename(i),F=this.findINode(e,p),D=this.getDirListing(e,p,F),W=new Date().getTime();if(i==="/"||D[d])throw s.EEXIST(i);var tt;try{var nt=this.addNewNode(e,u);tt=new ce(nt,u.length,a|o,W,W,W);var ft=this.addNewNode(e,tt.toBuffer());D[d]=ft,e.put(F.id,S.from(JSON.stringify(D)),!0)}catch(yt){throw e.abort(),yt}return e.commit(),tt},t.prototype.removeEntry=function(e,i){var o=this.store.beginTransaction("readwrite"),a=h.dirname(e),u=this.findINode(o,a),p=this.getDirListing(o,a,u),d=h.basename(e);if(!p[d])throw s.ENOENT(e);var F=p[d];delete p[d];var D=this.getINode(o,e,F);if(!i&&D.isDirectory())throw s.EISDIR(e);if(i&&!D.isDirectory())throw s.ENOTDIR(e);try{o.del(D.id),o.del(F),o.put(u.id,S.from(JSON.stringify(p)),!0)}catch(W){throw o.abort(),W}o.commit()},t}(x),Mn=function(n){function t(r,e,i,o,a){n.call(this,r,e,i,o,a)}return n&&(t.__proto__=n),t.prototype=Object.create(n&&n.prototype),t.prototype.constructor=t,t.prototype.sync=function(e){var i=this;this.isDirty()?this._fs._sync(this.getPath(),this.getBuffer(),this.getStats(),function(o){o||i.resetDirty(),e(o)}):e()},t.prototype.close=function(e){this.sync(e)},t}(X),Ta=function(n){function t(){n.apply(this,arguments)}return n&&(t.__proto__=n),t.prototype=Object.create(n&&n.prototype),t.prototype.constructor=t,t.isAvailable=function(){return!0},t.prototype.init=function(e,i){this.store=e,this.makeRootDirectory(i)},t.prototype.getName=function(){return this.store.name()},t.prototype.isReadOnly=function(){return!1},t.prototype.supportsSymlinks=function(){return!1},t.prototype.supportsProps=function(){return!1},t.prototype.supportsSynch=function(){return!1},t.prototype.empty=function(e){var i=this;this.store.clear(function(o){de(o,e)&&i.makeRootDirectory(e)})},t.prototype.rename=function(e,i,o){var a=this,u=this.store.beginTransaction("readwrite"),p=h.dirname(e),d=h.basename(e),F=h.dirname(i),D=h.basename(i),W={},tt={},nt=!1;if((F+"/").indexOf(e+"/")===0)return o(new s(f.EBUSY,p));var ft=function(){if(!(nt||!tt.hasOwnProperty(p)||!tt.hasOwnProperty(F))){var Et=tt[p],Kt=W[p],re=tt[F],Ee=W[F];if(!Et[d])o(s.ENOENT(e));else{var xe=Et[d];delete Et[d];var or=function(){re[D]=xe,u.put(Kt.id,S.from(JSON.stringify(Et)),!0,function(Te){$t(Te,u,o)&&(p===F?u.commit(o):u.put(Ee.id,S.from(JSON.stringify(re)),!0,function(Le){$t(Le,u,o)&&u.commit(o)}))})};re[D]?a.getINode(u,i,re[D],function(Te,Le){$t(Te,u,o)&&(Le.isFile()?u.del(Le.id,function(xi){$t(xi,u,o)&&u.del(re[D],function(as){$t(as,u,o)&&or()})}):u.abort(function(xi){o(s.EPERM(i))}))}):or()}}},yt=function(Et){a.findINodeAndDirListing(u,Et,function(Kt,re,Ee){Kt?nt||(nt=!0,u.abort(function(){o(Kt)})):(W[Et]=re,tt[Et]=Ee,ft())})};yt(p),p!==F&&yt(F)},t.prototype.stat=function(e,i,o){var a=this.store.beginTransaction("readonly");this.findINode(a,e,function(u,p){de(u,o)&&o(null,p.toStats())})},t.prototype.createFile=function(e,i,o,a){var u=this,p=this.store.beginTransaction("readwrite"),d=ot();this.commitNewFile(p,e,R.FILE,o,d,function(F,D){de(F,a)&&a(null,new Mn(u,e,i,D.toStats(),d))})},t.prototype.openFile=function(e,i,o){var a=this,u=this.store.beginTransaction("readonly");this.findINode(u,e,function(p,d){de(p,o)&&u.get(d.id,function(F,D){de(F,o)&&(D===void 0?o(s.ENOENT(e)):o(null,new Mn(a,e,i,d.toStats(),D)))})})},t.prototype.unlink=function(e,i){this.removeEntry(e,!1,i)},t.prototype.rmdir=function(e,i){var o=this;this.readdir(e,function(a,u){a?i(a):u.length>0?i(s.ENOTEMPTY(e)):o.removeEntry(e,!0,i)})},t.prototype.mkdir=function(e,i,o){var a=this.store.beginTransaction("readwrite"),u=S.from("{}");this.commitNewFile(a,e,R.DIRECTORY,i,u,o)},t.prototype.readdir=function(e,i){var o=this,a=this.store.beginTransaction("readonly");this.findINode(a,e,function(u,p){de(u,i)&&o.getDirListing(a,e,p,function(d,F){de(d,i)&&i(null,Object.keys(F))})})},t.prototype._sync=function(e,i,o,a){var u=this,p=this.store.beginTransaction("readwrite");this._findINode(p,h.dirname(e),h.basename(e),function(d,F){$t(d,p,a)&&u.getINode(p,e,F,function(D,W){if($t(D,p,a)){var tt=W.update(o);p.put(W.id,i,!0,function(nt){$t(nt,p,a)&&(tt?p.put(F,W.toBuffer(),!0,function(ft){$t(ft,p,a)&&p.commit(a)}):p.commit(a))})}})})},t.prototype.makeRootDirectory=function(e){var i=this.store.beginTransaction("readwrite");i.get(Ce,function(o,a){if(o||a===void 0){var u=new Date().getTime(),p=new ce(kr(),4096,511|R.DIRECTORY,u,u,u);i.put(p.id,Dn(),!1,function(d){$t(d,i,e)&&i.put(Ce,p.toBuffer(),!1,function(F){F?i.abort(function(){e(F)}):i.commit(e)})})}else i.commit(e)})},t.prototype._findINode=function(e,i,o,a){var u=this,p=function(d,F,D){d?a(d):D[o]?a(null,D[o]):a(s.ENOENT(h.resolve(i,o)))};i==="/"?o===""?a(null,Ce):this.getINode(e,i,Ce,function(d,F){de(d,a)&&u.getDirListing(e,i,F,function(D,W){p(D,F,W)})}):this.findINodeAndDirListing(e,i,p)},t.prototype.findINode=function(e,i,o){var a=this;this._findINode(e,h.dirname(i),h.basename(i),function(u,p){de(u,o)&&a.getINode(e,i,p,o)})},t.prototype.getINode=function(e,i,o,a){e.get(o,function(u,p){de(u,a)&&(p===void 0?a(s.ENOENT(i)):a(null,ce.fromBuffer(p)))})},t.prototype.getDirListing=function(e,i,o,a){o.isDirectory()?e.get(o.id,function(u,p){if(de(u,a))try{a(null,JSON.parse(p.toString()))}catch{a(s.ENOENT(i))}}):a(s.ENOTDIR(i))},t.prototype.findINodeAndDirListing=function(e,i,o){var a=this;this.findINode(e,i,function(u,p){de(u,o)&&a.getDirListing(e,i,p,function(d,F){de(d,o)&&o(null,p,F)})})},t.prototype.addNewNode=function(e,i,o){var a=0,u,p=function(){++a===5?o(new s(f.EIO,"Unable to commit data to key-value store.")):(u=kr(),e.put(u,i,!1,function(d,F){d||!F?p():o(null,u)}))};p()},t.prototype.commitNewFile=function(e,i,o,a,u,p){var d=this,F=h.dirname(i),D=h.basename(i),W=new Date().getTime();if(i==="/")return p(s.EEXIST(i));this.findINodeAndDirListing(e,F,function(tt,nt,ft){$t(tt,e,p)&&(ft[D]?e.abort(function(){p(s.EEXIST(i))}):d.addNewNode(e,u,function(yt,Et){if($t(yt,e,p)){var Kt=new ce(Et,u.length,a|o,W,W,W);d.addNewNode(e,Kt.toBuffer(),function(re,Ee){$t(re,e,p)&&(ft[D]=Ee,e.put(nt.id,S.from(JSON.stringify(ft)),!0,function(xe){$t(xe,e,p)&&e.commit(function(or){$t(or,e,p)&&p(null,Kt)})}))})}}))})},t.prototype.removeEntry=function(e,i,o){var a=this,u=this.store.beginTransaction("readwrite"),p=h.dirname(e),d=h.basename(e);this.findINodeAndDirListing(u,p,function(F,D,W){if($t(F,u,o))if(!W[d])u.abort(function(){o(s.ENOENT(e))});else{var tt=W[d];delete W[d],a.getINode(u,e,tt,function(nt,ft){$t(nt,u,o)&&(!i&&ft.isDirectory()?u.abort(function(){o(s.EISDIR(e))}):i&&!ft.isDirectory()?u.abort(function(){o(s.ENOTDIR(e))}):u.del(ft.id,function(yt){$t(yt,u,o)&&u.del(tt,function(Et){$t(Et,u,o)&&u.put(D.id,S.from(JSON.stringify(W)),!0,function(Kt){$t(Kt,u,o)&&u.commit(o)})})}))})}})},t}(ut),Pe=function(){this.store={}};Pe.prototype.name=function(){return $e.Name},Pe.prototype.clear=function(){this.store={}},Pe.prototype.beginTransaction=function(t){return new ke(this)},Pe.prototype.get=function(t){return this.store[t]},Pe.prototype.put=function(t,r,e){return!e&&this.store.hasOwnProperty(t)?!1:(this.store[t]=r,!0)},Pe.prototype.del=function(t){delete this.store[t]};var $e=function(n){function t(){n.call(this,{store:new Pe})}return n&&(t.__proto__=n),t.prototype=Object.create(n&&n.prototype),t.prototype.constructor=t,t.Create=function(e,i){i(null,new t)},t}(Cn);$e.Name="InMemory",$e.Options={};var Yr=c.indexedDB||c.mozIndexedDB||c.webkitIndexedDB||c.msIndexedDB;function ur(n,t){switch(t===void 0&&(t=n.toString()),n.name){case"NotFoundError":return new s(f.ENOENT,t);case"QuotaExceededError":return new s(f.ENOSPC,t);default:return new s(f.EIO,t)}}function fr(n,t,r){return t===void 0&&(t=f.EIO),r===void 0&&(r=null),function(e){e.preventDefault(),n(new s(t,r!==null?r:void 0))}}var qr=function(t,r){this.tx=t,this.store=r};qr.prototype.get=function(t,r){try{var e=this.store.get(t);e.onerror=fr(r),e.onsuccess=function(i){var o=i.target.result;o===void 0?r(null,o):r(null,A(o))}}catch(i){r(ur(i))}};var La=function(n){function t(r,e){n.call(this,r,e)}return n&&(t.__proto__=n),t.prototype=Object.create(n&&n.prototype),t.prototype.constructor=t,t.prototype.put=function(e,i,o,a){try{var u=qt(i),p;p=o?this.store.put(u,e):this.store.add(u,e),p.onerror=fr(a),p.onsuccess=function(d){a(null,!0)}}catch(d){a(ur(d))}},t.prototype.del=function(e,i){try{var o=this.store.delete(e);o.onerror=fr(i),o.onsuccess=function(a){i()}}catch(a){i(ur(a))}},t.prototype.commit=function(e){setTimeout(e,0)},t.prototype.abort=function(e){var i=null;try{this.tx.abort()}catch(o){i=ur(o)}finally{e(i)}},t}(qr),tr=function(t,r){this.db=t,this.storeName=r};tr.Create=function(t,r){var e=Yr.open(t,1);e.onupgradeneeded=function(i){var o=i.target.result;o.objectStoreNames.contains(t)&&o.deleteObjectStore(t),o.createObjectStore(t)},e.onsuccess=function(i){r(null,new tr(i.target.result,t))},e.onerror=fr(r,f.EACCES)},tr.prototype.name=function(){return cr.Name+" - "+this.storeName},tr.prototype.clear=function(t){try{var r=this.db.transaction(this.storeName,"readwrite"),e=r.objectStore(this.storeName),i=e.clear();i.onsuccess=function(o){setTimeout(t,0)},i.onerror=fr(t)}catch(o){t(ur(o))}},tr.prototype.beginTransaction=function(t){t===void 0&&(t="readonly");var r=this.db.transaction(this.storeName,t),e=r.objectStore(this.storeName);if(t==="readwrite")return new La(r,e);if(t==="readonly")return new qr(r,e);throw new s(f.EINVAL,"Invalid transaction type.")};var cr=function(n){function t(r){n.call(this),this.store=r}return n&&(t.__proto__=n),t.prototype=Object.create(n&&n.prototype),t.prototype.constructor=t,t.Create=function(e,i){tr.Create(e.storeName?e.storeName:"browserfs",function(o,a){a?i(null,new t(a)):i(o)})},t.isAvailable=function(){try{return typeof Yr<"u"&&Yr.open("__browserfs_test__")!==null}catch{return!1}},t}(Ta);cr.Name="IndexedDB",cr.Options={storeName:{type:"string",optional:!0,description:"The name of this file system. You can have multiple IndexedDB file systems operating at once, but each must have a different name."}};var Xr=!1,lr;try{c.localStorage.setItem("__test__",String.fromCharCode(55296)),Xr=c.localStorage.getItem("__test__")===String.fromCharCode(55296)}catch{Xr=!1}lr=Xr?"binary_string":"binary_string_ie",S.isEncoding(lr)||(lr="base64");var Be=function(){};Be.prototype.name=function(){return hr.Name},Be.prototype.clear=function(){c.localStorage.clear()},Be.prototype.beginTransaction=function(t){return new ke(this)},Be.prototype.get=function(t){try{var r=c.localStorage.getItem(t);if(r!==null)return S.from(r,lr)}catch{}},Be.prototype.put=function(t,r,e){try{return!e&&c.localStorage.getItem(t)!==null?!1:(c.localStorage.setItem(t,r.toString(lr)),!0)}catch{throw new s(f.ENOSPC,"LocalStorage is full.")}},Be.prototype.del=function(t){try{c.localStorage.removeItem(t)}catch(r){throw new s(f.EIO,"Unable to delete key "+t+": "+r)}};var hr=function(n){function t(){n.call(this,{store:new Be})}return n&&(t.__proto__=n),t.prototype=Object.create(n&&n.prototype),t.prototype.constructor=t,t.Create=function(e,i){i(null,new t)},t.isAvailable=function(){return typeof c.localStorage<"u"},t}(Cn);hr.Name="LocalStorage",hr.Options={};var er=function(n){function t(r){n.call(this),this.mountList=[],this.mntMap={},this.rootFs=r}return n&&(t.__proto__=n),t.prototype=Object.create(n&&n.prototype),t.prototype.constructor=t,t.Create=function(e,i){$e.Create({},function(o,a){if(a){var u=new t(a);try{Object.keys(e).forEach(function(p){u.mount(p,e[p])})}catch(p){return i(p)}i(null,u)}else i(o)})},t.isAvailable=function(){return!0},t.prototype.mount=function(e,i){if(e[0]!=="/"&&(e="/"+e),e=h.resolve(e),this.mntMap[e])throw new s(f.EINVAL,"Mount point "+e+" is already taken.");Zt(e,511,this.rootFs),this.mntMap[e]=i,this.mountList.push(e),this.mountList=this.mountList.sort(function(o,a){return a.length-o.length})},t.prototype.umount=function(e){var i=this;if(e[0]!=="/"&&(e="/"+e),e=h.resolve(e),!this.mntMap[e])throw new s(f.EINVAL,"Mount point "+e+" is already unmounted.");for(delete this.mntMap[e],this.mountList.splice(this.mountList.indexOf(e),1);e!=="/"&&i.rootFs.readdirSync(e).length===0;)i.rootFs.rmdirSync(e),e=h.dirname(e)},t.prototype._getFs=function(e){for(var i=this,o=this.mountList,a=o.length,u=0;u<a;u++){var p=o[u];if(p.length<=e.length&&e.indexOf(p)===0)return e=e.substr(p.length>1?p.length:0),e===""&&(e="/"),{fs:i.mntMap[p],path:e}}return{fs:this.rootFs,path:e}},t.prototype.getName=function(){return t.Name},t.prototype.diskSpace=function(e,i){i(0,0)},t.prototype.isReadOnly=function(){return!1},t.prototype.supportsLinks=function(){return!1},t.prototype.supportsProps=function(){return!1},t.prototype.supportsSynch=function(){return!0},t.prototype.standardizeError=function(e,i,o){var a=e.message.indexOf(i);return a!==-1&&(e.message=e.message.substr(0,a)+o+e.message.substr(a+i.length),e.path=o),e},t.prototype.rename=function(e,i,o){var a=this,u=this._getFs(e),p=this._getFs(i);return u.fs===p.fs?u.fs.rename(u.path,p.path,function(d){d&&a.standardizeError(a.standardizeError(d,u.path,e),p.path,i),o(d)}):$.readFile(e,function(d,F){if(d)return o(d);$.writeFile(i,F,function(D){if(D)return o(D);$.unlink(e,o)})})},t.prototype.renameSync=function(e,i){var o=this._getFs(e),a=this._getFs(i);if(o.fs===a.fs)try{return o.fs.renameSync(o.path,a.path)}catch(p){throw this.standardizeError(this.standardizeError(p,o.path,e),a.path,i),p}var u=$.readFileSync(e);return $.writeFileSync(i,u),$.unlinkSync(e)},t.prototype.readdirSync=function(e){var i=this._getFs(e),o=null;if(i.fs!==this.rootFs)try{o=this.rootFs.readdirSync(e)}catch{}try{var a=i.fs.readdirSync(i.path);return o===null?a:a.concat(o.filter(function(u){return a.indexOf(u)===-1}))}catch(u){if(o===null)throw this.standardizeError(u,i.path,e);return o}},t.prototype.readdir=function(e,i){var o=this,a=this._getFs(e);a.fs.readdir(a.path,function(u,p){if(a.fs!==o.rootFs)try{var d=o.rootFs.readdirSync(e);p?p=p.concat(d.filter(function(F){return p.indexOf(F)===-1})):p=d}catch{if(u)return i(o.standardizeError(u,a.path,e))}else if(u)return i(o.standardizeError(u,a.path,e));i(null,p)})},t.prototype.rmdirSync=function(e){var i=this._getFs(e);if(this._containsMountPt(e))throw s.ENOTEMPTY(e);try{i.fs.rmdirSync(i.path)}catch(o){throw this.standardizeError(o,i.path,e)}},t.prototype.rmdir=function(e,i){var o=this,a=this._getFs(e);this._containsMountPt(e)?i(s.ENOTEMPTY(e)):a.fs.rmdir(a.path,function(u){i(u?o.standardizeError(u,a.path,e):null)})},t.prototype._containsMountPt=function(e){for(var i=this.mountList,o=i.length,a=0;a<o;a++){var u=i[a];if(u.length>=e.length&&u.slice(0,e.length)===e)return!0}return!1},t}(ut);er.Name="MountableFileSystem",er.Options={};function Un(n,t,r){return t?function(){for(var e=[],i=arguments.length;i--;)e[i]=arguments[i];var o=e[0],a=this._getFs(o);e[0]=a.path;try{return a.fs[n].apply(a.fs,e)}catch(u){throw this.standardizeError(u,a.path,o),u}}:function(){for(var e=this,i=[],o=arguments.length;o--;)i[o]=arguments[o];var a=i[0],u=this._getFs(a);if(i[0]=u.path,typeof i[i.length-1]=="function"){var p=i[i.length-1];i[i.length-1]=function(){for(var d=[],F=arguments.length;F--;)d[F]=arguments[F];d.length>0&&d[0]instanceof s&&e.standardizeError(d[0],u.path,a),p.apply(null,d)}}return u.fs[n].apply(u.fs,i)}}for(var Pn=[["exists","unlink","readlink"],["stat","mkdir","realpath","truncate"],["open","readFile","chmod","utimes"],["chown"],["writeFile","appendFile"]],pr=0;pr<Pn.length;pr++)for(var Na=Pn[pr],Gr=0,Bn=Na;Gr<Bn.length;Gr+=1){var Or=Bn[Gr];er.prototype[Or]=Un(Or,!1,pr+1),er.prototype[Or+"Sync"]=Un(Or+"Sync",!0,pr+1)}var dr=function(){this._locked=!1,this._waiters=[]};dr.prototype.lock=function(t){if(this._locked){this._waiters.push(t);return}this._locked=!0,t()},dr.prototype.unlock=function(){if(!this._locked)throw new Error("unlock of a non-locked mutex");var t=this._waiters.shift();if(t){Ut(t);return}this._locked=!1},dr.prototype.tryLock=function(){return this._locked?!1:(this._locked=!0,!0)},dr.prototype.isLocked=function(){return this._locked};var dt=function(t){this._fs=t,this._mu=new dr};dt.prototype.getName=function(){return"LockedFS<"+this._fs.getName()+">"},dt.prototype.getFSUnlocked=function(){return this._fs},dt.prototype.diskSpace=function(t,r){this._fs.diskSpace(t,r)},dt.prototype.isReadOnly=function(){return this._fs.isReadOnly()},dt.prototype.supportsLinks=function(){return this._fs.supportsLinks()},dt.prototype.supportsProps=function(){return this._fs.supportsProps()},dt.prototype.supportsSynch=function(){return this._fs.supportsSynch()},dt.prototype.rename=function(t,r,e){var i=this;this._mu.lock(function(){i._fs.rename(t,r,function(o){i._mu.unlock(),e(o)})})},dt.prototype.renameSync=function(t,r){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.renameSync(t,r)},dt.prototype.stat=function(t,r,e){var i=this;this._mu.lock(function(){i._fs.stat(t,r,function(o,a){i._mu.unlock(),e(o,a)})})},dt.prototype.statSync=function(t,r){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.statSync(t,r)},dt.prototype.open=function(t,r,e,i){var o=this;this._mu.lock(function(){o._fs.open(t,r,e,function(a,u){o._mu.unlock(),i(a,u)})})},dt.prototype.openSync=function(t,r,e){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.openSync(t,r,e)},dt.prototype.unlink=function(t,r){var e=this;this._mu.lock(function(){e._fs.unlink(t,function(i){e._mu.unlock(),r(i)})})},dt.prototype.unlinkSync=function(t){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.unlinkSync(t)},dt.prototype.rmdir=function(t,r){var e=this;this._mu.lock(function(){e._fs.rmdir(t,function(i){e._mu.unlock(),r(i)})})},dt.prototype.rmdirSync=function(t){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.rmdirSync(t)},dt.prototype.mkdir=function(t,r,e){var i=this;this._mu.lock(function(){i._fs.mkdir(t,r,function(o){i._mu.unlock(),e(o)})})},dt.prototype.mkdirSync=function(t,r){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.mkdirSync(t,r)},dt.prototype.readdir=function(t,r){var e=this;this._mu.lock(function(){e._fs.readdir(t,function(i,o){e._mu.unlock(),r(i,o)})})},dt.prototype.readdirSync=function(t){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.readdirSync(t)},dt.prototype.exists=function(t,r){var e=this;this._mu.lock(function(){e._fs.exists(t,function(i){e._mu.unlock(),r(i)})})},dt.prototype.existsSync=function(t){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.existsSync(t)},dt.prototype.realpath=function(t,r,e){var i=this;this._mu.lock(function(){i._fs.realpath(t,r,function(o,a){i._mu.unlock(),e(o,a)})})},dt.prototype.realpathSync=function(t,r){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.realpathSync(t,r)},dt.prototype.truncate=function(t,r,e){var i=this;this._mu.lock(function(){i._fs.truncate(t,r,function(o){i._mu.unlock(),e(o)})})},dt.prototype.truncateSync=function(t,r){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.truncateSync(t,r)},dt.prototype.readFile=function(t,r,e,i){var o=this;this._mu.lock(function(){o._fs.readFile(t,r,e,function(a,u){o._mu.unlock(),i(a,u)})})},dt.prototype.readFileSync=function(t,r,e){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.readFileSync(t,r,e)},dt.prototype.writeFile=function(t,r,e,i,o,a){var u=this;this._mu.lock(function(){u._fs.writeFile(t,r,e,i,o,function(p){u._mu.unlock(),a(p)})})},dt.prototype.writeFileSync=function(t,r,e,i,o){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.writeFileSync(t,r,e,i,o)},dt.prototype.appendFile=function(t,r,e,i,o,a){var u=this;this._mu.lock(function(){u._fs.appendFile(t,r,e,i,o,function(p){u._mu.unlock(),a(p)})})},dt.prototype.appendFileSync=function(t,r,e,i,o){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.appendFileSync(t,r,e,i,o)},dt.prototype.chmod=function(t,r,e,i){var o=this;this._mu.lock(function(){o._fs.chmod(t,r,e,function(a){o._mu.unlock(),i(a)})})},dt.prototype.chmodSync=function(t,r,e){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.chmodSync(t,r,e)},dt.prototype.chown=function(t,r,e,i,o){var a=this;this._mu.lock(function(){a._fs.chown(t,r,e,i,function(u){a._mu.unlock(),o(u)})})},dt.prototype.chownSync=function(t,r,e,i){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.chownSync(t,r,e,i)},dt.prototype.utimes=function(t,r,e,i){var o=this;this._mu.lock(function(){o._fs.utimes(t,r,e,function(a){o._mu.unlock(),i(a)})})},dt.prototype.utimesSync=function(t,r,e){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.utimesSync(t,r,e)},dt.prototype.link=function(t,r,e){var i=this;this._mu.lock(function(){i._fs.link(t,r,function(o){i._mu.unlock(),e(o)})})},dt.prototype.linkSync=function(t,r){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.linkSync(t,r)},dt.prototype.symlink=function(t,r,e,i){var o=this;this._mu.lock(function(){o._fs.symlink(t,r,e,function(a){o._mu.unlock(),i(a)})})},dt.prototype.symlinkSync=function(t,r,e){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.symlinkSync(t,r,e)},dt.prototype.readlink=function(t,r){var e=this;this._mu.lock(function(){e._fs.readlink(t,function(i,o){e._mu.unlock(),r(i,o)})})},dt.prototype.readlinkSync=function(t){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.readlinkSync(t)};var Oe="/.deletedFiles.log";function jn(n){return 146|n}function ye(n){return N.getFileFlag(n)}var zn=function(n){function t(r,e,i,o,a){n.call(this,r,e,i,o,a)}return n&&(t.__proto__=n),t.prototype=Object.create(n&&n.prototype),t.prototype.constructor=t,t.prototype.sync=function(e){var i=this;if(!this.isDirty()){e(null);return}this._fs._syncAsync(this,function(o){i.resetDirty(),e(o)})},t.prototype.syncSync=function(){this.isDirty()&&(this._fs._syncSync(this),this.resetDirty())},t.prototype.close=function(e){this.sync(e)},t.prototype.closeSync=function(){this.syncSync()},t}(X),Wn=function(n){function t(r,e){if(n.call(this),this._isInitialized=!1,this._initializeCallbacks=[],this._deletedFiles={},this._deleteLog="",this._deleteLogUpdatePending=!1,this._deleteLogUpdateNeeded=!1,this._deleteLogError=null,this._writable=r,this._readable=e,this._writable.isReadOnly())throw new s(f.EINVAL,"Writable file system must be writable.")}return n&&(t.__proto__=n),t.prototype=Object.create(n&&n.prototype),t.prototype.constructor=t,t.isAvailable=function(){return!0},t.prototype.getOverlayedFileSystems=function(){return{readable:this._readable,writable:this._writable}},t.prototype._syncAsync=function(e,i){var o=this;this.createParentDirectoriesAsync(e.getPath(),function(a){if(a)return i(a);o._writable.writeFile(e.getPath(),e.getBuffer(),null,ye("w"),e.getStats().mode,i)})},t.prototype._syncSync=function(e){this.createParentDirectories(e.getPath()),this._writable.writeFileSync(e.getPath(),e.getBuffer(),null,ye("w"),e.getStats().mode)},t.prototype.getName=function(){return yr.Name},t.prototype._initialize=function(e){var i=this,o=this._initializeCallbacks,a=function(u){i._isInitialized=!u,i._initializeCallbacks=[],o.forEach(function(p){return p(u)})};if(this._isInitialized)return e();o.push(e),o.length===1&&this._writable.readFile(Oe,"utf8",ye("r"),function(u,p){if(u){if(u.errno!==f.ENOENT)return a(u)}else i._deleteLog=p;i._reparseDeletionLog(),a()})},t.prototype.isReadOnly=function(){return!1},t.prototype.supportsSynch=function(){return this._readable.supportsSynch()&&this._writable.supportsSynch()},t.prototype.supportsLinks=function(){return!1},t.prototype.supportsProps=function(){return this._readable.supportsProps()&&this._writable.supportsProps()},t.prototype.getDeletionLog=function(){return this._deleteLog},t.prototype.restoreDeletionLog=function(e){this._deleteLog=e,this._reparseDeletionLog(),this.updateLog("")},t.prototype.rename=function(e,i,o){var a=this;if(!(!this.checkInitAsync(o)||this.checkPathAsync(e,o)||this.checkPathAsync(i,o))){if(e===Oe||i===Oe)return o(s.EPERM("Cannot rename deletion log."));if(e===i)return o();this.stat(e,!1,function(u,p){return u?o(u):a.stat(i,!1,function(d,F){var D=a;function W(nt){var ft=nt.shift();if(!ft)return o();var yt=h.resolve(e,ft),Et=h.resolve(i,ft);D.rename(yt,Et,function(Kt){if(Kt)return o(Kt);W(nt)})}var tt=511;if(p.isDirectory()){if(d)return d.errno!==f.ENOENT?o(d):a._writable.exists(e,function(nt){if(nt)return a._writable.rename(e,i,o);a._writable.mkdir(i,tt,function(ft){if(ft)return o(ft);a._readable.readdir(e,function(yt,Et){if(yt)return o();W(Et)})})});if(tt=F.mode,!F.isDirectory())return o(s.ENOTDIR(i));a.readdir(i,function(nt,ft){if(ft&&ft.length)return o(s.ENOTEMPTY(i));a._readable.readdir(e,function(yt,Et){if(yt)return o();W(Et)})})}if(F&&F.isDirectory())return o(s.EISDIR(i));a.readFile(e,null,ye("r"),function(nt,ft){return nt?o(nt):a.writeFile(i,ft,null,ye("w"),p.mode,function(yt){return yt?o(yt):a.unlink(e,o)})})})})}},t.prototype.renameSync=function(e,i){var o=this;if(this.checkInitialized(),this.checkPath(e),this.checkPath(i),e===Oe||i===Oe)throw s.EPERM("Cannot rename deletion log.");var a=this.statSync(e,!1);if(a.isDirectory()){if(e===i)return;var u=511;if(this.existsSync(i)){var p=this.statSync(i,!1);if(u=p.mode,p.isDirectory()){if(this.readdirSync(i).length>0)throw s.ENOTEMPTY(i)}else throw s.ENOTDIR(i)}this._writable.existsSync(e)?this._writable.renameSync(e,i):this._writable.existsSync(i)||this._writable.mkdirSync(i,u),this._readable.existsSync(e)&&this._readable.readdirSync(e).forEach(function(d){o.renameSync(h.resolve(e,d),h.resolve(i,d))})}else{if(this.existsSync(i)&&this.statSync(i,!1).isDirectory())throw s.EISDIR(i);this.writeFileSync(i,this.readFileSync(e,null,ye("r")),null,ye("w"),a.mode)}e!==i&&this.existsSync(e)&&this.unlinkSync(e)},t.prototype.stat=function(e,i,o){var a=this;this.checkInitAsync(o)&&this._writable.stat(e,i,function(u,p){u&&u.errno===f.ENOENT?(a._deletedFiles[e]&&o(s.ENOENT(e)),a._readable.stat(e,i,function(d,F){F&&(F=M.clone(F),F.mode=jn(F.mode)),o(d,F)})):o(u,p)})},t.prototype.statSync=function(e,i){this.checkInitialized();try{return this._writable.statSync(e,i)}catch{if(this._deletedFiles[e])throw s.ENOENT(e);var o=M.clone(this._readable.statSync(e,i));return o.mode=jn(o.mode),o}},t.prototype.open=function(e,i,o,a){var u=this;!this.checkInitAsync(a)||this.checkPathAsync(e,a)||this.stat(e,!1,function(p,d){if(d)switch(i.pathExistsAction()){case T.TRUNCATE_FILE:return u.createParentDirectoriesAsync(e,function(F){if(F)return a(F);u._writable.open(e,i,o,a)});case T.NOP:return u._writable.exists(e,function(F){F?u._writable.open(e,i,o,a):(d=M.clone(d),d.mode=o,u._readable.readFile(e,null,ye("r"),function(D,W){if(D)return a(D);d.size===-1&&(d.size=W.length);var tt=new zn(u,e,i,d,W);a(null,tt)}))});default:return a(s.EEXIST(e))}else switch(i.pathNotExistsAction()){case T.CREATE_FILE:return u.createParentDirectoriesAsync(e,function(F){return F?a(F):u._writable.open(e,i,o,a)});default:return a(s.ENOENT(e))}})},t.prototype.openSync=function(e,i,o){if(this.checkInitialized(),this.checkPath(e),e===Oe)throw s.EPERM("Cannot open deletion log.");if(this.existsSync(e))switch(i.pathExistsAction()){case T.TRUNCATE_FILE:return this.createParentDirectories(e),this._writable.openSync(e,i,o);case T.NOP:if(this._writable.existsSync(e))return this._writable.openSync(e,i,o);var a=this._readable.readFileSync(e,null,ye("r")),u=M.clone(this._readable.statSync(e,!1));return u.mode=o,new zn(this,e,i,u,a);default:throw s.EEXIST(e)}else switch(i.pathNotExistsAction()){case T.CREATE_FILE:return this.createParentDirectories(e),this._writable.openSync(e,i,o);default:throw s.ENOENT(e)}},t.prototype.unlink=function(e,i){var o=this;!this.checkInitAsync(i)||this.checkPathAsync(e,i)||this.exists(e,function(a){if(!a)return i(s.ENOENT(e));o._writable.exists(e,function(u){if(u)return o._writable.unlink(e,function(p){if(p)return i(p);o.exists(e,function(d){d&&o.deletePath(e),i(null)})});o.deletePath(e),i(null)})})},t.prototype.unlinkSync=function(e){if(this.checkInitialized(),this.checkPath(e),this.existsSync(e))this._writable.existsSync(e)&&this._writable.unlinkSync(e),this.existsSync(e)&&this.deletePath(e);else throw s.ENOENT(e)},t.prototype.rmdir=function(e,i){var o=this;if(this.checkInitAsync(i)){var a=function(){o.readdir(e,function(u,p){if(u)return i(u);if(p.length)return i(s.ENOTEMPTY(e));o.deletePath(e),i(null)})};this.exists(e,function(u){if(!u)return i(s.ENOENT(e));o._writable.exists(e,function(p){p?o._writable.rmdir(e,function(d){if(d)return i(d);o._readable.exists(e,function(F){F?a():i()})}):a()})})}},t.prototype.rmdirSync=function(e){if(this.checkInitialized(),this.existsSync(e)){if(this._writable.existsSync(e)&&this._writable.rmdirSync(e),this.existsSync(e)){if(this.readdirSync(e).length>0)throw s.ENOTEMPTY(e);this.deletePath(e)}}else throw s.ENOENT(e)},t.prototype.mkdir=function(e,i,o){var a=this;this.checkInitAsync(o)&&this.exists(e,function(u){if(u)return o(s.EEXIST(e));a.createParentDirectoriesAsync(e,function(p){if(p)return o(p);a._writable.mkdir(e,i,o)})})},t.prototype.mkdirSync=function(e,i){if(this.checkInitialized(),this.existsSync(e))throw s.EEXIST(e);this.createParentDirectories(e),this._writable.mkdirSync(e,i)},t.prototype.readdir=function(e,i){var o=this;this.checkInitAsync(i)&&this.stat(e,!1,function(a,u){if(a)return i(a);if(!u.isDirectory())return i(s.ENOTDIR(e));o._writable.readdir(e,function(p,d){if(p&&p.code!=="ENOENT")return i(p);(p||!d)&&(d=[]),o._readable.readdir(e,function(F,D){(F||!D)&&(D=[]);var W={},tt=d.concat(D.filter(function(nt){return!o._deletedFiles[e+"/"+nt]})).filter(function(nt){var ft=!W[nt];return W[nt]=!0,ft});i(null,tt)})})})},t.prototype.readdirSync=function(e){var i=this;this.checkInitialized();var o=this.statSync(e,!1);if(!o.isDirectory())throw s.ENOTDIR(e);var a=[];try{a=a.concat(this._writable.readdirSync(e))}catch{}try{a=a.concat(this._readable.readdirSync(e).filter(function(p){return!i._deletedFiles[e+"/"+p]}))}catch{}var u={};return a.filter(function(p){var d=!u[p];return u[p]=!0,d})},t.prototype.exists=function(e,i){var o=this;this.checkInitialized(),this._writable.exists(e,function(a){if(a)return i(!0);o._readable.exists(e,function(u){i(u&&o._deletedFiles[e]!==!0)})})},t.prototype.existsSync=function(e){return this.checkInitialized(),this._writable.existsSync(e)||this._readable.existsSync(e)&&this._deletedFiles[e]!==!0},t.prototype.chmod=function(e,i,o,a){var u=this;this.checkInitAsync(a)&&this.operateOnWritableAsync(e,function(p){if(p)return a(p);u._writable.chmod(e,i,o,a)})},t.prototype.chmodSync=function(e,i,o){var a=this;this.checkInitialized(),this.operateOnWritable(e,function(){a._writable.chmodSync(e,i,o)})},t.prototype.chown=function(e,i,o,a,u){var p=this;this.checkInitAsync(u)&&this.operateOnWritableAsync(e,function(d){if(d)return u(d);p._writable.chown(e,i,o,a,u)})},t.prototype.chownSync=function(e,i,o,a){var u=this;this.checkInitialized(),this.operateOnWritable(e,function(){u._writable.chownSync(e,i,o,a)})},t.prototype.utimes=function(e,i,o,a){var u=this;this.checkInitAsync(a)&&this.operateOnWritableAsync(e,function(p){if(p)return a(p);u._writable.utimes(e,i,o,a)})},t.prototype.utimesSync=function(e,i,o){var a=this;this.checkInitialized(),this.operateOnWritable(e,function(){a._writable.utimesSync(e,i,o)})},t.prototype.deletePath=function(e){this._deletedFiles[e]=!0,this.updateLog("d"+e+`
`)},t.prototype.updateLog=function(e){var i=this;this._deleteLog+=e,this._deleteLogUpdatePending?this._deleteLogUpdateNeeded=!0:(this._deleteLogUpdatePending=!0,this._writable.writeFile(Oe,this._deleteLog,"utf8",N.getFileFlag("w"),420,function(o){i._deleteLogUpdatePending=!1,o?i._deleteLogError=o:i._deleteLogUpdateNeeded&&(i._deleteLogUpdateNeeded=!1,i.updateLog(""))}))},t.prototype._reparseDeletionLog=function(){var e=this;this._deletedFiles={},this._deleteLog.split(`
`).forEach(function(i){e._deletedFiles[i.slice(1)]=i.slice(0,1)==="d"})},t.prototype.checkInitialized=function(){if(this._isInitialized){if(this._deleteLogError!==null){var e=this._deleteLogError;throw this._deleteLogError=null,e}}else throw new s(f.EPERM,"OverlayFS is not initialized. Please initialize OverlayFS using its initialize() method before using it.")},t.prototype.checkInitAsync=function(e){if(this._isInitialized){if(this._deleteLogError!==null){var i=this._deleteLogError;return this._deleteLogError=null,e(i),!1}}else return e(new s(f.EPERM,"OverlayFS is not initialized. Please initialize OverlayFS using its initialize() method before using it.")),!1;return!0},t.prototype.checkPath=function(e){if(e===Oe)throw s.EPERM(e)},t.prototype.checkPathAsync=function(e,i){return e===Oe?(i(s.EPERM(e)),!0):!1},t.prototype.createParentDirectoriesAsync=function(e,i){var o=h.dirname(e),a=[],u=this;this._writable.stat(o,!1,p);function p(F,D){F?(a.push(o),o=h.dirname(o),u._writable.stat(o,!1,p)):d()}function d(){if(!a.length)return i();var F=a.pop();u._readable.stat(F,!1,function(D,W){if(!W)return i();u._writable.mkdir(F,W.mode,function(tt){if(tt)return i(tt);d()})})}},t.prototype.createParentDirectories=function(e){for(var i=this,o=h.dirname(e),a=[];!this._writable.existsSync(o);)a.push(o),o=h.dirname(o);a=a.reverse(),a.forEach(function(u){i._writable.mkdirSync(u,i.statSync(u,!1).mode)})},t.prototype.operateOnWritable=function(e,i){if(this.existsSync(e))this._writable.existsSync(e)||this.copyToWritable(e),i();else throw s.ENOENT(e)},t.prototype.operateOnWritableAsync=function(e,i){var o=this;this.exists(e,function(a){if(!a)return i(s.ENOENT(e));o._writable.exists(e,function(u){if(u)i();else return o.copyToWritableAsync(e,i)})})},t.prototype.copyToWritable=function(e){var i=this.statSync(e,!1);i.isDirectory()?this._writable.mkdirSync(e,i.mode):this.writeFileSync(e,this._readable.readFileSync(e,null,ye("r")),null,ye("w"),this.statSync(e,!1).mode)},t.prototype.copyToWritableAsync=function(e,i){var o=this;this.stat(e,!1,function(a,u){if(a)return i(a);if(u.isDirectory())return o._writable.mkdir(e,u.mode,i);o._readable.readFile(e,null,ye("r"),function(p,d){if(p)return i(p);o.writeFile(e,d,null,ye("w"),u.mode,i)})})},t}(ut),yr=function(n){function t(r,e){n.call(this,new Wn(r,e))}return n&&(t.__proto__=n),t.prototype=Object.create(n&&n.prototype),t.prototype.constructor=t,t.Create=function(e,i){try{var o=new t(e.writable,e.readable);o._initialize(function(a){i(a,o)})}catch(a){i(a)}},t.isAvailable=function(){return Wn.isAvailable()},t.prototype.getOverlayedFileSystems=function(){return n.prototype.getFSUnlocked.call(this).getOverlayedFileSystems()},t.prototype.unwrap=function(){return n.prototype.getFSUnlocked.call(this)},t.prototype._initialize=function(e){n.prototype.getFSUnlocked.call(this)._initialize(e)},t}(dt);yr.Name="OverlayFS",yr.Options={writable:{type:"object",description:"The file system to write modified files to."},readable:{type:"object",description:"The file system that initially populates this file system."}};var Vt;(function(n){n[n.CB=0]="CB",n[n.FD=1]="FD",n[n.API_ERROR=2]="API_ERROR",n[n.STATS=3]="STATS",n[n.PROBE=4]="PROBE",n[n.FILEFLAG=5]="FILEFLAG",n[n.BUFFER=6]="BUFFER",n[n.ERROR=7]="ERROR"})(Vt||(Vt={}));var Jr=function(){this._callbacks={},this._nextId=0};Jr.prototype.toRemoteArg=function(t){var r=this._nextId++;return this._callbacks[r]=t,{type:Vt.CB,id:r}},Jr.prototype.toLocalArg=function(t){var r=this._callbacks[t];return delete this._callbacks[t],r};var Rr=function(){this._fileDescriptors={},this._nextId=0};Rr.prototype.toRemoteArg=function(t,r,e,i){var o=this._nextId++,a,u;this._fileDescriptors[o]=t,t.stat(function(p,d){p?i(p):(u=je(d.toBuffer()),e.isReadable()?t.read(S.alloc(d.size),0,d.size,0,function(F,D,W){F?i(F):(a=je(W),i(null,{type:Vt.FD,id:o,data:a,stat:u,path:r,flag:e.getFlagString()}))}):i(null,{type:Vt.FD,id:o,data:new ArrayBuffer(0),stat:u,path:r,flag:e.getFlagString()}))})},Rr.prototype.applyFdAPIRequest=function(t,r){var e=this,i=t.args[0];this._applyFdChanges(i,function(o,a){o?r(o):a[t.method](function(u){t.method==="close"&&delete e._fileDescriptors[i.id],r(u)})})},Rr.prototype._applyFdChanges=function(t,r){var e=this._fileDescriptors[t.id],i=ze(t.data),o=M.fromBuffer(ze(t.stat)),a=N.getFileFlag(t.flag);a.isWriteable()?e.write(i,0,i.length,a.isAppendable()?e.getPos():0,function(u){function p(){e.stat(function(d,F){d?r(d):F.mode!==o.mode?e.chmod(o.mode,function(D){r(D,e)}):r(d,e)})}u?r(u):a.isAppendable()?p():e.truncate(i.length,function(){p()})}):r(null,e)};function Tr(n){return{type:Vt.API_ERROR,errorData:je(n.writeToBuffer())}}function Hn(n){return s.fromBuffer(ze(n.errorData))}function Vn(n){return{type:Vt.ERROR,name:n.name,message:n.message,stack:n.stack}}function Zn(n){var t=c[n.name];typeof t!="function"&&(t=Error);var r=new t(n.message);return r.stack=n.stack,r}function Yn(n){return{type:Vt.STATS,statsData:je(n.toBuffer())}}function qn(n){return M.fromBuffer(ze(n.statsData))}function Xn(n){return{type:Vt.FILEFLAG,flagStr:n.getFlagString()}}function Gn(n){return N.getFileFlag(n.flagStr)}function je(n){return qt(n)}function ze(n){return A(n)}function Jn(n){return{type:Vt.BUFFER,data:je(n)}}function Kn(n){return ze(n.data)}function Da(n){return n&&typeof n=="object"&&n.hasOwnProperty("browserfsMessage")&&n.browserfsMessage}function Aa(n){return n&&typeof n=="object"&&n.hasOwnProperty("browserfsMessage")&&n.browserfsMessage}var Qn=function(n){function t(r,e,i,o,a,u){n.call(this,r,e,i,o,u),this._remoteFdId=a}return n&&(t.__proto__=n),t.prototype=Object.create(n&&n.prototype),t.prototype.constructor=t,t.prototype.getRemoteFdId=function(){return this._remoteFdId},t.prototype.toRemoteArg=function(){return{type:Vt.FD,id:this._remoteFdId,data:je(this.getBuffer()),stat:je(this.getStats().toBuffer()),path:this.getPath(),flag:this.getFlag().getFlagString()}},t.prototype.sync=function(e){this._syncClose("sync",e)},t.prototype.close=function(e){this._syncClose("close",e)},t.prototype._syncClose=function(e,i){var o=this;this.isDirty()?this._fs.syncClose(e,this,function(a){a||o.resetDirty(),i(a)}):i()},t}(X),Lr=function(n){function t(r){var e=this;n.call(this),this._callbackConverter=new Jr,this._isInitialized=!1,this._isReadOnly=!1,this._supportLinks=!1,this._supportProps=!1,this._worker=r,this._worker.addEventListener("message",function(i){var o=i.data;if(Aa(o)){var a,u=o.args,p=new Array(u.length);for(a=0;a<p.length;a++)p[a]=e._argRemote2Local(u[a]);e._callbackConverter.toLocalArg(o.cbId).apply(null,p)}})}return n&&(t.__proto__=n),t.prototype=Object.create(n&&n.prototype),t.prototype.constructor=t,t.Create=function(e,i){var o=new t(e.worker);o._initialize(function(){i(null,o)})},t.isAvailable=function(){return typeof importScripts<"u"||typeof Worker<"u"},t.attachRemoteListener=function(e){var i=new Rr;function o(u,p,d){switch(typeof u){case"object":u instanceof M?d(null,Yn(u)):u instanceof s?d(null,Tr(u)):u instanceof m?d(null,i.toRemoteArg(u,p[0],p[1],d)):u instanceof N?d(null,Xn(u)):u instanceof S?d(null,Jn(u)):u instanceof Error?d(null,Vn(u)):d(null,u);break;default:d(null,u);break}}function a(u,p){if(!u)return u;switch(typeof u){case"object":if(typeof u.type=="number"){var d=u;switch(d.type){case Vt.CB:var F=u.id;return function(){var D=arguments,W,tt=new Array(arguments.length),nt,ft=arguments.length;function yt(Et){ft>0&&(ft=-1,nt={browserfsMessage:!0,cbId:F,args:[Tr(Et)]},e.postMessage(nt))}for(W=0;W<arguments.length;W++)(function(Et,Kt){o(Kt,p,function(re,Ee){tt[Et]=Ee,re?yt(re):--ft===0&&(nt={browserfsMessage:!0,cbId:F,args:tt},e.postMessage(nt))})})(W,D[W]);arguments.length===0&&(nt={browserfsMessage:!0,cbId:F,args:tt},e.postMessage(nt))};case Vt.API_ERROR:return Hn(d);case Vt.STATS:return qn(d);case Vt.FILEFLAG:return Gn(d);case Vt.BUFFER:return Kn(d);case Vt.ERROR:return Zn(d);default:return u}}else return u;default:return u}}e.addEventListener("message",function(u){var p=u.data;if(Da(p)){var d=p.args,F=new Array(d.length);switch(p.method){case"close":case"sync":(function(){var tt=d[1];i.applyFdAPIRequest(p,function(nt){var ft={browserfsMessage:!0,cbId:tt.id,args:nt?[Tr(nt)]:[]};e.postMessage(ft)})})();break;case"probe":(function(){var tt=$.getRootFS(),nt=d[1],ft={type:Vt.PROBE,isReadOnly:tt.isReadOnly(),supportsLinks:tt.supportsLinks(),supportsProps:tt.supportsProps()},yt={browserfsMessage:!0,cbId:nt.id,args:[ft]};e.postMessage(yt)})();break;default:for(var D=0;D<d.length;D++)F[D]=a(d[D],F);var W=$.getRootFS();W[p.method].apply(W,F);break}}})},t.prototype.getName=function(){return t.Name},t.prototype.isReadOnly=function(){return this._isReadOnly},t.prototype.supportsSynch=function(){return!1},t.prototype.supportsLinks=function(){return this._supportLinks},t.prototype.supportsProps=function(){return this._supportProps},t.prototype.rename=function(e,i,o){this._rpc("rename",arguments)},t.prototype.stat=function(e,i,o){this._rpc("stat",arguments)},t.prototype.open=function(e,i,o,a){this._rpc("open",arguments)},t.prototype.unlink=function(e,i){this._rpc("unlink",arguments)},t.prototype.rmdir=function(e,i){this._rpc("rmdir",arguments)},t.prototype.mkdir=function(e,i,o){this._rpc("mkdir",arguments)},t.prototype.readdir=function(e,i){this._rpc("readdir",arguments)},t.prototype.exists=function(e,i){this._rpc("exists",arguments)},t.prototype.realpath=function(e,i,o){this._rpc("realpath",arguments)},t.prototype.truncate=function(e,i,o){this._rpc("truncate",arguments)},t.prototype.readFile=function(e,i,o,a){this._rpc("readFile",arguments)},t.prototype.writeFile=function(e,i,o,a,u,p){this._rpc("writeFile",arguments)},t.prototype.appendFile=function(e,i,o,a,u,p){this._rpc("appendFile",arguments)},t.prototype.chmod=function(e,i,o,a){this._rpc("chmod",arguments)},t.prototype.chown=function(e,i,o,a,u){this._rpc("chown",arguments)},t.prototype.utimes=function(e,i,o,a){this._rpc("utimes",arguments)},t.prototype.link=function(e,i,o){this._rpc("link",arguments)},t.prototype.symlink=function(e,i,o,a){this._rpc("symlink",arguments)},t.prototype.readlink=function(e,i){this._rpc("readlink",arguments)},t.prototype.syncClose=function(e,i,o){this._worker.postMessage({browserfsMessage:!0,method:e,args:[i.toRemoteArg(),this._callbackConverter.toRemoteArg(o)]})},t.prototype._initialize=function(e){var i=this;if(this._isInitialized)e();else{var o={browserfsMessage:!0,method:"probe",args:[this._argLocal2Remote(ot()),this._callbackConverter.toRemoteArg(function(a){i._isInitialized=!0,i._isReadOnly=a.isReadOnly,i._supportLinks=a.supportsLinks,i._supportProps=a.supportsProps,e()})]};this._worker.postMessage(o)}},t.prototype._argRemote2Local=function(e){if(!e)return e;switch(typeof e){case"object":if(typeof e.type=="number"){var i=e;switch(i.type){case Vt.API_ERROR:return Hn(i);case Vt.FD:var o=i;return new Qn(this,o.path,N.getFileFlag(o.flag),M.fromBuffer(ze(o.stat)),o.id,ze(o.data));case Vt.STATS:return qn(i);case Vt.FILEFLAG:return Gn(i);case Vt.BUFFER:return Kn(i);case Vt.ERROR:return Zn(i);default:return e}}else return e;default:return e}},t.prototype._rpc=function(e,i){for(var o=this,a=new Array(i.length),u=0;u<i.length;u++)a[u]=o._argLocal2Remote(i[u]);var p={browserfsMessage:!0,method:e,args:a};this._worker.postMessage(p)},t.prototype._argLocal2Remote=function(e){if(!e)return e;switch(typeof e){case"object":return e instanceof M?Yn(e):e instanceof s?Tr(e):e instanceof Qn?e.toRemoteArg():e instanceof N?Xn(e):e instanceof S?Jn(e):e instanceof Error?Vn(e):"Unknown argument";case"function":return this._callbackConverter.toRemoteArg(e);default:return e}},t}(ut);Lr.Name="WorkerFS",Lr.Options={worker:{type:"object",description:"The target worker that you want to connect to, or the current worker if in a worker context.",validator:function(n,t){n.postMessage?t():t(new s(f.EINVAL,"option must be a Web Worker instance."))}}};var Nr=typeof XMLHttpRequest<"u"&&XMLHttpRequest!==null;function Ca(n,t,r){var e=new XMLHttpRequest;e.open("GET",n,!0);var i=!0;switch(t){case"buffer":e.responseType="arraybuffer";break;case"json":try{e.responseType="json",i=e.responseType==="json"}catch{i=!1}break;default:return r(new s(f.EINVAL,"Invalid download type: "+t))}e.onreadystatechange=function(o){if(e.readyState===4)if(e.status===200)switch(t){case"buffer":return r(null,e.response?S.from(e.response):ot());case"json":return i?r(null,e.response):r(null,JSON.parse(e.responseText))}else return r(new s(f.EIO,"XHR error: response returned code "+e.status))},e.send()}function Ma(n,t){var r=new XMLHttpRequest;r.open("GET",n,!1);var e=null,i=null;if(r.overrideMimeType("text/plain; charset=x-user-defined"),r.onreadystatechange=function(o){if(r.readyState===4)if(r.status===200)switch(t){case"buffer":var a=r.responseText;e=S.alloc(a.length);for(var u=0;u<a.length;u++)e[u]=a.charCodeAt(u);return;case"json":e=JSON.parse(r.responseText);return}else{i=new s(f.EIO,"XHR error: response returned code "+r.status);return}},r.send(),i)throw i;return e}function Ua(n,t){var r=new XMLHttpRequest;switch(r.open("GET",n,!1),t){case"buffer":r.responseType="arraybuffer";break;case"json":break;default:throw new s(f.EINVAL,"Invalid download type: "+t)}var e,i;if(r.onreadystatechange=function(o){if(r.readyState===4)if(r.status===200)switch(t){case"buffer":e=S.from(r.response);break;case"json":e=JSON.parse(r.response);break}else i=new s(f.EIO,"XHR error: response returned code "+r.status)},r.send(),i)throw i;return e}function $n(n,t,r){var e=new XMLHttpRequest;e.open("HEAD",t,n),e.onreadystatechange=function(i){if(e.readyState===4)if(e.status===200)try{return r(null,parseInt(e.getResponseHeader("Content-Length")||"-1",10))}catch{return r(new s(f.EIO,"XHR HEAD error: Could not read content-length."))}else return r(new s(f.EIO,"XHR HEAD error: response returned code "+e.status))},e.send()}var ti=Ca,Pa=Lt&&typeof Blob<"u"?Ua:Ma;function Ba(n){var t=-1;return $n(!1,n,function(r,e){if(r)throw r;t=e}),t}function ja(n,t){$n(!0,n,t)}var ei=typeof fetch<"u"&&fetch!==null;function za(n,t,r){var e;try{e=fetch(n)}catch(i){return r(new s(f.EINVAL,i.message))}e.then(function(i){if(i.ok)switch(t){case"buffer":i.arrayBuffer().then(function(o){return r(null,S.from(o))}).catch(function(o){return r(new s(f.EIO,o.message))});break;case"json":i.json().then(function(o){return r(null,o)}).catch(function(o){return r(new s(f.EIO,o.message))});break;default:r(new s(f.EINVAL,"Invalid download type: "+t))}else return r(new s(f.EIO,"fetch error: response returned code "+i.status))}).catch(function(i){return r(new s(f.EIO,i.message))})}function Wa(n,t){fetch(n,{method:"HEAD"}).then(function(r){return r.ok?t(null,parseInt(r.headers.get("Content-Length")||"-1",10)):t(new s(f.EIO,"fetch HEAD error: response returned code "+r.status))}).catch(function(r){return t(new s(f.EIO,r.message))})}var ge=function(){this._index={},this.addPath("/",new le)};ge.fromListing=function(t){var r=new ge,e=new le;r._index["/"]=e;for(var i=[["",t,e]];i.length>0;){var o=void 0,a=i.pop(),u=a[0],p=a[1],d=a[2];for(var F in p)if(p.hasOwnProperty(F)){var D=p[F],W=u+"/"+F;D?(r._index[W]=o=new le,i.push([W,D,o])):o=new rr(new M(R.FILE,-1,365)),d&&(d._ls[F]=o)}}return r},ge.prototype.fileIterator=function(t){var r=this;for(var e in r._index)if(r._index.hasOwnProperty(e))for(var i=r._index[e],o=i.getListing(),a=0,u=o;a<u.length;a+=1){var p=u[a],d=i.getItem(p);Re(d)&&t(d.getData())}},ge.prototype.addPath=function(t,r){if(!r)throw new Error("Inode must be specified");if(t[0]!=="/")throw new Error("Path must be absolute, got: "+t);if(this._index.hasOwnProperty(t))return this._index[t]===r;var e=this._split_path(t),i=e[0],o=e[1],a=this._index[i];return a===void 0&&t!=="/"&&(a=new le,!this.addPath(i,a))||t!=="/"&&!a.addItem(o,r)?!1:(Me(r)&&(this._index[t]=r),!0)},ge.prototype.addPathFast=function(t,r){var e=t.lastIndexOf("/"),i=e===0?"/":t.substring(0,e),o=t.substring(e+1),a=this._index[i];return a===void 0&&(a=new le,this.addPathFast(i,a)),a.addItem(o,r)?(r.isDir()&&(this._index[t]=r),!0):!1},ge.prototype.removePath=function(t){var r=this,e=this._split_path(t),i=e[0],o=e[1],a=this._index[i];if(a===void 0)return null;var u=a.remItem(o);if(u===null)return null;if(Me(u)){for(var p=u.getListing(),d=0,F=p;d<F.length;d+=1){var D=F[d];r.removePath(t+"/"+D)}t!=="/"&&delete this._index[t]}return u},ge.prototype.ls=function(t){var r=this._index[t];return r===void 0?null:r.getListing()},ge.prototype.getInode=function(t){var r=this._split_path(t),e=r[0],i=r[1],o=this._index[e];return o===void 0?null:e===t?o:o.getItem(i)},ge.prototype._split_path=function(t){var r=h.dirname(t),e=t.substr(r.length+(r==="/"?0:1));return[r,e]};var rr=function(t){this.data=t};rr.prototype.isFile=function(){return!0},rr.prototype.isDir=function(){return!1},rr.prototype.getData=function(){return this.data},rr.prototype.setData=function(t){this.data=t};var le=function(t){t===void 0&&(t=null),this.data=t,this._ls={}};le.prototype.isFile=function(){return!1},le.prototype.isDir=function(){return!0},le.prototype.getData=function(){return this.data},le.prototype.getStats=function(){return new M(R.DIRECTORY,4096,365)},le.prototype.getListing=function(){return Object.keys(this._ls)},le.prototype.getItem=function(t){var r=this._ls[t];return r||null},le.prototype.addItem=function(t,r){return t in this._ls?!1:(this._ls[t]=r,!0)},le.prototype.remItem=function(t){var r=this._ls[t];return r===void 0?null:(delete this._ls[t],r)};function Re(n){return!!n&&n.isFile()}function Me(n){return!!n&&n.isDir()}function Ha(n,t,r){try{r(null,n.toString(t))}catch(e){r(e)}}function ri(){throw new s(f.ENOTSUP,"Synchronous HTTP download methods are not available in this environment.")}var vr=function(n){function t(r,e,i){e===void 0&&(e=""),i===void 0&&(i=!1),n.call(this),e.length>0&&e.charAt(e.length-1)!=="/"&&(e=e+"/"),this.prefixUrl=e,this._index=ge.fromListing(r),ei&&(!i||!Nr)?(this._requestFileAsyncInternal=za,this._requestFileSizeAsyncInternal=Wa):(this._requestFileAsyncInternal=ti,this._requestFileSizeAsyncInternal=ja),Nr?(this._requestFileSyncInternal=Pa,this._requestFileSizeSyncInternal=Ba):(this._requestFileSyncInternal=ri,this._requestFileSizeSyncInternal=ri)}return n&&(t.__proto__=n),t.prototype=Object.create(n&&n.prototype),t.prototype.constructor=t,t.Create=function(e,i){e.index===void 0&&(e.index="index.json"),typeof e.index=="string"?ti(e.index,"json",function(o,a){o?i(o):i(null,new t(a,e.baseUrl))}):i(null,new t(e.index,e.baseUrl))},t.isAvailable=function(){return Nr||ei},t.prototype.empty=function(){this._index.fileIterator(function(e){e.fileData=null})},t.prototype.getName=function(){return t.Name},t.prototype.diskSpace=function(e,i){i(0,0)},t.prototype.isReadOnly=function(){return!0},t.prototype.supportsLinks=function(){return!1},t.prototype.supportsProps=function(){return!1},t.prototype.supportsSynch=function(){return Nr},t.prototype.preloadFile=function(e,i){var o=this._index.getInode(e);if(Re(o)){if(o===null)throw s.ENOENT(e);var a=o.getData();a.size=i.length,a.fileData=i}else throw s.EISDIR(e)},t.prototype.stat=function(e,i,o){var a=this._index.getInode(e);if(a===null)return o(s.ENOENT(e));var u;Re(a)?(u=a.getData(),u.size<0?this._requestFileSizeAsync(e,function(p,d){if(p)return o(p);u.size=d,o(null,M.clone(u))}):o(null,M.clone(u))):Me(a)?(u=a.getStats(),o(null,u)):o(s.FileError(f.EINVAL,e))},t.prototype.statSync=function(e,i){var o=this._index.getInode(e);if(o===null)throw s.ENOENT(e);var a;if(Re(o))a=o.getData(),a.size<0&&(a.size=this._requestFileSizeSync(e));else if(Me(o))a=o.getStats();else throw s.FileError(f.EINVAL,e);return a},t.prototype.open=function(e,i,o,a){if(i.isWriteable())return a(new s(f.EPERM,e));var u=this,p=this._index.getInode(e);if(p===null)return a(s.ENOENT(e));if(Re(p)){var d=p.getData();switch(i.pathExistsAction()){case T.THROW_EXCEPTION:case T.TRUNCATE_FILE:return a(s.EEXIST(e));case T.NOP:if(d.fileData)return a(null,new et(u,e,i,M.clone(d),d.fileData));this._requestFileAsync(e,"buffer",function(F,D){return F?a(F):(d.size=D.length,d.fileData=D,a(null,new et(u,e,i,M.clone(d),D)))});break;default:return a(new s(f.EINVAL,"Invalid FileMode object."))}}else return a(s.EISDIR(e))},t.prototype.openSync=function(e,i,o){if(i.isWriteable())throw new s(f.EPERM,e);var a=this._index.getInode(e);if(a===null)throw s.ENOENT(e);if(Re(a)){var u=a.getData();switch(i.pathExistsAction()){case T.THROW_EXCEPTION:case T.TRUNCATE_FILE:throw s.EEXIST(e);case T.NOP:if(u.fileData)return new et(this,e,i,M.clone(u),u.fileData);var p=this._requestFileSync(e,"buffer");return u.size=p.length,u.fileData=p,new et(this,e,i,M.clone(u),p);default:throw new s(f.EINVAL,"Invalid FileMode object.")}}else throw s.EISDIR(e)},t.prototype.readdir=function(e,i){try{i(null,this.readdirSync(e))}catch(o){i(o)}},t.prototype.readdirSync=function(e){var i=this._index.getInode(e);if(i===null)throw s.ENOENT(e);if(Me(i))return i.getListing();throw s.ENOTDIR(e)},t.prototype.readFile=function(e,i,o,a){var u=a;this.open(e,o,420,function(p,d){if(p)return a(p);a=function(W,tt){d.close(function(nt){return W||(W=nt),u(W,tt)})};var F=d,D=F.getBuffer();i===null?a(p,B(D)):Ha(D,i,a)})},t.prototype.readFileSync=function(e,i,o){var a=this.openSync(e,o,420);try{var u=a,p=u.getBuffer();return i===null?B(p):p.toString(i)}finally{a.closeSync()}},t.prototype._getHTTPPath=function(e){return e.charAt(0)==="/"&&(e=e.slice(1)),this.prefixUrl+e},t.prototype._requestFileAsync=function(e,i,o){this._requestFileAsyncInternal(this._getHTTPPath(e),i,o)},t.prototype._requestFileSync=function(e,i){return this._requestFileSyncInternal(this._getHTTPPath(e),i)},t.prototype._requestFileSizeAsync=function(e,i){this._requestFileSizeAsyncInternal(this._getHTTPPath(e),i)},t.prototype._requestFileSizeSync=function(e){return this._requestFileSizeSyncInternal(this._getHTTPPath(e))},t}(ut);vr.Name="HTTPRequest",vr.Options={index:{type:["string","object"],optional:!0,description:"URL to a file index as a JSON file or the file index object itself, generated with the make_http_index script. Defaults to `index.json`."},baseUrl:{type:"string",optional:!0,description:"Used as the URL prefix for fetched files. Default: Fetch files relative to the index."},preferXHR:{type:"boolean",optional:!0,description:"Whether to prefer XmlHttpRequest or fetch for async operations if both are available. Default: false"}};var We=function(){};We.str2byte=function(t,r){for(var e=t.length>r.length?r.length:t.length,i=0;i<e;i++){var o=t.charCodeAt(i);if(o>127){var a=We.extendedChars.indexOf(t.charAt(i));a>-1&&(o=a+128)}r[o]=i}return e},We.byte2str=function(t){for(var r=new Array(t.length),e=0;e<t.length;e++){var i=t[e];i>127?r[e]=We.extendedChars[i-128]:r[e]=String.fromCharCode(i)}return r.join("")},We.byteLength=function(t){return t.length},We.extendedChars=["\xC7","\xFC","\xE9","\xE2","\xE4","\xE0","\xE5","\xE7","\xEA","\xEB","\xE8","\xEF","\xEE","\xEC","\xC4","\xC5","\xC9","\xE6","\xC6","\xF4","\xF6","\xF2","\xFB","\xF9","\xFF","\xD6","\xDC","\xF8","\xA3","\xD8","\xD7","\u0192","\xE1","\xED","\xF3","\xFA","\xF1","\xD1","\xAA","\xBA","\xBF","\xAE","\xAC","\xBD","\xBC","\xA1","\xAB","\xBB","_","_","_","\xA6","\xA6","\xC1","\xC2","\xC0","\xA9","\xA6","\xA6","+","+","\xA2","\xA5","+","+","-","-","+","-","+","\xE3","\xC3","+","+","-","-","\xA6","-","+","\xA4","\xF0","\xD0","\xCA","\xCB","\xC8","i","\xCD","\xCE","\xCF","+","+","_","_","\xA6","\xCC","_","\xD3","\xDF","\xD4","\xD2","\xF5","\xD5","\xB5","\xFE","\xDE","\xDA","\xDB","\xD9","\xFD","\xDD","\xAF","\xB4","\xAD","\xB1","_","\xBE","\xB6","\xA7","\xF7","\xB8","\xB0","\xA8","\xB7","\xB9","\xB3","\xB2","_"," "];var Va=_(35).inflateRaw,ni={},ii;(function(n){n[n.MSDOS=0]="MSDOS",n[n.AMIGA=1]="AMIGA",n[n.OPENVMS=2]="OPENVMS",n[n.UNIX=3]="UNIX",n[n.VM_CMS=4]="VM_CMS",n[n.ATARI_ST=5]="ATARI_ST",n[n.OS2_HPFS=6]="OS2_HPFS",n[n.MAC=7]="MAC",n[n.Z_SYSTEM=8]="Z_SYSTEM",n[n.CP_M=9]="CP_M",n[n.NTFS=10]="NTFS",n[n.MVS=11]="MVS",n[n.VSE=12]="VSE",n[n.ACORN_RISC=13]="ACORN_RISC",n[n.VFAT=14]="VFAT",n[n.ALT_MVS=15]="ALT_MVS",n[n.BEOS=16]="BEOS",n[n.TANDEM=17]="TANDEM",n[n.OS_400=18]="OS_400",n[n.OSX=19]="OSX"})(ii||(ii={}));var nr;(function(n){n[n.STORED=0]="STORED",n[n.SHRUNK=1]="SHRUNK",n[n.REDUCED_1=2]="REDUCED_1",n[n.REDUCED_2=3]="REDUCED_2",n[n.REDUCED_3=4]="REDUCED_3",n[n.REDUCED_4=5]="REDUCED_4",n[n.IMPLODE=6]="IMPLODE",n[n.DEFLATE=8]="DEFLATE",n[n.DEFLATE64=9]="DEFLATE64",n[n.TERSE_OLD=10]="TERSE_OLD",n[n.BZIP2=12]="BZIP2",n[n.LZMA=14]="LZMA",n[n.TERSE_NEW=18]="TERSE_NEW",n[n.LZ77=19]="LZ77",n[n.WAVPACK=97]="WAVPACK",n[n.PPMD=98]="PPMD"})(nr||(nr={}));function oi(n,t){var r=t&31,e=(t>>5&15)-1,i=(t>>9)+1980,o=n&31,a=n>>5&63,u=n>>11;return new Date(i,e,r,u,a,o)}function Dr(n,t,r,e){return e===0?"":t?n.toString("utf8",r,r+e):We.byte2str(n.slice(r,r+e))}var ve=function(t){if(this.data=t,t.readUInt32LE(0)!==67324752)throw new s(f.EINVAL,"Invalid Zip file: Local file header has invalid signature: "+this.data.readUInt32LE(0))};ve.prototype.versionNeeded=function(){return this.data.readUInt16LE(4)},ve.prototype.flags=function(){return this.data.readUInt16LE(6)},ve.prototype.compressionMethod=function(){return this.data.readUInt16LE(8)},ve.prototype.lastModFileTime=function(){return oi(this.data.readUInt16LE(10),this.data.readUInt16LE(12))},ve.prototype.rawLastModFileTime=function(){return this.data.readUInt32LE(10)},ve.prototype.crc32=function(){return this.data.readUInt32LE(14)},ve.prototype.fileNameLength=function(){return this.data.readUInt16LE(26)},ve.prototype.extraFieldLength=function(){return this.data.readUInt16LE(28)},ve.prototype.fileName=function(){return Dr(this.data,this.useUTF8(),30,this.fileNameLength())},ve.prototype.extraField=function(){var t=30+this.fileNameLength();return this.data.slice(t,t+this.extraFieldLength())},ve.prototype.totalSize=function(){return 30+this.fileNameLength()+this.extraFieldLength()},ve.prototype.useUTF8=function(){return(this.flags()&2048)===2048};var gr=function(t,r,e){this.header=t,this.record=r,this.data=e};gr.prototype.decompress=function(){var t=this.header.compressionMethod(),r=ni[t];if(r)return r(this.data,this.record.compressedSize(),this.record.uncompressedSize(),this.record.flag());var e=nr[t];throw e||(e="Unknown: "+t),new s(f.EINVAL,"Invalid compression method on file '"+this.header.fileName()+"': "+e)},gr.prototype.getHeader=function(){return this.header},gr.prototype.getRecord=function(){return this.record},gr.prototype.getRawData=function(){return this.data};var Kr=function(t){this.data=t};Kr.prototype.crc32=function(){return this.data.readUInt32LE(0)},Kr.prototype.compressedSize=function(){return this.data.readUInt32LE(4)},Kr.prototype.uncompressedSize=function(){return this.data.readUInt32LE(8)};var ai=function(t){if(this.data=t,this.data.readUInt32LE(0)!==134630224)throw new s(f.EINVAL,"Invalid archive extra data record signature: "+this.data.readUInt32LE(0))};ai.prototype.length=function(){return this.data.readUInt32LE(4)},ai.prototype.extraFieldData=function(){return this.data.slice(8,8+this.length())};var si=function(t){if(this.data=t,this.data.readUInt32LE(0)!==84233040)throw new s(f.EINVAL,"Invalid digital signature signature: "+this.data.readUInt32LE(0))};si.prototype.size=function(){return this.data.readUInt16LE(4)},si.prototype.signatureData=function(){return this.data.slice(6,6+this.size())};var Nt=function(t,r){if(this.zipData=t,this.data=r,this.data.readUInt32LE(0)!==33639248)throw new s(f.EINVAL,"Invalid Zip file: Central directory record has invalid signature: "+this.data.readUInt32LE(0));this._filename=this.produceFilename()};Nt.prototype.versionMadeBy=function(){return this.data.readUInt16LE(4)},Nt.prototype.versionNeeded=function(){return this.data.readUInt16LE(6)},Nt.prototype.flag=function(){return this.data.readUInt16LE(8)},Nt.prototype.compressionMethod=function(){return this.data.readUInt16LE(10)},Nt.prototype.lastModFileTime=function(){return oi(this.data.readUInt16LE(12),this.data.readUInt16LE(14))},Nt.prototype.rawLastModFileTime=function(){return this.data.readUInt32LE(12)},Nt.prototype.crc32=function(){return this.data.readUInt32LE(16)},Nt.prototype.compressedSize=function(){return this.data.readUInt32LE(20)},Nt.prototype.uncompressedSize=function(){return this.data.readUInt32LE(24)},Nt.prototype.fileNameLength=function(){return this.data.readUInt16LE(28)},Nt.prototype.extraFieldLength=function(){return this.data.readUInt16LE(30)},Nt.prototype.fileCommentLength=function(){return this.data.readUInt16LE(32)},Nt.prototype.diskNumberStart=function(){return this.data.readUInt16LE(34)},Nt.prototype.internalAttributes=function(){return this.data.readUInt16LE(36)},Nt.prototype.externalAttributes=function(){return this.data.readUInt32LE(38)},Nt.prototype.headerRelativeOffset=function(){return this.data.readUInt32LE(42)},Nt.prototype.produceFilename=function(){var t=Dr(this.data,this.useUTF8(),46,this.fileNameLength());return t.replace(/\\/g,"/")},Nt.prototype.fileName=function(){return this._filename},Nt.prototype.rawFileName=function(){return this.data.slice(46,46+this.fileNameLength())},Nt.prototype.extraField=function(){var t=44+this.fileNameLength();return this.data.slice(t,t+this.extraFieldLength())},Nt.prototype.fileComment=function(){var t=46+this.fileNameLength()+this.extraFieldLength();return Dr(this.data,this.useUTF8(),t,this.fileCommentLength())},Nt.prototype.rawFileComment=function(){var t=46+this.fileNameLength()+this.extraFieldLength();return this.data.slice(t,t+this.fileCommentLength())},Nt.prototype.totalSize=function(){return 46+this.fileNameLength()+this.extraFieldLength()+this.fileCommentLength()},Nt.prototype.isDirectory=function(){var t=this.fileName();return!!(this.externalAttributes()&16)||t.charAt(t.length-1)==="/"},Nt.prototype.isFile=function(){return!this.isDirectory()},Nt.prototype.useUTF8=function(){return(this.flag()&2048)===2048},Nt.prototype.isEncrypted=function(){return(this.flag()&1)===1},Nt.prototype.getFileData=function(){var t=this.headerRelativeOffset(),r=new ve(this.zipData.slice(t));return new gr(r,this,this.zipData.slice(t+r.totalSize()))},Nt.prototype.getData=function(){return this.getFileData().decompress()},Nt.prototype.getRawData=function(){return this.getFileData().getRawData()},Nt.prototype.getStats=function(){return new M(R.FILE,this.uncompressedSize(),365,new Date,this.lastModFileTime())};var _e=function(t){if(this.data=t,this.data.readUInt32LE(0)!==101010256)throw new s(f.EINVAL,"Invalid Zip file: End of central directory record has invalid signature: "+this.data.readUInt32LE(0))};_e.prototype.diskNumber=function(){return this.data.readUInt16LE(4)},_e.prototype.cdDiskNumber=function(){return this.data.readUInt16LE(6)},_e.prototype.cdDiskEntryCount=function(){return this.data.readUInt16LE(8)},_e.prototype.cdTotalEntryCount=function(){return this.data.readUInt16LE(10)},_e.prototype.cdSize=function(){return this.data.readUInt32LE(12)},_e.prototype.cdOffset=function(){return this.data.readUInt32LE(16)},_e.prototype.cdZipCommentLength=function(){return this.data.readUInt16LE(20)},_e.prototype.cdZipComment=function(){return Dr(this.data,!0,22,this.cdZipCommentLength())},_e.prototype.rawCdZipComment=function(){return this.data.slice(22,22+this.cdZipCommentLength())};var Za=function(t,r,e,i){this.index=t,this.directoryEntries=r,this.eocd=e,this.data=i},He=function(n){function t(r,e){e===void 0&&(e=""),n.call(this),this.name=e,this._index=new ge,this._directoryEntries=[],this._eocd=null,this._index=r.index,this._directoryEntries=r.directoryEntries,this._eocd=r.eocd,this.data=r.data}return n&&(t.__proto__=n),t.prototype=Object.create(n&&n.prototype),t.prototype.constructor=t,t.Create=function(e,i){try{t._computeIndex(e.zipData,function(o,a){if(a){var u=new t(a,e.name);i(null,u)}else i(o)})}catch(o){i(o)}},t.isAvailable=function(){return!0},t.RegisterDecompressionMethod=function(e,i){ni[e]=i},t._getEOCD=function(e){for(var i=22,o=Math.min(i+65535,e.length-1),a=i;a<o;a++)if(e.readUInt32LE(e.length-a)===101010256)return new _e(e.slice(e.length-a));throw new s(f.EINVAL,"Invalid ZIP file: Could not locate End of Central Directory signature.")},t._addToIndex=function(e,i){var o=e.fileName();if(o.charAt(0)==="/")throw new s(f.EPERM,"Unexpectedly encountered an absolute path in a zip file. Please file a bug.");o.charAt(o.length-1)==="/"&&(o=o.substr(0,o.length-1)),e.isDirectory()?i.addPathFast("/"+o,new le(e)):i.addPathFast("/"+o,new rr(e))},t._computeIndex=function(e,i){try{var o=new ge,a=t._getEOCD(e);if(a.diskNumber()!==a.cdDiskNumber())return i(new s(f.EINVAL,"ZipFS does not support spanned zip files."));var u=a.cdOffset();if(u===4294967295)return i(new s(f.EINVAL,"ZipFS does not support Zip64."));var p=u+a.cdSize();t._computeIndexResponsive(e,o,u,p,i,[],a)}catch(d){i(d)}},t._computeIndexResponsiveTrampoline=function(e,i,o,a,u,p,d){try{t._computeIndexResponsive(e,i,o,a,u,p,d)}catch(F){u(F)}},t._computeIndexResponsive=function(e,i,o,a,u,p,d){if(o<a){for(var F=0;F++<200&&o<a;){var D=new Nt(e,e.slice(o));t._addToIndex(D,i),o+=D.totalSize(),p.push(D)}Ut(function(){t._computeIndexResponsiveTrampoline(e,i,o,a,u,p,d)})}else u(null,new Za(i,p,d,e))},t.prototype.getName=function(){return t.Name+(this.name!==""?" "+this.name:"")},t.prototype.getCentralDirectoryEntry=function(e){var i=this._index.getInode(e);if(i===null)throw s.ENOENT(e);if(Re(i))return i.getData();if(Me(i))return i.getData();throw s.EPERM("Invalid inode: "+i)},t.prototype.getCentralDirectoryEntryAt=function(e){var i=this._directoryEntries[e];if(!i)throw new RangeError("Invalid directory index: "+e+".");return i},t.prototype.getNumberOfCentralDirectoryEntries=function(){return this._directoryEntries.length},t.prototype.getEndOfCentralDirectory=function(){return this._eocd},t.prototype.diskSpace=function(e,i){i(this.data.length,0)},t.prototype.isReadOnly=function(){return!0},t.prototype.supportsLinks=function(){return!1},t.prototype.supportsProps=function(){return!1},t.prototype.supportsSynch=function(){return!0},t.prototype.statSync=function(e,i){var o=this._index.getInode(e);if(o===null)throw s.ENOENT(e);var a;if(Re(o))a=o.getData().getStats();else if(Me(o))a=o.getStats();else throw new s(f.EINVAL,"Invalid inode.");return a},t.prototype.openSync=function(e,i,o){if(i.isWriteable())throw new s(f.EPERM,e);var a=this._index.getInode(e);if(a)if(Re(a)){var u=a.getData(),p=u.getStats();switch(i.pathExistsAction()){case T.THROW_EXCEPTION:case T.TRUNCATE_FILE:throw s.EEXIST(e);case T.NOP:return new et(this,e,i,p,u.getData());default:throw new s(f.EINVAL,"Invalid FileMode object.")}}else throw s.EISDIR(e);else throw s.ENOENT(e)},t.prototype.readdirSync=function(e){var i=this._index.getInode(e);if(i){if(Me(i))return i.getListing();throw s.ENOTDIR(e)}else throw s.ENOENT(e)},t.prototype.readFileSync=function(e,i,o){var a=this.openSync(e,o,420);try{var u=a,p=u.getBuffer();return i===null?B(p):p.toString(i)}finally{a.closeSync()}},t}(x);He.Name="ZipFS",He.Options={zipData:{type:"object",description:"The zip file as a Buffer object.",validator:wt},name:{type:"string",optional:!0,description:"The name of the zip file (optional)."}},He.CompressionMethod=nr,He.RegisterDecompressionMethod(nr.DEFLATE,function(n,t,r){return oe(Va(n.slice(0,t),{chunkSize:r}))}),He.RegisterDecompressionMethod(nr.STORED,function(n,t,r){return B(n,0,r)});var Ya="IEEE_P1282";function he(n,t,r){return n.toString("ascii",t,t+r).trim()}function Qr(n,t,r){if(r===1)return String.fromCharCode(n[t]);for(var e=Math.floor(r/2),i=new Array(e),o=0;o<e;o++){var a=t+(o<<1);i[o]=String.fromCharCode(n[a+1]|n[a]<<8)}return i.join("")}function Se(n,t){var r=parseInt(he(n,t,4),10),e=parseInt(he(n,t+4,2),10),i=parseInt(he(n,t+6,2),10),o=parseInt(he(n,t+8,2),10),a=parseInt(he(n,t+10,2),10),u=parseInt(he(n,t+12,2),10),p=parseInt(he(n,t+14,2),10);return new Date(r,e,i,o,a,u,p*100)}function Ve(n,t){var r=n[t],e=n[t+1],i=n[t+2],o=n[t+3],a=n[t+4],u=n[t+5];return new Date(r,e-1,i,o,a,u)}function qa(n,t){var r=n.slice(t),e=new Jt(r);switch(e.signatureWord()){case 17221:return new hi(r);case 20548:return new Ja(r);case 21328:return new pi(r);case 21332:return new di(r);case 17746:return new yi(r);case 17747:return new Ka(r);case 20568:return new gi(r);case 20558:return new Qa(r);case 21324:return new $r(r);case 20045:return new wi(r);case 17228:return new tn(r);case 20556:return new $a(r);case 21061:return new mi(r);case 21574:return new _i(r);case 21318:return new ts(r);case 21074:return new vi(r);default:return e}}function ui(n,t,r,e){r=r-4;for(var i=new Array;t<r;){var o=qa(n,t),a=o.length();if(a===0)return i;if(t+=a,o instanceof di)break;o instanceof hi?i=i.concat(o.getEntries(e)):i.push(o)}return i}var ir=function(t){this._data=t};ir.prototype.type=function(){return this._data[0]},ir.prototype.standardIdentifier=function(){return he(this._data,1,5)},ir.prototype.version=function(){return this._data[6]},ir.prototype.data=function(){return this._data.slice(7,2048)};var fi=function(n){function t(r){n.call(this,r),this._root=null}return n&&(t.__proto__=n),t.prototype=Object.create(n&&n.prototype),t.prototype.constructor=t,t.prototype.systemIdentifier=function(){return this._getString32(8)},t.prototype.volumeIdentifier=function(){return this._getString32(40)},t.prototype.volumeSpaceSize=function(){return this._data.readUInt32LE(80)},t.prototype.volumeSetSize=function(){return this._data.readUInt16LE(120)},t.prototype.volumeSequenceNumber=function(){return this._data.readUInt16LE(124)},t.prototype.logicalBlockSize=function(){return this._data.readUInt16LE(128)},t.prototype.pathTableSize=function(){return this._data.readUInt32LE(132)},t.prototype.locationOfTypeLPathTable=function(){return this._data.readUInt32LE(140)},t.prototype.locationOfOptionalTypeLPathTable=function(){return this._data.readUInt32LE(144)},t.prototype.locationOfTypeMPathTable=function(){return this._data.readUInt32BE(148)},t.prototype.locationOfOptionalTypeMPathTable=function(){return this._data.readUInt32BE(152)},t.prototype.rootDirectoryEntry=function(e){return this._root===null&&(this._root=this._constructRootDirectoryRecord(this._data.slice(156)),this._root.rootCheckForRockRidge(e)),this._root},t.prototype.volumeSetIdentifier=function(){return this._getString(190,128)},t.prototype.publisherIdentifier=function(){return this._getString(318,128)},t.prototype.dataPreparerIdentifier=function(){return this._getString(446,128)},t.prototype.applicationIdentifier=function(){return this._getString(574,128)},t.prototype.copyrightFileIdentifier=function(){return this._getString(702,38)},t.prototype.abstractFileIdentifier=function(){return this._getString(740,36)},t.prototype.bibliographicFileIdentifier=function(){return this._getString(776,37)},t.prototype.volumeCreationDate=function(){return Se(this._data,813)},t.prototype.volumeModificationDate=function(){return Se(this._data,830)},t.prototype.volumeExpirationDate=function(){return Se(this._data,847)},t.prototype.volumeEffectiveDate=function(){return Se(this._data,864)},t.prototype.fileStructureVersion=function(){return this._data[881]},t.prototype.applicationUsed=function(){return this._data.slice(883,883+512)},t.prototype.reserved=function(){return this._data.slice(1395,1395+653)},t.prototype._getString32=function(e){return this._getString(e,32)},t}(ir),Xa=function(n){function t(r){if(n.call(this,r),this.type()!==1)throw new s(f.EIO,"Invalid primary volume descriptor.")}return n&&(t.__proto__=n),t.prototype=Object.create(n&&n.prototype),t.prototype.constructor=t,t.prototype.name=function(){return"ISO9660"},t.prototype._constructRootDirectoryRecord=function(e){return new ci(e,-1)},t.prototype._getString=function(e,i){return this._getString(e,i)},t}(fi),Ga=function(n){function t(r){if(n.call(this,r),this.type()!==2)throw new s(f.EIO,"Invalid supplementary volume descriptor.");var e=this.escapeSequence(),i=e[2];if(e[0]!==37||e[1]!==47||i!==64&&i!==67&&i!==69)throw new s(f.EIO,"Unrecognized escape sequence for SupplementaryVolumeDescriptor: "+e.toString())}return n&&(t.__proto__=n),t.prototype=Object.create(n&&n.prototype),t.prototype.constructor=t,t.prototype.name=function(){return"Joliet"},t.prototype.escapeSequence=function(){return this._data.slice(88,120)},t.prototype._constructRootDirectoryRecord=function(e){return new li(e,-1)},t.prototype._getString=function(e,i){return Qr(this._data,e,i)},t}(fi),Wt=function(t,r){this._suEntries=null,this._fileOrDir=null,this._data=t,this._rockRidgeOffset=r};Wt.prototype.hasRockRidge=function(){return this._rockRidgeOffset>-1},Wt.prototype.getRockRidgeOffset=function(){return this._rockRidgeOffset},Wt.prototype.rootCheckForRockRidge=function(t){var r=this.getDirectory(t);this._rockRidgeOffset=r.getDotEntry(t)._getRockRidgeOffset(t),this._rockRidgeOffset>-1&&(this._fileOrDir=null)},Wt.prototype.length=function(){return this._data[0]},Wt.prototype.extendedAttributeRecordLength=function(){return this._data[1]},Wt.prototype.lba=function(){return this._data.readUInt32LE(2)*2048},Wt.prototype.dataLength=function(){return this._data.readUInt32LE(10)},Wt.prototype.recordingDate=function(){return Ve(this._data,18)},Wt.prototype.fileFlags=function(){return this._data[25]},Wt.prototype.fileUnitSize=function(){return this._data[26]},Wt.prototype.interleaveGapSize=function(){return this._data[27]},Wt.prototype.volumeSequenceNumber=function(){return this._data.readUInt16LE(28)},Wt.prototype.identifier=function(){return this._getString(33,this._data[32])},Wt.prototype.fileName=function(t){if(this.hasRockRidge()){var r=this._rockRidgeFilename(t);if(r!==null)return r}var e=this.identifier();if(this.isDirectory(t))return e;var i=e.indexOf(";");return i===-1?e:e[i-1]==="."?e.slice(0,i-1):e.slice(0,i)},Wt.prototype.isDirectory=function(t){var r=!!(this.fileFlags()&2);return!r&&this.hasRockRidge()&&(r=this.getSUEntries(t).filter(function(e){return e instanceof tn}).length>0),r},Wt.prototype.isSymlink=function(t){return this.hasRockRidge()&&this.getSUEntries(t).filter(function(r){return r instanceof $r}).length>0},Wt.prototype.getSymlinkPath=function(t){for(var r="",e=this.getSUEntries(t),i=this._getGetString(),o=0,a=e;o<a.length;o+=1){var u=a[o];if(u instanceof $r){for(var p=u.componentRecords(),d=0,F=p;d<F.length;d+=1){var D=F[d],W=D.flags();W&2?r+="./":W&4?r+="../":W&8?r+="/":(r+=D.content(i),W&1||(r+="/"))}if(!u.continueFlag())break}}return r.length>1&&r[r.length-1]==="/"?r.slice(0,r.length-1):r},Wt.prototype.getFile=function(t){if(this.isDirectory(t))throw new Error("Tried to get a File from a directory.");return this._fileOrDir===null&&(this._fileOrDir=t.slice(this.lba(),this.lba()+this.dataLength())),this._fileOrDir},Wt.prototype.getDirectory=function(t){if(!this.isDirectory(t))throw new Error("Tried to get a Directory from a file.");return this._fileOrDir===null&&(this._fileOrDir=this._constructDirectory(t)),this._fileOrDir},Wt.prototype.getSUEntries=function(t){return this._suEntries||this._constructSUEntries(t),this._suEntries},Wt.prototype._rockRidgeFilename=function(t){var r=this.getSUEntries(t).filter(function(p){return p instanceof wi});if(r.length===0||r[0].flags()&6)return null;for(var e="",i=this._getGetString(),o=0,a=r;o<a.length;o+=1){var u=a[o];if(e+=u.name(i),!(u.flags()&1))break}return e},Wt.prototype._constructSUEntries=function(t){var r=33+this._data[32];r%2===1&&r++,r+=this._rockRidgeOffset,this._suEntries=ui(this._data,r,this.length(),t)},Wt.prototype._getRockRidgeOffset=function(t){this._rockRidgeOffset=0;var r=this.getSUEntries(t);if(r.length>0){var e=r[0];if(e instanceof pi&&e.checkBytesPass())for(var i=1;i<r.length;i++){var o=r[i];if(o instanceof vi||o instanceof yi&&o.extensionIdentifier()===Ya)return e.bytesSkipped()}}return this._rockRidgeOffset=-1,-1};var ci=function(n){function t(r,e){n.call(this,r,e)}return n&&(t.__proto__=n),t.prototype=Object.create(n&&n.prototype),t.prototype.constructor=t,t.prototype._getString=function(e,i){return he(this._data,e,i)},t.prototype._constructDirectory=function(e){return new es(this,e)},t.prototype._getGetString=function(){return he},t}(Wt),li=function(n){function t(r,e){n.call(this,r,e)}return n&&(t.__proto__=n),t.prototype=Object.create(n&&n.prototype),t.prototype.constructor=t,t.prototype._getString=function(e,i){return Qr(this._data,e,i)},t.prototype._constructDirectory=function(e){return new rs(this,e)},t.prototype._getGetString=function(){return Qr},t}(Wt),Jt=function(t){this._data=t};Jt.prototype.signatureWord=function(){return this._data.readUInt16BE(0)},Jt.prototype.signatureWordString=function(){return he(this._data,0,2)},Jt.prototype.length=function(){return this._data[2]},Jt.prototype.suVersion=function(){return this._data[3]};var hi=function(n){function t(r){n.call(this,r),this._entries=null}return n&&(t.__proto__=n),t.prototype=Object.create(n&&n.prototype),t.prototype.constructor=t,t.prototype.continuationLba=function(){return this._data.readUInt32LE(4)},t.prototype.continuationLbaOffset=function(){return this._data.readUInt32LE(12)},t.prototype.continuationLength=function(){return this._data.readUInt32LE(20)},t.prototype.getEntries=function(e){if(!this._entries){var i=this.continuationLba()*2048+this.continuationLbaOffset();this._entries=ui(e,i,this.continuationLength(),e)}return this._entries},t}(Jt),Ja=function(n){function t(r){n.call(this,r)}return n&&(t.__proto__=n),t.prototype=Object.create(n&&n.prototype),t.prototype.constructor=t,t}(Jt),pi=function(n){function t(r){n.call(this,r)}return n&&(t.__proto__=n),t.prototype=Object.create(n&&n.prototype),t.prototype.constructor=t,t.prototype.checkBytesPass=function(){return this._data[4]===190&&this._data[5]===239},t.prototype.bytesSkipped=function(){return this._data[6]},t}(Jt),di=function(n){function t(r){n.call(this,r)}return n&&(t.__proto__=n),t.prototype=Object.create(n&&n.prototype),t.prototype.constructor=t,t}(Jt),yi=function(n){function t(r){n.call(this,r)}return n&&(t.__proto__=n),t.prototype=Object.create(n&&n.prototype),t.prototype.constructor=t,t.prototype.identifierLength=function(){return this._data[4]},t.prototype.descriptorLength=function(){return this._data[5]},t.prototype.sourceLength=function(){return this._data[6]},t.prototype.extensionVersion=function(){return this._data[7]},t.prototype.extensionIdentifier=function(){return he(this._data,8,this.identifierLength())},t.prototype.extensionDescriptor=function(){return he(this._data,8+this.identifierLength(),this.descriptorLength())},t.prototype.extensionSource=function(){return he(this._data,8+this.identifierLength()+this.descriptorLength(),this.sourceLength())},t}(Jt),Ka=function(n){function t(r){n.call(this,r)}return n&&(t.__proto__=n),t.prototype=Object.create(n&&n.prototype),t.prototype.constructor=t,t.prototype.extensionSequence=function(){return this._data[4]},t}(Jt),vi=function(n){function t(r){n.call(this,r)}return n&&(t.__proto__=n),t.prototype=Object.create(n&&n.prototype),t.prototype.constructor=t,t}(Jt),gi=function(n){function t(r){n.call(this,r)}return n&&(t.__proto__=n),t.prototype=Object.create(n&&n.prototype),t.prototype.constructor=t,t.prototype.mode=function(){return this._data.readUInt32LE(4)},t.prototype.fileLinks=function(){return this._data.readUInt32LE(12)},t.prototype.uid=function(){return this._data.readUInt32LE(20)},t.prototype.gid=function(){return this._data.readUInt32LE(28)},t.prototype.inode=function(){return this._data.readUInt32LE(36)},t}(Jt),Qa=function(n){function t(r){n.call(this,r)}return n&&(t.__proto__=n),t.prototype=Object.create(n&&n.prototype),t.prototype.constructor=t,t.prototype.devTHigh=function(){return this._data.readUInt32LE(4)},t.prototype.devTLow=function(){return this._data.readUInt32LE(12)},t}(Jt),$r=function(n){function t(r){n.call(this,r)}return n&&(t.__proto__=n),t.prototype=Object.create(n&&n.prototype),t.prototype.constructor=t,t.prototype.flags=function(){return this._data[4]},t.prototype.continueFlag=function(){return this.flags()&1},t.prototype.componentRecords=function(){for(var e=this,i=new Array,o=5;o<this.length();){var a=new wr(e._data.slice(o));i.push(a),o+=a.length()}return i},t}(Jt),wr=function(t){this._data=t};wr.prototype.flags=function(){return this._data[0]},wr.prototype.length=function(){return 2+this.componentLength()},wr.prototype.componentLength=function(){return this._data[1]},wr.prototype.content=function(t){return t(this._data,2,this.componentLength())};var wi=function(n){function t(r){n.call(this,r)}return n&&(t.__proto__=n),t.prototype=Object.create(n&&n.prototype),t.prototype.constructor=t,t.prototype.flags=function(){return this._data[4]},t.prototype.name=function(e){return e(this._data,5,this.length()-5)},t}(Jt),tn=function(n){function t(r){n.call(this,r)}return n&&(t.__proto__=n),t.prototype=Object.create(n&&n.prototype),t.prototype.constructor=t,t.prototype.childDirectoryLba=function(){return this._data.readUInt32LE(4)},t}(Jt),$a=function(n){function t(r){n.call(this,r)}return n&&(t.__proto__=n),t.prototype=Object.create(n&&n.prototype),t.prototype.constructor=t,t.prototype.parentDirectoryLba=function(){return this._data.readUInt32LE(4)},t}(Jt),mi=function(n){function t(r){n.call(this,r)}return n&&(t.__proto__=n),t.prototype=Object.create(n&&n.prototype),t.prototype.constructor=t,t}(Jt),_i=function(n){function t(r){n.call(this,r)}return n&&(t.__proto__=n),t.prototype=Object.create(n&&n.prototype),t.prototype.constructor=t,t.prototype.flags=function(){return this._data[4]},t.prototype.creation=function(){return this.flags()&1?this._longFormDates()?Se(this._data,5):Ve(this._data,5):null},t.prototype.modify=function(){if(this.flags()&2){var e=this.flags()&1?1:0;return this._longFormDates?Se(this._data,5+e*17):Ve(this._data,5+e*7)}else return null},t.prototype.access=function(){if(this.flags()&4){var e=this.flags()&1?1:0;return e+=this.flags()&2?1:0,this._longFormDates?Se(this._data,5+e*17):Ve(this._data,5+e*7)}else return null},t.prototype.backup=function(){if(this.flags()&16){var e=this.flags()&1?1:0;return e+=this.flags()&2?1:0,e+=this.flags()&4?1:0,this._longFormDates?Se(this._data,5+e*17):Ve(this._data,5+e*7)}else return null},t.prototype.expiration=function(){if(this.flags()&32){var e=this.flags()&1?1:0;return e+=this.flags()&2?1:0,e+=this.flags()&4?1:0,e+=this.flags()&16?1:0,this._longFormDates?Se(this._data,5+e*17):Ve(this._data,5+e*7)}else return null},t.prototype.effective=function(){if(this.flags()&64){var e=this.flags()&1?1:0;return e+=this.flags()&2?1:0,e+=this.flags()&4?1:0,e+=this.flags()&16?1:0,e+=this.flags()&32?1:0,this._longFormDates?Se(this._data,5+e*17):Ve(this._data,5+e*7)}else return null},t.prototype._longFormDates=function(){return!!this.flags()},t}(Jt),ts=function(n){function t(r){n.call(this,r)}return n&&(t.__proto__=n),t.prototype=Object.create(n&&n.prototype),t.prototype.constructor=t,t.prototype.virtualSizeHigh=function(){return this._data.readUInt32LE(4)},t.prototype.virtualSizeLow=function(){return this._data.readUInt32LE(12)},t.prototype.tableDepth=function(){return this._data[20]},t}(Jt),mr=function(t,r){var e=this;this._fileList=[],this._fileMap={},this._record=t;var i=t.lba(),o=i+t.dataLength();if(!(t.fileFlags()&2)){var a=t.getSUEntries(r).filter(function(F){return F instanceof tn})[0];i=a.childDirectoryLba()*2048,o=1/0}for(;i<o;){var u=r[i];if(u===0){i++;continue}var p=e._constructDirectoryRecord(r.slice(i)),d=p.fileName(r);d!=="\0"&&d!==""?(!p.hasRockRidge()||p.getSUEntries(r).filter(function(F){return F instanceof mi}).length===0)&&(e._fileMap[d]=p,e._fileList.push(d)):o===1/0&&(o=i+p.dataLength()),i+=p.length()}};mr.prototype.getRecord=function(t){return this._fileMap[t]},mr.prototype.getFileList=function(){return this._fileList},mr.prototype.getDotEntry=function(t){return this._constructDirectoryRecord(t.slice(this._record.lba()))};var es=function(n){function t(r,e){n.call(this,r,e)}return n&&(t.__proto__=n),t.prototype=Object.create(n&&n.prototype),t.prototype.constructor=t,t.prototype._constructDirectoryRecord=function(e){return new ci(e,this._record.getRockRidgeOffset())},t}(mr),rs=function(n){function t(r,e){n.call(this,r,e)}return n&&(t.__proto__=n),t.prototype=Object.create(n&&n.prototype),t.prototype.constructor=t,t.prototype._constructDirectoryRecord=function(e){return new li(e,this._record.getRockRidgeOffset())},t}(mr),Ar=function(n){function t(r,e){var i=this;e===void 0&&(e=""),n.call(this),this._data=r;for(var o=!1,a=16*2048,u=new Array;!o;){var p=r.slice(a),d=new ir(p);switch(d.type()){case 1:u.push(new Xa(p));break;case 2:u.push(new Ga(p));break;case 255:o=!0;break}a+=2048}if(u.length===0)throw new s(f.EIO,"Unable to find a suitable volume descriptor.");u.forEach(function(F){(!i._pvd||i._pvd.type()!==2)&&(i._pvd=F)}),this._root=this._pvd.rootDirectoryEntry(r),this._name=e}return n&&(t.__proto__=n),t.prototype=Object.create(n&&n.prototype),t.prototype.constructor=t,t.Create=function(e,i){try{i(null,new t(e.data,e.name))}catch(o){i(o)}},t.isAvailable=function(){return!0},t.prototype.getName=function(){var e="IsoFS"+this._name+(this._pvd?"-"+this._pvd.name():"");return this._root&&this._root.hasRockRidge()&&(e+="-RockRidge"),e},t.prototype.diskSpace=function(e,i){i(this._data.length,0)},t.prototype.isReadOnly=function(){return!0},t.prototype.supportsLinks=function(){return!1},t.prototype.supportsProps=function(){return!1},t.prototype.supportsSynch=function(){return!0},t.prototype.statSync=function(e,i){var o=this._getDirectoryRecord(e);if(o===null)throw s.ENOENT(e);return this._getStats(e,o)},t.prototype.openSync=function(e,i,o){if(i.isWriteable())throw new s(f.EPERM,e);var a=this._getDirectoryRecord(e);if(a){if(a.isSymlink(this._data))return this.openSync(h.resolve(e,a.getSymlinkPath(this._data)),i,o);if(a.isDirectory(this._data))throw s.EISDIR(e);var u=a.getFile(this._data),p=this._getStats(e,a);switch(i.pathExistsAction()){case T.THROW_EXCEPTION:case T.TRUNCATE_FILE:throw s.EEXIST(e);case T.NOP:return new et(this,e,i,p,u);default:throw new s(f.EINVAL,"Invalid FileMode object.")}}else throw s.ENOENT(e)},t.prototype.readdirSync=function(e){var i=this._getDirectoryRecord(e);if(i){if(i.isDirectory(this._data))return i.getDirectory(this._data).getFileList().slice(0);throw s.ENOTDIR(e)}else throw s.ENOENT(e)},t.prototype.readFileSync=function(e,i,o){var a=this.openSync(e,o,420);try{var u=a,p=u.getBuffer();return i===null?B(p):p.toString(i)}finally{a.closeSync()}},t.prototype._getDirectoryRecord=function(e){var i=this;if(e==="/")return this._root;for(var o=e.split("/").slice(1),a=this._root,u=0,p=o;u<p.length;u+=1){var d=p[u];if(a.isDirectory(i._data)){if(a=a.getDirectory(i._data).getRecord(d),!a)return null}else return null}return a},t.prototype._getStats=function(e,i){if(i.isSymlink(this._data)){var o=h.resolve(e,i.getSymlinkPath(this._data)),a=this._getDirectoryRecord(o);return a?this._getStats(o,a):null}else{var u=i.dataLength(),p=365,d=i.recordingDate(),F=d,D=d,W=d;if(i.hasRockRidge())for(var tt=i.getSUEntries(this._data),nt=0,ft=tt;nt<ft.length;nt+=1){var yt=ft[nt];if(yt instanceof gi)p=yt.mode();else if(yt instanceof _i){var Et=yt.flags();Et&4&&(F=yt.access()),Et&2&&(D=yt.modify()),Et&1&&(W=yt.creation())}}return p=p&365,new M(i.isDirectory(this._data)?R.DIRECTORY:R.FILE,u,p,F,D,W)}},t}(x);Ar.Name="IsoFS",Ar.Options={data:{type:"object",description:"The ISO file in a buffer",validator:wt}},[l,Je,st,At,Ir,$e,cr,Ar,hr,er,yr,Lr,vr,He].forEach(function(n){var t=n.Create;n.Create=function(r,e){var i=typeof r=="function",o=i?r:e,a=i?{}:r;function u(p){p?o(p):t.call(n,a,o)}_t(n,a,u)}});var Cr={AsyncMirror:l,Dropbox:Je,Emscripten:st,FolderAdapter:At,HTML5FS:Ir,InMemory:$e,IndexedDB:cr,IsoFS:Ar,LocalStorage:hr,MountableFileSystem:er,OverlayFS:yr,WorkerFS:Lr,HTTPRequest:vr,XmlHttpRequest:vr,ZipFS:He};U.initializeTTYs&&U.initializeTTYs();function ns(n){n.Buffer=S,n.process=U;var t=n.require?n.require:null;n.require=function(r){var e=Si(r);return e||t.apply(null,Array.prototype.slice.call(arguments,0))}}function is(n,t){Cr[n]=t}function Si(n){switch(n){case"fs":return $;case"path":return h;case"buffer":return b;case"process":return U;case"bfs_utils":return te;default:return Cr[n]}}function Ei(n){return $.initialize(n)}function os(n,t){en(n,function(r,e){e?(Ei(e),t()):t(r)})}function en(n,t){var r=n.fs;if(!r)return t(new s(f.EPERM,'Missing "fs" property on configuration object.'));var e=n.options,i=0,o=!1;function a(){if(!o){o=!0;var d=Cr[r];d?d.Create(e,t):t(new s(f.EPERM,"File system "+r+" is not available in BrowserFS."))}}if(e!==null&&typeof e=="object"){var u=!1,p=Object.keys(e).filter(function(d){return d!=="fs"});p.forEach(function(d){var F=e[d];F!==null&&typeof F=="object"&&F.fs&&(i++,en(F,function(D,W){if(i--,D){if(o)return;o=!0,t(D)}else e[d]=W,i===0&&u&&a()}))}),u=!0}i===0&&a()}"ab".substr(-1)!=="b"&&(String.prototype.substr=function(n){return function(t,r){return t<0&&(t=this.length+t),n.call(this,t,r)}}(String.prototype.substr)),typeof ArrayBuffer<"u"&&typeof Uint8Array<"u"&&(Uint8Array.prototype.slice||(Uint8Array.prototype.slice=function(n,t){n===void 0&&(n=0),t===void 0&&(t=this.length);var r=this;return n<0&&(n=this.length+n,n<0&&(n=0)),t<0&&(t=this.length+t,t<0&&(t=0)),t<n&&(t=n),new Uint8Array(r.buffer,r.byteOffset+n,t-n)})),w.install=ns,w.registerFileSystem=is,w.BFSRequire=Si,w.initialize=Ei,w.configure=os,w.getFileSystem=en,w.EmscriptenFS=Mt,w.FileSystem=Cr,w.Errors=k,w.setImmediate=Ut}).call(w,_(9),_(5),_(2),_(34)(O))},function(O,w,_){"use strict";w.byteLength=g,w.toByteArray=s,w.fromByteArray=N;for(var S=[],L=[],U=typeof Uint8Array<"u"?Uint8Array:Array,I="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",b=0,h=I.length;b<h;++b)S[b]=I[b],L[I.charCodeAt(b)]=b;L["-".charCodeAt(0)]=62,L["_".charCodeAt(0)]=63;function f(R){var M=R.length;if(M%4>0)throw new Error("Invalid string. Length must be a multiple of 4");return R[M-2]==="="?2:R[M-1]==="="?1:0}function g(R){return R.length*3/4-f(R)}function s(R){var M,j,Q,H,rt,q=R.length;H=f(R),rt=new U(q*3/4-H),j=H>0?q-4:q;var mt=0;for(M=0;M<j;M+=4)Q=L[R.charCodeAt(M)]<<18|L[R.charCodeAt(M+1)]<<12|L[R.charCodeAt(M+2)]<<6|L[R.charCodeAt(M+3)],rt[mt++]=Q>>16&255,rt[mt++]=Q>>8&255,rt[mt++]=Q&255;return H===2?(Q=L[R.charCodeAt(M)]<<2|L[R.charCodeAt(M+1)]>>4,rt[mt++]=Q&255):H===1&&(Q=L[R.charCodeAt(M)]<<10|L[R.charCodeAt(M+1)]<<4|L[R.charCodeAt(M+2)]>>2,rt[mt++]=Q>>8&255,rt[mt++]=Q&255),rt}function k(R){return S[R>>18&63]+S[R>>12&63]+S[R>>6&63]+S[R&63]}function T(R,M,j){for(var Q,H=[],rt=M;rt<j;rt+=3)Q=(R[rt]<<16)+(R[rt+1]<<8)+R[rt+2],H.push(k(Q));return H.join("")}function N(R){for(var M,j=R.length,Q=j%3,H="",rt=[],q=16383,mt=0,ct=j-Q;mt<ct;mt+=q)rt.push(T(R,mt,mt+q>ct?ct:mt+q));return Q===1?(M=R[j-1],H+=S[M>>2],H+=S[M<<4&63],H+="=="):Q===2&&(M=(R[j-2]<<8)+R[j-1],H+=S[M>>10],H+=S[M>>4&63],H+=S[M<<2&63],H+="="),rt.push(H),rt.join("")}},function(O,w){w.read=function(_,S,L,U,I){var b,h,f=I*8-U-1,g=(1<<f)-1,s=g>>1,k=-7,T=L?I-1:0,N=L?-1:1,R=_[S+T];for(T+=N,b=R&(1<<-k)-1,R>>=-k,k+=f;k>0;b=b*256+_[S+T],T+=N,k-=8);for(h=b&(1<<-k)-1,b>>=-k,k+=U;k>0;h=h*256+_[S+T],T+=N,k-=8);if(b===0)b=1-s;else{if(b===g)return h?NaN:(R?-1:1)*(1/0);h=h+Math.pow(2,U),b=b-s}return(R?-1:1)*h*Math.pow(2,b-U)},w.write=function(_,S,L,U,I,b){var h,f,g,s=b*8-I-1,k=(1<<s)-1,T=k>>1,N=I===23?Math.pow(2,-24)-Math.pow(2,-77):0,R=U?0:b-1,M=U?1:-1,j=S<0||S===0&&1/S<0?1:0;for(S=Math.abs(S),isNaN(S)||S===1/0?(f=isNaN(S)?1:0,h=k):(h=Math.floor(Math.log(S)/Math.LN2),S*(g=Math.pow(2,-h))<1&&(h--,g*=2),h+T>=1?S+=N/g:S+=N*Math.pow(2,1-T),S*g>=2&&(h++,g/=2),h+T>=k?(f=0,h=k):h+T>=1?(f=(S*g-1)*Math.pow(2,I),h=h+T):(f=S*Math.pow(2,T-1)*Math.pow(2,I),h=0));I>=8;_[L+R]=f&255,R+=M,f/=256,I-=8);for(h=h<<I|f,s+=I;s>0;_[L+R]=h&255,R+=M,h/=256,s-=8);_[L+R-M]|=j*128}},function(O,w,_){"use strict";(function(S){var L=this&&this.__extends||function(g,s){for(var k in s)s.hasOwnProperty(k)&&(g[k]=s[k]);function T(){this.constructor=g}g.prototype=s===null?Object.create(s):(T.prototype=s.prototype,new T)},U=_(6),I=null,b=function(){function g(s,k){this.fun=s,this.array=k}return g.prototype.run=function(){this.fun.apply(null,this.array)},g}(),h=function(){function g(){this._queue=[],this._draining=!1,this._currentQueue=null,this._queueIndex=-1}return g.prototype.push=function(s){var k=this;this._queue.push(s)===1&&!this._draining&&setTimeout(function(){return k._drainQueue()},0)},g.prototype._cleanUpNextTick=function(){this._draining=!1,this._currentQueue&&this._currentQueue.length?this._queue=this._currentQueue.concat(this._queue):this._queueIndex=-1,this._queue.length&&this._drainQueue()},g.prototype._drainQueue=function(){var s=this;if(!this._draining){var k=setTimeout(function(){return s._cleanUpNextTick()});this._draining=!0;for(var T=this._queue.length;T;){for(this._currentQueue=this._queue,this._queue=[];++this._queueIndex<T;)this._currentQueue&&this._currentQueue[this._queueIndex].run();this._queueIndex=-1,T=this._queue.length}this._currentQueue=null,this._draining=!1,clearTimeout(k)}},g}(),f=function(g){L(s,g);function s(){g.apply(this,arguments),this.startTime=Date.now(),this._cwd="/",this.platform="browser",this.argv=[],this.execArgv=[],this.stdout=null,this.stderr=null,this.stdin=null,this.domain=null,this._queue=new h,this.execPath=S,this.env={},this.exitCode=0,this._gid=1,this._uid=1,this.version="v5.0",this.versions={http_parser:"0.0",node:"5.0",v8:"0.0",uv:"0.0",zlib:"0.0",ares:"0.0",icu:"0.0",modules:"0",openssl:"0.0"},this.config={target_defaults:{cflags:[],default_configuration:"Release",defines:[],include_dirs:[],libraries:[]},variables:{clang:0,host_arch:"x32",node_install_npm:!1,node_install_waf:!1,node_prefix:"",node_shared_cares:!1,node_shared_http_parser:!1,node_shared_libuv:!1,node_shared_zlib:!1,node_shared_v8:!1,node_use_dtrace:!1,node_use_etw:!1,node_use_openssl:!1,node_shared_openssl:!1,strict_aliasing:!1,target_arch:"x32",v8_use_snapshot:!1,v8_no_strict_aliasing:0,visibility:""}},this.pid=Math.random()*1e3|0,this.title="node",this.arch="x32",this._mask=18,this.connected=void 0}return s.prototype.chdir=function(k){I===null&&(I=_(13)),this._cwd=I.resolve(k)},s.prototype.cwd=function(){return this._cwd},s.prototype.uptime=function(){return(Date.now()-this.startTime)/1e3|0},s.prototype.nextTick=function(k){for(var T=[],N=1;N<arguments.length;N++)T[N-1]=arguments[N];this._queue.push(new b(k,T))},s.prototype.abort=function(){this.emit("abort")},s.prototype.exit=function(k){this.exitCode=k,this.emit("exit",[k])},s.prototype.getgid=function(){return this._gid},s.prototype.setgid=function(k){typeof k=="number"?this._gid=k:this._gid=1},s.prototype.getuid=function(){return this._uid},s.prototype.setuid=function(k){typeof k=="number"?this._uid=k:this._uid=1},s.prototype.kill=function(k,T){this.emit("kill",[k,T])},s.prototype.memoryUsage=function(){return{rss:0,heapTotal:0,heapUsed:0}},s.prototype.umask=function(k){k===void 0&&(k=this._mask);var T=this._mask;return this._mask=k,this.emit("umask",[k]),T},s.prototype.hrtime=function(){var k;typeof performance<"u"?k=performance.now():Date.now?k=Date.now():k=new Date().getTime();var T=k/1e3|0;return k-=T*1e3,k=k*1e6|0,[T,k]},s.prototype.initializeTTYs=function(){if(this.stdout===null){var k=_(23);this.stdout=new k,this.stderr=new k,this.stdin=new k}},s.prototype.disconnect=function(){},s}(U.EventEmitter);O.exports=f}).call(w,"/")},function(O,w,_){"use strict";(function(S){var L=this&&this.__extends||function(b,h){for(var f in h)h.hasOwnProperty(f)&&(b[f]=h[f]);function g(){this.constructor=b}b.prototype=h===null?Object.create(h):(g.prototype=h.prototype,new g)},U=_(24),I=function(b){L(h,b);function h(){b.call(this),this.isRaw=!1,this.columns=80,this.rows=120,this.isTTY=!0,this._bufferedWrites=[],this._waitingForWrites=!1}return h.prototype.setRawMode=function(f){this.isRaw!==f&&(this.isRaw=f,this.emit("modeChange"))},h.prototype.changeColumns=function(f){f!==this.columns&&(this.columns=f,this.emit("resize"))},h.prototype.changeRows=function(f){f!==this.rows&&(this.rows=f,this.emit("resize"))},h.isatty=function(f){return f&&f instanceof h},h.prototype._write=function(f,g,s){var k;try{var T;typeof f=="string"?T=new S(f,g):T=f,this._bufferedWrites.push(T),this._waitingForWrites&&this._read(1024)}catch(N){k=N}finally{s(k)}},h.prototype._read=function(f){if(this._bufferedWrites.length===0)this._waitingForWrites=!0;else for(;this._bufferedWrites.length>0&&(this._waitingForWrites=this.push(this._bufferedWrites.shift()),!!this._waitingForWrites););},h}(U.Duplex);O.exports=I}).call(w,_(9))},function(O,w,_){O.exports=U;var S=_(6).EventEmitter,L=_(1);L(U,S),U.Readable=_(10),U.Writable=_(30),U.Duplex=_(31),U.Transform=_(32),U.PassThrough=_(33),U.Stream=U;function U(){S.call(this)}U.prototype.pipe=function(I,b){var h=this;function f(M){I.writable&&I.write(M)===!1&&h.pause&&h.pause()}h.on("data",f);function g(){h.readable&&h.resume&&h.resume()}I.on("drain",g),!I._isStdio&&(!b||b.end!==!1)&&(h.on("end",k),h.on("close",T));var s=!1;function k(){s||(s=!0,I.end())}function T(){s||(s=!0,typeof I.destroy=="function"&&I.destroy())}function N(M){if(R(),S.listenerCount(this,"error")===0)throw M}h.on("error",N),I.on("error",N);function R(){h.removeListener("data",f),I.removeListener("drain",g),h.removeListener("end",k),h.removeListener("close",T),h.removeListener("error",N),I.removeListener("error",N),h.removeListener("end",R),h.removeListener("close",R),I.removeListener("close",R)}return h.on("end",R),h.on("close",R),I.on("close",R),I.emit("pipe",h),I}},function(O,w){var _={}.toString;O.exports=Array.isArray||function(S){return _.call(S)=="[object Array]"}},function(O,w){},function(O,w,_){"use strict";function S(I,b){if(!(I instanceof b))throw new TypeError("Cannot call a class as a function")}var L=_(11).Buffer;function U(I,b,h){I.copy(b,h)}O.exports=function(){function I(){S(this,I),this.head=null,this.tail=null,this.length=0}return I.prototype.push=function(h){var f={data:h,next:null};this.length>0?this.tail.next=f:this.head=f,this.tail=f,++this.length},I.prototype.unshift=function(h){var f={data:h,next:this.head};this.length===0&&(this.tail=f),this.head=f,++this.length},I.prototype.shift=function(){if(this.length!==0){var h=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,h}},I.prototype.clear=function(){this.head=this.tail=null,this.length=0},I.prototype.join=function(h){if(this.length===0)return"";for(var f=this.head,g=""+f.data;f=f.next;)g+=h+f.data;return g},I.prototype.concat=function(h){if(this.length===0)return L.alloc(0);if(this.length===1)return this.head.data;for(var f=L.allocUnsafe(h>>>0),g=this.head,s=0;g;)U(g.data,f,s),s+=g.data.length,g=g.next;return f},I}()},function(O,w,_){(function(S){O.exports=L;function L(I,b){if(U("noDeprecation"))return I;var h=!1;function f(){if(!h){if(U("throwDeprecation"))throw new Error(b);U("traceDeprecation")?console.trace(b):console.warn(b),h=!0}return I.apply(this,arguments)}return f}function U(I){try{if(!S.localStorage)return!1}catch{return!1}var b=S.localStorage[I];return b==null?!1:String(b).toLowerCase()==="true"}}).call(w,_(5))},function(O,w,_){"use strict";O.exports=U;var S=_(18),L=_(3);L.inherits=_(1),L.inherits(U,S);function U(I){if(!(this instanceof U))return new U(I);S.call(this,I)}U.prototype._transform=function(I,b,h){h(null,I)}},function(O,w,_){O.exports=_(12)},function(O,w,_){O.exports=_(0)},function(O,w,_){O.exports=_(10).Transform},function(O,w,_){O.exports=_(10).PassThrough},function(O,w){O.exports=function(_){return _.webpackPolyfill||(_.deprecate=function(){},_.paths=[],_.children||(_.children=[]),Object.defineProperty(_,"loaded",{enumerable:!0,get:function(){return _.l}}),Object.defineProperty(_,"id",{enumerable:!0,get:function(){return _.i}}),_.webpackPolyfill=1),_}},function(O,w,_){"use strict";var S=_(36),L=_(8),U=_(41),I=_(42),b=_(43),h=_(44),f=_(45),g=Object.prototype.toString;function s(N){if(!(this instanceof s))return new s(N);this.options=L.assign({chunkSize:16384,windowBits:0,to:""},N||{});var R=this.options;R.raw&&R.windowBits>=0&&R.windowBits<16&&(R.windowBits=-R.windowBits,R.windowBits===0&&(R.windowBits=-15)),R.windowBits>=0&&R.windowBits<16&&!(N&&N.windowBits)&&(R.windowBits+=32),R.windowBits>15&&R.windowBits<48&&(R.windowBits&15||(R.windowBits|=15)),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new h,this.strm.avail_out=0;var M=S.inflateInit2(this.strm,R.windowBits);if(M!==I.Z_OK)throw new Error(b[M]);this.header=new f,S.inflateGetHeader(this.strm,this.header)}s.prototype.push=function(N,R){var M=this.strm,j=this.options.chunkSize,Q=this.options.dictionary,H,rt,q,mt,ct,P,ht=!1;if(this.ended)return!1;rt=R===~~R?R:R===!0?I.Z_FINISH:I.Z_NO_FLUSH,typeof N=="string"?M.input=U.binstring2buf(N):g.call(N)==="[object ArrayBuffer]"?M.input=new Uint8Array(N):M.input=N,M.next_in=0,M.avail_in=M.input.length;do{if(M.avail_out===0&&(M.output=new L.Buf8(j),M.next_out=0,M.avail_out=j),H=S.inflate(M,I.Z_NO_FLUSH),H===I.Z_NEED_DICT&&Q&&(typeof Q=="string"?P=U.string2buf(Q):g.call(Q)==="[object ArrayBuffer]"?P=new Uint8Array(Q):P=Q,H=S.inflateSetDictionary(this.strm,P)),H===I.Z_BUF_ERROR&&ht===!0&&(H=I.Z_OK,ht=!1),H!==I.Z_STREAM_END&&H!==I.Z_OK)return this.onEnd(H),this.ended=!0,!1;M.next_out&&(M.avail_out===0||H===I.Z_STREAM_END||M.avail_in===0&&(rt===I.Z_FINISH||rt===I.Z_SYNC_FLUSH))&&(this.options.to==="string"?(q=U.utf8border(M.output,M.next_out),mt=M.next_out-q,ct=U.buf2string(M.output,q),M.next_out=mt,M.avail_out=j-mt,mt&&L.arraySet(M.output,M.output,q,mt,0),this.onData(ct)):this.onData(L.shrinkBuf(M.output,M.next_out))),M.avail_in===0&&M.avail_out===0&&(ht=!0)}while((M.avail_in>0||M.avail_out===0)&&H!==I.Z_STREAM_END);return H===I.Z_STREAM_END&&(rt=I.Z_FINISH),rt===I.Z_FINISH?(H=S.inflateEnd(this.strm),this.onEnd(H),this.ended=!0,H===I.Z_OK):(rt===I.Z_SYNC_FLUSH&&(this.onEnd(I.Z_OK),M.avail_out=0),!0)},s.prototype.onData=function(N){this.chunks.push(N)},s.prototype.onEnd=function(N){N===I.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=L.flattenChunks(this.chunks)),this.chunks=[],this.err=N,this.msg=this.strm.msg};function k(N,R){var M=new s(R);if(M.push(N,!0),M.err)throw M.msg||b[M.err];return M.result}function T(N,R){return R=R||{},R.raw=!0,k(N,R)}w.Inflate=s,w.inflate=k,w.inflateRaw=T,w.ungzip=k},function(O,w,_){"use strict";var S=_(8),L=_(37),U=_(38),I=_(39),b=_(40),h=0,f=1,g=2,s=4,k=5,T=6,N=0,R=1,M=2,j=-2,Q=-3,H=-4,rt=-5,q=8,mt=1,ct=2,P=3,ht=4,$=5,gt=6,It=7,vt=8,Tt=9,Lt=10,pt=11,Rt=12,Zt=13,qt=14,jt=15,oe=16,xt=17,A=18,B=19,G=20,ot=21,wt=22,_t=23,te=24,Pt=25,Ct=26,Mt=27,ut=28,x=29,m=30,X=31,et=32,v=852,l=592,c=15,E=c;function C(z){return(z>>>24&255)+(z>>>8&65280)+((z&65280)<<8)+((z&255)<<24)}function Y(){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 J(z){var K;return!z||!z.state?j:(K=z.state,z.total_in=z.total_out=K.total=0,z.msg="",K.wrap&&(z.adler=K.wrap&1),K.mode=mt,K.last=0,K.havedict=0,K.dmax=32768,K.head=null,K.hold=0,K.bits=0,K.lencode=K.lendyn=new S.Buf32(v),K.distcode=K.distdyn=new S.Buf32(l),K.sane=1,K.back=-1,N)}function St(z){var K;return!z||!z.state?j:(K=z.state,K.wsize=0,K.whave=0,K.wnext=0,J(z))}function kt(z,K){var y,st;return!z||!z.state||(st=z.state,K<0?(y=0,K=-K):(y=(K>>4)+1,K<48&&(K&=15)),K&&(K<8||K>15))?j:(st.window!==null&&st.wbits!==K&&(st.window=null),st.wrap=y,st.wbits=K,St(z))}function Ot(z,K){var y,st;return z?(st=new Y,z.state=st,st.window=null,y=kt(z,K),y!==N&&(z.state=null),y):j}function Ut(z){return Ot(z,E)}var Ft=!0,Ht,bt;function ne(z){if(Ft){var K;for(Ht=new S.Buf32(512),bt=new S.Buf32(32),K=0;K<144;)z.lens[K++]=8;for(;K<256;)z.lens[K++]=9;for(;K<280;)z.lens[K++]=7;for(;K<288;)z.lens[K++]=8;for(b(f,z.lens,0,288,Ht,0,z.work,{bits:9}),K=0;K<32;)z.lens[K++]=5;b(g,z.lens,0,32,bt,0,z.work,{bits:5}),Ft=!1}z.lencode=Ht,z.lenbits=9,z.distcode=bt,z.distbits=5}function Ie(z,K,y,st){var At,it=z.state;return it.window===null&&(it.wsize=1<<it.wbits,it.wnext=0,it.whave=0,it.window=new S.Buf8(it.wsize)),st>=it.wsize?(S.arraySet(it.window,K,y-it.wsize,it.wsize,0),it.wnext=0,it.whave=it.wsize):(At=it.wsize-it.wnext,At>st&&(At=st),S.arraySet(it.window,K,y-st,At,it.wnext),st-=At,st?(S.arraySet(it.window,K,y-st,st,0),it.wnext=st,it.whave=it.wsize):(it.wnext+=At,it.wnext===it.wsize&&(it.wnext=0),it.whave<it.wsize&&(it.whave+=At))),0}function Ge(z,K){var y,st,At,it,se,at,Xt,Z,V,Ue,Bt,lt,Ke,De,Gt=0,Dt,ee,ae,ie,Qe,Ae,Yt,ue,Qt=new S.Buf8(4),fe,pe,br=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!z||!z.state||!z.output||!z.input&&z.avail_in!==0)return j;y=z.state,y.mode===Rt&&(y.mode=Zt),se=z.next_out,At=z.output,Xt=z.avail_out,it=z.next_in,st=z.input,at=z.avail_in,Z=y.hold,V=y.bits,Ue=at,Bt=Xt,ue=N;t:for(;;)switch(y.mode){case mt:if(y.wrap===0){y.mode=Zt;break}for(;V<16;){if(at===0)break t;at--,Z+=st[it++]<<V,V+=8}if(y.wrap&2&&Z===35615){y.check=0,Qt[0]=Z&255,Qt[1]=Z>>>8&255,y.check=U(y.check,Qt,2,0),Z=0,V=0,y.mode=ct;break}if(y.flags=0,y.head&&(y.head.done=!1),!(y.wrap&1)||(((Z&255)<<8)+(Z>>8))%31){z.msg="incorrect header check",y.mode=m;break}if((Z&15)!==q){z.msg="unknown compression method",y.mode=m;break}if(Z>>>=4,V-=4,Yt=(Z&15)+8,y.wbits===0)y.wbits=Yt;else if(Yt>y.wbits){z.msg="invalid window size",y.mode=m;break}y.dmax=1<<Yt,z.adler=y.check=1,y.mode=Z&512?Lt:Rt,Z=0,V=0;break;case ct:for(;V<16;){if(at===0)break t;at--,Z+=st[it++]<<V,V+=8}if(y.flags=Z,(y.flags&255)!==q){z.msg="unknown compression method",y.mode=m;break}if(y.flags&57344){z.msg="unknown header flags set",y.mode=m;break}y.head&&(y.head.text=Z>>8&1),y.flags&512&&(Qt[0]=Z&255,Qt[1]=Z>>>8&255,y.check=U(y.check,Qt,2,0)),Z=0,V=0,y.mode=P;case P:for(;V<32;){if(at===0)break t;at--,Z+=st[it++]<<V,V+=8}y.head&&(y.head.time=Z),y.flags&512&&(Qt[0]=Z&255,Qt[1]=Z>>>8&255,Qt[2]=Z>>>16&255,Qt[3]=Z>>>24&255,y.check=U(y.check,Qt,4,0)),Z=0,V=0,y.mode=ht;case ht:for(;V<16;){if(at===0)break t;at--,Z+=st[it++]<<V,V+=8}y.head&&(y.head.xflags=Z&255,y.head.os=Z>>8),y.flags&512&&(Qt[0]=Z&255,Qt[1]=Z>>>8&255,y.check=U(y.check,Qt,2,0)),Z=0,V=0,y.mode=$;case $:if(y.flags&1024){for(;V<16;){if(at===0)break t;at--,Z+=st[it++]<<V,V+=8}y.length=Z,y.head&&(y.head.extra_len=Z),y.flags&512&&(Qt[0]=Z&255,Qt[1]=Z>>>8&255,y.check=U(y.check,Qt,2,0)),Z=0,V=0}else y.head&&(y.head.extra=null);y.mode=gt;case gt:if(y.flags&1024&&(lt=y.length,lt>at&&(lt=at),lt&&(y.head&&(Yt=y.head.extra_len-y.length,y.head.extra||(y.head.extra=new Array(y.head.extra_len)),S.arraySet(y.head.extra,st,it,lt,Yt)),y.flags&512&&(y.check=U(y.check,st,lt,it)),at-=lt,it+=lt,y.length-=lt),y.length))break t;y.length=0,y.mode=It;case It:if(y.flags&2048){if(at===0)break t;lt=0;do Yt=st[it+lt++],y.head&&Yt&&y.length<65536&&(y.head.name+=String.fromCharCode(Yt));while(Yt&&lt<at);if(y.flags&512&&(y.check=U(y.check,st,lt,it)),at-=lt,it+=lt,Yt)break t}else y.head&&(y.head.name=null);y.length=0,y.mode=vt;case vt:if(y.flags&4096){if(at===0)break t;lt=0;do Yt=st[it+lt++],y.head&&Yt&&y.length<65536&&(y.head.comment+=String.fromCharCode(Yt));while(Yt&&lt<at);if(y.flags&512&&(y.check=U(y.check,st,lt,it)),at-=lt,it+=lt,Yt)break t}else y.head&&(y.head.comment=null);y.mode=Tt;case Tt:if(y.flags&512){for(;V<16;){if(at===0)break t;at--,Z+=st[it++]<<V,V+=8}if(Z!==(y.check&65535)){z.msg="header crc mismatch",y.mode=m;break}Z=0,V=0}y.head&&(y.head.hcrc=y.flags>>9&1,y.head.done=!0),z.adler=y.check=0,y.mode=Rt;break;case Lt:for(;V<32;){if(at===0)break t;at--,Z+=st[it++]<<V,V+=8}z.adler=y.check=C(Z),Z=0,V=0,y.mode=pt;case pt:if(y.havedict===0)return z.next_out=se,z.avail_out=Xt,z.next_in=it,z.avail_in=at,y.hold=Z,y.bits=V,M;z.adler=y.check=1,y.mode=Rt;case Rt:if(K===k||K===T)break t;case Zt:if(y.last){Z>>>=V&7,V-=V&7,y.mode=Mt;break}for(;V<3;){if(at===0)break t;at--,Z+=st[it++]<<V,V+=8}switch(y.last=Z&1,Z>>>=1,V-=1,Z&3){case 0:y.mode=qt;break;case 1:if(ne(y),y.mode=G,K===T){Z>>>=2,V-=2;break t}break;case 2:y.mode=xt;break;case 3:z.msg="invalid block type",y.mode=m}Z>>>=2,V-=2;break;case qt:for(Z>>>=V&7,V-=V&7;V<32;){if(at===0)break t;at--,Z+=st[it++]<<V,V+=8}if((Z&65535)!==(Z>>>16^65535)){z.msg="invalid stored block lengths",y.mode=m;break}if(y.length=Z&65535,Z=0,V=0,y.mode=jt,K===T)break t;case jt:y.mode=oe;case oe:if(lt=y.length,lt){if(lt>at&&(lt=at),lt>Xt&&(lt=Xt),lt===0)break t;S.arraySet(At,st,it,lt,se),at-=lt,it+=lt,Xt-=lt,se+=lt,y.length-=lt;break}y.mode=Rt;break;case xt:for(;V<14;){if(at===0)break t;at--,Z+=st[it++]<<V,V+=8}if(y.nlen=(Z&31)+257,Z>>>=5,V-=5,y.ndist=(Z&31)+1,Z>>>=5,V-=5,y.ncode=(Z&15)+4,Z>>>=4,V-=4,y.nlen>286||y.ndist>30){z.msg="too many length or distance symbols",y.mode=m;break}y.have=0,y.mode=A;case A:for(;y.have<y.ncode;){for(;V<3;){if(at===0)break t;at--,Z+=st[it++]<<V,V+=8}y.lens[br[y.have++]]=Z&7,Z>>>=3,V-=3}for(;y.have<19;)y.lens[br[y.have++]]=0;if(y.lencode=y.lendyn,y.lenbits=7,fe={bits:y.lenbits},ue=b(h,y.lens,0,19,y.lencode,0,y.work,fe),y.lenbits=fe.bits,ue){z.msg="invalid code lengths set",y.mode=m;break}y.have=0,y.mode=B;case B:for(;y.have<y.nlen+y.ndist;){for(;Gt=y.lencode[Z&(1<<y.lenbits)-1],Dt=Gt>>>24,ee=Gt>>>16&255,ae=Gt&65535,!(Dt<=V);){if(at===0)break t;at--,Z+=st[it++]<<V,V+=8}if(ae<16)Z>>>=Dt,V-=Dt,y.lens[y.have++]=ae;else{if(ae===16){for(pe=Dt+2;V<pe;){if(at===0)break t;at--,Z+=st[it++]<<V,V+=8}if(Z>>>=Dt,V-=Dt,y.have===0){z.msg="invalid bit length repeat",y.mode=m;break}Yt=y.lens[y.have-1],lt=3+(Z&3),Z>>>=2,V-=2}else if(ae===17){for(pe=Dt+3;V<pe;){if(at===0)break t;at--,Z+=st[it++]<<V,V+=8}Z>>>=Dt,V-=Dt,Yt=0,lt=3+(Z&7),Z>>>=3,V-=3}else{for(pe=Dt+7;V<pe;){if(at===0)break t;at--,Z+=st[it++]<<V,V+=8}Z>>>=Dt,V-=Dt,Yt=0,lt=11+(Z&127),Z>>>=7,V-=7}if(y.have+lt>y.nlen+y.ndist){z.msg="invalid bit length repeat",y.mode=m;break}for(;lt--;)y.lens[y.have++]=Yt}}if(y.mode===m)break;if(y.lens[256]===0){z.msg="invalid code -- missing end-of-block",y.mode=m;break}if(y.lenbits=9,fe={bits:y.lenbits},ue=b(f,y.lens,0,y.nlen,y.lencode,0,y.work,fe),y.lenbits=fe.bits,ue){z.msg="invalid literal/lengths set",y.mode=m;break}if(y.distbits=6,y.distcode=y.distdyn,fe={bits:y.distbits},ue=b(g,y.lens,y.nlen,y.ndist,y.distcode,0,y.work,fe),y.distbits=fe.bits,ue){z.msg="invalid distances set",y.mode=m;break}if(y.mode=G,K===T)break t;case G:y.mode=ot;case ot:if(at>=6&&Xt>=258){z.next_out=se,z.avail_out=Xt,z.next_in=it,z.avail_in=at,y.hold=Z,y.bits=V,I(z,Bt),se=z.next_out,At=z.output,Xt=z.avail_out,it=z.next_in,st=z.input,at=z.avail_in,Z=y.hold,V=y.bits,y.mode===Rt&&(y.back=-1);break}for(y.back=0;Gt=y.lencode[Z&(1<<y.lenbits)-1],Dt=Gt>>>24,ee=Gt>>>16&255,ae=Gt&65535,!(Dt<=V);){if(at===0)break t;at--,Z+=st[it++]<<V,V+=8}if(ee&&!(ee&240)){for(ie=Dt,Qe=ee,Ae=ae;Gt=y.lencode[Ae+((Z&(1<<ie+Qe)-1)>>ie)],Dt=Gt>>>24,ee=Gt>>>16&255,ae=Gt&65535,!(ie+Dt<=V);){if(at===0)break t;at--,Z+=st[it++]<<V,V+=8}Z>>>=ie,V-=ie,y.back+=ie}if(Z>>>=Dt,V-=Dt,y.back+=Dt,y.length=ae,ee===0){y.mode=Ct;break}if(ee&32){y.back=-1,y.mode=Rt;break}if(ee&64){z.msg="invalid literal/length code",y.mode=m;break}y.extra=ee&15,y.mode=wt;case wt:if(y.extra){for(pe=y.extra;V<pe;){if(at===0)break t;at--,Z+=st[it++]<<V,V+=8}y.length+=Z&(1<<y.extra)-1,Z>>>=y.extra,V-=y.extra,y.back+=y.extra}y.was=y.length,y.mode=_t;case _t:for(;Gt=y.distcode[Z&(1<<y.distbits)-1],Dt=Gt>>>24,ee=Gt>>>16&255,ae=Gt&65535,!(Dt<=V);){if(at===0)break t;at--,Z+=st[it++]<<V,V+=8}if(!(ee&240)){for(ie=Dt,Qe=ee,Ae=ae;Gt=y.distcode[Ae+((Z&(1<<ie+Qe)-1)>>ie)],Dt=Gt>>>24,ee=Gt>>>16&255,ae=Gt&65535,!(ie+Dt<=V);){if(at===0)break t;at--,Z+=st[it++]<<V,V+=8}Z>>>=ie,V-=ie,y.back+=ie}if(Z>>>=Dt,V-=Dt,y.back+=Dt,ee&64){z.msg="invalid distance code",y.mode=m;break}y.offset=ae,y.extra=ee&15,y.mode=te;case te:if(y.extra){for(pe=y.extra;V<pe;){if(at===0)break t;at--,Z+=st[it++]<<V,V+=8}y.offset+=Z&(1<<y.extra)-1,Z>>>=y.extra,V-=y.extra,y.back+=y.extra}if(y.offset>y.dmax){z.msg="invalid distance too far back",y.mode=m;break}y.mode=Pt;case Pt:if(Xt===0)break t;if(lt=Bt-Xt,y.offset>lt){if(lt=y.offset-lt,lt>y.whave&&y.sane){z.msg="invalid distance too far back",y.mode=m;break}lt>y.wnext?(lt-=y.wnext,Ke=y.wsize-lt):Ke=y.wnext-lt,lt>y.length&&(lt=y.length),De=y.window}else De=At,Ke=se-y.offset,lt=y.length;lt>Xt&&(lt=Xt),Xt-=lt,y.length-=lt;do At[se++]=De[Ke++];while(--lt);y.length===0&&(y.mode=ot);break;case Ct:if(Xt===0)break t;At[se++]=y.length,Xt--,y.mode=ot;break;case Mt:if(y.wrap){for(;V<32;){if(at===0)break t;at--,Z|=st[it++]<<V,V+=8}if(Bt-=Xt,z.total_out+=Bt,y.total+=Bt,Bt&&(z.adler=y.check=y.flags?U(y.check,At,Bt,se-Bt):L(y.check,At,Bt,se-Bt)),Bt=Xt,(y.flags?Z:C(Z))!==y.check){z.msg="incorrect data check",y.mode=m;break}Z=0,V=0}y.mode=ut;case ut:if(y.wrap&&y.flags){for(;V<32;){if(at===0)break t;at--,Z+=st[it++]<<V,V+=8}if(Z!==(y.total&4294967295)){z.msg="incorrect length check",y.mode=m;break}Z=0,V=0}y.mode=x;case x:ue=R;break t;case m:ue=Q;break t;case X:return H;case et:default:return j}return z.next_out=se,z.avail_out=Xt,z.next_in=it,z.avail_in=at,y.hold=Z,y.bits=V,(y.wsize||Bt!==z.avail_out&&y.mode<m&&(y.mode<Mt||K!==s))&&Ie(z,z.output,z.next_out,Bt-z.avail_out)?(y.mode=X,H):(Ue-=z.avail_in,Bt-=z.avail_out,z.total_in+=Ue,z.total_out+=Bt,y.total+=Bt,y.wrap&&Bt&&(z.adler=y.check=y.flags?U(y.check,At,Bt,z.next_out-Bt):L(y.check,At,Bt,z.next_out-Bt)),z.data_type=y.bits+(y.last?64:0)+(y.mode===Rt?128:0)+(y.mode===G||y.mode===jt?256:0),(Ue===0&&Bt===0||K===s)&&ue===N&&(ue=rt),ue)}function xr(z){if(!z||!z.state)return j;var K=z.state;return K.window&&(K.window=null),z.state=null,N}function Je(z,K){var y;return!z||!z.state||(y=z.state,!(y.wrap&2))?j:(y.head=K,K.done=!1,N)}function Fr(z,K){var y=K.length,st,At,it;return!z||!z.state||(st=z.state,st.wrap!==0&&st.mode!==pt)?j:st.mode===pt&&(At=1,At=L(At,K,y,0),At!==st.check)?Q:(it=Ie(z,K,y,y),it?(st.mode=X,H):(st.havedict=1,N))}w.inflateReset=St,w.inflateReset2=kt,w.inflateResetKeep=J,w.inflateInit=Ut,w.inflateInit2=Ot,w.inflate=Ge,w.inflateEnd=xr,w.inflateGetHeader=Je,w.inflateSetDictionary=Fr,w.inflateInfo="pako inflate (from Nodeca project)"},function(O,w,_){"use strict";function S(L,U,I,b){for(var h=L&65535|0,f=L>>>16&65535|0,g=0;I!==0;){g=I>2e3?2e3:I,I-=g;do h=h+U[b++]|0,f=f+h|0;while(--g);h%=65521,f%=65521}return h|f<<16|0}O.exports=S},function(O,w,_){"use strict";function S(){for(var I,b=[],h=0;h<256;h++){I=h;for(var f=0;f<8;f++)I=I&1?3988292384^I>>>1:I>>>1;b[h]=I}return b}var L=S();function U(I,b,h,f){var g=L,s=f+h;I^=-1;for(var k=f;k<s;k++)I=I>>>8^g[(I^b[k])&255];return I^-1}O.exports=U},function(O,w,_){"use strict";var S=30,L=12;O.exports=function(I,b){var h,f,g,s,k,T,N,R,M,j,Q,H,rt,q,mt,ct,P,ht,$,gt,It,vt,Tt,Lt,pt;h=I.state,f=I.next_in,Lt=I.input,g=f+(I.avail_in-5),s=I.next_out,pt=I.output,k=s-(b-I.avail_out),T=s+(I.avail_out-257),N=h.dmax,R=h.wsize,M=h.whave,j=h.wnext,Q=h.window,H=h.hold,rt=h.bits,q=h.lencode,mt=h.distcode,ct=(1<<h.lenbits)-1,P=(1<<h.distbits)-1;t:do{rt<15&&(H+=Lt[f++]<<rt,rt+=8,H+=Lt[f++]<<rt,rt+=8),ht=q[H&ct];e:for(;;){if($=ht>>>24,H>>>=$,rt-=$,$=ht>>>16&255,$===0)pt[s++]=ht&65535;else if($&16){gt=ht&65535,$&=15,$&&(rt<$&&(H+=Lt[f++]<<rt,rt+=8),gt+=H&(1<<$)-1,H>>>=$,rt-=$),rt<15&&(H+=Lt[f++]<<rt,rt+=8,H+=Lt[f++]<<rt,rt+=8),ht=mt[H&P];r:for(;;){if($=ht>>>24,H>>>=$,rt-=$,$=ht>>>16&255,$&16){if(It=ht&65535,$&=15,rt<$&&(H+=Lt[f++]<<rt,rt+=8,rt<$&&(H+=Lt[f++]<<rt,rt+=8)),It+=H&(1<<$)-1,It>N){I.msg="invalid distance too far back",h.mode=S;break t}if(H>>>=$,rt-=$,$=s-k,It>$){if($=It-$,$>M&&h.sane){I.msg="invalid distance too far back",h.mode=S;break t}if(vt=0,Tt=Q,j===0){if(vt+=R-$,$<gt){gt-=$;do pt[s++]=Q[vt++];while(--$);vt=s-It,Tt=pt}}else if(j<$){if(vt+=R+j-$,$-=j,$<gt){gt-=$;do pt[s++]=Q[vt++];while(--$);if(vt=0,j<gt){$=j,gt-=$;do pt[s++]=Q[vt++];while(--$);vt=s-It,Tt=pt}}}else if(vt+=j-$,$<gt){gt-=$;do pt[s++]=Q[vt++];while(--$);vt=s-It,Tt=pt}for(;gt>2;)pt[s++]=Tt[vt++],pt[s++]=Tt[vt++],pt[s++]=Tt[vt++],gt-=3;gt&&(pt[s++]=Tt[vt++],gt>1&&(pt[s++]=Tt[vt++]))}else{vt=s-It;do pt[s++]=pt[vt++],pt[s++]=pt[vt++],pt[s++]=pt[vt++],gt-=3;while(gt>2);gt&&(pt[s++]=pt[vt++],gt>1&&(pt[s++]=pt[vt++]))}}else if($&64){I.msg="invalid distance code",h.mode=S;break t}else{ht=mt[(ht&65535)+(H&(1<<$)-1)];continue r}break}}else if($&64)if($&32){h.mode=L;break t}else{I.msg="invalid literal/length code",h.mode=S;break t}else{ht=q[(ht&65535)+(H&(1<<$)-1)];continue e}break}}while(f<g&&s<T);gt=rt>>3,f-=gt,rt-=gt<<3,H&=(1<<rt)-1,I.next_in=f,I.next_out=s,I.avail_in=f<g?5+(g-f):5-(f-g),I.avail_out=s<T?257+(T-s):257-(s-T),h.hold=H,h.bits=rt}},function(O,w,_){"use strict";var S=_(8),L=15,U=852,I=592,b=0,h=1,f=2,g=[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],s=[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],k=[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],T=[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];O.exports=function(R,M,j,Q,H,rt,q,mt){var ct=mt.bits,P=0,ht=0,$=0,gt=0,It=0,vt=0,Tt=0,Lt=0,pt=0,Rt=0,Zt,qt,jt,oe,xt,A=null,B=0,G,ot=new S.Buf16(L+1),wt=new S.Buf16(L+1),_t=null,te=0,Pt,Ct,Mt;for(P=0;P<=L;P++)ot[P]=0;for(ht=0;ht<Q;ht++)ot[M[j+ht]]++;for(It=ct,gt=L;gt>=1&&ot[gt]===0;gt--);if(It>gt&&(It=gt),gt===0)return H[rt++]=1<<24|64<<16|0,H[rt++]=1<<24|64<<16|0,mt.bits=1,0;for($=1;$<gt&&ot[$]===0;$++);for(It<$&&(It=$),Lt=1,P=1;P<=L;P++)if(Lt<<=1,Lt-=ot[P],Lt<0)return-1;if(Lt>0&&(R===b||gt!==1))return-1;for(wt[1]=0,P=1;P<L;P++)wt[P+1]=wt[P]+ot[P];for(ht=0;ht<Q;ht++)M[j+ht]!==0&&(q[wt[M[j+ht]]++]=ht);if(R===b?(A=_t=q,G=19):R===h?(A=g,B-=257,_t=s,te-=257,G=256):(A=k,_t=T,G=-1),Rt=0,ht=0,P=$,xt=rt,vt=It,Tt=0,jt=-1,pt=1<<It,oe=pt-1,R===h&&pt>U||R===f&&pt>I)return 1;for(;;){Pt=P-Tt,q[ht]<G?(Ct=0,Mt=q[ht]):q[ht]>G?(Ct=_t[te+q[ht]],Mt=A[B+q[ht]]):(Ct=32+64,Mt=0),Zt=1<<P-Tt,qt=1<<vt,$=qt;do qt-=Zt,H[xt+(Rt>>Tt)+qt]=Pt<<24|Ct<<16|Mt|0;while(qt!==0);for(Zt=1<<P-1;Rt&Zt;)Zt>>=1;if(Zt!==0?(Rt&=Zt-1,Rt+=Zt):Rt=0,ht++,--ot[P]===0){if(P===gt)break;P=M[j+q[ht]]}if(P>It&&(Rt&oe)!==jt){for(Tt===0&&(Tt=It),xt+=$,vt=P-Tt,Lt=1<<vt;vt+Tt<gt&&(Lt-=ot[vt+Tt],!(Lt<=0));)vt++,Lt<<=1;if(pt+=1<<vt,R===h&&pt>U||R===f&&pt>I)return 1;jt=Rt&oe,H[jt]=It<<24|vt<<16|xt-rt|0}}return Rt!==0&&(H[xt+Rt]=P-Tt<<24|64<<16|0),mt.bits=It,0}},function(O,w,_){"use strict";var S=_(8),L=!0,U=!0;try{String.fromCharCode.apply(null,[0])}catch{L=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{U=!1}for(var I=new S.Buf8(256),b=0;b<256;b++)I[b]=b>=252?6:b>=248?5:b>=240?4:b>=224?3:b>=192?2:1;I[254]=I[254]=1,w.string2buf=function(f){var g,s,k,T,N,R=f.length,M=0;for(T=0;T<R;T++)s=f.charCodeAt(T),(s&64512)===55296&&T+1<R&&(k=f.charCodeAt(T+1),(k&64512)===56320&&(s=65536+(s-55296<<10)+(k-56320),T++)),M+=s<128?1:s<2048?2:s<65536?3:4;for(g=new S.Buf8(M),N=0,T=0;N<M;T++)s=f.charCodeAt(T),(s&64512)===55296&&T+1<R&&(k=f.charCodeAt(T+1),(k&64512)===56320&&(s=65536+(s-55296<<10)+(k-56320),T++)),s<128?g[N++]=s:s<2048?(g[N++]=192|s>>>6,g[N++]=128|s&63):s<65536?(g[N++]=224|s>>>12,g[N++]=128|s>>>6&63,g[N++]=128|s&63):(g[N++]=240|s>>>18,g[N++]=128|s>>>12&63,g[N++]=128|s>>>6&63,g[N++]=128|s&63);return g};function h(f,g){if(g<65537&&(f.subarray&&U||!f.subarray&&L))return String.fromCharCode.apply(null,S.shrinkBuf(f,g));for(var s="",k=0;k<g;k++)s+=String.fromCharCode(f[k]);return s}w.buf2binstring=function(f){return h(f,f.length)},w.binstring2buf=function(f){for(var g=new S.Buf8(f.length),s=0,k=g.length;s<k;s++)g[s]=f.charCodeAt(s);return g},w.buf2string=function(f,g){var s,k,T,N,R=g||f.length,M=new Array(R*2);for(k=0,s=0;s<R;){if(T=f[s++],T<128){M[k++]=T;continue}if(N=I[T],N>4){M[k++]=65533,s+=N-1;continue}for(T&=N===2?31:N===3?15:7;N>1&&s<R;)T=T<<6|f[s++]&63,N--;if(N>1){M[k++]=65533;continue}T<65536?M[k++]=T:(T-=65536,M[k++]=55296|T>>10&1023,M[k++]=56320|T&1023)}return h(M,k)},w.utf8border=function(f,g){var s;for(g=g||f.length,g>f.length&&(g=f.length),s=g-1;s>=0&&(f[s]&192)===128;)s--;return s<0||s===0?g:s+I[f[s]]>g?s:g}},function(O,w,_){"use strict";O.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}},function(O,w,_){"use strict";O.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"}},function(O,w,_){"use strict";function S(){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}O.exports=S},function(O,w,_){"use strict";function S(){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}O.exports=S}])})});var Pi=bi((Fu,ks)=>{ks.exports={name:"@osgearthwasm/model-osgearthwasm",version:"0.1.17",private:!0,type:"module",main:"lib/model-osgearthwasm.js",types:"lib/model-osgearthwasm.d.ts",scripts:{build:"heft build --clean && echo FIXME",test:"heft test --clean","upgrade-project":"upgrade-project"},dependencies:{"@osgearthwasm/model-emscripten":"workspace:*","wasm-feature-detect":"1.5.0"},devDependencies:{"@osgearthwasm/build-rig":"workspace:*","@osgearthwasm/build-common":"workspace:*","@osgearthwasm/build-upgrade":"workspace:*",typescript:"4.8.4","@rushstack/heft":"0.49.7","@microsoft/rush-lib":"5.87.0","@types/node":"18.13.0","@types/heft-jest":"1.0.3"}}});var Ze;(function(O){O.node="node",O.browser="browser"})(Ze||(Ze={}));var Ye;(function(O){O.release="release",O.test="test",O.dev="dev",O.debug="debug"})(Ye||(Ye={}));var we;(function(O){O.single="single",O.multi="multi"})(we||(we={}));var Ne=class{constructor(w,_,S,L={}){this.platform=w,this.buildType=_,this.threadingModel=S,this.variables=L}};var Fe;(function(O){O.LOAD="LOAD",O.READY="READY",O.START="START",O.CREATE="CREATE",O.BOOT="BOOT",O.SETUP="SETUP",O.INIT="INIT",O.RUN="RUN"})(Fe||(Fe={}));var ki=()=>(async O=>{try{return(await WebAssembly.instantiate(O)).instance.exports.b(BigInt(0))===BigInt(0)}catch{return!1}})(new Uint8Array([0,97,115,109,1,0,0,0,1,6,1,96,1,126,1,126,3,2,1,0,7,5,1,1,98,0,0,10,6,1,4,0,32,0,11]));var Oi=async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,10,8,1,6,0,6,64,25,11,11]));var Ri=()=>(async O=>{try{return typeof MessageChannel<"u"&&new MessageChannel().port1.postMessage(new SharedArrayBuffer(1)),WebAssembly.validate(O)}catch{return!1}})(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,4,1,3,1,1,10,11,1,9,0,65,0,254,16,2,0,26,11]));var be=class extends Error{constructor(w){super(w),Object.setPrototypeOf(this,be.prototype)}};function ps(){try{if(typeof WebAssembly=="object"&&typeof WebAssembly.instantiate=="function"){let O=new WebAssembly.Module(Uint8Array.of(0,97,115,109,1,0,0,0));if(O instanceof WebAssembly.Module)return new WebAssembly.Instance(O)instanceof WebAssembly.Instance}}catch{return!1}return!0}async function ds(O=!0){if(!ps()){if(O)throw new be("WebAssembly is not supported");return!1}return!0}async function ys(O=!0){if(!document.createElement("canvas").getContext("webgl2")){if(O)throw new be("WebGL 2 is not supported");return!1}return!0}async function vs(O=!0){if(!await ki()){if(O)throw new be("WebAssembly big ints are not supported");return!1}return!0}async function gs(O=!0){if(!await Oi()){if(O)throw new be("WebAssembly native exceptions are not supported");return!1}return!0}async function ws(O=!0){if(!await Ri()){if(O)throw new be("WebAssembly threads are not supported");return!1}return!0}function ms(){return typeof document.createElement("canvas").transferControlToOffscreen=="function"}async function _s(O=!0){if(!ms()){if(O)throw new be("OffscreenCanvas is not supported");return!1}return!0}async function rn(O=!0){return(await Promise.all([ds(),ys(),vs(),gs()])).every(_=>_===!0)}async function Ti(O=!0){return(await Promise.all([rn(),_s(),ws()])).every(_=>_===!0)}async function _r(O={}){let w={...O.variables||{}};if(!O.platform||O.platform==="browser"){let _=Ze.browser;if(await rn()){let S=O.buildType||Ye.release;if(O.threadingModel===we.single)return new Ne(_,S,we.single,w);if(await Ti())return new Ne(_,S,we.multi,w);if(O.threadingModel===we.multi)throw new Error("OffscreenCanvas not supported");return new Ne(_,S,we.single,w)}else throw new Error("WebAssembly engine is not supported")}else return new Ne(Ze.node,O.buildType||Ye.release,we.multi,w)}var nn={silent:!0,onStatus:O=>{}};function Li(O){return{...nn,...O}}function Ni(O){let w=document.createElement("canvas");return w.id=window.crypto.randomUUID().split("-")[-1],O.appendChild(w),w}function Ss(){return typeof process<"u"&&process.release.name==="node"}function on(O){return[]}function an(O){return[function(w){w.NODEFS&&Ss()&&(w.FS.mkdir("/osgearthwasm"),w.FS.mount(w.NODEFS,{root:"."},"/osgearthwasm"))},function(w){for(let[_,S]of Object.entries((O==null?void 0:O.environmentVariables)||{}))w.ENV[_]=S}]}function sn(O){return[]}function Di(O){return O.oncontextmenu=function(w){w.preventDefault(),w.stopPropagation()},O.addEventListener("webglcontextlost",w=>{console.error("WebGL context lost. You will need to reload the page."),w.preventDefault()},!1),O}function Ci(O){return new Promise(async(w,_)=>{let S=await Promise.resolve().then(()=>Ii(Ai(),1));S.configure({fs:"MountableFileSystem",options:{"/volatile":{fs:"InMemory"},"/static":{fs:"LocalStorage"}}},async function(L){if(L)throw L;let U=O.FS,I=O.PATH,b=O.ERRNO_CODES,h=S.BFSRequire("fs"),f=S.BFSRequire("path"),g=new S.EmscriptenFS(U,I,b);U.mkdir("/static"),U.mount(g,{root:"/static"},"/static"),U.mkdir("/volatile"),U.mount(g,{root:"/volatile"},"/volatile"),w(h)})})}function fn(O,w="{}",_=nn,S={}){return new Promise(async(L,U)=>{let I;typeof O=="string"?I=Es(O):I=O,xs(I);let b=Li(_),h=await _r(S),f=Ni(I);try{let g=(await new Function(`return import("${b.baseUrl}/${b.runtime||"runtime-unkown"}.runtime-${h.threadingModel.toLocaleLowerCase()}-${h.buildType.toLocaleLowerCase()}.js")`)()).default,s={environmentVariables:h==null?void 0:h.variables},k=await g({locateFile:N=>`${b.baseUrl}/`+N,preInit:on(s),preRun:an(s),postRun:sn(s),canvas:Di(f)}),T=await Ci(k);k.run(f.id,w),L({module:k,fs:T})}catch(g){U(g)}})}var qe=class extends Error{constructor(w){super(w),Object.setPrototypeOf(this,qe.prototype)}};function Es(O){let w=document.querySelector(O);if(!w)throw new qe(`Could not find HTML element with selector "${O}"`);if(!(w instanceof HTMLDivElement))throw new qe(`HTML element with selector "${O}" is not an HTMLDivElement`);return w}function xs(O){if(O.childElementCount>0)throw new qe("HTML element is not empty")}function Mi(){let O=new Date().getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(w){var _=(O+Math.random()*16)%16|0;return O=Math.floor(O/16),(w=="x"?_:_&3|8).toString(16)})}var Er=class{constructor(w,_){this.api=w,this.runtime=_}echo(w){return this.api._echo(w)}addEventListener(w,_){this.api._addEventListener(w,_)}invokeAlgorithmFunc(w,_){this.api._invokeAlgorithmFunc(w,_)}flyToPoint(w,_,S=5e5,L=2){this.api._flyToPoint(w,_,S,L)}flyToBox(w,_,S,L,U=2){this.api._flyToBox(w,_,S,L,U)}getViewpoint(){let w=this.api._getViewpoint();return{longitude:w.longitude,latitude:w.latitude,altitude:w.altitude,heading:w.heading,pitch:Math.round(w.pitch),range:w.range}}setViewpoint(w,_=2){this.api._setViewpoint(w,_)}setLighting(w){this.api._setLighting(w)}setDateTime(w,_,S,L){this.api._setDateTime(w,_,S,L)}addMap(w,_,S){this.api._addMap(w,_,S)}setDate(w){this.api._setDateTime(w.getFullYear(),w.getMonth()+1,w.getDay()+1,w.getHours()+Math.round(w.getMinutes()/60*100+Number.EPSILON)/100)}async addEarthFile(w){let _=this.runtime.module.FS;return new Promise((S,L)=>{let U=Mi();_.mkdir(`/${U}`);let I=Mi(),b=`${U}/${I}.earth`;var h=new TextEncoder;let f=h.encode(w),g=_.open(b,"w+");_.write(g,f,0,f.length,0),_.close(g),this.api._addMap(b,()=>{S()},s=>{console.warn(s),L()})})}isLayerOpen(w){return this.api._isLayerOpen(w)}openLayer(w){this.api._openLayer(w)}closeLayer(w){this.api._closeLayer(w)}setOpacity(w,_){this.api._setOpacity(w,_)}};var Mr={styleFunction(O,w="style"){return`
    <script language="javascript">
      <![CDATA[
        function ${w}() {
          return new Function(feature, \`
            const ${w}Eval = + \\\`${O.toString().replace("`","\\`")}\\\`;
            return ${w}Eval.apply(this, [feature]);\`
          )(feature);
        }
      ]]>
    <\/script>
  `.trim()}};var ar=class{constructor(w,_,S){this.options={...w,runtime:"runtime-osgearth-offscreen"},this.environment=_,this.onStatus(Fe.READY),this.shell=S,this.util=Mr,this._ready=new Promise(L=>{this._resolve=L})}API(w="Api"){let _=Object.keys(this.runtime.module).filter(S=>S===w);return _.length>0?new this.runtime.module[_[0]]:null}onStatus(w){let _=Fe[w];_===Fe.RUN&&this._resolve!==void 0&&this._resolve(!0),this.options.onStatus&&this.options.onStatus(_)}async init(w,_){this.onStatus(Fe.START),this.runtime=await fn(this.shell,_,this.options,this.environment);let S=this.API(w);if(S)S._addEventListener("status",L=>(this.onStatus(L),0)),S._addEventListener("error",L=>(console.error(L),0)),await this._ready,this.api=new Er(S,this.runtime);else throw new Error(`API '${w}' not available in runtime`)}};function Ui(O){console.log(bs(O))}function bs(O){let w=Is;return O&&(w+=`
 (v${O})`),`${w}

`}var Is=` _______  _______  _______  _______  _______  ______    _______  __   __  _     _  _______  _______  __   __ 
|       ||       ||       ||       ||   _   ||    _ |  |       ||  | |  || | _ | ||   _   ||       ||  |_|  |
|   _   ||  _____||    ___||    ___||  |_|  ||   | ||  |_     _||  |_|  || || || ||  |_|  ||  _____||       |
|  | |  || |_____ |   | __ |   |___ |       ||   |_||_   |   |  |       ||       ||       || |_____ |       |
|  |_|  ||_____  ||   ||  ||    ___||       ||    __  |  |   |  |       ||       ||       ||_____  ||       |
|       | _____| ||   |_| ||   |___ |   _   ||   |  | |  |   |  |   _   ||   _   ||   _   | _____| || ||_|| |
|_______||_______||_______||_______||__| |__||___|  |_|  |___|  |__| |__||__| |__||__| |__||_______||_|   |_|`;async function ji(O,w="{}",_={runtime:"runtime-osgearth-offscreen"},S={}){_.silent||Ui(await Os());let L=await _r(S),U;typeof O=="string"?U=Rs(O):U=O,Ts(U);let I=new ar(_,L,U);return await I.init("OsgEarthApi",w),I}var Xe=class extends Error{constructor(w){super(w),Object.setPrototypeOf(this,Xe.prototype)}};async function Os(O=void 0){let w;if(O)w=O;else try{let _=await Promise.resolve().then(()=>Ii(Pi(),1));_!=null&&_.version&&(w=_.version)}catch{}return w}function Rs(O){let w=document.querySelector(O);if(!w)throw new Xe(`Could not find HTML element with selector "${O}"`);if(!(w instanceof HTMLDivElement))throw new Xe(`HTML element with selector "${O}" is not an HTMLDivElement`);return w}function Ts(O){if(O.childElementCount>0)throw new Xe("HTML element is not empty")}export{Ye as BuildType,Fe as EmscriptenRuntimeStatus,Ne as Environment,ar as Globe,Mr as OsgEarthUtil,Ze as Platform,we as ThreadingModel,ji as osgearthwasm};
/*! Bundled license information:

browserfs/dist/browserfs.js:
  (*!
   * The buffer module from node.js, for the browser.
   *
   * @author   Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
   * @license  MIT
   *)
*/
//# sourceMappingURL=osgearthwasm.js.map