}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,s=1023&i;e+=1,u.push(65536+(o<<10)+s)}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}functions(l,n){if(l)thrownewo("Decoder error");returnn||65533}functiona(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}functionh(n){if(!("encoding-indexes"inl))throwError("Indexes missing. Did you forget to include encoding-indexes.js?");returnl["encoding-indexes"][n]}functiond(l){if(l>39419&&189e3>l||l>1237575)returnnull;varn,u=0,e=0,t=h("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=h("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?s(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))returns(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),s(u);if(r+=1,e+=(o-128)*Math.pow(64,t-r),r!==t)returnnull;vara=e,c=i;returne=0,t=0,r=0,i=0,n(a,c,1114111)&&!n(a,55296,57343)?a:s(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))returna(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;){vars=u(t,Math.pow(64,r-1));o=l.emit(128+s%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?s(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&&a(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,s(e)),u.offset(1);vara;if(0!==i)returna=null,n(o,48,57)&&(a=d(10*(126*(10*(t-129)+(r-48))+(i-129))+o-48)),t=0,r=0,i=0,null===a?(u.offset(-3),s(e)):a;if(0!==r)returnn(o,129,254)?(i=o,null):(u.offset(-2),t=0,r=0,s(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)),a=null===p?null:f(p,h("gbk")),null===p&&u.offset(-1),null===a?s(e):a}returnn(o,0,127)?o:128===o?8364:n(o,129,254)?(t=o,null):s(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,h("gbk"));if(null!==i){varo=u(i,190)+129,
n.objectStoreNames.contains(K)&&n.deleteObjectStore(K),n.createObjectStore(K),n.objectStoreNames.contains(Y)&&n.deleteObjectStore(Y),n.createObjectStore(Y),u=!0},r.onsuccess=function(l){functionn(l){e.db=r,l?(e.readyState=G,t.reject(l)):(e.readyState=W,t.resolve())}varr=l.target.result,i=r.transaction([K],$),o=i.objectStore(K);if(u){vars=o.clear();s.onsuccess=function(){a(o,n)},s.onerror=function(l){n(l)}}elsen()},r.onerror=function(l){this.readyState=G,t.reject(l)};vari=1,o={};this.readyState=V,this.db=null,this.nextDescriptor=i,this.openFiles=o,this.name=l}var_=window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB,x=l("lodash"),E=l("when");l("encoding-indexes"),l("encoding");varj=l("src/path").normalize,k=l("src/path").dirname,A=l("src/path").basename,O=l("src/shared").guid,I=l("src/shared").hash;l("src/shared").nop;varS=l("src/error").EExists,B=l("src/error").EIsDirectory,D=l("src/error").ENoEntry,L=l("src/error").EBusy,C=l("src/error").ENotEmpty,R=l("src/error").ENotDirectory,T=l("src/error").EBadFileDescriptor;l("src/error").ENotImplemented,l("src/error").ENotMounted;varN=l("src/error").EInvalid,F=l("src/error").EIO,M=l("src/error").EFileSystemError,P=l("src/constants").FS_FORMAT,z=l("src/constants").MODE_FILE,H=l("src/constants").MODE_DIRECTORY,U=l("src/constants").ROOT_DIRECTORY_NAME,q=l("src/constants").ROOT_NODE_ID,$=l("src/constants").IDB_RW;l("src/constants").IDB_RO;varK=l("src/constants").FILE_STORE_NAME,Y=l("src/constants").METADATA_STORE_NAME,W=l("src/constants").FS_READY,V=l("src/constants").FS_PENDING,G=l("src/constants").FS_ERROR,X=l("src/constants").O_READ,J=l("src/constants").O_WRITE,Q=l("src/constants").O_CREATE,Z=l("src/constants").O_EXCLUSIVE;l("src/constants").O_TRUNCATE;varln=l("src/constants").O_APPEND,nn=l("src/constants").O_FLAGS;returnw.prototype._allocate_descriptor=function(l){varn=this.nextDescriptor++;returnthis.openFiles[n]=l,n},w.prototype._release_descriptor=function(l){deletethis.openFiles[l]},w.prototype.open=function(l,n,e){vart=this;this.promise.then(function(){functionr(l,e){if(l)i.reject(l);else{varr;r=x(n).contains(ln)?e.size:0;varo=newu(e.id,n,r),s=t._allocate_descriptor(o);i.resolve(s)}}vari=E.defer(),o=t.db.transaction([K],$),s=o.objectStore(K);x(nn).has(n)?n=nn[n]:i.reject(newN("flags is not valid")),p(this,s,l,n,r),i.promise.then(function(l){e(void0,l)},function(l){e(l)})},function(){e(newM("unknown error"))})},w.prototype.close=function(l,n){varu=E.defer();x(this.openFiles).has(l)?(this._release_descriptor(l),u.resolve()):u.reject(newT("invalid file descriptor")),u.promise.then(function(){n()},function(l){n(l)})},w.prototype.mkdir=function(l,n){varu=this;this.promise.then(function(){functione(l){l?t.reject(l):t.resolve()}vart=E.defer(),r=u.db.transaction([K],$),i=r.objectStore(K);c(i,l,e),t.promise.then(function(){n()},function(l){n(l)})},function(){n(newM("unknown error"))})},w.prototype.rmdir=function(l,n){varu=this;this.promise.then(function(){functione(l){l?t.reject(l):t.resolve()}vart=E.defer(),r=u.db.transaction([K],$),i=r.objectStore(K);f(i,l,e),t.promise.then(function(){n()},function(l){n(l)})},function(){n(newM("unknown error"))})},w.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=E.defer(),i=u.db.transaction([K],$),o=i.objectStore(K);g(o,l,e),r.promise.then(function(l){n(void0,l)},function(l){n(l)})},function(){n(newM("unknown error"))})},w.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=E.defer(),i=u.db.transaction([K],$),o=i.objectStore(K),s=u.openFiles[l];s?v(o,s,e):r.reject(newT("invalid file descriptor")),r.promise.then(function(l){n(void0,l)},function(l){n(l)})},function(){n(newM("unknown error"))})},w.prototype.link=function(l,n,u){vare=this;this.promise.then(function(){functiont(l){l?r.reject(l):r.resolve()}varr=E.defer(),i=e.db.transaction([K],$),o=i.objectStore(K);m(o,l,n,t),r.promise.