UNPKG

1.17 MBSource Map (JSON)View Raw
1{"version":3,"sources":["webpack://git/webpack/universalModuleDefinition","webpack://git/webpack/bootstrap","webpack://git/./src/utils/assertParameter.js","webpack://git/./src/utils/normalizePath.js","webpack://git/./src/utils/join.js","webpack://git/./src/errors/BaseError.js","webpack://git/./src/models/FileSystem.js","webpack://git/./src/models/GitPackedRefs.js","webpack://git/./src/utils/compareRefNames.js","webpack://git/./src/managers/GitRefManager.js","webpack://git/./src/errors/InternalError.js","webpack://git/./src/storage/readObject.js","webpack://git/./src/models/GitPktLine.js","webpack://git/./src/errors/NotFoundError.js","webpack://git/./node_modules/node-libs-browser/node_modules/buffer/index.js","webpack://git/./src/models/GitTree.js","webpack://git/./src/models/GitCommit.js","webpack://git/./src/managers/GitIndexManager.js","webpack://git/./src/managers/GitConfigManager.js","webpack://git/./src/errors/ObjectTypeError.js","webpack://git/./src/models/GitAnnotatedTag.js","webpack://git/./src/storage/writeObject.js","webpack://git/./src/utils/toHex.js","webpack://git/./src/utils/shasum.js","webpack://git/./src/utils/BufferCursor.js","webpack://git/./src/utils/normalizeNewlines.js","webpack://git/./src/errors/MissingNameError.js","webpack://git/./src/models/GitObject.js","webpack://git/./src/errors/MissingParameterError.js","webpack://git/./src/errors/AlreadyExistsError.js","webpack://git/./src/utils/dirname.js","webpack://git/./node_modules/pako/lib/utils/common.js","webpack://git/./src/errors/InvalidOidError.js","webpack://git/./src/utils/normalizeStats.js","webpack://git/./src/models/GitWalkerRepo.js","webpack://git/./src/commands/TREE.js","webpack://git/./src/errors/ParseError.js","webpack://git/./src/utils/symbols.js","webpack://git/./src/utils/compareStrings.js","webpack://git/./src/utils/forAwait.js","webpack://git/./src/utils/basename.js","webpack://git/./src/utils/arrayRange.js","webpack://git/./src/models/RunningMinimum.js","webpack://git/./src/utils/unionOfIterators.js","webpack://git/./src/commands/walk.js","webpack://git/./src/errors/InvalidRefNameError.js","webpack://git/./src/managers/GitShallowManager.js","webpack://git/./src/commands/currentBranch.js","webpack://git/./node_modules/clean-git-ref/lib/index.js","webpack://git/./src/errors/UnsafeFilepathError.js","webpack://git/./src/utils/resolveTree.js","webpack://git/./src/utils/pkg.js","webpack://git/./node_modules/pako/index.js","webpack://git/./src/utils/padHex.js","webpack://git/./src/utils/parseAuthor.js","webpack://git/./src/utils/collect.js","webpack://git/./src/utils/modified.js","webpack://git/./src/commands/readTree.js","webpack://git/./src/managers/GitRemoteHTTP.js","webpack://git/./src/errors/MergeNotSupportedError.js","webpack://git/./src/errors/MergeConflictError.js","webpack://git/./src/errors/HttpError.js","webpack://git/./src/errors/InvalidFilepathError.js","webpack://git/./src/utils/comparePath.js","webpack://git/./src/models/GitPackIndex.js","webpack://git/./src/managers/GitIgnoreManager.js","webpack://git/./src/managers/GitRemoteManager.js","webpack://git/./src/utils/translateSSHtoHTTP.js","webpack://git/./node_modules/async-lock/index.js","webpack://git/./src/utils/formatAuthor.js","webpack://git/./src/utils/FIFO.js","webpack://git/./src/errors/RemoteCapabilityError.js","webpack://git/./src/utils/compareStats.js","webpack://git/./src/utils/resolveFilepath.js","webpack://git/./src/errors/EmptyServerResponseError.js","webpack://git/./src/errors/NoRefspecError.js","webpack://git/./src/errors/SmartHttpError.js","webpack://git/./src/errors/UnknownTransportError.js","webpack://git/./src/errors/UrlParseError.js","webpack://git/./src/errors/UserCanceledError.js","webpack://git/./src/errors/UnmergedPathsError.js","webpack://git/./src/models/GitSideBand.js","webpack://git/./node_modules/sha.js/sha1.js","webpack://git/./src/utils/normalizeMode.js","webpack://git/./src/models/GitRefSpec.js","webpack://git/./src/storage/readPackIndex.js","webpack://git/./src/utils/StreamReader.js","webpack://git/./src/utils/inflate.js","webpack://git/./src/utils/deflate.js","webpack://git/./src/utils/calculateBasicAuthHeader.js","webpack://git/./src/wire/parseCapabilitiesV2.js","webpack://git/./src/wire/parseRefsAdResponse.js","webpack://git/./src/utils/getIterator.js","webpack://git/./src/utils/fromValue.js","webpack://git/./src/utils/indent.js","webpack://git/./node_modules/pify/index.js","webpack://git/./src/utils/abbreviateRef.js","webpack://git/./src/errors/index.js","webpack://git/./src/errors/PushRejectedError.js","webpack://git/./src/commands/commit.js","webpack://git/./node_modules/pako/lib/zlib/messages.js","webpack://git/./src/errors/AmbiguousError.js","webpack://git/./src/errors/CheckoutConflictError.js","webpack://git/./src/errors/CommitNotFetchedError.js","webpack://git/./src/errors/FastForwardError.js","webpack://git/./src/errors/GitPushError.js","webpack://git/./src/errors/MaxDepthError.js","webpack://git/./src/errors/MultipleGitError.js","webpack://git/./src/errors/IndexResetError.js","webpack://git/./src/models/GitIndex.js","webpack://git/./src/utils/flatFileListToDirectoryStructure.js","webpack://git/./src/models/GitConfig.js","webpack://git/./src/models/GitRefSpecSet.js","webpack://git/./src/storage/readObjectPacked.js","webpack://git/./src/utils/mergeFile.js","webpack://git/./src/commands/pack.js","webpack://git/./src/utils/flat.js","webpack://git/./src/commands/listObjects.js","webpack://git/./src/utils/rmRecursive.js","webpack://git/./src/utils/extractAuthFromUrl.js","webpack://git/./node_modules/process/browser.js","webpack://git/./src/commands/writeTree.js","webpack://git/./src/commands/fetch.js","webpack://git/./node_modules/safe-buffer/index.js","webpack://git/./node_modules/pako/lib/zlib/adler32.js","webpack://git/./node_modules/pako/lib/zlib/crc32.js","webpack://git/./node_modules/pako/lib/utils/strings.js","webpack://git/./node_modules/pako/lib/zlib/zstream.js","webpack://git/./node_modules/pako/lib/zlib/constants.js","webpack://git/./src/wire/writeUploadPackRequest.js","webpack://git/./src/wire/parseUploadPackResponse.js","webpack://git/./src/utils/mergeTree.js","webpack://git/./src/commands/listCommitsAndTags.js","webpack://git/./src/wire/writeReceivePackRequest.js","webpack://git/./src/wire/parseReceivePackResponse.js","webpack://git/./src/utils/compareTreeEntryPath.js","webpack://git/./src/storage/readObjectLoose.js","webpack://git/./node_modules/crc-32/crc32.js","webpack://git/./src/utils/git-list-pack.js","webpack://git/./src/utils/applyDelta.js","webpack://git/./src/utils/outdent.js","webpack://git/./src/utils/types.js","webpack://git/./node_modules/ignore/index.js","webpack://git/./src/storage/writeObjectLoose.js","webpack://git/./node_modules/diff3/diff3.js","webpack://git/./src/commands/types.js","webpack://git/./src/utils/filterCapabilities.js","webpack://git/./src/utils/splitLines.js","webpack://git/./node_modules/async-lock/lib/index.js","webpack://git/(webpack)/buildin/global.js","webpack://git/./node_modules/node-libs-browser/node_modules/base64-js/index.js","webpack://git/./node_modules/ieee754/index.js","webpack://git/./node_modules/isarray/index.js","webpack://git/./node_modules/inherits/inherits_browser.js","webpack://git/./node_modules/sha.js/hash.js","webpack://git/./node_modules/pako/lib/deflate.js","webpack://git/./node_modules/pako/lib/zlib/deflate.js","webpack://git/./node_modules/pako/lib/zlib/trees.js","webpack://git/./node_modules/pako/lib/inflate.js","webpack://git/./node_modules/pako/lib/zlib/inflate.js","webpack://git/./node_modules/pako/lib/zlib/inffast.js","webpack://git/./node_modules/pako/lib/zlib/inftrees.js","webpack://git/./node_modules/pako/lib/zlib/gzheader.js","webpack://git/./node_modules/diff3/onp.js","webpack://git/./src/api/hashBlob.js","webpack://git/./src/api/writeObject.js","webpack://git/./src/storage/hasObjectLoose.js","webpack://git/./src/storage/hasObjectPacked.js","webpack://git/./src/storage/hasObject.js","webpack://git/./src/commands/addNote.js","webpack://git/./src/utils/emptyPackfile.js","webpack://git/./src/storage/hashObject.js","webpack://git/./src/commands/packObjects.js","webpack://git/./src/models/GitWalkerIndex.js","webpack://git/./src/utils/mode2type.js","webpack://git/./src/commands/STAGE.js","webpack://git/./src/models/GitWalkerFs.js","webpack://git/./src/commands/WORKDIR.js","webpack://git/./src/api/abortMerge.js","webpack://git/./src/utils/posixifyPathBuffer.js","webpack://git/./src/api/add.js","webpack://git/./src/commands/getConfig.js","webpack://git/./src/utils/normalizeAuthorObject.js","webpack://git/./src/utils/normalizeCommitterObject.js","webpack://git/./src/api/addNote.js","webpack://git/./src/commands/addRemote.js","webpack://git/./src/api/addRemote.js","webpack://git/./src/commands/annotatedTag.js","webpack://git/./src/api/annotatedTag.js","webpack://git/./src/commands/branch.js","webpack://git/./src/api/branch.js","webpack://git/./src/utils/worthWalking.js","webpack://git/./src/commands/checkout.js","webpack://git/./src/api/checkout.js","webpack://git/./src/commands/init.js","webpack://git/./src/commands/clone.js","webpack://git/./src/api/clone.js","webpack://git/./src/api/commit.js","webpack://git/./src/api/currentBranch.js","webpack://git/./src/commands/deleteBranch.js","webpack://git/./src/api/deleteBranch.js","webpack://git/./src/api/deleteRef.js","webpack://git/./src/commands/deleteRemote.js","webpack://git/./src/api/deleteRemote.js","webpack://git/./src/commands/deleteTag.js","webpack://git/./src/api/deleteTag.js","webpack://git/./src/storage/expandOidLoose.js","webpack://git/./src/storage/expandOidPacked.js","webpack://git/./src/storage/expandOid.js","webpack://git/./src/api/expandOid.js","webpack://git/./src/api/expandRef.js","webpack://git/./src/commands/findMergeBase.js","webpack://git/./src/commands/merge.js","webpack://git/./src/commands/pull.js","webpack://git/./src/api/fastForward.js","webpack://git/./src/api/fetch.js","webpack://git/./src/api/findMergeBase.js","webpack://git/./src/commands/findRoot.js","webpack://git/./src/api/findRoot.js","webpack://git/./src/api/getConfig.js","webpack://git/./src/commands/getConfigAll.js","webpack://git/./src/api/getConfigAll.js","webpack://git/./src/api/getRemoteInfo.js","webpack://git/./src/utils/formatInfoRefs.js","webpack://git/./src/api/getRemoteInfo2.js","webpack://git/./src/commands/indexPack.js","webpack://git/./src/api/indexPack.js","webpack://git/./src/api/init.js","webpack://git/./src/commands/isDescendent.js","webpack://git/./src/api/isDescendent.js","webpack://git/./src/api/isIgnored.js","webpack://git/./src/api/listBranches.js","webpack://git/./src/commands/listFiles.js","webpack://git/./src/api/listFiles.js","webpack://git/./src/commands/listNotes.js","webpack://git/./src/api/listNotes.js","webpack://git/./src/commands/listRemotes.js","webpack://git/./src/api/listRemotes.js","webpack://git/./src/wire/parseListRefsResponse.js","webpack://git/./src/wire/writeListRefsRequest.js","webpack://git/./src/api/listServerRefs.js","webpack://git/./src/api/listTags.js","webpack://git/./src/utils/resolveCommit.js","webpack://git/./src/commands/readCommit.js","webpack://git/./src/utils/compareAge.js","webpack://git/./src/utils/resolveFileIdInTree.js","webpack://git/./src/commands/log.js","webpack://git/./src/api/log.js","webpack://git/./src/api/merge.js","webpack://git/./src/api/packObjects.js","webpack://git/./src/api/pull.js","webpack://git/./src/commands/push.js","webpack://git/./src/api/push.js","webpack://git/./src/utils/resolveBlob.js","webpack://git/./src/commands/readBlob.js","webpack://git/./src/api/readBlob.js","webpack://git/./src/api/readCommit.js","webpack://git/./src/commands/readNote.js","webpack://git/./src/api/readNote.js","webpack://git/./src/api/readObject.js","webpack://git/./src/commands/readTag.js","webpack://git/./src/api/readTag.js","webpack://git/./src/api/readTree.js","webpack://git/./src/api/remove.js","webpack://git/./src/commands/removeNote.js","webpack://git/./src/api/removeNote.js","webpack://git/./src/commands/renameBranch.js","webpack://git/./src/api/renameBranch.js","webpack://git/./src/utils/hashObject.js","webpack://git/./src/api/resetIndex.js","webpack://git/./src/api/resolveRef.js","webpack://git/./src/api/setConfig.js","webpack://git/./src/api/status.js","webpack://git/./src/api/statusMatrix.js","webpack://git/./src/api/tag.js","webpack://git/./src/api/updateIndex.js","webpack://git/./src/api/version.js","webpack://git/./src/api/walk.js","webpack://git/./src/api/writeBlob.js","webpack://git/./src/commands/writeCommit.js","webpack://git/./src/api/writeCommit.js","webpack://git/./src/api/writeRef.js","webpack://git/./src/commands/writeTag.js","webpack://git/./src/api/writeTag.js","webpack://git/./src/api/writeTree.js","webpack://git/./src/index.js"],"names":["root","factory","exports","module","define","amd","self","installedModules","__webpack_require__","moduleId","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","assertParameter","undefined","MissingParameterError","memo","Map","normalizePath","path","normalizedPath","split","join","replace","startsWith","slice","endsWith","length","normalizePathInternal","set","parts","map","BaseError","Error","constructor","message","super","this","caller","toJSON","code","data","stack","fromJSON","json","e","isPromiseFs","fs","isPromiseLike","targetFs","readFile","catch","test","commands","bindFs","target","command","pify","rm","_rm","rmdir","rmRecursive","FileSystem","_original_unwrapped_fs","promises","getOwnPropertyDescriptor","exists","filepath","options","_stat","err","console","log","read","buffer","_readFile","Buffer","from","write","contents","_writeFile","mkdir","dirname","_selfCall","_mkdir","parent","_unlink","opts","recursive","_rmdir","readdir","names","_readdir","sort","compareStrings","readdirDeep","dir","subdirs","Promise","all","subdir","res","isDirectory","reduce","a","f","concat","lstat","filename","_lstat","readlink","encoding","link","_readlink","isBuffer","writelink","_symlink","toString","GitPackedRefs","text","refs","parsedConfig","trim","line","comment","indexOf","ref","peeled","oid","delete","filter","entry","compareRefNames","b","_a","_b","tmp","refpaths","GIT_FILES","GitRefManager","gitdir","remote","symrefs","tags","refspecs","prune","pruneTags","values","match","InvalidOidError","config","GitConfigManager","getall","NoRefspecError","unshift","refspec","GitRefSpecSet","actualRefsToWrite","listRefs","deleteRefs","tag","serverRef","keys","refTranslations","translate","translatedRef","symrefTranslations","symtarget","translateOne","pruned","localNamespaces","file","has","push","packed","beforeSize","size","depth","sha","resolve","packedMap","packedRefs","allpaths","includes","NotFoundError","expand","fullref","resolveAgainstMap","files","x","InternalError","_readObject","cache","format","getExternalRefDelta","result","readObjectLoose","readObjectPacked","inflate","shasum","type","GitObject","unwrap","GitPktLine","hexlength","padHex","stream","reader","StreamReader","parseInt","error","what","base64","ieee754","isArray","kMaxLength","TYPED_ARRAY_SUPPORT","createBuffer","that","RangeError","Uint8Array","__proto__","arg","encodingOrOffset","allocUnsafe","TypeError","ArrayBuffer","array","byteOffset","byteLength","fromArrayLike","fromArrayBuffer","string","isEncoding","actual","fromString","obj","len","checked","copy","val","fromObject","assertSize","isView","loweredCase","utf8ToBytes","base64ToBytes","toLowerCase","slowToString","start","end","hexSlice","utf8Slice","asciiSlice","latin1Slice","base64Slice","utf16leSlice","swap","bidirectionalIndexOf","isNaN","arrayIndexOf","lastIndexOf","arr","indexSize","arrLength","valLength","String","buf","readUInt16BE","foundIndex","found","j","hexWrite","offset","Number","remaining","strLen","parsed","substr","utf8Write","blitBuffer","asciiWrite","str","byteArray","charCodeAt","asciiToBytes","latin1Write","base64Write","ucs2Write","units","hi","lo","utf16leToBytes","fromByteArray","Math","min","secondByte","thirdByte","fourthByte","tempCodePoint","firstByte","codePoint","bytesPerSequence","codePoints","fromCharCode","apply","decodeCodePointsArray","SlowBuffer","alloc","INSPECT_MAX_BYTES","global","foo","subarray","typedArraySupport","poolSize","_augment","species","configurable","fill","allocUnsafeSlow","_isBuffer","compare","y","list","pos","swap16","swap32","swap64","arguments","equals","inspect","max","thisStart","thisEnd","thisCopy","targetCopy","isFinite","Array","_arr","ret","out","toHex","bytes","checkOffset","ext","checkInt","objectWriteUInt16","littleEndian","objectWriteUInt32","checkIEEE754","writeFloat","noAssert","writeDouble","newBuf","sliceLen","readUIntLE","mul","readUIntBE","readUInt8","readUInt16LE","readUInt32LE","readUInt32BE","readIntLE","pow","readIntBE","readInt8","readInt16LE","readInt16BE","readInt32LE","readInt32BE","readFloatLE","readFloatBE","readDoubleLE","readDoubleBE","writeUIntLE","writeUIntBE","writeUInt8","floor","writeUInt16LE","writeUInt16BE","writeUInt32LE","writeUInt32BE","writeIntLE","limit","sub","writeIntBE","writeInt8","writeInt16LE","writeInt16BE","writeInt32LE","writeInt32BE","writeFloatLE","writeFloatBE","writeDoubleLE","writeDoubleBE","targetStart","INVALID_BASE64_RE","Infinity","leadSurrogate","toByteArray","stringtrim","base64clean","src","dst","mode2type","nudgeIntoShape","limitModeToAllowed","GitTree","entries","_entries","cursor","space","nullchar","UnsafeFilepathError","parseBuffer","comparePath","tree","render","toObject","compareTreeEntryPath","iterator","GitCommit","commit","_commit","payload","signature","headers","justHeaders","justMessage","normalizeNewlines","indent","parseHeaders","parse","assign","hs","h","author","parseAuthor","committer","formatAuthor","gpgsig","renderHeaders","withoutSignature","isolateSignature","outdent","sign","secretKey","signedCommit","lock","IndexCache","stat","rawIndexFile","index","GitIndex","stats","savedStats","currStats","compareStats","GitIndexManager","allowUnmerged","closure","AsyncLock","maxPending","unmergedPaths","acquire","isIndexStale","updateCachedIndexFile","UnmergedPathsError","_dirty","GitConfig","ObjectTypeError","expected","GitAnnotatedTag","_tag","tagger","signedTag","_writeObject","dryRun","wrap","deflate","writeObjectLoose","hex","byte","supportsSubtleSHA1","testSubtleSHA1","subtleSHA1","shasumSync","Hash","update","digest","crypto","subtle","_","BufferCursor","_start","eof","tell","seek","enc","source","MissingNameError","role","actualLength","parameter","AlreadyExistsError","noun","where","canForce","last","TYPED_OK","Uint16Array","Int32Array","_has","sources","shift","shrinkBuf","fnTyped","arraySet","dest","src_offs","dest_offs","flattenChunks","chunks","chunk","fnUntyped","setTyped","on","Buf8","Buf16","Buf32","SecondsNanoseconds","givenSeconds","givenNanoseconds","milliseconds","date","valueOf","seconds","normalizeStats","ctimeSeconds","ctimeNanoseconds","ctimeMs","ctime","mtimeSeconds","mtimeNanoseconds","mtimeMs","mtime","dev","ino","normalizeMode","uid","gid","GitWalkerRepo","mapPromise","resolveTree","walker","ConstructEntry","fullpath","_fullpath","_type","_mode","_content","_oid","content","JSON","stringify","readObject","_entry","TREE","GitWalkSymbol","freeze","ParseError","forAwait","iterable","cb","iter","getIterator","done","next","return","basename","arrayRange","RunningMinimum","consider","reset","unionOfIterators","sets","minimum","heads","numsets","_walk","trees","children","flatten","flat","iterate","walk","walkers","proxy","range","unionWalkerFromReaddir","iterators","find","walkedChildren","InvalidRefNameError","suggestion","GitShallowManager","oids","Set","add","_currentBranch","fullname","abbreviateRef","replaceAll","search","replacement","RegExp","CleanGitRef","clean","pkg","version","agent","pako","repeat","email","timestamp","timezoneOffset","parseTimezoneOffset","hours","minutes","collect","buffers","nextIndex","modified","base","_readTree","resolveFilepath","treeOid","corsProxify","corsProxy","url","updateHeaders","auth","username","password","Authorization","calculateBasicAuthHeader","stringifyBody","body","response","preview","GitRemoteHTTP","http","onProgress","onAuth","onAuthSuccess","onAuthFailure","service","_origUrl","protocolVersion","extractAuthFromUrl","proxifiedURL","tryAgain","providedAuthBefore","request","method","statusCode","getAuth","cancel","UserCanceledError","HttpError","statusMessage","remoteHTTP","parseRefsAdResponse","SmartHttpError","urlAuth","accept","MergeNotSupportedError","MergeConflictError","filepaths","bothModified","deleteByUs","deleteByTheirs","InvalidFilepathError","reason","GitPackIndex","stuff","offsetCache","idx","hashes","hash","offsets","packfileSha","crcs","pack","listpackTypes","1","2","3","4","6","7","offsetToObject","totalObjectCount","lastPercent","listpack","reference","num","percent","phase","loaded","total","offsetArray","crc","crc32","count","objectsByDepth","readDepth","externalReadDepth","readSlice","toBuffer","fanoutBuffer","crcsBuffer","offsetsBuffer","totalBuffer","shaBuffer","load","unload","raw","btype","lastFour","startWith","otherVarIntDecode","multibyte","lastSeven","decodeVarInt","baseOffset","applyDelta","GitIgnoreManager","excludes","excludesFile","pairs","gitignore","pieces","Boolean","folder","ignoredStatus","ign","ignore","parentdir","ignores","unignored","ignored","GitRemoteManager","remoteHelpers","transport","address","matches","parseRemoteUrl","UrlParseError","UnknownTransportError","translateSSHtoHTTP","is","simpleSign","abs","strHours","strMinutes","formatTimezoneOffset","FIFO","_queue","_ended","_waiting","destroy","RemoteCapabilityError","capability","pathArray","_resolveFilepath","EmptyServerResponseError","GitSideBand","input","streamReader","packetlines","packfile","progress","nextBit","inherits","K","W","Sha1","init","_w","rotl5","rotl30","ft","_c","_d","_e","_update","M","_hash","H","permissions","GitRefSpec","remotePath","localPath","force","matchPrefix","forceMatch","remoteGlobMatch","localGlobMatch","remoteIsGlob","remoteBranch","reverseTranslate","localBranch","PackfileCache","emitter","emitterPrefix","fromIdx","readPackIndex","loadPackIndex","undoCursor","started","_discardedBytes","_init","_loadnext","_moveCursor","_trim","_accumulate","skip","undo","_next","lengthBuffers","nextbuffer","acc","supportsDecompressionStream","testDecompressionStream","browserInflate","ds","DecompressionStream","Blob","pipeThrough","Response","arrayBuffer","supportsCompressionStream","testCompressionStream","browserDeflate","cs","CompressionStream","parseCapabilitiesV2","capabilities2","capabilities","lineOne","lineTwo","firstRef","capabilitiesLine","splitAndAssert","cap","sep","asyncIterator","queue","pop","fromValue","processFn","fn","args","P","promiseModule","reject","multiArgs","errorFirst","exclude","objType","pattern","include","some","excludeMain","getPrototypeOf","abbreviateRx","exec","PushRejectedError","onSign","signingKey","noUpdateBranch","inode","flatFileListToDirectoryStructure","constructTree","comm","writeObject","writeRef","metadata","0","AmbiguousError","nouns","short","CheckoutConflictError","CommitNotFetchedError","FastForwardError","GitPushError","prettyDetails","MaxDepthError","MultipleGitError","errors","IndexResetError","_unmergedPaths","_addEntry","flags","stage","stages","existingEntry","fromBuffer","magic","shaComputed","shaClaimed","numEntries","bits","assumeValid","extended","nameLength","pathlength","padding","flatMap","insert","bfilepath","clear","bpath","ceil","written","writer","renderCacheEntryFlags","header","entriesFlat","entryBuffers","_entryToBuffer","main","sum","inodes","mkfile","bool","schema","core","filemode","bare","logallrefupdates","symlinks","ignorecase","bigFileThreshold","SECTION_LINE_REGEX","SECTION_REGEX","VARIABLE_LINE_REGEX","VARIABLE_NAME_REGEX","VARIABLE_VALUE_COMMENT_REGEX","removeComments","rawValue","commentMatches","valueWithoutComment","hasOddNumberOfQuotes","removeQuotes","newText","isQuote","isEscapeForQuote","lower","getPath","section","subsection","pathSegments","sectionPath","trimmedLine","extractedSection","extractSectionLine","isSection","extractedVariable","valueWithoutComments","extractVariableLine","allValues","getSubsections","deleteSection","append","configIndex","callback","lastIndex","item","splice","modifiedConfig","sectionIndex","findIndex","newConfig","newSection","rules","rule","remoteRefs","remoteRef","localRef","indexFile","packFile","LINEBREAKS","mergeFile","branches","ourName","theirName","baseContent","ourContent","theirContent","ours","theirs","diff3Merge","mergedText","cleanMerge","ok","conflict","_pack","outputStream","buff","stype","types","listObjects","visited","subpath","then","userpass","cachedSetTimeout","cachedClearTimeout","process","defaultSetTimout","defaultClearTimeout","runTimeout","fun","setTimeout","clearTimeout","currentQueue","draining","queueIndex","cleanUpNextTick","drainQueue","timeout","run","marker","runClearTimeout","Item","noop","nextTick","title","browser","env","argv","versions","addListener","once","off","removeListener","removeAllListeners","emit","prependListener","prependOnceListener","listeners","binding","cwd","chdir","umask","_writeTree","_fetch","onMessage","_ref","_remoteRef","_remote","_url","since","relative","singleBranch","getRemoteHelperFor","discover","defaultBranch","fetchHead","fetchHeadDescription","filterCapabilities","wants","haveRefs","haves","hasObject","shallows","packstream","writeUploadPackRequest","packbuffer","connect","parseUploadPackResponse","hasParents","every","unshallows","bail","realRef","updateRemoteRefs","HEAD","FETCH_HEAD","description","lines","splitLines","emptyPackfile","fromPack","copyProps","SafeBuffer","adler","s1","s2","crcTable","table","k","makeTable","utils","STR_APPLY_OK","STR_APPLY_UIA_OK","__","_utf8len","q","buf2binstring","string2buf","c2","m_pos","str_len","buf_len","binstring2buf","buf2string","c_len","utf16buf","utf8border","next_in","avail_in","total_in","output","next_out","avail_out","total_out","msg","state","data_type","Z_NO_FLUSH","Z_PARTIAL_FLUSH","Z_SYNC_FLUSH","Z_FULL_FLUSH","Z_FINISH","Z_BLOCK","Z_TREES","Z_OK","Z_STREAM_END","Z_NEED_DICT","Z_ERRNO","Z_STREAM_ERROR","Z_DATA_ERROR","Z_BUF_ERROR","Z_NO_COMPRESSION","Z_BEST_SPEED","Z_BEST_COMPRESSION","Z_DEFAULT_COMPRESSION","Z_FILTERED","Z_HUFFMAN_ONLY","Z_RLE","Z_FIXED","Z_DEFAULT_STRATEGY","Z_BINARY","Z_TEXT","Z_UNKNOWN","Z_DEFLATED","firstLineCapabilities","encode","flush","demux","acks","nak","status","finally","mergeTree","ourOid","baseOid","theirOid","baseName","abortOnConflict","mergeDriver","ourTree","baseTree","theirTree","unmergedFiles","results","mergeBlobs","mergeResult","TextDecoder","decode","listCommitsAndTags","finish","startingSet","finishingSet","parents","writeReceivePackRequest","triplets","capsFirstLine","trip","oldoid","fullRef","parseReceivePackResponse","refAndMessage","appendSlashIfDir","CRC32","T","signed_crc_table","bstr","seed","C","L","crc32_buf_8","DO_NOT_EXPORT_CRC","onData","PACK","numObjects","ofs","parseHeader","inflator","Inflate","strm","delta","sourceSize","readVarIntLE","targetSize","firstOp","readOp","readCompactLE","isObject","isFunction","makeArray","subject","REGEX_TEST_BLANK_LINE","REGEX_REPLACE_LEADING_EXCAPED_EXCLAMATION","REGEX_REPLACE_LEADING_EXCAPED_HASH","REGEX_SPLITALL_CRLF","REGEX_TEST_INVALID_PATH","KEY_IGNORE","for","REGEX_REGEXP_RANGE","RETURN_FALSE","REPLACERS","p1","leadEscape","endEscape","close","slashes","cleanRangeBackSlash","to","sanitizeRange","regexCache","isString","IgnoreRule","origin","negative","regex","createRule","ignoreCase","prev","current","makeRegex","throwError","Ctor","checkPath","originalPath","doThrow","isNotRelative","convert","Ignore","allowRelativePaths","_rules","_ignoreCase","_allowRelativePaths","_initCache","_ignoreCache","_testCache","_added","checkPattern","splitPattern","forEach","_addPattern","checkUnignored","slices","_t","_testOne","_test","paths","createFilter","isPathValid","default","IGNORE_TEST_WIN32","platform","makePosix","REGIX_IS_WINDOWS_PATH_ABSOLUTE","onp","diffIndices","file1","file2","tail1","tail2","candidate","diff","compose","ses","getses","file1RevIdx","file2RevIdx","SES_COMMON","chain","file1index","file2index","SES_DELETE","SES_ADD","tail","longestCommonSubsequence","mismatchLength1","mismatchLength2","reverse","indices","m1","m2","hunks","addHunk","side","commonOffset","copyCommon","targetOffset","hunkIndex","firstHunkIndex","hunk","regionLhs","regionRhs","maybeOverlapping","maybeLhs","regions","oLhs","oRhs","abLhs","abRhs","aLhs","aRhs","bLhs","bRhs","diff3MergeIndices","okLines","flushOk","pushOk","xs","isTrueConflict","rec","aoff","boff","aIndex","oIndex","bIndex","blob","ofs_delta","ref_delta","server","client","serverNames","findSplit","queues","domains","domainReentrant","DEFAULT_TIMEOUT","DEFAULT_MAX_PENDING","_acquireBatch","deferredResolve","deferredReject","deferred","resolved","timer","locked","domain","called","_promiseTry","taskFn","skipQueue","fnx","getFn","isBusy","g","Function","window","b64","lens","getLens","validLen","placeHoldersLen","Arr","_byteLength","curByte","revLookup","uint8","extraBytes","len2","encodeChunk","lookup","isLE","mLen","nBytes","eLen","eMax","eBias","nBits","NaN","rt","LN2","ctor","superCtor","super_","writable","TempCtor","blockSize","finalSize","_block","_finalSize","_blockSize","_len","block","accum","assigned","remainder","rem","lowBits","highBits","zlib_deflate","strings","ZStream","Deflate","level","chunkSize","windowBits","memLevel","strategy","opt","gzip","ended","deflateInit2","deflateSetHeader","dictionary","dict","deflateSetDictionary","_dict_set","deflator","onEnd","deflateEnd","deflateRaw","configuration_table","adler32","errorCode","rank","zero","flush_pending","pending","pending_buf","pending_out","flush_block_only","_tr_flush_block","block_start","strstart","put_byte","putShortMSB","longest_match","cur_match","chain_length","max_chain_length","scan","best_len","prev_length","nice_match","w_size","_win","wmask","w_mask","strend","scan_end1","scan_end","good_match","lookahead","match_start","fill_window","more","_w_size","window_size","hash_size","head","ins_h","hash_shift","hash_mask","deflate_fast","hash_head","bflush","match_length","_tr_tally","max_lazy_match","MIN_MATCH","last_lit","deflate_slow","max_insert","prev_match","match_available","Config","good_length","max_lazy","nice_length","max_chain","func","DeflateState","pending_buf_size","gzhead","gzindex","last_flush","w_bits","hash_bits","dyn_ltree","HEAP_SIZE","dyn_dtree","bl_tree","l_desc","d_desc","bl_desc","bl_count","MAX_BITS","heap","heap_len","heap_max","l_buf","lit_bufsize","d_buf","opt_len","static_len","bi_buf","bi_valid","deflateResetKeep","_tr_init","deflateReset","max_block_size","max_start","deflateInit","old_flush","beg","hcrc","extra","time","os","bstate","deflate_huff","deflate_rle","_tr_align","_tr_stored_block","avail","tmpDict","dictLength","deflateInfo","extra_lbits","extra_dbits","extra_blbits","bl_order","static_ltree","static_dtree","D_CODES","_dist_code","_length_code","MAX_MATCH","base_length","static_l_desc","static_d_desc","static_bl_desc","base_dist","StaticTreeDesc","static_tree","extra_bits","extra_base","elems","max_length","has_stree","TreeDesc","dyn_tree","stat_desc","max_code","d_code","dist","put_short","w","send_bits","send_code","bi_reverse","gen_codes","next_code","init_block","LITERALS","END_BLOCK","bi_windup","smaller","_n2","_m2","pqdownheap","v","compress_block","ltree","dtree","lc","lx","build_tree","desc","node","stree","xbits","overflow","gen_bitlen","scan_tree","curlen","prevlen","nextlen","max_count","min_count","REP_3_6","REPZ_3_10","REPZ_11_138","send_tree","static_init_done","stored_len","copy_block","LENGTH_CODES","L_CODES","tr_static_init","opt_lenb","static_lenb","max_blindex","black_mask","detect_data_type","BL_CODES","build_bl_tree","lcodes","dcodes","blcodes","send_all_trees","STATIC_TREES","bi_flush","zlib_inflate","GZheader","inflateInit2","inflateGetHeader","inflateSetDictionary","next_out_utf8","utf8str","allowBufError","inflateEnd","inflateRaw","ungzip","inflate_fast","inflate_table","zswap32","InflateState","havedict","dmax","check","wbits","wsize","whave","wnext","hold","lencode","distcode","lenbits","distbits","ncode","nlen","ndist","have","work","lendyn","distdyn","sane","back","was","inflateResetKeep","inflateReset","inflateReset2","lenfix","distfix","virgin","fixedtables","sym","updatewindow","inflateInit","put","left","_in","_out","from_source","here_bits","here_op","here_val","last_bits","last_op","last_val","here","hbuf","order","inf_leave","xflags","extra_len","inflateInfo","s_window","lcode","dcode","lmask","dmask","op","top","dolen","dodist","lbase","lext","dbase","dext","lens_index","codes","table_index","incr","low","mask","curr","drop","used","huff","base_index","MAXBITS","offs","extra_index","a_","b_","tmp1","tmp2","ed","pathposi","lcs","seselem","elem","snake","pp","editdistance","getlcs","fp","epc","px_idx","py_idx","recordseq","hashBlob","_object","hashObject","_fs","hasObjectLoose","hasObjectPacked","_addNote","note","noteOid","pheader","_packObjects","GitWalkerIndex","treePromise","STAGE","GitWalkerFs","isFile","isSymbolicLink","_actualSize","entriesMap","WORKDIR","abortMerge","workdir","staged","unmerged","unmodified","posixifyPathBuffer","parallel","addToIndex","currentFilepath","isIgnored","child","settledPromises","allSettled","rejectedPromises","settle","_getConfig","normalizeAuthorObject","Date","now","getTimezoneOffset","normalizeCommitterObject","addNote","_author","_committer","_addRemote","cleanGitRef","save","addRemote","_annotatedTag","tagObject","annotatedTag","_tagger","_branch","checkout","writeSymbolicRef","branch","worthWalking","_checkout","noCheckout","noUpdateHead","track","ops","analyze","conflicts","chmod","folders","_clone","noTags","maxRetries","clone","currentBranch","_deleteBranch","deleteRef","deleteBranch","_deleteRemote","deleteRemote","_deleteTag","deleteTag","expandOidLoose","prefix","suffix","expandOidPacked","_expandOid","packedOids","packedOid","expandOid","expandRef","_findMergeBase","visits","passes","newheads","_merge","fastForward","fastForwardOnly","baseOids","alreadyMerged","mergeCommit","_pull","thisWillNotBeUsed","fetch","findMergeBase","_findRoot","findRoot","getConfig","_getConfigAll","getConfigAll","getRemoteInfo","forPush","part","symref","formatInfoRefs","peelTags","_key","getRemoteInfo2","_indexPack","indexPack","_isDescendent","ancestor","searchdepth","isDescendent","listBranches","_listFiles","filenames","accumulateFilesFromOid","listFiles","_listNotes","listNotes","_listRemotes","remoteNames","listRemotes","parseListRefsResponse","attrs","attr","writeListRefsRequest","delim","listServerRefs","listTags","resolveCommit","_readCommit","commitOid","compareAge","EMPTY_OID","resolveFileIdInTree","fileId","_resolveFileId","parentPath","walks","_log","follow","sinceTimestamp","commits","shallowCommits","tips","lastFileOid","lastCommit","isOk","endCommit","vFileOid","lastFound","merge","packObjects","pull","_push","_delete","httpRemote","fullRemoteRef","expandAgainstMap","thinPack","objects","skipObjects","mergebase","packstream1","packstream2","resolveBlob","_readBlob","readBlob","readCommit","_readNote","readNote","_format","_readTag","readTag","readTree","remove","_removeNote","removeNote","_renameBranch","oldref","fulloldref","fullnewref","fullCurrentBranchRef","renameBranch","resetIndex","workdirOid","resolveRef","setConfig","headTree","getHeadTree","getOidAtPath","indexEntry","I","getWorkdirOid","statusMatrix","shouldIgnore","headType","workdirType","stageType","isBlob","headOid","stageOid","updateIndex","fileStats","writeBlob","_writeCommit","writeCommit","symbolic","_writeTag","writeTag","writeTree","Errors"],"mappings":"CAAA,SAA2CA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ACrBz3D,GAAI,IAAIe,IAAWf,GACnB6F,SACAoB,QAEF,MAAO1F,GAEP,MADAA,EAAIhC,OAAS,eACPgC,O,sVCpCH,SAAeo2D,GAAtB,mC,4BAAO,WAAyB,GAAE33D,EAAF,IAAMiD,EAAN,OAAW4C,EAAStH,YAAK0E,EAAK,QAA9B,KAAuCgU,IACrE,IAKE,OAJAnZ,YAAgB,KAAMkC,GACtBlC,YAAgB,SAAU+H,GAC1B/H,YAAgB,OAAQmZ,SAEXioB,aAAW,CACtBl/B,GAAI,IAAIe,IAAWf,GACnB6F,SACAoR,SAEF,MAAO1V,GAEP,MADAA,EAAIhC,OAAS,gBACPgC,O,mCCnCV,k1FAgJe,WACbq2D,UACA9M,QACAtqC,SACA4qC,UACAnoC,MACAooC,aACAqB,WACAM,aACAG,gBACAK,UACAF,YACAgB,SACA/2C,UACAi5C,aACAE,gBACA0F,aACA7H,iBACAG,gBACAD,aACAG,gBACAE,aACAQ,aACAC,aACAM,eACAO,SACAC,iBACAE,YACAI,iBACAO,kBACAjH,cACAmH,aACA/iC,QACAmjC,gBACA1F,aACA2F,gBACAI,aACAE,aACAG,eACAM,kBACAC,YACAhxD,OACAuyD,SACAC,eACAC,QACApsD,QACAktD,YACAC,cACAE,YACA70C,cACAg1C,WACAC,YACAC,UACAE,cACAM,gBACAC,cACAkB,eACAhB,cACArwB,UACA6wB,gBACA1vD,OACA2c,WACAxB,QACAi1C,aACAE,eACAhjC,iBACAC,YACAkjC,YACAC","file":"index.umd.min.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"git\"] = factory();\n\telse\n\t\troot[\"git\"] = factory();\n})(self, function() {\nreturn "," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 160);\n","import { MissingParameterError } from '../errors/MissingParameterError.js'\n\nexport function assertParameter(name, value) {\n if (value === undefined) {\n throw new MissingParameterError(name)\n }\n}\n","const memo = new Map()\nexport function normalizePath(path) {\n let normalizedPath = memo.get(path)\n if (!normalizedPath) {\n normalizedPath = normalizePathInternal(path)\n memo.set(path, normalizedPath)\n }\n return normalizedPath\n}\n\nfunction normalizePathInternal(path) {\n path = path\n .split('/./')\n .join('/') // Replace '/./' with '/'\n .replace(/\\/{2,}/g, '/') // Replace consecutive '/'\n\n if (path === '/.') return '/' // if path === '/.' return '/'\n if (path === './') return '.' // if path === './' return '.'\n\n if (path.startsWith('./')) path = path.slice(2) // Remove leading './'\n if (path.endsWith('/.')) path = path.slice(0, -2) // Remove trailing '/.'\n if (path.length > 1 && path.endsWith('/')) path = path.slice(0, -1) // Remove trailing '/'\n\n if (path === '') return '.' // if path === '' return '.'\n\n return path\n}\n","// For some reason path.posix.join is undefined in webpack\n// Also, this is just much smaller\nimport { normalizePath } from './normalizePath.js'\n\nexport function join(...parts) {\n return normalizePath(parts.map(normalizePath).join('/'))\n}\n","export class BaseError extends Error {\n constructor(message) {\n super(message)\n // Setting this here allows TS to infer that all git errors have a `caller` property and\n // that its type is string.\n this.caller = ''\n }\n\n toJSON() {\n // Error objects aren't normally serializable. So we do something about that.\n return {\n code: this.code,\n data: this.data,\n caller: this.caller,\n message: this.message,\n stack: this.stack,\n }\n }\n\n fromJSON(json) {\n const e = new BaseError(json.message)\n e.code = json.code\n e.data = json.data\n e.caller = json.caller\n e.stack = json.stack\n return e\n }\n\n get isIsomorphicGitError() {\n return true\n }\n}\n","import pify from 'pify'\n\nimport { compareStrings } from '../utils/compareStrings.js'\nimport { dirname } from '../utils/dirname.js'\nimport { rmRecursive } from '../utils/rmRecursive.js'\nimport { isPromiseLike } from '../utils/types.js'\n\nfunction isPromiseFs(fs) {\n const test = targetFs => {\n try {\n // If readFile returns a promise then we can probably assume the other\n // commands do as well\n return targetFs.readFile().catch(e => e)\n } catch (e) {\n return e\n }\n }\n return isPromiseLike(test(fs))\n}\n\n// List of commands all filesystems are expected to provide. `rm` is not\n// included since it may not exist and must be handled as a special case\nconst commands = [\n 'readFile',\n 'writeFile',\n 'mkdir',\n 'rmdir',\n 'unlink',\n 'stat',\n 'lstat',\n 'readdir',\n 'readlink',\n 'symlink',\n]\n\nfunction bindFs(target, fs) {\n if (isPromiseFs(fs)) {\n for (const command of commands) {\n target[`_${command}`] = fs[command].bind(fs)\n }\n } else {\n for (const command of commands) {\n target[`_${command}`] = pify(fs[command].bind(fs))\n }\n }\n\n // Handle the special case of `rm`\n if (isPromiseFs(fs)) {\n if (fs.rm) target._rm = fs.rm.bind(fs)\n else if (fs.rmdir.length > 1) target._rm = fs.rmdir.bind(fs)\n else target._rm = rmRecursive.bind(null, target)\n } else {\n if (fs.rm) target._rm = pify(fs.rm.bind(fs))\n else if (fs.rmdir.length > 2) target._rm = pify(fs.rmdir.bind(fs))\n else target._rm = rmRecursive.bind(null, target)\n }\n}\n\n/**\n * This is just a collection of helper functions really. At least that's how it started.\n */\nexport class FileSystem {\n constructor(fs) {\n if (typeof fs._original_unwrapped_fs !== 'undefined') return fs\n\n const promises = Object.getOwnPropertyDescriptor(fs, 'promises')\n if (promises && promises.enumerable) {\n bindFs(this, fs.promises)\n } else {\n bindFs(this, fs)\n }\n this._original_unwrapped_fs = fs\n }\n\n /**\n * Return true if a file exists, false if it doesn't exist.\n * Rethrows errors that aren't related to file existance.\n */\n async exists(filepath, options = {}) {\n try {\n await this._stat(filepath)\n return true\n } catch (err) {\n if (err.code === 'ENOENT' || err.code === 'ENOTDIR') {\n return false\n } else {\n console.log('Unhandled error in \"FileSystem.exists()\" function', err)\n throw err\n }\n }\n }\n\n /**\n * Return the contents of a file if it exists, otherwise returns null.\n *\n * @param {string} filepath\n * @param {object} [options]\n *\n * @returns {Promise<Buffer|string|null>}\n */\n async read(filepath, options = {}) {\n try {\n let buffer = await this._readFile(filepath, options)\n // Convert plain ArrayBuffers to Buffers\n if (typeof buffer !== 'string') {\n buffer = Buffer.from(buffer)\n }\n return buffer\n } catch (err) {\n return null\n }\n }\n\n /**\n * Write a file (creating missing directories if need be) without throwing errors.\n *\n * @param {string} filepath\n * @param {Buffer|Uint8Array|string} contents\n * @param {object|string} [options]\n */\n async write(filepath, contents, options = {}) {\n try {\n await this._writeFile(filepath, contents, options)\n return\n } catch (err) {\n // Hmm. Let's try mkdirp and try again.\n await this.mkdir(dirname(filepath))\n await this._writeFile(filepath, contents, options)\n }\n }\n\n /**\n * Make a directory (or series of nested directories) without throwing an error if it already exists.\n */\n async mkdir(filepath, _selfCall = false) {\n try {\n await this._mkdir(filepath)\n return\n } catch (err) {\n // If err is null then operation succeeded!\n if (err === null) return\n // If the directory already exists, that's OK!\n if (err.code === 'EEXIST') return\n // Avoid infinite loops of failure\n if (_selfCall) throw err\n // If we got a \"no such file or directory error\" backup and try again.\n if (err.code === 'ENOENT') {\n const parent = dirname(filepath)\n // Check to see if we've gone too far\n if (parent === '.' || parent === '/' || parent === filepath) throw err\n // Infinite recursion, what could go wrong?\n await this.mkdir(parent)\n await this.mkdir(filepath, true)\n }\n }\n }\n\n /**\n * Delete a file without throwing an error if it is already deleted.\n */\n async rm(filepath) {\n try {\n await this._unlink(filepath)\n } catch (err) {\n if (err.code !== 'ENOENT') throw err\n }\n }\n\n /**\n * Delete a directory without throwing an error if it is already deleted.\n */\n async rmdir(filepath, opts) {\n try {\n if (opts && opts.recursive) {\n await this._rm(filepath, opts)\n } else {\n await this._rmdir(filepath)\n }\n } catch (err) {\n if (err.code !== 'ENOENT') throw err\n }\n }\n\n /**\n * Read a directory without throwing an error is the directory doesn't exist\n */\n async readdir(filepath) {\n try {\n const names = await this._readdir(filepath)\n // Ordering is not guaranteed, and system specific (Windows vs Unix)\n // so we must sort them ourselves.\n names.sort(compareStrings)\n return names\n } catch (err) {\n if (err.code === 'ENOTDIR') return null\n return []\n }\n }\n\n /**\n * Return a flast list of all the files nested inside a directory\n *\n * Based on an elegant concurrent recursive solution from SO\n * https://stackoverflow.com/a/45130990/2168416\n */\n async readdirDeep(dir) {\n const subdirs = await this._readdir(dir)\n const files = await Promise.all(\n subdirs.map(async subdir => {\n const res = dir + '/' + subdir\n return (await this._stat(res)).isDirectory()\n ? this.readdirDeep(res)\n : res\n })\n )\n return files.reduce((a, f) => a.concat(f), [])\n }\n\n /**\n * Return the Stats of a file/symlink if it exists, otherwise returns null.\n * Rethrows errors that aren't related to file existance.\n */\n async lstat(filename) {\n try {\n const stats = await this._lstat(filename)\n return stats\n } catch (err) {\n if (err.code === 'ENOENT') {\n return null\n }\n throw err\n }\n }\n\n /**\n * Reads the contents of a symlink if it exists, otherwise returns null.\n * Rethrows errors that aren't related to file existance.\n */\n async readlink(filename, opts = { encoding: 'buffer' }) {\n // Note: FileSystem.readlink returns a buffer by default\n // so we can dump it into GitObject.write just like any other file.\n try {\n const link = await this._readlink(filename, opts)\n return Buffer.isBuffer(link) ? link : Buffer.from(link)\n } catch (err) {\n if (err.code === 'ENOENT') {\n return null\n }\n throw err\n }\n }\n\n /**\n * Write the contents of buffer to a symlink.\n */\n async writelink(filename, buffer) {\n return this._symlink(buffer.toString('utf8'), filename)\n }\n}\n","export class GitPackedRefs {\n constructor(text) {\n this.refs = new Map()\n this.parsedConfig = []\n if (text) {\n let key = null\n this.parsedConfig = text\n .trim()\n .split('\\n')\n .map(line => {\n if (/^\\s*#/.test(line)) {\n return { line, comment: true }\n }\n const i = line.indexOf(' ')\n if (line.startsWith('^')) {\n // This is a oid for the commit associated with the annotated tag immediately preceding this line.\n // Trim off the '^'\n const value = line.slice(1)\n // The tagname^{} syntax is based on the output of `git show-ref --tags -d`\n this.refs.set(key + '^{}', value)\n return { line, ref: key, peeled: value }\n } else {\n // This is an oid followed by the ref name\n const value = line.slice(0, i)\n key = line.slice(i + 1)\n this.refs.set(key, value)\n return { line, ref: key, oid: value }\n }\n })\n }\n return this\n }\n\n static from(text) {\n return new GitPackedRefs(text)\n }\n\n delete(ref) {\n this.parsedConfig = this.parsedConfig.filter(entry => entry.ref !== ref)\n this.refs.delete(ref)\n }\n\n toString() {\n return this.parsedConfig.map(({ line }) => line).join('\\n') + '\\n'\n }\n}\n","export function compareRefNames(a, b) {\n // https://stackoverflow.com/a/40355107/2168416\n const _a = a.replace(/\\^\\{\\}$/, '')\n const _b = b.replace(/\\^\\{\\}$/, '')\n const tmp = -(_a < _b) || +(_a > _b)\n if (tmp === 0) {\n return a.endsWith('^{}') ? 1 : -1\n }\n return tmp\n}\n","// This is a convenience wrapper for reading and writing files in the 'refs' directory.\nimport { InvalidOidError } from '../errors/InvalidOidError.js'\nimport { NoRefspecError } from '../errors/NoRefspecError.js'\nimport { NotFoundError } from '../errors/NotFoundError.js'\nimport { GitPackedRefs } from '../models/GitPackedRefs.js'\nimport { GitRefSpecSet } from '../models/GitRefSpecSet.js'\nimport { compareRefNames } from '../utils/compareRefNames.js'\nimport { join } from '../utils/join.js'\n\nimport { GitConfigManager } from './GitConfigManager'\n\n// @see https://git-scm.com/docs/git-rev-parse.html#_specifying_revisions\nconst refpaths = ref => [\n `${ref}`,\n `refs/${ref}`,\n `refs/tags/${ref}`,\n `refs/heads/${ref}`,\n `refs/remotes/${ref}`,\n `refs/remotes/${ref}/HEAD`,\n]\n\n// @see https://git-scm.com/docs/gitrepository-layout\nconst GIT_FILES = ['config', 'description', 'index', 'shallow', 'commondir']\n\nexport class GitRefManager {\n static async updateRemoteRefs({\n fs,\n gitdir,\n remote,\n refs,\n symrefs,\n tags,\n refspecs = undefined,\n prune = false,\n pruneTags = false,\n }) {\n // Validate input\n for (const value of refs.values()) {\n if (!value.match(/[0-9a-f]{40}/)) {\n throw new InvalidOidError(value)\n }\n }\n const config = await GitConfigManager.get({ fs, gitdir })\n if (!refspecs) {\n refspecs = await config.getall(`remote.${remote}.fetch`)\n if (refspecs.length === 0) {\n throw new NoRefspecError(remote)\n }\n // There's some interesting behavior with HEAD that doesn't follow the refspec.\n refspecs.unshift(`+HEAD:refs/remotes/${remote}/HEAD`)\n }\n const refspec = GitRefSpecSet.from(refspecs)\n const actualRefsToWrite = new Map()\n // Delete all current tags if the pruneTags argument is true.\n if (pruneTags) {\n const tags = await GitRefManager.listRefs({\n fs,\n gitdir,\n filepath: 'refs/tags',\n })\n await GitRefManager.deleteRefs({\n fs,\n gitdir,\n refs: tags.map(tag => `refs/tags/${tag}`),\n })\n }\n // Add all tags if the fetch tags argument is true.\n if (tags) {\n for (const serverRef of refs.keys()) {\n if (serverRef.startsWith('refs/tags') && !serverRef.endsWith('^{}')) {\n // Git's behavior is to only fetch tags that do not conflict with tags already present.\n if (!(await GitRefManager.exists({ fs, gitdir, ref: serverRef }))) {\n // Always use the object id of the tag itself, and not the peeled object id.\n const oid = refs.get(serverRef)\n actualRefsToWrite.set(serverRef, oid)\n }\n }\n }\n }\n // Combine refs and symrefs giving symrefs priority\n const refTranslations = refspec.translate([...refs.keys()])\n for (const [serverRef, translatedRef] of refTranslations) {\n const value = refs.get(serverRef)\n actualRefsToWrite.set(translatedRef, value)\n }\n const symrefTranslations = refspec.translate([...symrefs.keys()])\n for (const [serverRef, translatedRef] of symrefTranslations) {\n const value = symrefs.get(serverRef)\n const symtarget = refspec.translateOne(value)\n if (symtarget) {\n actualRefsToWrite.set(translatedRef, `ref: ${symtarget}`)\n }\n }\n // If `prune` argument is true, clear out the existing local refspec roots\n const pruned = []\n if (prune) {\n for (const filepath of refspec.localNamespaces()) {\n const refs = (\n await GitRefManager.listRefs({\n fs,\n gitdir,\n filepath,\n })\n ).map(file => `${filepath}/${file}`)\n for (const ref of refs) {\n if (!actualRefsToWrite.has(ref)) {\n pruned.push(ref)\n }\n }\n }\n if (pruned.length > 0) {\n await GitRefManager.deleteRefs({ fs, gitdir, refs: pruned })\n }\n }\n // Update files\n // TODO: For large repos with a history of thousands of pull requests\n // (i.e. gitlab-ce) it would be vastly more efficient to write them\n // to .git/packed-refs.\n // The trick is to make sure we a) don't write a packed ref that is\n // already shadowed by a loose ref and b) don't loose any refs already\n // in packed-refs. Doing this efficiently may be difficult. A\n // solution that might work is\n // a) load the current packed-refs file\n // b) add actualRefsToWrite, overriding the existing values if present\n // c) enumerate all the loose refs currently in .git/refs/remotes/${remote}\n // d) overwrite their value with the new value.\n // Examples of refs we need to avoid writing in loose format for efficieny's sake\n // are .git/refs/remotes/origin/refs/remotes/remote_mirror_3059\n // and .git/refs/remotes/origin/refs/merge-requests\n for (const [key, value] of actualRefsToWrite) {\n await fs.write(join(gitdir, key), `${value.trim()}\\n`, 'utf8')\n }\n return { pruned }\n }\n\n // TODO: make this less crude?\n static async writeRef({ fs, gitdir, ref, value }) {\n // Validate input\n if (!value.match(/[0-9a-f]{40}/)) {\n throw new InvalidOidError(value)\n }\n await fs.write(join(gitdir, ref), `${value.trim()}\\n`, 'utf8')\n }\n\n static async writeSymbolicRef({ fs, gitdir, ref, value }) {\n await fs.write(join(gitdir, ref), 'ref: ' + `${value.trim()}\\n`, 'utf8')\n }\n\n static async deleteRef({ fs, gitdir, ref }) {\n return GitRefManager.deleteRefs({ fs, gitdir, refs: [ref] })\n }\n\n static async deleteRefs({ fs, gitdir, refs }) {\n // Delete regular ref\n await Promise.all(refs.map(ref => fs.rm(join(gitdir, ref))))\n // Delete any packed ref\n let text = await fs.read(`${gitdir}/packed-refs`, { encoding: 'utf8' })\n const packed = GitPackedRefs.from(text)\n const beforeSize = packed.refs.size\n for (const ref of refs) {\n if (packed.refs.has(ref)) {\n packed.delete(ref)\n }\n }\n if (packed.refs.size < beforeSize) {\n text = packed.toString()\n await fs.write(`${gitdir}/packed-refs`, text, { encoding: 'utf8' })\n }\n }\n\n /**\n * @param {object} args\n * @param {import('../models/FileSystem.js').FileSystem} args.fs\n * @param {string} args.gitdir\n * @param {string} args.ref\n * @param {number} [args.depth]\n * @returns {Promise<string>}\n */\n static async resolve({ fs, gitdir, ref, depth = undefined }) {\n if (depth !== undefined) {\n depth--\n if (depth === -1) {\n return ref\n }\n }\n let sha\n // Is it a ref pointer?\n if (ref.startsWith('ref: ')) {\n ref = ref.slice('ref: '.length)\n return GitRefManager.resolve({ fs, gitdir, ref, depth })\n }\n // Is it a complete and valid SHA?\n if (ref.length === 40 && /[0-9a-f]{40}/.test(ref)) {\n return ref\n }\n // We need to alternate between the file system and the packed-refs\n const packedMap = await GitRefManager.packedRefs({ fs, gitdir })\n // Look in all the proper paths, in this order\n const allpaths = refpaths(ref).filter(p => !GIT_FILES.includes(p)) // exclude git system files (#709)\n\n for (const ref of allpaths) {\n sha =\n (await fs.read(`${gitdir}/${ref}`, { encoding: 'utf8' })) ||\n packedMap.get(ref)\n if (sha) {\n return GitRefManager.resolve({ fs, gitdir, ref: sha.trim(), depth })\n }\n }\n // Do we give up?\n throw new NotFoundError(ref)\n }\n\n static async exists({ fs, gitdir, ref }) {\n try {\n await GitRefManager.expand({ fs, gitdir, ref })\n return true\n } catch (err) {\n return false\n }\n }\n\n static async expand({ fs, gitdir, ref }) {\n // Is it a complete and valid SHA?\n if (ref.length === 40 && /[0-9a-f]{40}/.test(ref)) {\n return ref\n }\n // We need to alternate between the file system and the packed-refs\n const packedMap = await GitRefManager.packedRefs({ fs, gitdir })\n // Look in all the proper paths, in this order\n const allpaths = refpaths(ref)\n for (const ref of allpaths) {\n if (await fs.exists(`${gitdir}/${ref}`)) return ref\n if (packedMap.has(ref)) return ref\n }\n // Do we give up?\n throw new NotFoundError(ref)\n }\n\n static async expandAgainstMap({ ref, map }) {\n // Look in all the proper paths, in this order\n const allpaths = refpaths(ref)\n for (const ref of allpaths) {\n if (await map.has(ref)) return ref\n }\n // Do we give up?\n throw new NotFoundError(ref)\n }\n\n static resolveAgainstMap({ ref, fullref = ref, depth = undefined, map }) {\n if (depth !== undefined) {\n depth--\n if (depth === -1) {\n return { fullref, oid: ref }\n }\n }\n // Is it a ref pointer?\n if (ref.startsWith('ref: ')) {\n ref = ref.slice('ref: '.length)\n return GitRefManager.resolveAgainstMap({ ref, fullref, depth, map })\n }\n // Is it a complete and valid SHA?\n if (ref.length === 40 && /[0-9a-f]{40}/.test(ref)) {\n return { fullref, oid: ref }\n }\n // Look in all the proper paths, in this order\n const allpaths = refpaths(ref)\n for (const ref of allpaths) {\n const sha = map.get(ref)\n if (sha) {\n return GitRefManager.resolveAgainstMap({\n ref: sha.trim(),\n fullref: ref,\n depth,\n map,\n })\n }\n }\n // Do we give up?\n throw new NotFoundError(ref)\n }\n\n static async packedRefs({ fs, gitdir }) {\n const text = await fs.read(`${gitdir}/packed-refs`, { encoding: 'utf8' })\n const packed = GitPackedRefs.from(text)\n return packed.refs\n }\n\n // List all the refs that match the `filepath` prefix\n static async listRefs({ fs, gitdir, filepath }) {\n const packedMap = GitRefManager.packedRefs({ fs, gitdir })\n let files = null\n try {\n files = await fs.readdirDeep(`${gitdir}/${filepath}`)\n files = files.map(x => x.replace(`${gitdir}/${filepath}/`, ''))\n } catch (err) {\n files = []\n }\n\n for (let key of (await packedMap).keys()) {\n // filter by prefix\n if (key.startsWith(filepath)) {\n // remove prefix\n key = key.replace(filepath + '/', '')\n // Don't include duplicates; the loose files have precedence anyway\n if (!files.includes(key)) {\n files.push(key)\n }\n }\n }\n // since we just appended things onto an array, we need to sort them now\n files.sort(compareRefNames)\n return files\n }\n\n static async listBranches({ fs, gitdir, remote }) {\n if (remote) {\n return GitRefManager.listRefs({\n fs,\n gitdir,\n filepath: `refs/remotes/${remote}`,\n })\n } else {\n return GitRefManager.listRefs({ fs, gitdir, filepath: `refs/heads` })\n }\n }\n\n static async listTags({ fs, gitdir }) {\n const tags = await GitRefManager.listRefs({\n fs,\n gitdir,\n filepath: `refs/tags`,\n })\n return tags.filter(x => !x.endsWith('^{}'))\n }\n}\n","import { BaseError } from './BaseError.js'\n\nexport class InternalError extends BaseError {\n /**\n * @param {string} message\n */\n constructor(message) {\n super(\n `An internal error caused this command to fail. Please file a bug report at https://github.com/isomorphic-git/isomorphic-git/issues with this error message: ${message}`\n )\n this.code = this.name = InternalError.code\n this.data = { message }\n }\n}\n/** @type {'InternalError'} */\nInternalError.code = 'InternalError'\n","import { InternalError } from '../errors/InternalError.js'\nimport { NotFoundError } from '../errors/NotFoundError.js'\nimport { GitObject } from '../models/GitObject.js'\nimport { readObjectLoose } from '../storage/readObjectLoose.js'\nimport { readObjectPacked } from '../storage/readObjectPacked.js'\nimport { inflate } from '../utils/inflate.js'\nimport { shasum } from '../utils/shasum.js'\n\n/**\n * @param {object} args\n * @param {import('../models/FileSystem.js').FileSystem} args.fs\n * @param {any} args.cache\n * @param {string} args.gitdir\n * @param {string} args.oid\n * @param {string} [args.format]\n */\nexport async function _readObject({\n fs,\n cache,\n gitdir,\n oid,\n format = 'content',\n}) {\n // Curry the current read method so that the packfile un-deltification\n // process can acquire external ref-deltas.\n const getExternalRefDelta = oid => _readObject({ fs, cache, gitdir, oid })\n\n let result\n // Empty tree - hard-coded so we can use it as a shorthand.\n // Note: I think the canonical git implementation must do this too because\n // `git cat-file -t 4b825dc642cb6eb9a060e54bf8d69288fbee4904` prints \"tree\" even in empty repos.\n if (oid === '4b825dc642cb6eb9a060e54bf8d69288fbee4904') {\n result = { format: 'wrapped', object: Buffer.from(`tree 0\\x00`) }\n }\n // Look for it in the loose object directory.\n if (!result) {\n result = await readObjectLoose({ fs, gitdir, oid })\n }\n // Check to see if it's in a packfile.\n if (!result) {\n result = await readObjectPacked({\n fs,\n cache,\n gitdir,\n oid,\n getExternalRefDelta,\n })\n }\n // Finally\n if (!result) {\n throw new NotFoundError(oid)\n }\n\n if (format === 'deflated') {\n return result\n }\n\n if (result.format === 'deflated') {\n result.object = Buffer.from(await inflate(result.object))\n result.format = 'wrapped'\n }\n\n if (result.format === 'wrapped') {\n if (format === 'wrapped' && result.format === 'wrapped') {\n return result\n }\n const sha = await shasum(result.object)\n if (sha !== oid) {\n throw new InternalError(\n `SHA check failed! Expected ${oid}, computed ${sha}`\n )\n }\n const { object, type } = GitObject.unwrap(result.object)\n result.type = type\n result.object = object\n result.format = 'content'\n }\n\n if (result.format === 'content') {\n if (format === 'content') return result\n return\n }\n\n throw new InternalError(`invalid format \"${result.format}\"`)\n}\n","/**\npkt-line Format\n---------------\n\nMuch (but not all) of the payload is described around pkt-lines.\n\nA pkt-line is a variable length binary string. The first four bytes\nof the line, the pkt-len, indicates the total length of the line,\nin hexadecimal. The pkt-len includes the 4 bytes used to contain\nthe length's hexadecimal representation.\n\nA pkt-line MAY contain binary data, so implementors MUST ensure\npkt-line parsing/formatting routines are 8-bit clean.\n\nA non-binary line SHOULD BE terminated by an LF, which if present\nMUST be included in the total length. Receivers MUST treat pkt-lines\nwith non-binary data the same whether or not they contain the trailing\nLF (stripping the LF if present, and not complaining when it is\nmissing).\n\nThe maximum length of a pkt-line's data component is 65516 bytes.\nImplementations MUST NOT send pkt-line whose length exceeds 65520\n(65516 bytes of payload + 4 bytes of length data).\n\nImplementations SHOULD NOT send an empty pkt-line (\"0004\").\n\nA pkt-line with a length field of 0 (\"0000\"), called a flush-pkt,\nis a special case and MUST be handled differently than an empty\npkt-line (\"0004\").\n\n----\n pkt-line = data-pkt / flush-pkt\n\n data-pkt = pkt-len pkt-payload\n pkt-len = 4*(HEXDIG)\n pkt-payload = (pkt-len - 4)*(OCTET)\n\n flush-pkt = \"0000\"\n----\n\nExamples (as C-style strings):\n\n----\n pkt-line actual value\n ---------------------------------\n \"0006a\\n\" \"a\\n\"\n \"0005a\" \"a\"\n \"000bfoobar\\n\" \"foobar\\n\"\n \"0004\" \"\"\n----\n*/\nimport { StreamReader } from '../utils/StreamReader.js'\nimport { padHex } from '../utils/padHex.js'\n\n// I'm really using this more as a namespace.\n// There's not a lot of \"state\" in a pkt-line\n\nexport class GitPktLine {\n static flush() {\n return Buffer.from('0000', 'utf8')\n }\n\n static delim() {\n return Buffer.from('0001', 'utf8')\n }\n\n static encode(line) {\n if (typeof line === 'string') {\n line = Buffer.from(line)\n }\n const length = line.length + 4\n const hexlength = padHex(4, length)\n return Buffer.concat([Buffer.from(hexlength, 'utf8'), line])\n }\n\n static streamReader(stream) {\n const reader = new StreamReader(stream)\n return async function read() {\n try {\n let length = await reader.read(4)\n if (length == null) return true\n length = parseInt(length.toString('utf8'), 16)\n if (length === 0) return null\n if (length === 1) return null // delim packets\n const buffer = await reader.read(length - 4)\n if (buffer == null) return true\n return buffer\n } catch (err) {\n stream.error = err\n return true\n }\n }\n }\n}\n","import { BaseError } from './BaseError.js'\n\nexport class NotFoundError extends BaseError {\n /**\n * @param {string} what\n */\n constructor(what) {\n super(`Could not find ${what}.`)\n this.code = this.name = NotFoundError.code\n this.data = { what }\n }\n}\n/** @type {'NotFoundError'} */\nNotFoundError.code = 'NotFoundError'\n","/*!\n * The buffer module from node.js, for the browser.\n *\n * @author Feross Aboukhadijeh <http://feross.org>\n * @license MIT\n */\n/* eslint-disable no-proto */\n\n'use strict'\n\nvar base64 = require('base64-js')\nvar ieee754 = require('ieee754')\nvar isArray = require('isarray')\n\nexports.Buffer = Buffer\nexports.SlowBuffer = SlowBuffer\nexports.INSPECT_MAX_BYTES = 50\n\n/**\n * If `Buffer.TYPED_ARRAY_SUPPORT`:\n * === true Use Uint8Array implementation (fastest)\n * === false Use Object implementation (most compatible, even IE6)\n *\n * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,\n * Opera 11.6+, iOS 4.2+.\n *\n * Due to various browser bugs, sometimes the Object implementation will be used even\n * when the browser supports typed arrays.\n *\n * Note:\n *\n * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,\n * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.\n *\n * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.\n *\n * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of\n * incorrect length in some situations.\n\n * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they\n * get the Object implementation, which is slower but behaves correctly.\n */\nBuffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined\n ? global.TYPED_ARRAY_SUPPORT\n : typedArraySupport()\n\n/*\n * Export kMaxLength after typed array support is determined.\n */\nexports.kMaxLength = kMaxLength()\n\nfunction typedArraySupport () {\n try {\n var arr = new Uint8Array(1)\n arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }}\n return arr.foo() === 42 && // typed array instances can be augmented\n typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`\n arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`\n } catch (e) {\n return false\n }\n}\n\nfunction kMaxLength () {\n return Buffer.TYPED_ARRAY_SUPPORT\n ? 0x7fffffff\n : 0x3fffffff\n}\n\nfunction createBuffer (that, length) {\n if (kMaxLength() < length) {\n throw new RangeError('Invalid typed array length')\n }\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n // Return an augmented `Uint8Array` instance, for best performance\n that = new Uint8Array(length)\n that.__proto__ = Buffer.prototype\n } else {\n // Fallback: Return an object instance of the Buffer class\n if (that === null) {\n that = new Buffer(length)\n }\n that.length = length\n }\n\n return that\n}\n\n/**\n * The Buffer constructor returns instances of `Uint8Array` that have their\n * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of\n * `Uint8Array`, so the returned instances will have all the node `Buffer` methods\n * and the `Uint8Array` methods. Square bracket notation works as expected -- it\n * returns a single octet.\n *\n * The `Uint8Array` prototype remains unmodified.\n */\n\nfunction Buffer (arg, encodingOrOffset, length) {\n if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {\n return new Buffer(arg, encodingOrOffset, length)\n }\n\n // Common case.\n if (typeof arg === 'number') {\n if (typeof encodingOrOffset === 'string') {\n throw new Error(\n 'If encoding is specified then the first argument must be a string'\n )\n }\n return allocUnsafe(this, arg)\n }\n return from(this, arg, encodingOrOffset, length)\n}\n\nBuffer.poolSize = 8192 // not used by this implementation\n\n// TODO: Legacy, not needed anymore. Remove in next major version.\nBuffer._augment = function (arr) {\n arr.__proto__ = Buffer.prototype\n return arr\n}\n\nfunction from (that, value, encodingOrOffset, length) {\n if (typeof value === 'number') {\n throw new TypeError('\"value\" argument must not be a number')\n }\n\n if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {\n return fromArrayBuffer(that, value, encodingOrOffset, length)\n }\n\n if (typeof value === 'string') {\n return fromString(that, value, encodingOrOffset)\n }\n\n return fromObject(that, value)\n}\n\n/**\n * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError\n * if value is a number.\n * Buffer.from(str[, encoding])\n * Buffer.from(array)\n * Buffer.from(buffer)\n * Buffer.from(arrayBuffer[, byteOffset[, length]])\n **/\nBuffer.from = function (value, encodingOrOffset, length) {\n return from(null, value, encodingOrOffset, length)\n}\n\nif (Buffer.TYPED_ARRAY_SUPPORT) {\n Buffer.prototype.__proto__ = Uint8Array.prototype\n Buffer.__proto__ = Uint8Array\n if (typeof Symbol !== 'undefined' && Symbol.species &&\n Buffer[Symbol.species] === Buffer) {\n // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97\n Object.defineProperty(Buffer, Symbol.species, {\n value: null,\n configurable: true\n })\n }\n}\n\nfunction assertSize (size) {\n if (typeof size !== 'number') {\n throw new TypeError('\"size\" argument must be a number')\n } else if (size < 0) {\n throw new RangeError('\"size\" argument must not be negative')\n }\n}\n\nfunction alloc (that, size, fill, encoding) {\n assertSize(size)\n if (size <= 0) {\n return createBuffer(that, size)\n }\n if (fill !== undefined) {\n // Only pay attention to encoding if it's a string. This\n // prevents accidentally sending in a number that would\n // be interpretted as a start offset.\n return typeof encoding === 'string'\n ? createBuffer(that, size).fill(fill, encoding)\n : createBuffer(that, size).fill(fill)\n }\n return createBuffer(that, size)\n}\n\n/**\n * Creates a new filled Buffer instance.\n * alloc(size[, fill[, encoding]])\n **/\nBuffer.alloc = function (size, fill, encoding) {\n return alloc(null, size, fill, encoding)\n}\n\nfunction allocUnsafe (that, size) {\n assertSize(size)\n that = createBuffer(that, size < 0 ? 0 : checked(size) | 0)\n if (!Buffer.TYPED_ARRAY_SUPPORT) {\n for (var i = 0; i < size; ++i) {\n that[i] = 0\n }\n }\n return that\n}\n\n/**\n * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.\n * */\nBuffer.allocUnsafe = function (size) {\n return allocUnsafe(null, size)\n}\n/**\n * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.\n */\nBuffer.allocUnsafeSlow = function (size) {\n return allocUnsafe(null, size)\n}\n\nfunction fromString (that, string, encoding) {\n if (typeof encoding !== 'string' || encoding === '') {\n encoding = 'utf8'\n }\n\n if (!Buffer.isEncoding(encoding)) {\n throw new TypeError('\"encoding\" must be a valid string encoding')\n }\n\n var length = byteLength(string, encoding) | 0\n that = createBuffer(that, length)\n\n var actual = that.write(string, encoding)\n\n if (actual !== length) {\n // Writing a hex string, for example, that contains invalid characters will\n // cause everything after the first invalid character to be ignored. (e.g.\n // 'abxxcd' will be treated as 'ab')\n that = that.slice(0, actual)\n }\n\n return that\n}\n\nfunction fromArrayLike (that, array) {\n var length = array.length < 0 ? 0 : checked(array.length) | 0\n that = createBuffer(that, length)\n for (var i = 0; i < length; i += 1) {\n that[i] = array[i] & 255\n }\n return that\n}\n\nfunction fromArrayBuffer (that, array, byteOffset, length) {\n array.byteLength // this throws if `array` is not a valid ArrayBuffer\n\n if (byteOffset < 0 || array.byteLength < byteOffset) {\n throw new RangeError('\\'offset\\' is out of bounds')\n }\n\n if (array.byteLength < byteOffset + (length || 0)) {\n throw new RangeError('\\'length\\' is out of bounds')\n }\n\n if (byteOffset === undefined && length === undefined) {\n array = new Uint8Array(array)\n } else if (length === undefined) {\n array = new Uint8Array(array, byteOffset)\n } else {\n array = new Uint8Array(array, byteOffset, length)\n }\n\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n // Return an augmented `Uint8Array` instance, for best performance\n that = array\n that.__proto__ = Buffer.prototype\n } else {\n // Fallback: Return an object instance of the Buffer class\n that = fromArrayLike(that, array)\n }\n return that\n}\n\nfunction fromObject (that, obj) {\n if (Buffer.isBuffer(obj)) {\n var len = checked(obj.length) | 0\n that = createBuffer(that, len)\n\n if (that.length === 0) {\n return that\n }\n\n obj.copy(that, 0, 0, len)\n return that\n }\n\n if (obj) {\n if ((typeof ArrayBuffer !== 'undefined' &&\n obj.buffer instanceof ArrayBuffer) || 'length' in obj) {\n if (typeof obj.length !== 'number' || isnan(obj.length)) {\n return createBuffer(that, 0)\n }\n return fromArrayLike(that, obj)\n }\n\n if (obj.type === 'Buffer' && isArray(obj.data)) {\n return fromArrayLike(that, obj.data)\n }\n }\n\n throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')\n}\n\nfunction checked (length) {\n // Note: cannot use `length < kMaxLength()` here because that fails when\n // length is NaN (which is otherwise coerced to zero.)\n if (length >= kMaxLength()) {\n throw new RangeError('Attempt to allocate Buffer larger than maximum ' +\n 'size: 0x' + kMaxLength().toString(16) + ' bytes')\n }\n return length | 0\n}\n\nfunction SlowBuffer (length) {\n if (+length != length) { // eslint-disable-line eqeqeq\n length = 0\n }\n return Buffer.alloc(+length)\n}\n\nBuffer.isBuffer = function isBuffer (b) {\n return !!(b != null && b._isBuffer)\n}\n\nBuffer.compare = function compare (a, b) {\n if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {\n throw new TypeError('Arguments must be Buffers')\n }\n\n if (a === b) return 0\n\n var x = a.length\n var y = b.length\n\n for (var i = 0, len = Math.min(x, y); i < len; ++i) {\n if (a[i] !== b[i]) {\n x = a[i]\n y = b[i]\n break\n }\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n}\n\nBuffer.isEncoding = function isEncoding (encoding) {\n switch (String(encoding).toLowerCase()) {\n case 'hex':\n case 'utf8':\n case 'utf-8':\n case 'ascii':\n case 'latin1':\n case 'binary':\n case 'base64':\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return true\n default:\n return false\n }\n}\n\nBuffer.concat = function concat (list, length) {\n if (!isArray(list)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers')\n }\n\n if (list.length === 0) {\n return Buffer.alloc(0)\n }\n\n var i\n if (length === undefined) {\n length = 0\n for (i = 0; i < list.length; ++i) {\n length += list[i].length\n }\n }\n\n var buffer = Buffer.allocUnsafe(length)\n var pos = 0\n for (i = 0; i < list.length; ++i) {\n var buf = list[i]\n if (!Buffer.isBuffer(buf)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers')\n }\n buf.copy(buffer, pos)\n pos += buf.length\n }\n return buffer\n}\n\nfunction byteLength (string, encoding) {\n if (Buffer.isBuffer(string)) {\n return string.length\n }\n if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' &&\n (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {\n return string.byteLength\n }\n if (typeof string !== 'string') {\n string = '' + string\n }\n\n var len = string.length\n if (len === 0) return 0\n\n // Use a for loop to avoid recursion\n var loweredCase = false\n for (;;) {\n switch (encoding) {\n case 'ascii':\n case 'latin1':\n case 'binary':\n return len\n case 'utf8':\n case 'utf-8':\n case undefined:\n return utf8ToBytes(string).length\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return len * 2\n case 'hex':\n return len >>> 1\n case 'base64':\n return base64ToBytes(string).length\n default:\n if (loweredCase) return utf8ToBytes(string).length // assume utf8\n encoding = ('' + encoding).toLowerCase()\n loweredCase = true\n }\n }\n}\nBuffer.byteLength = byteLength\n\nfunction slowToString (encoding, start, end) {\n var loweredCase = false\n\n // No need to verify that \"this.length <= MAX_UINT32\" since it's a read-only\n // property of a typed array.\n\n // This behaves neither like String nor Uint8Array in that we set start/end\n // to their upper/lower bounds if the value passed is out of range.\n // undefined is handled specially as per ECMA-262 6th Edition,\n // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.\n if (start === undefined || start < 0) {\n start = 0\n }\n // Return early if start > this.length. Done here to prevent potential uint32\n // coercion fail below.\n if (start > this.length) {\n return ''\n }\n\n if (end === undefined || end > this.length) {\n end = this.length\n }\n\n if (end <= 0) {\n return ''\n }\n\n // Force coersion to uint32. This will also coerce falsey/NaN values to 0.\n end >>>= 0\n start >>>= 0\n\n if (end <= start) {\n return ''\n }\n\n if (!encoding) encoding = 'utf8'\n\n while (true) {\n switch (encoding) {\n case 'hex':\n return hexSlice(this, start, end)\n\n case 'utf8':\n case 'utf-8':\n return utf8Slice(this, start, end)\n\n case 'ascii':\n return asciiSlice(this, start, end)\n\n case 'latin1':\n case 'binary':\n return latin1Slice(this, start, end)\n\n case 'base64':\n return base64Slice(this, start, end)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return utf16leSlice(this, start, end)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = (encoding + '').toLowerCase()\n loweredCase = true\n }\n }\n}\n\n// The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect\n// Buffer instances.\nBuffer.prototype._isBuffer = true\n\nfunction swap (b, n, m) {\n var i = b[n]\n b[n] = b[m]\n b[m] = i\n}\n\nBuffer.prototype.swap16 = function swap16 () {\n var len = this.length\n if (len % 2 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 16-bits')\n }\n for (var i = 0; i < len; i += 2) {\n swap(this, i, i + 1)\n }\n return this\n}\n\nBuffer.prototype.swap32 = function swap32 () {\n var len = this.length\n if (len % 4 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 32-bits')\n }\n for (var i = 0; i < len; i += 4) {\n swap(this, i, i + 3)\n swap(this, i + 1, i + 2)\n }\n return this\n}\n\nBuffer.prototype.swap64 = function swap64 () {\n var len = this.length\n if (len % 8 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 64-bits')\n }\n for (var i = 0; i < len; i += 8) {\n swap(this, i, i + 7)\n swap(this, i + 1, i + 6)\n swap(this, i + 2, i + 5)\n swap(this, i + 3, i + 4)\n }\n return this\n}\n\nBuffer.prototype.toString = function toString () {\n var length = this.length | 0\n if (length === 0) return ''\n if (arguments.length === 0) return utf8Slice(this, 0, length)\n return slowToString.apply(this, arguments)\n}\n\nBuffer.prototype.equals = function equals (b) {\n if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')\n if (this === b) return true\n return Buffer.compare(this, b) === 0\n}\n\nBuffer.prototype.inspect = function inspect () {\n var str = ''\n var max = exports.INSPECT_MAX_BYTES\n if (this.length > 0) {\n str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')\n if (this.length > max) str += ' ... '\n }\n return '<Buffer ' + str + '>'\n}\n\nBuffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {\n if (!Buffer.isBuffer(target)) {\n throw new TypeError('Argument must be a Buffer')\n }\n\n if (start === undefined) {\n start = 0\n }\n if (end === undefined) {\n end = target ? target.length : 0\n }\n if (thisStart === undefined) {\n thisStart = 0\n }\n if (thisEnd === undefined) {\n thisEnd = this.length\n }\n\n if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {\n throw new RangeError('out of range index')\n }\n\n if (thisStart >= thisEnd && start >= end) {\n return 0\n }\n if (thisStart >= thisEnd) {\n return -1\n }\n if (start >= end) {\n return 1\n }\n\n start >>>= 0\n end >>>= 0\n thisStart >>>= 0\n thisEnd >>>= 0\n\n if (this === target) return 0\n\n var x = thisEnd - thisStart\n var y = end - start\n var len = Math.min(x, y)\n\n var thisCopy = this.slice(thisStart, thisEnd)\n var targetCopy = target.slice(start, end)\n\n for (var i = 0; i < len; ++i) {\n if (thisCopy[i] !== targetCopy[i]) {\n x = thisCopy[i]\n y = targetCopy[i]\n break\n }\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n}\n\n// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,\n// OR the last index of `val` in `buffer` at offset <= `byteOffset`.\n//\n// Arguments:\n// - buffer - a Buffer to search\n// - val - a string, Buffer, or number\n// - byteOffset - an index into `buffer`; will be clamped to an int32\n// - encoding - an optional encoding, relevant is val is a string\n// - dir - true for indexOf, false for lastIndexOf\nfunction bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {\n // Empty buffer means no match\n if (buffer.length === 0) return -1\n\n // Normalize byteOffset\n if (typeof byteOffset === 'string') {\n encoding = byteOffset\n byteOffset = 0\n } else if (byteOffset > 0x7fffffff) {\n byteOffset = 0x7fffffff\n } else if (byteOffset < -0x80000000) {\n byteOffset = -0x80000000\n }\n byteOffset = +byteOffset // Coerce to Number.\n if (isNaN(byteOffset)) {\n // byteOffset: it it's undefined, null, NaN, \"foo\", etc, search whole buffer\n byteOffset = dir ? 0 : (buffer.length - 1)\n }\n\n // Normalize byteOffset: negative offsets start from the end of the buffer\n if (byteOffset < 0) byteOffset = buffer.length + byteOffset\n if (byteOffset >= buffer.length) {\n if (dir) return -1\n else byteOffset = buffer.length - 1\n } else if (byteOffset < 0) {\n if (dir) byteOffset = 0\n else return -1\n }\n\n // Normalize val\n if (typeof val === 'string') {\n val = Buffer.from(val, encoding)\n }\n\n // Finally, search either indexOf (if dir is true) or lastIndexOf\n if (Buffer.isBuffer(val)) {\n // Special case: looking for empty string/buffer always fails\n if (val.length === 0) {\n return -1\n }\n return arrayIndexOf(buffer, val, byteOffset, encoding, dir)\n } else if (typeof val === 'number') {\n val = val & 0xFF // Search for a byte value [0-255]\n if (Buffer.TYPED_ARRAY_SUPPORT &&\n typeof Uint8Array.prototype.indexOf === 'function') {\n if (dir) {\n return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)\n } else {\n return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)\n }\n }\n return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)\n }\n\n throw new TypeError('val must be string, number or Buffer')\n}\n\nfunction arrayIndexOf (arr, val, byteOffset, encoding, dir) {\n var indexSize = 1\n var arrLength = arr.length\n var valLength = val.length\n\n if (encoding !== undefined) {\n encoding = String(encoding).toLowerCase()\n if (encoding === 'ucs2' || encoding === 'ucs-2' ||\n encoding === 'utf16le' || encoding === 'utf-16le') {\n if (arr.length < 2 || val.length < 2) {\n return -1\n }\n indexSize = 2\n arrLength /= 2\n valLength /= 2\n byteOffset /= 2\n }\n }\n\n function read (buf, i) {\n if (indexSize === 1) {\n return buf[i]\n } else {\n return buf.readUInt16BE(i * indexSize)\n }\n }\n\n var i\n if (dir) {\n var foundIndex = -1\n for (i = byteOffset; i < arrLength; i++) {\n if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {\n if (foundIndex === -1) foundIndex = i\n if (i - foundIndex + 1 === valLength) return foundIndex * indexSize\n } else {\n if (foundIndex !== -1) i -= i - foundIndex\n foundIndex = -1\n }\n }\n } else {\n if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength\n for (i = byteOffset; i >= 0; i--) {\n var found = true\n for (var j = 0; j < valLength; j++) {\n if (read(arr, i + j) !== read(val, j)) {\n found = false\n break\n }\n }\n if (found) return i\n }\n }\n\n return -1\n}\n\nBuffer.prototype.includes = function includes (val, byteOffset, encoding) {\n return this.indexOf(val, byteOffset, encoding) !== -1\n}\n\nBuffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, true)\n}\n\nBuffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, false)\n}\n\nfunction hexWrite (buf, string, offset, length) {\n offset = Number(offset) || 0\n var remaining = buf.length - offset\n if (!length) {\n length = remaining\n } else {\n length = Number(length)\n if (length > remaining) {\n length = remaining\n }\n }\n\n // must be an even number of digits\n var strLen = string.length\n if (strLen % 2 !== 0) throw new TypeError('Invalid hex string')\n\n if (length > strLen / 2) {\n length = strLen / 2\n }\n for (var i = 0; i < length; ++i) {\n var parsed = parseInt(string.substr(i * 2, 2), 16)\n if (isNaN(parsed)) return i\n buf[offset + i] = parsed\n }\n return i\n}\n\nfunction utf8Write (buf, string, offset, length) {\n return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nfunction asciiWrite (buf, string, offset, length) {\n return blitBuffer(asciiToBytes(string), buf, offset, length)\n}\n\nfunction latin1Write (buf, string, offset, length) {\n return asciiWrite(buf, string, offset, length)\n}\n\nfunction base64Write (buf, string, offset, length) {\n return blitBuffer(base64ToBytes(string), buf, offset, length)\n}\n\nfunction ucs2Write (buf, string, offset, length) {\n return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nBuffer.prototype.write = function write (string, offset, length, encoding) {\n // Buffer#write(string)\n if (offset === undefined) {\n encoding = 'utf8'\n length = this.length\n offset = 0\n // Buffer#write(string, encoding)\n } else if (length === undefined && typeof offset === 'string') {\n encoding = offset\n length = this.length\n offset = 0\n // Buffer#write(string, offset[, length][, encoding])\n } else if (isFinite(offset)) {\n offset = offset | 0\n if (isFinite(length)) {\n length = length | 0\n if (encoding === undefined) encoding = 'utf8'\n } else {\n encoding = length\n length = undefined\n }\n // legacy write(string, encoding, offset, length) - remove in v0.13\n } else {\n throw new Error(\n 'Buffer.write(string, encoding, offset[, length]) is no longer supported'\n )\n }\n\n var remaining = this.length - offset\n if (length === undefined || length > remaining) length = remaining\n\n if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {\n throw new RangeError('Attempt to write outside buffer bounds')\n }\n\n if (!encoding) encoding = 'utf8'\n\n var loweredCase = false\n for (;;) {\n switch (encoding) {\n case 'hex':\n return hexWrite(this, string, offset, length)\n\n case 'utf8':\n case 'utf-8':\n return utf8Write(this, string, offset, length)\n\n case 'ascii':\n return asciiWrite(this, string, offset, length)\n\n case 'latin1':\n case 'binary':\n return latin1Write(this, string, offset, length)\n\n case 'base64':\n // Warning: maxLength not taken into account in base64Write\n return base64Write(this, string, offset, length)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return ucs2Write(this, string, offset, length)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = ('' + encoding).toLowerCase()\n loweredCase = true\n }\n }\n}\n\nBuffer.prototype.toJSON = function toJSON () {\n return {\n type: 'Buffer',\n data: Array.prototype.slice.call(this._arr || this, 0)\n }\n}\n\nfunction base64Slice (buf, start, end) {\n if (start === 0 && end === buf.length) {\n return base64.fromByteArray(buf)\n } else {\n return base64.fromByteArray(buf.slice(start, end))\n }\n}\n\nfunction utf8Slice (buf, start, end) {\n end = Math.min(buf.length, end)\n var res = []\n\n var i = start\n while (i < end) {\n var firstByte = buf[i]\n var codePoint = null\n var bytesPerSequence = (firstByte > 0xEF) ? 4\n : (firstByte > 0xDF) ? 3\n : (firstByte > 0xBF) ? 2\n : 1\n\n if (i + bytesPerSequence <= end) {\n var secondByte, thirdByte, fourthByte, tempCodePoint\n\n switch (bytesPerSequence) {\n case 1:\n if (firstByte < 0x80) {\n codePoint = firstByte\n }\n break\n case 2:\n secondByte = buf[i + 1]\n if ((secondByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)\n if (tempCodePoint > 0x7F) {\n codePoint = tempCodePoint\n }\n }\n break\n case 3:\n secondByte = buf[i + 1]\n thirdByte = buf[i + 2]\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)\n if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {\n codePoint = tempCodePoint\n }\n }\n break\n case 4:\n secondByte = buf[i + 1]\n thirdByte = buf[i + 2]\n fourthByte = buf[i + 3]\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)\n if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {\n codePoint = tempCodePoint\n }\n }\n }\n }\n\n if (codePoint === null) {\n // we did not generate a valid codePoint so insert a\n // replacement char (U+FFFD) and advance only 1 byte\n codePoint = 0xFFFD\n bytesPerSequence = 1\n } else if (codePoint > 0xFFFF) {\n // encode to utf16 (surrogate pair dance)\n codePoint -= 0x10000\n res.push(codePoint >>> 10 & 0x3FF | 0xD800)\n codePoint = 0xDC00 | codePoint & 0x3FF\n }\n\n res.push(codePoint)\n i += bytesPerSequence\n }\n\n return decodeCodePointsArray(res)\n}\n\n// Based on http://stackoverflow.com/a/22747272/680742, the browser with\n// the lowest limit is Chrome, with 0x10000 args.\n// We go 1 magnitude less, for safety\nvar MAX_ARGUMENTS_LENGTH = 0x1000\n\nfunction decodeCodePointsArray (codePoints) {\n var len = codePoints.length\n if (len <= MAX_ARGUMENTS_LENGTH) {\n return String.fromCharCode.apply(String, codePoints) // avoid extra slice()\n }\n\n // Decode in chunks to avoid \"call stack size exceeded\".\n var res = ''\n var i = 0\n while (i < len) {\n res += String.fromCharCode.apply(\n String,\n codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)\n )\n }\n return res\n}\n\nfunction asciiSlice (buf, start, end) {\n var ret = ''\n end = Math.min(buf.length, end)\n\n for (var i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i] & 0x7F)\n }\n return ret\n}\n\nfunction latin1Slice (buf, start, end) {\n var ret = ''\n end = Math.min(buf.length, end)\n\n for (var i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i])\n }\n return ret\n}\n\nfunction hexSlice (buf, start, end) {\n var len = buf.length\n\n if (!start || start < 0) start = 0\n if (!end || end < 0 || end > len) end = len\n\n var out = ''\n for (var i = start; i < end; ++i) {\n out += toHex(buf[i])\n }\n return out\n}\n\nfunction utf16leSlice (buf, start, end) {\n var bytes = buf.slice(start, end)\n var res = ''\n for (var i = 0; i < bytes.length; i += 2) {\n res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)\n }\n return res\n}\n\nBuffer.prototype.slice = function slice (start, end) {\n var len = this.length\n start = ~~start\n end = end === undefined ? len : ~~end\n\n if (start < 0) {\n start += len\n if (start < 0) start = 0\n } else if (start > len) {\n start = len\n }\n\n if (end < 0) {\n end += len\n if (end < 0) end = 0\n } else if (end > len) {\n end = len\n }\n\n if (end < start) end = start\n\n var newBuf\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n newBuf = this.subarray(start, end)\n newBuf.__proto__ = Buffer.prototype\n } else {\n var sliceLen = end - start\n newBuf = new Buffer(sliceLen, undefined)\n for (var i = 0; i < sliceLen; ++i) {\n newBuf[i] = this[i + start]\n }\n }\n\n return newBuf\n}\n\n/*\n * Need to make sure that buffer isn't trying to write out of bounds.\n */\nfunction checkOffset (offset, ext, length) {\n if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n}\n\nBuffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var val = this[offset]\n var mul = 1\n var i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) {\n checkOffset(offset, byteLength, this.length)\n }\n\n var val = this[offset + --byteLength]\n var mul = 1\n while (byteLength > 0 && (mul *= 0x100)) {\n val += this[offset + --byteLength] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 1, this.length)\n return this[offset]\n}\n\nBuffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n return this[offset] | (this[offset + 1] << 8)\n}\n\nBuffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n return (this[offset] << 8) | this[offset + 1]\n}\n\nBuffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return ((this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16)) +\n (this[offset + 3] * 0x1000000)\n}\n\nBuffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] * 0x1000000) +\n ((this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n this[offset + 3])\n}\n\nBuffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var val = this[offset]\n var mul = 1\n var i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var i = byteLength\n var mul = 1\n var val = this[offset + --i]\n while (i > 0 && (mul *= 0x100)) {\n val += this[offset + --i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readInt8 = function readInt8 (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 1, this.length)\n if (!(this[offset] & 0x80)) return (this[offset])\n return ((0xff - this[offset] + 1) * -1)\n}\n\nBuffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n var val = this[offset] | (this[offset + 1] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n var val = this[offset + 1] | (this[offset] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16) |\n (this[offset + 3] << 24)\n}\n\nBuffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] << 24) |\n (this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n (this[offset + 3])\n}\n\nBuffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, true, 23, 4)\n}\n\nBuffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, false, 23, 4)\n}\n\nBuffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, true, 52, 8)\n}\n\nBuffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, false, 52, 8)\n}\n\nfunction checkInt (buf, value, offset, ext, max, min) {\n if (!Buffer.isBuffer(buf)) throw new TypeError('\"buffer\" argument must be a Buffer instance')\n if (value > max || value < min) throw new RangeError('\"value\" argument is out of bounds')\n if (offset + ext > buf.length) throw new RangeError('Index out of range')\n}\n\nBuffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) {\n var maxBytes = Math.pow(2, 8 * byteLength) - 1\n checkInt(this, value, offset, byteLength, maxBytes, 0)\n }\n\n var mul = 1\n var i = 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) {\n var maxBytes = Math.pow(2, 8 * byteLength) - 1\n checkInt(this, value, offset, byteLength, maxBytes, 0)\n }\n\n var i = byteLength - 1\n var mul = 1\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)\n if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)\n this[offset] = (value & 0xff)\n return offset + 1\n}\n\nfunction objectWriteUInt16 (buf, value, offset, littleEndian) {\n if (value < 0) value = 0xffff + value + 1\n for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {\n buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>\n (littleEndian ? i : 1 - i) * 8\n }\n}\n\nBuffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n } else {\n objectWriteUInt16(this, value, offset, true)\n }\n return offset + 2\n}\n\nBuffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 8)\n this[offset + 1] = (value & 0xff)\n } else {\n objectWriteUInt16(this, value, offset, false)\n }\n return offset + 2\n}\n\nfunction objectWriteUInt32 (buf, value, offset, littleEndian) {\n if (value < 0) value = 0xffffffff + value + 1\n for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {\n buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff\n }\n}\n\nBuffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset + 3] = (value >>> 24)\n this[offset + 2] = (value >>> 16)\n this[offset + 1] = (value >>> 8)\n this[offset] = (value & 0xff)\n } else {\n objectWriteUInt32(this, value, offset, true)\n }\n return offset + 4\n}\n\nBuffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = (value & 0xff)\n } else {\n objectWriteUInt32(this, value, offset, false)\n }\n return offset + 4\n}\n\nBuffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) {\n var limit = Math.pow(2, 8 * byteLength - 1)\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit)\n }\n\n var i = 0\n var mul = 1\n var sub = 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {\n sub = 1\n }\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) {\n var limit = Math.pow(2, 8 * byteLength - 1)\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit)\n }\n\n var i = byteLength - 1\n var mul = 1\n var sub = 0\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {\n sub = 1\n }\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)\n if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)\n if (value < 0) value = 0xff + value + 1\n this[offset] = (value & 0xff)\n return offset + 1\n}\n\nBuffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n } else {\n objectWriteUInt16(this, value, offset, true)\n }\n return offset + 2\n}\n\nBuffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 8)\n this[offset + 1] = (value & 0xff)\n } else {\n objectWriteUInt16(this, value, offset, false)\n }\n return offset + 2\n}\n\nBuffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n this[offset + 2] = (value >>> 16)\n this[offset + 3] = (value >>> 24)\n } else {\n objectWriteUInt32(this, value, offset, true)\n }\n return offset + 4\n}\n\nBuffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n if (value < 0) value = 0xffffffff + value + 1\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = (value & 0xff)\n } else {\n objectWriteUInt32(this, value, offset, false)\n }\n return offset + 4\n}\n\nfunction checkIEEE754 (buf, value, offset, ext, max, min) {\n if (offset + ext > buf.length) throw new RangeError('Index out of range')\n if (offset < 0) throw new RangeError('Index out of range')\n}\n\nfunction writeFloat (buf, value, offset, littleEndian, noAssert) {\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)\n }\n ieee754.write(buf, value, offset, littleEndian, 23, 4)\n return offset + 4\n}\n\nBuffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {\n return writeFloat(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {\n return writeFloat(this, value, offset, false, noAssert)\n}\n\nfunction writeDouble (buf, value, offset, littleEndian, noAssert) {\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)\n }\n ieee754.write(buf, value, offset, littleEndian, 52, 8)\n return offset + 8\n}\n\nBuffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {\n return writeDouble(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {\n return writeDouble(this, value, offset, false, noAssert)\n}\n\n// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)\nBuffer.prototype.copy = function copy (target, targetStart, start, end) {\n if (!start) start = 0\n if (!end && end !== 0) end = this.length\n if (targetStart >= target.length) targetStart = target.length\n if (!targetStart) targetStart = 0\n if (end > 0 && end < start) end = start\n\n // Copy 0 bytes; we're done\n if (end === start) return 0\n if (target.length === 0 || this.length === 0) return 0\n\n // Fatal error conditions\n if (targetStart < 0) {\n throw new RangeError('targetStart out of bounds')\n }\n if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')\n if (end < 0) throw new RangeError('sourceEnd out of bounds')\n\n // Are we oob?\n if (end > this.length) end = this.length\n if (target.length - targetStart < end - start) {\n end = target.length - targetStart + start\n }\n\n var len = end - start\n var i\n\n if (this === target && start < targetStart && targetStart < end) {\n // descending copy from end\n for (i = len - 1; i >= 0; --i) {\n target[i + targetStart] = this[i + start]\n }\n } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {\n // ascending copy from start\n for (i = 0; i < len; ++i) {\n target[i + targetStart] = this[i + start]\n }\n } else {\n Uint8Array.prototype.set.call(\n target,\n this.subarray(start, start + len),\n targetStart\n )\n }\n\n return len\n}\n\n// Usage:\n// buffer.fill(number[, offset[, end]])\n// buffer.fill(buffer[, offset[, end]])\n// buffer.fill(string[, offset[, end]][, encoding])\nBuffer.prototype.fill = function fill (val, start, end, encoding) {\n // Handle string cases:\n if (typeof val === 'string') {\n if (typeof start === 'string') {\n encoding = start\n start = 0\n end = this.length\n } else if (typeof end === 'string') {\n encoding = end\n end = this.length\n }\n if (val.length === 1) {\n var code = val.charCodeAt(0)\n if (code < 256) {\n val = code\n }\n }\n if (encoding !== undefined && typeof encoding !== 'string') {\n throw new TypeError('encoding must be a string')\n }\n if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {\n throw new TypeError('Unknown encoding: ' + encoding)\n }\n } else if (typeof val === 'number') {\n val = val & 255\n }\n\n // Invalid ranges are not set to a default, so can range check early.\n if (start < 0 || this.length < start || this.length < end) {\n throw new RangeError('Out of range index')\n }\n\n if (end <= start) {\n return this\n }\n\n start = start >>> 0\n end = end === undefined ? this.length : end >>> 0\n\n if (!val) val = 0\n\n var i\n if (typeof val === 'number') {\n for (i = start; i < end; ++i) {\n this[i] = val\n }\n } else {\n var bytes = Buffer.isBuffer(val)\n ? val\n : utf8ToBytes(new Buffer(val, encoding).toString())\n var len = bytes.length\n for (i = 0; i < end - start; ++i) {\n this[i + start] = bytes[i % len]\n }\n }\n\n return this\n}\n\n// HELPER FUNCTIONS\n// ================\n\nvar INVALID_BASE64_RE = /[^+\\/0-9A-Za-z-_]/g\n\nfunction base64clean (str) {\n // Node strips out invalid characters like \\n and \\t from the string, base64-js does not\n str = stringtrim(str).replace(INVALID_BASE64_RE, '')\n // Node converts strings with length < 2 to ''\n if (str.length < 2) return ''\n // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not\n while (str.length % 4 !== 0) {\n str = str + '='\n }\n return str\n}\n\nfunction stringtrim (str) {\n if (str.trim) return str.trim()\n return str.replace(/^\\s+|\\s+$/g, '')\n}\n\nfunction toHex (n) {\n if (n < 16) return '0' + n.toString(16)\n return n.toString(16)\n}\n\nfunction utf8ToBytes (string, units) {\n units = units || Infinity\n var codePoint\n var length = string.length\n var leadSurrogate = null\n var bytes = []\n\n for (var i = 0; i < length; ++i) {\n codePoint = string.charCodeAt(i)\n\n // is surrogate component\n if (codePoint > 0xD7FF && codePoint < 0xE000) {\n // last char was a lead\n if (!leadSurrogate) {\n // no lead yet\n if (codePoint > 0xDBFF) {\n // unexpected trail\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n } else if (i + 1 === length) {\n // unpaired lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n }\n\n // valid lead\n leadSurrogate = codePoint\n\n continue\n }\n\n // 2 leads in a row\n if (codePoint < 0xDC00) {\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n leadSurrogate = codePoint\n continue\n }\n\n // valid surrogate pair\n codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000\n } else if (leadSurrogate) {\n // valid bmp char, but last char was a lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n }\n\n leadSurrogate = null\n\n // encode utf8\n if (codePoint < 0x80) {\n if ((units -= 1) < 0) break\n bytes.push(codePoint)\n } else if (codePoint < 0x800) {\n if ((units -= 2) < 0) break\n bytes.push(\n codePoint >> 0x6 | 0xC0,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x10000) {\n if ((units -= 3) < 0) break\n bytes.push(\n codePoint >> 0xC | 0xE0,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x110000) {\n if ((units -= 4) < 0) break\n bytes.push(\n codePoint >> 0x12 | 0xF0,\n codePoint >> 0xC & 0x3F | 0x80,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else {\n throw new Error('Invalid code point')\n }\n }\n\n return bytes\n}\n\nfunction asciiToBytes (str) {\n var byteArray = []\n for (var i = 0; i < str.length; ++i) {\n // Node's code seems to be doing this and not & 0x7F..\n byteArray.push(str.charCodeAt(i) & 0xFF)\n }\n return byteArray\n}\n\nfunction utf16leToBytes (str, units) {\n var c, hi, lo\n var byteArray = []\n for (var i = 0; i < str.length; ++i) {\n if ((units -= 2) < 0) break\n\n c = str.charCodeAt(i)\n hi = c >> 8\n lo = c % 256\n byteArray.push(lo)\n byteArray.push(hi)\n }\n\n return byteArray\n}\n\nfunction base64ToBytes (str) {\n return base64.toByteArray(base64clean(str))\n}\n\nfunction blitBuffer (src, dst, offset, length) {\n for (var i = 0; i < length; ++i) {\n if ((i + offset >= dst.length) || (i >= src.length)) break\n dst[i + offset] = src[i]\n }\n return i\n}\n\nfunction isnan (val) {\n return val !== val // eslint-disable-line no-self-compare\n}\n","import { InternalError } from '../errors/InternalError.js'\nimport { UnsafeFilepathError } from '../errors/UnsafeFilepathError.js'\nimport { comparePath } from '../utils/comparePath.js'\nimport { compareTreeEntryPath } from '../utils/compareTreeEntryPath.js'\n\n/**\n *\n * @typedef {Object} TreeEntry\n * @property {string} mode - the 6 digit hexadecimal mode\n * @property {string} path - the name of the file or directory\n * @property {string} oid - the SHA-1 object id of the blob or tree\n * @property {'commit'|'blob'|'tree'} type - the type of object\n */\n\nfunction mode2type(mode) {\n // prettier-ignore\n switch (mode) {\n case '040000': return 'tree'\n case '100644': return 'blob'\n case '100755': return 'blob'\n case '120000': return 'blob'\n case '160000': return 'commit'\n }\n throw new InternalError(`Unexpected GitTree entry mode: ${mode}`)\n}\n\nfunction parseBuffer(buffer) {\n const _entries = []\n let cursor = 0\n while (cursor < buffer.length) {\n const space = buffer.indexOf(32, cursor)\n if (space === -1) {\n throw new InternalError(\n `GitTree: Error parsing buffer at byte location ${cursor}: Could not find the next space character.`\n )\n }\n const nullchar = buffer.indexOf(0, cursor)\n if (nullchar === -1) {\n throw new InternalError(\n `GitTree: Error parsing buffer at byte location ${cursor}: Could not find the next null character.`\n )\n }\n let mode = buffer.slice(cursor, space).toString('utf8')\n if (mode === '40000') mode = '040000' // makes it line up neater in printed output\n const type = mode2type(mode)\n const path = buffer.slice(space + 1, nullchar).toString('utf8')\n\n // Prevent malicious git repos from writing to \"..\\foo\" on clone etc\n if (path.includes('\\\\') || path.includes('/')) {\n throw new UnsafeFilepathError(path)\n }\n\n const oid = buffer.slice(nullchar + 1, nullchar + 21).toString('hex')\n cursor = nullchar + 21\n _entries.push({ mode, path, oid, type })\n }\n return _entries\n}\n\nfunction limitModeToAllowed(mode) {\n if (typeof mode === 'number') {\n mode = mode.toString(8)\n }\n // tree\n if (mode.match(/^0?4.*/)) return '040000' // Directory\n if (mode.match(/^1006.*/)) return '100644' // Regular non-executable file\n if (mode.match(/^1007.*/)) return '100755' // Regular executable file\n if (mode.match(/^120.*/)) return '120000' // Symbolic link\n if (mode.match(/^160.*/)) return '160000' // Commit (git submodule reference)\n throw new InternalError(`Could not understand file mode: ${mode}`)\n}\n\nfunction nudgeIntoShape(entry) {\n if (!entry.oid && entry.sha) {\n entry.oid = entry.sha // Github\n }\n entry.mode = limitModeToAllowed(entry.mode) // index\n if (!entry.type) {\n entry.type = mode2type(entry.mode) // index\n }\n return entry\n}\n\nexport class GitTree {\n constructor(entries) {\n if (Buffer.isBuffer(entries)) {\n this._entries = parseBuffer(entries)\n } else if (Array.isArray(entries)) {\n this._entries = entries.map(nudgeIntoShape)\n } else {\n throw new InternalError('invalid type passed to GitTree constructor')\n }\n // Tree entries are not sorted alphabetically in the usual sense (see `compareTreeEntryPath`)\n // but it is important later on that these be sorted in the same order as they would be returned from readdir.\n this._entries.sort(comparePath)\n }\n\n static from(tree) {\n return new GitTree(tree)\n }\n\n render() {\n return this._entries\n .map(entry => `${entry.mode} ${entry.type} ${entry.oid} ${entry.path}`)\n .join('\\n')\n }\n\n toObject() {\n // Adjust the sort order to match git's\n const entries = [...this._entries]\n entries.sort(compareTreeEntryPath)\n return Buffer.concat(\n entries.map(entry => {\n const mode = Buffer.from(entry.mode.replace(/^0/, ''))\n const space = Buffer.from(' ')\n const path = Buffer.from(entry.path, 'utf8')\n const nullchar = Buffer.from([0])\n const oid = Buffer.from(entry.oid, 'hex')\n return Buffer.concat([mode, space, path, nullchar, oid])\n })\n )\n }\n\n /**\n * @returns {TreeEntry[]}\n */\n entries() {\n return this._entries\n }\n\n *[Symbol.iterator]() {\n for (const entry of this._entries) {\n yield entry\n }\n }\n}\n","import { InternalError } from '../errors/InternalError.js'\nimport { formatAuthor } from '../utils/formatAuthor.js'\nimport { indent } from '../utils/indent.js'\nimport { normalizeNewlines } from '../utils/normalizeNewlines.js'\nimport { outdent } from '../utils/outdent.js'\nimport { parseAuthor } from '../utils/parseAuthor.js'\n\nexport class GitCommit {\n constructor(commit) {\n if (typeof commit === 'string') {\n this._commit = commit\n } else if (Buffer.isBuffer(commit)) {\n this._commit = commit.toString('utf8')\n } else if (typeof commit === 'object') {\n this._commit = GitCommit.render(commit)\n } else {\n throw new InternalError('invalid type passed to GitCommit constructor')\n }\n }\n\n static fromPayloadSignature({ payload, signature }) {\n const headers = GitCommit.justHeaders(payload)\n const message = GitCommit.justMessage(payload)\n const commit = normalizeNewlines(\n headers + '\\ngpgsig' + indent(signature) + '\\n' + message\n )\n return new GitCommit(commit)\n }\n\n static from(commit) {\n return new GitCommit(commit)\n }\n\n toObject() {\n return Buffer.from(this._commit, 'utf8')\n }\n\n // Todo: allow setting the headers and message\n headers() {\n return this.parseHeaders()\n }\n\n // Todo: allow setting the headers and message\n message() {\n return GitCommit.justMessage(this._commit)\n }\n\n parse() {\n return Object.assign({ message: this.message() }, this.headers())\n }\n\n static justMessage(commit) {\n return normalizeNewlines(commit.slice(commit.indexOf('\\n\\n') + 2))\n }\n\n static justHeaders(commit) {\n return commit.slice(0, commit.indexOf('\\n\\n'))\n }\n\n parseHeaders() {\n const headers = GitCommit.justHeaders(this._commit).split('\\n')\n const hs = []\n for (const h of headers) {\n if (h[0] === ' ') {\n // combine with previous header (without space indent)\n hs[hs.length - 1] += '\\n' + h.slice(1)\n } else {\n hs.push(h)\n }\n }\n const obj = {\n parent: [],\n }\n for (const h of hs) {\n const key = h.slice(0, h.indexOf(' '))\n const value = h.slice(h.indexOf(' ') + 1)\n if (Array.isArray(obj[key])) {\n obj[key].push(value)\n } else {\n obj[key] = value\n }\n }\n if (obj.author) {\n obj.author = parseAuthor(obj.author)\n }\n if (obj.committer) {\n obj.committer = parseAuthor(obj.committer)\n }\n return obj\n }\n\n static renderHeaders(obj) {\n let headers = ''\n if (obj.tree) {\n headers += `tree ${obj.tree}\\n`\n } else {\n headers += `tree 4b825dc642cb6eb9a060e54bf8d69288fbee4904\\n` // the null tree\n }\n if (obj.parent) {\n if (obj.parent.length === undefined) {\n throw new InternalError(`commit 'parent' property should be an array`)\n }\n for (const p of obj.parent) {\n headers += `parent ${p}\\n`\n }\n }\n const author = obj.author\n headers += `author ${formatAuthor(author)}\\n`\n const committer = obj.committer || obj.author\n headers += `committer ${formatAuthor(committer)}\\n`\n if (obj.gpgsig) {\n headers += 'gpgsig' + indent(obj.gpgsig)\n }\n return headers\n }\n\n static render(obj) {\n return GitCommit.renderHeaders(obj) + '\\n' + normalizeNewlines(obj.message)\n }\n\n render() {\n return this._commit\n }\n\n withoutSignature() {\n const commit = normalizeNewlines(this._commit)\n if (commit.indexOf('\\ngpgsig') === -1) return commit\n const headers = commit.slice(0, commit.indexOf('\\ngpgsig'))\n const message = commit.slice(\n commit.indexOf('-----END PGP SIGNATURE-----\\n') +\n '-----END PGP SIGNATURE-----\\n'.length\n )\n return normalizeNewlines(headers + '\\n' + message)\n }\n\n isolateSignature() {\n const signature = this._commit.slice(\n this._commit.indexOf('-----BEGIN PGP SIGNATURE-----'),\n this._commit.indexOf('-----END PGP SIGNATURE-----') +\n '-----END PGP SIGNATURE-----'.length\n )\n return outdent(signature)\n }\n\n static async sign(commit, sign, secretKey) {\n const payload = commit.withoutSignature()\n const message = GitCommit.justMessage(commit._commit)\n let { signature } = await sign({ payload, secretKey })\n // renormalize the line endings to the one true line-ending\n signature = normalizeNewlines(signature)\n const headers = GitCommit.justHeaders(commit._commit)\n const signedCommit =\n headers + '\\n' + 'gpgsig' + indent(signature) + '\\n' + message\n // return a new commit object\n return GitCommit.from(signedCommit)\n }\n}\n","// import LockManager from 'travix-lock-manager'\nimport AsyncLock from 'async-lock'\n\nimport { UnmergedPathsError } from '../errors/UnmergedPathsError.js'\nimport { GitIndex } from '../models/GitIndex.js'\nimport { compareStats } from '../utils/compareStats.js'\n\n// import Lock from '../utils.js'\n\n// const lm = new LockManager()\nlet lock = null\n\nconst IndexCache = Symbol('IndexCache')\n\nfunction createCache() {\n return {\n map: new Map(),\n stats: new Map(),\n }\n}\n\nasync function updateCachedIndexFile(fs, filepath, cache) {\n const stat = await fs.lstat(filepath)\n const rawIndexFile = await fs.read(filepath)\n const index = await GitIndex.from(rawIndexFile)\n // cache the GitIndex object so we don't need to re-read it every time.\n cache.map.set(filepath, index)\n // Save the stat data for the index so we know whether the cached file is stale (modified by an outside process).\n cache.stats.set(filepath, stat)\n}\n\n// Determine whether our copy of the index file is stale\nasync function isIndexStale(fs, filepath, cache) {\n const savedStats = cache.stats.get(filepath)\n if (savedStats === undefined) return true\n const currStats = await fs.lstat(filepath)\n if (savedStats === null) return false\n if (currStats === null) return false\n return compareStats(savedStats, currStats)\n}\n\nexport class GitIndexManager {\n /**\n *\n * @param {object} opts\n * @param {import('../models/FileSystem.js').FileSystem} opts.fs\n * @param {string} opts.gitdir\n * @param {object} opts.cache\n * @param {bool} opts.allowUnmerged\n * @param {function(GitIndex): any} closure\n */\n static async acquire({ fs, gitdir, cache, allowUnmerged = true }, closure) {\n if (!cache[IndexCache]) cache[IndexCache] = createCache()\n\n const filepath = `${gitdir}/index`\n if (lock === null) lock = new AsyncLock({ maxPending: Infinity })\n let result\n let unmergedPaths = []\n await lock.acquire(filepath, async () => {\n // Acquire a file lock while we're reading the index\n // to make sure other processes aren't writing to it\n // simultaneously, which could result in a corrupted index.\n // const fileLock = await Lock(filepath)\n if (await isIndexStale(fs, filepath, cache[IndexCache])) {\n await updateCachedIndexFile(fs, filepath, cache[IndexCache])\n }\n const index = cache[IndexCache].map.get(filepath)\n unmergedPaths = index.unmergedPaths\n\n if (unmergedPaths.length && !allowUnmerged)\n throw new UnmergedPathsError(unmergedPaths)\n\n result = await closure(index)\n if (index._dirty) {\n // Acquire a file lock while we're writing the index file\n // let fileLock = await Lock(filepath)\n const buffer = await index.toObject()\n await fs.write(filepath, buffer)\n // Update cached stat value\n cache[IndexCache].stats.set(filepath, await fs.lstat(filepath))\n index._dirty = false\n }\n })\n\n return result\n }\n}\n","import { GitConfig } from '../models/GitConfig.js'\n\nexport class GitConfigManager {\n static async get({ fs, gitdir }) {\n // We can improve efficiency later if needed.\n // TODO: read from full list of git config files\n const text = await fs.read(`${gitdir}/config`, { encoding: 'utf8' })\n return GitConfig.from(text)\n }\n\n static async save({ fs, gitdir, config }) {\n // We can improve efficiency later if needed.\n // TODO: handle saving to the correct global/user/repo location\n await fs.write(`${gitdir}/config`, config.toString(), {\n encoding: 'utf8',\n })\n }\n}\n","import { BaseError } from './BaseError.js'\n\nexport class ObjectTypeError extends BaseError {\n /**\n * @param {string} oid\n * @param {'blob'|'commit'|'tag'|'tree'} actual\n * @param {'blob'|'commit'|'tag'|'tree'} expected\n * @param {string} [filepath]\n */\n constructor(oid, actual, expected, filepath) {\n super(\n `Object ${oid} ${\n filepath ? `at ${filepath}` : ''\n }was anticipated to be a ${expected} but it is a ${actual}.`\n )\n this.code = this.name = ObjectTypeError.code\n this.data = { oid, actual, expected, filepath }\n }\n}\n/** @type {'ObjectTypeError'} */\nObjectTypeError.code = 'ObjectTypeError'\n","import { InternalError } from '../errors/InternalError.js'\nimport { formatAuthor } from '../utils/formatAuthor.js'\nimport { normalizeNewlines } from '../utils/normalizeNewlines.js'\nimport { parseAuthor } from '../utils/parseAuthor.js'\n\nexport class GitAnnotatedTag {\n constructor(tag) {\n if (typeof tag === 'string') {\n this._tag = tag\n } else if (Buffer.isBuffer(tag)) {\n this._tag = tag.toString('utf8')\n } else if (typeof tag === 'object') {\n this._tag = GitAnnotatedTag.render(tag)\n } else {\n throw new InternalError(\n 'invalid type passed to GitAnnotatedTag constructor'\n )\n }\n }\n\n static from(tag) {\n return new GitAnnotatedTag(tag)\n }\n\n static render(obj) {\n return `object ${obj.object}\ntype ${obj.type}\ntag ${obj.tag}\ntagger ${formatAuthor(obj.tagger)}\n\n${obj.message}\n${obj.gpgsig ? obj.gpgsig : ''}`\n }\n\n justHeaders() {\n return this._tag.slice(0, this._tag.indexOf('\\n\\n'))\n }\n\n message() {\n const tag = this.withoutSignature()\n return tag.slice(tag.indexOf('\\n\\n') + 2)\n }\n\n parse() {\n return Object.assign(this.headers(), {\n message: this.message(),\n gpgsig: this.gpgsig(),\n })\n }\n\n render() {\n return this._tag\n }\n\n headers() {\n const headers = this.justHeaders().split('\\n')\n const hs = []\n for (const h of headers) {\n if (h[0] === ' ') {\n // combine with previous header (without space indent)\n hs[hs.length - 1] += '\\n' + h.slice(1)\n } else {\n hs.push(h)\n }\n }\n const obj = {}\n for (const h of hs) {\n const key = h.slice(0, h.indexOf(' '))\n const value = h.slice(h.indexOf(' ') + 1)\n if (Array.isArray(obj[key])) {\n obj[key].push(value)\n } else {\n obj[key] = value\n }\n }\n if (obj.tagger) {\n obj.tagger = parseAuthor(obj.tagger)\n }\n if (obj.committer) {\n obj.committer = parseAuthor(obj.committer)\n }\n return obj\n }\n\n withoutSignature() {\n const tag = normalizeNewlines(this._tag)\n if (tag.indexOf('\\n-----BEGIN PGP SIGNATURE-----') === -1) return tag\n return tag.slice(0, tag.lastIndexOf('\\n-----BEGIN PGP SIGNATURE-----'))\n }\n\n gpgsig() {\n if (this._tag.indexOf('\\n-----BEGIN PGP SIGNATURE-----') === -1) return\n const signature = this._tag.slice(\n this._tag.indexOf('-----BEGIN PGP SIGNATURE-----'),\n this._tag.indexOf('-----END PGP SIGNATURE-----') +\n '-----END PGP SIGNATURE-----'.length\n )\n return normalizeNewlines(signature)\n }\n\n payload() {\n return this.withoutSignature() + '\\n'\n }\n\n toObject() {\n return Buffer.from(this._tag, 'utf8')\n }\n\n static async sign(tag, sign, secretKey) {\n const payload = tag.payload()\n let { signature } = await sign({ payload, secretKey })\n // renormalize the line endings to the one true line-ending\n signature = normalizeNewlines(signature)\n const signedTag = payload + signature\n // return a new tag object\n return GitAnnotatedTag.from(signedTag)\n }\n}\n","import { GitObject } from '../models/GitObject.js'\nimport { writeObjectLoose } from '../storage/writeObjectLoose.js'\nimport { deflate } from '../utils/deflate.js'\nimport { shasum } from '../utils/shasum.js'\n\nexport async function _writeObject({\n fs,\n gitdir,\n type,\n object,\n format = 'content',\n oid = undefined,\n dryRun = false,\n}) {\n if (format !== 'deflated') {\n if (format !== 'wrapped') {\n object = GitObject.wrap({ type, object })\n }\n oid = await shasum(object)\n object = Buffer.from(await deflate(object))\n }\n if (!dryRun) {\n await writeObjectLoose({ fs, gitdir, object, format: 'deflated', oid })\n }\n return oid\n}\n","export function toHex(buffer) {\n let hex = ''\n for (const byte of new Uint8Array(buffer)) {\n if (byte < 16) hex += '0'\n hex += byte.toString(16)\n }\n return hex\n}\n","/* eslint-env node, browser */\nimport Hash from 'sha.js/sha1.js'\n\nimport { toHex } from './toHex.js'\n\nlet supportsSubtleSHA1 = null\n\nexport async function shasum(buffer) {\n if (supportsSubtleSHA1 === null) {\n supportsSubtleSHA1 = await testSubtleSHA1()\n }\n return supportsSubtleSHA1 ? subtleSHA1(buffer) : shasumSync(buffer)\n}\n\n// This is modeled after @dominictarr's \"shasum\" module,\n// but without the 'json-stable-stringify' dependency and\n// extra type-casting features.\nfunction shasumSync(buffer) {\n return new Hash().update(buffer).digest('hex')\n}\n\nasync function subtleSHA1(buffer) {\n const hash = await crypto.subtle.digest('SHA-1', buffer)\n return toHex(hash)\n}\n\nasync function testSubtleSHA1() {\n // I'm using a rather crude method of progressive enhancement, because\n // some browsers that have crypto.subtle.digest don't actually implement SHA-1.\n try {\n const hash = await subtleSHA1(new Uint8Array([]))\n if (hash === 'da39a3ee5e6b4b0d3255bfef95601890afd80709') return true\n } catch (_) {\n // no bother\n }\n return false\n}\n","// Modeled after https://github.com/tjfontaine/node-buffercursor\n// but with the goal of being much lighter weight.\nexport class BufferCursor {\n constructor(buffer) {\n this.buffer = buffer\n this._start = 0\n }\n\n eof() {\n return this._start >= this.buffer.length\n }\n\n tell() {\n return this._start\n }\n\n seek(n) {\n this._start = n\n }\n\n slice(n) {\n const r = this.buffer.slice(this._start, this._start + n)\n this._start += n\n return r\n }\n\n toString(enc, length) {\n const r = this.buffer.toString(enc, this._start, this._start + length)\n this._start += length\n return r\n }\n\n write(value, length, enc) {\n const r = this.buffer.write(value, this._start, length, enc)\n this._start += length\n return r\n }\n\n copy(source, start, end) {\n const r = source.copy(this.buffer, this._start, start, end)\n this._start += r\n return r\n }\n\n readUInt8() {\n const r = this.buffer.readUInt8(this._start)\n this._start += 1\n return r\n }\n\n writeUInt8(value) {\n const r = this.buffer.writeUInt8(value, this._start)\n this._start += 1\n return r\n }\n\n readUInt16BE() {\n const r = this.buffer.readUInt16BE(this._start)\n this._start += 2\n return r\n }\n\n writeUInt16BE(value) {\n const r = this.buffer.writeUInt16BE(value, this._start)\n this._start += 2\n return r\n }\n\n readUInt32BE() {\n const r = this.buffer.readUInt32BE(this._start)\n this._start += 4\n return r\n }\n\n writeUInt32BE(value) {\n const r = this.buffer.writeUInt32BE(value, this._start)\n this._start += 4\n return r\n }\n}\n","export function normalizeNewlines(str) {\n // remove all <CR>\n str = str.replace(/\\r/g, '')\n // no extra newlines up front\n str = str.replace(/^\\n+/, '')\n // and a single newline at the end\n str = str.replace(/\\n+$/, '') + '\\n'\n return str\n}\n","import { BaseError } from './BaseError.js'\n\nexport class MissingNameError extends BaseError {\n /**\n * @param {'author'|'committer'|'tagger'} role\n */\n constructor(role) {\n super(\n `No name was provided for ${role} in the argument or in the .git/config file.`\n )\n this.code = this.name = MissingNameError.code\n this.data = { role }\n }\n}\n/** @type {'MissingNameError'} */\nMissingNameError.code = 'MissingNameError'\n","import { InternalError } from '../errors/InternalError.js'\n\nexport class GitObject {\n static wrap({ type, object }) {\n return Buffer.concat([\n Buffer.from(`${type} ${object.byteLength.toString()}\\x00`),\n Buffer.from(object),\n ])\n }\n\n static unwrap(buffer) {\n const s = buffer.indexOf(32) // first space\n const i = buffer.indexOf(0) // first null value\n const type = buffer.slice(0, s).toString('utf8') // get type of object\n const length = buffer.slice(s + 1, i).toString('utf8') // get type of object\n const actualLength = buffer.length - (i + 1)\n // verify length\n if (parseInt(length) !== actualLength) {\n throw new InternalError(\n `Length mismatch: expected ${length} bytes but got ${actualLength} instead.`\n )\n }\n return {\n type,\n object: Buffer.from(buffer.slice(i + 1)),\n }\n }\n}\n","import { BaseError } from './BaseError.js'\n\nexport class MissingParameterError extends BaseError {\n /**\n * @param {string} parameter\n */\n constructor(parameter) {\n super(\n `The function requires a \"${parameter}\" parameter but none was provided.`\n )\n this.code = this.name = MissingParameterError.code\n this.data = { parameter }\n }\n}\n/** @type {'MissingParameterError'} */\nMissingParameterError.code = 'MissingParameterError'\n","import { BaseError } from './BaseError.js'\n\nexport class AlreadyExistsError extends BaseError {\n /**\n * @param {'note'|'remote'|'tag'|'branch'} noun\n * @param {string} where\n * @param {boolean} canForce\n */\n constructor(noun, where, canForce = true) {\n super(\n `Failed to create ${noun} at ${where} because it already exists.${\n canForce\n ? ` (Hint: use 'force: true' parameter to overwrite existing ${noun}.)`\n : ''\n }`\n )\n this.code = this.name = AlreadyExistsError.code\n this.data = { noun, where, canForce }\n }\n}\n/** @type {'AlreadyExistsError'} */\nAlreadyExistsError.code = 'AlreadyExistsError'\n","export function dirname(path) {\n const last = Math.max(path.lastIndexOf('/'), path.lastIndexOf('\\\\'))\n if (last === -1) return '.'\n if (last === 0) return '/'\n return path.slice(0, last)\n}\n","'use strict';\n\n\nvar TYPED_OK = (typeof Uint8Array !== 'undefined') &&\n (typeof Uint16Array !== 'undefined') &&\n (typeof Int32Array !== 'undefined');\n\nfunction _has(obj, key) {\n return Object.prototype.hasOwnProperty.call(obj, key);\n}\n\nexports.assign = function (obj /*from1, from2, from3, ...*/) {\n var sources = Array.prototype.slice.call(arguments, 1);\n while (sources.length) {\n var source = sources.shift();\n if (!source) { continue; }\n\n if (typeof source !== 'object') {\n throw new TypeError(source + 'must be non-object');\n }\n\n for (var p in source) {\n if (_has(source, p)) {\n obj[p] = source[p];\n }\n }\n }\n\n return obj;\n};\n\n\n// reduce buffer size, avoiding mem copy\nexports.shrinkBuf = function (buf, size) {\n if (buf.length === size) { return buf; }\n if (buf.subarray) { return buf.subarray(0, size); }\n buf.length = size;\n return buf;\n};\n\n\nvar fnTyped = {\n arraySet: function (dest, src, src_offs, len, dest_offs) {\n if (src.subarray && dest.subarray) {\n dest.set(src.subarray(src_offs, src_offs + len), dest_offs);\n return;\n }\n // Fallback to ordinary array\n for (var i = 0; i < len; i++) {\n dest[dest_offs + i] = src[src_offs + i];\n }\n },\n // Join array of chunks to single array.\n flattenChunks: function (chunks) {\n var i, l, len, pos, chunk, result;\n\n // calculate data length\n len = 0;\n for (i = 0, l = chunks.length; i < l; i++) {\n len += chunks[i].length;\n }\n\n // join chunks\n result = new Uint8Array(len);\n pos = 0;\n for (i = 0, l = chunks.length; i < l; i++) {\n chunk = chunks[i];\n result.set(chunk, pos);\n pos += chunk.length;\n }\n\n return result;\n }\n};\n\nvar fnUntyped = {\n arraySet: function (dest, src, src_offs, len, dest_offs) {\n for (var i = 0; i < len; i++) {\n dest[dest_offs + i] = src[src_offs + i];\n }\n },\n // Join array of chunks to single array.\n flattenChunks: function (chunks) {\n return [].concat.apply([], chunks);\n }\n};\n\n\n// Enable/Disable typed arrays use, for testing\n//\nexports.setTyped = function (on) {\n if (on) {\n exports.Buf8 = Uint8Array;\n exports.Buf16 = Uint16Array;\n exports.Buf32 = Int32Array;\n exports.assign(exports, fnTyped);\n } else {\n exports.Buf8 = Array;\n exports.Buf16 = Array;\n exports.Buf32 = Array;\n exports.assign(exports, fnUntyped);\n }\n};\n\nexports.setTyped(TYPED_OK);\n","import { BaseError } from './BaseError.js'\n\nexport class InvalidOidError extends BaseError {\n /**\n * @param {string} value\n */\n constructor(value) {\n super(`Expected a 40-char hex object id but saw \"${value}\".`)\n this.code = this.name = InvalidOidError.code\n this.data = { value }\n }\n}\n/** @type {'InvalidOidError'} */\nInvalidOidError.code = 'InvalidOidError'\n","import { normalizeMode } from './normalizeMode'\n\nconst MAX_UINT32 = 2 ** 32\n\nfunction SecondsNanoseconds(\n givenSeconds,\n givenNanoseconds,\n milliseconds,\n date\n) {\n if (givenSeconds !== undefined && givenNanoseconds !== undefined) {\n return [givenSeconds, givenNanoseconds]\n }\n if (milliseconds === undefined) {\n milliseconds = date.valueOf()\n }\n const seconds = Math.floor(milliseconds / 1000)\n const nanoseconds = (milliseconds - seconds * 1000) * 1000000\n return [seconds, nanoseconds]\n}\n\nexport function normalizeStats(e) {\n const [ctimeSeconds, ctimeNanoseconds] = SecondsNanoseconds(\n e.ctimeSeconds,\n e.ctimeNanoseconds,\n e.ctimeMs,\n e.ctime\n )\n const [mtimeSeconds, mtimeNanoseconds] = SecondsNanoseconds(\n e.mtimeSeconds,\n e.mtimeNanoseconds,\n e.mtimeMs,\n e.mtime\n )\n\n return {\n ctimeSeconds: ctimeSeconds % MAX_UINT32,\n ctimeNanoseconds: ctimeNanoseconds % MAX_UINT32,\n mtimeSeconds: mtimeSeconds % MAX_UINT32,\n mtimeNanoseconds: mtimeNanoseconds % MAX_UINT32,\n dev: e.dev % MAX_UINT32,\n ino: e.ino % MAX_UINT32,\n mode: normalizeMode(e.mode % MAX_UINT32),\n uid: e.uid % MAX_UINT32,\n gid: e.gid % MAX_UINT32,\n // size of -1 happens over a BrowserFS HTTP Backend that doesn't serve Content-Length headers\n // (like the Karma webserver) because BrowserFS HTTP Backend uses HTTP HEAD requests to do fs.stat\n size: e.size > -1 ? e.size % MAX_UINT32 : 0,\n }\n}\n","import { NotFoundError } from '../errors/NotFoundError.js'\nimport { ObjectTypeError } from '../errors/ObjectTypeError.js'\nimport { GitRefManager } from '../managers/GitRefManager.js'\nimport { GitTree } from '../models/GitTree.js'\nimport { _readObject as readObject } from '../storage/readObject.js'\nimport { join } from '../utils/join'\nimport { normalizeMode } from '../utils/normalizeMode.js'\nimport { resolveTree } from '../utils/resolveTree.js'\n\nexport class GitWalkerRepo {\n constructor({ fs, gitdir, ref, cache }) {\n this.fs = fs\n this.cache = cache\n this.gitdir = gitdir\n this.mapPromise = (async () => {\n const map = new Map()\n let oid\n try {\n oid = await GitRefManager.resolve({ fs, gitdir, ref })\n } catch (e) {\n if (e instanceof NotFoundError) {\n // Handle fresh branches with no commits\n oid = '4b825dc642cb6eb9a060e54bf8d69288fbee4904'\n }\n }\n const tree = await resolveTree({ fs, cache: this.cache, gitdir, oid })\n tree.type = 'tree'\n tree.mode = '40000'\n map.set('.', tree)\n return map\n })()\n const walker = this\n this.ConstructEntry = class TreeEntry {\n constructor(fullpath) {\n this._fullpath = fullpath\n this._type = false\n this._mode = false\n this._stat = false\n this._content = false\n this._oid = false\n }\n\n async type() {\n return walker.type(this)\n }\n\n async mode() {\n return walker.mode(this)\n }\n\n async stat() {\n return walker.stat(this)\n }\n\n async content() {\n return walker.content(this)\n }\n\n async oid() {\n return walker.oid(this)\n }\n }\n }\n\n async readdir(entry) {\n const filepath = entry._fullpath\n const { fs, cache, gitdir } = this\n const map = await this.mapPromise\n const obj = map.get(filepath)\n if (!obj) throw new Error(`No obj for ${filepath}`)\n const oid = obj.oid\n if (!oid) throw new Error(`No oid for obj ${JSON.stringify(obj)}`)\n if (obj.type !== 'tree') {\n // TODO: support submodules (type === 'commit')\n return null\n }\n const { type, object } = await readObject({ fs, cache, gitdir, oid })\n if (type !== obj.type) {\n throw new ObjectTypeError(oid, type, obj.type)\n }\n const tree = GitTree.from(object)\n // cache all entries\n for (const entry of tree) {\n map.set(join(filepath, entry.path), entry)\n }\n return tree.entries().map(entry => join(filepath, entry.path))\n }\n\n async type(entry) {\n if (entry._type === false) {\n const map = await this.mapPromise\n const { type } = map.get(entry._fullpath)\n entry._type = type\n }\n return entry._type\n }\n\n async mode(entry) {\n if (entry._mode === false) {\n const map = await this.mapPromise\n const { mode } = map.get(entry._fullpath)\n entry._mode = normalizeMode(parseInt(mode, 8))\n }\n return entry._mode\n }\n\n async stat(_entry) {}\n\n async content(entry) {\n if (entry._content === false) {\n const map = await this.mapPromise\n const { fs, cache, gitdir } = this\n const obj = map.get(entry._fullpath)\n const oid = obj.oid\n const { type, object } = await readObject({ fs, cache, gitdir, oid })\n if (type !== 'blob') {\n entry._content = undefined\n } else {\n entry._content = new Uint8Array(object)\n }\n }\n return entry._content\n }\n\n async oid(entry) {\n if (entry._oid === false) {\n const map = await this.mapPromise\n const obj = map.get(entry._fullpath)\n entry._oid = obj.oid\n }\n return entry._oid\n }\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { GitWalkerRepo } from '../models/GitWalkerRepo.js'\nimport { GitWalkSymbol } from '../utils/symbols.js'\n\n/**\n * @param {object} args\n * @param {string} [args.ref='HEAD']\n * @returns {Walker}\n */\nexport function TREE({ ref = 'HEAD' } = {}) {\n const o = Object.create(null)\n Object.defineProperty(o, GitWalkSymbol, {\n value: function({ fs, gitdir, cache }) {\n return new GitWalkerRepo({ fs, gitdir, ref, cache })\n },\n })\n Object.freeze(o)\n return o\n}\n","import { BaseError } from './BaseError.js'\n\nexport class ParseError extends BaseError {\n /**\n * @param {string} expected\n * @param {string} actual\n */\n constructor(expected, actual) {\n super(`Expected \"${expected}\" but received \"${actual}\".`)\n this.code = this.name = ParseError.code\n this.data = { expected, actual }\n }\n}\n/** @type {'ParseError'} */\nParseError.code = 'ParseError'\n","// This is part of an elaborate system to facilitate code-splitting / tree-shaking.\n// commands/walk.js can depend on only this, and the actual Walker classes exported\n// can be opaque - only having a single property (this symbol) that is not enumerable,\n// and thus the constructor can be passed as an argument to walk while being \"unusable\"\n// outside of it.\nexport const GitWalkSymbol = Symbol('GitWalkSymbol')\n","export function compareStrings(a, b) {\n // https://stackoverflow.com/a/40355107/2168416\n return -(a < b) || +(a > b)\n}\n","import { getIterator } from './getIterator.js'\n\n// Currently 'for await' upsets my linters.\nexport async function forAwait(iterable, cb) {\n const iter = getIterator(iterable)\n while (true) {\n const { value, done } = await iter.next()\n if (value) await cb(value)\n if (done) break\n }\n if (iter.return) iter.return()\n}\n","export function basename(path) {\n const last = Math.max(path.lastIndexOf('/'), path.lastIndexOf('\\\\'))\n if (last > -1) {\n path = path.slice(last + 1)\n }\n return path\n}\n","// https://dev.to/namirsab/comment/2050\nexport function arrayRange(start, end) {\n const length = end - start\n return Array.from({ length }, (_, i) => start + i)\n}\n","// This is convenient for computing unions/joins of sorted lists.\nexport class RunningMinimum {\n constructor() {\n // Using a getter for 'value' would just bloat the code.\n // You know better than to set it directly right?\n this.value = null\n }\n\n consider(value) {\n if (value === null || value === undefined) return\n if (this.value === null) {\n this.value = value\n } else if (value < this.value) {\n this.value = value\n }\n }\n\n reset() {\n this.value = null\n }\n}\n","import { RunningMinimum } from '../models/RunningMinimum'\n\n// Take an array of length N of\n// iterators of length Q_n\n// of strings\n// and return an iterator of length max(Q_n) for all n\n// of arrays of length N\n// of string|null who all have the same string value\nexport function* unionOfIterators(sets) {\n /* NOTE: We can assume all arrays are sorted.\n * Indexes are sorted because they are defined that way:\n *\n * > Index entries are sorted in ascending order on the name field,\n * > interpreted as a string of unsigned bytes (i.e. memcmp() order, no\n * > localization, no special casing of directory separator '/'). Entries\n * > with the same name are sorted by their stage field.\n *\n * Trees should be sorted because they are created directly from indexes.\n * They definitely should be sorted, or else they wouldn't have a unique SHA1.\n * So that would be very naughty on the part of the tree-creator.\n *\n * Lastly, the working dir entries are sorted because I choose to sort them\n * in my FileSystem.readdir() implementation.\n */\n\n // Init\n const min = new RunningMinimum()\n let minimum\n const heads = []\n const numsets = sets.length\n for (let i = 0; i < numsets; i++) {\n // Abuse the fact that iterators continue to return 'undefined' for value\n // once they are done\n heads[i] = sets[i].next().value\n if (heads[i] !== undefined) {\n min.consider(heads[i])\n }\n }\n if (min.value === null) return\n // Iterate\n while (true) {\n const result = []\n minimum = min.value\n min.reset()\n for (let i = 0; i < numsets; i++) {\n if (heads[i] !== undefined && heads[i] === minimum) {\n result[i] = heads[i]\n heads[i] = sets[i].next().value\n } else {\n // A little hacky, but eh\n result[i] = null\n }\n if (heads[i] !== undefined) {\n min.consider(heads[i])\n }\n }\n yield result\n if (min.value === null) return\n }\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { arrayRange } from '../utils/arrayRange.js'\nimport { flat } from '../utils/flat.js'\nimport { GitWalkSymbol } from '../utils/symbols.js'\nimport { unionOfIterators } from '../utils/unionOfIterators.js'\n\n/**\n * @param {object} args\n * @param {import('../models/FileSystem.js').FileSystem} args.fs\n * @param {object} args.cache\n * @param {string} [args.dir]\n * @param {string} [args.gitdir=join(dir,'.git')]\n * @param {Walker[]} args.trees\n * @param {WalkerMap} [args.map]\n * @param {WalkerReduce} [args.reduce]\n * @param {WalkerIterate} [args.iterate]\n *\n * @returns {Promise<any>} The finished tree-walking result\n *\n * @see {WalkerMap}\n *\n */\nexport async function _walk({\n fs,\n cache,\n dir,\n gitdir,\n trees,\n // @ts-ignore\n map = async (_, entry) => entry,\n // The default reducer is a flatmap that filters out undefineds.\n reduce = async (parent, children) => {\n const flatten = flat(children)\n if (parent !== undefined) flatten.unshift(parent)\n return flatten\n },\n // The default iterate function walks all children concurrently\n iterate = (walk, children) => Promise.all([...children].map(walk)),\n}) {\n const walkers = trees.map(proxy =>\n proxy[GitWalkSymbol]({ fs, dir, gitdir, cache })\n )\n\n const root = new Array(walkers.length).fill('.')\n const range = arrayRange(0, walkers.length)\n const unionWalkerFromReaddir = async entries => {\n range.map(i => {\n entries[i] = entries[i] && new walkers[i].ConstructEntry(entries[i])\n })\n const subdirs = await Promise.all(\n range.map(i => (entries[i] ? walkers[i].readdir(entries[i]) : []))\n )\n // Now process child directories\n const iterators = subdirs\n .map(array => (array === null ? [] : array))\n .map(array => array[Symbol.iterator]())\n return {\n entries,\n children: unionOfIterators(iterators),\n }\n }\n\n const walk = async root => {\n const { entries, children } = await unionWalkerFromReaddir(root)\n const fullpath = entries.find(entry => entry && entry._fullpath)._fullpath\n const parent = await map(fullpath, entries)\n if (parent !== null) {\n let walkedChildren = await iterate(walk, children)\n walkedChildren = walkedChildren.filter(x => x !== undefined)\n return reduce(parent, walkedChildren)\n }\n }\n return walk(root)\n}\n","import { BaseError } from './BaseError.js'\n\nexport class InvalidRefNameError extends BaseError {\n /**\n * @param {string} ref\n * @param {string} suggestion\n * @param {boolean} canForce\n */\n constructor(ref, suggestion) {\n super(\n `\"${ref}\" would be an invalid git reference. (Hint: a valid alternative would be \"${suggestion}\".)`\n )\n this.code = this.name = InvalidRefNameError.code\n this.data = { ref, suggestion }\n }\n}\n/** @type {'InvalidRefNameError'} */\nInvalidRefNameError.code = 'InvalidRefNameError'\n","import AsyncLock from 'async-lock'\n\nimport { join } from '../utils/join.js'\n\nlet lock = null\n\nexport class GitShallowManager {\n static async read({ fs, gitdir }) {\n if (lock === null) lock = new AsyncLock()\n const filepath = join(gitdir, 'shallow')\n const oids = new Set()\n await lock.acquire(filepath, async function() {\n const text = await fs.read(filepath, { encoding: 'utf8' })\n if (text === null) return oids // no file\n if (text.trim() === '') return oids // empty file\n text\n .trim()\n .split('\\n')\n .map(oid => oids.add(oid))\n })\n return oids\n }\n\n static async write({ fs, gitdir, oids }) {\n if (lock === null) lock = new AsyncLock()\n const filepath = join(gitdir, 'shallow')\n if (oids.size > 0) {\n const text = [...oids].join('\\n') + '\\n'\n await lock.acquire(filepath, async function() {\n await fs.write(filepath, text, {\n encoding: 'utf8',\n })\n })\n } else {\n // No shallows\n await lock.acquire(filepath, async function() {\n await fs.rm(filepath)\n })\n }\n }\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { GitRefManager } from '../managers/GitRefManager.js'\nimport { abbreviateRef } from '../utils/abbreviateRef.js'\n\n/**\n * @param {Object} args\n * @param {import('../models/FileSystem.js').FileSystem} args.fs\n * @param {string} args.gitdir\n * @param {boolean} [args.fullname = false] - Return the full path (e.g. \"refs/heads/main\") instead of the abbreviated form.\n * @param {boolean} [args.test = false] - If the current branch doesn't actually exist (such as right after git init) then return `undefined`.\n *\n * @returns {Promise<string|void>} The name of the current branch or undefined if the HEAD is detached.\n *\n */\nexport async function _currentBranch({\n fs,\n gitdir,\n fullname = false,\n test = false,\n}) {\n const ref = await GitRefManager.resolve({\n fs,\n gitdir,\n ref: 'HEAD',\n depth: 2,\n })\n if (test) {\n try {\n await GitRefManager.resolve({ fs, gitdir, ref })\n } catch (_) {\n return\n }\n }\n // Return `undefined` for detached HEAD\n if (!ref.startsWith('refs/')) return\n return fullname ? ref : abbreviateRef(ref)\n}\n","'use strict';\n\nfunction escapeRegExp(string) {\n return string.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&'); // $& means the whole matched string\n}\n\nfunction replaceAll(str, search, replacement) {\n search = search instanceof RegExp ? search : new RegExp(escapeRegExp(search), 'g');\n\n return str.replace(search, replacement);\n}\n\nvar CleanGitRef = {\n clean: function clean(value) {\n if (typeof value !== 'string') {\n throw new Error('Expected a string, received: ' + value);\n }\n\n value = replaceAll(value, './', '/');\n value = replaceAll(value, '..', '.');\n value = replaceAll(value, ' ', '-');\n value = replaceAll(value, /^[~^:?*\\\\\\-]/g, '');\n value = replaceAll(value, /[~^:?*\\\\]/g, '-');\n value = replaceAll(value, /[~^:?*\\\\\\-]$/g, '');\n value = replaceAll(value, '@{', '-');\n value = replaceAll(value, /\\.$/g, '');\n value = replaceAll(value, /\\/$/g, '');\n value = replaceAll(value, /\\.lock$/g, '');\n return value;\n }\n};\n\nmodule.exports = CleanGitRef;","import { BaseError } from './BaseError.js'\n\nexport class UnsafeFilepathError extends BaseError {\n /**\n * @param {string} filepath\n */\n constructor(filepath) {\n super(`The filepath \"${filepath}\" contains unsafe character sequences`)\n this.code = this.name = UnsafeFilepathError.code\n this.data = { filepath }\n }\n}\n/** @type {'UnsafeFilepathError'} */\nUnsafeFilepathError.code = 'UnsafeFilepathError'\n","import { ObjectTypeError } from '../errors/index.js'\nimport { GitAnnotatedTag } from '../models/GitAnnotatedTag.js'\nimport { GitCommit } from '../models/GitCommit.js'\nimport { GitTree } from '../models/GitTree.js'\nimport { _readObject } from '../storage/readObject.js'\n\nexport async function resolveTree({ fs, cache, gitdir, oid }) {\n // Empty tree - bypass `readObject`\n if (oid === '4b825dc642cb6eb9a060e54bf8d69288fbee4904') {\n return { tree: GitTree.from([]), oid }\n }\n const { type, object } = await _readObject({ fs, cache, gitdir, oid })\n // Resolve annotated tag objects to whatever\n if (type === 'tag') {\n oid = GitAnnotatedTag.from(object).parse().object\n return resolveTree({ fs, cache, gitdir, oid })\n }\n // Resolve commits to trees\n if (type === 'commit') {\n oid = GitCommit.from(object).parse().tree\n return resolveTree({ fs, cache, gitdir, oid })\n }\n if (type !== 'tree') {\n throw new ObjectTypeError(oid, type, 'tree')\n }\n return { tree: GitTree.from(object), oid }\n}\n","export const pkg = {\n name: 'isomorphic-git',\n version: '1.25.4',\n agent: 'git/isomorphic-git@1.25.4',\n}\n","// Top level file is just a mixin of submodules & constants\n'use strict';\n\nvar assign = require('./lib/utils/common').assign;\n\nvar deflate = require('./lib/deflate');\nvar inflate = require('./lib/inflate');\nvar constants = require('./lib/zlib/constants');\n\nvar pako = {};\n\nassign(pako, deflate, inflate, constants);\n\nmodule.exports = pako;\n","export function padHex(b, n) {\n const s = n.toString(16)\n return '0'.repeat(b - s.length) + s\n}\n","export function parseAuthor(author) {\n const [, name, email, timestamp, offset] = author.match(\n /^(.*) <(.*)> (.*) (.*)$/\n )\n return {\n name: name,\n email: email,\n timestamp: Number(timestamp),\n timezoneOffset: parseTimezoneOffset(offset),\n }\n}\n\n// The amount of effort that went into crafting these cases to handle\n// -0 (just so we don't lose that information when parsing and reconstructing)\n// but can also default to +0 was extraordinary.\n\nfunction parseTimezoneOffset(offset) {\n let [, sign, hours, minutes] = offset.match(/(\\+|-)(\\d\\d)(\\d\\d)/)\n minutes = (sign === '+' ? 1 : -1) * (Number(hours) * 60 + Number(minutes))\n return negateExceptForZero(minutes)\n}\n\nfunction negateExceptForZero(n) {\n return n === 0 ? n : -n\n}\n","import { forAwait } from './forAwait.js'\n\nexport async function collect(iterable) {\n let size = 0\n const buffers = []\n // This will be easier once `for await ... of` loops are available.\n await forAwait(iterable, value => {\n buffers.push(value)\n size += value.byteLength\n })\n const result = new Uint8Array(size)\n let nextIndex = 0\n for (const buffer of buffers) {\n result.set(buffer, nextIndex)\n nextIndex += buffer.byteLength\n }\n return result\n}\n","// @ts-check\n/**\n *\n * @param {WalkerEntry} entry\n * @param {WalkerEntry} base\n *\n */\nexport async function modified(entry, base) {\n if (!entry && !base) return false\n if (entry && !base) return true\n if (!entry && base) return true\n if ((await entry.type()) === 'tree' && (await base.type()) === 'tree') {\n return false\n }\n if (\n (await entry.type()) === (await base.type()) &&\n (await entry.mode()) === (await base.mode()) &&\n (await entry.oid()) === (await base.oid())\n ) {\n return false\n }\n return true\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { resolveFilepath } from '../utils/resolveFilepath.js'\nimport { resolveTree } from '../utils/resolveTree.js'\n\n/**\n *\n * @typedef {Object} ReadTreeResult - The object returned has the following schema:\n * @property {string} oid - SHA-1 object id of this tree\n * @property {TreeObject} tree - the parsed tree object\n */\n\n/**\n * @param {object} args\n * @param {import('../models/FileSystem.js').FileSystem} args.fs\n * @param {any} args.cache\n * @param {string} args.gitdir\n * @param {string} args.oid\n * @param {string} [args.filepath]\n *\n * @returns {Promise<ReadTreeResult>}\n */\nexport async function _readTree({\n fs,\n cache,\n gitdir,\n oid,\n filepath = undefined,\n}) {\n if (filepath !== undefined) {\n oid = await resolveFilepath({ fs, cache, gitdir, oid, filepath })\n }\n const { tree, oid: treeOid } = await resolveTree({ fs, cache, gitdir, oid })\n const result = {\n oid: treeOid,\n tree: tree.entries(),\n }\n return result\n}\n","import '../typedefs.js'\n\nimport { HttpError } from '../errors/HttpError.js'\nimport { SmartHttpError } from '../errors/SmartHttpError.js'\nimport { UserCanceledError } from '../errors/UserCanceledError.js'\nimport { calculateBasicAuthHeader } from '../utils/calculateBasicAuthHeader.js'\nimport { collect } from '../utils/collect.js'\nimport { extractAuthFromUrl } from '../utils/extractAuthFromUrl.js'\nimport { parseRefsAdResponse } from '../wire/parseRefsAdResponse.js'\n\n// Try to accomodate known CORS proxy implementations:\n// - https://jcubic.pl/proxy.php? <-- uses query string\n// - https://cors.isomorphic-git.org <-- uses path\nconst corsProxify = (corsProxy, url) =>\n corsProxy.endsWith('?')\n ? `${corsProxy}${url}`\n : `${corsProxy}/${url.replace(/^https?:\\/\\//, '')}`\n\nconst updateHeaders = (headers, auth) => {\n // Update the basic auth header\n if (auth.username || auth.password) {\n headers.Authorization = calculateBasicAuthHeader(auth)\n }\n // but any manually provided headers take precedence\n if (auth.headers) {\n Object.assign(headers, auth.headers)\n }\n}\n\n/**\n * @param {GitHttpResponse} res\n *\n * @returns {{ preview: string, response: string, data: Buffer }}\n */\nconst stringifyBody = async res => {\n try {\n // Some services provide a meaningful error message in the body of 403s like \"token lacks the scopes necessary to perform this action\"\n const data = Buffer.from(await collect(res.body))\n const response = data.toString('utf8')\n const preview =\n response.length < 256 ? response : response.slice(0, 256) + '...'\n return { preview, response, data }\n } catch (e) {\n return {}\n }\n}\n\nexport class GitRemoteHTTP {\n static async capabilities() {\n return ['discover', 'connect']\n }\n\n /**\n * @param {Object} args\n * @param {HttpClient} args.http\n * @param {ProgressCallback} [args.onProgress]\n * @param {AuthCallback} [args.onAuth]\n * @param {AuthFailureCallback} [args.onAuthFailure]\n * @param {AuthSuccessCallback} [args.onAuthSuccess]\n * @param {string} [args.corsProxy]\n * @param {string} args.service\n * @param {string} args.url\n * @param {Object<string, string>} args.headers\n * @param {1 | 2} args.protocolVersion - Git Protocol Version\n */\n static async discover({\n http,\n onProgress,\n onAuth,\n onAuthSuccess,\n onAuthFailure,\n corsProxy,\n service,\n url: _origUrl,\n headers,\n protocolVersion,\n }) {\n let { url, auth } = extractAuthFromUrl(_origUrl)\n const proxifiedURL = corsProxy ? corsProxify(corsProxy, url) : url\n if (auth.username || auth.password) {\n headers.Authorization = calculateBasicAuthHeader(auth)\n }\n if (protocolVersion === 2) {\n headers['Git-Protocol'] = 'version=2'\n }\n\n let res\n let tryAgain\n let providedAuthBefore = false\n do {\n res = await http.request({\n onProgress,\n method: 'GET',\n url: `${proxifiedURL}/info/refs?service=${service}`,\n headers,\n })\n\n // the default loop behavior\n tryAgain = false\n\n // 401 is the \"correct\" response for access denied. 203 is Non-Authoritative Information and comes from Azure DevOps, which\n // apparently doesn't realize this is a git request and is returning the HTML for the \"Azure DevOps Services | Sign In\" page.\n if (res.statusCode === 401 || res.statusCode === 203) {\n // On subsequent 401s, call `onAuthFailure` instead of `onAuth`.\n // This is so that naive `onAuth` callbacks that return a fixed value don't create an infinite loop of retrying.\n const getAuth = providedAuthBefore ? onAuthFailure : onAuth\n if (getAuth) {\n // Acquire credentials and try again\n // TODO: read `useHttpPath` value from git config and pass along?\n auth = await getAuth(url, {\n ...auth,\n headers: { ...headers },\n })\n if (auth && auth.cancel) {\n throw new UserCanceledError()\n } else if (auth) {\n updateHeaders(headers, auth)\n providedAuthBefore = true\n tryAgain = true\n }\n }\n } else if (\n res.statusCode === 200 &&\n providedAuthBefore &&\n onAuthSuccess\n ) {\n await onAuthSuccess(url, auth)\n }\n } while (tryAgain)\n\n if (res.statusCode !== 200) {\n const { response } = await stringifyBody(res)\n throw new HttpError(res.statusCode, res.statusMessage, response)\n }\n // Git \"smart\" HTTP servers should respond with the correct Content-Type header.\n if (\n res.headers['content-type'] === `application/x-${service}-advertisement`\n ) {\n const remoteHTTP = await parseRefsAdResponse(res.body, { service })\n remoteHTTP.auth = auth\n return remoteHTTP\n } else {\n // If they don't send the correct content-type header, that's a good indicator it is either a \"dumb\" HTTP\n // server, or the user specified an incorrect remote URL and the response is actually an HTML page.\n // In this case, we save the response as plain text so we can generate a better error message if needed.\n const { preview, response, data } = await stringifyBody(res)\n // For backwards compatibility, try to parse it anyway.\n // TODO: maybe just throw instead of trying?\n try {\n const remoteHTTP = await parseRefsAdResponse([data], { service })\n remoteHTTP.auth = auth\n return remoteHTTP\n } catch (e) {\n throw new SmartHttpError(preview, response)\n }\n }\n }\n\n /**\n * @param {Object} args\n * @param {HttpClient} args.http\n * @param {ProgressCallback} [args.onProgress]\n * @param {string} [args.corsProxy]\n * @param {string} args.service\n * @param {string} args.url\n * @param {Object<string, string>} [args.headers]\n * @param {any} args.body\n * @param {any} args.auth\n */\n static async connect({\n http,\n onProgress,\n corsProxy,\n service,\n url,\n auth,\n body,\n headers,\n }) {\n // We already have the \"correct\" auth value at this point, but\n // we need to strip out the username/password from the URL yet again.\n const urlAuth = extractAuthFromUrl(url)\n if (urlAuth) url = urlAuth.url\n\n if (corsProxy) url = corsProxify(corsProxy, url)\n\n headers['content-type'] = `application/x-${service}-request`\n headers.accept = `application/x-${service}-result`\n updateHeaders(headers, auth)\n\n const res = await http.request({\n onProgress,\n method: 'POST',\n url: `${url}/${service}`,\n body,\n headers,\n })\n if (res.statusCode !== 200) {\n const { response } = stringifyBody(res)\n throw new HttpError(res.statusCode, res.statusMessage, response)\n }\n return res\n }\n}\n","import { BaseError } from './BaseError.js'\n\nexport class MergeNotSupportedError extends BaseError {\n constructor() {\n super(`Merges with conflicts are not supported yet.`)\n this.code = this.name = MergeNotSupportedError.code\n this.data = {}\n }\n}\n/** @type {'MergeNotSupportedError'} */\nMergeNotSupportedError.code = 'MergeNotSupportedError'\n","import { BaseError } from './BaseError.js'\n\nexport class MergeConflictError extends BaseError {\n /**\n * @param {Array<string>} filepaths\n * @param {Array<string>} bothModified\n * @param {Array<string>} deleteByUs\n * @param {Array<string>} deleteByTheirs\n */\n constructor(filepaths, bothModified, deleteByUs, deleteByTheirs) {\n super(\n `Automatic merge failed with one or more merge conflicts in the following files: ${filepaths.toString()}. Fix conflicts then commit the result.`\n )\n this.code = this.name = MergeConflictError.code\n this.data = { filepaths, bothModified, deleteByUs, deleteByTheirs }\n }\n}\n/** @type {'MergeConflictError'} */\nMergeConflictError.code = 'MergeConflictError'\n","import { BaseError } from './BaseError.js'\n\nexport class HttpError extends BaseError {\n /**\n * @param {number} statusCode\n * @param {string} statusMessage\n * @param {string} response\n */\n constructor(statusCode, statusMessage, response) {\n super(`HTTP Error: ${statusCode} ${statusMessage}`)\n this.code = this.name = HttpError.code\n this.data = { statusCode, statusMessage, response }\n }\n}\n/** @type {'HttpError'} */\nHttpError.code = 'HttpError'\n","import { BaseError } from './BaseError.js'\n\nexport class InvalidFilepathError extends BaseError {\n /**\n * @param {'leading-slash'|'trailing-slash'|'directory'} [reason]\n */\n constructor(reason) {\n let message = 'invalid filepath'\n if (reason === 'leading-slash' || reason === 'trailing-slash') {\n message = `\"filepath\" parameter should not include leading or trailing directory separators because these can cause problems on some platforms.`\n } else if (reason === 'directory') {\n message = `\"filepath\" should not be a directory.`\n }\n super(message)\n this.code = this.name = InvalidFilepathError.code\n this.data = { reason }\n }\n}\n/** @type {'InvalidFilepathError'} */\nInvalidFilepathError.code = 'InvalidFilepathError'\n","import { compareStrings } from './compareStrings'\n\nexport function comparePath(a, b) {\n // https://stackoverflow.com/a/40355107/2168416\n return compareStrings(a.path, b.path)\n}\n","import crc32 from 'crc-32'\n\nimport { InternalError } from '../errors/InternalError.js'\nimport { GitObject } from '../models/GitObject'\nimport { BufferCursor } from '../utils/BufferCursor.js'\nimport { applyDelta } from '../utils/applyDelta.js'\nimport { listpack } from '../utils/git-list-pack.js'\nimport { inflate } from '../utils/inflate.js'\nimport { shasum } from '../utils/shasum.js'\n\nfunction decodeVarInt(reader) {\n const bytes = []\n let byte = 0\n let multibyte = 0\n do {\n byte = reader.readUInt8()\n // We keep bits 6543210\n const lastSeven = byte & 0b01111111\n bytes.push(lastSeven)\n // Whether the next byte is part of the variable-length encoded number\n // is encoded in bit 7\n multibyte = byte & 0b10000000\n } while (multibyte)\n // Now that all the bytes are in big-endian order,\n // alternate shifting the bits left by 7 and OR-ing the next byte.\n // And... do a weird increment-by-one thing that I don't quite understand.\n return bytes.reduce((a, b) => ((a + 1) << 7) | b, -1)\n}\n\n// I'm pretty much copying this one from the git C source code,\n// because it makes no sense.\nfunction otherVarIntDecode(reader, startWith) {\n let result = startWith\n let shift = 4\n let byte = null\n do {\n byte = reader.readUInt8()\n result |= (byte & 0b01111111) << shift\n shift += 7\n } while (byte & 0b10000000)\n return result\n}\n\nexport class GitPackIndex {\n constructor(stuff) {\n Object.assign(this, stuff)\n this.offsetCache = {}\n }\n\n static async fromIdx({ idx, getExternalRefDelta }) {\n const reader = new BufferCursor(idx)\n const magic = reader.slice(4).toString('hex')\n // Check for IDX v2 magic number\n if (magic !== 'ff744f63') {\n return // undefined\n }\n const version = reader.readUInt32BE()\n if (version !== 2) {\n throw new InternalError(\n `Unable to read version ${version} packfile IDX. (Only version 2 supported)`\n )\n }\n if (idx.byteLength > 2048 * 1024 * 1024) {\n throw new InternalError(\n `To keep implementation simple, I haven't implemented the layer 5 feature needed to support packfiles > 2GB in size.`\n )\n }\n // Skip over fanout table\n reader.seek(reader.tell() + 4 * 255)\n // Get hashes\n const size = reader.readUInt32BE()\n const hashes = []\n for (let i = 0; i < size; i++) {\n const hash = reader.slice(20).toString('hex')\n hashes[i] = hash\n }\n reader.seek(reader.tell() + 4 * size)\n // Skip over CRCs\n // Get offsets\n const offsets = new Map()\n for (let i = 0; i < size; i++) {\n offsets.set(hashes[i], reader.readUInt32BE())\n }\n const packfileSha = reader.slice(20).toString('hex')\n return new GitPackIndex({\n hashes,\n crcs: {},\n offsets,\n packfileSha,\n getExternalRefDelta,\n })\n }\n\n static async fromPack({ pack, getExternalRefDelta, onProgress }) {\n const listpackTypes = {\n 1: 'commit',\n 2: 'tree',\n 3: 'blob',\n 4: 'tag',\n 6: 'ofs-delta',\n 7: 'ref-delta',\n }\n const offsetToObject = {}\n\n // Older packfiles do NOT use the shasum of the pack itself,\n // so it is recommended to just use whatever bytes are in the trailer.\n // Source: https://github.com/git/git/commit/1190a1acf800acdcfd7569f87ac1560e2d077414\n const packfileSha = pack.slice(-20).toString('hex')\n\n const hashes = []\n const crcs = {}\n const offsets = new Map()\n let totalObjectCount = null\n let lastPercent = null\n\n await listpack([pack], async ({ data, type, reference, offset, num }) => {\n if (totalObjectCount === null) totalObjectCount = num\n const percent = Math.floor(\n ((totalObjectCount - num) * 100) / totalObjectCount\n )\n if (percent !== lastPercent) {\n if (onProgress) {\n await onProgress({\n phase: 'Receiving objects',\n loaded: totalObjectCount - num,\n total: totalObjectCount,\n })\n }\n }\n lastPercent = percent\n // Change type from a number to a meaningful string\n type = listpackTypes[type]\n\n if (['commit', 'tree', 'blob', 'tag'].includes(type)) {\n offsetToObject[offset] = {\n type,\n offset,\n }\n } else if (type === 'ofs-delta') {\n offsetToObject[offset] = {\n type,\n offset,\n }\n } else if (type === 'ref-delta') {\n offsetToObject[offset] = {\n type,\n offset,\n }\n }\n })\n\n // We need to know the lengths of the slices to compute the CRCs.\n const offsetArray = Object.keys(offsetToObject).map(Number)\n for (const [i, start] of offsetArray.entries()) {\n const end =\n i + 1 === offsetArray.length ? pack.byteLength - 20 : offsetArray[i + 1]\n const o = offsetToObject[start]\n const crc = crc32.buf(pack.slice(start, end)) >>> 0\n o.end = end\n o.crc = crc\n }\n\n // We don't have the hashes yet. But we can generate them using the .readSlice function!\n const p = new GitPackIndex({\n pack: Promise.resolve(pack),\n packfileSha,\n crcs,\n hashes,\n offsets,\n getExternalRefDelta,\n })\n\n // Resolve deltas and compute the oids\n lastPercent = null\n let count = 0\n const objectsByDepth = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n for (let offset in offsetToObject) {\n offset = Number(offset)\n const percent = Math.floor((count * 100) / totalObjectCount)\n if (percent !== lastPercent) {\n if (onProgress) {\n await onProgress({\n phase: 'Resolving deltas',\n loaded: count,\n total: totalObjectCount,\n })\n }\n }\n count++\n lastPercent = percent\n\n const o = offsetToObject[offset]\n if (o.oid) continue\n try {\n p.readDepth = 0\n p.externalReadDepth = 0\n const { type, object } = await p.readSlice({ start: offset })\n objectsByDepth[p.readDepth] += 1\n const oid = await shasum(GitObject.wrap({ type, object }))\n o.oid = oid\n hashes.push(oid)\n offsets.set(oid, offset)\n crcs[oid] = o.crc\n } catch (err) {\n continue\n }\n }\n\n hashes.sort()\n return p\n }\n\n async toBuffer() {\n const buffers = []\n const write = (str, encoding) => {\n buffers.push(Buffer.from(str, encoding))\n }\n // Write out IDX v2 magic number\n write('ff744f63', 'hex')\n // Write out version number 2\n write('00000002', 'hex')\n // Write fanout table\n const fanoutBuffer = new BufferCursor(Buffer.alloc(256 * 4))\n for (let i = 0; i < 256; i++) {\n let count = 0\n for (const hash of this.hashes) {\n if (parseInt(hash.slice(0, 2), 16) <= i) count++\n }\n fanoutBuffer.writeUInt32BE(count)\n }\n buffers.push(fanoutBuffer.buffer)\n // Write out hashes\n for (const hash of this.hashes) {\n write(hash, 'hex')\n }\n // Write out crcs\n const crcsBuffer = new BufferCursor(Buffer.alloc(this.hashes.length * 4))\n for (const hash of this.hashes) {\n crcsBuffer.writeUInt32BE(this.crcs[hash])\n }\n buffers.push(crcsBuffer.buffer)\n // Write out offsets\n const offsetsBuffer = new BufferCursor(Buffer.alloc(this.hashes.length * 4))\n for (const hash of this.hashes) {\n offsetsBuffer.writeUInt32BE(this.offsets.get(hash))\n }\n buffers.push(offsetsBuffer.buffer)\n // Write out packfile checksum\n write(this.packfileSha, 'hex')\n // Write out shasum\n const totalBuffer = Buffer.concat(buffers)\n const sha = await shasum(totalBuffer)\n const shaBuffer = Buffer.alloc(20)\n shaBuffer.write(sha, 'hex')\n return Buffer.concat([totalBuffer, shaBuffer])\n }\n\n async load({ pack }) {\n this.pack = pack\n }\n\n async unload() {\n this.pack = null\n }\n\n async read({ oid }) {\n if (!this.offsets.get(oid)) {\n if (this.getExternalRefDelta) {\n this.externalReadDepth++\n return this.getExternalRefDelta(oid)\n } else {\n throw new InternalError(`Could not read object ${oid} from packfile`)\n }\n }\n const start = this.offsets.get(oid)\n return this.readSlice({ start })\n }\n\n async readSlice({ start }) {\n if (this.offsetCache[start]) {\n return Object.assign({}, this.offsetCache[start])\n }\n this.readDepth++\n const types = {\n 0b0010000: 'commit',\n 0b0100000: 'tree',\n 0b0110000: 'blob',\n 0b1000000: 'tag',\n 0b1100000: 'ofs_delta',\n 0b1110000: 'ref_delta',\n }\n if (!this.pack) {\n throw new InternalError(\n 'Tried to read from a GitPackIndex with no packfile loaded into memory'\n )\n }\n const raw = (await this.pack).slice(start)\n const reader = new BufferCursor(raw)\n const byte = reader.readUInt8()\n // Object type is encoded in bits 654\n const btype = byte & 0b1110000\n let type = types[btype]\n if (type === undefined) {\n throw new InternalError('Unrecognized type: 0b' + btype.toString(2))\n }\n // The length encoding get complicated.\n // Last four bits of length is encoded in bits 3210\n const lastFour = byte & 0b1111\n let length = lastFour\n // Whether the next byte is part of the variable-length encoded number\n // is encoded in bit 7\n const multibyte = byte & 0b10000000\n if (multibyte) {\n length = otherVarIntDecode(reader, lastFour)\n }\n let base = null\n let object = null\n // Handle deltified objects\n if (type === 'ofs_delta') {\n const offset = decodeVarInt(reader)\n const baseOffset = start - offset\n ;({ object: base, type } = await this.readSlice({ start: baseOffset }))\n }\n if (type === 'ref_delta') {\n const oid = reader.slice(20).toString('hex')\n ;({ object: base, type } = await this.read({ oid }))\n }\n // Handle undeltified objects\n const buffer = raw.slice(reader.tell())\n object = Buffer.from(await inflate(buffer))\n // Assert that the object length is as expected.\n if (object.byteLength !== length) {\n throw new InternalError(\n `Packfile told us object would have length ${length} but it had length ${object.byteLength}`\n )\n }\n if (base) {\n object = Buffer.from(applyDelta(object, base))\n }\n // Cache the result based on depth.\n if (this.readDepth > 3) {\n // hand tuned for speed / memory usage tradeoff\n this.offsetCache[start] = { type, object }\n }\n return { type, format: 'content', object }\n }\n}\n","import ignore from 'ignore'\n\nimport { basename } from '../utils/basename.js'\nimport { dirname } from '../utils/dirname.js'\nimport { join } from '../utils/join.js'\n\n// I'm putting this in a Manager because I reckon it could benefit\n// from a LOT of cacheing.\nexport class GitIgnoreManager {\n static async isIgnored({ fs, dir, gitdir = join(dir, '.git'), filepath }) {\n // ALWAYS ignore \".git\" folders.\n if (basename(filepath) === '.git') return true\n // '.' is not a valid gitignore entry, so '.' is never ignored\n if (filepath === '.') return false\n // Check and load exclusion rules from project exclude file (.git/info/exclude)\n let excludes = ''\n const excludesFile = join(gitdir, 'info', 'exclude')\n if (await fs.exists(excludesFile)) {\n excludes = await fs.read(excludesFile, 'utf8')\n }\n // Find all the .gitignore files that could affect this file\n const pairs = [\n {\n gitignore: join(dir, '.gitignore'),\n filepath,\n },\n ]\n const pieces = filepath.split('/').filter(Boolean)\n for (let i = 1; i < pieces.length; i++) {\n const folder = pieces.slice(0, i).join('/')\n const file = pieces.slice(i).join('/')\n pairs.push({\n gitignore: join(dir, folder, '.gitignore'),\n filepath: file,\n })\n }\n let ignoredStatus = false\n for (const p of pairs) {\n let file\n try {\n file = await fs.read(p.gitignore, 'utf8')\n } catch (err) {\n if (err.code === 'NOENT') continue\n }\n const ign = ignore().add(excludes)\n ign.add(file)\n // If the parent directory is excluded, we are done.\n // \"It is not possible to re-include a file if a parent directory of that file is excluded. Git doesn’t list excluded directories for performance reasons, so any patterns on contained files have no effect, no matter where they are defined.\"\n // source: https://git-scm.com/docs/gitignore\n const parentdir = dirname(p.filepath)\n if (parentdir !== '.' && ign.ignores(parentdir)) return true\n // If the file is currently ignored, test for UNignoring.\n if (ignoredStatus) {\n ignoredStatus = !ign.test(p.filepath).unignored\n } else {\n ignoredStatus = ign.test(p.filepath).ignored\n }\n }\n return ignoredStatus\n }\n}\n","import { UnknownTransportError } from '../errors/UnknownTransportError.js'\nimport { UrlParseError } from '../errors/UrlParseError.js'\nimport { translateSSHtoHTTP } from '../utils/translateSSHtoHTTP.js'\n\nimport { GitRemoteHTTP } from './GitRemoteHTTP'\n\nfunction parseRemoteUrl({ url }) {\n // the stupid \"shorter scp-like syntax\"\n if (url.startsWith('git@')) {\n return {\n transport: 'ssh',\n address: url,\n }\n }\n const matches = url.match(/(\\w+)(:\\/\\/|::)(.*)/)\n if (matches === null) return\n /*\n * When git encounters a URL of the form <transport>://<address>, where <transport> is\n * a protocol that it cannot handle natively, it automatically invokes git remote-<transport>\n * with the full URL as the second argument.\n *\n * @see https://git-scm.com/docs/git-remote-helpers\n */\n if (matches[2] === '://') {\n return {\n transport: matches[1],\n address: matches[0],\n }\n }\n /*\n * A URL of the form <transport>::<address> explicitly instructs git to invoke\n * git remote-<transport> with <address> as the second argument.\n *\n * @see https://git-scm.com/docs/git-remote-helpers\n */\n if (matches[2] === '::') {\n return {\n transport: matches[1],\n address: matches[3],\n }\n }\n}\n\nexport class GitRemoteManager {\n static getRemoteHelperFor({ url }) {\n // TODO: clean up the remoteHelper API and move into PluginCore\n const remoteHelpers = new Map()\n remoteHelpers.set('http', GitRemoteHTTP)\n remoteHelpers.set('https', GitRemoteHTTP)\n\n const parts = parseRemoteUrl({ url })\n if (!parts) {\n throw new UrlParseError(url)\n }\n if (remoteHelpers.has(parts.transport)) {\n return remoteHelpers.get(parts.transport)\n }\n throw new UnknownTransportError(\n url,\n parts.transport,\n parts.transport === 'ssh' ? translateSSHtoHTTP(url) : undefined\n )\n }\n}\n","export function translateSSHtoHTTP(url) {\n // handle \"shorter scp-like syntax\"\n url = url.replace(/^git@([^:]+):/, 'https://$1/')\n // handle proper SSH URLs\n url = url.replace(/^ssh:\\/\\//, 'https://')\n return url\n}\n","'use strict';\nmodule.exports = require('./lib');\n","export function formatAuthor({ name, email, timestamp, timezoneOffset }) {\n timezoneOffset = formatTimezoneOffset(timezoneOffset)\n return `${name} <${email}> ${timestamp} ${timezoneOffset}`\n}\n\n// The amount of effort that went into crafting these cases to handle\n// -0 (just so we don't lose that information when parsing and reconstructing)\n// but can also default to +0 was extraordinary.\n\nfunction formatTimezoneOffset(minutes) {\n const sign = simpleSign(negateExceptForZero(minutes))\n minutes = Math.abs(minutes)\n const hours = Math.floor(minutes / 60)\n minutes -= hours * 60\n let strHours = String(hours)\n let strMinutes = String(minutes)\n if (strHours.length < 2) strHours = '0' + strHours\n if (strMinutes.length < 2) strMinutes = '0' + strMinutes\n return (sign === -1 ? '-' : '+') + strHours + strMinutes\n}\n\nfunction simpleSign(n) {\n return Math.sign(n) || (Object.is(n, -0) ? -1 : 1)\n}\n\nfunction negateExceptForZero(n) {\n return n === 0 ? n : -n\n}\n","export class FIFO {\n constructor() {\n this._queue = []\n }\n\n write(chunk) {\n if (this._ended) {\n throw Error('You cannot write to a FIFO that has already been ended!')\n }\n if (this._waiting) {\n const resolve = this._waiting\n this._waiting = null\n resolve({ value: chunk })\n } else {\n this._queue.push(chunk)\n }\n }\n\n end() {\n this._ended = true\n if (this._waiting) {\n const resolve = this._waiting\n this._waiting = null\n resolve({ done: true })\n }\n }\n\n destroy(err) {\n this.error = err\n this.end()\n }\n\n async next() {\n if (this._queue.length > 0) {\n return { value: this._queue.shift() }\n }\n if (this._ended) {\n return { done: true }\n }\n if (this._waiting) {\n throw Error(\n 'You cannot call read until the previous call to read has returned!'\n )\n }\n return new Promise(resolve => {\n this._waiting = resolve\n })\n }\n}\n","import { BaseError } from './BaseError.js'\n\nexport class RemoteCapabilityError extends BaseError {\n /**\n * @param {'shallow'|'deepen-since'|'deepen-not'|'deepen-relative'} capability\n * @param {'depth'|'since'|'exclude'|'relative'} parameter\n */\n constructor(capability, parameter) {\n super(\n `Remote does not support the \"${capability}\" so the \"${parameter}\" parameter cannot be used.`\n )\n this.code = this.name = RemoteCapabilityError.code\n this.data = { capability, parameter }\n }\n}\n/** @type {'RemoteCapabilityError'} */\nRemoteCapabilityError.code = 'RemoteCapabilityError'\n","import { normalizeStats } from './normalizeStats.js'\n\nexport function compareStats(entry, stats) {\n // Comparison based on the description in Paragraph 4 of\n // https://www.kernel.org/pub/software/scm/git/docs/technical/racy-git.txt\n const e = normalizeStats(entry)\n const s = normalizeStats(stats)\n const staleness =\n e.mode !== s.mode ||\n e.mtimeSeconds !== s.mtimeSeconds ||\n e.ctimeSeconds !== s.ctimeSeconds ||\n e.uid !== s.uid ||\n e.gid !== s.gid ||\n e.ino !== s.ino ||\n e.size !== s.size\n return staleness\n}\n","// @ts-check\nimport { InvalidFilepathError } from '../errors/InvalidFilepathError.js'\nimport { NotFoundError } from '../errors/NotFoundError.js'\nimport { ObjectTypeError } from '../errors/ObjectTypeError.js'\nimport { GitTree } from '../models/GitTree.js'\nimport { _readObject as readObject } from '../storage/readObject.js'\nimport { resolveTree } from '../utils/resolveTree.js'\n\nexport async function resolveFilepath({ fs, cache, gitdir, oid, filepath }) {\n // Ensure there are no leading or trailing directory separators.\n // I was going to do this automatically, but then found that the Git Terminal for Windows\n // auto-expands --filepath=/src/utils to --filepath=C:/Users/Will/AppData/Local/Programs/Git/src/utils\n // so I figured it would be wise to promote the behavior in the application layer not just the library layer.\n if (filepath.startsWith('/')) {\n throw new InvalidFilepathError('leading-slash')\n } else if (filepath.endsWith('/')) {\n throw new InvalidFilepathError('trailing-slash')\n }\n const _oid = oid\n const result = await resolveTree({ fs, cache, gitdir, oid })\n const tree = result.tree\n if (filepath === '') {\n oid = result.oid\n } else {\n const pathArray = filepath.split('/')\n oid = await _resolveFilepath({\n fs,\n cache,\n gitdir,\n tree,\n pathArray,\n oid: _oid,\n filepath,\n })\n }\n return oid\n}\n\nasync function _resolveFilepath({\n fs,\n cache,\n gitdir,\n tree,\n pathArray,\n oid,\n filepath,\n}) {\n const name = pathArray.shift()\n for (const entry of tree) {\n if (entry.path === name) {\n if (pathArray.length === 0) {\n return entry.oid\n } else {\n const { type, object } = await readObject({\n fs,\n cache,\n gitdir,\n oid: entry.oid,\n })\n if (type !== 'tree') {\n throw new ObjectTypeError(oid, type, 'tree', filepath)\n }\n tree = GitTree.from(object)\n return _resolveFilepath({\n fs,\n cache,\n gitdir,\n tree,\n pathArray,\n oid,\n filepath,\n })\n }\n }\n }\n throw new NotFoundError(`file or directory found at \"${oid}:${filepath}\"`)\n}\n","import { BaseError } from './BaseError.js'\n\nexport class EmptyServerResponseError extends BaseError {\n constructor() {\n super(`Empty response from git server.`)\n this.code = this.name = EmptyServerResponseError.code\n this.data = {}\n }\n}\n/** @type {'EmptyServerResponseError'} */\nEmptyServerResponseError.code = 'EmptyServerResponseError'\n","import { BaseError } from './BaseError.js'\n\nexport class NoRefspecError extends BaseError {\n /**\n * @param {string} remote\n */\n constructor(remote) {\n super(`Could not find a fetch refspec for remote \"${remote}\". Make sure the config file has an entry like the following:\n[remote \"${remote}\"]\n\\tfetch = +refs/heads/*:refs/remotes/origin/*\n`)\n this.code = this.name = NoRefspecError.code\n this.data = { remote }\n }\n}\n/** @type {'NoRefspecError'} */\nNoRefspecError.code = 'NoRefspecError'\n","import { BaseError } from './BaseError.js'\n\nexport class SmartHttpError extends BaseError {\n /**\n * @param {string} preview\n * @param {string} response\n */\n constructor(preview, response) {\n super(\n `Remote did not reply using the \"smart\" HTTP protocol. Expected \"001e# service=git-upload-pack\" but received: ${preview}`\n )\n this.code = this.name = SmartHttpError.code\n this.data = { preview, response }\n }\n}\n/** @type {'SmartHttpError'} */\nSmartHttpError.code = 'SmartHttpError'\n","import { BaseError } from './BaseError.js'\n\nexport class UnknownTransportError extends BaseError {\n /**\n * @param {string} url\n * @param {string} transport\n * @param {string} [suggestion]\n */\n constructor(url, transport, suggestion) {\n super(\n `Git remote \"${url}\" uses an unrecognized transport protocol: \"${transport}\"`\n )\n this.code = this.name = UnknownTransportError.code\n this.data = { url, transport, suggestion }\n }\n}\n/** @type {'UnknownTransportError'} */\nUnknownTransportError.code = 'UnknownTransportError'\n","import { BaseError } from './BaseError.js'\n\nexport class UrlParseError extends BaseError {\n /**\n * @param {string} url\n */\n constructor(url) {\n super(`Cannot parse remote URL: \"${url}\"`)\n this.code = this.name = UrlParseError.code\n this.data = { url }\n }\n}\n/** @type {'UrlParseError'} */\nUrlParseError.code = 'UrlParseError'\n","import { BaseError } from './BaseError.js'\n\nexport class UserCanceledError extends BaseError {\n constructor() {\n super(`The operation was canceled.`)\n this.code = this.name = UserCanceledError.code\n this.data = {}\n }\n}\n/** @type {'UserCanceledError'} */\nUserCanceledError.code = 'UserCanceledError'\n","import { BaseError } from './BaseError.js'\n\nexport class UnmergedPathsError extends BaseError {\n /**\n * @param {Array<string>} filepaths\n */\n constructor(filepaths) {\n super(\n `Modifying the index is not possible because you have unmerged files: ${filepaths.toString}. Fix them up in the work tree, and then use 'git add/rm as appropriate to mark resolution and make a commit.`\n )\n this.code = this.name = UnmergedPathsError.code\n this.data = { filepaths }\n }\n}\n/** @type {'UnmergedPathsError'} */\nUnmergedPathsError.code = 'UnmergedPathsError'\n","/*\nIf 'side-band' or 'side-band-64k' capabilities have been specified by\nthe client, the server will send the packfile data multiplexed.\n\nEach packet starting with the packet-line length of the amount of data\nthat follows, followed by a single byte specifying the sideband the\nfollowing data is coming in on.\n\nIn 'side-band' mode, it will send up to 999 data bytes plus 1 control\ncode, for a total of up to 1000 bytes in a pkt-line. In 'side-band-64k'\nmode it will send up to 65519 data bytes plus 1 control code, for a\ntotal of up to 65520 bytes in a pkt-line.\n\nThe sideband byte will be a '1', '2' or a '3'. Sideband '1' will contain\npackfile data, sideband '2' will be used for progress information that the\nclient will generally print to stderr and sideband '3' is used for error\ninformation.\n\nIf no 'side-band' capability was specified, the server will stream the\nentire packfile without multiplexing.\n*/\nimport { FIFO } from '../utils/FIFO.js'\n\nimport { GitPktLine } from './GitPktLine.js'\n\nexport class GitSideBand {\n static demux(input) {\n const read = GitPktLine.streamReader(input)\n // And now for the ridiculous side-band or side-band-64k protocol\n const packetlines = new FIFO()\n const packfile = new FIFO()\n const progress = new FIFO()\n // TODO: Use a proper through stream?\n const nextBit = async function() {\n const line = await read()\n // Skip over flush packets\n if (line === null) return nextBit()\n // A made up convention to signal there's no more to read.\n if (line === true) {\n packetlines.end()\n progress.end()\n input.error ? packfile.destroy(input.error) : packfile.end()\n return\n }\n // Examine first byte to determine which output \"stream\" to use\n switch (line[0]) {\n case 1: {\n // pack data\n packfile.write(line.slice(1))\n break\n }\n case 2: {\n // progress message\n progress.write(line.slice(1))\n break\n }\n case 3: {\n // fatal error message just before stream aborts\n const error = line.slice(1)\n progress.write(error)\n packetlines.end()\n progress.end()\n packfile.destroy(new Error(error.toString('utf8')))\n return\n }\n default: {\n // Not part of the side-band-64k protocol\n packetlines.write(line)\n }\n }\n // Careful not to blow up the stack.\n // I think Promises in a tail-call position should be OK.\n nextBit()\n }\n nextBit()\n return {\n packetlines,\n packfile,\n progress,\n }\n }\n // static mux ({\n // protocol, // 'side-band' or 'side-band-64k'\n // packetlines,\n // packfile,\n // progress,\n // error\n // }) {\n // const MAX_PACKET_LENGTH = protocol === 'side-band-64k' ? 999 : 65519\n // let output = new PassThrough()\n // packetlines.on('data', data => {\n // if (data === null) {\n // output.write(GitPktLine.flush())\n // } else {\n // output.write(GitPktLine.encode(data))\n // }\n // })\n // let packfileWasEmpty = true\n // let packfileEnded = false\n // let progressEnded = false\n // let errorEnded = false\n // let goodbye = Buffer.concat([\n // GitPktLine.encode(Buffer.from('010A', 'hex')),\n // GitPktLine.flush()\n // ])\n // packfile\n // .on('data', data => {\n // packfileWasEmpty = false\n // const buffers = splitBuffer(data, MAX_PACKET_LENGTH)\n // for (const buffer of buffers) {\n // output.write(\n // GitPktLine.encode(Buffer.concat([Buffer.from('01', 'hex'), buffer]))\n // )\n // }\n // })\n // .on('end', () => {\n // packfileEnded = true\n // if (!packfileWasEmpty) output.write(goodbye)\n // if (progressEnded && errorEnded) output.end()\n // })\n // progress\n // .on('data', data => {\n // const buffers = splitBuffer(data, MAX_PACKET_LENGTH)\n // for (const buffer of buffers) {\n // output.write(\n // GitPktLine.encode(Buffer.concat([Buffer.from('02', 'hex'), buffer]))\n // )\n // }\n // })\n // .on('end', () => {\n // progressEnded = true\n // if (packfileEnded && errorEnded) output.end()\n // })\n // error\n // .on('data', data => {\n // const buffers = splitBuffer(data, MAX_PACKET_LENGTH)\n // for (const buffer of buffers) {\n // output.write(\n // GitPktLine.encode(Buffer.concat([Buffer.from('03', 'hex'), buffer]))\n // )\n // }\n // })\n // .on('end', () => {\n // errorEnded = true\n // if (progressEnded && packfileEnded) output.end()\n // })\n // return output\n // }\n}\n","/*\n * A JavaScript implementation of the Secure Hash Algorithm, SHA-1, as defined\n * in FIPS PUB 180-1\n * Version 2.1a Copyright Paul Johnston 2000 - 2002.\n * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet\n * Distributed under the BSD License\n * See http://pajhome.org.uk/crypt/md5 for details.\n */\n\nvar inherits = require('inherits')\nvar Hash = require('./hash')\nvar Buffer = require('safe-buffer').Buffer\n\nvar K = [\n 0x5a827999, 0x6ed9eba1, 0x8f1bbcdc | 0, 0xca62c1d6 | 0\n]\n\nvar W = new Array(80)\n\nfunction Sha1 () {\n this.init()\n this._w = W\n\n Hash.call(this, 64, 56)\n}\n\ninherits(Sha1, Hash)\n\nSha1.prototype.init = function () {\n this._a = 0x67452301\n this._b = 0xefcdab89\n this._c = 0x98badcfe\n this._d = 0x10325476\n this._e = 0xc3d2e1f0\n\n return this\n}\n\nfunction rotl1 (num) {\n return (num << 1) | (num >>> 31)\n}\n\nfunction rotl5 (num) {\n return (num << 5) | (num >>> 27)\n}\n\nfunction rotl30 (num) {\n return (num << 30) | (num >>> 2)\n}\n\nfunction ft (s, b, c, d) {\n if (s === 0) return (b & c) | ((~b) & d)\n if (s === 2) return (b & c) | (b & d) | (c & d)\n return b ^ c ^ d\n}\n\nSha1.prototype._update = function (M) {\n var W = this._w\n\n var a = this._a | 0\n var b = this._b | 0\n var c = this._c | 0\n var d = this._d | 0\n var e = this._e | 0\n\n for (var i = 0; i < 16; ++i) W[i] = M.readInt32BE(i * 4)\n for (; i < 80; ++i) W[i] = rotl1(W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16])\n\n for (var j = 0; j < 80; ++j) {\n var s = ~~(j / 20)\n var t = (rotl5(a) + ft(s, b, c, d) + e + W[j] + K[s]) | 0\n\n e = d\n d = c\n c = rotl30(b)\n b = a\n a = t\n }\n\n this._a = (a + this._a) | 0\n this._b = (b + this._b) | 0\n this._c = (c + this._c) | 0\n this._d = (d + this._d) | 0\n this._e = (e + this._e) | 0\n}\n\nSha1.prototype._hash = function () {\n var H = Buffer.allocUnsafe(20)\n\n H.writeInt32BE(this._a | 0, 0)\n H.writeInt32BE(this._b | 0, 4)\n H.writeInt32BE(this._c | 0, 8)\n H.writeInt32BE(this._d | 0, 12)\n H.writeInt32BE(this._e | 0, 16)\n\n return H\n}\n\nmodule.exports = Sha1\n","/**\n * From https://github.com/git/git/blob/master/Documentation/technical/index-format.txt\n *\n * 32-bit mode, split into (high to low bits)\n *\n * 4-bit object type\n * valid values in binary are 1000 (regular file), 1010 (symbolic link)\n * and 1110 (gitlink)\n *\n * 3-bit unused\n *\n * 9-bit unix permission. Only 0755 and 0644 are valid for regular files.\n * Symbolic links and gitlinks have value 0 in this field.\n */\nexport function normalizeMode(mode) {\n // Note: BrowserFS will use -1 for \"unknown\"\n // I need to make it non-negative for these bitshifts to work.\n let type = mode > 0 ? mode >> 12 : 0\n // If it isn't valid, assume it as a \"regular file\"\n // 0100 = directory\n // 1000 = regular file\n // 1010 = symlink\n // 1110 = gitlink\n if (\n type !== 0b0100 &&\n type !== 0b1000 &&\n type !== 0b1010 &&\n type !== 0b1110\n ) {\n type = 0b1000\n }\n let permissions = mode & 0o777\n // Is the file executable? then 755. Else 644.\n if (permissions & 0b001001001) {\n permissions = 0o755\n } else {\n permissions = 0o644\n }\n // If it's not a regular file, scrub all permissions\n if (type !== 0b1000) permissions = 0\n return (type << 12) + permissions\n}\n","import { InternalError } from '../errors/InternalError.js'\n\nexport class GitRefSpec {\n constructor({ remotePath, localPath, force, matchPrefix }) {\n Object.assign(this, {\n remotePath,\n localPath,\n force,\n matchPrefix,\n })\n }\n\n static from(refspec) {\n const [\n forceMatch,\n remotePath,\n remoteGlobMatch,\n localPath,\n localGlobMatch,\n ] = refspec.match(/^(\\+?)(.*?)(\\*?):(.*?)(\\*?)$/).slice(1)\n const force = forceMatch === '+'\n const remoteIsGlob = remoteGlobMatch === '*'\n const localIsGlob = localGlobMatch === '*'\n // validate\n // TODO: Make this check more nuanced, and depend on whether this is a fetch refspec or a push refspec\n if (remoteIsGlob !== localIsGlob) {\n throw new InternalError('Invalid refspec')\n }\n return new GitRefSpec({\n remotePath,\n localPath,\n force,\n matchPrefix: remoteIsGlob,\n })\n // TODO: We need to run resolveRef on both paths to expand them to their full name.\n }\n\n translate(remoteBranch) {\n if (this.matchPrefix) {\n if (remoteBranch.startsWith(this.remotePath)) {\n return this.localPath + remoteBranch.replace(this.remotePath, '')\n }\n } else {\n if (remoteBranch === this.remotePath) return this.localPath\n }\n return null\n }\n\n reverseTranslate(localBranch) {\n if (this.matchPrefix) {\n if (localBranch.startsWith(this.localPath)) {\n return this.remotePath + localBranch.replace(this.localPath, '')\n }\n } else {\n if (localBranch === this.localPath) return this.remotePath\n }\n return null\n }\n}\n","import { GitPackIndex } from '../models/GitPackIndex.js'\n\nconst PackfileCache = Symbol('PackfileCache')\n\nasync function loadPackIndex({\n fs,\n filename,\n getExternalRefDelta,\n emitter,\n emitterPrefix,\n}) {\n const idx = await fs.read(filename)\n return GitPackIndex.fromIdx({ idx, getExternalRefDelta })\n}\n\nexport function readPackIndex({\n fs,\n cache,\n filename,\n getExternalRefDelta,\n emitter,\n emitterPrefix,\n}) {\n // Try to get the packfile index from the in-memory cache\n if (!cache[PackfileCache]) cache[PackfileCache] = new Map()\n let p = cache[PackfileCache].get(filename)\n if (!p) {\n p = loadPackIndex({\n fs,\n filename,\n getExternalRefDelta,\n emitter,\n emitterPrefix,\n })\n cache[PackfileCache].set(filename, p)\n }\n return p\n}\n","import { getIterator } from './getIterator.js'\n\n// inspired by 'gartal' but lighter-weight and more battle-tested.\nexport class StreamReader {\n constructor(stream) {\n this.stream = getIterator(stream)\n this.buffer = null\n this.cursor = 0\n this.undoCursor = 0\n this.started = false\n this._ended = false\n this._discardedBytes = 0\n }\n\n eof() {\n return this._ended && this.cursor === this.buffer.length\n }\n\n tell() {\n return this._discardedBytes + this.cursor\n }\n\n async byte() {\n if (this.eof()) return\n if (!this.started) await this._init()\n if (this.cursor === this.buffer.length) {\n await this._loadnext()\n if (this._ended) return\n }\n this._moveCursor(1)\n return this.buffer[this.undoCursor]\n }\n\n async chunk() {\n if (this.eof()) return\n if (!this.started) await this._init()\n if (this.cursor === this.buffer.length) {\n await this._loadnext()\n if (this._ended) return\n }\n this._moveCursor(this.buffer.length)\n return this.buffer.slice(this.undoCursor, this.cursor)\n }\n\n async read(n) {\n if (this.eof()) return\n if (!this.started) await this._init()\n if (this.cursor + n > this.buffer.length) {\n this._trim()\n await this._accumulate(n)\n }\n this._moveCursor(n)\n return this.buffer.slice(this.undoCursor, this.cursor)\n }\n\n async skip(n) {\n if (this.eof()) return\n if (!this.started) await this._init()\n if (this.cursor + n > this.buffer.length) {\n this._trim()\n await this._accumulate(n)\n }\n this._moveCursor(n)\n }\n\n async undo() {\n this.cursor = this.undoCursor\n }\n\n async _next() {\n this.started = true\n let { done, value } = await this.stream.next()\n if (done) {\n this._ended = true\n if (!value) return Buffer.alloc(0)\n }\n if (value) {\n value = Buffer.from(value)\n }\n return value\n }\n\n _trim() {\n // Throw away parts of the buffer we don't need anymore\n // assert(this.cursor <= this.buffer.length)\n this.buffer = this.buffer.slice(this.undoCursor)\n this.cursor -= this.undoCursor\n this._discardedBytes += this.undoCursor\n this.undoCursor = 0\n }\n\n _moveCursor(n) {\n this.undoCursor = this.cursor\n this.cursor += n\n if (this.cursor > this.buffer.length) {\n this.cursor = this.buffer.length\n }\n }\n\n async _accumulate(n) {\n if (this._ended) return\n // Expand the buffer until we have N bytes of data\n // or we've reached the end of the stream\n const buffers = [this.buffer]\n while (this.cursor + n > lengthBuffers(buffers)) {\n const nextbuffer = await this._next()\n if (this._ended) break\n buffers.push(nextbuffer)\n }\n this.buffer = Buffer.concat(buffers)\n }\n\n async _loadnext() {\n this._discardedBytes += this.buffer.length\n this.undoCursor = 0\n this.cursor = 0\n this.buffer = await this._next()\n }\n\n async _init() {\n this.buffer = await this._next()\n }\n}\n\n// This helper function helps us postpone concatenating buffers, which\n// would create intermediate buffer objects,\nfunction lengthBuffers(buffers) {\n return buffers.reduce((acc, buffer) => acc + buffer.length, 0)\n}\n","/* eslint-env node, browser */\n/* global DecompressionStream */\nimport pako from 'pako'\n\nlet supportsDecompressionStream = false\n\nexport async function inflate(buffer) {\n if (supportsDecompressionStream === null) {\n supportsDecompressionStream = testDecompressionStream()\n }\n return supportsDecompressionStream\n ? browserInflate(buffer)\n : pako.inflate(buffer)\n}\n\nasync function browserInflate(buffer) {\n const ds = new DecompressionStream('deflate')\n const d = new Blob([buffer]).stream().pipeThrough(ds)\n return new Uint8Array(await new Response(d).arrayBuffer())\n}\n\nfunction testDecompressionStream() {\n try {\n const ds = new DecompressionStream('deflate')\n if (ds) return true\n } catch (_) {\n // no bother\n }\n return false\n}\n","/* eslint-env node, browser */\n/* global CompressionStream */\nimport pako from 'pako'\n\nlet supportsCompressionStream = null\n\nexport async function deflate(buffer) {\n if (supportsCompressionStream === null) {\n supportsCompressionStream = testCompressionStream()\n }\n return supportsCompressionStream\n ? browserDeflate(buffer)\n : pako.deflate(buffer)\n}\n\nasync function browserDeflate(buffer) {\n const cs = new CompressionStream('deflate')\n const c = new Blob([buffer]).stream().pipeThrough(cs)\n return new Uint8Array(await new Response(c).arrayBuffer())\n}\n\nfunction testCompressionStream() {\n try {\n const cs = new CompressionStream('deflate')\n // Test if `Blob.stream` is present. React Native does not have the `stream` method\n const stream = new Blob([]).stream()\n stream.cancel()\n return !!cs\n } catch (_) {\n // no bother\n }\n return false\n}\n","export function calculateBasicAuthHeader({ username = '', password = '' }) {\n return `Basic ${Buffer.from(`${username}:${password}`).toString('base64')}`\n}\n","// @ts-check\n\n/**\n * @param {function} read\n */\nexport async function parseCapabilitiesV2(read) {\n /** @type {Object<string, string | true>} */\n const capabilities2 = {}\n\n let line\n while (true) {\n line = await read()\n if (line === true) break\n if (line === null) continue\n line = line.toString('utf8').replace(/\\n$/, '')\n const i = line.indexOf('=')\n if (i > -1) {\n const key = line.slice(0, i)\n const value = line.slice(i + 1)\n capabilities2[key] = value\n } else {\n capabilities2[line] = true\n }\n }\n return { protocolVersion: 2, capabilities2 }\n}\n","import { EmptyServerResponseError } from '../errors/EmptyServerResponseError.js'\nimport { ParseError } from '../errors/ParseError.js'\nimport { GitPktLine } from '../models/GitPktLine.js'\nimport { parseCapabilitiesV2 } from '../wire/parseCapabilitiesV2.js'\n\nexport async function parseRefsAdResponse(stream, { service }) {\n const capabilities = new Set()\n const refs = new Map()\n const symrefs = new Map()\n\n // There is probably a better way to do this, but for now\n // let's just throw the result parser inline here.\n const read = GitPktLine.streamReader(stream)\n let lineOne = await read()\n // skip past any flushes\n while (lineOne === null) lineOne = await read()\n\n if (lineOne === true) throw new EmptyServerResponseError()\n\n // Handle protocol v2 responses (Bitbucket Server doesn't include a `# service=` line)\n if (lineOne.includes('version 2')) {\n return parseCapabilitiesV2(read)\n }\n\n // Clients MUST ignore an LF at the end of the line.\n if (lineOne.toString('utf8').replace(/\\n$/, '') !== `# service=${service}`) {\n throw new ParseError(`# service=${service}\\\\n`, lineOne.toString('utf8'))\n }\n let lineTwo = await read()\n // skip past any flushes\n while (lineTwo === null) lineTwo = await read()\n // In the edge case of a brand new repo, zero refs (and zero capabilities)\n // are returned.\n if (lineTwo === true) return { capabilities, refs, symrefs }\n lineTwo = lineTwo.toString('utf8')\n\n // Handle protocol v2 responses\n if (lineTwo.includes('version 2')) {\n return parseCapabilitiesV2(read)\n }\n\n const [firstRef, capabilitiesLine] = splitAndAssert(lineTwo, '\\x00', '\\\\x00')\n capabilitiesLine.split(' ').map(x => capabilities.add(x))\n const [ref, name] = splitAndAssert(firstRef, ' ', ' ')\n refs.set(name, ref)\n while (true) {\n const line = await read()\n if (line === true) break\n if (line !== null) {\n const [ref, name] = splitAndAssert(line.toString('utf8'), ' ', ' ')\n refs.set(name, ref)\n }\n }\n // Symrefs are thrown into the \"capabilities\" unfortunately.\n for (const cap of capabilities) {\n if (cap.startsWith('symref=')) {\n const m = cap.match(/symref=([^:]+):(.*)/)\n if (m.length === 3) {\n symrefs.set(m[1], m[2])\n }\n }\n }\n return { protocolVersion: 1, capabilities, refs, symrefs }\n}\n\nfunction splitAndAssert(line, sep, expected) {\n const split = line.trim().split(sep)\n if (split.length !== 2) {\n throw new ParseError(\n `Two strings separated by '${expected}'`,\n line.toString('utf8')\n )\n }\n return split\n}\n","import { fromValue } from '../utils/fromValue.js'\n\nexport function getIterator(iterable) {\n if (iterable[Symbol.asyncIterator]) {\n return iterable[Symbol.asyncIterator]()\n }\n if (iterable[Symbol.iterator]) {\n return iterable[Symbol.iterator]()\n }\n if (iterable.next) {\n return iterable\n }\n return fromValue(iterable)\n}\n","// Convert a value to an Async Iterator\n// This will be easier with async generator functions.\nexport function fromValue(value) {\n let queue = [value]\n return {\n next() {\n return Promise.resolve({ done: queue.length === 0, value: queue.pop() })\n },\n return() {\n queue = []\n return {}\n },\n [Symbol.asyncIterator]() {\n return this\n },\n }\n}\n","export function indent(str) {\n return (\n str\n .trim()\n .split('\\n')\n .map(x => ' ' + x)\n .join('\\n') + '\\n'\n )\n}\n","'use strict';\n\nconst processFn = (fn, options) => function (...args) {\n\tconst P = options.promiseModule;\n\n\treturn new P((resolve, reject) => {\n\t\tif (options.multiArgs) {\n\t\t\targs.push((...result) => {\n\t\t\t\tif (options.errorFirst) {\n\t\t\t\t\tif (result[0]) {\n\t\t\t\t\t\treject(result);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tresult.shift();\n\t\t\t\t\t\tresolve(result);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tresolve(result);\n\t\t\t\t}\n\t\t\t});\n\t\t} else if (options.errorFirst) {\n\t\t\targs.push((error, result) => {\n\t\t\t\tif (error) {\n\t\t\t\t\treject(error);\n\t\t\t\t} else {\n\t\t\t\t\tresolve(result);\n\t\t\t\t}\n\t\t\t});\n\t\t} else {\n\t\t\targs.push(resolve);\n\t\t}\n\n\t\tfn.apply(this, args);\n\t});\n};\n\nmodule.exports = (input, options) => {\n\toptions = Object.assign({\n\t\texclude: [/.+(Sync|Stream)$/],\n\t\terrorFirst: true,\n\t\tpromiseModule: Promise\n\t}, options);\n\n\tconst objType = typeof input;\n\tif (!(input !== null && (objType === 'object' || objType === 'function'))) {\n\t\tthrow new TypeError(`Expected \\`input\\` to be a \\`Function\\` or \\`Object\\`, got \\`${input === null ? 'null' : objType}\\``);\n\t}\n\n\tconst filter = key => {\n\t\tconst match = pattern => typeof pattern === 'string' ? key === pattern : pattern.test(key);\n\t\treturn options.include ? options.include.some(match) : !options.exclude.some(match);\n\t};\n\n\tlet ret;\n\tif (objType === 'function') {\n\t\tret = function (...args) {\n\t\t\treturn options.excludeMain ? input(...args) : processFn(input, options).apply(this, args);\n\t\t};\n\t} else {\n\t\tret = Object.create(Object.getPrototypeOf(input));\n\t}\n\n\tfor (const key in input) { // eslint-disable-line guard-for-in\n\t\tconst property = input[key];\n\t\tret[key] = typeof property === 'function' && filter(key) ? processFn(property, options) : property;\n\t}\n\n\treturn ret;\n};\n","// @see https://git-scm.com/docs/git-rev-parse.html#_specifying_revisions\nconst abbreviateRx = new RegExp('^refs/(heads/|tags/|remotes/)?(.*)')\n\nexport function abbreviateRef(ref) {\n const match = abbreviateRx.exec(ref)\n if (match) {\n if (match[1] === 'remotes/' && ref.endsWith('/HEAD')) {\n return match[2].slice(0, -5)\n } else {\n return match[2]\n }\n }\n return ref\n}\n","export * from './AlreadyExistsError.js'\nexport * from './AmbiguousError.js'\n// BaseError.js\nexport * from './CheckoutConflictError.js'\nexport * from './CommitNotFetchedError.js'\nexport * from './EmptyServerResponseError.js'\nexport * from './FastForwardError.js'\nexport * from './GitPushError.js'\nexport * from './HttpError.js'\n// index.js\nexport * from './InternalError.js'\nexport * from './InvalidFilepathError.js'\nexport * from './InvalidOidError.js'\nexport * from './InvalidRefNameError.js'\nexport * from './MaxDepthError.js'\nexport * from './MergeNotSupportedError.js'\nexport * from './MergeConflictError.js'\nexport * from './MissingNameError.js'\nexport * from './MissingParameterError.js'\nexport * from './MultipleGitError.js'\nexport * from './NoRefspecError.js'\nexport * from './NotFoundError.js'\nexport * from './ObjectTypeError.js'\nexport * from './ParseError.js'\nexport * from './PushRejectedError.js'\nexport * from './RemoteCapabilityError.js'\nexport * from './SmartHttpError.js'\nexport * from './UnknownTransportError.js'\nexport * from './UnsafeFilepathError.js'\nexport * from './UrlParseError.js'\nexport * from './UserCanceledError.js'\nexport * from './UnmergedPathsError.js'\nexport * from './IndexResetError.js'\n","import { BaseError } from './BaseError.js'\n\nexport class PushRejectedError extends BaseError {\n /**\n * @param {'not-fast-forward'|'tag-exists'} reason\n */\n constructor(reason) {\n let message = ''\n if (reason === 'not-fast-forward') {\n message = ' because it was not a simple fast-forward'\n } else if (reason === 'tag-exists') {\n message = ' because tag already exists'\n }\n super(`Push rejected${message}. Use \"force: true\" to override.`)\n this.code = this.name = PushRejectedError.code\n this.data = { reason }\n }\n}\n/** @type {'PushRejectedError'} */\nPushRejectedError.code = 'PushRejectedError'\n","// @ts-check\nimport '../typedefs.js'\n\nimport { GitIndexManager } from '../managers/GitIndexManager.js'\nimport { GitRefManager } from '../managers/GitRefManager.js'\nimport { GitCommit } from '../models/GitCommit.js'\nimport { GitTree } from '../models/GitTree.js'\nimport { _writeObject as writeObject } from '../storage/writeObject.js'\nimport { flatFileListToDirectoryStructure } from '../utils/flatFileListToDirectoryStructure.js'\n\n/**\n *\n * @param {Object} args\n * @param {import('../models/FileSystem.js').FileSystem} args.fs\n * @param {object} args.cache\n * @param {SignCallback} [args.onSign]\n * @param {string} args.gitdir\n * @param {string} args.message\n * @param {Object} args.author\n * @param {string} args.author.name\n * @param {string} args.author.email\n * @param {number} args.author.timestamp\n * @param {number} args.author.timezoneOffset\n * @param {Object} args.committer\n * @param {string} args.committer.name\n * @param {string} args.committer.email\n * @param {number} args.committer.timestamp\n * @param {number} args.committer.timezoneOffset\n * @param {string} [args.signingKey]\n * @param {boolean} [args.dryRun = false]\n * @param {boolean} [args.noUpdateBranch = false]\n * @param {string} [args.ref]\n * @param {string[]} [args.parent]\n * @param {string} [args.tree]\n *\n * @returns {Promise<string>} Resolves successfully with the SHA-1 object id of the newly created commit.\n */\nexport async function _commit({\n fs,\n cache,\n onSign,\n gitdir,\n message,\n author,\n committer,\n signingKey,\n dryRun = false,\n noUpdateBranch = false,\n ref,\n parent,\n tree,\n}) {\n if (!ref) {\n ref = await GitRefManager.resolve({\n fs,\n gitdir,\n ref: 'HEAD',\n depth: 2,\n })\n }\n\n return GitIndexManager.acquire(\n { fs, gitdir, cache, allowUnmerged: false },\n async function(index) {\n const inodes = flatFileListToDirectoryStructure(index.entries)\n const inode = inodes.get('.')\n if (!tree) {\n tree = await constructTree({ fs, gitdir, inode, dryRun })\n }\n if (!parent) {\n try {\n parent = [\n await GitRefManager.resolve({\n fs,\n gitdir,\n ref,\n }),\n ]\n } catch (err) {\n // Probably an initial commit\n parent = []\n }\n } else {\n // ensure that the parents are oids, not refs\n parent = await Promise.all(\n parent.map(p => {\n return GitRefManager.resolve({ fs, gitdir, ref: p })\n })\n )\n }\n\n let comm = GitCommit.from({\n tree,\n parent,\n author,\n committer,\n message,\n })\n if (signingKey) {\n comm = await GitCommit.sign(comm, onSign, signingKey)\n }\n const oid = await writeObject({\n fs,\n gitdir,\n type: 'commit',\n object: comm.toObject(),\n dryRun,\n })\n if (!noUpdateBranch && !dryRun) {\n // Update branch pointer\n await GitRefManager.writeRef({\n fs,\n gitdir,\n ref,\n value: oid,\n })\n }\n return oid\n }\n )\n}\n\nasync function constructTree({ fs, gitdir, inode, dryRun }) {\n // use depth first traversal\n const children = inode.children\n for (const inode of children) {\n if (inode.type === 'tree') {\n inode.metadata.mode = '040000'\n inode.metadata.oid = await constructTree({ fs, gitdir, inode, dryRun })\n }\n }\n const entries = children.map(inode => ({\n mode: inode.metadata.mode,\n path: inode.basename,\n oid: inode.metadata.oid,\n type: inode.type,\n }))\n const tree = GitTree.from(entries)\n const oid = await writeObject({\n fs,\n gitdir,\n type: 'tree',\n object: tree.toObject(),\n dryRun,\n })\n return oid\n}\n","'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nmodule.exports = {\n 2: 'need dictionary', /* Z_NEED_DICT 2 */\n 1: 'stream end', /* Z_STREAM_END 1 */\n 0: '', /* Z_OK 0 */\n '-1': 'file error', /* Z_ERRNO (-1) */\n '-2': 'stream error', /* Z_STREAM_ERROR (-2) */\n '-3': 'data error', /* Z_DATA_ERROR (-3) */\n '-4': 'insufficient memory', /* Z_MEM_ERROR (-4) */\n '-5': 'buffer error', /* Z_BUF_ERROR (-5) */\n '-6': 'incompatible version' /* Z_VERSION_ERROR (-6) */\n};\n","import { BaseError } from './BaseError.js'\n\nexport class AmbiguousError extends BaseError {\n /**\n * @param {'oids'|'refs'} nouns\n * @param {string} short\n * @param {string[]} matches\n */\n constructor(nouns, short, matches) {\n super(\n `Found multiple ${nouns} matching \"${short}\" (${matches.join(\n ', '\n )}). Use a longer abbreviation length to disambiguate them.`\n )\n this.code = this.name = AmbiguousError.code\n this.data = { nouns, short, matches }\n }\n}\n/** @type {'AmbiguousError'} */\nAmbiguousError.code = 'AmbiguousError'\n","import { BaseError } from './BaseError.js'\n\nexport class CheckoutConflictError extends BaseError {\n /**\n * @param {string[]} filepaths\n */\n constructor(filepaths) {\n super(\n `Your local changes to the following files would be overwritten by checkout: ${filepaths.join(\n ', '\n )}`\n )\n this.code = this.name = CheckoutConflictError.code\n this.data = { filepaths }\n }\n}\n/** @type {'CheckoutConflictError'} */\nCheckoutConflictError.code = 'CheckoutConflictError'\n","import { BaseError } from './BaseError.js'\n\nexport class CommitNotFetchedError extends BaseError {\n /**\n * @param {string} ref\n * @param {string} oid\n */\n constructor(ref, oid) {\n super(\n `Failed to checkout \"${ref}\" because commit ${oid} is not available locally. Do a git fetch to make the branch available locally.`\n )\n this.code = this.name = CommitNotFetchedError.code\n this.data = { ref, oid }\n }\n}\n/** @type {'CommitNotFetchedError'} */\nCommitNotFetchedError.code = 'CommitNotFetchedError'\n","import { BaseError } from './BaseError.js'\n\nexport class FastForwardError extends BaseError {\n constructor() {\n super(`A simple fast-forward merge was not possible.`)\n this.code = this.name = FastForwardError.code\n this.data = {}\n }\n}\n/** @type {'FastForwardError'} */\nFastForwardError.code = 'FastForwardError'\n","import '../typedefs.js'\nimport { BaseError } from './BaseError.js'\n\nexport class GitPushError extends BaseError {\n /**\n * @param {string} prettyDetails\n * @param {PushResult} result\n */\n constructor(prettyDetails, result) {\n super(`One or more branches were not updated: ${prettyDetails}`)\n this.code = this.name = GitPushError.code\n this.data = { prettyDetails, result }\n }\n}\n/** @type {'GitPushError'} */\nGitPushError.code = 'GitPushError'\n","import { BaseError } from './BaseError.js'\n\nexport class MaxDepthError extends BaseError {\n /**\n * @param {number} depth\n */\n constructor(depth) {\n super(`Maximum search depth of ${depth} exceeded.`)\n this.code = this.name = MaxDepthError.code\n this.data = { depth }\n }\n}\n/** @type {'MaxDepthError'} */\nMaxDepthError.code = 'MaxDepthError'\n","import { BaseError } from './BaseError.js'\n\nexport class MultipleGitError extends BaseError {\n /**\n * @param {Error[]} errors\n * @param {string} message\n */\n constructor(errors) {\n super(\n `There are multiple errors that were thrown by the method. Please refer to the \"errors\" property to see more`\n )\n this.code = this.name = MultipleGitError.code\n this.data = { errors }\n this.errors = errors\n }\n}\n/** @type {'MultipleGitError'} */\nMultipleGitError.code = 'MultipleGitError'\n","import { BaseError } from './BaseError.js'\n\nexport class IndexResetError extends BaseError {\n /**\n * @param {Array<string>} filepaths\n */\n constructor(filepath) {\n super(\n `Could not merge index: Entry for '${filepath}' is not up to date. Either reset the index entry to HEAD, or stage your unstaged chages.`\n )\n this.code = this.name = IndexResetError.code\n this.data = { filepath }\n }\n}\n/** @type {'IndexResetError'} */\nIndexResetError.code = 'IndexResetError'\n","import { InternalError } from '../errors/InternalError.js'\nimport { UnsafeFilepathError } from '../errors/UnsafeFilepathError.js'\nimport { BufferCursor } from '../utils/BufferCursor.js'\nimport { comparePath } from '../utils/comparePath.js'\nimport { normalizeStats } from '../utils/normalizeStats.js'\nimport { shasum } from '../utils/shasum.js'\n\n// Extract 1-bit assume-valid, 1-bit extended flag, 2-bit merge state flag, 12-bit path length flag\nfunction parseCacheEntryFlags(bits) {\n return {\n assumeValid: Boolean(bits & 0b1000000000000000),\n extended: Boolean(bits & 0b0100000000000000),\n stage: (bits & 0b0011000000000000) >> 12,\n nameLength: bits & 0b0000111111111111,\n }\n}\n\nfunction renderCacheEntryFlags(entry) {\n const flags = entry.flags\n // 1-bit extended flag (must be zero in version 2)\n flags.extended = false\n // 12-bit name length if the length is less than 0xFFF; otherwise 0xFFF\n // is stored in this field.\n flags.nameLength = Math.min(Buffer.from(entry.path).length, 0xfff)\n return (\n (flags.assumeValid ? 0b1000000000000000 : 0) +\n (flags.extended ? 0b0100000000000000 : 0) +\n ((flags.stage & 0b11) << 12) +\n (flags.nameLength & 0b111111111111)\n )\n}\n\nexport class GitIndex {\n /*::\n _entries: Map<string, CacheEntry>\n _dirty: boolean // Used to determine if index needs to be saved to filesystem\n */\n constructor(entries, unmergedPaths) {\n this._dirty = false\n this._unmergedPaths = unmergedPaths || new Set()\n this._entries = entries || new Map()\n }\n\n _addEntry(entry) {\n if (entry.flags.stage === 0) {\n entry.stages = [entry]\n this._entries.set(entry.path, entry)\n this._unmergedPaths.delete(entry.path)\n } else {\n let existingEntry = this._entries.get(entry.path)\n if (!existingEntry) {\n this._entries.set(entry.path, entry)\n existingEntry = entry\n }\n existingEntry.stages[entry.flags.stage] = entry\n this._unmergedPaths.add(entry.path)\n }\n }\n\n static async from(buffer) {\n if (Buffer.isBuffer(buffer)) {\n return GitIndex.fromBuffer(buffer)\n } else if (buffer === null) {\n return new GitIndex(null)\n } else {\n throw new InternalError('invalid type passed to GitIndex.from')\n }\n }\n\n static async fromBuffer(buffer) {\n if (buffer.length === 0) {\n throw new InternalError('Index file is empty (.git/index)')\n }\n\n const index = new GitIndex()\n const reader = new BufferCursor(buffer)\n const magic = reader.toString('utf8', 4)\n if (magic !== 'DIRC') {\n throw new InternalError(`Invalid dircache magic file number: ${magic}`)\n }\n\n // Verify shasum after we ensured that the file has a magic number\n const shaComputed = await shasum(buffer.slice(0, -20))\n const shaClaimed = buffer.slice(-20).toString('hex')\n if (shaClaimed !== shaComputed) {\n throw new InternalError(\n `Invalid checksum in GitIndex buffer: expected ${shaClaimed} but saw ${shaComputed}`\n )\n }\n\n const version = reader.readUInt32BE()\n if (version !== 2) {\n throw new InternalError(`Unsupported dircache version: ${version}`)\n }\n const numEntries = reader.readUInt32BE()\n let i = 0\n while (!reader.eof() && i < numEntries) {\n const entry = {}\n entry.ctimeSeconds = reader.readUInt32BE()\n entry.ctimeNanoseconds = reader.readUInt32BE()\n entry.mtimeSeconds = reader.readUInt32BE()\n entry.mtimeNanoseconds = reader.readUInt32BE()\n entry.dev = reader.readUInt32BE()\n entry.ino = reader.readUInt32BE()\n entry.mode = reader.readUInt32BE()\n entry.uid = reader.readUInt32BE()\n entry.gid = reader.readUInt32BE()\n entry.size = reader.readUInt32BE()\n entry.oid = reader.slice(20).toString('hex')\n const flags = reader.readUInt16BE()\n entry.flags = parseCacheEntryFlags(flags)\n // TODO: handle if (version === 3 && entry.flags.extended)\n const pathlength = buffer.indexOf(0, reader.tell() + 1) - reader.tell()\n if (pathlength < 1) {\n throw new InternalError(`Got a path length of: ${pathlength}`)\n }\n // TODO: handle pathnames larger than 12 bits\n entry.path = reader.toString('utf8', pathlength)\n\n // Prevent malicious paths like \"..\\foo\"\n if (entry.path.includes('..\\\\') || entry.path.includes('../')) {\n throw new UnsafeFilepathError(entry.path)\n }\n\n // The next bit is awkward. We expect 1 to 8 null characters\n // such that the total size of the entry is a multiple of 8 bits.\n // (Hence subtract 12 bytes for the header.)\n let padding = 8 - ((reader.tell() - 12) % 8)\n if (padding === 0) padding = 8\n while (padding--) {\n const tmp = reader.readUInt8()\n if (tmp !== 0) {\n throw new InternalError(\n `Expected 1-8 null characters but got '${tmp}' after ${entry.path}`\n )\n } else if (reader.eof()) {\n throw new InternalError('Unexpected end of file')\n }\n }\n // end of awkward part\n entry.stages = []\n\n index._addEntry(entry)\n\n i++\n }\n return index\n }\n\n get unmergedPaths() {\n return [...this._unmergedPaths]\n }\n\n get entries() {\n return [...this._entries.values()].sort(comparePath)\n }\n\n get entriesMap() {\n return this._entries\n }\n\n get entriesFlat() {\n return [...this.entries].flatMap(entry => {\n return entry.stages.length > 1 ? entry.stages.filter(x => x) : entry\n })\n }\n\n *[Symbol.iterator]() {\n for (const entry of this.entries) {\n yield entry\n }\n }\n\n insert({ filepath, stats, oid, stage = 0 }) {\n if (!stats) {\n stats = {\n ctimeSeconds: 0,\n ctimeNanoseconds: 0,\n mtimeSeconds: 0,\n mtimeNanoseconds: 0,\n dev: 0,\n ino: 0,\n mode: 0,\n uid: 0,\n gid: 0,\n size: 0,\n }\n }\n stats = normalizeStats(stats)\n const bfilepath = Buffer.from(filepath)\n const entry = {\n ctimeSeconds: stats.ctimeSeconds,\n ctimeNanoseconds: stats.ctimeNanoseconds,\n mtimeSeconds: stats.mtimeSeconds,\n mtimeNanoseconds: stats.mtimeNanoseconds,\n dev: stats.dev,\n ino: stats.ino,\n // We provide a fallback value for `mode` here because not all fs\n // implementations assign it, but we use it in GitTree.\n // '100644' is for a \"regular non-executable file\"\n mode: stats.mode || 0o100644,\n uid: stats.uid,\n gid: stats.gid,\n size: stats.size,\n path: filepath,\n oid: oid,\n flags: {\n assumeValid: false,\n extended: false,\n stage,\n nameLength: bfilepath.length < 0xfff ? bfilepath.length : 0xfff,\n },\n stages: [],\n }\n\n this._addEntry(entry)\n\n this._dirty = true\n }\n\n delete({ filepath }) {\n if (this._entries.has(filepath)) {\n this._entries.delete(filepath)\n } else {\n for (const key of this._entries.keys()) {\n if (key.startsWith(filepath + '/')) {\n this._entries.delete(key)\n }\n }\n }\n\n if (this._unmergedPaths.has(filepath)) {\n this._unmergedPaths.delete(filepath)\n }\n this._dirty = true\n }\n\n clear() {\n this._entries.clear()\n this._dirty = true\n }\n\n has({ filepath }) {\n return this._entries.has(filepath)\n }\n\n render() {\n return this.entries\n .map(entry => `${entry.mode.toString(8)} ${entry.oid} ${entry.path}`)\n .join('\\n')\n }\n\n static async _entryToBuffer(entry) {\n const bpath = Buffer.from(entry.path)\n // the fixed length + the filename + at least one null char => align by 8\n const length = Math.ceil((62 + bpath.length + 1) / 8) * 8\n const written = Buffer.alloc(length)\n const writer = new BufferCursor(written)\n const stat = normalizeStats(entry)\n writer.writeUInt32BE(stat.ctimeSeconds)\n writer.writeUInt32BE(stat.ctimeNanoseconds)\n writer.writeUInt32BE(stat.mtimeSeconds)\n writer.writeUInt32BE(stat.mtimeNanoseconds)\n writer.writeUInt32BE(stat.dev)\n writer.writeUInt32BE(stat.ino)\n writer.writeUInt32BE(stat.mode)\n writer.writeUInt32BE(stat.uid)\n writer.writeUInt32BE(stat.gid)\n writer.writeUInt32BE(stat.size)\n writer.write(entry.oid, 20, 'hex')\n writer.writeUInt16BE(renderCacheEntryFlags(entry))\n writer.write(entry.path, bpath.length, 'utf8')\n return written\n }\n\n async toObject() {\n const header = Buffer.alloc(12)\n const writer = new BufferCursor(header)\n writer.write('DIRC', 4, 'utf8')\n writer.writeUInt32BE(2)\n writer.writeUInt32BE(this.entriesFlat.length)\n\n let entryBuffers = []\n for (const entry of this.entries) {\n entryBuffers.push(GitIndex._entryToBuffer(entry))\n if (entry.stages.length > 1) {\n for (const stage of entry.stages) {\n if (stage && stage !== entry) {\n entryBuffers.push(GitIndex._entryToBuffer(stage))\n }\n }\n }\n }\n entryBuffers = await Promise.all(entryBuffers)\n\n const body = Buffer.concat(entryBuffers)\n const main = Buffer.concat([header, body])\n const sum = await shasum(main)\n return Buffer.concat([main, Buffer.from(sum, 'hex')])\n }\n}\n","import { basename } from '../utils/basename.js'\nimport { dirname } from '../utils/dirname.js'\n\n/*::\ntype Node = {\n type: string,\n fullpath: string,\n basename: string,\n metadata: Object, // mode, oid\n parent?: Node,\n children: Array<Node>\n}\n*/\n\nexport function flatFileListToDirectoryStructure(files) {\n const inodes = new Map()\n const mkdir = function(name) {\n if (!inodes.has(name)) {\n const dir = {\n type: 'tree',\n fullpath: name,\n basename: basename(name),\n metadata: {},\n children: [],\n }\n inodes.set(name, dir)\n // This recursively generates any missing parent folders.\n // We do it after we've added the inode to the set so that\n // we don't recurse infinitely trying to create the root '.' dirname.\n dir.parent = mkdir(dirname(name))\n if (dir.parent && dir.parent !== dir) dir.parent.children.push(dir)\n }\n return inodes.get(name)\n }\n\n const mkfile = function(name, metadata) {\n if (!inodes.has(name)) {\n const file = {\n type: 'blob',\n fullpath: name,\n basename: basename(name),\n metadata: metadata,\n // This recursively generates any missing parent folders.\n parent: mkdir(dirname(name)),\n children: [],\n }\n if (file.parent) file.parent.children.push(file)\n inodes.set(name, file)\n }\n return inodes.get(name)\n }\n\n mkdir('.')\n for (const file of files) {\n mkfile(file.path, file)\n }\n return inodes\n}\n","// This is straight from parse_unit_factor in config.c of canonical git\nconst num = val => {\n val = val.toLowerCase()\n let n = parseInt(val)\n if (val.endsWith('k')) n *= 1024\n if (val.endsWith('m')) n *= 1024 * 1024\n if (val.endsWith('g')) n *= 1024 * 1024 * 1024\n return n\n}\n\n// This is straight from git_parse_maybe_bool_text in config.c of canonical git\nconst bool = val => {\n val = val.trim().toLowerCase()\n if (val === 'true' || val === 'yes' || val === 'on') return true\n if (val === 'false' || val === 'no' || val === 'off') return false\n throw Error(\n `Expected 'true', 'false', 'yes', 'no', 'on', or 'off', but got ${val}`\n )\n}\n\nconst schema = {\n core: {\n filemode: bool,\n bare: bool,\n logallrefupdates: bool,\n symlinks: bool,\n ignorecase: bool,\n bigFileThreshold: num,\n },\n}\n\n// https://git-scm.com/docs/git-config#_syntax\n\n// section starts with [ and ends with ]\n// section is alphanumeric (ASCII) with - and .\n// section is case insensitive\n// subsection is optionnal\n// subsection is specified after section and one or more spaces\n// subsection is specified between double quotes\nconst SECTION_LINE_REGEX = /^\\[([A-Za-z0-9-.]+)(?: \"(.*)\")?\\]$/\nconst SECTION_REGEX = /^[A-Za-z0-9-.]+$/\n\n// variable lines contain a name, and equal sign and then a value\n// variable lines can also only contain a name (the implicit value is a boolean true)\n// variable name is alphanumeric (ASCII) with -\n// variable name starts with an alphabetic character\n// variable name is case insensitive\nconst VARIABLE_LINE_REGEX = /^([A-Za-z][A-Za-z-]*)(?: *= *(.*))?$/\nconst VARIABLE_NAME_REGEX = /^[A-Za-z][A-Za-z-]*$/\n\nconst VARIABLE_VALUE_COMMENT_REGEX = /^(.*?)( *[#;].*)$/\n\nconst extractSectionLine = line => {\n const matches = SECTION_LINE_REGEX.exec(line)\n if (matches != null) {\n const [section, subsection] = matches.slice(1)\n return [section, subsection]\n }\n return null\n}\n\nconst extractVariableLine = line => {\n const matches = VARIABLE_LINE_REGEX.exec(line)\n if (matches != null) {\n const [name, rawValue = 'true'] = matches.slice(1)\n const valueWithoutComments = removeComments(rawValue)\n const valueWithoutQuotes = removeQuotes(valueWithoutComments)\n return [name, valueWithoutQuotes]\n }\n return null\n}\n\nconst removeComments = rawValue => {\n const commentMatches = VARIABLE_VALUE_COMMENT_REGEX.exec(rawValue)\n if (commentMatches == null) {\n return rawValue\n }\n const [valueWithoutComment, comment] = commentMatches.slice(1)\n // if odd number of quotes before and after comment => comment is escaped\n if (\n hasOddNumberOfQuotes(valueWithoutComment) &&\n hasOddNumberOfQuotes(comment)\n ) {\n return `${valueWithoutComment}${comment}`\n }\n return valueWithoutComment\n}\n\nconst hasOddNumberOfQuotes = text => {\n const numberOfQuotes = (text.match(/(?:^|[^\\\\])\"/g) || []).length\n return numberOfQuotes % 2 !== 0\n}\n\nconst removeQuotes = text => {\n return text.split('').reduce((newText, c, idx, text) => {\n const isQuote = c === '\"' && text[idx - 1] !== '\\\\'\n const isEscapeForQuote = c === '\\\\' && text[idx + 1] === '\"'\n if (isQuote || isEscapeForQuote) {\n return newText\n }\n return newText + c\n }, '')\n}\n\nconst lower = text => {\n return text != null ? text.toLowerCase() : null\n}\n\nconst getPath = (section, subsection, name) => {\n return [lower(section), subsection, lower(name)]\n .filter(a => a != null)\n .join('.')\n}\n\nconst normalizePath = path => {\n const pathSegments = path.split('.')\n const section = pathSegments.shift()\n const name = pathSegments.pop()\n const subsection = pathSegments.length ? pathSegments.join('.') : undefined\n\n return {\n section,\n subsection,\n name,\n path: getPath(section, subsection, name),\n sectionPath: getPath(section, subsection, null),\n }\n}\n\nconst findLastIndex = (array, callback) => {\n return array.reduce((lastIndex, item, index) => {\n return callback(item) ? index : lastIndex\n }, -1)\n}\n\n// Note: there are a LOT of edge cases that aren't covered (e.g. keys in sections that also\n// have subsections, [include] directives, etc.\nexport class GitConfig {\n constructor(text) {\n let section = null\n let subsection = null\n this.parsedConfig = text.split('\\n').map(line => {\n let name = null\n let value = null\n\n const trimmedLine = line.trim()\n const extractedSection = extractSectionLine(trimmedLine)\n const isSection = extractedSection != null\n if (isSection) {\n ;[section, subsection] = extractedSection\n } else {\n const extractedVariable = extractVariableLine(trimmedLine)\n const isVariable = extractedVariable != null\n if (isVariable) {\n ;[name, value] = extractedVariable\n }\n }\n\n const path = getPath(section, subsection, name)\n return { line, isSection, section, subsection, name, value, path }\n })\n }\n\n static from(text) {\n return new GitConfig(text)\n }\n\n async get(path, getall = false) {\n const normalizedPath = normalizePath(path).path\n const allValues = this.parsedConfig\n .filter(config => config.path === normalizedPath)\n .map(({ section, name, value }) => {\n const fn = schema[section] && schema[section][name]\n return fn ? fn(value) : value\n })\n return getall ? allValues : allValues.pop()\n }\n\n async getall(path) {\n return this.get(path, true)\n }\n\n async getSubsections(section) {\n return this.parsedConfig\n .filter(config => config.section === section && config.isSection)\n .map(config => config.subsection)\n }\n\n async deleteSection(section, subsection) {\n this.parsedConfig = this.parsedConfig.filter(\n config =>\n !(config.section === section && config.subsection === subsection)\n )\n }\n\n async append(path, value) {\n return this.set(path, value, true)\n }\n\n async set(path, value, append = false) {\n const {\n section,\n subsection,\n name,\n path: normalizedPath,\n sectionPath,\n } = normalizePath(path)\n const configIndex = findLastIndex(\n this.parsedConfig,\n config => config.path === normalizedPath\n )\n if (value == null) {\n if (configIndex !== -1) {\n this.parsedConfig.splice(configIndex, 1)\n }\n } else {\n if (configIndex !== -1) {\n const config = this.parsedConfig[configIndex]\n // Name should be overwritten in case the casing changed\n const modifiedConfig = Object.assign({}, config, {\n name,\n value,\n modified: true,\n })\n if (append) {\n this.parsedConfig.splice(configIndex + 1, 0, modifiedConfig)\n } else {\n this.parsedConfig[configIndex] = modifiedConfig\n }\n } else {\n const sectionIndex = this.parsedConfig.findIndex(\n config => config.path === sectionPath\n )\n const newConfig = {\n section,\n subsection,\n name,\n value,\n modified: true,\n path: normalizedPath,\n }\n if (SECTION_REGEX.test(section) && VARIABLE_NAME_REGEX.test(name)) {\n if (sectionIndex >= 0) {\n // Reuse existing section\n this.parsedConfig.splice(sectionIndex + 1, 0, newConfig)\n } else {\n // Add a new section\n const newSection = {\n section,\n subsection,\n modified: true,\n path: sectionPath,\n }\n this.parsedConfig.push(newSection, newConfig)\n }\n }\n }\n }\n }\n\n toString() {\n return this.parsedConfig\n .map(({ line, section, subsection, name, value, modified = false }) => {\n if (!modified) {\n return line\n }\n if (name != null && value != null) {\n if (typeof value === 'string' && /[#;]/.test(value)) {\n // A `#` or `;` symbol denotes a comment, so we have to wrap it in double quotes\n return `\\t${name} = \"${value}\"`\n }\n return `\\t${name} = ${value}`\n }\n if (subsection != null) {\n return `[${section} \"${subsection}\"]`\n }\n return `[${section}]`\n })\n .join('\\n')\n }\n}\n","import { GitRefSpec } from './GitRefSpec'\n\nexport class GitRefSpecSet {\n constructor(rules = []) {\n this.rules = rules\n }\n\n static from(refspecs) {\n const rules = []\n for (const refspec of refspecs) {\n rules.push(GitRefSpec.from(refspec)) // might throw\n }\n return new GitRefSpecSet(rules)\n }\n\n add(refspec) {\n const rule = GitRefSpec.from(refspec) // might throw\n this.rules.push(rule)\n }\n\n translate(remoteRefs) {\n const result = []\n for (const rule of this.rules) {\n for (const remoteRef of remoteRefs) {\n const localRef = rule.translate(remoteRef)\n if (localRef) {\n result.push([remoteRef, localRef])\n }\n }\n }\n return result\n }\n\n translateOne(remoteRef) {\n let result = null\n for (const rule of this.rules) {\n const localRef = rule.translate(remoteRef)\n if (localRef) {\n result = localRef\n }\n }\n return result\n }\n\n localNamespaces() {\n return this.rules\n .filter(rule => rule.matchPrefix)\n .map(rule => rule.localPath.replace(/\\/$/, ''))\n }\n}\n","import { InternalError } from '../errors/InternalError.js'\nimport { readPackIndex } from '../storage/readPackIndex.js'\nimport { join } from '../utils/join.js'\n\nexport async function readObjectPacked({\n fs,\n cache,\n gitdir,\n oid,\n format = 'content',\n getExternalRefDelta,\n}) {\n // Check to see if it's in a packfile.\n // Iterate through all the .idx files\n let list = await fs.readdir(join(gitdir, 'objects/pack'))\n list = list.filter(x => x.endsWith('.idx'))\n for (const filename of list) {\n const indexFile = `${gitdir}/objects/pack/${filename}`\n const p = await readPackIndex({\n fs,\n cache,\n filename: indexFile,\n getExternalRefDelta,\n })\n if (p.error) throw new InternalError(p.error)\n // If the packfile DOES have the oid we're looking for...\n if (p.offsets.has(oid)) {\n // Get the resolved git object from the packfile\n if (!p.pack) {\n const packFile = indexFile.replace(/idx$/, 'pack')\n p.pack = fs.read(packFile)\n }\n const result = await p.read({ oid, getExternalRefDelta })\n result.format = 'content'\n result.source = `objects/pack/${filename.replace(/idx$/, 'pack')}`\n return result\n }\n }\n // Failed to find it\n return null\n}\n","import diff3Merge from 'diff3'\n\nconst LINEBREAKS = /^.*(\\r?\\n|$)/gm\n\nexport function mergeFile({ branches, contents }) {\n const ourName = branches[1]\n const theirName = branches[2]\n\n const baseContent = contents[0]\n const ourContent = contents[1]\n const theirContent = contents[2]\n\n const ours = ourContent.match(LINEBREAKS)\n const base = baseContent.match(LINEBREAKS)\n const theirs = theirContent.match(LINEBREAKS)\n\n // Here we let the diff3 library do the heavy lifting.\n const result = diff3Merge(ours, base, theirs)\n\n const markerSize = 7\n\n // Here we note whether there are conflicts and format the results\n let mergedText = ''\n let cleanMerge = true\n\n for (const item of result) {\n if (item.ok) {\n mergedText += item.ok.join('')\n }\n if (item.conflict) {\n cleanMerge = false\n mergedText += `${'<'.repeat(markerSize)} ${ourName}\\n`\n mergedText += item.conflict.a.join('')\n\n mergedText += `${'='.repeat(markerSize)}\\n`\n mergedText += item.conflict.b.join('')\n mergedText += `${'>'.repeat(markerSize)} ${theirName}\\n`\n }\n }\n return { cleanMerge, mergedText }\n}\n","import Hash from 'sha.js/sha1.js'\n\nimport { types } from '../commands/types.js'\nimport { _readObject as readObject } from '../storage/readObject.js'\nimport { deflate } from '../utils/deflate.js'\nimport { join } from '../utils/join.js'\nimport { padHex } from '../utils/padHex.js'\n\n/**\n * @param {object} args\n * @param {import('../models/FileSystem.js').FileSystem} args.fs\n * @param {any} args.cache\n * @param {string} [args.dir] - The [working tree](dir-vs-gitdir.md) directory path\n * @param {string} [args.gitdir=join(dir, '.git')] - [required] The [git directory](dir-vs-gitdir.md) path\n * @param {string[]} args.oids\n */\nexport async function _pack({\n fs,\n cache,\n dir,\n gitdir = join(dir, '.git'),\n oids,\n}) {\n const hash = new Hash()\n const outputStream = []\n function write(chunk, enc) {\n const buff = Buffer.from(chunk, enc)\n outputStream.push(buff)\n hash.update(buff)\n }\n async function writeObject({ stype, object }) {\n // Object type is encoded in bits 654\n const type = types[stype]\n // The length encoding gets complicated.\n let length = object.length\n // Whether the next byte is part of the variable-length encoded number\n // is encoded in bit 7\n let multibyte = length > 0b1111 ? 0b10000000 : 0b0\n // Last four bits of length is encoded in bits 3210\n const lastFour = length & 0b1111\n // Discard those bits\n length = length >>> 4\n // The first byte is then (1-bit multibyte?), (3-bit type), (4-bit least sig 4-bits of length)\n let byte = (multibyte | type | lastFour).toString(16)\n write(byte, 'hex')\n // Now we keep chopping away at length 7-bits at a time until its zero,\n // writing out the bytes in what amounts to little-endian order.\n while (multibyte) {\n multibyte = length > 0b01111111 ? 0b10000000 : 0b0\n byte = multibyte | (length & 0b01111111)\n write(padHex(2, byte), 'hex')\n length = length >>> 7\n }\n // Lastly, we can compress and write the object.\n write(Buffer.from(await deflate(object)))\n }\n write('PACK')\n write('00000002', 'hex')\n // Write a 4 byte (32-bit) int\n write(padHex(8, oids.length), 'hex')\n for (const oid of oids) {\n const { type, object } = await readObject({ fs, cache, gitdir, oid })\n await writeObject({ write, object, stype: type })\n }\n // Write SHA1 checksum\n const digest = hash.digest()\n outputStream.push(digest)\n return outputStream\n}\n","// TODO: Should I just polyfill Array.flat?\nexport const flat =\n typeof Array.prototype.flat === 'undefined'\n ? entries => entries.reduce((acc, x) => acc.concat(x), [])\n : entries => entries.flat()\n","import { GitAnnotatedTag } from '../models/GitAnnotatedTag.js'\nimport { GitCommit } from '../models/GitCommit.js'\nimport { GitTree } from '../models/GitTree.js'\nimport { _readObject as readObject } from '../storage/readObject.js'\nimport { join } from '../utils/join.js'\n\n/**\n * @param {object} args\n * @param {import('../models/FileSystem.js').FileSystem} args.fs\n * @param {any} args.cache\n * @param {string} [args.dir]\n * @param {string} args.gitdir\n * @param {Iterable<string>} args.oids\n * @returns {Promise<Set<string>>}\n */\nexport async function listObjects({\n fs,\n cache,\n dir,\n gitdir = join(dir, '.git'),\n oids,\n}) {\n const visited = new Set()\n // We don't do the purest simplest recursion, because we can\n // avoid reading Blob objects entirely since the Tree objects\n // tell us which oids are Blobs and which are Trees.\n async function walk(oid) {\n if (visited.has(oid)) return\n visited.add(oid)\n const { type, object } = await readObject({ fs, cache, gitdir, oid })\n if (type === 'tag') {\n const tag = GitAnnotatedTag.from(object)\n const obj = tag.headers().object\n await walk(obj)\n } else if (type === 'commit') {\n const commit = GitCommit.from(object)\n const tree = commit.headers().tree\n await walk(tree)\n } else if (type === 'tree') {\n const tree = GitTree.from(object)\n for (const entry of tree) {\n // add blobs to the set\n // skip over submodules whose type is 'commit'\n if (entry.type === 'blob') {\n visited.add(entry.oid)\n }\n // recurse for trees\n if (entry.type === 'tree') {\n await walk(entry.oid)\n }\n }\n }\n }\n // Let's go walking!\n for (const oid of oids) {\n await walk(oid)\n }\n return visited\n}\n","import { join } from './join'\n\n/**\n * Removes the directory at the specified filepath recursively. Used internally to replicate the behavior of\n * fs.promises.rm({ recursive: true, force: true }) from Node.js 14 and above when not available. If the provided\n * filepath resolves to a file, it will be removed.\n *\n * @param {import('../models/FileSystem.js').FileSystem} fs\n * @param {string} filepath - The file or directory to remove.\n */\nexport async function rmRecursive(fs, filepath) {\n const entries = await fs.readdir(filepath)\n if (entries == null) {\n await fs.rm(filepath)\n } else if (entries.length) {\n await Promise.all(\n entries.map(entry => {\n const subpath = join(filepath, entry)\n return fs.lstat(subpath).then(stat => {\n if (!stat) return\n return stat.isDirectory() ? rmRecursive(fs, subpath) : fs.rm(subpath)\n })\n })\n ).then(() => fs.rmdir(filepath))\n } else {\n await fs.rmdir(filepath)\n }\n}\n","export function extractAuthFromUrl(url) {\n // For whatever reason, the `fetch` API does not convert credentials embedded in the URL\n // into Basic Authentication headers automatically. Instead it throws an error!\n // So we must manually parse the URL, rip out the user:password portion if it is present\n // and compute the Authorization header.\n // Note: I tried using new URL(url) but that throws a security exception in Edge. :rolleyes:\n let userpass = url.match(/^https?:\\/\\/([^/]+)@/)\n // No credentials, return the url unmodified and an empty auth object\n if (userpass == null) return { url, auth: {} }\n userpass = userpass[1]\n const [username, password] = userpass.split(':')\n // Remove credentials from URL\n url = url.replace(`${userpass}@`, '')\n // Has credentials, return the fetch-safe URL and the parsed credentials\n return { url, auth: { username, password } }\n}\n","// shim for using process in browser\nvar process = module.exports = {};\n\n// cached from whatever global is present so that test runners that stub it\n// don't break things. But we need to wrap it in a try catch in case it is\n// wrapped in strict mode code which doesn't define any globals. It's inside a\n// function because try/catches deoptimize in certain engines.\n\nvar cachedSetTimeout;\nvar cachedClearTimeout;\n\nfunction defaultSetTimout() {\n throw new Error('setTimeout has not been defined');\n}\nfunction defaultClearTimeout () {\n throw new Error('clearTimeout has not been defined');\n}\n(function () {\n try {\n if (typeof setTimeout === 'function') {\n cachedSetTimeout = setTimeout;\n } else {\n cachedSetTimeout = defaultSetTimout;\n }\n } catch (e) {\n cachedSetTimeout = defaultSetTimout;\n }\n try {\n if (typeof clearTimeout === 'function') {\n cachedClearTimeout = clearTimeout;\n } else {\n cachedClearTimeout = defaultClearTimeout;\n }\n } catch (e) {\n cachedClearTimeout = defaultClearTimeout;\n }\n} ())\nfunction runTimeout(fun) {\n if (cachedSetTimeout === setTimeout) {\n //normal enviroments in sane situations\n return setTimeout(fun, 0);\n }\n // if setTimeout wasn't available but was latter defined\n if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {\n cachedSetTimeout = setTimeout;\n return setTimeout(fun, 0);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedSetTimeout(fun, 0);\n } catch(e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedSetTimeout.call(null, fun, 0);\n } catch(e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error\n return cachedSetTimeout.call(this, fun, 0);\n }\n }\n\n\n}\nfunction runClearTimeout(marker) {\n if (cachedClearTimeout === clearTimeout) {\n //normal enviroments in sane situations\n return clearTimeout(marker);\n }\n // if clearTimeout wasn't available but was latter defined\n if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {\n cachedClearTimeout = clearTimeout;\n return clearTimeout(marker);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedClearTimeout(marker);\n } catch (e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedClearTimeout.call(null, marker);\n } catch (e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.\n // Some versions of I.E. have different rules for clearTimeout vs setTimeout\n return cachedClearTimeout.call(this, marker);\n }\n }\n\n\n\n}\nvar queue = [];\nvar draining = false;\nvar currentQueue;\nvar queueIndex = -1;\n\nfunction cleanUpNextTick() {\n if (!draining || !currentQueue) {\n return;\n }\n draining = false;\n if (currentQueue.length) {\n queue = currentQueue.concat(queue);\n } else {\n queueIndex = -1;\n }\n if (queue.length) {\n drainQueue();\n }\n}\n\nfunction drainQueue() {\n if (draining) {\n return;\n }\n var timeout = runTimeout(cleanUpNextTick);\n draining = true;\n\n var len = queue.length;\n while(len) {\n currentQueue = queue;\n queue = [];\n while (++queueIndex < len) {\n if (currentQueue) {\n currentQueue[queueIndex].run();\n }\n }\n queueIndex = -1;\n len = queue.length;\n }\n currentQueue = null;\n draining = false;\n runClearTimeout(timeout);\n}\n\nprocess.nextTick = function (fun) {\n var args = new Array(arguments.length - 1);\n if (arguments.length > 1) {\n for (var i = 1; i < arguments.length; i++) {\n args[i - 1] = arguments[i];\n }\n }\n queue.push(new Item(fun, args));\n if (queue.length === 1 && !draining) {\n runTimeout(drainQueue);\n }\n};\n\n// v8 likes predictible objects\nfunction Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}\nItem.prototype.run = function () {\n this.fun.apply(null, this.array);\n};\nprocess.title = 'browser';\nprocess.browser = true;\nprocess.env = {};\nprocess.argv = [];\nprocess.version = ''; // empty string to avoid regexp issues\nprocess.versions = {};\n\nfunction noop() {}\n\nprocess.on = noop;\nprocess.addListener = noop;\nprocess.once = noop;\nprocess.off = noop;\nprocess.removeListener = noop;\nprocess.removeAllListeners = noop;\nprocess.emit = noop;\nprocess.prependListener = noop;\nprocess.prependOnceListener = noop;\n\nprocess.listeners = function (name) { return [] }\n\nprocess.binding = function (name) {\n throw new Error('process.binding is not supported');\n};\n\nprocess.cwd = function () { return '/' };\nprocess.chdir = function (dir) {\n throw new Error('process.chdir is not supported');\n};\nprocess.umask = function() { return 0; };\n","// @ts-check\nimport '../typedefs.js'\n\nimport { GitTree } from '../models/GitTree.js'\nimport { _writeObject as writeObject } from '../storage/writeObject.js'\n\n/**\n * @param {object} args\n * @param {import('../models/FileSystem.js').FileSystem} args.fs\n * @param {string} args.gitdir\n * @param {TreeObject} args.tree\n *\n * @returns {Promise<string>}\n */\nexport async function _writeTree({ fs, gitdir, tree }) {\n // Convert object to buffer\n const object = GitTree.from(tree).toObject()\n const oid = await writeObject({\n fs,\n gitdir,\n type: 'tree',\n object,\n format: 'content',\n })\n return oid\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { _currentBranch } from '../commands/currentBranch.js'\nimport { MissingParameterError } from '../errors/MissingParameterError.js'\nimport { RemoteCapabilityError } from '../errors/RemoteCapabilityError.js'\nimport { GitConfigManager } from '../managers/GitConfigManager.js'\nimport { GitRefManager } from '../managers/GitRefManager.js'\nimport { GitRemoteManager } from '../managers/GitRemoteManager.js'\nimport { GitShallowManager } from '../managers/GitShallowManager.js'\nimport { GitCommit } from '../models/GitCommit.js'\nimport { GitPackIndex } from '../models/GitPackIndex.js'\nimport { hasObject } from '../storage/hasObject.js'\nimport { _readObject as readObject } from '../storage/readObject.js'\nimport { abbreviateRef } from '../utils/abbreviateRef.js'\nimport { collect } from '../utils/collect.js'\nimport { emptyPackfile } from '../utils/emptyPackfile.js'\nimport { filterCapabilities } from '../utils/filterCapabilities.js'\nimport { forAwait } from '../utils/forAwait.js'\nimport { join } from '../utils/join.js'\nimport { pkg } from '../utils/pkg.js'\nimport { splitLines } from '../utils/splitLines.js'\nimport { parseUploadPackResponse } from '../wire/parseUploadPackResponse.js'\nimport { writeUploadPackRequest } from '../wire/writeUploadPackRequest.js'\n\n/**\n *\n * @typedef {object} FetchResult - The object returned has the following schema:\n * @property {string | null} defaultBranch - The branch that is cloned if no branch is specified\n * @property {string | null} fetchHead - The SHA-1 object id of the fetched head commit\n * @property {string | null} fetchHeadDescription - a textual description of the branch that was fetched\n * @property {Object<string, string>} [headers] - The HTTP response headers returned by the git server\n * @property {string[]} [pruned] - A list of branches that were pruned, if you provided the `prune` parameter\n *\n */\n\n/**\n * @param {object} args\n * @param {import('../models/FileSystem.js').FileSystem} args.fs\n * @param {any} args.cache\n * @param {HttpClient} args.http\n * @param {ProgressCallback} [args.onProgress]\n * @param {MessageCallback} [args.onMessage]\n * @param {AuthCallback} [args.onAuth]\n * @param {AuthFailureCallback} [args.onAuthFailure]\n * @param {AuthSuccessCallback} [args.onAuthSuccess]\n * @param {string} args.gitdir\n * @param {string|void} [args.url]\n * @param {string} [args.corsProxy]\n * @param {string} [args.ref]\n * @param {string} [args.remoteRef]\n * @param {string} [args.remote]\n * @param {boolean} [args.singleBranch = false]\n * @param {boolean} [args.tags = false]\n * @param {number} [args.depth]\n * @param {Date} [args.since]\n * @param {string[]} [args.exclude = []]\n * @param {boolean} [args.relative = false]\n * @param {Object<string, string>} [args.headers]\n * @param {boolean} [args.prune]\n * @param {boolean} [args.pruneTags]\n *\n * @returns {Promise<FetchResult>}\n * @see FetchResult\n */\nexport async function _fetch({\n fs,\n cache,\n http,\n onProgress,\n onMessage,\n onAuth,\n onAuthSuccess,\n onAuthFailure,\n gitdir,\n ref: _ref,\n remoteRef: _remoteRef,\n remote: _remote,\n url: _url,\n corsProxy,\n depth = null,\n since = null,\n exclude = [],\n relative = false,\n tags = false,\n singleBranch = false,\n headers = {},\n prune = false,\n pruneTags = false,\n}) {\n const ref = _ref || (await _currentBranch({ fs, gitdir, test: true }))\n const config = await GitConfigManager.get({ fs, gitdir })\n // Figure out what remote to use.\n const remote =\n _remote || (ref && (await config.get(`branch.${ref}.remote`))) || 'origin'\n // Lookup the URL for the given remote.\n const url = _url || (await config.get(`remote.${remote}.url`))\n if (typeof url === 'undefined') {\n throw new MissingParameterError('remote OR url')\n }\n // Figure out what remote ref to use.\n const remoteRef =\n _remoteRef ||\n (ref && (await config.get(`branch.${ref}.merge`))) ||\n _ref ||\n 'HEAD'\n\n if (corsProxy === undefined) {\n corsProxy = await config.get('http.corsProxy')\n }\n\n const GitRemoteHTTP = GitRemoteManager.getRemoteHelperFor({ url })\n const remoteHTTP = await GitRemoteHTTP.discover({\n http,\n onAuth,\n onAuthSuccess,\n onAuthFailure,\n corsProxy,\n service: 'git-upload-pack',\n url,\n headers,\n protocolVersion: 1,\n })\n const auth = remoteHTTP.auth // hack to get new credentials from CredentialManager API\n const remoteRefs = remoteHTTP.refs\n // For the special case of an empty repository with no refs, return null.\n if (remoteRefs.size === 0) {\n return {\n defaultBranch: null,\n fetchHead: null,\n fetchHeadDescription: null,\n }\n }\n // Check that the remote supports the requested features\n if (depth !== null && !remoteHTTP.capabilities.has('shallow')) {\n throw new RemoteCapabilityError('shallow', 'depth')\n }\n if (since !== null && !remoteHTTP.capabilities.has('deepen-since')) {\n throw new RemoteCapabilityError('deepen-since', 'since')\n }\n if (exclude.length > 0 && !remoteHTTP.capabilities.has('deepen-not')) {\n throw new RemoteCapabilityError('deepen-not', 'exclude')\n }\n if (relative === true && !remoteHTTP.capabilities.has('deepen-relative')) {\n throw new RemoteCapabilityError('deepen-relative', 'relative')\n }\n // Figure out the SHA for the requested ref\n const { oid, fullref } = GitRefManager.resolveAgainstMap({\n ref: remoteRef,\n map: remoteRefs,\n })\n // Filter out refs we want to ignore: only keep ref we're cloning, HEAD, branches, and tags (if we're keeping them)\n for (const remoteRef of remoteRefs.keys()) {\n if (\n remoteRef === fullref ||\n remoteRef === 'HEAD' ||\n remoteRef.startsWith('refs/heads/') ||\n (tags && remoteRef.startsWith('refs/tags/'))\n ) {\n continue\n }\n remoteRefs.delete(remoteRef)\n }\n // Assemble the application/x-git-upload-pack-request\n const capabilities = filterCapabilities(\n [...remoteHTTP.capabilities],\n [\n 'multi_ack_detailed',\n 'no-done',\n 'side-band-64k',\n // Note: I removed 'thin-pack' option since our code doesn't \"fatten\" packfiles,\n // which is necessary for compatibility with git. It was the cause of mysterious\n // 'fatal: pack has [x] unresolved deltas' errors that plagued us for some time.\n // isomorphic-git is perfectly happy with thin packfiles in .git/objects/pack but\n // canonical git it turns out is NOT.\n 'ofs-delta',\n `agent=${pkg.agent}`,\n ]\n )\n if (relative) capabilities.push('deepen-relative')\n // Start figuring out which oids from the remote we want to request\n const wants = singleBranch ? [oid] : remoteRefs.values()\n // Come up with a reasonable list of oids to tell the remote we already have\n // (preferably oids that are close ancestors of the branch heads we're fetching)\n const haveRefs = singleBranch\n ? [ref]\n : await GitRefManager.listRefs({\n fs,\n gitdir,\n filepath: `refs`,\n })\n let haves = []\n for (let ref of haveRefs) {\n try {\n ref = await GitRefManager.expand({ fs, gitdir, ref })\n const oid = await GitRefManager.resolve({ fs, gitdir, ref })\n if (await hasObject({ fs, cache, gitdir, oid })) {\n haves.push(oid)\n }\n } catch (err) {}\n }\n haves = [...new Set(haves)]\n const oids = await GitShallowManager.read({ fs, gitdir })\n const shallows = remoteHTTP.capabilities.has('shallow') ? [...oids] : []\n const packstream = writeUploadPackRequest({\n capabilities,\n wants,\n haves,\n shallows,\n depth,\n since,\n exclude,\n })\n // CodeCommit will hang up if we don't send a Content-Length header\n // so we can't stream the body.\n const packbuffer = Buffer.from(await collect(packstream))\n const raw = await GitRemoteHTTP.connect({\n http,\n onProgress,\n corsProxy,\n service: 'git-upload-pack',\n url,\n auth,\n body: [packbuffer],\n headers,\n })\n const response = await parseUploadPackResponse(raw.body)\n if (raw.headers) {\n response.headers = raw.headers\n }\n // Apply all the 'shallow' and 'unshallow' commands\n for (const oid of response.shallows) {\n if (!oids.has(oid)) {\n // this is in a try/catch mostly because my old test fixtures are missing objects\n try {\n // server says it's shallow, but do we have the parents?\n const { object } = await readObject({ fs, cache, gitdir, oid })\n const commit = new GitCommit(object)\n const hasParents = await Promise.all(\n commit\n .headers()\n .parent.map(oid => hasObject({ fs, cache, gitdir, oid }))\n )\n const haveAllParents =\n hasParents.length === 0 || hasParents.every(has => has)\n if (!haveAllParents) {\n oids.add(oid)\n }\n } catch (err) {\n oids.add(oid)\n }\n }\n }\n for (const oid of response.unshallows) {\n oids.delete(oid)\n }\n await GitShallowManager.write({ fs, gitdir, oids })\n // Update local remote refs\n if (singleBranch) {\n const refs = new Map([[fullref, oid]])\n // But wait, maybe it was a symref, like 'HEAD'!\n // We need to save all the refs in the symref chain (sigh).\n const symrefs = new Map()\n let bail = 10\n let key = fullref\n while (bail--) {\n const value = remoteHTTP.symrefs.get(key)\n if (value === undefined) break\n symrefs.set(key, value)\n key = value\n }\n // final value must not be a symref but a real ref\n const realRef = remoteRefs.get(key)\n // There may be no ref at all if we've fetched a specific commit hash\n if (realRef) {\n refs.set(key, realRef)\n }\n const { pruned } = await GitRefManager.updateRemoteRefs({\n fs,\n gitdir,\n remote,\n refs,\n symrefs,\n tags,\n prune,\n })\n if (prune) {\n response.pruned = pruned\n }\n } else {\n const { pruned } = await GitRefManager.updateRemoteRefs({\n fs,\n gitdir,\n remote,\n refs: remoteRefs,\n symrefs: remoteHTTP.symrefs,\n tags,\n prune,\n pruneTags,\n })\n if (prune) {\n response.pruned = pruned\n }\n }\n // We need this value later for the `clone` command.\n response.HEAD = remoteHTTP.symrefs.get('HEAD')\n // AWS CodeCommit doesn't list HEAD as a symref, but we can reverse engineer it\n // Find the SHA of the branch called HEAD\n if (response.HEAD === undefined) {\n const { oid } = GitRefManager.resolveAgainstMap({\n ref: 'HEAD',\n map: remoteRefs,\n })\n // Use the name of the first branch that's not called HEAD that has\n // the same SHA as the branch called HEAD.\n for (const [key, value] of remoteRefs.entries()) {\n if (key !== 'HEAD' && value === oid) {\n response.HEAD = key\n break\n }\n }\n }\n const noun = fullref.startsWith('refs/tags') ? 'tag' : 'branch'\n response.FETCH_HEAD = {\n oid,\n description: `${noun} '${abbreviateRef(fullref)}' of ${url}`,\n }\n\n if (onProgress || onMessage) {\n const lines = splitLines(response.progress)\n forAwait(lines, async line => {\n if (onMessage) await onMessage(line)\n if (onProgress) {\n const matches = line.match(/([^:]*).*\\((\\d+?)\\/(\\d+?)\\)/)\n if (matches) {\n await onProgress({\n phase: matches[1].trim(),\n loaded: parseInt(matches[2], 10),\n total: parseInt(matches[3], 10),\n })\n }\n }\n })\n }\n const packfile = Buffer.from(await collect(response.packfile))\n if (raw.body.error) throw raw.body.error\n const packfileSha = packfile.slice(-20).toString('hex')\n const res = {\n defaultBranch: response.HEAD,\n fetchHead: response.FETCH_HEAD.oid,\n fetchHeadDescription: response.FETCH_HEAD.description,\n }\n if (response.headers) {\n res.headers = response.headers\n }\n if (prune) {\n res.pruned = response.pruned\n }\n // This is a quick fix for the empty .git/objects/pack/pack-.pack file error,\n // which due to the way `git-list-pack` works causes the program to hang when it tries to read it.\n // TODO: Longer term, we should actually:\n // a) NOT concatenate the entire packfile into memory (line 78),\n // b) compute the SHA of the stream except for the last 20 bytes, using the same library used in push.js, and\n // c) compare the computed SHA with the last 20 bytes of the stream before saving to disk, and throwing a \"packfile got corrupted during download\" error if the SHA doesn't match.\n if (packfileSha !== '' && !emptyPackfile(packfile)) {\n res.packfile = `objects/pack/pack-${packfileSha}.pack`\n const fullpath = join(gitdir, res.packfile)\n await fs.write(fullpath, packfile)\n const getExternalRefDelta = oid => readObject({ fs, cache, gitdir, oid })\n const idx = await GitPackIndex.fromPack({\n pack: packfile,\n getExternalRefDelta,\n onProgress,\n })\n await fs.write(fullpath.replace(/\\.pack$/, '.idx'), await idx.toBuffer())\n }\n return res\n}\n","/* eslint-disable node/no-deprecated-api */\nvar buffer = require('buffer')\nvar Buffer = buffer.Buffer\n\n// alternative to using Object.keys for old browsers\nfunction copyProps (src, dst) {\n for (var key in src) {\n dst[key] = src[key]\n }\n}\nif (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) {\n module.exports = buffer\n} else {\n // Copy properties from require('buffer')\n copyProps(buffer, exports)\n exports.Buffer = SafeBuffer\n}\n\nfunction SafeBuffer (arg, encodingOrOffset, length) {\n return Buffer(arg, encodingOrOffset, length)\n}\n\n// Copy static methods from Buffer\ncopyProps(Buffer, SafeBuffer)\n\nSafeBuffer.from = function (arg, encodingOrOffset, length) {\n if (typeof arg === 'number') {\n throw new TypeError('Argument must not be a number')\n }\n return Buffer(arg, encodingOrOffset, length)\n}\n\nSafeBuffer.alloc = function (size, fill, encoding) {\n if (typeof size !== 'number') {\n throw new TypeError('Argument must be a number')\n }\n var buf = Buffer(size)\n if (fill !== undefined) {\n if (typeof encoding === 'string') {\n buf.fill(fill, encoding)\n } else {\n buf.fill(fill)\n }\n } else {\n buf.fill(0)\n }\n return buf\n}\n\nSafeBuffer.allocUnsafe = function (size) {\n if (typeof size !== 'number') {\n throw new TypeError('Argument must be a number')\n }\n return Buffer(size)\n}\n\nSafeBuffer.allocUnsafeSlow = function (size) {\n if (typeof size !== 'number') {\n throw new TypeError('Argument must be a number')\n }\n return buffer.SlowBuffer(size)\n}\n","'use strict';\n\n// Note: adler32 takes 12% for level 0 and 2% for level 6.\n// It isn't worth it to make additional optimizations as in original.\n// Small size is preferable.\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nfunction adler32(adler, buf, len, pos) {\n var s1 = (adler & 0xffff) |0,\n s2 = ((adler >>> 16) & 0xffff) |0,\n n = 0;\n\n while (len !== 0) {\n // Set limit ~ twice less than 5552, to keep\n // s2 in 31-bits, because we force signed ints.\n // in other case %= will fail.\n n = len > 2000 ? 2000 : len;\n len -= n;\n\n do {\n s1 = (s1 + buf[pos++]) |0;\n s2 = (s2 + s1) |0;\n } while (--n);\n\n s1 %= 65521;\n s2 %= 65521;\n }\n\n return (s1 | (s2 << 16)) |0;\n}\n\n\nmodule.exports = adler32;\n","'use strict';\n\n// Note: we can't get significant speed boost here.\n// So write code to minimize size - no pregenerated tables\n// and array tools dependencies.\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\n// Use ordinary array, since untyped makes no boost here\nfunction makeTable() {\n var c, table = [];\n\n for (var n = 0; n < 256; n++) {\n c = n;\n for (var k = 0; k < 8; k++) {\n c = ((c & 1) ? (0xEDB88320 ^ (c >>> 1)) : (c >>> 1));\n }\n table[n] = c;\n }\n\n return table;\n}\n\n// Create table on load. Just 255 signed longs. Not a problem.\nvar crcTable = makeTable();\n\n\nfunction crc32(crc, buf, len, pos) {\n var t = crcTable,\n end = pos + len;\n\n crc ^= -1;\n\n for (var i = pos; i < end; i++) {\n crc = (crc >>> 8) ^ t[(crc ^ buf[i]) & 0xFF];\n }\n\n return (crc ^ (-1)); // >>> 0;\n}\n\n\nmodule.exports = crc32;\n","// String encode/decode helpers\n'use strict';\n\n\nvar utils = require('./common');\n\n\n// Quick check if we can use fast array to bin string conversion\n//\n// - apply(Array) can fail on Android 2.2\n// - apply(Uint8Array) can fail on iOS 5.1 Safari\n//\nvar STR_APPLY_OK = true;\nvar STR_APPLY_UIA_OK = true;\n\ntry { String.fromCharCode.apply(null, [ 0 ]); } catch (__) { STR_APPLY_OK = false; }\ntry { String.fromCharCode.apply(null, new Uint8Array(1)); } catch (__) { STR_APPLY_UIA_OK = false; }\n\n\n// Table with utf8 lengths (calculated by first byte of sequence)\n// Note, that 5 & 6-byte values and some 4-byte values can not be represented in JS,\n// because max possible codepoint is 0x10ffff\nvar _utf8len = new utils.Buf8(256);\nfor (var q = 0; q < 256; q++) {\n _utf8len[q] = (q >= 252 ? 6 : q >= 248 ? 5 : q >= 240 ? 4 : q >= 224 ? 3 : q >= 192 ? 2 : 1);\n}\n_utf8len[254] = _utf8len[254] = 1; // Invalid sequence start\n\n\n// convert string to array (typed, when possible)\nexports.string2buf = function (str) {\n var buf, c, c2, m_pos, i, str_len = str.length, buf_len = 0;\n\n // count binary size\n for (m_pos = 0; m_pos < str_len; m_pos++) {\n c = str.charCodeAt(m_pos);\n if ((c & 0xfc00) === 0xd800 && (m_pos + 1 < str_len)) {\n c2 = str.charCodeAt(m_pos + 1);\n if ((c2 & 0xfc00) === 0xdc00) {\n c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00);\n m_pos++;\n }\n }\n buf_len += c < 0x80 ? 1 : c < 0x800 ? 2 : c < 0x10000 ? 3 : 4;\n }\n\n // allocate buffer\n buf = new utils.Buf8(buf_len);\n\n // convert\n for (i = 0, m_pos = 0; i < buf_len; m_pos++) {\n c = str.charCodeAt(m_pos);\n if ((c & 0xfc00) === 0xd800 && (m_pos + 1 < str_len)) {\n c2 = str.charCodeAt(m_pos + 1);\n if ((c2 & 0xfc00) === 0xdc00) {\n c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00);\n m_pos++;\n }\n }\n if (c < 0x80) {\n /* one byte */\n buf[i++] = c;\n } else if (c < 0x800) {\n /* two bytes */\n buf[i++] = 0xC0 | (c >>> 6);\n buf[i++] = 0x80 | (c & 0x3f);\n } else if (c < 0x10000) {\n /* three bytes */\n buf[i++] = 0xE0 | (c >>> 12);\n buf[i++] = 0x80 | (c >>> 6 & 0x3f);\n buf[i++] = 0x80 | (c & 0x3f);\n } else {\n /* four bytes */\n buf[i++] = 0xf0 | (c >>> 18);\n buf[i++] = 0x80 | (c >>> 12 & 0x3f);\n buf[i++] = 0x80 | (c >>> 6 & 0x3f);\n buf[i++] = 0x80 | (c & 0x3f);\n }\n }\n\n return buf;\n};\n\n// Helper (used in 2 places)\nfunction buf2binstring(buf, len) {\n // On Chrome, the arguments in a function call that are allowed is `65534`.\n // If the length of the buffer is smaller than that, we can use this optimization,\n // otherwise we will take a slower path.\n if (len < 65534) {\n if ((buf.subarray && STR_APPLY_UIA_OK) || (!buf.subarray && STR_APPLY_OK)) {\n return String.fromCharCode.apply(null, utils.shrinkBuf(buf, len));\n }\n }\n\n var result = '';\n for (var i = 0; i < len; i++) {\n result += String.fromCharCode(buf[i]);\n }\n return result;\n}\n\n\n// Convert byte array to binary string\nexports.buf2binstring = function (buf) {\n return buf2binstring(buf, buf.length);\n};\n\n\n// Convert binary string (typed, when possible)\nexports.binstring2buf = function (str) {\n var buf = new utils.Buf8(str.length);\n for (var i = 0, len = buf.length; i < len; i++) {\n buf[i] = str.charCodeAt(i);\n }\n return buf;\n};\n\n\n// convert array to string\nexports.buf2string = function (buf, max) {\n var i, out, c, c_len;\n var len = max || buf.length;\n\n // Reserve max possible length (2 words per char)\n // NB: by unknown reasons, Array is significantly faster for\n // String.fromCharCode.apply than Uint16Array.\n var utf16buf = new Array(len * 2);\n\n for (out = 0, i = 0; i < len;) {\n c = buf[i++];\n // quick process ascii\n if (c < 0x80) { utf16buf[out++] = c; continue; }\n\n c_len = _utf8len[c];\n // skip 5 & 6 byte codes\n if (c_len > 4) { utf16buf[out++] = 0xfffd; i += c_len - 1; continue; }\n\n // apply mask on first byte\n c &= c_len === 2 ? 0x1f : c_len === 3 ? 0x0f : 0x07;\n // join the rest\n while (c_len > 1 && i < len) {\n c = (c << 6) | (buf[i++] & 0x3f);\n c_len--;\n }\n\n // terminated by end of string?\n if (c_len > 1) { utf16buf[out++] = 0xfffd; continue; }\n\n if (c < 0x10000) {\n utf16buf[out++] = c;\n } else {\n c -= 0x10000;\n utf16buf[out++] = 0xd800 | ((c >> 10) & 0x3ff);\n utf16buf[out++] = 0xdc00 | (c & 0x3ff);\n }\n }\n\n return buf2binstring(utf16buf, out);\n};\n\n\n// Calculate max possible position in utf8 buffer,\n// that will not break sequence. If that's not possible\n// - (very small limits) return max size as is.\n//\n// buf[] - utf8 bytes array\n// max - length limit (mandatory);\nexports.utf8border = function (buf, max) {\n var pos;\n\n max = max || buf.length;\n if (max > buf.length) { max = buf.length; }\n\n // go back from last position, until start of sequence found\n pos = max - 1;\n while (pos >= 0 && (buf[pos] & 0xC0) === 0x80) { pos--; }\n\n // Very small and broken sequence,\n // return max, because we should return something anyway.\n if (pos < 0) { return max; }\n\n // If we came to start of buffer - that means buffer is too small,\n // return max too.\n if (pos === 0) { return max; }\n\n return (pos + _utf8len[buf[pos]] > max) ? pos : max;\n};\n","'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nfunction ZStream() {\n /* next input byte */\n this.input = null; // JS specific, because we have no pointers\n this.next_in = 0;\n /* number of bytes available at input */\n this.avail_in = 0;\n /* total number of input bytes read so far */\n this.total_in = 0;\n /* next output byte should be put there */\n this.output = null; // JS specific, because we have no pointers\n this.next_out = 0;\n /* remaining free space at output */\n this.avail_out = 0;\n /* total number of bytes output so far */\n this.total_out = 0;\n /* last error message, NULL if no error */\n this.msg = ''/*Z_NULL*/;\n /* not visible by applications */\n this.state = null;\n /* best guess about the data type: binary or text */\n this.data_type = 2/*Z_UNKNOWN*/;\n /* adler32 value of the uncompressed data */\n this.adler = 0;\n}\n\nmodule.exports = ZStream;\n","'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nmodule.exports = {\n\n /* Allowed flush values; see deflate() and inflate() below for details */\n Z_NO_FLUSH: 0,\n Z_PARTIAL_FLUSH: 1,\n Z_SYNC_FLUSH: 2,\n Z_FULL_FLUSH: 3,\n Z_FINISH: 4,\n Z_BLOCK: 5,\n Z_TREES: 6,\n\n /* Return codes for the compression/decompression functions. Negative values\n * are errors, positive values are used for special but normal events.\n */\n Z_OK: 0,\n Z_STREAM_END: 1,\n Z_NEED_DICT: 2,\n Z_ERRNO: -1,\n Z_STREAM_ERROR: -2,\n Z_DATA_ERROR: -3,\n //Z_MEM_ERROR: -4,\n Z_BUF_ERROR: -5,\n //Z_VERSION_ERROR: -6,\n\n /* compression levels */\n Z_NO_COMPRESSION: 0,\n Z_BEST_SPEED: 1,\n Z_BEST_COMPRESSION: 9,\n Z_DEFAULT_COMPRESSION: -1,\n\n\n Z_FILTERED: 1,\n Z_HUFFMAN_ONLY: 2,\n Z_RLE: 3,\n Z_FIXED: 4,\n Z_DEFAULT_STRATEGY: 0,\n\n /* Possible values of the data_type field (though see inflate()) */\n Z_BINARY: 0,\n Z_TEXT: 1,\n //Z_ASCII: 1, // = Z_TEXT (deprecated)\n Z_UNKNOWN: 2,\n\n /* The deflate compression method */\n Z_DEFLATED: 8\n //Z_NULL: null // Use -1 or null inline, depending on var type\n};\n","import { GitPktLine } from '../models/GitPktLine.js'\n\nexport function writeUploadPackRequest({\n capabilities = [],\n wants = [],\n haves = [],\n shallows = [],\n depth = null,\n since = null,\n exclude = [],\n}) {\n const packstream = []\n wants = [...new Set(wants)] // remove duplicates\n let firstLineCapabilities = ` ${capabilities.join(' ')}`\n for (const oid of wants) {\n packstream.push(GitPktLine.encode(`want ${oid}${firstLineCapabilities}\\n`))\n firstLineCapabilities = ''\n }\n for (const oid of shallows) {\n packstream.push(GitPktLine.encode(`shallow ${oid}\\n`))\n }\n if (depth !== null) {\n packstream.push(GitPktLine.encode(`deepen ${depth}\\n`))\n }\n if (since !== null) {\n packstream.push(\n GitPktLine.encode(`deepen-since ${Math.floor(since.valueOf() / 1000)}\\n`)\n )\n }\n for (const oid of exclude) {\n packstream.push(GitPktLine.encode(`deepen-not ${oid}\\n`))\n }\n packstream.push(GitPktLine.flush())\n for (const oid of haves) {\n packstream.push(GitPktLine.encode(`have ${oid}\\n`))\n }\n packstream.push(GitPktLine.encode(`done\\n`))\n return packstream\n}\n","import { InvalidOidError } from '../errors/InvalidOidError.js'\nimport { GitSideBand } from '../models/GitSideBand.js'\nimport { forAwait } from '../utils/forAwait.js'\n\nexport async function parseUploadPackResponse(stream) {\n const { packetlines, packfile, progress } = GitSideBand.demux(stream)\n const shallows = []\n const unshallows = []\n const acks = []\n let nak = false\n let done = false\n return new Promise((resolve, reject) => {\n // Parse the response\n forAwait(packetlines, data => {\n const line = data.toString('utf8').trim()\n if (line.startsWith('shallow')) {\n const oid = line.slice(-41).trim()\n if (oid.length !== 40) {\n reject(new InvalidOidError(oid))\n }\n shallows.push(oid)\n } else if (line.startsWith('unshallow')) {\n const oid = line.slice(-41).trim()\n if (oid.length !== 40) {\n reject(new InvalidOidError(oid))\n }\n unshallows.push(oid)\n } else if (line.startsWith('ACK')) {\n const [, oid, status] = line.split(' ')\n acks.push({ oid, status })\n if (!status) done = true\n } else if (line.startsWith('NAK')) {\n nak = true\n done = true\n } else {\n done = true\n nak = true\n }\n if (done) {\n stream.error\n ? reject(stream.error)\n : resolve({ shallows, unshallows, acks, nak, packfile, progress })\n }\n }).finally(() => {\n if (!done) {\n stream.error\n ? reject(stream.error)\n : resolve({ shallows, unshallows, acks, nak, packfile, progress })\n }\n })\n })\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { TREE } from '../commands/TREE.js'\nimport { _walk } from '../commands/walk.js'\nimport { MergeConflictError } from '../errors/MergeConflictError.js'\nimport { MergeNotSupportedError } from '../errors/MergeNotSupportedError.js'\nimport { GitTree } from '../models/GitTree.js'\nimport { _writeObject as writeObject } from '../storage/writeObject.js'\n\nimport { basename } from './basename.js'\nimport { join } from './join.js'\nimport { mergeFile } from './mergeFile.js'\nimport { modified } from './modified.js'\n\n/**\n * Create a merged tree\n *\n * @param {Object} args\n * @param {import('../models/FileSystem.js').FileSystem} args.fs\n * @param {object} args.cache\n * @param {string} [args.dir] - The [working tree](dir-vs-gitdir.md) directory path\n * @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path\n * @param {string} args.ourOid - The SHA-1 object id of our tree\n * @param {string} args.baseOid - The SHA-1 object id of the base tree\n * @param {string} args.theirOid - The SHA-1 object id of their tree\n * @param {string} [args.ourName='ours'] - The name to use in conflicted files for our hunks\n * @param {string} [args.baseName='base'] - The name to use in conflicted files (in diff3 format) for the base hunks\n * @param {string} [args.theirName='theirs'] - The name to use in conflicted files for their hunks\n * @param {boolean} [args.dryRun=false]\n * @param {boolean} [args.abortOnConflict=false]\n * @param {MergeDriverCallback} [args.mergeDriver]\n *\n * @returns {Promise<string>} - The SHA-1 object id of the merged tree\n *\n */\nexport async function mergeTree({\n fs,\n cache,\n dir,\n gitdir = join(dir, '.git'),\n index,\n ourOid,\n baseOid,\n theirOid,\n ourName = 'ours',\n baseName = 'base',\n theirName = 'theirs',\n dryRun = false,\n abortOnConflict = true,\n mergeDriver,\n}) {\n const ourTree = TREE({ ref: ourOid })\n const baseTree = TREE({ ref: baseOid })\n const theirTree = TREE({ ref: theirOid })\n\n const unmergedFiles = []\n const bothModified = []\n const deleteByUs = []\n const deleteByTheirs = []\n\n const results = await _walk({\n fs,\n cache,\n dir,\n gitdir,\n trees: [ourTree, baseTree, theirTree],\n map: async function(filepath, [ours, base, theirs]) {\n const path = basename(filepath)\n // What we did, what they did\n const ourChange = await modified(ours, base)\n const theirChange = await modified(theirs, base)\n switch (`${ourChange}-${theirChange}`) {\n case 'false-false': {\n return {\n mode: await base.mode(),\n path,\n oid: await base.oid(),\n type: await base.type(),\n }\n }\n case 'false-true': {\n return theirs\n ? {\n mode: await theirs.mode(),\n path,\n oid: await theirs.oid(),\n type: await theirs.type(),\n }\n : undefined\n }\n case 'true-false': {\n return ours\n ? {\n mode: await ours.mode(),\n path,\n oid: await ours.oid(),\n type: await ours.type(),\n }\n : undefined\n }\n case 'true-true': {\n // Modifications\n if (\n ours &&\n base &&\n theirs &&\n (await ours.type()) === 'blob' &&\n (await base.type()) === 'blob' &&\n (await theirs.type()) === 'blob'\n ) {\n return mergeBlobs({\n fs,\n gitdir,\n path,\n ours,\n base,\n theirs,\n ourName,\n baseName,\n theirName,\n mergeDriver,\n }).then(async r => {\n if (!r.cleanMerge) {\n unmergedFiles.push(filepath)\n bothModified.push(filepath)\n if (!abortOnConflict) {\n const baseOid = await base.oid()\n const ourOid = await ours.oid()\n const theirOid = await theirs.oid()\n\n index.delete({ filepath })\n\n index.insert({ filepath, oid: baseOid, stage: 1 })\n index.insert({ filepath, oid: ourOid, stage: 2 })\n index.insert({ filepath, oid: theirOid, stage: 3 })\n }\n } else if (!abortOnConflict) {\n index.insert({ filepath, oid: r.mergeResult.oid, stage: 0 })\n }\n return r.mergeResult\n })\n }\n\n // deleted by us\n if (\n base &&\n !ours &&\n theirs &&\n (await base.type()) === 'blob' &&\n (await theirs.type()) === 'blob'\n ) {\n unmergedFiles.push(filepath)\n deleteByUs.push(filepath)\n if (!abortOnConflict) {\n const baseOid = await base.oid()\n const theirOid = await theirs.oid()\n\n index.delete({ filepath })\n\n index.insert({ filepath, oid: baseOid, stage: 1 })\n index.insert({ filepath, oid: theirOid, stage: 3 })\n }\n\n return {\n mode: await theirs.mode(),\n oid: await theirs.oid(),\n type: 'blob',\n path,\n }\n }\n\n // deleted by theirs\n if (\n base &&\n ours &&\n !theirs &&\n (await base.type()) === 'blob' &&\n (await ours.type()) === 'blob'\n ) {\n unmergedFiles.push(filepath)\n deleteByTheirs.push(filepath)\n if (!abortOnConflict) {\n const baseOid = await base.oid()\n const ourOid = await ours.oid()\n\n index.delete({ filepath })\n\n index.insert({ filepath, oid: baseOid, stage: 1 })\n index.insert({ filepath, oid: ourOid, stage: 2 })\n }\n\n return {\n mode: await ours.mode(),\n oid: await ours.oid(),\n type: 'blob',\n path,\n }\n }\n\n // deleted by both\n if (base && !ours && !theirs && (await base.type()) === 'blob') {\n return undefined\n }\n\n // all other types of conflicts fail\n // TODO: Merge conflicts involving additions\n throw new MergeNotSupportedError()\n }\n }\n },\n /**\n * @param {TreeEntry} [parent]\n * @param {Array<TreeEntry>} children\n */\n reduce:\n unmergedFiles.length !== 0 && (!dir || abortOnConflict)\n ? undefined\n : async (parent, children) => {\n const entries = children.filter(Boolean) // remove undefineds\n\n // if the parent was deleted, the children have to go\n if (!parent) return\n\n // automatically delete directories if they have been emptied\n if (parent && parent.type === 'tree' && entries.length === 0) return\n\n if (entries.length > 0) {\n const tree = new GitTree(entries)\n const object = tree.toObject()\n const oid = await writeObject({\n fs,\n gitdir,\n type: 'tree',\n object,\n dryRun,\n })\n parent.oid = oid\n }\n return parent\n },\n })\n\n if (unmergedFiles.length !== 0) {\n if (dir && !abortOnConflict) {\n await _walk({\n fs,\n cache,\n dir,\n gitdir,\n trees: [TREE({ ref: results.oid })],\n map: async function(filepath, [entry]) {\n const path = `${dir}/${filepath}`\n if ((await entry.type()) === 'blob') {\n const mode = await entry.mode()\n const content = new TextDecoder().decode(await entry.content())\n await fs.write(path, content, { mode })\n }\n return true\n },\n })\n }\n return new MergeConflictError(\n unmergedFiles,\n bothModified,\n deleteByUs,\n deleteByTheirs\n )\n }\n\n return results.oid\n}\n\n/**\n *\n * @param {Object} args\n * @param {import('../models/FileSystem').FileSystem} args.fs\n * @param {string} args.gitdir\n * @param {string} args.path\n * @param {WalkerEntry} args.ours\n * @param {WalkerEntry} args.base\n * @param {WalkerEntry} args.theirs\n * @param {string} [args.ourName]\n * @param {string} [args.baseName]\n * @param {string} [args.theirName]\n * @param {boolean} [args.dryRun = false]\n * @param {MergeDriverCallback} [args.mergeDriver]\n *\n */\nasync function mergeBlobs({\n fs,\n gitdir,\n path,\n ours,\n base,\n theirs,\n ourName,\n theirName,\n baseName,\n dryRun,\n mergeDriver = mergeFile,\n}) {\n const type = 'blob'\n // Compute the new mode.\n // Since there are ONLY two valid blob modes ('100755' and '100644') it boils down to this\n const mode =\n (await base.mode()) === (await ours.mode())\n ? await theirs.mode()\n : await ours.mode()\n // The trivial case: nothing to merge except maybe mode\n if ((await ours.oid()) === (await theirs.oid())) {\n return {\n cleanMerge: true,\n mergeResult: { mode, path, oid: await ours.oid(), type },\n }\n }\n // if only one side made oid changes, return that side's oid\n if ((await ours.oid()) === (await base.oid())) {\n return {\n cleanMerge: true,\n mergeResult: { mode, path, oid: await theirs.oid(), type },\n }\n }\n if ((await theirs.oid()) === (await base.oid())) {\n return {\n cleanMerge: true,\n mergeResult: { mode, path, oid: await ours.oid(), type },\n }\n }\n // if both sides made changes do a merge\n const ourContent = Buffer.from(await ours.content()).toString('utf8')\n const baseContent = Buffer.from(await base.content()).toString('utf8')\n const theirContent = Buffer.from(await theirs.content()).toString('utf8')\n const { mergedText, cleanMerge } = await mergeDriver({\n branches: [baseName, ourName, theirName],\n contents: [baseContent, ourContent, theirContent],\n path,\n })\n const oid = await writeObject({\n fs,\n gitdir,\n type: 'blob',\n object: Buffer.from(mergedText, 'utf8'),\n dryRun,\n })\n\n return { cleanMerge, mergeResult: { mode, path, oid, type } }\n}\n","import { ObjectTypeError } from '../errors/ObjectTypeError.js'\nimport { GitRefManager } from '../managers/GitRefManager.js'\nimport { GitShallowManager } from '../managers/GitShallowManager.js'\nimport { GitAnnotatedTag } from '../models/GitAnnotatedTag.js'\nimport { GitCommit } from '../models/GitCommit.js'\nimport { _readObject as readObject } from '../storage/readObject.js'\nimport { join } from '../utils/join.js'\n\n/**\n * @param {object} args\n * @param {import('../models/FileSystem.js').FileSystem} args.fs\n * @param {any} args.cache\n * @param {string} [args.dir]\n * @param {string} args.gitdir\n * @param {Iterable<string>} args.start\n * @param {Iterable<string>} args.finish\n * @returns {Promise<Set<string>>}\n */\nexport async function listCommitsAndTags({\n fs,\n cache,\n dir,\n gitdir = join(dir, '.git'),\n start,\n finish,\n}) {\n const shallows = await GitShallowManager.read({ fs, gitdir })\n const startingSet = new Set()\n const finishingSet = new Set()\n for (const ref of start) {\n startingSet.add(await GitRefManager.resolve({ fs, gitdir, ref }))\n }\n for (const ref of finish) {\n // We may not have these refs locally so we must try/catch\n try {\n const oid = await GitRefManager.resolve({ fs, gitdir, ref })\n finishingSet.add(oid)\n } catch (err) {}\n }\n const visited = new Set()\n // Because git commits are named by their hash, there is no\n // way to construct a cycle. Therefore we won't worry about\n // setting a default recursion limit.\n async function walk(oid) {\n visited.add(oid)\n const { type, object } = await readObject({ fs, cache, gitdir, oid })\n // Recursively resolve annotated tags\n if (type === 'tag') {\n const tag = GitAnnotatedTag.from(object)\n const commit = tag.headers().object\n return walk(commit)\n }\n if (type !== 'commit') {\n throw new ObjectTypeError(oid, type, 'commit')\n }\n if (!shallows.has(oid)) {\n const commit = GitCommit.from(object)\n const parents = commit.headers().parent\n for (oid of parents) {\n if (!finishingSet.has(oid) && !visited.has(oid)) {\n await walk(oid)\n }\n }\n }\n }\n // Let's go walking!\n for (const oid of startingSet) {\n await walk(oid)\n }\n return visited\n}\n","import { GitPktLine } from '../models/GitPktLine.js'\n\nexport async function writeReceivePackRequest({\n capabilities = [],\n triplets = [],\n}) {\n const packstream = []\n let capsFirstLine = `\\x00 ${capabilities.join(' ')}`\n for (const trip of triplets) {\n packstream.push(\n GitPktLine.encode(\n `${trip.oldoid} ${trip.oid} ${trip.fullRef}${capsFirstLine}\\n`\n )\n )\n capsFirstLine = ''\n }\n packstream.push(GitPktLine.flush())\n return packstream\n}\n","import '../typedefs.js'\n\nimport { ParseError } from '../errors/ParseError.js'\nimport { GitPktLine } from '../models/GitPktLine.js'\n\nexport async function parseReceivePackResponse(packfile) {\n /** @type PushResult */\n const result = {}\n let response = ''\n const read = GitPktLine.streamReader(packfile)\n let line = await read()\n while (line !== true) {\n if (line !== null) response += line.toString('utf8') + '\\n'\n line = await read()\n }\n\n const lines = response.toString('utf8').split('\\n')\n // We're expecting \"unpack {unpack-result}\"\n line = lines.shift()\n if (!line.startsWith('unpack ')) {\n throw new ParseError('unpack ok\" or \"unpack [error message]', line)\n }\n result.ok = line === 'unpack ok'\n if (!result.ok) {\n result.error = line.slice('unpack '.length)\n }\n result.refs = {}\n for (const line of lines) {\n if (line.trim() === '') continue\n const status = line.slice(0, 2)\n const refAndMessage = line.slice(3)\n let space = refAndMessage.indexOf(' ')\n if (space === -1) space = refAndMessage.length\n const ref = refAndMessage.slice(0, space)\n const error = refAndMessage.slice(space + 1)\n result.refs[ref] = {\n ok: status === 'ok',\n error,\n }\n }\n return result\n}\n","import { compareStrings } from './compareStrings'\n\nexport function compareTreeEntryPath(a, b) {\n // Git sorts tree entries as if there is a trailing slash on directory names.\n return compareStrings(appendSlashIfDir(a), appendSlashIfDir(b))\n}\n\nfunction appendSlashIfDir(entry) {\n return entry.mode === '040000' ? entry.path + '/' : entry.path\n}\n","export async function readObjectLoose({ fs, gitdir, oid }) {\n const source = `objects/${oid.slice(0, 2)}/${oid.slice(2)}`\n const file = await fs.read(`${gitdir}/${source}`)\n if (!file) {\n return null\n }\n return { object: file, format: 'deflated', source }\n}\n","/* crc32.js (C) 2014-present SheetJS -- http://sheetjs.com */\n/* vim: set ts=2: */\n/*exported CRC32 */\nvar CRC32;\n(function (factory) {\n\t/*jshint ignore:start */\n\t/*eslint-disable */\n\tif(typeof DO_NOT_EXPORT_CRC === 'undefined') {\n\t\tif('object' === typeof exports) {\n\t\t\tfactory(exports);\n\t\t} else if ('function' === typeof define && define.amd) {\n\t\t\tdefine(function () {\n\t\t\t\tvar module = {};\n\t\t\t\tfactory(module);\n\t\t\t\treturn module;\n\t\t\t});\n\t\t} else {\n\t\t\tfactory(CRC32 = {});\n\t\t}\n\t} else {\n\t\tfactory(CRC32 = {});\n\t}\n\t/*eslint-enable */\n\t/*jshint ignore:end */\n}(function(CRC32) {\nCRC32.version = '1.2.0';\n/* see perf/crc32table.js */\n/*global Int32Array */\nfunction signed_crc_table() {\n\tvar c = 0, table = new Array(256);\n\n\tfor(var n =0; n != 256; ++n){\n\t\tc = n;\n\t\tc = ((c&1) ? (-306674912 ^ (c >>> 1)) : (c >>> 1));\n\t\tc = ((c&1) ? (-306674912 ^ (c >>> 1)) : (c >>> 1));\n\t\tc = ((c&1) ? (-306674912 ^ (c >>> 1)) : (c >>> 1));\n\t\tc = ((c&1) ? (-306674912 ^ (c >>> 1)) : (c >>> 1));\n\t\tc = ((c&1) ? (-306674912 ^ (c >>> 1)) : (c >>> 1));\n\t\tc = ((c&1) ? (-306674912 ^ (c >>> 1)) : (c >>> 1));\n\t\tc = ((c&1) ? (-306674912 ^ (c >>> 1)) : (c >>> 1));\n\t\tc = ((c&1) ? (-306674912 ^ (c >>> 1)) : (c >>> 1));\n\t\ttable[n] = c;\n\t}\n\n\treturn typeof Int32Array !== 'undefined' ? new Int32Array(table) : table;\n}\n\nvar T = signed_crc_table();\nfunction crc32_bstr(bstr, seed) {\n\tvar C = seed ^ -1, L = bstr.length - 1;\n\tfor(var i = 0; i < L;) {\n\t\tC = (C>>>8) ^ T[(C^bstr.charCodeAt(i++))&0xFF];\n\t\tC = (C>>>8) ^ T[(C^bstr.charCodeAt(i++))&0xFF];\n\t}\n\tif(i === L) C = (C>>>8) ^ T[(C ^ bstr.charCodeAt(i))&0xFF];\n\treturn C ^ -1;\n}\n\nfunction crc32_buf(buf, seed) {\n\tif(buf.length > 10000) return crc32_buf_8(buf, seed);\n\tvar C = seed ^ -1, L = buf.length - 3;\n\tfor(var i = 0; i < L;) {\n\t\tC = (C>>>8) ^ T[(C^buf[i++])&0xFF];\n\t\tC = (C>>>8) ^ T[(C^buf[i++])&0xFF];\n\t\tC = (C>>>8) ^ T[(C^buf[i++])&0xFF];\n\t\tC = (C>>>8) ^ T[(C^buf[i++])&0xFF];\n\t}\n\twhile(i < L+3) C = (C>>>8) ^ T[(C^buf[i++])&0xFF];\n\treturn C ^ -1;\n}\n\nfunction crc32_buf_8(buf, seed) {\n\tvar C = seed ^ -1, L = buf.length - 7;\n\tfor(var i = 0; i < L;) {\n\t\tC = (C>>>8) ^ T[(C^buf[i++])&0xFF];\n\t\tC = (C>>>8) ^ T[(C^buf[i++])&0xFF];\n\t\tC = (C>>>8) ^ T[(C^buf[i++])&0xFF];\n\t\tC = (C>>>8) ^ T[(C^buf[i++])&0xFF];\n\t\tC = (C>>>8) ^ T[(C^buf[i++])&0xFF];\n\t\tC = (C>>>8) ^ T[(C^buf[i++])&0xFF];\n\t\tC = (C>>>8) ^ T[(C^buf[i++])&0xFF];\n\t\tC = (C>>>8) ^ T[(C^buf[i++])&0xFF];\n\t}\n\twhile(i < L+7) C = (C>>>8) ^ T[(C^buf[i++])&0xFF];\n\treturn C ^ -1;\n}\n\nfunction crc32_str(str, seed) {\n\tvar C = seed ^ -1;\n\tfor(var i = 0, L=str.length, c, d; i < L;) {\n\t\tc = str.charCodeAt(i++);\n\t\tif(c < 0x80) {\n\t\t\tC = (C>>>8) ^ T[(C ^ c)&0xFF];\n\t\t} else if(c < 0x800) {\n\t\t\tC = (C>>>8) ^ T[(C ^ (192|((c>>6)&31)))&0xFF];\n\t\t\tC = (C>>>8) ^ T[(C ^ (128|(c&63)))&0xFF];\n\t\t} else if(c >= 0xD800 && c < 0xE000) {\n\t\t\tc = (c&1023)+64; d = str.charCodeAt(i++)&1023;\n\t\t\tC = (C>>>8) ^ T[(C ^ (240|((c>>8)&7)))&0xFF];\n\t\t\tC = (C>>>8) ^ T[(C ^ (128|((c>>2)&63)))&0xFF];\n\t\t\tC = (C>>>8) ^ T[(C ^ (128|((d>>6)&15)|((c&3)<<4)))&0xFF];\n\t\t\tC = (C>>>8) ^ T[(C ^ (128|(d&63)))&0xFF];\n\t\t} else {\n\t\t\tC = (C>>>8) ^ T[(C ^ (224|((c>>12)&15)))&0xFF];\n\t\t\tC = (C>>>8) ^ T[(C ^ (128|((c>>6)&63)))&0xFF];\n\t\t\tC = (C>>>8) ^ T[(C ^ (128|(c&63)))&0xFF];\n\t\t}\n\t}\n\treturn C ^ -1;\n}\nCRC32.table = T;\n// $FlowIgnore\nCRC32.bstr = crc32_bstr;\n// $FlowIgnore\nCRC32.buf = crc32_buf;\n// $FlowIgnore\nCRC32.str = crc32_str;\n}));\n","// My version of git-list-pack - roughly 15x faster than the original\n// It's used slightly differently - instead of returning a through stream it wraps a stream.\n// (I tried to make it API identical, but that ended up being 2x slower than this version.)\nimport pako from 'pako'\n\nimport { InternalError } from '../errors/InternalError.js'\nimport { StreamReader } from '../utils/StreamReader.js'\n\nexport async function listpack(stream, onData) {\n const reader = new StreamReader(stream)\n let PACK = await reader.read(4)\n PACK = PACK.toString('utf8')\n if (PACK !== 'PACK') {\n throw new InternalError(`Invalid PACK header '${PACK}'`)\n }\n\n let version = await reader.read(4)\n version = version.readUInt32BE(0)\n if (version !== 2) {\n throw new InternalError(`Invalid packfile version: ${version}`)\n }\n\n let numObjects = await reader.read(4)\n numObjects = numObjects.readUInt32BE(0)\n // If (for some godforsaken reason) this is an empty packfile, abort now.\n if (numObjects < 1) return\n\n while (!reader.eof() && numObjects--) {\n const offset = reader.tell()\n const { type, length, ofs, reference } = await parseHeader(reader)\n const inflator = new pako.Inflate()\n while (!inflator.result) {\n const chunk = await reader.chunk()\n if (!chunk) break\n inflator.push(chunk, false)\n if (inflator.err) {\n throw new InternalError(`Pako error: ${inflator.msg}`)\n }\n if (inflator.result) {\n if (inflator.result.length !== length) {\n throw new InternalError(\n `Inflated object size is different from that stated in packfile.`\n )\n }\n\n // Backtrack parser to where deflated data ends\n await reader.undo()\n await reader.read(chunk.length - inflator.strm.avail_in)\n const end = reader.tell()\n await onData({\n data: inflator.result,\n type,\n num: numObjects,\n offset,\n end,\n reference,\n ofs,\n })\n }\n }\n }\n}\n\nasync function parseHeader(reader) {\n // Object type is encoded in bits 654\n let byte = await reader.byte()\n const type = (byte >> 4) & 0b111\n // The length encoding get complicated.\n // Last four bits of length is encoded in bits 3210\n let length = byte & 0b1111\n // Whether the next byte is part of the variable-length encoded number\n // is encoded in bit 7\n if (byte & 0b10000000) {\n let shift = 4\n do {\n byte = await reader.byte()\n length |= (byte & 0b01111111) << shift\n shift += 7\n } while (byte & 0b10000000)\n }\n // Handle deltified objects\n let ofs\n let reference\n if (type === 6) {\n let shift = 0\n ofs = 0\n const bytes = []\n do {\n byte = await reader.byte()\n ofs |= (byte & 0b01111111) << shift\n shift += 7\n bytes.push(byte)\n } while (byte & 0b10000000)\n reference = Buffer.from(bytes)\n }\n if (type === 7) {\n const buf = await reader.read(20)\n reference = buf\n }\n return { type, length, ofs, reference }\n}\n","import { InternalError } from '../errors/InternalError.js'\nimport { BufferCursor } from '../utils/BufferCursor.js'\n\n/**\n * @param {Buffer} delta\n * @param {Buffer} source\n * @returns {Buffer}\n */\nexport function applyDelta(delta, source) {\n const reader = new BufferCursor(delta)\n const sourceSize = readVarIntLE(reader)\n\n if (sourceSize !== source.byteLength) {\n throw new InternalError(\n `applyDelta expected source buffer to be ${sourceSize} bytes but the provided buffer was ${source.length} bytes`\n )\n }\n const targetSize = readVarIntLE(reader)\n let target\n\n const firstOp = readOp(reader, source)\n // Speed optimization - return raw buffer if it's just single simple copy\n if (firstOp.byteLength === targetSize) {\n target = firstOp\n } else {\n // Otherwise, allocate a fresh buffer and slices\n target = Buffer.alloc(targetSize)\n const writer = new BufferCursor(target)\n writer.copy(firstOp)\n\n while (!reader.eof()) {\n writer.copy(readOp(reader, source))\n }\n\n const tell = writer.tell()\n if (targetSize !== tell) {\n throw new InternalError(\n `applyDelta expected target buffer to be ${targetSize} bytes but the resulting buffer was ${tell} bytes`\n )\n }\n }\n return target\n}\n\nfunction readVarIntLE(reader) {\n let result = 0\n let shift = 0\n let byte = null\n do {\n byte = reader.readUInt8()\n result |= (byte & 0b01111111) << shift\n shift += 7\n } while (byte & 0b10000000)\n return result\n}\n\nfunction readCompactLE(reader, flags, size) {\n let result = 0\n let shift = 0\n while (size--) {\n if (flags & 0b00000001) {\n result |= reader.readUInt8() << shift\n }\n flags >>= 1\n shift += 8\n }\n return result\n}\n\nfunction readOp(reader, source) {\n /** @type {number} */\n const byte = reader.readUInt8()\n const COPY = 0b10000000\n const OFFS = 0b00001111\n const SIZE = 0b01110000\n if (byte & COPY) {\n // copy consists of 4 byte offset, 3 byte size (in LE order)\n const offset = readCompactLE(reader, byte & OFFS, 4)\n let size = readCompactLE(reader, (byte & SIZE) >> 4, 3)\n // Yup. They really did this optimization.\n if (size === 0) size = 0x10000\n return source.slice(offset, offset + size)\n } else {\n // insert\n return reader.slice(byte)\n }\n}\n","export function outdent(str) {\n return str\n .split('\\n')\n .map(x => x.replace(/^ /, ''))\n .join('\\n')\n}\n","export function isPromiseLike(obj) {\n return isObject(obj) && isFunction(obj.then) && isFunction(obj.catch)\n}\n\nexport function isObject(obj) {\n return obj && typeof obj === 'object'\n}\n\nexport function isFunction(obj) {\n return typeof obj === 'function'\n}\n","// A simple implementation of make-array\nfunction makeArray (subject) {\n return Array.isArray(subject)\n ? subject\n : [subject]\n}\n\nconst EMPTY = ''\nconst SPACE = ' '\nconst ESCAPE = '\\\\'\nconst REGEX_TEST_BLANK_LINE = /^\\s+$/\nconst REGEX_REPLACE_LEADING_EXCAPED_EXCLAMATION = /^\\\\!/\nconst REGEX_REPLACE_LEADING_EXCAPED_HASH = /^\\\\#/\nconst REGEX_SPLITALL_CRLF = /\\r?\\n/g\n// /foo,\n// ./foo,\n// ../foo,\n// .\n// ..\nconst REGEX_TEST_INVALID_PATH = /^\\.*\\/|^\\.+$/\n\nconst SLASH = '/'\nconst KEY_IGNORE = typeof Symbol !== 'undefined'\n ? Symbol.for('node-ignore')\n /* istanbul ignore next */\n : 'node-ignore'\n\nconst define = (object, key, value) =>\n Object.defineProperty(object, key, {value})\n\nconst REGEX_REGEXP_RANGE = /([0-z])-([0-z])/g\n\nconst RETURN_FALSE = () => false\n\n// Sanitize the range of a regular expression\n// The cases are complicated, see test cases for details\nconst sanitizeRange = range => range.replace(\n REGEX_REGEXP_RANGE,\n (match, from, to) => from.charCodeAt(0) <= to.charCodeAt(0)\n ? match\n // Invalid range (out of order) which is ok for gitignore rules but\n // fatal for JavaScript regular expression, so eliminate it.\n : EMPTY\n)\n\n// See fixtures #59\nconst cleanRangeBackSlash = slashes => {\n const {length} = slashes\n return slashes.slice(0, length - length % 2)\n}\n\n// > If the pattern ends with a slash,\n// > it is removed for the purpose of the following description,\n// > but it would only find a match with a directory.\n// > In other words, foo/ will match a directory foo and paths underneath it,\n// > but will not match a regular file or a symbolic link foo\n// > (this is consistent with the way how pathspec works in general in Git).\n// '`foo/`' will not match regular file '`foo`' or symbolic link '`foo`'\n// -> ignore-rules will not deal with it, because it costs extra `fs.stat` call\n// you could use option `mark: true` with `glob`\n\n// '`foo/`' should not continue with the '`..`'\nconst REPLACERS = [\n\n // > Trailing spaces are ignored unless they are quoted with backslash (\"\\\")\n [\n // (a\\ ) -> (a )\n // (a ) -> (a)\n // (a \\ ) -> (a )\n /\\\\?\\s+$/,\n match => match.indexOf('\\\\') === 0\n ? SPACE\n : EMPTY\n ],\n\n // replace (\\ ) with ' '\n [\n /\\\\\\s/g,\n () => SPACE\n ],\n\n // Escape metacharacters\n // which is written down by users but means special for regular expressions.\n\n // > There are 12 characters with special meanings:\n // > - the backslash \\,\n // > - the caret ^,\n // > - the dollar sign $,\n // > - the period or dot .,\n // > - the vertical bar or pipe symbol |,\n // > - the question mark ?,\n // > - the asterisk or star *,\n // > - the plus sign +,\n // > - the opening parenthesis (,\n // > - the closing parenthesis ),\n // > - and the opening square bracket [,\n // > - the opening curly brace {,\n // > These special characters are often called \"metacharacters\".\n [\n /[\\\\$.|*+(){^]/g,\n match => `\\\\${match}`\n ],\n\n [\n // > a question mark (?) matches a single character\n /(?!\\\\)\\?/g,\n () => '[^/]'\n ],\n\n // leading slash\n [\n\n // > A leading slash matches the beginning of the pathname.\n // > For example, \"/*.c\" matches \"cat-file.c\" but not \"mozilla-sha1/sha1.c\".\n // A leading slash matches the beginning of the pathname\n /^\\//,\n () => '^'\n ],\n\n // replace special metacharacter slash after the leading slash\n [\n /\\//g,\n () => '\\\\/'\n ],\n\n [\n // > A leading \"**\" followed by a slash means match in all directories.\n // > For example, \"**/foo\" matches file or directory \"foo\" anywhere,\n // > the same as pattern \"foo\".\n // > \"**/foo/bar\" matches file or directory \"bar\" anywhere that is directly\n // > under directory \"foo\".\n // Notice that the '*'s have been replaced as '\\\\*'\n /^\\^*\\\\\\*\\\\\\*\\\\\\//,\n\n // '**/foo' <-> 'foo'\n () => '^(?:.*\\\\/)?'\n ],\n\n // starting\n [\n // there will be no leading '/'\n // (which has been replaced by section \"leading slash\")\n // If starts with '**', adding a '^' to the regular expression also works\n /^(?=[^^])/,\n function startingReplacer () {\n // If has a slash `/` at the beginning or middle\n return !/\\/(?!$)/.test(this)\n // > Prior to 2.22.1\n // > If the pattern does not contain a slash /,\n // > Git treats it as a shell glob pattern\n // Actually, if there is only a trailing slash,\n // git also treats it as a shell glob pattern\n\n // After 2.22.1 (compatible but clearer)\n // > If there is a separator at the beginning or middle (or both)\n // > of the pattern, then the pattern is relative to the directory\n // > level of the particular .gitignore file itself.\n // > Otherwise the pattern may also match at any level below\n // > the .gitignore level.\n ? '(?:^|\\\\/)'\n\n // > Otherwise, Git treats the pattern as a shell glob suitable for\n // > consumption by fnmatch(3)\n : '^'\n }\n ],\n\n // two globstars\n [\n // Use lookahead assertions so that we could match more than one `'/**'`\n /\\\\\\/\\\\\\*\\\\\\*(?=\\\\\\/|$)/g,\n\n // Zero, one or several directories\n // should not use '*', or it will be replaced by the next replacer\n\n // Check if it is not the last `'/**'`\n (_, index, str) => index + 6 < str.length\n\n // case: /**/\n // > A slash followed by two consecutive asterisks then a slash matches\n // > zero or more directories.\n // > For example, \"a/**/b\" matches \"a/b\", \"a/x/b\", \"a/x/y/b\" and so on.\n // '/**/'\n ? '(?:\\\\/[^\\\\/]+)*'\n\n // case: /**\n // > A trailing `\"/**\"` matches everything inside.\n\n // #21: everything inside but it should not include the current folder\n : '\\\\/.+'\n ],\n\n // intermediate wildcards\n [\n // Never replace escaped '*'\n // ignore rule '\\*' will match the path '*'\n\n // 'abc.*/' -> go\n // 'abc.*' -> skip this rule\n /(^|[^\\\\]+)\\\\\\*(?=.+)/g,\n\n // '*.js' matches '.js'\n // '*.js' doesn't match 'abc'\n (_, p1) => `${p1}[^\\\\/]*`\n ],\n\n [\n // unescape, revert step 3 except for back slash\n // For example, if a user escape a '\\\\*',\n // after step 3, the result will be '\\\\\\\\\\\\*'\n /\\\\\\\\\\\\(?=[$.|*+(){^])/g,\n () => ESCAPE\n ],\n\n [\n // '\\\\\\\\' -> '\\\\'\n /\\\\\\\\/g,\n () => ESCAPE\n ],\n\n [\n // > The range notation, e.g. [a-zA-Z],\n // > can be used to match one of the characters in a range.\n\n // `\\` is escaped by step 3\n /(\\\\)?\\[([^\\]/]*?)(\\\\*)($|\\])/g,\n (match, leadEscape, range, endEscape, close) => leadEscape === ESCAPE\n // '\\\\[bar]' -> '\\\\\\\\[bar\\\\]'\n ? `\\\\[${range}${cleanRangeBackSlash(endEscape)}${close}`\n : close === ']'\n ? endEscape.length % 2 === 0\n // A normal case, and it is a range notation\n // '[bar]'\n // '[bar\\\\\\\\]'\n ? `[${sanitizeRange(range)}${endEscape}]`\n // Invalid range notaton\n // '[bar\\\\]' -> '[bar\\\\\\\\]'\n : '[]'\n : '[]'\n ],\n\n // ending\n [\n // 'js' will not match 'js.'\n // 'ab' will not match 'abc'\n /(?:[^*])$/,\n\n // WTF!\n // https://git-scm.com/docs/gitignore\n // changes in [2.22.1](https://git-scm.com/docs/gitignore/2.22.1)\n // which re-fixes #24, #38\n\n // > If there is a separator at the end of the pattern then the pattern\n // > will only match directories, otherwise the pattern can match both\n // > files and directories.\n\n // 'js*' will not match 'a.js'\n // 'js/' will not match 'a.js'\n // 'js' will match 'a.js' and 'a.js/'\n match => /\\/$/.test(match)\n // foo/ will not match 'foo'\n ? `${match}$`\n // foo matches 'foo' and 'foo/'\n : `${match}(?=$|\\\\/$)`\n ],\n\n // trailing wildcard\n [\n /(\\^|\\\\\\/)?\\\\\\*$/,\n (_, p1) => {\n const prefix = p1\n // '\\^':\n // '/*' does not match EMPTY\n // '/*' does not match everything\n\n // '\\\\\\/':\n // 'abc/*' does not match 'abc/'\n ? `${p1}[^/]+`\n\n // 'a*' matches 'a'\n // 'a*' matches 'aa'\n : '[^/]*'\n\n return `${prefix}(?=$|\\\\/$)`\n }\n ],\n]\n\n// A simple cache, because an ignore rule only has only one certain meaning\nconst regexCache = Object.create(null)\n\n// @param {pattern}\nconst makeRegex = (pattern, ignoreCase) => {\n let source = regexCache[pattern]\n\n if (!source) {\n source = REPLACERS.reduce(\n (prev, current) => prev.replace(current[0], current[1].bind(pattern)),\n pattern\n )\n regexCache[pattern] = source\n }\n\n return ignoreCase\n ? new RegExp(source, 'i')\n : new RegExp(source)\n}\n\nconst isString = subject => typeof subject === 'string'\n\n// > A blank line matches no files, so it can serve as a separator for readability.\nconst checkPattern = pattern => pattern\n && isString(pattern)\n && !REGEX_TEST_BLANK_LINE.test(pattern)\n\n // > A line starting with # serves as a comment.\n && pattern.indexOf('#') !== 0\n\nconst splitPattern = pattern => pattern.split(REGEX_SPLITALL_CRLF)\n\nclass IgnoreRule {\n constructor (\n origin,\n pattern,\n negative,\n regex\n ) {\n this.origin = origin\n this.pattern = pattern\n this.negative = negative\n this.regex = regex\n }\n}\n\nconst createRule = (pattern, ignoreCase) => {\n const origin = pattern\n let negative = false\n\n // > An optional prefix \"!\" which negates the pattern;\n if (pattern.indexOf('!') === 0) {\n negative = true\n pattern = pattern.substr(1)\n }\n\n pattern = pattern\n // > Put a backslash (\"\\\") in front of the first \"!\" for patterns that\n // > begin with a literal \"!\", for example, `\"\\!important!.txt\"`.\n .replace(REGEX_REPLACE_LEADING_EXCAPED_EXCLAMATION, '!')\n // > Put a backslash (\"\\\") in front of the first hash for patterns that\n // > begin with a hash.\n .replace(REGEX_REPLACE_LEADING_EXCAPED_HASH, '#')\n\n const regex = makeRegex(pattern, ignoreCase)\n\n return new IgnoreRule(\n origin,\n pattern,\n negative,\n regex\n )\n}\n\nconst throwError = (message, Ctor) => {\n throw new Ctor(message)\n}\n\nconst checkPath = (path, originalPath, doThrow) => {\n if (!isString(path)) {\n return doThrow(\n `path must be a string, but got \\`${originalPath}\\``,\n TypeError\n )\n }\n\n // We don't know if we should ignore EMPTY, so throw\n if (!path) {\n return doThrow(`path must not be empty`, TypeError)\n }\n\n // Check if it is a relative path\n if (checkPath.isNotRelative(path)) {\n const r = '`path.relative()`d'\n return doThrow(\n `path should be a ${r} string, but got \"${originalPath}\"`,\n RangeError\n )\n }\n\n return true\n}\n\nconst isNotRelative = path => REGEX_TEST_INVALID_PATH.test(path)\n\ncheckPath.isNotRelative = isNotRelative\ncheckPath.convert = p => p\n\nclass Ignore {\n constructor ({\n ignorecase = true,\n ignoreCase = ignorecase,\n allowRelativePaths = false\n } = {}) {\n define(this, KEY_IGNORE, true)\n\n this._rules = []\n this._ignoreCase = ignoreCase\n this._allowRelativePaths = allowRelativePaths\n this._initCache()\n }\n\n _initCache () {\n this._ignoreCache = Object.create(null)\n this._testCache = Object.create(null)\n }\n\n _addPattern (pattern) {\n // #32\n if (pattern && pattern[KEY_IGNORE]) {\n this._rules = this._rules.concat(pattern._rules)\n this._added = true\n return\n }\n\n if (checkPattern(pattern)) {\n const rule = createRule(pattern, this._ignoreCase)\n this._added = true\n this._rules.push(rule)\n }\n }\n\n // @param {Array<string> | string | Ignore} pattern\n add (pattern) {\n this._added = false\n\n makeArray(\n isString(pattern)\n ? splitPattern(pattern)\n : pattern\n ).forEach(this._addPattern, this)\n\n // Some rules have just added to the ignore,\n // making the behavior changed.\n if (this._added) {\n this._initCache()\n }\n\n return this\n }\n\n // legacy\n addPattern (pattern) {\n return this.add(pattern)\n }\n\n // | ignored : unignored\n // negative | 0:0 | 0:1 | 1:0 | 1:1\n // -------- | ------- | ------- | ------- | --------\n // 0 | TEST | TEST | SKIP | X\n // 1 | TESTIF | SKIP | TEST | X\n\n // - SKIP: always skip\n // - TEST: always test\n // - TESTIF: only test if checkUnignored\n // - X: that never happen\n\n // @param {boolean} whether should check if the path is unignored,\n // setting `checkUnignored` to `false` could reduce additional\n // path matching.\n\n // @returns {TestResult} true if a file is ignored\n _testOne (path, checkUnignored) {\n let ignored = false\n let unignored = false\n\n this._rules.forEach(rule => {\n const {negative} = rule\n if (\n unignored === negative && ignored !== unignored\n || negative && !ignored && !unignored && !checkUnignored\n ) {\n return\n }\n\n const matched = rule.regex.test(path)\n\n if (matched) {\n ignored = !negative\n unignored = negative\n }\n })\n\n return {\n ignored,\n unignored\n }\n }\n\n // @returns {TestResult}\n _test (originalPath, cache, checkUnignored, slices) {\n const path = originalPath\n // Supports nullable path\n && checkPath.convert(originalPath)\n\n checkPath(\n path,\n originalPath,\n this._allowRelativePaths\n ? RETURN_FALSE\n : throwError\n )\n\n return this._t(path, cache, checkUnignored, slices)\n }\n\n _t (path, cache, checkUnignored, slices) {\n if (path in cache) {\n return cache[path]\n }\n\n if (!slices) {\n // path/to/a.js\n // ['path', 'to', 'a.js']\n slices = path.split(SLASH)\n }\n\n slices.pop()\n\n // If the path has no parent directory, just test it\n if (!slices.length) {\n return cache[path] = this._testOne(path, checkUnignored)\n }\n\n const parent = this._t(\n slices.join(SLASH) + SLASH,\n cache,\n checkUnignored,\n slices\n )\n\n // If the path contains a parent directory, check the parent first\n return cache[path] = parent.ignored\n // > It is not possible to re-include a file if a parent directory of\n // > that file is excluded.\n ? parent\n : this._testOne(path, checkUnignored)\n }\n\n ignores (path) {\n return this._test(path, this._ignoreCache, false).ignored\n }\n\n createFilter () {\n return path => !this.ignores(path)\n }\n\n filter (paths) {\n return makeArray(paths).filter(this.createFilter())\n }\n\n // @returns {TestResult}\n test (path) {\n return this._test(path, this._testCache, true)\n }\n}\n\nconst factory = options => new Ignore(options)\n\nconst isPathValid = path =>\n checkPath(path && checkPath.convert(path), path, RETURN_FALSE)\n\nfactory.isPathValid = isPathValid\n\n// Fixes typescript\nfactory.default = factory\n\nmodule.exports = factory\n\n// Windows\n// --------------------------------------------------------------\n/* istanbul ignore if */\nif (\n // Detect `process` so that it can run in browsers.\n typeof process !== 'undefined'\n && (\n process.env && process.env.IGNORE_TEST_WIN32\n || process.platform === 'win32'\n )\n) {\n /* eslint no-control-regex: \"off\" */\n const makePosix = str => /^\\\\\\\\\\?\\\\/.test(str)\n || /[\"<>|\\u0000-\\u001F]+/u.test(str)\n ? str\n : str.replace(/\\\\/g, '/')\n\n checkPath.convert = makePosix\n\n // 'C:\\\\foo' <- 'C:\\\\foo' has been converted to 'C:/'\n // 'd:\\\\foo'\n const REGIX_IS_WINDOWS_PATH_ABSOLUTE = /^[a-z]:\\//i\n checkPath.isNotRelative = path =>\n REGIX_IS_WINDOWS_PATH_ABSOLUTE.test(path)\n || isNotRelative(path)\n}\n","import { InternalError } from '../errors/InternalError.js'\n\nexport async function writeObjectLoose({ fs, gitdir, object, format, oid }) {\n if (format !== 'deflated') {\n throw new InternalError(\n 'GitObjectStoreLoose expects objects to write to be in deflated format'\n )\n }\n const source = `objects/${oid.slice(0, 2)}/${oid.slice(2)}`\n const filepath = `${gitdir}/${source}`\n // Don't overwrite existing git objects - this helps avoid EPERM errors.\n // Although I don't know how we'd fix corrupted objects then. Perhaps delete them\n // on read?\n if (!(await fs.exists(filepath))) await fs.write(filepath, object)\n}\n","// Copyright (c) 2006, 2008 Tony Garnock-Jones <tonyg@lshift.net>\n// Copyright (c) 2006, 2008 LShift Ltd. <query@lshift.net>\n//\n// Permission is hereby granted, free of charge, to any person\n// obtaining a copy of this software and associated documentation files\n// (the \"Software\"), to deal in the Software without restriction,\n// including without limitation the rights to use, copy, modify, merge,\n// publish, distribute, sublicense, and/or sell copies of the Software,\n// and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be\n// included in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\n// BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\n// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n// SOFTWARE.\n\nvar onp = require('./onp');\n\nfunction longestCommonSubsequence(file1, file2) {\n var diff = new onp(file1, file2);\n diff.compose();\n var ses = diff.getses();\n\n var root;\n var prev;\n var file1RevIdx = file1.length - 1,\n file2RevIdx = file2.length - 1;\n for (var i = ses.length - 1; i >= 0; --i) {\n if (ses[i].t === diff.SES_COMMON) {\n if (prev) {\n prev.chain = {\n file1index: file1RevIdx,\n file2index: file2RevIdx,\n chain: null\n };\n prev = prev.chain;\n } else {\n root = {\n file1index: file1RevIdx,\n file2index: file2RevIdx,\n chain: null\n };\n prev = root;\n }\n file1RevIdx--;\n file2RevIdx--;\n } else if (ses[i].t === diff.SES_DELETE) {\n file1RevIdx--;\n } else if (ses[i].t === diff.SES_ADD) {\n file2RevIdx--;\n }\n }\n\n var tail = {\n file1index: -1,\n file2index: -1,\n chain: null\n };\n\n if (!prev) {\n return tail;\n }\n\n prev.chain = tail;\n\n return root;\n}\n\nfunction diffIndices(file1, file2) {\n // We apply the LCS to give a simple representation of the\n // offsets and lengths of mismatched chunks in the input\n // files. This is used by diff3_merge_indices below.\n\n var result = [];\n var tail1 = file1.length;\n var tail2 = file2.length;\n\n for (var candidate = longestCommonSubsequence(file1, file2); candidate !== null; candidate = candidate.chain) {\n var mismatchLength1 = tail1 - candidate.file1index - 1;\n var mismatchLength2 = tail2 - candidate.file2index - 1;\n tail1 = candidate.file1index;\n tail2 = candidate.file2index;\n\n if (mismatchLength1 || mismatchLength2) {\n result.push({\n file1: [tail1 + 1, mismatchLength1],\n file2: [tail2 + 1, mismatchLength2]\n });\n }\n }\n\n result.reverse();\n return result;\n}\n\nfunction diff3MergeIndices(a, o, b) {\n // Given three files, A, O, and B, where both A and B are\n // independently derived from O, returns a fairly complicated\n // internal representation of merge decisions it's taken. The\n // interested reader may wish to consult\n //\n // Sanjeev Khanna, Keshav Kunal, and Benjamin C. Pierce. \"A\n // Formal Investigation of Diff3.\" In Arvind and Prasad,\n // editors, Foundations of Software Technology and Theoretical\n // Computer Science (FSTTCS), December 2007.\n //\n // (http://www.cis.upenn.edu/~bcpierce/papers/diff3-short.pdf)\n var i;\n\n var m1 = diffIndices(o, a);\n var m2 = diffIndices(o, b);\n\n var hunks = [];\n\n function addHunk(h, side) {\n hunks.push([h.file1[0], side, h.file1[1], h.file2[0], h.file2[1]]);\n }\n for (i = 0; i < m1.length; i++) {\n addHunk(m1[i], 0);\n }\n for (i = 0; i < m2.length; i++) {\n addHunk(m2[i], 2);\n }\n hunks.sort(function(x, y) {\n return x[0] - y[0]\n });\n\n var result = [];\n var commonOffset = 0;\n\n function copyCommon(targetOffset) {\n if (targetOffset > commonOffset) {\n result.push([1, commonOffset, targetOffset - commonOffset]);\n commonOffset = targetOffset;\n }\n }\n\n for (var hunkIndex = 0; hunkIndex < hunks.length; hunkIndex++) {\n var firstHunkIndex = hunkIndex;\n var hunk = hunks[hunkIndex];\n var regionLhs = hunk[0];\n var regionRhs = regionLhs + hunk[2];\n while (hunkIndex < hunks.length - 1) {\n var maybeOverlapping = hunks[hunkIndex + 1];\n var maybeLhs = maybeOverlapping[0];\n if (maybeLhs > regionRhs) break;\n regionRhs = Math.max(regionRhs, maybeLhs + maybeOverlapping[2]);\n hunkIndex++;\n }\n\n copyCommon(regionLhs);\n if (firstHunkIndex == hunkIndex) {\n // The \"overlap\" was only one hunk long, meaning that\n // there's no conflict here. Either a and o were the\n // same, or b and o were the same.\n if (hunk[4] > 0) {\n result.push([hunk[1], hunk[3], hunk[4]]);\n }\n } else {\n // A proper conflict. Determine the extents of the\n // regions involved from a, o and b. Effectively merge\n // all the hunks on the left into one giant hunk, and\n // do the same for the right; then, correct for skew\n // in the regions of o that each side changed, and\n // report appropriate spans for the three sides.\n var regions = {\n 0: [a.length, -1, o.length, -1],\n 2: [b.length, -1, o.length, -1]\n };\n for (i = firstHunkIndex; i <= hunkIndex; i++) {\n hunk = hunks[i];\n var side = hunk[1];\n var r = regions[side];\n var oLhs = hunk[0];\n var oRhs = oLhs + hunk[2];\n var abLhs = hunk[3];\n var abRhs = abLhs + hunk[4];\n r[0] = Math.min(abLhs, r[0]);\n r[1] = Math.max(abRhs, r[1]);\n r[2] = Math.min(oLhs, r[2]);\n r[3] = Math.max(oRhs, r[3]);\n }\n var aLhs = regions[0][0] + (regionLhs - regions[0][2]);\n var aRhs = regions[0][1] + (regionRhs - regions[0][3]);\n var bLhs = regions[2][0] + (regionLhs - regions[2][2]);\n var bRhs = regions[2][1] + (regionRhs - regions[2][3]);\n result.push([-1,\n aLhs, aRhs - aLhs,\n regionLhs, regionRhs - regionLhs,\n bLhs, bRhs - bLhs\n ]);\n }\n commonOffset = regionRhs;\n }\n\n copyCommon(o.length);\n return result;\n}\n\nfunction diff3Merge(a, o, b) {\n // Applies the output of Diff.diff3_merge_indices to actually\n // construct the merged file; the returned result alternates\n // between \"ok\" and \"conflict\" blocks.\n\n var result = [];\n var files = [a, o, b];\n var indices = diff3MergeIndices(a, o, b);\n\n var okLines = [];\n\n function flushOk() {\n if (okLines.length) {\n result.push({\n ok: okLines\n });\n }\n okLines = [];\n }\n\n function pushOk(xs) {\n for (var j = 0; j < xs.length; j++) {\n okLines.push(xs[j]);\n }\n }\n\n function isTrueConflict(rec) {\n if (rec[2] != rec[6]) return true;\n var aoff = rec[1];\n var boff = rec[5];\n for (var j = 0; j < rec[2]; j++) {\n if (a[j + aoff] != b[j + boff]) return true;\n }\n return false;\n }\n\n for (var i = 0; i < indices.length; i++) {\n var x = indices[i];\n var side = x[0];\n if (side == -1) {\n if (!isTrueConflict(x)) {\n pushOk(files[0].slice(x[1], x[1] + x[2]));\n } else {\n flushOk();\n result.push({\n conflict: {\n a: a.slice(x[1], x[1] + x[2]),\n aIndex: x[1],\n o: o.slice(x[3], x[3] + x[4]),\n oIndex: x[3],\n b: b.slice(x[5], x[5] + x[6]),\n bIndex: x[5]\n }\n });\n }\n } else {\n pushOk(files[side].slice(x[1], x[1] + x[2]));\n }\n }\n\n flushOk();\n return result;\n}\n\nmodule.exports = diff3Merge;\n","/**\n * @enum {number}\n */\nexport const types = {\n commit: 0b0010000,\n tree: 0b0100000,\n blob: 0b0110000,\n tag: 0b1000000,\n ofs_delta: 0b1100000,\n ref_delta: 0b1110000,\n}\n","export function filterCapabilities(server, client) {\n const serverNames = server.map(cap => cap.split('=', 1)[0])\n return client.filter(cap => {\n const name = cap.split('=', 1)[0]\n return serverNames.includes(name)\n })\n}\n","import { FIFO } from './FIFO.js'\nimport { forAwait } from './forAwait.js'\n\n// Note: progress messages are designed to be written directly to the terminal,\n// so they are often sent with just a carriage return to overwrite the last line of output.\n// But there are also messages delimited with newlines.\n// I also include CRLF just in case.\nfunction findSplit(str) {\n const r = str.indexOf('\\r')\n const n = str.indexOf('\\n')\n if (r === -1 && n === -1) return -1\n if (r === -1) return n + 1 // \\n\n if (n === -1) return r + 1 // \\r\n if (n === r + 1) return n + 1 // \\r\\n\n return Math.min(r, n) + 1 // \\r or \\n\n}\n\nexport function splitLines(input) {\n const output = new FIFO()\n let tmp = ''\n ;(async () => {\n await forAwait(input, chunk => {\n chunk = chunk.toString('utf8')\n tmp += chunk\n while (true) {\n const i = findSplit(tmp)\n if (i === -1) break\n output.write(tmp.slice(0, i))\n tmp = tmp.slice(i)\n }\n })\n if (tmp.length > 0) {\n output.write(tmp)\n }\n output.end()\n })()\n return output\n}\n","'use strict';\n\nvar AsyncLock = function (opts) {\n\topts = opts || {};\n\n\tthis.Promise = opts.Promise || Promise;\n\n\t// format: {key : [fn, fn]}\n\t// queues[key] = null indicates no job running for key\n\tthis.queues = {};\n\n\t// domain of current running func {key : fn}\n\tthis.domains = {};\n\n\t// lock is reentrant for same domain\n\tthis.domainReentrant = opts.domainReentrant || false;\n\n\tthis.timeout = opts.timeout || AsyncLock.DEFAULT_TIMEOUT;\n\tthis.maxPending = opts.maxPending || AsyncLock.DEFAULT_MAX_PENDING;\n};\n\nAsyncLock.DEFAULT_TIMEOUT = 0; //Never\nAsyncLock.DEFAULT_MAX_PENDING = 1000;\n\n/**\n * Acquire Locks\n *\n * @param {String|Array} key \tresource key or keys to lock\n * @param {function} fn \tasync function\n * @param {function} cb \tcallback function, otherwise will return a promise\n * @param {Object} opts \toptions\n */\nAsyncLock.prototype.acquire = function (key, fn, cb, opts) {\n\tif (Array.isArray(key)) {\n\t\treturn this._acquireBatch(key, fn, cb, opts);\n\t}\n\n\tif (typeof (fn) !== 'function') {\n\t\tthrow new Error('You must pass a function to execute');\n\t}\n\n\t// faux-deferred promise using new Promise() (as Promise.defer is deprecated)\n\tvar deferredResolve = null;\n\tvar deferredReject = null;\n\tvar deferred = null;\n\n\tif (typeof (cb) !== 'function') {\n\t\topts = cb;\n\t\tcb = null;\n\n\t\t// will return a promise\n\t\tdeferred = new this.Promise(function(resolve, reject) {\n\t\t\tdeferredResolve = resolve;\n\t\t\tdeferredReject = reject;\n\t\t});\n\t}\n\n\topts = opts || {};\n\n\tvar resolved = false;\n\tvar timer = null;\n\tvar self = this;\n\n\tvar done = function (locked, err, ret) {\n\t\tif (locked) {\n\t\t\tif (self.queues[key].length === 0) {\n\t\t\t\tdelete self.queues[key];\n\t\t\t}\n\t\t\tdelete self.domains[key];\n\t\t}\n\n\t\tif (!resolved) {\n\t\t\tif (!deferred) {\n\t\t\t\tif (typeof (cb) === 'function') {\n\t\t\t\t\tcb(err, ret);\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\t//promise mode\n\t\t\t\tif (err) {\n\t\t\t\t\tdeferredReject(err);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tdeferredResolve(ret);\n\t\t\t\t}\n\t\t\t}\n\t\t\tresolved = true;\n\t\t}\n\n\t\tif (locked) {\n\t\t\t//run next func\n\t\t\tif (!!self.queues[key] && self.queues[key].length > 0) {\n\t\t\t\tself.queues[key].shift()();\n\t\t\t}\n\t\t}\n\t};\n\n\tvar exec = function (locked) {\n\t\tif (resolved) { // may due to timed out\n\t\t\treturn done(locked);\n\t\t}\n\n\t\tif (timer) {\n\t\t\tclearTimeout(timer);\n\t\t\ttimer = null;\n\t\t}\n\n\t\tif (locked) {\n\t\t\tself.domains[key] = process.domain;\n\t\t}\n\n\t\t// Callback mode\n\t\tif (fn.length === 1) {\n\t\t\tvar called = false;\n\t\t\tfn(function (err, ret) {\n\t\t\t\tif (!called) {\n\t\t\t\t\tcalled = true;\n\t\t\t\t\tdone(locked, err, ret);\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t\telse {\n\t\t\t// Promise mode\n\t\t\tself._promiseTry(function () {\n\t\t\t\treturn fn();\n\t\t\t})\n\t\t\t.then(function(ret){\n\t\t\t\tdone(locked, undefined, ret);\n\t\t\t}, function(error){\n\t\t\t\tdone(locked, error);\n\t\t\t});\n\t\t}\n\t};\n\tif (!!process.domain) {\n\t\texec = process.domain.bind(exec);\n\t}\n\n\tif (!self.queues[key]) {\n\t\tself.queues[key] = [];\n\t\texec(true);\n\t}\n\telse if (self.domainReentrant && !!process.domain && process.domain === self.domains[key]) {\n\t\t// If code is in the same domain of current running task, run it directly\n\t\t// Since lock is re-enterable\n\t\texec(false);\n\t}\n\telse if (self.queues[key].length >= self.maxPending) {\n\t\tdone(false, new Error('Too much pending tasks'));\n\t}\n\telse {\n\t\tvar taskFn = function () {\n\t\t\texec(true);\n\t\t};\n\t\tif (opts.skipQueue) {\n\t\t\tself.queues[key].unshift(taskFn);\n\t\t} else {\n\t\t\tself.queues[key].push(taskFn);\n\t\t}\n\n\t\tvar timeout = opts.timeout || self.timeout;\n\t\tif (timeout) {\n\t\t\ttimer = setTimeout(function () {\n\t\t\t\ttimer = null;\n\t\t\t\tdone(false, new Error('async-lock timed out'));\n\t\t\t}, timeout);\n\t\t}\n\t}\n\n\tif (deferred) {\n\t\treturn deferred;\n\t}\n};\n\n/*\n * Below is how this function works:\n *\n * Equivalent code:\n * self.acquire(key1, function(cb){\n * self.acquire(key2, function(cb){\n * self.acquire(key3, fn, cb);\n * }, cb);\n * }, cb);\n *\n * Equivalent code:\n * var fn3 = getFn(key3, fn);\n * var fn2 = getFn(key2, fn3);\n * var fn1 = getFn(key1, fn2);\n * fn1(cb);\n */\nAsyncLock.prototype._acquireBatch = function (keys, fn, cb, opts) {\n\tif (typeof (cb) !== 'function') {\n\t\topts = cb;\n\t\tcb = null;\n\t}\n\n\tvar self = this;\n\tvar getFn = function (key, fn) {\n\t\treturn function (cb) {\n\t\t\tself.acquire(key, fn, cb, opts);\n\t\t};\n\t};\n\n\tvar fnx = fn;\n\tkeys.reverse().forEach(function (key) {\n\t\tfnx = getFn(key, fnx);\n\t});\n\n\tif (typeof (cb) === 'function') {\n\t\tfnx(cb);\n\t}\n\telse {\n\t\treturn new this.Promise(function (resolve, reject) {\n\t\t\t// check for promise mode in case keys is empty array\n\t\t\tif (fnx.length === 1) {\n\t\t\t\tfnx(function (err, ret) {\n\t\t\t\t\tif (err) {\n\t\t\t\t\t\treject(err);\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tresolve(ret);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tresolve(fnx());\n\t\t\t}\n\t\t});\n\t}\n};\n\n/*\n *\tWhether there is any running or pending asyncFunc\n *\n *\t@param {String} key\n */\nAsyncLock.prototype.isBusy = function (key) {\n\tif (!key) {\n\t\treturn Object.keys(this.queues).length > 0;\n\t}\n\telse {\n\t\treturn !!this.queues[key];\n\t}\n};\n\n/**\n * Promise.try() implementation to become independent of Q-specific methods\n */\nAsyncLock.prototype._promiseTry = function(fn) {\n\ttry {\n\t\treturn this.Promise.resolve(fn());\n\t} catch (e) {\n\t\treturn this.Promise.reject(e);\n\t}\n};\n\nmodule.exports = AsyncLock;\n","var g;\n\n// This works in non-strict mode\ng = (function() {\n\treturn this;\n})();\n\ntry {\n\t// This works if eval is allowed (see CSP)\n\tg = g || new Function(\"return this\")();\n} catch (e) {\n\t// This works if the window reference is available\n\tif (typeof window === \"object\") g = window;\n}\n\n// g can still be undefined, but nothing to do about it...\n// We return undefined, instead of nothing here, so it's\n// easier to handle this case. if(!global) { ...}\n\nmodule.exports = g;\n","'use strict'\n\nexports.byteLength = byteLength\nexports.toByteArray = toByteArray\nexports.fromByteArray = fromByteArray\n\nvar lookup = []\nvar revLookup = []\nvar Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array\n\nvar code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'\nfor (var i = 0, len = code.length; i < len; ++i) {\n lookup[i] = code[i]\n revLookup[code.charCodeAt(i)] = i\n}\n\n// Support decoding URL-safe base64 strings, as Node.js does.\n// See: https://en.wikipedia.org/wiki/Base64#URL_applications\nrevLookup['-'.charCodeAt(0)] = 62\nrevLookup['_'.charCodeAt(0)] = 63\n\nfunction getLens (b64) {\n var len = b64.length\n\n if (len % 4 > 0) {\n throw new Error('Invalid string. Length must be a multiple of 4')\n }\n\n // Trim off extra bytes after placeholder bytes are found\n // See: https://github.com/beatgammit/base64-js/issues/42\n var validLen = b64.indexOf('=')\n if (validLen === -1) validLen = len\n\n var placeHoldersLen = validLen === len\n ? 0\n : 4 - (validLen % 4)\n\n return [validLen, placeHoldersLen]\n}\n\n// base64 is 4/3 + up to two characters of the original data\nfunction byteLength (b64) {\n var lens = getLens(b64)\n var validLen = lens[0]\n var placeHoldersLen = lens[1]\n return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen\n}\n\nfunction _byteLength (b64, validLen, placeHoldersLen) {\n return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen\n}\n\nfunction toByteArray (b64) {\n var tmp\n var lens = getLens(b64)\n var validLen = lens[0]\n var placeHoldersLen = lens[1]\n\n var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))\n\n var curByte = 0\n\n // if there are placeholders, only get up to the last complete 4 chars\n var len = placeHoldersLen > 0\n ? validLen - 4\n : validLen\n\n var i\n for (i = 0; i < len; i += 4) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 18) |\n (revLookup[b64.charCodeAt(i + 1)] << 12) |\n (revLookup[b64.charCodeAt(i + 2)] << 6) |\n revLookup[b64.charCodeAt(i + 3)]\n arr[curByte++] = (tmp >> 16) & 0xFF\n arr[curByte++] = (tmp >> 8) & 0xFF\n arr[curByte++] = tmp & 0xFF\n }\n\n if (placeHoldersLen === 2) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 2) |\n (revLookup[b64.charCodeAt(i + 1)] >> 4)\n arr[curByte++] = tmp & 0xFF\n }\n\n if (placeHoldersLen === 1) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 10) |\n (revLookup[b64.charCodeAt(i + 1)] << 4) |\n (revLookup[b64.charCodeAt(i + 2)] >> 2)\n arr[curByte++] = (tmp >> 8) & 0xFF\n arr[curByte++] = tmp & 0xFF\n }\n\n return arr\n}\n\nfunction tripletToBase64 (num) {\n return lookup[num >> 18 & 0x3F] +\n lookup[num >> 12 & 0x3F] +\n lookup[num >> 6 & 0x3F] +\n lookup[num & 0x3F]\n}\n\nfunction encodeChunk (uint8, start, end) {\n var tmp\n var output = []\n for (var i = start; i < end; i += 3) {\n tmp =\n ((uint8[i] << 16) & 0xFF0000) +\n ((uint8[i + 1] << 8) & 0xFF00) +\n (uint8[i + 2] & 0xFF)\n output.push(tripletToBase64(tmp))\n }\n return output.join('')\n}\n\nfunction fromByteArray (uint8) {\n var tmp\n var len = uint8.length\n var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes\n var parts = []\n var maxChunkLength = 16383 // must be multiple of 3\n\n // go through the array every three bytes, we'll deal with trailing stuff later\n for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {\n parts.push(encodeChunk(\n uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)\n ))\n }\n\n // pad the end with zeros, but make sure to not forget the extra bytes\n if (extraBytes === 1) {\n tmp = uint8[len - 1]\n parts.push(\n lookup[tmp >> 2] +\n lookup[(tmp << 4) & 0x3F] +\n '=='\n )\n } else if (extraBytes === 2) {\n tmp = (uint8[len - 2] << 8) + uint8[len - 1]\n parts.push(\n lookup[tmp >> 10] +\n lookup[(tmp >> 4) & 0x3F] +\n lookup[(tmp << 2) & 0x3F] +\n '='\n )\n }\n\n return parts.join('')\n}\n","exports.read = function (buffer, offset, isLE, mLen, nBytes) {\n var e, m\n var eLen = (nBytes * 8) - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var nBits = -7\n var i = isLE ? (nBytes - 1) : 0\n var d = isLE ? -1 : 1\n var s = buffer[offset + i]\n\n i += d\n\n e = s & ((1 << (-nBits)) - 1)\n s >>= (-nBits)\n nBits += eLen\n for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}\n\n m = e & ((1 << (-nBits)) - 1)\n e >>= (-nBits)\n nBits += mLen\n for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}\n\n if (e === 0) {\n e = 1 - eBias\n } else if (e === eMax) {\n return m ? NaN : ((s ? -1 : 1) * Infinity)\n } else {\n m = m + Math.pow(2, mLen)\n e = e - eBias\n }\n return (s ? -1 : 1) * m * Math.pow(2, e - mLen)\n}\n\nexports.write = function (buffer, value, offset, isLE, mLen, nBytes) {\n var e, m, c\n var eLen = (nBytes * 8) - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)\n var i = isLE ? 0 : (nBytes - 1)\n var d = isLE ? 1 : -1\n var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0\n\n value = Math.abs(value)\n\n if (isNaN(value) || value === Infinity) {\n m = isNaN(value) ? 1 : 0\n e = eMax\n } else {\n e = Math.floor(Math.log(value) / Math.LN2)\n if (value * (c = Math.pow(2, -e)) < 1) {\n e--\n c *= 2\n }\n if (e + eBias >= 1) {\n value += rt / c\n } else {\n value += rt * Math.pow(2, 1 - eBias)\n }\n if (value * c >= 2) {\n e++\n c /= 2\n }\n\n if (e + eBias >= eMax) {\n m = 0\n e = eMax\n } else if (e + eBias >= 1) {\n m = ((value * c) - 1) * Math.pow(2, mLen)\n e = e + eBias\n } else {\n m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)\n e = 0\n }\n }\n\n for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}\n\n e = (e << mLen) | m\n eLen += mLen\n for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}\n\n buffer[offset + i - d] |= s * 128\n}\n","var toString = {}.toString;\n\nmodule.exports = Array.isArray || function (arr) {\n return toString.call(arr) == '[object Array]';\n};\n","if (typeof Object.create === 'function') {\n // implementation from standard node.js 'util' module\n module.exports = function inherits(ctor, superCtor) {\n ctor.super_ = superCtor\n ctor.prototype = Object.create(superCtor.prototype, {\n constructor: {\n value: ctor,\n enumerable: false,\n writable: true,\n configurable: true\n }\n });\n };\n} else {\n // old school shim for old browsers\n module.exports = function inherits(ctor, superCtor) {\n ctor.super_ = superCtor\n var TempCtor = function () {}\n TempCtor.prototype = superCtor.prototype\n ctor.prototype = new TempCtor()\n ctor.prototype.constructor = ctor\n }\n}\n","var Buffer = require('safe-buffer').Buffer\n\n// prototype class for hash functions\nfunction Hash (blockSize, finalSize) {\n this._block = Buffer.alloc(blockSize)\n this._finalSize = finalSize\n this._blockSize = blockSize\n this._len = 0\n}\n\nHash.prototype.update = function (data, enc) {\n if (typeof data === 'string') {\n enc = enc || 'utf8'\n data = Buffer.from(data, enc)\n }\n\n var block = this._block\n var blockSize = this._blockSize\n var length = data.length\n var accum = this._len\n\n for (var offset = 0; offset < length;) {\n var assigned = accum % blockSize\n var remainder = Math.min(length - offset, blockSize - assigned)\n\n for (var i = 0; i < remainder; i++) {\n block[assigned + i] = data[offset + i]\n }\n\n accum += remainder\n offset += remainder\n\n if ((accum % blockSize) === 0) {\n this._update(block)\n }\n }\n\n this._len += length\n return this\n}\n\nHash.prototype.digest = function (enc) {\n var rem = this._len % this._blockSize\n\n this._block[rem] = 0x80\n\n // zero (rem + 1) trailing bits, where (rem + 1) is the smallest\n // non-negative solution to the equation (length + 1 + (rem + 1)) === finalSize mod blockSize\n this._block.fill(0, rem + 1)\n\n if (rem >= this._finalSize) {\n this._update(this._block)\n this._block.fill(0)\n }\n\n var bits = this._len * 8\n\n // uint32\n if (bits <= 0xffffffff) {\n this._block.writeUInt32BE(bits, this._blockSize - 4)\n\n // uint64\n } else {\n var lowBits = (bits & 0xffffffff) >>> 0\n var highBits = (bits - lowBits) / 0x100000000\n\n this._block.writeUInt32BE(highBits, this._blockSize - 8)\n this._block.writeUInt32BE(lowBits, this._blockSize - 4)\n }\n\n this._update(this._block)\n var hash = this._hash()\n\n return enc ? hash.toString(enc) : hash\n}\n\nHash.prototype._update = function () {\n throw new Error('_update must be implemented by subclass')\n}\n\nmodule.exports = Hash\n","'use strict';\n\n\nvar zlib_deflate = require('./zlib/deflate');\nvar utils = require('./utils/common');\nvar strings = require('./utils/strings');\nvar msg = require('./zlib/messages');\nvar ZStream = require('./zlib/zstream');\n\nvar toString = Object.prototype.toString;\n\n/* Public constants ==========================================================*/\n/* ===========================================================================*/\n\nvar Z_NO_FLUSH = 0;\nvar Z_FINISH = 4;\n\nvar Z_OK = 0;\nvar Z_STREAM_END = 1;\nvar Z_SYNC_FLUSH = 2;\n\nvar Z_DEFAULT_COMPRESSION = -1;\n\nvar Z_DEFAULT_STRATEGY = 0;\n\nvar Z_DEFLATED = 8;\n\n/* ===========================================================================*/\n\n\n/**\n * class Deflate\n *\n * Generic JS-style wrapper for zlib calls. If you don't need\n * streaming behaviour - use more simple functions: [[deflate]],\n * [[deflateRaw]] and [[gzip]].\n **/\n\n/* internal\n * Deflate.chunks -> Array\n *\n * Chunks of output data, if [[Deflate#onData]] not overridden.\n **/\n\n/**\n * Deflate.result -> Uint8Array|Array\n *\n * Compressed result, generated by default [[Deflate#onData]]\n * and [[Deflate#onEnd]] handlers. Filled after you push last chunk\n * (call [[Deflate#push]] with `Z_FINISH` / `true` param) or if you\n * push a chunk with explicit flush (call [[Deflate#push]] with\n * `Z_SYNC_FLUSH` param).\n **/\n\n/**\n * Deflate.err -> Number\n *\n * Error code after deflate finished. 0 (Z_OK) on success.\n * You will not need it in real life, because deflate errors\n * are possible only on wrong options or bad `onData` / `onEnd`\n * custom handlers.\n **/\n\n/**\n * Deflate.msg -> String\n *\n * Error message, if [[Deflate.err]] != 0\n **/\n\n\n/**\n * new Deflate(options)\n * - options (Object): zlib deflate options.\n *\n * Creates new deflator instance with specified params. Throws exception\n * on bad params. Supported options:\n *\n * - `level`\n * - `windowBits`\n * - `memLevel`\n * - `strategy`\n * - `dictionary`\n *\n * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced)\n * for more information on these.\n *\n * Additional options, for internal needs:\n *\n * - `chunkSize` - size of generated data chunks (16K by default)\n * - `raw` (Boolean) - do raw deflate\n * - `gzip` (Boolean) - create gzip wrapper\n * - `to` (String) - if equal to 'string', then result will be \"binary string\"\n * (each char code [0..255])\n * - `header` (Object) - custom header for gzip\n * - `text` (Boolean) - true if compressed data believed to be text\n * - `time` (Number) - modification time, unix timestamp\n * - `os` (Number) - operation system code\n * - `extra` (Array) - array of bytes with extra data (max 65536)\n * - `name` (String) - file name (binary string)\n * - `comment` (String) - comment (binary string)\n * - `hcrc` (Boolean) - true if header crc should be added\n *\n * ##### Example:\n *\n * ```javascript\n * var pako = require('pako')\n * , chunk1 = Uint8Array([1,2,3,4,5,6,7,8,9])\n * , chunk2 = Uint8Array([10,11,12,13,14,15,16,17,18,19]);\n *\n * var deflate = new pako.Deflate({ level: 3});\n *\n * deflate.push(chunk1, false);\n * deflate.push(chunk2, true); // true -> last chunk\n *\n * if (deflate.err) { throw new Error(deflate.err); }\n *\n * console.log(deflate.result);\n * ```\n **/\nfunction Deflate(options) {\n if (!(this instanceof Deflate)) return new Deflate(options);\n\n this.options = utils.assign({\n level: Z_DEFAULT_COMPRESSION,\n method: Z_DEFLATED,\n chunkSize: 16384,\n windowBits: 15,\n memLevel: 8,\n strategy: Z_DEFAULT_STRATEGY,\n to: ''\n }, options || {});\n\n var opt = this.options;\n\n if (opt.raw && (opt.windowBits > 0)) {\n opt.windowBits = -opt.windowBits;\n }\n\n else if (opt.gzip && (opt.windowBits > 0) && (opt.windowBits < 16)) {\n opt.windowBits += 16;\n }\n\n this.err = 0; // error code, if happens (0 = Z_OK)\n this.msg = ''; // error message\n this.ended = false; // used to avoid multiple onEnd() calls\n this.chunks = []; // chunks of compressed data\n\n this.strm = new ZStream();\n this.strm.avail_out = 0;\n\n var status = zlib_deflate.deflateInit2(\n this.strm,\n opt.level,\n opt.method,\n opt.windowBits,\n opt.memLevel,\n opt.strategy\n );\n\n if (status !== Z_OK) {\n throw new Error(msg[status]);\n }\n\n if (opt.header) {\n zlib_deflate.deflateSetHeader(this.strm, opt.header);\n }\n\n if (opt.dictionary) {\n var dict;\n // Convert data if needed\n if (typeof opt.dictionary === 'string') {\n // If we need to compress text, change encoding to utf8.\n dict = strings.string2buf(opt.dictionary);\n } else if (toString.call(opt.dictionary) === '[object ArrayBuffer]') {\n dict = new Uint8Array(opt.dictionary);\n } else {\n dict = opt.dictionary;\n }\n\n status = zlib_deflate.deflateSetDictionary(this.strm, dict);\n\n if (status !== Z_OK) {\n throw new Error(msg[status]);\n }\n\n this._dict_set = true;\n }\n}\n\n/**\n * Deflate#push(data[, mode]) -> Boolean\n * - data (Uint8Array|Array|ArrayBuffer|String): input data. Strings will be\n * converted to utf8 byte sequence.\n * - mode (Number|Boolean): 0..6 for corresponding Z_NO_FLUSH..Z_TREE modes.\n * See constants. Skipped or `false` means Z_NO_FLUSH, `true` means Z_FINISH.\n *\n * Sends input data to deflate pipe, generating [[Deflate#onData]] calls with\n * new compressed chunks. Returns `true` on success. The last data block must have\n * mode Z_FINISH (or `true`). That will flush internal pending buffers and call\n * [[Deflate#onEnd]]. For interim explicit flushes (without ending the stream) you\n * can use mode Z_SYNC_FLUSH, keeping the compression context.\n *\n * On fail call [[Deflate#onEnd]] with error code and return false.\n *\n * We strongly recommend to use `Uint8Array` on input for best speed (output\n * array format is detected automatically). Also, don't skip last param and always\n * use the same type in your code (boolean or number). That will improve JS speed.\n *\n * For regular `Array`-s make sure all elements are [0..255].\n *\n * ##### Example\n *\n * ```javascript\n * push(chunk, false); // push one of data chunks\n * ...\n * push(chunk, true); // push last chunk\n * ```\n **/\nDeflate.prototype.push = function (data, mode) {\n var strm = this.strm;\n var chunkSize = this.options.chunkSize;\n var status, _mode;\n\n if (this.ended) { return false; }\n\n _mode = (mode === ~~mode) ? mode : ((mode === true) ? Z_FINISH : Z_NO_FLUSH);\n\n // Convert data if needed\n if (typeof data === 'string') {\n // If we need to compress text, change encoding to utf8.\n strm.input = strings.string2buf(data);\n } else if (toString.call(data) === '[object ArrayBuffer]') {\n strm.input = new Uint8Array(data);\n } else {\n strm.input = data;\n }\n\n strm.next_in = 0;\n strm.avail_in = strm.input.length;\n\n do {\n if (strm.avail_out === 0) {\n strm.output = new utils.Buf8(chunkSize);\n strm.next_out = 0;\n strm.avail_out = chunkSize;\n }\n status = zlib_deflate.deflate(strm, _mode); /* no bad return value */\n\n if (status !== Z_STREAM_END && status !== Z_OK) {\n this.onEnd(status);\n this.ended = true;\n return false;\n }\n if (strm.avail_out === 0 || (strm.avail_in === 0 && (_mode === Z_FINISH || _mode === Z_SYNC_FLUSH))) {\n if (this.options.to === 'string') {\n this.onData(strings.buf2binstring(utils.shrinkBuf(strm.output, strm.next_out)));\n } else {\n this.onData(utils.shrinkBuf(strm.output, strm.next_out));\n }\n }\n } while ((strm.avail_in > 0 || strm.avail_out === 0) && status !== Z_STREAM_END);\n\n // Finalize on the last chunk.\n if (_mode === Z_FINISH) {\n status = zlib_deflate.deflateEnd(this.strm);\n this.onEnd(status);\n this.ended = true;\n return status === Z_OK;\n }\n\n // callback interim results if Z_SYNC_FLUSH.\n if (_mode === Z_SYNC_FLUSH) {\n this.onEnd(Z_OK);\n strm.avail_out = 0;\n return true;\n }\n\n return true;\n};\n\n\n/**\n * Deflate#onData(chunk) -> Void\n * - chunk (Uint8Array|Array|String): output data. Type of array depends\n * on js engine support. When string output requested, each chunk\n * will be string.\n *\n * By default, stores data blocks in `chunks[]` property and glue\n * those in `onEnd`. Override this handler, if you need another behaviour.\n **/\nDeflate.prototype.onData = function (chunk) {\n this.chunks.push(chunk);\n};\n\n\n/**\n * Deflate#onEnd(status) -> Void\n * - status (Number): deflate status. 0 (Z_OK) on success,\n * other if not.\n *\n * Called once after you tell deflate that the input stream is\n * complete (Z_FINISH) or should be flushed (Z_SYNC_FLUSH)\n * or if an error happened. By default - join collected chunks,\n * free memory and fill `results` / `err` properties.\n **/\nDeflate.prototype.onEnd = function (status) {\n // On success - join\n if (status === Z_OK) {\n if (this.options.to === 'string') {\n this.result = this.chunks.join('');\n } else {\n this.result = utils.flattenChunks(this.chunks);\n }\n }\n this.chunks = [];\n this.err = status;\n this.msg = this.strm.msg;\n};\n\n\n/**\n * deflate(data[, options]) -> Uint8Array|Array|String\n * - data (Uint8Array|Array|String): input data to compress.\n * - options (Object): zlib deflate options.\n *\n * Compress `data` with deflate algorithm and `options`.\n *\n * Supported options are:\n *\n * - level\n * - windowBits\n * - memLevel\n * - strategy\n * - dictionary\n *\n * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced)\n * for more information on these.\n *\n * Sugar (options):\n *\n * - `raw` (Boolean) - say that we work with raw stream, if you don't wish to specify\n * negative windowBits implicitly.\n * - `to` (String) - if equal to 'string', then result will be \"binary string\"\n * (each char code [0..255])\n *\n * ##### Example:\n *\n * ```javascript\n * var pako = require('pako')\n * , data = Uint8Array([1,2,3,4,5,6,7,8,9]);\n *\n * console.log(pako.deflate(data));\n * ```\n **/\nfunction deflate(input, options) {\n var deflator = new Deflate(options);\n\n deflator.push(input, true);\n\n // That will never happens, if you don't cheat with options :)\n if (deflator.err) { throw deflator.msg || msg[deflator.err]; }\n\n return deflator.result;\n}\n\n\n/**\n * deflateRaw(data[, options]) -> Uint8Array|Array|String\n * - data (Uint8Array|Array|String): input data to compress.\n * - options (Object): zlib deflate options.\n *\n * The same as [[deflate]], but creates raw data, without wrapper\n * (header and adler32 crc).\n **/\nfunction deflateRaw(input, options) {\n options = options || {};\n options.raw = true;\n return deflate(input, options);\n}\n\n\n/**\n * gzip(data[, options]) -> Uint8Array|Array|String\n * - data (Uint8Array|Array|String): input data to compress.\n * - options (Object): zlib deflate options.\n *\n * The same as [[deflate]], but create gzip wrapper instead of\n * deflate one.\n **/\nfunction gzip(input, options) {\n options = options || {};\n options.gzip = true;\n return deflate(input, options);\n}\n\n\nexports.Deflate = Deflate;\nexports.deflate = deflate;\nexports.deflateRaw = deflateRaw;\nexports.gzip = gzip;\n","'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nvar utils = require('../utils/common');\nvar trees = require('./trees');\nvar adler32 = require('./adler32');\nvar crc32 = require('./crc32');\nvar msg = require('./messages');\n\n/* Public constants ==========================================================*/\n/* ===========================================================================*/\n\n\n/* Allowed flush values; see deflate() and inflate() below for details */\nvar Z_NO_FLUSH = 0;\nvar Z_PARTIAL_FLUSH = 1;\n//var Z_SYNC_FLUSH = 2;\nvar Z_FULL_FLUSH = 3;\nvar Z_FINISH = 4;\nvar Z_BLOCK = 5;\n//var Z_TREES = 6;\n\n\n/* Return codes for the compression/decompression functions. Negative values\n * are errors, positive values are used for special but normal events.\n */\nvar Z_OK = 0;\nvar Z_STREAM_END = 1;\n//var Z_NEED_DICT = 2;\n//var Z_ERRNO = -1;\nvar Z_STREAM_ERROR = -2;\nvar Z_DATA_ERROR = -3;\n//var Z_MEM_ERROR = -4;\nvar Z_BUF_ERROR = -5;\n//var Z_VERSION_ERROR = -6;\n\n\n/* compression levels */\n//var Z_NO_COMPRESSION = 0;\n//var Z_BEST_SPEED = 1;\n//var Z_BEST_COMPRESSION = 9;\nvar Z_DEFAULT_COMPRESSION = -1;\n\n\nvar Z_FILTERED = 1;\nvar Z_HUFFMAN_ONLY = 2;\nvar Z_RLE = 3;\nvar Z_FIXED = 4;\nvar Z_DEFAULT_STRATEGY = 0;\n\n/* Possible values of the data_type field (though see inflate()) */\n//var Z_BINARY = 0;\n//var Z_TEXT = 1;\n//var Z_ASCII = 1; // = Z_TEXT\nvar Z_UNKNOWN = 2;\n\n\n/* The deflate compression method */\nvar Z_DEFLATED = 8;\n\n/*============================================================================*/\n\n\nvar MAX_MEM_LEVEL = 9;\n/* Maximum value for memLevel in deflateInit2 */\nvar MAX_WBITS = 15;\n/* 32K LZ77 window */\nvar DEF_MEM_LEVEL = 8;\n\n\nvar LENGTH_CODES = 29;\n/* number of length codes, not counting the special END_BLOCK code */\nvar LITERALS = 256;\n/* number of literal bytes 0..255 */\nvar L_CODES = LITERALS + 1 + LENGTH_CODES;\n/* number of Literal or Length codes, including the END_BLOCK code */\nvar D_CODES = 30;\n/* number of distance codes */\nvar BL_CODES = 19;\n/* number of codes used to transfer the bit lengths */\nvar HEAP_SIZE = 2 * L_CODES + 1;\n/* maximum heap size */\nvar MAX_BITS = 15;\n/* All codes must not exceed MAX_BITS bits */\n\nvar MIN_MATCH = 3;\nvar MAX_MATCH = 258;\nvar MIN_LOOKAHEAD = (MAX_MATCH + MIN_MATCH + 1);\n\nvar PRESET_DICT = 0x20;\n\nvar INIT_STATE = 42;\nvar EXTRA_STATE = 69;\nvar NAME_STATE = 73;\nvar COMMENT_STATE = 91;\nvar HCRC_STATE = 103;\nvar BUSY_STATE = 113;\nvar FINISH_STATE = 666;\n\nvar BS_NEED_MORE = 1; /* block not completed, need more input or more output */\nvar BS_BLOCK_DONE = 2; /* block flush performed */\nvar BS_FINISH_STARTED = 3; /* finish started, need only more output at next deflate */\nvar BS_FINISH_DONE = 4; /* finish done, accept no more input or output */\n\nvar OS_CODE = 0x03; // Unix :) . Don't detect, use this default.\n\nfunction err(strm, errorCode) {\n strm.msg = msg[errorCode];\n return errorCode;\n}\n\nfunction rank(f) {\n return ((f) << 1) - ((f) > 4 ? 9 : 0);\n}\n\nfunction zero(buf) { var len = buf.length; while (--len >= 0) { buf[len] = 0; } }\n\n\n/* =========================================================================\n * Flush as much pending output as possible. All deflate() output goes\n * through this function so some applications may wish to modify it\n * to avoid allocating a large strm->output buffer and copying into it.\n * (See also read_buf()).\n */\nfunction flush_pending(strm) {\n var s = strm.state;\n\n //_tr_flush_bits(s);\n var len = s.pending;\n if (len > strm.avail_out) {\n len = strm.avail_out;\n }\n if (len === 0) { return; }\n\n utils.arraySet(strm.output, s.pending_buf, s.pending_out, len, strm.next_out);\n strm.next_out += len;\n s.pending_out += len;\n strm.total_out += len;\n strm.avail_out -= len;\n s.pending -= len;\n if (s.pending === 0) {\n s.pending_out = 0;\n }\n}\n\n\nfunction flush_block_only(s, last) {\n trees._tr_flush_block(s, (s.block_start >= 0 ? s.block_start : -1), s.strstart - s.block_start, last);\n s.block_start = s.strstart;\n flush_pending(s.strm);\n}\n\n\nfunction put_byte(s, b) {\n s.pending_buf[s.pending++] = b;\n}\n\n\n/* =========================================================================\n * Put a short in the pending buffer. The 16-bit value is put in MSB order.\n * IN assertion: the stream state is correct and there is enough room in\n * pending_buf.\n */\nfunction putShortMSB(s, b) {\n// put_byte(s, (Byte)(b >> 8));\n// put_byte(s, (Byte)(b & 0xff));\n s.pending_buf[s.pending++] = (b >>> 8) & 0xff;\n s.pending_buf[s.pending++] = b & 0xff;\n}\n\n\n/* ===========================================================================\n * Read a new buffer from the current input stream, update the adler32\n * and total number of bytes read. All deflate() input goes through\n * this function so some applications may wish to modify it to avoid\n * allocating a large strm->input buffer and copying from it.\n * (See also flush_pending()).\n */\nfunction read_buf(strm, buf, start, size) {\n var len = strm.avail_in;\n\n if (len > size) { len = size; }\n if (len === 0) { return 0; }\n\n strm.avail_in -= len;\n\n // zmemcpy(buf, strm->next_in, len);\n utils.arraySet(buf, strm.input, strm.next_in, len, start);\n if (strm.state.wrap === 1) {\n strm.adler = adler32(strm.adler, buf, len, start);\n }\n\n else if (strm.state.wrap === 2) {\n strm.adler = crc32(strm.adler, buf, len, start);\n }\n\n strm.next_in += len;\n strm.total_in += len;\n\n return len;\n}\n\n\n/* ===========================================================================\n * Set match_start to the longest match starting at the given string and\n * return its length. Matches shorter or equal to prev_length are discarded,\n * in which case the result is equal to prev_length and match_start is\n * garbage.\n * IN assertions: cur_match is the head of the hash chain for the current\n * string (strstart) and its distance is <= MAX_DIST, and prev_length >= 1\n * OUT assertion: the match length is not greater than s->lookahead.\n */\nfunction longest_match(s, cur_match) {\n var chain_length = s.max_chain_length; /* max hash chain length */\n var scan = s.strstart; /* current string */\n var match; /* matched string */\n var len; /* length of current match */\n var best_len = s.prev_length; /* best match length so far */\n var nice_match = s.nice_match; /* stop if match long enough */\n var limit = (s.strstart > (s.w_size - MIN_LOOKAHEAD)) ?\n s.strstart - (s.w_size - MIN_LOOKAHEAD) : 0/*NIL*/;\n\n var _win = s.window; // shortcut\n\n var wmask = s.w_mask;\n var prev = s.prev;\n\n /* Stop when cur_match becomes <= limit. To simplify the code,\n * we prevent matches with the string of window index 0.\n */\n\n var strend = s.strstart + MAX_MATCH;\n var scan_end1 = _win[scan + best_len - 1];\n var scan_end = _win[scan + best_len];\n\n /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16.\n * It is easy to get rid of this optimization if necessary.\n */\n // Assert(s->hash_bits >= 8 && MAX_MATCH == 258, \"Code too clever\");\n\n /* Do not waste too much time if we already have a good match: */\n if (s.prev_length >= s.good_match) {\n chain_length >>= 2;\n }\n /* Do not look for matches beyond the end of the input. This is necessary\n * to make deflate deterministic.\n */\n if (nice_match > s.lookahead) { nice_match = s.lookahead; }\n\n // Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, \"need lookahead\");\n\n do {\n // Assert(cur_match < s->strstart, \"no future\");\n match = cur_match;\n\n /* Skip to next match if the match length cannot increase\n * or if the match length is less than 2. Note that the checks below\n * for insufficient lookahead only occur occasionally for performance\n * reasons. Therefore uninitialized memory will be accessed, and\n * conditional jumps will be made that depend on those values.\n * However the length of the match is limited to the lookahead, so\n * the output of deflate is not affected by the uninitialized values.\n */\n\n if (_win[match + best_len] !== scan_end ||\n _win[match + best_len - 1] !== scan_end1 ||\n _win[match] !== _win[scan] ||\n _win[++match] !== _win[scan + 1]) {\n continue;\n }\n\n /* The check at best_len-1 can be removed because it will be made\n * again later. (This heuristic is not always a win.)\n * It is not necessary to compare scan[2] and match[2] since they\n * are always equal when the other bytes match, given that\n * the hash keys are equal and that HASH_BITS >= 8.\n */\n scan += 2;\n match++;\n // Assert(*scan == *match, \"match[2]?\");\n\n /* We check for insufficient lookahead only every 8th comparison;\n * the 256th check will be made at strstart+258.\n */\n do {\n /*jshint noempty:false*/\n } while (_win[++scan] === _win[++match] && _win[++scan] === _win[++match] &&\n _win[++scan] === _win[++match] && _win[++scan] === _win[++match] &&\n _win[++scan] === _win[++match] && _win[++scan] === _win[++match] &&\n _win[++scan] === _win[++match] && _win[++scan] === _win[++match] &&\n scan < strend);\n\n // Assert(scan <= s->window+(unsigned)(s->window_size-1), \"wild scan\");\n\n len = MAX_MATCH - (strend - scan);\n scan = strend - MAX_MATCH;\n\n if (len > best_len) {\n s.match_start = cur_match;\n best_len = len;\n if (len >= nice_match) {\n break;\n }\n scan_end1 = _win[scan + best_len - 1];\n scan_end = _win[scan + best_len];\n }\n } while ((cur_match = prev[cur_match & wmask]) > limit && --chain_length !== 0);\n\n if (best_len <= s.lookahead) {\n return best_len;\n }\n return s.lookahead;\n}\n\n\n/* ===========================================================================\n * Fill the window when the lookahead becomes insufficient.\n * Updates strstart and lookahead.\n *\n * IN assertion: lookahead < MIN_LOOKAHEAD\n * OUT assertions: strstart <= window_size-MIN_LOOKAHEAD\n * At least one byte has been read, or avail_in == 0; reads are\n * performed for at least two bytes (required for the zip translate_eol\n * option -- not supported here).\n */\nfunction fill_window(s) {\n var _w_size = s.w_size;\n var p, n, m, more, str;\n\n //Assert(s->lookahead < MIN_LOOKAHEAD, \"already enough lookahead\");\n\n do {\n more = s.window_size - s.lookahead - s.strstart;\n\n // JS ints have 32 bit, block below not needed\n /* Deal with !@#$% 64K limit: */\n //if (sizeof(int) <= 2) {\n // if (more == 0 && s->strstart == 0 && s->lookahead == 0) {\n // more = wsize;\n //\n // } else if (more == (unsigned)(-1)) {\n // /* Very unlikely, but possible on 16 bit machine if\n // * strstart == 0 && lookahead == 1 (input done a byte at time)\n // */\n // more--;\n // }\n //}\n\n\n /* If the window is almost full and there is insufficient lookahead,\n * move the upper half to the lower one to make room in the upper half.\n */\n if (s.strstart >= _w_size + (_w_size - MIN_LOOKAHEAD)) {\n\n utils.arraySet(s.window, s.window, _w_size, _w_size, 0);\n s.match_start -= _w_size;\n s.strstart -= _w_size;\n /* we now have strstart >= MAX_DIST */\n s.block_start -= _w_size;\n\n /* Slide the hash table (could be avoided with 32 bit values\n at the expense of memory usage). We slide even when level == 0\n to keep the hash table consistent if we switch back to level > 0\n later. (Using level 0 permanently is not an optimal usage of\n zlib, so we don't care about this pathological case.)\n */\n\n n = s.hash_size;\n p = n;\n do {\n m = s.head[--p];\n s.head[p] = (m >= _w_size ? m - _w_size : 0);\n } while (--n);\n\n n = _w_size;\n p = n;\n do {\n m = s.prev[--p];\n s.prev[p] = (m >= _w_size ? m - _w_size : 0);\n /* If n is not on any hash chain, prev[n] is garbage but\n * its value will never be used.\n */\n } while (--n);\n\n more += _w_size;\n }\n if (s.strm.avail_in === 0) {\n break;\n }\n\n /* If there was no sliding:\n * strstart <= WSIZE+MAX_DIST-1 && lookahead <= MIN_LOOKAHEAD - 1 &&\n * more == window_size - lookahead - strstart\n * => more >= window_size - (MIN_LOOKAHEAD-1 + WSIZE + MAX_DIST-1)\n * => more >= window_size - 2*WSIZE + 2\n * In the BIG_MEM or MMAP case (not yet supported),\n * window_size == input_size + MIN_LOOKAHEAD &&\n * strstart + s->lookahead <= input_size => more >= MIN_LOOKAHEAD.\n * Otherwise, window_size == 2*WSIZE so more >= 2.\n * If there was sliding, more >= WSIZE. So in all cases, more >= 2.\n */\n //Assert(more >= 2, \"more < 2\");\n n = read_buf(s.strm, s.window, s.strstart + s.lookahead, more);\n s.lookahead += n;\n\n /* Initialize the hash value now that we have some input: */\n if (s.lookahead + s.insert >= MIN_MATCH) {\n str = s.strstart - s.insert;\n s.ins_h = s.window[str];\n\n /* UPDATE_HASH(s, s->ins_h, s->window[str + 1]); */\n s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[str + 1]) & s.hash_mask;\n//#if MIN_MATCH != 3\n// Call update_hash() MIN_MATCH-3 more times\n//#endif\n while (s.insert) {\n /* UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]); */\n s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[str + MIN_MATCH - 1]) & s.hash_mask;\n\n s.prev[str & s.w_mask] = s.head[s.ins_h];\n s.head[s.ins_h] = str;\n str++;\n s.insert--;\n if (s.lookahead + s.insert < MIN_MATCH) {\n break;\n }\n }\n }\n /* If the whole input has less than MIN_MATCH bytes, ins_h is garbage,\n * but this is not important since only literal bytes will be emitted.\n */\n\n } while (s.lookahead < MIN_LOOKAHEAD && s.strm.avail_in !== 0);\n\n /* If the WIN_INIT bytes after the end of the current data have never been\n * written, then zero those bytes in order to avoid memory check reports of\n * the use of uninitialized (or uninitialised as Julian writes) bytes by\n * the longest match routines. Update the high water mark for the next\n * time through here. WIN_INIT is set to MAX_MATCH since the longest match\n * routines allow scanning to strstart + MAX_MATCH, ignoring lookahead.\n */\n// if (s.high_water < s.window_size) {\n// var curr = s.strstart + s.lookahead;\n// var init = 0;\n//\n// if (s.high_water < curr) {\n// /* Previous high water mark below current data -- zero WIN_INIT\n// * bytes or up to end of window, whichever is less.\n// */\n// init = s.window_size - curr;\n// if (init > WIN_INIT)\n// init = WIN_INIT;\n// zmemzero(s->window + curr, (unsigned)init);\n// s->high_water = curr + init;\n// }\n// else if (s->high_water < (ulg)curr + WIN_INIT) {\n// /* High water mark at or above current data, but below current data\n// * plus WIN_INIT -- zero out to current data plus WIN_INIT, or up\n// * to end of window, whichever is less.\n// */\n// init = (ulg)curr + WIN_INIT - s->high_water;\n// if (init > s->window_size - s->high_water)\n// init = s->window_size - s->high_water;\n// zmemzero(s->window + s->high_water, (unsigned)init);\n// s->high_water += init;\n// }\n// }\n//\n// Assert((ulg)s->strstart <= s->window_size - MIN_LOOKAHEAD,\n// \"not enough room for search\");\n}\n\n/* ===========================================================================\n * Copy without compression as much as possible from the input stream, return\n * the current block state.\n * This function does not insert new strings in the dictionary since\n * uncompressible data is probably not useful. This function is used\n * only for the level=0 compression option.\n * NOTE: this function should be optimized to avoid extra copying from\n * window to pending_buf.\n */\nfunction deflate_stored(s, flush) {\n /* Stored blocks are limited to 0xffff bytes, pending_buf is limited\n * to pending_buf_size, and each stored block has a 5 byte header:\n */\n var max_block_size = 0xffff;\n\n if (max_block_size > s.pending_buf_size - 5) {\n max_block_size = s.pending_buf_size - 5;\n }\n\n /* Copy as much as possible from input to output: */\n for (;;) {\n /* Fill the window as much as possible: */\n if (s.lookahead <= 1) {\n\n //Assert(s->strstart < s->w_size+MAX_DIST(s) ||\n // s->block_start >= (long)s->w_size, \"slide too late\");\n// if (!(s.strstart < s.w_size + (s.w_size - MIN_LOOKAHEAD) ||\n// s.block_start >= s.w_size)) {\n// throw new Error(\"slide too late\");\n// }\n\n fill_window(s);\n if (s.lookahead === 0 && flush === Z_NO_FLUSH) {\n return BS_NEED_MORE;\n }\n\n if (s.lookahead === 0) {\n break;\n }\n /* flush the current block */\n }\n //Assert(s->block_start >= 0L, \"block gone\");\n// if (s.block_start < 0) throw new Error(\"block gone\");\n\n s.strstart += s.lookahead;\n s.lookahead = 0;\n\n /* Emit a stored block if pending_buf will be full: */\n var max_start = s.block_start + max_block_size;\n\n if (s.strstart === 0 || s.strstart >= max_start) {\n /* strstart == 0 is possible when wraparound on 16-bit machine */\n s.lookahead = s.strstart - max_start;\n s.strstart = max_start;\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n\n\n }\n /* Flush if we may have to slide, otherwise block_start may become\n * negative and the data will be gone:\n */\n if (s.strstart - s.block_start >= (s.w_size - MIN_LOOKAHEAD)) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n }\n\n s.insert = 0;\n\n if (flush === Z_FINISH) {\n /*** FLUSH_BLOCK(s, 1); ***/\n flush_block_only(s, true);\n if (s.strm.avail_out === 0) {\n return BS_FINISH_STARTED;\n }\n /***/\n return BS_FINISH_DONE;\n }\n\n if (s.strstart > s.block_start) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n\n return BS_NEED_MORE;\n}\n\n/* ===========================================================================\n * Compress as much as possible from the input stream, return the current\n * block state.\n * This function does not perform lazy evaluation of matches and inserts\n * new strings in the dictionary only for unmatched strings or for short\n * matches. It is used only for the fast compression options.\n */\nfunction deflate_fast(s, flush) {\n var hash_head; /* head of the hash chain */\n var bflush; /* set if current block must be flushed */\n\n for (;;) {\n /* Make sure that we always have enough lookahead, except\n * at the end of the input file. We need MAX_MATCH bytes\n * for the next match, plus MIN_MATCH bytes to insert the\n * string following the next match.\n */\n if (s.lookahead < MIN_LOOKAHEAD) {\n fill_window(s);\n if (s.lookahead < MIN_LOOKAHEAD && flush === Z_NO_FLUSH) {\n return BS_NEED_MORE;\n }\n if (s.lookahead === 0) {\n break; /* flush the current block */\n }\n }\n\n /* Insert the string window[strstart .. strstart+2] in the\n * dictionary, and set hash_head to the head of the hash chain:\n */\n hash_head = 0/*NIL*/;\n if (s.lookahead >= MIN_MATCH) {\n /*** INSERT_STRING(s, s.strstart, hash_head); ***/\n s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask;\n hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];\n s.head[s.ins_h] = s.strstart;\n /***/\n }\n\n /* Find the longest match, discarding those <= prev_length.\n * At this point we have always match_length < MIN_MATCH\n */\n if (hash_head !== 0/*NIL*/ && ((s.strstart - hash_head) <= (s.w_size - MIN_LOOKAHEAD))) {\n /* To simplify the code, we prevent matches with the string\n * of window index 0 (in particular we have to avoid a match\n * of the string with itself at the start of the input file).\n */\n s.match_length = longest_match(s, hash_head);\n /* longest_match() sets match_start */\n }\n if (s.match_length >= MIN_MATCH) {\n // check_match(s, s.strstart, s.match_start, s.match_length); // for debug only\n\n /*** _tr_tally_dist(s, s.strstart - s.match_start,\n s.match_length - MIN_MATCH, bflush); ***/\n bflush = trees._tr_tally(s, s.strstart - s.match_start, s.match_length - MIN_MATCH);\n\n s.lookahead -= s.match_length;\n\n /* Insert new strings in the hash table only if the match length\n * is not too large. This saves time but degrades compression.\n */\n if (s.match_length <= s.max_lazy_match/*max_insert_length*/ && s.lookahead >= MIN_MATCH) {\n s.match_length--; /* string at strstart already in table */\n do {\n s.strstart++;\n /*** INSERT_STRING(s, s.strstart, hash_head); ***/\n s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask;\n hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];\n s.head[s.ins_h] = s.strstart;\n /***/\n /* strstart never exceeds WSIZE-MAX_MATCH, so there are\n * always MIN_MATCH bytes ahead.\n */\n } while (--s.match_length !== 0);\n s.strstart++;\n } else\n {\n s.strstart += s.match_length;\n s.match_length = 0;\n s.ins_h = s.window[s.strstart];\n /* UPDATE_HASH(s, s.ins_h, s.window[s.strstart+1]); */\n s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + 1]) & s.hash_mask;\n\n//#if MIN_MATCH != 3\n// Call UPDATE_HASH() MIN_MATCH-3 more times\n//#endif\n /* If lookahead < MIN_MATCH, ins_h is garbage, but it does not\n * matter since it will be recomputed at next deflate call.\n */\n }\n } else {\n /* No match, output a literal byte */\n //Tracevv((stderr,\"%c\", s.window[s.strstart]));\n /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/\n bflush = trees._tr_tally(s, 0, s.window[s.strstart]);\n\n s.lookahead--;\n s.strstart++;\n }\n if (bflush) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n }\n s.insert = ((s.strstart < (MIN_MATCH - 1)) ? s.strstart : MIN_MATCH - 1);\n if (flush === Z_FINISH) {\n /*** FLUSH_BLOCK(s, 1); ***/\n flush_block_only(s, true);\n if (s.strm.avail_out === 0) {\n return BS_FINISH_STARTED;\n }\n /***/\n return BS_FINISH_DONE;\n }\n if (s.last_lit) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n return BS_BLOCK_DONE;\n}\n\n/* ===========================================================================\n * Same as above, but achieves better compression. We use a lazy\n * evaluation for matches: a match is finally adopted only if there is\n * no better match at the next window position.\n */\nfunction deflate_slow(s, flush) {\n var hash_head; /* head of hash chain */\n var bflush; /* set if current block must be flushed */\n\n var max_insert;\n\n /* Process the input block. */\n for (;;) {\n /* Make sure that we always have enough lookahead, except\n * at the end of the input file. We need MAX_MATCH bytes\n * for the next match, plus MIN_MATCH bytes to insert the\n * string following the next match.\n */\n if (s.lookahead < MIN_LOOKAHEAD) {\n fill_window(s);\n if (s.lookahead < MIN_LOOKAHEAD && flush === Z_NO_FLUSH) {\n return BS_NEED_MORE;\n }\n if (s.lookahead === 0) { break; } /* flush the current block */\n }\n\n /* Insert the string window[strstart .. strstart+2] in the\n * dictionary, and set hash_head to the head of the hash chain:\n */\n hash_head = 0/*NIL*/;\n if (s.lookahead >= MIN_MATCH) {\n /*** INSERT_STRING(s, s.strstart, hash_head); ***/\n s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask;\n hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];\n s.head[s.ins_h] = s.strstart;\n /***/\n }\n\n /* Find the longest match, discarding those <= prev_length.\n */\n s.prev_length = s.match_length;\n s.prev_match = s.match_start;\n s.match_length = MIN_MATCH - 1;\n\n if (hash_head !== 0/*NIL*/ && s.prev_length < s.max_lazy_match &&\n s.strstart - hash_head <= (s.w_size - MIN_LOOKAHEAD)/*MAX_DIST(s)*/) {\n /* To simplify the code, we prevent matches with the string\n * of window index 0 (in particular we have to avoid a match\n * of the string with itself at the start of the input file).\n */\n s.match_length = longest_match(s, hash_head);\n /* longest_match() sets match_start */\n\n if (s.match_length <= 5 &&\n (s.strategy === Z_FILTERED || (s.match_length === MIN_MATCH && s.strstart - s.match_start > 4096/*TOO_FAR*/))) {\n\n /* If prev_match is also MIN_MATCH, match_start is garbage\n * but we will ignore the current match anyway.\n */\n s.match_length = MIN_MATCH - 1;\n }\n }\n /* If there was a match at the previous step and the current\n * match is not better, output the previous match:\n */\n if (s.prev_length >= MIN_MATCH && s.match_length <= s.prev_length) {\n max_insert = s.strstart + s.lookahead - MIN_MATCH;\n /* Do not insert strings in hash table beyond this. */\n\n //check_match(s, s.strstart-1, s.prev_match, s.prev_length);\n\n /***_tr_tally_dist(s, s.strstart - 1 - s.prev_match,\n s.prev_length - MIN_MATCH, bflush);***/\n bflush = trees._tr_tally(s, s.strstart - 1 - s.prev_match, s.prev_length - MIN_MATCH);\n /* Insert in hash table all strings up to the end of the match.\n * strstart-1 and strstart are already inserted. If there is not\n * enough lookahead, the last two strings are not inserted in\n * the hash table.\n */\n s.lookahead -= s.prev_length - 1;\n s.prev_length -= 2;\n do {\n if (++s.strstart <= max_insert) {\n /*** INSERT_STRING(s, s.strstart, hash_head); ***/\n s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask;\n hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];\n s.head[s.ins_h] = s.strstart;\n /***/\n }\n } while (--s.prev_length !== 0);\n s.match_available = 0;\n s.match_length = MIN_MATCH - 1;\n s.strstart++;\n\n if (bflush) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n\n } else if (s.match_available) {\n /* If there was no match at the previous position, output a\n * single literal. If there was a match but the current match\n * is longer, truncate the previous match to a single literal.\n */\n //Tracevv((stderr,\"%c\", s->window[s->strstart-1]));\n /*** _tr_tally_lit(s, s.window[s.strstart-1], bflush); ***/\n bflush = trees._tr_tally(s, 0, s.window[s.strstart - 1]);\n\n if (bflush) {\n /*** FLUSH_BLOCK_ONLY(s, 0) ***/\n flush_block_only(s, false);\n /***/\n }\n s.strstart++;\n s.lookahead--;\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n } else {\n /* There is no previous match to compare with, wait for\n * the next step to decide.\n */\n s.match_available = 1;\n s.strstart++;\n s.lookahead--;\n }\n }\n //Assert (flush != Z_NO_FLUSH, \"no flush?\");\n if (s.match_available) {\n //Tracevv((stderr,\"%c\", s->window[s->strstart-1]));\n /*** _tr_tally_lit(s, s.window[s.strstart-1], bflush); ***/\n bflush = trees._tr_tally(s, 0, s.window[s.strstart - 1]);\n\n s.match_available = 0;\n }\n s.insert = s.strstart < MIN_MATCH - 1 ? s.strstart : MIN_MATCH - 1;\n if (flush === Z_FINISH) {\n /*** FLUSH_BLOCK(s, 1); ***/\n flush_block_only(s, true);\n if (s.strm.avail_out === 0) {\n return BS_FINISH_STARTED;\n }\n /***/\n return BS_FINISH_DONE;\n }\n if (s.last_lit) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n\n return BS_BLOCK_DONE;\n}\n\n\n/* ===========================================================================\n * For Z_RLE, simply look for runs of bytes, generate matches only of distance\n * one. Do not maintain a hash table. (It will be regenerated if this run of\n * deflate switches away from Z_RLE.)\n */\nfunction deflate_rle(s, flush) {\n var bflush; /* set if current block must be flushed */\n var prev; /* byte at distance one to match */\n var scan, strend; /* scan goes up to strend for length of run */\n\n var _win = s.window;\n\n for (;;) {\n /* Make sure that we always have enough lookahead, except\n * at the end of the input file. We need MAX_MATCH bytes\n * for the longest run, plus one for the unrolled loop.\n */\n if (s.lookahead <= MAX_MATCH) {\n fill_window(s);\n if (s.lookahead <= MAX_MATCH && flush === Z_NO_FLUSH) {\n return BS_NEED_MORE;\n }\n if (s.lookahead === 0) { break; } /* flush the current block */\n }\n\n /* See how many times the previous byte repeats */\n s.match_length = 0;\n if (s.lookahead >= MIN_MATCH && s.strstart > 0) {\n scan = s.strstart - 1;\n prev = _win[scan];\n if (prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan]) {\n strend = s.strstart + MAX_MATCH;\n do {\n /*jshint noempty:false*/\n } while (prev === _win[++scan] && prev === _win[++scan] &&\n prev === _win[++scan] && prev === _win[++scan] &&\n prev === _win[++scan] && prev === _win[++scan] &&\n prev === _win[++scan] && prev === _win[++scan] &&\n scan < strend);\n s.match_length = MAX_MATCH - (strend - scan);\n if (s.match_length > s.lookahead) {\n s.match_length = s.lookahead;\n }\n }\n //Assert(scan <= s->window+(uInt)(s->window_size-1), \"wild scan\");\n }\n\n /* Emit match if have run of MIN_MATCH or longer, else emit literal */\n if (s.match_length >= MIN_MATCH) {\n //check_match(s, s.strstart, s.strstart - 1, s.match_length);\n\n /*** _tr_tally_dist(s, 1, s.match_length - MIN_MATCH, bflush); ***/\n bflush = trees._tr_tally(s, 1, s.match_length - MIN_MATCH);\n\n s.lookahead -= s.match_length;\n s.strstart += s.match_length;\n s.match_length = 0;\n } else {\n /* No match, output a literal byte */\n //Tracevv((stderr,\"%c\", s->window[s->strstart]));\n /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/\n bflush = trees._tr_tally(s, 0, s.window[s.strstart]);\n\n s.lookahead--;\n s.strstart++;\n }\n if (bflush) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n }\n s.insert = 0;\n if (flush === Z_FINISH) {\n /*** FLUSH_BLOCK(s, 1); ***/\n flush_block_only(s, true);\n if (s.strm.avail_out === 0) {\n return BS_FINISH_STARTED;\n }\n /***/\n return BS_FINISH_DONE;\n }\n if (s.last_lit) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n return BS_BLOCK_DONE;\n}\n\n/* ===========================================================================\n * For Z_HUFFMAN_ONLY, do not look for matches. Do not maintain a hash table.\n * (It will be regenerated if this run of deflate switches away from Huffman.)\n */\nfunction deflate_huff(s, flush) {\n var bflush; /* set if current block must be flushed */\n\n for (;;) {\n /* Make sure that we have a literal to write. */\n if (s.lookahead === 0) {\n fill_window(s);\n if (s.lookahead === 0) {\n if (flush === Z_NO_FLUSH) {\n return BS_NEED_MORE;\n }\n break; /* flush the current block */\n }\n }\n\n /* Output a literal byte */\n s.match_length = 0;\n //Tracevv((stderr,\"%c\", s->window[s->strstart]));\n /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/\n bflush = trees._tr_tally(s, 0, s.window[s.strstart]);\n s.lookahead--;\n s.strstart++;\n if (bflush) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n }\n s.insert = 0;\n if (flush === Z_FINISH) {\n /*** FLUSH_BLOCK(s, 1); ***/\n flush_block_only(s, true);\n if (s.strm.avail_out === 0) {\n return BS_FINISH_STARTED;\n }\n /***/\n return BS_FINISH_DONE;\n }\n if (s.last_lit) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n return BS_BLOCK_DONE;\n}\n\n/* Values for max_lazy_match, good_match and max_chain_length, depending on\n * the desired pack level (0..9). The values given below have been tuned to\n * exclude worst case performance for pathological files. Better values may be\n * found for specific files.\n */\nfunction Config(good_length, max_lazy, nice_length, max_chain, func) {\n this.good_length = good_length;\n this.max_lazy = max_lazy;\n this.nice_length = nice_length;\n this.max_chain = max_chain;\n this.func = func;\n}\n\nvar configuration_table;\n\nconfiguration_table = [\n /* good lazy nice chain */\n new Config(0, 0, 0, 0, deflate_stored), /* 0 store only */\n new Config(4, 4, 8, 4, deflate_fast), /* 1 max speed, no lazy matches */\n new Config(4, 5, 16, 8, deflate_fast), /* 2 */\n new Config(4, 6, 32, 32, deflate_fast), /* 3 */\n\n new Config(4, 4, 16, 16, deflate_slow), /* 4 lazy matches */\n new Config(8, 16, 32, 32, deflate_slow), /* 5 */\n new Config(8, 16, 128, 128, deflate_slow), /* 6 */\n new Config(8, 32, 128, 256, deflate_slow), /* 7 */\n new Config(32, 128, 258, 1024, deflate_slow), /* 8 */\n new Config(32, 258, 258, 4096, deflate_slow) /* 9 max compression */\n];\n\n\n/* ===========================================================================\n * Initialize the \"longest match\" routines for a new zlib stream\n */\nfunction lm_init(s) {\n s.window_size = 2 * s.w_size;\n\n /*** CLEAR_HASH(s); ***/\n zero(s.head); // Fill with NIL (= 0);\n\n /* Set the default configuration parameters:\n */\n s.max_lazy_match = configuration_table[s.level].max_lazy;\n s.good_match = configuration_table[s.level].good_length;\n s.nice_match = configuration_table[s.level].nice_length;\n s.max_chain_length = configuration_table[s.level].max_chain;\n\n s.strstart = 0;\n s.block_start = 0;\n s.lookahead = 0;\n s.insert = 0;\n s.match_length = s.prev_length = MIN_MATCH - 1;\n s.match_available = 0;\n s.ins_h = 0;\n}\n\n\nfunction DeflateState() {\n this.strm = null; /* pointer back to this zlib stream */\n this.status = 0; /* as the name implies */\n this.pending_buf = null; /* output still pending */\n this.pending_buf_size = 0; /* size of pending_buf */\n this.pending_out = 0; /* next pending byte to output to the stream */\n this.pending = 0; /* nb of bytes in the pending buffer */\n this.wrap = 0; /* bit 0 true for zlib, bit 1 true for gzip */\n this.gzhead = null; /* gzip header information to write */\n this.gzindex = 0; /* where in extra, name, or comment */\n this.method = Z_DEFLATED; /* can only be DEFLATED */\n this.last_flush = -1; /* value of flush param for previous deflate call */\n\n this.w_size = 0; /* LZ77 window size (32K by default) */\n this.w_bits = 0; /* log2(w_size) (8..16) */\n this.w_mask = 0; /* w_size - 1 */\n\n this.window = null;\n /* Sliding window. Input bytes are read into the second half of the window,\n * and move to the first half later to keep a dictionary of at least wSize\n * bytes. With this organization, matches are limited to a distance of\n * wSize-MAX_MATCH bytes, but this ensures that IO is always\n * performed with a length multiple of the block size.\n */\n\n this.window_size = 0;\n /* Actual size of window: 2*wSize, except when the user input buffer\n * is directly used as sliding window.\n */\n\n this.prev = null;\n /* Link to older string with same hash index. To limit the size of this\n * array to 64K, this link is maintained only for the last 32K strings.\n * An index in this array is thus a window index modulo 32K.\n */\n\n this.head = null; /* Heads of the hash chains or NIL. */\n\n this.ins_h = 0; /* hash index of string to be inserted */\n this.hash_size = 0; /* number of elements in hash table */\n this.hash_bits = 0; /* log2(hash_size) */\n this.hash_mask = 0; /* hash_size-1 */\n\n this.hash_shift = 0;\n /* Number of bits by which ins_h must be shifted at each input\n * step. It must be such that after MIN_MATCH steps, the oldest\n * byte no longer takes part in the hash key, that is:\n * hash_shift * MIN_MATCH >= hash_bits\n */\n\n this.block_start = 0;\n /* Window position at the beginning of the current output block. Gets\n * negative when the window is moved backwards.\n */\n\n this.match_length = 0; /* length of best match */\n this.prev_match = 0; /* previous match */\n this.match_available = 0; /* set if previous match exists */\n this.strstart = 0; /* start of string to insert */\n this.match_start = 0; /* start of matching string */\n this.lookahead = 0; /* number of valid bytes ahead in window */\n\n this.prev_length = 0;\n /* Length of the best match at previous step. Matches not greater than this\n * are discarded. This is used in the lazy match evaluation.\n */\n\n this.max_chain_length = 0;\n /* To speed up deflation, hash chains are never searched beyond this\n * length. A higher limit improves compression ratio but degrades the\n * speed.\n */\n\n this.max_lazy_match = 0;\n /* Attempt to find a better match only when the current match is strictly\n * smaller than this value. This mechanism is used only for compression\n * levels >= 4.\n */\n // That's alias to max_lazy_match, don't use directly\n //this.max_insert_length = 0;\n /* Insert new strings in the hash table only if the match length is not\n * greater than this length. This saves time but degrades compression.\n * max_insert_length is used only for compression levels <= 3.\n */\n\n this.level = 0; /* compression level (1..9) */\n this.strategy = 0; /* favor or force Huffman coding*/\n\n this.good_match = 0;\n /* Use a faster search when the previous match is longer than this */\n\n this.nice_match = 0; /* Stop searching when current match exceeds this */\n\n /* used by trees.c: */\n\n /* Didn't use ct_data typedef below to suppress compiler warning */\n\n // struct ct_data_s dyn_ltree[HEAP_SIZE]; /* literal and length tree */\n // struct ct_data_s dyn_dtree[2*D_CODES+1]; /* distance tree */\n // struct ct_data_s bl_tree[2*BL_CODES+1]; /* Huffman tree for bit lengths */\n\n // Use flat array of DOUBLE size, with interleaved fata,\n // because JS does not support effective\n this.dyn_ltree = new utils.Buf16(HEAP_SIZE * 2);\n this.dyn_dtree = new utils.Buf16((2 * D_CODES + 1) * 2);\n this.bl_tree = new utils.Buf16((2 * BL_CODES + 1) * 2);\n zero(this.dyn_ltree);\n zero(this.dyn_dtree);\n zero(this.bl_tree);\n\n this.l_desc = null; /* desc. for literal tree */\n this.d_desc = null; /* desc. for distance tree */\n this.bl_desc = null; /* desc. for bit length tree */\n\n //ush bl_count[MAX_BITS+1];\n this.bl_count = new utils.Buf16(MAX_BITS + 1);\n /* number of codes at each bit length for an optimal tree */\n\n //int heap[2*L_CODES+1]; /* heap used to build the Huffman trees */\n this.heap = new utils.Buf16(2 * L_CODES + 1); /* heap used to build the Huffman trees */\n zero(this.heap);\n\n this.heap_len = 0; /* number of elements in the heap */\n this.heap_max = 0; /* element of largest frequency */\n /* The sons of heap[n] are heap[2*n] and heap[2*n+1]. heap[0] is not used.\n * The same heap array is used to build all trees.\n */\n\n this.depth = new utils.Buf16(2 * L_CODES + 1); //uch depth[2*L_CODES+1];\n zero(this.depth);\n /* Depth of each subtree used as tie breaker for trees of equal frequency\n */\n\n this.l_buf = 0; /* buffer index for literals or lengths */\n\n this.lit_bufsize = 0;\n /* Size of match buffer for literals/lengths. There are 4 reasons for\n * limiting lit_bufsize to 64K:\n * - frequencies can be kept in 16 bit counters\n * - if compression is not successful for the first block, all input\n * data is still in the window so we can still emit a stored block even\n * when input comes from standard input. (This can also be done for\n * all blocks if lit_bufsize is not greater than 32K.)\n * - if compression is not successful for a file smaller than 64K, we can\n * even emit a stored file instead of a stored block (saving 5 bytes).\n * This is applicable only for zip (not gzip or zlib).\n * - creating new Huffman trees less frequently may not provide fast\n * adaptation to changes in the input data statistics. (Take for\n * example a binary file with poorly compressible code followed by\n * a highly compressible string table.) Smaller buffer sizes give\n * fast adaptation but have of course the overhead of transmitting\n * trees more frequently.\n * - I can't count above 4\n */\n\n this.last_lit = 0; /* running index in l_buf */\n\n this.d_buf = 0;\n /* Buffer index for distances. To simplify the code, d_buf and l_buf have\n * the same number of elements. To use different lengths, an extra flag\n * array would be necessary.\n */\n\n this.opt_len = 0; /* bit length of current block with optimal trees */\n this.static_len = 0; /* bit length of current block with static trees */\n this.matches = 0; /* number of string matches in current block */\n this.insert = 0; /* bytes at end of window left to insert */\n\n\n this.bi_buf = 0;\n /* Output buffer. bits are inserted starting at the bottom (least\n * significant bits).\n */\n this.bi_valid = 0;\n /* Number of valid bits in bi_buf. All bits above the last valid bit\n * are always zero.\n */\n\n // Used for window memory init. We safely ignore it for JS. That makes\n // sense only for pointers and memory check tools.\n //this.high_water = 0;\n /* High water mark offset in window for initialized bytes -- bytes above\n * this are set to zero in order to avoid memory check warnings when\n * longest match routines access bytes past the input. This is then\n * updated to the new high water mark.\n */\n}\n\n\nfunction deflateResetKeep(strm) {\n var s;\n\n if (!strm || !strm.state) {\n return err(strm, Z_STREAM_ERROR);\n }\n\n strm.total_in = strm.total_out = 0;\n strm.data_type = Z_UNKNOWN;\n\n s = strm.state;\n s.pending = 0;\n s.pending_out = 0;\n\n if (s.wrap < 0) {\n s.wrap = -s.wrap;\n /* was made negative by deflate(..., Z_FINISH); */\n }\n s.status = (s.wrap ? INIT_STATE : BUSY_STATE);\n strm.adler = (s.wrap === 2) ?\n 0 // crc32(0, Z_NULL, 0)\n :\n 1; // adler32(0, Z_NULL, 0)\n s.last_flush = Z_NO_FLUSH;\n trees._tr_init(s);\n return Z_OK;\n}\n\n\nfunction deflateReset(strm) {\n var ret = deflateResetKeep(strm);\n if (ret === Z_OK) {\n lm_init(strm.state);\n }\n return ret;\n}\n\n\nfunction deflateSetHeader(strm, head) {\n if (!strm || !strm.state) { return Z_STREAM_ERROR; }\n if (strm.state.wrap !== 2) { return Z_STREAM_ERROR; }\n strm.state.gzhead = head;\n return Z_OK;\n}\n\n\nfunction deflateInit2(strm, level, method, windowBits, memLevel, strategy) {\n if (!strm) { // === Z_NULL\n return Z_STREAM_ERROR;\n }\n var wrap = 1;\n\n if (level === Z_DEFAULT_COMPRESSION) {\n level = 6;\n }\n\n if (windowBits < 0) { /* suppress zlib wrapper */\n wrap = 0;\n windowBits = -windowBits;\n }\n\n else if (windowBits > 15) {\n wrap = 2; /* write gzip wrapper instead */\n windowBits -= 16;\n }\n\n\n if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method !== Z_DEFLATED ||\n windowBits < 8 || windowBits > 15 || level < 0 || level > 9 ||\n strategy < 0 || strategy > Z_FIXED) {\n return err(strm, Z_STREAM_ERROR);\n }\n\n\n if (windowBits === 8) {\n windowBits = 9;\n }\n /* until 256-byte window bug fixed */\n\n var s = new DeflateState();\n\n strm.state = s;\n s.strm = strm;\n\n s.wrap = wrap;\n s.gzhead = null;\n s.w_bits = windowBits;\n s.w_size = 1 << s.w_bits;\n s.w_mask = s.w_size - 1;\n\n s.hash_bits = memLevel + 7;\n s.hash_size = 1 << s.hash_bits;\n s.hash_mask = s.hash_size - 1;\n s.hash_shift = ~~((s.hash_bits + MIN_MATCH - 1) / MIN_MATCH);\n\n s.window = new utils.Buf8(s.w_size * 2);\n s.head = new utils.Buf16(s.hash_size);\n s.prev = new utils.Buf16(s.w_size);\n\n // Don't need mem init magic for JS.\n //s.high_water = 0; /* nothing written to s->window yet */\n\n s.lit_bufsize = 1 << (memLevel + 6); /* 16K elements by default */\n\n s.pending_buf_size = s.lit_bufsize * 4;\n\n //overlay = (ushf *) ZALLOC(strm, s->lit_bufsize, sizeof(ush)+2);\n //s->pending_buf = (uchf *) overlay;\n s.pending_buf = new utils.Buf8(s.pending_buf_size);\n\n // It is offset from `s.pending_buf` (size is `s.lit_bufsize * 2`)\n //s->d_buf = overlay + s->lit_bufsize/sizeof(ush);\n s.d_buf = 1 * s.lit_bufsize;\n\n //s->l_buf = s->pending_buf + (1+sizeof(ush))*s->lit_bufsize;\n s.l_buf = (1 + 2) * s.lit_bufsize;\n\n s.level = level;\n s.strategy = strategy;\n s.method = method;\n\n return deflateReset(strm);\n}\n\nfunction deflateInit(strm, level) {\n return deflateInit2(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY);\n}\n\n\nfunction deflate(strm, flush) {\n var old_flush, s;\n var beg, val; // for gzip header write only\n\n if (!strm || !strm.state ||\n flush > Z_BLOCK || flush < 0) {\n return strm ? err(strm, Z_STREAM_ERROR) : Z_STREAM_ERROR;\n }\n\n s = strm.state;\n\n if (!strm.output ||\n (!strm.input && strm.avail_in !== 0) ||\n (s.status === FINISH_STATE && flush !== Z_FINISH)) {\n return err(strm, (strm.avail_out === 0) ? Z_BUF_ERROR : Z_STREAM_ERROR);\n }\n\n s.strm = strm; /* just in case */\n old_flush = s.last_flush;\n s.last_flush = flush;\n\n /* Write the header */\n if (s.status === INIT_STATE) {\n\n if (s.wrap === 2) { // GZIP header\n strm.adler = 0; //crc32(0L, Z_NULL, 0);\n put_byte(s, 31);\n put_byte(s, 139);\n put_byte(s, 8);\n if (!s.gzhead) { // s->gzhead == Z_NULL\n put_byte(s, 0);\n put_byte(s, 0);\n put_byte(s, 0);\n put_byte(s, 0);\n put_byte(s, 0);\n put_byte(s, s.level === 9 ? 2 :\n (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 ?\n 4 : 0));\n put_byte(s, OS_CODE);\n s.status = BUSY_STATE;\n }\n else {\n put_byte(s, (s.gzhead.text ? 1 : 0) +\n (s.gzhead.hcrc ? 2 : 0) +\n (!s.gzhead.extra ? 0 : 4) +\n (!s.gzhead.name ? 0 : 8) +\n (!s.gzhead.comment ? 0 : 16)\n );\n put_byte(s, s.gzhead.time & 0xff);\n put_byte(s, (s.gzhead.time >> 8) & 0xff);\n put_byte(s, (s.gzhead.time >> 16) & 0xff);\n put_byte(s, (s.gzhead.time >> 24) & 0xff);\n put_byte(s, s.level === 9 ? 2 :\n (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 ?\n 4 : 0));\n put_byte(s, s.gzhead.os & 0xff);\n if (s.gzhead.extra && s.gzhead.extra.length) {\n put_byte(s, s.gzhead.extra.length & 0xff);\n put_byte(s, (s.gzhead.extra.length >> 8) & 0xff);\n }\n if (s.gzhead.hcrc) {\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending, 0);\n }\n s.gzindex = 0;\n s.status = EXTRA_STATE;\n }\n }\n else // DEFLATE header\n {\n var header = (Z_DEFLATED + ((s.w_bits - 8) << 4)) << 8;\n var level_flags = -1;\n\n if (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2) {\n level_flags = 0;\n } else if (s.level < 6) {\n level_flags = 1;\n } else if (s.level === 6) {\n level_flags = 2;\n } else {\n level_flags = 3;\n }\n header |= (level_flags << 6);\n if (s.strstart !== 0) { header |= PRESET_DICT; }\n header += 31 - (header % 31);\n\n s.status = BUSY_STATE;\n putShortMSB(s, header);\n\n /* Save the adler32 of the preset dictionary: */\n if (s.strstart !== 0) {\n putShortMSB(s, strm.adler >>> 16);\n putShortMSB(s, strm.adler & 0xffff);\n }\n strm.adler = 1; // adler32(0L, Z_NULL, 0);\n }\n }\n\n//#ifdef GZIP\n if (s.status === EXTRA_STATE) {\n if (s.gzhead.extra/* != Z_NULL*/) {\n beg = s.pending; /* start of bytes to update crc */\n\n while (s.gzindex < (s.gzhead.extra.length & 0xffff)) {\n if (s.pending === s.pending_buf_size) {\n if (s.gzhead.hcrc && s.pending > beg) {\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);\n }\n flush_pending(strm);\n beg = s.pending;\n if (s.pending === s.pending_buf_size) {\n break;\n }\n }\n put_byte(s, s.gzhead.extra[s.gzindex] & 0xff);\n s.gzindex++;\n }\n if (s.gzhead.hcrc && s.pending > beg) {\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);\n }\n if (s.gzindex === s.gzhead.extra.length) {\n s.gzindex = 0;\n s.status = NAME_STATE;\n }\n }\n else {\n s.status = NAME_STATE;\n }\n }\n if (s.status === NAME_STATE) {\n if (s.gzhead.name/* != Z_NULL*/) {\n beg = s.pending; /* start of bytes to update crc */\n //int val;\n\n do {\n if (s.pending === s.pending_buf_size) {\n if (s.gzhead.hcrc && s.pending > beg) {\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);\n }\n flush_pending(strm);\n beg = s.pending;\n if (s.pending === s.pending_buf_size) {\n val = 1;\n break;\n }\n }\n // JS specific: little magic to add zero terminator to end of string\n if (s.gzindex < s.gzhead.name.length) {\n val = s.gzhead.name.charCodeAt(s.gzindex++) & 0xff;\n } else {\n val = 0;\n }\n put_byte(s, val);\n } while (val !== 0);\n\n if (s.gzhead.hcrc && s.pending > beg) {\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);\n }\n if (val === 0) {\n s.gzindex = 0;\n s.status = COMMENT_STATE;\n }\n }\n else {\n s.status = COMMENT_STATE;\n }\n }\n if (s.status === COMMENT_STATE) {\n if (s.gzhead.comment/* != Z_NULL*/) {\n beg = s.pending; /* start of bytes to update crc */\n //int val;\n\n do {\n if (s.pending === s.pending_buf_size) {\n if (s.gzhead.hcrc && s.pending > beg) {\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);\n }\n flush_pending(strm);\n beg = s.pending;\n if (s.pending === s.pending_buf_size) {\n val = 1;\n break;\n }\n }\n // JS specific: little magic to add zero terminator to end of string\n if (s.gzindex < s.gzhead.comment.length) {\n val = s.gzhead.comment.charCodeAt(s.gzindex++) & 0xff;\n } else {\n val = 0;\n }\n put_byte(s, val);\n } while (val !== 0);\n\n if (s.gzhead.hcrc && s.pending > beg) {\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);\n }\n if (val === 0) {\n s.status = HCRC_STATE;\n }\n }\n else {\n s.status = HCRC_STATE;\n }\n }\n if (s.status === HCRC_STATE) {\n if (s.gzhead.hcrc) {\n if (s.pending + 2 > s.pending_buf_size) {\n flush_pending(strm);\n }\n if (s.pending + 2 <= s.pending_buf_size) {\n put_byte(s, strm.adler & 0xff);\n put_byte(s, (strm.adler >> 8) & 0xff);\n strm.adler = 0; //crc32(0L, Z_NULL, 0);\n s.status = BUSY_STATE;\n }\n }\n else {\n s.status = BUSY_STATE;\n }\n }\n//#endif\n\n /* Flush as much pending output as possible */\n if (s.pending !== 0) {\n flush_pending(strm);\n if (strm.avail_out === 0) {\n /* Since avail_out is 0, deflate will be called again with\n * more output space, but possibly with both pending and\n * avail_in equal to zero. There won't be anything to do,\n * but this is not an error situation so make sure we\n * return OK instead of BUF_ERROR at next call of deflate:\n */\n s.last_flush = -1;\n return Z_OK;\n }\n\n /* Make sure there is something to do and avoid duplicate consecutive\n * flushes. For repeated and useless calls with Z_FINISH, we keep\n * returning Z_STREAM_END instead of Z_BUF_ERROR.\n */\n } else if (strm.avail_in === 0 && rank(flush) <= rank(old_flush) &&\n flush !== Z_FINISH) {\n return err(strm, Z_BUF_ERROR);\n }\n\n /* User must not provide more input after the first FINISH: */\n if (s.status === FINISH_STATE && strm.avail_in !== 0) {\n return err(strm, Z_BUF_ERROR);\n }\n\n /* Start a new block or continue the current one.\n */\n if (strm.avail_in !== 0 || s.lookahead !== 0 ||\n (flush !== Z_NO_FLUSH && s.status !== FINISH_STATE)) {\n var bstate = (s.strategy === Z_HUFFMAN_ONLY) ? deflate_huff(s, flush) :\n (s.strategy === Z_RLE ? deflate_rle(s, flush) :\n configuration_table[s.level].func(s, flush));\n\n if (bstate === BS_FINISH_STARTED || bstate === BS_FINISH_DONE) {\n s.status = FINISH_STATE;\n }\n if (bstate === BS_NEED_MORE || bstate === BS_FINISH_STARTED) {\n if (strm.avail_out === 0) {\n s.last_flush = -1;\n /* avoid BUF_ERROR next call, see above */\n }\n return Z_OK;\n /* If flush != Z_NO_FLUSH && avail_out == 0, the next call\n * of deflate should use the same flush parameter to make sure\n * that the flush is complete. So we don't have to output an\n * empty block here, this will be done at next call. This also\n * ensures that for a very small output buffer, we emit at most\n * one empty block.\n */\n }\n if (bstate === BS_BLOCK_DONE) {\n if (flush === Z_PARTIAL_FLUSH) {\n trees._tr_align(s);\n }\n else if (flush !== Z_BLOCK) { /* FULL_FLUSH or SYNC_FLUSH */\n\n trees._tr_stored_block(s, 0, 0, false);\n /* For a full flush, this empty block will be recognized\n * as a special marker by inflate_sync().\n */\n if (flush === Z_FULL_FLUSH) {\n /*** CLEAR_HASH(s); ***/ /* forget history */\n zero(s.head); // Fill with NIL (= 0);\n\n if (s.lookahead === 0) {\n s.strstart = 0;\n s.block_start = 0;\n s.insert = 0;\n }\n }\n }\n flush_pending(strm);\n if (strm.avail_out === 0) {\n s.last_flush = -1; /* avoid BUF_ERROR at next call, see above */\n return Z_OK;\n }\n }\n }\n //Assert(strm->avail_out > 0, \"bug2\");\n //if (strm.avail_out <= 0) { throw new Error(\"bug2\");}\n\n if (flush !== Z_FINISH) { return Z_OK; }\n if (s.wrap <= 0) { return Z_STREAM_END; }\n\n /* Write the trailer */\n if (s.wrap === 2) {\n put_byte(s, strm.adler & 0xff);\n put_byte(s, (strm.adler >> 8) & 0xff);\n put_byte(s, (strm.adler >> 16) & 0xff);\n put_byte(s, (strm.adler >> 24) & 0xff);\n put_byte(s, strm.total_in & 0xff);\n put_byte(s, (strm.total_in >> 8) & 0xff);\n put_byte(s, (strm.total_in >> 16) & 0xff);\n put_byte(s, (strm.total_in >> 24) & 0xff);\n }\n else\n {\n putShortMSB(s, strm.adler >>> 16);\n putShortMSB(s, strm.adler & 0xffff);\n }\n\n flush_pending(strm);\n /* If avail_out is zero, the application will call deflate again\n * to flush the rest.\n */\n if (s.wrap > 0) { s.wrap = -s.wrap; }\n /* write the trailer only once! */\n return s.pending !== 0 ? Z_OK : Z_STREAM_END;\n}\n\nfunction deflateEnd(strm) {\n var status;\n\n if (!strm/*== Z_NULL*/ || !strm.state/*== Z_NULL*/) {\n return Z_STREAM_ERROR;\n }\n\n status = strm.state.status;\n if (status !== INIT_STATE &&\n status !== EXTRA_STATE &&\n status !== NAME_STATE &&\n status !== COMMENT_STATE &&\n status !== HCRC_STATE &&\n status !== BUSY_STATE &&\n status !== FINISH_STATE\n ) {\n return err(strm, Z_STREAM_ERROR);\n }\n\n strm.state = null;\n\n return status === BUSY_STATE ? err(strm, Z_DATA_ERROR) : Z_OK;\n}\n\n\n/* =========================================================================\n * Initializes the compression dictionary from the given byte\n * sequence without producing any compressed output.\n */\nfunction deflateSetDictionary(strm, dictionary) {\n var dictLength = dictionary.length;\n\n var s;\n var str, n;\n var wrap;\n var avail;\n var next;\n var input;\n var tmpDict;\n\n if (!strm/*== Z_NULL*/ || !strm.state/*== Z_NULL*/) {\n return Z_STREAM_ERROR;\n }\n\n s = strm.state;\n wrap = s.wrap;\n\n if (wrap === 2 || (wrap === 1 && s.status !== INIT_STATE) || s.lookahead) {\n return Z_STREAM_ERROR;\n }\n\n /* when using zlib wrappers, compute Adler-32 for provided dictionary */\n if (wrap === 1) {\n /* adler32(strm->adler, dictionary, dictLength); */\n strm.adler = adler32(strm.adler, dictionary, dictLength, 0);\n }\n\n s.wrap = 0; /* avoid computing Adler-32 in read_buf */\n\n /* if dictionary would fill window, just replace the history */\n if (dictLength >= s.w_size) {\n if (wrap === 0) { /* already empty otherwise */\n /*** CLEAR_HASH(s); ***/\n zero(s.head); // Fill with NIL (= 0);\n s.strstart = 0;\n s.block_start = 0;\n s.insert = 0;\n }\n /* use the tail */\n // dictionary = dictionary.slice(dictLength - s.w_size);\n tmpDict = new utils.Buf8(s.w_size);\n utils.arraySet(tmpDict, dictionary, dictLength - s.w_size, s.w_size, 0);\n dictionary = tmpDict;\n dictLength = s.w_size;\n }\n /* insert dictionary into window and hash */\n avail = strm.avail_in;\n next = strm.next_in;\n input = strm.input;\n strm.avail_in = dictLength;\n strm.next_in = 0;\n strm.input = dictionary;\n fill_window(s);\n while (s.lookahead >= MIN_MATCH) {\n str = s.strstart;\n n = s.lookahead - (MIN_MATCH - 1);\n do {\n /* UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]); */\n s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[str + MIN_MATCH - 1]) & s.hash_mask;\n\n s.prev[str & s.w_mask] = s.head[s.ins_h];\n\n s.head[s.ins_h] = str;\n str++;\n } while (--n);\n s.strstart = str;\n s.lookahead = MIN_MATCH - 1;\n fill_window(s);\n }\n s.strstart += s.lookahead;\n s.block_start = s.strstart;\n s.insert = s.lookahead;\n s.lookahead = 0;\n s.match_length = s.prev_length = MIN_MATCH - 1;\n s.match_available = 0;\n strm.next_in = next;\n strm.input = input;\n strm.avail_in = avail;\n s.wrap = wrap;\n return Z_OK;\n}\n\n\nexports.deflateInit = deflateInit;\nexports.deflateInit2 = deflateInit2;\nexports.deflateReset = deflateReset;\nexports.deflateResetKeep = deflateResetKeep;\nexports.deflateSetHeader = deflateSetHeader;\nexports.deflate = deflate;\nexports.deflateEnd = deflateEnd;\nexports.deflateSetDictionary = deflateSetDictionary;\nexports.deflateInfo = 'pako deflate (from Nodeca project)';\n\n/* Not implemented\nexports.deflateBound = deflateBound;\nexports.deflateCopy = deflateCopy;\nexports.deflateParams = deflateParams;\nexports.deflatePending = deflatePending;\nexports.deflatePrime = deflatePrime;\nexports.deflateTune = deflateTune;\n*/\n","'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\n/* eslint-disable space-unary-ops */\n\nvar utils = require('../utils/common');\n\n/* Public constants ==========================================================*/\n/* ===========================================================================*/\n\n\n//var Z_FILTERED = 1;\n//var Z_HUFFMAN_ONLY = 2;\n//var Z_RLE = 3;\nvar Z_FIXED = 4;\n//var Z_DEFAULT_STRATEGY = 0;\n\n/* Possible values of the data_type field (though see inflate()) */\nvar Z_BINARY = 0;\nvar Z_TEXT = 1;\n//var Z_ASCII = 1; // = Z_TEXT\nvar Z_UNKNOWN = 2;\n\n/*============================================================================*/\n\n\nfunction zero(buf) { var len = buf.length; while (--len >= 0) { buf[len] = 0; } }\n\n// From zutil.h\n\nvar STORED_BLOCK = 0;\nvar STATIC_TREES = 1;\nvar DYN_TREES = 2;\n/* The three kinds of block type */\n\nvar MIN_MATCH = 3;\nvar MAX_MATCH = 258;\n/* The minimum and maximum match lengths */\n\n// From deflate.h\n/* ===========================================================================\n * Internal compression state.\n */\n\nvar LENGTH_CODES = 29;\n/* number of length codes, not counting the special END_BLOCK code */\n\nvar LITERALS = 256;\n/* number of literal bytes 0..255 */\n\nvar L_CODES = LITERALS + 1 + LENGTH_CODES;\n/* number of Literal or Length codes, including the END_BLOCK code */\n\nvar D_CODES = 30;\n/* number of distance codes */\n\nvar BL_CODES = 19;\n/* number of codes used to transfer the bit lengths */\n\nvar HEAP_SIZE = 2 * L_CODES + 1;\n/* maximum heap size */\n\nvar MAX_BITS = 15;\n/* All codes must not exceed MAX_BITS bits */\n\nvar Buf_size = 16;\n/* size of bit buffer in bi_buf */\n\n\n/* ===========================================================================\n * Constants\n */\n\nvar MAX_BL_BITS = 7;\n/* Bit length codes must not exceed MAX_BL_BITS bits */\n\nvar END_BLOCK = 256;\n/* end of block literal code */\n\nvar REP_3_6 = 16;\n/* repeat previous bit length 3-6 times (2 bits of repeat count) */\n\nvar REPZ_3_10 = 17;\n/* repeat a zero length 3-10 times (3 bits of repeat count) */\n\nvar REPZ_11_138 = 18;\n/* repeat a zero length 11-138 times (7 bits of repeat count) */\n\n/* eslint-disable comma-spacing,array-bracket-spacing */\nvar extra_lbits = /* extra bits for each length code */\n [0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0];\n\nvar extra_dbits = /* extra bits for each distance code */\n [0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13];\n\nvar extra_blbits = /* extra bits for each bit length code */\n [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7];\n\nvar bl_order =\n [16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];\n/* eslint-enable comma-spacing,array-bracket-spacing */\n\n/* The lengths of the bit length codes are sent in order of decreasing\n * probability, to avoid transmitting the lengths for unused bit length codes.\n */\n\n/* ===========================================================================\n * Local data. These are initialized only once.\n */\n\n// We pre-fill arrays with 0 to avoid uninitialized gaps\n\nvar DIST_CODE_LEN = 512; /* see definition of array dist_code below */\n\n// !!!! Use flat array instead of structure, Freq = i*2, Len = i*2+1\nvar static_ltree = new Array((L_CODES + 2) * 2);\nzero(static_ltree);\n/* The static literal tree. Since the bit lengths are imposed, there is no\n * need for the L_CODES extra codes used during heap construction. However\n * The codes 286 and 287 are needed to build a canonical tree (see _tr_init\n * below).\n */\n\nvar static_dtree = new Array(D_CODES * 2);\nzero(static_dtree);\n/* The static distance tree. (Actually a trivial tree since all codes use\n * 5 bits.)\n */\n\nvar _dist_code = new Array(DIST_CODE_LEN);\nzero(_dist_code);\n/* Distance codes. The first 256 values correspond to the distances\n * 3 .. 258, the last 256 values correspond to the top 8 bits of\n * the 15 bit distances.\n */\n\nvar _length_code = new Array(MAX_MATCH - MIN_MATCH + 1);\nzero(_length_code);\n/* length code for each normalized match length (0 == MIN_MATCH) */\n\nvar base_length = new Array(LENGTH_CODES);\nzero(base_length);\n/* First normalized length for each code (0 = MIN_MATCH) */\n\nvar base_dist = new Array(D_CODES);\nzero(base_dist);\n/* First normalized distance for each code (0 = distance of 1) */\n\n\nfunction StaticTreeDesc(static_tree, extra_bits, extra_base, elems, max_length) {\n\n this.static_tree = static_tree; /* static tree or NULL */\n this.extra_bits = extra_bits; /* extra bits for each code or NULL */\n this.extra_base = extra_base; /* base index for extra_bits */\n this.elems = elems; /* max number of elements in the tree */\n this.max_length = max_length; /* max bit length for the codes */\n\n // show if `static_tree` has data or dummy - needed for monomorphic objects\n this.has_stree = static_tree && static_tree.length;\n}\n\n\nvar static_l_desc;\nvar static_d_desc;\nvar static_bl_desc;\n\n\nfunction TreeDesc(dyn_tree, stat_desc) {\n this.dyn_tree = dyn_tree; /* the dynamic tree */\n this.max_code = 0; /* largest code with non zero frequency */\n this.stat_desc = stat_desc; /* the corresponding static tree */\n}\n\n\n\nfunction d_code(dist) {\n return dist < 256 ? _dist_code[dist] : _dist_code[256 + (dist >>> 7)];\n}\n\n\n/* ===========================================================================\n * Output a short LSB first on the stream.\n * IN assertion: there is enough room in pendingBuf.\n */\nfunction put_short(s, w) {\n// put_byte(s, (uch)((w) & 0xff));\n// put_byte(s, (uch)((ush)(w) >> 8));\n s.pending_buf[s.pending++] = (w) & 0xff;\n s.pending_buf[s.pending++] = (w >>> 8) & 0xff;\n}\n\n\n/* ===========================================================================\n * Send a value on a given number of bits.\n * IN assertion: length <= 16 and value fits in length bits.\n */\nfunction send_bits(s, value, length) {\n if (s.bi_valid > (Buf_size - length)) {\n s.bi_buf |= (value << s.bi_valid) & 0xffff;\n put_short(s, s.bi_buf);\n s.bi_buf = value >> (Buf_size - s.bi_valid);\n s.bi_valid += length - Buf_size;\n } else {\n s.bi_buf |= (value << s.bi_valid) & 0xffff;\n s.bi_valid += length;\n }\n}\n\n\nfunction send_code(s, c, tree) {\n send_bits(s, tree[c * 2]/*.Code*/, tree[c * 2 + 1]/*.Len*/);\n}\n\n\n/* ===========================================================================\n * Reverse the first len bits of a code, using straightforward code (a faster\n * method would use a table)\n * IN assertion: 1 <= len <= 15\n */\nfunction bi_reverse(code, len) {\n var res = 0;\n do {\n res |= code & 1;\n code >>>= 1;\n res <<= 1;\n } while (--len > 0);\n return res >>> 1;\n}\n\n\n/* ===========================================================================\n * Flush the bit buffer, keeping at most 7 bits in it.\n */\nfunction bi_flush(s) {\n if (s.bi_valid === 16) {\n put_short(s, s.bi_buf);\n s.bi_buf = 0;\n s.bi_valid = 0;\n\n } else if (s.bi_valid >= 8) {\n s.pending_buf[s.pending++] = s.bi_buf & 0xff;\n s.bi_buf >>= 8;\n s.bi_valid -= 8;\n }\n}\n\n\n/* ===========================================================================\n * Compute the optimal bit lengths for a tree and update the total bit length\n * for the current block.\n * IN assertion: the fields freq and dad are set, heap[heap_max] and\n * above are the tree nodes sorted by increasing frequency.\n * OUT assertions: the field len is set to the optimal bit length, the\n * array bl_count contains the frequencies for each bit length.\n * The length opt_len is updated; static_len is also updated if stree is\n * not null.\n */\nfunction gen_bitlen(s, desc)\n// deflate_state *s;\n// tree_desc *desc; /* the tree descriptor */\n{\n var tree = desc.dyn_tree;\n var max_code = desc.max_code;\n var stree = desc.stat_desc.static_tree;\n var has_stree = desc.stat_desc.has_stree;\n var extra = desc.stat_desc.extra_bits;\n var base = desc.stat_desc.extra_base;\n var max_length = desc.stat_desc.max_length;\n var h; /* heap index */\n var n, m; /* iterate over the tree elements */\n var bits; /* bit length */\n var xbits; /* extra bits */\n var f; /* frequency */\n var overflow = 0; /* number of elements with bit length too large */\n\n for (bits = 0; bits <= MAX_BITS; bits++) {\n s.bl_count[bits] = 0;\n }\n\n /* In a first pass, compute the optimal bit lengths (which may\n * overflow in the case of the bit length tree).\n */\n tree[s.heap[s.heap_max] * 2 + 1]/*.Len*/ = 0; /* root of the heap */\n\n for (h = s.heap_max + 1; h < HEAP_SIZE; h++) {\n n = s.heap[h];\n bits = tree[tree[n * 2 + 1]/*.Dad*/ * 2 + 1]/*.Len*/ + 1;\n if (bits > max_length) {\n bits = max_length;\n overflow++;\n }\n tree[n * 2 + 1]/*.Len*/ = bits;\n /* We overwrite tree[n].Dad which is no longer needed */\n\n if (n > max_code) { continue; } /* not a leaf node */\n\n s.bl_count[bits]++;\n xbits = 0;\n if (n >= base) {\n xbits = extra[n - base];\n }\n f = tree[n * 2]/*.Freq*/;\n s.opt_len += f * (bits + xbits);\n if (has_stree) {\n s.static_len += f * (stree[n * 2 + 1]/*.Len*/ + xbits);\n }\n }\n if (overflow === 0) { return; }\n\n // Trace((stderr,\"\\nbit length overflow\\n\"));\n /* This happens for example on obj2 and pic of the Calgary corpus */\n\n /* Find the first bit length which could increase: */\n do {\n bits = max_length - 1;\n while (s.bl_count[bits] === 0) { bits--; }\n s.bl_count[bits]--; /* move one leaf down the tree */\n s.bl_count[bits + 1] += 2; /* move one overflow item as its brother */\n s.bl_count[max_length]--;\n /* The brother of the overflow item also moves one step up,\n * but this does not affect bl_count[max_length]\n */\n overflow -= 2;\n } while (overflow > 0);\n\n /* Now recompute all bit lengths, scanning in increasing frequency.\n * h is still equal to HEAP_SIZE. (It is simpler to reconstruct all\n * lengths instead of fixing only the wrong ones. This idea is taken\n * from 'ar' written by Haruhiko Okumura.)\n */\n for (bits = max_length; bits !== 0; bits--) {\n n = s.bl_count[bits];\n while (n !== 0) {\n m = s.heap[--h];\n if (m > max_code) { continue; }\n if (tree[m * 2 + 1]/*.Len*/ !== bits) {\n // Trace((stderr,\"code %d bits %d->%d\\n\", m, tree[m].Len, bits));\n s.opt_len += (bits - tree[m * 2 + 1]/*.Len*/) * tree[m * 2]/*.Freq*/;\n tree[m * 2 + 1]/*.Len*/ = bits;\n }\n n--;\n }\n }\n}\n\n\n/* ===========================================================================\n * Generate the codes for a given tree and bit counts (which need not be\n * optimal).\n * IN assertion: the array bl_count contains the bit length statistics for\n * the given tree and the field len is set for all tree elements.\n * OUT assertion: the field code is set for all tree elements of non\n * zero code length.\n */\nfunction gen_codes(tree, max_code, bl_count)\n// ct_data *tree; /* the tree to decorate */\n// int max_code; /* largest code with non zero frequency */\n// ushf *bl_count; /* number of codes at each bit length */\n{\n var next_code = new Array(MAX_BITS + 1); /* next code value for each bit length */\n var code = 0; /* running code value */\n var bits; /* bit index */\n var n; /* code index */\n\n /* The distribution counts are first used to generate the code values\n * without bit reversal.\n */\n for (bits = 1; bits <= MAX_BITS; bits++) {\n next_code[bits] = code = (code + bl_count[bits - 1]) << 1;\n }\n /* Check that the bit counts in bl_count are consistent. The last code\n * must be all ones.\n */\n //Assert (code + bl_count[MAX_BITS]-1 == (1<<MAX_BITS)-1,\n // \"inconsistent bit counts\");\n //Tracev((stderr,\"\\ngen_codes: max_code %d \", max_code));\n\n for (n = 0; n <= max_code; n++) {\n var len = tree[n * 2 + 1]/*.Len*/;\n if (len === 0) { continue; }\n /* Now reverse the bits */\n tree[n * 2]/*.Code*/ = bi_reverse(next_code[len]++, len);\n\n //Tracecv(tree != static_ltree, (stderr,\"\\nn %3d %c l %2d c %4x (%x) \",\n // n, (isgraph(n) ? n : ' '), len, tree[n].Code, next_code[len]-1));\n }\n}\n\n\n/* ===========================================================================\n * Initialize the various 'constant' tables.\n */\nfunction tr_static_init() {\n var n; /* iterates over tree elements */\n var bits; /* bit counter */\n var length; /* length value */\n var code; /* code value */\n var dist; /* distance index */\n var bl_count = new Array(MAX_BITS + 1);\n /* number of codes at each bit length for an optimal tree */\n\n // do check in _tr_init()\n //if (static_init_done) return;\n\n /* For some embedded targets, global variables are not initialized: */\n/*#ifdef NO_INIT_GLOBAL_POINTERS\n static_l_desc.static_tree = static_ltree;\n static_l_desc.extra_bits = extra_lbits;\n static_d_desc.static_tree = static_dtree;\n static_d_desc.extra_bits = extra_dbits;\n static_bl_desc.extra_bits = extra_blbits;\n#endif*/\n\n /* Initialize the mapping length (0..255) -> length code (0..28) */\n length = 0;\n for (code = 0; code < LENGTH_CODES - 1; code++) {\n base_length[code] = length;\n for (n = 0; n < (1 << extra_lbits[code]); n++) {\n _length_code[length++] = code;\n }\n }\n //Assert (length == 256, \"tr_static_init: length != 256\");\n /* Note that the length 255 (match length 258) can be represented\n * in two different ways: code 284 + 5 bits or code 285, so we\n * overwrite length_code[255] to use the best encoding:\n */\n _length_code[length - 1] = code;\n\n /* Initialize the mapping dist (0..32K) -> dist code (0..29) */\n dist = 0;\n for (code = 0; code < 16; code++) {\n base_dist[code] = dist;\n for (n = 0; n < (1 << extra_dbits[code]); n++) {\n _dist_code[dist++] = code;\n }\n }\n //Assert (dist == 256, \"tr_static_init: dist != 256\");\n dist >>= 7; /* from now on, all distances are divided by 128 */\n for (; code < D_CODES; code++) {\n base_dist[code] = dist << 7;\n for (n = 0; n < (1 << (extra_dbits[code] - 7)); n++) {\n _dist_code[256 + dist++] = code;\n }\n }\n //Assert (dist == 256, \"tr_static_init: 256+dist != 512\");\n\n /* Construct the codes of the static literal tree */\n for (bits = 0; bits <= MAX_BITS; bits++) {\n bl_count[bits] = 0;\n }\n\n n = 0;\n while (n <= 143) {\n static_ltree[n * 2 + 1]/*.Len*/ = 8;\n n++;\n bl_count[8]++;\n }\n while (n <= 255) {\n static_ltree[n * 2 + 1]/*.Len*/ = 9;\n n++;\n bl_count[9]++;\n }\n while (n <= 279) {\n static_ltree[n * 2 + 1]/*.Len*/ = 7;\n n++;\n bl_count[7]++;\n }\n while (n <= 287) {\n static_ltree[n * 2 + 1]/*.Len*/ = 8;\n n++;\n bl_count[8]++;\n }\n /* Codes 286 and 287 do not exist, but we must include them in the\n * tree construction to get a canonical Huffman tree (longest code\n * all ones)\n */\n gen_codes(static_ltree, L_CODES + 1, bl_count);\n\n /* The static distance tree is trivial: */\n for (n = 0; n < D_CODES; n++) {\n static_dtree[n * 2 + 1]/*.Len*/ = 5;\n static_dtree[n * 2]/*.Code*/ = bi_reverse(n, 5);\n }\n\n // Now data ready and we can init static trees\n static_l_desc = new StaticTreeDesc(static_ltree, extra_lbits, LITERALS + 1, L_CODES, MAX_BITS);\n static_d_desc = new StaticTreeDesc(static_dtree, extra_dbits, 0, D_CODES, MAX_BITS);\n static_bl_desc = new StaticTreeDesc(new Array(0), extra_blbits, 0, BL_CODES, MAX_BL_BITS);\n\n //static_init_done = true;\n}\n\n\n/* ===========================================================================\n * Initialize a new block.\n */\nfunction init_block(s) {\n var n; /* iterates over tree elements */\n\n /* Initialize the trees. */\n for (n = 0; n < L_CODES; n++) { s.dyn_ltree[n * 2]/*.Freq*/ = 0; }\n for (n = 0; n < D_CODES; n++) { s.dyn_dtree[n * 2]/*.Freq*/ = 0; }\n for (n = 0; n < BL_CODES; n++) { s.bl_tree[n * 2]/*.Freq*/ = 0; }\n\n s.dyn_ltree[END_BLOCK * 2]/*.Freq*/ = 1;\n s.opt_len = s.static_len = 0;\n s.last_lit = s.matches = 0;\n}\n\n\n/* ===========================================================================\n * Flush the bit buffer and align the output on a byte boundary\n */\nfunction bi_windup(s)\n{\n if (s.bi_valid > 8) {\n put_short(s, s.bi_buf);\n } else if (s.bi_valid > 0) {\n //put_byte(s, (Byte)s->bi_buf);\n s.pending_buf[s.pending++] = s.bi_buf;\n }\n s.bi_buf = 0;\n s.bi_valid = 0;\n}\n\n/* ===========================================================================\n * Copy a stored block, storing first the length and its\n * one's complement if requested.\n */\nfunction copy_block(s, buf, len, header)\n//DeflateState *s;\n//charf *buf; /* the input data */\n//unsigned len; /* its length */\n//int header; /* true if block header must be written */\n{\n bi_windup(s); /* align on byte boundary */\n\n if (header) {\n put_short(s, len);\n put_short(s, ~len);\n }\n// while (len--) {\n// put_byte(s, *buf++);\n// }\n utils.arraySet(s.pending_buf, s.window, buf, len, s.pending);\n s.pending += len;\n}\n\n/* ===========================================================================\n * Compares to subtrees, using the tree depth as tie breaker when\n * the subtrees have equal frequency. This minimizes the worst case length.\n */\nfunction smaller(tree, n, m, depth) {\n var _n2 = n * 2;\n var _m2 = m * 2;\n return (tree[_n2]/*.Freq*/ < tree[_m2]/*.Freq*/ ||\n (tree[_n2]/*.Freq*/ === tree[_m2]/*.Freq*/ && depth[n] <= depth[m]));\n}\n\n/* ===========================================================================\n * Restore the heap property by moving down the tree starting at node k,\n * exchanging a node with the smallest of its two sons if necessary, stopping\n * when the heap property is re-established (each father smaller than its\n * two sons).\n */\nfunction pqdownheap(s, tree, k)\n// deflate_state *s;\n// ct_data *tree; /* the tree to restore */\n// int k; /* node to move down */\n{\n var v = s.heap[k];\n var j = k << 1; /* left son of k */\n while (j <= s.heap_len) {\n /* Set j to the smallest of the two sons: */\n if (j < s.heap_len &&\n smaller(tree, s.heap[j + 1], s.heap[j], s.depth)) {\n j++;\n }\n /* Exit if v is smaller than both sons */\n if (smaller(tree, v, s.heap[j], s.depth)) { break; }\n\n /* Exchange v with the smallest son */\n s.heap[k] = s.heap[j];\n k = j;\n\n /* And continue down the tree, setting j to the left son of k */\n j <<= 1;\n }\n s.heap[k] = v;\n}\n\n\n// inlined manually\n// var SMALLEST = 1;\n\n/* ===========================================================================\n * Send the block data compressed using the given Huffman trees\n */\nfunction compress_block(s, ltree, dtree)\n// deflate_state *s;\n// const ct_data *ltree; /* literal tree */\n// const ct_data *dtree; /* distance tree */\n{\n var dist; /* distance of matched string */\n var lc; /* match length or unmatched char (if dist == 0) */\n var lx = 0; /* running index in l_buf */\n var code; /* the code to send */\n var extra; /* number of extra bits to send */\n\n if (s.last_lit !== 0) {\n do {\n dist = (s.pending_buf[s.d_buf + lx * 2] << 8) | (s.pending_buf[s.d_buf + lx * 2 + 1]);\n lc = s.pending_buf[s.l_buf + lx];\n lx++;\n\n if (dist === 0) {\n send_code(s, lc, ltree); /* send a literal byte */\n //Tracecv(isgraph(lc), (stderr,\" '%c' \", lc));\n } else {\n /* Here, lc is the match length - MIN_MATCH */\n code = _length_code[lc];\n send_code(s, code + LITERALS + 1, ltree); /* send the length code */\n extra = extra_lbits[code];\n if (extra !== 0) {\n lc -= base_length[code];\n send_bits(s, lc, extra); /* send the extra length bits */\n }\n dist--; /* dist is now the match distance - 1 */\n code = d_code(dist);\n //Assert (code < D_CODES, \"bad d_code\");\n\n send_code(s, code, dtree); /* send the distance code */\n extra = extra_dbits[code];\n if (extra !== 0) {\n dist -= base_dist[code];\n send_bits(s, dist, extra); /* send the extra distance bits */\n }\n } /* literal or match pair ? */\n\n /* Check that the overlay between pending_buf and d_buf+l_buf is ok: */\n //Assert((uInt)(s->pending) < s->lit_bufsize + 2*lx,\n // \"pendingBuf overflow\");\n\n } while (lx < s.last_lit);\n }\n\n send_code(s, END_BLOCK, ltree);\n}\n\n\n/* ===========================================================================\n * Construct one Huffman tree and assigns the code bit strings and lengths.\n * Update the total bit length for the current block.\n * IN assertion: the field freq is set for all tree elements.\n * OUT assertions: the fields len and code are set to the optimal bit length\n * and corresponding code. The length opt_len is updated; static_len is\n * also updated if stree is not null. The field max_code is set.\n */\nfunction build_tree(s, desc)\n// deflate_state *s;\n// tree_desc *desc; /* the tree descriptor */\n{\n var tree = desc.dyn_tree;\n var stree = desc.stat_desc.static_tree;\n var has_stree = desc.stat_desc.has_stree;\n var elems = desc.stat_desc.elems;\n var n, m; /* iterate over heap elements */\n var max_code = -1; /* largest code with non zero frequency */\n var node; /* new node being created */\n\n /* Construct the initial heap, with least frequent element in\n * heap[SMALLEST]. The sons of heap[n] are heap[2*n] and heap[2*n+1].\n * heap[0] is not used.\n */\n s.heap_len = 0;\n s.heap_max = HEAP_SIZE;\n\n for (n = 0; n < elems; n++) {\n if (tree[n * 2]/*.Freq*/ !== 0) {\n s.heap[++s.heap_len] = max_code = n;\n s.depth[n] = 0;\n\n } else {\n tree[n * 2 + 1]/*.Len*/ = 0;\n }\n }\n\n /* The pkzip format requires that at least one distance code exists,\n * and that at least one bit should be sent even if there is only one\n * possible code. So to avoid special checks later on we force at least\n * two codes of non zero frequency.\n */\n while (s.heap_len < 2) {\n node = s.heap[++s.heap_len] = (max_code < 2 ? ++max_code : 0);\n tree[node * 2]/*.Freq*/ = 1;\n s.depth[node] = 0;\n s.opt_len--;\n\n if (has_stree) {\n s.static_len -= stree[node * 2 + 1]/*.Len*/;\n }\n /* node is 0 or 1 so it does not have extra bits */\n }\n desc.max_code = max_code;\n\n /* The elements heap[heap_len/2+1 .. heap_len] are leaves of the tree,\n * establish sub-heaps of increasing lengths:\n */\n for (n = (s.heap_len >> 1/*int /2*/); n >= 1; n--) { pqdownheap(s, tree, n); }\n\n /* Construct the Huffman tree by repeatedly combining the least two\n * frequent nodes.\n */\n node = elems; /* next internal node of the tree */\n do {\n //pqremove(s, tree, n); /* n = node of least frequency */\n /*** pqremove ***/\n n = s.heap[1/*SMALLEST*/];\n s.heap[1/*SMALLEST*/] = s.heap[s.heap_len--];\n pqdownheap(s, tree, 1/*SMALLEST*/);\n /***/\n\n m = s.heap[1/*SMALLEST*/]; /* m = node of next least frequency */\n\n s.heap[--s.heap_max] = n; /* keep the nodes sorted by frequency */\n s.heap[--s.heap_max] = m;\n\n /* Create a new node father of n and m */\n tree[node * 2]/*.Freq*/ = tree[n * 2]/*.Freq*/ + tree[m * 2]/*.Freq*/;\n s.depth[node] = (s.depth[n] >= s.depth[m] ? s.depth[n] : s.depth[m]) + 1;\n tree[n * 2 + 1]/*.Dad*/ = tree[m * 2 + 1]/*.Dad*/ = node;\n\n /* and insert the new node in the heap */\n s.heap[1/*SMALLEST*/] = node++;\n pqdownheap(s, tree, 1/*SMALLEST*/);\n\n } while (s.heap_len >= 2);\n\n s.heap[--s.heap_max] = s.heap[1/*SMALLEST*/];\n\n /* At this point, the fields freq and dad are set. We can now\n * generate the bit lengths.\n */\n gen_bitlen(s, desc);\n\n /* The field len is now set, we can generate the bit codes */\n gen_codes(tree, max_code, s.bl_count);\n}\n\n\n/* ===========================================================================\n * Scan a literal or distance tree to determine the frequencies of the codes\n * in the bit length tree.\n */\nfunction scan_tree(s, tree, max_code)\n// deflate_state *s;\n// ct_data *tree; /* the tree to be scanned */\n// int max_code; /* and its largest code of non zero frequency */\n{\n var n; /* iterates over all tree elements */\n var prevlen = -1; /* last emitted length */\n var curlen; /* length of current code */\n\n var nextlen = tree[0 * 2 + 1]/*.Len*/; /* length of next code */\n\n var count = 0; /* repeat count of the current code */\n var max_count = 7; /* max repeat count */\n var min_count = 4; /* min repeat count */\n\n if (nextlen === 0) {\n max_count = 138;\n min_count = 3;\n }\n tree[(max_code + 1) * 2 + 1]/*.Len*/ = 0xffff; /* guard */\n\n for (n = 0; n <= max_code; n++) {\n curlen = nextlen;\n nextlen = tree[(n + 1) * 2 + 1]/*.Len*/;\n\n if (++count < max_count && curlen === nextlen) {\n continue;\n\n } else if (count < min_count) {\n s.bl_tree[curlen * 2]/*.Freq*/ += count;\n\n } else if (curlen !== 0) {\n\n if (curlen !== prevlen) { s.bl_tree[curlen * 2]/*.Freq*/++; }\n s.bl_tree[REP_3_6 * 2]/*.Freq*/++;\n\n } else if (count <= 10) {\n s.bl_tree[REPZ_3_10 * 2]/*.Freq*/++;\n\n } else {\n s.bl_tree[REPZ_11_138 * 2]/*.Freq*/++;\n }\n\n count = 0;\n prevlen = curlen;\n\n if (nextlen === 0) {\n max_count = 138;\n min_count = 3;\n\n } else if (curlen === nextlen) {\n max_count = 6;\n min_count = 3;\n\n } else {\n max_count = 7;\n min_count = 4;\n }\n }\n}\n\n\n/* ===========================================================================\n * Send a literal or distance tree in compressed form, using the codes in\n * bl_tree.\n */\nfunction send_tree(s, tree, max_code)\n// deflate_state *s;\n// ct_data *tree; /* the tree to be scanned */\n// int max_code; /* and its largest code of non zero frequency */\n{\n var n; /* iterates over all tree elements */\n var prevlen = -1; /* last emitted length */\n var curlen; /* length of current code */\n\n var nextlen = tree[0 * 2 + 1]/*.Len*/; /* length of next code */\n\n var count = 0; /* repeat count of the current code */\n var max_count = 7; /* max repeat count */\n var min_count = 4; /* min repeat count */\n\n /* tree[max_code+1].Len = -1; */ /* guard already set */\n if (nextlen === 0) {\n max_count = 138;\n min_count = 3;\n }\n\n for (n = 0; n <= max_code; n++) {\n curlen = nextlen;\n nextlen = tree[(n + 1) * 2 + 1]/*.Len*/;\n\n if (++count < max_count && curlen === nextlen) {\n continue;\n\n } else if (count < min_count) {\n do { send_code(s, curlen, s.bl_tree); } while (--count !== 0);\n\n } else if (curlen !== 0) {\n if (curlen !== prevlen) {\n send_code(s, curlen, s.bl_tree);\n count--;\n }\n //Assert(count >= 3 && count <= 6, \" 3_6?\");\n send_code(s, REP_3_6, s.bl_tree);\n send_bits(s, count - 3, 2);\n\n } else if (count <= 10) {\n send_code(s, REPZ_3_10, s.bl_tree);\n send_bits(s, count - 3, 3);\n\n } else {\n send_code(s, REPZ_11_138, s.bl_tree);\n send_bits(s, count - 11, 7);\n }\n\n count = 0;\n prevlen = curlen;\n if (nextlen === 0) {\n max_count = 138;\n min_count = 3;\n\n } else if (curlen === nextlen) {\n max_count = 6;\n min_count = 3;\n\n } else {\n max_count = 7;\n min_count = 4;\n }\n }\n}\n\n\n/* ===========================================================================\n * Construct the Huffman tree for the bit lengths and return the index in\n * bl_order of the last bit length code to send.\n */\nfunction build_bl_tree(s) {\n var max_blindex; /* index of last bit length code of non zero freq */\n\n /* Determine the bit length frequencies for literal and distance trees */\n scan_tree(s, s.dyn_ltree, s.l_desc.max_code);\n scan_tree(s, s.dyn_dtree, s.d_desc.max_code);\n\n /* Build the bit length tree: */\n build_tree(s, s.bl_desc);\n /* opt_len now includes the length of the tree representations, except\n * the lengths of the bit lengths codes and the 5+5+4 bits for the counts.\n */\n\n /* Determine the number of bit length codes to send. The pkzip format\n * requires that at least 4 bit length codes be sent. (appnote.txt says\n * 3 but the actual value used is 4.)\n */\n for (max_blindex = BL_CODES - 1; max_blindex >= 3; max_blindex--) {\n if (s.bl_tree[bl_order[max_blindex] * 2 + 1]/*.Len*/ !== 0) {\n break;\n }\n }\n /* Update opt_len to include the bit length tree and counts */\n s.opt_len += 3 * (max_blindex + 1) + 5 + 5 + 4;\n //Tracev((stderr, \"\\ndyn trees: dyn %ld, stat %ld\",\n // s->opt_len, s->static_len));\n\n return max_blindex;\n}\n\n\n/* ===========================================================================\n * Send the header for a block using dynamic Huffman trees: the counts, the\n * lengths of the bit length codes, the literal tree and the distance tree.\n * IN assertion: lcodes >= 257, dcodes >= 1, blcodes >= 4.\n */\nfunction send_all_trees(s, lcodes, dcodes, blcodes)\n// deflate_state *s;\n// int lcodes, dcodes, blcodes; /* number of codes for each tree */\n{\n var rank; /* index in bl_order */\n\n //Assert (lcodes >= 257 && dcodes >= 1 && blcodes >= 4, \"not enough codes\");\n //Assert (lcodes <= L_CODES && dcodes <= D_CODES && blcodes <= BL_CODES,\n // \"too many codes\");\n //Tracev((stderr, \"\\nbl counts: \"));\n send_bits(s, lcodes - 257, 5); /* not +255 as stated in appnote.txt */\n send_bits(s, dcodes - 1, 5);\n send_bits(s, blcodes - 4, 4); /* not -3 as stated in appnote.txt */\n for (rank = 0; rank < blcodes; rank++) {\n //Tracev((stderr, \"\\nbl code %2d \", bl_order[rank]));\n send_bits(s, s.bl_tree[bl_order[rank] * 2 + 1]/*.Len*/, 3);\n }\n //Tracev((stderr, \"\\nbl tree: sent %ld\", s->bits_sent));\n\n send_tree(s, s.dyn_ltree, lcodes - 1); /* literal tree */\n //Tracev((stderr, \"\\nlit tree: sent %ld\", s->bits_sent));\n\n send_tree(s, s.dyn_dtree, dcodes - 1); /* distance tree */\n //Tracev((stderr, \"\\ndist tree: sent %ld\", s->bits_sent));\n}\n\n\n/* ===========================================================================\n * Check if the data type is TEXT or BINARY, using the following algorithm:\n * - TEXT if the two conditions below are satisfied:\n * a) There are no non-portable control characters belonging to the\n * \"black list\" (0..6, 14..25, 28..31).\n * b) There is at least one printable character belonging to the\n * \"white list\" (9 {TAB}, 10 {LF}, 13 {CR}, 32..255).\n * - BINARY otherwise.\n * - The following partially-portable control characters form a\n * \"gray list\" that is ignored in this detection algorithm:\n * (7 {BEL}, 8 {BS}, 11 {VT}, 12 {FF}, 26 {SUB}, 27 {ESC}).\n * IN assertion: the fields Freq of dyn_ltree are set.\n */\nfunction detect_data_type(s) {\n /* black_mask is the bit mask of black-listed bytes\n * set bits 0..6, 14..25, and 28..31\n * 0xf3ffc07f = binary 11110011111111111100000001111111\n */\n var black_mask = 0xf3ffc07f;\n var n;\n\n /* Check for non-textual (\"black-listed\") bytes. */\n for (n = 0; n <= 31; n++, black_mask >>>= 1) {\n if ((black_mask & 1) && (s.dyn_ltree[n * 2]/*.Freq*/ !== 0)) {\n return Z_BINARY;\n }\n }\n\n /* Check for textual (\"white-listed\") bytes. */\n if (s.dyn_ltree[9 * 2]/*.Freq*/ !== 0 || s.dyn_ltree[10 * 2]/*.Freq*/ !== 0 ||\n s.dyn_ltree[13 * 2]/*.Freq*/ !== 0) {\n return Z_TEXT;\n }\n for (n = 32; n < LITERALS; n++) {\n if (s.dyn_ltree[n * 2]/*.Freq*/ !== 0) {\n return Z_TEXT;\n }\n }\n\n /* There are no \"black-listed\" or \"white-listed\" bytes:\n * this stream either is empty or has tolerated (\"gray-listed\") bytes only.\n */\n return Z_BINARY;\n}\n\n\nvar static_init_done = false;\n\n/* ===========================================================================\n * Initialize the tree data structures for a new zlib stream.\n */\nfunction _tr_init(s)\n{\n\n if (!static_init_done) {\n tr_static_init();\n static_init_done = true;\n }\n\n s.l_desc = new TreeDesc(s.dyn_ltree, static_l_desc);\n s.d_desc = new TreeDesc(s.dyn_dtree, static_d_desc);\n s.bl_desc = new TreeDesc(s.bl_tree, static_bl_desc);\n\n s.bi_buf = 0;\n s.bi_valid = 0;\n\n /* Initialize the first block of the first file: */\n init_block(s);\n}\n\n\n/* ===========================================================================\n * Send a stored block\n */\nfunction _tr_stored_block(s, buf, stored_len, last)\n//DeflateState *s;\n//charf *buf; /* input block */\n//ulg stored_len; /* length of input block */\n//int last; /* one if this is the last block for a file */\n{\n send_bits(s, (STORED_BLOCK << 1) + (last ? 1 : 0), 3); /* send block type */\n copy_block(s, buf, stored_len, true); /* with header */\n}\n\n\n/* ===========================================================================\n * Send one empty static block to give enough lookahead for inflate.\n * This takes 10 bits, of which 7 may remain in the bit buffer.\n */\nfunction _tr_align(s) {\n send_bits(s, STATIC_TREES << 1, 3);\n send_code(s, END_BLOCK, static_ltree);\n bi_flush(s);\n}\n\n\n/* ===========================================================================\n * Determine the best encoding for the current block: dynamic trees, static\n * trees or store, and output the encoded block to the zip file.\n */\nfunction _tr_flush_block(s, buf, stored_len, last)\n//DeflateState *s;\n//charf *buf; /* input block, or NULL if too old */\n//ulg stored_len; /* length of input block */\n//int last; /* one if this is the last block for a file */\n{\n var opt_lenb, static_lenb; /* opt_len and static_len in bytes */\n var max_blindex = 0; /* index of last bit length code of non zero freq */\n\n /* Build the Huffman trees unless a stored block is forced */\n if (s.level > 0) {\n\n /* Check if the file is binary or text */\n if (s.strm.data_type === Z_UNKNOWN) {\n s.strm.data_type = detect_data_type(s);\n }\n\n /* Construct the literal and distance trees */\n build_tree(s, s.l_desc);\n // Tracev((stderr, \"\\nlit data: dyn %ld, stat %ld\", s->opt_len,\n // s->static_len));\n\n build_tree(s, s.d_desc);\n // Tracev((stderr, \"\\ndist data: dyn %ld, stat %ld\", s->opt_len,\n // s->static_len));\n /* At this point, opt_len and static_len are the total bit lengths of\n * the compressed block data, excluding the tree representations.\n */\n\n /* Build the bit length tree for the above two trees, and get the index\n * in bl_order of the last bit length code to send.\n */\n max_blindex = build_bl_tree(s);\n\n /* Determine the best encoding. Compute the block lengths in bytes. */\n opt_lenb = (s.opt_len + 3 + 7) >>> 3;\n static_lenb = (s.static_len + 3 + 7) >>> 3;\n\n // Tracev((stderr, \"\\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u \",\n // opt_lenb, s->opt_len, static_lenb, s->static_len, stored_len,\n // s->last_lit));\n\n if (static_lenb <= opt_lenb) { opt_lenb = static_lenb; }\n\n } else {\n // Assert(buf != (char*)0, \"lost buf\");\n opt_lenb = static_lenb = stored_len + 5; /* force a stored block */\n }\n\n if ((stored_len + 4 <= opt_lenb) && (buf !== -1)) {\n /* 4: two words for the lengths */\n\n /* The test buf != NULL is only necessary if LIT_BUFSIZE > WSIZE.\n * Otherwise we can't have processed more than WSIZE input bytes since\n * the last block flush, because compression would have been\n * successful. If LIT_BUFSIZE <= WSIZE, it is never too late to\n * transform a block into a stored block.\n */\n _tr_stored_block(s, buf, stored_len, last);\n\n } else if (s.strategy === Z_FIXED || static_lenb === opt_lenb) {\n\n send_bits(s, (STATIC_TREES << 1) + (last ? 1 : 0), 3);\n compress_block(s, static_ltree, static_dtree);\n\n } else {\n send_bits(s, (DYN_TREES << 1) + (last ? 1 : 0), 3);\n send_all_trees(s, s.l_desc.max_code + 1, s.d_desc.max_code + 1, max_blindex + 1);\n compress_block(s, s.dyn_ltree, s.dyn_dtree);\n }\n // Assert (s->compressed_len == s->bits_sent, \"bad compressed size\");\n /* The above check is made mod 2^32, for files larger than 512 MB\n * and uLong implemented on 32 bits.\n */\n init_block(s);\n\n if (last) {\n bi_windup(s);\n }\n // Tracev((stderr,\"\\ncomprlen %lu(%lu) \", s->compressed_len>>3,\n // s->compressed_len-7*last));\n}\n\n/* ===========================================================================\n * Save the match info and tally the frequency counts. Return true if\n * the current block must be flushed.\n */\nfunction _tr_tally(s, dist, lc)\n// deflate_state *s;\n// unsigned dist; /* distance of matched string */\n// unsigned lc; /* match length-MIN_MATCH or unmatched char (if dist==0) */\n{\n //var out_length, in_length, dcode;\n\n s.pending_buf[s.d_buf + s.last_lit * 2] = (dist >>> 8) & 0xff;\n s.pending_buf[s.d_buf + s.last_lit * 2 + 1] = dist & 0xff;\n\n s.pending_buf[s.l_buf + s.last_lit] = lc & 0xff;\n s.last_lit++;\n\n if (dist === 0) {\n /* lc is the unmatched char */\n s.dyn_ltree[lc * 2]/*.Freq*/++;\n } else {\n s.matches++;\n /* Here, lc is the match length - MIN_MATCH */\n dist--; /* dist = match distance - 1 */\n //Assert((ush)dist < (ush)MAX_DIST(s) &&\n // (ush)lc <= (ush)(MAX_MATCH-MIN_MATCH) &&\n // (ush)d_code(dist) < (ush)D_CODES, \"_tr_tally: bad match\");\n\n s.dyn_ltree[(_length_code[lc] + LITERALS + 1) * 2]/*.Freq*/++;\n s.dyn_dtree[d_code(dist) * 2]/*.Freq*/++;\n }\n\n// (!) This block is disabled in zlib defaults,\n// don't enable it for binary compatibility\n\n//#ifdef TRUNCATE_BLOCK\n// /* Try to guess if it is profitable to stop the current block here */\n// if ((s.last_lit & 0x1fff) === 0 && s.level > 2) {\n// /* Compute an upper bound for the compressed length */\n// out_length = s.last_lit*8;\n// in_length = s.strstart - s.block_start;\n//\n// for (dcode = 0; dcode < D_CODES; dcode++) {\n// out_length += s.dyn_dtree[dcode*2]/*.Freq*/ * (5 + extra_dbits[dcode]);\n// }\n// out_length >>>= 3;\n// //Tracev((stderr,\"\\nlast_lit %u, in %ld, out ~%ld(%ld%%) \",\n// // s->last_lit, in_length, out_length,\n// // 100L - out_length*100L/in_length));\n// if (s.matches < (s.last_lit>>1)/*int /2*/ && out_length < (in_length>>1)/*int /2*/) {\n// return true;\n// }\n// }\n//#endif\n\n return (s.last_lit === s.lit_bufsize - 1);\n /* We avoid equality with lit_bufsize because of wraparound at 64K\n * on 16 bit machines and because stored blocks are restricted to\n * 64K-1 bytes.\n */\n}\n\nexports._tr_init = _tr_init;\nexports._tr_stored_block = _tr_stored_block;\nexports._tr_flush_block = _tr_flush_block;\nexports._tr_tally = _tr_tally;\nexports._tr_align = _tr_align;\n","'use strict';\n\n\nvar zlib_inflate = require('./zlib/inflate');\nvar utils = require('./utils/common');\nvar strings = require('./utils/strings');\nvar c = require('./zlib/constants');\nvar msg = require('./zlib/messages');\nvar ZStream = require('./zlib/zstream');\nvar GZheader = require('./zlib/gzheader');\n\nvar toString = Object.prototype.toString;\n\n/**\n * class Inflate\n *\n * Generic JS-style wrapper for zlib calls. If you don't need\n * streaming behaviour - use more simple functions: [[inflate]]\n * and [[inflateRaw]].\n **/\n\n/* internal\n * inflate.chunks -> Array\n *\n * Chunks of output data, if [[Inflate#onData]] not overridden.\n **/\n\n/**\n * Inflate.result -> Uint8Array|Array|String\n *\n * Uncompressed result, generated by default [[Inflate#onData]]\n * and [[Inflate#onEnd]] handlers. Filled after you push last chunk\n * (call [[Inflate#push]] with `Z_FINISH` / `true` param) or if you\n * push a chunk with explicit flush (call [[Inflate#push]] with\n * `Z_SYNC_FLUSH` param).\n **/\n\n/**\n * Inflate.err -> Number\n *\n * Error code after inflate finished. 0 (Z_OK) on success.\n * Should be checked if broken data possible.\n **/\n\n/**\n * Inflate.msg -> String\n *\n * Error message, if [[Inflate.err]] != 0\n **/\n\n\n/**\n * new Inflate(options)\n * - options (Object): zlib inflate options.\n *\n * Creates new inflator instance with specified params. Throws exception\n * on bad params. Supported options:\n *\n * - `windowBits`\n * - `dictionary`\n *\n * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced)\n * for more information on these.\n *\n * Additional options, for internal needs:\n *\n * - `chunkSize` - size of generated data chunks (16K by default)\n * - `raw` (Boolean) - do raw inflate\n * - `to` (String) - if equal to 'string', then result will be converted\n * from utf8 to utf16 (javascript) string. When string output requested,\n * chunk length can differ from `chunkSize`, depending on content.\n *\n * By default, when no options set, autodetect deflate/gzip data format via\n * wrapper header.\n *\n * ##### Example:\n *\n * ```javascript\n * var pako = require('pako')\n * , chunk1 = Uint8Array([1,2,3,4,5,6,7,8,9])\n * , chunk2 = Uint8Array([10,11,12,13,14,15,16,17,18,19]);\n *\n * var inflate = new pako.Inflate({ level: 3});\n *\n * inflate.push(chunk1, false);\n * inflate.push(chunk2, true); // true -> last chunk\n *\n * if (inflate.err) { throw new Error(inflate.err); }\n *\n * console.log(inflate.result);\n * ```\n **/\nfunction Inflate(options) {\n if (!(this instanceof Inflate)) return new Inflate(options);\n\n this.options = utils.assign({\n chunkSize: 16384,\n windowBits: 0,\n to: ''\n }, options || {});\n\n var opt = this.options;\n\n // Force window size for `raw` data, if not set directly,\n // because we have no header for autodetect.\n if (opt.raw && (opt.windowBits >= 0) && (opt.windowBits < 16)) {\n opt.windowBits = -opt.windowBits;\n if (opt.windowBits === 0) { opt.windowBits = -15; }\n }\n\n // If `windowBits` not defined (and mode not raw) - set autodetect flag for gzip/deflate\n if ((opt.windowBits >= 0) && (opt.windowBits < 16) &&\n !(options && options.windowBits)) {\n opt.windowBits += 32;\n }\n\n // Gzip header has no info about windows size, we can do autodetect only\n // for deflate. So, if window size not set, force it to max when gzip possible\n if ((opt.windowBits > 15) && (opt.windowBits < 48)) {\n // bit 3 (16) -> gzipped data\n // bit 4 (32) -> autodetect gzip/deflate\n if ((opt.windowBits & 15) === 0) {\n opt.windowBits |= 15;\n }\n }\n\n this.err = 0; // error code, if happens (0 = Z_OK)\n this.msg = ''; // error message\n this.ended = false; // used to avoid multiple onEnd() calls\n this.chunks = []; // chunks of compressed data\n\n this.strm = new ZStream();\n this.strm.avail_out = 0;\n\n var status = zlib_inflate.inflateInit2(\n this.strm,\n opt.windowBits\n );\n\n if (status !== c.Z_OK) {\n throw new Error(msg[status]);\n }\n\n this.header = new GZheader();\n\n zlib_inflate.inflateGetHeader(this.strm, this.header);\n\n // Setup dictionary\n if (opt.dictionary) {\n // Convert data if needed\n if (typeof opt.dictionary === 'string') {\n opt.dictionary = strings.string2buf(opt.dictionary);\n } else if (toString.call(opt.dictionary) === '[object ArrayBuffer]') {\n opt.dictionary = new Uint8Array(opt.dictionary);\n }\n if (opt.raw) { //In raw mode we need to set the dictionary early\n status = zlib_inflate.inflateSetDictionary(this.strm, opt.dictionary);\n if (status !== c.Z_OK) {\n throw new Error(msg[status]);\n }\n }\n }\n}\n\n/**\n * Inflate#push(data[, mode]) -> Boolean\n * - data (Uint8Array|Array|ArrayBuffer|String): input data\n * - mode (Number|Boolean): 0..6 for corresponding Z_NO_FLUSH..Z_TREE modes.\n * See constants. Skipped or `false` means Z_NO_FLUSH, `true` means Z_FINISH.\n *\n * Sends input data to inflate pipe, generating [[Inflate#onData]] calls with\n * new output chunks. Returns `true` on success. The last data block must have\n * mode Z_FINISH (or `true`). That will flush internal pending buffers and call\n * [[Inflate#onEnd]]. For interim explicit flushes (without ending the stream) you\n * can use mode Z_SYNC_FLUSH, keeping the decompression context.\n *\n * On fail call [[Inflate#onEnd]] with error code and return false.\n *\n * We strongly recommend to use `Uint8Array` on input for best speed (output\n * format is detected automatically). Also, don't skip last param and always\n * use the same type in your code (boolean or number). That will improve JS speed.\n *\n * For regular `Array`-s make sure all elements are [0..255].\n *\n * ##### Example\n *\n * ```javascript\n * push(chunk, false); // push one of data chunks\n * ...\n * push(chunk, true); // push last chunk\n * ```\n **/\nInflate.prototype.push = function (data, mode) {\n var strm = this.strm;\n var chunkSize = this.options.chunkSize;\n var dictionary = this.options.dictionary;\n var status, _mode;\n var next_out_utf8, tail, utf8str;\n\n // Flag to properly process Z_BUF_ERROR on testing inflate call\n // when we check that all output data was flushed.\n var allowBufError = false;\n\n if (this.ended) { return false; }\n _mode = (mode === ~~mode) ? mode : ((mode === true) ? c.Z_FINISH : c.Z_NO_FLUSH);\n\n // Convert data if needed\n if (typeof data === 'string') {\n // Only binary strings can be decompressed on practice\n strm.input = strings.binstring2buf(data);\n } else if (toString.call(data) === '[object ArrayBuffer]') {\n strm.input = new Uint8Array(data);\n } else {\n strm.input = data;\n }\n\n strm.next_in = 0;\n strm.avail_in = strm.input.length;\n\n do {\n if (strm.avail_out === 0) {\n strm.output = new utils.Buf8(chunkSize);\n strm.next_out = 0;\n strm.avail_out = chunkSize;\n }\n\n status = zlib_inflate.inflate(strm, c.Z_NO_FLUSH); /* no bad return value */\n\n if (status === c.Z_NEED_DICT && dictionary) {\n status = zlib_inflate.inflateSetDictionary(this.strm, dictionary);\n }\n\n if (status === c.Z_BUF_ERROR && allowBufError === true) {\n status = c.Z_OK;\n allowBufError = false;\n }\n\n if (status !== c.Z_STREAM_END && status !== c.Z_OK) {\n this.onEnd(status);\n this.ended = true;\n return false;\n }\n\n if (strm.next_out) {\n if (strm.avail_out === 0 || status === c.Z_STREAM_END || (strm.avail_in === 0 && (_mode === c.Z_FINISH || _mode === c.Z_SYNC_FLUSH))) {\n\n if (this.options.to === 'string') {\n\n next_out_utf8 = strings.utf8border(strm.output, strm.next_out);\n\n tail = strm.next_out - next_out_utf8;\n utf8str = strings.buf2string(strm.output, next_out_utf8);\n\n // move tail\n strm.next_out = tail;\n strm.avail_out = chunkSize - tail;\n if (tail) { utils.arraySet(strm.output, strm.output, next_out_utf8, tail, 0); }\n\n this.onData(utf8str);\n\n } else {\n this.onData(utils.shrinkBuf(strm.output, strm.next_out));\n }\n }\n }\n\n // When no more input data, we should check that internal inflate buffers\n // are flushed. The only way to do it when avail_out = 0 - run one more\n // inflate pass. But if output data not exists, inflate return Z_BUF_ERROR.\n // Here we set flag to process this error properly.\n //\n // NOTE. Deflate does not return error in this case and does not needs such\n // logic.\n if (strm.avail_in === 0 && strm.avail_out === 0) {\n allowBufError = true;\n }\n\n } while ((strm.avail_in > 0 || strm.avail_out === 0) && status !== c.Z_STREAM_END);\n\n if (status === c.Z_STREAM_END) {\n _mode = c.Z_FINISH;\n }\n\n // Finalize on the last chunk.\n if (_mode === c.Z_FINISH) {\n status = zlib_inflate.inflateEnd(this.strm);\n this.onEnd(status);\n this.ended = true;\n return status === c.Z_OK;\n }\n\n // callback interim results if Z_SYNC_FLUSH.\n if (_mode === c.Z_SYNC_FLUSH) {\n this.onEnd(c.Z_OK);\n strm.avail_out = 0;\n return true;\n }\n\n return true;\n};\n\n\n/**\n * Inflate#onData(chunk) -> Void\n * - chunk (Uint8Array|Array|String): output data. Type of array depends\n * on js engine support. When string output requested, each chunk\n * will be string.\n *\n * By default, stores data blocks in `chunks[]` property and glue\n * those in `onEnd`. Override this handler, if you need another behaviour.\n **/\nInflate.prototype.onData = function (chunk) {\n this.chunks.push(chunk);\n};\n\n\n/**\n * Inflate#onEnd(status) -> Void\n * - status (Number): inflate status. 0 (Z_OK) on success,\n * other if not.\n *\n * Called either after you tell inflate that the input stream is\n * complete (Z_FINISH) or should be flushed (Z_SYNC_FLUSH)\n * or if an error happened. By default - join collected chunks,\n * free memory and fill `results` / `err` properties.\n **/\nInflate.prototype.onEnd = function (status) {\n // On success - join\n if (status === c.Z_OK) {\n if (this.options.to === 'string') {\n // Glue & convert here, until we teach pako to send\n // utf8 aligned strings to onData\n this.result = this.chunks.join('');\n } else {\n this.result = utils.flattenChunks(this.chunks);\n }\n }\n this.chunks = [];\n this.err = status;\n this.msg = this.strm.msg;\n};\n\n\n/**\n * inflate(data[, options]) -> Uint8Array|Array|String\n * - data (Uint8Array|Array|String): input data to decompress.\n * - options (Object): zlib inflate options.\n *\n * Decompress `data` with inflate/ungzip and `options`. Autodetect\n * format via wrapper header by default. That's why we don't provide\n * separate `ungzip` method.\n *\n * Supported options are:\n *\n * - windowBits\n *\n * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced)\n * for more information.\n *\n * Sugar (options):\n *\n * - `raw` (Boolean) - say that we work with raw stream, if you don't wish to specify\n * negative windowBits implicitly.\n * - `to` (String) - if equal to 'string', then result will be converted\n * from utf8 to utf16 (javascript) string. When string output requested,\n * chunk length can differ from `chunkSize`, depending on content.\n *\n *\n * ##### Example:\n *\n * ```javascript\n * var pako = require('pako')\n * , input = pako.deflate([1,2,3,4,5,6,7,8,9])\n * , output;\n *\n * try {\n * output = pako.inflate(input);\n * } catch (err)\n * console.log(err);\n * }\n * ```\n **/\nfunction inflate(input, options) {\n var inflator = new Inflate(options);\n\n inflator.push(input, true);\n\n // That will never happens, if you don't cheat with options :)\n if (inflator.err) { throw inflator.msg || msg[inflator.err]; }\n\n return inflator.result;\n}\n\n\n/**\n * inflateRaw(data[, options]) -> Uint8Array|Array|String\n * - data (Uint8Array|Array|String): input data to decompress.\n * - options (Object): zlib inflate options.\n *\n * The same as [[inflate]], but creates raw data, without wrapper\n * (header and adler32 crc).\n **/\nfunction inflateRaw(input, options) {\n options = options || {};\n options.raw = true;\n return inflate(input, options);\n}\n\n\n/**\n * ungzip(data[, options]) -> Uint8Array|Array|String\n * - data (Uint8Array|Array|String): input data to decompress.\n * - options (Object): zlib inflate options.\n *\n * Just shortcut to [[inflate]], because it autodetects format\n * by header.content. Done for convenience.\n **/\n\n\nexports.Inflate = Inflate;\nexports.inflate = inflate;\nexports.inflateRaw = inflateRaw;\nexports.ungzip = inflate;\n","'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nvar utils = require('../utils/common');\nvar adler32 = require('./adler32');\nvar crc32 = require('./crc32');\nvar inflate_fast = require('./inffast');\nvar inflate_table = require('./inftrees');\n\nvar CODES = 0;\nvar LENS = 1;\nvar DISTS = 2;\n\n/* Public constants ==========================================================*/\n/* ===========================================================================*/\n\n\n/* Allowed flush values; see deflate() and inflate() below for details */\n//var Z_NO_FLUSH = 0;\n//var Z_PARTIAL_FLUSH = 1;\n//var Z_SYNC_FLUSH = 2;\n//var Z_FULL_FLUSH = 3;\nvar Z_FINISH = 4;\nvar Z_BLOCK = 5;\nvar Z_TREES = 6;\n\n\n/* Return codes for the compression/decompression functions. Negative values\n * are errors, positive values are used for special but normal events.\n */\nvar Z_OK = 0;\nvar Z_STREAM_END = 1;\nvar Z_NEED_DICT = 2;\n//var Z_ERRNO = -1;\nvar Z_STREAM_ERROR = -2;\nvar Z_DATA_ERROR = -3;\nvar Z_MEM_ERROR = -4;\nvar Z_BUF_ERROR = -5;\n//var Z_VERSION_ERROR = -6;\n\n/* The deflate compression method */\nvar Z_DEFLATED = 8;\n\n\n/* STATES ====================================================================*/\n/* ===========================================================================*/\n\n\nvar HEAD = 1; /* i: waiting for magic header */\nvar FLAGS = 2; /* i: waiting for method and flags (gzip) */\nvar TIME = 3; /* i: waiting for modification time (gzip) */\nvar OS = 4; /* i: waiting for extra flags and operating system (gzip) */\nvar EXLEN = 5; /* i: waiting for extra length (gzip) */\nvar EXTRA = 6; /* i: waiting for extra bytes (gzip) */\nvar NAME = 7; /* i: waiting for end of file name (gzip) */\nvar COMMENT = 8; /* i: waiting for end of comment (gzip) */\nvar HCRC = 9; /* i: waiting for header crc (gzip) */\nvar DICTID = 10; /* i: waiting for dictionary check value */\nvar DICT = 11; /* waiting for inflateSetDictionary() call */\nvar TYPE = 12; /* i: waiting for type bits, including last-flag bit */\nvar TYPEDO = 13; /* i: same, but skip check to exit inflate on new block */\nvar STORED = 14; /* i: waiting for stored size (length and complement) */\nvar COPY_ = 15; /* i/o: same as COPY below, but only first time in */\nvar COPY = 16; /* i/o: waiting for input or output to copy stored block */\nvar TABLE = 17; /* i: waiting for dynamic block table lengths */\nvar LENLENS = 18; /* i: waiting for code length code lengths */\nvar CODELENS = 19; /* i: waiting for length/lit and distance code lengths */\nvar LEN_ = 20; /* i: same as LEN below, but only first time in */\nvar LEN = 21; /* i: waiting for length/lit/eob code */\nvar LENEXT = 22; /* i: waiting for length extra bits */\nvar DIST = 23; /* i: waiting for distance code */\nvar DISTEXT = 24; /* i: waiting for distance extra bits */\nvar MATCH = 25; /* o: waiting for output space to copy string */\nvar LIT = 26; /* o: waiting for output space to write literal */\nvar CHECK = 27; /* i: waiting for 32-bit check value */\nvar LENGTH = 28; /* i: waiting for 32-bit length (gzip) */\nvar DONE = 29; /* finished check, done -- remain here until reset */\nvar BAD = 30; /* got a data error -- remain here until reset */\nvar MEM = 31; /* got an inflate() memory error -- remain here until reset */\nvar SYNC = 32; /* looking for synchronization bytes to restart inflate() */\n\n/* ===========================================================================*/\n\n\n\nvar ENOUGH_LENS = 852;\nvar ENOUGH_DISTS = 592;\n//var ENOUGH = (ENOUGH_LENS+ENOUGH_DISTS);\n\nvar MAX_WBITS = 15;\n/* 32K LZ77 window */\nvar DEF_WBITS = MAX_WBITS;\n\n\nfunction zswap32(q) {\n return (((q >>> 24) & 0xff) +\n ((q >>> 8) & 0xff00) +\n ((q & 0xff00) << 8) +\n ((q & 0xff) << 24));\n}\n\n\nfunction InflateState() {\n this.mode = 0; /* current inflate mode */\n this.last = false; /* true if processing last block */\n this.wrap = 0; /* bit 0 true for zlib, bit 1 true for gzip */\n this.havedict = false; /* true if dictionary provided */\n this.flags = 0; /* gzip header method and flags (0 if zlib) */\n this.dmax = 0; /* zlib header max distance (INFLATE_STRICT) */\n this.check = 0; /* protected copy of check value */\n this.total = 0; /* protected copy of output count */\n // TODO: may be {}\n this.head = null; /* where to save gzip header information */\n\n /* sliding window */\n this.wbits = 0; /* log base 2 of requested window size */\n this.wsize = 0; /* window size or zero if not using window */\n this.whave = 0; /* valid bytes in the window */\n this.wnext = 0; /* window write index */\n this.window = null; /* allocated sliding window, if needed */\n\n /* bit accumulator */\n this.hold = 0; /* input bit accumulator */\n this.bits = 0; /* number of bits in \"in\" */\n\n /* for string and stored block copying */\n this.length = 0; /* literal or length of data to copy */\n this.offset = 0; /* distance back to copy string from */\n\n /* for table and code decoding */\n this.extra = 0; /* extra bits needed */\n\n /* fixed and dynamic code tables */\n this.lencode = null; /* starting table for length/literal codes */\n this.distcode = null; /* starting table for distance codes */\n this.lenbits = 0; /* index bits for lencode */\n this.distbits = 0; /* index bits for distcode */\n\n /* dynamic table building */\n this.ncode = 0; /* number of code length code lengths */\n this.nlen = 0; /* number of length code lengths */\n this.ndist = 0; /* number of distance code lengths */\n this.have = 0; /* number of code lengths in lens[] */\n this.next = null; /* next available space in codes[] */\n\n this.lens = new utils.Buf16(320); /* temporary storage for code lengths */\n this.work = new utils.Buf16(288); /* work area for code table building */\n\n /*\n because we don't have pointers in js, we use lencode and distcode directly\n as buffers so we don't need codes\n */\n //this.codes = new utils.Buf32(ENOUGH); /* space for code tables */\n this.lendyn = null; /* dynamic table for length/literal codes (JS specific) */\n this.distdyn = null; /* dynamic table for distance codes (JS specific) */\n this.sane = 0; /* if false, allow invalid distance too far */\n this.back = 0; /* bits back of last unprocessed length/lit */\n this.was = 0; /* initial length of match */\n}\n\nfunction inflateResetKeep(strm) {\n var state;\n\n if (!strm || !strm.state) { return Z_STREAM_ERROR; }\n state = strm.state;\n strm.total_in = strm.total_out = state.total = 0;\n strm.msg = ''; /*Z_NULL*/\n if (state.wrap) { /* to support ill-conceived Java test suite */\n strm.adler = state.wrap & 1;\n }\n state.mode = HEAD;\n state.last = 0;\n state.havedict = 0;\n state.dmax = 32768;\n state.head = null/*Z_NULL*/;\n state.hold = 0;\n state.bits = 0;\n //state.lencode = state.distcode = state.next = state.codes;\n state.lencode = state.lendyn = new utils.Buf32(ENOUGH_LENS);\n state.distcode = state.distdyn = new utils.Buf32(ENOUGH_DISTS);\n\n state.sane = 1;\n state.back = -1;\n //Tracev((stderr, \"inflate: reset\\n\"));\n return Z_OK;\n}\n\nfunction inflateReset(strm) {\n var state;\n\n if (!strm || !strm.state) { return Z_STREAM_ERROR; }\n state = strm.state;\n state.wsize = 0;\n state.whave = 0;\n state.wnext = 0;\n return inflateResetKeep(strm);\n\n}\n\nfunction inflateReset2(strm, windowBits) {\n var wrap;\n var state;\n\n /* get the state */\n if (!strm || !strm.state) { return Z_STREAM_ERROR; }\n state = strm.state;\n\n /* extract wrap request from windowBits parameter */\n if (windowBits < 0) {\n wrap = 0;\n windowBits = -windowBits;\n }\n else {\n wrap = (windowBits >> 4) + 1;\n if (windowBits < 48) {\n windowBits &= 15;\n }\n }\n\n /* set number of window bits, free window if different */\n if (windowBits && (windowBits < 8 || windowBits > 15)) {\n return Z_STREAM_ERROR;\n }\n if (state.window !== null && state.wbits !== windowBits) {\n state.window = null;\n }\n\n /* update state and reset the rest of it */\n state.wrap = wrap;\n state.wbits = windowBits;\n return inflateReset(strm);\n}\n\nfunction inflateInit2(strm, windowBits) {\n var ret;\n var state;\n\n if (!strm) { return Z_STREAM_ERROR; }\n //strm.msg = Z_NULL; /* in case we return an error */\n\n state = new InflateState();\n\n //if (state === Z_NULL) return Z_MEM_ERROR;\n //Tracev((stderr, \"inflate: allocated\\n\"));\n strm.state = state;\n state.window = null/*Z_NULL*/;\n ret = inflateReset2(strm, windowBits);\n if (ret !== Z_OK) {\n strm.state = null/*Z_NULL*/;\n }\n return ret;\n}\n\nfunction inflateInit(strm) {\n return inflateInit2(strm, DEF_WBITS);\n}\n\n\n/*\n Return state with length and distance decoding tables and index sizes set to\n fixed code decoding. Normally this returns fixed tables from inffixed.h.\n If BUILDFIXED is defined, then instead this routine builds the tables the\n first time it's called, and returns those tables the first time and\n thereafter. This reduces the size of the code by about 2K bytes, in\n exchange for a little execution time. However, BUILDFIXED should not be\n used for threaded applications, since the rewriting of the tables and virgin\n may not be thread-safe.\n */\nvar virgin = true;\n\nvar lenfix, distfix; // We have no pointers in JS, so keep tables separate\n\nfunction fixedtables(state) {\n /* build fixed huffman tables if first call (may not be thread safe) */\n if (virgin) {\n var sym;\n\n lenfix = new utils.Buf32(512);\n distfix = new utils.Buf32(32);\n\n /* literal/length table */\n sym = 0;\n while (sym < 144) { state.lens[sym++] = 8; }\n while (sym < 256) { state.lens[sym++] = 9; }\n while (sym < 280) { state.lens[sym++] = 7; }\n while (sym < 288) { state.lens[sym++] = 8; }\n\n inflate_table(LENS, state.lens, 0, 288, lenfix, 0, state.work, { bits: 9 });\n\n /* distance table */\n sym = 0;\n while (sym < 32) { state.lens[sym++] = 5; }\n\n inflate_table(DISTS, state.lens, 0, 32, distfix, 0, state.work, { bits: 5 });\n\n /* do this just once */\n virgin = false;\n }\n\n state.lencode = lenfix;\n state.lenbits = 9;\n state.distcode = distfix;\n state.distbits = 5;\n}\n\n\n/*\n Update the window with the last wsize (normally 32K) bytes written before\n returning. If window does not exist yet, create it. This is only called\n when a window is already in use, or when output has been written during this\n inflate call, but the end of the deflate stream has not been reached yet.\n It is also called to create a window for dictionary data when a dictionary\n is loaded.\n\n Providing output buffers larger than 32K to inflate() should provide a speed\n advantage, since only the last 32K of output is copied to the sliding window\n upon return from inflate(), and since all distances after the first 32K of\n output will fall in the output data, making match copies simpler and faster.\n The advantage may be dependent on the size of the processor's data caches.\n */\nfunction updatewindow(strm, src, end, copy) {\n var dist;\n var state = strm.state;\n\n /* if it hasn't been done already, allocate space for the window */\n if (state.window === null) {\n state.wsize = 1 << state.wbits;\n state.wnext = 0;\n state.whave = 0;\n\n state.window = new utils.Buf8(state.wsize);\n }\n\n /* copy state->wsize or less output bytes into the circular window */\n if (copy >= state.wsize) {\n utils.arraySet(state.window, src, end - state.wsize, state.wsize, 0);\n state.wnext = 0;\n state.whave = state.wsize;\n }\n else {\n dist = state.wsize - state.wnext;\n if (dist > copy) {\n dist = copy;\n }\n //zmemcpy(state->window + state->wnext, end - copy, dist);\n utils.arraySet(state.window, src, end - copy, dist, state.wnext);\n copy -= dist;\n if (copy) {\n //zmemcpy(state->window, end - copy, copy);\n utils.arraySet(state.window, src, end - copy, copy, 0);\n state.wnext = copy;\n state.whave = state.wsize;\n }\n else {\n state.wnext += dist;\n if (state.wnext === state.wsize) { state.wnext = 0; }\n if (state.whave < state.wsize) { state.whave += dist; }\n }\n }\n return 0;\n}\n\nfunction inflate(strm, flush) {\n var state;\n var input, output; // input/output buffers\n var next; /* next input INDEX */\n var put; /* next output INDEX */\n var have, left; /* available input and output */\n var hold; /* bit buffer */\n var bits; /* bits in bit buffer */\n var _in, _out; /* save starting available input and output */\n var copy; /* number of stored or match bytes to copy */\n var from; /* where to copy match bytes from */\n var from_source;\n var here = 0; /* current decoding table entry */\n var here_bits, here_op, here_val; // paked \"here\" denormalized (JS specific)\n //var last; /* parent table entry */\n var last_bits, last_op, last_val; // paked \"last\" denormalized (JS specific)\n var len; /* length to copy for repeats, bits to drop */\n var ret; /* return code */\n var hbuf = new utils.Buf8(4); /* buffer for gzip header crc calculation */\n var opts;\n\n var n; // temporary var for NEED_BITS\n\n var order = /* permutation of code lengths */\n [ 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15 ];\n\n\n if (!strm || !strm.state || !strm.output ||\n (!strm.input && strm.avail_in !== 0)) {\n return Z_STREAM_ERROR;\n }\n\n state = strm.state;\n if (state.mode === TYPE) { state.mode = TYPEDO; } /* skip check */\n\n\n //--- LOAD() ---\n put = strm.next_out;\n output = strm.output;\n left = strm.avail_out;\n next = strm.next_in;\n input = strm.input;\n have = strm.avail_in;\n hold = state.hold;\n bits = state.bits;\n //---\n\n _in = have;\n _out = left;\n ret = Z_OK;\n\n inf_leave: // goto emulation\n for (;;) {\n switch (state.mode) {\n case HEAD:\n if (state.wrap === 0) {\n state.mode = TYPEDO;\n break;\n }\n //=== NEEDBITS(16);\n while (bits < 16) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if ((state.wrap & 2) && hold === 0x8b1f) { /* gzip header */\n state.check = 0/*crc32(0L, Z_NULL, 0)*/;\n //=== CRC2(state.check, hold);\n hbuf[0] = hold & 0xff;\n hbuf[1] = (hold >>> 8) & 0xff;\n state.check = crc32(state.check, hbuf, 2, 0);\n //===//\n\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = FLAGS;\n break;\n }\n state.flags = 0; /* expect zlib header */\n if (state.head) {\n state.head.done = false;\n }\n if (!(state.wrap & 1) || /* check if zlib header allowed */\n (((hold & 0xff)/*BITS(8)*/ << 8) + (hold >> 8)) % 31) {\n strm.msg = 'incorrect header check';\n state.mode = BAD;\n break;\n }\n if ((hold & 0x0f)/*BITS(4)*/ !== Z_DEFLATED) {\n strm.msg = 'unknown compression method';\n state.mode = BAD;\n break;\n }\n //--- DROPBITS(4) ---//\n hold >>>= 4;\n bits -= 4;\n //---//\n len = (hold & 0x0f)/*BITS(4)*/ + 8;\n if (state.wbits === 0) {\n state.wbits = len;\n }\n else if (len > state.wbits) {\n strm.msg = 'invalid window size';\n state.mode = BAD;\n break;\n }\n state.dmax = 1 << len;\n //Tracev((stderr, \"inflate: zlib header ok\\n\"));\n strm.adler = state.check = 1/*adler32(0L, Z_NULL, 0)*/;\n state.mode = hold & 0x200 ? DICTID : TYPE;\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n break;\n case FLAGS:\n //=== NEEDBITS(16); */\n while (bits < 16) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.flags = hold;\n if ((state.flags & 0xff) !== Z_DEFLATED) {\n strm.msg = 'unknown compression method';\n state.mode = BAD;\n break;\n }\n if (state.flags & 0xe000) {\n strm.msg = 'unknown header flags set';\n state.mode = BAD;\n break;\n }\n if (state.head) {\n state.head.text = ((hold >> 8) & 1);\n }\n if (state.flags & 0x0200) {\n //=== CRC2(state.check, hold);\n hbuf[0] = hold & 0xff;\n hbuf[1] = (hold >>> 8) & 0xff;\n state.check = crc32(state.check, hbuf, 2, 0);\n //===//\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = TIME;\n /* falls through */\n case TIME:\n //=== NEEDBITS(32); */\n while (bits < 32) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if (state.head) {\n state.head.time = hold;\n }\n if (state.flags & 0x0200) {\n //=== CRC4(state.check, hold)\n hbuf[0] = hold & 0xff;\n hbuf[1] = (hold >>> 8) & 0xff;\n hbuf[2] = (hold >>> 16) & 0xff;\n hbuf[3] = (hold >>> 24) & 0xff;\n state.check = crc32(state.check, hbuf, 4, 0);\n //===\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = OS;\n /* falls through */\n case OS:\n //=== NEEDBITS(16); */\n while (bits < 16) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if (state.head) {\n state.head.xflags = (hold & 0xff);\n state.head.os = (hold >> 8);\n }\n if (state.flags & 0x0200) {\n //=== CRC2(state.check, hold);\n hbuf[0] = hold & 0xff;\n hbuf[1] = (hold >>> 8) & 0xff;\n state.check = crc32(state.check, hbuf, 2, 0);\n //===//\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = EXLEN;\n /* falls through */\n case EXLEN:\n if (state.flags & 0x0400) {\n //=== NEEDBITS(16); */\n while (bits < 16) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.length = hold;\n if (state.head) {\n state.head.extra_len = hold;\n }\n if (state.flags & 0x0200) {\n //=== CRC2(state.check, hold);\n hbuf[0] = hold & 0xff;\n hbuf[1] = (hold >>> 8) & 0xff;\n state.check = crc32(state.check, hbuf, 2, 0);\n //===//\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n }\n else if (state.head) {\n state.head.extra = null/*Z_NULL*/;\n }\n state.mode = EXTRA;\n /* falls through */\n case EXTRA:\n if (state.flags & 0x0400) {\n copy = state.length;\n if (copy > have) { copy = have; }\n if (copy) {\n if (state.head) {\n len = state.head.extra_len - state.length;\n if (!state.head.extra) {\n // Use untyped array for more convenient processing later\n state.head.extra = new Array(state.head.extra_len);\n }\n utils.arraySet(\n state.head.extra,\n input,\n next,\n // extra field is limited to 65536 bytes\n // - no need for additional size check\n copy,\n /*len + copy > state.head.extra_max - len ? state.head.extra_max : copy,*/\n len\n );\n //zmemcpy(state.head.extra + len, next,\n // len + copy > state.head.extra_max ?\n // state.head.extra_max - len : copy);\n }\n if (state.flags & 0x0200) {\n state.check = crc32(state.check, input, copy, next);\n }\n have -= copy;\n next += copy;\n state.length -= copy;\n }\n if (state.length) { break inf_leave; }\n }\n state.length = 0;\n state.mode = NAME;\n /* falls through */\n case NAME:\n if (state.flags & 0x0800) {\n if (have === 0) { break inf_leave; }\n copy = 0;\n do {\n // TODO: 2 or 1 bytes?\n len = input[next + copy++];\n /* use constant limit because in js we should not preallocate memory */\n if (state.head && len &&\n (state.length < 65536 /*state.head.name_max*/)) {\n state.head.name += String.fromCharCode(len);\n }\n } while (len && copy < have);\n\n if (state.flags & 0x0200) {\n state.check = crc32(state.check, input, copy, next);\n }\n have -= copy;\n next += copy;\n if (len) { break inf_leave; }\n }\n else if (state.head) {\n state.head.name = null;\n }\n state.length = 0;\n state.mode = COMMENT;\n /* falls through */\n case COMMENT:\n if (state.flags & 0x1000) {\n if (have === 0) { break inf_leave; }\n copy = 0;\n do {\n len = input[next + copy++];\n /* use constant limit because in js we should not preallocate memory */\n if (state.head && len &&\n (state.length < 65536 /*state.head.comm_max*/)) {\n state.head.comment += String.fromCharCode(len);\n }\n } while (len && copy < have);\n if (state.flags & 0x0200) {\n state.check = crc32(state.check, input, copy, next);\n }\n have -= copy;\n next += copy;\n if (len) { break inf_leave; }\n }\n else if (state.head) {\n state.head.comment = null;\n }\n state.mode = HCRC;\n /* falls through */\n case HCRC:\n if (state.flags & 0x0200) {\n //=== NEEDBITS(16); */\n while (bits < 16) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if (hold !== (state.check & 0xffff)) {\n strm.msg = 'header crc mismatch';\n state.mode = BAD;\n break;\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n }\n if (state.head) {\n state.head.hcrc = ((state.flags >> 9) & 1);\n state.head.done = true;\n }\n strm.adler = state.check = 0;\n state.mode = TYPE;\n break;\n case DICTID:\n //=== NEEDBITS(32); */\n while (bits < 32) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n strm.adler = state.check = zswap32(hold);\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = DICT;\n /* falls through */\n case DICT:\n if (state.havedict === 0) {\n //--- RESTORE() ---\n strm.next_out = put;\n strm.avail_out = left;\n strm.next_in = next;\n strm.avail_in = have;\n state.hold = hold;\n state.bits = bits;\n //---\n return Z_NEED_DICT;\n }\n strm.adler = state.check = 1/*adler32(0L, Z_NULL, 0)*/;\n state.mode = TYPE;\n /* falls through */\n case TYPE:\n if (flush === Z_BLOCK || flush === Z_TREES) { break inf_leave; }\n /* falls through */\n case TYPEDO:\n if (state.last) {\n //--- BYTEBITS() ---//\n hold >>>= bits & 7;\n bits -= bits & 7;\n //---//\n state.mode = CHECK;\n break;\n }\n //=== NEEDBITS(3); */\n while (bits < 3) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.last = (hold & 0x01)/*BITS(1)*/;\n //--- DROPBITS(1) ---//\n hold >>>= 1;\n bits -= 1;\n //---//\n\n switch ((hold & 0x03)/*BITS(2)*/) {\n case 0: /* stored block */\n //Tracev((stderr, \"inflate: stored block%s\\n\",\n // state.last ? \" (last)\" : \"\"));\n state.mode = STORED;\n break;\n case 1: /* fixed block */\n fixedtables(state);\n //Tracev((stderr, \"inflate: fixed codes block%s\\n\",\n // state.last ? \" (last)\" : \"\"));\n state.mode = LEN_; /* decode codes */\n if (flush === Z_TREES) {\n //--- DROPBITS(2) ---//\n hold >>>= 2;\n bits -= 2;\n //---//\n break inf_leave;\n }\n break;\n case 2: /* dynamic block */\n //Tracev((stderr, \"inflate: dynamic codes block%s\\n\",\n // state.last ? \" (last)\" : \"\"));\n state.mode = TABLE;\n break;\n case 3:\n strm.msg = 'invalid block type';\n state.mode = BAD;\n }\n //--- DROPBITS(2) ---//\n hold >>>= 2;\n bits -= 2;\n //---//\n break;\n case STORED:\n //--- BYTEBITS() ---// /* go to byte boundary */\n hold >>>= bits & 7;\n bits -= bits & 7;\n //---//\n //=== NEEDBITS(32); */\n while (bits < 32) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if ((hold & 0xffff) !== ((hold >>> 16) ^ 0xffff)) {\n strm.msg = 'invalid stored block lengths';\n state.mode = BAD;\n break;\n }\n state.length = hold & 0xffff;\n //Tracev((stderr, \"inflate: stored length %u\\n\",\n // state.length));\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = COPY_;\n if (flush === Z_TREES) { break inf_leave; }\n /* falls through */\n case COPY_:\n state.mode = COPY;\n /* falls through */\n case COPY:\n copy = state.length;\n if (copy) {\n if (copy > have) { copy = have; }\n if (copy > left) { copy = left; }\n if (copy === 0) { break inf_leave; }\n //--- zmemcpy(put, next, copy); ---\n utils.arraySet(output, input, next, copy, put);\n //---//\n have -= copy;\n next += copy;\n left -= copy;\n put += copy;\n state.length -= copy;\n break;\n }\n //Tracev((stderr, \"inflate: stored end\\n\"));\n state.mode = TYPE;\n break;\n case TABLE:\n //=== NEEDBITS(14); */\n while (bits < 14) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.nlen = (hold & 0x1f)/*BITS(5)*/ + 257;\n //--- DROPBITS(5) ---//\n hold >>>= 5;\n bits -= 5;\n //---//\n state.ndist = (hold & 0x1f)/*BITS(5)*/ + 1;\n //--- DROPBITS(5) ---//\n hold >>>= 5;\n bits -= 5;\n //---//\n state.ncode = (hold & 0x0f)/*BITS(4)*/ + 4;\n //--- DROPBITS(4) ---//\n hold >>>= 4;\n bits -= 4;\n //---//\n//#ifndef PKZIP_BUG_WORKAROUND\n if (state.nlen > 286 || state.ndist > 30) {\n strm.msg = 'too many length or distance symbols';\n state.mode = BAD;\n break;\n }\n//#endif\n //Tracev((stderr, \"inflate: table sizes ok\\n\"));\n state.have = 0;\n state.mode = LENLENS;\n /* falls through */\n case LENLENS:\n while (state.have < state.ncode) {\n //=== NEEDBITS(3);\n while (bits < 3) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.lens[order[state.have++]] = (hold & 0x07);//BITS(3);\n //--- DROPBITS(3) ---//\n hold >>>= 3;\n bits -= 3;\n //---//\n }\n while (state.have < 19) {\n state.lens[order[state.have++]] = 0;\n }\n // We have separate tables & no pointers. 2 commented lines below not needed.\n //state.next = state.codes;\n //state.lencode = state.next;\n // Switch to use dynamic table\n state.lencode = state.lendyn;\n state.lenbits = 7;\n\n opts = { bits: state.lenbits };\n ret = inflate_table(CODES, state.lens, 0, 19, state.lencode, 0, state.work, opts);\n state.lenbits = opts.bits;\n\n if (ret) {\n strm.msg = 'invalid code lengths set';\n state.mode = BAD;\n break;\n }\n //Tracev((stderr, \"inflate: code lengths ok\\n\"));\n state.have = 0;\n state.mode = CODELENS;\n /* falls through */\n case CODELENS:\n while (state.have < state.nlen + state.ndist) {\n for (;;) {\n here = state.lencode[hold & ((1 << state.lenbits) - 1)];/*BITS(state.lenbits)*/\n here_bits = here >>> 24;\n here_op = (here >>> 16) & 0xff;\n here_val = here & 0xffff;\n\n if ((here_bits) <= bits) { break; }\n //--- PULLBYTE() ---//\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n //---//\n }\n if (here_val < 16) {\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n state.lens[state.have++] = here_val;\n }\n else {\n if (here_val === 16) {\n //=== NEEDBITS(here.bits + 2);\n n = here_bits + 2;\n while (bits < n) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n if (state.have === 0) {\n strm.msg = 'invalid bit length repeat';\n state.mode = BAD;\n break;\n }\n len = state.lens[state.have - 1];\n copy = 3 + (hold & 0x03);//BITS(2);\n //--- DROPBITS(2) ---//\n hold >>>= 2;\n bits -= 2;\n //---//\n }\n else if (here_val === 17) {\n //=== NEEDBITS(here.bits + 3);\n n = here_bits + 3;\n while (bits < n) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n len = 0;\n copy = 3 + (hold & 0x07);//BITS(3);\n //--- DROPBITS(3) ---//\n hold >>>= 3;\n bits -= 3;\n //---//\n }\n else {\n //=== NEEDBITS(here.bits + 7);\n n = here_bits + 7;\n while (bits < n) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n len = 0;\n copy = 11 + (hold & 0x7f);//BITS(7);\n //--- DROPBITS(7) ---//\n hold >>>= 7;\n bits -= 7;\n //---//\n }\n if (state.have + copy > state.nlen + state.ndist) {\n strm.msg = 'invalid bit length repeat';\n state.mode = BAD;\n break;\n }\n while (copy--) {\n state.lens[state.have++] = len;\n }\n }\n }\n\n /* handle error breaks in while */\n if (state.mode === BAD) { break; }\n\n /* check for end-of-block code (better have one) */\n if (state.lens[256] === 0) {\n strm.msg = 'invalid code -- missing end-of-block';\n state.mode = BAD;\n break;\n }\n\n /* build code tables -- note: do not change the lenbits or distbits\n values here (9 and 6) without reading the comments in inftrees.h\n concerning the ENOUGH constants, which depend on those values */\n state.lenbits = 9;\n\n opts = { bits: state.lenbits };\n ret = inflate_table(LENS, state.lens, 0, state.nlen, state.lencode, 0, state.work, opts);\n // We have separate tables & no pointers. 2 commented lines below not needed.\n // state.next_index = opts.table_index;\n state.lenbits = opts.bits;\n // state.lencode = state.next;\n\n if (ret) {\n strm.msg = 'invalid literal/lengths set';\n state.mode = BAD;\n break;\n }\n\n state.distbits = 6;\n //state.distcode.copy(state.codes);\n // Switch to use dynamic table\n state.distcode = state.distdyn;\n opts = { bits: state.distbits };\n ret = inflate_table(DISTS, state.lens, state.nlen, state.ndist, state.distcode, 0, state.work, opts);\n // We have separate tables & no pointers. 2 commented lines below not needed.\n // state.next_index = opts.table_index;\n state.distbits = opts.bits;\n // state.distcode = state.next;\n\n if (ret) {\n strm.msg = 'invalid distances set';\n state.mode = BAD;\n break;\n }\n //Tracev((stderr, 'inflate: codes ok\\n'));\n state.mode = LEN_;\n if (flush === Z_TREES) { break inf_leave; }\n /* falls through */\n case LEN_:\n state.mode = LEN;\n /* falls through */\n case LEN:\n if (have >= 6 && left >= 258) {\n //--- RESTORE() ---\n strm.next_out = put;\n strm.avail_out = left;\n strm.next_in = next;\n strm.avail_in = have;\n state.hold = hold;\n state.bits = bits;\n //---\n inflate_fast(strm, _out);\n //--- LOAD() ---\n put = strm.next_out;\n output = strm.output;\n left = strm.avail_out;\n next = strm.next_in;\n input = strm.input;\n have = strm.avail_in;\n hold = state.hold;\n bits = state.bits;\n //---\n\n if (state.mode === TYPE) {\n state.back = -1;\n }\n break;\n }\n state.back = 0;\n for (;;) {\n here = state.lencode[hold & ((1 << state.lenbits) - 1)]; /*BITS(state.lenbits)*/\n here_bits = here >>> 24;\n here_op = (here >>> 16) & 0xff;\n here_val = here & 0xffff;\n\n if (here_bits <= bits) { break; }\n //--- PULLBYTE() ---//\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n //---//\n }\n if (here_op && (here_op & 0xf0) === 0) {\n last_bits = here_bits;\n last_op = here_op;\n last_val = here_val;\n for (;;) {\n here = state.lencode[last_val +\n ((hold & ((1 << (last_bits + last_op)) - 1))/*BITS(last.bits + last.op)*/ >> last_bits)];\n here_bits = here >>> 24;\n here_op = (here >>> 16) & 0xff;\n here_val = here & 0xffff;\n\n if ((last_bits + here_bits) <= bits) { break; }\n //--- PULLBYTE() ---//\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n //---//\n }\n //--- DROPBITS(last.bits) ---//\n hold >>>= last_bits;\n bits -= last_bits;\n //---//\n state.back += last_bits;\n }\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n state.back += here_bits;\n state.length = here_val;\n if (here_op === 0) {\n //Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?\n // \"inflate: literal '%c'\\n\" :\n // \"inflate: literal 0x%02x\\n\", here.val));\n state.mode = LIT;\n break;\n }\n if (here_op & 32) {\n //Tracevv((stderr, \"inflate: end of block\\n\"));\n state.back = -1;\n state.mode = TYPE;\n break;\n }\n if (here_op & 64) {\n strm.msg = 'invalid literal/length code';\n state.mode = BAD;\n break;\n }\n state.extra = here_op & 15;\n state.mode = LENEXT;\n /* falls through */\n case LENEXT:\n if (state.extra) {\n //=== NEEDBITS(state.extra);\n n = state.extra;\n while (bits < n) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.length += hold & ((1 << state.extra) - 1)/*BITS(state.extra)*/;\n //--- DROPBITS(state.extra) ---//\n hold >>>= state.extra;\n bits -= state.extra;\n //---//\n state.back += state.extra;\n }\n //Tracevv((stderr, \"inflate: length %u\\n\", state.length));\n state.was = state.length;\n state.mode = DIST;\n /* falls through */\n case DIST:\n for (;;) {\n here = state.distcode[hold & ((1 << state.distbits) - 1)];/*BITS(state.distbits)*/\n here_bits = here >>> 24;\n here_op = (here >>> 16) & 0xff;\n here_val = here & 0xffff;\n\n if ((here_bits) <= bits) { break; }\n //--- PULLBYTE() ---//\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n //---//\n }\n if ((here_op & 0xf0) === 0) {\n last_bits = here_bits;\n last_op = here_op;\n last_val = here_val;\n for (;;) {\n here = state.distcode[last_val +\n ((hold & ((1 << (last_bits + last_op)) - 1))/*BITS(last.bits + last.op)*/ >> last_bits)];\n here_bits = here >>> 24;\n here_op = (here >>> 16) & 0xff;\n here_val = here & 0xffff;\n\n if ((last_bits + here_bits) <= bits) { break; }\n //--- PULLBYTE() ---//\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n //---//\n }\n //--- DROPBITS(last.bits) ---//\n hold >>>= last_bits;\n bits -= last_bits;\n //---//\n state.back += last_bits;\n }\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n state.back += here_bits;\n if (here_op & 64) {\n strm.msg = 'invalid distance code';\n state.mode = BAD;\n break;\n }\n state.offset = here_val;\n state.extra = (here_op) & 15;\n state.mode = DISTEXT;\n /* falls through */\n case DISTEXT:\n if (state.extra) {\n //=== NEEDBITS(state.extra);\n n = state.extra;\n while (bits < n) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.offset += hold & ((1 << state.extra) - 1)/*BITS(state.extra)*/;\n //--- DROPBITS(state.extra) ---//\n hold >>>= state.extra;\n bits -= state.extra;\n //---//\n state.back += state.extra;\n }\n//#ifdef INFLATE_STRICT\n if (state.offset > state.dmax) {\n strm.msg = 'invalid distance too far back';\n state.mode = BAD;\n break;\n }\n//#endif\n //Tracevv((stderr, \"inflate: distance %u\\n\", state.offset));\n state.mode = MATCH;\n /* falls through */\n case MATCH:\n if (left === 0) { break inf_leave; }\n copy = _out - left;\n if (state.offset > copy) { /* copy from window */\n copy = state.offset - copy;\n if (copy > state.whave) {\n if (state.sane) {\n strm.msg = 'invalid distance too far back';\n state.mode = BAD;\n break;\n }\n// (!) This block is disabled in zlib defaults,\n// don't enable it for binary compatibility\n//#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR\n// Trace((stderr, \"inflate.c too far\\n\"));\n// copy -= state.whave;\n// if (copy > state.length) { copy = state.length; }\n// if (copy > left) { copy = left; }\n// left -= copy;\n// state.length -= copy;\n// do {\n// output[put++] = 0;\n// } while (--copy);\n// if (state.length === 0) { state.mode = LEN; }\n// break;\n//#endif\n }\n if (copy > state.wnext) {\n copy -= state.wnext;\n from = state.wsize - copy;\n }\n else {\n from = state.wnext - copy;\n }\n if (copy > state.length) { copy = state.length; }\n from_source = state.window;\n }\n else { /* copy from output */\n from_source = output;\n from = put - state.offset;\n copy = state.length;\n }\n if (copy > left) { copy = left; }\n left -= copy;\n state.length -= copy;\n do {\n output[put++] = from_source[from++];\n } while (--copy);\n if (state.length === 0) { state.mode = LEN; }\n break;\n case LIT:\n if (left === 0) { break inf_leave; }\n output[put++] = state.length;\n left--;\n state.mode = LEN;\n break;\n case CHECK:\n if (state.wrap) {\n //=== NEEDBITS(32);\n while (bits < 32) {\n if (have === 0) { break inf_leave; }\n have--;\n // Use '|' instead of '+' to make sure that result is signed\n hold |= input[next++] << bits;\n bits += 8;\n }\n //===//\n _out -= left;\n strm.total_out += _out;\n state.total += _out;\n if (_out) {\n strm.adler = state.check =\n /*UPDATE(state.check, put - _out, _out);*/\n (state.flags ? crc32(state.check, output, _out, put - _out) : adler32(state.check, output, _out, put - _out));\n\n }\n _out = left;\n // NB: crc32 stored as signed 32-bit int, zswap32 returns signed too\n if ((state.flags ? hold : zswap32(hold)) !== state.check) {\n strm.msg = 'incorrect data check';\n state.mode = BAD;\n break;\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n //Tracev((stderr, \"inflate: check matches trailer\\n\"));\n }\n state.mode = LENGTH;\n /* falls through */\n case LENGTH:\n if (state.wrap && state.flags) {\n //=== NEEDBITS(32);\n while (bits < 32) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if (hold !== (state.total & 0xffffffff)) {\n strm.msg = 'incorrect length check';\n state.mode = BAD;\n break;\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n //Tracev((stderr, \"inflate: length matches trailer\\n\"));\n }\n state.mode = DONE;\n /* falls through */\n case DONE:\n ret = Z_STREAM_END;\n break inf_leave;\n case BAD:\n ret = Z_DATA_ERROR;\n break inf_leave;\n case MEM:\n return Z_MEM_ERROR;\n case SYNC:\n /* falls through */\n default:\n return Z_STREAM_ERROR;\n }\n }\n\n // inf_leave <- here is real place for \"goto inf_leave\", emulated via \"break inf_leave\"\n\n /*\n Return from inflate(), updating the total counts and the check value.\n If there was no progress during the inflate() call, return a buffer\n error. Call updatewindow() to create and/or update the window state.\n Note: a memory error from inflate() is non-recoverable.\n */\n\n //--- RESTORE() ---\n strm.next_out = put;\n strm.avail_out = left;\n strm.next_in = next;\n strm.avail_in = have;\n state.hold = hold;\n state.bits = bits;\n //---\n\n if (state.wsize || (_out !== strm.avail_out && state.mode < BAD &&\n (state.mode < CHECK || flush !== Z_FINISH))) {\n if (updatewindow(strm, strm.output, strm.next_out, _out - strm.avail_out)) {\n state.mode = MEM;\n return Z_MEM_ERROR;\n }\n }\n _in -= strm.avail_in;\n _out -= strm.avail_out;\n strm.total_in += _in;\n strm.total_out += _out;\n state.total += _out;\n if (state.wrap && _out) {\n strm.adler = state.check = /*UPDATE(state.check, strm.next_out - _out, _out);*/\n (state.flags ? crc32(state.check, output, _out, strm.next_out - _out) : adler32(state.check, output, _out, strm.next_out - _out));\n }\n strm.data_type = state.bits + (state.last ? 64 : 0) +\n (state.mode === TYPE ? 128 : 0) +\n (state.mode === LEN_ || state.mode === COPY_ ? 256 : 0);\n if (((_in === 0 && _out === 0) || flush === Z_FINISH) && ret === Z_OK) {\n ret = Z_BUF_ERROR;\n }\n return ret;\n}\n\nfunction inflateEnd(strm) {\n\n if (!strm || !strm.state /*|| strm->zfree == (free_func)0*/) {\n return Z_STREAM_ERROR;\n }\n\n var state = strm.state;\n if (state.window) {\n state.window = null;\n }\n strm.state = null;\n return Z_OK;\n}\n\nfunction inflateGetHeader(strm, head) {\n var state;\n\n /* check state */\n if (!strm || !strm.state) { return Z_STREAM_ERROR; }\n state = strm.state;\n if ((state.wrap & 2) === 0) { return Z_STREAM_ERROR; }\n\n /* save header structure */\n state.head = head;\n head.done = false;\n return Z_OK;\n}\n\nfunction inflateSetDictionary(strm, dictionary) {\n var dictLength = dictionary.length;\n\n var state;\n var dictid;\n var ret;\n\n /* check state */\n if (!strm /* == Z_NULL */ || !strm.state /* == Z_NULL */) { return Z_STREAM_ERROR; }\n state = strm.state;\n\n if (state.wrap !== 0 && state.mode !== DICT) {\n return Z_STREAM_ERROR;\n }\n\n /* check for correct dictionary identifier */\n if (state.mode === DICT) {\n dictid = 1; /* adler32(0, null, 0)*/\n /* dictid = adler32(dictid, dictionary, dictLength); */\n dictid = adler32(dictid, dictionary, dictLength, 0);\n if (dictid !== state.check) {\n return Z_DATA_ERROR;\n }\n }\n /* copy dictionary to window using updatewindow(), which will amend the\n existing dictionary if appropriate */\n ret = updatewindow(strm, dictionary, dictLength, dictLength);\n if (ret) {\n state.mode = MEM;\n return Z_MEM_ERROR;\n }\n state.havedict = 1;\n // Tracev((stderr, \"inflate: dictionary set\\n\"));\n return Z_OK;\n}\n\nexports.inflateReset = inflateReset;\nexports.inflateReset2 = inflateReset2;\nexports.inflateResetKeep = inflateResetKeep;\nexports.inflateInit = inflateInit;\nexports.inflateInit2 = inflateInit2;\nexports.inflate = inflate;\nexports.inflateEnd = inflateEnd;\nexports.inflateGetHeader = inflateGetHeader;\nexports.inflateSetDictionary = inflateSetDictionary;\nexports.inflateInfo = 'pako inflate (from Nodeca project)';\n\n/* Not implemented\nexports.inflateCopy = inflateCopy;\nexports.inflateGetDictionary = inflateGetDictionary;\nexports.inflateMark = inflateMark;\nexports.inflatePrime = inflatePrime;\nexports.inflateSync = inflateSync;\nexports.inflateSyncPoint = inflateSyncPoint;\nexports.inflateUndermine = inflateUndermine;\n*/\n","'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\n// See state defs from inflate.js\nvar BAD = 30; /* got a data error -- remain here until reset */\nvar TYPE = 12; /* i: waiting for type bits, including last-flag bit */\n\n/*\n Decode literal, length, and distance codes and write out the resulting\n literal and match bytes until either not enough input or output is\n available, an end-of-block is encountered, or a data error is encountered.\n When large enough input and output buffers are supplied to inflate(), for\n example, a 16K input buffer and a 64K output buffer, more than 95% of the\n inflate execution time is spent in this routine.\n\n Entry assumptions:\n\n state.mode === LEN\n strm.avail_in >= 6\n strm.avail_out >= 258\n start >= strm.avail_out\n state.bits < 8\n\n On return, state.mode is one of:\n\n LEN -- ran out of enough output space or enough available input\n TYPE -- reached end of block code, inflate() to interpret next block\n BAD -- error in block data\n\n Notes:\n\n - The maximum input bits used by a length/distance pair is 15 bits for the\n length code, 5 bits for the length extra, 15 bits for the distance code,\n and 13 bits for the distance extra. This totals 48 bits, or six bytes.\n Therefore if strm.avail_in >= 6, then there is enough input to avoid\n checking for available input while decoding.\n\n - The maximum bytes that a single length/distance pair can output is 258\n bytes, which is the maximum length that can be coded. inflate_fast()\n requires strm.avail_out >= 258 for each loop to avoid checking for\n output space.\n */\nmodule.exports = function inflate_fast(strm, start) {\n var state;\n var _in; /* local strm.input */\n var last; /* have enough input while in < last */\n var _out; /* local strm.output */\n var beg; /* inflate()'s initial strm.output */\n var end; /* while out < end, enough space available */\n//#ifdef INFLATE_STRICT\n var dmax; /* maximum distance from zlib header */\n//#endif\n var wsize; /* window size or zero if not using window */\n var whave; /* valid bytes in the window */\n var wnext; /* window write index */\n // Use `s_window` instead `window`, avoid conflict with instrumentation tools\n var s_window; /* allocated sliding window, if wsize != 0 */\n var hold; /* local strm.hold */\n var bits; /* local strm.bits */\n var lcode; /* local strm.lencode */\n var dcode; /* local strm.distcode */\n var lmask; /* mask for first level of length codes */\n var dmask; /* mask for first level of distance codes */\n var here; /* retrieved table entry */\n var op; /* code bits, operation, extra bits, or */\n /* window position, window bytes to copy */\n var len; /* match length, unused bytes */\n var dist; /* match distance */\n var from; /* where to copy match from */\n var from_source;\n\n\n var input, output; // JS specific, because we have no pointers\n\n /* copy state to local variables */\n state = strm.state;\n //here = state.here;\n _in = strm.next_in;\n input = strm.input;\n last = _in + (strm.avail_in - 5);\n _out = strm.next_out;\n output = strm.output;\n beg = _out - (start - strm.avail_out);\n end = _out + (strm.avail_out - 257);\n//#ifdef INFLATE_STRICT\n dmax = state.dmax;\n//#endif\n wsize = state.wsize;\n whave = state.whave;\n wnext = state.wnext;\n s_window = state.window;\n hold = state.hold;\n bits = state.bits;\n lcode = state.lencode;\n dcode = state.distcode;\n lmask = (1 << state.lenbits) - 1;\n dmask = (1 << state.distbits) - 1;\n\n\n /* decode literals and length/distances until end-of-block or not enough\n input data or output space */\n\n top:\n do {\n if (bits < 15) {\n hold += input[_in++] << bits;\n bits += 8;\n hold += input[_in++] << bits;\n bits += 8;\n }\n\n here = lcode[hold & lmask];\n\n dolen:\n for (;;) { // Goto emulation\n op = here >>> 24/*here.bits*/;\n hold >>>= op;\n bits -= op;\n op = (here >>> 16) & 0xff/*here.op*/;\n if (op === 0) { /* literal */\n //Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?\n // \"inflate: literal '%c'\\n\" :\n // \"inflate: literal 0x%02x\\n\", here.val));\n output[_out++] = here & 0xffff/*here.val*/;\n }\n else if (op & 16) { /* length base */\n len = here & 0xffff/*here.val*/;\n op &= 15; /* number of extra bits */\n if (op) {\n if (bits < op) {\n hold += input[_in++] << bits;\n bits += 8;\n }\n len += hold & ((1 << op) - 1);\n hold >>>= op;\n bits -= op;\n }\n //Tracevv((stderr, \"inflate: length %u\\n\", len));\n if (bits < 15) {\n hold += input[_in++] << bits;\n bits += 8;\n hold += input[_in++] << bits;\n bits += 8;\n }\n here = dcode[hold & dmask];\n\n dodist:\n for (;;) { // goto emulation\n op = here >>> 24/*here.bits*/;\n hold >>>= op;\n bits -= op;\n op = (here >>> 16) & 0xff/*here.op*/;\n\n if (op & 16) { /* distance base */\n dist = here & 0xffff/*here.val*/;\n op &= 15; /* number of extra bits */\n if (bits < op) {\n hold += input[_in++] << bits;\n bits += 8;\n if (bits < op) {\n hold += input[_in++] << bits;\n bits += 8;\n }\n }\n dist += hold & ((1 << op) - 1);\n//#ifdef INFLATE_STRICT\n if (dist > dmax) {\n strm.msg = 'invalid distance too far back';\n state.mode = BAD;\n break top;\n }\n//#endif\n hold >>>= op;\n bits -= op;\n //Tracevv((stderr, \"inflate: distance %u\\n\", dist));\n op = _out - beg; /* max distance in output */\n if (dist > op) { /* see if copy from window */\n op = dist - op; /* distance back in window */\n if (op > whave) {\n if (state.sane) {\n strm.msg = 'invalid distance too far back';\n state.mode = BAD;\n break top;\n }\n\n// (!) This block is disabled in zlib defaults,\n// don't enable it for binary compatibility\n//#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR\n// if (len <= op - whave) {\n// do {\n// output[_out++] = 0;\n// } while (--len);\n// continue top;\n// }\n// len -= op - whave;\n// do {\n// output[_out++] = 0;\n// } while (--op > whave);\n// if (op === 0) {\n// from = _out - dist;\n// do {\n// output[_out++] = output[from++];\n// } while (--len);\n// continue top;\n// }\n//#endif\n }\n from = 0; // window index\n from_source = s_window;\n if (wnext === 0) { /* very common case */\n from += wsize - op;\n if (op < len) { /* some from window */\n len -= op;\n do {\n output[_out++] = s_window[from++];\n } while (--op);\n from = _out - dist; /* rest from output */\n from_source = output;\n }\n }\n else if (wnext < op) { /* wrap around window */\n from += wsize + wnext - op;\n op -= wnext;\n if (op < len) { /* some from end of window */\n len -= op;\n do {\n output[_out++] = s_window[from++];\n } while (--op);\n from = 0;\n if (wnext < len) { /* some from start of window */\n op = wnext;\n len -= op;\n do {\n output[_out++] = s_window[from++];\n } while (--op);\n from = _out - dist; /* rest from output */\n from_source = output;\n }\n }\n }\n else { /* contiguous in window */\n from += wnext - op;\n if (op < len) { /* some from window */\n len -= op;\n do {\n output[_out++] = s_window[from++];\n } while (--op);\n from = _out - dist; /* rest from output */\n from_source = output;\n }\n }\n while (len > 2) {\n output[_out++] = from_source[from++];\n output[_out++] = from_source[from++];\n output[_out++] = from_source[from++];\n len -= 3;\n }\n if (len) {\n output[_out++] = from_source[from++];\n if (len > 1) {\n output[_out++] = from_source[from++];\n }\n }\n }\n else {\n from = _out - dist; /* copy direct from output */\n do { /* minimum length is three */\n output[_out++] = output[from++];\n output[_out++] = output[from++];\n output[_out++] = output[from++];\n len -= 3;\n } while (len > 2);\n if (len) {\n output[_out++] = output[from++];\n if (len > 1) {\n output[_out++] = output[from++];\n }\n }\n }\n }\n else if ((op & 64) === 0) { /* 2nd level distance code */\n here = dcode[(here & 0xffff)/*here.val*/ + (hold & ((1 << op) - 1))];\n continue dodist;\n }\n else {\n strm.msg = 'invalid distance code';\n state.mode = BAD;\n break top;\n }\n\n break; // need to emulate goto via \"continue\"\n }\n }\n else if ((op & 64) === 0) { /* 2nd level length code */\n here = lcode[(here & 0xffff)/*here.val*/ + (hold & ((1 << op) - 1))];\n continue dolen;\n }\n else if (op & 32) { /* end-of-block */\n //Tracevv((stderr, \"inflate: end of block\\n\"));\n state.mode = TYPE;\n break top;\n }\n else {\n strm.msg = 'invalid literal/length code';\n state.mode = BAD;\n break top;\n }\n\n break; // need to emulate goto via \"continue\"\n }\n } while (_in < last && _out < end);\n\n /* return unused bytes (on entry, bits < 8, so in won't go too far back) */\n len = bits >> 3;\n _in -= len;\n bits -= len << 3;\n hold &= (1 << bits) - 1;\n\n /* update state and return */\n strm.next_in = _in;\n strm.next_out = _out;\n strm.avail_in = (_in < last ? 5 + (last - _in) : 5 - (_in - last));\n strm.avail_out = (_out < end ? 257 + (end - _out) : 257 - (_out - end));\n state.hold = hold;\n state.bits = bits;\n return;\n};\n","'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nvar utils = require('../utils/common');\n\nvar MAXBITS = 15;\nvar ENOUGH_LENS = 852;\nvar ENOUGH_DISTS = 592;\n//var ENOUGH = (ENOUGH_LENS+ENOUGH_DISTS);\n\nvar CODES = 0;\nvar LENS = 1;\nvar DISTS = 2;\n\nvar lbase = [ /* Length codes 257..285 base */\n 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31,\n 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0\n];\n\nvar lext = [ /* Length codes 257..285 extra */\n 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18,\n 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 72, 78\n];\n\nvar dbase = [ /* Distance codes 0..29 base */\n 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,\n 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,\n 8193, 12289, 16385, 24577, 0, 0\n];\n\nvar dext = [ /* Distance codes 0..29 extra */\n 16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22,\n 23, 23, 24, 24, 25, 25, 26, 26, 27, 27,\n 28, 28, 29, 29, 64, 64\n];\n\nmodule.exports = function inflate_table(type, lens, lens_index, codes, table, table_index, work, opts)\n{\n var bits = opts.bits;\n //here = opts.here; /* table entry for duplication */\n\n var len = 0; /* a code's length in bits */\n var sym = 0; /* index of code symbols */\n var min = 0, max = 0; /* minimum and maximum code lengths */\n var root = 0; /* number of index bits for root table */\n var curr = 0; /* number of index bits for current table */\n var drop = 0; /* code bits to drop for sub-table */\n var left = 0; /* number of prefix codes available */\n var used = 0; /* code entries in table used */\n var huff = 0; /* Huffman code */\n var incr; /* for incrementing code, index */\n var fill; /* index for replicating entries */\n var low; /* low bits for current root entry */\n var mask; /* mask for low root bits */\n var next; /* next available space in table */\n var base = null; /* base value table to use */\n var base_index = 0;\n// var shoextra; /* extra bits table to use */\n var end; /* use base and extra for symbol > end */\n var count = new utils.Buf16(MAXBITS + 1); //[MAXBITS+1]; /* number of codes of each length */\n var offs = new utils.Buf16(MAXBITS + 1); //[MAXBITS+1]; /* offsets in table for each length */\n var extra = null;\n var extra_index = 0;\n\n var here_bits, here_op, here_val;\n\n /*\n Process a set of code lengths to create a canonical Huffman code. The\n code lengths are lens[0..codes-1]. Each length corresponds to the\n symbols 0..codes-1. The Huffman code is generated by first sorting the\n symbols by length from short to long, and retaining the symbol order\n for codes with equal lengths. Then the code starts with all zero bits\n for the first code of the shortest length, and the codes are integer\n increments for the same length, and zeros are appended as the length\n increases. For the deflate format, these bits are stored backwards\n from their more natural integer increment ordering, and so when the\n decoding tables are built in the large loop below, the integer codes\n are incremented backwards.\n\n This routine assumes, but does not check, that all of the entries in\n lens[] are in the range 0..MAXBITS. The caller must assure this.\n 1..MAXBITS is interpreted as that code length. zero means that that\n symbol does not occur in this code.\n\n The codes are sorted by computing a count of codes for each length,\n creating from that a table of starting indices for each length in the\n sorted table, and then entering the symbols in order in the sorted\n table. The sorted table is work[], with that space being provided by\n the caller.\n\n The length counts are used for other purposes as well, i.e. finding\n the minimum and maximum length codes, determining if there are any\n codes at all, checking for a valid set of lengths, and looking ahead\n at length counts to determine sub-table sizes when building the\n decoding tables.\n */\n\n /* accumulate lengths for codes (assumes lens[] all in 0..MAXBITS) */\n for (len = 0; len <= MAXBITS; len++) {\n count[len] = 0;\n }\n for (sym = 0; sym < codes; sym++) {\n count[lens[lens_index + sym]]++;\n }\n\n /* bound code lengths, force root to be within code lengths */\n root = bits;\n for (max = MAXBITS; max >= 1; max--) {\n if (count[max] !== 0) { break; }\n }\n if (root > max) {\n root = max;\n }\n if (max === 0) { /* no symbols to code at all */\n //table.op[opts.table_index] = 64; //here.op = (var char)64; /* invalid code marker */\n //table.bits[opts.table_index] = 1; //here.bits = (var char)1;\n //table.val[opts.table_index++] = 0; //here.val = (var short)0;\n table[table_index++] = (1 << 24) | (64 << 16) | 0;\n\n\n //table.op[opts.table_index] = 64;\n //table.bits[opts.table_index] = 1;\n //table.val[opts.table_index++] = 0;\n table[table_index++] = (1 << 24) | (64 << 16) | 0;\n\n opts.bits = 1;\n return 0; /* no symbols, but wait for decoding to report error */\n }\n for (min = 1; min < max; min++) {\n if (count[min] !== 0) { break; }\n }\n if (root < min) {\n root = min;\n }\n\n /* check for an over-subscribed or incomplete set of lengths */\n left = 1;\n for (len = 1; len <= MAXBITS; len++) {\n left <<= 1;\n left -= count[len];\n if (left < 0) {\n return -1;\n } /* over-subscribed */\n }\n if (left > 0 && (type === CODES || max !== 1)) {\n return -1; /* incomplete set */\n }\n\n /* generate offsets into symbol table for each length for sorting */\n offs[1] = 0;\n for (len = 1; len < MAXBITS; len++) {\n offs[len + 1] = offs[len] + count[len];\n }\n\n /* sort symbols by length, by symbol order within each length */\n for (sym = 0; sym < codes; sym++) {\n if (lens[lens_index + sym] !== 0) {\n work[offs[lens[lens_index + sym]]++] = sym;\n }\n }\n\n /*\n Create and fill in decoding tables. In this loop, the table being\n filled is at next and has curr index bits. The code being used is huff\n with length len. That code is converted to an index by dropping drop\n bits off of the bottom. For codes where len is less than drop + curr,\n those top drop + curr - len bits are incremented through all values to\n fill the table with replicated entries.\n\n root is the number of index bits for the root table. When len exceeds\n root, sub-tables are created pointed to by the root entry with an index\n of the low root bits of huff. This is saved in low to check for when a\n new sub-table should be started. drop is zero when the root table is\n being filled, and drop is root when sub-tables are being filled.\n\n When a new sub-table is needed, it is necessary to look ahead in the\n code lengths to determine what size sub-table is needed. The length\n counts are used for this, and so count[] is decremented as codes are\n entered in the tables.\n\n used keeps track of how many table entries have been allocated from the\n provided *table space. It is checked for LENS and DIST tables against\n the constants ENOUGH_LENS and ENOUGH_DISTS to guard against changes in\n the initial root table size constants. See the comments in inftrees.h\n for more information.\n\n sym increments through all symbols, and the loop terminates when\n all codes of length max, i.e. all codes, have been processed. This\n routine permits incomplete codes, so another loop after this one fills\n in the rest of the decoding tables with invalid code markers.\n */\n\n /* set up for code type */\n // poor man optimization - use if-else instead of switch,\n // to avoid deopts in old v8\n if (type === CODES) {\n base = extra = work; /* dummy value--not used */\n end = 19;\n\n } else if (type === LENS) {\n base = lbase;\n base_index -= 257;\n extra = lext;\n extra_index -= 257;\n end = 256;\n\n } else { /* DISTS */\n base = dbase;\n extra = dext;\n end = -1;\n }\n\n /* initialize opts for loop */\n huff = 0; /* starting code */\n sym = 0; /* starting code symbol */\n len = min; /* starting code length */\n next = table_index; /* current table to fill in */\n curr = root; /* current table index bits */\n drop = 0; /* current bits to drop from code for index */\n low = -1; /* trigger new sub-table when len > root */\n used = 1 << root; /* use root table entries */\n mask = used - 1; /* mask for comparing low */\n\n /* check available table space */\n if ((type === LENS && used > ENOUGH_LENS) ||\n (type === DISTS && used > ENOUGH_DISTS)) {\n return 1;\n }\n\n /* process all codes and make table entries */\n for (;;) {\n /* create table entry */\n here_bits = len - drop;\n if (work[sym] < end) {\n here_op = 0;\n here_val = work[sym];\n }\n else if (work[sym] > end) {\n here_op = extra[extra_index + work[sym]];\n here_val = base[base_index + work[sym]];\n }\n else {\n here_op = 32 + 64; /* end of block */\n here_val = 0;\n }\n\n /* replicate for those indices with low len bits equal to huff */\n incr = 1 << (len - drop);\n fill = 1 << curr;\n min = fill; /* save offset to next table */\n do {\n fill -= incr;\n table[next + (huff >> drop) + fill] = (here_bits << 24) | (here_op << 16) | here_val |0;\n } while (fill !== 0);\n\n /* backwards increment the len-bit code huff */\n incr = 1 << (len - 1);\n while (huff & incr) {\n incr >>= 1;\n }\n if (incr !== 0) {\n huff &= incr - 1;\n huff += incr;\n } else {\n huff = 0;\n }\n\n /* go to next symbol, update count, len */\n sym++;\n if (--count[len] === 0) {\n if (len === max) { break; }\n len = lens[lens_index + work[sym]];\n }\n\n /* create new sub-table if needed */\n if (len > root && (huff & mask) !== low) {\n /* if first time, transition to sub-tables */\n if (drop === 0) {\n drop = root;\n }\n\n /* increment past last table */\n next += min; /* here min is 1 << curr */\n\n /* determine length of next table */\n curr = len - drop;\n left = 1 << curr;\n while (curr + drop < max) {\n left -= count[curr + drop];\n if (left <= 0) { break; }\n curr++;\n left <<= 1;\n }\n\n /* check for enough space */\n used += 1 << curr;\n if ((type === LENS && used > ENOUGH_LENS) ||\n (type === DISTS && used > ENOUGH_DISTS)) {\n return 1;\n }\n\n /* point entry in root table to sub-table */\n low = huff & mask;\n /*table.op[low] = curr;\n table.bits[low] = root;\n table.val[low] = next - opts.table_index;*/\n table[low] = (root << 24) | (curr << 16) | (next - table_index) |0;\n }\n }\n\n /* fill in remaining table entry if code is incomplete (guaranteed to have\n at most one remaining entry, since if the code is incomplete, the\n maximum code length that was allowed to get this far is one bit) */\n if (huff !== 0) {\n //table.op[next + huff] = 64; /* invalid code marker */\n //table.bits[next + huff] = len - drop;\n //table.val[next + huff] = 0;\n table[next + huff] = ((len - drop) << 24) | (64 << 16) |0;\n }\n\n /* set return parameters */\n //opts.table_index += used;\n opts.bits = root;\n return 0;\n};\n","'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nfunction GZheader() {\n /* true if compressed data believed to be text */\n this.text = 0;\n /* modification time */\n this.time = 0;\n /* extra flags (not used when writing a gzip file) */\n this.xflags = 0;\n /* operating system */\n this.os = 0;\n /* pointer to extra field or Z_NULL if none */\n this.extra = null;\n /* extra field length (valid if extra != Z_NULL) */\n this.extra_len = 0; // Actually, we don't need it in JS,\n // but leave for few code modifications\n\n //\n // Setup limits is not necessary because in js we should not preallocate memory\n // for inflate use constant limit in 65536 bytes\n //\n\n /* space at extra (only when reading header) */\n // this.extra_max = 0;\n /* pointer to zero-terminated file name or Z_NULL */\n this.name = '';\n /* space at name (only when reading header) */\n // this.name_max = 0;\n /* pointer to zero-terminated comment or Z_NULL */\n this.comment = '';\n /* space at comment (only when reading header) */\n // this.comm_max = 0;\n /* true if there was or will be a header crc */\n this.hcrc = 0;\n /* true when done reading gzip header (not used when writing a gzip file) */\n this.done = false;\n}\n\nmodule.exports = GZheader;\n","/*\n * URL: https://github.com/cubicdaiya/onp\n *\n * Copyright (c) 2013 Tatsuhiko Kubo <cubicdaiya@gmail.com>\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n/**\n * The algorithm implemented here is based on \"An O(NP) Sequence Comparison Algorithm\"\n * by described by Sun Wu, Udi Manber and Gene Myers\n*/\nmodule.exports = function (a_, b_) {\n var a = a_,\n b = b_,\n m = a.length,\n n = b.length,\n reverse = false,\n ed = null,\n offset = m + 1,\n path = [],\n pathposi = [],\n ses = [],\n lcs = \"\",\n SES_DELETE = -1,\n SES_COMMON = 0,\n SES_ADD = 1;\n\n var tmp1,\n tmp2;\n\n var init = function () {\n if (m >= n) {\n tmp1 = a;\n tmp2 = m;\n a = b;\n b = tmp1;\n m = n;\n n = tmp2;\n reverse = true;\n offset = m + 1;\n }\n };\n\n var P = function (x, y, k) {\n return {\n 'x' : x,\n 'y' : y,\n 'k' : k,\n };\n };\n\n var seselem = function (elem, t) {\n return {\n 'elem' : elem,\n 't' : t,\n };\n };\n\n var snake = function (k, p, pp) {\n var r, x, y;\n if (p > pp) {\n r = path[k-1+offset];\n } else {\n r = path[k+1+offset];\n }\n\n y = Math.max(p, pp);\n x = y - k;\n while (x < m && y < n && a[x] === b[y]) {\n ++x;\n ++y;\n }\n\n path[k+offset] = pathposi.length;\n pathposi[pathposi.length] = new P(x, y, r);\n return y;\n };\n\n var recordseq = function (epc) {\n var x_idx, y_idx, px_idx, py_idx, i;\n x_idx = y_idx = 1;\n px_idx = py_idx = 0;\n for (i=epc.length-1;i>=0;--i) {\n while(px_idx < epc[i].x || py_idx < epc[i].y) {\n if (epc[i].y - epc[i].x > py_idx - px_idx) {\n if (reverse) {\n ses[ses.length] = new seselem(b[py_idx], SES_DELETE);\n } else {\n ses[ses.length] = new seselem(b[py_idx], SES_ADD);\n }\n ++y_idx;\n ++py_idx;\n } else if (epc[i].y - epc[i].x < py_idx - px_idx) {\n if (reverse) {\n ses[ses.length] = new seselem(a[px_idx], SES_ADD);\n } else {\n ses[ses.length] = new seselem(a[px_idx], SES_DELETE);\n }\n ++x_idx;\n ++px_idx;\n } else {\n ses[ses.length] = new seselem(a[px_idx], SES_COMMON);\n lcs += a[px_idx];\n ++x_idx;\n ++y_idx;\n ++px_idx;\n ++py_idx;\n }\n }\n }\n };\n\n init();\n\n return {\n SES_DELETE : -1,\n SES_COMMON : 0,\n SES_ADD : 1,\n editdistance : function () {\n return ed;\n },\n getlcs : function () {\n return lcs;\n },\n getses : function () {\n return ses;\n },\n compose : function () {\n var delta, size, fp, p, r, epc, i, k;\n delta = n - m;\n size = m + n + 3;\n fp = {};\n for (i=0;i<size;++i) {\n fp[i] = -1;\n path[i] = -1;\n }\n p = -1;\n do {\n ++p;\n for (k=-p;k<=delta-1;++k) {\n fp[k+offset] = snake(k, fp[k-1+offset]+1, fp[k+1+offset]);\n }\n for (k=delta+p;k>=delta+1;--k) {\n fp[k+offset] = snake(k, fp[k-1+offset]+1, fp[k+1+offset]);\n }\n fp[delta+offset] = snake(delta, fp[delta-1+offset]+1, fp[delta+1+offset]);\n } while (fp[delta+offset] !== n);\n\n ed = delta + 2 * p;\n\n r = path[delta+offset];\n\n epc = [];\n while (r !== -1) {\n epc[epc.length] = new P(pathposi[r].x, pathposi[r].y, null);\n r = pathposi[r].k;\n }\n recordseq(epc);\n }\n };\n};\n","// @ts-check\nimport { hashObject } from '../storage/hashObject.js'\nimport { assertParameter } from '../utils/assertParameter.js'\n\n/**\n *\n * @typedef {object} HashBlobResult - The object returned has the following schema:\n * @property {string} oid - The SHA-1 object id\n * @property {'blob'} type - The type of the object\n * @property {Uint8Array} object - The wrapped git object (the thing that is hashed)\n * @property {'wrapped'} format - The format of the object\n *\n */\n\n/**\n * Compute what the SHA-1 object id of a file would be\n *\n * @param {object} args\n * @param {Uint8Array|string} args.object - The object to write. If `object` is a String then it will be converted to a Uint8Array using UTF-8 encoding.\n *\n * @returns {Promise<HashBlobResult>} Resolves successfully with the SHA-1 object id and the wrapped object Uint8Array.\n * @see HashBlobResult\n *\n * @example\n * let { oid, type, object, format } = await git.hashBlob({\n * object: 'Hello world!',\n * })\n *\n * console.log('oid', oid)\n * console.log('type', type)\n * console.log('object', object)\n * console.log('format', format)\n *\n */\nexport async function hashBlob({ object }) {\n try {\n assertParameter('object', object)\n\n // Convert object to buffer\n if (typeof object === 'string') {\n object = Buffer.from(object, 'utf8')\n } else {\n object = Buffer.from(object)\n }\n\n const type = 'blob'\n const { oid, object: _object } = await hashObject({\n type: 'blob',\n format: 'content',\n object,\n })\n return { oid, type, object: new Uint8Array(_object), format: 'wrapped' }\n } catch (err) {\n err.caller = 'git.hashBlob'\n throw err\n }\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { ObjectTypeError } from '../errors/ObjectTypeError.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { GitAnnotatedTag } from '../models/GitAnnotatedTag.js'\nimport { GitCommit } from '../models/GitCommit.js'\nimport { GitTree } from '../models/GitTree.js'\nimport { _writeObject } from '../storage/writeObject.js'\nimport { join } from '../utils/join.js'\n\n/**\n * Write a git object directly\n *\n * `format` can have the following values:\n *\n * | param | description |\n * | ---------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n * | 'deflated' | Treat `object` as the raw deflate-compressed buffer for an object, meaning can be written to `.git/objects/**` as-is. |\n * | 'wrapped' | Treat `object` as the inflated object buffer wrapped in the git object header. This is the raw buffer used when calculating the SHA-1 object id of a git object. |\n * | 'content' | Treat `object` as the object buffer without the git header. |\n * | 'parsed' | Treat `object` as a parsed representation of the object. |\n *\n * If `format` is `'parsed'`, then `object` must match one of the schemas for `CommitObject`, `TreeObject`, `TagObject`, or a `string` (for blobs).\n *\n * {@link CommitObject typedef}\n *\n * {@link TreeObject typedef}\n *\n * {@link TagObject typedef}\n *\n * If `format` is `'content'`, `'wrapped'`, or `'deflated'`, `object` should be a `Uint8Array`.\n *\n * @deprecated\n * > This command is overly complicated.\n * >\n * > If you know the type of object you are writing, use [`writeBlob`](./writeBlob.md), [`writeCommit`](./writeCommit.md), [`writeTag`](./writeTag.md), or [`writeTree`](./writeTree.md).\n *\n * @param {object} args\n * @param {FsClient} args.fs - a file system client\n * @param {string} [args.dir] - The [working tree](dir-vs-gitdir.md) directory path\n * @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path\n * @param {string | Uint8Array | CommitObject | TreeObject | TagObject} args.object - The object to write.\n * @param {'blob'|'tree'|'commit'|'tag'} [args.type] - The kind of object to write.\n * @param {'deflated' | 'wrapped' | 'content' | 'parsed'} [args.format = 'parsed'] - What format the object is in. The possible choices are listed below.\n * @param {string} [args.oid] - If `format` is `'deflated'` then this param is required. Otherwise it is calculated.\n * @param {string} [args.encoding] - If `type` is `'blob'` then `object` will be converted to a Uint8Array using `encoding`.\n *\n * @returns {Promise<string>} Resolves successfully with the SHA-1 object id of the newly written object.\n *\n * @example\n * // Manually create an annotated tag.\n * let sha = await git.resolveRef({ fs, dir: '/tutorial', ref: 'HEAD' })\n * console.log('commit', sha)\n *\n * let oid = await git.writeObject({\n * fs,\n * dir: '/tutorial',\n * type: 'tag',\n * object: {\n * object: sha,\n * type: 'commit',\n * tag: 'my-tag',\n * tagger: {\n * name: 'your name',\n * email: 'email@example.com',\n * timestamp: Math.floor(Date.now()/1000),\n * timezoneOffset: new Date().getTimezoneOffset()\n * },\n * message: 'Optional message'\n * }\n * })\n *\n * console.log('tag', oid)\n *\n */\nexport async function writeObject({\n fs: _fs,\n dir,\n gitdir = join(dir, '.git'),\n type,\n object,\n format = 'parsed',\n oid,\n encoding = undefined,\n}) {\n try {\n const fs = new FileSystem(_fs)\n // Convert object to buffer\n if (format === 'parsed') {\n switch (type) {\n case 'commit':\n object = GitCommit.from(object).toObject()\n break\n case 'tree':\n object = GitTree.from(object).toObject()\n break\n case 'blob':\n object = Buffer.from(object, encoding)\n break\n case 'tag':\n object = GitAnnotatedTag.from(object).toObject()\n break\n default:\n throw new ObjectTypeError(oid || '', type, 'blob|commit|tag|tree')\n }\n // GitObjectManager does not know how to serialize content, so we tweak that parameter before passing it.\n format = 'content'\n }\n oid = await _writeObject({\n fs,\n gitdir,\n type,\n object,\n oid,\n format,\n })\n return oid\n } catch (err) {\n err.caller = 'git.writeObject'\n throw err\n }\n}\n","export async function hasObjectLoose({ fs, gitdir, oid }) {\n const source = `objects/${oid.slice(0, 2)}/${oid.slice(2)}`\n return fs.exists(`${gitdir}/${source}`)\n}\n","import { InternalError } from '../errors/InternalError.js'\nimport { readPackIndex } from '../storage/readPackIndex.js'\nimport { join } from '../utils/join.js'\n\nexport async function hasObjectPacked({\n fs,\n cache,\n gitdir,\n oid,\n getExternalRefDelta,\n}) {\n // Check to see if it's in a packfile.\n // Iterate through all the .idx files\n let list = await fs.readdir(join(gitdir, 'objects/pack'))\n list = list.filter(x => x.endsWith('.idx'))\n for (const filename of list) {\n const indexFile = `${gitdir}/objects/pack/${filename}`\n const p = await readPackIndex({\n fs,\n cache,\n filename: indexFile,\n getExternalRefDelta,\n })\n if (p.error) throw new InternalError(p.error)\n // If the packfile DOES have the oid we're looking for...\n if (p.offsets.has(oid)) {\n return true\n }\n }\n // Failed to find it\n return false\n}\n","import { hasObjectLoose } from '../storage/hasObjectLoose.js'\nimport { hasObjectPacked } from '../storage/hasObjectPacked.js'\nimport { _readObject as readObject } from '../storage/readObject.js'\n\nexport async function hasObject({\n fs,\n cache,\n gitdir,\n oid,\n format = 'content',\n}) {\n // Curry the current read method so that the packfile un-deltification\n // process can acquire external ref-deltas.\n const getExternalRefDelta = oid => readObject({ fs, cache, gitdir, oid })\n\n // Look for it in the loose object directory.\n let result = await hasObjectLoose({ fs, gitdir, oid })\n // Check to see if it's in a packfile.\n if (!result) {\n result = await hasObjectPacked({\n fs,\n cache,\n gitdir,\n oid,\n getExternalRefDelta,\n })\n }\n // Finally\n return result\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { _commit } from '../commands/commit.js'\nimport { _readTree } from '../commands/readTree.js'\nimport { _writeTree } from '../commands/writeTree.js'\nimport { AlreadyExistsError } from '../errors/AlreadyExistsError.js'\nimport { NotFoundError } from '../errors/NotFoundError.js'\nimport { GitRefManager } from '../managers/GitRefManager.js'\nimport { _writeObject as writeObject } from '../storage/writeObject.js'\n\n/**\n * @param {object} args\n * @param {import('../models/FileSystem.js').FileSystem} args.fs\n * @param {object} args.cache\n * @param {SignCallback} [args.onSign]\n * @param {string} args.gitdir\n * @param {string} args.ref\n * @param {string} args.oid\n * @param {string|Uint8Array} args.note\n * @param {boolean} [args.force]\n * @param {Object} args.author\n * @param {string} args.author.name\n * @param {string} args.author.email\n * @param {number} args.author.timestamp\n * @param {number} args.author.timezoneOffset\n * @param {Object} args.committer\n * @param {string} args.committer.name\n * @param {string} args.committer.email\n * @param {number} args.committer.timestamp\n * @param {number} args.committer.timezoneOffset\n * @param {string} [args.signingKey]\n *\n * @returns {Promise<string>}\n */\n\nexport async function _addNote({\n fs,\n cache,\n onSign,\n gitdir,\n ref,\n oid,\n note,\n force,\n author,\n committer,\n signingKey,\n}) {\n // Get the current note commit\n let parent\n try {\n parent = await GitRefManager.resolve({ gitdir, fs, ref })\n } catch (err) {\n if (!(err instanceof NotFoundError)) {\n throw err\n }\n }\n\n // I'm using the \"empty tree\" magic number here for brevity\n const result = await _readTree({\n fs,\n cache,\n gitdir,\n oid: parent || '4b825dc642cb6eb9a060e54bf8d69288fbee4904',\n })\n let tree = result.tree\n\n // Handle the case where a note already exists\n if (force) {\n tree = tree.filter(entry => entry.path !== oid)\n } else {\n for (const entry of tree) {\n if (entry.path === oid) {\n throw new AlreadyExistsError('note', oid)\n }\n }\n }\n\n // Create the note blob\n if (typeof note === 'string') {\n note = Buffer.from(note, 'utf8')\n }\n const noteOid = await writeObject({\n fs,\n gitdir,\n type: 'blob',\n object: note,\n format: 'content',\n })\n\n // Create the new note tree\n tree.push({ mode: '100644', path: oid, oid: noteOid, type: 'blob' })\n const treeOid = await _writeTree({\n fs,\n gitdir,\n tree,\n })\n\n // Create the new note commit\n const commitOid = await _commit({\n fs,\n cache,\n onSign,\n gitdir,\n ref,\n tree: treeOid,\n parent: parent && [parent],\n message: `Note added by 'isomorphic-git addNote'\\n`,\n author,\n committer,\n signingKey,\n })\n\n return commitOid\n}\n","// TODO: make a function that just returns obCount. then emptyPackfile = () => sizePack(pack) === 0\nexport function emptyPackfile(pack) {\n const pheader = '5041434b'\n const version = '00000002'\n const obCount = '00000000'\n const header = pheader + version + obCount\n return pack.slice(0, 12).toString('hex') === header\n}\n","import { GitObject } from '../models/GitObject.js'\nimport { shasum } from '../utils/shasum.js'\n\nexport async function hashObject({\n type,\n object,\n format = 'content',\n oid = undefined,\n}) {\n if (format !== 'deflated') {\n if (format !== 'wrapped') {\n object = GitObject.wrap({ type, object })\n }\n oid = await shasum(object)\n }\n return { oid, object }\n}\n","// @ts-check\nimport { collect } from '../utils/collect.js'\nimport { join } from '../utils/join.js'\n\nimport { _pack } from './pack'\n\n/**\n *\n * @typedef {Object} PackObjectsResult The packObjects command returns an object with two properties:\n * @property {string} filename - The suggested filename for the packfile if you want to save it to disk somewhere. It includes the packfile SHA.\n * @property {Uint8Array} [packfile] - The packfile contents. Not present if `write` parameter was true, in which case the packfile was written straight to disk.\n */\n\n/**\n * @param {object} args\n * @param {import('../models/FileSystem.js').FileSystem} args.fs\n * @param {any} args.cache\n * @param {string} args.gitdir\n * @param {string[]} args.oids\n * @param {boolean} args.write\n *\n * @returns {Promise<PackObjectsResult>}\n * @see PackObjectsResult\n */\nexport async function _packObjects({ fs, cache, gitdir, oids, write }) {\n const buffers = await _pack({ fs, cache, gitdir, oids })\n const packfile = Buffer.from(await collect(buffers))\n const packfileSha = packfile.slice(-20).toString('hex')\n const filename = `pack-${packfileSha}.pack`\n if (write) {\n await fs.write(join(gitdir, `objects/pack/${filename}`), packfile)\n return { filename }\n }\n return {\n filename,\n packfile: new Uint8Array(packfile),\n }\n}\n","import { GitIndexManager } from '../managers/GitIndexManager.js'\nimport { compareStrings } from '../utils/compareStrings.js'\nimport { flatFileListToDirectoryStructure } from '../utils/flatFileListToDirectoryStructure.js'\nimport { mode2type } from '../utils/mode2type'\nimport { normalizeStats } from '../utils/normalizeStats'\n\nexport class GitWalkerIndex {\n constructor({ fs, gitdir, cache }) {\n this.treePromise = GitIndexManager.acquire(\n { fs, gitdir, cache },\n async function(index) {\n return flatFileListToDirectoryStructure(index.entries)\n }\n )\n const walker = this\n this.ConstructEntry = class StageEntry {\n constructor(fullpath) {\n this._fullpath = fullpath\n this._type = false\n this._mode = false\n this._stat = false\n this._oid = false\n }\n\n async type() {\n return walker.type(this)\n }\n\n async mode() {\n return walker.mode(this)\n }\n\n async stat() {\n return walker.stat(this)\n }\n\n async content() {\n return walker.content(this)\n }\n\n async oid() {\n return walker.oid(this)\n }\n }\n }\n\n async readdir(entry) {\n const filepath = entry._fullpath\n const tree = await this.treePromise\n const inode = tree.get(filepath)\n if (!inode) return null\n if (inode.type === 'blob') return null\n if (inode.type !== 'tree') {\n throw new Error(`ENOTDIR: not a directory, scandir '${filepath}'`)\n }\n const names = inode.children.map(inode => inode.fullpath)\n names.sort(compareStrings)\n return names\n }\n\n async type(entry) {\n if (entry._type === false) {\n await entry.stat()\n }\n return entry._type\n }\n\n async mode(entry) {\n if (entry._mode === false) {\n await entry.stat()\n }\n return entry._mode\n }\n\n async stat(entry) {\n if (entry._stat === false) {\n const tree = await this.treePromise\n const inode = tree.get(entry._fullpath)\n if (!inode) {\n throw new Error(\n `ENOENT: no such file or directory, lstat '${entry._fullpath}'`\n )\n }\n const stats = inode.type === 'tree' ? {} : normalizeStats(inode.metadata)\n entry._type = inode.type === 'tree' ? 'tree' : mode2type(stats.mode)\n entry._mode = stats.mode\n if (inode.type === 'tree') {\n entry._stat = undefined\n } else {\n entry._stat = stats\n }\n }\n return entry._stat\n }\n\n async content(_entry) {\n // Cannot get content for an index entry\n }\n\n async oid(entry) {\n if (entry._oid === false) {\n const tree = await this.treePromise\n const inode = tree.get(entry._fullpath)\n entry._oid = inode.metadata.oid\n }\n return entry._oid\n }\n}\n","import { InternalError } from '../errors/InternalError.js'\n\n/**\n *\n * @param {number} mode\n */\nexport function mode2type(mode) {\n // prettier-ignore\n switch (mode) {\n case 0o040000: return 'tree'\n case 0o100644: return 'blob'\n case 0o100755: return 'blob'\n case 0o120000: return 'blob'\n case 0o160000: return 'commit'\n }\n throw new InternalError(`Unexpected GitTree entry mode: ${mode.toString(8)}`)\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { GitWalkerIndex } from '../models/GitWalkerIndex.js'\nimport { GitWalkSymbol } from '../utils/symbols.js'\n\n/**\n * @returns {Walker}\n */\nexport function STAGE() {\n const o = Object.create(null)\n Object.defineProperty(o, GitWalkSymbol, {\n value: function({ fs, gitdir, cache }) {\n return new GitWalkerIndex({ fs, gitdir, cache })\n },\n })\n Object.freeze(o)\n return o\n}\n","import { GitIndexManager } from '../managers/GitIndexManager.js'\nimport { compareStats } from '../utils/compareStats.js'\nimport { join } from '../utils/join'\nimport { normalizeStats } from '../utils/normalizeStats.js'\nimport { shasum } from '../utils/shasum.js'\n\nimport { GitObject } from './GitObject.js'\n\nexport class GitWalkerFs {\n constructor({ fs, dir, gitdir, cache }) {\n this.fs = fs\n this.cache = cache\n this.dir = dir\n this.gitdir = gitdir\n const walker = this\n this.ConstructEntry = class WorkdirEntry {\n constructor(fullpath) {\n this._fullpath = fullpath\n this._type = false\n this._mode = false\n this._stat = false\n this._content = false\n this._oid = false\n }\n\n async type() {\n return walker.type(this)\n }\n\n async mode() {\n return walker.mode(this)\n }\n\n async stat() {\n return walker.stat(this)\n }\n\n async content() {\n return walker.content(this)\n }\n\n async oid() {\n return walker.oid(this)\n }\n }\n }\n\n async readdir(entry) {\n const filepath = entry._fullpath\n const { fs, dir } = this\n const names = await fs.readdir(join(dir, filepath))\n if (names === null) return null\n return names.map(name => join(filepath, name))\n }\n\n async type(entry) {\n if (entry._type === false) {\n await entry.stat()\n }\n return entry._type\n }\n\n async mode(entry) {\n if (entry._mode === false) {\n await entry.stat()\n }\n return entry._mode\n }\n\n async stat(entry) {\n if (entry._stat === false) {\n const { fs, dir } = this\n let stat = await fs.lstat(`${dir}/${entry._fullpath}`)\n if (!stat) {\n throw new Error(\n `ENOENT: no such file or directory, lstat '${entry._fullpath}'`\n )\n }\n let type = stat.isDirectory() ? 'tree' : 'blob'\n if (type === 'blob' && !stat.isFile() && !stat.isSymbolicLink()) {\n type = 'special'\n }\n entry._type = type\n stat = normalizeStats(stat)\n entry._mode = stat.mode\n // workaround for a BrowserFS edge case\n if (stat.size === -1 && entry._actualSize) {\n stat.size = entry._actualSize\n }\n entry._stat = stat\n }\n return entry._stat\n }\n\n async content(entry) {\n if (entry._content === false) {\n const { fs, dir } = this\n if ((await entry.type()) === 'tree') {\n entry._content = undefined\n } else {\n const content = await fs.read(`${dir}/${entry._fullpath}`)\n // workaround for a BrowserFS edge case\n entry._actualSize = content.length\n if (entry._stat && entry._stat.size === -1) {\n entry._stat.size = entry._actualSize\n }\n entry._content = new Uint8Array(content)\n }\n }\n return entry._content\n }\n\n async oid(entry) {\n if (entry._oid === false) {\n const { fs, gitdir, cache } = this\n let oid\n // See if we can use the SHA1 hash in the index.\n await GitIndexManager.acquire({ fs, gitdir, cache }, async function(\n index\n ) {\n const stage = index.entriesMap.get(entry._fullpath)\n const stats = await entry.stat()\n if (!stage || compareStats(stats, stage)) {\n const content = await entry.content()\n if (content === undefined) {\n oid = undefined\n } else {\n oid = await shasum(\n GitObject.wrap({ type: 'blob', object: await entry.content() })\n )\n // Update the stats in the index so we will get a \"cache hit\" next time\n // 1) if we can (because the oid and mode are the same)\n // 2) and only if we need to (because other stats differ)\n if (\n stage &&\n oid === stage.oid &&\n stats.mode === stage.mode &&\n compareStats(stats, stage)\n ) {\n index.insert({\n filepath: entry._fullpath,\n stats,\n oid: oid,\n })\n }\n }\n } else {\n // Use the index SHA1 rather than compute it\n oid = stage.oid\n }\n })\n entry._oid = oid\n }\n return entry._oid\n }\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { GitWalkerFs } from '../models/GitWalkerFs.js'\nimport { GitWalkSymbol } from '../utils/symbols.js'\n\n/**\n * @returns {Walker}\n */\nexport function WORKDIR() {\n const o = Object.create(null)\n Object.defineProperty(o, GitWalkSymbol, {\n value: function({ fs, dir, gitdir, cache }) {\n return new GitWalkerFs({ fs, dir, gitdir, cache })\n },\n })\n Object.freeze(o)\n return o\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { STAGE } from '../commands/STAGE.js'\nimport { TREE } from '../commands/TREE.js'\nimport { WORKDIR } from '../commands/WORKDIR.js'\nimport { _walk } from '../commands/walk.js'\nimport { IndexResetError } from '../errors/IndexResetError.js'\nimport { GitIndexManager } from '../managers/GitIndexManager.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { assertParameter } from '../utils/assertParameter.js'\nimport { join } from '../utils/join.js'\nimport { modified } from '../utils/modified.js'\n\n/**\n * Abort a merge in progress.\n *\n * Based on the behavior of git reset --merge, i.e. \"Resets the index and updates the files in the working tree that are different between <commit> and HEAD, but keeps those which are different between the index and working tree (i.e. which have changes which have not been added). If a file that is different between <commit> and the index has unstaged changes, reset is aborted.\"\n *\n * Essentially, abortMerge will reset any files affected by merge conflicts to their last known good version at HEAD.\n * Any unstaged changes are saved and any staged changes are reset as well.\n *\n * NOTE: The behavior of this command differs slightly from canonical git in that an error will be thrown if a file exists in the index and nowhere else.\n * Canonical git will reset the file and continue aborting the merge in this case.\n *\n * **WARNING:** Running git merge with non-trivial uncommitted changes is discouraged: while possible, it may leave you in a state that is hard to back out of in the case of a conflict.\n * If there were uncommitted changes when the merge started (and especially if those changes were further modified after the merge was started), `git.abortMerge` will in some cases be unable to reconstruct the original (pre-merge) changes.\n *\n * @param {object} args\n * @param {FsClient} args.fs - a file system implementation\n * @param {string} args.dir - The [working tree](dir-vs-gitdir.md) directory path\n * @param {string} [args.gitdir=join(dir, '.git')] - [required] The [git directory](dir-vs-gitdir.md) path\n * @param {string} [args.commit='HEAD'] - commit to reset the index and worktree to, defaults to HEAD\n * @param {object} [args.cache] - a [cache](cache.md) object\n *\n * @returns {Promise<void>} Resolves successfully once the git index has been updated\n *\n */\nexport async function abortMerge({\n fs: _fs,\n dir,\n gitdir = join(dir, '.git'),\n commit = 'HEAD',\n cache = {},\n}) {\n try {\n assertParameter('fs', _fs)\n assertParameter('dir', dir)\n assertParameter('gitdir', gitdir)\n\n const fs = new FileSystem(_fs)\n const trees = [TREE({ ref: commit }), WORKDIR(), STAGE()]\n let unmergedPaths = []\n\n await GitIndexManager.acquire({ fs, gitdir, cache }, async function(index) {\n unmergedPaths = index.unmergedPaths\n })\n\n const results = await _walk({\n fs,\n cache,\n dir,\n gitdir,\n trees,\n map: async function(path, [head, workdir, index]) {\n const staged = !(await modified(workdir, index))\n const unmerged = unmergedPaths.includes(path)\n const unmodified = !(await modified(index, head))\n\n if (staged || unmerged) {\n return head\n ? {\n path,\n mode: await head.mode(),\n oid: await head.oid(),\n type: await head.type(),\n content: await head.content(),\n }\n : undefined\n }\n\n if (unmodified) return false\n else throw new IndexResetError(path)\n },\n })\n\n await GitIndexManager.acquire({ fs, gitdir, cache }, async function(index) {\n // Reset paths in index and worktree, this can't be done in _walk because the\n // STAGE walker acquires its own index lock.\n\n for (const entry of results) {\n if (entry === false) continue\n\n // entry is not false, so from here we can assume index = workdir\n if (!entry) {\n await fs.rmdir(`${dir}/${entry.path}`, { recursive: true })\n index.delete({ filepath: entry.path })\n continue\n }\n\n if (entry.type === 'blob') {\n const content = new TextDecoder().decode(entry.content)\n await fs.write(`${dir}/${entry.path}`, content, { mode: entry.mode })\n index.insert({\n filepath: entry.path,\n oid: entry.oid,\n stage: 0,\n })\n }\n }\n })\n } catch (err) {\n err.caller = 'git.abortMerge'\n throw err\n }\n}\n","export function posixifyPathBuffer(buffer) {\n let idx\n while (~(idx = buffer.indexOf(92))) buffer[idx] = 47\n return buffer\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { MultipleGitError } from '../errors/MultipleGitError'\nimport { NotFoundError } from '../errors/NotFoundError.js'\nimport { GitIgnoreManager } from '../managers/GitIgnoreManager.js'\nimport { GitIndexManager } from '../managers/GitIndexManager.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { _writeObject } from '../storage/writeObject.js'\nimport { assertParameter } from '../utils/assertParameter.js'\nimport { join } from '../utils/join.js'\nimport { posixifyPathBuffer } from '../utils/posixifyPathBuffer.js'\n\n/**\n * Add a file to the git index (aka staging area)\n *\n * @param {object} args\n * @param {FsClient} args.fs - a file system implementation\n * @param {string} args.dir - The [working tree](dir-vs-gitdir.md) directory path\n * @param {string} [args.gitdir=join(dir, '.git')] - [required] The [git directory](dir-vs-gitdir.md) path\n * @param {string|string[]} args.filepath - The path to the file to add to the index\n * @param {object} [args.cache] - a [cache](cache.md) object\n * @param {boolean} [args.force=false] - add to index even if matches gitignore. Think `git add --force`\n * @param {boolean} [args.parallel=false] - process each input file in parallel. Parallel processing will result in more memory consumption but less process time\n *\n * @returns {Promise<void>} Resolves successfully once the git index has been updated\n *\n * @example\n * await fs.promises.writeFile('/tutorial/README.md', `# TEST`)\n * await git.add({ fs, dir: '/tutorial', filepath: 'README.md' })\n * console.log('done')\n *\n */\nexport async function add({\n fs: _fs,\n dir,\n gitdir = join(dir, '.git'),\n filepath,\n cache = {},\n force = false,\n parallel = true,\n}) {\n try {\n assertParameter('fs', _fs)\n assertParameter('dir', dir)\n assertParameter('gitdir', gitdir)\n assertParameter('filepath', filepath)\n\n const fs = new FileSystem(_fs)\n await GitIndexManager.acquire({ fs, gitdir, cache }, async index => {\n return addToIndex({\n dir,\n gitdir,\n fs,\n filepath,\n index,\n force,\n parallel,\n })\n })\n } catch (err) {\n err.caller = 'git.add'\n throw err\n }\n}\n\nasync function addToIndex({\n dir,\n gitdir,\n fs,\n filepath,\n index,\n force,\n parallel,\n}) {\n // TODO: Should ignore UNLESS it's already in the index.\n filepath = Array.isArray(filepath) ? filepath : [filepath]\n const promises = filepath.map(async currentFilepath => {\n if (!force) {\n const ignored = await GitIgnoreManager.isIgnored({\n fs,\n dir,\n gitdir,\n filepath: currentFilepath,\n })\n if (ignored) return\n }\n const stats = await fs.lstat(join(dir, currentFilepath))\n if (!stats) throw new NotFoundError(currentFilepath)\n\n if (stats.isDirectory()) {\n const children = await fs.readdir(join(dir, currentFilepath))\n if (parallel) {\n const promises = children.map(child =>\n addToIndex({\n dir,\n gitdir,\n fs,\n filepath: [join(currentFilepath, child)],\n index,\n force,\n parallel,\n })\n )\n await Promise.all(promises)\n } else {\n for (const child of children) {\n await addToIndex({\n dir,\n gitdir,\n fs,\n filepath: [join(currentFilepath, child)],\n index,\n force,\n parallel,\n })\n }\n }\n } else {\n const object = stats.isSymbolicLink()\n ? await fs.readlink(join(dir, currentFilepath)).then(posixifyPathBuffer)\n : await fs.read(join(dir, currentFilepath))\n if (object === null) throw new NotFoundError(currentFilepath)\n const oid = await _writeObject({ fs, gitdir, type: 'blob', object })\n index.insert({ filepath: currentFilepath, stats, oid })\n }\n })\n\n const settledPromises = await Promise.allSettled(promises)\n const rejectedPromises = settledPromises\n .filter(settle => settle.status === 'rejected')\n .map(settle => settle.reason)\n if (rejectedPromises.length > 1) {\n throw new MultipleGitError(rejectedPromises)\n }\n if (rejectedPromises.length === 1) {\n throw rejectedPromises[0]\n }\n\n const fulfilledPromises = settledPromises\n .filter(settle => settle.status === 'fulfilled' && settle.value)\n .map(settle => settle.value)\n\n return fulfilledPromises\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { GitConfigManager } from '../managers/GitConfigManager.js'\n\n/**\n * @param {Object} args\n * @param {import('../models/FileSystem.js').FileSystem} args.fs\n * @param {string} args.gitdir\n * @param {string} args.path\n *\n * @returns {Promise<any>} Resolves with the config value\n *\n * @example\n * // Read config value\n * let value = await git.getConfig({\n * dir: '$input((/))',\n * path: '$input((user.name))'\n * })\n * console.log(value)\n *\n */\nexport async function _getConfig({ fs, gitdir, path }) {\n const config = await GitConfigManager.get({ fs, gitdir })\n return config.get(path)\n}\n","import { _getConfig } from '../commands/getConfig'\n\n/**\n *\n * @returns {Promise<void | {name: string, email: string, date: Date, timestamp: number, timezoneOffset: number }>}\n */\nexport async function normalizeAuthorObject({ fs, gitdir, author = {} }) {\n let { name, email, timestamp, timezoneOffset } = author\n name = name || (await _getConfig({ fs, gitdir, path: 'user.name' }))\n email = email || (await _getConfig({ fs, gitdir, path: 'user.email' })) || ''\n\n if (name === undefined) {\n return undefined\n }\n\n timestamp = timestamp != null ? timestamp : Math.floor(Date.now() / 1000)\n timezoneOffset =\n timezoneOffset != null\n ? timezoneOffset\n : new Date(timestamp * 1000).getTimezoneOffset()\n\n return { name, email, timestamp, timezoneOffset }\n}\n","import { normalizeAuthorObject } from '../utils/normalizeAuthorObject.js'\n\n/**\n *\n * @returns {Promise<void | {name: string, email: string, timestamp: number, timezoneOffset: number }>}\n */\nexport async function normalizeCommitterObject({\n fs,\n gitdir,\n author,\n committer,\n}) {\n committer = Object.assign({}, committer || author)\n // Match committer's date to author's one, if omitted\n if (author) {\n committer.timestamp = committer.timestamp || author.timestamp\n committer.timezoneOffset = committer.timezoneOffset || author.timezoneOffset\n }\n committer = await normalizeAuthorObject({ fs, gitdir, author: committer })\n return committer\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { _addNote } from '../commands/addNote.js'\nimport { MissingNameError } from '../errors/MissingNameError.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { assertParameter } from '../utils/assertParameter.js'\nimport { join } from '../utils/join'\nimport { normalizeAuthorObject } from '../utils/normalizeAuthorObject.js'\nimport { normalizeCommitterObject } from '../utils/normalizeCommitterObject.js'\n\n/**\n * Add or update an object note\n *\n * @param {object} args\n * @param {FsClient} args.fs - a file system implementation\n * @param {SignCallback} [args.onSign] - a PGP signing implementation\n * @param {string} [args.dir] - The [working tree](dir-vs-gitdir.md) directory path\n * @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path\n * @param {string} [args.ref] - The notes ref to look under\n * @param {string} args.oid - The SHA-1 object id of the object to add the note to.\n * @param {string|Uint8Array} args.note - The note to add\n * @param {boolean} [args.force] - Over-write note if it already exists.\n * @param {Object} [args.author] - The details about the author.\n * @param {string} [args.author.name] - Default is `user.name` config.\n * @param {string} [args.author.email] - Default is `user.email` config.\n * @param {number} [args.author.timestamp=Math.floor(Date.now()/1000)] - Set the author timestamp field. This is the integer number of seconds since the Unix epoch (1970-01-01 00:00:00).\n * @param {number} [args.author.timezoneOffset] - Set the author timezone offset field. This is the difference, in minutes, from the current timezone to UTC. Default is `(new Date()).getTimezoneOffset()`.\n * @param {Object} [args.committer = author] - The details about the note committer, in the same format as the author parameter. If not specified, the author details are used.\n * @param {string} [args.committer.name] - Default is `user.name` config.\n * @param {string} [args.committer.email] - Default is `user.email` config.\n * @param {number} [args.committer.timestamp=Math.floor(Date.now()/1000)] - Set the committer timestamp field. This is the integer number of seconds since the Unix epoch (1970-01-01 00:00:00).\n * @param {number} [args.committer.timezoneOffset] - Set the committer timezone offset field. This is the difference, in minutes, from the current timezone to UTC. Default is `(new Date()).getTimezoneOffset()`.\n * @param {string} [args.signingKey] - Sign the note commit using this private PGP key.\n * @param {object} [args.cache] - a [cache](cache.md) object\n *\n * @returns {Promise<string>} Resolves successfully with the SHA-1 object id of the commit object for the added note.\n */\n\nexport async function addNote({\n fs: _fs,\n onSign,\n dir,\n gitdir = join(dir, '.git'),\n ref = 'refs/notes/commits',\n oid,\n note,\n force,\n author: _author,\n committer: _committer,\n signingKey,\n cache = {},\n}) {\n try {\n assertParameter('fs', _fs)\n assertParameter('gitdir', gitdir)\n assertParameter('oid', oid)\n assertParameter('note', note)\n if (signingKey) {\n assertParameter('onSign', onSign)\n }\n const fs = new FileSystem(_fs)\n\n const author = await normalizeAuthorObject({ fs, gitdir, author: _author })\n if (!author) throw new MissingNameError('author')\n\n const committer = await normalizeCommitterObject({\n fs,\n gitdir,\n author,\n committer: _committer,\n })\n if (!committer) throw new MissingNameError('committer')\n\n return await _addNote({\n fs: new FileSystem(fs),\n cache,\n onSign,\n gitdir,\n ref,\n oid,\n note,\n force,\n author,\n committer,\n signingKey,\n })\n } catch (err) {\n err.caller = 'git.addNote'\n throw err\n }\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport cleanGitRef from 'clean-git-ref'\n\nimport { AlreadyExistsError } from '../errors/AlreadyExistsError.js'\nimport { InvalidRefNameError } from '../errors/InvalidRefNameError.js'\nimport { GitConfigManager } from '../managers/GitConfigManager.js'\n\n/**\n * @param {object} args\n * @param {import('../models/FileSystem.js').FileSystem} args.fs\n * @param {string} args.gitdir\n * @param {string} args.remote\n * @param {string} args.url\n * @param {boolean} args.force\n *\n * @returns {Promise<void>}\n *\n */\nexport async function _addRemote({ fs, gitdir, remote, url, force }) {\n if (remote !== cleanGitRef.clean(remote)) {\n throw new InvalidRefNameError(remote, cleanGitRef.clean(remote))\n }\n const config = await GitConfigManager.get({ fs, gitdir })\n if (!force) {\n // Check that setting it wouldn't overwrite.\n const remoteNames = await config.getSubsections('remote')\n if (remoteNames.includes(remote)) {\n // Throw an error if it would overwrite an existing remote,\n // but not if it's simply setting the same value again.\n if (url !== (await config.get(`remote.${remote}.url`))) {\n throw new AlreadyExistsError('remote', remote)\n }\n }\n }\n await config.set(`remote.${remote}.url`, url)\n await config.set(\n `remote.${remote}.fetch`,\n `+refs/heads/*:refs/remotes/${remote}/*`\n )\n await GitConfigManager.save({ fs, gitdir, config })\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { _addRemote } from '../commands/addRemote.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { assertParameter } from '../utils/assertParameter.js'\nimport { join } from '../utils/join.js'\n\n/**\n * Add or update a remote\n *\n * @param {object} args\n * @param {FsClient} args.fs - a file system implementation\n * @param {string} [args.dir] - The [working tree](dir-vs-gitdir.md) directory path\n * @param {string} [args.gitdir] - [required] The [git directory](dir-vs-gitdir.md) path\n * @param {string} args.remote - The name of the remote\n * @param {string} args.url - The URL of the remote\n * @param {boolean} [args.force = false] - Instead of throwing an error if a remote named `remote` already exists, overwrite the existing remote.\n *\n * @returns {Promise<void>} Resolves successfully when filesystem operations are complete\n *\n * @example\n * await git.addRemote({\n * fs,\n * dir: '/tutorial',\n * remote: 'upstream',\n * url: 'https://github.com/isomorphic-git/isomorphic-git'\n * })\n * console.log('done')\n *\n */\nexport async function addRemote({\n fs,\n dir,\n gitdir = join(dir, '.git'),\n remote,\n url,\n force = false,\n}) {\n try {\n assertParameter('fs', fs)\n assertParameter('gitdir', gitdir)\n assertParameter('remote', remote)\n assertParameter('url', url)\n return await _addRemote({\n fs: new FileSystem(fs),\n gitdir,\n remote,\n url,\n force,\n })\n } catch (err) {\n err.caller = 'git.addRemote'\n throw err\n }\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { AlreadyExistsError } from '../errors/AlreadyExistsError.js'\nimport { GitRefManager } from '../managers/GitRefManager.js'\nimport { GitAnnotatedTag } from '../models/GitAnnotatedTag'\nimport { _readObject as readObject } from '../storage/readObject.js'\nimport { _writeObject as writeObject } from '../storage/writeObject.js'\n\n/**\n * Create an annotated tag.\n *\n * @param {object} args\n * @param {import('../models/FileSystem.js').FileSystem} args.fs\n * @param {any} args.cache\n * @param {SignCallback} [args.onSign]\n * @param {string} args.gitdir\n * @param {string} args.ref\n * @param {string} [args.message = ref]\n * @param {string} [args.object = 'HEAD']\n * @param {object} [args.tagger]\n * @param {string} args.tagger.name\n * @param {string} args.tagger.email\n * @param {number} args.tagger.timestamp\n * @param {number} args.tagger.timezoneOffset\n * @param {string} [args.gpgsig]\n * @param {string} [args.signingKey]\n * @param {boolean} [args.force = false]\n *\n * @returns {Promise<void>} Resolves successfully when filesystem operations are complete\n *\n * @example\n * await git.annotatedTag({\n * dir: '$input((/))',\n * ref: '$input((test-tag))',\n * message: '$input((This commit is awesome))',\n * tagger: {\n * name: '$input((Mr. Test))',\n * email: '$input((mrtest@example.com))'\n * }\n * })\n * console.log('done')\n *\n */\nexport async function _annotatedTag({\n fs,\n cache,\n onSign,\n gitdir,\n ref,\n tagger,\n message = ref,\n gpgsig,\n object,\n signingKey,\n force = false,\n}) {\n ref = ref.startsWith('refs/tags/') ? ref : `refs/tags/${ref}`\n\n if (!force && (await GitRefManager.exists({ fs, gitdir, ref }))) {\n throw new AlreadyExistsError('tag', ref)\n }\n\n // Resolve passed value\n const oid = await GitRefManager.resolve({\n fs,\n gitdir,\n ref: object || 'HEAD',\n })\n\n const { type } = await readObject({ fs, cache, gitdir, oid })\n let tagObject = GitAnnotatedTag.from({\n object: oid,\n type,\n tag: ref.replace('refs/tags/', ''),\n tagger,\n message,\n gpgsig,\n })\n if (signingKey) {\n tagObject = await GitAnnotatedTag.sign(tagObject, onSign, signingKey)\n }\n const value = await writeObject({\n fs,\n gitdir,\n type: 'tag',\n object: tagObject.toObject(),\n })\n\n await GitRefManager.writeRef({ fs, gitdir, ref, value })\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { _annotatedTag } from '../commands/annotatedTag.js'\nimport { MissingNameError } from '../errors/MissingNameError.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { assertParameter } from '../utils/assertParameter.js'\nimport { join } from '../utils/join.js'\nimport { normalizeAuthorObject } from '../utils/normalizeAuthorObject.js'\n\n/**\n * Create an annotated tag.\n *\n * @param {object} args\n * @param {FsClient} args.fs - a file system implementation\n * @param {SignCallback} [args.onSign] - a PGP signing implementation\n * @param {string} [args.dir] - The [working tree](dir-vs-gitdir.md) directory path\n * @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path\n * @param {string} args.ref - What to name the tag\n * @param {string} [args.message = ref] - The tag message to use.\n * @param {string} [args.object = 'HEAD'] - The SHA-1 object id the tag points to. (Will resolve to a SHA-1 object id if value is a ref.) By default, the commit object which is referred by the current `HEAD` is used.\n * @param {object} [args.tagger] - The details about the tagger.\n * @param {string} [args.tagger.name] - Default is `user.name` config.\n * @param {string} [args.tagger.email] - Default is `user.email` config.\n * @param {number} [args.tagger.timestamp=Math.floor(Date.now()/1000)] - Set the tagger timestamp field. This is the integer number of seconds since the Unix epoch (1970-01-01 00:00:00).\n * @param {number} [args.tagger.timezoneOffset] - Set the tagger timezone offset field. This is the difference, in minutes, from the current timezone to UTC. Default is `(new Date()).getTimezoneOffset()`.\n * @param {string} [args.gpgsig] - The gpgsig attatched to the tag object. (Mutually exclusive with the `signingKey` option.)\n * @param {string} [args.signingKey] - Sign the tag object using this private PGP key. (Mutually exclusive with the `gpgsig` option.)\n * @param {boolean} [args.force = false] - Instead of throwing an error if a tag named `ref` already exists, overwrite the existing tag. Note that this option does not modify the original tag object itself.\n * @param {object} [args.cache] - a [cache](cache.md) object\n *\n * @returns {Promise<void>} Resolves successfully when filesystem operations are complete\n *\n * @example\n * await git.annotatedTag({\n * fs,\n * dir: '/tutorial',\n * ref: 'test-tag',\n * message: 'This commit is awesome',\n * tagger: {\n * name: 'Mr. Test',\n * email: 'mrtest@example.com'\n * }\n * })\n * console.log('done')\n *\n */\nexport async function annotatedTag({\n fs: _fs,\n onSign,\n dir,\n gitdir = join(dir, '.git'),\n ref,\n tagger: _tagger,\n message = ref,\n gpgsig,\n object,\n signingKey,\n force = false,\n cache = {},\n}) {\n try {\n assertParameter('fs', _fs)\n assertParameter('gitdir', gitdir)\n assertParameter('ref', ref)\n if (signingKey) {\n assertParameter('onSign', onSign)\n }\n const fs = new FileSystem(_fs)\n\n // Fill in missing arguments with default values\n const tagger = await normalizeAuthorObject({ fs, gitdir, author: _tagger })\n if (!tagger) throw new MissingNameError('tagger')\n\n return await _annotatedTag({\n fs,\n cache,\n onSign,\n gitdir,\n ref,\n tagger,\n message,\n gpgsig,\n object,\n signingKey,\n force,\n })\n } catch (err) {\n err.caller = 'git.annotatedTag'\n throw err\n }\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport cleanGitRef from 'clean-git-ref'\n\nimport { AlreadyExistsError } from '../errors/AlreadyExistsError.js'\nimport { InvalidRefNameError } from '../errors/InvalidRefNameError.js'\nimport { GitRefManager } from '../managers/GitRefManager.js'\n\n/**\n * Create a branch\n *\n * @param {object} args\n * @param {import('../models/FileSystem.js').FileSystem} args.fs\n * @param {string} args.gitdir\n * @param {string} args.ref\n * @param {string} [args.object = 'HEAD']\n * @param {boolean} [args.checkout = false]\n * @param {boolean} [args.force = false]\n *\n * @returns {Promise<void>} Resolves successfully when filesystem operations are complete\n *\n * @example\n * await git.branch({ dir: '$input((/))', ref: '$input((develop))' })\n * console.log('done')\n *\n */\nexport async function _branch({\n fs,\n gitdir,\n ref,\n object,\n checkout = false,\n force = false,\n}) {\n if (ref !== cleanGitRef.clean(ref)) {\n throw new InvalidRefNameError(ref, cleanGitRef.clean(ref))\n }\n\n const fullref = `refs/heads/${ref}`\n\n if (!force) {\n const exist = await GitRefManager.exists({ fs, gitdir, ref: fullref })\n if (exist) {\n throw new AlreadyExistsError('branch', ref, false)\n }\n }\n\n // Get current HEAD tree oid\n let oid\n try {\n oid = await GitRefManager.resolve({ fs, gitdir, ref: object || 'HEAD' })\n } catch (e) {\n // Probably an empty repo\n }\n\n // Create a new ref that points at the current commit\n if (oid) {\n await GitRefManager.writeRef({ fs, gitdir, ref: fullref, value: oid })\n }\n\n if (checkout) {\n // Update HEAD\n await GitRefManager.writeSymbolicRef({\n fs,\n gitdir,\n ref: 'HEAD',\n value: fullref,\n })\n }\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { _branch } from '../commands/branch.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { assertParameter } from '../utils/assertParameter.js'\nimport { join } from '../utils/join.js'\n\n/**\n * Create a branch\n *\n * @param {object} args\n * @param {FsClient} args.fs - a file system implementation\n * @param {string} [args.dir] - The [working tree](dir-vs-gitdir.md) directory path\n * @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path\n * @param {string} args.ref - What to name the branch\n * @param {string} [args.object = 'HEAD'] - What oid to use as the start point. Accepts a symbolic ref.\n * @param {boolean} [args.checkout = false] - Update `HEAD` to point at the newly created branch\n * @param {boolean} [args.force = false] - Instead of throwing an error if a branched named `ref` already exists, overwrite the existing branch.\n *\n * @returns {Promise<void>} Resolves successfully when filesystem operations are complete\n *\n * @example\n * await git.branch({ fs, dir: '/tutorial', ref: 'develop' })\n * console.log('done')\n *\n */\nexport async function branch({\n fs,\n dir,\n gitdir = join(dir, '.git'),\n ref,\n object,\n checkout = false,\n force = false,\n}) {\n try {\n assertParameter('fs', fs)\n assertParameter('gitdir', gitdir)\n assertParameter('ref', ref)\n return await _branch({\n fs: new FileSystem(fs),\n gitdir,\n ref,\n object,\n checkout,\n force,\n })\n } catch (err) {\n err.caller = 'git.branch'\n throw err\n }\n}\n","export const worthWalking = (filepath, root) => {\n if (filepath === '.' || root == null || root.length === 0 || root === '.') {\n return true\n }\n if (root.length >= filepath.length) {\n return root.startsWith(filepath)\n } else {\n return filepath.startsWith(root)\n }\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { STAGE } from '../commands/STAGE.js'\nimport { TREE } from '../commands/TREE.js'\nimport { WORKDIR } from '../commands/WORKDIR.js'\nimport { _walk } from '../commands/walk.js'\nimport { CheckoutConflictError } from '../errors/CheckoutConflictError.js'\nimport { CommitNotFetchedError } from '../errors/CommitNotFetchedError.js'\nimport { InternalError } from '../errors/InternalError.js'\nimport { NotFoundError } from '../errors/NotFoundError.js'\nimport { GitConfigManager } from '../managers/GitConfigManager.js'\nimport { GitIndexManager } from '../managers/GitIndexManager.js'\nimport { GitRefManager } from '../managers/GitRefManager.js'\nimport { _readObject as readObject } from '../storage/readObject.js'\nimport { flat } from '../utils/flat.js'\nimport { worthWalking } from '../utils/worthWalking.js'\n\n/**\n * @param {object} args\n * @param {import('../models/FileSystem.js').FileSystem} args.fs\n * @param {any} args.cache\n * @param {ProgressCallback} [args.onProgress]\n * @param {string} args.dir\n * @param {string} args.gitdir\n * @param {string} args.ref\n * @param {string[]} [args.filepaths]\n * @param {string} args.remote\n * @param {boolean} args.noCheckout\n * @param {boolean} [args.noUpdateHead]\n * @param {boolean} [args.dryRun]\n * @param {boolean} [args.force]\n * @param {boolean} [args.track]\n *\n * @returns {Promise<void>} Resolves successfully when filesystem operations are complete\n *\n */\nexport async function _checkout({\n fs,\n cache,\n onProgress,\n dir,\n gitdir,\n remote,\n ref,\n filepaths,\n noCheckout,\n noUpdateHead,\n dryRun,\n force,\n track = true,\n}) {\n // Get tree oid\n let oid\n try {\n oid = await GitRefManager.resolve({ fs, gitdir, ref })\n // TODO: Figure out what to do if both 'ref' and 'remote' are specified, ref already exists,\n // and is configured to track a different remote.\n } catch (err) {\n if (ref === 'HEAD') throw err\n // If `ref` doesn't exist, create a new remote tracking branch\n // Figure out the commit to checkout\n const remoteRef = `${remote}/${ref}`\n oid = await GitRefManager.resolve({\n fs,\n gitdir,\n ref: remoteRef,\n })\n if (track) {\n // Set up remote tracking branch\n const config = await GitConfigManager.get({ fs, gitdir })\n await config.set(`branch.${ref}.remote`, remote)\n await config.set(`branch.${ref}.merge`, `refs/heads/${ref}`)\n await GitConfigManager.save({ fs, gitdir, config })\n }\n // Create a new branch that points at that same commit\n await GitRefManager.writeRef({\n fs,\n gitdir,\n ref: `refs/heads/${ref}`,\n value: oid,\n })\n }\n\n // Update working dir\n if (!noCheckout) {\n let ops\n // First pass - just analyze files (not directories) and figure out what needs to be done\n try {\n ops = await analyze({\n fs,\n cache,\n onProgress,\n dir,\n gitdir,\n ref,\n force,\n filepaths,\n })\n } catch (err) {\n // Throw a more helpful error message for this common mistake.\n if (err instanceof NotFoundError && err.data.what === oid) {\n throw new CommitNotFetchedError(ref, oid)\n } else {\n throw err\n }\n }\n\n // Report conflicts\n const conflicts = ops\n .filter(([method]) => method === 'conflict')\n .map(([method, fullpath]) => fullpath)\n if (conflicts.length > 0) {\n throw new CheckoutConflictError(conflicts)\n }\n\n // Collect errors\n const errors = ops\n .filter(([method]) => method === 'error')\n .map(([method, fullpath]) => fullpath)\n if (errors.length > 0) {\n throw new InternalError(errors.join(', '))\n }\n\n if (dryRun) {\n // Since the format of 'ops' is in flux, I really would rather folk besides myself not start relying on it\n // return ops\n return\n }\n\n // Second pass - execute planned changes\n // The cheapest semi-parallel solution without computing a full dependency graph will be\n // to just do ops in 4 dumb phases: delete files, delete dirs, create dirs, write files\n\n let count = 0\n const total = ops.length\n await GitIndexManager.acquire({ fs, gitdir, cache }, async function(index) {\n await Promise.all(\n ops\n .filter(\n ([method]) => method === 'delete' || method === 'delete-index'\n )\n .map(async function([method, fullpath]) {\n const filepath = `${dir}/${fullpath}`\n if (method === 'delete') {\n await fs.rm(filepath)\n }\n index.delete({ filepath: fullpath })\n if (onProgress) {\n await onProgress({\n phase: 'Updating workdir',\n loaded: ++count,\n total,\n })\n }\n })\n )\n })\n\n // Note: this is cannot be done naively in parallel\n await GitIndexManager.acquire({ fs, gitdir, cache }, async function(index) {\n for (const [method, fullpath] of ops) {\n if (method === 'rmdir' || method === 'rmdir-index') {\n const filepath = `${dir}/${fullpath}`\n try {\n if (method === 'rmdir-index') {\n index.delete({ filepath: fullpath })\n }\n await fs.rmdir(filepath)\n if (onProgress) {\n await onProgress({\n phase: 'Updating workdir',\n loaded: ++count,\n total,\n })\n }\n } catch (e) {\n if (e.code === 'ENOTEMPTY') {\n console.log(\n `Did not delete ${fullpath} because directory is not empty`\n )\n } else {\n throw e\n }\n }\n }\n }\n })\n\n await Promise.all(\n ops\n .filter(([method]) => method === 'mkdir' || method === 'mkdir-index')\n .map(async function([_, fullpath]) {\n const filepath = `${dir}/${fullpath}`\n await fs.mkdir(filepath)\n if (onProgress) {\n await onProgress({\n phase: 'Updating workdir',\n loaded: ++count,\n total,\n })\n }\n })\n )\n\n await GitIndexManager.acquire({ fs, gitdir, cache }, async function(index) {\n await Promise.all(\n ops\n .filter(\n ([method]) =>\n method === 'create' ||\n method === 'create-index' ||\n method === 'update' ||\n method === 'mkdir-index'\n )\n .map(async function([method, fullpath, oid, mode, chmod]) {\n const filepath = `${dir}/${fullpath}`\n try {\n if (method !== 'create-index' && method !== 'mkdir-index') {\n const { object } = await readObject({ fs, cache, gitdir, oid })\n if (chmod) {\n // Note: the mode option of fs.write only works when creating files,\n // not updating them. Since the `fs` plugin doesn't expose `chmod` this\n // is our only option.\n await fs.rm(filepath)\n }\n if (mode === 0o100644) {\n // regular file\n await fs.write(filepath, object)\n } else if (mode === 0o100755) {\n // executable file\n await fs.write(filepath, object, { mode: 0o777 })\n } else if (mode === 0o120000) {\n // symlink\n await fs.writelink(filepath, object)\n } else {\n throw new InternalError(\n `Invalid mode 0o${mode.toString(8)} detected in blob ${oid}`\n )\n }\n }\n\n const stats = await fs.lstat(filepath)\n // We can't trust the executable bit returned by lstat on Windows,\n // so we need to preserve this value from the TREE.\n // TODO: Figure out how git handles this internally.\n if (mode === 0o100755) {\n stats.mode = 0o755\n }\n // Submodules are present in the git index but use a unique mode different from trees\n if (method === 'mkdir-index') {\n stats.mode = 0o160000\n }\n index.insert({\n filepath: fullpath,\n stats,\n oid,\n })\n if (onProgress) {\n await onProgress({\n phase: 'Updating workdir',\n loaded: ++count,\n total,\n })\n }\n } catch (e) {\n console.log(e)\n }\n })\n )\n })\n }\n\n // Update HEAD\n if (!noUpdateHead) {\n const fullRef = await GitRefManager.expand({ fs, gitdir, ref })\n if (fullRef.startsWith('refs/heads')) {\n await GitRefManager.writeSymbolicRef({\n fs,\n gitdir,\n ref: 'HEAD',\n value: fullRef,\n })\n } else {\n // detached head\n await GitRefManager.writeRef({ fs, gitdir, ref: 'HEAD', value: oid })\n }\n }\n}\n\nasync function analyze({\n fs,\n cache,\n onProgress,\n dir,\n gitdir,\n ref,\n force,\n filepaths,\n}) {\n let count = 0\n return _walk({\n fs,\n cache,\n dir,\n gitdir,\n trees: [TREE({ ref }), WORKDIR(), STAGE()],\n map: async function(fullpath, [commit, workdir, stage]) {\n if (fullpath === '.') return\n // match against base paths\n if (filepaths && !filepaths.some(base => worthWalking(fullpath, base))) {\n return null\n }\n // Emit progress event\n if (onProgress) {\n await onProgress({ phase: 'Analyzing workdir', loaded: ++count })\n }\n\n // This is a kind of silly pattern but it worked so well for me in the past\n // and it makes intuitively demonstrating exhaustiveness so *easy*.\n // This checks for the presense and/or absence of each of the 3 entries,\n // converts that to a 3-bit binary representation, and then handles\n // every possible combination (2^3 or 8 cases) with a lookup table.\n const key = [!!stage, !!commit, !!workdir].map(Number).join('')\n switch (key) {\n // Impossible case.\n case '000':\n return\n // Ignore workdir files that are not tracked and not part of the new commit.\n case '001':\n // OK, make an exception for explicitly named files.\n if (force && filepaths && filepaths.includes(fullpath)) {\n return ['delete', fullpath]\n }\n return\n // New entries\n case '010': {\n switch (await commit.type()) {\n case 'tree': {\n return ['mkdir', fullpath]\n }\n case 'blob': {\n return [\n 'create',\n fullpath,\n await commit.oid(),\n await commit.mode(),\n ]\n }\n case 'commit': {\n return [\n 'mkdir-index',\n fullpath,\n await commit.oid(),\n await commit.mode(),\n ]\n }\n default: {\n return [\n 'error',\n `new entry Unhandled type ${await commit.type()}`,\n ]\n }\n }\n }\n // New entries but there is already something in the workdir there.\n case '011': {\n switch (`${await commit.type()}-${await workdir.type()}`) {\n case 'tree-tree': {\n return // noop\n }\n case 'tree-blob':\n case 'blob-tree': {\n return ['conflict', fullpath]\n }\n case 'blob-blob': {\n // Is the incoming file different?\n if ((await commit.oid()) !== (await workdir.oid())) {\n if (force) {\n return [\n 'update',\n fullpath,\n await commit.oid(),\n await commit.mode(),\n (await commit.mode()) !== (await workdir.mode()),\n ]\n } else {\n return ['conflict', fullpath]\n }\n } else {\n // Is the incoming file a different mode?\n if ((await commit.mode()) !== (await workdir.mode())) {\n if (force) {\n return [\n 'update',\n fullpath,\n await commit.oid(),\n await commit.mode(),\n true,\n ]\n } else {\n return ['conflict', fullpath]\n }\n } else {\n return [\n 'create-index',\n fullpath,\n await commit.oid(),\n await commit.mode(),\n ]\n }\n }\n }\n case 'commit-tree': {\n // TODO: submodule\n // We'll ignore submodule directories for now.\n // Users prefer we not throw an error for lack of submodule support.\n // gitlinks\n return\n }\n case 'commit-blob': {\n // TODO: submodule\n // But... we'll complain if there is a *file* where we would\n // put a submodule if we had submodule support.\n return ['conflict', fullpath]\n }\n default: {\n return ['error', `new entry Unhandled type ${commit.type}`]\n }\n }\n }\n // Something in stage but not in the commit OR the workdir.\n // Note: I verified this behavior against canonical git.\n case '100': {\n return ['delete-index', fullpath]\n }\n // Deleted entries\n // TODO: How to handle if stage type and workdir type mismatch?\n case '101': {\n switch (await stage.type()) {\n case 'tree': {\n return ['rmdir', fullpath]\n }\n case 'blob': {\n // Git checks that the workdir.oid === stage.oid before deleting file\n if ((await stage.oid()) !== (await workdir.oid())) {\n if (force) {\n return ['delete', fullpath]\n } else {\n return ['conflict', fullpath]\n }\n } else {\n return ['delete', fullpath]\n }\n }\n case 'commit': {\n return ['rmdir-index', fullpath]\n }\n default: {\n return [\n 'error',\n `delete entry Unhandled type ${await stage.type()}`,\n ]\n }\n }\n }\n /* eslint-disable no-fallthrough */\n // File missing from workdir\n case '110':\n // Possibly modified entries\n case '111': {\n /* eslint-enable no-fallthrough */\n switch (`${await stage.type()}-${await commit.type()}`) {\n case 'tree-tree': {\n return\n }\n case 'blob-blob': {\n // If the file hasn't changed, there is no need to do anything.\n // Existing file modifications in the workdir can be be left as is.\n if (\n (await stage.oid()) === (await commit.oid()) &&\n (await stage.mode()) === (await commit.mode()) &&\n !force\n ) {\n return\n }\n\n // Check for local changes that would be lost\n if (workdir) {\n // Note: canonical git only compares with the stage. But we're smart enough\n // to compare to the stage AND the incoming commit.\n if (\n (await workdir.oid()) !== (await stage.oid()) &&\n (await workdir.oid()) !== (await commit.oid())\n ) {\n if (force) {\n return [\n 'update',\n fullpath,\n await commit.oid(),\n await commit.mode(),\n (await commit.mode()) !== (await workdir.mode()),\n ]\n } else {\n return ['conflict', fullpath]\n }\n }\n } else if (force) {\n return [\n 'update',\n fullpath,\n await commit.oid(),\n await commit.mode(),\n (await commit.mode()) !== (await stage.mode()),\n ]\n }\n // Has file mode changed?\n if ((await commit.mode()) !== (await stage.mode())) {\n return [\n 'update',\n fullpath,\n await commit.oid(),\n await commit.mode(),\n true,\n ]\n }\n // TODO: HANDLE SYMLINKS\n // Has the file content changed?\n if ((await commit.oid()) !== (await stage.oid())) {\n return [\n 'update',\n fullpath,\n await commit.oid(),\n await commit.mode(),\n false,\n ]\n } else {\n return\n }\n }\n case 'tree-blob': {\n return ['update-dir-to-blob', fullpath, await commit.oid()]\n }\n case 'blob-tree': {\n return ['update-blob-to-tree', fullpath]\n }\n case 'commit-commit': {\n return [\n 'mkdir-index',\n fullpath,\n await commit.oid(),\n await commit.mode(),\n ]\n }\n default: {\n return [\n 'error',\n `update entry Unhandled type ${await stage.type()}-${await commit.type()}`,\n ]\n }\n }\n }\n }\n },\n // Modify the default flat mapping\n reduce: async function(parent, children) {\n children = flat(children)\n if (!parent) {\n return children\n } else if (parent && parent[0] === 'rmdir') {\n children.push(parent)\n return children\n } else {\n children.unshift(parent)\n return children\n }\n },\n })\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { _checkout } from '../commands/checkout.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { assertParameter } from '../utils/assertParameter.js'\nimport { join } from '../utils/join.js'\n\n/**\n * Checkout a branch\n *\n * If the branch already exists it will check out that branch. Otherwise, it will create a new remote tracking branch set to track the remote branch of that name.\n *\n * @param {object} args\n * @param {FsClient} args.fs - a file system implementation\n * @param {ProgressCallback} [args.onProgress] - optional progress event callback\n * @param {string} args.dir - The [working tree](dir-vs-gitdir.md) directory path\n * @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path\n * @param {string} [args.ref = 'HEAD'] - Source to checkout files from\n * @param {string[]} [args.filepaths] - Limit the checkout to the given files and directories\n * @param {string} [args.remote = 'origin'] - Which remote repository to use\n * @param {boolean} [args.noCheckout = false] - If true, will update HEAD but won't update the working directory\n * @param {boolean} [args.noUpdateHead] - If true, will update the working directory but won't update HEAD. Defaults to `false` when `ref` is provided, and `true` if `ref` is not provided.\n * @param {boolean} [args.dryRun = false] - If true, simulates a checkout so you can test whether it would succeed.\n * @param {boolean} [args.force = false] - If true, conflicts will be ignored and files will be overwritten regardless of local changes.\n * @param {boolean} [args.track = true] - If false, will not set the remote branch tracking information. Defaults to true.\n * @param {object} [args.cache] - a [cache](cache.md) object\n *\n * @returns {Promise<void>} Resolves successfully when filesystem operations are complete\n *\n * @example\n * // switch to the main branch\n * await git.checkout({\n * fs,\n * dir: '/tutorial',\n * ref: 'main'\n * })\n * console.log('done')\n *\n * @example\n * // restore the 'docs' and 'src/docs' folders to the way they were, overwriting any changes\n * await git.checkout({\n * fs,\n * dir: '/tutorial',\n * force: true,\n * filepaths: ['docs', 'src/docs']\n * })\n * console.log('done')\n *\n * @example\n * // restore the 'docs' and 'src/docs' folders to the way they are in the 'develop' branch, overwriting any changes\n * await git.checkout({\n * fs,\n * dir: '/tutorial',\n * ref: 'develop',\n * noUpdateHead: true,\n * force: true,\n * filepaths: ['docs', 'src/docs']\n * })\n * console.log('done')\n */\nexport async function checkout({\n fs,\n onProgress,\n dir,\n gitdir = join(dir, '.git'),\n remote = 'origin',\n ref: _ref,\n filepaths,\n noCheckout = false,\n noUpdateHead = _ref === undefined,\n dryRun = false,\n force = false,\n track = true,\n cache = {},\n}) {\n try {\n assertParameter('fs', fs)\n assertParameter('dir', dir)\n assertParameter('gitdir', gitdir)\n\n const ref = _ref || 'HEAD'\n return await _checkout({\n fs: new FileSystem(fs),\n cache,\n onProgress,\n dir,\n gitdir,\n remote,\n ref,\n filepaths,\n noCheckout,\n noUpdateHead,\n dryRun,\n force,\n track,\n })\n } catch (err) {\n err.caller = 'git.checkout'\n throw err\n }\n}\n","// @ts-check\nimport { join } from '../utils/join.js'\n\n/**\n * Initialize a new repository\n *\n * @param {object} args\n * @param {import('../models/FileSystem.js').FileSystem} args.fs\n * @param {string} [args.dir]\n * @param {string} [args.gitdir]\n * @param {boolean} [args.bare = false]\n * @param {string} [args.defaultBranch = 'master']\n * @returns {Promise<void>}\n */\nexport async function _init({\n fs,\n bare = false,\n dir,\n gitdir = bare ? dir : join(dir, '.git'),\n defaultBranch = 'master',\n}) {\n // Don't overwrite an existing config\n if (await fs.exists(gitdir + '/config')) return\n\n let folders = [\n 'hooks',\n 'info',\n 'objects/info',\n 'objects/pack',\n 'refs/heads',\n 'refs/tags',\n ]\n folders = folders.map(dir => gitdir + '/' + dir)\n for (const folder of folders) {\n await fs.mkdir(folder)\n }\n\n await fs.write(\n gitdir + '/config',\n '[core]\\n' +\n '\\trepositoryformatversion = 0\\n' +\n '\\tfilemode = false\\n' +\n `\\tbare = ${bare}\\n` +\n (bare ? '' : '\\tlogallrefupdates = true\\n') +\n '\\tsymlinks = false\\n' +\n '\\tignorecase = true\\n'\n )\n await fs.write(gitdir + '/HEAD', `ref: refs/heads/${defaultBranch}\\n`)\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { _addRemote } from '../commands/addRemote.js'\nimport { _checkout } from '../commands/checkout.js'\nimport { _fetch } from '../commands/fetch.js'\nimport { _init } from '../commands/init.js'\nimport { GitConfigManager } from '../managers/GitConfigManager.js'\n\n/**\n * @param {object} args\n * @param {import('../models/FileSystem.js').FileSystem} args.fs\n * @param {object} args.cache\n * @param {HttpClient} args.http\n * @param {ProgressCallback} [args.onProgress]\n * @param {MessageCallback} [args.onMessage]\n * @param {AuthCallback} [args.onAuth]\n * @param {AuthFailureCallback} [args.onAuthFailure]\n * @param {AuthSuccessCallback} [args.onAuthSuccess]\n * @param {string} [args.dir]\n * @param {string} args.gitdir\n * @param {string} args.url\n * @param {string} args.corsProxy\n * @param {string} args.ref\n * @param {boolean} args.singleBranch\n * @param {boolean} args.noCheckout\n * @param {boolean} args.noTags\n * @param {string} args.remote\n * @param {number} args.depth\n * @param {Date} args.since\n * @param {string[]} args.exclude\n * @param {boolean} args.relative\n * @param {Object<string, string>} args.headers\n *\n * @returns {Promise<void>} Resolves successfully when clone completes\n *\n */\nexport async function _clone({\n fs,\n cache,\n http,\n onProgress,\n onMessage,\n onAuth,\n onAuthSuccess,\n onAuthFailure,\n dir,\n gitdir,\n url,\n corsProxy,\n ref,\n remote,\n depth,\n since,\n exclude,\n relative,\n singleBranch,\n noCheckout,\n noTags,\n headers,\n}) {\n try {\n await _init({ fs, gitdir })\n await _addRemote({ fs, gitdir, remote, url, force: false })\n if (corsProxy) {\n const config = await GitConfigManager.get({ fs, gitdir })\n await config.set(`http.corsProxy`, corsProxy)\n await GitConfigManager.save({ fs, gitdir, config })\n }\n const { defaultBranch, fetchHead } = await _fetch({\n fs,\n cache,\n http,\n onProgress,\n onMessage,\n onAuth,\n onAuthSuccess,\n onAuthFailure,\n gitdir,\n ref,\n remote,\n corsProxy,\n depth,\n since,\n exclude,\n relative,\n singleBranch,\n headers,\n tags: !noTags,\n })\n if (fetchHead === null) return\n ref = ref || defaultBranch\n ref = ref.replace('refs/heads/', '')\n // Checkout that branch\n await _checkout({\n fs,\n cache,\n onProgress,\n dir,\n gitdir,\n ref,\n remote,\n noCheckout,\n })\n } catch (err) {\n // Remove partial local repository, see #1283\n // Ignore any error as we are already failing.\n // The catch is necessary so the original error is not masked.\n await fs\n .rmdir(gitdir, { recursive: true, maxRetries: 10 })\n .catch(() => undefined)\n throw err\n }\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { _clone } from '../commands/clone.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { assertParameter } from '../utils/assertParameter.js'\nimport { join } from '../utils/join.js'\n\n/**\n * Clone a repository\n *\n * @param {object} args\n * @param {FsClient} args.fs - a file system implementation\n * @param {HttpClient} args.http - an HTTP client\n * @param {ProgressCallback} [args.onProgress] - optional progress event callback\n * @param {MessageCallback} [args.onMessage] - optional message event callback\n * @param {AuthCallback} [args.onAuth] - optional auth fill callback\n * @param {AuthFailureCallback} [args.onAuthFailure] - optional auth rejected callback\n * @param {AuthSuccessCallback} [args.onAuthSuccess] - optional auth approved callback\n * @param {string} args.dir - The [working tree](dir-vs-gitdir.md) directory path\n * @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path\n * @param {string} args.url - The URL of the remote repository\n * @param {string} [args.corsProxy] - Optional [CORS proxy](https://www.npmjs.com/%40isomorphic-git/cors-proxy). Value is stored in the git config file for that repo.\n * @param {string} [args.ref] - Which branch to checkout. By default this is the designated \"main branch\" of the repository.\n * @param {boolean} [args.singleBranch = false] - Instead of the default behavior of fetching all the branches, only fetch a single branch.\n * @param {boolean} [args.noCheckout = false] - If true, clone will only fetch the repo, not check out a branch. Skipping checkout can save a lot of time normally spent writing files to disk.\n * @param {boolean} [args.noTags = false] - By default clone will fetch all tags. `noTags` disables that behavior.\n * @param {string} [args.remote = 'origin'] - What to name the remote that is created.\n * @param {number} [args.depth] - Integer. Determines how much of the git repository's history to retrieve\n * @param {Date} [args.since] - Only fetch commits created after the given date. Mutually exclusive with `depth`.\n * @param {string[]} [args.exclude = []] - A list of branches or tags. Instructs the remote server not to send us any commits reachable from these refs.\n * @param {boolean} [args.relative = false] - Changes the meaning of `depth` to be measured from the current shallow depth rather than from the branch tip.\n * @param {Object<string, string>} [args.headers = {}] - Additional headers to include in HTTP requests, similar to git's `extraHeader` config\n * @param {object} [args.cache] - a [cache](cache.md) object\n *\n * @returns {Promise<void>} Resolves successfully when clone completes\n *\n * @example\n * await git.clone({\n * fs,\n * http,\n * dir: '/tutorial',\n * corsProxy: 'https://cors.isomorphic-git.org',\n * url: 'https://github.com/isomorphic-git/isomorphic-git',\n * singleBranch: true,\n * depth: 1\n * })\n * console.log('done')\n *\n */\nexport async function clone({\n fs,\n http,\n onProgress,\n onMessage,\n onAuth,\n onAuthSuccess,\n onAuthFailure,\n dir,\n gitdir = join(dir, '.git'),\n url,\n corsProxy = undefined,\n ref = undefined,\n remote = 'origin',\n depth = undefined,\n since = undefined,\n exclude = [],\n relative = false,\n singleBranch = false,\n noCheckout = false,\n noTags = false,\n headers = {},\n cache = {},\n}) {\n try {\n assertParameter('fs', fs)\n assertParameter('http', http)\n assertParameter('gitdir', gitdir)\n if (!noCheckout) {\n assertParameter('dir', dir)\n }\n assertParameter('url', url)\n\n return await _clone({\n fs: new FileSystem(fs),\n cache,\n http,\n onProgress,\n onMessage,\n onAuth,\n onAuthSuccess,\n onAuthFailure,\n dir,\n gitdir,\n url,\n corsProxy,\n ref,\n remote,\n depth,\n since,\n exclude,\n relative,\n singleBranch,\n noCheckout,\n noTags,\n headers,\n })\n } catch (err) {\n err.caller = 'git.clone'\n throw err\n }\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { _commit } from '../commands/commit.js'\nimport { MissingNameError } from '../errors/MissingNameError.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { assertParameter } from '../utils/assertParameter.js'\nimport { join } from '../utils/join.js'\nimport { normalizeAuthorObject } from '../utils/normalizeAuthorObject.js'\nimport { normalizeCommitterObject } from '../utils/normalizeCommitterObject.js'\n\n/**\n * Create a new commit\n *\n * @param {Object} args\n * @param {FsClient} args.fs - a file system implementation\n * @param {SignCallback} [args.onSign] - a PGP signing implementation\n * @param {string} [args.dir] - The [working tree](dir-vs-gitdir.md) directory path\n * @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path\n * @param {string} args.message - The commit message to use.\n * @param {Object} [args.author] - The details about the author.\n * @param {string} [args.author.name] - Default is `user.name` config.\n * @param {string} [args.author.email] - Default is `user.email` config.\n * @param {number} [args.author.timestamp=Math.floor(Date.now()/1000)] - Set the author timestamp field. This is the integer number of seconds since the Unix epoch (1970-01-01 00:00:00).\n * @param {number} [args.author.timezoneOffset] - Set the author timezone offset field. This is the difference, in minutes, from the current timezone to UTC. Default is `(new Date()).getTimezoneOffset()`.\n * @param {Object} [args.committer = author] - The details about the commit committer, in the same format as the author parameter. If not specified, the author details are used.\n * @param {string} [args.committer.name] - Default is `user.name` config.\n * @param {string} [args.committer.email] - Default is `user.email` config.\n * @param {number} [args.committer.timestamp=Math.floor(Date.now()/1000)] - Set the committer timestamp field. This is the integer number of seconds since the Unix epoch (1970-01-01 00:00:00).\n * @param {number} [args.committer.timezoneOffset] - Set the committer timezone offset field. This is the difference, in minutes, from the current timezone to UTC. Default is `(new Date()).getTimezoneOffset()`.\n * @param {string} [args.signingKey] - Sign the tag object using this private PGP key.\n * @param {boolean} [args.dryRun = false] - If true, simulates making a commit so you can test whether it would succeed. Implies `noUpdateBranch`.\n * @param {boolean} [args.noUpdateBranch = false] - If true, does not update the branch pointer after creating the commit.\n * @param {string} [args.ref] - The fully expanded name of the branch to commit to. Default is the current branch pointed to by HEAD. (TODO: fix it so it can expand branch names without throwing if the branch doesn't exist yet.)\n * @param {string[]} [args.parent] - The SHA-1 object ids of the commits to use as parents. If not specified, the commit pointed to by `ref` is used.\n * @param {string} [args.tree] - The SHA-1 object id of the tree to use. If not specified, a new tree object is created from the current git index.\n * @param {object} [args.cache] - a [cache](cache.md) object\n *\n * @returns {Promise<string>} Resolves successfully with the SHA-1 object id of the newly created commit.\n *\n * @example\n * let sha = await git.commit({\n * fs,\n * dir: '/tutorial',\n * author: {\n * name: 'Mr. Test',\n * email: 'mrtest@example.com',\n * },\n * message: 'Added the a.txt file'\n * })\n * console.log(sha)\n *\n */\nexport async function commit({\n fs: _fs,\n onSign,\n dir,\n gitdir = join(dir, '.git'),\n message,\n author: _author,\n committer: _committer,\n signingKey,\n dryRun = false,\n noUpdateBranch = false,\n ref,\n parent,\n tree,\n cache = {},\n}) {\n try {\n assertParameter('fs', _fs)\n assertParameter('message', message)\n if (signingKey) {\n assertParameter('onSign', onSign)\n }\n const fs = new FileSystem(_fs)\n\n const author = await normalizeAuthorObject({ fs, gitdir, author: _author })\n if (!author) throw new MissingNameError('author')\n\n const committer = await normalizeCommitterObject({\n fs,\n gitdir,\n author,\n committer: _committer,\n })\n if (!committer) throw new MissingNameError('committer')\n\n return await _commit({\n fs,\n cache,\n onSign,\n gitdir,\n message,\n author,\n committer,\n signingKey,\n dryRun,\n noUpdateBranch,\n ref,\n parent,\n tree,\n })\n } catch (err) {\n err.caller = 'git.commit'\n throw err\n }\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { _currentBranch } from '../commands/currentBranch.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { assertParameter } from '../utils/assertParameter.js'\nimport { join } from '../utils/join.js'\n\n/**\n * Get the name of the branch currently pointed to by .git/HEAD\n *\n * @param {Object} args\n * @param {FsClient} args.fs - a file system implementation\n * @param {string} [args.dir] - The [working tree](dir-vs-gitdir.md) directory path\n * @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path\n * @param {boolean} [args.fullname = false] - Return the full path (e.g. \"refs/heads/main\") instead of the abbreviated form.\n * @param {boolean} [args.test = false] - If the current branch doesn't actually exist (such as right after git init) then return `undefined`.\n *\n * @returns {Promise<string|void>} The name of the current branch or undefined if the HEAD is detached.\n *\n * @example\n * // Get the current branch name\n * let branch = await git.currentBranch({\n * fs,\n * dir: '/tutorial',\n * fullname: false\n * })\n * console.log(branch)\n *\n */\nexport async function currentBranch({\n fs,\n dir,\n gitdir = join(dir, '.git'),\n fullname = false,\n test = false,\n}) {\n try {\n assertParameter('fs', fs)\n assertParameter('gitdir', gitdir)\n return await _currentBranch({\n fs: new FileSystem(fs),\n gitdir,\n fullname,\n test,\n })\n } catch (err) {\n err.caller = 'git.currentBranch'\n throw err\n }\n}\n","// @ts-check\nimport { _currentBranch } from '../commands/currentBranch'\nimport { NotFoundError } from '../errors/NotFoundError.js'\nimport { GitRefManager } from '../managers/GitRefManager.js'\n\n/**\n * @param {Object} args\n * @param {import('../models/FileSystem.js').FileSystem} args.fs\n * @param {string} args.gitdir\n * @param {string} args.ref\n *\n * @returns {Promise<void>}\n */\nexport async function _deleteBranch({ fs, gitdir, ref }) {\n ref = ref.startsWith('refs/heads/') ? ref : `refs/heads/${ref}`\n const exist = await GitRefManager.exists({ fs, gitdir, ref })\n if (!exist) {\n throw new NotFoundError(ref)\n }\n\n const fullRef = await GitRefManager.expand({ fs, gitdir, ref })\n const currentRef = await _currentBranch({ fs, gitdir, fullname: true })\n if (fullRef === currentRef) {\n // detach HEAD\n const value = await GitRefManager.resolve({ fs, gitdir, ref: fullRef })\n await GitRefManager.writeRef({ fs, gitdir, ref: 'HEAD', value })\n }\n\n // Delete a specified branch\n await GitRefManager.deleteRef({ fs, gitdir, ref: fullRef })\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { _deleteBranch } from '../commands/deleteBranch.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { assertParameter } from '../utils/assertParameter.js'\nimport { join } from '../utils/join.js'\n\n/**\n * Delete a local branch\n *\n * > Note: This only deletes loose branches - it should be fixed in the future to delete packed branches as well.\n *\n * @param {Object} args\n * @param {FsClient} args.fs - a file system implementation\n * @param {string} [args.dir] - The [working tree](dir-vs-gitdir.md) directory path\n * @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path\n * @param {string} args.ref - The branch to delete\n *\n * @returns {Promise<void>} Resolves successfully when filesystem operations are complete\n *\n * @example\n * await git.deleteBranch({ fs, dir: '/tutorial', ref: 'local-branch' })\n * console.log('done')\n *\n */\nexport async function deleteBranch({\n fs,\n dir,\n gitdir = join(dir, '.git'),\n ref,\n}) {\n try {\n assertParameter('fs', fs)\n assertParameter('ref', ref)\n return await _deleteBranch({\n fs: new FileSystem(fs),\n gitdir,\n ref,\n })\n } catch (err) {\n err.caller = 'git.deleteBranch'\n throw err\n }\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { GitRefManager } from '../managers/GitRefManager.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { assertParameter } from '../utils/assertParameter.js'\nimport { join } from '../utils/join.js'\n\n/**\n * Delete a local ref\n *\n * @param {Object} args\n * @param {FsClient} args.fs - a file system implementation\n * @param {string} [args.dir] - The [working tree](dir-vs-gitdir.md) directory path\n * @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path\n * @param {string} args.ref - The ref to delete\n *\n * @returns {Promise<void>} Resolves successfully when filesystem operations are complete\n *\n * @example\n * await git.deleteRef({ fs, dir: '/tutorial', ref: 'refs/tags/test-tag' })\n * console.log('done')\n *\n */\nexport async function deleteRef({ fs, dir, gitdir = join(dir, '.git'), ref }) {\n try {\n assertParameter('fs', fs)\n assertParameter('ref', ref)\n await GitRefManager.deleteRef({ fs: new FileSystem(fs), gitdir, ref })\n } catch (err) {\n err.caller = 'git.deleteRef'\n throw err\n }\n}\n","// @ts-check\nimport { GitConfigManager } from '../managers/GitConfigManager.js'\n\n/**\n * @param {Object} args\n * @param {import('../models/FileSystem.js').FileSystem} args.fs\n * @param {string} args.gitdir\n * @param {string} args.remote\n *\n * @returns {Promise<void>}\n */\nexport async function _deleteRemote({ fs, gitdir, remote }) {\n const config = await GitConfigManager.get({ fs, gitdir })\n await config.deleteSection('remote', remote)\n await GitConfigManager.save({ fs, gitdir, config })\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { _deleteRemote } from '../commands/deleteRemote.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { assertParameter } from '../utils/assertParameter.js'\nimport { join } from '../utils/join.js'\n\n/**\n * Removes the local config entry for a given remote\n *\n * @param {Object} args\n * @param {FsClient} args.fs - a file system implementation\n * @param {string} [args.dir] - The [working tree](dir-vs-gitdir.md) directory path\n * @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path\n * @param {string} args.remote - The name of the remote to delete\n *\n * @returns {Promise<void>} Resolves successfully when filesystem operations are complete\n *\n * @example\n * await git.deleteRemote({ fs, dir: '/tutorial', remote: 'upstream' })\n * console.log('done')\n *\n */\nexport async function deleteRemote({\n fs,\n dir,\n gitdir = join(dir, '.git'),\n remote,\n}) {\n try {\n assertParameter('fs', fs)\n assertParameter('remote', remote)\n return await _deleteRemote({\n fs: new FileSystem(fs),\n gitdir,\n remote,\n })\n } catch (err) {\n err.caller = 'git.deleteRemote'\n throw err\n }\n}\n","// @ts-check\nimport { GitRefManager } from '../managers/GitRefManager.js'\n\n/**\n * Delete a local tag ref\n *\n * @param {Object} args\n * @param {import('../models/FileSystem.js').FileSystem} args.fs\n * @param {string} args.gitdir\n * @param {string} args.ref - The tag to delete\n *\n * @returns {Promise<void>} Resolves successfully when filesystem operations are complete\n *\n * @example\n * await git.deleteTag({ dir: '$input((/))', ref: '$input((test-tag))' })\n * console.log('done')\n *\n */\nexport async function _deleteTag({ fs, gitdir, ref }) {\n ref = ref.startsWith('refs/tags/') ? ref : `refs/tags/${ref}`\n await GitRefManager.deleteRef({ fs, gitdir, ref })\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { _deleteTag } from '../commands/deleteTag.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { assertParameter } from '../utils/assertParameter.js'\nimport { join } from '../utils/join.js'\n\n/**\n * Delete a local tag ref\n *\n * @param {Object} args\n * @param {FsClient} args.fs - a file system implementation\n * @param {string} [args.dir] - The [working tree](dir-vs-gitdir.md) directory path\n * @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path\n * @param {string} args.ref - The tag to delete\n *\n * @returns {Promise<void>} Resolves successfully when filesystem operations are complete\n *\n * @example\n * await git.deleteTag({ fs, dir: '/tutorial', ref: 'test-tag' })\n * console.log('done')\n *\n */\nexport async function deleteTag({ fs, dir, gitdir = join(dir, '.git'), ref }) {\n try {\n assertParameter('fs', fs)\n assertParameter('ref', ref)\n return await _deleteTag({\n fs: new FileSystem(fs),\n gitdir,\n ref,\n })\n } catch (err) {\n err.caller = 'git.deleteTag'\n throw err\n }\n}\n","export async function expandOidLoose({ fs, gitdir, oid: short }) {\n const prefix = short.slice(0, 2)\n const objectsSuffixes = await fs.readdir(`${gitdir}/objects/${prefix}`)\n return objectsSuffixes\n .map(suffix => `${prefix}${suffix}`)\n .filter(_oid => _oid.startsWith(short))\n}\n","import { InternalError } from '../errors/InternalError.js'\nimport { readPackIndex } from '../storage/readPackIndex.js'\nimport { join } from '../utils/join.js'\n\nexport async function expandOidPacked({\n fs,\n cache,\n gitdir,\n oid: short,\n getExternalRefDelta,\n}) {\n // Iterate through all the .pack files\n const results = []\n let list = await fs.readdir(join(gitdir, 'objects/pack'))\n list = list.filter(x => x.endsWith('.idx'))\n for (const filename of list) {\n const indexFile = `${gitdir}/objects/pack/${filename}`\n const p = await readPackIndex({\n fs,\n cache,\n filename: indexFile,\n getExternalRefDelta,\n })\n if (p.error) throw new InternalError(p.error)\n // Search through the list of oids in the packfile\n for (const oid of p.offsets.keys()) {\n if (oid.startsWith(short)) results.push(oid)\n }\n }\n return results\n}\n","import { AmbiguousError } from '../errors/AmbiguousError.js'\nimport { NotFoundError } from '../errors/NotFoundError.js'\nimport { expandOidLoose } from '../storage/expandOidLoose.js'\nimport { expandOidPacked } from '../storage/expandOidPacked.js'\nimport { _readObject as readObject } from '../storage/readObject.js'\n\nexport async function _expandOid({ fs, cache, gitdir, oid: short }) {\n // Curry the current read method so that the packfile un-deltification\n // process can acquire external ref-deltas.\n const getExternalRefDelta = oid => readObject({ fs, cache, gitdir, oid })\n\n const results = await expandOidLoose({ fs, gitdir, oid: short })\n const packedOids = await expandOidPacked({\n fs,\n cache,\n gitdir,\n oid: short,\n getExternalRefDelta,\n })\n // Objects can exist in a pack file as well as loose, make sure we only get a list of unique oids.\n for (const packedOid of packedOids) {\n if (results.indexOf(packedOid) === -1) {\n results.push(packedOid)\n }\n }\n\n if (results.length === 1) {\n return results[0]\n }\n if (results.length > 1) {\n throw new AmbiguousError('oids', short, results)\n }\n throw new NotFoundError(`an object matching \"${short}\"`)\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { FileSystem } from '../models/FileSystem.js'\nimport { _expandOid } from '../storage/expandOid.js'\nimport { assertParameter } from '../utils/assertParameter.js'\nimport { join } from '../utils/join.js'\n\n/**\n * Expand and resolve a short oid into a full oid\n *\n * @param {Object} args\n * @param {FsClient} args.fs - a file system implementation\n * @param {string} [args.dir] - The [working tree](dir-vs-gitdir.md) directory path\n * @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path\n * @param {string} args.oid - The shortened oid prefix to expand (like \"0414d2a\")\n * @param {object} [args.cache] - a [cache](cache.md) object\n *\n * @returns {Promise<string>} Resolves successfully with the full oid (like \"0414d2a286d7bbc7a4a326a61c1f9f888a8ab87f\")\n *\n * @example\n * let oid = await git.expandOid({ fs, dir: '/tutorial', oid: '0414d2a'})\n * console.log(oid)\n *\n */\nexport async function expandOid({\n fs,\n dir,\n gitdir = join(dir, '.git'),\n oid,\n cache = {},\n}) {\n try {\n assertParameter('fs', fs)\n assertParameter('gitdir', gitdir)\n assertParameter('oid', oid)\n return await _expandOid({\n fs: new FileSystem(fs),\n cache,\n gitdir,\n oid,\n })\n } catch (err) {\n err.caller = 'git.expandOid'\n throw err\n }\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { GitRefManager } from '../managers/GitRefManager.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { assertParameter } from '../utils/assertParameter.js'\nimport { join } from '../utils/join.js'\n\n/**\n * Expand an abbreviated ref to its full name\n *\n * @param {Object} args\n * @param {FsClient} args.fs - a file system implementation\n * @param {string} [args.dir] - The [working tree](dir-vs-gitdir.md) directory path\n * @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path\n * @param {string} args.ref - The ref to expand (like \"v1.0.0\")\n *\n * @returns {Promise<string>} Resolves successfully with a full ref name (\"refs/tags/v1.0.0\")\n *\n * @example\n * let fullRef = await git.expandRef({ fs, dir: '/tutorial', ref: 'main'})\n * console.log(fullRef)\n *\n */\nexport async function expandRef({ fs, dir, gitdir = join(dir, '.git'), ref }) {\n try {\n assertParameter('fs', fs)\n assertParameter('gitdir', gitdir)\n assertParameter('ref', ref)\n return await GitRefManager.expand({\n fs: new FileSystem(fs),\n gitdir,\n ref,\n })\n } catch (err) {\n err.caller = 'git.expandRef'\n throw err\n }\n}\n","// @ts-check\nimport { GitCommit } from '../models/GitCommit.js'\nimport { _readObject as readObject } from '../storage/readObject.js'\n\n/**\n * @param {object} args\n * @param {import('../models/FileSystem.js').FileSystem} args.fs\n * @param {any} args.cache\n * @param {string} args.gitdir\n * @param {string[]} args.oids\n *\n */\nexport async function _findMergeBase({ fs, cache, gitdir, oids }) {\n // Note: right now, the tests are geared so that the output should match that of\n // `git merge-base --all --octopus`\n // because without the --octopus flag, git's output seems to depend on the ORDER of the oids,\n // and computing virtual merge bases is just too much for me to fathom right now.\n\n // If we start N independent walkers, one at each of the given `oids`, and walk backwards\n // through ancestors, eventually we'll discover a commit where each one of these N walkers\n // has passed through. So we just need to keep track of which walkers have visited each commit\n // until we find a commit that N distinct walkers has visited.\n const visits = {}\n const passes = oids.length\n let heads = oids.map((oid, index) => ({ index, oid }))\n while (heads.length) {\n // Count how many times we've passed each commit\n const result = new Set()\n for (const { oid, index } of heads) {\n if (!visits[oid]) visits[oid] = new Set()\n visits[oid].add(index)\n if (visits[oid].size === passes) {\n result.add(oid)\n }\n }\n if (result.size > 0) {\n return [...result]\n }\n // We haven't found a common ancestor yet\n const newheads = new Map()\n for (const { oid, index } of heads) {\n try {\n const { object } = await readObject({ fs, cache, gitdir, oid })\n const commit = GitCommit.from(object)\n const { parent } = commit.parseHeaders()\n for (const oid of parent) {\n if (!visits[oid] || !visits[oid].has(index)) {\n newheads.set(oid + ':' + index, { oid, index })\n }\n }\n } catch (err) {\n // do nothing\n }\n }\n heads = Array.from(newheads.values())\n }\n return []\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { _commit } from '../commands/commit'\nimport { _currentBranch } from '../commands/currentBranch.js'\nimport { _findMergeBase } from '../commands/findMergeBase.js'\nimport { FastForwardError } from '../errors/FastForwardError.js'\nimport { MergeConflictError } from '../errors/MergeConflictError.js'\nimport { MergeNotSupportedError } from '../errors/MergeNotSupportedError.js'\nimport { GitIndexManager } from '../managers/GitIndexManager.js'\nimport { GitRefManager } from '../managers/GitRefManager.js'\nimport { abbreviateRef } from '../utils/abbreviateRef.js'\nimport { mergeTree } from '../utils/mergeTree.js'\n\n// import diff3 from 'node-diff3'\n/**\n *\n * @typedef {Object} MergeResult - Returns an object with a schema like this:\n * @property {string} [oid] - The SHA-1 object id that is now at the head of the branch. Absent only if `dryRun` was specified and `mergeCommit` is true.\n * @property {boolean} [alreadyMerged] - True if the branch was already merged so no changes were made\n * @property {boolean} [fastForward] - True if it was a fast-forward merge\n * @property {boolean} [mergeCommit] - True if merge resulted in a merge commit\n * @property {string} [tree] - The SHA-1 object id of the tree resulting from a merge commit\n *\n */\n\n/**\n * @param {object} args\n * @param {import('../models/FileSystem.js').FileSystem} args.fs\n * @param {object} args.cache\n * @param {string} args.gitdir\n * @param {string} [args.ours]\n * @param {string} args.theirs\n * @param {boolean} args.fastForward\n * @param {boolean} args.fastForwardOnly\n * @param {boolean} args.dryRun\n * @param {boolean} args.noUpdateBranch\n * @param {boolean} args.abortOnConflict\n * @param {string} [args.message]\n * @param {Object} args.author\n * @param {string} args.author.name\n * @param {string} args.author.email\n * @param {number} args.author.timestamp\n * @param {number} args.author.timezoneOffset\n * @param {Object} args.committer\n * @param {string} args.committer.name\n * @param {string} args.committer.email\n * @param {number} args.committer.timestamp\n * @param {number} args.committer.timezoneOffset\n * @param {string} [args.signingKey]\n * @param {SignCallback} [args.onSign] - a PGP signing implementation\n * @param {MergeDriverCallback} [args.mergeDriver]\n *\n * @returns {Promise<MergeResult>} Resolves to a description of the merge operation\n *\n */\nexport async function _merge({\n fs,\n cache,\n dir,\n gitdir,\n ours,\n theirs,\n fastForward = true,\n fastForwardOnly = false,\n dryRun = false,\n noUpdateBranch = false,\n abortOnConflict = true,\n message,\n author,\n committer,\n signingKey,\n onSign,\n mergeDriver,\n}) {\n if (ours === undefined) {\n ours = await _currentBranch({ fs, gitdir, fullname: true })\n }\n ours = await GitRefManager.expand({\n fs,\n gitdir,\n ref: ours,\n })\n theirs = await GitRefManager.expand({\n fs,\n gitdir,\n ref: theirs,\n })\n const ourOid = await GitRefManager.resolve({\n fs,\n gitdir,\n ref: ours,\n })\n const theirOid = await GitRefManager.resolve({\n fs,\n gitdir,\n ref: theirs,\n })\n // find most recent common ancestor of ref a and ref b\n const baseOids = await _findMergeBase({\n fs,\n cache,\n gitdir,\n oids: [ourOid, theirOid],\n })\n if (baseOids.length !== 1) {\n // TODO: Recursive Merge strategy\n throw new MergeNotSupportedError()\n }\n const baseOid = baseOids[0]\n // handle fast-forward case\n if (baseOid === theirOid) {\n return {\n oid: ourOid,\n alreadyMerged: true,\n }\n }\n if (fastForward && baseOid === ourOid) {\n if (!dryRun && !noUpdateBranch) {\n await GitRefManager.writeRef({ fs, gitdir, ref: ours, value: theirOid })\n }\n return {\n oid: theirOid,\n fastForward: true,\n }\n } else {\n // not a simple fast-forward\n if (fastForwardOnly) {\n throw new FastForwardError()\n }\n // try a fancier merge\n const tree = await GitIndexManager.acquire(\n { fs, gitdir, cache, allowUnmerged: false },\n async index => {\n return mergeTree({\n fs,\n cache,\n dir,\n gitdir,\n index,\n ourOid,\n theirOid,\n baseOid,\n ourName: abbreviateRef(ours),\n baseName: 'base',\n theirName: abbreviateRef(theirs),\n dryRun,\n abortOnConflict,\n mergeDriver,\n })\n }\n )\n\n // Defer throwing error until the index lock is relinquished and index is\n // written to filsesystem\n if (tree instanceof MergeConflictError) throw tree\n\n if (!message) {\n message = `Merge branch '${abbreviateRef(theirs)}' into ${abbreviateRef(\n ours\n )}`\n }\n const oid = await _commit({\n fs,\n cache,\n gitdir,\n message,\n ref: ours,\n tree,\n parent: [ourOid, theirOid],\n author,\n committer,\n signingKey,\n onSign,\n dryRun,\n noUpdateBranch,\n })\n return {\n oid,\n tree,\n mergeCommit: true,\n }\n }\n}\n","// @ts-check\n\nimport { _checkout } from '../commands/checkout.js'\nimport { _currentBranch } from '../commands/currentBranch.js'\nimport { _fetch } from '../commands/fetch.js'\nimport { _merge } from '../commands/merge.js'\nimport { MissingParameterError } from '../errors/MissingParameterError.js'\n\n/**\n * @param {object} args\n * @param {import('../models/FileSystem.js').FileSystem} args.fs\n * @param {object} args.cache\n * @param {HttpClient} args.http\n * @param {ProgressCallback} [args.onProgress]\n * @param {MessageCallback} [args.onMessage]\n * @param {AuthCallback} [args.onAuth]\n * @param {AuthFailureCallback} [args.onAuthFailure]\n * @param {AuthSuccessCallback} [args.onAuthSuccess]\n * @param {string} args.dir\n * @param {string} args.gitdir\n * @param {string} args.ref\n * @param {string} [args.url]\n * @param {string} [args.remote]\n * @param {string} [args.remoteRef]\n * @param {boolean} [args.prune]\n * @param {boolean} [args.pruneTags]\n * @param {string} [args.corsProxy]\n * @param {boolean} args.singleBranch\n * @param {boolean} args.fastForward\n * @param {boolean} args.fastForwardOnly\n * @param {Object<string, string>} [args.headers]\n * @param {Object} args.author\n * @param {string} args.author.name\n * @param {string} args.author.email\n * @param {number} args.author.timestamp\n * @param {number} args.author.timezoneOffset\n * @param {Object} args.committer\n * @param {string} args.committer.name\n * @param {string} args.committer.email\n * @param {number} args.committer.timestamp\n * @param {number} args.committer.timezoneOffset\n * @param {string} [args.signingKey]\n *\n * @returns {Promise<void>} Resolves successfully when pull operation completes\n *\n */\nexport async function _pull({\n fs,\n cache,\n http,\n onProgress,\n onMessage,\n onAuth,\n onAuthSuccess,\n onAuthFailure,\n dir,\n gitdir,\n ref,\n url,\n remote,\n remoteRef,\n prune,\n pruneTags,\n fastForward,\n fastForwardOnly,\n corsProxy,\n singleBranch,\n headers,\n author,\n committer,\n signingKey,\n}) {\n try {\n // If ref is undefined, use 'HEAD'\n if (!ref) {\n const head = await _currentBranch({ fs, gitdir })\n // TODO: use a better error.\n if (!head) {\n throw new MissingParameterError('ref')\n }\n ref = head\n }\n\n const { fetchHead, fetchHeadDescription } = await _fetch({\n fs,\n cache,\n http,\n onProgress,\n onMessage,\n onAuth,\n onAuthSuccess,\n onAuthFailure,\n gitdir,\n corsProxy,\n ref,\n url,\n remote,\n remoteRef,\n singleBranch,\n headers,\n prune,\n pruneTags,\n })\n // Merge the remote tracking branch into the local one.\n await _merge({\n fs,\n cache,\n gitdir,\n ours: ref,\n theirs: fetchHead,\n fastForward,\n fastForwardOnly,\n message: `Merge ${fetchHeadDescription}`,\n author,\n committer,\n signingKey,\n dryRun: false,\n noUpdateBranch: false,\n })\n await _checkout({\n fs,\n cache,\n onProgress,\n dir,\n gitdir,\n ref,\n remote,\n noCheckout: false,\n })\n } catch (err) {\n err.caller = 'git.pull'\n throw err\n }\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { _pull } from '../commands/pull.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { assertParameter } from '../utils/assertParameter.js'\nimport { join } from '../utils/join.js'\n\n/**\n * Like `pull`, but hard-coded with `fastForward: true` so there is no need for an `author` parameter.\n *\n * @param {object} args\n * @param {FsClient} args.fs - a file system client\n * @param {HttpClient} args.http - an HTTP client\n * @param {ProgressCallback} [args.onProgress] - optional progress event callback\n * @param {MessageCallback} [args.onMessage] - optional message event callback\n * @param {AuthCallback} [args.onAuth] - optional auth fill callback\n * @param {AuthFailureCallback} [args.onAuthFailure] - optional auth rejected callback\n * @param {AuthSuccessCallback} [args.onAuthSuccess] - optional auth approved callback\n * @param {string} args.dir] - The [working tree](dir-vs-gitdir.md) directory path\n * @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path\n * @param {string} [args.ref] - Which branch to merge into. By default this is the currently checked out branch.\n * @param {string} [args.url] - (Added in 1.1.0) The URL of the remote repository. The default is the value set in the git config for that remote.\n * @param {string} [args.remote] - (Added in 1.1.0) If URL is not specified, determines which remote to use.\n * @param {string} [args.remoteRef] - (Added in 1.1.0) The name of the branch on the remote to fetch. By default this is the configured remote tracking branch.\n * @param {string} [args.corsProxy] - Optional [CORS proxy](https://www.npmjs.com/%40isomorphic-git/cors-proxy). Overrides value in repo config.\n * @param {boolean} [args.singleBranch = false] - Instead of the default behavior of fetching all the branches, only fetch a single branch.\n * @param {Object<string, string>} [args.headers] - Additional headers to include in HTTP requests, similar to git's `extraHeader` config\n * @param {object} [args.cache] - a [cache](cache.md) object\n *\n * @returns {Promise<void>} Resolves successfully when pull operation completes\n *\n * @example\n * await git.fastForward({\n * fs,\n * http,\n * dir: '/tutorial',\n * ref: 'main',\n * singleBranch: true\n * })\n * console.log('done')\n *\n */\nexport async function fastForward({\n fs,\n http,\n onProgress,\n onMessage,\n onAuth,\n onAuthSuccess,\n onAuthFailure,\n dir,\n gitdir = join(dir, '.git'),\n ref,\n url,\n remote,\n remoteRef,\n corsProxy,\n singleBranch,\n headers = {},\n cache = {},\n}) {\n try {\n assertParameter('fs', fs)\n assertParameter('http', http)\n assertParameter('gitdir', gitdir)\n\n const thisWillNotBeUsed = {\n name: '',\n email: '',\n timestamp: Date.now(),\n timezoneOffset: 0,\n }\n\n return await _pull({\n fs: new FileSystem(fs),\n cache,\n http,\n onProgress,\n onMessage,\n onAuth,\n onAuthSuccess,\n onAuthFailure,\n dir,\n gitdir,\n ref,\n url,\n remote,\n remoteRef,\n fastForwardOnly: true,\n corsProxy,\n singleBranch,\n headers,\n author: thisWillNotBeUsed,\n committer: thisWillNotBeUsed,\n })\n } catch (err) {\n err.caller = 'git.fastForward'\n throw err\n }\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { _fetch } from '../commands/fetch.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { assertParameter } from '../utils/assertParameter.js'\nimport { join } from '../utils/join.js'\n\n/**\n *\n * @typedef {object} FetchResult - The object returned has the following schema:\n * @property {string | null} defaultBranch - The branch that is cloned if no branch is specified\n * @property {string | null} fetchHead - The SHA-1 object id of the fetched head commit\n * @property {string | null} fetchHeadDescription - a textual description of the branch that was fetched\n * @property {Object<string, string>} [headers] - The HTTP response headers returned by the git server\n * @property {string[]} [pruned] - A list of branches that were pruned, if you provided the `prune` parameter\n *\n */\n\n/**\n * Fetch commits from a remote repository\n *\n * @param {object} args\n * @param {FsClient} args.fs - a file system client\n * @param {HttpClient} args.http - an HTTP client\n * @param {ProgressCallback} [args.onProgress] - optional progress event callback\n * @param {MessageCallback} [args.onMessage] - optional message event callback\n * @param {AuthCallback} [args.onAuth] - optional auth fill callback\n * @param {AuthFailureCallback} [args.onAuthFailure] - optional auth rejected callback\n * @param {AuthSuccessCallback} [args.onAuthSuccess] - optional auth approved callback\n * @param {string} [args.dir] - The [working tree](dir-vs-gitdir.md) directory path\n * @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path\n * @param {string} [args.url] - The URL of the remote repository. The default is the value set in the git config for that remote.\n * @param {string} [args.remote] - If URL is not specified, determines which remote to use.\n * @param {boolean} [args.singleBranch = false] - Instead of the default behavior of fetching all the branches, only fetch a single branch.\n * @param {string} [args.ref] - Which branch to fetch if `singleBranch` is true. By default this is the current branch or the remote's default branch.\n * @param {string} [args.remoteRef] - The name of the branch on the remote to fetch if `singleBranch` is true. By default this is the configured remote tracking branch.\n * @param {boolean} [args.tags = false] - Also fetch tags\n * @param {number} [args.depth] - Integer. Determines how much of the git repository's history to retrieve\n * @param {boolean} [args.relative = false] - Changes the meaning of `depth` to be measured from the current shallow depth rather than from the branch tip.\n * @param {Date} [args.since] - Only fetch commits created after the given date. Mutually exclusive with `depth`.\n * @param {string[]} [args.exclude = []] - A list of branches or tags. Instructs the remote server not to send us any commits reachable from these refs.\n * @param {boolean} [args.prune = false] - Delete local remote-tracking branches that are not present on the remote\n * @param {boolean} [args.pruneTags = false] - Prune local tags that don’t exist on the remote, and force-update those tags that differ\n * @param {string} [args.corsProxy] - Optional [CORS proxy](https://www.npmjs.com/%40isomorphic-git/cors-proxy). Overrides value in repo config.\n * @param {Object<string, string>} [args.headers] - Additional headers to include in HTTP requests, similar to git's `extraHeader` config\n * @param {object} [args.cache] - a [cache](cache.md) object\n *\n * @returns {Promise<FetchResult>} Resolves successfully when fetch completes\n * @see FetchResult\n *\n * @example\n * let result = await git.fetch({\n * fs,\n * http,\n * dir: '/tutorial',\n * corsProxy: 'https://cors.isomorphic-git.org',\n * url: 'https://github.com/isomorphic-git/isomorphic-git',\n * ref: 'main',\n * depth: 1,\n * singleBranch: true,\n * tags: false\n * })\n * console.log(result)\n *\n */\nexport async function fetch({\n fs,\n http,\n onProgress,\n onMessage,\n onAuth,\n onAuthSuccess,\n onAuthFailure,\n dir,\n gitdir = join(dir, '.git'),\n ref,\n remote,\n remoteRef,\n url,\n corsProxy,\n depth = null,\n since = null,\n exclude = [],\n relative = false,\n tags = false,\n singleBranch = false,\n headers = {},\n prune = false,\n pruneTags = false,\n cache = {},\n}) {\n try {\n assertParameter('fs', fs)\n assertParameter('http', http)\n assertParameter('gitdir', gitdir)\n\n return await _fetch({\n fs: new FileSystem(fs),\n cache,\n http,\n onProgress,\n onMessage,\n onAuth,\n onAuthSuccess,\n onAuthFailure,\n gitdir,\n ref,\n remote,\n remoteRef,\n url,\n corsProxy,\n depth,\n since,\n exclude,\n relative,\n tags,\n singleBranch,\n headers,\n prune,\n pruneTags,\n })\n } catch (err) {\n err.caller = 'git.fetch'\n throw err\n }\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { _findMergeBase } from '../commands/findMergeBase.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { assertParameter } from '../utils/assertParameter.js'\nimport { join } from '../utils/join.js'\n\n/**\n * Find the merge base for a set of commits\n *\n * @param {object} args\n * @param {FsClient} args.fs - a file system client\n * @param {string} [args.dir] - The [working tree](dir-vs-gitdir.md) directory path\n * @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path\n * @param {string[]} args.oids - Which commits\n * @param {object} [args.cache] - a [cache](cache.md) object\n *\n */\nexport async function findMergeBase({\n fs,\n dir,\n gitdir = join(dir, '.git'),\n oids,\n cache = {},\n}) {\n try {\n assertParameter('fs', fs)\n assertParameter('gitdir', gitdir)\n assertParameter('oids', oids)\n\n return await _findMergeBase({\n fs: new FileSystem(fs),\n cache,\n gitdir,\n oids,\n })\n } catch (err) {\n err.caller = 'git.findMergeBase'\n throw err\n }\n}\n","// @ts-check\nimport { NotFoundError } from '../errors/NotFoundError.js'\nimport { dirname } from '../utils/dirname.js'\nimport { join } from '../utils/join.js'\n\n/**\n * Find the root git directory\n *\n * Starting at `filepath`, walks upward until it finds a directory that contains a subdirectory called '.git'.\n *\n * @param {Object} args\n * @param {import('../models/FileSystem.js').FileSystem} args.fs\n * @param {string} args.filepath\n *\n * @returns {Promise<string>} Resolves successfully with a root git directory path\n */\nexport async function _findRoot({ fs, filepath }) {\n if (await fs.exists(join(filepath, '.git'))) {\n return filepath\n } else {\n const parent = dirname(filepath)\n if (parent === filepath) {\n throw new NotFoundError(`git root for ${filepath}`)\n }\n return _findRoot({ fs, filepath: parent })\n }\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { _findRoot } from '../commands/findRoot.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { assertParameter } from '../utils/assertParameter.js'\n\n/**\n * Find the root git directory\n *\n * Starting at `filepath`, walks upward until it finds a directory that contains a subdirectory called '.git'.\n *\n * @param {Object} args\n * @param {FsClient} args.fs - a file system client\n * @param {string} args.filepath - The file directory to start searching in.\n *\n * @returns {Promise<string>} Resolves successfully with a root git directory path\n * @throws {NotFoundError}\n *\n * @example\n * let gitroot = await git.findRoot({\n * fs,\n * filepath: '/tutorial/src/utils'\n * })\n * console.log(gitroot)\n *\n */\nexport async function findRoot({ fs, filepath }) {\n try {\n assertParameter('fs', fs)\n assertParameter('filepath', filepath)\n\n return await _findRoot({ fs: new FileSystem(fs), filepath })\n } catch (err) {\n err.caller = 'git.findRoot'\n throw err\n }\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { _getConfig } from '../commands/getConfig.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { assertParameter } from '../utils/assertParameter.js'\nimport { join } from '../utils/join.js'\n\n/**\n * Read an entry from the git config files.\n *\n * *Caveats:*\n * - Currently only the local `$GIT_DIR/config` file can be read or written. However support for the global `~/.gitconfig` and system `$(prefix)/etc/gitconfig` will be added in the future.\n * - The current parser does not support the more exotic features of the git-config file format such as `[include]` and `[includeIf]`.\n *\n * @param {Object} args\n * @param {FsClient} args.fs - a file system implementation\n * @param {string} [args.dir] - The [working tree](dir-vs-gitdir.md) directory path\n * @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path\n * @param {string} args.path - The key of the git config entry\n *\n * @returns {Promise<any>} Resolves with the config value\n *\n * @example\n * // Read config value\n * let value = await git.getConfig({\n * fs,\n * dir: '/tutorial',\n * path: 'remote.origin.url'\n * })\n * console.log(value)\n *\n */\nexport async function getConfig({ fs, dir, gitdir = join(dir, '.git'), path }) {\n try {\n assertParameter('fs', fs)\n assertParameter('gitdir', gitdir)\n assertParameter('path', path)\n\n return await _getConfig({\n fs: new FileSystem(fs),\n gitdir,\n path,\n })\n } catch (err) {\n err.caller = 'git.getConfig'\n throw err\n }\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { GitConfigManager } from '../managers/GitConfigManager.js'\n\n/**\n * @param {Object} args\n * @param {import('../models/FileSystem.js').FileSystem} args.fs\n * @param {string} args.gitdir\n * @param {string} args.path\n *\n * @returns {Promise<Array<any>>} Resolves with an array of the config value\n *\n */\nexport async function _getConfigAll({ fs, gitdir, path }) {\n const config = await GitConfigManager.get({ fs, gitdir })\n return config.getall(path)\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { _getConfigAll } from '../commands/getConfigAll.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { assertParameter } from '../utils/assertParameter.js'\nimport { join } from '../utils/join.js'\n\n/**\n * Read a multi-valued entry from the git config files.\n *\n * *Caveats:*\n * - Currently only the local `$GIT_DIR/config` file can be read or written. However support for the global `~/.gitconfig` and system `$(prefix)/etc/gitconfig` will be added in the future.\n * - The current parser does not support the more exotic features of the git-config file format such as `[include]` and `[includeIf]`.\n *\n * @param {Object} args\n * @param {FsClient} args.fs - a file system implementation\n * @param {string} [args.dir] - The [working tree](dir-vs-gitdir.md) directory path\n * @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path\n * @param {string} args.path - The key of the git config entry\n *\n * @returns {Promise<Array<any>>} Resolves with the config value\n *\n */\nexport async function getConfigAll({\n fs,\n dir,\n gitdir = join(dir, '.git'),\n path,\n}) {\n try {\n assertParameter('fs', fs)\n assertParameter('gitdir', gitdir)\n assertParameter('path', path)\n\n return await _getConfigAll({\n fs: new FileSystem(fs),\n gitdir,\n path,\n })\n } catch (err) {\n err.caller = 'git.getConfigAll'\n throw err\n }\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { GitRemoteManager } from '../managers/GitRemoteManager.js'\nimport { assertParameter } from '../utils/assertParameter.js'\n\n/**\n *\n * @typedef {Object} GetRemoteInfoResult - The object returned has the following schema:\n * @property {string[]} capabilities - The list of capabilities returned by the server (part of the Git protocol)\n * @property {Object} [refs]\n * @property {string} [HEAD] - The default branch of the remote\n * @property {Object<string, string>} [refs.heads] - The branches on the remote\n * @property {Object<string, string>} [refs.pull] - The special branches representing pull requests (non-standard)\n * @property {Object<string, string>} [refs.tags] - The tags on the remote\n *\n */\n\n/**\n * List a remote servers branches, tags, and capabilities.\n *\n * This is a rare command that doesn't require an `fs`, `dir`, or even `gitdir` argument.\n * It just communicates to a remote git server, using the first step of the `git-upload-pack` handshake, but stopping short of fetching the packfile.\n *\n * @param {object} args\n * @param {HttpClient} args.http - an HTTP client\n * @param {AuthCallback} [args.onAuth] - optional auth fill callback\n * @param {AuthFailureCallback} [args.onAuthFailure] - optional auth rejected callback\n * @param {AuthSuccessCallback} [args.onAuthSuccess] - optional auth approved callback\n * @param {string} args.url - The URL of the remote repository. Will be gotten from gitconfig if absent.\n * @param {string} [args.corsProxy] - Optional [CORS proxy](https://www.npmjs.com/%40isomorphic-git/cors-proxy). Overrides value in repo config.\n * @param {boolean} [args.forPush = false] - By default, the command queries the 'fetch' capabilities. If true, it will ask for the 'push' capabilities.\n * @param {Object<string, string>} [args.headers] - Additional headers to include in HTTP requests, similar to git's `extraHeader` config\n *\n * @returns {Promise<GetRemoteInfoResult>} Resolves successfully with an object listing the branches, tags, and capabilities of the remote.\n * @see GetRemoteInfoResult\n *\n * @example\n * let info = await git.getRemoteInfo({\n * http,\n * url:\n * \"https://cors.isomorphic-git.org/github.com/isomorphic-git/isomorphic-git.git\"\n * });\n * console.log(info);\n *\n */\nexport async function getRemoteInfo({\n http,\n onAuth,\n onAuthSuccess,\n onAuthFailure,\n corsProxy,\n url,\n headers = {},\n forPush = false,\n}) {\n try {\n assertParameter('http', http)\n assertParameter('url', url)\n\n const GitRemoteHTTP = GitRemoteManager.getRemoteHelperFor({ url })\n const remote = await GitRemoteHTTP.discover({\n http,\n onAuth,\n onAuthSuccess,\n onAuthFailure,\n corsProxy,\n service: forPush ? 'git-receive-pack' : 'git-upload-pack',\n url,\n headers,\n protocolVersion: 1,\n })\n\n // Note: remote.capabilities, remote.refs, and remote.symrefs are Set and Map objects,\n // but one of the objectives of the public API is to always return JSON-compatible objects\n // so we must JSONify them.\n const result = {\n capabilities: [...remote.capabilities],\n }\n // Convert the flat list into an object tree, because I figure 99% of the time\n // that will be easier to use.\n for (const [ref, oid] of remote.refs) {\n const parts = ref.split('/')\n const last = parts.pop()\n let o = result\n for (const part of parts) {\n o[part] = o[part] || {}\n o = o[part]\n }\n o[last] = oid\n }\n // Merge symrefs on top of refs to more closely match actual git repo layouts\n for (const [symref, ref] of remote.symrefs) {\n const parts = symref.split('/')\n const last = parts.pop()\n let o = result\n for (const part of parts) {\n o[part] = o[part] || {}\n o = o[part]\n }\n o[last] = ref\n }\n return result\n } catch (err) {\n err.caller = 'git.getRemoteInfo'\n throw err\n }\n}\n","// @ts-check\nimport '../typedefs.js'\n\n/**\n * @param {any} remote\n * @param {string} prefix\n * @param {boolean} symrefs\n * @param {boolean} peelTags\n * @returns {ServerRef[]}\n */\nexport function formatInfoRefs(remote, prefix, symrefs, peelTags) {\n const refs = []\n for (const [key, value] of remote.refs) {\n if (prefix && !key.startsWith(prefix)) continue\n\n if (key.endsWith('^{}')) {\n if (peelTags) {\n const _key = key.replace('^{}', '')\n // Peeled tags are almost always listed immediately after the original tag\n const last = refs[refs.length - 1]\n const r = last.ref === _key ? last : refs.find(x => x.ref === _key)\n if (r === undefined) {\n throw new Error('I did not expect this to happen')\n }\n r.peeled = value\n }\n continue\n }\n /** @type ServerRef */\n const ref = { ref: key, oid: value }\n if (symrefs) {\n if (remote.symrefs.has(key)) {\n ref.target = remote.symrefs.get(key)\n }\n }\n refs.push(ref)\n }\n return refs\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { GitRemoteManager } from '../managers/GitRemoteManager.js'\nimport { assertParameter } from '../utils/assertParameter.js'\nimport { formatInfoRefs } from '../utils/formatInfoRefs.js'\n\n/**\n * @typedef {Object} GetRemoteInfo2Result - This object has the following schema:\n * @property {1 | 2} protocolVersion - Git protocol version the server supports\n * @property {Object<string, string | true>} capabilities - An object of capabilities represented as keys and values\n * @property {ServerRef[]} [refs] - Server refs (they get returned by protocol version 1 whether you want them or not)\n */\n\n/**\n * List a remote server's capabilities.\n *\n * This is a rare command that doesn't require an `fs`, `dir`, or even `gitdir` argument.\n * It just communicates to a remote git server, determining what protocol version, commands, and features it supports.\n *\n * > The successor to [`getRemoteInfo`](./getRemoteInfo.md), this command supports Git Wire Protocol Version 2.\n * > Therefore its return type is more complicated as either:\n * >\n * > - v1 capabilities (and refs) or\n * > - v2 capabilities (and no refs)\n * >\n * > are returned.\n * > If you just care about refs, use [`listServerRefs`](./listServerRefs.md)\n *\n * @param {object} args\n * @param {HttpClient} args.http - an HTTP client\n * @param {AuthCallback} [args.onAuth] - optional auth fill callback\n * @param {AuthFailureCallback} [args.onAuthFailure] - optional auth rejected callback\n * @param {AuthSuccessCallback} [args.onAuthSuccess] - optional auth approved callback\n * @param {string} args.url - The URL of the remote repository. Will be gotten from gitconfig if absent.\n * @param {string} [args.corsProxy] - Optional [CORS proxy](https://www.npmjs.com/%40isomorphic-git/cors-proxy). Overrides value in repo config.\n * @param {boolean} [args.forPush = false] - By default, the command queries the 'fetch' capabilities. If true, it will ask for the 'push' capabilities.\n * @param {Object<string, string>} [args.headers] - Additional headers to include in HTTP requests, similar to git's `extraHeader` config\n * @param {1 | 2} [args.protocolVersion = 2] - Which version of the Git Protocol to use.\n *\n * @returns {Promise<GetRemoteInfo2Result>} Resolves successfully with an object listing the capabilities of the remote.\n * @see GetRemoteInfo2Result\n * @see ServerRef\n *\n * @example\n * let info = await git.getRemoteInfo2({\n * http,\n * corsProxy: \"https://cors.isomorphic-git.org\",\n * url: \"https://github.com/isomorphic-git/isomorphic-git.git\"\n * });\n * console.log(info);\n *\n */\nexport async function getRemoteInfo2({\n http,\n onAuth,\n onAuthSuccess,\n onAuthFailure,\n corsProxy,\n url,\n headers = {},\n forPush = false,\n protocolVersion = 2,\n}) {\n try {\n assertParameter('http', http)\n assertParameter('url', url)\n\n const GitRemoteHTTP = GitRemoteManager.getRemoteHelperFor({ url })\n const remote = await GitRemoteHTTP.discover({\n http,\n onAuth,\n onAuthSuccess,\n onAuthFailure,\n corsProxy,\n service: forPush ? 'git-receive-pack' : 'git-upload-pack',\n url,\n headers,\n protocolVersion,\n })\n\n if (remote.protocolVersion === 2) {\n /** @type GetRemoteInfo2Result */\n return {\n protocolVersion: remote.protocolVersion,\n capabilities: remote.capabilities2,\n }\n }\n\n // Note: remote.capabilities, remote.refs, and remote.symrefs are Set and Map objects,\n // but one of the objectives of the public API is to always return JSON-compatible objects\n // so we must JSONify them.\n /** @type Object<string, true> */\n const capabilities = {}\n for (const cap of remote.capabilities) {\n const [key, value] = cap.split('=')\n if (value) {\n capabilities[key] = value\n } else {\n capabilities[key] = true\n }\n }\n /** @type GetRemoteInfo2Result */\n return {\n protocolVersion: 1,\n capabilities,\n refs: formatInfoRefs(remote, undefined, true, true),\n }\n } catch (err) {\n err.caller = 'git.getRemoteInfo2'\n throw err\n }\n}\n","// @ts-check\nimport { GitPackIndex } from '../models/GitPackIndex.js'\nimport { _readObject as readObject } from '../storage/readObject.js'\nimport { join } from '../utils/join.js'\n\n/**\n * @param {object} args\n * @param {import('../models/FileSystem.js').FileSystem} args.fs\n * @param {any} args.cache\n * @param {ProgressCallback} [args.onProgress]\n * @param {string} args.dir\n * @param {string} args.gitdir\n * @param {string} args.filepath\n *\n * @returns {Promise<{oids: string[]}>}\n */\nexport async function _indexPack({\n fs,\n cache,\n onProgress,\n dir,\n gitdir,\n filepath,\n}) {\n try {\n filepath = join(dir, filepath)\n const pack = await fs.read(filepath)\n const getExternalRefDelta = oid => readObject({ fs, cache, gitdir, oid })\n const idx = await GitPackIndex.fromPack({\n pack,\n getExternalRefDelta,\n onProgress,\n })\n await fs.write(filepath.replace(/\\.pack$/, '.idx'), await idx.toBuffer())\n return {\n oids: [...idx.hashes],\n }\n } catch (err) {\n err.caller = 'git.indexPack'\n throw err\n }\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { _indexPack } from '../commands/indexPack.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { assertParameter } from '../utils/assertParameter.js'\nimport { join } from '../utils/join.js'\n\n/**\n * Create the .idx file for a given .pack file\n *\n * @param {object} args\n * @param {FsClient} args.fs - a file system client\n * @param {ProgressCallback} [args.onProgress] - optional progress event callback\n * @param {string} args.dir - The [working tree](dir-vs-gitdir.md) directory path\n * @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path\n * @param {string} args.filepath - The path to the .pack file to index\n * @param {object} [args.cache] - a [cache](cache.md) object\n *\n * @returns {Promise<{oids: string[]}>} Resolves with a list of the SHA-1 object ids contained in the packfile\n *\n * @example\n * let packfiles = await fs.promises.readdir('/tutorial/.git/objects/pack')\n * packfiles = packfiles.filter(name => name.endsWith('.pack'))\n * console.log('packfiles', packfiles)\n *\n * const { oids } = await git.indexPack({\n * fs,\n * dir: '/tutorial',\n * filepath: `.git/objects/pack/${packfiles[0]}`,\n * async onProgress (evt) {\n * console.log(`${evt.phase}: ${evt.loaded} / ${evt.total}`)\n * }\n * })\n * console.log(oids)\n *\n */\nexport async function indexPack({\n fs,\n onProgress,\n dir,\n gitdir = join(dir, '.git'),\n filepath,\n cache = {},\n}) {\n try {\n assertParameter('fs', fs)\n assertParameter('dir', dir)\n assertParameter('gitdir', dir)\n assertParameter('filepath', filepath)\n\n return await _indexPack({\n fs: new FileSystem(fs),\n cache,\n onProgress,\n dir,\n gitdir,\n filepath,\n })\n } catch (err) {\n err.caller = 'git.indexPack'\n throw err\n }\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { _init } from '../commands/init.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { assertParameter } from '../utils/assertParameter.js'\nimport { join } from '../utils/join.js'\n\n/**\n * Initialize a new repository\n *\n * @param {object} args\n * @param {FsClient} args.fs - a file system client\n * @param {string} [args.dir] - The [working tree](dir-vs-gitdir.md) directory path\n * @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path\n * @param {boolean} [args.bare = false] - Initialize a bare repository\n * @param {string} [args.defaultBranch = 'master'] - The name of the default branch (might be changed to a required argument in 2.0.0)\n * @returns {Promise<void>} Resolves successfully when filesystem operations are complete\n *\n * @example\n * await git.init({ fs, dir: '/tutorial' })\n * console.log('done')\n *\n */\nexport async function init({\n fs,\n bare = false,\n dir,\n gitdir = bare ? dir : join(dir, '.git'),\n defaultBranch = 'master',\n}) {\n try {\n assertParameter('fs', fs)\n assertParameter('gitdir', gitdir)\n if (!bare) {\n assertParameter('dir', dir)\n }\n\n return await _init({\n fs: new FileSystem(fs),\n bare,\n dir,\n gitdir,\n defaultBranch,\n })\n } catch (err) {\n err.caller = 'git.init'\n throw err\n }\n}\n","// @ts-check\nimport { MaxDepthError } from '../errors/MaxDepthError.js'\nimport { MissingParameterError } from '../errors/MissingParameterError.js'\nimport { ObjectTypeError } from '../errors/ObjectTypeError.js'\nimport { GitShallowManager } from '../managers/GitShallowManager.js'\nimport { GitCommit } from '../models/GitCommit.js'\nimport { _readObject } from '../storage/readObject.js'\n\n/**\n * @param {object} args\n * @param {import('../models/FileSystem.js').FileSystem} args.fs\n * @param {any} args.cache\n * @param {string} args.gitdir\n * @param {string} args.oid\n * @param {string} args.ancestor\n * @param {number} args.depth - Maximum depth to search before giving up. -1 means no maximum depth.\n *\n * @returns {Promise<boolean>}\n */\nexport async function _isDescendent({\n fs,\n cache,\n gitdir,\n oid,\n ancestor,\n depth,\n}) {\n const shallows = await GitShallowManager.read({ fs, gitdir })\n if (!oid) {\n throw new MissingParameterError('oid')\n }\n if (!ancestor) {\n throw new MissingParameterError('ancestor')\n }\n // If you don't like this behavior, add your own check.\n // Edge cases are hard to define a perfect solution.\n if (oid === ancestor) return false\n // We do not use recursion here, because that would lead to depth-first traversal,\n // and we want to maintain a breadth-first traversal to avoid hitting shallow clone depth cutoffs.\n const queue = [oid]\n const visited = new Set()\n let searchdepth = 0\n while (queue.length) {\n if (searchdepth++ === depth) {\n throw new MaxDepthError(depth)\n }\n const oid = queue.shift()\n const { type, object } = await _readObject({\n fs,\n cache,\n gitdir,\n oid,\n })\n if (type !== 'commit') {\n throw new ObjectTypeError(oid, type, 'commit')\n }\n const commit = GitCommit.from(object).parse()\n // Are any of the parents the sought-after ancestor?\n for (const parent of commit.parent) {\n if (parent === ancestor) return true\n }\n // If not, add them to heads (unless we know this is a shallow commit)\n if (!shallows.has(oid)) {\n for (const parent of commit.parent) {\n if (!visited.has(parent)) {\n queue.push(parent)\n visited.add(parent)\n }\n }\n }\n // Eventually, we'll travel entire tree to the roots where all the parents are empty arrays,\n // or hit the shallow depth and throw an error. Excluding the possibility of grafts, or\n // different branches cloned to different depths, you would hit this error at the same time\n // for all parents, so trying to continue is futile.\n }\n return false\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { _isDescendent } from '../commands/isDescendent.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { assertParameter } from '../utils/assertParameter.js'\nimport { join } from '../utils/join.js'\n\n/**\n * Check whether a git commit is descended from another\n *\n * @param {object} args\n * @param {FsClient} args.fs - a file system client\n * @param {string} [args.dir] - The [working tree](dir-vs-gitdir.md) directory path\n * @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path\n * @param {string} args.oid - The descendent commit\n * @param {string} args.ancestor - The (proposed) ancestor commit\n * @param {number} [args.depth = -1] - Maximum depth to search before giving up. -1 means no maximum depth.\n * @param {object} [args.cache] - a [cache](cache.md) object\n *\n * @returns {Promise<boolean>} Resolves to true if `oid` is a descendent of `ancestor`\n *\n * @example\n * let oid = await git.resolveRef({ fs, dir: '/tutorial', ref: 'main' })\n * let ancestor = await git.resolveRef({ fs, dir: '/tutorial', ref: 'v0.20.0' })\n * console.log(oid, ancestor)\n * await git.isDescendent({ fs, dir: '/tutorial', oid, ancestor, depth: -1 })\n *\n */\nexport async function isDescendent({\n fs,\n dir,\n gitdir = join(dir, '.git'),\n oid,\n ancestor,\n depth = -1,\n cache = {},\n}) {\n try {\n assertParameter('fs', fs)\n assertParameter('gitdir', gitdir)\n assertParameter('oid', oid)\n assertParameter('ancestor', ancestor)\n\n return await _isDescendent({\n fs: new FileSystem(fs),\n cache,\n gitdir,\n oid,\n ancestor,\n depth,\n })\n } catch (err) {\n err.caller = 'git.isDescendent'\n throw err\n }\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { GitIgnoreManager } from '../managers/GitIgnoreManager.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { assertParameter } from '../utils/assertParameter.js'\nimport { join } from '../utils/join.js'\n\n/**\n * Test whether a filepath should be ignored (because of .gitignore or .git/exclude)\n *\n * @param {object} args\n * @param {FsClient} args.fs - a file system client\n * @param {string} args.dir - The [working tree](dir-vs-gitdir.md) directory path\n * @param {string} [args.gitdir=join(dir, '.git')] - [required] The [git directory](dir-vs-gitdir.md) path\n * @param {string} args.filepath - The filepath to test\n *\n * @returns {Promise<boolean>} Resolves to true if the file should be ignored\n *\n * @example\n * await git.isIgnored({ fs, dir: '/tutorial', filepath: 'docs/add.md' })\n *\n */\nexport async function isIgnored({\n fs,\n dir,\n gitdir = join(dir, '.git'),\n filepath,\n}) {\n try {\n assertParameter('fs', fs)\n assertParameter('dir', dir)\n assertParameter('gitdir', gitdir)\n assertParameter('filepath', filepath)\n\n return GitIgnoreManager.isIgnored({\n fs: new FileSystem(fs),\n dir,\n gitdir,\n filepath,\n })\n } catch (err) {\n err.caller = 'git.isIgnored'\n throw err\n }\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { GitRefManager } from '../managers/GitRefManager.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { assertParameter } from '../utils/assertParameter.js'\nimport { join } from '../utils/join.js'\n\n/**\n * List branches\n *\n * By default it lists local branches. If a 'remote' is specified, it lists the remote's branches. When listing remote branches, the HEAD branch is not filtered out, so it may be included in the list of results.\n *\n * Note that specifying a remote does not actually contact the server and update the list of branches.\n * If you want an up-to-date list, first do a `fetch` to that remote.\n * (Which branch you fetch doesn't matter - the list of branches available on the remote is updated during the fetch handshake.)\n *\n * Also note, that a branch is a reference to a commit. If you initialize a new repository it has no commits, so the\n * `listBranches` function will return an empty list, until you create the first commit.\n *\n * @param {object} args\n * @param {FsClient} args.fs - a file system client\n * @param {string} [args.dir] - The [working tree](dir-vs-gitdir.md) directory path\n * @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path\n * @param {string} [args.remote] - Instead of the branches in `refs/heads`, list the branches in `refs/remotes/${remote}`.\n *\n * @returns {Promise<Array<string>>} Resolves successfully with an array of branch names\n *\n * @example\n * let branches = await git.listBranches({ fs, dir: '/tutorial' })\n * console.log(branches)\n * let remoteBranches = await git.listBranches({ fs, dir: '/tutorial', remote: 'origin' })\n * console.log(remoteBranches)\n *\n */\nexport async function listBranches({\n fs,\n dir,\n gitdir = join(dir, '.git'),\n remote,\n}) {\n try {\n assertParameter('fs', fs)\n assertParameter('gitdir', gitdir)\n\n return GitRefManager.listBranches({\n fs: new FileSystem(fs),\n gitdir,\n remote,\n })\n } catch (err) {\n err.caller = 'git.listBranches'\n throw err\n }\n}\n","// @ts-check\nimport { _readTree } from '../commands/readTree'\nimport { GitIndexManager } from '../managers/GitIndexManager.js'\nimport { GitRefManager } from '../managers/GitRefManager.js'\nimport { join } from '../utils/join'\n\n/**\n * @param {object} args\n * @param {import('../models/FileSystem.js').FileSystem} args.fs\n * @param {object} args.cache\n * @param {string} args.gitdir\n * @param {string} [args.ref]\n *\n * @returns {Promise<Array<string>>}\n */\nexport async function _listFiles({ fs, gitdir, ref, cache }) {\n if (ref) {\n const oid = await GitRefManager.resolve({ gitdir, fs, ref })\n const filenames = []\n await accumulateFilesFromOid({\n fs,\n cache,\n gitdir,\n oid,\n filenames,\n prefix: '',\n })\n return filenames\n } else {\n return GitIndexManager.acquire({ fs, gitdir, cache }, async function(\n index\n ) {\n return index.entries.map(x => x.path)\n })\n }\n}\n\nasync function accumulateFilesFromOid({\n fs,\n cache,\n gitdir,\n oid,\n filenames,\n prefix,\n}) {\n const { tree } = await _readTree({ fs, cache, gitdir, oid })\n // TODO: Use `walk` to do this. Should be faster.\n for (const entry of tree) {\n if (entry.type === 'tree') {\n await accumulateFilesFromOid({\n fs,\n cache,\n gitdir,\n oid: entry.oid,\n filenames,\n prefix: join(prefix, entry.path),\n })\n } else {\n filenames.push(join(prefix, entry.path))\n }\n }\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { _listFiles } from '../commands/listFiles'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { assertParameter } from '../utils/assertParameter.js'\nimport { join } from '../utils/join'\n\n/**\n * List all the files in the git index or a commit\n *\n * > Note: This function is efficient for listing the files in the staging area, but listing all the files in a commit requires recursively walking through the git object store.\n * > If you do not require a complete list of every file, better performance can be achieved by using [walk](./walk) and ignoring subdirectories you don't care about.\n *\n * @param {object} args\n * @param {FsClient} args.fs - a file system client\n * @param {string} [args.dir] - The [working tree](dir-vs-gitdir.md) directory path\n * @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path\n * @param {string} [args.ref] - Return a list of all the files in the commit at `ref` instead of the files currently in the git index (aka staging area)\n * @param {object} [args.cache] - a [cache](cache.md) object\n *\n * @returns {Promise<Array<string>>} Resolves successfully with an array of filepaths\n *\n * @example\n * // All the files in the previous commit\n * let files = await git.listFiles({ fs, dir: '/tutorial', ref: 'HEAD' })\n * console.log(files)\n * // All the files in the current staging area\n * files = await git.listFiles({ fs, dir: '/tutorial' })\n * console.log(files)\n *\n */\nexport async function listFiles({\n fs,\n dir,\n gitdir = join(dir, '.git'),\n ref,\n cache = {},\n}) {\n try {\n assertParameter('fs', fs)\n assertParameter('gitdir', gitdir)\n\n return await _listFiles({\n fs: new FileSystem(fs),\n cache,\n gitdir,\n ref,\n })\n } catch (err) {\n err.caller = 'git.listFiles'\n throw err\n }\n}\n","// @ts-check\nimport { _readTree } from '../commands/readTree'\nimport { NotFoundError } from '../errors/NotFoundError.js'\nimport { GitRefManager } from '../managers/GitRefManager.js'\n\n/**\n * List all the object notes\n *\n * @param {object} args\n * @param {import('../models/FileSystem.js').FileSystem} args.fs\n * @param {any} args.cache\n * @param {string} args.gitdir\n * @param {string} args.ref\n *\n * @returns {Promise<Array<{target: string, note: string}>>}\n */\n\nexport async function _listNotes({ fs, cache, gitdir, ref }) {\n // Get the current note commit\n let parent\n try {\n parent = await GitRefManager.resolve({ gitdir, fs, ref })\n } catch (err) {\n if (err instanceof NotFoundError) {\n return []\n }\n }\n\n // Create the current note tree\n const result = await _readTree({\n fs,\n cache,\n gitdir,\n oid: parent,\n })\n\n // Format the tree entries\n const notes = result.tree.map(entry => ({\n target: entry.path,\n note: entry.oid,\n }))\n return notes\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { _listNotes } from '../commands/listNotes.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { assertParameter } from '../utils/assertParameter.js'\nimport { join } from '../utils/join'\n\n/**\n * List all the object notes\n *\n * @param {object} args\n * @param {FsClient} args.fs - a file system client\n * @param {string} [args.dir] - The [working tree](dir-vs-gitdir.md) directory path\n * @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path\n * @param {string} [args.ref] - The notes ref to look under\n * @param {object} [args.cache] - a [cache](cache.md) object\n *\n * @returns {Promise<Array<{target: string, note: string}>>} Resolves successfully with an array of entries containing SHA-1 object ids of the note and the object the note targets\n */\n\nexport async function listNotes({\n fs,\n dir,\n gitdir = join(dir, '.git'),\n ref = 'refs/notes/commits',\n cache = {},\n}) {\n try {\n assertParameter('fs', fs)\n assertParameter('gitdir', gitdir)\n assertParameter('ref', ref)\n\n return await _listNotes({\n fs: new FileSystem(fs),\n cache,\n gitdir,\n ref,\n })\n } catch (err) {\n err.caller = 'git.listNotes'\n throw err\n }\n}\n","// @ts-check\nimport { GitConfigManager } from '../managers/GitConfigManager.js'\n\n/**\n * @param {object} args\n * @param {import('../models/FileSystem.js').FileSystem} args.fs\n * @param {string} args.gitdir\n *\n * @returns {Promise<Array<{remote: string, url: string}>>}\n */\nexport async function _listRemotes({ fs, gitdir }) {\n const config = await GitConfigManager.get({ fs, gitdir })\n const remoteNames = await config.getSubsections('remote')\n const remotes = Promise.all(\n remoteNames.map(async remote => {\n const url = await config.get(`remote.${remote}.url`)\n return { remote, url }\n })\n )\n return remotes\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { _listRemotes } from '../commands/listRemotes.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { assertParameter } from '../utils/assertParameter.js'\nimport { join } from '../utils/join.js'\n\n/**\n * List remotes\n *\n * @param {object} args\n * @param {FsClient} args.fs - a file system client\n * @param {string} [args.dir] - The [working tree](dir-vs-gitdir.md) directory path\n * @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path\n *\n * @returns {Promise<Array<{remote: string, url: string}>>} Resolves successfully with an array of `{remote, url}` objects\n *\n * @example\n * let remotes = await git.listRemotes({ fs, dir: '/tutorial' })\n * console.log(remotes)\n *\n */\nexport async function listRemotes({ fs, dir, gitdir = join(dir, '.git') }) {\n try {\n assertParameter('fs', fs)\n assertParameter('gitdir', gitdir)\n\n return await _listRemotes({\n fs: new FileSystem(fs),\n gitdir,\n })\n } catch (err) {\n err.caller = 'git.listRemotes'\n throw err\n }\n}\n","import { GitPktLine } from '../models/GitPktLine.js'\n\n/**\n * @typedef {Object} ServerRef - This object has the following schema:\n * @property {string} ref - The name of the ref\n * @property {string} oid - The SHA-1 object id the ref points to\n * @property {string} [target] - The target ref pointed to by a symbolic ref\n * @property {string} [peeled] - If the oid is the SHA-1 object id of an annotated tag, this is the SHA-1 object id that the annotated tag points to\n */\n\nexport async function parseListRefsResponse(stream) {\n const read = GitPktLine.streamReader(stream)\n\n // TODO: when we re-write everything to minimize memory usage,\n // we could make this a generator\n const refs = []\n\n let line\n while (true) {\n line = await read()\n if (line === true) break\n if (line === null) continue\n line = line.toString('utf8').replace(/\\n$/, '')\n const [oid, ref, ...attrs] = line.split(' ')\n const r = { ref, oid }\n for (const attr of attrs) {\n const [name, value] = attr.split(':')\n if (name === 'symref-target') {\n r.target = value\n } else if (name === 'peeled') {\n r.peeled = value\n }\n }\n refs.push(r)\n }\n\n return refs\n}\n","import { GitPktLine } from '../models/GitPktLine.js'\nimport { pkg } from '../utils/pkg.js'\n\n/**\n * @param {object} args\n * @param {string} [args.prefix] - Only list refs that start with this prefix\n * @param {boolean} [args.symrefs = false] - Include symbolic ref targets\n * @param {boolean} [args.peelTags = false] - Include peeled tags values\n * @returns {Uint8Array[]}\n */\nexport async function writeListRefsRequest({ prefix, symrefs, peelTags }) {\n const packstream = []\n // command\n packstream.push(GitPktLine.encode('command=ls-refs\\n'))\n // capability-list\n packstream.push(GitPktLine.encode(`agent=${pkg.agent}\\n`))\n // [command-args]\n if (peelTags || symrefs || prefix) {\n packstream.push(GitPktLine.delim())\n }\n if (peelTags) packstream.push(GitPktLine.encode('peel'))\n if (symrefs) packstream.push(GitPktLine.encode('symrefs'))\n if (prefix) packstream.push(GitPktLine.encode(`ref-prefix ${prefix}`))\n packstream.push(GitPktLine.flush())\n return packstream\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { GitRemoteHTTP } from '../managers/GitRemoteHTTP.js'\nimport { assertParameter } from '../utils/assertParameter.js'\nimport { formatInfoRefs } from '../utils/formatInfoRefs.js'\nimport { parseListRefsResponse } from '../wire/parseListRefsResponse.js'\nimport { writeListRefsRequest } from '../wire/writeListRefsRequest.js'\n\n/**\n * Fetch a list of refs (branches, tags, etc) from a server.\n *\n * This is a rare command that doesn't require an `fs`, `dir`, or even `gitdir` argument.\n * It just requires an `http` argument.\n *\n * ### About `protocolVersion`\n *\n * There's a rather fun trade-off between Git Protocol Version 1 and Git Protocol Version 2.\n * Version 2 actually requires 2 HTTP requests instead of 1, making it similar to fetch or push in that regard.\n * However, version 2 supports server-side filtering by prefix, whereas that filtering is done client-side in version 1.\n * Which protocol is most efficient therefore depends on the number of refs on the remote, the latency of the server, and speed of the network connection.\n * For an small repos (or fast Internet connections), the requirement to make two trips to the server makes protocol 2 slower.\n * But for large repos (or slow Internet connections), the decreased payload size of the second request makes up for the additional request.\n *\n * Hard numbers vary by situation, but here's some numbers from my machine:\n *\n * Using isomorphic-git in a browser, with a CORS proxy, listing only the branches (refs/heads) of https://github.com/isomorphic-git/isomorphic-git\n * - Protocol Version 1 took ~300ms and transfered 84 KB.\n * - Protocol Version 2 took ~500ms and transfered 4.1 KB.\n *\n * Using isomorphic-git in a browser, with a CORS proxy, listing only the branches (refs/heads) of https://gitlab.com/gitlab-org/gitlab\n * - Protocol Version 1 took ~4900ms and transfered 9.41 MB.\n * - Protocol Version 2 took ~1280ms and transfered 433 KB.\n *\n * Finally, there is a fun quirk regarding the `symrefs` parameter.\n * Protocol Version 1 will generally only return the `HEAD` symref and not others.\n * Historically, this meant that servers don't use symbolic refs except for `HEAD`, which is used to point at the \"default branch\".\n * However Protocol Version 2 can return *all* the symbolic refs on the server.\n * So if you are running your own git server, you could take advantage of that I guess.\n *\n * #### TL;DR\n * If you are _not_ taking advantage of `prefix` I would recommend `protocolVersion: 1`.\n * Otherwise, I recommend to use the default which is `protocolVersion: 2`.\n *\n * @param {object} args\n * @param {HttpClient} args.http - an HTTP client\n * @param {AuthCallback} [args.onAuth] - optional auth fill callback\n * @param {AuthFailureCallback} [args.onAuthFailure] - optional auth rejected callback\n * @param {AuthSuccessCallback} [args.onAuthSuccess] - optional auth approved callback\n * @param {string} args.url - The URL of the remote repository. Will be gotten from gitconfig if absent.\n * @param {string} [args.corsProxy] - Optional [CORS proxy](https://www.npmjs.com/%40isomorphic-git/cors-proxy). Overrides value in repo config.\n * @param {boolean} [args.forPush = false] - By default, the command queries the 'fetch' capabilities. If true, it will ask for the 'push' capabilities.\n * @param {Object<string, string>} [args.headers] - Additional headers to include in HTTP requests, similar to git's `extraHeader` config\n * @param {1 | 2} [args.protocolVersion = 2] - Which version of the Git Protocol to use.\n * @param {string} [args.prefix] - Only list refs that start with this prefix\n * @param {boolean} [args.symrefs = false] - Include symbolic ref targets\n * @param {boolean} [args.peelTags = false] - Include annotated tag peeled targets\n *\n * @returns {Promise<ServerRef[]>} Resolves successfully with an array of ServerRef objects\n * @see ServerRef\n *\n * @example\n * // List all the branches on a repo\n * let refs = await git.listServerRefs({\n * http,\n * corsProxy: \"https://cors.isomorphic-git.org\",\n * url: \"https://github.com/isomorphic-git/isomorphic-git.git\",\n * prefix: \"refs/heads/\",\n * });\n * console.log(refs);\n *\n * @example\n * // Get the default branch on a repo\n * let refs = await git.listServerRefs({\n * http,\n * corsProxy: \"https://cors.isomorphic-git.org\",\n * url: \"https://github.com/isomorphic-git/isomorphic-git.git\",\n * prefix: \"HEAD\",\n * symrefs: true,\n * });\n * console.log(refs);\n *\n * @example\n * // List all the tags on a repo\n * let refs = await git.listServerRefs({\n * http,\n * corsProxy: \"https://cors.isomorphic-git.org\",\n * url: \"https://github.com/isomorphic-git/isomorphic-git.git\",\n * prefix: \"refs/tags/\",\n * peelTags: true,\n * });\n * console.log(refs);\n *\n * @example\n * // List all the pull requests on a repo\n * let refs = await git.listServerRefs({\n * http,\n * corsProxy: \"https://cors.isomorphic-git.org\",\n * url: \"https://github.com/isomorphic-git/isomorphic-git.git\",\n * prefix: \"refs/pull/\",\n * });\n * console.log(refs);\n *\n */\nexport async function listServerRefs({\n http,\n onAuth,\n onAuthSuccess,\n onAuthFailure,\n corsProxy,\n url,\n headers = {},\n forPush = false,\n protocolVersion = 2,\n prefix,\n symrefs,\n peelTags,\n}) {\n try {\n assertParameter('http', http)\n assertParameter('url', url)\n\n const remote = await GitRemoteHTTP.discover({\n http,\n onAuth,\n onAuthSuccess,\n onAuthFailure,\n corsProxy,\n service: forPush ? 'git-receive-pack' : 'git-upload-pack',\n url,\n headers,\n protocolVersion,\n })\n\n if (remote.protocolVersion === 1) {\n return formatInfoRefs(remote, prefix, symrefs, peelTags)\n }\n\n // Protocol Version 2\n const body = await writeListRefsRequest({ prefix, symrefs, peelTags })\n\n const res = await GitRemoteHTTP.connect({\n http,\n auth: remote.auth,\n headers,\n corsProxy,\n service: forPush ? 'git-receive-pack' : 'git-upload-pack',\n url,\n body,\n })\n\n return parseListRefsResponse(res.body)\n } catch (err) {\n err.caller = 'git.listServerRefs'\n throw err\n }\n}\n","// @ts-check\nimport { GitRefManager } from '../managers/GitRefManager.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { assertParameter } from '../utils/assertParameter.js'\nimport { join } from '../utils/join.js'\n\n/**\n * List tags\n *\n * @param {object} args\n * @param {FsClient} args.fs - a file system client\n * @param {string} [args.dir] - The [working tree](dir-vs-gitdir.md) directory path\n * @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path\n *\n * @returns {Promise<Array<string>>} Resolves successfully with an array of tag names\n *\n * @example\n * let tags = await git.listTags({ fs, dir: '/tutorial' })\n * console.log(tags)\n *\n */\nexport async function listTags({ fs, dir, gitdir = join(dir, '.git') }) {\n try {\n assertParameter('fs', fs)\n assertParameter('gitdir', gitdir)\n return GitRefManager.listTags({ fs: new FileSystem(fs), gitdir })\n } catch (err) {\n err.caller = 'git.listTags'\n throw err\n }\n}\n","import { ObjectTypeError } from '../errors/ObjectTypeError.js'\nimport { GitAnnotatedTag } from '../models/GitAnnotatedTag.js'\nimport { GitCommit } from '../models/GitCommit.js'\nimport { _readObject as readObject } from '../storage/readObject.js'\n\nexport async function resolveCommit({ fs, cache, gitdir, oid }) {\n const { type, object } = await readObject({ fs, cache, gitdir, oid })\n // Resolve annotated tag objects to whatever\n if (type === 'tag') {\n oid = GitAnnotatedTag.from(object).parse().object\n return resolveCommit({ fs, cache, gitdir, oid })\n }\n if (type !== 'commit') {\n throw new ObjectTypeError(oid, type, 'commit')\n }\n return { commit: GitCommit.from(object), oid }\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { resolveCommit } from '../utils/resolveCommit.js'\n\n/**\n * @param {object} args\n * @param {import('../models/FileSystem.js').FileSystem} args.fs\n * @param {any} args.cache\n * @param {string} args.gitdir\n * @param {string} args.oid\n *\n * @returns {Promise<ReadCommitResult>} Resolves successfully with a git commit object\n * @see ReadCommitResult\n * @see CommitObject\n *\n */\nexport async function _readCommit({ fs, cache, gitdir, oid }) {\n const { commit, oid: commitOid } = await resolveCommit({\n fs,\n cache,\n gitdir,\n oid,\n })\n const result = {\n oid: commitOid,\n commit: commit.parse(),\n payload: commit.withoutSignature(),\n }\n // @ts-ignore\n return result\n}\n","export function compareAge(a, b) {\n return a.committer.timestamp - b.committer.timestamp\n}\n","// @ts-check\nimport { GitTree } from '../models/GitTree.js'\nimport { _readObject as readObject } from '../storage/readObject.js'\n\nimport { join } from './join.js'\nimport { resolveTree } from './resolveTree.js'\n\n// the empty file content object id\nconst EMPTY_OID = 'e69de29bb2d1d6434b8b29ae775ad8c2e48c5391'\n\nexport async function resolveFileIdInTree({ fs, cache, gitdir, oid, fileId }) {\n if (fileId === EMPTY_OID) return\n const _oid = oid\n let filepath\n const result = await resolveTree({ fs, cache, gitdir, oid })\n const tree = result.tree\n if (fileId === result.oid) {\n filepath = result.path\n } else {\n filepath = await _resolveFileId({\n fs,\n cache,\n gitdir,\n tree,\n fileId,\n oid: _oid,\n })\n if (Array.isArray(filepath)) {\n if (filepath.length === 0) filepath = undefined\n else if (filepath.length === 1) filepath = filepath[0]\n }\n }\n return filepath\n}\n\nasync function _resolveFileId({\n fs,\n cache,\n gitdir,\n tree,\n fileId,\n oid,\n filepaths = [],\n parentPath = '',\n}) {\n const walks = tree.entries().map(function(entry) {\n let result\n if (entry.oid === fileId) {\n result = join(parentPath, entry.path)\n filepaths.push(result)\n } else if (entry.type === 'tree') {\n result = readObject({\n fs,\n cache,\n gitdir,\n oid: entry.oid,\n }).then(function({ object }) {\n return _resolveFileId({\n fs,\n cache,\n gitdir,\n tree: GitTree.from(object),\n fileId,\n oid,\n filepaths,\n parentPath: join(parentPath, entry.path),\n })\n })\n }\n return result\n })\n\n await Promise.all(walks)\n return filepaths\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { _readCommit } from '../commands/readCommit.js'\nimport { NotFoundError } from '../errors/NotFoundError.js'\nimport { GitRefManager } from '../managers/GitRefManager.js'\nimport { GitShallowManager } from '../managers/GitShallowManager.js'\nimport { compareAge } from '../utils/compareAge.js'\nimport { resolveFileIdInTree } from '../utils/resolveFileIdInTree.js'\nimport { resolveFilepath } from '../utils/resolveFilepath.js'\n\n/**\n * Get commit descriptions from the git history\n *\n * @param {object} args\n * @param {import('../models/FileSystem.js').FileSystem} args.fs\n * @param {any} args.cache\n * @param {string} args.gitdir\n * @param {string=} args.filepath optional get the commit for the filepath only\n * @param {string} args.ref\n * @param {number|void} args.depth\n * @param {boolean=} [args.force=false] do not throw error if filepath is not exist (works only for a single file). defaults to false\n * @param {boolean=} [args.follow=false] Continue listing the history of a file beyond renames (works only for a single file). defaults to false\n * @param {boolean=} args.follow Continue listing the history of a file beyond renames (works only for a single file). defaults to false\n *\n * @returns {Promise<Array<ReadCommitResult>>} Resolves to an array of ReadCommitResult objects\n * @see ReadCommitResult\n * @see CommitObject\n *\n * @example\n * let commits = await git.log({ dir: '$input((/))', depth: $input((5)), ref: '$input((master))' })\n * console.log(commits)\n *\n */\nexport async function _log({\n fs,\n cache,\n gitdir,\n filepath,\n ref,\n depth,\n since,\n force,\n follow,\n}) {\n const sinceTimestamp =\n typeof since === 'undefined'\n ? undefined\n : Math.floor(since.valueOf() / 1000)\n // TODO: In the future, we may want to have an API where we return a\n // async iterator that emits commits.\n const commits = []\n const shallowCommits = await GitShallowManager.read({ fs, gitdir })\n const oid = await GitRefManager.resolve({ fs, gitdir, ref })\n const tips = [await _readCommit({ fs, cache, gitdir, oid })]\n let lastFileOid\n let lastCommit\n let isOk\n\n function endCommit(commit) {\n if (isOk && filepath) commits.push(commit)\n }\n\n while (tips.length > 0) {\n const commit = tips.pop()\n\n // Stop the log if we've hit the age limit\n if (\n sinceTimestamp !== undefined &&\n commit.commit.committer.timestamp <= sinceTimestamp\n ) {\n break\n }\n\n if (filepath) {\n let vFileOid\n try {\n vFileOid = await resolveFilepath({\n fs,\n cache,\n gitdir,\n oid: commit.commit.tree,\n filepath,\n })\n if (lastCommit && lastFileOid !== vFileOid) {\n commits.push(lastCommit)\n }\n lastFileOid = vFileOid\n lastCommit = commit\n isOk = true\n } catch (e) {\n if (e instanceof NotFoundError) {\n let found = follow && lastFileOid\n if (found) {\n found = await resolveFileIdInTree({\n fs,\n cache,\n gitdir,\n oid: commit.commit.tree,\n fileId: lastFileOid,\n })\n if (found) {\n if (Array.isArray(found)) {\n if (lastCommit) {\n const lastFound = await resolveFileIdInTree({\n fs,\n cache,\n gitdir,\n oid: lastCommit.commit.tree,\n fileId: lastFileOid,\n })\n if (Array.isArray(lastFound)) {\n found = found.filter(p => lastFound.indexOf(p) === -1)\n if (found.length === 1) {\n found = found[0]\n filepath = found\n if (lastCommit) commits.push(lastCommit)\n } else {\n found = false\n if (lastCommit) commits.push(lastCommit)\n break\n }\n }\n }\n } else {\n filepath = found\n if (lastCommit) commits.push(lastCommit)\n }\n }\n }\n if (!found) {\n if (isOk && lastFileOid) {\n commits.push(lastCommit)\n if (!force) break\n }\n if (!force && !follow) throw e\n }\n lastCommit = commit\n isOk = false\n } else throw e\n }\n } else {\n commits.push(commit)\n }\n\n // Stop the loop if we have enough commits now.\n if (depth !== undefined && commits.length === depth) {\n endCommit(commit)\n break\n }\n\n // If this is not a shallow commit...\n if (!shallowCommits.has(commit.oid)) {\n // Add the parents of this commit to the queue\n // Note: for the case of a commit with no parents, it will concat an empty array, having no net effect.\n for (const oid of commit.commit.parent) {\n const commit = await _readCommit({ fs, cache, gitdir, oid })\n if (!tips.map(commit => commit.oid).includes(commit.oid)) {\n tips.push(commit)\n }\n }\n }\n\n // Stop the loop if there are no more commit parents\n if (tips.length === 0) {\n endCommit(commit)\n }\n\n // Process tips in order by age\n tips.sort((a, b) => compareAge(a.commit, b.commit))\n }\n return commits\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { _log } from '../commands/log.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { assertParameter } from '../utils/assertParameter.js'\nimport { join } from '../utils/join.js'\n\n/**\n * Get commit descriptions from the git history\n *\n * @param {object} args\n * @param {FsClient} args.fs - a file system client\n * @param {string} [args.dir] - The [working tree](dir-vs-gitdir.md) directory path\n * @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path\n * @param {string=} args.filepath optional get the commit for the filepath only\n * @param {string} [args.ref = 'HEAD'] - The commit to begin walking backwards through the history from\n * @param {number=} [args.depth] - Limit the number of commits returned. No limit by default.\n * @param {Date} [args.since] - Return history newer than the given date. Can be combined with `depth` to get whichever is shorter.\n * @param {boolean=} [args.force=false] do not throw error if filepath is not exist (works only for a single file). defaults to false\n * @param {boolean=} [args.follow=false] Continue listing the history of a file beyond renames (works only for a single file). defaults to false\n * @param {object} [args.cache] - a [cache](cache.md) object\n *\n * @returns {Promise<Array<ReadCommitResult>>} Resolves to an array of ReadCommitResult objects\n * @see ReadCommitResult\n * @see CommitObject\n *\n * @example\n * let commits = await git.log({\n * fs,\n * dir: '/tutorial',\n * depth: 5,\n * ref: 'main'\n * })\n * console.log(commits)\n *\n */\nexport async function log({\n fs,\n dir,\n gitdir = join(dir, '.git'),\n filepath,\n ref = 'HEAD',\n depth,\n since, // Date\n force,\n follow,\n cache = {},\n}) {\n try {\n assertParameter('fs', fs)\n assertParameter('gitdir', gitdir)\n assertParameter('ref', ref)\n\n return await _log({\n fs: new FileSystem(fs),\n cache,\n gitdir,\n filepath,\n ref,\n depth,\n since,\n force,\n follow,\n })\n } catch (err) {\n err.caller = 'git.log'\n throw err\n }\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { _merge } from '../commands/merge.js'\nimport { MissingNameError } from '../errors/MissingNameError.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { assertParameter } from '../utils/assertParameter.js'\nimport { join } from '../utils/join.js'\nimport { normalizeAuthorObject } from '../utils/normalizeAuthorObject.js'\nimport { normalizeCommitterObject } from '../utils/normalizeCommitterObject.js'\n\n/**\n *\n * @typedef {Object} MergeResult - Returns an object with a schema like this:\n * @property {string} [oid] - The SHA-1 object id that is now at the head of the branch. Absent only if `dryRun` was specified and `mergeCommit` is true.\n * @property {boolean} [alreadyMerged] - True if the branch was already merged so no changes were made\n * @property {boolean} [fastForward] - True if it was a fast-forward merge\n * @property {boolean} [mergeCommit] - True if merge resulted in a merge commit\n * @property {string} [tree] - The SHA-1 object id of the tree resulting from a merge commit\n *\n */\n\n/**\n * Merge two branches\n *\n * Currently it will fail if multiple candidate merge bases are found. (It doesn't yet implement the recursive merge strategy.)\n *\n * Currently it does not support selecting alternative merge strategies.\n *\n * Currently it is not possible to abort an incomplete merge. To restore the worktree to a clean state, you will need to checkout an earlier commit.\n *\n * Currently it does not directly support the behavior of `git merge --continue`. To complete a merge after manual conflict resolution, you will need to add and commit the files manually, and specify the appropriate parent commits.\n *\n * ## Manually resolving merge conflicts\n * By default, if isomorphic-git encounters a merge conflict it cannot resolve using the builtin diff3 algorithm or provided merge driver, it will abort and throw a `MergeNotSupportedError`.\n * This leaves the index and working tree untouched.\n *\n * When `abortOnConflict` is set to `false`, and a merge conflict cannot be automatically resolved, a `MergeConflictError` is thrown and the results of the incomplete merge will be written to the working directory.\n * This includes conflict markers in files with unresolved merge conflicts.\n *\n * To complete the merge, edit the conflicting files as you see fit, and then add and commit the resolved merge.\n *\n * For a proper merge commit, be sure to specify the branches or commits you are merging in the `parent` argument to `git.commit`.\n * For example, say we are merging the branch `feature` into the branch `main` and there is a conflict we want to resolve manually.\n * The flow would look like this:\n *\n * ```\n * await git.merge({\n * fs,\n * dir,\n * ours: 'main',\n * theirs: 'feature',\n * abortOnConflict: false,\n * }).catch(e => {\n * if (e instanceof Errors.MergeConflictError) {\n * console.log(\n * 'Automatic merge failed for the following files: '\n * + `${e.data}. `\n * + 'Resolve these conflicts and then commit your changes.'\n * )\n * } else throw e\n * })\n *\n * // This is the where we manually edit the files that have been written to the working directory\n * // ...\n * // Files have been edited and we are ready to commit\n *\n * await git.add({\n * fs,\n * dir,\n * filepath: '.',\n * })\n *\n * await git.commit({\n * fs,\n * dir,\n * ref: 'main',\n * message: \"Merge branch 'feature' into main\",\n * parent: ['main', 'feature'], // Be sure to specify the parents when creating a merge commit\n * })\n * ```\n *\n * @param {object} args\n * @param {FsClient} args.fs - a file system client\n * @param {SignCallback} [args.onSign] - a PGP signing implementation\n * @param {string} [args.dir] - The [working tree](dir-vs-gitdir.md) directory path\n * @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path\n * @param {string} [args.ours] - The branch receiving the merge. If undefined, defaults to the current branch.\n * @param {string} args.theirs - The branch to be merged\n * @param {boolean} [args.fastForward = true] - If false, create a merge commit in all cases.\n * @param {boolean} [args.fastForwardOnly = false] - If true, then non-fast-forward merges will throw an Error instead of performing a merge.\n * @param {boolean} [args.dryRun = false] - If true, simulates a merge so you can test whether it would succeed.\n * @param {boolean} [args.noUpdateBranch = false] - If true, does not update the branch pointer after creating the commit.\n * @param {boolean} [args.abortOnConflict = true] - If true, merges with conflicts will not update the worktree or index.\n * @param {string} [args.message] - Overrides the default auto-generated merge commit message\n * @param {Object} [args.author] - passed to [commit](commit.md) when creating a merge commit\n * @param {string} [args.author.name] - Default is `user.name` config.\n * @param {string} [args.author.email] - Default is `user.email` config.\n * @param {number} [args.author.timestamp=Math.floor(Date.now()/1000)] - Set the author timestamp field. This is the integer number of seconds since the Unix epoch (1970-01-01 00:00:00).\n * @param {number} [args.author.timezoneOffset] - Set the author timezone offset field. This is the difference, in minutes, from the current timezone to UTC. Default is `(new Date()).getTimezoneOffset()`.\n * @param {Object} [args.committer] - passed to [commit](commit.md) when creating a merge commit\n * @param {string} [args.committer.name] - Default is `user.name` config.\n * @param {string} [args.committer.email] - Default is `user.email` config.\n * @param {number} [args.committer.timestamp=Math.floor(Date.now()/1000)] - Set the committer timestamp field. This is the integer number of seconds since the Unix epoch (1970-01-01 00:00:00).\n * @param {number} [args.committer.timezoneOffset] - Set the committer timezone offset field. This is the difference, in minutes, from the current timezone to UTC. Default is `(new Date()).getTimezoneOffset()`.\n * @param {string} [args.signingKey] - passed to [commit](commit.md) when creating a merge commit\n * @param {object} [args.cache] - a [cache](cache.md) object\n * @param {MergeDriverCallback} [args.mergeDriver] - a [merge driver](mergeDriver.md) implementation\n *\n * @returns {Promise<MergeResult>} Resolves to a description of the merge operation\n * @see MergeResult\n *\n * @example\n * let m = await git.merge({\n * fs,\n * dir: '/tutorial',\n * ours: 'main',\n * theirs: 'remotes/origin/main'\n * })\n * console.log(m)\n *\n */\nexport async function merge({\n fs: _fs,\n onSign,\n dir,\n gitdir = join(dir, '.git'),\n ours,\n theirs,\n fastForward = true,\n fastForwardOnly = false,\n dryRun = false,\n noUpdateBranch = false,\n abortOnConflict = true,\n message,\n author: _author,\n committer: _committer,\n signingKey,\n cache = {},\n mergeDriver,\n}) {\n try {\n assertParameter('fs', _fs)\n if (signingKey) {\n assertParameter('onSign', onSign)\n }\n const fs = new FileSystem(_fs)\n\n const author = await normalizeAuthorObject({ fs, gitdir, author: _author })\n if (!author && (!fastForwardOnly || !fastForward)) {\n throw new MissingNameError('author')\n }\n\n const committer = await normalizeCommitterObject({\n fs,\n gitdir,\n author,\n committer: _committer,\n })\n if (!committer && (!fastForwardOnly || !fastForward)) {\n throw new MissingNameError('committer')\n }\n\n return await _merge({\n fs,\n cache,\n dir,\n gitdir,\n ours,\n theirs,\n fastForward,\n fastForwardOnly,\n dryRun,\n noUpdateBranch,\n abortOnConflict,\n message,\n author,\n committer,\n signingKey,\n onSign,\n mergeDriver,\n })\n } catch (err) {\n err.caller = 'git.merge'\n throw err\n }\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { _packObjects } from '../commands/packObjects.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { assertParameter } from '../utils/assertParameter.js'\nimport { join } from '../utils/join.js'\n\n/**\n *\n * @typedef {Object} PackObjectsResult The packObjects command returns an object with two properties:\n * @property {string} filename - The suggested filename for the packfile if you want to save it to disk somewhere. It includes the packfile SHA.\n * @property {Uint8Array} [packfile] - The packfile contents. Not present if `write` parameter was true, in which case the packfile was written straight to disk.\n */\n\n/**\n * Create a packfile from an array of SHA-1 object ids\n *\n * @param {object} args\n * @param {FsClient} args.fs - a file system client\n * @param {string} [args.dir] - The [working tree](dir-vs-gitdir.md) directory path\n * @param {string} [args.gitdir=join(dir, '.git')] - [required] The [git directory](dir-vs-gitdir.md) path\n * @param {string[]} args.oids - An array of SHA-1 object ids to be included in the packfile\n * @param {boolean} [args.write = false] - Whether to save the packfile to disk or not\n * @param {object} [args.cache] - a [cache](cache.md) object\n *\n * @returns {Promise<PackObjectsResult>} Resolves successfully when the packfile is ready with the filename and buffer\n * @see PackObjectsResult\n *\n * @example\n * // Create a packfile containing only an empty tree\n * let { packfile } = await git.packObjects({\n * fs,\n * dir: '/tutorial',\n * oids: ['4b825dc642cb6eb9a060e54bf8d69288fbee4904']\n * })\n * console.log(packfile)\n *\n */\nexport async function packObjects({\n fs,\n dir,\n gitdir = join(dir, '.git'),\n oids,\n write = false,\n cache = {},\n}) {\n try {\n assertParameter('fs', fs)\n assertParameter('gitdir', gitdir)\n assertParameter('oids', oids)\n\n return await _packObjects({\n fs: new FileSystem(fs),\n cache,\n gitdir,\n oids,\n write,\n })\n } catch (err) {\n err.caller = 'git.packObjects'\n throw err\n }\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { _pull } from '../commands/pull.js'\nimport { MissingNameError } from '../errors/MissingNameError.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { assertParameter } from '../utils/assertParameter.js'\nimport { join } from '../utils/join.js'\nimport { normalizeAuthorObject } from '../utils/normalizeAuthorObject.js'\nimport { normalizeCommitterObject } from '../utils/normalizeCommitterObject.js'\n\n/**\n * Fetch and merge commits from a remote repository\n *\n * @param {object} args\n * @param {FsClient} args.fs - a file system client\n * @param {HttpClient} args.http - an HTTP client\n * @param {ProgressCallback} [args.onProgress] - optional progress event callback\n * @param {MessageCallback} [args.onMessage] - optional message event callback\n * @param {AuthCallback} [args.onAuth] - optional auth fill callback\n * @param {AuthFailureCallback} [args.onAuthFailure] - optional auth rejected callback\n * @param {AuthSuccessCallback} [args.onAuthSuccess] - optional auth approved callback\n * @param {string} args.dir] - The [working tree](dir-vs-gitdir.md) directory path\n * @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path\n * @param {string} [args.ref] - Which branch to merge into. By default this is the currently checked out branch.\n * @param {string} [args.url] - (Added in 1.1.0) The URL of the remote repository. The default is the value set in the git config for that remote.\n * @param {string} [args.remote] - (Added in 1.1.0) If URL is not specified, determines which remote to use.\n * @param {string} [args.remoteRef] - (Added in 1.1.0) The name of the branch on the remote to fetch. By default this is the configured remote tracking branch.\n * @param {boolean} [args.prune = false] - Delete local remote-tracking branches that are not present on the remote\n * @param {boolean} [args.pruneTags = false] - Prune local tags that don’t exist on the remote, and force-update those tags that differ\n * @param {string} [args.corsProxy] - Optional [CORS proxy](https://www.npmjs.com/%40isomorphic-git/cors-proxy). Overrides value in repo config.\n * @param {boolean} [args.singleBranch = false] - Instead of the default behavior of fetching all the branches, only fetch a single branch.\n * @param {boolean} [args.fastForward = true] - If false, only create merge commits.\n * @param {boolean} [args.fastForwardOnly = false] - Only perform simple fast-forward merges. (Don't create merge commits.)\n * @param {Object<string, string>} [args.headers] - Additional headers to include in HTTP requests, similar to git's `extraHeader` config\n * @param {Object} [args.author] - The details about the author.\n * @param {string} [args.author.name] - Default is `user.name` config.\n * @param {string} [args.author.email] - Default is `user.email` config.\n * @param {number} [args.author.timestamp=Math.floor(Date.now()/1000)] - Set the author timestamp field. This is the integer number of seconds since the Unix epoch (1970-01-01 00:00:00).\n * @param {number} [args.author.timezoneOffset] - Set the author timezone offset field. This is the difference, in minutes, from the current timezone to UTC. Default is `(new Date()).getTimezoneOffset()`.\n * @param {Object} [args.committer = author] - The details about the commit committer, in the same format as the author parameter. If not specified, the author details are used.\n * @param {string} [args.committer.name] - Default is `user.name` config.\n * @param {string} [args.committer.email] - Default is `user.email` config.\n * @param {number} [args.committer.timestamp=Math.floor(Date.now()/1000)] - Set the committer timestamp field. This is the integer number of seconds since the Unix epoch (1970-01-01 00:00:00).\n * @param {number} [args.committer.timezoneOffset] - Set the committer timezone offset field. This is the difference, in minutes, from the current timezone to UTC. Default is `(new Date()).getTimezoneOffset()`.\n * @param {string} [args.signingKey] - passed to [commit](commit.md) when creating a merge commit\n * @param {object} [args.cache] - a [cache](cache.md) object\n *\n * @returns {Promise<void>} Resolves successfully when pull operation completes\n *\n * @example\n * await git.pull({\n * fs,\n * http,\n * dir: '/tutorial',\n * ref: 'main',\n * singleBranch: true\n * })\n * console.log('done')\n *\n */\nexport async function pull({\n fs: _fs,\n http,\n onProgress,\n onMessage,\n onAuth,\n onAuthSuccess,\n onAuthFailure,\n dir,\n gitdir = join(dir, '.git'),\n ref,\n url,\n remote,\n remoteRef,\n prune = false,\n pruneTags = false,\n fastForward = true,\n fastForwardOnly = false,\n corsProxy,\n singleBranch,\n headers = {},\n author: _author,\n committer: _committer,\n signingKey,\n cache = {},\n}) {\n try {\n assertParameter('fs', _fs)\n assertParameter('gitdir', gitdir)\n\n const fs = new FileSystem(_fs)\n\n const author = await normalizeAuthorObject({ fs, gitdir, author: _author })\n if (!author) throw new MissingNameError('author')\n\n const committer = await normalizeCommitterObject({\n fs,\n gitdir,\n author,\n committer: _committer,\n })\n if (!committer) throw new MissingNameError('committer')\n\n return await _pull({\n fs,\n cache,\n http,\n onProgress,\n onMessage,\n onAuth,\n onAuthSuccess,\n onAuthFailure,\n dir,\n gitdir,\n ref,\n url,\n remote,\n remoteRef,\n fastForward,\n fastForwardOnly,\n corsProxy,\n singleBranch,\n headers,\n author,\n committer,\n signingKey,\n prune,\n pruneTags,\n })\n } catch (err) {\n err.caller = 'git.pull'\n throw err\n }\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { _currentBranch } from '../commands/currentBranch.js'\nimport { _findMergeBase } from '../commands/findMergeBase.js'\nimport { _isDescendent } from '../commands/isDescendent.js'\nimport { listCommitsAndTags } from '../commands/listCommitsAndTags.js'\nimport { listObjects } from '../commands/listObjects.js'\nimport { _pack } from '../commands/pack.js'\nimport { GitPushError } from '../errors/GitPushError.js'\nimport { MissingParameterError } from '../errors/MissingParameterError.js'\nimport { NotFoundError } from '../errors/NotFoundError.js'\nimport { PushRejectedError } from '../errors/PushRejectedError.js'\nimport { GitConfigManager } from '../managers/GitConfigManager.js'\nimport { GitRefManager } from '../managers/GitRefManager.js'\nimport { GitRemoteManager } from '../managers/GitRemoteManager.js'\nimport { GitSideBand } from '../models/GitSideBand.js'\nimport { filterCapabilities } from '../utils/filterCapabilities.js'\nimport { forAwait } from '../utils/forAwait.js'\nimport { pkg } from '../utils/pkg.js'\nimport { splitLines } from '../utils/splitLines.js'\nimport { parseReceivePackResponse } from '../wire/parseReceivePackResponse.js'\nimport { writeReceivePackRequest } from '../wire/writeReceivePackRequest.js'\n\n/**\n * @param {object} args\n * @param {import('../models/FileSystem.js').FileSystem} args.fs\n * @param {any} args.cache\n * @param {HttpClient} args.http\n * @param {ProgressCallback} [args.onProgress]\n * @param {MessageCallback} [args.onMessage]\n * @param {AuthCallback} [args.onAuth]\n * @param {AuthFailureCallback} [args.onAuthFailure]\n * @param {AuthSuccessCallback} [args.onAuthSuccess]\n * @param {string} args.gitdir\n * @param {string} [args.ref]\n * @param {string} [args.remoteRef]\n * @param {string} [args.remote]\n * @param {boolean} [args.force = false]\n * @param {boolean} [args.delete = false]\n * @param {string} [args.url]\n * @param {string} [args.corsProxy]\n * @param {Object<string, string>} [args.headers]\n *\n * @returns {Promise<PushResult>}\n */\nexport async function _push({\n fs,\n cache,\n http,\n onProgress,\n onMessage,\n onAuth,\n onAuthSuccess,\n onAuthFailure,\n gitdir,\n ref: _ref,\n remoteRef: _remoteRef,\n remote,\n url: _url,\n force = false,\n delete: _delete = false,\n corsProxy,\n headers = {},\n}) {\n const ref = _ref || (await _currentBranch({ fs, gitdir }))\n if (typeof ref === 'undefined') {\n throw new MissingParameterError('ref')\n }\n const config = await GitConfigManager.get({ fs, gitdir })\n // Figure out what remote to use.\n remote =\n remote ||\n (await config.get(`branch.${ref}.pushRemote`)) ||\n (await config.get('remote.pushDefault')) ||\n (await config.get(`branch.${ref}.remote`)) ||\n 'origin'\n // Lookup the URL for the given remote.\n const url =\n _url ||\n (await config.get(`remote.${remote}.pushurl`)) ||\n (await config.get(`remote.${remote}.url`))\n if (typeof url === 'undefined') {\n throw new MissingParameterError('remote OR url')\n }\n // Figure out what remote ref to use.\n const remoteRef = _remoteRef || (await config.get(`branch.${ref}.merge`))\n if (typeof url === 'undefined') {\n throw new MissingParameterError('remoteRef')\n }\n\n if (corsProxy === undefined) {\n corsProxy = await config.get('http.corsProxy')\n }\n\n const fullRef = await GitRefManager.expand({ fs, gitdir, ref })\n const oid = _delete\n ? '0000000000000000000000000000000000000000'\n : await GitRefManager.resolve({ fs, gitdir, ref: fullRef })\n\n /** @type typeof import(\"../managers/GitRemoteHTTP\").GitRemoteHTTP */\n const GitRemoteHTTP = GitRemoteManager.getRemoteHelperFor({ url })\n const httpRemote = await GitRemoteHTTP.discover({\n http,\n onAuth,\n onAuthSuccess,\n onAuthFailure,\n corsProxy,\n service: 'git-receive-pack',\n url,\n headers,\n protocolVersion: 1,\n })\n const auth = httpRemote.auth // hack to get new credentials from CredentialManager API\n let fullRemoteRef\n if (!remoteRef) {\n fullRemoteRef = fullRef\n } else {\n try {\n fullRemoteRef = await GitRefManager.expandAgainstMap({\n ref: remoteRef,\n map: httpRemote.refs,\n })\n } catch (err) {\n if (err instanceof NotFoundError) {\n // The remote reference doesn't exist yet.\n // If it is fully specified, use that value. Otherwise, treat it as a branch.\n fullRemoteRef = remoteRef.startsWith('refs/')\n ? remoteRef\n : `refs/heads/${remoteRef}`\n } else {\n throw err\n }\n }\n }\n const oldoid =\n httpRemote.refs.get(fullRemoteRef) ||\n '0000000000000000000000000000000000000000'\n\n // Remotes can always accept thin-packs UNLESS they specify the 'no-thin' capability\n const thinPack = !httpRemote.capabilities.has('no-thin')\n\n let objects = new Set()\n if (!_delete) {\n const finish = [...httpRemote.refs.values()]\n let skipObjects = new Set()\n\n // If remote branch is present, look for a common merge base.\n if (oldoid !== '0000000000000000000000000000000000000000') {\n // trick to speed up common force push scenarios\n const mergebase = await _findMergeBase({\n fs,\n cache,\n gitdir,\n oids: [oid, oldoid],\n })\n for (const oid of mergebase) finish.push(oid)\n if (thinPack) {\n skipObjects = await listObjects({ fs, cache, gitdir, oids: mergebase })\n }\n }\n\n // If remote does not have the commit, figure out the objects to send\n if (!finish.includes(oid)) {\n const commits = await listCommitsAndTags({\n fs,\n cache,\n gitdir,\n start: [oid],\n finish,\n })\n objects = await listObjects({ fs, cache, gitdir, oids: commits })\n }\n\n if (thinPack) {\n // If there's a default branch for the remote lets skip those objects too.\n // Since this is an optional optimization, we just catch and continue if there is\n // an error (because we can't find a default branch, or can't find a commit, etc)\n try {\n // Sadly, the discovery phase with 'forPush' doesn't return symrefs, so we have to\n // rely on existing ones.\n const ref = await GitRefManager.resolve({\n fs,\n gitdir,\n ref: `refs/remotes/${remote}/HEAD`,\n depth: 2,\n })\n const { oid } = await GitRefManager.resolveAgainstMap({\n ref: ref.replace(`refs/remotes/${remote}/`, ''),\n fullref: ref,\n map: httpRemote.refs,\n })\n const oids = [oid]\n for (const oid of await listObjects({ fs, cache, gitdir, oids })) {\n skipObjects.add(oid)\n }\n } catch (e) {}\n\n // Remove objects that we know the remote already has\n for (const oid of skipObjects) {\n objects.delete(oid)\n }\n }\n\n if (oid === oldoid) force = true\n if (!force) {\n // Is it a tag that already exists?\n if (\n fullRef.startsWith('refs/tags') &&\n oldoid !== '0000000000000000000000000000000000000000'\n ) {\n throw new PushRejectedError('tag-exists')\n }\n // Is it a non-fast-forward commit?\n if (\n oid !== '0000000000000000000000000000000000000000' &&\n oldoid !== '0000000000000000000000000000000000000000' &&\n !(await _isDescendent({\n fs,\n cache,\n gitdir,\n oid,\n ancestor: oldoid,\n depth: -1,\n }))\n ) {\n throw new PushRejectedError('not-fast-forward')\n }\n }\n }\n // We can only safely use capabilities that the server also understands.\n // For instance, AWS CodeCommit aborts a push if you include the `agent`!!!\n const capabilities = filterCapabilities(\n [...httpRemote.capabilities],\n ['report-status', 'side-band-64k', `agent=${pkg.agent}`]\n )\n const packstream1 = await writeReceivePackRequest({\n capabilities,\n triplets: [{ oldoid, oid, fullRef: fullRemoteRef }],\n })\n const packstream2 = _delete\n ? []\n : await _pack({\n fs,\n cache,\n gitdir,\n oids: [...objects],\n })\n const res = await GitRemoteHTTP.connect({\n http,\n onProgress,\n corsProxy,\n service: 'git-receive-pack',\n url,\n auth,\n headers,\n body: [...packstream1, ...packstream2],\n })\n const { packfile, progress } = await GitSideBand.demux(res.body)\n if (onMessage) {\n const lines = splitLines(progress)\n forAwait(lines, async line => {\n await onMessage(line)\n })\n }\n // Parse the response!\n const result = await parseReceivePackResponse(packfile)\n if (res.headers) {\n result.headers = res.headers\n }\n\n // Update the local copy of the remote ref\n if (remote && result.ok && result.refs[fullRemoteRef].ok) {\n // TODO: I think this should actually be using a refspec transform rather than assuming 'refs/remotes/{remote}'\n const ref = `refs/remotes/${remote}/${fullRemoteRef.replace(\n 'refs/heads',\n ''\n )}`\n if (_delete) {\n await GitRefManager.deleteRef({ fs, gitdir, ref })\n } else {\n await GitRefManager.writeRef({ fs, gitdir, ref, value: oid })\n }\n }\n if (result.ok && Object.values(result.refs).every(result => result.ok)) {\n return result\n } else {\n const prettyDetails = Object.entries(result.refs)\n .filter(([k, v]) => !v.ok)\n .map(([k, v]) => `\\n - ${k}: ${v.error}`)\n .join('')\n throw new GitPushError(prettyDetails, result)\n }\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { _push } from '../commands/push.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { assertParameter } from '../utils/assertParameter.js'\nimport { join } from '../utils/join.js'\n\n/**\n * Push a branch or tag\n *\n * The push command returns an object that describes the result of the attempted push operation.\n * *Notes:* If there were no errors, then there will be no `errors` property. There can be a mix of `ok` messages and `errors` messages.\n *\n * | param | type [= default] | description |\n * | ------ | ---------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n * | ok | Array\\<string\\> | The first item is \"unpack\" if the overall operation was successful. The remaining items are the names of refs that were updated successfully. |\n * | errors | Array\\<string\\> | If the overall operation threw and error, the first item will be \"unpack {Overall error message}\". The remaining items are individual refs that failed to be updated in the format \"{ref name} {error message}\". |\n *\n * @param {object} args\n * @param {FsClient} args.fs - a file system client\n * @param {HttpClient} args.http - an HTTP client\n * @param {ProgressCallback} [args.onProgress] - optional progress event callback\n * @param {MessageCallback} [args.onMessage] - optional message event callback\n * @param {AuthCallback} [args.onAuth] - optional auth fill callback\n * @param {AuthFailureCallback} [args.onAuthFailure] - optional auth rejected callback\n * @param {AuthSuccessCallback} [args.onAuthSuccess] - optional auth approved callback\n * @param {string} [args.dir] - The [working tree](dir-vs-gitdir.md) directory path\n * @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path\n * @param {string} [args.ref] - Which branch to push. By default this is the currently checked out branch.\n * @param {string} [args.url] - The URL of the remote repository. The default is the value set in the git config for that remote.\n * @param {string} [args.remote] - If URL is not specified, determines which remote to use.\n * @param {string} [args.remoteRef] - The name of the receiving branch on the remote. By default this is the configured remote tracking branch.\n * @param {boolean} [args.force = false] - If true, behaves the same as `git push --force`\n * @param {boolean} [args.delete = false] - If true, delete the remote ref\n * @param {string} [args.corsProxy] - Optional [CORS proxy](https://www.npmjs.com/%40isomorphic-git/cors-proxy). Overrides value in repo config.\n * @param {Object<string, string>} [args.headers] - Additional headers to include in HTTP requests, similar to git's `extraHeader` config\n * @param {object} [args.cache] - a [cache](cache.md) object\n *\n * @returns {Promise<PushResult>} Resolves successfully when push completes with a detailed description of the operation from the server.\n * @see PushResult\n * @see RefUpdateStatus\n *\n * @example\n * let pushResult = await git.push({\n * fs,\n * http,\n * dir: '/tutorial',\n * remote: 'origin',\n * ref: 'main',\n * onAuth: () => ({ username: process.env.GITHUB_TOKEN }),\n * })\n * console.log(pushResult)\n *\n */\nexport async function push({\n fs,\n http,\n onProgress,\n onMessage,\n onAuth,\n onAuthSuccess,\n onAuthFailure,\n dir,\n gitdir = join(dir, '.git'),\n ref,\n remoteRef,\n remote = 'origin',\n url,\n force = false,\n delete: _delete = false,\n corsProxy,\n headers = {},\n cache = {},\n}) {\n try {\n assertParameter('fs', fs)\n assertParameter('http', http)\n assertParameter('gitdir', gitdir)\n\n return await _push({\n fs: new FileSystem(fs),\n cache,\n http,\n onProgress,\n onMessage,\n onAuth,\n onAuthSuccess,\n onAuthFailure,\n gitdir,\n ref,\n remoteRef,\n remote,\n url,\n force,\n delete: _delete,\n corsProxy,\n headers,\n })\n } catch (err) {\n err.caller = 'git.push'\n throw err\n }\n}\n","import { ObjectTypeError } from '../errors/ObjectTypeError.js'\nimport { GitAnnotatedTag } from '../models/GitAnnotatedTag.js'\nimport { _readObject as readObject } from '../storage/readObject.js'\n\nexport async function resolveBlob({ fs, cache, gitdir, oid }) {\n const { type, object } = await readObject({ fs, cache, gitdir, oid })\n // Resolve annotated tag objects to whatever\n if (type === 'tag') {\n oid = GitAnnotatedTag.from(object).parse().object\n return resolveBlob({ fs, cache, gitdir, oid })\n }\n if (type !== 'blob') {\n throw new ObjectTypeError(oid, type, 'blob')\n }\n return { oid, blob: new Uint8Array(object) }\n}\n","// @ts-check\nimport { resolveBlob } from '../utils/resolveBlob.js'\nimport { resolveFilepath } from '../utils/resolveFilepath.js'\n\n/**\n *\n * @typedef {Object} ReadBlobResult - The object returned has the following schema:\n * @property {string} oid\n * @property {Uint8Array} blob\n *\n */\n\n/**\n * @param {object} args\n * @param {import('../models/FileSystem.js').FileSystem} args.fs\n * @param {any} args.cache\n * @param {string} args.gitdir\n * @param {string} args.oid\n * @param {string} [args.filepath]\n *\n * @returns {Promise<ReadBlobResult>} Resolves successfully with a blob object description\n * @see ReadBlobResult\n */\nexport async function _readBlob({\n fs,\n cache,\n gitdir,\n oid,\n filepath = undefined,\n}) {\n if (filepath !== undefined) {\n oid = await resolveFilepath({ fs, cache, gitdir, oid, filepath })\n }\n const blob = await resolveBlob({\n fs,\n cache,\n gitdir,\n oid,\n })\n return blob\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { _readBlob } from '../commands/readBlob.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { assertParameter } from '../utils/assertParameter.js'\nimport { join } from '../utils/join.js'\n\n/**\n *\n * @typedef {Object} ReadBlobResult - The object returned has the following schema:\n * @property {string} oid\n * @property {Uint8Array} blob\n *\n */\n\n/**\n * Read a blob object directly\n *\n * @param {object} args\n * @param {FsClient} args.fs - a file system client\n * @param {string} [args.dir] - The [working tree](dir-vs-gitdir.md) directory path\n * @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path\n * @param {string} args.oid - The SHA-1 object id to get. Annotated tags, commits, and trees are peeled.\n * @param {string} [args.filepath] - Don't return the object with `oid` itself, but resolve `oid` to a tree and then return the blob object at that filepath.\n * @param {object} [args.cache] - a [cache](cache.md) object\n *\n * @returns {Promise<ReadBlobResult>} Resolves successfully with a blob object description\n * @see ReadBlobResult\n *\n * @example\n * // Get the contents of 'README.md' in the main branch.\n * let commitOid = await git.resolveRef({ fs, dir: '/tutorial', ref: 'main' })\n * console.log(commitOid)\n * let { blob } = await git.readBlob({\n * fs,\n * dir: '/tutorial',\n * oid: commitOid,\n * filepath: 'README.md'\n * })\n * console.log(Buffer.from(blob).toString('utf8'))\n *\n */\nexport async function readBlob({\n fs,\n dir,\n gitdir = join(dir, '.git'),\n oid,\n filepath,\n cache = {},\n}) {\n try {\n assertParameter('fs', fs)\n assertParameter('gitdir', gitdir)\n assertParameter('oid', oid)\n\n return await _readBlob({\n fs: new FileSystem(fs),\n cache,\n gitdir,\n oid,\n filepath,\n })\n } catch (err) {\n err.caller = 'git.readBlob'\n throw err\n }\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { _readCommit } from '../commands/readCommit.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { assertParameter } from '../utils/assertParameter.js'\nimport { join } from '../utils/join.js'\n\n/**\n * Read a commit object directly\n *\n * @param {object} args\n * @param {FsClient} args.fs - a file system client\n * @param {string} [args.dir] - The [working tree](dir-vs-gitdir.md) directory path\n * @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path\n * @param {string} args.oid - The SHA-1 object id to get. Annotated tags are peeled.\n * @param {object} [args.cache] - a [cache](cache.md) object\n *\n * @returns {Promise<ReadCommitResult>} Resolves successfully with a git commit object\n * @see ReadCommitResult\n * @see CommitObject\n *\n * @example\n * // Read a commit object\n * let sha = await git.resolveRef({ fs, dir: '/tutorial', ref: 'main' })\n * console.log(sha)\n * let commit = await git.readCommit({ fs, dir: '/tutorial', oid: sha })\n * console.log(commit)\n *\n */\nexport async function readCommit({\n fs,\n dir,\n gitdir = join(dir, '.git'),\n oid,\n cache = {},\n}) {\n try {\n assertParameter('fs', fs)\n assertParameter('gitdir', gitdir)\n assertParameter('oid', oid)\n\n return await _readCommit({\n fs: new FileSystem(fs),\n cache,\n gitdir,\n oid,\n })\n } catch (err) {\n err.caller = 'git.readCommit'\n throw err\n }\n}\n","// @ts-check\nimport { GitRefManager } from '../managers/GitRefManager.js'\n\nimport { _readBlob } from './readBlob'\n\n/**\n * Read the contents of a note\n *\n * @param {object} args\n * @param {import('../models/FileSystem.js').FileSystem} args.fs\n * @param {any} args.cache\n * @param {string} args.gitdir\n * @param {string} [args.ref] - The notes ref to look under\n * @param {string} args.oid\n *\n * @returns {Promise<Uint8Array>} Resolves successfully with note contents as a Buffer.\n */\n\nexport async function _readNote({\n fs,\n cache,\n gitdir,\n ref = 'refs/notes/commits',\n oid,\n}) {\n const parent = await GitRefManager.resolve({ gitdir, fs, ref })\n const { blob } = await _readBlob({\n fs,\n cache,\n gitdir,\n oid: parent,\n filepath: oid,\n })\n\n return blob\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { _readNote } from '../commands/readNote.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { assertParameter } from '../utils/assertParameter.js'\nimport { join } from '../utils/join.js'\n\n/**\n * Read the contents of a note\n *\n * @param {object} args\n * @param {FsClient} args.fs - a file system client\n * @param {string} [args.dir] - The [working tree](dir-vs-gitdir.md) directory path\n * @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path\n * @param {string} [args.ref] - The notes ref to look under\n * @param {string} args.oid - The SHA-1 object id of the object to get the note for.\n * @param {object} [args.cache] - a [cache](cache.md) object\n *\n * @returns {Promise<Uint8Array>} Resolves successfully with note contents as a Buffer.\n */\n\nexport async function readNote({\n fs,\n dir,\n gitdir = join(dir, '.git'),\n ref = 'refs/notes/commits',\n oid,\n cache = {},\n}) {\n try {\n assertParameter('fs', fs)\n assertParameter('gitdir', gitdir)\n assertParameter('ref', ref)\n assertParameter('oid', oid)\n\n return await _readNote({\n fs: new FileSystem(fs),\n cache,\n gitdir,\n ref,\n oid,\n })\n } catch (err) {\n err.caller = 'git.readNote'\n throw err\n }\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { ObjectTypeError } from '../errors/ObjectTypeError.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { GitAnnotatedTag } from '../models/GitAnnotatedTag.js'\nimport { GitCommit } from '../models/GitCommit.js'\nimport { GitTree } from '../models/GitTree.js'\nimport { _readObject } from '../storage/readObject.js'\nimport { assertParameter } from '../utils/assertParameter.js'\nimport { join } from '../utils/join.js'\nimport { resolveFilepath } from '../utils/resolveFilepath.js'\n\n/**\n *\n * @typedef {Object} DeflatedObject\n * @property {string} oid\n * @property {'deflated'} type\n * @property {'deflated'} format\n * @property {Uint8Array} object\n * @property {string} [source]\n *\n */\n\n/**\n *\n * @typedef {Object} WrappedObject\n * @property {string} oid\n * @property {'wrapped'} type\n * @property {'wrapped'} format\n * @property {Uint8Array} object\n * @property {string} [source]\n *\n */\n\n/**\n *\n * @typedef {Object} RawObject\n * @property {string} oid\n * @property {'blob'|'commit'|'tree'|'tag'} type\n * @property {'content'} format\n * @property {Uint8Array} object\n * @property {string} [source]\n *\n */\n\n/**\n *\n * @typedef {Object} ParsedBlobObject\n * @property {string} oid\n * @property {'blob'} type\n * @property {'parsed'} format\n * @property {string} object\n * @property {string} [source]\n *\n */\n\n/**\n *\n * @typedef {Object} ParsedCommitObject\n * @property {string} oid\n * @property {'commit'} type\n * @property {'parsed'} format\n * @property {CommitObject} object\n * @property {string} [source]\n *\n */\n\n/**\n *\n * @typedef {Object} ParsedTreeObject\n * @property {string} oid\n * @property {'tree'} type\n * @property {'parsed'} format\n * @property {TreeObject} object\n * @property {string} [source]\n *\n */\n\n/**\n *\n * @typedef {Object} ParsedTagObject\n * @property {string} oid\n * @property {'tag'} type\n * @property {'parsed'} format\n * @property {TagObject} object\n * @property {string} [source]\n *\n */\n\n/**\n *\n * @typedef {ParsedBlobObject | ParsedCommitObject | ParsedTreeObject | ParsedTagObject} ParsedObject\n */\n\n/**\n *\n * @typedef {DeflatedObject | WrappedObject | RawObject | ParsedObject } ReadObjectResult\n */\n\n/**\n * Read a git object directly by its SHA-1 object id\n *\n * Regarding `ReadObjectResult`:\n *\n * - `oid` will be the same as the `oid` argument unless the `filepath` argument is provided, in which case it will be the oid of the tree or blob being returned.\n * - `type` of deflated objects is `'deflated'`, and `type` of wrapped objects is `'wrapped'`\n * - `format` is usually, but not always, the format you requested. Packfiles do not store each object individually compressed so if you end up reading the object from a packfile it will be returned in format 'content' even if you requested 'deflated' or 'wrapped'.\n * - `object` will be an actual Object if format is 'parsed' and the object is a commit, tree, or annotated tag. Blobs are still formatted as Buffers unless an encoding is provided in which case they'll be strings. If format is anything other than 'parsed', object will be a Buffer.\n * - `source` is the name of the packfile or loose object file where the object was found.\n *\n * The `format` parameter can have the following values:\n *\n * | param | description |\n * | ---------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n * | 'deflated' | Return the raw deflate-compressed buffer for an object if possible. Useful for efficiently shuffling around loose objects when you don't care about the contents and can save time by not inflating them. |\n * | 'wrapped' | Return the inflated object buffer wrapped in the git object header if possible. This is the raw data used when calculating the SHA-1 object id of a git object. |\n * | 'content' | Return the object buffer without the git header. |\n * | 'parsed' | Returns a parsed representation of the object. |\n *\n * The result will be in one of the following schemas:\n *\n * ## `'deflated'` format\n *\n * {@link DeflatedObject typedef}\n *\n * ## `'wrapped'` format\n *\n * {@link WrappedObject typedef}\n *\n * ## `'content'` format\n *\n * {@link RawObject typedef}\n *\n * ## `'parsed'` format\n *\n * ### parsed `'blob'` type\n *\n * {@link ParsedBlobObject typedef}\n *\n * ### parsed `'commit'` type\n *\n * {@link ParsedCommitObject typedef}\n * {@link CommitObject typedef}\n *\n * ### parsed `'tree'` type\n *\n * {@link ParsedTreeObject typedef}\n * {@link TreeObject typedef}\n * {@link TreeEntry typedef}\n *\n * ### parsed `'tag'` type\n *\n * {@link ParsedTagObject typedef}\n * {@link TagObject typedef}\n *\n * @deprecated\n * > This command is overly complicated.\n * >\n * > If you know the type of object you are reading, use [`readBlob`](./readBlob.md), [`readCommit`](./readCommit.md), [`readTag`](./readTag.md), or [`readTree`](./readTree.md).\n *\n * @param {object} args\n * @param {FsClient} args.fs - a file system client\n * @param {string} [args.dir] - The [working tree](dir-vs-gitdir.md) directory path\n * @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path\n * @param {string} args.oid - The SHA-1 object id to get\n * @param {'deflated' | 'wrapped' | 'content' | 'parsed'} [args.format = 'parsed'] - What format to return the object in. The choices are described in more detail below.\n * @param {string} [args.filepath] - Don't return the object with `oid` itself, but resolve `oid` to a tree and then return the object at that filepath. To return the root directory of a tree set filepath to `''`\n * @param {string} [args.encoding] - A convenience argument that only affects blobs. Instead of returning `object` as a buffer, it returns a string parsed using the given encoding.\n * @param {object} [args.cache] - a [cache](cache.md) object\n *\n * @returns {Promise<ReadObjectResult>} Resolves successfully with a git object description\n * @see ReadObjectResult\n *\n * @example\n * // Given a ransom SHA-1 object id, figure out what it is\n * let { type, object } = await git.readObject({\n * fs,\n * dir: '/tutorial',\n * oid: '0698a781a02264a6f37ba3ff41d78067eaf0f075'\n * })\n * switch (type) {\n * case 'commit': {\n * console.log(object)\n * break\n * }\n * case 'tree': {\n * console.log(object)\n * break\n * }\n * case 'blob': {\n * console.log(object)\n * break\n * }\n * case 'tag': {\n * console.log(object)\n * break\n * }\n * }\n *\n */\nexport async function readObject({\n fs: _fs,\n dir,\n gitdir = join(dir, '.git'),\n oid,\n format = 'parsed',\n filepath = undefined,\n encoding = undefined,\n cache = {},\n}) {\n try {\n assertParameter('fs', _fs)\n assertParameter('gitdir', gitdir)\n assertParameter('oid', oid)\n\n const fs = new FileSystem(_fs)\n if (filepath !== undefined) {\n oid = await resolveFilepath({\n fs,\n cache,\n gitdir,\n oid,\n filepath,\n })\n }\n // GitObjectManager does not know how to parse content, so we tweak that parameter before passing it.\n const _format = format === 'parsed' ? 'content' : format\n const result = await _readObject({\n fs,\n cache,\n gitdir,\n oid,\n format: _format,\n })\n result.oid = oid\n if (format === 'parsed') {\n result.format = 'parsed'\n switch (result.type) {\n case 'commit':\n result.object = GitCommit.from(result.object).parse()\n break\n case 'tree':\n result.object = GitTree.from(result.object).entries()\n break\n case 'blob':\n // Here we consider returning a raw Buffer as the 'content' format\n // and returning a string as the 'parsed' format\n if (encoding) {\n result.object = result.object.toString(encoding)\n } else {\n result.object = new Uint8Array(result.object)\n result.format = 'content'\n }\n break\n case 'tag':\n result.object = GitAnnotatedTag.from(result.object).parse()\n break\n default:\n throw new ObjectTypeError(\n result.oid,\n result.type,\n 'blob|commit|tag|tree'\n )\n }\n } else if (result.format === 'deflated' || result.format === 'wrapped') {\n result.type = result.format\n }\n return result\n } catch (err) {\n err.caller = 'git.readObject'\n throw err\n }\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { ObjectTypeError } from '../errors/ObjectTypeError.js'\nimport { GitAnnotatedTag } from '../models/GitAnnotatedTag.js'\nimport { _readObject as readObject } from '../storage/readObject.js'\n\n/**\n *\n * @typedef {Object} ReadTagResult - The object returned has the following schema:\n * @property {string} oid - SHA-1 object id of this tag\n * @property {TagObject} tag - the parsed tag object\n * @property {string} payload - PGP signing payload\n */\n\n/**\n * @param {object} args\n * @param {import('../models/FileSystem.js').FileSystem} args.fs\n * @param {any} args.cache\n * @param {string} args.gitdir\n * @param {string} args.oid\n *\n * @returns {Promise<ReadTagResult>}\n */\nexport async function _readTag({ fs, cache, gitdir, oid }) {\n const { type, object } = await readObject({\n fs,\n cache,\n gitdir,\n oid,\n format: 'content',\n })\n if (type !== 'tag') {\n throw new ObjectTypeError(oid, type, 'tag')\n }\n const tag = GitAnnotatedTag.from(object)\n const result = {\n oid,\n tag: tag.parse(),\n payload: tag.payload(),\n }\n // @ts-ignore\n return result\n}\n","import '../typedefs.js'\n\nimport { _readTag } from '../commands/readTag.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { assertParameter } from '../utils/assertParameter.js'\nimport { join } from '../utils/join.js'\n\n/**\n *\n * @typedef {Object} ReadTagResult - The object returned has the following schema:\n * @property {string} oid - SHA-1 object id of this tag\n * @property {TagObject} tag - the parsed tag object\n * @property {string} payload - PGP signing payload\n */\n\n/**\n * Read an annotated tag object directly\n *\n * @param {object} args\n * @param {FsClient} args.fs - a file system client\n * @param {string} [args.dir] - The [working tree](dir-vs-gitdir.md) directory path\n * @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path\n * @param {string} args.oid - The SHA-1 object id to get\n * @param {object} [args.cache] - a [cache](cache.md) object\n *\n * @returns {Promise<ReadTagResult>} Resolves successfully with a git object description\n * @see ReadTagResult\n * @see TagObject\n *\n */\nexport async function readTag({\n fs,\n dir,\n gitdir = join(dir, '.git'),\n oid,\n cache = {},\n}) {\n try {\n assertParameter('fs', fs)\n assertParameter('gitdir', gitdir)\n assertParameter('oid', oid)\n\n return await _readTag({\n fs: new FileSystem(fs),\n cache,\n gitdir,\n oid,\n })\n } catch (err) {\n err.caller = 'git.readTag'\n throw err\n }\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { _readTree } from '../commands/readTree.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { assertParameter } from '../utils/assertParameter.js'\nimport { join } from '../utils/join.js'\n\n/**\n *\n * @typedef {Object} ReadTreeResult - The object returned has the following schema:\n * @property {string} oid - SHA-1 object id of this tree\n * @property {TreeObject} tree - the parsed tree object\n */\n\n/**\n * Read a tree object directly\n *\n * @param {object} args\n * @param {FsClient} args.fs - a file system client\n * @param {string} [args.dir] - The [working tree](dir-vs-gitdir.md) directory path\n * @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path\n * @param {string} args.oid - The SHA-1 object id to get. Annotated tags and commits are peeled.\n * @param {string} [args.filepath] - Don't return the object with `oid` itself, but resolve `oid` to a tree and then return the tree object at that filepath.\n * @param {object} [args.cache] - a [cache](cache.md) object\n *\n * @returns {Promise<ReadTreeResult>} Resolves successfully with a git tree object\n * @see ReadTreeResult\n * @see TreeObject\n * @see TreeEntry\n *\n */\nexport async function readTree({\n fs,\n dir,\n gitdir = join(dir, '.git'),\n oid,\n filepath = undefined,\n cache = {},\n}) {\n try {\n assertParameter('fs', fs)\n assertParameter('gitdir', gitdir)\n assertParameter('oid', oid)\n\n return await _readTree({\n fs: new FileSystem(fs),\n cache,\n gitdir,\n oid,\n filepath,\n })\n } catch (err) {\n err.caller = 'git.readTree'\n throw err\n }\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { GitIndexManager } from '../managers/GitIndexManager.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { assertParameter } from '../utils/assertParameter.js'\nimport { join } from '../utils/join.js'\n\n/**\n * Remove a file from the git index (aka staging area)\n *\n * Note that this does NOT delete the file in the working directory.\n *\n * @param {object} args\n * @param {FsClient} args.fs - a file system client\n * @param {string} [args.dir] - The [working tree](dir-vs-gitdir.md) directory path\n * @param {string} [args.gitdir=join(dir, '.git')] - [required] The [git directory](dir-vs-gitdir.md) path\n * @param {string} args.filepath - The path to the file to remove from the index\n * @param {object} [args.cache] - a [cache](cache.md) object\n *\n * @returns {Promise<void>} Resolves successfully once the git index has been updated\n *\n * @example\n * await git.remove({ fs, dir: '/tutorial', filepath: 'README.md' })\n * console.log('done')\n *\n */\nexport async function remove({\n fs: _fs,\n dir,\n gitdir = join(dir, '.git'),\n filepath,\n cache = {},\n}) {\n try {\n assertParameter('fs', _fs)\n assertParameter('gitdir', gitdir)\n assertParameter('filepath', filepath)\n\n await GitIndexManager.acquire(\n { fs: new FileSystem(_fs), gitdir, cache },\n async function(index) {\n index.delete({ filepath })\n }\n )\n } catch (err) {\n err.caller = 'git.remove'\n throw err\n }\n}\n","// @ts-check\nimport { _commit } from '../commands/commit.js'\nimport { _readTree } from '../commands/readTree.js'\nimport { _writeTree } from '../commands/writeTree.js'\nimport { NotFoundError } from '../errors/NotFoundError.js'\nimport { GitRefManager } from '../managers/GitRefManager.js'\n\n/**\n * @param {object} args\n * @param {import('../models/FileSystem.js').FileSystem} args.fs\n * @param {object} args.cache\n * @param {SignCallback} [args.onSign]\n * @param {string} [args.dir]\n * @param {string} [args.gitdir=join(dir,'.git')]\n * @param {string} [args.ref]\n * @param {string} args.oid\n * @param {Object} args.author\n * @param {string} args.author.name\n * @param {string} args.author.email\n * @param {number} args.author.timestamp\n * @param {number} args.author.timezoneOffset\n * @param {Object} args.committer\n * @param {string} args.committer.name\n * @param {string} args.committer.email\n * @param {number} args.committer.timestamp\n * @param {number} args.committer.timezoneOffset\n * @param {string} [args.signingKey]\n *\n * @returns {Promise<string>}\n */\n\nexport async function _removeNote({\n fs,\n cache,\n onSign,\n gitdir,\n ref = 'refs/notes/commits',\n oid,\n author,\n committer,\n signingKey,\n}) {\n // Get the current note commit\n let parent\n try {\n parent = await GitRefManager.resolve({ gitdir, fs, ref })\n } catch (err) {\n if (!(err instanceof NotFoundError)) {\n throw err\n }\n }\n\n // I'm using the \"empty tree\" magic number here for brevity\n const result = await _readTree({\n fs,\n gitdir,\n oid: parent || '4b825dc642cb6eb9a060e54bf8d69288fbee4904',\n })\n let tree = result.tree\n\n // Remove the note blob entry from the tree\n tree = tree.filter(entry => entry.path !== oid)\n\n // Create the new note tree\n const treeOid = await _writeTree({\n fs,\n gitdir,\n tree,\n })\n\n // Create the new note commit\n const commitOid = await _commit({\n fs,\n cache,\n onSign,\n gitdir,\n ref,\n tree: treeOid,\n parent: parent && [parent],\n message: `Note removed by 'isomorphic-git removeNote'\\n`,\n author,\n committer,\n signingKey,\n })\n\n return commitOid\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { _removeNote } from '../commands/removeNote.js'\nimport { MissingNameError } from '../errors/MissingNameError.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { assertParameter } from '../utils/assertParameter.js'\nimport { join } from '../utils/join.js'\nimport { normalizeAuthorObject } from '../utils/normalizeAuthorObject.js'\nimport { normalizeCommitterObject } from '../utils/normalizeCommitterObject.js'\n\n/**\n * Remove an object note\n *\n * @param {object} args\n * @param {FsClient} args.fs - a file system client\n * @param {SignCallback} [args.onSign] - a PGP signing implementation\n * @param {string} [args.dir] - The [working tree](dir-vs-gitdir.md) directory path\n * @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path\n * @param {string} [args.ref] - The notes ref to look under\n * @param {string} args.oid - The SHA-1 object id of the object to remove the note from.\n * @param {Object} [args.author] - The details about the author.\n * @param {string} [args.author.name] - Default is `user.name` config.\n * @param {string} [args.author.email] - Default is `user.email` config.\n * @param {number} [args.author.timestamp=Math.floor(Date.now()/1000)] - Set the author timestamp field. This is the integer number of seconds since the Unix epoch (1970-01-01 00:00:00).\n * @param {number} [args.author.timezoneOffset] - Set the author timezone offset field. This is the difference, in minutes, from the current timezone to UTC. Default is `(new Date()).getTimezoneOffset()`.\n * @param {Object} [args.committer = author] - The details about the note committer, in the same format as the author parameter. If not specified, the author details are used.\n * @param {string} [args.committer.name] - Default is `user.name` config.\n * @param {string} [args.committer.email] - Default is `user.email` config.\n * @param {number} [args.committer.timestamp=Math.floor(Date.now()/1000)] - Set the committer timestamp field. This is the integer number of seconds since the Unix epoch (1970-01-01 00:00:00).\n * @param {number} [args.committer.timezoneOffset] - Set the committer timezone offset field. This is the difference, in minutes, from the current timezone to UTC. Default is `(new Date()).getTimezoneOffset()`.\n * @param {string} [args.signingKey] - Sign the tag object using this private PGP key.\n * @param {object} [args.cache] - a [cache](cache.md) object\n *\n * @returns {Promise<string>} Resolves successfully with the SHA-1 object id of the commit object for the note removal.\n */\n\nexport async function removeNote({\n fs: _fs,\n onSign,\n dir,\n gitdir = join(dir, '.git'),\n ref = 'refs/notes/commits',\n oid,\n author: _author,\n committer: _committer,\n signingKey,\n cache = {},\n}) {\n try {\n assertParameter('fs', _fs)\n assertParameter('gitdir', gitdir)\n assertParameter('oid', oid)\n\n const fs = new FileSystem(_fs)\n\n const author = await normalizeAuthorObject({ fs, gitdir, author: _author })\n if (!author) throw new MissingNameError('author')\n\n const committer = await normalizeCommitterObject({\n fs,\n gitdir,\n author,\n committer: _committer,\n })\n if (!committer) throw new MissingNameError('committer')\n\n return await _removeNote({\n fs,\n cache,\n onSign,\n gitdir,\n ref,\n oid,\n author,\n committer,\n signingKey,\n })\n } catch (err) {\n err.caller = 'git.removeNote'\n throw err\n }\n}\n","// @ts-check\nimport cleanGitRef from 'clean-git-ref'\n\nimport { _currentBranch } from '../commands/currentBranch.js'\nimport { AlreadyExistsError } from '../errors/AlreadyExistsError.js'\nimport { InvalidRefNameError } from '../errors/InvalidRefNameError.js'\nimport { GitRefManager } from '../managers/GitRefManager.js'\nimport '../typedefs.js'\n\n/**\n * Rename a branch\n *\n * @param {object} args\n * @param {import('../models/FileSystem.js').FileSystem} args.fs\n * @param {string} args.gitdir\n * @param {string} args.ref - The name of the new branch\n * @param {string} args.oldref - The name of the old branch\n * @param {boolean} [args.checkout = false]\n *\n * @returns {Promise<void>} Resolves successfully when filesystem operations are complete\n */\nexport async function _renameBranch({\n fs,\n gitdir,\n oldref,\n ref,\n checkout = false,\n}) {\n if (ref !== cleanGitRef.clean(ref)) {\n throw new InvalidRefNameError(ref, cleanGitRef.clean(ref))\n }\n\n if (oldref !== cleanGitRef.clean(oldref)) {\n throw new InvalidRefNameError(oldref, cleanGitRef.clean(oldref))\n }\n\n const fulloldref = `refs/heads/${oldref}`\n const fullnewref = `refs/heads/${ref}`\n\n const newexist = await GitRefManager.exists({ fs, gitdir, ref: fullnewref })\n\n if (newexist) {\n throw new AlreadyExistsError('branch', ref, false)\n }\n\n const value = await GitRefManager.resolve({\n fs,\n gitdir,\n ref: fulloldref,\n depth: 1,\n })\n\n await GitRefManager.writeRef({ fs, gitdir, ref: fullnewref, value })\n await GitRefManager.deleteRef({ fs, gitdir, ref: fulloldref })\n\n const fullCurrentBranchRef = await _currentBranch({\n fs,\n gitdir,\n fullname: true,\n })\n const isCurrentBranch = fullCurrentBranchRef === fulloldref\n\n if (checkout || isCurrentBranch) {\n // Update HEAD\n await GitRefManager.writeSymbolicRef({\n fs,\n gitdir,\n ref: 'HEAD',\n value: fullnewref,\n })\n }\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { _renameBranch } from '../commands/renameBranch.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { assertParameter } from '../utils/assertParameter.js'\nimport { join } from '../utils/join.js'\n\n/**\n * Rename a branch\n *\n * @param {object} args\n * @param {FsClient} args.fs - a file system implementation\n * @param {string} [args.dir] - The [working tree](dir-vs-gitdir.md) directory path\n * @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path\n * @param {string} args.ref - What to name the branch\n * @param {string} args.oldref - What the name of the branch was\n * @param {boolean} [args.checkout = false] - Update `HEAD` to point at the newly created branch\n *\n * @returns {Promise<void>} Resolves successfully when filesystem operations are complete\n *\n * @example\n * await git.renameBranch({ fs, dir: '/tutorial', ref: 'main', oldref: 'master' })\n * console.log('done')\n *\n */\nexport async function renameBranch({\n fs,\n dir,\n gitdir = join(dir, '.git'),\n ref,\n oldref,\n checkout = false,\n}) {\n try {\n assertParameter('fs', fs)\n assertParameter('gitdir', gitdir)\n assertParameter('ref', ref)\n assertParameter('oldref', oldref)\n return await _renameBranch({\n fs: new FileSystem(fs),\n gitdir,\n ref,\n oldref,\n checkout,\n })\n } catch (err) {\n err.caller = 'git.renameBranch'\n throw err\n }\n}\n","import { GitObject } from '../models/GitObject.js'\nimport { shasum } from '../utils/shasum.js'\n\nexport async function hashObject({ gitdir, type, object }) {\n return shasum(GitObject.wrap({ type, object }))\n}\n","// @ts-check\nimport { GitIndexManager } from '../managers/GitIndexManager.js'\nimport { GitRefManager } from '../managers/GitRefManager.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { assertParameter } from '../utils/assertParameter.js'\nimport { hashObject } from '../utils/hashObject.js'\nimport { join } from '../utils/join.js'\nimport { resolveFilepath } from '../utils/resolveFilepath.js'\n\n/**\n * Reset a file in the git index (aka staging area)\n *\n * Note that this does NOT modify the file in the working directory.\n *\n * @param {object} args\n * @param {FsClient} args.fs - a file system client\n * @param {string} [args.dir] - The [working tree](dir-vs-gitdir.md) directory path\n * @param {string} [args.gitdir=join(dir, '.git')] - [required] The [git directory](dir-vs-gitdir.md) path\n * @param {string} args.filepath - The path to the file to reset in the index\n * @param {string} [args.ref = 'HEAD'] - A ref to the commit to use\n * @param {object} [args.cache] - a [cache](cache.md) object\n *\n * @returns {Promise<void>} Resolves successfully once the git index has been updated\n *\n * @example\n * await git.resetIndex({ fs, dir: '/tutorial', filepath: 'README.md' })\n * console.log('done')\n *\n */\nexport async function resetIndex({\n fs: _fs,\n dir,\n gitdir = join(dir, '.git'),\n filepath,\n ref,\n cache = {},\n}) {\n try {\n assertParameter('fs', _fs)\n assertParameter('gitdir', gitdir)\n assertParameter('filepath', filepath)\n\n const fs = new FileSystem(_fs)\n\n let oid\n let workdirOid\n\n try {\n // Resolve commit\n oid = await GitRefManager.resolve({ fs, gitdir, ref: ref || 'HEAD' })\n } catch (e) {\n if (ref) {\n // Only throw the error if a ref is explicitly provided\n throw e\n }\n }\n\n // Not having an oid at this point means `resetIndex()` was called without explicit `ref` on a new git\n // repository. If that happens, we can skip resolving the file path.\n if (oid) {\n try {\n // Resolve blob\n oid = await resolveFilepath({\n fs,\n cache,\n gitdir,\n oid,\n filepath,\n })\n } catch (e) {\n // This means we're resetting the file to a \"deleted\" state\n oid = null\n }\n }\n\n // For files that aren't in the workdir use zeros\n let stats = {\n ctime: new Date(0),\n mtime: new Date(0),\n dev: 0,\n ino: 0,\n mode: 0,\n uid: 0,\n gid: 0,\n size: 0,\n }\n // If the file exists in the workdir...\n const object = dir && (await fs.read(join(dir, filepath)))\n if (object) {\n // ... and has the same hash as the desired state...\n workdirOid = await hashObject({\n gitdir,\n type: 'blob',\n object,\n })\n if (oid === workdirOid) {\n // ... use the workdir Stats object\n stats = await fs.lstat(join(dir, filepath))\n }\n }\n await GitIndexManager.acquire({ fs, gitdir, cache }, async function(index) {\n index.delete({ filepath })\n if (oid) {\n index.insert({ filepath, stats, oid })\n }\n })\n } catch (err) {\n err.caller = 'git.reset'\n throw err\n }\n}\n","// @ts-check\nimport { GitRefManager } from '../managers/GitRefManager.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { assertParameter } from '../utils/assertParameter.js'\nimport { join } from '../utils/join.js'\n\n/**\n * Get the value of a symbolic ref or resolve a ref to its SHA-1 object id\n *\n * @param {object} args\n * @param {FsClient} args.fs - a file system client\n * @param {string} [args.dir] - The [working tree](dir-vs-gitdir.md) directory path\n * @param {string} [args.gitdir=join(dir, '.git')] - [required] The [git directory](dir-vs-gitdir.md) path\n * @param {string} args.ref - The ref to resolve\n * @param {number} [args.depth = undefined] - How many symbolic references to follow before returning\n *\n * @returns {Promise<string>} Resolves successfully with a SHA-1 object id or the value of a symbolic ref\n *\n * @example\n * let currentCommit = await git.resolveRef({ fs, dir: '/tutorial', ref: 'HEAD' })\n * console.log(currentCommit)\n * let currentBranch = await git.resolveRef({ fs, dir: '/tutorial', ref: 'HEAD', depth: 2 })\n * console.log(currentBranch)\n *\n */\nexport async function resolveRef({\n fs,\n dir,\n gitdir = join(dir, '.git'),\n ref,\n depth,\n}) {\n try {\n assertParameter('fs', fs)\n assertParameter('gitdir', gitdir)\n assertParameter('ref', ref)\n\n const oid = await GitRefManager.resolve({\n fs: new FileSystem(fs),\n gitdir,\n ref,\n depth,\n })\n return oid\n } catch (err) {\n err.caller = 'git.resolveRef'\n throw err\n }\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { GitConfigManager } from '../managers/GitConfigManager.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { assertParameter } from '../utils/assertParameter.js'\nimport { join } from '../utils/join.js'\n\n/**\n * Write an entry to the git config files.\n *\n * *Caveats:*\n * - Currently only the local `$GIT_DIR/config` file can be read or written. However support for the global `~/.gitconfig` and system `$(prefix)/etc/gitconfig` will be added in the future.\n * - The current parser does not support the more exotic features of the git-config file format such as `[include]` and `[includeIf]`.\n *\n * @param {Object} args\n * @param {FsClient} args.fs - a file system implementation\n * @param {string} [args.dir] - The [working tree](dir-vs-gitdir.md) directory path\n * @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path\n * @param {string} args.path - The key of the git config entry\n * @param {string | boolean | number | void} args.value - A value to store at that path. (Use `undefined` as the value to delete a config entry.)\n * @param {boolean} [args.append = false] - If true, will append rather than replace when setting (use with multi-valued config options).\n *\n * @returns {Promise<void>} Resolves successfully when operation completed\n *\n * @example\n * // Write config value\n * await git.setConfig({\n * fs,\n * dir: '/tutorial',\n * path: 'user.name',\n * value: 'Mr. Test'\n * })\n *\n * // Print out config file\n * let file = await fs.promises.readFile('/tutorial/.git/config', 'utf8')\n * console.log(file)\n *\n * // Delete a config entry\n * await git.setConfig({\n * fs,\n * dir: '/tutorial',\n * path: 'user.name',\n * value: undefined\n * })\n *\n * // Print out config file\n * file = await fs.promises.readFile('/tutorial/.git/config', 'utf8')\n * console.log(file)\n */\nexport async function setConfig({\n fs: _fs,\n dir,\n gitdir = join(dir, '.git'),\n path,\n value,\n append = false,\n}) {\n try {\n assertParameter('fs', _fs)\n assertParameter('gitdir', gitdir)\n assertParameter('path', path)\n // assertParameter('value', value) // We actually allow 'undefined' as a value to unset/delete\n\n const fs = new FileSystem(_fs)\n const config = await GitConfigManager.get({ fs, gitdir })\n if (append) {\n await config.append(path, value)\n } else {\n await config.set(path, value)\n }\n await GitConfigManager.save({ fs, gitdir, config })\n } catch (err) {\n err.caller = 'git.setConfig'\n throw err\n }\n}\n","// @ts-check\nimport { _readTree } from '../commands/readTree.js'\nimport { NotFoundError } from '../errors/NotFoundError.js'\nimport { ObjectTypeError } from '../errors/ObjectTypeError'\nimport { GitIgnoreManager } from '../managers/GitIgnoreManager.js'\nimport { GitIndexManager } from '../managers/GitIndexManager.js'\nimport { GitRefManager } from '../managers/GitRefManager.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { GitTree } from '../models/GitTree.js'\nimport { _readObject } from '../storage/readObject.js'\nimport { assertParameter } from '../utils/assertParameter.js'\nimport { compareStats } from '../utils/compareStats.js'\nimport { hashObject } from '../utils/hashObject.js'\nimport { join } from '../utils/join.js'\n\n/**\n * Tell whether a file has been changed\n *\n * The possible resolve values are:\n *\n * | status | description |\n * | --------------------- | ------------------------------------------------------------------------------------- |\n * | `\"ignored\"` | file ignored by a .gitignore rule |\n * | `\"unmodified\"` | file unchanged from HEAD commit |\n * | `\"*modified\"` | file has modifications, not yet staged |\n * | `\"*deleted\"` | file has been removed, but the removal is not yet staged |\n * | `\"*added\"` | file is untracked, not yet staged |\n * | `\"absent\"` | file not present in HEAD commit, staging area, or working dir |\n * | `\"modified\"` | file has modifications, staged |\n * | `\"deleted\"` | file has been removed, staged |\n * | `\"added\"` | previously untracked file, staged |\n * | `\"*unmodified\"` | working dir and HEAD commit match, but index differs |\n * | `\"*absent\"` | file not present in working dir or HEAD commit, but present in the index |\n * | `\"*undeleted\"` | file was deleted from the index, but is still in the working dir |\n * | `\"*undeletemodified\"` | file was deleted from the index, but is present with modifications in the working dir |\n *\n * @param {object} args\n * @param {FsClient} args.fs - a file system client\n * @param {string} args.dir - The [working tree](dir-vs-gitdir.md) directory path\n * @param {string} [args.gitdir=join(dir, '.git')] - [required] The [git directory](dir-vs-gitdir.md) path\n * @param {string} args.filepath - The path to the file to query\n * @param {object} [args.cache] - a [cache](cache.md) object\n *\n * @returns {Promise<'ignored'|'unmodified'|'*modified'|'*deleted'|'*added'|'absent'|'modified'|'deleted'|'added'|'*unmodified'|'*absent'|'*undeleted'|'*undeletemodified'>} Resolves successfully with the file's git status\n *\n * @example\n * let status = await git.status({ fs, dir: '/tutorial', filepath: 'README.md' })\n * console.log(status)\n *\n */\nexport async function status({\n fs: _fs,\n dir,\n gitdir = join(dir, '.git'),\n filepath,\n cache = {},\n}) {\n try {\n assertParameter('fs', _fs)\n assertParameter('gitdir', gitdir)\n assertParameter('filepath', filepath)\n\n const fs = new FileSystem(_fs)\n const ignored = await GitIgnoreManager.isIgnored({\n fs,\n gitdir,\n dir,\n filepath,\n })\n if (ignored) {\n return 'ignored'\n }\n const headTree = await getHeadTree({ fs, cache, gitdir })\n const treeOid = await getOidAtPath({\n fs,\n cache,\n gitdir,\n tree: headTree,\n path: filepath,\n })\n const indexEntry = await GitIndexManager.acquire(\n { fs, gitdir, cache },\n async function(index) {\n for (const entry of index) {\n if (entry.path === filepath) return entry\n }\n return null\n }\n )\n const stats = await fs.lstat(join(dir, filepath))\n\n const H = treeOid !== null // head\n const I = indexEntry !== null // index\n const W = stats !== null // working dir\n\n const getWorkdirOid = async () => {\n if (I && !compareStats(indexEntry, stats)) {\n return indexEntry.oid\n } else {\n const object = await fs.read(join(dir, filepath))\n const workdirOid = await hashObject({\n gitdir,\n type: 'blob',\n object,\n })\n // If the oid in the index === working dir oid but stats differed update cache\n if (I && indexEntry.oid === workdirOid) {\n // and as long as our fs.stats aren't bad.\n // size of -1 happens over a BrowserFS HTTP Backend that doesn't serve Content-Length headers\n // (like the Karma webserver) because BrowserFS HTTP Backend uses HTTP HEAD requests to do fs.stat\n if (stats.size !== -1) {\n // We don't await this so we can return faster for one-off cases.\n GitIndexManager.acquire({ fs, gitdir, cache }, async function(\n index\n ) {\n index.insert({ filepath, stats, oid: workdirOid })\n })\n }\n }\n return workdirOid\n }\n }\n\n if (!H && !W && !I) return 'absent' // ---\n if (!H && !W && I) return '*absent' // -A-\n if (!H && W && !I) return '*added' // --A\n if (!H && W && I) {\n const workdirOid = await getWorkdirOid()\n // @ts-ignore\n return workdirOid === indexEntry.oid ? 'added' : '*added' // -AA : -AB\n }\n if (H && !W && !I) return 'deleted' // A--\n if (H && !W && I) {\n // @ts-ignore\n return treeOid === indexEntry.oid ? '*deleted' : '*deleted' // AA- : AB-\n }\n if (H && W && !I) {\n const workdirOid = await getWorkdirOid()\n return workdirOid === treeOid ? '*undeleted' : '*undeletemodified' // A-A : A-B\n }\n if (H && W && I) {\n const workdirOid = await getWorkdirOid()\n if (workdirOid === treeOid) {\n // @ts-ignore\n return workdirOid === indexEntry.oid ? 'unmodified' : '*unmodified' // AAA : ABA\n } else {\n // @ts-ignore\n return workdirOid === indexEntry.oid ? 'modified' : '*modified' // ABB : AAB\n }\n }\n /*\n ---\n -A-\n --A\n -AA\n -AB\n A--\n AA-\n AB-\n A-A\n A-B\n AAA\n ABA\n ABB\n AAB\n */\n } catch (err) {\n err.caller = 'git.status'\n throw err\n }\n}\n\nasync function getOidAtPath({ fs, cache, gitdir, tree, path }) {\n if (typeof path === 'string') path = path.split('/')\n const dirname = path.shift()\n for (const entry of tree) {\n if (entry.path === dirname) {\n if (path.length === 0) {\n return entry.oid\n }\n const { type, object } = await _readObject({\n fs,\n cache,\n gitdir,\n oid: entry.oid,\n })\n if (type === 'tree') {\n const tree = GitTree.from(object)\n return getOidAtPath({ fs, cache, gitdir, tree, path })\n }\n if (type === 'blob') {\n throw new ObjectTypeError(entry.oid, type, 'blob', path.join('/'))\n }\n }\n }\n return null\n}\n\nasync function getHeadTree({ fs, cache, gitdir }) {\n // Get the tree from the HEAD commit.\n let oid\n try {\n oid = await GitRefManager.resolve({ fs, gitdir, ref: 'HEAD' })\n } catch (e) {\n // Handle fresh branches with no commits\n if (e instanceof NotFoundError) {\n return []\n }\n }\n const { tree } = await _readTree({ fs, cache, gitdir, oid })\n return tree\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { STAGE } from '../commands/STAGE.js'\nimport { TREE } from '../commands/TREE.js'\nimport { WORKDIR } from '../commands/WORKDIR.js'\nimport { _walk } from '../commands/walk.js'\nimport { GitIgnoreManager } from '../managers/GitIgnoreManager.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { assertParameter } from '../utils/assertParameter.js'\nimport { join } from '../utils/join.js'\nimport { worthWalking } from '../utils/worthWalking.js'\n\n/**\n * Efficiently get the status of multiple files at once.\n *\n * The returned `StatusMatrix` is admittedly not the easiest format to read.\n * However it conveys a large amount of information in dense format that should make it easy to create reports about the current state of the repository;\n * without having to do multiple, time-consuming isomorphic-git calls.\n * My hope is that the speed and flexibility of the function will make up for the learning curve of interpreting the return value.\n *\n * ```js live\n * // get the status of all the files in 'src'\n * let status = await git.statusMatrix({\n * fs,\n * dir: '/tutorial',\n * filter: f => f.startsWith('src/')\n * })\n * console.log(status)\n * ```\n *\n * ```js live\n * // get the status of all the JSON and Markdown files\n * let status = await git.statusMatrix({\n * fs,\n * dir: '/tutorial',\n * filter: f => f.endsWith('.json') || f.endsWith('.md')\n * })\n * console.log(status)\n * ```\n *\n * The result is returned as a 2D array.\n * The outer array represents the files and/or blobs in the repo, in alphabetical order.\n * The inner arrays describe the status of the file:\n * the first value is the filepath, and the next three are integers\n * representing the HEAD status, WORKDIR status, and STAGE status of the entry.\n *\n * ```js\n * // example StatusMatrix\n * [\n * [\"a.txt\", 0, 2, 0], // new, untracked\n * [\"b.txt\", 0, 2, 2], // added, staged\n * [\"c.txt\", 0, 2, 3], // added, staged, with unstaged changes\n * [\"d.txt\", 1, 1, 1], // unmodified\n * [\"e.txt\", 1, 2, 1], // modified, unstaged\n * [\"f.txt\", 1, 2, 2], // modified, staged\n * [\"g.txt\", 1, 2, 3], // modified, staged, with unstaged changes\n * [\"h.txt\", 1, 0, 1], // deleted, unstaged\n * [\"i.txt\", 1, 0, 0], // deleted, staged\n * ]\n * ```\n *\n * - The HEAD status is either absent (0) or present (1).\n * - The WORKDIR status is either absent (0), identical to HEAD (1), or different from HEAD (2).\n * - The STAGE status is either absent (0), identical to HEAD (1), identical to WORKDIR (2), or different from WORKDIR (3).\n *\n * ```ts\n * type Filename = string\n * type HeadStatus = 0 | 1\n * type WorkdirStatus = 0 | 1 | 2\n * type StageStatus = 0 | 1 | 2 | 3\n *\n * type StatusRow = [Filename, HeadStatus, WorkdirStatus, StageStatus]\n *\n * type StatusMatrix = StatusRow[]\n * ```\n *\n * > Think of the natural progression of file modifications as being from HEAD (previous) -> WORKDIR (current) -> STAGE (next).\n * > Then HEAD is \"version 1\", WORKDIR is \"version 2\", and STAGE is \"version 3\".\n * > Then, imagine a \"version 0\" which is before the file was created.\n * > Then the status value in each column corresponds to the oldest version of the file it is identical to.\n * > (For a file to be identical to \"version 0\" means the file is deleted.)\n *\n * Here are some examples of queries you can answer using the result:\n *\n * #### Q: What files have been deleted?\n * ```js\n * const FILE = 0, WORKDIR = 2\n *\n * const filenames = (await statusMatrix({ dir }))\n * .filter(row => row[WORKDIR] === 0)\n * .map(row => row[FILE])\n * ```\n *\n * #### Q: What files have unstaged changes?\n * ```js\n * const FILE = 0, WORKDIR = 2, STAGE = 3\n *\n * const filenames = (await statusMatrix({ dir }))\n * .filter(row => row[WORKDIR] !== row[STAGE])\n * .map(row => row[FILE])\n * ```\n *\n * #### Q: What files have been modified since the last commit?\n * ```js\n * const FILE = 0, HEAD = 1, WORKDIR = 2\n *\n * const filenames = (await statusMatrix({ dir }))\n * .filter(row => row[HEAD] !== row[WORKDIR])\n * .map(row => row[FILE])\n * ```\n *\n * #### Q: What files will NOT be changed if I commit right now?\n * ```js\n * const FILE = 0, HEAD = 1, STAGE = 3\n *\n * const filenames = (await statusMatrix({ dir }))\n * .filter(row => row[HEAD] === row[STAGE])\n * .map(row => row[FILE])\n * ```\n *\n * For reference, here are all possible combinations:\n *\n * | HEAD | WORKDIR | STAGE | `git status --short` equivalent |\n * | ---- | ------- | ----- | ------------------------------- |\n * | 0 | 0 | 0 | `` |\n * | 0 | 0 | 3 | `AD` |\n * | 0 | 2 | 0 | `??` |\n * | 0 | 2 | 2 | `A ` |\n * | 0 | 2 | 3 | `AM` |\n * | 1 | 0 | 0 | `D ` |\n * | 1 | 0 | 1 | ` D` |\n * | 1 | 0 | 3 | `MD` |\n * | 1 | 1 | 0 | `D ` + `??` |\n * | 1 | 1 | 1 | `` |\n * | 1 | 1 | 3 | `MM` |\n * | 1 | 2 | 0 | `D ` + `??` |\n * | 1 | 2 | 1 | ` M` |\n * | 1 | 2 | 2 | `M ` |\n * | 1 | 2 | 3 | `MM` |\n *\n * @param {object} args\n * @param {FsClient} args.fs - a file system client\n * @param {string} args.dir - The [working tree](dir-vs-gitdir.md) directory path\n * @param {string} [args.gitdir=join(dir, '.git')] - [required] The [git directory](dir-vs-gitdir.md) path\n * @param {string} [args.ref = 'HEAD'] - Optionally specify a different commit to compare against the workdir and stage instead of the HEAD\n * @param {string[]} [args.filepaths = ['.']] - Limit the query to the given files and directories\n * @param {function(string): boolean} [args.filter] - Filter the results to only those whose filepath matches a function.\n * @param {object} [args.cache] - a [cache](cache.md) object\n * @param {boolean} [args.ignored = false] - include ignored files in the result\n *\n * @returns {Promise<Array<StatusRow>>} Resolves with a status matrix, described below.\n * @see StatusRow\n */\nexport async function statusMatrix({\n fs: _fs,\n dir,\n gitdir = join(dir, '.git'),\n ref = 'HEAD',\n filepaths = ['.'],\n filter,\n cache = {},\n ignored: shouldIgnore = false,\n}) {\n try {\n assertParameter('fs', _fs)\n assertParameter('gitdir', gitdir)\n assertParameter('ref', ref)\n\n const fs = new FileSystem(_fs)\n return await _walk({\n fs,\n cache,\n dir,\n gitdir,\n trees: [TREE({ ref }), WORKDIR(), STAGE()],\n map: async function(filepath, [head, workdir, stage]) {\n // Ignore ignored files, but only if they are not already tracked.\n if (!head && !stage && workdir) {\n if (!shouldIgnore) {\n const isIgnored = await GitIgnoreManager.isIgnored({\n fs,\n dir,\n filepath,\n })\n if (isIgnored) {\n return null\n }\n }\n }\n // match against base paths\n if (!filepaths.some(base => worthWalking(filepath, base))) {\n return null\n }\n // Late filter against file names\n if (filter) {\n if (!filter(filepath)) return\n }\n\n const [headType, workdirType, stageType] = await Promise.all([\n head && head.type(),\n workdir && workdir.type(),\n stage && stage.type(),\n ])\n\n const isBlob = [headType, workdirType, stageType].includes('blob')\n\n // For now, bail on directories unless the file is also a blob in another tree\n if ((headType === 'tree' || headType === 'special') && !isBlob) return\n if (headType === 'commit') return null\n\n if ((workdirType === 'tree' || workdirType === 'special') && !isBlob)\n return\n\n if (stageType === 'commit') return null\n if ((stageType === 'tree' || stageType === 'special') && !isBlob) return\n\n // Figure out the oids for files, using the staged oid for the working dir oid if the stats match.\n const headOid = headType === 'blob' ? await head.oid() : undefined\n const stageOid = stageType === 'blob' ? await stage.oid() : undefined\n let workdirOid\n if (\n headType !== 'blob' &&\n workdirType === 'blob' &&\n stageType !== 'blob'\n ) {\n // We don't actually NEED the sha. Any sha will do\n // TODO: update this logic to handle N trees instead of just 3.\n workdirOid = '42'\n } else if (workdirType === 'blob') {\n workdirOid = await workdir.oid()\n }\n const entry = [undefined, headOid, workdirOid, stageOid]\n const result = entry.map(value => entry.indexOf(value))\n result.shift() // remove leading undefined entry\n return [filepath, ...result]\n },\n })\n } catch (err) {\n err.caller = 'git.statusMatrix'\n throw err\n }\n}\n","// @ts-check\nimport { AlreadyExistsError } from '../errors/AlreadyExistsError.js'\nimport { MissingParameterError } from '../errors/MissingParameterError.js'\nimport { GitRefManager } from '../managers/GitRefManager'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { assertParameter } from '../utils/assertParameter'\nimport { join } from '../utils/join.js'\n\n/**\n * Create a lightweight tag\n *\n * @param {object} args\n * @param {FsClient} args.fs - a file system client\n * @param {string} [args.dir] - The [working tree](dir-vs-gitdir.md) directory path\n * @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path\n * @param {string} args.ref - What to name the tag\n * @param {string} [args.object = 'HEAD'] - What oid the tag refers to. (Will resolve to oid if value is a ref.) By default, the commit object which is referred by the current `HEAD` is used.\n * @param {boolean} [args.force = false] - Instead of throwing an error if a tag named `ref` already exists, overwrite the existing tag.\n *\n * @returns {Promise<void>} Resolves successfully when filesystem operations are complete\n *\n * @example\n * await git.tag({ fs, dir: '/tutorial', ref: 'test-tag' })\n * console.log('done')\n *\n */\nexport async function tag({\n fs: _fs,\n dir,\n gitdir = join(dir, '.git'),\n ref,\n object,\n force = false,\n}) {\n try {\n assertParameter('fs', _fs)\n assertParameter('gitdir', gitdir)\n assertParameter('ref', ref)\n\n const fs = new FileSystem(_fs)\n\n if (ref === undefined) {\n throw new MissingParameterError('ref')\n }\n\n ref = ref.startsWith('refs/tags/') ? ref : `refs/tags/${ref}`\n\n // Resolve passed object\n const value = await GitRefManager.resolve({\n fs,\n gitdir,\n ref: object || 'HEAD',\n })\n\n if (!force && (await GitRefManager.exists({ fs, gitdir, ref }))) {\n throw new AlreadyExistsError('tag', ref)\n }\n\n await GitRefManager.writeRef({ fs, gitdir, ref, value })\n } catch (err) {\n err.caller = 'git.tag'\n throw err\n }\n}\n","// @ts-check\nimport { InvalidFilepathError } from '../errors/InvalidFilepathError.js'\nimport { NotFoundError } from '../errors/NotFoundError.js'\nimport { GitIndexManager } from '../managers/GitIndexManager.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { _writeObject } from '../storage/writeObject.js'\nimport { assertParameter } from '../utils/assertParameter.js'\nimport { join } from '../utils/join.js'\n\n/**\n * Register file contents in the working tree or object database to the git index (aka staging area).\n *\n * @param {object} args\n * @param {FsClient} args.fs - a file system client\n * @param {string} args.dir - The [working tree](dir-vs-gitdir.md) directory path\n * @param {string} [args.gitdir=join(dir, '.git')] - [required] The [git directory](dir-vs-gitdir.md) path\n * @param {string} args.filepath - File to act upon.\n * @param {string} [args.oid] - OID of the object in the object database to add to the index with the specified filepath.\n * @param {number} [args.mode = 100644] - The file mode to add the file to the index.\n * @param {boolean} [args.add] - Adds the specified file to the index if it does not yet exist in the index.\n * @param {boolean} [args.remove] - Remove the specified file from the index if it does not exist in the workspace anymore.\n * @param {boolean} [args.force] - Remove the specified file from the index, even if it still exists in the workspace.\n * @param {object} [args.cache] - a [cache](cache.md) object\n *\n * @returns {Promise<string | void>} Resolves successfully with the SHA-1 object id of the object written or updated in the index, or nothing if the file was removed.\n *\n * @example\n * await git.updateIndex({\n * fs,\n * dir: '/tutorial',\n * filepath: 'readme.md'\n * })\n *\n * @example\n * // Manually create a blob in the object database.\n * let oid = await git.writeBlob({\n * fs,\n * dir: '/tutorial',\n * blob: new Uint8Array([])\n * })\n *\n * // Write the object in the object database to the index.\n * await git.updateIndex({\n * fs,\n * dir: '/tutorial',\n * add: true,\n * filepath: 'readme.md',\n * oid\n * })\n */\nexport async function updateIndex({\n fs: _fs,\n dir,\n gitdir = join(dir, '.git'),\n cache = {},\n filepath,\n oid,\n mode,\n add,\n remove,\n force,\n}) {\n try {\n assertParameter('fs', _fs)\n assertParameter('gitdir', gitdir)\n assertParameter('filepath', filepath)\n\n const fs = new FileSystem(_fs)\n\n if (remove) {\n return await GitIndexManager.acquire(\n { fs, gitdir, cache },\n async function(index) {\n let fileStats\n\n if (!force) {\n // Check if the file is still present in the working directory\n fileStats = await fs.lstat(join(dir, filepath))\n\n if (fileStats) {\n if (fileStats.isDirectory()) {\n // Removing directories should not work\n throw new InvalidFilepathError('directory')\n }\n\n // Do nothing if we don't force and the file still exists in the workdir\n return\n }\n }\n\n // Directories are not allowed, so we make sure the provided filepath exists in the index\n if (index.has({ filepath })) {\n index.delete({\n filepath,\n })\n }\n }\n )\n }\n\n // Test if it is a file and exists on disk if `remove` is not provided, only of no oid is provided\n let fileStats\n\n if (!oid) {\n fileStats = await fs.lstat(join(dir, filepath))\n\n if (!fileStats) {\n throw new NotFoundError(\n `file at \"${filepath}\" on disk and \"remove\" not set`\n )\n }\n\n if (fileStats.isDirectory()) {\n throw new InvalidFilepathError('directory')\n }\n }\n\n return await GitIndexManager.acquire({ fs, gitdir, cache }, async function(\n index\n ) {\n if (!add && !index.has({ filepath })) {\n // If the index does not contain the filepath yet and `add` is not set, we should throw\n throw new NotFoundError(\n `file at \"${filepath}\" in index and \"add\" not set`\n )\n }\n\n // By default we use 0 for the stats of the index file\n let stats = {\n ctime: new Date(0),\n mtime: new Date(0),\n dev: 0,\n ino: 0,\n mode,\n uid: 0,\n gid: 0,\n size: 0,\n }\n\n if (!oid) {\n stats = fileStats\n\n // Write the file to the object database\n const object = stats.isSymbolicLink()\n ? await fs.readlink(join(dir, filepath))\n : await fs.read(join(dir, filepath))\n\n oid = await _writeObject({\n fs,\n gitdir,\n type: 'blob',\n format: 'content',\n object,\n })\n }\n\n index.insert({\n filepath,\n oid: oid,\n stats,\n })\n\n return oid\n })\n } catch (err) {\n err.caller = 'git.updateIndex'\n throw err\n }\n}\n","// @ts-check\nimport { pkg } from '../utils/pkg.js'\n\n/**\n * Return the version number of isomorphic-git\n *\n * I don't know why you might need this. I added it just so I could check that I was getting\n * the correct version of the library and not a cached version.\n *\n * @returns {string} the version string taken from package.json at publication time\n *\n * @example\n * console.log(git.version())\n *\n */\nexport function version() {\n try {\n return pkg.version\n } catch (err) {\n err.caller = 'git.version'\n throw err\n }\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { _walk } from '../commands/walk.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { assertParameter } from '../utils/assertParameter.js'\nimport { join } from '../utils/join.js'\n\n/**\n * @callback WalkerMap\n * @param {string} filename\n * @param {Array<WalkerEntry | null>} entries\n * @returns {Promise<any>}\n */\n\n/**\n * @callback WalkerReduce\n * @param {any} parent\n * @param {any[]} children\n * @returns {Promise<any>}\n */\n\n/**\n * @callback WalkerIterateCallback\n * @param {WalkerEntry[]} entries\n * @returns {Promise<any[]>}\n */\n\n/**\n * @callback WalkerIterate\n * @param {WalkerIterateCallback} walk\n * @param {IterableIterator<WalkerEntry[]>} children\n * @returns {Promise<any[]>}\n */\n\n/**\n * A powerful recursive tree-walking utility.\n *\n * The `walk` API simplifies gathering detailed information about a tree or comparing all the filepaths in two or more trees.\n * Trees can be git commits, the working directory, or the or git index (staging area).\n * As long as a file or directory is present in at least one of the trees, it will be traversed.\n * Entries are traversed in alphabetical order.\n *\n * The arguments to `walk` are the `trees` you want to traverse, and 3 optional transform functions:\n * `map`, `reduce`, and `iterate`.\n *\n * ## `TREE`, `WORKDIR`, and `STAGE`\n *\n * Tree walkers are represented by three separate functions that can be imported:\n *\n * ```js\n * import { TREE, WORKDIR, STAGE } from 'isomorphic-git'\n * ```\n *\n * These functions return opaque handles called `Walker`s.\n * The only thing that `Walker` objects are good for is passing into `walk`.\n * Here are the three `Walker`s passed into `walk` by the `statusMatrix` command for example:\n *\n * ```js\n * let ref = 'HEAD'\n *\n * let trees = [TREE({ ref }), WORKDIR(), STAGE()]\n * ```\n *\n * For the arguments, see the doc pages for [TREE](./TREE.md), [WORKDIR](./WORKDIR.md), and [STAGE](./STAGE.md).\n *\n * `map`, `reduce`, and `iterate` allow you control the recursive walk by pruning and transforming `WalkerEntry`s into the desired result.\n *\n * ## WalkerEntry\n *\n * {@link WalkerEntry typedef}\n *\n * `map` receives an array of `WalkerEntry[]` as its main argument, one `WalkerEntry` for each `Walker` in the `trees` argument.\n * The methods are memoized per `WalkerEntry` so calling them multiple times in a `map` function does not adversely impact performance.\n * By only computing these values if needed, you build can build lean, mean, efficient walking machines.\n *\n * ### WalkerEntry#type()\n *\n * Returns the kind as a string. This is normally either `tree` or `blob`.\n *\n * `TREE`, `STAGE`, and `WORKDIR` walkers all return a string.\n *\n * Possible values:\n *\n * - `'tree'` directory\n * - `'blob'` file\n * - `'special'` used by `WORKDIR` to represent irregular files like sockets and FIFOs\n * - `'commit'` used by `TREE` to represent submodules\n *\n * ```js\n * await entry.type()\n * ```\n *\n * ### WalkerEntry#mode()\n *\n * Returns the file mode as a number. Use this to distinguish between regular files, symlinks, and executable files.\n *\n * `TREE`, `STAGE`, and `WORKDIR` walkers all return a number for all `type`s of entries.\n *\n * It has been normalized to one of the 4 values that are allowed in git commits:\n *\n * - `0o40000` directory\n * - `0o100644` file\n * - `0o100755` file (executable)\n * - `0o120000` symlink\n *\n * Tip: to make modes more readable, you can print them to octal using `.toString(8)`.\n *\n * ```js\n * await entry.mode()\n * ```\n *\n * ### WalkerEntry#oid()\n *\n * Returns the SHA-1 object id for blobs and trees.\n *\n * `TREE` walkers return a string for `blob` and `tree` entries.\n *\n * `STAGE` and `WORKDIR` walkers return a string for `blob` entries and `undefined` for `tree` entries.\n *\n * ```js\n * await entry.oid()\n * ```\n *\n * ### WalkerEntry#content()\n *\n * Returns the file contents as a Buffer.\n *\n * `TREE` and `WORKDIR` walkers return a Buffer for `blob` entries and `undefined` for `tree` entries.\n *\n * `STAGE` walkers always return `undefined` since the file contents are never stored in the stage.\n *\n * ```js\n * await entry.content()\n * ```\n *\n * ### WalkerEntry#stat()\n *\n * Returns a normalized subset of filesystem Stat data.\n *\n * `WORKDIR` walkers return a `Stat` for `blob` and `tree` entries.\n *\n * `STAGE` walkers return a `Stat` for `blob` entries and `undefined` for `tree` entries.\n *\n * `TREE` walkers return `undefined` for all entry types.\n *\n * ```js\n * await entry.stat()\n * ```\n *\n * {@link Stat typedef}\n *\n * ## map(string, Array<WalkerEntry|null>) => Promise<any>\n *\n * {@link WalkerMap typedef}\n *\n * This is the function that is called once per entry BEFORE visiting the children of that node.\n *\n * If you return `null` for a `tree` entry, then none of the children of that `tree` entry will be walked.\n *\n * This is a good place for query logic, such as examining the contents of a file.\n * Ultimately, compare all the entries and return any values you are interested in.\n * If you do not return a value (or return undefined) that entry will be filtered from the results.\n *\n * Example 1: Find all the files containing the word 'foo'.\n * ```js\n * async function map(filepath, [head, workdir]) {\n * let content = (await workdir.content()).toString('utf8')\n * if (content.contains('foo')) {\n * return {\n * filepath,\n * content\n * }\n * }\n * }\n * ```\n *\n * Example 2: Return the difference between the working directory and the HEAD commit\n * ```js\n * const map = async (filepath, [head, workdir]) => {\n * return {\n * filepath,\n * oid: await head?.oid(),\n * diff: diff(\n * (await head?.content())?.toString('utf8') || '',\n * (await workdir?.content())?.toString('utf8') || ''\n * )\n * }\n * }\n * ```\n *\n * Example 3:\n * ```js\n * let path = require('path')\n * // Only examine files in the directory `cwd`\n * let cwd = 'src/app'\n * async function map (filepath, [head, workdir, stage]) {\n * if (\n * // don't skip the root directory\n * head.fullpath !== '.' &&\n * // return true for 'src' and 'src/app'\n * !cwd.startsWith(filepath) &&\n * // return true for 'src/app/*'\n * path.dirname(filepath) !== cwd\n * ) {\n * return null\n * } else {\n * return filepath\n * }\n * }\n * ```\n *\n * ## reduce(parent, children)\n *\n * {@link WalkerReduce typedef}\n *\n * This is the function that is called once per entry AFTER visiting the children of that node.\n *\n * Default: `async (parent, children) => parent === undefined ? children.flat() : [parent, children].flat()`\n *\n * The default implementation of this function returns all directories and children in a giant flat array.\n * You can define a different accumulation method though.\n *\n * Example: Return a hierarchical structure\n * ```js\n * async function reduce (parent, children) {\n * return Object.assign(parent, { children })\n * }\n * ```\n *\n * ## iterate(walk, children)\n *\n * {@link WalkerIterate typedef}\n *\n * {@link WalkerIterateCallback typedef}\n *\n * Default: `(walk, children) => Promise.all([...children].map(walk))`\n *\n * The default implementation recurses all children concurrently using Promise.all.\n * However you could use a custom function to traverse children serially or use a global queue to throttle recursion.\n *\n * @param {object} args\n * @param {FsClient} args.fs - a file system client\n * @param {string} [args.dir] - The [working tree](dir-vs-gitdir.md) directory path\n * @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path\n * @param {Walker[]} args.trees - The trees you want to traverse\n * @param {WalkerMap} [args.map] - Transform `WalkerEntry`s into a result form\n * @param {WalkerReduce} [args.reduce] - Control how mapped entries are combined with their parent result\n * @param {WalkerIterate} [args.iterate] - Fine-tune how entries within a tree are iterated over\n * @param {object} [args.cache] - a [cache](cache.md) object\n *\n * @returns {Promise<any>} The finished tree-walking result\n */\nexport async function walk({\n fs,\n dir,\n gitdir = join(dir, '.git'),\n trees,\n map,\n reduce,\n iterate,\n cache = {},\n}) {\n try {\n assertParameter('fs', fs)\n assertParameter('gitdir', gitdir)\n assertParameter('trees', trees)\n\n return await _walk({\n fs: new FileSystem(fs),\n cache,\n dir,\n gitdir,\n trees,\n map,\n reduce,\n iterate,\n })\n } catch (err) {\n err.caller = 'git.walk'\n throw err\n }\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { FileSystem } from '../models/FileSystem.js'\nimport { _writeObject } from '../storage/writeObject'\nimport { assertParameter } from '../utils/assertParameter.js'\nimport { join } from '../utils/join.js'\n\n/**\n * Write a blob object directly\n *\n * @param {object} args\n * @param {FsClient} args.fs - a file system client\n * @param {string} [args.dir] - The [working tree](dir-vs-gitdir.md) directory path\n * @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path\n * @param {Uint8Array} args.blob - The blob object to write\n *\n * @returns {Promise<string>} Resolves successfully with the SHA-1 object id of the newly written object\n *\n * @example\n * // Manually create a blob.\n * let oid = await git.writeBlob({\n * fs,\n * dir: '/tutorial',\n * blob: new Uint8Array([])\n * })\n *\n * console.log('oid', oid) // should be 'e69de29bb2d1d6434b8b29ae775ad8c2e48c5391'\n *\n */\nexport async function writeBlob({ fs, dir, gitdir = join(dir, '.git'), blob }) {\n try {\n assertParameter('fs', fs)\n assertParameter('gitdir', gitdir)\n assertParameter('blob', blob)\n\n return await _writeObject({\n fs: new FileSystem(fs),\n gitdir,\n type: 'blob',\n object: blob,\n format: 'content',\n })\n } catch (err) {\n err.caller = 'git.writeBlob'\n throw err\n }\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { GitCommit } from '../models/GitCommit.js'\nimport { _writeObject as writeObject } from '../storage/writeObject.js'\n\n/**\n * @param {object} args\n * @param {import('../models/FileSystem.js').FileSystem} args.fs\n * @param {string} args.gitdir\n * @param {CommitObject} args.commit\n *\n * @returns {Promise<string>}\n * @see CommitObject\n *\n */\nexport async function _writeCommit({ fs, gitdir, commit }) {\n // Convert object to buffer\n const object = GitCommit.from(commit).toObject()\n const oid = await writeObject({\n fs,\n gitdir,\n type: 'commit',\n object,\n format: 'content',\n })\n return oid\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { _writeCommit } from '../commands/writeCommit.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { assertParameter } from '../utils/assertParameter.js'\nimport { join } from '../utils/join.js'\n\n/**\n * Write a commit object directly\n *\n * @param {object} args\n * @param {FsClient} args.fs - a file system client\n * @param {string} [args.dir] - The [working tree](dir-vs-gitdir.md) directory path\n * @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path\n * @param {CommitObject} args.commit - The object to write\n *\n * @returns {Promise<string>} Resolves successfully with the SHA-1 object id of the newly written object\n * @see CommitObject\n *\n */\nexport async function writeCommit({\n fs,\n dir,\n gitdir = join(dir, '.git'),\n commit,\n}) {\n try {\n assertParameter('fs', fs)\n assertParameter('gitdir', gitdir)\n assertParameter('commit', commit)\n\n return await _writeCommit({\n fs: new FileSystem(fs),\n gitdir,\n commit,\n })\n } catch (err) {\n err.caller = 'git.writeCommit'\n throw err\n }\n}\n","// @ts-check\nimport cleanGitRef from 'clean-git-ref'\n\nimport { AlreadyExistsError } from '../errors/AlreadyExistsError.js'\nimport { InvalidRefNameError } from '../errors/InvalidRefNameError.js'\nimport { GitRefManager } from '../managers/GitRefManager.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { assertParameter } from '../utils/assertParameter.js'\nimport { join } from '../utils/join.js'\n\n/**\n * Write a ref which refers to the specified SHA-1 object id, or a symbolic ref which refers to the specified ref.\n *\n * @param {object} args\n * @param {FsClient} args.fs - a file system client\n * @param {string} [args.dir] - The [working tree](dir-vs-gitdir.md) directory path\n * @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path\n * @param {string} args.ref - The name of the ref to write\n * @param {string} args.value - When `symbolic` is false, a ref or an SHA-1 object id. When true, a ref starting with `refs/`.\n * @param {boolean} [args.force = false] - Instead of throwing an error if a ref named `ref` already exists, overwrite the existing ref.\n * @param {boolean} [args.symbolic = false] - Whether the ref is symbolic or not.\n *\n * @returns {Promise<void>} Resolves successfully when filesystem operations are complete\n *\n * @example\n * await git.writeRef({\n * fs,\n * dir: '/tutorial',\n * ref: 'refs/heads/another-branch',\n * value: 'HEAD'\n * })\n * await git.writeRef({\n * fs,\n * dir: '/tutorial',\n * ref: 'HEAD',\n * value: 'refs/heads/another-branch',\n * force: true,\n * symbolic: true\n * })\n * console.log('done')\n *\n */\nexport async function writeRef({\n fs: _fs,\n dir,\n gitdir = join(dir, '.git'),\n ref,\n value,\n force = false,\n symbolic = false,\n}) {\n try {\n assertParameter('fs', _fs)\n assertParameter('gitdir', gitdir)\n assertParameter('ref', ref)\n assertParameter('value', value)\n\n const fs = new FileSystem(_fs)\n\n if (ref !== cleanGitRef.clean(ref)) {\n throw new InvalidRefNameError(ref, cleanGitRef.clean(ref))\n }\n\n if (!force && (await GitRefManager.exists({ fs, gitdir, ref }))) {\n throw new AlreadyExistsError('ref', ref)\n }\n\n if (symbolic) {\n await GitRefManager.writeSymbolicRef({\n fs,\n gitdir,\n ref,\n value,\n })\n } else {\n value = await GitRefManager.resolve({\n fs,\n gitdir,\n ref: value,\n })\n await GitRefManager.writeRef({\n fs,\n gitdir,\n ref,\n value,\n })\n }\n } catch (err) {\n err.caller = 'git.writeRef'\n throw err\n }\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { GitAnnotatedTag } from '../models/GitAnnotatedTag.js'\nimport { _writeObject as writeObject } from '../storage/writeObject.js'\n\n/**\n * @param {object} args\n * @param {import('../models/FileSystem.js').FileSystem} args.fs\n * @param {string} args.gitdir\n * @param {TagObject} args.tag\n *\n * @returns {Promise<string>}\n */\nexport async function _writeTag({ fs, gitdir, tag }) {\n // Convert object to buffer\n const object = GitAnnotatedTag.from(tag).toObject()\n const oid = await writeObject({\n fs,\n gitdir,\n type: 'tag',\n object,\n format: 'content',\n })\n return oid\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { _writeTag } from '../commands/writeTag.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { assertParameter } from '../utils/assertParameter.js'\nimport { join } from '../utils/join.js'\n\n/**\n * Write an annotated tag object directly\n *\n * @param {object} args\n * @param {FsClient} args.fs - a file system client\n * @param {string} [args.dir] - The [working tree](dir-vs-gitdir.md) directory path\n * @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path\n * @param {TagObject} args.tag - The object to write\n *\n * @returns {Promise<string>} Resolves successfully with the SHA-1 object id of the newly written object\n * @see TagObject\n *\n * @example\n * // Manually create an annotated tag.\n * let sha = await git.resolveRef({ fs, dir: '/tutorial', ref: 'HEAD' })\n * console.log('commit', sha)\n *\n * let oid = await git.writeTag({\n * fs,\n * dir: '/tutorial',\n * tag: {\n * object: sha,\n * type: 'commit',\n * tag: 'my-tag',\n * tagger: {\n * name: 'your name',\n * email: 'email@example.com',\n * timestamp: Math.floor(Date.now()/1000),\n * timezoneOffset: new Date().getTimezoneOffset()\n * },\n * message: 'Optional message'\n * }\n * })\n *\n * console.log('tag', oid)\n *\n */\nexport async function writeTag({ fs, dir, gitdir = join(dir, '.git'), tag }) {\n try {\n assertParameter('fs', fs)\n assertParameter('gitdir', gitdir)\n assertParameter('tag', tag)\n\n return await _writeTag({\n fs: new FileSystem(fs),\n gitdir,\n tag,\n })\n } catch (err) {\n err.caller = 'git.writeTag'\n throw err\n }\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { _writeTree } from '../commands/writeTree.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { assertParameter } from '../utils/assertParameter.js'\nimport { join } from '../utils/join.js'\n\n/**\n * Write a tree object directly\n *\n * @param {object} args\n * @param {FsClient} args.fs - a file system client\n * @param {string} [args.dir] - The [working tree](dir-vs-gitdir.md) directory path\n * @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path\n * @param {TreeObject} args.tree - The object to write\n *\n * @returns {Promise<string>} Resolves successfully with the SHA-1 object id of the newly written object.\n * @see TreeObject\n * @see TreeEntry\n *\n */\nexport async function writeTree({ fs, dir, gitdir = join(dir, '.git'), tree }) {\n try {\n assertParameter('fs', fs)\n assertParameter('gitdir', gitdir)\n assertParameter('tree', tree)\n\n return await _writeTree({\n fs: new FileSystem(fs),\n gitdir,\n tree,\n })\n } catch (err) {\n err.caller = 'git.writeTree'\n throw err\n }\n}\n","import './typedefs.js'\n\nimport { STAGE } from './api/STAGE.js'\nimport { TREE } from './api/TREE.js'\nimport { WORKDIR } from './api/WORKDIR.js'\nimport { abortMerge } from './api/abortMerge.js'\nimport { add } from './api/add.js'\nimport { addNote } from './api/addNote.js'\nimport { addRemote } from './api/addRemote.js'\nimport { annotatedTag } from './api/annotatedTag.js'\nimport { branch } from './api/branch.js'\nimport { checkout } from './api/checkout.js'\nimport { clone } from './api/clone.js'\nimport { commit } from './api/commit.js'\nimport { currentBranch } from './api/currentBranch.js'\nimport { deleteBranch } from './api/deleteBranch.js'\nimport { deleteRef } from './api/deleteRef.js'\nimport { deleteRemote } from './api/deleteRemote.js'\nimport { deleteTag } from './api/deleteTag.js'\nimport { expandOid } from './api/expandOid.js'\nimport { expandRef } from './api/expandRef.js'\nimport { fastForward } from './api/fastForward.js'\nimport { fetch } from './api/fetch.js'\nimport { findMergeBase } from './api/findMergeBase.js'\nimport { findRoot } from './api/findRoot.js'\nimport { getConfig } from './api/getConfig.js'\nimport { getConfigAll } from './api/getConfigAll.js'\nimport { getRemoteInfo } from './api/getRemoteInfo.js'\nimport { getRemoteInfo2 } from './api/getRemoteInfo2.js'\nimport { hashBlob } from './api/hashBlob.js'\nimport { indexPack } from './api/indexPack.js'\nimport { init } from './api/init.js'\nimport { isDescendent } from './api/isDescendent.js'\nimport { isIgnored } from './api/isIgnored.js'\nimport { listBranches } from './api/listBranches.js'\nimport { listFiles } from './api/listFiles.js'\nimport { listNotes } from './api/listNotes.js'\nimport { listRemotes } from './api/listRemotes.js'\nimport { listServerRefs } from './api/listServerRefs.js'\nimport { listTags } from './api/listTags.js'\nimport { log } from './api/log.js'\nimport { merge } from './api/merge.js'\nimport { packObjects } from './api/packObjects.js'\nimport { pull } from './api/pull.js'\nimport { push } from './api/push.js'\nimport { readBlob } from './api/readBlob.js'\nimport { readCommit } from './api/readCommit.js'\nimport { readNote } from './api/readNote.js'\nimport { readObject } from './api/readObject.js'\nimport { readTag } from './api/readTag.js'\nimport { readTree } from './api/readTree.js'\nimport { remove } from './api/remove.js'\nimport { removeNote } from './api/removeNote.js'\nimport { renameBranch } from './api/renameBranch.js'\nimport { resetIndex } from './api/resetIndex.js'\nimport { resolveRef } from './api/resolveRef.js'\nimport { setConfig } from './api/setConfig.js'\nimport { status } from './api/status.js'\nimport { statusMatrix } from './api/statusMatrix.js'\nimport { tag } from './api/tag.js'\nimport { updateIndex } from './api/updateIndex.js'\nimport { version } from './api/version.js'\nimport { walk } from './api/walk.js'\nimport { writeBlob } from './api/writeBlob.js'\nimport { writeCommit } from './api/writeCommit.js'\nimport { writeObject } from './api/writeObject.js'\nimport { writeRef } from './api/writeRef.js'\nimport { writeTag } from './api/writeTag.js'\nimport { writeTree } from './api/writeTree.js'\nimport * as Errors from './errors/index.js'\n\n// named exports\nexport {\n Errors,\n STAGE,\n TREE,\n WORKDIR,\n abortMerge,\n add,\n addNote,\n addRemote,\n annotatedTag,\n branch,\n checkout,\n clone,\n commit,\n getConfig,\n getConfigAll,\n setConfig,\n currentBranch,\n deleteBranch,\n deleteRef,\n deleteRemote,\n deleteTag,\n expandOid,\n expandRef,\n fastForward,\n fetch,\n findMergeBase,\n findRoot,\n getRemoteInfo,\n getRemoteInfo2,\n hashBlob,\n indexPack,\n init,\n isDescendent,\n isIgnored,\n listBranches,\n listFiles,\n listNotes,\n listRemotes,\n listServerRefs,\n listTags,\n log,\n merge,\n packObjects,\n pull,\n push,\n readBlob,\n readCommit,\n readNote,\n readObject,\n readTag,\n readTree,\n remove,\n removeNote,\n renameBranch,\n resetIndex,\n updateIndex,\n resolveRef,\n status,\n statusMatrix,\n tag,\n version,\n walk,\n writeBlob,\n writeCommit,\n writeObject,\n writeRef,\n writeTag,\n writeTree,\n}\n\n// default export\nexport default {\n Errors,\n STAGE,\n TREE,\n WORKDIR,\n add,\n abortMerge,\n addNote,\n addRemote,\n annotatedTag,\n branch,\n checkout,\n clone,\n commit,\n getConfig,\n getConfigAll,\n setConfig,\n currentBranch,\n deleteBranch,\n deleteRef,\n deleteRemote,\n deleteTag,\n expandOid,\n expandRef,\n fastForward,\n fetch,\n findMergeBase,\n findRoot,\n getRemoteInfo,\n getRemoteInfo2,\n hashBlob,\n indexPack,\n init,\n isDescendent,\n isIgnored,\n listBranches,\n listFiles,\n listNotes,\n listRemotes,\n listServerRefs,\n listTags,\n log,\n merge,\n packObjects,\n pull,\n push,\n readBlob,\n readCommit,\n readNote,\n readObject,\n readTag,\n readTree,\n remove,\n removeNote,\n renameBranch,\n resetIndex,\n updateIndex,\n resolveRef,\n status,\n statusMatrix,\n tag,\n version,\n walk,\n writeBlob,\n writeCommit,\n writeObject,\n writeRef,\n writeTag,\n writeTree,\n}\n"],"sourceRoot":""}
\No newline at end of file