}functionu(l,n){returnMath.floor(l/n)}functione(l){varn=0;this.get=function(){returnn>=l.length?M:Number(l[n])},this.offset=function(u){if(n+=u,0>n)throwError("Seeking past start of the buffer");if(n>l.length)throwError("Seeking past EOF")},this.match=function(u){if(u.length>n+l.length)return!1;vare;for(e=0;u.length>e;e+=1)if(Number(l[n+e])!==u[e])return!1;return!0}}functiont(l){varn=0;this.emit=function(){varu,e=M;for(u=0;arguments.length>u;++u)e=Number(arguments[u]),l[n++]=e;returne}}functionr(l){functionu(l){for(varu=[],e=0,t=l.length;l.length>e;){varr=l.charCodeAt(e);if(n(r,55296,57343))if(n(r,56320,57343))u.push(65533);elseif(e===t-1)u.push(65533);else{vari=l.charCodeAt(e+1);if(n(i,56320,57343)){varo=1023&r,a=1023&i;e+=1,u.push(65536+(o<<10)+a)}elseu.push(65533)}elseu.push(r);e+=1}returnu}vare=0,t=u(l);this.offset=function(l){if(e+=l,0>e)throwError("Seeking past start of the buffer");if(e>t.length)throwError("Seeking past EOF")},this.get=function(){returne>=t.length?P:t[e]}}functioni(){varl="";this.string=function(){returnl},this.emit=function(n){65535>=n?l+=String.fromCharCode(n):(n-=65536,l+=String.fromCharCode(55296+(1023&n>>10)),l+=String.fromCharCode(56320+(1023&n)))}}functiono(l){this.name="EncodingError",this.message=l,this.code=0}functiona(l,n){if(l)thrownewo("Decoder error");returnn||65533}functions(l){thrownewo("The code point "+l+" could not be encoded.")}functionc(l){returnl=(l+"").trim().toLowerCase(),Object.prototype.hasOwnProperty.call(U,l)?U[l]:null}functionf(l,n){return(n||[])[l]||null}functionp(l,n){varu=n.indexOf(l);return-1===u?null:u}functiond(n){if(!("encoding-indexes"inl))throwError("Indexes missing. Did you forget to include encoding-indexes.js?");returnl["encoding-indexes"][n]}functionh(l){if(l>39419&&189e3>l||l>1237575)returnnull;varn,u=0,e=0,t=d("gb18030");for(n=0;t.length>n;++n){varr=t[n];if(!(l>=r[0]))break;u=r[0],e=r[1]}returne+l-u}functiong(l){varn,u=0,e=0,t=d("gb18030");for(n=0;t.length>n;++n){varr=t[n];if(!(l>=r[1]))break;u=r[1],e=r[0]}returne+l-u}functionv(l){varu=l.fatal,e=0,t=0,r=0,i=0;this.decode=function(l){varo=l.get();if(o===M)return0!==t?a(u):P;if(l.offset(1),0===t){if(n(o,0,127))returno;if(n(o,194,223))t=1,i=128,e=o-192;elseif(n(o,224,239))t=2,i=2048,e=o-224;else{if(!n(o,240,244))returna(u);t=3,i=65536,e=o-240}returne*=Math.pow(64,t),null}if(!n(o,128,191))returne=0,t=0,r=0,i=0,l.offset(-1),a(u);if(r+=1,e+=(o-128)*Math.pow(64,t-r),r!==t)returnnull;vars=e,c=i;returne=0,t=0,r=0,i=0,n(s,c,1114111)&&!n(s,55296,57343)?s:a(u)}}functionm(l){l.fatal,this.encode=function(l,e){vart=e.get();if(t===P)returnM;if(e.offset(1),n(t,55296,57343))returns(t);if(n(t,0,127))returnl.emit(t);varr,i;n(t,128,2047)?(r=1,i=192):n(t,2048,65535)?(r=2,i=224):n(t,65536,1114111)&&(r=3,i=240);for(varo=l.emit(u(t,Math.pow(64,r))+i);r>0;){vara=u(t,Math.pow(64,r-1));o=l.emit(128+a%64),r-=1}returno}}functiony(l,u){vare=u.fatal;this.decode=function(u){vart=u.get();if(t===M)returnP;if(u.offset(1),n(t,0,127))returnt;varr=l[t-128];returnnull===r?a(e):r}}functionb(l,u){u.fatal,this.encode=function(u,e){vart=e.get();if(t===P)returnM;if(e.offset(1),n(t,0,127))returnu.emit(t);varr=p(t,l);returnnull===r&&s(t),u.emit(r+128)}}functionw(l,u){vare=u.fatal,t=0,r=0,i=0;this.decode=function(u){varo=u.get();if(o===M&&0===t&&0===r&&0===i)returnP;o!==M||0===t&&0===r&&0===i||(t=0,r=0,i=0,a(e)),u.offset(1);vars;if(0!==i)returns=null,n(o,48,57)&&(s=h(10*(126*(10*(t-129)+(r-48))+(i-129))+o-48)),t=0,r=0,i=0,null===s?(u.offset(-3),a(e)):s;if(0!==r)returnn(o,129,254)?(i=o,null):(u.offset(-2),t=0,r=0,a(e));if(0!==t){if(n(o,48,57)&&l)returnr=o,null;varc=t,p=null;t=0;varg=127>o?64:65;return(n(o,64,126)||n(o,128,254))&&(p=190*(c-129)+(o-g)),s=null===p?null:f(p,d("gbk")),null===p&&u.offset(-1),null===s?a(e):s}returnn(o,0,127)?o:128===o?8364:n(o,129,254)?(t=o,null):a(e)}}function_(l,e){e.fatal,this.encode=function(e,t){varr=t.get();if(r===P)returnM;if(t.offset(1),n(r,0,127))returne.emit(r);vari=p(r,d("gbk"));if(null!==i){varo=u(i,190)+129,
n.objectStoreNames.contains(W)&&n.deleteObjectStore(W),n.createObjectStore(W),n.objectStoreNames.contains(V)&&n.deleteObjectStore(V),n.createObjectStore(V),u=!0},r.onsuccess=function(l){functionn(l){e.db=r,l?(e.readyState=J,t.reject(l)):(e.readyState=G,t.resolve())}varr=l.target.result,i=r.transaction([W],K),o=i.objectStore(W);if(u){vara=o.clear();a.onsuccess=function(){s(o,n)},a.onerror=function(l){n(l)}}elsen()},r.onerror=function(l){this.readyState=J,t.reject(l)};vari=1,o={};this.readyState=X,this.db=null,this.nextDescriptor=i,this.openFiles=o,this.name=l}varx=window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB,E=l("lodash"),j=l("when");l("encoding-indexes"),l("encoding");vark=l("src/path").normalize,A=l("src/path").dirname,O=l("src/path").basename,I=l("src/shared").guid,S=l("src/shared").hash;l("src/shared").nop;varB=l("src/error").EExists,D=l("src/error").EIsDirectory,L=l("src/error").ENoEntry,C=l("src/error").EBusy,R=l("src/error").ENotEmpty,T=l("src/error").ENotDirectory,N=l("src/error").EBadFileDescriptor;l("src/error").ENotImplemented,l("src/error").ENotMounted;varF=l("src/error").EInvalid,M=l("src/error").EIO,P=l("src/error").EFileSystemError,z=l("src/constants").FS_FORMAT,H=l("src/constants").MODE_FILE,U=l("src/constants").MODE_DIRECTORY,q=l("src/constants").ROOT_DIRECTORY_NAME,$=l("src/constants").ROOT_NODE_ID,K=l("src/constants").IDB_RW,Y=l("src/constants").IDB_RO,W=l("src/constants").FILE_STORE_NAME,V=l("src/constants").METADATA_STORE_NAME,G=l("src/constants").FS_READY,X=l("src/constants").FS_PENDING,J=l("src/constants").FS_ERROR,Q=l("src/constants").O_READ,Z=l("src/constants").O_WRITE,ln=l("src/constants").O_CREATE,nn=l("src/constants").O_EXCLUSIVE;l("src/constants").O_TRUNCATE;varun=l("src/constants").O_APPEND,en=l("src/constants").O_FLAGS;return_.prototype._allocate_descriptor=function(l){varn=this.nextDescriptor++;returnthis.openFiles[n]=l,n},_.prototype._release_descriptor=function(l){deletethis.openFiles[l]},_.prototype.open=function(l,n,e){vart=this;this.promise.then(function(){functionr(l,e){if(l)i.reject(l);else{varr;r=E(n).contains(un)?e.size:0;varo=newu(e.id,n,r),a=t._allocate_descriptor(o);i.resolve(a)}}vari=j.defer(),o=t.db.transaction([W],K),a=o.objectStore(W);n=w(n),n||i.reject(newF("flags is not valid")),p(t,a,l,n,r),i.promise.then(function(l){e(void0,l)},function(l){e(l)})},function(){e(newP("unknown error"))})},_.prototype.close=function(l,n){varu=j.defer();E(this.openFiles).has(l)?(this._release_descriptor(l),u.resolve()):u.reject(newN("invalid file descriptor")),u.promise.then(function(){n()},function(l){n(l)})},_.prototype.mkdir=function(l,n){varu=this;this.promise.then(function(){functione(l){l?t.reject(l):t.resolve()}vart=j.defer(),r=u.db.transaction([W],K),i=r.objectStore(W);c(i,l,e),t.promise.then(function(){n()},function(l){n(l)})},function(){n(newP("unknown error"))})},_.prototype.rmdir=function(l,n){varu=this;this.promise.then(function(){functione(l){l?t.reject(l):t.resolve()}vart=j.defer(),r=u.db.transaction([W],K),i=r.objectStore(W);f(i,l,e),t.promise.then(function(){n()},function(l){n(l)})},function(){n(newP("unknown error"))})},_.prototype.stat=function(l,n){varu=this;this.promise.then(function(){functione(l,n){if(l)r.reject(l);else{vare=newt(n,u.name);r.resolve(e)}}varr=j.defer(),i=u.db.transaction([W],K),o=i.objectStore(W);g(o,l,e),r.promise.then(function(l){n(void0,l)},function(l){n(l)})},function(){n(newP("unknown error"))})},_.prototype.fstat=function(l,n){varu=this;this.promise.then(function(){functione(l,n){if(l)r.reject(l);else{vare=newt(n,u.name);r.resolve(e)}}varr=j.defer(),i=u.db.transaction([W],K),o=i.objectStore(W),a=u.openFiles[l];a?v(o,a,e):r.reject(newN("invalid file descriptor")),r.promise.then(function(l){n(void0,l)},function(l){n(l)})},function(){n(newP("unknown error"))})},_.prototype.link=function(l,n,u){vare=this;this.promise.then(function(){functiont(l){l?r.reject(l):r.resolve()}varr=j.defer(),i=e.db.transaction([W],K),o=i.objectStore(W);m(o,l,n,t),r.promise.then(function(