!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.BrowserFS=e():t.BrowserFS=e()}(this,function(){return function(t){function e(r){if(n[r])return n[r].exports;var i=n[r]={exports:{},id:r,loaded:!1};return t[r].call(i.exports,i,i.exports,e),i.loaded=!0,i.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e,n){(function(t,r,i,o){"use strict";function s(t){if(t)return t;throw new me(ge.EIO,"Initialize BrowserFS with a file system using BrowserFS.initialize(filesystem)")}function a(t,e){switch(typeof t){case"number":return t;case"string":var n=parseInt(t,8);return isNaN(n)?e:n;default:return e}}function c(t){if(t instanceof Date)return t;if("number"==typeof t)return new Date(1e3*t);throw new me(ge.EINVAL,"Invalid time.")}function u(t){if(t.indexOf("\0")>=0)throw new me(ge.EINVAL,"Path must be a string without null bytes.");if(""===t)throw new me(ge.EINVAL,"Path must not be empty.");return ye.resolve(t)}function f(t,e,n,r){switch(typeof t){case"object":return{encoding:"undefined"!=typeof t.encoding?t.encoding:e,flag:"undefined"!=typeof t.flag?t.flag:n,mode:a(t.mode,r)};case"string":return{encoding:t,flag:n,mode:r};default:return{encoding:e,flag:n,mode:r}}}function h(){}function p(){throw new Error("BFS has reached an impossible code path; please file a bug.")}function l(t,e,n){n.existsSync(t)||(l(ye.dirname(t),e,n),n.mkdirSync(t,e))}function d(t){var e=y(t),n=e.byteOffset,r=e.byteLength;return 0===n&&r===e.buffer.byteLength?e.buffer:e.buffer.slice(n,n+r)}function y(t){return t instanceof Uint8Array?t:new Uint8Array(t)}function g(t){return t instanceof r?t:t instanceof Uint8Array?_(t):new r(t)}function _(t){return t instanceof r?t:0===t.byteOffset&&t.byteLength===t.buffer.byteLength?v(t.buffer):new r(t)}function v(t){try{return new r(t)}catch(e){return new r(new Uint8Array(t))}}function w(t,e,n){if(void 0===e&&(e=0),void 0===n&&(n=t.length),e<0||n<0||n>t.length||e>n)throw new TypeError("Invalid slice bounds on buffer of length "+t.length+": ["+e+", "+n+"]");if(0===t.length)return new r(0);var i=y(t),o=t[0],s=(o+1)%255;return t[0]=s,i[0]===s?(i[0]=o,_(i.slice(e,n))):(t[0]=o,_(i.subarray(e,n)))}function m(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}function E(t,e,n){return e=Ve(void 0===e?t.length-1:e,0),function(){for(var r=arguments,i=-1,o=Ve(r.length-e,0),s=Array(o);++i-1&&t%1==0&&t<=un}function T(t){return null!=t&&L(t.length)&&!N(t)}function x(){}function D(t){return function(){if(null!==t){var e=t;t=null,e.apply(this,arguments)}}}function A(t,e){for(var n=-1,r=Array(t);++n-1&&t%1==0&&t0?"/"+i.join("/"):e)}function _t(t,e){if(null!==e&&"object"==typeof e){var n=e,r=n.path;r&&(r="/"+ye.relative(t,r),n.message=n.message.replace(n.path,r),n.path=r)}return e}function vt(t,e){return"function"==typeof e?function(n){arguments.length>0&&(arguments[0]=_t(t,n)),e.apply(null,arguments)}:e}function wt(t,e,n){return"Sync"!==t.slice(t.length-4)?function(){return arguments.length>0&&(e&&(arguments[0]=ye.join(this._folder,arguments[0])),n&&(arguments[1]=ye.join(this._folder,arguments[1])),arguments[arguments.length-1]=vt(this._folder,arguments[arguments.length-1])),this._wrapped[t].apply(this._wrapped,arguments)}:function(){try{return e&&(arguments[0]=ye.join(this._folder,arguments[0])),n&&(arguments[1]=ye.join(this._folder,arguments[1])),this._wrapped[t].apply(this._wrapped,arguments)}catch(t){throw _t(this._folder,t)}}}function mt(t){return t.isDirectory}function Et(t,e,n,r){if("undefined"!=typeof navigator.webkitPersistentStorage)switch(t){case _e.PERSISTENT:navigator.webkitPersistentStorage.requestQuota(e,n,r);break;case _e.TEMPORARY:navigator.webkitTemporaryStorage.requestQuota(e,n,r);break;default:r(new TypeError("Invalid storage type: "+t))}else _e.webkitStorageInfo.requestQuota(t,e,n,r)}function St(t){return Array.prototype.slice.call(t||[],0)}function bt(t,e,n){switch(t.name){case"PathExistsError":return me.EEXIST(e);case"QuotaExceededError":return me.FileError(ge.ENOSPC,e);case"NotFoundError":return me.ENOENT(e);case"SecurityError":return me.FileError(ge.EACCES,e);case"InvalidModificationError":return me.FileError(ge.EPERM,e);case"TypeMismatchError":return me.FileError(n?ge.ENOTDIR:ge.EISDIR,e);case"EncodingError":case"InvalidStateError":case"NoModificationAllowedError":default:return me.FileError(ge.EINVAL,e)}}function kt(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var e=16*Math.random()|0,n="x"===t?e:3&e|8;return n.toString(16)})}function It(t,e){return!t||(e(t),!1)}function Ot(t,e,n){return!t||(e.abort(function(){n(t)}),!1)}function Ft(t,e){switch(void 0===e&&(e=t.toString()),t.name){case"NotFoundError":return new me(ge.ENOENT,e);case"QuotaExceededError":return new me(ge.ENOSPC,e);default:return new me(ge.EIO,e)}}function Rt(t,e,n){return void 0===e&&(e=ge.EIO),void 0===n&&(n=null),function(r){r.preventDefault(),t(new me(e,null!==n?n:void 0))}}function Nt(t,e,n){return e?function(){for(var e=[],n=arguments.length;n--;)e[n]=arguments[n];var r=e[0],i=this._getFs(r);e[0]=i.path;try{return i.fs[t].apply(i.fs,e)}catch(t){throw this.standardizeError(t,i.path,r),t}}:function(){for(var e=this,n=[],r=arguments.length;r--;)n[r]=arguments[r];var i=n[0],o=this._getFs(i);if(n[0]=o.path,"function"==typeof n[n.length-1]){var s=n[n.length-1];n[n.length-1]=function(){for(var t=[],n=arguments.length;n--;)t[n]=arguments[n];t.length>0&&t[0]instanceof me&&e.standardizeError(t[0],o.path,i),s.apply(null,t)}}return o.fs[t].apply(o.fs,n)}}function Lt(t){return 146|t}function Tt(t){return Se.getFileFlag(t)}function xt(t){return{type:mi.API_ERROR,errorData:jt(t.writeToBuffer())}}function Dt(t){return me.fromBuffer(zt(t.errorData))}function At(t){return{type:mi.ERROR,name:t.name,message:t.message,stack:t.stack}}function Pt(t){var e=_e[t.name];"function"!=typeof e&&(e=Error);var n=new e(t.message);return n.stack=t.stack,n}function Ct(t){return{type:mi.STATS,statsData:jt(t.toBuffer())}}function Ut(t){return ke.fromBuffer(zt(t.statsData))}function Mt(t){return{type:mi.FILEFLAG,flagStr:t.getFlagString()}}function Bt(t){return Se.getFileFlag(t.flagStr)}function jt(t){return d(t)}function zt(t){return v(t)}function qt(t){return{type:mi.BUFFER,data:jt(t)}}function Vt(t){return zt(t.data)}function Wt(t){return t&&"object"==typeof t&&t.hasOwnProperty("browserfsMessage")&&t.browserfsMessage}function Ht(t){return t&&"object"==typeof t&&t.hasOwnProperty("browserfsMessage")&&t.browserfsMessage}function Zt(t,e,n){var i=new XMLHttpRequest;i.open("GET",t,!0);var o=!0;switch(e){case"buffer":i.responseType="arraybuffer";break;case"json":try{i.responseType="json",o="json"===i.responseType}catch(t){o=!1}break;default:return n(new me(ge.EINVAL,"Invalid download type: "+e))}i.onreadystatechange=function(t){if(4===i.readyState){if(200!==i.status)return n(new me(i.status,"XHR error."));switch(e){case"buffer":return n(null,new r(i.response?i.response:0));case"json":return o?n(null,i.response):n(null,JSON.parse(i.responseText))}}},i.send()}function Yt(t,e){var n=new XMLHttpRequest;n.open("GET",t,!1);var i=null,o=null;if(n.overrideMimeType("text/plain; charset=x-user-defined"),n.onreadystatechange=function(t){if(4===n.readyState){if(200!==n.status)return void(o=new me(n.status,"XHR error."));switch(e){case"buffer":var s=n.responseText;i=new r(s.length);for(var a=0;a>5&15)-1,i=(e>>9)+1980,o=31&t,s=t>>5&63,a=t>>11;return new Date(i,r,n,a,s,o)}function ne(t,e,n,r){return 0===r?"":e?t.toString("utf8",n,n+r):Pi.byte2str(t.slice(n,n+r))}function re(t,e,n){return t.toString("ascii",e,e+n).trim()}function ie(t,e,n){if(1===n)return String.fromCharCode(t[e]);for(var r=Math.floor(n/2),i=new Array(r),o=0;othis._buffer.length){var e=new r(t-this._buffer.length);return e.fill(0),this.writeSync(e,0,e.length,this._buffer.length),void(this._flag.isSynchronous()&&Re.getRootFS().supportsSynch()&&this.syncSync())}this._stat.size=t;var n=new r(t);this._buffer.copy(n,0,0,t),this._buffer=n,this._flag.isSynchronous()&&Re.getRootFS().supportsSynch()&&this.syncSync()},e.prototype.write=function(t,e,n,r,i){try{i(null,this.writeSync(t,e,n,r),t)}catch(t){i(t)}},e.prototype.writeSync=function(t,e,n,i){if(this._dirty=!0,void 0!==i&&null!==i||(i=this.getPos()),!this._flag.isWriteable())throw new me(ge.EPERM,"File not opened with a writeable mode.");var o=i+n;if(o>this._stat.size&&(this._stat.size=o,o>this._buffer.length)){var s=new r(o);this._buffer.copy(s),this._buffer=s}var a=t.copy(this._buffer,i,e,e+n);return this._stat.mtime=new Date,this._flag.isSynchronous()?(this.syncSync(),a):(this.setPos(i+a),a)},e.prototype.read=function(t,e,n,r,i){try{i(null,this.readSync(t,e,n,r),t)}catch(t){i(t)}},e.prototype.readSync=function(t,e,n,r){if(!this._flag.isReadable())throw new me(ge.EPERM,"File not opened with a readable mode.");void 0!==r&&null!==r||(r=this.getPos());var i=r+n;i>this._stat.size&&(n=this._stat.size-r);var o=this._buffer.copy(t,e,r,r+n);return this._stat.atime=new Date,this._pos=r+n,o},e.prototype.chmod=function(t,e){try{this.chmodSync(t),e()}catch(t){e(t)}},e.prototype.chmodSync=function(t){if(!this._fs.supportsProps())throw new me(ge.ENOTSUP);this._dirty=!0,this._stat.chmod(t),this.syncSync()},e.prototype.isDirty=function(){return this._dirty},e.prototype.resetDirty=function(){this._dirty=!1},e}(Me),je=function(t){function e(e,n,r,i,o){t.call(this,e,n,r,i,o)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.sync=function(t){t()},e.prototype.syncSync=function(){},e.prototype.close=function(t){t()},e.prototype.closeSync=function(){},e}(Be),ze=function(t){function e(e,n,r,i,o){t.call(this,e,n,r,i,o)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.syncSync=function(){this.isDirty()&&(this._fs._syncSync(this),this.resetDirty())},e.prototype.closeSync=function(){this.syncSync()},e}(Be),qe=function(t){function e(e,n){if(t.call(this),this._queue=[],this._queueRunning=!1,this._isInitialized=!1,this._initializeCallbacks=[],this._sync=e,this._async=n,!e.supportsSynch())throw new Error("The first argument to AsyncMirror needs to be a synchronous file system.")}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.isAvailable=function(){return!0},e.prototype.getName=function(){return"AsyncMirror"},e.prototype._syncSync=function(t){this._sync.writeFileSync(t.getPath(),t.getBuffer(),null,Se.getFileFlag("w"),t.getStats().mode),this.enqueueOp({apiMethod:"writeFile",arguments:[t.getPath(),t.getBuffer(),null,t.getFlag(),t.getStats().mode]})},e.prototype.initialize=function(t){var e=this,n=this._initializeCallbacks,r=function(t){e._isInitialized=!t,e._initializeCallbacks=[],n.forEach(function(e){return e(t)})};if(this._isInitialized)t();else if(1===n.push(t)){var i=function(t,n,r){"/"!==t&&e._sync.mkdirSync(t,n),e._async.readdir(t,function(e,n){function i(e){e?r(e):o0){var r=e._queue.shift(),i=r.arguments;i.push(n),e._async[r.apiMethod].apply(e._async,i)}else e._queueRunning=!1};n()}},e}(Ue),Ve=Math.max,We=function(t){return b(function(e){var n=e.pop();t.call(this,e,n)})},He="object"==typeof t&&t&&t.Object===Object&&t,Ze="object"==typeof self&&self&&self.Object===Object&&self,Ye=He||Ze||Function("return this")(),Xe=Ye.Symbol,Ke=Object.prototype,Ge=Ke.hasOwnProperty,Je=Ke.toString,Qe=Xe?Xe.toStringTag:void 0,$e=Object.prototype,tn=$e.toString,en="[object Null]",nn="[object Undefined]",rn=Xe?Xe.toStringTag:void 0,on="[object AsyncFunction]",sn="[object Function]",an="[object GeneratorFunction]",cn="[object Proxy]",un=9007199254740991,fn="function"==typeof Symbol&&Symbol.iterator,hn=function(t){return fn&&t[fn]&&t[fn]()},pn="[object Arguments]",ln=Object.prototype,dn=ln.hasOwnProperty,yn=ln.propertyIsEnumerable,gn=C(function(){return arguments}())?C:function(t){return P(t)&&dn.call(t,"callee")&&!yn.call(t,"callee")},_n=Array.isArray,vn="object"==typeof e&&e&&!e.nodeType&&e,wn=vn&&"object"==typeof i&&i&&!i.nodeType&&i,mn=wn&&wn.exports===vn,En=mn?Ye.Buffer:void 0,Sn=En?En.isBuffer:void 0,bn=Sn||U,kn=9007199254740991,In=/^(?:0|[1-9]\d*)$/,On="[object Arguments]",Fn="[object Array]",Rn="[object Boolean]",Nn="[object Date]",Ln="[object Error]",Tn="[object Function]",xn="[object Map]",Dn="[object Number]",An="[object Object]",Pn="[object RegExp]",Cn="[object Set]",Un="[object String]",Mn="[object WeakMap]",Bn="[object ArrayBuffer]",jn="[object DataView]",zn="[object Float32Array]",qn="[object Float64Array]",Vn="[object Int8Array]",Wn="[object Int16Array]",Hn="[object Int32Array]",Zn="[object Uint8Array]",Yn="[object Uint8ClampedArray]",Xn="[object Uint16Array]",Kn="[object Uint32Array]",Gn={};Gn[zn]=Gn[qn]=Gn[Vn]=Gn[Wn]=Gn[Hn]=Gn[Zn]=Gn[Yn]=Gn[Xn]=Gn[Kn]=!0,Gn[On]=Gn[Fn]=Gn[Bn]=Gn[Rn]=Gn[jn]=Gn[Nn]=Gn[Ln]=Gn[Tn]=Gn[xn]=Gn[Dn]=Gn[An]=Gn[Pn]=Gn[Cn]=Gn[Un]=Gn[Mn]=!1;var Jn="object"==typeof e&&e&&!e.nodeType&&e,Qn=Jn&&"object"==typeof i&&i&&!i.nodeType&&i,$n=Qn&&Qn.exports===Jn,tr=$n&&He.process,er=function(){try{return tr&&tr.binding&&tr.binding("util")}catch(t){}}(),nr=er&&er.isTypedArray,rr=nr?j(nr):B,ir=Object.prototype,or=ir.hasOwnProperty,sr=Object.prototype,ar=V(Object.keys,Object),cr=Object.prototype,ur=cr.hasOwnProperty,fr={},hr=$(Q,1/0),pr=function(t,e,n){var r=T(t)?tt:hr;r(t,e,n)},lr=et(nt);k(lr);var dr=rt(nt),yr=$(dr,1);k(yr),b(function(t,e){return b(function(n){return t.apply(null,e.concat(n))})});var gr,_r=(ot(),"\\ud800-\\udfff"),vr="\\u0300-\\u036f",wr="\\ufe20-\\ufe2f",mr="\\u20d0-\\u20ff",Er=vr+wr+mr,Sr="\\ufe0e\\ufe0f",br="["+_r+"]",kr="["+Er+"]",Ir="\\ud83c[\\udffb-\\udfff]",Or="(?:"+kr+"|"+Ir+")",Fr="[^"+_r+"]",Rr="(?:\\ud83c[\\udde6-\\uddff]){2}",Nr="[\\ud800-\\udbff][\\udc00-\\udfff]",Lr="\\u200d",Tr=Or+"?",xr="["+Sr+"]?",Dr=("(?:"+Lr+"(?:"+[Fr,Rr,Nr].join("|")+")"+xr+Tr+")*","(?:"+[Fr+kr+"?",kr,Rr,Nr,br].join("|")+")","function"==typeof setImmediate&&setImmediate),Ar="object"==typeof o&&"function"==typeof o.nextTick;gr=Dr?setImmediate:Ar?o.nextTick:st,at(gr);var Pr=$(Q,1),Cr=b(function(t){return b(function(e){var n=this,r=e[e.length-1];"function"==typeof r?e.pop():r=x,ct(t,e,function(t,e,r){e.apply(n,t.concat([b(function(t,e){r(t,e)})]))},function(t,e){r.apply(n,[t].concat(e))})})});b(function(t){return Cr.apply(null,t.reverse())}),b(function(t){var e=[null].concat(t);return We(function(t,n){return n.apply(this,e)})}),ut("dir"),ut("log");var Ur;Ur=Ar?o.nextTick:Dr?setImmediate:st,at(Ur);var Mr,Br=(Math.ceil,Math.max,function(t){this._cache={},this._client=t});Br.prototype.readdir=function(t,e){var n=this,r=this.getCachedDirInfo(t);this._wrap(function(e){null!==r&&r.contents?n._client.readdir(t,{contentHash:r.stat.contentHash},e):n._client.readdir(t,e)},function(i,o,s,a){i?i.status===Dropbox.ApiError.NO_CONTENT&&null!==r?e(null,r.contents.slice(0)):e(i):(n.updateCachedDirInfo(t,s,o.slice(0)),a.forEach(function(e){n.updateCachedInfo(ye.join(t,e.name),e)}),e(null,o))})},Br.prototype.remove=function(t,e){var n=this;this._wrap(function(e){n._client.remove(t,e)},function(r,i){r||n.updateCachedInfo(t,i),e(r)})},Br.prototype.move=function(t,e,n){var r=this;this._wrap(function(n){r._client.move(t,e,n)},function(i,o){i||(r.deleteCachedInfo(t),r.updateCachedInfo(e,o)),n(i)})},Br.prototype.stat=function(t,e){var n=this;this._wrap(function(e){n._client.stat(t,e)},function(r,i){r||n.updateCachedInfo(t,i),e(r,i)})},Br.prototype.readFile=function(t,e){var n=this,r=this.getCachedFileInfo(t);null!==r&&null!==r.contents?this.stat(t,function(i,o){i?e(i):o.contentHash===r.stat.contentHash?e(i,r.contents.slice(0),r.stat):n.readFile(t,e)}):this._wrap(function(e){n._client.readFile(t,{arrayBuffer:!0},e)},function(r,i,o){r||n.updateCachedInfo(t,o,i.slice(0)),e(r,i,o)})},Br.prototype.writeFile=function(t,e,n){var r=this;this._wrap(function(n){r._client.writeFile(t,e,n)},function(i,o){i||r.updateCachedInfo(t,o,e.slice(0)),n(i,o)})},Br.prototype.mkdir=function(t,e){var n=this;this._wrap(function(e){n._client.mkdir(t,e)},function(r,i){r||n.updateCachedInfo(t,i,[]),e(r)})},Br.prototype._wrap=function(t,e){var n=0,r=function(i){var o=2;if(i&&3>++n)switch(i.status){case Dropbox.ApiError.SERVER_ERROR:case Dropbox.ApiError.NETWORK_ERROR:case Dropbox.ApiError.RATE_LIMITED:setTimeout(function(){t(r)},1e3*o);break;default:e.apply(null,arguments)}else e.apply(null,arguments)};t(r)},Br.prototype.getCachedInfo=function(t){return this._cache[t.toLowerCase()]},Br.prototype.putCachedInfo=function(t,e){this._cache[t.toLowerCase()]=e},Br.prototype.deleteCachedInfo=function(t){delete this._cache[t.toLowerCase()]},Br.prototype.getCachedDirInfo=function(t){var e=this.getCachedInfo(t);return dt(e)?e:null},Br.prototype.getCachedFileInfo=function(t){var e=this.getCachedInfo(t);return lt(e)?e:null},Br.prototype.updateCachedDirInfo=function(t,e,n){void 0===n&&(n=null);var r=this.getCachedInfo(t);null===e.contentHash||void 0!==r&&r.stat.contentHash===e.contentHash||this.putCachedInfo(t,{stat:e,contents:n})},Br.prototype.updateCachedFileInfo=function(t,e,n){void 0===n&&(n=null);var r=this.getCachedInfo(t);null===e.versionTag||void 0!==r&&r.stat.versionTag===e.versionTag||this.putCachedInfo(t,{stat:e,contents:n})},Br.prototype.updateCachedInfo=function(t,e,n){void 0===n&&(n=null),e.isFile&&yt(n)?this.updateCachedFileInfo(t,e,n):e.isFolder&&Array.isArray(n)&&this.updateCachedDirInfo(t,e,n)};var jr=function(t){function e(e,n,r,i,o){t.call(this,e,n,r,i,o)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.sync=function(t){var e=this;if(this.isDirty()){var n=this.getBuffer(),r=d(n);this._fs._writeFileStrict(this.getPath(),r,function(n){n||e.resetDirty(),t(n)})}else t()},e.prototype.close=function(t){this.sync(t)},e}(Be),zr=function(t){function e(e){t.call(this),this._client=new Br(e),pt()}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.isAvailable=function(){return"undefined"!=typeof Dropbox},e.prototype.getName=function(){return"Dropbox"},e.prototype.isReadOnly=function(){return!1},e.prototype.supportsSymlinks=function(){return!1},e.prototype.supportsProps=function(){return!1},e.prototype.supportsSynch=function(){return!1},e.prototype.empty=function(t){var e=this;this._client.readdir("/",function(n,r){if(n)t(e.convert(n,"/"));else{var i=function(t,n){var r=ye.join("/",t);e._client.remove(r,function(t){n(t?e.convert(t,r):null)})},o=function(e){e?t(e):t()};ht(r,i,o)}})},e.prototype.rename=function(t,e,n){var r=this;this._client.move(t,e,function(i){i?r._client.stat(e,function(o,s){if(o||s.isFolder){var a=i.response.error.indexOf(t)>-1?t:e;n(r.convert(i,a))}else r._client.remove(e,function(i){i?n(r.convert(i,e)):r.rename(t,e,n)})}):n()})},e.prototype.stat=function(t,e,n){var r=this;this._client.stat(t,function(e,i){if(e)n(r.convert(e,t));else{if(!i||!i.isRemoved){var o=new ke(r._statType(i),i.size);return n(null,o)}n(me.FileError(ge.ENOENT,t))}})},e.prototype.open=function(t,e,n,i){var o=this;this._client.readFile(t,function(n,s,a){if(!n){var c;c=null===s?new r(0):v(s);var u=o._makeFile(t,e,a,c);return i(null,u)}if(e.isReadable())i(o.convert(n,t));else switch(n.status){case Dropbox.ApiError.NOT_FOUND:var f=new ArrayBuffer(0);return o._writeFileStrict(t,f,function(n,r){if(n)i(n);else{var s=o._makeFile(t,e,r,v(f));i(null,s)}});default:return i(o.convert(n,t))}})},e.prototype._writeFileStrict=function(t,e,n){var r=this,i=ye.dirname(t);this.stat(i,!1,function(o,s){o?n(me.FileError(ge.ENOENT,i)):r._client.writeFile(t,e,function(e,i){e?n(r.convert(e,t)):n(null,i)})})},e.prototype._statType=function(t){return t.isFile?be.FILE:be.DIRECTORY},e.prototype._makeFile=function(t,e,n,r){var i=this._statType(n),o=new ke(i,n.size);return new jr(this,t,e,o,r)},e.prototype._remove=function(t,e,n){var r=this;this._client.stat(t,function(i,o){i?e(r.convert(i,t)):o.isFile&&!n?e(me.FileError(ge.ENOTDIR,t)):!o.isFile&&n?e(me.FileError(ge.EISDIR,t)):r._client.remove(t,function(n){e(n?r.convert(n,t):null)})})},e.prototype.unlink=function(t,e){this._remove(t,e,!0)},e.prototype.rmdir=function(t,e){this._remove(t,e,!1)},e.prototype.mkdir=function(t,e,n){var r=this,i=ye.dirname(t);this._client.stat(i,function(e,o){e?n(r.convert(e,i)):r._client.mkdir(t,function(e){n(e?me.FileError(ge.EEXIST,t):null)})})},e.prototype.readdir=function(t,e){var n=this;this._client.readdir(t,function(t,r){return t?e(n.convert(t)):e(null,r)})},e.prototype.convert=function(t,e){void 0===e&&(e=null);var n=Mr[t.status];return void 0===n&&(n=ge.EIO),e?me.FileError(n,e):new me(n)},e}(Ce),qr=function(t){function e(e,n,r,i){t.call(this),this._fs=e,this._FS=n,this._path=r,this._stream=i}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getPos=function(){},e.prototype.close=function(t){var e=null;try{this.closeSync()}catch(t){e=t}finally{t(e)}},e.prototype.closeSync=function(){try{this._FS.close(this._stream)}catch(t){throw gt(t,this._path)}},e.prototype.stat=function(t){try{t(null,this.statSync())}catch(e){t(e)}},e.prototype.statSync=function(){try{return this._fs.statSync(this._path,!1)}catch(t){throw gt(t,this._path)}},e.prototype.truncate=function(t,e){var n=null;try{this.truncateSync(t)}catch(t){n=t}finally{e(n)}},e.prototype.truncateSync=function(t){try{this._FS.ftruncate(this._stream.fd,t)}catch(t){throw gt(t,this._path)}},e.prototype.write=function(t,e,n,r,i){try{i(null,this.writeSync(t,e,n,r),t)}catch(t){i(t)}},e.prototype.writeSync=function(t,e,n,r){try{var i=y(t),o=null===r?void 0:r;return this._FS.write(this._stream,i,e,n,o)}catch(t){throw gt(t,this._path)}},e.prototype.read=function(t,e,n,r,i){try{i(null,this.readSync(t,e,n,r),t)}catch(t){i(t)}},e.prototype.readSync=function(t,e,n,r){try{var i=y(t),o=null===r?void 0:r;return this._FS.read(this._stream,i,e,n,o)}catch(t){throw gt(t,this._path)}},e.prototype.sync=function(t){t()},e.prototype.syncSync=function(){},e.prototype.chown=function(t,e,n){var r=null;try{this.chownSync(t,e)}catch(t){r=t}finally{n(r)}},e.prototype.chownSync=function(t,e){try{this._FS.fchown(this._stream.fd,t,e)}catch(t){throw gt(t,this._path)}},e.prototype.chmod=function(t,e){var n=null;try{this.chmodSync(t)}catch(t){n=t}finally{e(n)}},e.prototype.chmodSync=function(t){try{this._FS.fchmod(this._stream.fd,t)}catch(t){throw gt(t,this._path)}},e.prototype.utimes=function(t,e,n){var r=null;try{this.utimesSync(t,e)}catch(t){r=t}finally{n(r)}},e.prototype.utimesSync=function(t,e){ this._fs.utimesSync(this._path,t,e)},e}(Me),Vr=function(t){function e(e){t.call(this),this._FS=e}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.isAvailable=function(){return!0},e.prototype.getName=function(){return this._FS.DB_NAME()},e.prototype.isReadOnly=function(){return!1},e.prototype.supportsLinks=function(){return!0},e.prototype.supportsProps=function(){return!0},e.prototype.supportsSynch=function(){return!0},e.prototype.renameSync=function(t,e){try{this._FS.rename(t,e)}catch(n){throw n.errno===ge.ENOENT?gt(n,this.existsSync(t)?e:t):gt(n)}},e.prototype.statSync=function(t,e){try{var n=e?this._FS.lstat(t):this._FS.stat(t),r=this.modeToFileType(n.mode);return new ke(r,n.size,n.mode,n.atime,n.mtime,n.ctime)}catch(e){throw gt(e,t)}},e.prototype.openSync=function(t,e,n){try{var r=this._FS.open(t,e.getFlagString(),n);if(this._FS.isDir(r.node.mode))throw this._FS.close(r),me.EISDIR(t);return new qr(this,this._FS,t,r)}catch(e){throw gt(e,t)}},e.prototype.unlinkSync=function(t){try{this._FS.unlink(t)}catch(e){throw gt(e,t)}},e.prototype.rmdirSync=function(t){try{this._FS.rmdir(t)}catch(e){throw gt(e,t)}},e.prototype.mkdirSync=function(t,e){try{this._FS.mkdir(t,e)}catch(e){throw gt(e,t)}},e.prototype.readdirSync=function(t){try{return this._FS.readdir(t).filter(function(t){return"."!==t&&".."!==t})}catch(e){throw gt(e,t)}},e.prototype.truncateSync=function(t,e){try{this._FS.truncate(t,e)}catch(e){throw gt(e,t)}},e.prototype.readFileSync=function(t,e,n){try{var r=this._FS.readFile(t,{flags:n.getFlagString()}),i=_(r);return e?i.toString(e):i}catch(e){throw gt(e,t)}},e.prototype.writeFileSync=function(t,e,n,i,o){try{n&&(e=new r(e,n));var s=y(e);this._FS.writeFile(t,s,{flags:i.getFlagString(),encoding:"binary"}),this._FS.chmod(t,o)}catch(e){throw gt(e,t)}},e.prototype.chmodSync=function(t,e,n){try{e?this._FS.lchmod(t,n):this._FS.chmod(t,n)}catch(e){throw gt(e,t)}},e.prototype.chownSync=function(t,e,n,r){try{e?this._FS.lchown(t,n,r):this._FS.chown(t,n,r)}catch(e){throw gt(e,t)}},e.prototype.symlinkSync=function(t,e,n){try{this._FS.symlink(t,e)}catch(t){throw gt(t)}},e.prototype.readlinkSync=function(t){try{return this._FS.readlink(t)}catch(e){throw gt(e,t)}},e.prototype.utimesSync=function(t,e,n){try{this._FS.utime(t,e.getTime(),n.getTime())}catch(e){throw gt(e,t)}},e.prototype.modeToFileType=function(t){if(this._FS.isDir(t))return be.DIRECTORY;if(this._FS.isFile(t))return be.FILE;if(this._FS.isLink(t))return be.SYMLINK;throw me.EPERM("Invalid mode: "+t)},e}(Ue),Wr=function(t){function e(e,n){t.call(this),this._folder=e,this._wrapped=n}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.isAvailable=function(){return!0},e.prototype.initialize=function(t){var e=this;this._wrapped.exists(this._folder,function(n){n?t():e._wrapped.isReadOnly()?t(me.ENOENT(e._folder)):e._wrapped.mkdir(e._folder,511,t)})},e.prototype.getName=function(){return this._wrapped.getName()},e.prototype.isReadOnly=function(){return this._wrapped.isReadOnly()},e.prototype.supportsProps=function(){return this._wrapped.supportsProps()},e.prototype.supportsSynch=function(){return this._wrapped.supportsSynch()},e.prototype.supportsLinks=function(){return!1},e}(Ce);["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(t){Wr.prototype[t]=wt(t,!0,!1)}),["rename","renameSync","link","linkSync","symlink","symlinkSync"].forEach(function(t){Wr.prototype[t]=wt(t,!0,!0)});var Hr=_e.webkitRequestFileSystem||_e.requestFileSystem||null,Zr=function(t){function e(e,n,r,i,o,s){t.call(this,e,r,i,o,s),this._entry=n}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.sync=function(t){var e=this;return this.isDirty()?void this._entry.createWriter(function(n){var r=e.getBuffer(),i=new Blob([d(r)]),o=i.size;n.onwriteend=function(r){n.onwriteend=null,n.onerror=null,n.truncate(o),e.resetDirty(),t()},n.onerror=function(n){t(bt(n,e.getPath(),!1))},n.write(i)}):t()},e.prototype.close=function(t){this.sync(t)},e}(Be),Yr=function(t){function e(e,n){void 0===e&&(e=5),void 0===n&&(n=_e.PERSISTENT),t.call(this),this.size=1048576*e,this.type=n}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.isAvailable=function(){return!!Hr},e.prototype.getName=function(){return"HTML5 FileSystem"},e.prototype.isReadOnly=function(){return!1},e.prototype.supportsSymlinks=function(){return!1},e.prototype.supportsProps=function(){return!1},e.prototype.supportsSynch=function(){return!1},e.prototype.allocate=function(t){var e=this;void 0===t&&(t=function(){});var n=function(n){e.fs=n,t()},r=function(e){t(bt(e,"/",!0))};this.type===_e.PERSISTENT?Et(this.type,this.size,function(t){Hr(e.type,t,n,r)},r):Hr(this.type,this.size,n,r)},e.prototype.empty=function(t){this._readdir("/",function(e,n){if(e)console.error("Failed to empty FS"),t(e);else{var r=function(n){e?(console.error("Failed to empty FS"),t(e)):t()},i=function(t,e){var n=function(){e()},r=function(n){e(bt(n,t.fullPath,!t.isDirectory))};mt(t)?t.removeRecursively(n,r):t.remove(n,r)};ht(n,i,r)}})},e.prototype.rename=function(t,e,n){var r=this,i=2,o=0,s=this.fs.root,a=t,c=function(t){--i<=0&&n(bt(t,a,!1))},u=function(i){return 2===++o?n(new me(ge.EINVAL,"Something was identified as both a file and a directory. This should never happen.")):t===e?n():(a=ye.dirname(e),void s.getDirectory(a,{},function(o){a=ye.basename(e),i.moveTo(o,a,function(t){n()},function(o){i.isDirectory?(a=e,r.unlink(e,function(i){i?c(o):r.rename(t,e,n)})):c(o)})},c))};s.getFile(t,{},u,c),s.getDirectory(t,{},u,c)},e.prototype.stat=function(t,e,n){var r=this,i={create:!1},o=function(t){var e=function(t){var e=new ke(be.FILE,t.size);n(null,e)};t.file(e,a)},s=function(t){var e=4096,r=new ke(be.DIRECTORY,e);n(null,r)},a=function(e){n(bt(e,t,!1))},c=function(){r.fs.root.getDirectory(t,i,s,a)};this.fs.root.getFile(t,i,o,c)},e.prototype.open=function(t,e,n,r){var i=this,o=function(n){r("InvalidModificationError"===n.name&&e.isExclusive()?me.EEXIST(t):bt(n,t,!1))};this.fs.root.getFile(t,{create:e.pathNotExistsAction()===we.CREATE_FILE,exclusive:e.isExclusive()},function(n){n.file(function(s){var a=new FileReader;a.onloadend=function(o){var c=i._makeFile(t,n,e,s,a.result);r(null,c)},a.onerror=function(t){o(a.error)},a.readAsArrayBuffer(s)},o)},o)},e.prototype.unlink=function(t,e){this._remove(t,e,!0)},e.prototype.rmdir=function(t,e){var n=this;this.readdir(t,function(r,i){r?e(r):i.length>0?e(me.ENOTEMPTY(t)):n._remove(t,e,!1)})},e.prototype.mkdir=function(t,e,n){var r={create:!0,exclusive:!0},i=function(t){n()},o=function(e){n(bt(e,t,!0))};this.fs.root.getDirectory(t,r,i,o)},e.prototype.readdir=function(t,e){this._readdir(t,function(t,n){if(t)return e(t);for(var r=[],i=0;i0)throw me.ENOTEMPTY(t);this.removeEntry(t,!0)},e.prototype.mkdirSync=function(t,e){var n=this.store.beginTransaction("readwrite"),i=new r("{}");this.commitNewFile(n,t,be.DIRECTORY,e,i)},e.prototype.readdirSync=function(t){var e=this.store.beginTransaction("readonly");return Object.keys(this.getDirListing(e,t,this.findINode(e,t)))},e.prototype._syncSync=function(t,e,n){var r=this.store.beginTransaction("readwrite"),i=this._findINode(r,ye.dirname(t),ye.basename(t)),o=this.getINode(r,t,i),s=o.update(n);try{r.put(o.id,e,!0),s&&r.put(i,o.toBuffer(),!0)}catch(t){throw r.abort(),t}r.commit()},e.prototype.makeRootDirectory=function(){var t=this.store.beginTransaction("readwrite");if(void 0===t.get(Kr)){var e=(new Date).getTime(),n=new Xr(kt(),4096,511|be.DIRECTORY,e,e,e);t.put(n.id,new r("{}"),!1),t.put(Kr,n.toBuffer(),!1),t.commit()}},e.prototype._findINode=function(t,e,n){var r=this,i=function(i){var o=r.getDirListing(t,e,i);if(o[n])return o[n];throw me.ENOENT(ye.resolve(e,n))};return"/"===e?""===n?Kr:i(this.getINode(t,e,Kr)):i(this.getINode(t,e+ye.sep+n,this._findINode(t,ye.dirname(e),ye.basename(e))))},e.prototype.findINode=function(t,e){return this.getINode(t,e,this._findINode(t,ye.dirname(e),ye.basename(e)))},e.prototype.getINode=function(t,e,n){var r=t.get(n);if(void 0===r)throw me.ENOENT(e);return Xr.fromBuffer(r)},e.prototype.getDirListing=function(t,e,n){if(!n.isDirectory())throw me.ENOTDIR(e);var r=t.get(n.id);if(void 0===r)throw me.ENOENT(e);return JSON.parse(r.toString())},e.prototype.addNewNode=function(t,e){for(var n,r=0;r<5;)try{return n=kt(),t.put(n,e,!1),n}catch(t){}throw new me(ge.EIO,"Unable to commit data to key-value store.")},e.prototype.commitNewFile=function(t,e,n,i,o){var s=ye.dirname(e),a=ye.basename(e),c=this.findINode(t,s),u=this.getDirListing(t,s,c),f=(new Date).getTime();if("/"===e)throw me.EEXIST(e);if(u[a])throw me.EEXIST(e);var h;try{var p=this.addNewNode(t,o);h=new Xr(p,o.length,i|n,f,f,f);var l=this.addNewNode(t,h.toBuffer());u[a]=l,t.put(c.id,new r(JSON.stringify(u)),!0)}catch(e){throw t.abort(),e}return t.commit(),h},e.prototype.removeEntry=function(t,e){var n=this.store.beginTransaction("readwrite"),i=ye.dirname(t),o=this.findINode(n,i),s=this.getDirListing(n,i,o),a=ye.basename(t);if(!s[a])throw me.ENOENT(t);var c=s[a];delete s[a];var u=this.getINode(n,t,c);if(!e&&u.isDirectory())throw me.EISDIR(t);if(e&&!u.isDirectory())throw me.ENOTDIR(t);try{n.del(u.id),n.del(c),n.put(o.id,new r(JSON.stringify(s)),!0)}catch(t){throw n.abort(),t}n.commit()},e}(Ue),$r=function(t){function e(e,n,r,i,o){t.call(this,e,n,r,i,o)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.sync=function(t){var e=this;this.isDirty()?this._fs._sync(this.getPath(),this.getBuffer(),this.getStats(),function(n){n||e.resetDirty(),t(n)}):t()},e.prototype.close=function(t){this.sync(t)},e}(Be),ti=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.isAvailable=function(){return!0},e.prototype.init=function(t,e){this.store=t,this.makeRootDirectory(e)},e.prototype.getName=function(){return this.store.name()},e.prototype.isReadOnly=function(){return!1},e.prototype.supportsSymlinks=function(){return!1},e.prototype.supportsProps=function(){return!1},e.prototype.supportsSynch=function(){return!1},e.prototype.empty=function(t){var e=this;this.store.clear(function(n){It(n,t)&&e.makeRootDirectory(t)})},e.prototype.rename=function(t,e,n){var i=this,o=this.store.beginTransaction("readwrite"),s=ye.dirname(t),a=ye.basename(t),c=ye.dirname(e),u=ye.basename(e),f={},h={},p=!1;if(0===(c+"/").indexOf(t+"/"))return n(new me(ge.EBUSY,s));var l=function(){if(!p&&h.hasOwnProperty(s)&&h.hasOwnProperty(c)){var l=h[s],d=f[s],y=h[c],g=f[c];if(l[a]){var _=l[a];delete l[a];var v=function(){y[u]=_,o.put(d.id,new r(JSON.stringify(l)),!0,function(t){Ot(t,o,n)&&(s===c?o.commit(n):o.put(g.id,new r(JSON.stringify(y)),!0,function(t){Ot(t,o,n)&&o.commit(n)}))})};y[u]?i.getINode(o,e,y[u],function(t,r){Ot(t,o,n)&&(r.isFile()?o.del(r.id,function(t){Ot(t,o,n)&&o.del(y[u],function(t){Ot(t,o,n)&&v()})}):o.abort(function(t){n(me.EPERM(e))}))}):v()}else n(me.ENOENT(t))}},d=function(t){i.findINodeAndDirListing(o,t,function(e,r,i){e?p||(p=!0,o.abort(function(){n(e)})):(f[t]=r,h[t]=i,l())})};d(s),s!==c&&d(c)},e.prototype.stat=function(t,e,n){var r=this.store.beginTransaction("readonly");this.findINode(r,t,function(t,e){It(t,n)&&n(null,e.toStats())})},e.prototype.createFile=function(t,e,n,i){var o=this,s=this.store.beginTransaction("readwrite"),a=new r(0);this.commitNewFile(s,t,be.FILE,n,a,function(n,r){It(n,i)&&i(null,new $r(o,t,e,r.toStats(),a))})},e.prototype.openFile=function(t,e,n){var r=this,i=this.store.beginTransaction("readonly");this.findINode(i,t,function(o,s){It(o,n)&&i.get(s.id,function(i,o){It(i,n)&&(void 0===o?n(me.ENOENT(t)):n(null,new $r(r,t,e,s.toStats(),o)))})})},e.prototype.unlink=function(t,e){this.removeEntry(t,!1,e)},e.prototype.rmdir=function(t,e){var n=this;this.readdir(t,function(r,i){r?e(r):i.length>0?e(me.ENOTEMPTY(t)):n.removeEntry(t,!0,e)})},e.prototype.mkdir=function(t,e,n){var i=this.store.beginTransaction("readwrite"),o=new r("{}");this.commitNewFile(i,t,be.DIRECTORY,e,o,n)},e.prototype.readdir=function(t,e){var n=this,r=this.store.beginTransaction("readonly");this.findINode(r,t,function(i,o){It(i,e)&&n.getDirListing(r,t,o,function(t,n){It(t,e)&&e(null,Object.keys(n))})})},e.prototype._sync=function(t,e,n,r){var i=this,o=this.store.beginTransaction("readwrite");this._findINode(o,ye.dirname(t),ye.basename(t),function(s,a){Ot(s,o,r)&&i.getINode(o,t,a,function(t,i){if(Ot(t,o,r)){var s=i.update(n);o.put(i.id,e,!0,function(t){Ot(t,o,r)&&(s?o.put(a,i.toBuffer(),!0,function(t){Ot(t,o,r)&&o.commit(r)}):o.commit(r))})}})})},e.prototype.makeRootDirectory=function(t){var e=this.store.beginTransaction("readwrite");e.get(Kr,function(n,i){if(n||void 0===i){var o=(new Date).getTime(),s=new Xr(kt(),4096,511|be.DIRECTORY,o,o,o);e.put(s.id,new r("{}"),!1,function(n){Ot(n,e,t)&&e.put(Kr,s.toBuffer(),!1,function(n){n?e.abort(function(){t(n)}):e.commit(t)})})}else e.commit(t)})},e.prototype._findINode=function(t,e,n,r){var i=this,o=function(t,i,o){t?r(t):o[n]?r(null,o[n]):r(me.ENOENT(ye.resolve(e,n)))};"/"===e?""===n?r(null,Kr):this.getINode(t,e,Kr,function(n,s){It(n,r)&&i.getDirListing(t,e,s,function(t,e){o(t,s,e)})}):this.findINodeAndDirListing(t,e,o)},e.prototype.findINode=function(t,e,n){var r=this;this._findINode(t,ye.dirname(e),ye.basename(e),function(i,o){It(i,n)&&r.getINode(t,e,o,n)})},e.prototype.getINode=function(t,e,n,r){t.get(n,function(t,n){It(t,r)&&(void 0===n?r(me.ENOENT(e)):r(null,Xr.fromBuffer(n)))})},e.prototype.getDirListing=function(t,e,n,r){n.isDirectory()?t.get(n.id,function(t,n){if(It(t,r))try{r(null,JSON.parse(n.toString()))}catch(t){r(me.ENOENT(e))}}):r(me.ENOTDIR(e))},e.prototype.findINodeAndDirListing=function(t,e,n){var r=this;this.findINode(t,e,function(i,o){It(i,n)&&r.getDirListing(t,e,o,function(t,e){It(t,n)&&n(null,o,e)})})},e.prototype.addNewNode=function(t,e,n){var r,i=0,o=function(){5===++i?n(new me(ge.EIO,"Unable to commit data to key-value store.")):(r=kt(),t.put(r,e,!1,function(t,e){t||!e?o():n(null,r)}))};o()},e.prototype.commitNewFile=function(t,e,n,i,o,s){var a=this,c=ye.dirname(e),u=ye.basename(e),f=(new Date).getTime();return"/"===e?s(me.EEXIST(e)):void this.findINodeAndDirListing(t,c,function(c,h,p){Ot(c,t,s)&&(p[u]?t.abort(function(){s(me.EEXIST(e))}):a.addNewNode(t,o,function(e,c){if(Ot(e,t,s)){var l=new Xr(c,o.length,i|n,f,f,f);a.addNewNode(t,l.toBuffer(),function(e,n){Ot(e,t,s)&&(p[u]=n,t.put(h.id,new r(JSON.stringify(p)),!0,function(e){Ot(e,t,s)&&t.commit(function(e){Ot(e,t,s)&&s(null,l)})}))})}}))})},e.prototype.removeEntry=function(t,e,n){var i=this,o=this.store.beginTransaction("readwrite"),s=ye.dirname(t),a=ye.basename(t);this.findINodeAndDirListing(o,s,function(s,c,u){if(Ot(s,o,n))if(u[a]){var f=u[a];delete u[a],i.getINode(o,t,f,function(i,s){Ot(i,o,n)&&(!e&&s.isDirectory()?o.abort(function(){n(me.EISDIR(t))}):e&&!s.isDirectory()?o.abort(function(){n(me.ENOTDIR(t))}):o.del(s.id,function(t){Ot(t,o,n)&&o.del(f,function(t){Ot(t,o,n)&&o.put(c.id,new r(JSON.stringify(u)),!0,function(t){Ot(t,o,n)&&o.commit(n)})})}))})}else o.abort(function(){n(me.ENOENT(t))})})},e}(Ce),ei=function(){this.store={}};ei.prototype.name=function(){return"In-memory"},ei.prototype.clear=function(){this.store={}},ei.prototype.beginTransaction=function(t){return new Gr(this)},ei.prototype.get=function(t){return this.store[t]},ei.prototype.put=function(t,e,n){return!(!n&&this.store.hasOwnProperty(t))&&(this.store[t]=e,!0)},ei.prototype.del=function(t){delete this.store[t]};var ni=function(t){function e(){t.call(this,{store:new ei})}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Qr),ri=_e.indexedDB||_e.mozIndexedDB||_e.webkitIndexedDB||_e.msIndexedDB,ii=function(t,e){this.tx=t,this.store=e};ii.prototype.get=function(t,e){try{var n=this.store.get(t);n.onerror=Rt(e),n.onsuccess=function(t){var n=t.target.result;void 0===n?e(null,n):e(null,v(n))}}catch(t){e(Ft(t))}};var oi=function(t){function e(e,n){t.call(this,e,n)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.put=function(t,e,n,r){try{var i,o=d(e);i=n?this.store.put(o,t):this.store.add(o,t),i.onerror=Rt(r),i.onsuccess=function(t){r(null,!0)}}catch(t){r(Ft(t))}},e.prototype.del=function(t,e){try{var n=this.store.delete(t);n.onerror=Rt(e),n.onsuccess=function(t){e()}}catch(t){e(Ft(t))}},e.prototype.commit=function(t){setTimeout(t,0)},e.prototype.abort=function(t){var e=null;try{this.tx.abort()}catch(t){e=Ft(t)}finally{t(e)}},e}(ii),si=function(t,e){var n=this;void 0===e&&(e="browserfs"),this.storeName=e;var r=ri.open(this.storeName,1);r.onupgradeneeded=function(t){var e=t.target.result;e.objectStoreNames.contains(n.storeName)&&e.deleteObjectStore(n.storeName),e.createObjectStore(n.storeName)},r.onsuccess=function(e){n.db=e.target.result,t(null,n)},r.onerror=Rt(t,ge.EACCES)};si.prototype.name=function(){return"IndexedDB - "+this.storeName},si.prototype.clear=function(t){try{var e=this.db.transaction(this.storeName,"readwrite"),n=e.objectStore(this.storeName),r=n.clear();r.onsuccess=function(e){setTimeout(t,0)},r.onerror=Rt(t)}catch(e){t(Ft(e))}},si.prototype.beginTransaction=function(t){void 0===t&&(t="readonly");var e=this.db.transaction(this.storeName,t),n=e.objectStore(this.storeName);if("readwrite"===t)return new oi(e,n);if("readonly"===t)return new ii(e,n);throw new me(ge.EINVAL,"Invalid transaction type.")};var ai,ci=function(t){function e(e,n){var r=this;t.call(this);var i=new si(function(t){t?e(t):r.init(i,function(t){e(t,r)})},n)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.isAvailable=function(){try{return"undefined"!=typeof ri&&null!==ri.open("__browserfs_test__")}catch(t){return!1}},e}(ti),ui=!1;try{_e.localStorage.setItem("__test__",String.fromCharCode(55296)),ui=_e.localStorage.getItem("__test__")===String.fromCharCode(55296)}catch(t){ui=!1}ai=ui?"binary_string":"binary_string_ie",r.isEncoding(ai)||(ai="base64");var fi=function(){};fi.prototype.name=function(){return"LocalStorage"},fi.prototype.clear=function(){_e.localStorage.clear()},fi.prototype.beginTransaction=function(t){return new Gr(this)},fi.prototype.get=function(t){try{var e=_e.localStorage.getItem(t);if(null!==e)return new r(e,ai)}catch(t){}},fi.prototype.put=function(t,e,n){try{return!(!n&&null!==_e.localStorage.getItem(t))&&(_e.localStorage.setItem(t,e.toString(ai)),!0)}catch(t){throw new me(ge.ENOSPC,"LocalStorage is full.")}},fi.prototype.del=function(t){try{_e.localStorage.removeItem(t)}catch(e){throw new me(ge.EIO,"Unable to delete key "+t+": "+e)}};for(var hi=function(t){function e(){t.call(this,{store:new fi})}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.isAvailable=function(){return"undefined"!=typeof _e.localStorage},e}(Qr),pi=function(t){function e(){t.call(this),this.mountList=[],this.mntMap={},this.rootFs=new ni}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.isAvailable=function(){return!0},e.prototype.mount=function(t,e){if("/"!==t[0]&&(t="/"+t),t=ye.resolve(t),this.mntMap[t])throw new me(ge.EINVAL,"Mount point "+t+" is already taken.");l(t,511,this.rootFs),this.mntMap[t]=e,this.mountList.push(t),this.mountList=this.mountList.sort(function(t,e){return e.length-t.length})},e.prototype.umount=function(t){var e=this;if("/"!==t[0]&&(t="/"+t),t=ye.resolve(t),!this.mntMap[t])throw new me(ge.EINVAL,"Mount point "+t+" is already unmounted.");for(delete this.mntMap[t],this.mountList.splice(this.mountList.indexOf(t),1);"/"!==t&&0===e.rootFs.readdirSync(t).length;)e.rootFs.rmdirSync(t),t=ye.dirname(t)},e.prototype._getFs=function(t){for(var e=this,n=this.mountList,r=n.length,i=0;i1?o.length:0),""===t&&(t="/"),{fs:e.mntMap[o],path:t}}return{fs:this.rootFs,path:t}},e.prototype.getName=function(){return"MountableFileSystem"},e.prototype.diskSpace=function(t,e){e(0,0)},e.prototype.isReadOnly=function(){return!1},e.prototype.supportsLinks=function(){return!1},e.prototype.supportsProps=function(){return!1},e.prototype.supportsSynch=function(){return!0},e.prototype.standardizeError=function(t,e,n){var r=t.message.indexOf(e);return r!==-1&&(t.message=t.message.substr(0,r)+n+t.message.substr(r+e.length),t.path=n),t},e.prototype.rename=function(t,e,n){var r=this,i=this._getFs(t),o=this._getFs(e);return i.fs===o.fs?i.fs.rename(i.path,o.path,function(s){s&&r.standardizeError(r.standardizeError(s,i.path,t),o.path,e),n(s)}):Re.readFile(t,function(r,i){return r?n(r):void Re.writeFile(e,i,function(e){return e?n(e):void Re.unlink(t,n)})})},e.prototype.renameSync=function(t,e){var n=this._getFs(t),r=this._getFs(e);if(n.fs===r.fs)try{return n.fs.renameSync(n.path,r.path)}catch(i){throw this.standardizeError(this.standardizeError(i,n.path,t),r.path,e),i}var i=Re.readFileSync(t);return Re.writeFileSync(e,i),Re.unlinkSync(t)},e.prototype.readdirSync=function(t){var e=this._getFs(t),n=null;if(e.fs!==this.rootFs)try{n=this.rootFs.readdirSync(t)}catch(t){}try{var r=e.fs.readdirSync(e.path);return null===n?r:r.concat(n.filter(function(t){return r.indexOf(t)===-1}))}catch(r){if(null===n)throw this.standardizeError(r,e.path,t);return n}},e.prototype.readdir=function(t,e){var n=this,r=this._getFs(t);r.fs.readdir(r.path,function(i,o){if(r.fs!==n.rootFs)try{var s=n.rootFs.readdirSync(t);o=o?o.concat(s.filter(function(t){return o.indexOf(t)===-1})):s}catch(o){if(i)return e(n.standardizeError(i,r.path,t))}else if(i)return e(n.standardizeError(i,r.path,t));e(null,o)})},e.prototype.rmdirSync=function(t){var e=this._getFs(t);if(this._containsMountPt(t))throw me.ENOTEMPTY(t);try{e.fs.rmdirSync(e.path)}catch(n){throw this.standardizeError(n,e.path,t)}},e.prototype.rmdir=function(t,e){var n=this,r=this._getFs(t);this._containsMountPt(t)?e(me.ENOTEMPTY(t)):r.fs.rmdir(r.path,function(i){e(i?n.standardizeError(i,r.path,t):null)})},e.prototype._containsMountPt=function(t){for(var e=this.mountList,n=e.length,r=0;r=t.length&&i.slice(0,t.length)===t)return!0}return!1},e}(Ce),li=[["exists","unlink","readlink"],["stat","mkdir","realpath","truncate"],["open","readFile","chmod","utimes"],["chown"],["writeFile","appendFile"]],di=0;di"},wi.prototype.getFSUnlocked=function(){return this._fs},wi.prototype.initialize=function(t){this._fs.initialize(t)},wi.prototype.diskSpace=function(t,e){this._fs.diskSpace(t,e)},wi.prototype.isReadOnly=function(){return this._fs.isReadOnly()},wi.prototype.supportsLinks=function(){return this._fs.supportsLinks()},wi.prototype.supportsProps=function(){return this._fs.supportsProps()},wi.prototype.supportsSynch=function(){return this._fs.supportsSynch()},wi.prototype.rename=function(t,e,n){var r=this;this._mu.lock(function(){r._fs.rename(t,e,function(t){r._mu.unlock(),n(t)})})},wi.prototype.renameSync=function(t,e){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.renameSync(t,e)},wi.prototype.stat=function(t,e,n){var r=this;this._mu.lock(function(){r._fs.stat(t,e,function(t,e){r._mu.unlock(),n(t,e)})})},wi.prototype.statSync=function(t,e){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.statSync(t,e)},wi.prototype.open=function(t,e,n,r){var i=this;this._mu.lock(function(){i._fs.open(t,e,n,function(t,e){i._mu.unlock(),r(t,e)})})},wi.prototype.openSync=function(t,e,n){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.openSync(t,e,n)},wi.prototype.unlink=function(t,e){var n=this;this._mu.lock(function(){n._fs.unlink(t,function(t){n._mu.unlock(),e(t)})})},wi.prototype.unlinkSync=function(t){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.unlinkSync(t)},wi.prototype.rmdir=function(t,e){var n=this;this._mu.lock(function(){n._fs.rmdir(t,function(t){n._mu.unlock(),e(t)})})},wi.prototype.rmdirSync=function(t){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.rmdirSync(t)},wi.prototype.mkdir=function(t,e,n){var r=this;this._mu.lock(function(){r._fs.mkdir(t,e,function(t){r._mu.unlock(),n(t)})})},wi.prototype.mkdirSync=function(t,e){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.mkdirSync(t,e)},wi.prototype.readdir=function(t,e){var n=this;this._mu.lock(function(){n._fs.readdir(t,function(t,r){n._mu.unlock(),e(t,r)})})},wi.prototype.readdirSync=function(t){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.readdirSync(t)},wi.prototype.exists=function(t,e){var n=this;this._mu.lock(function(){n._fs.exists(t,function(t){n._mu.unlock(),e(t)})})},wi.prototype.existsSync=function(t){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.existsSync(t)},wi.prototype.realpath=function(t,e,n){var r=this;this._mu.lock(function(){r._fs.realpath(t,e,function(t,e){r._mu.unlock(),n(t,e)})})},wi.prototype.realpathSync=function(t,e){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.realpathSync(t,e)},wi.prototype.truncate=function(t,e,n){var r=this;this._mu.lock(function(){r._fs.truncate(t,e,function(t){r._mu.unlock(),n(t)})})},wi.prototype.truncateSync=function(t,e){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.truncateSync(t,e)},wi.prototype.readFile=function(t,e,n,r){var i=this;this._mu.lock(function(){i._fs.readFile(t,e,n,function(t,e){i._mu.unlock(),r(t,e)})})},wi.prototype.readFileSync=function(t,e,n){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.readFileSync(t,e,n)},wi.prototype.writeFile=function(t,e,n,r,i,o){var s=this;this._mu.lock(function(){s._fs.writeFile(t,e,n,r,i,function(t){s._mu.unlock(),o(t)})})},wi.prototype.writeFileSync=function(t,e,n,r,i){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.writeFileSync(t,e,n,r,i)},wi.prototype.appendFile=function(t,e,n,r,i,o){var s=this; this._mu.lock(function(){s._fs.appendFile(t,e,n,r,i,function(t){s._mu.unlock(),o(t)})})},wi.prototype.appendFileSync=function(t,e,n,r,i){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.appendFileSync(t,e,n,r,i)},wi.prototype.chmod=function(t,e,n,r){var i=this;this._mu.lock(function(){i._fs.chmod(t,e,n,function(t){i._mu.unlock(),r(t)})})},wi.prototype.chmodSync=function(t,e,n){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.chmodSync(t,e,n)},wi.prototype.chown=function(t,e,n,r,i){var o=this;this._mu.lock(function(){o._fs.chown(t,e,n,r,function(t){o._mu.unlock(),i(t)})})},wi.prototype.chownSync=function(t,e,n,r){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.chownSync(t,e,n,r)},wi.prototype.utimes=function(t,e,n,r){var i=this;this._mu.lock(function(){i._fs.utimes(t,e,n,function(t){i._mu.unlock(),r(t)})})},wi.prototype.utimesSync=function(t,e,n){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.utimesSync(t,e,n)},wi.prototype.link=function(t,e,n){var r=this;this._mu.lock(function(){r._fs.link(t,e,function(t){r._mu.unlock(),n(t)})})},wi.prototype.linkSync=function(t,e){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.linkSync(t,e)},wi.prototype.symlink=function(t,e,n,r){var i=this;this._mu.lock(function(){i._fs.symlink(t,e,n,function(t){i._mu.unlock(),r(t)})})},wi.prototype.symlinkSync=function(t,e,n){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.symlinkSync(t,e,n)},wi.prototype.readlink=function(t,e){var n=this;this._mu.lock(function(){n._fs.readlink(t,function(t,r){n._mu.unlock(),e(t,r)})})},wi.prototype.readlinkSync=function(t){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.readlinkSync(t)};var mi,Ei="/.deletedFiles.log",Si=function(t){function e(e,n,r,i,o){t.call(this,e,n,r,i,o)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.sync=function(t){var e=this;return this.isDirty()?void this._fs._syncAsync(this,function(n){e.resetDirty(),t(n)}):void t(null)},e.prototype.syncSync=function(){this.isDirty()&&(this._fs._syncSync(this),this.resetDirty())},e.prototype.close=function(t){this.sync(t)},e.prototype.closeSync=function(){this.syncSync()},e}(Be),bi=function(t){function e(e,n){if(t.call(this),this._isInitialized=!1,this._initializeCallbacks=[],this._deletedFiles={},this._deleteLog="",this._deleteLogUpdatePending=!1,this._deleteLogUpdateNeeded=!1,this._deleteLogError=null,this._writable=e,this._readable=n,this._writable.isReadOnly())throw new me(ge.EINVAL,"Writable file system must be writable.")}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.isAvailable=function(){return!0},e.prototype.getOverlayedFileSystems=function(){return{readable:this._readable,writable:this._writable}},e.prototype._syncAsync=function(t,e){var n=this;this.createParentDirectoriesAsync(t.getPath(),function(r){return r?e(r):void n._writable.writeFile(t.getPath(),t.getBuffer(),null,Tt("w"),t.getStats().mode,e)})},e.prototype._syncSync=function(t){this.createParentDirectories(t.getPath()),this._writable.writeFileSync(t.getPath(),t.getBuffer(),null,Tt("w"),t.getStats().mode)},e.prototype.getName=function(){return"OverlayFS"},e.prototype.initialize=function(t){var e=this,n=this._initializeCallbacks,r=function(t){e._isInitialized=!t,e._initializeCallbacks=[],n.forEach(function(e){return e(t)})};return this._isInitialized?t():(n.push(t),void(1===n.length&&this._writable.readFile(Ei,"utf8",Tt("r"),function(t,n){if(t){if(t.errno!==ge.ENOENT)return r(t)}else e._deleteLog=n;e._reparseDeletionLog(),r()})))},e.prototype.isReadOnly=function(){return!1},e.prototype.supportsSynch=function(){return this._readable.supportsSynch()&&this._writable.supportsSynch()},e.prototype.supportsLinks=function(){return!1},e.prototype.supportsProps=function(){return this._readable.supportsProps()&&this._writable.supportsProps()},e.prototype.getDeletionLog=function(){return this._deleteLog},e.prototype.restoreDeletionLog=function(t){this._deleteLog=t,this._reparseDeletionLog(),this.updateLog("")},e.prototype.rename=function(t,e,n){var r=this;if(this.checkInitAsync(n)&&!this.checkPathAsync(t,n)&&!this.checkPathAsync(e,n))return t===Ei||e===Ei?n(me.EPERM("Cannot rename deletion log.")):t===e?n():void this.stat(t,!1,function(i,o){return i?n(i):r.stat(e,!1,function(i,s){function a(r){var i=r.shift();if(!i)return n();var o=ye.resolve(t,i),s=ye.resolve(e,i);c.rename(o,s,function(t){return t?n(t):void a(r)})}var c=r,u=511;if(o.isDirectory()){if(i)return i.errno!==ge.ENOENT?n(i):r._writable.exists(t,function(i){return i?r._writable.rename(t,e,n):void r._writable.mkdir(e,u,function(e){return e?n(e):void r._readable.readdir(t,function(t,e){return t?n():void a(e)})})});if(u=s.mode,!s.isDirectory())return n(me.ENOTDIR(e));r.readdir(e,function(i,o){return o&&o.length?n(me.ENOTEMPTY(e)):void r._readable.readdir(t,function(t,e){return t?n():void a(e)})})}return s&&s.isDirectory()?n(me.EISDIR(e)):void r.readFile(t,null,Tt("r"),function(i,s){return i?n(i):r.writeFile(e,s,null,Tt("w"),o.mode,function(e){return e?n(e):r.unlink(t,n)})})})})},e.prototype.renameSync=function(t,e){var n=this;if(this.checkInitialized(),this.checkPath(t),this.checkPath(e),t===Ei||e===Ei)throw me.EPERM("Cannot rename deletion log.");var r=this.statSync(t,!1);if(r.isDirectory()){if(t===e)return;var i=511;if(this.existsSync(e)){var o=this.statSync(e,!1);if(i=o.mode,!o.isDirectory())throw me.ENOTDIR(e);if(this.readdirSync(e).length>0)throw me.ENOTEMPTY(e)}this._writable.existsSync(t)?this._writable.renameSync(t,e):this._writable.existsSync(e)||this._writable.mkdirSync(e,i),this._readable.existsSync(t)&&this._readable.readdirSync(t).forEach(function(r){n.renameSync(ye.resolve(t,r),ye.resolve(e,r))})}else{if(this.existsSync(e)&&this.statSync(e,!1).isDirectory())throw me.EISDIR(e);this.writeFileSync(e,this.readFileSync(t,null,Tt("r")),null,Tt("w"),r.mode)}t!==e&&this.existsSync(t)&&this.unlinkSync(t)},e.prototype.stat=function(t,e,n){var r=this;this.checkInitAsync(n)&&this._writable.stat(t,e,function(i,o){i&&i.errno===ge.ENOENT?(r._deletedFiles[t]&&n(me.ENOENT(t)),r._readable.stat(t,e,function(t,e){e&&(e=e.clone(),e.mode=Lt(e.mode)),n(t,e)})):n(i,o)})},e.prototype.statSync=function(t,e){this.checkInitialized();try{return this._writable.statSync(t,e)}catch(r){if(this._deletedFiles[t])throw me.ENOENT(t);var n=this._readable.statSync(t,e).clone();return n.mode=Lt(n.mode),n}},e.prototype.open=function(t,e,n,r){var i=this;this.checkInitAsync(r)&&!this.checkPathAsync(t,r)&&this.stat(t,!1,function(o,s){if(s)switch(e.pathExistsAction()){case we.TRUNCATE_FILE:return i.createParentDirectoriesAsync(t,function(o){return o?r(o):void i._writable.open(t,e,n,r)});case we.NOP:return i._writable.exists(t,function(o){o?i._writable.open(t,e,n,r):(s=s.clone(),s.mode=n,i._readable.readFile(t,null,Tt("r"),function(n,o){if(n)return r(n);s.size===-1&&(s.size=o.length);var a=new Si(i,t,e,s,o);r(null,a)}))});default:return r(me.EEXIST(t))}else switch(e.pathNotExistsAction()){case we.CREATE_FILE:return i.createParentDirectoriesAsync(t,function(o){return o?r(o):i._writable.open(t,e,n,r)});default:return r(me.ENOENT(t))}})},e.prototype.openSync=function(t,e,n){if(this.checkInitialized(),this.checkPath(t),t===Ei)throw me.EPERM("Cannot open deletion log.");if(this.existsSync(t))switch(e.pathExistsAction()){case we.TRUNCATE_FILE:return this.createParentDirectories(t),this._writable.openSync(t,e,n);case we.NOP:if(this._writable.existsSync(t))return this._writable.openSync(t,e,n);var r=this._readable.readFileSync(t,null,Tt("r")),i=this._readable.statSync(t,!1).clone();return i.mode=n,new Si(this,t,e,i,r);default:throw me.EEXIST(t)}else switch(e.pathNotExistsAction()){case we.CREATE_FILE:return this.createParentDirectories(t),this._writable.openSync(t,e,n);default:throw me.ENOENT(t)}},e.prototype.unlink=function(t,e){var n=this;this.checkInitAsync(e)&&!this.checkPathAsync(t,e)&&this.exists(t,function(r){return r?void n._writable.exists(t,function(r){return r?n._writable.unlink(t,function(r){return r?e(r):void n.exists(t,function(r){r&&n.deletePath(t),e(null)})}):(n.deletePath(t),void e(null))}):e(me.ENOENT(t))})},e.prototype.unlinkSync=function(t){if(this.checkInitialized(),this.checkPath(t),!this.existsSync(t))throw me.ENOENT(t);this._writable.existsSync(t)&&this._writable.unlinkSync(t),this.existsSync(t)&&this.deletePath(t)},e.prototype.rmdir=function(t,e){var n=this;if(this.checkInitAsync(e)){var r=function(){n.readdir(t,function(r,i){return r?e(r):i.length?e(me.ENOTEMPTY(t)):(n.deletePath(t),void e(null))})};this.exists(t,function(i){return i?void n._writable.exists(t,function(i){i?n._writable.rmdir(t,function(i){return i?e(i):void n._readable.exists(t,function(t){t?r():e()})}):r()}):e(me.ENOENT(t))})}},e.prototype.rmdirSync=function(t){if(this.checkInitialized(),!this.existsSync(t))throw me.ENOENT(t);if(this._writable.existsSync(t)&&this._writable.rmdirSync(t),this.existsSync(t)){if(this.readdirSync(t).length>0)throw me.ENOTEMPTY(t);this.deletePath(t)}},e.prototype.mkdir=function(t,e,n){var r=this;this.checkInitAsync(n)&&this.exists(t,function(i){return i?n(me.EEXIST(t)):void r.createParentDirectoriesAsync(t,function(i){return i?n(i):void r._writable.mkdir(t,e,n)})})},e.prototype.mkdirSync=function(t,e){if(this.checkInitialized(),this.existsSync(t))throw me.EEXIST(t);this.createParentDirectories(t),this._writable.mkdirSync(t,e)},e.prototype.readdir=function(t,e){var n=this;this.checkInitAsync(e)&&this.stat(t,!1,function(r,i){return r?e(r):i.isDirectory()?void n._writable.readdir(t,function(r,i){return r&&"ENOENT"!==r.code?e(r):(!r&&i||(i=[]),void n._readable.readdir(t,function(r,o){!r&&o||(o=[]);var s={},a=i.concat(o.filter(function(e){return!n._deletedFiles[t+"/"+e]})).filter(function(t){var e=!s[t];return s[t]=!0,e});e(null,a)}))}):e(me.ENOTDIR(t))})},e.prototype.readdirSync=function(t){var e=this;this.checkInitialized();var n=this.statSync(t,!1);if(!n.isDirectory())throw me.ENOTDIR(t);var r=[];try{r=r.concat(this._writable.readdirSync(t))}catch(t){}try{r=r.concat(this._readable.readdirSync(t).filter(function(n){return!e._deletedFiles[t+"/"+n]}))}catch(t){}var i={};return r.filter(function(t){var e=!i[t];return i[t]=!0,e})},e.prototype.exists=function(t,e){var n=this;this.checkInitialized(),this._writable.exists(t,function(r){return r?e(!0):void n._readable.exists(t,function(r){e(r&&n._deletedFiles[t]!==!0)})})},e.prototype.existsSync=function(t){return this.checkInitialized(),this._writable.existsSync(t)||this._readable.existsSync(t)&&this._deletedFiles[t]!==!0},e.prototype.chmod=function(t,e,n,r){var i=this;this.checkInitAsync(r)&&this.operateOnWritableAsync(t,function(o){return o?r(o):void i._writable.chmod(t,e,n,r)})},e.prototype.chmodSync=function(t,e,n){var r=this;this.checkInitialized(),this.operateOnWritable(t,function(){r._writable.chmodSync(t,e,n)})},e.prototype.chown=function(t,e,n,r,i){var o=this;this.checkInitAsync(i)&&this.operateOnWritableAsync(t,function(s){return s?i(s):void o._writable.chown(t,e,n,r,i)})},e.prototype.chownSync=function(t,e,n,r){var i=this;this.checkInitialized(),this.operateOnWritable(t,function(){i._writable.chownSync(t,e,n,r)})},e.prototype.utimes=function(t,e,n,r){var i=this;this.checkInitAsync(r)&&this.operateOnWritableAsync(t,function(o){return o?r(o):void i._writable.utimes(t,e,n,r)})},e.prototype.utimesSync=function(t,e,n){var r=this;this.checkInitialized(),this.operateOnWritable(t,function(){r._writable.utimesSync(t,e,n)})},e.prototype.deletePath=function(t){this._deletedFiles[t]=!0,this.updateLog("d"+t+"\n")},e.prototype.updateLog=function(t){var e=this;this._deleteLog+=t,this._deleteLogUpdatePending?this._deleteLogUpdateNeeded=!0:(this._deleteLogUpdatePending=!0,this._writable.writeFile(Ei,this._deleteLog,"utf8",Se.getFileFlag("w"),420,function(t){e._deleteLogUpdatePending=!1,t?e._deleteLogError=t:e._deleteLogUpdateNeeded&&(e._deleteLogUpdateNeeded=!1,e.updateLog(""))}))},e.prototype._reparseDeletionLog=function(){var t=this;this._deletedFiles={},this._deleteLog.split("\n").forEach(function(e){t._deletedFiles[e.slice(1)]="d"===e.slice(0,1)})},e.prototype.checkInitialized=function(){if(!this._isInitialized)throw new me(ge.EPERM,"OverlayFS is not initialized. Please initialize OverlayFS using its initialize() method before using it.");if(null!==this._deleteLogError){var t=this._deleteLogError;throw this._deleteLogError=null,t}},e.prototype.checkInitAsync=function(t){if(!this._isInitialized)return t(new me(ge.EPERM,"OverlayFS is not initialized. Please initialize OverlayFS using its initialize() method before using it.")),!1;if(null!==this._deleteLogError){var e=this._deleteLogError;return this._deleteLogError=null,t(e),!1}return!0},e.prototype.checkPath=function(t){if(t===Ei)throw me.EPERM(t)},e.prototype.checkPathAsync=function(t,e){return t===Ei&&(e(me.EPERM(t)),!0)},e.prototype.createParentDirectoriesAsync=function(t,e){function n(t,e){t?(o.push(i),i=ye.dirname(i),s._writable.stat(i,!1,n)):r()}function r(){if(!o.length)return e();var t=o.pop();s._readable.stat(t,!1,function(n,i){return i?void s._writable.mkdir(t,i.mode,function(t){return t?e(t):void r()}):e()})}var i=ye.dirname(t),o=[],s=this;this._writable.stat(i,!1,n)},e.prototype.createParentDirectories=function(t){for(var e=this,n=ye.dirname(t),r=[];!this._writable.existsSync(n);)r.push(n),n=ye.dirname(n);r=r.reverse(),r.forEach(function(t){e._writable.mkdirSync(t,e.statSync(t,!1).mode)})},e.prototype.operateOnWritable=function(t,e){if(!this.existsSync(t))throw me.ENOENT(t);this._writable.existsSync(t)||this.copyToWritable(t),e()},e.prototype.operateOnWritableAsync=function(t,e){var n=this;this.exists(t,function(r){return r?void n._writable.exists(t,function(r){return r?void e():n.copyToWritableAsync(t,e)}):e(me.ENOENT(t))})},e.prototype.copyToWritable=function(t){var e=this.statSync(t,!1);e.isDirectory()?this._writable.mkdirSync(t,e.mode):this.writeFileSync(t,this._readable.readFileSync(t,null,Tt("r")),null,Tt("w"),this.statSync(t,!1).mode)},e.prototype.copyToWritableAsync=function(t,e){var n=this;this.stat(t,!1,function(r,i){return r?e(r):i.isDirectory()?n._writable.mkdir(t,i.mode,e):void n._readable.readFile(t,null,Tt("r"),function(r,o){return r?e(r):void n.writeFile(t,o,null,Tt("w"),i.mode,e)})})},e}(Ce),ki=function(t){function e(e,n){t.call(this,new bi(e,n))}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.isAvailable=function(){return bi.isAvailable()},e.prototype.initialize=function(e){t.prototype.initialize.call(this,e)},e.prototype.getOverlayedFileSystems=function(){return t.prototype.getFSUnlocked.call(this).getOverlayedFileSystems()},e.prototype.unwrap=function(){return t.prototype.getFSUnlocked.call(this)},e}(wi);!function(t){t[t.CB=0]="CB",t[t.FD=1]="FD",t[t.API_ERROR=2]="API_ERROR",t[t.STATS=3]="STATS",t[t.PROBE=4]="PROBE",t[t.FILEFLAG=5]="FILEFLAG",t[t.BUFFER=6]="BUFFER",t[t.ERROR=7]="ERROR"}(mi||(mi={}));var Ii=function(){this._callbacks={},this._nextId=0};Ii.prototype.toRemoteArg=function(t){var e=this._nextId++;return this._callbacks[e]=t,{type:mi.CB,id:e}},Ii.prototype.toLocalArg=function(t){var e=this._callbacks[t];return delete this._callbacks[t],e};var Oi=function(){this._fileDescriptors={},this._nextId=0};Oi.prototype.toRemoteArg=function(t,e,n,i){var o,s,a=this._nextId++;this._fileDescriptors[a]=t,t.stat(function(c,u){c?i(c):(s=jt(u.toBuffer()),n.isReadable()?t.read(new r(u.size),0,u.size,0,function(t,r,c){t?i(t):(o=jt(c),i(null,{type:mi.FD,id:a,data:o,stat:s,path:e,flag:n.getFlagString()}))}):i(null,{type:mi.FD,id:a,data:new ArrayBuffer(0),stat:s,path:e,flag:n.getFlagString()}))})},Oi.prototype.applyFdAPIRequest=function(t,e){var n=this,r=t.args[0];this._applyFdChanges(r,function(i,o){i?e(i):o[t.method](function(i){"close"===t.method&&delete n._fileDescriptors[r.id],e(i)})})},Oi.prototype._applyFdChanges=function(t,e){var n=this._fileDescriptors[t.id],r=zt(t.data),i=ke.fromBuffer(zt(t.stat)),o=Se.getFileFlag(t.flag);o.isWriteable()?n.write(r,0,r.length,o.isAppendable()?n.getPos():0,function(t){function s(){n.stat(function(t,r){t?e(t):r.mode!==i.mode?n.chmod(i.mode,function(t){e(t,n)}):e(t,n)})}t?e(t):o.isAppendable()?s():n.truncate(r.length,function(){s()})}):e(null,n)};var Fi=function(t){function e(e,n,r,i,o,s){t.call(this,e,n,r,i,s),this._remoteFdId=o}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getRemoteFdId=function(){return this._remoteFdId},e.prototype.toRemoteArg=function(){return{type:mi.FD,id:this._remoteFdId,data:jt(this.getBuffer()),stat:jt(this.getStats().toBuffer()),path:this.getPath(),flag:this.getFlag().getFlagString()}},e.prototype.sync=function(t){this._syncClose("sync",t)},e.prototype.close=function(t){this._syncClose("close",t)},e.prototype._syncClose=function(t,e){var n=this;this.isDirty()?this._fs.syncClose(t,this,function(t){t||n.resetDirty(),e(t)}):e()},e}(Be),Ri=function(t){function e(e){var n=this;t.call(this),this._callbackConverter=new Ii,this._isInitialized=!1,this._isReadOnly=!1,this._supportLinks=!1,this._supportProps=!1,this._worker=e,this._worker.addEventListener("message",function(t){var e=t.data;if(Ht(e)){var r,i=e.args,o=new Array(i.length);for(r=0;r0&&(u=-1,s={browserfsMessage:!0,cbId:o,args:[xt(e)]},t.postMessage(s))}var i,s,a=arguments,c=new Array(arguments.length),u=arguments.length;for(i=0;i0;){var i=void 0,o=r.pop(),s=o[0],a=o[1],c=o[2];for(var u in a)if(a.hasOwnProperty(u)){var f=a[u],h=s+"/"+u;f?(e._index[h]=i=new Di,r.push([h,f,i])):i=new xi(new ke(be.FILE,-1,365)),c&&(c._ls[u]=i)}}return e},Ti.prototype.fileIterator=function(t){var e=this;for(var n in e._index)if(e._index.hasOwnProperty(n))for(var r=e._index[n],i=r.getListing(),o=0;o0&&"/"!==n.charAt(n.length-1)&&(n+="/"),this.prefixUrl=n;var r=null;if("string"==typeof e){if(r=this._requestFileSync(e,"json"),!r)throw new Error("Unable to find listing at URL: ${listingUrlOrObj}")}else r=e;this._index=Ti.fromListing(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.isAvailable=function(){return"undefined"!=typeof XMLHttpRequest&&null!==XMLHttpRequest},e.prototype.empty=function(){this._index.fileIterator(function(t){t.fileData=null})},e.prototype._requestFileSizeAsync=function(t,e){Jt(this.getXhrPath(t),e)},e.prototype._requestFileSizeSync=function(t){return Gt(this.getXhrPath(t))},e.prototype.getName=function(){return"XmlHttpRequest"},e.prototype.diskSpace=function(t,e){e(0,0)},e.prototype.isReadOnly=function(){return!0},e.prototype.supportsLinks=function(){return!1},e.prototype.supportsProps=function(){return!1},e.prototype.supportsSynch=function(){return!0},e.prototype.preloadFile=function(t,e){var n=this._index.getInode(t);if(!Qt(n))throw me.EISDIR(t);if(null===n)throw me.ENOENT(t);var r=n.getData();r.size=e.length,r.fileData=e},e.prototype.stat=function(t,e,n){var r=this._index.getInode(t);if(null===r)return n(me.ENOENT(t));var i;Qt(r)?(i=r.getData(),i.size<0?this._requestFileSizeAsync(t,function(t,e){return t?n(t):(i.size=e,void n(null,i.clone()))}):n(null,i.clone())):$t(r)?(i=r.getStats(),n(null,i)):n(me.FileError(ge.EINVAL,t))},e.prototype.statSync=function(t,e){var n=this._index.getInode(t);if(null===n)throw me.ENOENT(t);var r;if(Qt(n))r=n.getData(),r.size<0&&(r.size=this._requestFileSizeSync(t));else{if(!$t(n))throw me.FileError(ge.EINVAL,t);r=n.getStats()}return r},e.prototype.open=function(t,e,n,r){if(e.isWriteable())return r(new me(ge.EPERM,t));var i=this,o=this._index.getInode(t);if(null===o)return r(me.ENOENT(t));if(!Qt(o))return r(me.EISDIR(t));var s=o.getData();switch(e.pathExistsAction()){case we.THROW_EXCEPTION:case we.TRUNCATE_FILE:return r(me.EEXIST(t));case we.NOP:if(s.fileData)return r(null,new je(i,t,e,s.clone(),s.fileData));this._requestFileAsync(t,"buffer",function(n,o){return n?r(n):(s.size=o.length,s.fileData=o,r(null,new je(i,t,e,s.clone(),o)))});break;default:return r(new me(ge.EINVAL,"Invalid FileMode object."))}},e.prototype.openSync=function(t,e,n){if(e.isWriteable())throw new me(ge.EPERM,t);var r=this._index.getInode(t);if(null===r)throw me.ENOENT(t);if(!Qt(r))throw me.EISDIR(t);var i=r.getData();switch(e.pathExistsAction()){case we.THROW_EXCEPTION:case we.TRUNCATE_FILE:throw me.EEXIST(t);case we.NOP:if(i.fileData)return new je(this,t,e,i.clone(),i.fileData);var o=this._requestFileSync(t,"buffer");return i.size=o.length,i.fileData=o,new je(this,t,e,i.clone(),o);default:throw new me(ge.EINVAL,"Invalid FileMode object.")}},e.prototype.readdir=function(t,e){try{e(null,this.readdirSync(t))}catch(t){e(t)}},e.prototype.readdirSync=function(t){var e=this._index.getInode(t);if(null===e)throw me.ENOENT(t);if($t(e))return e.getListing();throw me.ENOTDIR(t)},e.prototype.readFile=function(t,e,n,r){var i=r;this.open(t,n,420,function(t,n){if(t)return r(t);r=function(t,e){n.close(function(n){return t||(t=n),i(t,e)})};var o=n,s=o.getBuffer();null===e?r(t,w(s)):te(s,e,r)})},e.prototype.readFileSync=function(t,e,n){var r=this.openSync(t,n,420);try{var i=r,o=i.getBuffer();return null===e?w(o):o.toString(e)}finally{r.closeSync()}},e.prototype.getXhrPath=function(t){return"/"===t.charAt(0)&&(t=t.slice(1)),this.prefixUrl+t},e.prototype._requestFileAsync=function(t,e,n){Ni(this.getXhrPath(t),e,n)},e.prototype._requestFileSync=function(t,e){return Li(this.getXhrPath(t),e)},e}(Ce),Pi=function(){};Pi.str2byte=function(t,e){for(var n=t.length>e.length?e.length:t.length,r=0;r127){var o=Pi.extendedChars.indexOf(t.charAt(r));o>-1&&(i=o+128)}e[i]=r}return n},Pi.byte2str=function(t){for(var e=new Array(t.length),n=0;n127?e[n]=Pi.extendedChars[r-128]:e[n]=String.fromCharCode(r)}return e.join("")},Pi.byteLength=function(t){return t.length},Pi.extendedChars=["Ç","ü","é","â","ä","à","å","ç","ê","ë","è","ï","î","ì","Ä","Å","É","æ","Æ","ô","ö","ò","û","ù","ÿ","Ö","Ü","ø","£","Ø","×","ƒ","á","í","ó","ú","ñ","Ñ","ª","º","¿","®","¬","½","¼","¡","«","»","_","_","_","¦","¦","Á","Â","À","©","¦","¦","+","+","¢","¥","+","+","-","-","+","-","+","ã","Ã","+","+","-","-","¦","-","+","¤","ð","Ð","Ê","Ë","È","i","Í","Î","Ï","+","+","_","_","¦","Ì","_","Ó","ß","Ô","Ò","õ","Õ","µ","þ","Þ","Ú","Û","Ù","ý","Ý","¯","´","­","±","_","¾","¶","§","÷","¸","°","¨","·","¹","³","²","_"," "];var Ci,Ui=n(23).inflateRaw,Mi={};!function(t){t[t.MSDOS=0]="MSDOS",t[t.AMIGA=1]="AMIGA",t[t.OPENVMS=2]="OPENVMS",t[t.UNIX=3]="UNIX",t[t.VM_CMS=4]="VM_CMS",t[t.ATARI_ST=5]="ATARI_ST",t[t.OS2_HPFS=6]="OS2_HPFS",t[t.MAC=7]="MAC",t[t.Z_SYSTEM=8]="Z_SYSTEM",t[t.CP_M=9]="CP_M",t[t.NTFS=10]="NTFS",t[t.MVS=11]="MVS",t[t.VSE=12]="VSE",t[t.ACORN_RISC=13]="ACORN_RISC",t[t.VFAT=14]="VFAT",t[t.ALT_MVS=15]="ALT_MVS",t[t.BEOS=16]="BEOS",t[t.TANDEM=17]="TANDEM",t[t.OS_400=18]="OS_400",t[t.OSX=19]="OSX"}(Ci||(Ci={}));var Bi;!function(t){t[t.STORED=0]="STORED",t[t.SHRUNK=1]="SHRUNK",t[t.REDUCED_1=2]="REDUCED_1",t[t.REDUCED_2=3]="REDUCED_2",t[t.REDUCED_3=4]="REDUCED_3",t[t.REDUCED_4=5]="REDUCED_4",t[t.IMPLODE=6]="IMPLODE",t[t.DEFLATE=8]="DEFLATE",t[t.DEFLATE64=9]="DEFLATE64",t[t.TERSE_OLD=10]="TERSE_OLD",t[t.BZIP2=12]="BZIP2",t[t.LZMA=14]="LZMA",t[t.TERSE_NEW=18]="TERSE_NEW",t[t.LZ77=19]="LZ77",t[t.WAVPACK=97]="WAVPACK",t[t.PPMD=98]="PPMD"}(Bi||(Bi={}));var ji=function(t){if(this.data=t,67324752!==t.readUInt32LE(0))throw new me(ge.EINVAL,"Invalid Zip file: Local file header has invalid signature: "+this.data.readUInt32LE(0))};ji.prototype.versionNeeded=function(){return this.data.readUInt16LE(4)},ji.prototype.flags=function(){return this.data.readUInt16LE(6)},ji.prototype.compressionMethod=function(){return this.data.readUInt16LE(8)},ji.prototype.lastModFileTime=function(){return ee(this.data.readUInt16LE(10),this.data.readUInt16LE(12))},ji.prototype.rawLastModFileTime=function(){return this.data.readUInt32LE(10)},ji.prototype.crc32=function(){return this.data.readUInt32LE(14)},ji.prototype.fileNameLength=function(){return this.data.readUInt16LE(26)},ji.prototype.extraFieldLength=function(){return this.data.readUInt16LE(28)},ji.prototype.fileName=function(){return ne(this.data,this.useUTF8(),30,this.fileNameLength())},ji.prototype.extraField=function(){var t=30+this.fileNameLength();return this.data.slice(t,t+this.extraFieldLength())},ji.prototype.totalSize=function(){return 30+this.fileNameLength()+this.extraFieldLength()},ji.prototype.useUTF8=function(){return 2048===(2048&this.flags())};var zi=function(t,e,n){this.header=t,this.record=e,this.data=n};zi.prototype.decompress=function(){var t=this.header.compressionMethod(),e=Mi[t];if(e)return e(this.data,this.record.compressedSize(),this.record.uncompressedSize(),this.record.flag()); var n=Bi[t];throw n||(n="Unknown: "+t),new me(ge.EINVAL,"Invalid compression method on file '"+this.header.fileName()+"': "+n)},zi.prototype.getHeader=function(){return this.header},zi.prototype.getRecord=function(){return this.record},zi.prototype.getRawData=function(){return this.data};var qi=function(t){this.data=t};qi.prototype.crc32=function(){return this.data.readUInt32LE(0)},qi.prototype.compressedSize=function(){return this.data.readUInt32LE(4)},qi.prototype.uncompressedSize=function(){return this.data.readUInt32LE(8)};var Vi=function(t){if(this.data=t,134630224!==this.data.readUInt32LE(0))throw new me(ge.EINVAL,"Invalid archive extra data record signature: "+this.data.readUInt32LE(0))};Vi.prototype.length=function(){return this.data.readUInt32LE(4)},Vi.prototype.extraFieldData=function(){return this.data.slice(8,8+this.length())};var Wi=function(t){if(this.data=t,84233040!==this.data.readUInt32LE(0))throw new me(ge.EINVAL,"Invalid digital signature signature: "+this.data.readUInt32LE(0))};Wi.prototype.size=function(){return this.data.readUInt16LE(4)},Wi.prototype.signatureData=function(){return this.data.slice(6,6+this.size())};var Hi=function(t,e){if(this.zipData=t,this.data=e,33639248!==this.data.readUInt32LE(0))throw new me(ge.EINVAL,"Invalid Zip file: Central directory record has invalid signature: "+this.data.readUInt32LE(0));this._filename=this.produceFilename()};Hi.prototype.versionMadeBy=function(){return this.data.readUInt16LE(4)},Hi.prototype.versionNeeded=function(){return this.data.readUInt16LE(6)},Hi.prototype.flag=function(){return this.data.readUInt16LE(8)},Hi.prototype.compressionMethod=function(){return this.data.readUInt16LE(10)},Hi.prototype.lastModFileTime=function(){return ee(this.data.readUInt16LE(12),this.data.readUInt16LE(14))},Hi.prototype.rawLastModFileTime=function(){return this.data.readUInt32LE(12)},Hi.prototype.crc32=function(){return this.data.readUInt32LE(16)},Hi.prototype.compressedSize=function(){return this.data.readUInt32LE(20)},Hi.prototype.uncompressedSize=function(){return this.data.readUInt32LE(24)},Hi.prototype.fileNameLength=function(){return this.data.readUInt16LE(28)},Hi.prototype.extraFieldLength=function(){return this.data.readUInt16LE(30)},Hi.prototype.fileCommentLength=function(){return this.data.readUInt16LE(32)},Hi.prototype.diskNumberStart=function(){return this.data.readUInt16LE(34)},Hi.prototype.internalAttributes=function(){return this.data.readUInt16LE(36)},Hi.prototype.externalAttributes=function(){return this.data.readUInt32LE(38)},Hi.prototype.headerRelativeOffset=function(){return this.data.readUInt32LE(42)},Hi.prototype.produceFilename=function(){var t=ne(this.data,this.useUTF8(),46,this.fileNameLength());return t.replace(/\\/g,"/")},Hi.prototype.fileName=function(){return this._filename},Hi.prototype.rawFileName=function(){return this.data.slice(46,46+this.fileNameLength())},Hi.prototype.extraField=function(){var t=44+this.fileNameLength();return this.data.slice(t,t+this.extraFieldLength())},Hi.prototype.fileComment=function(){var t=46+this.fileNameLength()+this.extraFieldLength();return ne(this.data,this.useUTF8(),t,this.fileCommentLength())},Hi.prototype.rawFileComment=function(){var t=46+this.fileNameLength()+this.extraFieldLength();return this.data.slice(t,t+this.fileCommentLength())},Hi.prototype.totalSize=function(){return 46+this.fileNameLength()+this.extraFieldLength()+this.fileCommentLength()},Hi.prototype.isDirectory=function(){var t=this.fileName();return!!(16&this.externalAttributes())||"/"===t.charAt(t.length-1)},Hi.prototype.isFile=function(){return!this.isDirectory()},Hi.prototype.useUTF8=function(){return 2048===(2048&this.flag())},Hi.prototype.isEncrypted=function(){return 1===(1&this.flag())},Hi.prototype.getFileData=function(){var t=this.headerRelativeOffset(),e=new ji(this.zipData.slice(t));return new zi(e,this,this.zipData.slice(t+e.totalSize()))},Hi.prototype.getData=function(){return this.getFileData().decompress()},Hi.prototype.getRawData=function(){return this.getFileData().getRawData()},Hi.prototype.getStats=function(){return new ke(be.FILE,this.uncompressedSize(),365,new Date,this.lastModFileTime())};var Zi=function(t){if(this.data=t,101010256!==this.data.readUInt32LE(0))throw new me(ge.EINVAL,"Invalid Zip file: End of central directory record has invalid signature: "+this.data.readUInt32LE(0))};Zi.prototype.diskNumber=function(){return this.data.readUInt16LE(4)},Zi.prototype.cdDiskNumber=function(){return this.data.readUInt16LE(6)},Zi.prototype.cdDiskEntryCount=function(){return this.data.readUInt16LE(8)},Zi.prototype.cdTotalEntryCount=function(){return this.data.readUInt16LE(10)},Zi.prototype.cdSize=function(){return this.data.readUInt32LE(12)},Zi.prototype.cdOffset=function(){return this.data.readUInt32LE(16)},Zi.prototype.cdZipCommentLength=function(){return this.data.readUInt16LE(20)},Zi.prototype.cdZipComment=function(){return ne(this.data,!0,22,this.cdZipCommentLength())},Zi.prototype.rawCdZipComment=function(){return this.data.slice(22,22+this.cdZipCommentLength())};var Yi=function(t,e,n,r){this.index=t,this.directoryEntries=e,this.eocd=n,this.data=r},Xi=function(t){function e(e,n){void 0===n&&(n=""),t.call(this),this.name=n,this._index=new Ti,this._directoryEntries=[],this._eocd=null,e instanceof Yi?(this._index=e.index,this._directoryEntries=e.directoryEntries,this._eocd=e.eocd,this.data=e.data):(this.data=e,this.populateIndex())}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.isAvailable=function(){return!0},e.RegisterDecompressionMethod=function(t,e){Mi[t]=e},e.computeIndex=function(t,n){var r=new Ti,i=e.getEOCD(t);if(i.diskNumber()!==i.cdDiskNumber())throw new me(ge.EINVAL,"ZipFS does not support spanned zip files.");var o=i.cdOffset();if(4294967295===o)throw new me(ge.EINVAL,"ZipFS does not support Zip64.");var s=o+i.cdSize();e.computeIndexResponsive(t,r,o,s,n,[],i)},e.getEOCD=function(t){for(var e=22,n=Math.min(e+65535,t.length-1),r=e;r-1},to.prototype.getRockRidgeOffset=function(){return this._rockRidgeOffset},to.prototype.rootCheckForRockRidge=function(t){var e=this.getDirectory(t);this._rockRidgeOffset=e.getDotEntry(t)._getRockRidgeOffset(t),this._rockRidgeOffset>-1&&(this._fileOrDir=null)},to.prototype.length=function(){return this._data[0]},to.prototype.extendedAttributeRecordLength=function(){return this._data[1]},to.prototype.lba=function(){return 2048*this._data.readUInt32LE(2)},to.prototype.dataLength=function(){return this._data.readUInt32LE(10)},to.prototype.recordingDate=function(){return se(this._data,18)},to.prototype.fileFlags=function(){return this._data[25]},to.prototype.fileUnitSize=function(){return this._data[26]},to.prototype.interleaveGapSize=function(){return this._data[27]},to.prototype.volumeSequenceNumber=function(){return this._data.readUInt16LE(28)},to.prototype.identifier=function(){return this._getString(33,this._data[32])},to.prototype.fileName=function(t){if(this.hasRockRidge()){var e=this._rockRidgeFilename(t);if(null!==e)return e}var n=this.identifier();if(this.isDirectory(t))return n;var r=n.indexOf(";");return r===-1?n:"."===n[r-1]?n.slice(0,r-1):n.slice(0,r)},to.prototype.isDirectory=function(t){var e=!!(2&this.fileFlags());return!e&&this.hasRockRidge()&&(e=this.getSUEntries(t).filter(function(t){return t instanceof _o}).length>0),e},to.prototype.isSymlink=function(t){return this.hasRockRidge()&&this.getSUEntries(t).filter(function(t){return t instanceof lo}).length>0},to.prototype.getSymlinkPath=function(t){for(var e="",n=this.getSUEntries(t),r=this._getGetString(),i=0;i1&&"/"===e[e.length-1]?e.slice(0,e.length-1):e},to.prototype.getFile=function(t){if(this.isDirectory(t))throw new Error("Tried to get a File from a directory.");return null===this._fileOrDir&&(this._fileOrDir=t.slice(this.lba(),this.lba()+this.dataLength())),this._fileOrDir},to.prototype.getDirectory=function(t){if(!this.isDirectory(t))throw new Error("Tried to get a Directory from a file.");return null===this._fileOrDir&&(this._fileOrDir=this._constructDirectory(t)),this._fileOrDir},to.prototype.getSUEntries=function(t){return this._suEntries||this._constructSUEntries(t),this._suEntries},to.prototype._rockRidgeFilename=function(t){var e=this.getSUEntries(t).filter(function(t){return t instanceof go});if(0===e.length||6&e[0].flags())return null;for(var n="",r=this._getGetString(),i=0;i0){var n=e[0];if(n instanceof so&&n.checkBytesPass())for(var r=1;r0)){var e=Ro.shift();return e()}};Fo.addEventListener?Fo.addEventListener("message",To,!0):Fo.attachEvent("onmessage",To)}else if(Fo.MessageChannel){var xo=new Fo.MessageChannel;xo.port1.onmessage=function(t){if(Ro.length>0)return Ro.shift()()},Fo.setImmediate=function(t){Ro.push(t),xo.port2.postMessage("")}}else Fo.setImmediate=function(t){return setTimeout(t,0)}}"undefined"!=typeof ArrayBuffer&&"undefined"!=typeof Uint8Array&&(Uint8Array.prototype.slice||(Uint8Array.prototype.slice=function(t,e){void 0===t&&(t=0),void 0===e&&(e=this.length);var n=this;return t<0&&(t=this.length+t,t<0&&(t=0)),e<0&&(e=this.length+e,e<0&&(e=0)),e * @license MIT */ "use strict";function r(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()}catch(t){return!1}}function i(e){if(e>K)throw new RangeError("Invalid typed array length");var n=new Uint8Array(e);return n.__proto__=t.prototype,n}function t(t,e,n){if("number"==typeof t){if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return c(t)}return o(t,e,n)}function o(t,e,n){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer?h(t,e,n):"string"==typeof t?u(t,e):p(t)}function s(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function a(t,e,n){return s(t),t<=0?i(t):void 0!==e?"string"==typeof n?i(t).fill(e,n):i(t).fill(e):i(t)}function c(t){return s(t),i(t<0?0:0|l(t))}function u(e,n){if("string"==typeof n&&""!==n||(n="utf8"),!t.isEncoding(n))throw new TypeError('"encoding" must be a valid string encoding');var r=0|y(e,n),o=i(r),s=o.write(e,n);return s!==r&&(o=o.slice(0,s)),o}function f(t){for(var e=t.length<0?0:0|l(t.length),n=i(e),r=0;r=K)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+K.toString(16)+" bytes");return 0|t}function d(e){return+e!=e&&(e=0),t.alloc(+e)}function y(e,n){if(t.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var r=e.length;if(0===r)return 0;for(var i=!1;;)switch(n){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return z(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return W(e).length;default:if(i)return z(e).length;n=(""+n).toLowerCase(),i=!0}}function g(t,e,n){var r=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if(n>>>=0,e>>>=0,n<=e)return"";for(t||(t="utf8");;)switch(t){case"hex":return T(this,e,n);case"utf8":case"utf-8":return F(this,e,n);case"ascii":return N(this,e,n);case"latin1":case"binary":return L(this,e,n);case"base64":return O(this,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return x(this,e,n);default:if(r)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),r=!0}}function _(t,e,n){var r=t[e];t[e]=t[n],t[n]=r}function v(e,n,r,i,o){if(0===e.length)return-1;if("string"==typeof r?(i=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=o?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(o)return-1;r=e.length-1}else if(r<0){if(!o)return-1;r=0}if("string"==typeof n&&(n=t.from(n,i)),t.isBuffer(n))return 0===n.length?-1:w(e,n,r,i,o);if("number"==typeof n)return n&=255,"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(e,n,r):Uint8Array.prototype.lastIndexOf.call(e,n,r):w(e,[n],r,i,o);throw new TypeError("val must be string, number or Buffer")}function w(t,e,n,r,i){function o(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}var s=1,a=t.length,c=e.length;if(void 0!==r&&(r=String(r).toLowerCase(),"ucs2"===r||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(t.length<2||e.length<2)return-1;s=2,a/=2,c/=2,n/=2}var u;if(i){var f=-1;for(u=n;ua&&(n=a-c),u=n;u>=0;u--){for(var h=!0,p=0;pi&&(r=i)):r=i;var o=e.length;if(o%2!==0)throw new TypeError("Invalid hex string");r>o/2&&(r=o/2);for(var s=0;s239?4:o>223?3:o>191?2:1;if(i+a<=n){var c,u,f,h;switch(a){case 1:o<128&&(s=o);break;case 2:c=t[i+1],128===(192&c)&&(h=(31&o)<<6|63&c,h>127&&(s=h));break;case 3:c=t[i+1],u=t[i+2],128===(192&c)&&128===(192&u)&&(h=(15&o)<<12|(63&c)<<6|63&u,h>2047&&(h<55296||h>57343)&&(s=h));break;case 4:c=t[i+1],u=t[i+2],f=t[i+3],128===(192&c)&&128===(192&u)&&128===(192&f)&&(h=(15&o)<<18|(63&c)<<12|(63&u)<<6|63&f,h>65535&&h<1114112&&(s=h))}}null===s?(s=65533,a=1):s>65535&&(s-=65536,r.push(s>>>10&1023|55296),s=56320|1023&s),r.push(s),i+=a}return R(r)}function R(t){var e=t.length;if(e<=G)return String.fromCharCode.apply(String,t);for(var n="",r=0;rr)&&(n=r);for(var i="",o=e;on)throw new RangeError("Trying to access beyond buffer length")}function A(e,n,r,i,o,s){if(!t.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(n>o||ne.length)throw new RangeError("Index out of range")}function P(t,e,n,r,i,o){if(n+r>t.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function C(t,e,n,r,i){return e=+e,n>>>=0,i||P(t,e,n,4,3.4028234663852886e38,-3.4028234663852886e38),X.write(t,e,n,r,23,4),n+4}function U(t,e,n,r,i){return e=+e,n>>>=0,i||P(t,e,n,8,1.7976931348623157e308,-1.7976931348623157e308),X.write(t,e,n,r,52,8),n+8}function M(t){if(t=B(t).replace(J,""),t.length<2)return"";for(;t.length%4!==0;)t+="=";return t}function B(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function j(t){return t<16?"0"+t.toString(16):t.toString(16)}function z(t,e){e=e||1/0;for(var n,r=t.length,i=null,o=[],s=0;s55295&&n<57344){if(!i){if(n>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(s+1===r){(e-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(e-=3)>-1&&o.push(239,191,189),i=n;continue}n=(i-55296<<10|n-56320)+65536}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((e-=1)<0)break;o.push(n)}else if(n<2048){if((e-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((e-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function q(t){for(var e=[],n=0;n>8,i=n%256,o.push(i),o.push(r);return o}function W(t){return Y.toByteArray(M(t))}function H(t,e,n,r){for(var i=0;i=e.length||i>=t.length);++i)e[i+n]=t[i];return i}function Z(t){return t!==t}var Y=n(18),X=n(21);e.Buffer=t,e.SlowBuffer=d,e.INSPECT_MAX_BYTES=50;var K=2147483647;e.kMaxLength=K,t.TYPED_ARRAY_SUPPORT=r(),t.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||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."),"undefined"!=typeof Symbol&&Symbol.species&&t[Symbol.species]===t&&Object.defineProperty(t,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),t.poolSize=8192,t.from=function(t,e,n){return o(t,e,n)},t.prototype.__proto__=Uint8Array.prototype,t.__proto__=Uint8Array,t.alloc=function(t,e,n){return a(t,e,n)},t.allocUnsafe=function(t){return c(t)},t.allocUnsafeSlow=function(t){return c(t)},t.isBuffer=function(t){return!(null==t||!t._isBuffer)},t.compare=function(e,n){if(!t.isBuffer(e)||!t.isBuffer(n))throw new TypeError("Arguments must be Buffers");if(e===n)return 0;for(var r=e.length,i=n.length,o=0,s=Math.min(r,i);o0&&(t=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(t+=" ... ")),""},t.prototype.compare=function(e,n,r,i,o){if(!t.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===n&&(n=0),void 0===r&&(r=e?e.length:0),void 0===i&&(i=0),void 0===o&&(o=this.length),n<0||r>e.length||i<0||o>this.length)throw new RangeError("out of range index");if(i>=o&&n>=r)return 0;if(i>=o)return-1;if(n>=r)return 1;if(n>>>=0,r>>>=0,i>>>=0,o>>>=0,this===e)return 0;for(var s=o-i,a=r-n,c=Math.min(s,a),u=this.slice(i,o),f=e.slice(n,r),h=0;h>>=0,isFinite(n)?(n>>>=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}var i=this.length-e;if((void 0===n||n>i)&&(n=i),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var o=!1;;)switch(r){case"hex":return m(this,t,e,n);case"utf8":case"utf-8":return E(this,t,e,n);case"ascii":return S(this,t,e,n);case"latin1":case"binary":return b(this,t,e,n);case"base64":return k(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return I(this,t,e,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},t.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var G=4096;t.prototype.slice=function(e,n){var r=this.length;e=~~e,n=void 0===n?r:~~n,e<0?(e+=r,e<0&&(e=0)):e>r&&(e=r),n<0?(n+=r,n<0&&(n=0)):n>r&&(n=r),n>>=0,e>>>=0,n||D(t,e,this.length);for(var r=this[t],i=1,o=0;++o>>=0,e>>>=0,n||D(t,e,this.length);for(var r=this[t+--e],i=1;e>0&&(i*=256);)r+=this[t+--e]*i;return r},t.prototype.readUInt8=function(t,e){return t>>>=0,e||D(t,1,this.length),this[t]},t.prototype.readUInt16LE=function(t,e){return t>>>=0,e||D(t,2,this.length),this[t]|this[t+1]<<8},t.prototype.readUInt16BE=function(t,e){return t>>>=0,e||D(t,2,this.length),this[t]<<8|this[t+1]},t.prototype.readUInt32LE=function(t,e){return t>>>=0,e||D(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},t.prototype.readUInt32BE=function(t,e){return t>>>=0,e||D(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},t.prototype.readIntLE=function(t,e,n){t>>>=0,e>>>=0,n||D(t,e,this.length);for(var r=this[t],i=1,o=0;++o=i&&(r-=Math.pow(2,8*e)),r},t.prototype.readIntBE=function(t,e,n){t>>>=0,e>>>=0,n||D(t,e,this.length);for(var r=e,i=1,o=this[t+--r];r>0&&(i*=256);)o+=this[t+--r]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*e)),o},t.prototype.readInt8=function(t,e){return t>>>=0,e||D(t,1,this.length),128&this[t]?(255-this[t]+1)*-1:this[t]},t.prototype.readInt16LE=function(t,e){t>>>=0,e||D(t,2,this.length);var n=this[t]|this[t+1]<<8;return 32768&n?4294901760|n:n},t.prototype.readInt16BE=function(t,e){t>>>=0,e||D(t,2,this.length);var n=this[t+1]|this[t]<<8;return 32768&n?4294901760|n:n},t.prototype.readInt32LE=function(t,e){return t>>>=0,e||D(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},t.prototype.readInt32BE=function(t,e){return t>>>=0,e||D(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},t.prototype.readFloatLE=function(t,e){return t>>>=0,e||D(t,4,this.length),X.read(this,t,!0,23,4)},t.prototype.readFloatBE=function(t,e){return t>>>=0,e||D(t,4,this.length),X.read(this,t,!1,23,4)},t.prototype.readDoubleLE=function(t,e){return t>>>=0,e||D(t,8,this.length),X.read(this,t,!0,52,8)},t.prototype.readDoubleBE=function(t,e){return t>>>=0,e||D(t,8,this.length),X.read(this,t,!1,52,8)},t.prototype.writeUIntLE=function(t,e,n,r){if(t=+t,e>>>=0,n>>>=0,!r){var i=Math.pow(2,8*n)-1;A(this,t,e,n,i,0)}var o=1,s=0;for(this[e]=255&t;++s>>=0,n>>>=0,!r){var i=Math.pow(2,8*n)-1;A(this,t,e,n,i,0)}var o=n-1,s=1;for(this[e+o]=255&t;--o>=0&&(s*=256);)this[e+o]=t/s&255;return e+n},t.prototype.writeUInt8=function(t,e,n){return t=+t,e>>>=0,n||A(this,t,e,1,255,0),this[e]=255&t,e+1},t.prototype.writeUInt16LE=function(t,e,n){return t=+t,e>>>=0,n||A(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},t.prototype.writeUInt16BE=function(t,e,n){return t=+t,e>>>=0,n||A(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},t.prototype.writeUInt32LE=function(t,e,n){return t=+t,e>>>=0,n||A(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},t.prototype.writeUInt32BE=function(t,e,n){return t=+t,e>>>=0,n||A(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},t.prototype.writeIntLE=function(t,e,n,r){if(t=+t,e>>>=0,!r){var i=Math.pow(2,8*n-1);A(this,t,e,n,i-1,-i)}var o=0,s=1,a=0;for(this[e]=255&t;++o>0)-a&255;return e+n},t.prototype.writeIntBE=function(t,e,n,r){if(t=+t,e>>>=0,!r){var i=Math.pow(2,8*n-1);A(this,t,e,n,i-1,-i)}var o=n-1,s=1,a=0;for(this[e+o]=255&t;--o>=0&&(s*=256);)t<0&&0===a&&0!==this[e+o+1]&&(a=1),this[e+o]=(t/s>>0)-a&255;return e+n},t.prototype.writeInt8=function(t,e,n){return t=+t,e>>>=0,n||A(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},t.prototype.writeInt16LE=function(t,e,n){return t=+t,e>>>=0,n||A(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},t.prototype.writeInt16BE=function(t,e,n){return t=+t,e>>>=0,n||A(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},t.prototype.writeInt32LE=function(t,e,n){return t=+t,e>>>=0,n||A(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},t.prototype.writeInt32BE=function(t,e,n){return t=+t,e>>>=0,n||A(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},t.prototype.writeFloatLE=function(t,e,n){return C(this,t,e,!0,n)},t.prototype.writeFloatBE=function(t,e,n){return C(this,t,e,!1,n)},t.prototype.writeDoubleLE=function(t,e,n){return U(this,t,e,!0,n)},t.prototype.writeDoubleBE=function(t,e,n){return U(this,t,e,!1,n)},t.prototype.copy=function(t,e,n,r){if(n||(n=0),r||0===r||(r=this.length),e>=t.length&&(e=t.length),e||(e=0),r>0&&r=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),t.length-e=0;--i)t[i+e]=this[i+n];else if(o<1e3)for(i=0;i>>=0,r=void 0===r?this.length:r>>>0,e||(e=0);var s;if("number"==typeof e)for(s=n;s0&&this._events[t].length>i&&(this._events[t].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[t].length),"function"==typeof console.trace&&console.trace())),this},n.prototype.on=n.prototype.addListener,n.prototype.once=function(t,e){function n(){this.removeListener(t,n),i||(i=!0,e.apply(this,arguments))}if(!r(e))throw TypeError("listener must be a function");var i=!1;return n.listener=e,this.on(t,n),this},n.prototype.removeListener=function(t,e){var n,i,s,a;if(!r(e))throw TypeError("listener must be a function");if(!this._events||!this._events[t])return this;if(n=this._events[t],s=n.length,i=-1,n===e||r(n.listener)&&n.listener===e)delete this._events[t],this._events.removeListener&&this.emit("removeListener",t,e);else if(o(n)){for(a=s;a-- >0;)if(n[a]===e||n[a].listener&&n[a].listener===e){i=a;break}if(i<0)return this;1===n.length?(n.length=0,delete this._events[t]):n.splice(i,1),this._events.removeListener&&this.emit("removeListener",t,e)}return this},n.prototype.removeAllListeners=function(t){var e,n;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[t]&&delete this._events[t],this;if(0===arguments.length){for(e in this._events)"removeListener"!==e&&this.removeAllListeners(e);return this.removeAllListeners("removeListener"),this._events={},this}if(n=this._events[t],r(n))this.removeListener(t,n);else if(n)for(;n.length;)this.removeListener(t,n[n.length-1]);return delete this._events[t],this},n.prototype.listeners=function(t){var e;return e=this._events&&this._events[t]?r(this._events[t])?[this._events[t]]:this._events[t].slice():[]},n.prototype.listenerCount=function(t){if(this._events){var e=this._events[t];if(r(e))return 1;if(e)return e.length}return 0},n.listenerCount=function(t,e){return t.listenerCount(e)}},function(t,e,n){t.exports=n(1).Buffer},function(t,e){"use strict";var n="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;e.assign=function(t){for(var e=Array.prototype.slice.call(arguments,1);e.length;){var n=e.shift();if(n){if("object"!=typeof n)throw new TypeError(n+"must be non-object");for(var r in n)n.hasOwnProperty(r)&&(t[r]=n[r])}}return t},e.shrinkBuf=function(t,e){return t.length===e?t:t.subarray?t.subarray(0,e):(t.length=e,t)};var r={arraySet:function(t,e,n,r,i){if(e.subarray&&t.subarray)return void t.set(e.subarray(n,n+r),i);for(var o=0;os)throw new RangeError("size is too large");var r=n,o=e;void 0===o&&(r=void 0,o=0);var a=new i(t);if("string"==typeof o)for(var c=new i(o,r),u=c.length,f=-1;++fs)throw new RangeError("size is too large");return new i(t)},e.from=function(e,n,r){if("function"==typeof i.from&&(!t.Uint8Array||Uint8Array.from!==i.from))return i.from(e,n,r);if("number"==typeof e)throw new TypeError('"value" argument must not be a number');if("string"==typeof e)return new i(e,n);if("undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer){var o=n;if(1===arguments.length)return new i(e);"undefined"==typeof o&&(o=0);var s=r;if("undefined"==typeof s&&(s=e.byteLength-o),o>=e.byteLength)throw new RangeError("'offset' is out of bounds");if(s>e.byteLength-o)throw new RangeError("'length' is out of bounds");return new i(e.slice(o,o+s))}if(i.isBuffer(e)){var a=new i(e.length);return e.copy(a,0,0,e.length),a}if(e){if(Array.isArray(e)||"undefined"!=typeof ArrayBuffer&&e.buffer instanceof ArrayBuffer||"length"in e)return new i(e);if("Buffer"===e.type&&Array.isArray(e.data))return new i(e.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")},e.allocUnsafeSlow=function(t){if("function"==typeof i.allocUnsafeSlow)return i.allocUnsafeSlow(t);if("number"!=typeof t)throw new TypeError("size must be a number");if(t>=s)throw new RangeError("size is too large");return new o(t)}}).call(e,function(){return this}())},function(t,e,n){(function(e){"use strict";function n(t,n,r,i){if("function"!=typeof t)throw new TypeError('"callback" argument must be a function');var o,s,a=arguments.length;switch(a){case 0:case 1:return e.nextTick(t);case 2:return e.nextTick(function(){t.call(null,n)});case 3:return e.nextTick(function(){t.call(null,n,r)});case 4:return e.nextTick(function(){t.call(null,n,r,i)});default:for(o=new Array(a-1),s=0;s-1?setImmediate:k;s.WritableState=o;var O=n(5);O.inherits=n(4);var F,R={deprecate:n(40)};!function(){try{F=n(9)}catch(t){}finally{F||(F=n(6).EventEmitter)}}();var N=n(1).Buffer,L=n(10);O.inherits(s,F),o.prototype.getBuffer=function(){for(var t=this.bufferedRequest,e=[];t;)e.push(t),t=t.next;return e},function(){try{Object.defineProperty(o.prototype,"buffer",{get:R.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.")})}catch(t){}}();var T;"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(T=Function.prototype[Symbol.hasInstance],Object.defineProperty(s,Symbol.hasInstance,{value:function(t){return!!T.call(this,t)||t&&t._writableState instanceof o}})):T=function(t){return t instanceof this},s.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},s.prototype.write=function(t,e,n){var i=this._writableState,o=!1;return"function"==typeof e&&(n=e,e=null),N.isBuffer(t)?e="buffer":e||(e=i.defaultEncoding),"function"!=typeof n&&(n=r),i.ended?a(this,n):c(this,i,t,n)&&(i.pendingcb++,o=f(this,i,t,e,n)),o},s.prototype.cork=function(){var t=this._writableState;t.corked++},s.prototype.uncork=function(){var t=this._writableState;t.corked&&(t.corked--,t.writing||t.corked||t.finished||t.bufferProcessing||!t.bufferedRequest||_(this,t))},s.prototype.setDefaultEncoding=function(t){if("string"==typeof t&&(t=t.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((t+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},s.prototype._write=function(t,e,n){n(new Error("_write() is not implemented"))},s.prototype._writev=null,s.prototype.end=function(t,e,n){var r=this._writableState;"function"==typeof t?(n=t,t=null,e=null):"function"==typeof e&&(n=e,e=null),null!==t&&void 0!==t&&this.write(t,e),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||E(this,r,n)}}).call(e,n(3))},function(t,e,n){(function(e){"use strict";function n(t){var e=r.exec(t);return e.shift(),e}var r=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/,i=function(){function t(){}return t.normalize=function(e){""===e&&(e=".");var n=e.charAt(0)===t.sep;e=t._removeDuplicateSeps(e);for(var r=e.split(t.sep),i=[],o=0;o0&&".."!==i[0])?i.pop():i.push(s))}if(!n&&i.length<2)switch(i.length){case 1:""===i[0]&&i.unshift(".");break;default:i.push(".")}return e=i.join(t.sep),n&&e.charAt(0)!==t.sep&&(e=t.sep+e),e},t.join=function(){for(var e=[],n=0;n1&&a.charAt(a.length-1)===t.sep)return a.substr(0,a.length-1);if(a.charAt(0)!==t.sep){"."!==a.charAt(0)||1!==a.length&&a.charAt(1)!==t.sep||(a=1===a.length?"":a.substr(2));var c=e.cwd();a=""!==a?this.normalize(c+("/"!==c?t.sep:"")+a):c}return a},t.relative=function(e,n){var r;e=t.resolve(e),n=t.resolve(n);var i=e.split(t.sep),o=n.split(t.sep);o.shift(),i.shift();var s=0,a=[];for(r=0;ri.length&&(s=i.length);var u="";for(r=0;r1&&u.charAt(u.length-1)===t.sep&&(u=u.substr(0,u.length-1)),u},t.dirname=function(e){e=t._removeDuplicateSeps(e);var n=e.charAt(0)===t.sep,r=e.split(t.sep);return""===r.pop()&&r.length>0&&r.pop(),r.length>1||1===r.length&&!n?r.join(t.sep):n?t.sep:"."},t.basename=function(e,n){if(void 0===n&&(n=""),""===e)return e;e=t.normalize(e);var r=e.split(t.sep),i=r[r.length-1];if(""===i&&r.length>1)return r[r.length-2];if(n.length>0){var o=i.substr(i.length-n.length);if(o===n)return i.substr(0,i.length-n.length)}return i},t.extname=function(e){e=t.normalize(e);var n=e.split(t.sep);if(e=n.pop(),""===e&&n.length>0&&(e=n.pop()),".."===e)return"";var r=e.lastIndexOf(".");return r===-1||0===r?"":e.substr(r)},t.isAbsolute=function(e){return e.length>0&&e.charAt(0)===t.sep},t._makeLong=function(t){return t},t.parse=function(t){var e=n(t);return{root:e[0],dir:e[0]+e[1].slice(0,-1),base:e[2],ext:e[3],name:e[2].slice(0,e[2].length-e[3].length)}},t.format=function(e){if(null===e||"object"!=typeof e)throw new TypeError("Parameter 'pathObject' must be an object, not "+typeof e);var n=e.root||"";if("string"!=typeof n)throw new TypeError("'pathObject.root' must be a string or undefined, not "+typeof e.root);var r=e.dir?e.dir+t.sep:"",i=e.base||"";return r+i},t._removeDuplicateSeps=function(t){return t=t.replace(this._replaceRegex,this.sep)},t.sep="/",t._replaceRegex=new RegExp("//+","g"),t.delimiter=":",t.posix=t,t.win32=t,t}();t.exports=i}).call(e,n(3))},function(t,e,n){"use strict";function r(t){return this instanceof r?void i.call(this,t):new r(t)}t.exports=r;var i=n(12),o=n(5);o.inherits=n(4),o.inherits(r,i),r.prototype._transform=function(t,e,n){n(null,t)}},function(t,e,n){(function(e){"use strict";function r(t,e,n){return"function"==typeof t.prependListener?t.prependListener(e,n):void(t._events&&t._events[e]?T(t._events[e])?t._events[e].unshift(n):t._events[e]=[n,t._events[e]]:t.on(e,n))}function i(t,e){N=N||n(2),t=t||{},this.objectMode=!!t.objectMode,e instanceof N&&(this.objectMode=this.objectMode||!!t.readableObjectMode);var r=t.highWaterMark,i=this.objectMode?16:16384;this.highWaterMark=r||0===r?r:i,this.highWaterMark=~~this.highWaterMark,this.buffer=new j,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.defaultEncoding=t.defaultEncoding||"utf8",this.ranOut=!1,this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(B||(B=n(17).StringDecoder),this.decoder=new B(t.encoding),this.encoding=t.encoding)}function o(t){return N=N||n(2),this instanceof o?(this._readableState=new i(t,this),this.readable=!0,t&&"function"==typeof t.read&&(this._read=t.read),void x.call(this)):new o(t)}function s(t,e,n,r,i){var o=f(e,n);if(o)t.emit("error",o);else if(null===n)e.reading=!1,h(t,e);else if(e.objectMode||n&&n.length>0)if(e.ended&&!i){var s=new Error("stream.push() after EOF");t.emit("error",s)}else if(e.endEmitted&&i){var c=new Error("stream.unshift() after end event");t.emit("error",c)}else{var u;!e.decoder||i||r||(n=e.decoder.write(n),u=!e.objectMode&&0===n.length),i||(e.reading=!1),u||(e.flowing&&0===e.length&&!e.sync?(t.emit("data",n),t.read(0)):(e.length+=e.objectMode?1:n.length,i?e.buffer.unshift(n):e.buffer.push(n),e.needReadable&&p(t))),d(t,e)}else i||(e.reading=!1);return a(e)}function a(t){return!t.ended&&(t.needReadable||t.length=z?t=z:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}function u(t,e){return t<=0||0===e.length&&e.ended?0:e.objectMode?1:t!==t?e.flowing&&e.length?e.buffer.head.data.length:e.length:(t>e.highWaterMark&&(e.highWaterMark=c(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}function f(t,e){var n=null;return A.isBuffer(e)||"string"==typeof e||null===e||void 0===e||t.objectMode||(n=new TypeError("Invalid non-string/buffer chunk")),n}function h(t,e){if(!e.ended){if(e.decoder){var n=e.decoder.end();n&&n.length&&(e.buffer.push(n),e.length+=e.objectMode?1:n.length)}e.ended=!0,p(t)}}function p(t){var e=t._readableState;e.needReadable=!1,e.emittedReadable||(M("emitReadable",e.flowing),e.emittedReadable=!0,e.sync?L(l,t):l(t))}function l(t){M("emit readable"),t.emit("readable"),m(t)}function d(t,e){e.readingMore||(e.readingMore=!0,L(y,t,e))}function y(t,e){for(var n=e.length;!e.reading&&!e.flowing&&!e.ended&&e.length=e.length?(n=e.decoder?e.buffer.join(""):1===e.buffer.length?e.buffer.head.data:e.buffer.concat(e.length),e.buffer.clear()):n=S(t,e.buffer,e.decoder),n}function S(t,e,n){var r;return to.length?o.length:t;if(i+=s===o.length?o:o.slice(0,t),t-=s,0===t){s===o.length?(++r,n.next?e.head=n.next:e.head=e.tail=null):(e.head=n,n.data=o.slice(s));break}++r}return e.length-=r,i}function k(t,e){var n=P.allocUnsafe(t),r=e.head,i=1;for(r.data.copy(n),t-=r.data.length;r=r.next;){var o=r.data,s=t>o.length?o.length:t;if(o.copy(n,n.length-t,0,s),t-=s,0===t){s===o.length?(++i,r.next?e.head=r.next:e.head=e.tail=null):(e.head=r,r.data=o.slice(s));break}++i}return e.length-=i,n}function I(t){var e=t._readableState;if(e.length>0)throw new Error('"endReadable()" called on non-empty stream');e.endEmitted||(e.ended=!0,L(O,e,t))}function O(t,e){t.endEmitted||0!==t.length||(t.endEmitted=!0,e.readable=!1,e.emit("end"))}function F(t,e){for(var n=0,r=t.length;n=e.highWaterMark||e.ended))return M("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?I(this):p(this),null;if(t=u(t,e),0===t&&e.ended)return 0===e.length&&I(this),null;var r=e.needReadable;M("need readable",r),(0===e.length||e.length-t0?E(t,e):null,null===i?(e.needReadable=!0,t=0):e.length-=t,0===e.length&&(e.ended||(e.needReadable=!0),n!==t&&e.ended&&I(this)),null!==i&&this.emit("data",i),i},o.prototype._read=function(t){this.emit("error",new Error("_read() is not implemented"))},o.prototype.pipe=function(t,n){function i(t){M("onunpipe"),t===p&&s()}function o(){M("onend"),t.end()}function s(){M("cleanup"),t.removeListener("close",u),t.removeListener("finish",f),t.removeListener("drain",_),t.removeListener("error",c),t.removeListener("unpipe",i),p.removeListener("end",o),p.removeListener("end",s),p.removeListener("data",a),v=!0,!l.awaitDrain||t._writableState&&!t._writableState.needDrain||_()}function a(e){M("ondata"),w=!1;var n=t.write(e);!1!==n||w||((1===l.pipesCount&&l.pipes===t||l.pipesCount>1&&R(l.pipes,t)!==-1)&&!v&&(M("false write response, pause",p._readableState.awaitDrain),p._readableState.awaitDrain++,w=!0),p.pause())}function c(e){M("onerror",e),h(),t.removeListener("error",c),0===D(t,"error")&&t.emit("error",e)}function u(){t.removeListener("finish",f),h()}function f(){M("onfinish"),t.removeListener("close",u),h()}function h(){M("unpipe"),p.unpipe(t)}var p=this,l=this._readableState;switch(l.pipesCount){case 0:l.pipes=t;break;case 1:l.pipes=[l.pipes,t];break;default:l.pipes.push(t)}l.pipesCount+=1,M("pipe count=%d opts=%j",l.pipesCount,n);var d=(!n||n.end!==!1)&&t!==e.stdout&&t!==e.stderr,y=d?o:s;l.endEmitted?L(y):p.once("end",y),t.on("unpipe",i);var _=g(p);t.on("drain",_);var v=!1,w=!1;return p.on("data",a),r(t,"error",c),t.once("close",u),t.once("finish",f),t.emit("pipe",p),l.flowing||(M("pipe resume"),p.resume()),t},o.prototype.unpipe=function(t){var e=this._readableState;if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes?this:(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this),this);if(!t){var n=e.pipes,r=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var i=0;i=this.charLength-this.charReceived?this.charLength-this.charReceived:t.length;if(t.copy(this.charBuffer,this.charReceived,0,n),this.charReceived+=n,this.charReceived=55296&&r<=56319)){if(this.charReceived=this.charLength=0,0===t.length)return e;break}this.charLength+=this.surrogateSize,e=""}this.detectIncompleteChar(t);var i=t.length;this.charLength&&(t.copy(this.charBuffer,0,t.length-this.charReceived,i),i-=this.charReceived),e+=t.toString(this.encoding,0,i);var i=e.length-1,r=e.charCodeAt(i);if(r>=55296&&r<=56319){var o=this.surrogateSize;return this.charLength+=o,this.charReceived+=o,this.charBuffer.copy(this.charBuffer,o,0,o),t.copy(this.charBuffer,0,0,o),e.substring(0,i)}return e},u.prototype.detectIncompleteChar=function(t){for(var e=t.length>=3?3:t.length;e>0;e--){var n=t[t.length-e];if(1==e&&n>>5==6){this.charLength=2;break}if(e<=2&&n>>4==14){this.charLength=3;break}if(e<=3&&n>>3==30){this.charLength=4;break}}this.charReceived=e},u.prototype.end=function(t){var e="";if(t&&t.length&&(e=this.write(t)),this.charReceived){var n=this.charReceived,r=this.charBuffer,i=this.encoding;e+=r.slice(0,n).toString(i)}return e}},function(t,e){"use strict";function n(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");return"="===t[e-2]?2:"="===t[e-1]?1:0}function r(t){return 3*t.length/4-n(t)}function i(t){var e,r,i,o,s,a,c=t.length;s=n(t),a=new f(3*c/4-s),i=s>0?c-4:c;var h=0;for(e=0,r=0;e>16&255,a[h++]=o>>8&255,a[h++]=255&o;return 2===s?(o=u[t.charCodeAt(e)]<<2|u[t.charCodeAt(e+1)]>>4,a[h++]=255&o):1===s&&(o=u[t.charCodeAt(e)]<<10|u[t.charCodeAt(e+1)]<<4|u[t.charCodeAt(e+2)]>>2,a[h++]=o>>8&255,a[h++]=255&o),a}function o(t){return c[t>>18&63]+c[t>>12&63]+c[t>>6&63]+c[63&t]}function s(t,e,n){for(var r,i=[],s=e;sf?f:u+a));return 1===r?(e=t[n-1],i+=c[e>>2],i+=c[e<<4&63],i+="=="):2===r&&(e=(t[n-2]<<8)+t[n-1],i+=c[e>>10],i+=c[e>>4&63],i+=c[e<<2&63],i+="="),o.push(i),o.join("")}e.byteLength=r,e.toByteArray=i,e.fromByteArray=a;for(var c=[],u=[],f="undefined"!=typeof Uint8Array?Uint8Array:Array,h="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",p=0,l=h.length;p0&&(this._waitingForWrites=this.push(this._bufferedWrites.shift()),this._waitingForWrites););},n}(i.Duplex);t.exports=o}).call(e,n(7))},function(t,e){e.read=function(t,e,n,r,i){var o,s,a=8*i-r-1,c=(1<>1,f=-7,h=n?i-1:0,p=n?-1:1,l=t[e+h];for(h+=p,o=l&(1<<-f)-1,l>>=-f,f+=a;f>0;o=256*o+t[e+h],h+=p,f-=8);for(s=o&(1<<-f)-1,o>>=-f,f+=r;f>0;s=256*s+t[e+h],h+=p,f-=8);if(0===o)o=1-u;else{if(o===c)return s?NaN:(l?-1:1)*(1/0);s+=Math.pow(2,r),o-=u}return(l?-1:1)*s*Math.pow(2,o-r)},e.write=function(t,e,n,r,i,o){var s,a,c,u=8*o-i-1,f=(1<>1,p=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,l=r?0:o-1,d=r?1:-1,y=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=f):(s=Math.floor(Math.log(e)/Math.LN2),e*(c=Math.pow(2,-s))<1&&(s--,c*=2),e+=s+h>=1?p/c:p*Math.pow(2,1-h),e*c>=2&&(s++,c/=2),s+h>=f?(a=0,s=f):s+h>=1?(a=(e*c-1)*Math.pow(2,i),s+=h):(a=e*Math.pow(2,h-1)*Math.pow(2,i),s=0));i>=8;t[n+l]=255&a,l+=d,a/=256,i-=8);for(s=s<0;t[n+l]=255&s,l+=d,s/=256,u-=8);t[n+l-d]|=128*y}},function(t,e){var n={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==n.call(t)}},function(t,e,n){"use strict";function r(t){if(!(this instanceof r))return new r(t);this.options=a.assign({chunkSize:16384,windowBits:0,to:""},t||{});var e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,0===e.windowBits&&(e.windowBits=-15)),!(e.windowBits>=0&&e.windowBits<16)||t&&t.windowBits||(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&0===(15&e.windowBits)&&(e.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new h,this.strm.avail_out=0;var n=s.inflateInit2(this.strm,e.windowBits);if(n!==u.Z_OK)throw new Error(f[n]);this.header=new p,s.inflateGetHeader(this.strm,this.header)}function i(t,e){var n=new r(e);if(n.push(t,!0),n.err)throw n.msg||f[n.err];return n.result}function o(t,e){return e=e||{},e.raw=!0,i(t,e)}var s=n(30),a=n(8),c=n(24),u=n(26),f=n(32),h=n(33),p=n(28),l=Object.prototype.toString;r.prototype.push=function(t,e){var n,r,i,o,f,h,p=this.strm,d=this.options.chunkSize,y=this.options.dictionary,g=!1;if(this.ended)return!1;r=e===~~e?e:e===!0?u.Z_FINISH:u.Z_NO_FLUSH,"string"==typeof t?p.input=c.binstring2buf(t):"[object ArrayBuffer]"===l.call(t)?p.input=new Uint8Array(t):p.input=t,p.next_in=0,p.avail_in=p.input.length;do{if(0===p.avail_out&&(p.output=new a.Buf8(d),p.next_out=0,p.avail_out=d),n=s.inflate(p,u.Z_NO_FLUSH),n===u.Z_NEED_DICT&&y&&(h="string"==typeof y?c.string2buf(y):"[object ArrayBuffer]"===l.call(y)?new Uint8Array(y):y,n=s.inflateSetDictionary(this.strm,h)),n===u.Z_BUF_ERROR&&g===!0&&(n=u.Z_OK,g=!1),n!==u.Z_STREAM_END&&n!==u.Z_OK)return this.onEnd(n),this.ended=!0,!1;p.next_out&&(0!==p.avail_out&&n!==u.Z_STREAM_END&&(0!==p.avail_in||r!==u.Z_FINISH&&r!==u.Z_SYNC_FLUSH)||("string"===this.options.to?(i=c.utf8border(p.output,p.next_out),o=p.next_out-i,f=c.buf2string(p.output,i),p.next_out=o,p.avail_out=d-o,o&&a.arraySet(p.output,p.output,i,o,0),this.onData(f)):this.onData(a.shrinkBuf(p.output,p.next_out)))),0===p.avail_in&&0===p.avail_out&&(g=!0)}while((p.avail_in>0||0===p.avail_out)&&n!==u.Z_STREAM_END);return n===u.Z_STREAM_END&&(r=u.Z_FINISH),r===u.Z_FINISH?(n=s.inflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===u.Z_OK):r!==u.Z_SYNC_FLUSH||(this.onEnd(u.Z_OK),p.avail_out=0,!0)},r.prototype.onData=function(t){this.chunks.push(t)},r.prototype.onEnd=function(t){t===u.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=a.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg},e.Inflate=r,e.inflate=i,e.inflateRaw=o,e.ungzip=i},function(t,e,n){"use strict";function r(t,e){if(e<65537&&(t.subarray&&s||!t.subarray&&o))return String.fromCharCode.apply(null,i.shrinkBuf(t,e));for(var n="",r=0;r=252?6:c>=248?5:c>=240?4:c>=224?3:c>=192?2:1;a[254]=a[254]=1,e.string2buf=function(t){var e,n,r,o,s,a=t.length,c=0;for(o=0;o>>6,e[s++]=128|63&n):n<65536?(e[s++]=224|n>>>12,e[s++]=128|n>>>6&63,e[s++]=128|63&n):(e[s++]=240|n>>>18,e[s++]=128|n>>>12&63,e[s++]=128|n>>>6&63,e[s++]=128|63&n);return e},e.buf2binstring=function(t){return r(t,t.length)},e.binstring2buf=function(t){for(var e=new i.Buf8(t.length),n=0,r=e.length;n4)u[i++]=65533,n+=s-1;else{for(o&=2===s?31:3===s?15:7;s>1&&n1?u[i++]=65533:o<65536?u[i++]=o:(o-=65536,u[i++]=55296|o>>10&1023, u[i++]=56320|1023&o)}return r(u,i)},e.utf8border=function(t,e){var n;for(e=e||t.length,e>t.length&&(e=t.length),n=e-1;n>=0&&128===(192&t[n]);)n--;return n<0?e:0===n?e:n+a[t[n]]>e?n:e}},function(t,e){"use strict";function n(t,e,n,r){for(var i=65535&t|0,o=t>>>16&65535|0,s=0;0!==n;){s=n>2e3?2e3:n,n-=s;do i=i+e[r++]|0,o=o+i|0;while(--s);i%=65521,o%=65521}return i|o<<16|0}t.exports=n},function(t,e){"use strict";t.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(t,e){"use strict";function n(){for(var t,e=[],n=0;n<256;n++){t=n;for(var r=0;r<8;r++)t=1&t?3988292384^t>>>1:t>>>1;e[n]=t}return e}function r(t,e,n,r){var o=i,s=r+n;t^=-1;for(var a=r;a>>8^o[255&(t^e[a])];return t^-1}var i=n();t.exports=r},function(t,e){"use strict";function n(){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}t.exports=n},function(t,e){"use strict";var n=30,r=12;t.exports=function(t,e){var i,o,s,a,c,u,f,h,p,l,d,y,g,_,v,w,m,E,S,b,k,I,O,F,R;i=t.state,o=t.next_in,F=t.input,s=o+(t.avail_in-5),a=t.next_out,R=t.output,c=a-(e-t.avail_out),u=a+(t.avail_out-257),f=i.dmax,h=i.wsize,p=i.whave,l=i.wnext,d=i.window,y=i.hold,g=i.bits,_=i.lencode,v=i.distcode,w=(1<>>24,y>>>=S,g-=S,S=E>>>16&255,0===S)R[a++]=65535&E;else{if(!(16&S)){if(0===(64&S)){E=_[(65535&E)+(y&(1<>>=S,g-=S),g<15&&(y+=F[o++]<>>24,y>>>=S,g-=S,S=E>>>16&255,!(16&S)){if(0===(64&S)){E=v[(65535&E)+(y&(1<f){t.msg="invalid distance too far back",i.mode=n;break t}if(y>>>=S,g-=S,S=a-c,k>S){if(S=k-S,S>p&&i.sane){t.msg="invalid distance too far back",i.mode=n;break t}if(I=0,O=d,0===l){if(I+=h-S,S2;)R[a++]=O[I++],R[a++]=O[I++],R[a++]=O[I++],b-=3;b&&(R[a++]=O[I++],b>1&&(R[a++]=O[I++]))}else{I=a-k;do R[a++]=R[I++],R[a++]=R[I++],R[a++]=R[I++],b-=3;while(b>2);b&&(R[a++]=R[I++],b>1&&(R[a++]=R[I++]))}break}}break}}while(o>3,o-=b,g-=b<<3,y&=(1<>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24)}function i(){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 v.Buf16(320),this.work=new v.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function o(t){var e;return t&&t.state?(e=t.state,t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=1&e.wrap),e.mode=U,e.last=0,e.havedict=0,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new v.Buf32(yt),e.distcode=e.distdyn=new v.Buf32(gt),e.sane=1,e.back=-1,N):x}function s(t){var e;return t&&t.state?(e=t.state,e.wsize=0,e.whave=0,e.wnext=0,o(t)):x}function a(t,e){var n,r;return t&&t.state?(r=t.state,e<0?(n=0,e=-e):(n=(e>>4)+1,e<48&&(e&=15)),e&&(e<8||e>15)?x:(null!==r.window&&r.wbits!==e&&(r.window=null),r.wrap=n,r.wbits=e,s(t))):x}function c(t,e){var n,r;return t?(r=new i,t.state=r,r.window=null,n=a(t,e),n!==N&&(t.state=null),n):x}function u(t){return c(t,vt)}function f(t){if(wt){var e;for(g=new v.Buf32(512),_=new v.Buf32(32),e=0;e<144;)t.lens[e++]=8;for(;e<256;)t.lens[e++]=9;for(;e<280;)t.lens[e++]=7;for(;e<288;)t.lens[e++]=8;for(S(k,t.lens,0,288,g,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;S(I,t.lens,0,32,_,0,t.work,{bits:5}),wt=!1}t.lencode=g,t.lenbits=9,t.distcode=_,t.distbits=5}function h(t,e,n,r){var i,o=t.state;return null===o.window&&(o.wsize=1<=o.wsize?(v.arraySet(o.window,e,n-o.wsize,o.wsize,0),o.wnext=0,o.whave=o.wsize):(i=o.wsize-o.wnext,i>r&&(i=r),v.arraySet(o.window,e,n-r,i,o.wnext),r-=i,r?(v.arraySet(o.window,e,n-r,r,0),o.wnext=r,o.whave=o.wsize):(o.wnext+=i,o.wnext===o.wsize&&(o.wnext=0),o.whave>>8&255,n.check=m(n.check,Ft,2,0),p=0,l=0,n.mode=M;break}if(n.flags=0,n.head&&(n.head.done=!1),!(1&n.wrap)||(((255&p)<<8)+(p>>8))%31){t.msg="incorrect header check",n.mode=pt;break}if((15&p)!==C){t.msg="unknown compression method",n.mode=pt;break}if(p>>>=4,l-=4,St=(15&p)+8,0===n.wbits)n.wbits=St;else if(St>n.wbits){t.msg="invalid window size",n.mode=pt;break}n.dmax=1<>8&1),512&n.flags&&(Ft[0]=255&p,Ft[1]=p>>>8&255,n.check=m(n.check,Ft,2,0)),p=0,l=0,n.mode=B;case B:for(;l<32;){if(0===c)break t;c--,p+=i[s++]<>>8&255,Ft[2]=p>>>16&255,Ft[3]=p>>>24&255,n.check=m(n.check,Ft,4,0)),p=0,l=0,n.mode=j;case j:for(;l<16;){if(0===c)break t;c--,p+=i[s++]<>8),512&n.flags&&(Ft[0]=255&p,Ft[1]=p>>>8&255,n.check=m(n.check,Ft,2,0)),p=0,l=0,n.mode=z;case z:if(1024&n.flags){for(;l<16;){if(0===c)break t;c--,p+=i[s++]<>>8&255,n.check=m(n.check,Ft,2,0)),p=0,l=0}else n.head&&(n.head.extra=null);n.mode=q;case q:if(1024&n.flags&&(g=n.length,g>c&&(g=c),g&&(n.head&&(St=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Array(n.head.extra_len)),v.arraySet(n.head.extra,i,s,g,St)),512&n.flags&&(n.check=m(n.check,i,g,s)),c-=g,s+=g,n.length-=g),n.length))break t;n.length=0,n.mode=V;case V:if(2048&n.flags){if(0===c)break t;g=0;do St=i[s+g++],n.head&&St&&n.length<65536&&(n.head.name+=String.fromCharCode(St));while(St&&g>9&1,n.head.done=!0),t.adler=n.check=0,n.mode=X;break;case Z:for(;l<32;){if(0===c)break t;c--,p+=i[s++]<>>=7&l,l-=7&l,n.mode=ut;break}for(;l<3;){if(0===c)break t;c--,p+=i[s++]<>>=1,l-=1,3&p){case 0:n.mode=G;break;case 1:if(f(n),n.mode=nt,e===R){p>>>=2,l-=2;break t}break;case 2:n.mode=$;break;case 3:t.msg="invalid block type",n.mode=pt}p>>>=2,l-=2;break;case G:for(p>>>=7&l,l-=7&l;l<32;){if(0===c)break t;c--,p+=i[s++]<>>16^65535)){t.msg="invalid stored block lengths",n.mode=pt;break}if(n.length=65535&p,p=0,l=0,n.mode=J,e===R)break t;case J:n.mode=Q;case Q:if(g=n.length){if(g>c&&(g=c),g>u&&(g=u),0===g)break t;v.arraySet(o,i,s,g,a),c-=g,s+=g,u-=g,a+=g,n.length-=g;break}n.mode=X;break;case $:for(;l<14;){if(0===c)break t;c--,p+=i[s++]<>>=5,l-=5,n.ndist=(31&p)+1,p>>>=5,l-=5,n.ncode=(15&p)+4,p>>>=4,l-=4,n.nlen>286||n.ndist>30){t.msg="too many length or distance symbols",n.mode=pt;break}n.have=0,n.mode=tt;case tt:for(;n.have>>=3,l-=3}for(;n.have<19;)n.lens[Rt[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,kt={bits:n.lenbits},bt=S(b,n.lens,0,19,n.lencode,0,n.work,kt),n.lenbits=kt.bits,bt){t.msg="invalid code lengths set",n.mode=pt;break}n.have=0,n.mode=et;case et:for(;n.have>>24,_t=Ot>>>16&255,vt=65535&Ot,!(gt<=l);){if(0===c)break t;c--,p+=i[s++]<>>=gt,l-=gt,n.lens[n.have++]=vt;else{if(16===vt){for(It=gt+2;l>>=gt,l-=gt,0===n.have){t.msg="invalid bit length repeat",n.mode=pt;break}St=n.lens[n.have-1],g=3+(3&p),p>>>=2,l-=2}else if(17===vt){for(It=gt+3;l>>=gt,l-=gt,St=0,g=3+(7&p),p>>>=3,l-=3}else{for(It=gt+7;l>>=gt,l-=gt,St=0,g=11+(127&p),p>>>=7,l-=7}if(n.have+g>n.nlen+n.ndist){t.msg="invalid bit length repeat",n.mode=pt;break}for(;g--;)n.lens[n.have++]=St}}if(n.mode===pt)break;if(0===n.lens[256]){t.msg="invalid code -- missing end-of-block",n.mode=pt;break}if(n.lenbits=9,kt={bits:n.lenbits},bt=S(k,n.lens,0,n.nlen,n.lencode,0,n.work,kt),n.lenbits=kt.bits,bt){t.msg="invalid literal/lengths set",n.mode=pt;break}if(n.distbits=6,n.distcode=n.distdyn,kt={bits:n.distbits},bt=S(I,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,kt),n.distbits=kt.bits,bt){t.msg="invalid distances set",n.mode=pt;break}if(n.mode=nt,e===R)break t;case nt:n.mode=rt;case rt:if(c>=6&&u>=258){t.next_out=a,t.avail_out=u,t.next_in=s,t.avail_in=c,n.hold=p,n.bits=l,E(t,y),a=t.next_out,o=t.output,u=t.avail_out,s=t.next_in,i=t.input,c=t.avail_in,p=n.hold,l=n.bits,n.mode===X&&(n.back=-1);break}for(n.back=0;Ot=n.lencode[p&(1<>>24,_t=Ot>>>16&255,vt=65535&Ot,!(gt<=l);){if(0===c)break t;c--,p+=i[s++]<>wt)],gt=Ot>>>24,_t=Ot>>>16&255,vt=65535&Ot,!(wt+gt<=l);){if(0===c)break t;c--,p+=i[s++]<>>=wt,l-=wt,n.back+=wt}if(p>>>=gt,l-=gt,n.back+=gt,n.length=vt,0===_t){n.mode=ct;break}if(32&_t){n.back=-1,n.mode=X;break}if(64&_t){t.msg="invalid literal/length code",n.mode=pt;break}n.extra=15&_t,n.mode=it;case it:if(n.extra){for(It=n.extra;l>>=n.extra,l-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=ot;case ot:for(;Ot=n.distcode[p&(1<>>24,_t=Ot>>>16&255,vt=65535&Ot,!(gt<=l);){if(0===c)break t;c--,p+=i[s++]<>wt)],gt=Ot>>>24,_t=Ot>>>16&255,vt=65535&Ot,!(wt+gt<=l);){if(0===c)break t;c--,p+=i[s++]<>>=wt,l-=wt,n.back+=wt}if(p>>>=gt,l-=gt,n.back+=gt,64&_t){t.msg="invalid distance code",n.mode=pt;break}n.offset=vt,n.extra=15&_t,n.mode=st;case st:if(n.extra){for(It=n.extra;l>>=n.extra,l-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){t.msg="invalid distance too far back",n.mode=pt;break}n.mode=at;case at:if(0===u)break t;if(g=y-u,n.offset>g){if(g=n.offset-g,g>n.whave&&n.sane){t.msg="invalid distance too far back",n.mode=pt;break}g>n.wnext?(g-=n.wnext,_=n.wsize-g):_=n.wnext-g,g>n.length&&(g=n.length),yt=n.window}else yt=o,_=a-n.offset,g=n.length;g>u&&(g=u),u-=g,n.length-=g;do o[a++]=yt[_++];while(--g);0===n.length&&(n.mode=rt);break;case ct:if(0===u)break t;o[a++]=n.length,u--,n.mode=rt;break;case ut:if(n.wrap){for(;l<32;){if(0===c)break t;c--,p|=i[s++]<=1&&0===z[x];x--);if(D>x&&(D=x),0===x)return y[g++]=20971520,y[g++]=20971520,v.bits=1,0;for(T=1;T0&&(t===a||1!==x))return-1;for(q[1]=0,N=1;No||t===u&&U>s)return 1;for(;;){I=N-P,_[L]k?(O=V[W+_[L]],F=B[j+_[L]]):(O=96,F=0),w=1<>P)+m]=I<<24|O<<16|F|0;while(0!==m);for(w=1<>=1;if(0!==w?(M&=w-1,M+=w):M=0,L++,0===--z[N]){if(N===x)break;N=e[n+_[L]]}if(N>D&&(M&S)!==E){for(0===P&&(P=D),b+=T,A=N-P,C=1<o||t===u&&U>s)return 1;E=M&S,y[E]=D<<24|A<<16|b-g|0}}return 0!==M&&(y[b+M]=N-P<<24|64<<16|0),v.bits=D,0}},function(t,e){"use strict";t.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(t,e){"use strict";function n(){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}t.exports=n},function(t,e,n){t.exports=n(2)},function(t,e,n){"use strict";function r(){this.head=null,this.tail=null,this.length=0}var i=(n(1).Buffer,n(10));t.exports=r,r.prototype.push=function(t){var e={data:t,next:null};this.length>0?this.tail.next=e:this.head=e,this.tail=e,++this.length},r.prototype.unshift=function(t){var e={data:t,next:this.head};0===this.length&&(this.tail=e),this.head=e,++this.length},r.prototype.shift=function(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}},r.prototype.clear=function(){this.head=this.tail=null,this.length=0},r.prototype.join=function(t){if(0===this.length)return"";for(var e=this.head,n=""+e.data;e=e.next;)n+=t+e.data;return n},r.prototype.concat=function(t){if(0===this.length)return i.alloc(0);if(1===this.length)return this.head.data;for(var e=i.allocUnsafe(t>>>0),n=this.head,r=0;n;)n.data.copy(e,r),r+=n.data.length,n=n.next;return e}},function(t,e,n){t.exports=n(15)},function(t,e,n){(function(r){var i=function(){try{return n(9)}catch(t){}}();e=t.exports=n(16),e.Stream=i||e,e.Readable=e,e.Writable=n(13),e.Duplex=n(2),e.Transform=n(12),e.PassThrough=n(15),!r.browser&&"disable"===r.env.READABLE_STREAM&&i&&(t.exports=i)}).call(e,n(3))},function(t,e,n){t.exports=n(12)},function(t,e,n){t.exports=n(13)},function(t,e){(function(e){function n(t,e){function n(){if(!i){if(r("throwDeprecation"))throw new Error(e);r("traceDeprecation")?console.trace(e):console.warn(e),i=!0}return t.apply(this,arguments)}if(r("noDeprecation"))return t;var i=!1;return n}function r(t){try{if(!e.localStorage)return!1}catch(t){return!1}var n=e.localStorage[t];return null!=n&&"true"===String(n).toLowerCase()}t.exports=n}).call(e,function(){return this}())},function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children=[],t.webpackPolyfill=1),t}},function(t,e){}])}); //# sourceMappingURL=browserfs.min.js.map