RetroArch/pkg/emscripten/libretro/browserfs.min.js

10 lines
264 KiB
JavaScript
Raw Normal View History

2018-02-06 22:05:21 -05:00
!function(a){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=a();else if("function"==typeof define&&define.amd)define([],a);else{var b;b="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,b.BrowserFS=a()}}(function(){var a;return function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};b[g][0].call(k.exports,function(a){var c=b[g][1][a];return e(c?c:a)},k,k.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g<d.length;g++)e(d[g]);return e}({1:[function(b,c,d){(function(b,e){!function(b,e){"object"==typeof d&&"undefined"!=typeof c?e(d):"function"==typeof a&&a.amd?a(["exports"],e):e(b.async=b.async||{})}(this,function(a){"use strict";function c(a,b,c){var d=c.length;switch(d){case 0:return a.call(b);case 1:return a.call(b,c[0]);case 2:return a.call(b,c[0],c[1]);case 3:return a.call(b,c[0],c[1],c[2])}return a.apply(b,c)}function d(a){var b=typeof a;return!!a&&("object"==b||"function"==b)}function f(a){var b=d(a)?mb.call(a):"";return b==jb||b==kb}function g(a){return!!a&&"object"==typeof a}function h(a){return"symbol"==typeof a||g(a)&&pb.call(a)==nb}function i(a){if("number"==typeof a)return a;if(h(a))return qb;if(d(a)){var b=f(a.valueOf)?a.valueOf():a;a=d(b)?b+"":b}if("string"!=typeof a)return 0===a?a:+a;a=a.replace(rb,"");var c=tb.test(a);return c||ub.test(a)?vb(a.slice(2),c?2:8):sb.test(a)?qb:+a}function j(a){if(!a)return 0===a?a:0;if(a=i(a),a===wb||a===-wb){var b=a<0?-1:1;return b*xb}return a===a?a:0}function k(a){var b=j(a),c=b%1;return b===b?c?b-c:b:0}function l(a,b){if("function"!=typeof a)throw new TypeError(yb);return b=zb(void 0===b?a.length-1:k(b),0),function(){for(var d=arguments,e=-1,f=zb(d.length-b,0),g=Array(f);++e<f;)g[e]=d[b+e];switch(b){case 0:return a.call(this,g);case 1:return a.call(this,d[0],g);case 2:return a.call(this,d[0],d[1],g)}var h=Array(b+1);for(e=-1;++e<b;)h[e]=d[e];return h[b]=g,c(a,this,h)}}function m(a){return l(function(b){var c=b.pop();a.call(this,b,c)})}function n(a){return l(function(b,c){var d=m(function(c,d){var e=this;return a(b,function(a,b){a.apply(e,c.concat([b]))},d)});return c.length?d.apply(this,c):d})}function o(a){return function(b){return null==b?void 0:b[a]}}function p(a){return"number"==typeof a&&a>-1&&a%1==0&&a<=Bb}function q(a){return null!=a&&p(Ab(a))&&!f(a)}function r(){}function s(a){return function(){if(null!==a){var b=a;a=null,b.apply(this,arguments)}}}function t(a){return Cb&&a[Cb]&&a[Cb]()}function u(a){return Db(Object(a))}function v(a,b){return null!=a&&(Fb.call(a,b)||"object"==typeof a&&b in a&&null===u(a))}function w(a){return Gb(Object(a))}function x(a,b){for(var c=-1,d=Array(a);++c<a;)d[c]=b(c);return d}function y(a){return g(a)&&q(a)}function z(a){return y(a)&&Jb.call(a,"callee")&&(!Lb.call(a,"callee")||Kb.call(a)==Hb)}function A(a){return"string"==typeof a||!Mb(a)&&g(a)&&Pb.call(a)==Nb}function B(a){var b=a?a.length:void 0;return p(b)&&(Mb(a)||A(a)||z(a))?x(b,String):null}function C(a,b){return b=null==b?Qb:b,!!b&&("number"==typeof a||Rb.test(a))&&a>-1&&a%1==0&&a<b}function D(a){var b=a&&a.constructor,c="function"==typeof b&&b.prototype||Sb;return a===c}function E(a){var b=D(a);if(!b&&!q(a))return w(a);var c=B(a),d=!!c,e=c||[],f=e.length;for(var g in a)!v(a,g)||d&&("length"==g||C(g,f))||b&&"constructor"==g||e.push(g);return e}function F(a){var b=-1,c=a.length;return function(){return++b<c?{value:a[b],key:b}:null}}function G(a){var b=-1;return function(){var c=a.next();return c.done?null:(b++,{value:c.value,key:b})}}function H(a){var b=E(a),c=-1,d=b.length;return function(){var e=b[++c];return c<d?{value:a[e],key:e}:null}}function I(a){if(q(a))return F(a);var b=t(a);return b?G(b):H(a)}function J(a){return function(){if(null===a)throw new Error("Callback was already called.");var b=a;a=null,b.apply(this,arguments)}}function K(a){return function(b,c,d){function e(a){
b||f(a,4,this.length),a+=this.offset,this.data.readFloatLE(a)},a.prototype.readFloatBE=function(a,b){return void 0===b&&(b=!1),a>>>=0,b||f(a,4,this.length),a+=this.offset,this.data.readFloatBE(a)},a.prototype.readDoubleLE=function(a,b){return void 0===b&&(b=!1),a>>>=0,b||f(a,8,this.length),a+=this.offset,this.data.readDoubleLE(a)},a.prototype.readDoubleBE=function(a,b){return void 0===b&&(b=!1),a>>>=0,b||f(a,8,this.length),a+=this.offset,this.data.readDoubleBE(a)},a.prototype.writeUIntLE=function(a,b,c,e){void 0===e&&(e=!1),b>>>=0,e||d(this,a,b,c,r[c],0);var f=b+c;switch(b+=this.offset,c){case 1:this.data.writeUInt8(b,a);break;case 2:this.data.writeUInt16LE(b,a);break;case 3:this.data.writeUInt8(b,255&a),this.data.writeUInt16LE(b+1,a>>8);break;case 4:this.data.writeUInt32LE(b,a);break;case 6:this.data.writeUInt8(b,255&a),a=Math.floor(a/256),b++;case 5:this.data.writeUInt8(b,255&a),a=Math.floor(a/256),this.data.writeUInt32LE(b+1,a);break;default:throw new Error("Invalid byteLength: "+c)}return f},a.prototype.writeUIntBE=function(a,b,c,e){void 0===e&&(e=!1),b>>>=0,e||d(this,a,b,c,r[c],0);var f=b+c;switch(b+=this.offset,c){case 1:this.data.writeUInt8(b,a);break;case 2:this.data.writeUInt16BE(b,a);break;case 3:this.data.writeUInt8(b+2,255&a),this.data.writeUInt16BE(b,a>>8);break;case 4:this.data.writeUInt32BE(b,a);break;case 6:this.data.writeUInt8(b+5,255&a),a=Math.floor(a/256);case 5:this.data.writeUInt8(b+4,255&a),a=Math.floor(a/256),this.data.writeUInt32BE(b,a);break;default:throw new Error("Invalid byteLength: "+c)}return f},a.prototype.writeIntLE=function(a,b,c,e){void 0===e&&(e=!1),b>>>=0,e||d(this,a,b,c,p[c],q[c]);var f=b+c;switch(b+=this.offset,c){case 1:this.data.writeInt8(b,a);break;case 2:this.data.writeInt16LE(b,a);break;case 3:this.data.writeUInt8(b,255&a),this.data.writeInt16LE(b+1,a>>8);break;case 4:this.data.writeInt32LE(b,a);break;case 6:this.data.writeUInt8(b,255&a),a=Math.floor(a/256),b++;case 5:this.data.writeUInt8(b,255&a),a=Math.floor(a/256),this.data.writeInt32LE(b+1,a);break;default:throw new Error("Invalid byteLength: "+c)}return f},a.prototype.writeIntBE=function(a,b,c,e){void 0===e&&(e=!1),b>>>=0,e||d(this,a,b,c,p[c],q[c]);var f=b+c;switch(b+=this.offset,c){case 1:this.data.writeInt8(b,a);break;case 2:this.data.writeInt16BE(b,a);break;case 3:this.data.writeUInt8(b+2,255&a),this.data.writeInt16BE(b,a>>8);break;case 4:this.data.writeInt32BE(b,a);break;case 6:this.data.writeUInt8(b+5,255&a),a=Math.floor(a/256);case 5:this.data.writeUInt8(b+4,255&a),a=Math.floor(a/256),this.data.writeInt32BE(b,a);break;default:throw new Error("Invalid byteLength: "+c)}return f},a.prototype.writeUInt8=function(a,b,c){return void 0===c&&(c=!1),b>>>=0,c||d(this,a,b,1,255,0),this.data.writeUInt8(b+this.offset,a),b+1},a.prototype.writeUInt16LE=function(a,b,c){return void 0===c&&(c=!1),b>>>=0,c||d(this,a,b,2,65535,0),this.data.writeUInt16LE(b+this.offset,a),b+2},a.prototype.writeUInt16BE=function(a,b,c){return void 0===c&&(c=!1),b>>>=0,c||d(this,a,b,2,65535,0),this.data.writeUInt16BE(b+this.offset,a),b+2},a.prototype.writeUInt32LE=function(a,b,c){return void 0===c&&(c=!1),b>>>=0,c||d(this,a,b,4,4294967295,0),this.data.writeUInt32LE(b+this.offset,a),b+4},a.prototype.writeUInt32BE=function(a,b,c){return void 0===c&&(c=!1),b>>>=0,c||d(this,a,b,4,4294967295,0),this.data.writeUInt32BE(b+this.offset,a),b+4},a.prototype.writeInt8=function(a,b,c){return void 0===c&&(c=!1),b>>>=0,c||d(this,a,b,1,127,-128),this.data.writeInt8(b+this.offset,a),b+1},a.prototype.writeInt16LE=function(a,b,c){return void 0===c&&(c=!1),b>>>=0,c||d(this,a,b,2,32767,-32768),this.data.writeInt16LE(b+this.offset,a),b+2},a.prototype.writeInt16BE=function(a,b,c){return void 0===c&&(c=!1),b>>>=0,c||d(this,a,b,2,32767,-32768),this.data.writeInt16BE(b+this.offset,a),b+2},a.prototype.writeInt32LE=function(a,b,c){return void 0===c&&(c=!1),b>>>=0,c||d(this,a,b,4,2147483647,-2147483648),this.data.writeInt32LE(b+this.offset,a),b+4},a.prototype.writeInt32BE=function(a,b,c){return void 0===c&&(c=!1),b>>>=0,c||d(this,a,b,4,2147483647,-2147483648),this.data.writeInt32BE(b+t
new c)},e=a("stream"),f=function(a){function b(){a.call(this),this.isRaw=!1,this.columns=80,this.rows=120,this.isTTY=!0,this._bufferedWrites=[],this._waitingForWrites=!1}return d(b,a),b.prototype.setRawMode=function(a){this.isRaw!==a&&(this.isRaw=a,this.emit("modeChange"))},b.prototype.changeColumns=function(a){a!==this.columns&&(this.columns=a,this.emit("resize"))},b.prototype.changeRows=function(a){a!==this.rows&&(this.rows=a,this.emit("resize"))},b.isatty=function(a){return a&&a instanceof b},b.prototype._write=function(a,b,d){var e;try{var f;f="string"==typeof a?new c(a,b):a,this._bufferedWrites.push(f),this._waitingForWrites&&this._read(1024)}catch(a){e=a}finally{d(e)}},b.prototype._read=function(a){if(0===this._bufferedWrites.length)this._waitingForWrites=!0;else for(;this._bufferedWrites.length>0&&(this._waitingForWrites=this.push(this._bufferedWrites.shift()),this._waitingForWrites););},b}(e.Duplex);b.exports=f}).call(this,a("bfs-buffer").Buffer)},{"bfs-buffer":2,stream:34}],14:[function(a,b,c){},{}],15:[function(a,b,c){(function(b){"use strict";var d=a("buffer"),e=d.Buffer,f=d.SlowBuffer,g=d.kMaxLength||2147483647;c.alloc=function(a,b,c){if("function"==typeof e.alloc)return e.alloc(a,b,c);if("number"==typeof c)throw new TypeError("encoding must not be number");if("number"!=typeof a)throw new TypeError("size must be a number");if(a>g)throw new RangeError("size is too large");var d=c,f=b;void 0===f&&(d=void 0,f=0);var h=new e(a);if("string"==typeof f)for(var i=new e(f,d),j=i.length,k=-1;++k<a;)h[k]=i[k%j];else h.fill(f);return h},c.allocUnsafe=function(a){if("function"==typeof e.allocUnsafe)return e.allocUnsafe(a);if("number"!=typeof a)throw new TypeError("size must be a number");if(a>g)throw new RangeError("size is too large");return new e(a)},c.from=function(a,c,d){if("function"==typeof e.from&&(!b.Uint8Array||Uint8Array.from!==e.from))return e.from(a,c,d);if("number"==typeof a)throw new TypeError('"value" argument must not be a number');if("string"==typeof a)return new e(a,c);if("undefined"!=typeof ArrayBuffer&&a instanceof ArrayBuffer){var f=c;if(1===arguments.length)return new e(a);"undefined"==typeof f&&(f=0);var g=d;if("undefined"==typeof g&&(g=a.byteLength-f),f>=a.byteLength)throw new RangeError("'offset' is out of bounds");if(g>a.byteLength-f)throw new RangeError("'length' is out of bounds");return new e(a.slice(f,f+g))}if(e.isBuffer(a)){var h=new e(a.length);return a.copy(h,0,0,a.length),h}if(a){if(Array.isArray(a)||"undefined"!=typeof ArrayBuffer&&a.buffer instanceof ArrayBuffer||"length"in a)return new e(a);if("Buffer"===a.type&&Array.isArray(a.data))return new e(a.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")},c.allocUnsafeSlow=function(a){if("function"==typeof e.allocUnsafeSlow)return e.allocUnsafeSlow(a);if("number"!=typeof a)throw new TypeError("size must be a number");if(a>=g)throw new RangeError("size is too large");return new f(a)}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{buffer:2}],16:[function(a,b,c){(function(a){function b(a){return Array.isArray?Array.isArray(a):"[object Array]"===q(a)}function d(a){return"boolean"==typeof a}function e(a){return null===a}function f(a){return null==a}function g(a){return"number"==typeof a}function h(a){return"string"==typeof a}function i(a){return"symbol"==typeof a}function j(a){return void 0===a}function k(a){return"[object RegExp]"===q(a)}function l(a){return"object"==typeof a&&null!==a}function m(a){return"[object Date]"===q(a)}function n(a){return"[object Error]"===q(a)||a instanceof Error}function o(a){return"function"==typeof a}function p(a){return null===a||"boolean"==typeof a||"number"==typeof a||"string"==typeof a||"symbol"==typeof a||"undefined"==typeof a}function q(a){return Object.prototype.toString.call(a)}c.isArray=b,c.isBoolean=d,c.isNull=e,c.isNullOrUndefined=f,c.isNumber=g,c.isString=h,c.isSymbol=i,c.isUndefined=j,c.isRegExp=k,c.isObject=l,c.isDate=m,c.isError=n,c.isFunction=o,c.isPrimitive=p,c.isBuffer
for(f=new Array(h-1),g=0;g<f.length;)f[g++]=arguments[g];return a.nextTick(function(){b.apply(null,f)})}}!a.version||0===a.version.indexOf("v0.")||0===a.version.indexOf("v1.")&&0!==a.version.indexOf("v1.8.")?b.exports=c:b.exports=a.nextTick}).call(this,a("bfs-process"))},{"bfs-process":11}],22:[function(a,b,c){b.exports=a("./lib/_stream_duplex.js")},{"./lib/_stream_duplex.js":23}],23:[function(a,b,c){"use strict";function d(a){return this instanceof d?(j.call(this,a),k.call(this,a),a&&a.readable===!1&&(this.readable=!1),a&&a.writable===!1&&(this.writable=!1),this.allowHalfOpen=!0,a&&a.allowHalfOpen===!1&&(this.allowHalfOpen=!1),void this.once("end",e)):new d(a)}function e(){this.allowHalfOpen||this._writableState.ended||h(f,this)}function f(a){a.end()}var g=Object.keys||function(a){var b=[];for(var c in a)b.push(c);return b};b.exports=d;var h=a("process-nextick-args"),i=a("core-util-is");i.inherits=a("inherits");var j=a("./_stream_readable"),k=a("./_stream_writable");i.inherits(d,j);for(var l=g(k.prototype),m=0;m<l.length;m++){var n=l[m];d.prototype[n]||(d.prototype[n]=k.prototype[n])}},{"./_stream_readable":25,"./_stream_writable":27,"core-util-is":16,inherits:18,"process-nextick-args":21}],24:[function(a,b,c){"use strict";function d(a){return this instanceof d?void e.call(this,a):new d(a)}b.exports=d;var e=a("./_stream_transform"),f=a("core-util-is");f.inherits=a("inherits"),f.inherits(d,e),d.prototype._transform=function(a,b,c){c(null,a)}},{"./_stream_transform":26,"core-util-is":16,inherits:18}],25:[function(a,b,c){(function(c){"use strict";function d(a,b,c){return"function"==typeof a.prependListener?a.prependListener(b,c):void(a._events&&a._events[b]?E(a._events[b])?a._events[b].unshift(c):a._events[b]=[c,a._events[b]]:a.on(b,c))}function e(b,c){O=O||a("./_stream_duplex"),b=b||{},this.objectMode=!!b.objectMode,c instanceof O&&(this.objectMode=this.objectMode||!!b.readableObjectMode);var d=b.highWaterMark,e=this.objectMode?16:16384;this.highWaterMark=d||0===d?d:e,this.highWaterMark=~~this.highWaterMark,this.buffer=new N,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=b.defaultEncoding||"utf8",this.ranOut=!1,this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,b.encoding&&(M||(M=a("string_decoder/").StringDecoder),this.decoder=new M(b.encoding),this.encoding=b.encoding)}function f(b){return O=O||a("./_stream_duplex"),this instanceof f?(this._readableState=new e(b,this),this.readable=!0,b&&"function"==typeof b.read&&(this._read=b.read),void F.call(this)):new f(b)}function g(a,b,c,d,e){var f=k(b,c);if(f)a.emit("error",f);else if(null===c)b.reading=!1,l(a,b);else if(b.objectMode||c&&c.length>0)if(b.ended&&!e){var g=new Error("stream.push() after EOF");a.emit("error",g)}else if(b.endEmitted&&e){var i=new Error("stream.unshift() after end event");a.emit("error",i)}else{var j;!b.decoder||e||d||(c=b.decoder.write(c),j=!b.objectMode&&0===c.length),e||(b.reading=!1),j||(b.flowing&&0===b.length&&!b.sync?(a.emit("data",c),a.read(0)):(b.length+=b.objectMode?1:c.length,e?b.buffer.unshift(c):b.buffer.push(c),b.needReadable&&m(a))),o(a,b)}else e||(b.reading=!1);return h(b)}function h(a){return!a.ended&&(a.needReadable||a.length<a.highWaterMark||0===a.length)}function i(a){return a>=P?a=P:(a--,a|=a>>>1,a|=a>>>2,a|=a>>>4,a|=a>>>8,a|=a>>>16,a++),a}function j(a,b){return a<=0||0===b.length&&b.ended?0:b.objectMode?1:a!==a?b.flowing&&b.length?b.buffer.head.data.length:b.length:(a>b.highWaterMark&&(b.highWaterMark=i(a)),a<=b.length?a:b.ended?b.length:(b.needReadable=!0,0))}function k(a,b){var c=null;return H.isBuffer(b)||"string"==typeof b||null===b||void 0===b||a.objectMode||(c=new TypeError("Invalid non-string/buffer chunk")),c}function l(a,b){if(!b.ended){if(b.decoder){var c=b.decoder.end();c&&c.length&&(b.buffer.push(c),b.length+=b.objectMode?1:c.length)}b.ended=!0,m(a)}}function m(a){var b=a._readableState;b.needReadabl
void 0===c&&(c=null);var d=this.getCachedInfo(a);null===b.versionTag||void 0!==d&&d.stat.versionTag===b.versionTag||this.putCachedInfo(a,{stat:b,contents:c})},a.prototype.updateCachedInfo=function(a,b,c){void 0===c&&(c=null),b.isFile&&g(c)?this.updateCachedFileInfo(a,b,c):b.isFolder&&Array.isArray(c)&&this.updateCachedDirInfo(a,b,c)},a.prototype.readdir=function(a,b){var c=this,d=this.getCachedDirInfo(a);this._wrap(function(b){null!==d&&d.contents?c._client.readdir(a,{contentHash:d.stat.contentHash},b):c._client.readdir(a,b)},function(e,f,g,h){e?e.status===Dropbox.ApiError.NO_CONTENT&&null!==d?b(null,d.contents.slice(0)):b(e):(c.updateCachedDirInfo(a,g,f.slice(0)),h.forEach(function(b){c.updateCachedInfo(n.join(a,b.name),b)}),b(null,f))})},a.prototype.remove=function(a,b){var c=this;this._wrap(function(b){c._client.remove(a,b)},function(d,e){d||c.updateCachedInfo(a,e),b(d)})},a.prototype.move=function(a,b,c){var d=this;this._wrap(function(c){d._client.move(a,b,c)},function(e,f){e||(d.deleteCachedInfo(a),d.updateCachedInfo(b,f)),c(e)})},a.prototype.stat=function(a,b){var c=this;this._wrap(function(b){c._client.stat(a,b)},function(d,e){d||c.updateCachedInfo(a,e),b(d,e)})},a.prototype.readFile=function(a,b){var c=this,d=this.getCachedFileInfo(a);null!==d&&null!==d.contents?this.stat(a,function(e,f){e?b(e):f.contentHash===d.stat.contentHash?b(e,d.contents.slice(0),d.stat):c.readFile(a,b)}):this._wrap(function(b){c._client.readFile(a,{arrayBuffer:!0},b)},function(d,e,f){d||c.updateCachedInfo(a,f,e.slice(0)),b(d,e,f)})},a.prototype.writeFile=function(a,b,c){var d=this;this._wrap(function(c){d._client.writeFile(a,b,c)},function(e,f){e||d.updateCachedInfo(a,f,b.slice(0)),c(e,f)})},a.prototype.mkdir=function(a,b){var c=this;this._wrap(function(b){c._client.mkdir(a,b)},function(d,e){d||c.updateCachedInfo(a,e,[]),b(d)})},a.prototype._wrap=function(a,b){var c=0,d=function(e){var f=2;if(e&&3>++c)switch(e.status){case Dropbox.ApiError.SERVER_ERROR:case Dropbox.ApiError.NETWORK_ERROR:case Dropbox.ApiError.RATE_LIMITED:setTimeout(function(){a(d)},1e3*f);break;default:b.apply(null,arguments)}else b.apply(null,arguments)};a(d)},a}(),r=function(a){function b(b,c,d,e,f){a.call(this,b,c,d,e,f)}return h(b,a),b.prototype.sync=function(a){var b=this;if(this.isDirty()){var c=this.getBuffer(),d=o.buffer2ArrayBuffer(c);this._fs._writeFileStrict(this.getPath(),d,function(c){c||b.resetDirty(),a(c)})}else a()},b.prototype.close=function(a){this.sync(a)},b}(i.PreloadFile);c.DropboxFile=r;var s=function(a){function c(b){a.call(this),this._client=new q(b),d()}return h(c,a),c.prototype.getName=function(){return"Dropbox"},c.isAvailable=function(){return"undefined"!=typeof Dropbox},c.prototype.isReadOnly=function(){return!1},c.prototype.supportsSymlinks=function(){return!1},c.prototype.supportsProps=function(){return!1},c.prototype.supportsSynch=function(){return!1},c.prototype.empty=function(a){var b=this;this._client.readdir("/",function(c,d){if(c)a(b.convert(c,"/"));else{var e=function(a,c){var d=n.join("/",a);b._client.remove(d,function(a){c(a?b.convert(a,d):null)})},f=function(b){b?a(b):a()};m.each(d,e,f)}})},c.prototype.rename=function(a,b,c){var d=this;this._client.move(a,b,function(e){e?d._client.stat(b,function(f,g){if(f||g.isFolder){var h=e.response.error.indexOf(a)>-1?a:b;c(d.convert(e,h))}else d._client.remove(b,function(e){e?c(d.convert(e,b)):d.rename(a,b,c)})}):c()})},c.prototype.stat=function(a,b,c){var d=this;this._client.stat(a,function(b,e){if(b)c(d.convert(b,a));else{if(null==e||!e.isRemoved){var f=new k.default(d._statType(e),e.size);return c(null,f)}c(l.ApiError.FileError(l.ErrorCode.ENOENT,a))}})},c.prototype.open=function(a,c,d,e){var f=this;this._client.readFile(a,function(d,g,h){if(!d){var i;i=null===g?new b(0):o.arrayBuffer2Buffer(g);var j=f._makeFile(a,c,h,i);return e(null,j)}if(c.isReadable())e(f.convert(d,a));else switch(d.status){case Dropbox.ApiError.NOT_FOUND:var k=new ArrayBuffer(0);return f._writeFileStrict(a,k,function(b,d){if(b)e(b);else{var g=f._makeFile(a,c,d,o.arrayBuffer2Buffer(k));e(null,g)}});default:return e(f.co
c=l.dirname(c);d=d.reverse(),d.forEach(function(a){b._writable.mkdirSync(a,b.statSync(a,!1).mode)})},b.isAvailable=function(){return!0},b.prototype._syncAsync=function(a,b){var c=this;this.createParentDirectoriesAsync(a.getPath(),function(d){return d?b(d):void c._writable.writeFile(a.getPath(),a.getBuffer(),null,e("w"),a.getStats().mode,b)})},b.prototype._syncSync=function(a){this.createParentDirectories(a.getPath()),this._writable.writeFileSync(a.getPath(),a.getBuffer(),null,e("w"),a.getStats().mode)},b.prototype.getName=function(){return"OverlayFS"},b.prototype.initialize=function(a){var b=this,c=this._initializeCallbacks,d=function(a){b._isInitialized=!a,b._initializeCallbacks=[],c.forEach(function(b){return b(a)})};return this._isInitialized?a():(c.push(a),void(1===c.length&&this._writable.readFile(m,"utf8",e("r"),function(a,c){if(a){if(a.errno!==h.ErrorCode.ENOENT)return d(a)}else b._deleteLog=c;b._reparseDeletionLog(),d(null)})))},b.prototype.isReadOnly=function(){return!1},b.prototype.supportsSynch=function(){return this._readable.supportsSynch()&&this._writable.supportsSynch()},b.prototype.supportsLinks=function(){return!1},b.prototype.supportsProps=function(){return this._readable.supportsProps()&&this._writable.supportsProps()},b.prototype.deletePath=function(a){this._deletedFiles[a]=!0,this.updateLog("d"+a+"\n")},b.prototype.updateLog=function(a){var b=this;this._deleteLog+=a,this._deleteLogUpdatePending?this._deleteLogUpdateNeeded=!0:(this._deleteLogUpdatePending=!0,this._writable.writeFile(m,this._deleteLog,"utf8",i.FileFlag.getFileFlag("w"),420,function(a){b._deleteLogUpdatePending=!1,a?b._deleteLogError=a:b._deleteLogUpdateNeeded&&(b._deleteLogUpdateNeeded=!1,b.updateLog(""))}))},b.prototype.getDeletionLog=function(){return this._deleteLog},b.prototype._reparseDeletionLog=function(){var a=this;this._deletedFiles={},this._deleteLog.split("\n").forEach(function(b){a._deletedFiles[b.slice(1)]="d"===b.slice(0,1)})},b.prototype.restoreDeletionLog=function(a){this._deleteLog=a,this._reparseDeletionLog(),this.updateLog("")},b.prototype.rename=function(a,b,c){var d=this;if(this.checkInitAsync(c)&&!this.checkPathAsync(a,c)&&!this.checkPathAsync(b,c))return a===m||b===m?c(h.ApiError.EPERM("Cannot rename deletion log.")):a===b?c():void this.stat(a,!1,function(f,g){return f?c(f):d.stat(b,!1,function(f,i){function j(d){var e=d.shift();if(!e)return c();var f=l.resolve(a,e),g=l.resolve(b,e);this.rename(f,g,function(a){return a?c(a):void j(d)})}var k=511;if(g.isDirectory()){if(f)return f.errno!==h.ErrorCode.ENOENT?c(f):d._writable.exists(a,function(e){return e?d._writable.rename(a,b,c):void d._writable.mkdir(b,k,function(b){return b?c(b):void d._readable.readdir(a,function(a,b){return a?c():void j(b)})})});if(k=i.mode,!i.isDirectory())return c(h.ApiError.ENOTDIR(b));d.readdir(b,function(e,f){return f&&f.length?c(h.ApiError.ENOTEMPTY(b)):void d._readable.readdir(a,function(a,b){return a?c():void j(b)})})}return i&&i.isDirectory()?c(h.ApiError.EISDIR(b)):void d.readFile(a,null,e("r"),function(f,h){return f?c(f):d.writeFile(b,h,null,e("w"),g.mode,function(b){return b?c(b):d.unlink(a,c)})})})})},b.prototype.renameSync=function(a,b){var c=this;if(this.checkInitialized(),this.checkPath(a),this.checkPath(b),a===m||b===m)throw h.ApiError.EPERM("Cannot rename deletion log.");var d=this.statSync(a,!1);if(d.isDirectory()){if(a===b)return;var f=511;if(this.existsSync(b)){var g=this.statSync(b,!1),f=g.mode;if(!g.isDirectory())throw h.ApiError.ENOTDIR(b);if(this.readdirSync(b).length>0)throw h.ApiError.ENOTEMPTY(b)}this._writable.existsSync(a)?this._writable.renameSync(a,b):this._writable.existsSync(b)||this._writable.mkdirSync(b,f),this._readable.existsSync(a)&&this._readable.readdirSync(a).forEach(function(d){c.renameSync(l.resolve(a,d),l.resolve(b,d))})}else{if(this.existsSync(b)&&this.statSync(b,!1).isDirectory())throw h.ApiError.EISDIR(b);this.writeFileSync(b,this.readFileSync(a,null,e("r")),null,e("w"),d.mode)}a!==b&&this.existsSync(a)&&this.unlinkSync(a)},b.prototype.stat=function(a,b,c){var e=this;this.checkInitAsync(c)&&this.
return this.data.slice(a,a+this.fileCommentLength())},a.prototype.totalSize=function(){return 46+this.fileNameLength()+this.extraFieldLength()+this.fileCommentLength()},a.prototype.isDirectory=function(){var a=this.fileName();return!!(16&this.externalAttributes())||"/"===a.charAt(a.length-1)},a.prototype.isFile=function(){return!this.isDirectory()},a.prototype.useUTF8=function(){return 2048===(2048&this.flag())},a.prototype.isEncrypted=function(){return 1===(1&this.flag())},a.prototype.getFileData=function(){var a=this.headerRelativeOffset(),b=new q(this.zipData.slice(a));return new r(b,this,this.zipData.slice(a+b.totalSize()))},a.prototype.getData=function(){return this.getFileData().decompress()},a.prototype.getRawData=function(){return this.getFileData().getRawData()},a.prototype.getStats=function(){return new h.default(h.FileType.FILE,this.uncompressedSize(),365,new Date,this.lastModFileTime())},a}();c.CentralDirectory=v;var w=function(){function a(a){if(this.data=a,101010256!==this.data.readUInt32LE(0))throw new g.ApiError(g.ErrorCode.EINVAL,"Invalid Zip file: End of central directory record has invalid signature: "+this.data.readUInt32LE(0))}return a.prototype.diskNumber=function(){return this.data.readUInt16LE(4)},a.prototype.cdDiskNumber=function(){return this.data.readUInt16LE(6)},a.prototype.cdDiskEntryCount=function(){return this.data.readUInt16LE(8)},a.prototype.cdTotalEntryCount=function(){return this.data.readUInt16LE(10)},a.prototype.cdSize=function(){return this.data.readUInt32LE(12)},a.prototype.cdOffset=function(){return this.data.readUInt32LE(16)},a.prototype.cdZipCommentLength=function(){return this.data.readUInt16LE(20)},a.prototype.cdZipComment=function(){return e(this.data,!0,22,this.cdZipCommentLength())},a.prototype.rawCdZipComment=function(){return this.data.slice(22,22+this.cdZipCommentLength())},a}();c.EndOfCentralDirectory=w;var x=function(){function a(a,b,c,d){this.index=a,this.directoryEntries=b,this.eocd=c,this.data=d}return a}();c.ZipTOC=x;var y=function(a){function b(b,c){void 0===c&&(c=""),a.call(this),this.input=b,this.name=c,this._index=new o.FileIndex,this._directoryEntries=[],this._eocd=null,b instanceof x?(this._index=b.index,this._directoryEntries=b.directoryEntries,this._eocd=b.eocd,this.data=b.data):(this.data=b,this.populateIndex())}return f(b,a),b.prototype.getName=function(){return"ZipFS"+(""!==this.name?" "+this.name:"")},b.prototype.getCentralDirectoryEntry=function(a){var b=this._index.getInode(a);if(null===b)throw g.ApiError.ENOENT(a);return o.isFileInode(b)?b.getData():o.isDirInode(b)?b.getData():void 0},b.prototype.getCentralDirectoryEntryAt=function(a){var b=this._directoryEntries[a];if(!b)throw new RangeError("Invalid directory index: "+a+".");return b},b.prototype.getNumberOfCentralDirectoryEntries=function(){return this._directoryEntries.length},b.prototype.getEndOfCentralDirectory=function(){return this._eocd},b.isAvailable=function(){return!0},b.prototype.diskSpace=function(a,b){b(this.data.length,0)},b.prototype.isReadOnly=function(){return!0},b.prototype.supportsLinks=function(){return!1},b.prototype.supportsProps=function(){return!1},b.prototype.supportsSynch=function(){return!0},b.prototype.statSync=function(a,b){var c=this._index.getInode(a);if(null===c)throw g.ApiError.ENOENT(a);var d;if(o.isFileInode(c))d=c.getData().getStats();else{if(!o.isDirInode(c))throw new g.ApiError(g.ErrorCode.EINVAL,"Invalid inode.");d=c.getStats()}return d},b.prototype.openSync=function(a,b,c){if(b.isWriteable())throw new g.ApiError(g.ErrorCode.EPERM,a);var d=this._index.getInode(a);if(!d)throw g.ApiError.ENOENT(a);if(!o.isFileInode(d))throw g.ApiError.EISDIR(a);var e=d.getData(),f=e.getStats();switch(b.pathExistsAction()){case j.ActionType.THROW_EXCEPTION:case j.ActionType.TRUNCATE_FILE:throw g.ApiError.EEXIST(a);case j.ActionType.NOP:return new k.NoSyncFile(this,a,b,f,e.getData());default:throw new g.ApiError(g.ErrorCode.EINVAL,"Invalid FileMode object.")}},b.prototype.readdirSync=function(a){var b=this._index.getInode(a);if(b){if(o.isDirInode(b))return b.getListing();throw g.A
try{"string"==typeof c&&(c=new b(c,d)),g.writeSync(c,0,c.length,null)}finally{g.closeSync()}},a.prototype.chmod=function(a,b,c,d){d(new e.ApiError(e.ErrorCode.ENOTSUP))},a.prototype.chmodSync=function(a,b,c){throw new e.ApiError(e.ErrorCode.ENOTSUP)},a.prototype.chown=function(a,b,c,d,f){f(new e.ApiError(e.ErrorCode.ENOTSUP))},a.prototype.chownSync=function(a,b,c,d){throw new e.ApiError(e.ErrorCode.ENOTSUP)},a.prototype.utimes=function(a,b,c,d){d(new e.ApiError(e.ErrorCode.ENOTSUP))},a.prototype.utimesSync=function(a,b,c){throw new e.ApiError(e.ErrorCode.ENOTSUP)},a.prototype.link=function(a,b,c){c(new e.ApiError(e.ErrorCode.ENOTSUP))},a.prototype.linkSync=function(a,b){throw new e.ApiError(e.ErrorCode.ENOTSUP)},a.prototype.symlink=function(a,b,c,d){d(new e.ApiError(e.ErrorCode.ENOTSUP))},a.prototype.symlinkSync=function(a,b,c){throw new e.ApiError(e.ErrorCode.ENOTSUP)},a.prototype.readlink=function(a,b){b(new e.ApiError(e.ErrorCode.ENOTSUP))},a.prototype.readlinkSync=function(a){throw new e.ApiError(e.ErrorCode.ENOTSUP)},a}();c.BaseFileSystem=h;var i=function(a){function b(){a.apply(this,arguments)}return d(b,a),b.prototype.supportsSynch=function(){return!0},b.prototype.rename=function(a,b,c){try{this.renameSync(a,b),c()}catch(a){c(a)}},b.prototype.stat=function(a,b,c){try{c(null,this.statSync(a,b))}catch(a){c(a)}},b.prototype.open=function(a,b,c,d){try{d(null,this.openSync(a,b,c))}catch(a){d(a)}},b.prototype.unlink=function(a,b){try{this.unlinkSync(a),b()}catch(a){b(a)}},b.prototype.rmdir=function(a,b){try{this.rmdirSync(a),b()}catch(a){b(a)}},b.prototype.mkdir=function(a,b,c){try{this.mkdirSync(a,b),c()}catch(a){c(a)}},b.prototype.readdir=function(a,b){try{b(null,this.readdirSync(a))}catch(a){b(a)}},b.prototype.chmod=function(a,b,c,d){try{this.chmodSync(a,b,c),d()}catch(a){d(a)}},b.prototype.chown=function(a,b,c,d,e){try{this.chownSync(a,b,c,d),e()}catch(a){e(a)}},b.prototype.utimes=function(a,b,c,d){try{this.utimesSync(a,b,c),d()}catch(a){d(a)}},b.prototype.link=function(a,b,c){try{this.linkSync(a,b),c()}catch(a){c(a)}},b.prototype.symlink=function(a,b,c,d){try{this.symlinkSync(a,b,c),d()}catch(a){d(a)}},b.prototype.readlink=function(a,b){try{b(null,this.readlinkSync(a))}catch(a){b(a)}},b}(h);c.SynchronousFileSystem=i}).call(this,a("bfs-buffer").Buffer)},{"./api_error":52,"./file_flag":56,"bfs-buffer":2,path:10}],58:[function(a,b,c){(function(a){"use strict";var c;c="undefined"!=typeof window?window:"undefined"!=typeof self?self:a,b.exports=c}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],59:[function(a,b,c){"use strict";var d=a("./FS"),e=new d.default,f={},g=d.default.prototype;Object.keys(g).forEach(function(a){"function"==typeof e[a]?f[a]=function(){return e[a].apply(e,arguments)}:f[a]=e[a]}),f.changeFSModule=function(a){e=a},f.getFSModule=function(){return e},f._wrapCb=function(a,b){return e._wrapCb(a,b)},f.FS=d.default,b.exports=f},{"./FS":51}],60:[function(a,b,c){(function(a){"use strict";!function(a){a[a.FILE=32768]="FILE",a[a.DIRECTORY=16384]="DIRECTORY",a[a.SYMLINK=40960]="SYMLINK"}(c.FileType||(c.FileType={}));var b=c.FileType,d=function(){function c(a,c,d,e,f,g){if(void 0===e&&(e=new Date),void 0===f&&(f=new Date),void 0===g&&(g=new Date),this.size=c,this.mode=d,this.atime=e,this.mtime=f,this.ctime=g,this.dev=0,this.ino=0,this.rdev=0,this.nlink=1,this.blksize=4096,this.uid=0,this.gid=0,this.birthtime=new Date(0),this.file_data=null,null==this.mode)switch(a){case b.FILE:this.mode=420;break;case b.DIRECTORY:default:this.mode=511}this.blocks=Math.ceil(c/512),this.mode<4096&&(this.mode|=a)}return c.prototype.toBuffer=function(){var b=new a(32);return b.writeUInt32LE(this.size,0),b.writeUInt32LE(this.mode,4),b.writeDoubleLE(this.atime.getTime(),8),b.writeDoubleLE(this.mtime.getTime(),16),b.writeDoubleLE(this.ctime.getTime(),24),b},c.fromBuffer=function(a){var b=a.readUInt32LE(0),d=a.readUInt32LE(4),e=a.readDoubleLE(8),f=a.readDoubleLE(16),g=a.readDoubleLE(24);return new c(61440&d,b,4095&d,new Date(e),new Date(f),new Date(g))},c.prototype.c
return this._fs.truncateSync(a,b)},a.prototype.readFile=function(a,b,c,d){var e=this;this._mu.lock(function(){e._fs.readFile(a,b,c,function(a,b){e._mu.unlock(),d(a,b)})})},a.prototype.readFileSync=function(a,b,c){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.readFileSync(a,b,c)},a.prototype.writeFile=function(a,b,c,d,e,f){var g=this;this._mu.lock(function(){g._fs.writeFile(a,b,c,d,e,function(a){g._mu.unlock(),f(a)})})},a.prototype.writeFileSync=function(a,b,c,d,e){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.writeFileSync(a,b,c,d,e)},a.prototype.appendFile=function(a,b,c,d,e,f){var g=this;this._mu.lock(function(){g._fs.appendFile(a,b,c,d,e,function(a){g._mu.unlock(),f(a)})})},a.prototype.appendFileSync=function(a,b,c,d,e){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.appendFileSync(a,b,c,d,e)},a.prototype.chmod=function(a,b,c,d){var e=this;this._mu.lock(function(){e._fs.chmod(a,b,c,function(a){e._mu.unlock(),d(a)})})},a.prototype.chmodSync=function(a,b,c){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.chmodSync(a,b,c)},a.prototype.chown=function(a,b,c,d,e){var f=this;this._mu.lock(function(){f._fs.chown(a,b,c,d,function(a){f._mu.unlock(),e(a)})})},a.prototype.chownSync=function(a,b,c,d){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.chownSync(a,b,c,d)},a.prototype.utimes=function(a,b,c,d){var e=this;this._mu.lock(function(){e._fs.utimes(a,b,c,function(a){e._mu.unlock(),d(a)})})},a.prototype.utimesSync=function(a,b,c){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.utimesSync(a,b,c)},a.prototype.link=function(a,b,c){var d=this;this._mu.lock(function(){d._fs.link(a,b,function(a){d._mu.unlock(),c(a)})})},a.prototype.linkSync=function(a,b){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.linkSync(a,b)},a.prototype.symlink=function(a,b,c,d){var e=this;this._mu.lock(function(){e._fs.symlink(a,b,c,function(a){e._mu.unlock(),d(a)})})},a.prototype.symlinkSync=function(a,b,c){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.symlinkSync(a,b,c)},a.prototype.readlink=function(a,b){var c=this;this._mu.lock(function(){c._fs.readlink(a,function(a,d){c._mu.unlock(),b(a,d)})})},a.prototype.readlinkSync=function(a){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.readlinkSync(a)},a}();c.__esModule=!0,c.default=e},{"./mutex":67}],67:[function(a,b,c){"use strict";var d=function(){function a(){this._locked=!1,this._waiters=[]}return a.prototype.lock=function(a){return this._locked?void this._waiters.push(a):(this._locked=!0,void a())},a.prototype.unlock=function(){if(!this._locked)throw new Error("unlock of a non-locked mutex");var a=this._waiters.shift();return a?void setImmediate(a):void(this._locked=!1)},a.prototype.tryLock=function(){return!this._locked&&(this._locked=!0,!0)},a.prototype.isLocked=function(){return this._locked},a}();c.__esModule=!0,c.default=d},{}],68:[function(a,b,c){(function(b){"use strict";var d=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);a.prototype=null===b?Object.create(b):(c.prototype=b.prototype,new c)},e=a("../core/file"),f=a("../core/api_error"),g=a("../core/node_fs"),h=function(a){function c(c,d,e,f,g){if(a.call(this),this._pos=0,this._dirty=!1,this._fs=c,this._path=d,this._flag=e,this._stat=f,null!=g?this._buffer=g:this._buffer=new b(0),this._stat.size!==this._buffer.length&&this._flag.isReadable())throw new Error("Invalid buffer: Buffer is "+this._buffer.length+" long, yet Stats object specifies that file is "+this._stat.size+" long.")}return d(c,a),c.prototype.isDirty=function(){return this._dirty},c.prototype.resetDirty=function(){this._dirty=!1},c.prototype.getBuffer=function(){return this._buffer},c.prototype.getStats=function(){return this._stat},c.prototype.getFlag=function(){return this._flag},c.prototype.getPath=function(){return this._path},c.prototype.getPos=function(){retu
//# sourceMappingURL=browserfs.min.js.map