vibe64 0.1.26 → 0.1.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (111) hide show
  1. package/dist/assets/{VRadioGroup-D6WRdUau.js → VRadioGroup-BuRMvs7d.js} +1 -1
  2. package/dist/assets/{VTabs-BGX5dGoS.js → VTabs-CQq9CAuT.js} +1 -1
  3. package/dist/assets/{VTextarea-CD6H_mtJ.js → VTextarea-Duvzvmjq.js} +1 -1
  4. package/dist/assets/{Vibe64AsyncModuleState-Cel3OePx.js → Vibe64AsyncModuleState-DuuzlJDp.js} +1 -1
  5. package/dist/assets/{Vibe64AuthSettingsButton-CMMeacsl.js → Vibe64AuthSettingsButton-CKOCL-kl.js} +1 -1
  6. package/dist/assets/{Vibe64DashboardShell-C2UhX2ke.js → Vibe64DashboardShell-DMT8aOp1.js} +1 -1
  7. package/dist/assets/{Vibe64DatabaseWorkspace-C43TE5-O.js → Vibe64DatabaseWorkspace-CqH0zfFZ.js} +1 -1
  8. package/dist/assets/{Vibe64OutputControls-BmzH2ASf.js → Vibe64OutputControls-DDILWOYb.js} +1 -1
  9. package/dist/assets/{Vibe64RepositoryWorkspace-CT9tkvHh.js → Vibe64RepositoryWorkspace-D11BZHtF.js} +1 -1
  10. package/dist/assets/Vibe64SessionFiles-BSoB7Xrs.js +1 -0
  11. package/dist/assets/{Vibe64SessionFiles-CH5PCxwg.css → Vibe64SessionFiles-DVux69YS.css} +1 -1
  12. package/dist/assets/{Vibe64SubsystemsView-DNx-pZp8.js → Vibe64SubsystemsView-tLlxmK3M.js} +1 -1
  13. package/dist/assets/{Vibe64SystemWorldView-UdNJZbqX.js → Vibe64SystemWorldView-8og8TPyL.js} +1 -1
  14. package/dist/assets/{_sessionId_-DZTmI19N.js → _sessionId_-Dts6gv4W.js} +1 -1
  15. package/dist/assets/{_sessionTool_-CugJWIK4.js → _sessionTool_-bHJUlHCW.js} +1 -1
  16. package/dist/assets/_slug_-B3fqw8Sl.js +12 -0
  17. package/dist/assets/_slug_-DfHqx2_b.css +1 -0
  18. package/dist/assets/{dashboard-D4NXqPY1.js → dashboard-CcD6GIaB.js} +1 -1
  19. package/dist/assets/{definitions-CyUCoqu-.js → definitions-ChGXm26a.js} +1 -1
  20. package/dist/assets/{error-kYKTA8fu.js → error-CStS-Kbt.js} +1 -1
  21. package/dist/assets/{index-hy7AAm-B.js → index-B262pg9q.js} +1 -1
  22. package/dist/assets/{index-DX6Rm6jZ.js → index-B_grpOta.js} +1 -1
  23. package/dist/assets/{index-Cpt19GIW.js → index-BtHA_DX9.js} +1 -1
  24. package/dist/assets/{index-SBc6H2In.js → index-C4KnwA0g.js} +4 -4
  25. package/dist/assets/{index-DeRx59Iq.js → index-CC7BFJAg.js} +1 -1
  26. package/dist/assets/{index-6Kv-7k0S.js → index-CKFrWxnr.js} +1 -1
  27. package/dist/assets/{index-BDe3NnFP.js → index-CPG-_bMW.js} +1 -1
  28. package/dist/assets/{index-CuEZOpKL.js → index-CV9pOpbQ.js} +1 -1
  29. package/dist/assets/{index-D4p1hWbM.js → index-DIQxSy1c.js} +1 -1
  30. package/dist/assets/{index-D5vnCntG.js → index-DVaJ8fEr.js} +1 -1
  31. package/dist/assets/{index-BGu7hfTb.js → index-DtGqjUin.js} +1 -1
  32. package/dist/assets/{index-Cca4WXur.js → index-YQALXwL4.js} +1 -1
  33. package/dist/assets/{placement-Nw6LF6xp.js → placement-Cyt3SnRe.js} +1 -1
  34. package/dist/assets/{studioGateApi-B2eiydiA.js → studioGateApi-BwBnOYBp.js} +1 -1
  35. package/dist/assets/{useArchivedVibe64Sessions-LeGda1Y9.js → useArchivedVibe64Sessions-_FKt1-qN.js} +1 -1
  36. package/dist/assets/{useVibe64ConversationLog-BPyKYbvH.js → useVibe64ConversationLog-BjnpqM9K.js} +1 -1
  37. package/dist/assets/{useVibe64ProjectScope-n5T5l2pY.js → useVibe64ProjectScope-DcDkjbLT.js} +1 -1
  38. package/dist/assets/{useVibe64SessionData-BToODuTg.js → useVibe64SessionData-BHLSmuPm.js} +1 -1
  39. package/dist/assets/{useVibe64SessionSelection-D1wXIWTm.js → useVibe64SessionSelection-G6KQKJxb.js} +1 -1
  40. package/dist/assets/{vibe64RepositoryRealtime-Xo7aIksE.js → vibe64RepositoryRealtime-C2WPn5do.js} +1 -1
  41. package/dist/assets/{vibe64SessionInfo-Dy_4bL3a.js → vibe64SessionInfo-8kuxgD5r.js} +1 -1
  42. package/dist/assets/{vibe64SessionPanelModel-5UED-6V-.js → vibe64SessionPanelModel-DDaXjAJ_.js} +1 -1
  43. package/dist/assets/{vibe64SessionRequestConfig-B7Llggdb.js → vibe64SessionRequestConfig-uGWcyQY6.js} +1 -1
  44. package/dist/assets/{vibe64SessionToolDefinitions-C4maKOfp.js → vibe64SessionToolDefinitions-D5CgOIqa.js} +1 -1
  45. package/dist/assets/{vueRefOrGetterValue-_KqAOFjr.js → vueRefOrGetterValue-CV9c3oBd.js} +1 -1
  46. package/dist/index.html +1 -1
  47. package/node_modules/@jskit-ai/connector-google-calendar/package.json +3 -3
  48. package/node_modules/@jskit-ai/connector-google-calendar/patterns/calendar-cli/example/package.json +4 -4
  49. package/node_modules/@jskit-ai/connectors-catalog/package.json +3 -3
  50. package/node_modules/@jskit-ai/connectors-catalog/test/dbt-semantic-layer.test.js +3 -0
  51. package/node_modules/@jskit-ai/connectors-catalog/test/google-ads.test.js +3 -0
  52. package/node_modules/@jskit-ai/connectors-catalog/test/salesforce.test.js +3 -0
  53. package/node_modules/@jskit-ai/connectors-catalog/test/xero.test.js +3 -0
  54. package/node_modules/@jskit-ai/connectors-core/package.json +4 -4
  55. package/node_modules/@jskit-ai/http-web/package.json +6 -6
  56. package/node_modules/@jskit-ai/kernel/package.json +1 -1
  57. package/node_modules/@jskit-ai/kernel/server/runtime/fastifyBootstrap.js +50 -10
  58. package/node_modules/@jskit-ai/kernel/server/runtime/fastifyBootstrap.test.js +38 -0
  59. package/node_modules/@jskit-ai/kernel/shared/support/normalize.js +8 -0
  60. package/node_modules/@jskit-ai/kernel/shared/support/normalize.test.js +10 -0
  61. package/node_modules/@jskit-ai/payments-core/package.json +1 -1
  62. package/node_modules/@jskit-ai/realtime/package.json +3 -3
  63. package/node_modules/@jskit-ai/realtime/patterns/realtime-application/example/package.json +2 -2
  64. package/node_modules/@jskit-ai/resource-core/package.json +2 -2
  65. package/node_modules/@jskit-ai/resource-crud-core/package.json +3 -3
  66. package/node_modules/@jskit-ai/shell-web/package.json +2 -2
  67. package/node_modules/@jskit-ai/uploads-runtime/package.json +2 -2
  68. package/node_modules/@local/current-app/package.json +1 -1
  69. package/node_modules/@local/main/package.json +2 -2
  70. package/node_modules/@local/studio-health/package.json +1 -1
  71. package/node_modules/@local/vibe64-accounts/package.json +3 -3
  72. package/node_modules/@local/vibe64-core/package.json +1 -1
  73. package/node_modules/@local/vibe64-database-tools/package.json +3 -3
  74. package/node_modules/@local/vibe64-project/package.json +1 -1
  75. package/node_modules/@local/vibe64-runtime/src/server/codexAppServerProvider.js +34 -0
  76. package/node_modules/@local/vibe64-sessions/package.json +1 -1
  77. package/node_modules/@local/vibe64-sessions/src/server/sessionRenewal.js +4 -1
  78. package/node_modules/@local/vibe64-source-editor/package.json +5 -5
  79. package/node_modules/@local/vibe64-system-graph/package.json +3 -3
  80. package/node_modules/@local/vibe64-terminals/package.json +2 -2
  81. package/node_modules/@local/vibe64-terminals/src/server/agent/providers/codexSessionAgentProvider.js +6 -0
  82. package/node_modules/@local/vibe64-terminals/src/server/agent/sessionAgentManager.js +16 -0
  83. package/node_modules/@local/vibe64-terminals/src/server/codexTerminal.js +180 -64
  84. package/node_modules/@local/vibe64-terminals/src/server/registerRoutes.js +12 -0
  85. package/node_modules/@local/vibe64-terminals/src/server/service.js +57 -16
  86. package/node_modules/@local/vibe64-terminals/src/server/sessionPromptHints.js +9 -1
  87. package/node_modules/@local/vibe64-terminals/src/server/sessionSaveCommitMessage.js +1 -1
  88. package/package.json +15 -15
  89. package/packages/current-app/package.json +1 -1
  90. package/packages/main/package.json +2 -2
  91. package/packages/studio-health/package.json +1 -1
  92. package/packages/vibe64-accounts/package.json +3 -3
  93. package/packages/vibe64-core/package.json +1 -1
  94. package/packages/vibe64-database-tools/package.json +3 -3
  95. package/packages/vibe64-project/package.json +1 -1
  96. package/packages/vibe64-runtime/src/server/codexAppServerProvider.js +34 -0
  97. package/packages/vibe64-sessions/package.json +1 -1
  98. package/packages/vibe64-sessions/src/server/sessionRenewal.js +4 -1
  99. package/packages/vibe64-source-editor/package.json +5 -5
  100. package/packages/vibe64-system-graph/package.json +3 -3
  101. package/packages/vibe64-terminals/package.json +2 -2
  102. package/packages/vibe64-terminals/src/server/agent/providers/codexSessionAgentProvider.js +6 -0
  103. package/packages/vibe64-terminals/src/server/agent/sessionAgentManager.js +16 -0
  104. package/packages/vibe64-terminals/src/server/codexTerminal.js +180 -64
  105. package/packages/vibe64-terminals/src/server/registerRoutes.js +12 -0
  106. package/packages/vibe64-terminals/src/server/service.js +57 -16
  107. package/packages/vibe64-terminals/src/server/sessionPromptHints.js +9 -1
  108. package/packages/vibe64-terminals/src/server/sessionSaveCommitMessage.js +1 -1
  109. package/dist/assets/Vibe64SessionFiles-BS5MW7Qz.js +0 -1
  110. package/dist/assets/_slug_-BzRzebKA.js +0 -12
  111. package/dist/assets/_slug_-Q7ibe3SE.css +0 -1
@@ -1 +1 @@
1
- import{_ as _export_sfc,a as openBlock,c as createElementBlock,b as createBlock,r as createCommentVNode,bs as StudioErrorNotice,w as withCtx,j as createTextVNode,t as toDisplayString,I as VAlert,A as computed,bu as VProgressLinear,d as createBaseVNode,F as Fragment,y as renderList,$ as normalizeClass,n as VBtn,e as createVNode,H as watch,M as useRealtimeEvent,ag as onScopeDispose,bz as reactive,B as ref,L as getHttpWebClient,i as unref,dt as mdiCloudRefreshOutline,aZ as mdiSourcePull,h as VIcon,du as mdiSourceMerge,db as mdiSourceCommit,S as VSheet,a_ as mdiContentSaveOutline,al as createSlots,ai as VChip,V as VCard,g as VCardTitle,bR as mdiAccountOutline,W as mdiClockOutline,ab as mdiClose,br as VDivider,k as VCardText,p as VDialog,bF as mdiChevronRight}from"./index-SBc6H2In.js";import{r as repositoryStatusSessionId,a as repositoryStatusRealtimeShouldRefresh,b as repositoryStatusRealtimeNeedsCanonicalCheck,V as Vibe64TemporaryAiFixAction}from"./vibe64RepositoryRealtime-Xo7aIksE.js";import{D as Diff}from"./base-DDNBxAg7.js";import{a as vibe64ApiResponseError}from"./vibe64ApiResponses-COQ3JIKv.js";import{V as VIBE64_SESSION_CHANGED_EVENT,u as VIBE64_SOURCE_EDITOR_FILE_CHANGED_EVENT,R as vibe64RepositoryHistoryPath,w as vibe64SessionCheckUpdatesPath,S as vibe64RepositoryVersionDiffPath,T as vibe64RepositoryVersionFilesPath,U as vibe64SessionChangeDiffPath,W as vibe64SessionChangesPath}from"./vibe64SessionRequestConfig-B7Llggdb.js";import{r as readRefOrGetterValue}from"./vueRefOrGetterValue-_KqAOFjr.js";function nonnegativeInteger(value){const number=Number(value);return Number.isSafeInteger(number)&&number>=0?number:0}function repositoryUpdateRelationship(aheadValue=0,behindValue=0){const ahead=nonnegativeInteger(aheadValue);const behind=nonnegativeInteger(behindValue);if(ahead>0&&behind>0){return"diverged"}if(behind>0){return"behind"}if(ahead>0){return"ahead"}return"current"}class CharacterDiff extends Diff{}const characterDiff=new CharacterDiff;function diffChars(oldStr,newStr,options){return characterDiff.diff(oldStr,newStr,options)}const extendedWordChars="a-zA-Z0-9_\\u{AD}\\u{C0}-\\u{D6}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}";class WordsWithSpaceDiff extends Diff{tokenize(value){const regex2=new RegExp(`(\\r?\\n)|[${extendedWordChars}]+|[^\\S\\n\\r]+|[^${extendedWordChars}]`,"ug");return value.match(regex2)||[]}}const wordsWithSpaceDiff=new WordsWithSpaceDiff;function diffWordsWithSpace(oldStr,newStr,options){return wordsWithSpaceDiff.diff(oldStr,newStr,options)}var LineType;(function(LineType2){LineType2["INSERT"]="insert";LineType2["DELETE"]="delete";LineType2["CONTEXT"]="context"})(LineType||(LineType={}));const OutputFormatType={LINE_BY_LINE:"line-by-line"};const LineMatchingType={NONE:"none"};const DiffStyleType={WORD:"word"};var ColorSchemeType;(function(ColorSchemeType2){ColorSchemeType2["AUTO"]="auto";ColorSchemeType2["DARK"]="dark";ColorSchemeType2["LIGHT"]="light"})(ColorSchemeType||(ColorSchemeType={}));const specials=["-","[","]","/","{","}","(",")","*","+","?",".","\\","^","$","|"];const regex=RegExp("["+specials.join("\\")+"]","g");function escapeForRegExp(str){return str.replace(regex,"\\$&")}function unifyPath(path){return path?path.replace(/\\/g,"/"):path}function hashCode(text){let i,chr,len;let hash=0;for(i=0,len=text.length;i<len;i++){chr=text.charCodeAt(i);hash=(hash<<5)-hash+chr;hash|=0}return hash}function max(arr){const length=arr.length;let max2=-Infinity;for(let i=0;i<length;i++){max2=Math.max(max2,arr[i])}return max2}function getExtension(filename,language){const filenameParts=filename.split(".");return filenameParts.length>1?filenameParts[filenameParts.length-1]:language}function startsWithAny(str,prefixes){return prefixes.reduce((startsWith,prefix)=>startsWith||str.startsWith(prefix),false)}const baseDiffFilenamePrefixes=["a/","b/","i/","w/","c/","o/"];function getFilename(line,linePrefix,extraPrefix){const prefixes=extraPrefix!==void 0?[...baseDiffFilenamePrefixes,extraPrefix]:baseDiffFilenamePrefixes;const FilenameRegExp=linePrefix?new RegExp(`^${escapeForRegExp(linePrefix)} "?(.+?)"?$`):new RegExp('^"?(.+?)"?$');const[,filename=""]=FilenameRegExp.exec(line)||[];const matchingPrefix=prefixes.find(p=>filename.indexOf(p)===0);const fnameWithoutPrefix=matchingPrefix?filename.slice(matchingPrefix.length):filename;return fnameWithoutPrefix.replace(/\s+\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}(?:\.\d+)? [+-]\d{4}.*$/,"")}function getSrcFilename(line,srcPrefix){return getFilename(line,"---",srcPrefix)}function getDstFilename(line,dstPrefix){return getFilename(line,"+++",dstPrefix)}function parse(diffInput,config={}){const files=[];let currentFile=null;let currentBlock=null;let oldLine=null;let oldLine2=null;let newLine=null;let possibleOldName=null;let possibleNewName=null;const oldFileNameHeader="--- ";const newFileNameHeader="+++ ";const hunkHeaderPrefix="@@";const oldMode=/^old mode (\d{6})/;const newMode=/^new mode (\d{6})/;const deletedFileMode=/^deleted file mode (\d{6})/;const newFileMode=/^new file mode (\d{6})/;const copyFrom=/^copy from "?(.+)"?/;const copyTo=/^copy to "?(.+)"?/;const renameFrom=/^rename from "?(.+)"?/;const renameTo=/^rename to "?(.+)"?/;const similarityIndex=/^similarity index (\d+)%/;const dissimilarityIndex=/^dissimilarity index (\d+)%/;const index=/^index ([\da-z]+)\.\.([\da-z]+)\s*(\d{6})?/;const binaryFiles=/^Binary files (.*) and (.*) differ/;const binaryDiff=/^GIT binary patch/;const combinedIndex=/^index ([\da-z]+),([\da-z]+)\.\.([\da-z]+)/;const combinedMode=/^mode (\d{6}),(\d{6})\.\.(\d{6})/;const combinedNewFile=/^new file mode (\d{6})/;const combinedDeletedFile=/^deleted file mode (\d{6}),(\d{6})/;const diffLines=diffInput.replace(/\/g,"").replace(/\r\n?/g,"\n").split("\n");function saveBlock(){if(currentBlock!==null&&currentFile!==null){currentFile.blocks.push(currentBlock);currentBlock=null}}function saveFile(){if(currentFile!==null){if(!currentFile.oldName&&possibleOldName!==null){currentFile.oldName=possibleOldName}if(!currentFile.newName&&possibleNewName!==null){currentFile.newName=possibleNewName}if(currentFile.newName){files.push(currentFile);currentFile=null}}possibleOldName=null;possibleNewName=null}function startFile(){saveBlock();saveFile();currentFile={blocks:[],deletedLines:0,addedLines:0}}function startBlock(line){saveBlock();let values;if(currentFile!==null){if(values=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@.*/.exec(line)){currentFile.isCombined=false;oldLine=parseInt(values[1],10);newLine=parseInt(values[2],10)}else if(values=/^@@@ -(\d+)(?:,\d+)? -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@@.*/.exec(line)){currentFile.isCombined=true;oldLine=parseInt(values[1],10);oldLine2=parseInt(values[2],10);newLine=parseInt(values[3],10)}else{if(line.startsWith(hunkHeaderPrefix)){console.error("Failed to parse lines, starting in 0!")}oldLine=0;newLine=0;currentFile.isCombined=false}}currentBlock={lines:[],oldStartLine:oldLine,oldStartLine2:oldLine2,newStartLine:newLine,header:line}}function createLine(line){if(currentFile===null||currentBlock===null||oldLine===null||newLine===null)return;const currentLine={content:line};const addedPrefixes=currentFile.isCombined?["+ "," +","++"]:["+"];const deletedPrefixes=currentFile.isCombined?["- "," -","--"]:["-"];if(startsWithAny(line,addedPrefixes)){currentFile.addedLines++;currentLine.type=LineType.INSERT;currentLine.oldNumber=void 0;currentLine.newNumber=newLine++}else if(startsWithAny(line,deletedPrefixes)){currentFile.deletedLines++;currentLine.type=LineType.DELETE;currentLine.oldNumber=oldLine++;currentLine.newNumber=void 0}else{currentLine.type=LineType.CONTEXT;currentLine.oldNumber=oldLine++;currentLine.newNumber=newLine++}currentBlock.lines.push(currentLine)}function existHunkHeader(line,lineIdx){let idx=lineIdx;while(idx<diffLines.length-3){if(line.startsWith("diff")){return false}if(diffLines[idx].startsWith(oldFileNameHeader)&&diffLines[idx+1].startsWith(newFileNameHeader)&&diffLines[idx+2].startsWith(hunkHeaderPrefix)){return true}idx++}return false}diffLines.forEach((line,lineIndex)=>{if(!line||line.startsWith("*")){return}let values;const prevLine=diffLines[lineIndex-1];const nxtLine=diffLines[lineIndex+1];const afterNxtLine=diffLines[lineIndex+2];if(line.startsWith("diff --git")||line.startsWith("diff --combined")){startFile();const gitDiffStart=/^diff --git "?([a-ciow]\/.+)"? "?([a-ciow]\/.+)"?/;if(values=gitDiffStart.exec(line)){possibleOldName=getFilename(values[1],void 0,config.dstPrefix);possibleNewName=getFilename(values[2],void 0,config.srcPrefix)}if(currentFile===null){throw new Error("Where is my file !!!")}currentFile.isGitDiff=true;return}if(line.startsWith("Binary files")&&!(currentFile===null||currentFile===void 0?void 0:currentFile.isGitDiff)){startFile();const unixDiffBinaryStart=/^Binary files "?([a-ciow]\/.+)"? and "?([a-ciow]\/.+)"? differ/;if(values=unixDiffBinaryStart.exec(line)){possibleOldName=getFilename(values[1],void 0,config.dstPrefix);possibleNewName=getFilename(values[2],void 0,config.srcPrefix)}if(currentFile===null){throw new Error("Where is my file !!!")}currentFile.isBinary=true;return}if(!currentFile||!currentFile.isGitDiff&&currentFile&&line.startsWith(oldFileNameHeader)&&nxtLine.startsWith(newFileNameHeader)&&afterNxtLine.startsWith(hunkHeaderPrefix)){startFile()}if(currentFile===null||currentFile===void 0?void 0:currentFile.isTooBig){return}if(currentFile&&(typeof config.diffMaxChanges==="number"&&currentFile.addedLines+currentFile.deletedLines>config.diffMaxChanges||typeof config.diffMaxLineLength==="number"&&line.length>config.diffMaxLineLength)){currentFile.isTooBig=true;currentFile.addedLines=0;currentFile.deletedLines=0;currentFile.blocks=[];currentBlock=null;const message2=typeof config.diffTooBigMessage==="function"?config.diffTooBigMessage(files.length):"Diff too big to be displayed";startBlock(message2);return}if(line.startsWith(oldFileNameHeader)&&nxtLine.startsWith(newFileNameHeader)||line.startsWith(newFileNameHeader)&&prevLine.startsWith(oldFileNameHeader)){if(currentFile&&!currentFile.oldName&&line.startsWith("--- ")&&(values=getSrcFilename(line,config.srcPrefix))){currentFile.oldName=values;currentFile.language=getExtension(currentFile.oldName,currentFile.language);return}if(currentFile&&!currentFile.newName&&line.startsWith("+++ ")&&(values=getDstFilename(line,config.dstPrefix))){currentFile.newName=values;currentFile.language=getExtension(currentFile.newName,currentFile.language);return}}if(currentFile&&(line.startsWith(hunkHeaderPrefix)||currentFile.isGitDiff&&currentFile.oldName&&currentFile.newName&&!currentBlock)){startBlock(line);return}if(currentBlock&&(line.startsWith("+")||line.startsWith("-")||line.startsWith(" "))){createLine(line);return}const doesNotExistHunkHeader=!existHunkHeader(line,lineIndex);if(currentFile===null){throw new Error("Where is my file !!!")}if(values=oldMode.exec(line)){currentFile.oldMode=values[1]}else if(values=newMode.exec(line)){currentFile.newMode=values[1]}else if(values=deletedFileMode.exec(line)){currentFile.deletedFileMode=values[1];currentFile.isDeleted=true}else if(values=newFileMode.exec(line)){currentFile.newFileMode=values[1];currentFile.isNew=true}else if(values=copyFrom.exec(line)){if(doesNotExistHunkHeader){currentFile.oldName=values[1]}currentFile.isCopy=true}else if(values=copyTo.exec(line)){if(doesNotExistHunkHeader){currentFile.newName=values[1]}currentFile.isCopy=true}else if(values=renameFrom.exec(line)){if(doesNotExistHunkHeader){currentFile.oldName=values[1]}currentFile.isRename=true}else if(values=renameTo.exec(line)){if(doesNotExistHunkHeader){currentFile.newName=values[1]}currentFile.isRename=true}else if(values=binaryFiles.exec(line)){currentFile.isBinary=true;currentFile.oldName=getFilename(values[1],void 0,config.srcPrefix);currentFile.newName=getFilename(values[2],void 0,config.dstPrefix);startBlock("Binary file")}else if(binaryDiff.test(line)){currentFile.isBinary=true;startBlock(line)}else if(values=similarityIndex.exec(line)){currentFile.unchangedPercentage=parseInt(values[1],10)}else if(values=dissimilarityIndex.exec(line)){currentFile.changedPercentage=parseInt(values[1],10)}else if(values=index.exec(line)){currentFile.checksumBefore=values[1];currentFile.checksumAfter=values[2];if(values[3])currentFile.mode=values[3]}else if(values=combinedIndex.exec(line)){currentFile.checksumBefore=[values[2],values[3]];currentFile.checksumAfter=values[1]}else if(values=combinedMode.exec(line)){currentFile.oldMode=[values[2],values[3]];currentFile.newMode=values[1]}else if(values=combinedNewFile.exec(line)){currentFile.newFileMode=values[1];currentFile.isNew=true}else if(values=combinedDeletedFile.exec(line)){currentFile.deletedFileMode=values[1];currentFile.isDeleted=true}});saveBlock();saveFile();return files}function levenshtein(a,b){if(a.length===0){return b.length}if(b.length===0){return a.length}const matrix=[];let i;for(i=0;i<=b.length;i++){matrix[i]=[i]}let j;for(j=0;j<=a.length;j++){matrix[0][j]=j}for(i=1;i<=b.length;i++){for(j=1;j<=a.length;j++){if(b.charAt(i-1)===a.charAt(j-1)){matrix[i][j]=matrix[i-1][j-1]}else{matrix[i][j]=Math.min(matrix[i-1][j-1]+1,Math.min(matrix[i][j-1]+1,matrix[i-1][j]+1))}}}return matrix[b.length][a.length]}function newDistanceFn(str){return(x,y)=>{const xValue=str(x).trim();const yValue=str(y).trim();const lev=levenshtein(xValue,yValue);return lev/(xValue.length+yValue.length)}}function newMatcherFn(distance2){function findBestMatch(a,b,cache=new Map){let bestMatchDist=Infinity;let bestMatch;for(let i=0;i<a.length;++i){for(let j=0;j<b.length;++j){const cacheKey=JSON.stringify([a[i],b[j]]);let md;if(!(cache.has(cacheKey)&&(md=cache.get(cacheKey)))){md=distance2(a[i],b[j]);cache.set(cacheKey,md)}if(md<bestMatchDist){bestMatchDist=md;bestMatch={indexA:i,indexB:j,score:bestMatchDist}}}}return bestMatch}function group(a,b,level=0,cache=new Map){const bm=findBestMatch(a,b,cache);if(!bm||a.length+b.length<3){return[[a,b]]}const a1=a.slice(0,bm.indexA);const b1=b.slice(0,bm.indexB);const aMatch=[a[bm.indexA]];const bMatch=[b[bm.indexB]];const tailA=bm.indexA+1;const tailB=bm.indexB+1;const a2=a.slice(tailA);const b2=b.slice(tailB);const group1=group(a1,b1,level+1,cache);const groupMatch=group(aMatch,bMatch,level+1,cache);const group2=group(a2,b2,level+1,cache);let result=groupMatch;if(bm.indexA>0||bm.indexB>0){result=group1.concat(result)}if(a.length>tailA||b.length>tailB){result=result.concat(group2)}return result}return group}const CSSLineClass={INSERTS:"d2h-ins",DELETES:"d2h-del",CONTEXT:"d2h-cntx",INFO:"d2h-info",INSERT_CHANGES:"d2h-ins d2h-change",DELETE_CHANGES:"d2h-del d2h-change"};const defaultRenderConfig={matching:LineMatchingType.NONE,matchWordsThreshold:.25,maxLineLengthHighlight:1e4,diffStyle:DiffStyleType.WORD,colorScheme:ColorSchemeType.LIGHT};const separator="/";const distance=newDistanceFn(change=>change.value);const matcher=newMatcherFn(distance);function isDevNullName(name){return name.indexOf("dev/null")!==-1}function removeInsElements(line){return line.replace(/(<ins[^>]*>((.|\n)*?)<\/ins>)/g,"")}function removeDelElements(line){return line.replace(/(<del[^>]*>((.|\n)*?)<\/del>)/g,"")}function toCSSClass(lineType){switch(lineType){case LineType.CONTEXT:return CSSLineClass.CONTEXT;case LineType.INSERT:return CSSLineClass.INSERTS;case LineType.DELETE:return CSSLineClass.DELETES}}function colorSchemeToCss(colorScheme){switch(colorScheme){case ColorSchemeType.DARK:return"d2h-dark-color-scheme";case ColorSchemeType.AUTO:return"d2h-auto-color-scheme";case ColorSchemeType.LIGHT:default:return"d2h-light-color-scheme"}}function prefixLength(isCombined){return isCombined?2:1}function escapeForHtml(str){return str.slice(0).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;").replace(/\//g,"&#x2F;")}function deconstructLine(line,isCombined,escape=true){const indexToSplit=prefixLength(isCombined);return{prefix:line.substring(0,indexToSplit),content:escape?escapeForHtml(line.substring(indexToSplit)):line.substring(indexToSplit)}}function filenameDiff(file){const oldFilename=unifyPath(file.oldName);const newFilename=unifyPath(file.newName);if(oldFilename!==newFilename&&!isDevNullName(oldFilename)&&!isDevNullName(newFilename)){const prefixPaths=[];const suffixPaths=[];const oldFilenameParts=oldFilename.split(separator);const newFilenameParts=newFilename.split(separator);const oldFilenamePartsSize=oldFilenameParts.length;const newFilenamePartsSize=newFilenameParts.length;let i=0;let j=oldFilenamePartsSize-1;let k=newFilenamePartsSize-1;while(i<j&&i<k){if(oldFilenameParts[i]===newFilenameParts[i]){prefixPaths.push(newFilenameParts[i]);i+=1}else{break}}while(j>i&&k>i){if(oldFilenameParts[j]===newFilenameParts[k]){suffixPaths.unshift(newFilenameParts[k]);j-=1;k-=1}else{break}}const finalPrefix=prefixPaths.join(separator);const finalSuffix=suffixPaths.join(separator);const oldRemainingPath=oldFilenameParts.slice(i,j+1).join(separator);const newRemainingPath=newFilenameParts.slice(i,k+1).join(separator);if(finalPrefix.length&&finalSuffix.length){return finalPrefix+separator+"{"+oldRemainingPath+" → "+newRemainingPath+"}"+separator+finalSuffix}else if(finalPrefix.length){return finalPrefix+separator+"{"+oldRemainingPath+" → "+newRemainingPath+"}"}else if(finalSuffix.length){return"{"+oldRemainingPath+" → "+newRemainingPath+"}"+separator+finalSuffix}return oldFilename+" → "+newFilename}else if(!isDevNullName(newFilename)){return newFilename}else{return oldFilename}}function getHtmlId(file){return`d2h-${hashCode(filenameDiff(file)).toString().slice(-6)}`}function getFileIcon(file){let templateName="file-changed";if(file.isRename){templateName="file-renamed"}else if(file.isCopy){templateName="file-renamed"}else if(file.isNew){templateName="file-added"}else if(file.isDeleted){templateName="file-deleted"}else if(file.newName!==file.oldName){templateName="file-renamed"}return templateName}function diffHighlight(diffLine1,diffLine2,isCombined,config={}){const{matching,maxLineLengthHighlight,matchWordsThreshold,diffStyle}=Object.assign(Object.assign({},defaultRenderConfig),config);const line1=deconstructLine(diffLine1,isCombined,false);const line2=deconstructLine(diffLine2,isCombined,false);if(line1.content.length>maxLineLengthHighlight||line2.content.length>maxLineLengthHighlight){return{oldLine:{prefix:line1.prefix,content:escapeForHtml(line1.content)},newLine:{prefix:line2.prefix,content:escapeForHtml(line2.content)}}}const diff=diffStyle==="char"?diffChars(line1.content,line2.content):diffWordsWithSpace(line1.content,line2.content);const changedWords=[];if(diffStyle==="word"&&matching==="words"){const removed=diff.filter(element=>element.removed);const added=diff.filter(element=>element.added);const chunks=matcher(added,removed);chunks.forEach(chunk=>{if(chunk[0].length===1&&chunk[1].length===1){const dist=distance(chunk[0][0],chunk[1][0]);if(dist<matchWordsThreshold){changedWords.push(chunk[0][0]);changedWords.push(chunk[1][0])}}})}const highlightedLine=diff.reduce((highlightedLine2,part)=>{const elemType=part.added?"ins":part.removed?"del":null;const addClass=changedWords.indexOf(part)>-1?' class="d2h-change"':"";const escapedValue=escapeForHtml(part.value);return elemType!==null?`${highlightedLine2}<${elemType}${addClass}>${escapedValue}</${elemType}>`:`${highlightedLine2}${escapedValue}`},"");return{oldLine:{prefix:line1.prefix,content:removeInsElements(highlightedLine)},newLine:{prefix:line2.prefix,content:removeDelElements(highlightedLine)}}}const baseTemplatesPath$2="file-summary";const iconsBaseTemplatesPath$2="icon";const defaultFileListRendererConfig={colorScheme:defaultRenderConfig.colorScheme};class FileListRenderer{constructor(hoganUtils,config={}){this.hoganUtils=hoganUtils;this.config=Object.assign(Object.assign({},defaultFileListRendererConfig),config)}render(diffFiles){const files=diffFiles.map(file=>this.hoganUtils.render(baseTemplatesPath$2,"line",{fileHtmlId:getHtmlId(file),oldName:file.oldName,newName:file.newName,fileName:filenameDiff(file),deletedLines:"-"+file.deletedLines,addedLines:"+"+file.addedLines},{fileIcon:this.hoganUtils.template(iconsBaseTemplatesPath$2,getFileIcon(file))})).join("\n");return this.hoganUtils.render(baseTemplatesPath$2,"wrapper",{colorScheme:colorSchemeToCss(this.config.colorScheme),filesNumber:diffFiles.length,files})}}const defaultLineByLineRendererConfig=Object.assign(Object.assign({},defaultRenderConfig),{renderNothingWhenEmpty:false,matchingMaxComparisons:2500,maxLineSizeInBlockForComparison:200});const genericTemplatesPath$1="generic";const baseTemplatesPath$1="line-by-line";const iconsBaseTemplatesPath$1="icon";const tagsBaseTemplatesPath$1="tag";class LineByLineRenderer{constructor(hoganUtils,config={}){this.hoganUtils=hoganUtils;this.config=Object.assign(Object.assign({},defaultLineByLineRendererConfig),config)}render(diffFiles){const diffsHtml=diffFiles.map(file=>{let diffs;if(file.blocks.length){diffs=this.generateFileHtml(file)}else{diffs=this.generateEmptyDiff()}return this.makeFileDiffHtml(file,diffs)}).join("\n");return this.hoganUtils.render(genericTemplatesPath$1,"wrapper",{colorScheme:colorSchemeToCss(this.config.colorScheme),content:diffsHtml})}makeFileDiffHtml(file,diffs){if(this.config.renderNothingWhenEmpty&&Array.isArray(file.blocks)&&file.blocks.length===0)return"";const fileDiffTemplate=this.hoganUtils.template(baseTemplatesPath$1,"file-diff");const filePathTemplate=this.hoganUtils.template(genericTemplatesPath$1,"file-path");const fileIconTemplate=this.hoganUtils.template(iconsBaseTemplatesPath$1,"file");const fileTagTemplate=this.hoganUtils.template(tagsBaseTemplatesPath$1,getFileIcon(file));return fileDiffTemplate.render({file,fileHtmlId:getHtmlId(file),diffs,filePath:filePathTemplate.render({fileDiffName:filenameDiff(file)},{fileIcon:fileIconTemplate,fileTag:fileTagTemplate})})}generateEmptyDiff(){return this.hoganUtils.render(genericTemplatesPath$1,"empty-diff",{contentClass:"d2h-code-line",CSSLineClass})}generateFileHtml(file){const matcher2=newMatcherFn(newDistanceFn(e=>deconstructLine(e.content,file.isCombined).content));return file.blocks.map(block=>{let lines=this.hoganUtils.render(genericTemplatesPath$1,"block-header",{CSSLineClass,blockHeader:file.isTooBig?block.header:escapeForHtml(block.header),lineClass:"d2h-code-linenumber",contentClass:"d2h-code-line"});this.applyLineGroupping(block).forEach(([contextLines,oldLines,newLines])=>{if(oldLines.length&&newLines.length&&!contextLines.length){this.applyRematchMatching(oldLines,newLines,matcher2).map(([oldLines2,newLines2])=>{const{left,right}=this.processChangedLines(file,file.isCombined,oldLines2,newLines2);lines+=left;lines+=right})}else if(contextLines.length){contextLines.forEach(line=>{const{prefix,content}=deconstructLine(line.content,file.isCombined);lines+=this.generateSingleLineHtml(file,{type:CSSLineClass.CONTEXT,prefix,content,oldNumber:line.oldNumber,newNumber:line.newNumber})})}else if(oldLines.length||newLines.length){const{left,right}=this.processChangedLines(file,file.isCombined,oldLines,newLines);lines+=left;lines+=right}else{console.error("Unknown state reached while processing groups of lines",contextLines,oldLines,newLines)}});return lines}).join("\n")}applyLineGroupping(block){const blockLinesGroups=[];let oldLines=[];let newLines=[];for(let i=0;i<block.lines.length;i++){const diffLine=block.lines[i];if(diffLine.type!==LineType.INSERT&&newLines.length||diffLine.type===LineType.CONTEXT&&oldLines.length>0){blockLinesGroups.push([[],oldLines,newLines]);oldLines=[];newLines=[]}if(diffLine.type===LineType.CONTEXT){blockLinesGroups.push([[diffLine],[],[]])}else if(diffLine.type===LineType.INSERT&&oldLines.length===0){blockLinesGroups.push([[],[],[diffLine]])}else if(diffLine.type===LineType.INSERT&&oldLines.length>0){newLines.push(diffLine)}else if(diffLine.type===LineType.DELETE){oldLines.push(diffLine)}}if(oldLines.length||newLines.length){blockLinesGroups.push([[],oldLines,newLines]);oldLines=[];newLines=[]}return blockLinesGroups}applyRematchMatching(oldLines,newLines,matcher2){const comparisons=oldLines.length*newLines.length;const maxLineSizeInBlock=max(oldLines.concat(newLines).map(elem=>elem.content.length));const doMatching=comparisons<this.config.matchingMaxComparisons&&maxLineSizeInBlock<this.config.maxLineSizeInBlockForComparison&&(this.config.matching==="lines"||this.config.matching==="words");return doMatching?matcher2(oldLines,newLines):[[oldLines,newLines]]}processChangedLines(file,isCombined,oldLines,newLines){const fileHtml={right:"",left:""};const maxLinesNumber=Math.max(oldLines.length,newLines.length);for(let i=0;i<maxLinesNumber;i++){const oldLine=oldLines[i];const newLine=newLines[i];const diff=oldLine!==void 0&&newLine!==void 0?diffHighlight(oldLine.content,newLine.content,isCombined,this.config):void 0;const preparedOldLine=oldLine!==void 0&&oldLine.oldNumber!==void 0?Object.assign(Object.assign({},diff!==void 0?{prefix:diff.oldLine.prefix,content:diff.oldLine.content,type:CSSLineClass.DELETE_CHANGES}:Object.assign(Object.assign({},deconstructLine(oldLine.content,isCombined)),{type:toCSSClass(oldLine.type)})),{oldNumber:oldLine.oldNumber,newNumber:oldLine.newNumber}):void 0;const preparedNewLine=newLine!==void 0&&newLine.newNumber!==void 0?Object.assign(Object.assign({},diff!==void 0?{prefix:diff.newLine.prefix,content:diff.newLine.content,type:CSSLineClass.INSERT_CHANGES}:Object.assign(Object.assign({},deconstructLine(newLine.content,isCombined)),{type:toCSSClass(newLine.type)})),{oldNumber:newLine.oldNumber,newNumber:newLine.newNumber}):void 0;const{left,right}=this.generateLineHtml(file,preparedOldLine,preparedNewLine);fileHtml.left+=left;fileHtml.right+=right}return fileHtml}generateLineHtml(file,oldLine,newLine){return{left:this.generateSingleLineHtml(file,oldLine),right:this.generateSingleLineHtml(file,newLine)}}generateSingleLineHtml(file,line){if(line===void 0)return"";const lineNumberHtml=this.hoganUtils.render(baseTemplatesPath$1,"numbers",{oldNumber:line.oldNumber||"",newNumber:line.newNumber||""});return this.hoganUtils.render(genericTemplatesPath$1,"line",{type:line.type,lineClass:"d2h-code-linenumber",contentClass:"d2h-code-line",prefix:line.prefix===" "?"&nbsp;":line.prefix,content:line.content,lineNumber:lineNumberHtml,line,file})}}const defaultSideBySideRendererConfig=Object.assign(Object.assign({},defaultRenderConfig),{renderNothingWhenEmpty:false,matchingMaxComparisons:2500,maxLineSizeInBlockForComparison:200});const genericTemplatesPath="generic";const baseTemplatesPath="side-by-side";const iconsBaseTemplatesPath="icon";const tagsBaseTemplatesPath="tag";class SideBySideRenderer{constructor(hoganUtils,config={}){this.hoganUtils=hoganUtils;this.config=Object.assign(Object.assign({},defaultSideBySideRendererConfig),config)}render(diffFiles){const diffsHtml=diffFiles.map(file=>{let diffs;if(file.blocks.length){diffs=this.generateFileHtml(file)}else{diffs=this.generateEmptyDiff()}return this.makeFileDiffHtml(file,diffs)}).join("\n");return this.hoganUtils.render(genericTemplatesPath,"wrapper",{colorScheme:colorSchemeToCss(this.config.colorScheme),content:diffsHtml})}makeFileDiffHtml(file,diffs){if(this.config.renderNothingWhenEmpty&&Array.isArray(file.blocks)&&file.blocks.length===0)return"";const fileDiffTemplate=this.hoganUtils.template(baseTemplatesPath,"file-diff");const filePathTemplate=this.hoganUtils.template(genericTemplatesPath,"file-path");const fileIconTemplate=this.hoganUtils.template(iconsBaseTemplatesPath,"file");const fileTagTemplate=this.hoganUtils.template(tagsBaseTemplatesPath,getFileIcon(file));return fileDiffTemplate.render({file,fileHtmlId:getHtmlId(file),diffs,filePath:filePathTemplate.render({fileDiffName:filenameDiff(file)},{fileIcon:fileIconTemplate,fileTag:fileTagTemplate})})}generateEmptyDiff(){return{right:"",left:this.hoganUtils.render(genericTemplatesPath,"empty-diff",{contentClass:"d2h-code-side-line",CSSLineClass})}}generateFileHtml(file){const matcher2=newMatcherFn(newDistanceFn(e=>deconstructLine(e.content,file.isCombined).content));return file.blocks.map(block=>{const fileHtml={left:this.makeHeaderHtml(block.header,file),right:this.makeHeaderHtml("")};this.applyLineGroupping(block).forEach(([contextLines,oldLines,newLines])=>{if(oldLines.length&&newLines.length&&!contextLines.length){this.applyRematchMatching(oldLines,newLines,matcher2).map(([oldLines2,newLines2])=>{const{left,right}=this.processChangedLines(file.isCombined,oldLines2,newLines2);fileHtml.left+=left;fileHtml.right+=right})}else if(contextLines.length){contextLines.forEach(line=>{const{prefix,content}=deconstructLine(line.content,file.isCombined);const{left,right}=this.generateLineHtml({type:CSSLineClass.CONTEXT,prefix,content,number:line.oldNumber},{type:CSSLineClass.CONTEXT,prefix,content,number:line.newNumber});fileHtml.left+=left;fileHtml.right+=right})}else if(oldLines.length||newLines.length){const{left,right}=this.processChangedLines(file.isCombined,oldLines,newLines);fileHtml.left+=left;fileHtml.right+=right}else{console.error("Unknown state reached while processing groups of lines",contextLines,oldLines,newLines)}});return fileHtml}).reduce((accomulated,html2)=>{return{left:accomulated.left+html2.left,right:accomulated.right+html2.right}},{left:"",right:""})}applyLineGroupping(block){const blockLinesGroups=[];let oldLines=[];let newLines=[];for(let i=0;i<block.lines.length;i++){const diffLine=block.lines[i];if(diffLine.type!==LineType.INSERT&&newLines.length||diffLine.type===LineType.CONTEXT&&oldLines.length>0){blockLinesGroups.push([[],oldLines,newLines]);oldLines=[];newLines=[]}if(diffLine.type===LineType.CONTEXT){blockLinesGroups.push([[diffLine],[],[]])}else if(diffLine.type===LineType.INSERT&&oldLines.length===0){blockLinesGroups.push([[],[],[diffLine]])}else if(diffLine.type===LineType.INSERT&&oldLines.length>0){newLines.push(diffLine)}else if(diffLine.type===LineType.DELETE){oldLines.push(diffLine)}}if(oldLines.length||newLines.length){blockLinesGroups.push([[],oldLines,newLines]);oldLines=[];newLines=[]}return blockLinesGroups}applyRematchMatching(oldLines,newLines,matcher2){const comparisons=oldLines.length*newLines.length;const maxLineSizeInBlock=max(oldLines.concat(newLines).map(elem=>elem.content.length));const doMatching=comparisons<this.config.matchingMaxComparisons&&maxLineSizeInBlock<this.config.maxLineSizeInBlockForComparison&&(this.config.matching==="lines"||this.config.matching==="words");return doMatching?matcher2(oldLines,newLines):[[oldLines,newLines]]}makeHeaderHtml(blockHeader,file){return this.hoganUtils.render(genericTemplatesPath,"block-header",{CSSLineClass,blockHeader:(file===null||file===void 0?void 0:file.isTooBig)?blockHeader:escapeForHtml(blockHeader),lineClass:"d2h-code-side-linenumber",contentClass:"d2h-code-side-line"})}processChangedLines(isCombined,oldLines,newLines){const fileHtml={right:"",left:""};const maxLinesNumber=Math.max(oldLines.length,newLines.length);for(let i=0;i<maxLinesNumber;i++){const oldLine=oldLines[i];const newLine=newLines[i];const diff=oldLine!==void 0&&newLine!==void 0?diffHighlight(oldLine.content,newLine.content,isCombined,this.config):void 0;const preparedOldLine=oldLine!==void 0&&oldLine.oldNumber!==void 0?Object.assign(Object.assign({},diff!==void 0?{prefix:diff.oldLine.prefix,content:diff.oldLine.content,type:CSSLineClass.DELETE_CHANGES}:Object.assign(Object.assign({},deconstructLine(oldLine.content,isCombined)),{type:toCSSClass(oldLine.type)})),{number:oldLine.oldNumber}):void 0;const preparedNewLine=newLine!==void 0&&newLine.newNumber!==void 0?Object.assign(Object.assign({},diff!==void 0?{prefix:diff.newLine.prefix,content:diff.newLine.content,type:CSSLineClass.INSERT_CHANGES}:Object.assign(Object.assign({},deconstructLine(newLine.content,isCombined)),{type:toCSSClass(newLine.type)})),{number:newLine.newNumber}):void 0;const{left,right}=this.generateLineHtml(preparedOldLine,preparedNewLine);fileHtml.left+=left;fileHtml.right+=right}return fileHtml}generateLineHtml(oldLine,newLine){return{left:this.generateSingleHtml(oldLine),right:this.generateSingleHtml(newLine)}}generateSingleHtml(line){const lineClass="d2h-code-side-linenumber";const contentClass="d2h-code-side-line";return this.hoganUtils.render(genericTemplatesPath,"line",{type:(line===null||line===void 0?void 0:line.type)||`${CSSLineClass.CONTEXT} d2h-emptyplaceholder`,lineClass:line!==void 0?lineClass:`${lineClass} d2h-code-side-emptyplaceholder`,contentClass:line!==void 0?contentClass:`${contentClass} d2h-code-side-emptyplaceholder`,prefix:(line===null||line===void 0?void 0:line.prefix)===" "?"&nbsp;":line===null||line===void 0?void 0:line.prefix,content:line===null||line===void 0?void 0:line.content,lineNumber:line===null||line===void 0?void 0:line.number})}}var compiler={};var hasRequiredCompiler;function requireCompiler(){if(hasRequiredCompiler)return compiler;hasRequiredCompiler=1;(function(exports){(function(Hogan){var rIsWhitespace=/\S/,rQuot=/\"/g,rNewline=/\n/g,rCr=/\r/g,rSlash=/\\/g,rLineSep=/\u2028/,rParagraphSep=/\u2029/;Hogan.tags={"#":1,"^":2,"<":3,"$":4,"/":5,"!":6,">":7,"=":8,"_v":9,"{":10,"&":11,"_t":12};Hogan.scan=function scan(text,delimiters){var len=text.length,IN_TEXT=0,IN_TAG_TYPE=1,IN_TAG=2,state=IN_TEXT,tagType=null,tag=null,buf="",tokens=[],seenTag=false,i=0,lineStart=0,otag="{{",ctag="}}";function addBuf(){if(buf.length>0){tokens.push({tag:"_t",text:new String(buf)});buf=""}}function lineIsWhitespace(){var isAllWhitespace=true;for(var j=lineStart;j<tokens.length;j++){isAllWhitespace=Hogan.tags[tokens[j].tag]<Hogan.tags["_v"]||tokens[j].tag=="_t"&&tokens[j].text.match(rIsWhitespace)===null;if(!isAllWhitespace){return false}}return isAllWhitespace}function filterLine(haveSeenTag,noNewLine){addBuf();if(haveSeenTag&&lineIsWhitespace()){for(var j=lineStart,next;j<tokens.length;j++){if(tokens[j].text){if((next=tokens[j+1])&&next.tag==">"){next.indent=tokens[j].text.toString()}tokens.splice(j,1)}}}else if(!noNewLine){tokens.push({tag:"\n"})}seenTag=false;lineStart=tokens.length}function changeDelimiters(text2,index){var close="="+ctag,closeIndex=text2.indexOf(close,index),delimiters2=trim(text2.substring(text2.indexOf("=",index)+1,closeIndex)).split(" ");otag=delimiters2[0];ctag=delimiters2[delimiters2.length-1];return closeIndex+close.length-1}if(delimiters){delimiters=delimiters.split(" ");otag=delimiters[0];ctag=delimiters[1]}for(i=0;i<len;i++){if(state==IN_TEXT){if(tagChange(otag,text,i)){--i;addBuf();state=IN_TAG_TYPE}else{if(text.charAt(i)=="\n"){filterLine(seenTag)}else{buf+=text.charAt(i)}}}else if(state==IN_TAG_TYPE){i+=otag.length-1;tag=Hogan.tags[text.charAt(i+1)];tagType=tag?text.charAt(i+1):"_v";if(tagType=="="){i=changeDelimiters(text,i);state=IN_TEXT}else{if(tag){i++}state=IN_TAG}seenTag=i}else{if(tagChange(ctag,text,i)){tokens.push({tag:tagType,n:trim(buf),otag,ctag,i:tagType=="/"?seenTag-otag.length:i+ctag.length});buf="";i+=ctag.length-1;state=IN_TEXT;if(tagType=="{"){if(ctag=="}}"){i++}else{cleanTripleStache(tokens[tokens.length-1])}}}else{buf+=text.charAt(i)}}}filterLine(seenTag,true);return tokens};function cleanTripleStache(token){if(token.n.substr(token.n.length-1)==="}"){token.n=token.n.substring(0,token.n.length-1)}}function trim(s){if(s.trim){return s.trim()}return s.replace(/^\s*|\s*$/g,"")}function tagChange(tag,text,index){if(text.charAt(index)!=tag.charAt(0)){return false}for(var i=1,l=tag.length;i<l;i++){if(text.charAt(index+i)!=tag.charAt(i)){return false}}return true}var allowedInSuper={"_t":true,"\n":true,"$":true,"/":true};function buildTree(tokens,kind,stack,customTags){var instructions=[],opener=null,tail=null,token=null;tail=stack[stack.length-1];while(tokens.length>0){token=tokens.shift();if(tail&&tail.tag=="<"&&!(token.tag in allowedInSuper)){throw new Error("Illegal content in < super tag.")}if(Hogan.tags[token.tag]<=Hogan.tags["$"]||isOpener(token,customTags)){stack.push(token);token.nodes=buildTree(tokens,token.tag,stack,customTags)}else if(token.tag=="/"){if(stack.length===0){throw new Error("Closing tag without opener: /"+token.n)}opener=stack.pop();if(token.n!=opener.n&&!isCloser(token.n,opener.n,customTags)){throw new Error("Nesting error: "+opener.n+" vs. "+token.n)}opener.end=token.i;return instructions}else if(token.tag=="\n"){token.last=tokens.length==0||tokens[0].tag=="\n"}instructions.push(token)}if(stack.length>0){throw new Error("missing closing tag: "+stack.pop().n)}return instructions}function isOpener(token,tags){for(var i=0,l=tags.length;i<l;i++){if(tags[i].o==token.n){token.tag="#";return true}}}function isCloser(close,open,tags){for(var i=0,l=tags.length;i<l;i++){if(tags[i].c==close&&tags[i].o==open){return true}}}function stringifySubstitutions(obj){var items=[];for(var key2 in obj){items.push('"'+esc(key2)+'": function(c,p,t,i) {'+obj[key2]+"}")}return"{ "+items.join(",")+" }"}function stringifyPartials(codeObj){var partials=[];for(var key2 in codeObj.partials){partials.push('"'+esc(key2)+'":{name:"'+esc(codeObj.partials[key2].name)+'", '+stringifyPartials(codeObj.partials[key2])+"}")}return"partials: {"+partials.join(",")+"}, subs: "+stringifySubstitutions(codeObj.subs)}Hogan.stringify=function(codeObj,text,options){return"{code: function (c,p,i) { "+Hogan.wrapMain(codeObj.code)+" },"+stringifyPartials(codeObj)+"}"};var serialNo=0;Hogan.generate=function(tree,text,options){serialNo=0;var context={code:"",subs:{},partials:{}};Hogan.walk(tree,context);if(options.asString){return this.stringify(context,text,options)}return this.makeTemplate(context,text,options)};Hogan.wrapMain=function(code){return'var t=this;t.b(i=i||"");'+code+"return t.fl();"};Hogan.template=Hogan.Template;Hogan.makeTemplate=function(codeObj,text,options){var template2=this.makePartials(codeObj);template2.code=new Function("c","p","i",this.wrapMain(codeObj.code));return new this.template(template2,text,this,options)};Hogan.makePartials=function(codeObj){var key2,template2={subs:{},partials:codeObj.partials,name:codeObj.name};for(key2 in template2.partials){template2.partials[key2]=this.makePartials(template2.partials[key2])}for(key2 in codeObj.subs){template2.subs[key2]=new Function("c","p","t","i",codeObj.subs[key2])}return template2};function esc(s){return s.replace(rSlash,"\\\\").replace(rQuot,'\\"').replace(rNewline,"\\n").replace(rCr,"\\r").replace(rLineSep,"\\u2028").replace(rParagraphSep,"\\u2029")}function chooseMethod(s){return~s.indexOf(".")?"d":"f"}function createPartial(node,context){var prefix="<"+(context.prefix||"");var sym=prefix+node.n+serialNo++;context.partials[sym]={name:node.n,partials:{}};context.code+='t.b(t.rp("'+esc(sym)+'",c,p,"'+(node.indent||"")+'"));';return sym}Hogan.codegen={"#":function(node,context){context.code+="if(t.s(t."+chooseMethod(node.n)+'("'+esc(node.n)+'",c,p,1),c,p,0,'+node.i+","+node.end+',"'+node.otag+" "+node.ctag+'")){t.rs(c,p,function(c,p,t){';Hogan.walk(node.nodes,context);context.code+="});c.pop();}"},"^":function(node,context){context.code+="if(!t.s(t."+chooseMethod(node.n)+'("'+esc(node.n)+'",c,p,1),c,p,1,0,0,"")){';Hogan.walk(node.nodes,context);context.code+="};"},">":createPartial,"<":function(node,context){var ctx={partials:{},code:"",subs:{},inPartial:true};Hogan.walk(node.nodes,ctx);var template2=context.partials[createPartial(node,context)];template2.subs=ctx.subs;template2.partials=ctx.partials},"$":function(node,context){var ctx={subs:{},code:"",partials:context.partials,prefix:node.n};Hogan.walk(node.nodes,ctx);context.subs[node.n]=ctx.code;if(!context.inPartial){context.code+='t.sub("'+esc(node.n)+'",c,p,i);'}},"\n":function(node,context){context.code+=write('"\\n"'+(node.last?"":" + i"))},"_v":function(node,context){context.code+="t.b(t.v(t."+chooseMethod(node.n)+'("'+esc(node.n)+'",c,p,0)));'},"_t":function(node,context){context.code+=write('"'+esc(node.text)+'"')},"{":tripleStache,"&":tripleStache};function tripleStache(node,context){context.code+="t.b(t.t(t."+chooseMethod(node.n)+'("'+esc(node.n)+'",c,p,0)));'}function write(s){return"t.b("+s+");"}Hogan.walk=function(nodelist,context){var func;for(var i=0,l=nodelist.length;i<l;i++){func=Hogan.codegen[nodelist[i].tag];func&&func(nodelist[i],context)}return context};Hogan.parse=function(tokens,text,options){options=options||{};return buildTree(tokens,"",[],options.sectionTags||[])};Hogan.cache={};Hogan.cacheKey=function(text,options){return[text,!!options.asString,!!options.disableLambda,options.delimiters,!!options.modelGet].join("||")};Hogan.compile=function(text,options){options=options||{};var key2=Hogan.cacheKey(text,options);var template2=this.cache[key2];if(template2){var partials=template2.partials;for(var name in partials){delete partials[name].instance}return template2}template2=this.generate(this.parse(this.scan(text,options.delimiters),text,options),text,options);return this.cache[key2]=template2}})(exports)})(compiler);return compiler}var template={};var hasRequiredTemplate;function requireTemplate(){if(hasRequiredTemplate)return template;hasRequiredTemplate=1;(function(exports){(function(Hogan){Hogan.Template=function(codeObj,text,compiler2,options){codeObj=codeObj||{};this.r=codeObj.code||this.r;this.c=compiler2;this.options=options||{};this.text=text||"";this.partials=codeObj.partials||{};this.subs=codeObj.subs||{};this.buf=""};Hogan.Template.prototype={r:function(context,partials,indent){return""},v:hoganEscape,t:coerceToString,render:function render(context,partials,indent){return this.ri([context],partials||{},indent)},ri:function(context,partials,indent){return this.r(context,partials,indent)},ep:function(symbol,partials){var partial=this.partials[symbol];var template2=partials[partial.name];if(partial.instance&&partial.base==template2){return partial.instance}if(typeof template2=="string"){if(!this.c){throw new Error("No compiler available.")}template2=this.c.compile(template2,this.options)}if(!template2){return null}this.partials[symbol].base=template2;if(partial.subs){if(!partials.stackText)partials.stackText={};for(key in partial.subs){if(!partials.stackText[key]){partials.stackText[key]=this.activeSub!==void 0&&partials.stackText[this.activeSub]?partials.stackText[this.activeSub]:this.text}}template2=createSpecializedPartial(template2,partial.subs,partial.partials,this.stackSubs,this.stackPartials,partials.stackText)}this.partials[symbol].instance=template2;return template2},rp:function(symbol,context,partials,indent){var partial=this.ep(symbol,partials);if(!partial){return""}return partial.ri(context,partials,indent)},rs:function(context,partials,section){var tail=context[context.length-1];if(!isArray(tail)){section(context,partials,this);return}for(var i=0;i<tail.length;i++){context.push(tail[i]);section(context,partials,this);context.pop()}},s:function(val,ctx,partials,inverted,start,end,tags){var pass;if(isArray(val)&&val.length===0){return false}if(typeof val=="function"){val=this.ms(val,ctx,partials,inverted,start,end,tags)}pass=!!val;if(!inverted&&pass&&ctx){ctx.push(typeof val=="object"?val:ctx[ctx.length-1])}return pass},d:function(key2,ctx,partials,returnFound){var found,names=key2.split("."),val=this.f(names[0],ctx,partials,returnFound),doModelGet=this.options.modelGet,cx=null;if(key2==="."&&isArray(ctx[ctx.length-2])){val=ctx[ctx.length-1]}else{for(var i=1;i<names.length;i++){found=findInScope(names[i],val,doModelGet);if(found!==void 0){cx=val;val=found}else{val=""}}}if(returnFound&&!val){return false}if(!returnFound&&typeof val=="function"){ctx.push(cx);val=this.mv(val,ctx,partials);ctx.pop()}return val},f:function(key2,ctx,partials,returnFound){var val=false,v=null,found=false,doModelGet=this.options.modelGet;for(var i=ctx.length-1;i>=0;i--){v=ctx[i];val=findInScope(key2,v,doModelGet);if(val!==void 0){found=true;break}}if(!found){return returnFound?false:""}if(!returnFound&&typeof val=="function"){val=this.mv(val,ctx,partials)}return val},ls:function(func,cx,ctx,partials,text,tags){var oldTags=this.options.delimiters;this.options.delimiters=tags;this.b(this.ct(coerceToString(func.call(cx,text,ctx)),cx,partials));this.options.delimiters=oldTags;return false},ct:function(text,cx,partials){if(this.options.disableLambda){throw new Error("Lambda features disabled.")}return this.c.compile(text,this.options).render(cx,partials)},b:function(s){this.buf+=s},fl:function(){var r=this.buf;this.buf="";return r},ms:function(func,ctx,partials,inverted,start,end,tags){var textSource,cx=ctx[ctx.length-1],result=func.call(cx);if(typeof result=="function"){if(inverted){return true}else{textSource=this.activeSub&&this.subsText&&this.subsText[this.activeSub]?this.subsText[this.activeSub]:this.text;return this.ls(result,cx,ctx,partials,textSource.substring(start,end),tags)}}return result},mv:function(func,ctx,partials){var cx=ctx[ctx.length-1];var result=func.call(cx);if(typeof result=="function"){return this.ct(coerceToString(result.call(cx)),cx,partials)}return result},sub:function(name,context,partials,indent){var f=this.subs[name];if(f){this.activeSub=name;f(context,partials,this,indent);this.activeSub=false}}};function findInScope(key2,scope,doModelGet){var val;if(scope&&typeof scope=="object"){if(scope[key2]!==void 0){val=scope[key2]}else if(doModelGet&&scope.get&&typeof scope.get=="function"){val=scope.get(key2)}}return val}function createSpecializedPartial(instance,subs,partials,stackSubs,stackPartials,stackText){function PartialTemplate(){}PartialTemplate.prototype=instance;function Substitutions(){}Substitutions.prototype=instance.subs;var key2;var partial=new PartialTemplate;partial.subs=new Substitutions;partial.subsText={};partial.buf="";stackSubs=stackSubs||{};partial.stackSubs=stackSubs;partial.subsText=stackText;for(key2 in subs){if(!stackSubs[key2])stackSubs[key2]=subs[key2]}for(key2 in stackSubs){partial.subs[key2]=stackSubs[key2]}stackPartials=stackPartials||{};partial.stackPartials=stackPartials;for(key2 in partials){if(!stackPartials[key2])stackPartials[key2]=partials[key2]}for(key2 in stackPartials){partial.partials[key2]=stackPartials[key2]}return partial}var rAmp=/&/g,rLt=/</g,rGt=/>/g,rApos=/\'/g,rQuot=/\"/g,hChars=/[&<>\"\']/;function coerceToString(val){return String(val===null||val===void 0?"":val)}function hoganEscape(str){str=coerceToString(str);return hChars.test(str)?str.replace(rAmp,"&amp;").replace(rLt,"&lt;").replace(rGt,"&gt;").replace(rApos,"&#39;").replace(rQuot,"&quot;"):str}var isArray=Array.isArray||function(a){return Object.prototype.toString.call(a)==="[object Array]"}})(exports)})(template);return template}var hogan;var hasRequiredHogan;function requireHogan(){if(hasRequiredHogan)return hogan;hasRequiredHogan=1;var Hogan=requireCompiler();Hogan.Template=requireTemplate().Template;Hogan.template=Hogan.Template;hogan=Hogan;return hogan}var hoganExports=requireHogan();const defaultTemplates={};defaultTemplates["file-summary-line"]=new hoganExports.Template({code:function(c,p,i){var t=this;t.b(i=i||"");t.b('<li class="d2h-file-list-line">');t.b("\n"+i);t.b(' <span class="d2h-file-name-wrapper">');t.b("\n"+i);t.b(t.rp("<fileIcon0",c,p," "));t.b(' <a href="#');t.b(t.v(t.f("fileHtmlId",c,p,0)));t.b('" class="d2h-file-name">');t.b(t.v(t.f("fileName",c,p,0)));t.b("</a>");t.b("\n"+i);t.b(' <span class="d2h-file-stats">');t.b("\n"+i);t.b(' <span class="d2h-lines-added">');t.b(t.v(t.f("addedLines",c,p,0)));t.b("</span>");t.b("\n"+i);t.b(' <span class="d2h-lines-deleted">');t.b(t.v(t.f("deletedLines",c,p,0)));t.b("</span>");t.b("\n"+i);t.b(" </span>");t.b("\n"+i);t.b(" </span>");t.b("\n"+i);t.b("</li>");return t.fl()},partials:{"<fileIcon0":{name:"fileIcon",partials:{},subs:{}}},subs:{}});defaultTemplates["file-summary-wrapper"]=new hoganExports.Template({code:function(c,p,i){var t=this;t.b(i=i||"");t.b('<div class="d2h-file-list-wrapper ');t.b(t.v(t.f("colorScheme",c,p,0)));t.b('">');t.b("\n"+i);t.b(' <div class="d2h-file-list-header">');t.b("\n"+i);t.b(' <span class="d2h-file-list-title">Files changed (');t.b(t.v(t.f("filesNumber",c,p,0)));t.b(")</span>");t.b("\n"+i);t.b(' <a class="d2h-file-switch d2h-hide">hide</a>');t.b("\n"+i);t.b(' <a class="d2h-file-switch d2h-show">show</a>');t.b("\n"+i);t.b(" </div>");t.b("\n"+i);t.b(' <ol class="d2h-file-list">');t.b("\n"+i);t.b(" ");t.b(t.t(t.f("files",c,p,0)));t.b("\n"+i);t.b(" </ol>");t.b("\n"+i);t.b("</div>");return t.fl()},partials:{},subs:{}});defaultTemplates["generic-block-header"]=new hoganExports.Template({code:function(c,p,i){var t=this;t.b(i=i||"");t.b("<tr>");t.b("\n"+i);t.b(' <td class="');t.b(t.v(t.f("lineClass",c,p,0)));t.b(" ");t.b(t.v(t.d("CSSLineClass.INFO",c,p,0)));t.b('"></td>');t.b("\n"+i);t.b(' <td class="');t.b(t.v(t.d("CSSLineClass.INFO",c,p,0)));t.b('">');t.b("\n"+i);t.b(' <div class="');t.b(t.v(t.f("contentClass",c,p,0)));t.b('">');if(t.s(t.f("blockHeader",c,p,1),c,p,0,156,173,"{{ }}")){t.rs(c,p,function(c2,p2,t2){t2.b(t2.t(t2.f("blockHeader",c2,p2,0)))});c.pop()}if(!t.s(t.f("blockHeader",c,p,1),c,p,1,0,0,"")){t.b("&nbsp;")}t.b("</div>");t.b("\n"+i);t.b(" </td>");t.b("\n"+i);t.b("</tr>");return t.fl()},partials:{},subs:{}});defaultTemplates["generic-empty-diff"]=new hoganExports.Template({code:function(c,p,i){var t=this;t.b(i=i||"");t.b("<tr>");t.b("\n"+i);t.b(' <td class="');t.b(t.v(t.d("CSSLineClass.INFO",c,p,0)));t.b('">');t.b("\n"+i);t.b(' <div class="');t.b(t.v(t.f("contentClass",c,p,0)));t.b('">');t.b("\n"+i);t.b(" File without changes");t.b("\n"+i);t.b(" </div>");t.b("\n"+i);t.b(" </td>");t.b("\n"+i);t.b("</tr>");return t.fl()},partials:{},subs:{}});defaultTemplates["generic-file-path"]=new hoganExports.Template({code:function(c,p,i){var t=this;t.b(i=i||"");t.b('<span class="d2h-file-name-wrapper">');t.b("\n"+i);t.b(t.rp("<fileIcon0",c,p," "));t.b(' <span class="d2h-file-name">');t.b(t.v(t.f("fileDiffName",c,p,0)));t.b("</span>");t.b("\n"+i);t.b(t.rp("<fileTag1",c,p," "));t.b("</span>");t.b("\n"+i);t.b('<label class="d2h-file-collapse">');t.b("\n"+i);t.b(' <input class="d2h-file-collapse-input" type="checkbox" name="viewed" value="viewed">');t.b("\n"+i);t.b(" Viewed");t.b("\n"+i);t.b("</label>");return t.fl()},partials:{"<fileIcon0":{name:"fileIcon",partials:{},subs:{}},"<fileTag1":{name:"fileTag",partials:{},subs:{}}},subs:{}});defaultTemplates["generic-line"]=new hoganExports.Template({code:function(c,p,i){var t=this;t.b(i=i||"");t.b("<tr>");t.b("\n"+i);t.b(' <td class="');t.b(t.v(t.f("lineClass",c,p,0)));t.b(" ");t.b(t.v(t.f("type",c,p,0)));t.b('">');t.b("\n"+i);t.b(" ");t.b(t.t(t.f("lineNumber",c,p,0)));t.b("\n"+i);t.b(" </td>");t.b("\n"+i);t.b(' <td class="');t.b(t.v(t.f("type",c,p,0)));t.b('">');t.b("\n"+i);t.b(' <div class="');t.b(t.v(t.f("contentClass",c,p,0)));t.b('">');t.b("\n"+i);if(t.s(t.f("prefix",c,p,1),c,p,0,162,238,"{{ }}")){t.rs(c,p,function(c2,p2,t2){t2.b(' <span class="d2h-code-line-prefix">');t2.b(t2.t(t2.f("prefix",c2,p2,0)));t2.b("</span>");t2.b("\n"+i)});c.pop()}if(!t.s(t.f("prefix",c,p,1),c,p,1,0,0,"")){t.b(' <span class="d2h-code-line-prefix">&nbsp;</span>');t.b("\n"+i)}if(t.s(t.f("content",c,p,1),c,p,0,371,445,"{{ }}")){t.rs(c,p,function(c2,p2,t2){t2.b(' <span class="d2h-code-line-ctn">');t2.b(t2.t(t2.f("content",c2,p2,0)));t2.b("</span>");t2.b("\n"+i)});c.pop()}if(!t.s(t.f("content",c,p,1),c,p,1,0,0,"")){t.b(' <span class="d2h-code-line-ctn"><br></span>');t.b("\n"+i)}t.b(" </div>");t.b("\n"+i);t.b(" </td>");t.b("\n"+i);t.b("</tr>");return t.fl()},partials:{},subs:{}});defaultTemplates["generic-wrapper"]=new hoganExports.Template({code:function(c,p,i){var t=this;t.b(i=i||"");t.b('<div class="d2h-wrapper ');t.b(t.v(t.f("colorScheme",c,p,0)));t.b('">');t.b("\n"+i);t.b(" ");t.b(t.t(t.f("content",c,p,0)));t.b("\n"+i);t.b("</div>");return t.fl()},partials:{},subs:{}});defaultTemplates["icon-file-added"]=new hoganExports.Template({code:function(c,p,i){var t=this;t.b(i=i||"");t.b('<svg aria-hidden="true" class="d2h-icon d2h-added" height="16" title="added" version="1.1" viewBox="0 0 14 16"');t.b("\n"+i);t.b(' width="14">');t.b("\n"+i);t.b(' <path d="M13 1H1C0.45 1 0 1.45 0 2v12c0 0.55 0.45 1 1 1h12c0.55 0 1-0.45 1-1V2c0-0.55-0.45-1-1-1z m0 13H1V2h12v12zM6 9H3V7h3V4h2v3h3v2H8v3H6V9z"></path>');t.b("\n"+i);t.b("</svg>");return t.fl()},partials:{},subs:{}});defaultTemplates["icon-file-changed"]=new hoganExports.Template({code:function(c,p,i){var t=this;t.b(i=i||"");t.b('<svg aria-hidden="true" class="d2h-icon d2h-changed" height="16" title="modified" version="1.1"');t.b("\n"+i);t.b(' viewBox="0 0 14 16" width="14">');t.b("\n"+i);t.b(' <path d="M13 1H1C0.45 1 0 1.45 0 2v12c0 0.55 0.45 1 1 1h12c0.55 0 1-0.45 1-1V2c0-0.55-0.45-1-1-1z m0 13H1V2h12v12zM4 8c0-1.66 1.34-3 3-3s3 1.34 3 3-1.34 3-3 3-3-1.34-3-3z"></path>');t.b("\n"+i);t.b("</svg>");return t.fl()},partials:{},subs:{}});defaultTemplates["icon-file-deleted"]=new hoganExports.Template({code:function(c,p,i){var t=this;t.b(i=i||"");t.b('<svg aria-hidden="true" class="d2h-icon d2h-deleted" height="16" title="removed" version="1.1"');t.b("\n"+i);t.b(' viewBox="0 0 14 16" width="14">');t.b("\n"+i);t.b(' <path d="M13 1H1C0.45 1 0 1.45 0 2v12c0 0.55 0.45 1 1 1h12c0.55 0 1-0.45 1-1V2c0-0.55-0.45-1-1-1z m0 13H1V2h12v12zM11 9H3V7h8v2z"></path>');t.b("\n"+i);t.b("</svg>");return t.fl()},partials:{},subs:{}});defaultTemplates["icon-file-renamed"]=new hoganExports.Template({code:function(c,p,i){var t=this;t.b(i=i||"");t.b('<svg aria-hidden="true" class="d2h-icon d2h-moved" height="16" title="renamed" version="1.1"');t.b("\n"+i);t.b(' viewBox="0 0 14 16" width="14">');t.b("\n"+i);t.b(' <path d="M6 9H3V7h3V4l5 4-5 4V9z m8-7v12c0 0.55-0.45 1-1 1H1c-0.55 0-1-0.45-1-1V2c0-0.55 0.45-1 1-1h12c0.55 0 1 0.45 1 1z m-1 0H1v12h12V2z"></path>');t.b("\n"+i);t.b("</svg>");return t.fl()},partials:{},subs:{}});defaultTemplates["icon-file"]=new hoganExports.Template({code:function(c,p,i){var t=this;t.b(i=i||"");t.b('<svg aria-hidden="true" class="d2h-icon" height="16" version="1.1" viewBox="0 0 12 16" width="12">');t.b("\n"+i);t.b(' <path d="M6 5H2v-1h4v1zM2 8h7v-1H2v1z m0 2h7v-1H2v1z m0 2h7v-1H2v1z m10-7.5v9.5c0 0.55-0.45 1-1 1H1c-0.55 0-1-0.45-1-1V2c0-0.55 0.45-1 1-1h7.5l3.5 3.5z m-1 0.5L8 2H1v12h10V5z"></path>');t.b("\n"+i);t.b("</svg>");return t.fl()},partials:{},subs:{}});defaultTemplates["line-by-line-file-diff"]=new hoganExports.Template({code:function(c,p,i){var t=this;t.b(i=i||"");t.b('<div id="');t.b(t.v(t.f("fileHtmlId",c,p,0)));t.b('" class="d2h-file-wrapper" data-lang="');t.b(t.v(t.d("file.language",c,p,0)));t.b('">');t.b("\n"+i);t.b(' <div class="d2h-file-header">');t.b("\n"+i);t.b(" ");t.b(t.t(t.f("filePath",c,p,0)));t.b("\n"+i);t.b(" </div>");t.b("\n"+i);t.b(' <div class="d2h-file-diff">');t.b("\n"+i);t.b(' <div class="d2h-code-wrapper">');t.b("\n"+i);t.b(' <table class="d2h-diff-table">');t.b("\n"+i);t.b(' <tbody class="d2h-diff-tbody">');t.b("\n"+i);t.b(" ");t.b(t.t(t.f("diffs",c,p,0)));t.b("\n"+i);t.b(" </tbody>");t.b("\n"+i);t.b(" </table>");t.b("\n"+i);t.b(" </div>");t.b("\n"+i);t.b(" </div>");t.b("\n"+i);t.b("</div>");return t.fl()},partials:{},subs:{}});defaultTemplates["line-by-line-numbers"]=new hoganExports.Template({code:function(c,p,i){var t=this;t.b(i=i||"");t.b('<div class="line-num1">');t.b(t.v(t.f("oldNumber",c,p,0)));t.b("</div>");t.b("\n"+i);t.b('<div class="line-num2">');t.b(t.v(t.f("newNumber",c,p,0)));t.b("</div>");return t.fl()},partials:{},subs:{}});defaultTemplates["side-by-side-file-diff"]=new hoganExports.Template({code:function(c,p,i){var t=this;t.b(i=i||"");t.b('<div id="');t.b(t.v(t.f("fileHtmlId",c,p,0)));t.b('" class="d2h-file-wrapper" data-lang="');t.b(t.v(t.d("file.language",c,p,0)));t.b('">');t.b("\n"+i);t.b(' <div class="d2h-file-header">');t.b("\n"+i);t.b(" ");t.b(t.t(t.f("filePath",c,p,0)));t.b("\n"+i);t.b(" </div>");t.b("\n"+i);t.b(' <div class="d2h-files-diff">');t.b("\n"+i);t.b(' <div class="d2h-file-side-diff">');t.b("\n"+i);t.b(' <div class="d2h-code-wrapper">');t.b("\n"+i);t.b(' <table class="d2h-diff-table">');t.b("\n"+i);t.b(' <tbody class="d2h-diff-tbody">');t.b("\n"+i);t.b(" ");t.b(t.t(t.d("diffs.left",c,p,0)));t.b("\n"+i);t.b(" </tbody>");t.b("\n"+i);t.b(" </table>");t.b("\n"+i);t.b(" </div>");t.b("\n"+i);t.b(" </div>");t.b("\n"+i);t.b(' <div class="d2h-file-side-diff">');t.b("\n"+i);t.b(' <div class="d2h-code-wrapper">');t.b("\n"+i);t.b(' <table class="d2h-diff-table">');t.b("\n"+i);t.b(' <tbody class="d2h-diff-tbody">');t.b("\n"+i);t.b(" ");t.b(t.t(t.d("diffs.right",c,p,0)));t.b("\n"+i);t.b(" </tbody>");t.b("\n"+i);t.b(" </table>");t.b("\n"+i);t.b(" </div>");t.b("\n"+i);t.b(" </div>");t.b("\n"+i);t.b(" </div>");t.b("\n"+i);t.b("</div>");return t.fl()},partials:{},subs:{}});defaultTemplates["tag-file-added"]=new hoganExports.Template({code:function(c,p,i){var t=this;t.b(i=i||"");t.b('<span class="d2h-tag d2h-added d2h-added-tag">ADDED</span>');return t.fl()},partials:{},subs:{}});defaultTemplates["tag-file-changed"]=new hoganExports.Template({code:function(c,p,i){var t=this;t.b(i=i||"");t.b('<span class="d2h-tag d2h-changed d2h-changed-tag">CHANGED</span>');return t.fl()},partials:{},subs:{}});defaultTemplates["tag-file-deleted"]=new hoganExports.Template({code:function(c,p,i){var t=this;t.b(i=i||"");t.b('<span class="d2h-tag d2h-deleted d2h-deleted-tag">DELETED</span>');return t.fl()},partials:{},subs:{}});defaultTemplates["tag-file-renamed"]=new hoganExports.Template({code:function(c,p,i){var t=this;t.b(i=i||"");t.b('<span class="d2h-tag d2h-moved d2h-moved-tag">RENAMED</span>');return t.fl()},partials:{},subs:{}});class HoganJsUtils{constructor({compiledTemplates={},rawTemplates={}}){const compiledRawTemplates=Object.entries(rawTemplates).reduce((previousTemplates,[name,templateString])=>{const compiledTemplate=hoganExports.compile(templateString,{asString:false});return Object.assign(Object.assign({},previousTemplates),{[name]:compiledTemplate})},{});this.preCompiledTemplates=Object.assign(Object.assign(Object.assign({},defaultTemplates),compiledTemplates),compiledRawTemplates)}static compile(templateString){return hoganExports.compile(templateString,{asString:false})}render(namespace,view,params,partials,indent){const templateKey=this.templateKey(namespace,view);try{const template2=this.preCompiledTemplates[templateKey];return template2.render(params,partials,indent)}catch(_e){throw new Error(`Could not find template to render '${templateKey}'`)}}template(namespace,view){return this.preCompiledTemplates[this.templateKey(namespace,view)]}templateKey(namespace,view){return`${namespace}-${view}`}}const defaultDiff2HtmlConfig=Object.assign(Object.assign(Object.assign({},defaultLineByLineRendererConfig),defaultSideBySideRendererConfig),{outputFormat:OutputFormatType.LINE_BY_LINE,drawFileList:true});function html(diffInput,configuration={}){const config=Object.assign(Object.assign({},defaultDiff2HtmlConfig),configuration);const diffJson=typeof diffInput==="string"?parse(diffInput,config):diffInput;const hoganUtils=new HoganJsUtils(config);const{colorScheme}=config;const fileListRendererConfig={colorScheme};const fileList=config.drawFileList?new FileListRenderer(hoganUtils,fileListRendererConfig).render(diffJson):"";const diffOutput=config.outputFormat==="side-by-side"?new SideBySideRenderer(hoganUtils,config).render(diffJson):new LineByLineRenderer(hoganUtils,config).render(diffJson);return fileList+diffOutput}const _hoisted_1$2={class:"vibe64-repository-diff"};const _hoisted_2$2=["innerHTML"];const _sfc_main$2={__name:"Vibe64RepositoryDiff",props:{error:{default:"",type:String},loading:{default:false,type:Boolean},payload:{default:null,type:Object}},setup(__props){const props=__props;const rendered=computed(()=>{var _a;const diff=String(((_a=props.payload)==null?void 0:_a.diff)||"");return diff?html(diff,{drawFileList:false,matching:"lines",outputFormat:"side-by-side"}):""});const shownLines=computed(()=>{var _a;return Number(((_a=props.payload)==null?void 0:_a.shownLines)||0)});const totalLines=computed(()=>{var _a;return Number(((_a=props.payload)==null?void 0:_a.totalLines)||0)});const truncated=computed(()=>{var _a;return((_a=props.payload)==null?void 0:_a.truncated)===true});return(_ctx,_cache)=>{return openBlock(),createElementBlock("section",_hoisted_1$2,[__props.loading?(openBlock(),createBlock(VProgressLinear,{key:0,color:"primary",indeterminate:""})):createCommentVNode("",true),__props.error?(openBlock(),createBlock(StudioErrorNotice,{key:1,compact:"",error:__props.error,title:"File changes could not load"},null,8,["error"])):truncated.value?(openBlock(),createBlock(VAlert,{key:2,density:"compact",type:"warning",variant:"tonal"},{default:withCtx(()=>[createTextVNode(" This large file difference is shortened to "+toDisplayString(shownLines.value)+" of "+toDisplayString(totalLines.value)+" lines. ",1)]),_:1})):createCommentVNode("",true),rendered.value?(openBlock(),createElementBlock("div",{key:3,class:"vibe64-repository-diff__rendered",innerHTML:rendered.value},null,8,_hoisted_2$2)):!__props.loading&&!__props.error?(openBlock(),createBlock(VAlert,{key:4,density:"compact",type:"info",variant:"tonal"},{default:withCtx(()=>[..._cache[0]||(_cache[0]=[createTextVNode(" Choose a changed file to see exactly what changed. ",-1)])]),_:1})):createCommentVNode("",true)])}}};const Vibe64RepositoryDiff=_export_sfc(_sfc_main$2,[["__scopeId","data-v-fdf12a43"]]);const _hoisted_1$1=["aria-label"];const _hoisted_2$1={key:0};const _hoisted_3$1={key:0};const _hoisted_4$1=["aria-current","onClick"];const _hoisted_5$1={class:"vibe64-repository-file-browser__path"};const _hoisted_6$1={class:"vibe64-repository-file-browser__meta"};const _hoisted_7$1={class:"vibe64-repository-file-browser__counts"};const _hoisted_8$1={class:"vibe64-repository-file-browser__detail"};const _sfc_main$1={__name:"Vibe64RepositoryFileBrowser",props:{ariaLabel:{default:"Changed files",type:String},embedded:{default:false,type:Boolean},emptyTitle:{default:"Select a file",type:String},error:{default:"",type:String},files:{default:()=>[],type:Array},listDescription:{default:"",type:String},listTitle:{default:"",type:String},loading:{default:false,type:Boolean},loadingMore:{default:false,type:Boolean},payload:{default:null,type:Object},selectedPath:{default:"",type:String},truncated:{default:false,type:Boolean}},emits:["load-more","select"],setup(__props){function fileStatusLabel(value=""){return{A:"Added",C:"Copied",D:"Removed",M:"Changed",R:"Renamed",T:"Type changed",U:"Needs attention"}[String(value||"").slice(0,1).toUpperCase()]||"Changed"}return(_ctx,_cache)=>{return openBlock(),createElementBlock("div",{class:normalizeClass(["vibe64-repository-file-browser",{"vibe64-repository-file-browser--embedded":__props.embedded}])},[createBaseVNode("aside",{"aria-label":__props.ariaLabel,class:"vibe64-repository-file-browser__list"},[__props.listTitle?(openBlock(),createElementBlock("header",_hoisted_2$1,[createBaseVNode("strong",null,toDisplayString(__props.listTitle),1),__props.listDescription?(openBlock(),createElementBlock("span",_hoisted_3$1,toDisplayString(__props.listDescription),1)):createCommentVNode("",true)])):createCommentVNode("",true),(openBlock(true),createElementBlock(Fragment,null,renderList(__props.files,file=>{return openBlock(),createElementBlock("button",{key:file.path,"aria-current":__props.selectedPath===file.path?"true":void 0,class:normalizeClass(["vibe64-repository-file-browser__file",{"vibe64-repository-file-browser__file--active":__props.selectedPath===file.path}]),type:"button",onClick:$event=>_ctx.$emit("select",file)},[createBaseVNode("span",_hoisted_5$1,toDisplayString(file.path),1),createBaseVNode("span",_hoisted_6$1,[createTextVNode(toDisplayString(fileStatusLabel(file.status))+" ",1),createBaseVNode("span",_hoisted_7$1,"+"+toDisplayString(file.added)+" −"+toDisplayString(file.deleted),1)])],10,_hoisted_4$1)}),128)),__props.truncated?(openBlock(),createBlock(VBtn,{key:1,loading:__props.loadingMore,size:"small",type:"button",variant:"text",onClick:_cache[0]||(_cache[0]=$event=>_ctx.$emit("load-more"))},{default:withCtx(()=>[..._cache[1]||(_cache[1]=[createTextVNode(" Load more files ",-1)])]),_:1},8,["loading"])):createCommentVNode("",true)],8,_hoisted_1$1),createBaseVNode("main",_hoisted_8$1,[createBaseVNode("h2",null,toDisplayString(__props.selectedPath||__props.emptyTitle),1),createVNode(Vibe64RepositoryDiff,{error:__props.error,loading:__props.loading,payload:__props.payload},null,8,["error","loading","payload"])])],2)}}};const Vibe64RepositoryFileBrowser=_export_sfc(_sfc_main$1,[["__scopeId","data-v-147b6f7c"]]);function message(error,fallback){return error instanceof Error?error.message:String(error||fallback)}async function requestJson(path,options={}){var _a,_b;if(!path){throw new Error("Repository information is not available yet.")}const result=await getHttpWebClient().request(path,{method:"GET",...options});if((result==null?void 0:result.ok)===false){const error=new Error(vibe64ApiResponseError(result,"Repository information could not be loaded."));error.code=String(result.code||((_b=(_a=result.errors)==null?void 0:_a[0])==null?void 0:_b.code)||"").trim();error.response=result;throw error}return result}function useVibe64RepositoryWorkspace(dashboardContext,{view="changes"}={}){const selectedCurrentPath=ref("");const selectedVersion=ref(null);const selectedVersionPath=ref("");const changes=reactive({error:"",loading:false,loadingMore:false,payload:null});const currentDiff=reactive({error:"",loading:false,payload:null});const history=reactive({error:"",loading:false,nextCursor:"",payload:null,versions:[]});const versionFiles=reactive({error:"",loading:false,loadingMore:false,payload:null});const versionDiff=reactive({error:"",loading:false,payload:null});const updates=reactive({applying:false,canonicalChangePending:false,checking:false,error:"",errorCode:"",payload:null});const saving=ref(false);const requestRevisions=Object.create(null);const updateChecks=new Map;const forcedUpdateFollowups=new Set;let activeChangesRefresh=null;let activeSaveHistoryRefresh=null;let disposed=false;const context=computed(()=>dashboardContext.value||{});const activeView=computed(()=>String(readRefOrGetterValue(view)||"changes")==="history"?"history":"changes");const sessionId=computed(()=>{var _a;return String(context.value.sessionId||((_a=context.value.session)==null?void 0:_a.sessionId)||"").trim()});const sessionsApiPath=computed(()=>String(readRefOrGetterValue(context.value.sessionsApiPath)||"").trim());const sourceOperationsSuspended=computed(()=>readRefOrGetterValue(context.value.sourceOperationsSuspended)===true);let updateAccessRevision=0;function requestContextKey(){return`${sessionsApiPath.value}\0${sessionId.value}`}function updateCheckContextKey(){return`${requestContextKey()}\0${updateAccessRevision}`}function beginRequest(name){const revision=Number(requestRevisions[name]||0)+1;requestRevisions[name]=revision;return{contextKey:requestContextKey(),name,revision}}function requestIsCurrent(request){return!disposed&&(request==null?void 0:request.contextKey)===requestContextKey()&&requestRevisions[request.name]===request.revision}function updateRequestIsCurrent(request){return requestIsCurrent(request)&&(request==null?void 0:request.updateAccessRevision)===updateAccessRevision&&!sourceOperationsSuspended.value}function invalidateRequests(){for(const name of["applyUpdates","changes","currentDiff","history","saveHistory","updates","versionDiff","versionFiles"]){requestRevisions[name]=Number(requestRevisions[name]||0)+1}}function updateCheckIsNewer(candidate={},current={}){const candidateCheck=candidate&&typeof candidate==="object"?candidate:{};const currentCheck=current&&typeof current==="object"?current:{};const candidateTime=Date.parse(String(candidateCheck.checkedAt||""));const currentTime=Date.parse(String(currentCheck.checkedAt||""));if(!Number.isFinite(candidateTime)){return!currentCheck.checkedAt}return!Number.isFinite(currentTime)||candidateTime>=currentTime}async function selectCurrentFile(file){const path=String((file==null?void 0:file.path)||"");selectedCurrentPath.value=path;currentDiff.error="";currentDiff.payload=null;if(!path||!sessionId.value){return}const request=beginRequest("currentDiff");currentDiff.loading=true;try{const result=await requestJson(vibe64SessionChangeDiffPath(sessionsApiPath.value,sessionId.value,path));if(requestIsCurrent(request)&&selectedCurrentPath.value===path){currentDiff.payload=result}}catch(error){if(requestIsCurrent(request)){currentDiff.error=message(error,"This file difference could not be loaded.")}}finally{if(requestIsCurrent(request)){currentDiff.loading=false}}}async function loadChanges({append=false}={}){var _a,_b,_c;changes.error="";if(!append){beginRequest("currentDiff");changes.payload=null;selectedCurrentPath.value="";currentDiff.error="";currentDiff.loading=false;currentDiff.payload=null}if(!sessionId.value){return}const request=beginRequest("changes");changes.loading=!append;changes.loadingMore=append;try{const previousFiles=append?((_a=changes.payload)==null?void 0:_a.files)||[]:[];const result=await requestJson(vibe64SessionChangesPath(sessionsApiPath.value,sessionId.value,{offset:previousFiles.length}));if(!requestIsCurrent(request)){return}changes.payload=append?{...result,files:[...previousFiles,...result.files||[]]}:result;if(!append&&typeof context.value.refreshSessionWork==="function"){const observedWork={...result};delete observedWork.initialDiff;await context.value.refreshSessionWork(observedWork)}const first=!append?(_c=(_b=changes.payload)==null?void 0:_b.files)==null?void 0:_c[0]:null;if(first){const initialDiff=result.initialDiff&&typeof result.initialDiff==="object"?result.initialDiff:null;if(String((initialDiff==null?void 0:initialDiff.path)||"")===String(first.path||"")){selectedCurrentPath.value=first.path;currentDiff.payload=initialDiff}else{void selectCurrentFile(first)}}}catch(error){if(requestIsCurrent(request)){changes.error=message(error,"Current changes could not be loaded.")}}finally{if(requestIsCurrent(request)){changes.loading=false;changes.loadingMore=false}}}function requestChangesRefresh(){const contextKey=requestContextKey();if((activeChangesRefresh==null?void 0:activeChangesRefresh.contextKey)===contextKey){activeChangesRefresh.refreshAfterActive=true;return activeChangesRefresh.promise}const refresh={contextKey,promise:null,refreshAfterActive:false};refresh.promise=loadChanges().finally(()=>{if(activeChangesRefresh!==refresh){return}activeChangesRefresh=null;if(refresh.refreshAfterActive&&!disposed&&refresh.contextKey===requestContextKey()&&activeView.value==="changes"&&!sourceOperationsSuspended.value){void requestChangesRefresh()}});activeChangesRefresh=refresh;return refresh.promise}async function selectVersion(version){var _a,_b,_c,_d,_e;const request=beginRequest("versionFiles");beginRequest("versionDiff");if(((_a=selectedVersion.value)==null?void 0:_a.commit)!==(version==null?void 0:version.commit)){versionFiles.error=""}selectedVersion.value=version||null;selectedVersionPath.value="";versionFiles.loading=false;versionFiles.loadingMore=false;versionFiles.payload=null;versionDiff.error="";versionDiff.loading=false;versionDiff.payload=null;if(!(version==null?void 0:version.commit)||!((_b=history.payload)==null?void 0:_b.historySnapshotCommit)){return}versionFiles.loading=true;try{const result=await requestJson(vibe64RepositoryVersionFilesPath(sessionsApiPath.value,version.commit,{historySnapshotCommit:history.payload.historySnapshotCommit,sessionId:sessionId.value}));if(!requestIsCurrent(request)||((_c=selectedVersion.value)==null?void 0:_c.commit)!==version.commit){return}versionFiles.payload=result;versionFiles.error="";versionFiles.loading=false;const first=(_e=(_d=versionFiles.payload)==null?void 0:_d.files)==null?void 0:_e[0];if(first){await selectVersionFile(first)}}catch(error){if(requestIsCurrent(request)){versionFiles.error=message(error,"This version could not be loaded.")}}finally{if(requestIsCurrent(request)){versionFiles.loading=false}}}async function loadMoreVersionFiles(){var _a,_b,_c;if(versionFiles.loading||versionFiles.loadingMore||!((_a=versionFiles.payload)==null?void 0:_a.truncated)||!((_b=selectedVersion.value)==null?void 0:_b.commit)||!((_c=history.payload)==null?void 0:_c.historySnapshotCommit)){return}versionFiles.loadingMore=true;versionFiles.error="";const request=beginRequest("versionFiles");try{const previousFiles=versionFiles.payload.files||[];const result=await requestJson(vibe64RepositoryVersionFilesPath(sessionsApiPath.value,selectedVersion.value.commit,{historySnapshotCommit:history.payload.historySnapshotCommit,offset:previousFiles.length,sessionId:sessionId.value}));if(!requestIsCurrent(request)){return}versionFiles.payload={...result,files:[...previousFiles,...result.files||[]]}}catch(error){if(requestIsCurrent(request)){versionFiles.error=message(error,"More files from this version could not be loaded.")}}finally{if(requestIsCurrent(request)){versionFiles.loadingMore=false}}}async function selectVersionFile(file){var _a,_b,_c;const path=String((file==null?void 0:file.path)||"");selectedVersionPath.value=path;versionDiff.error="";versionDiff.payload=null;if(!path||!((_a=selectedVersion.value)==null?void 0:_a.commit)||!((_b=history.payload)==null?void 0:_b.historySnapshotCommit)){return}const request=beginRequest("versionDiff");const versionCommit=selectedVersion.value.commit;versionDiff.loading=true;try{const result=await requestJson(vibe64RepositoryVersionDiffPath(sessionsApiPath.value,selectedVersion.value.commit,path,{historySnapshotCommit:history.payload.historySnapshotCommit,sessionId:sessionId.value}));if(requestIsCurrent(request)&&((_c=selectedVersion.value)==null?void 0:_c.commit)===versionCommit&&selectedVersionPath.value===path){versionDiff.payload=result}}catch(error){if(requestIsCurrent(request)){versionDiff.error=message(error,"This file difference could not be loaded.")}}finally{if(requestIsCurrent(request)){versionDiff.loading=false}}}async function loadHistory({append=false}={}){if(!sessionId.value){history.error="";history.payload=null;history.versions=[];history.nextCursor="";return}const request=beginRequest("history");history.loading=true;try{const result=await requestJson(vibe64RepositoryHistoryPath(sessionsApiPath.value,{cursor:append?history.nextCursor:"",sessionId:sessionId.value}));if(!requestIsCurrent(request)){return}history.error="";history.payload=append&&history.payload?{...result,versions:[...history.versions,...result.versions||[]]}:result;history.versions=history.payload.versions||[];history.nextCursor=result.nextCursor||"";if(!append&&result.updateCheck&&updateCheckIsNewer(result.updateCheck,updates.payload)){updates.payload={...result.updateCheck,cached:true}}}catch(error){if(requestIsCurrent(request)){history.error=message(error,"Version history could not be loaded.")}}finally{if(requestIsCurrent(request)){history.loading=false}}}async function checkForUpdates({force=true}={}){if(!sessionId.value||updates.applying||sourceOperationsSuspended.value){return false}const contextKey=updateCheckContextKey();const active=updateChecks.get(contextKey);if(active){if(force&&active.force!==true){forcedUpdateFollowups.add(contextKey)}return active.promise}const request={...beginRequest("updates"),updateAccessRevision};updates.checking=true;updates.error="";updates.errorCode="";const promise=(async()=>{var _a;try{const result=await requestJson(vibe64SessionCheckUpdatesPath(sessionsApiPath.value,sessionId.value),{body:{force},method:"POST"}).finally(async()=>{while(updateRequestIsCurrent(request)&&(activeSaveHistoryRefresh==null?void 0:activeSaveHistoryRefresh.contextKey)===request.contextKey){await activeSaveHistoryRefresh.settled}});if(!updateRequestIsCurrent(request)){return false}updates.payload=result;updates.canonicalChangePending=false;if(activeView.value==="changes"){if(!changes.payload||String(changes.payload.canonicalCommit||"").trim()!==String(result.canonicalCommit||"").trim()){await requestChangesRefresh()}}else if(!history.payload||String(result.canonicalCommit||"").trim()!==String(((_a=history.payload)==null?void 0:_a.historySnapshotCommit)||"").trim()){await loadHistory()}return result}catch(error){if(updateRequestIsCurrent(request)){updates.error=message(error,"Updates could not be checked.");updates.errorCode=String((error==null?void 0:error.code)||"").trim();if(activeView.value==="changes"&&!changes.payload){await requestChangesRefresh()}}return false}finally{if(updateRequestIsCurrent(request)){updates.checking=false}const registered=updateChecks.get(contextKey);if((registered==null?void 0:registered.promise)===promise){updateChecks.delete(contextKey)}if(!disposed&&forcedUpdateFollowups.delete(contextKey)&&contextKey===updateCheckContextKey()){void checkForUpdates({force:true})}}})();updateChecks.set(contextKey,{force,promise});return promise}async function applyUpdates(){var _a;const requestUpdateWork=context.value.requestUpdateWork;if(!sessionId.value||sourceOperationsSuspended.value||updates.checking||updates.applying||!(updates.canonicalChangePending||((_a=updates.payload)==null?void 0:_a.updateAvailable)===true)||typeof requestUpdateWork!=="function"){return false}updates.applying=true;updates.error="";updates.errorCode="";const request=beginRequest("applyUpdates");try{const result=await requestUpdateWork();if(!requestIsCurrent(request)){return false}if(result===false||(result==null?void 0:result.ok)===false){throw new Error("This session could not be updated.")}updates.payload=result;updates.canonicalChangePending=false;if(activeView.value==="history"){await loadHistory()}else{await requestChangesRefresh()}return result}catch(error){if(requestIsCurrent(request)){updates.error=message(error,"This session could not be updated.");updates.errorCode=String((error==null?void 0:error.code)||"").trim()}return false}finally{if(requestIsCurrent(request)){updates.applying=false}}}async function saveWork(){var _a,_b;const requestSaveWork=context.value.requestSaveWork;if(!sessionId.value||context.value.assistantDirectAllowed===false||sourceOperationsSuspended.value||saving.value||updates.checking||updates.applying||updates.canonicalChangePending||updates.error||!updates.payload||((_a=updates.payload)==null?void 0:_a.updateAvailable)===true||changes.error||changes.loading||((_b=changes.payload)==null?void 0:_b.unsaved)!==true||typeof requestSaveWork!=="function"){return false}saving.value=true;try{return await requestSaveWork()}finally{saving.value=false}}watch([sessionsApiPath,sessionId,activeView],async([apiPath])=>{invalidateRequests();activeSaveHistoryRefresh==null?void 0:activeSaveHistoryRefresh.settle();activeSaveHistoryRefresh=null;changes.error="";changes.loading=false;changes.loadingMore=false;changes.payload=null;currentDiff.error="";currentDiff.loading=false;currentDiff.payload=null;history.error="";history.loading=false;history.nextCursor="";history.payload=null;history.versions=[];selectedCurrentPath.value="";selectedVersion.value=null;selectedVersionPath.value="";versionDiff.error="";versionDiff.loading=false;versionDiff.payload=null;versionFiles.error="";versionFiles.loading=false;versionFiles.loadingMore=false;versionFiles.payload=null;updates.applying=false;updates.checking=false;updates.error="";updates.errorCode="";updates.payload=null;updates.canonicalChangePending=false;if(apiPath&&sessionId.value){const initialContext=requestContextKey();if(activeView.value==="history"){await loadHistory();if(disposed||initialContext!==requestContextKey()){return}}else if(!sourceOperationsSuspended.value){await requestChangesRefresh();if(disposed||initialContext!==requestContextKey()){return}}if(!sourceOperationsSuspended.value){void checkForUpdates({force:false})}}},{immediate:true});watch(sourceOperationsSuspended,async(suspended,wasSuspended)=>{if(suspended){updateAccessRevision+=1;updates.checking=false;return}if(wasSuspended!==true){return}updateAccessRevision+=1;if(sessionId.value){const releasedContext=requestContextKey();if(activeView.value==="changes"){await requestChangesRefresh();if(disposed||releasedContext!==requestContextKey()||sourceOperationsSuspended.value){return}}void checkForUpdates({force:false})}},{flush:"sync",immediate:true});useRealtimeEvent({enabled:computed(()=>Boolean(sessionId.value)),event:VIBE64_SESSION_CHANGED_EVENT,matches:({payload={}}={})=>repositoryStatusSessionId(payload)===sessionId.value&&repositoryStatusRealtimeShouldRefresh(payload),onEvent:async({payload={}}={})=>{const reason=String((payload==null?void 0:payload.reason)||"").trim();const checkCanonical=repositoryStatusRealtimeNeedsCanonicalCheck(payload)||["session-repository-checked","session-save-completed","session-update-completed"].includes(reason);if(repositoryStatusRealtimeNeedsCanonicalCheck(payload)){updates.canonicalChangePending=true}if(activeView.value==="history"&&reason==="session-save-completed"){const refresh=beginRequest("saveHistory");refresh.settled=new Promise(resolve=>{refresh.settle=resolve});activeSaveHistoryRefresh==null?void 0:activeSaveHistoryRefresh.settle();activeSaveHistoryRefresh=refresh;try{await loadHistory()}finally{if(activeSaveHistoryRefresh===refresh){activeSaveHistoryRefresh=null}refresh.settle()}if(!requestIsCurrent(refresh)){return}}else if(activeView.value==="changes"&&!checkCanonical){void requestChangesRefresh()}if(checkCanonical){void checkForUpdates({force:repositoryStatusRealtimeNeedsCanonicalCheck(payload)})}}});onScopeDispose(()=>{disposed=true;invalidateRequests();activeChangesRefresh=null;activeSaveHistoryRefresh==null?void 0:activeSaveHistoryRefresh.settle();activeSaveHistoryRefresh=null;updateChecks.clear();forcedUpdateFollowups.clear()});useRealtimeEvent({enabled:computed(()=>Boolean(sessionId.value)&&activeView.value==="changes"),event:VIBE64_SOURCE_EDITOR_FILE_CHANGED_EVENT,matches:({payload={}}={})=>repositoryStatusSessionId(payload)===sessionId.value,onEvent:()=>{void requestChangesRefresh()}});return{applyUpdates,changes,checkForUpdates,currentDiff,history,loadChanges,loadHistory,loadMoreVersionFiles,saveWork,saving,selectCurrentFile,selectedCurrentPath,selectedVersion,selectedVersionPath,selectVersion,selectVersionFile,sessionId,sourceOperationsSuspended,updates,versionDiff,versionFiles}}const _hoisted_1={class:"vibe64-repository-workspace__header"};const _hoisted_2={class:"vibe64-repository-workspace__actions"};const _hoisted_3={class:"vibe64-repository-workspace__changes-area"};const _hoisted_4={key:0,"aria-label":"Saved versions this session needs",class:"vibe64-repository-workspace__incoming-versions"};const _hoisted_5={key:1};const _hoisted_6={class:"vibe64-repository-workspace__summary-copy"};const _hoisted_7={class:"vibe64-repository-workspace__actions"};const _hoisted_8={class:"vibe64-repository-workspace__window"};const _hoisted_9={key:0,class:"vibe64-repository-workspace__changes"};const _hoisted_10={key:0,class:"vibe64-repository-workspace__empty"};const _hoisted_11={key:4,class:"vibe64-repository-workspace__empty"};const _hoisted_12={key:1};const _hoisted_13={key:2,class:"vibe64-repository-workspace__history"};const _hoisted_14={class:"vibe64-repository-workspace__history-intro"};const _hoisted_15={class:"vibe64-repository-workspace__history-heading"};const _hoisted_16={"aria-hidden":"true",class:"vibe64-repository-workspace__history-icon"};const _hoisted_17={class:"vibe64-repository-workspace__versions","aria-label":"Saved versions"};const _hoisted_18=["aria-current","aria-label","onClick"];const _hoisted_19={class:"vibe64-repository-workspace__version-copy"};const _hoisted_20={class:"vibe64-repository-workspace__version-heading"};const _hoisted_21={class:"vibe64-repository-workspace__version-meta"};const _hoisted_22={key:0,class:"vibe64-repository-workspace__load-more"};const _hoisted_23={key:3,class:"vibe64-repository-workspace__empty"};const _hoisted_24={"aria-hidden":"true",class:"vibe64-repository-version-dialog__icon"};const _hoisted_25={class:"vibe64-repository-version-dialog__heading"};const _hoisted_26={class:"vibe64-repository-version-dialog__eyebrow"};const _hoisted_27={key:0,class:"vibe64-repository-version-dialog__meta"};const _sfc_main={__name:"Vibe64RepositoryWorkspace",props:{dashboardContext:{default:()=>({}),type:Object},view:{default:"changes",type:String,validator:value=>["changes","history"].includes(value)}},setup(__props){const props=__props;const dashboard=computed(()=>props.dashboardContext||{});const view=computed(()=>props.view==="history"?"history":"changes");const versionSheetOpen=ref(false);const{applyUpdates,changes,checkForUpdates,currentDiff,history,loadHistory,loadChanges,loadMoreVersionFiles,saveWork,saving,selectCurrentFile,selectedCurrentPath,selectedVersion,selectedVersionPath,selectVersion,selectVersionFile,sessionId,sourceOperationsSuspended,updates,versionDiff,versionFiles}=useVibe64RepositoryWorkspace(dashboard,{view});const versionFileCountLabel=computed(()=>{var _a;const count=Number(((_a=versionFiles.payload)==null?void 0:_a.totalCount)||0);return`${count} changed ${count===1?"file":"files"}`});const pageTitle=computed(()=>view.value==="history"?"Repository":"Current changes");const pageDescription=computed(()=>view.value==="history"?"Review saved versions and bring this session up to date.":"Review exactly what this session changes before saving it.");const repositoryStatus=computed(()=>updates.payload||changes.payload||null);const repositoryOperationBusy=computed(()=>Boolean(!sessionId.value||sourceOperationsSuspended.value||updates.checking||updates.applying||saving.value));const saveWorkDisabled=computed(()=>{var _a,_b;return Boolean(repositoryOperationBusy.value||dashboard.value.assistantDirectAllowed===false||updates.canonicalChangePending||updates.error||!updates.payload||((_a=repositoryStatus.value)==null?void 0:_a.updateAvailable)===true||changes.error||changes.loading||((_b=changes.payload)==null?void 0:_b.unsaved)!==true||typeof dashboard.value.requestSaveWork!=="function")});const saveWorkTitle=computed(()=>{var _a,_b;if(dashboard.value.assistantDirectAllowed===false){return dashboard.value.assistantRestrictionMessage}if(sourceOperationsSuspended.value){return"Session renewal is safely using this session’s source"}if(updates.applying||saving.value){return"Wait for the current repository operation to finish"}if(updates.checking||updates.canonicalChangePending){return"Checking the latest saved project version"}if(updates.error||!updates.payload||changes.error){return"Repository status is unavailable; check for updates before saving"}if(((_a=repositoryStatus.value)==null?void 0:_a.updateAvailable)===true){return"Update this session (rebase) before saving"}if(changes.loading){return"Checking whether this session has work to save"}if(((_b=changes.payload)==null?void 0:_b.unsaved)!==true){return"No work to save"}return"Save this session's work to the project repository"});const repositorySummaryTitle=computed(()=>{var _a;if(!sessionId.value){return"Project versions"}if(changes.loading){return"Checking this session…"}if(updates.checking||updates.canonicalChangePending){return"Checking the latest saved project version…"}if(updates.error||!updates.payload){return"Saved project status unavailable"}if(changes.error||!changes.payload){return"Save status unavailable"}return((_a=changes.payload)==null?void 0:_a.unsaved)?"This session has unsaved work":"This session is saved"});const repositorySummaryDetail=computed(()=>{var _a,_b,_c;if(!sessionId.value){return"Select a session to see its work. Saved project history remains available."}if(changes.loading){return"Comparing this session with the project’s saved version."}if(updates.checking||updates.canonicalChangePending){return"Save will be available after the latest project version has been checked."}if(updates.error||!updates.payload){return"Save is unavailable until Vibe64 can safely compare this session with the saved project."}if(changes.error||!changes.payload){return"Check for updates to compare this session with the project’s saved version."}const count=Number(((_a=changes.payload)==null?void 0:_a.totalCount)||0);const behind=Number(((_b=repositoryStatus.value)==null?void 0:_b.behind)||0);if(behind>0){if(((_c=changes.payload)==null?void 0:_c.unsaved)===true){return`${behind} newer saved ${behind===1?"version is":"versions are"} available. Update this session (rebase) will preserve its unsaved work.`}return`${behind} newer saved ${behind===1?"version is":"versions are"} available. Update this session (rebase) to use ${behind===1?"it":"them"}.`}if(count>0){return`${count} ${count===1?"file differs":"files differ"} from the project’s saved version.`}return"No files differ from the project’s saved version."});const repositoryUpdateTitle=computed(()=>{if(!sessionId.value){return"No session selected"}if(updates.checking){return"Checking for updates…"}if(updates.error){return"Update status unavailable"}if(history.loading&&!history.payload){return"Loading update status…"}if(!repositoryStatus.value){return"Updates have not been checked"}const relationship=repositoryUpdateRelationship(repositoryStatus.value.ahead,repositoryStatus.value.behind);const ahead=Number(repositoryStatus.value.ahead||0);const behind=Number(repositoryStatus.value.behind||0);if(relationship==="diverged"){return"This session and the saved project have both changed"}if(behind>0){return`${behind} ${behind===1?"update":"updates"} available`}if(relationship==="ahead"&&ahead>0){return"This session has work not in the saved project"}return"This session is up to date"});const repositoryIncomingVersions=computed(()=>{var _a,_b,_c;const relationship=repositoryUpdateRelationship((_a=repositoryStatus.value)==null?void 0:_a.ahead,(_b=repositoryStatus.value)==null?void 0:_b.behind);return relationship==="behind"&&Array.isArray((_c=repositoryStatus.value)==null?void 0:_c.incomingVersions)?repositoryStatus.value.incomingVersions:[]});const repositoryIncomingVersionsRemainder=computed(()=>{var _a;return Math.max(0,Number(((_a=repositoryStatus.value)==null?void 0:_a.behind)||0)-repositoryIncomingVersions.value.length)});const repositoryUpdateDetail=computed(()=>{var _a;if(!sessionId.value){return"Select a session to check it against the project’s saved version."}if(updates.checking){return"Reading the latest saved project version."}if(updates.error){return"Review the problem below, then try checking again."}if(history.loading&&!history.payload){return"Reading the last successful update check for this session."}if(!repositoryStatus.value){return"Use Check for updates to compare this session with the latest saved project version."}const relationship=repositoryUpdateRelationship(repositoryStatus.value.ahead,repositoryStatus.value.behind);const ahead=Number(repositoryStatus.value.ahead||0);const behind=Number(repositoryStatus.value.behind||0);const checked=repositoryStatus.value.checkedAt?` Last checked ${formatVersionDate(repositoryStatus.value.checkedAt)}.`:"";if(relationship==="diverged"){return`Someone saved new project work after this session started, and this session also has its own saved work. Vibe64 cannot simply move it forward. Update this session (rebase) will try to combine both without discarding either. If the same files conflict, nothing changes and Temporary AI can help.${checked}`}if(behind>0){const updateEffect=((_a=changes.payload)==null?void 0:_a.unsaved)===true?"will replay its unsaved work on the latest saved version before Save is allowed":"will move it to the latest saved version";return`This session is ${behind} saved ${behind===1?"version":"versions"} behind. Update this session (rebase) ${updateEffect}.${checked}`}if(relationship==="ahead"&&ahead>0){return`There are no incoming updates. This session contains ${ahead} ${ahead===1?"version":"versions"} not yet in the saved project.${checked}`}return`It already includes the latest saved project version.${checked}`});const canResolveUpdateWithTemporaryAi=computed(()=>["vibe64_session_update_conflict","vibe64_session_update_history_diverged"].includes(String(updates.errorCode||"").trim()));const resolvingUpdateProblem=ref(false);function formatVersionDate(value=""){const parsed=new Date(value);return Number.isNaN(parsed.getTime())?"Unknown time":new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"short"}).format(parsed)}function versionButtonLabel(version={},index=-1){const parts=[index===0?"Latest saved version":"Saved version",version.message||"Saved work",version.author||"Unknown author",formatVersionDate(version.committedAt),version.shortCommit];if(version.isMerge){parts.splice(1,0,"merge")}return parts.filter(Boolean).join(", ")}async function resolveUpdateProblem(){if(resolvingUpdateProblem.value||dashboard.value.assistantDirectAllowed===false||typeof dashboard.value.requestTemporaryAi!=="function"){return false}resolvingUpdateProblem.value=true;try{return await dashboard.value.requestTemporaryAi({code:updates.errorCode,error:updates.error,title:"Resolve repository update"})}finally{resolvingUpdateProblem.value=false}}async function openVersion(version){versionSheetOpen.value=true;await selectVersion(version)}function closeVersion(){versionSheetOpen.value=false;void selectVersion(null)}return(_ctx,_cache)=>{var _a,_b,_c;return openBlock(),createElementBlock("section",{class:normalizeClass(["vibe64-repository-workspace",{"vibe64-repository-workspace--changes":view.value==="changes"}])},[createBaseVNode("header",_hoisted_1,[createBaseVNode("div",null,[createBaseVNode("h1",null,toDisplayString(pageTitle.value),1),createBaseVNode("p",null,toDisplayString(pageDescription.value),1)]),createBaseVNode("div",_hoisted_2,[createVNode(VBtn,{disabled:repositoryOperationBusy.value,loading:unref(updates).checking,"prepend-icon":unref(mdiCloudRefreshOutline),size:"small",type:"button",variant:"tonal",onClick:unref(checkForUpdates)},{default:withCtx(()=>[..._cache[5]||(_cache[5]=[createTextVNode(" Check for updates ",-1)])]),_:1},8,["disabled","loading","prepend-icon","onClick"]),view.value==="history"&&(((_a=repositoryStatus.value)==null?void 0:_a.updateAvailable)||unref(updates).canonicalChangePending)?(openBlock(),createBlock(VBtn,{key:0,disabled:repositoryOperationBusy.value,loading:unref(updates).applying,"prepend-icon":unref(mdiSourcePull),size:"small",type:"button",variant:"tonal",onClick:unref(applyUpdates)},{default:withCtx(()=>[..._cache[6]||(_cache[6]=[createTextVNode(" Update this session (rebase) ",-1)])]),_:1},8,["disabled","loading","prepend-icon","onClick"])):createCommentVNode("",true)])]),createBaseVNode("section",_hoisted_3,[view.value==="history"?(openBlock(),createBlock(VSheet,{key:0,"aria-live":"polite",border:"",class:"vibe64-repository-workspace__update-status",role:"status",rounded:"lg"},{default:withCtx(()=>[createBaseVNode("strong",null,toDisplayString(repositoryUpdateTitle.value),1),createBaseVNode("span",null,toDisplayString(repositoryUpdateDetail.value),1),repositoryIncomingVersions.value.length?(openBlock(),createElementBlock("ol",_hoisted_4,[(openBlock(true),createElementBlock(Fragment,null,renderList(repositoryIncomingVersions.value,version=>{return openBlock(),createElementBlock("li",{key:version.commit},[createVNode(VIcon,{"aria-hidden":"true",icon:version.isMerge?unref(mdiSourceMerge):unref(mdiSourceCommit),size:"15"},null,8,["icon"]),createBaseVNode("span",null,toDisplayString(version.message||"Saved work"),1),createBaseVNode("code",null,toDisplayString(version.shortCommit),1)])}),128))])):createCommentVNode("",true),repositoryIncomingVersions.value.length&&repositoryIncomingVersionsRemainder.value>0?(openBlock(),createElementBlock("span",_hoisted_5," And "+toDisplayString(repositoryIncomingVersionsRemainder.value)+" older "+toDisplayString(repositoryIncomingVersionsRemainder.value===1?"update":"updates")+". ",1)):createCommentVNode("",true)]),_:1})):createCommentVNode("",true),view.value==="changes"?(openBlock(),createBlock(VSheet,{key:1,border:"",class:"vibe64-repository-workspace__summary",rounded:"lg"},{default:withCtx(()=>{var _a2,_b2;return[createBaseVNode("div",_hoisted_6,[createBaseVNode("strong",null,toDisplayString(repositorySummaryTitle.value),1),createBaseVNode("span",null,toDisplayString(repositorySummaryDetail.value),1)]),createBaseVNode("div",_hoisted_7,[((_a2=repositoryStatus.value)==null?void 0:_a2.updateAvailable)||unref(updates).canonicalChangePending?(openBlock(),createBlock(VBtn,{key:0,disabled:repositoryOperationBusy.value,loading:unref(updates).applying,"prepend-icon":unref(mdiSourcePull),size:"small",type:"button",variant:"tonal",onClick:unref(applyUpdates)},{default:withCtx(()=>[..._cache[7]||(_cache[7]=[createTextVNode(" Update this session (rebase) ",-1)])]),_:1},8,["disabled","loading","prepend-icon","onClick"])):createCommentVNode("",true),createVNode(VBtn,{color:((_b2=unref(changes).payload)==null?void 0:_b2.unsaved)===true?"error":void 0,disabled:saveWorkDisabled.value,loading:unref(saving),"prepend-icon":unref(mdiContentSaveOutline),size:"small",type:"button",title:saveWorkTitle.value,variant:"tonal",onClick:unref(saveWork)},{default:withCtx(()=>[..._cache[8]||(_cache[8]=[createTextVNode(" Save work ",-1)])]),_:1},8,["color","disabled","loading","prepend-icon","title","onClick"])])]}),_:1})):createCommentVNode("",true),unref(updates).error?(openBlock(),createBlock(StudioErrorNotice,{key:2,compact:"",error:unref(updates).error,title:"Project updates need attention"},{actions:withCtx(()=>[canResolveUpdateWithTemporaryAi.value&&typeof dashboard.value.requestTemporaryAi==="function"?(openBlock(),createBlock(Vibe64TemporaryAiFixAction,{key:0,disabled:resolvingUpdateProblem.value||dashboard.value.assistantDirectAllowed===false,pending:resolvingUpdateProblem.value,title:dashboard.value.assistantDirectAllowed===false?dashboard.value.assistantRestrictionMessage:"Open temporary AI to resolve this repository update",onClick:resolveUpdateProblem},null,8,["disabled","pending","title"])):createCommentVNode("",true)]),_:1},8,["error"])):createCommentVNode("",true),createBaseVNode("div",_hoisted_8,[view.value==="changes"?(openBlock(),createElementBlock("section",_hoisted_9,[!unref(sessionId)?(openBlock(),createElementBlock("div",_hoisted_10,[..._cache[9]||(_cache[9]=[createBaseVNode("strong",null,"No session selected",-1),createBaseVNode("span",null,"Create or select a session to see its current changes.",-1)])])):unref(changes).error?(openBlock(),createBlock(StudioErrorNotice,{key:1,compact:"",error:unref(changes).error,title:"Current changes could not load"},null,8,["error"])):unref(changes).loading?(openBlock(),createBlock(VProgressLinear,{key:2,color:"primary",indeterminate:""})):((_c=(_b=unref(changes).payload)==null?void 0:_b.files)==null?void 0:_c.length)?(openBlock(),createBlock(Vibe64RepositoryFileBrowser,{key:3,"aria-label":"Changed files","empty-title":"File changes",error:unref(currentDiff).error,files:unref(changes).payload.files,"list-description":"Compared with the project’s saved version","list-title":`${unref(changes).payload.totalCount} changed ${unref(changes).payload.totalCount===1?"file":"files"}`,loading:unref(currentDiff).loading,"loading-more":unref(changes).loadingMore,payload:unref(currentDiff).payload,"selected-path":unref(selectedCurrentPath),truncated:unref(changes).payload.truncated,onLoadMore:_cache[0]||(_cache[0]=$event=>unref(loadChanges)({append:true})),onSelect:unref(selectCurrentFile)},null,8,["error","files","list-title","loading","loading-more","payload","selected-path","truncated","onSelect"])):(openBlock(),createElementBlock("div",_hoisted_11,[..._cache[10]||(_cache[10]=[createBaseVNode("strong",null,"No unsaved file changes",-1),createBaseVNode("span",null,"This session has no file changes waiting to be saved.",-1)])]))])):(openBlock(),createElementBlock("section",_hoisted_12,[unref(history).error?(openBlock(),createBlock(StudioErrorNotice,{key:0,compact:"",error:unref(history).error,title:"Version history could not load"},createSlots({_:2},[!unref(history).payload?{name:"actions",fn:withCtx(()=>[createVNode(VBtn,{"aria-busy":unref(history).loading?"true":void 0,disabled:unref(history).loading,size:"small",type:"button",variant:"tonal",onClick:_cache[1]||(_cache[1]=$event=>unref(loadHistory)())},{default:withCtx(()=>[createTextVNode(toDisplayString(unref(history).loading?"Retrying…":"Retry history"),1)]),_:1},8,["aria-busy","disabled"])]),key:"0"}:void 0]),1032,["error"])):createCommentVNode("",true),unref(history).loading&&!unref(history).payload&&!unref(history).error?(openBlock(),createBlock(VProgressLinear,{key:1,color:"primary",indeterminate:""})):unref(history).versions.length?(openBlock(),createElementBlock("div",_hoisted_13,[createBaseVNode("div",_hoisted_14,[createBaseVNode("div",_hoisted_15,[createBaseVNode("span",_hoisted_16,[createVNode(VIcon,{icon:unref(mdiSourceCommit),size:"18"},null,8,["icon"])]),_cache[11]||(_cache[11]=createBaseVNode("div",null,[createBaseVNode("strong",null,"Saved versions"),createBaseVNode("span",null,"Newest first. Open a version to review its files.")],-1))]),createVNode(VChip,{label:"",size:"x-small",variant:"tonal"},{default:withCtx(()=>[createTextVNode(toDisplayString(unref(history).versions.length)+" loaded ",1)]),_:1})]),createBaseVNode("ol",_hoisted_17,[(openBlock(true),createElementBlock(Fragment,null,renderList(unref(history).versions,(version,index)=>{var _a2;return openBlock(),createElementBlock("li",{key:version.commit,class:"vibe64-repository-workspace__history-item"},[createBaseVNode("span",{"aria-hidden":"true",class:normalizeClass(["vibe64-repository-workspace__commit-marker",{"vibe64-repository-workspace__commit-marker--first":index===0,"vibe64-repository-workspace__commit-marker--last":index===unref(history).versions.length-1}])},[createBaseVNode("span",{class:normalizeClass(["vibe64-repository-workspace__commit-node",{"vibe64-repository-workspace__commit-node--latest":index===0}])},[createVNode(VIcon,{icon:version.isMerge?unref(mdiSourceMerge):unref(mdiSourceCommit),size:"15"},null,8,["icon"])],2)],2),createBaseVNode("button",{"aria-current":versionSheetOpen.value&&((_a2=unref(selectedVersion))==null?void 0:_a2.commit)===version.commit?"true":void 0,"aria-label":versionButtonLabel(version,index),class:"vibe64-repository-workspace__version",type:"button",onClick:$event=>openVersion(version)},[createBaseVNode("span",_hoisted_19,[createBaseVNode("span",_hoisted_20,[createBaseVNode("strong",null,toDisplayString(version.message||"Saved work"),1),index===0?(openBlock(),createBlock(VChip,{key:0,color:"primary",label:"",size:"x-small",variant:"tonal"},{default:withCtx(()=>[..._cache[12]||(_cache[12]=[createTextVNode(" Latest ",-1)])]),_:1})):createCommentVNode("",true),version.isMerge?(openBlock(),createBlock(VChip,{key:1,label:"",size:"x-small",variant:"outlined"},{default:withCtx(()=>[..._cache[13]||(_cache[13]=[createTextVNode(" Merge ",-1)])]),_:1})):createCommentVNode("",true)]),createBaseVNode("span",_hoisted_21,[createBaseVNode("span",null,[createVNode(VIcon,{icon:unref(mdiAccountOutline),size:"15"},null,8,["icon"]),createTextVNode(" "+toDisplayString(version.author||"Unknown author"),1)]),createBaseVNode("span",null,[createVNode(VIcon,{icon:unref(mdiClockOutline),size:"15"},null,8,["icon"]),createTextVNode(" "+toDisplayString(formatVersionDate(version.committedAt)),1)]),createBaseVNode("code",null,toDisplayString(version.shortCommit),1)])]),createVNode(VIcon,{"aria-hidden":"true",icon:unref(mdiChevronRight),size:"20"},null,8,["icon"])],8,_hoisted_18)])}),128)),unref(history).nextCursor?(openBlock(),createElementBlock("li",_hoisted_22,[createVNode(VBtn,{loading:unref(history).loading,size:"small",type:"button",variant:"text",onClick:_cache[2]||(_cache[2]=$event=>unref(loadHistory)({append:true}))},{default:withCtx(()=>[..._cache[14]||(_cache[14]=[createTextVNode(" Load older versions ",-1)])]),_:1},8,["loading"])])):createCommentVNode("",true)])])):!unref(history).error?(openBlock(),createElementBlock("div",_hoisted_23,[..._cache[15]||(_cache[15]=[createBaseVNode("strong",null,"No saved versions yet",-1),createBaseVNode("span",null,"Versions will appear here after work is saved.",-1)])])):createCommentVNode("",true)]))])]),createVNode(VDialog,{"model-value":versionSheetOpen.value,class:"vibe64-repository-version-dialog",fullscreen:"",scrollable:"",transition:"dialog-bottom-transition","onUpdate:modelValue":_cache[4]||(_cache[4]=$event=>!$event&&closeVersion())},{default:withCtx(()=>[createVNode(VCard,{class:"vibe64-repository-version-dialog__card"},{default:withCtx(()=>[createVNode(VCardTitle,{class:"vibe64-repository-version-dialog__header"},{default:withCtx(()=>{var _a2,_b2,_c2;return[createBaseVNode("span",_hoisted_24,[createVNode(VIcon,{icon:((_a2=unref(selectedVersion))==null?void 0:_a2.isMerge)?unref(mdiSourceMerge):unref(mdiSourceCommit),size:"22"},null,8,["icon"])]),createBaseVNode("div",_hoisted_25,[createBaseVNode("span",_hoisted_26,toDisplayString(((_b2=unref(selectedVersion))==null?void 0:_b2.isMerge)?"Merge version":"Saved version"),1),createBaseVNode("h2",null,toDisplayString(((_c2=unref(selectedVersion))==null?void 0:_c2.message)||"Saved version"),1),unref(selectedVersion)?(openBlock(),createElementBlock("div",_hoisted_27,[createBaseVNode("span",null,[createVNode(VIcon,{icon:unref(mdiAccountOutline),size:"16"},null,8,["icon"]),createTextVNode(" "+toDisplayString(unref(selectedVersion).author||"Unknown author"),1)]),createBaseVNode("span",null,[createVNode(VIcon,{icon:unref(mdiClockOutline),size:"16"},null,8,["icon"]),createTextVNode(" "+toDisplayString(formatVersionDate(unref(selectedVersion).committedAt)),1)]),createBaseVNode("code",null,toDisplayString(unref(selectedVersion).shortCommit),1),unref(versionFiles).payload?(openBlock(),createBlock(VChip,{key:0,label:"",size:"x-small",variant:"tonal"},{default:withCtx(()=>[createTextVNode(toDisplayString(versionFileCountLabel.value),1)]),_:1})):createCommentVNode("",true)])):createCommentVNode("",true)]),createVNode(VBtn,{"aria-label":"Close version details",icon:unref(mdiClose),size:"small",type:"button",variant:"text",onClick:closeVersion},null,8,["icon"])]}),_:1}),createVNode(VDivider),createVNode(VCardText,{class:"vibe64-repository-version-dialog__body"},{default:withCtx(()=>{var _a2,_b2;return[unref(versionFiles).error?(openBlock(),createBlock(StudioErrorNotice,{key:0,class:"vibe64-repository-version-dialog__error",compact:"",error:unref(versionFiles).error,title:"Version details could not load"},createSlots({_:2},[!unref(versionFiles).payload?{name:"actions",fn:withCtx(()=>[createVNode(VBtn,{"aria-busy":unref(versionFiles).loading?"true":void 0,disabled:unref(versionFiles).loading,size:"small",type:"button",variant:"tonal",onClick:_cache[3]||(_cache[3]=$event=>unref(selectVersion)(unref(selectedVersion)))},{default:withCtx(()=>[createTextVNode(toDisplayString(unref(versionFiles).loading?"Retrying…":"Retry files"),1)]),_:1},8,["aria-busy","disabled"])]),key:"0"}:void 0]),1032,["error"])):createCommentVNode("",true),unref(versionFiles).loading&&!unref(versionFiles).payload&&!unref(versionFiles).error?(openBlock(),createBlock(VProgressLinear,{key:1,color:"primary",indeterminate:""})):createCommentVNode("",true),unref(versionFiles).payload?(openBlock(),createBlock(Vibe64RepositoryFileBrowser,{key:2,"aria-label":"Files in this version",class:"vibe64-repository-version-dialog__files",embedded:"",error:unref(versionDiff).error,files:((_a2=unref(versionFiles).payload)==null?void 0:_a2.files)||[],loading:unref(versionDiff).loading,"loading-more":unref(versionFiles).loadingMore,payload:unref(versionDiff).payload,"selected-path":unref(selectedVersionPath),truncated:((_b2=unref(versionFiles).payload)==null?void 0:_b2.truncated)===true,onLoadMore:unref(loadMoreVersionFiles),onSelect:unref(selectVersionFile)},null,8,["error","files","loading","loading-more","payload","selected-path","truncated","onLoadMore","onSelect"])):createCommentVNode("",true)]}),_:1})]),_:1})]),_:1},8,["model-value"])],2)}}};const Vibe64RepositoryWorkspace=_export_sfc(_sfc_main,[["__scopeId","data-v-cc50b59a"]]);export{Vibe64RepositoryWorkspace as V};
1
+ import{_ as _export_sfc,a as openBlock,c as createElementBlock,b as createBlock,r as createCommentVNode,bs as StudioErrorNotice,w as withCtx,j as createTextVNode,t as toDisplayString,I as VAlert,A as computed,bu as VProgressLinear,d as createBaseVNode,F as Fragment,y as renderList,$ as normalizeClass,n as VBtn,e as createVNode,H as watch,M as useRealtimeEvent,ag as onScopeDispose,bz as reactive,B as ref,L as getHttpWebClient,i as unref,dt as mdiCloudRefreshOutline,aZ as mdiSourcePull,h as VIcon,du as mdiSourceMerge,db as mdiSourceCommit,S as VSheet,a_ as mdiContentSaveOutline,al as createSlots,ai as VChip,V as VCard,g as VCardTitle,bR as mdiAccountOutline,W as mdiClockOutline,ab as mdiClose,br as VDivider,k as VCardText,p as VDialog,bF as mdiChevronRight}from"./index-C4KnwA0g.js";import{r as repositoryStatusSessionId,a as repositoryStatusRealtimeShouldRefresh,b as repositoryStatusRealtimeNeedsCanonicalCheck,V as Vibe64TemporaryAiFixAction}from"./vibe64RepositoryRealtime-C2WPn5do.js";import{D as Diff}from"./base-DDNBxAg7.js";import{a as vibe64ApiResponseError}from"./vibe64ApiResponses-COQ3JIKv.js";import{V as VIBE64_SESSION_CHANGED_EVENT,u as VIBE64_SOURCE_EDITOR_FILE_CHANGED_EVENT,R as vibe64RepositoryHistoryPath,w as vibe64SessionCheckUpdatesPath,S as vibe64RepositoryVersionDiffPath,T as vibe64RepositoryVersionFilesPath,U as vibe64SessionChangeDiffPath,W as vibe64SessionChangesPath}from"./vibe64SessionRequestConfig-uGWcyQY6.js";import{r as readRefOrGetterValue}from"./vueRefOrGetterValue-CV9c3oBd.js";function nonnegativeInteger(value){const number=Number(value);return Number.isSafeInteger(number)&&number>=0?number:0}function repositoryUpdateRelationship(aheadValue=0,behindValue=0){const ahead=nonnegativeInteger(aheadValue);const behind=nonnegativeInteger(behindValue);if(ahead>0&&behind>0){return"diverged"}if(behind>0){return"behind"}if(ahead>0){return"ahead"}return"current"}class CharacterDiff extends Diff{}const characterDiff=new CharacterDiff;function diffChars(oldStr,newStr,options){return characterDiff.diff(oldStr,newStr,options)}const extendedWordChars="a-zA-Z0-9_\\u{AD}\\u{C0}-\\u{D6}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}";class WordsWithSpaceDiff extends Diff{tokenize(value){const regex2=new RegExp(`(\\r?\\n)|[${extendedWordChars}]+|[^\\S\\n\\r]+|[^${extendedWordChars}]`,"ug");return value.match(regex2)||[]}}const wordsWithSpaceDiff=new WordsWithSpaceDiff;function diffWordsWithSpace(oldStr,newStr,options){return wordsWithSpaceDiff.diff(oldStr,newStr,options)}var LineType;(function(LineType2){LineType2["INSERT"]="insert";LineType2["DELETE"]="delete";LineType2["CONTEXT"]="context"})(LineType||(LineType={}));const OutputFormatType={LINE_BY_LINE:"line-by-line"};const LineMatchingType={NONE:"none"};const DiffStyleType={WORD:"word"};var ColorSchemeType;(function(ColorSchemeType2){ColorSchemeType2["AUTO"]="auto";ColorSchemeType2["DARK"]="dark";ColorSchemeType2["LIGHT"]="light"})(ColorSchemeType||(ColorSchemeType={}));const specials=["-","[","]","/","{","}","(",")","*","+","?",".","\\","^","$","|"];const regex=RegExp("["+specials.join("\\")+"]","g");function escapeForRegExp(str){return str.replace(regex,"\\$&")}function unifyPath(path){return path?path.replace(/\\/g,"/"):path}function hashCode(text){let i,chr,len;let hash=0;for(i=0,len=text.length;i<len;i++){chr=text.charCodeAt(i);hash=(hash<<5)-hash+chr;hash|=0}return hash}function max(arr){const length=arr.length;let max2=-Infinity;for(let i=0;i<length;i++){max2=Math.max(max2,arr[i])}return max2}function getExtension(filename,language){const filenameParts=filename.split(".");return filenameParts.length>1?filenameParts[filenameParts.length-1]:language}function startsWithAny(str,prefixes){return prefixes.reduce((startsWith,prefix)=>startsWith||str.startsWith(prefix),false)}const baseDiffFilenamePrefixes=["a/","b/","i/","w/","c/","o/"];function getFilename(line,linePrefix,extraPrefix){const prefixes=extraPrefix!==void 0?[...baseDiffFilenamePrefixes,extraPrefix]:baseDiffFilenamePrefixes;const FilenameRegExp=linePrefix?new RegExp(`^${escapeForRegExp(linePrefix)} "?(.+?)"?$`):new RegExp('^"?(.+?)"?$');const[,filename=""]=FilenameRegExp.exec(line)||[];const matchingPrefix=prefixes.find(p=>filename.indexOf(p)===0);const fnameWithoutPrefix=matchingPrefix?filename.slice(matchingPrefix.length):filename;return fnameWithoutPrefix.replace(/\s+\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}(?:\.\d+)? [+-]\d{4}.*$/,"")}function getSrcFilename(line,srcPrefix){return getFilename(line,"---",srcPrefix)}function getDstFilename(line,dstPrefix){return getFilename(line,"+++",dstPrefix)}function parse(diffInput,config={}){const files=[];let currentFile=null;let currentBlock=null;let oldLine=null;let oldLine2=null;let newLine=null;let possibleOldName=null;let possibleNewName=null;const oldFileNameHeader="--- ";const newFileNameHeader="+++ ";const hunkHeaderPrefix="@@";const oldMode=/^old mode (\d{6})/;const newMode=/^new mode (\d{6})/;const deletedFileMode=/^deleted file mode (\d{6})/;const newFileMode=/^new file mode (\d{6})/;const copyFrom=/^copy from "?(.+)"?/;const copyTo=/^copy to "?(.+)"?/;const renameFrom=/^rename from "?(.+)"?/;const renameTo=/^rename to "?(.+)"?/;const similarityIndex=/^similarity index (\d+)%/;const dissimilarityIndex=/^dissimilarity index (\d+)%/;const index=/^index ([\da-z]+)\.\.([\da-z]+)\s*(\d{6})?/;const binaryFiles=/^Binary files (.*) and (.*) differ/;const binaryDiff=/^GIT binary patch/;const combinedIndex=/^index ([\da-z]+),([\da-z]+)\.\.([\da-z]+)/;const combinedMode=/^mode (\d{6}),(\d{6})\.\.(\d{6})/;const combinedNewFile=/^new file mode (\d{6})/;const combinedDeletedFile=/^deleted file mode (\d{6}),(\d{6})/;const diffLines=diffInput.replace(/\/g,"").replace(/\r\n?/g,"\n").split("\n");function saveBlock(){if(currentBlock!==null&&currentFile!==null){currentFile.blocks.push(currentBlock);currentBlock=null}}function saveFile(){if(currentFile!==null){if(!currentFile.oldName&&possibleOldName!==null){currentFile.oldName=possibleOldName}if(!currentFile.newName&&possibleNewName!==null){currentFile.newName=possibleNewName}if(currentFile.newName){files.push(currentFile);currentFile=null}}possibleOldName=null;possibleNewName=null}function startFile(){saveBlock();saveFile();currentFile={blocks:[],deletedLines:0,addedLines:0}}function startBlock(line){saveBlock();let values;if(currentFile!==null){if(values=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@.*/.exec(line)){currentFile.isCombined=false;oldLine=parseInt(values[1],10);newLine=parseInt(values[2],10)}else if(values=/^@@@ -(\d+)(?:,\d+)? -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@@.*/.exec(line)){currentFile.isCombined=true;oldLine=parseInt(values[1],10);oldLine2=parseInt(values[2],10);newLine=parseInt(values[3],10)}else{if(line.startsWith(hunkHeaderPrefix)){console.error("Failed to parse lines, starting in 0!")}oldLine=0;newLine=0;currentFile.isCombined=false}}currentBlock={lines:[],oldStartLine:oldLine,oldStartLine2:oldLine2,newStartLine:newLine,header:line}}function createLine(line){if(currentFile===null||currentBlock===null||oldLine===null||newLine===null)return;const currentLine={content:line};const addedPrefixes=currentFile.isCombined?["+ "," +","++"]:["+"];const deletedPrefixes=currentFile.isCombined?["- "," -","--"]:["-"];if(startsWithAny(line,addedPrefixes)){currentFile.addedLines++;currentLine.type=LineType.INSERT;currentLine.oldNumber=void 0;currentLine.newNumber=newLine++}else if(startsWithAny(line,deletedPrefixes)){currentFile.deletedLines++;currentLine.type=LineType.DELETE;currentLine.oldNumber=oldLine++;currentLine.newNumber=void 0}else{currentLine.type=LineType.CONTEXT;currentLine.oldNumber=oldLine++;currentLine.newNumber=newLine++}currentBlock.lines.push(currentLine)}function existHunkHeader(line,lineIdx){let idx=lineIdx;while(idx<diffLines.length-3){if(line.startsWith("diff")){return false}if(diffLines[idx].startsWith(oldFileNameHeader)&&diffLines[idx+1].startsWith(newFileNameHeader)&&diffLines[idx+2].startsWith(hunkHeaderPrefix)){return true}idx++}return false}diffLines.forEach((line,lineIndex)=>{if(!line||line.startsWith("*")){return}let values;const prevLine=diffLines[lineIndex-1];const nxtLine=diffLines[lineIndex+1];const afterNxtLine=diffLines[lineIndex+2];if(line.startsWith("diff --git")||line.startsWith("diff --combined")){startFile();const gitDiffStart=/^diff --git "?([a-ciow]\/.+)"? "?([a-ciow]\/.+)"?/;if(values=gitDiffStart.exec(line)){possibleOldName=getFilename(values[1],void 0,config.dstPrefix);possibleNewName=getFilename(values[2],void 0,config.srcPrefix)}if(currentFile===null){throw new Error("Where is my file !!!")}currentFile.isGitDiff=true;return}if(line.startsWith("Binary files")&&!(currentFile===null||currentFile===void 0?void 0:currentFile.isGitDiff)){startFile();const unixDiffBinaryStart=/^Binary files "?([a-ciow]\/.+)"? and "?([a-ciow]\/.+)"? differ/;if(values=unixDiffBinaryStart.exec(line)){possibleOldName=getFilename(values[1],void 0,config.dstPrefix);possibleNewName=getFilename(values[2],void 0,config.srcPrefix)}if(currentFile===null){throw new Error("Where is my file !!!")}currentFile.isBinary=true;return}if(!currentFile||!currentFile.isGitDiff&&currentFile&&line.startsWith(oldFileNameHeader)&&nxtLine.startsWith(newFileNameHeader)&&afterNxtLine.startsWith(hunkHeaderPrefix)){startFile()}if(currentFile===null||currentFile===void 0?void 0:currentFile.isTooBig){return}if(currentFile&&(typeof config.diffMaxChanges==="number"&&currentFile.addedLines+currentFile.deletedLines>config.diffMaxChanges||typeof config.diffMaxLineLength==="number"&&line.length>config.diffMaxLineLength)){currentFile.isTooBig=true;currentFile.addedLines=0;currentFile.deletedLines=0;currentFile.blocks=[];currentBlock=null;const message2=typeof config.diffTooBigMessage==="function"?config.diffTooBigMessage(files.length):"Diff too big to be displayed";startBlock(message2);return}if(line.startsWith(oldFileNameHeader)&&nxtLine.startsWith(newFileNameHeader)||line.startsWith(newFileNameHeader)&&prevLine.startsWith(oldFileNameHeader)){if(currentFile&&!currentFile.oldName&&line.startsWith("--- ")&&(values=getSrcFilename(line,config.srcPrefix))){currentFile.oldName=values;currentFile.language=getExtension(currentFile.oldName,currentFile.language);return}if(currentFile&&!currentFile.newName&&line.startsWith("+++ ")&&(values=getDstFilename(line,config.dstPrefix))){currentFile.newName=values;currentFile.language=getExtension(currentFile.newName,currentFile.language);return}}if(currentFile&&(line.startsWith(hunkHeaderPrefix)||currentFile.isGitDiff&&currentFile.oldName&&currentFile.newName&&!currentBlock)){startBlock(line);return}if(currentBlock&&(line.startsWith("+")||line.startsWith("-")||line.startsWith(" "))){createLine(line);return}const doesNotExistHunkHeader=!existHunkHeader(line,lineIndex);if(currentFile===null){throw new Error("Where is my file !!!")}if(values=oldMode.exec(line)){currentFile.oldMode=values[1]}else if(values=newMode.exec(line)){currentFile.newMode=values[1]}else if(values=deletedFileMode.exec(line)){currentFile.deletedFileMode=values[1];currentFile.isDeleted=true}else if(values=newFileMode.exec(line)){currentFile.newFileMode=values[1];currentFile.isNew=true}else if(values=copyFrom.exec(line)){if(doesNotExistHunkHeader){currentFile.oldName=values[1]}currentFile.isCopy=true}else if(values=copyTo.exec(line)){if(doesNotExistHunkHeader){currentFile.newName=values[1]}currentFile.isCopy=true}else if(values=renameFrom.exec(line)){if(doesNotExistHunkHeader){currentFile.oldName=values[1]}currentFile.isRename=true}else if(values=renameTo.exec(line)){if(doesNotExistHunkHeader){currentFile.newName=values[1]}currentFile.isRename=true}else if(values=binaryFiles.exec(line)){currentFile.isBinary=true;currentFile.oldName=getFilename(values[1],void 0,config.srcPrefix);currentFile.newName=getFilename(values[2],void 0,config.dstPrefix);startBlock("Binary file")}else if(binaryDiff.test(line)){currentFile.isBinary=true;startBlock(line)}else if(values=similarityIndex.exec(line)){currentFile.unchangedPercentage=parseInt(values[1],10)}else if(values=dissimilarityIndex.exec(line)){currentFile.changedPercentage=parseInt(values[1],10)}else if(values=index.exec(line)){currentFile.checksumBefore=values[1];currentFile.checksumAfter=values[2];if(values[3])currentFile.mode=values[3]}else if(values=combinedIndex.exec(line)){currentFile.checksumBefore=[values[2],values[3]];currentFile.checksumAfter=values[1]}else if(values=combinedMode.exec(line)){currentFile.oldMode=[values[2],values[3]];currentFile.newMode=values[1]}else if(values=combinedNewFile.exec(line)){currentFile.newFileMode=values[1];currentFile.isNew=true}else if(values=combinedDeletedFile.exec(line)){currentFile.deletedFileMode=values[1];currentFile.isDeleted=true}});saveBlock();saveFile();return files}function levenshtein(a,b){if(a.length===0){return b.length}if(b.length===0){return a.length}const matrix=[];let i;for(i=0;i<=b.length;i++){matrix[i]=[i]}let j;for(j=0;j<=a.length;j++){matrix[0][j]=j}for(i=1;i<=b.length;i++){for(j=1;j<=a.length;j++){if(b.charAt(i-1)===a.charAt(j-1)){matrix[i][j]=matrix[i-1][j-1]}else{matrix[i][j]=Math.min(matrix[i-1][j-1]+1,Math.min(matrix[i][j-1]+1,matrix[i-1][j]+1))}}}return matrix[b.length][a.length]}function newDistanceFn(str){return(x,y)=>{const xValue=str(x).trim();const yValue=str(y).trim();const lev=levenshtein(xValue,yValue);return lev/(xValue.length+yValue.length)}}function newMatcherFn(distance2){function findBestMatch(a,b,cache=new Map){let bestMatchDist=Infinity;let bestMatch;for(let i=0;i<a.length;++i){for(let j=0;j<b.length;++j){const cacheKey=JSON.stringify([a[i],b[j]]);let md;if(!(cache.has(cacheKey)&&(md=cache.get(cacheKey)))){md=distance2(a[i],b[j]);cache.set(cacheKey,md)}if(md<bestMatchDist){bestMatchDist=md;bestMatch={indexA:i,indexB:j,score:bestMatchDist}}}}return bestMatch}function group(a,b,level=0,cache=new Map){const bm=findBestMatch(a,b,cache);if(!bm||a.length+b.length<3){return[[a,b]]}const a1=a.slice(0,bm.indexA);const b1=b.slice(0,bm.indexB);const aMatch=[a[bm.indexA]];const bMatch=[b[bm.indexB]];const tailA=bm.indexA+1;const tailB=bm.indexB+1;const a2=a.slice(tailA);const b2=b.slice(tailB);const group1=group(a1,b1,level+1,cache);const groupMatch=group(aMatch,bMatch,level+1,cache);const group2=group(a2,b2,level+1,cache);let result=groupMatch;if(bm.indexA>0||bm.indexB>0){result=group1.concat(result)}if(a.length>tailA||b.length>tailB){result=result.concat(group2)}return result}return group}const CSSLineClass={INSERTS:"d2h-ins",DELETES:"d2h-del",CONTEXT:"d2h-cntx",INFO:"d2h-info",INSERT_CHANGES:"d2h-ins d2h-change",DELETE_CHANGES:"d2h-del d2h-change"};const defaultRenderConfig={matching:LineMatchingType.NONE,matchWordsThreshold:.25,maxLineLengthHighlight:1e4,diffStyle:DiffStyleType.WORD,colorScheme:ColorSchemeType.LIGHT};const separator="/";const distance=newDistanceFn(change=>change.value);const matcher=newMatcherFn(distance);function isDevNullName(name){return name.indexOf("dev/null")!==-1}function removeInsElements(line){return line.replace(/(<ins[^>]*>((.|\n)*?)<\/ins>)/g,"")}function removeDelElements(line){return line.replace(/(<del[^>]*>((.|\n)*?)<\/del>)/g,"")}function toCSSClass(lineType){switch(lineType){case LineType.CONTEXT:return CSSLineClass.CONTEXT;case LineType.INSERT:return CSSLineClass.INSERTS;case LineType.DELETE:return CSSLineClass.DELETES}}function colorSchemeToCss(colorScheme){switch(colorScheme){case ColorSchemeType.DARK:return"d2h-dark-color-scheme";case ColorSchemeType.AUTO:return"d2h-auto-color-scheme";case ColorSchemeType.LIGHT:default:return"d2h-light-color-scheme"}}function prefixLength(isCombined){return isCombined?2:1}function escapeForHtml(str){return str.slice(0).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;").replace(/\//g,"&#x2F;")}function deconstructLine(line,isCombined,escape=true){const indexToSplit=prefixLength(isCombined);return{prefix:line.substring(0,indexToSplit),content:escape?escapeForHtml(line.substring(indexToSplit)):line.substring(indexToSplit)}}function filenameDiff(file){const oldFilename=unifyPath(file.oldName);const newFilename=unifyPath(file.newName);if(oldFilename!==newFilename&&!isDevNullName(oldFilename)&&!isDevNullName(newFilename)){const prefixPaths=[];const suffixPaths=[];const oldFilenameParts=oldFilename.split(separator);const newFilenameParts=newFilename.split(separator);const oldFilenamePartsSize=oldFilenameParts.length;const newFilenamePartsSize=newFilenameParts.length;let i=0;let j=oldFilenamePartsSize-1;let k=newFilenamePartsSize-1;while(i<j&&i<k){if(oldFilenameParts[i]===newFilenameParts[i]){prefixPaths.push(newFilenameParts[i]);i+=1}else{break}}while(j>i&&k>i){if(oldFilenameParts[j]===newFilenameParts[k]){suffixPaths.unshift(newFilenameParts[k]);j-=1;k-=1}else{break}}const finalPrefix=prefixPaths.join(separator);const finalSuffix=suffixPaths.join(separator);const oldRemainingPath=oldFilenameParts.slice(i,j+1).join(separator);const newRemainingPath=newFilenameParts.slice(i,k+1).join(separator);if(finalPrefix.length&&finalSuffix.length){return finalPrefix+separator+"{"+oldRemainingPath+" → "+newRemainingPath+"}"+separator+finalSuffix}else if(finalPrefix.length){return finalPrefix+separator+"{"+oldRemainingPath+" → "+newRemainingPath+"}"}else if(finalSuffix.length){return"{"+oldRemainingPath+" → "+newRemainingPath+"}"+separator+finalSuffix}return oldFilename+" → "+newFilename}else if(!isDevNullName(newFilename)){return newFilename}else{return oldFilename}}function getHtmlId(file){return`d2h-${hashCode(filenameDiff(file)).toString().slice(-6)}`}function getFileIcon(file){let templateName="file-changed";if(file.isRename){templateName="file-renamed"}else if(file.isCopy){templateName="file-renamed"}else if(file.isNew){templateName="file-added"}else if(file.isDeleted){templateName="file-deleted"}else if(file.newName!==file.oldName){templateName="file-renamed"}return templateName}function diffHighlight(diffLine1,diffLine2,isCombined,config={}){const{matching,maxLineLengthHighlight,matchWordsThreshold,diffStyle}=Object.assign(Object.assign({},defaultRenderConfig),config);const line1=deconstructLine(diffLine1,isCombined,false);const line2=deconstructLine(diffLine2,isCombined,false);if(line1.content.length>maxLineLengthHighlight||line2.content.length>maxLineLengthHighlight){return{oldLine:{prefix:line1.prefix,content:escapeForHtml(line1.content)},newLine:{prefix:line2.prefix,content:escapeForHtml(line2.content)}}}const diff=diffStyle==="char"?diffChars(line1.content,line2.content):diffWordsWithSpace(line1.content,line2.content);const changedWords=[];if(diffStyle==="word"&&matching==="words"){const removed=diff.filter(element=>element.removed);const added=diff.filter(element=>element.added);const chunks=matcher(added,removed);chunks.forEach(chunk=>{if(chunk[0].length===1&&chunk[1].length===1){const dist=distance(chunk[0][0],chunk[1][0]);if(dist<matchWordsThreshold){changedWords.push(chunk[0][0]);changedWords.push(chunk[1][0])}}})}const highlightedLine=diff.reduce((highlightedLine2,part)=>{const elemType=part.added?"ins":part.removed?"del":null;const addClass=changedWords.indexOf(part)>-1?' class="d2h-change"':"";const escapedValue=escapeForHtml(part.value);return elemType!==null?`${highlightedLine2}<${elemType}${addClass}>${escapedValue}</${elemType}>`:`${highlightedLine2}${escapedValue}`},"");return{oldLine:{prefix:line1.prefix,content:removeInsElements(highlightedLine)},newLine:{prefix:line2.prefix,content:removeDelElements(highlightedLine)}}}const baseTemplatesPath$2="file-summary";const iconsBaseTemplatesPath$2="icon";const defaultFileListRendererConfig={colorScheme:defaultRenderConfig.colorScheme};class FileListRenderer{constructor(hoganUtils,config={}){this.hoganUtils=hoganUtils;this.config=Object.assign(Object.assign({},defaultFileListRendererConfig),config)}render(diffFiles){const files=diffFiles.map(file=>this.hoganUtils.render(baseTemplatesPath$2,"line",{fileHtmlId:getHtmlId(file),oldName:file.oldName,newName:file.newName,fileName:filenameDiff(file),deletedLines:"-"+file.deletedLines,addedLines:"+"+file.addedLines},{fileIcon:this.hoganUtils.template(iconsBaseTemplatesPath$2,getFileIcon(file))})).join("\n");return this.hoganUtils.render(baseTemplatesPath$2,"wrapper",{colorScheme:colorSchemeToCss(this.config.colorScheme),filesNumber:diffFiles.length,files})}}const defaultLineByLineRendererConfig=Object.assign(Object.assign({},defaultRenderConfig),{renderNothingWhenEmpty:false,matchingMaxComparisons:2500,maxLineSizeInBlockForComparison:200});const genericTemplatesPath$1="generic";const baseTemplatesPath$1="line-by-line";const iconsBaseTemplatesPath$1="icon";const tagsBaseTemplatesPath$1="tag";class LineByLineRenderer{constructor(hoganUtils,config={}){this.hoganUtils=hoganUtils;this.config=Object.assign(Object.assign({},defaultLineByLineRendererConfig),config)}render(diffFiles){const diffsHtml=diffFiles.map(file=>{let diffs;if(file.blocks.length){diffs=this.generateFileHtml(file)}else{diffs=this.generateEmptyDiff()}return this.makeFileDiffHtml(file,diffs)}).join("\n");return this.hoganUtils.render(genericTemplatesPath$1,"wrapper",{colorScheme:colorSchemeToCss(this.config.colorScheme),content:diffsHtml})}makeFileDiffHtml(file,diffs){if(this.config.renderNothingWhenEmpty&&Array.isArray(file.blocks)&&file.blocks.length===0)return"";const fileDiffTemplate=this.hoganUtils.template(baseTemplatesPath$1,"file-diff");const filePathTemplate=this.hoganUtils.template(genericTemplatesPath$1,"file-path");const fileIconTemplate=this.hoganUtils.template(iconsBaseTemplatesPath$1,"file");const fileTagTemplate=this.hoganUtils.template(tagsBaseTemplatesPath$1,getFileIcon(file));return fileDiffTemplate.render({file,fileHtmlId:getHtmlId(file),diffs,filePath:filePathTemplate.render({fileDiffName:filenameDiff(file)},{fileIcon:fileIconTemplate,fileTag:fileTagTemplate})})}generateEmptyDiff(){return this.hoganUtils.render(genericTemplatesPath$1,"empty-diff",{contentClass:"d2h-code-line",CSSLineClass})}generateFileHtml(file){const matcher2=newMatcherFn(newDistanceFn(e=>deconstructLine(e.content,file.isCombined).content));return file.blocks.map(block=>{let lines=this.hoganUtils.render(genericTemplatesPath$1,"block-header",{CSSLineClass,blockHeader:file.isTooBig?block.header:escapeForHtml(block.header),lineClass:"d2h-code-linenumber",contentClass:"d2h-code-line"});this.applyLineGroupping(block).forEach(([contextLines,oldLines,newLines])=>{if(oldLines.length&&newLines.length&&!contextLines.length){this.applyRematchMatching(oldLines,newLines,matcher2).map(([oldLines2,newLines2])=>{const{left,right}=this.processChangedLines(file,file.isCombined,oldLines2,newLines2);lines+=left;lines+=right})}else if(contextLines.length){contextLines.forEach(line=>{const{prefix,content}=deconstructLine(line.content,file.isCombined);lines+=this.generateSingleLineHtml(file,{type:CSSLineClass.CONTEXT,prefix,content,oldNumber:line.oldNumber,newNumber:line.newNumber})})}else if(oldLines.length||newLines.length){const{left,right}=this.processChangedLines(file,file.isCombined,oldLines,newLines);lines+=left;lines+=right}else{console.error("Unknown state reached while processing groups of lines",contextLines,oldLines,newLines)}});return lines}).join("\n")}applyLineGroupping(block){const blockLinesGroups=[];let oldLines=[];let newLines=[];for(let i=0;i<block.lines.length;i++){const diffLine=block.lines[i];if(diffLine.type!==LineType.INSERT&&newLines.length||diffLine.type===LineType.CONTEXT&&oldLines.length>0){blockLinesGroups.push([[],oldLines,newLines]);oldLines=[];newLines=[]}if(diffLine.type===LineType.CONTEXT){blockLinesGroups.push([[diffLine],[],[]])}else if(diffLine.type===LineType.INSERT&&oldLines.length===0){blockLinesGroups.push([[],[],[diffLine]])}else if(diffLine.type===LineType.INSERT&&oldLines.length>0){newLines.push(diffLine)}else if(diffLine.type===LineType.DELETE){oldLines.push(diffLine)}}if(oldLines.length||newLines.length){blockLinesGroups.push([[],oldLines,newLines]);oldLines=[];newLines=[]}return blockLinesGroups}applyRematchMatching(oldLines,newLines,matcher2){const comparisons=oldLines.length*newLines.length;const maxLineSizeInBlock=max(oldLines.concat(newLines).map(elem=>elem.content.length));const doMatching=comparisons<this.config.matchingMaxComparisons&&maxLineSizeInBlock<this.config.maxLineSizeInBlockForComparison&&(this.config.matching==="lines"||this.config.matching==="words");return doMatching?matcher2(oldLines,newLines):[[oldLines,newLines]]}processChangedLines(file,isCombined,oldLines,newLines){const fileHtml={right:"",left:""};const maxLinesNumber=Math.max(oldLines.length,newLines.length);for(let i=0;i<maxLinesNumber;i++){const oldLine=oldLines[i];const newLine=newLines[i];const diff=oldLine!==void 0&&newLine!==void 0?diffHighlight(oldLine.content,newLine.content,isCombined,this.config):void 0;const preparedOldLine=oldLine!==void 0&&oldLine.oldNumber!==void 0?Object.assign(Object.assign({},diff!==void 0?{prefix:diff.oldLine.prefix,content:diff.oldLine.content,type:CSSLineClass.DELETE_CHANGES}:Object.assign(Object.assign({},deconstructLine(oldLine.content,isCombined)),{type:toCSSClass(oldLine.type)})),{oldNumber:oldLine.oldNumber,newNumber:oldLine.newNumber}):void 0;const preparedNewLine=newLine!==void 0&&newLine.newNumber!==void 0?Object.assign(Object.assign({},diff!==void 0?{prefix:diff.newLine.prefix,content:diff.newLine.content,type:CSSLineClass.INSERT_CHANGES}:Object.assign(Object.assign({},deconstructLine(newLine.content,isCombined)),{type:toCSSClass(newLine.type)})),{oldNumber:newLine.oldNumber,newNumber:newLine.newNumber}):void 0;const{left,right}=this.generateLineHtml(file,preparedOldLine,preparedNewLine);fileHtml.left+=left;fileHtml.right+=right}return fileHtml}generateLineHtml(file,oldLine,newLine){return{left:this.generateSingleLineHtml(file,oldLine),right:this.generateSingleLineHtml(file,newLine)}}generateSingleLineHtml(file,line){if(line===void 0)return"";const lineNumberHtml=this.hoganUtils.render(baseTemplatesPath$1,"numbers",{oldNumber:line.oldNumber||"",newNumber:line.newNumber||""});return this.hoganUtils.render(genericTemplatesPath$1,"line",{type:line.type,lineClass:"d2h-code-linenumber",contentClass:"d2h-code-line",prefix:line.prefix===" "?"&nbsp;":line.prefix,content:line.content,lineNumber:lineNumberHtml,line,file})}}const defaultSideBySideRendererConfig=Object.assign(Object.assign({},defaultRenderConfig),{renderNothingWhenEmpty:false,matchingMaxComparisons:2500,maxLineSizeInBlockForComparison:200});const genericTemplatesPath="generic";const baseTemplatesPath="side-by-side";const iconsBaseTemplatesPath="icon";const tagsBaseTemplatesPath="tag";class SideBySideRenderer{constructor(hoganUtils,config={}){this.hoganUtils=hoganUtils;this.config=Object.assign(Object.assign({},defaultSideBySideRendererConfig),config)}render(diffFiles){const diffsHtml=diffFiles.map(file=>{let diffs;if(file.blocks.length){diffs=this.generateFileHtml(file)}else{diffs=this.generateEmptyDiff()}return this.makeFileDiffHtml(file,diffs)}).join("\n");return this.hoganUtils.render(genericTemplatesPath,"wrapper",{colorScheme:colorSchemeToCss(this.config.colorScheme),content:diffsHtml})}makeFileDiffHtml(file,diffs){if(this.config.renderNothingWhenEmpty&&Array.isArray(file.blocks)&&file.blocks.length===0)return"";const fileDiffTemplate=this.hoganUtils.template(baseTemplatesPath,"file-diff");const filePathTemplate=this.hoganUtils.template(genericTemplatesPath,"file-path");const fileIconTemplate=this.hoganUtils.template(iconsBaseTemplatesPath,"file");const fileTagTemplate=this.hoganUtils.template(tagsBaseTemplatesPath,getFileIcon(file));return fileDiffTemplate.render({file,fileHtmlId:getHtmlId(file),diffs,filePath:filePathTemplate.render({fileDiffName:filenameDiff(file)},{fileIcon:fileIconTemplate,fileTag:fileTagTemplate})})}generateEmptyDiff(){return{right:"",left:this.hoganUtils.render(genericTemplatesPath,"empty-diff",{contentClass:"d2h-code-side-line",CSSLineClass})}}generateFileHtml(file){const matcher2=newMatcherFn(newDistanceFn(e=>deconstructLine(e.content,file.isCombined).content));return file.blocks.map(block=>{const fileHtml={left:this.makeHeaderHtml(block.header,file),right:this.makeHeaderHtml("")};this.applyLineGroupping(block).forEach(([contextLines,oldLines,newLines])=>{if(oldLines.length&&newLines.length&&!contextLines.length){this.applyRematchMatching(oldLines,newLines,matcher2).map(([oldLines2,newLines2])=>{const{left,right}=this.processChangedLines(file.isCombined,oldLines2,newLines2);fileHtml.left+=left;fileHtml.right+=right})}else if(contextLines.length){contextLines.forEach(line=>{const{prefix,content}=deconstructLine(line.content,file.isCombined);const{left,right}=this.generateLineHtml({type:CSSLineClass.CONTEXT,prefix,content,number:line.oldNumber},{type:CSSLineClass.CONTEXT,prefix,content,number:line.newNumber});fileHtml.left+=left;fileHtml.right+=right})}else if(oldLines.length||newLines.length){const{left,right}=this.processChangedLines(file.isCombined,oldLines,newLines);fileHtml.left+=left;fileHtml.right+=right}else{console.error("Unknown state reached while processing groups of lines",contextLines,oldLines,newLines)}});return fileHtml}).reduce((accomulated,html2)=>{return{left:accomulated.left+html2.left,right:accomulated.right+html2.right}},{left:"",right:""})}applyLineGroupping(block){const blockLinesGroups=[];let oldLines=[];let newLines=[];for(let i=0;i<block.lines.length;i++){const diffLine=block.lines[i];if(diffLine.type!==LineType.INSERT&&newLines.length||diffLine.type===LineType.CONTEXT&&oldLines.length>0){blockLinesGroups.push([[],oldLines,newLines]);oldLines=[];newLines=[]}if(diffLine.type===LineType.CONTEXT){blockLinesGroups.push([[diffLine],[],[]])}else if(diffLine.type===LineType.INSERT&&oldLines.length===0){blockLinesGroups.push([[],[],[diffLine]])}else if(diffLine.type===LineType.INSERT&&oldLines.length>0){newLines.push(diffLine)}else if(diffLine.type===LineType.DELETE){oldLines.push(diffLine)}}if(oldLines.length||newLines.length){blockLinesGroups.push([[],oldLines,newLines]);oldLines=[];newLines=[]}return blockLinesGroups}applyRematchMatching(oldLines,newLines,matcher2){const comparisons=oldLines.length*newLines.length;const maxLineSizeInBlock=max(oldLines.concat(newLines).map(elem=>elem.content.length));const doMatching=comparisons<this.config.matchingMaxComparisons&&maxLineSizeInBlock<this.config.maxLineSizeInBlockForComparison&&(this.config.matching==="lines"||this.config.matching==="words");return doMatching?matcher2(oldLines,newLines):[[oldLines,newLines]]}makeHeaderHtml(blockHeader,file){return this.hoganUtils.render(genericTemplatesPath,"block-header",{CSSLineClass,blockHeader:(file===null||file===void 0?void 0:file.isTooBig)?blockHeader:escapeForHtml(blockHeader),lineClass:"d2h-code-side-linenumber",contentClass:"d2h-code-side-line"})}processChangedLines(isCombined,oldLines,newLines){const fileHtml={right:"",left:""};const maxLinesNumber=Math.max(oldLines.length,newLines.length);for(let i=0;i<maxLinesNumber;i++){const oldLine=oldLines[i];const newLine=newLines[i];const diff=oldLine!==void 0&&newLine!==void 0?diffHighlight(oldLine.content,newLine.content,isCombined,this.config):void 0;const preparedOldLine=oldLine!==void 0&&oldLine.oldNumber!==void 0?Object.assign(Object.assign({},diff!==void 0?{prefix:diff.oldLine.prefix,content:diff.oldLine.content,type:CSSLineClass.DELETE_CHANGES}:Object.assign(Object.assign({},deconstructLine(oldLine.content,isCombined)),{type:toCSSClass(oldLine.type)})),{number:oldLine.oldNumber}):void 0;const preparedNewLine=newLine!==void 0&&newLine.newNumber!==void 0?Object.assign(Object.assign({},diff!==void 0?{prefix:diff.newLine.prefix,content:diff.newLine.content,type:CSSLineClass.INSERT_CHANGES}:Object.assign(Object.assign({},deconstructLine(newLine.content,isCombined)),{type:toCSSClass(newLine.type)})),{number:newLine.newNumber}):void 0;const{left,right}=this.generateLineHtml(preparedOldLine,preparedNewLine);fileHtml.left+=left;fileHtml.right+=right}return fileHtml}generateLineHtml(oldLine,newLine){return{left:this.generateSingleHtml(oldLine),right:this.generateSingleHtml(newLine)}}generateSingleHtml(line){const lineClass="d2h-code-side-linenumber";const contentClass="d2h-code-side-line";return this.hoganUtils.render(genericTemplatesPath,"line",{type:(line===null||line===void 0?void 0:line.type)||`${CSSLineClass.CONTEXT} d2h-emptyplaceholder`,lineClass:line!==void 0?lineClass:`${lineClass} d2h-code-side-emptyplaceholder`,contentClass:line!==void 0?contentClass:`${contentClass} d2h-code-side-emptyplaceholder`,prefix:(line===null||line===void 0?void 0:line.prefix)===" "?"&nbsp;":line===null||line===void 0?void 0:line.prefix,content:line===null||line===void 0?void 0:line.content,lineNumber:line===null||line===void 0?void 0:line.number})}}var compiler={};var hasRequiredCompiler;function requireCompiler(){if(hasRequiredCompiler)return compiler;hasRequiredCompiler=1;(function(exports){(function(Hogan){var rIsWhitespace=/\S/,rQuot=/\"/g,rNewline=/\n/g,rCr=/\r/g,rSlash=/\\/g,rLineSep=/\u2028/,rParagraphSep=/\u2029/;Hogan.tags={"#":1,"^":2,"<":3,"$":4,"/":5,"!":6,">":7,"=":8,"_v":9,"{":10,"&":11,"_t":12};Hogan.scan=function scan(text,delimiters){var len=text.length,IN_TEXT=0,IN_TAG_TYPE=1,IN_TAG=2,state=IN_TEXT,tagType=null,tag=null,buf="",tokens=[],seenTag=false,i=0,lineStart=0,otag="{{",ctag="}}";function addBuf(){if(buf.length>0){tokens.push({tag:"_t",text:new String(buf)});buf=""}}function lineIsWhitespace(){var isAllWhitespace=true;for(var j=lineStart;j<tokens.length;j++){isAllWhitespace=Hogan.tags[tokens[j].tag]<Hogan.tags["_v"]||tokens[j].tag=="_t"&&tokens[j].text.match(rIsWhitespace)===null;if(!isAllWhitespace){return false}}return isAllWhitespace}function filterLine(haveSeenTag,noNewLine){addBuf();if(haveSeenTag&&lineIsWhitespace()){for(var j=lineStart,next;j<tokens.length;j++){if(tokens[j].text){if((next=tokens[j+1])&&next.tag==">"){next.indent=tokens[j].text.toString()}tokens.splice(j,1)}}}else if(!noNewLine){tokens.push({tag:"\n"})}seenTag=false;lineStart=tokens.length}function changeDelimiters(text2,index){var close="="+ctag,closeIndex=text2.indexOf(close,index),delimiters2=trim(text2.substring(text2.indexOf("=",index)+1,closeIndex)).split(" ");otag=delimiters2[0];ctag=delimiters2[delimiters2.length-1];return closeIndex+close.length-1}if(delimiters){delimiters=delimiters.split(" ");otag=delimiters[0];ctag=delimiters[1]}for(i=0;i<len;i++){if(state==IN_TEXT){if(tagChange(otag,text,i)){--i;addBuf();state=IN_TAG_TYPE}else{if(text.charAt(i)=="\n"){filterLine(seenTag)}else{buf+=text.charAt(i)}}}else if(state==IN_TAG_TYPE){i+=otag.length-1;tag=Hogan.tags[text.charAt(i+1)];tagType=tag?text.charAt(i+1):"_v";if(tagType=="="){i=changeDelimiters(text,i);state=IN_TEXT}else{if(tag){i++}state=IN_TAG}seenTag=i}else{if(tagChange(ctag,text,i)){tokens.push({tag:tagType,n:trim(buf),otag,ctag,i:tagType=="/"?seenTag-otag.length:i+ctag.length});buf="";i+=ctag.length-1;state=IN_TEXT;if(tagType=="{"){if(ctag=="}}"){i++}else{cleanTripleStache(tokens[tokens.length-1])}}}else{buf+=text.charAt(i)}}}filterLine(seenTag,true);return tokens};function cleanTripleStache(token){if(token.n.substr(token.n.length-1)==="}"){token.n=token.n.substring(0,token.n.length-1)}}function trim(s){if(s.trim){return s.trim()}return s.replace(/^\s*|\s*$/g,"")}function tagChange(tag,text,index){if(text.charAt(index)!=tag.charAt(0)){return false}for(var i=1,l=tag.length;i<l;i++){if(text.charAt(index+i)!=tag.charAt(i)){return false}}return true}var allowedInSuper={"_t":true,"\n":true,"$":true,"/":true};function buildTree(tokens,kind,stack,customTags){var instructions=[],opener=null,tail=null,token=null;tail=stack[stack.length-1];while(tokens.length>0){token=tokens.shift();if(tail&&tail.tag=="<"&&!(token.tag in allowedInSuper)){throw new Error("Illegal content in < super tag.")}if(Hogan.tags[token.tag]<=Hogan.tags["$"]||isOpener(token,customTags)){stack.push(token);token.nodes=buildTree(tokens,token.tag,stack,customTags)}else if(token.tag=="/"){if(stack.length===0){throw new Error("Closing tag without opener: /"+token.n)}opener=stack.pop();if(token.n!=opener.n&&!isCloser(token.n,opener.n,customTags)){throw new Error("Nesting error: "+opener.n+" vs. "+token.n)}opener.end=token.i;return instructions}else if(token.tag=="\n"){token.last=tokens.length==0||tokens[0].tag=="\n"}instructions.push(token)}if(stack.length>0){throw new Error("missing closing tag: "+stack.pop().n)}return instructions}function isOpener(token,tags){for(var i=0,l=tags.length;i<l;i++){if(tags[i].o==token.n){token.tag="#";return true}}}function isCloser(close,open,tags){for(var i=0,l=tags.length;i<l;i++){if(tags[i].c==close&&tags[i].o==open){return true}}}function stringifySubstitutions(obj){var items=[];for(var key2 in obj){items.push('"'+esc(key2)+'": function(c,p,t,i) {'+obj[key2]+"}")}return"{ "+items.join(",")+" }"}function stringifyPartials(codeObj){var partials=[];for(var key2 in codeObj.partials){partials.push('"'+esc(key2)+'":{name:"'+esc(codeObj.partials[key2].name)+'", '+stringifyPartials(codeObj.partials[key2])+"}")}return"partials: {"+partials.join(",")+"}, subs: "+stringifySubstitutions(codeObj.subs)}Hogan.stringify=function(codeObj,text,options){return"{code: function (c,p,i) { "+Hogan.wrapMain(codeObj.code)+" },"+stringifyPartials(codeObj)+"}"};var serialNo=0;Hogan.generate=function(tree,text,options){serialNo=0;var context={code:"",subs:{},partials:{}};Hogan.walk(tree,context);if(options.asString){return this.stringify(context,text,options)}return this.makeTemplate(context,text,options)};Hogan.wrapMain=function(code){return'var t=this;t.b(i=i||"");'+code+"return t.fl();"};Hogan.template=Hogan.Template;Hogan.makeTemplate=function(codeObj,text,options){var template2=this.makePartials(codeObj);template2.code=new Function("c","p","i",this.wrapMain(codeObj.code));return new this.template(template2,text,this,options)};Hogan.makePartials=function(codeObj){var key2,template2={subs:{},partials:codeObj.partials,name:codeObj.name};for(key2 in template2.partials){template2.partials[key2]=this.makePartials(template2.partials[key2])}for(key2 in codeObj.subs){template2.subs[key2]=new Function("c","p","t","i",codeObj.subs[key2])}return template2};function esc(s){return s.replace(rSlash,"\\\\").replace(rQuot,'\\"').replace(rNewline,"\\n").replace(rCr,"\\r").replace(rLineSep,"\\u2028").replace(rParagraphSep,"\\u2029")}function chooseMethod(s){return~s.indexOf(".")?"d":"f"}function createPartial(node,context){var prefix="<"+(context.prefix||"");var sym=prefix+node.n+serialNo++;context.partials[sym]={name:node.n,partials:{}};context.code+='t.b(t.rp("'+esc(sym)+'",c,p,"'+(node.indent||"")+'"));';return sym}Hogan.codegen={"#":function(node,context){context.code+="if(t.s(t."+chooseMethod(node.n)+'("'+esc(node.n)+'",c,p,1),c,p,0,'+node.i+","+node.end+',"'+node.otag+" "+node.ctag+'")){t.rs(c,p,function(c,p,t){';Hogan.walk(node.nodes,context);context.code+="});c.pop();}"},"^":function(node,context){context.code+="if(!t.s(t."+chooseMethod(node.n)+'("'+esc(node.n)+'",c,p,1),c,p,1,0,0,"")){';Hogan.walk(node.nodes,context);context.code+="};"},">":createPartial,"<":function(node,context){var ctx={partials:{},code:"",subs:{},inPartial:true};Hogan.walk(node.nodes,ctx);var template2=context.partials[createPartial(node,context)];template2.subs=ctx.subs;template2.partials=ctx.partials},"$":function(node,context){var ctx={subs:{},code:"",partials:context.partials,prefix:node.n};Hogan.walk(node.nodes,ctx);context.subs[node.n]=ctx.code;if(!context.inPartial){context.code+='t.sub("'+esc(node.n)+'",c,p,i);'}},"\n":function(node,context){context.code+=write('"\\n"'+(node.last?"":" + i"))},"_v":function(node,context){context.code+="t.b(t.v(t."+chooseMethod(node.n)+'("'+esc(node.n)+'",c,p,0)));'},"_t":function(node,context){context.code+=write('"'+esc(node.text)+'"')},"{":tripleStache,"&":tripleStache};function tripleStache(node,context){context.code+="t.b(t.t(t."+chooseMethod(node.n)+'("'+esc(node.n)+'",c,p,0)));'}function write(s){return"t.b("+s+");"}Hogan.walk=function(nodelist,context){var func;for(var i=0,l=nodelist.length;i<l;i++){func=Hogan.codegen[nodelist[i].tag];func&&func(nodelist[i],context)}return context};Hogan.parse=function(tokens,text,options){options=options||{};return buildTree(tokens,"",[],options.sectionTags||[])};Hogan.cache={};Hogan.cacheKey=function(text,options){return[text,!!options.asString,!!options.disableLambda,options.delimiters,!!options.modelGet].join("||")};Hogan.compile=function(text,options){options=options||{};var key2=Hogan.cacheKey(text,options);var template2=this.cache[key2];if(template2){var partials=template2.partials;for(var name in partials){delete partials[name].instance}return template2}template2=this.generate(this.parse(this.scan(text,options.delimiters),text,options),text,options);return this.cache[key2]=template2}})(exports)})(compiler);return compiler}var template={};var hasRequiredTemplate;function requireTemplate(){if(hasRequiredTemplate)return template;hasRequiredTemplate=1;(function(exports){(function(Hogan){Hogan.Template=function(codeObj,text,compiler2,options){codeObj=codeObj||{};this.r=codeObj.code||this.r;this.c=compiler2;this.options=options||{};this.text=text||"";this.partials=codeObj.partials||{};this.subs=codeObj.subs||{};this.buf=""};Hogan.Template.prototype={r:function(context,partials,indent){return""},v:hoganEscape,t:coerceToString,render:function render(context,partials,indent){return this.ri([context],partials||{},indent)},ri:function(context,partials,indent){return this.r(context,partials,indent)},ep:function(symbol,partials){var partial=this.partials[symbol];var template2=partials[partial.name];if(partial.instance&&partial.base==template2){return partial.instance}if(typeof template2=="string"){if(!this.c){throw new Error("No compiler available.")}template2=this.c.compile(template2,this.options)}if(!template2){return null}this.partials[symbol].base=template2;if(partial.subs){if(!partials.stackText)partials.stackText={};for(key in partial.subs){if(!partials.stackText[key]){partials.stackText[key]=this.activeSub!==void 0&&partials.stackText[this.activeSub]?partials.stackText[this.activeSub]:this.text}}template2=createSpecializedPartial(template2,partial.subs,partial.partials,this.stackSubs,this.stackPartials,partials.stackText)}this.partials[symbol].instance=template2;return template2},rp:function(symbol,context,partials,indent){var partial=this.ep(symbol,partials);if(!partial){return""}return partial.ri(context,partials,indent)},rs:function(context,partials,section){var tail=context[context.length-1];if(!isArray(tail)){section(context,partials,this);return}for(var i=0;i<tail.length;i++){context.push(tail[i]);section(context,partials,this);context.pop()}},s:function(val,ctx,partials,inverted,start,end,tags){var pass;if(isArray(val)&&val.length===0){return false}if(typeof val=="function"){val=this.ms(val,ctx,partials,inverted,start,end,tags)}pass=!!val;if(!inverted&&pass&&ctx){ctx.push(typeof val=="object"?val:ctx[ctx.length-1])}return pass},d:function(key2,ctx,partials,returnFound){var found,names=key2.split("."),val=this.f(names[0],ctx,partials,returnFound),doModelGet=this.options.modelGet,cx=null;if(key2==="."&&isArray(ctx[ctx.length-2])){val=ctx[ctx.length-1]}else{for(var i=1;i<names.length;i++){found=findInScope(names[i],val,doModelGet);if(found!==void 0){cx=val;val=found}else{val=""}}}if(returnFound&&!val){return false}if(!returnFound&&typeof val=="function"){ctx.push(cx);val=this.mv(val,ctx,partials);ctx.pop()}return val},f:function(key2,ctx,partials,returnFound){var val=false,v=null,found=false,doModelGet=this.options.modelGet;for(var i=ctx.length-1;i>=0;i--){v=ctx[i];val=findInScope(key2,v,doModelGet);if(val!==void 0){found=true;break}}if(!found){return returnFound?false:""}if(!returnFound&&typeof val=="function"){val=this.mv(val,ctx,partials)}return val},ls:function(func,cx,ctx,partials,text,tags){var oldTags=this.options.delimiters;this.options.delimiters=tags;this.b(this.ct(coerceToString(func.call(cx,text,ctx)),cx,partials));this.options.delimiters=oldTags;return false},ct:function(text,cx,partials){if(this.options.disableLambda){throw new Error("Lambda features disabled.")}return this.c.compile(text,this.options).render(cx,partials)},b:function(s){this.buf+=s},fl:function(){var r=this.buf;this.buf="";return r},ms:function(func,ctx,partials,inverted,start,end,tags){var textSource,cx=ctx[ctx.length-1],result=func.call(cx);if(typeof result=="function"){if(inverted){return true}else{textSource=this.activeSub&&this.subsText&&this.subsText[this.activeSub]?this.subsText[this.activeSub]:this.text;return this.ls(result,cx,ctx,partials,textSource.substring(start,end),tags)}}return result},mv:function(func,ctx,partials){var cx=ctx[ctx.length-1];var result=func.call(cx);if(typeof result=="function"){return this.ct(coerceToString(result.call(cx)),cx,partials)}return result},sub:function(name,context,partials,indent){var f=this.subs[name];if(f){this.activeSub=name;f(context,partials,this,indent);this.activeSub=false}}};function findInScope(key2,scope,doModelGet){var val;if(scope&&typeof scope=="object"){if(scope[key2]!==void 0){val=scope[key2]}else if(doModelGet&&scope.get&&typeof scope.get=="function"){val=scope.get(key2)}}return val}function createSpecializedPartial(instance,subs,partials,stackSubs,stackPartials,stackText){function PartialTemplate(){}PartialTemplate.prototype=instance;function Substitutions(){}Substitutions.prototype=instance.subs;var key2;var partial=new PartialTemplate;partial.subs=new Substitutions;partial.subsText={};partial.buf="";stackSubs=stackSubs||{};partial.stackSubs=stackSubs;partial.subsText=stackText;for(key2 in subs){if(!stackSubs[key2])stackSubs[key2]=subs[key2]}for(key2 in stackSubs){partial.subs[key2]=stackSubs[key2]}stackPartials=stackPartials||{};partial.stackPartials=stackPartials;for(key2 in partials){if(!stackPartials[key2])stackPartials[key2]=partials[key2]}for(key2 in stackPartials){partial.partials[key2]=stackPartials[key2]}return partial}var rAmp=/&/g,rLt=/</g,rGt=/>/g,rApos=/\'/g,rQuot=/\"/g,hChars=/[&<>\"\']/;function coerceToString(val){return String(val===null||val===void 0?"":val)}function hoganEscape(str){str=coerceToString(str);return hChars.test(str)?str.replace(rAmp,"&amp;").replace(rLt,"&lt;").replace(rGt,"&gt;").replace(rApos,"&#39;").replace(rQuot,"&quot;"):str}var isArray=Array.isArray||function(a){return Object.prototype.toString.call(a)==="[object Array]"}})(exports)})(template);return template}var hogan;var hasRequiredHogan;function requireHogan(){if(hasRequiredHogan)return hogan;hasRequiredHogan=1;var Hogan=requireCompiler();Hogan.Template=requireTemplate().Template;Hogan.template=Hogan.Template;hogan=Hogan;return hogan}var hoganExports=requireHogan();const defaultTemplates={};defaultTemplates["file-summary-line"]=new hoganExports.Template({code:function(c,p,i){var t=this;t.b(i=i||"");t.b('<li class="d2h-file-list-line">');t.b("\n"+i);t.b(' <span class="d2h-file-name-wrapper">');t.b("\n"+i);t.b(t.rp("<fileIcon0",c,p," "));t.b(' <a href="#');t.b(t.v(t.f("fileHtmlId",c,p,0)));t.b('" class="d2h-file-name">');t.b(t.v(t.f("fileName",c,p,0)));t.b("</a>");t.b("\n"+i);t.b(' <span class="d2h-file-stats">');t.b("\n"+i);t.b(' <span class="d2h-lines-added">');t.b(t.v(t.f("addedLines",c,p,0)));t.b("</span>");t.b("\n"+i);t.b(' <span class="d2h-lines-deleted">');t.b(t.v(t.f("deletedLines",c,p,0)));t.b("</span>");t.b("\n"+i);t.b(" </span>");t.b("\n"+i);t.b(" </span>");t.b("\n"+i);t.b("</li>");return t.fl()},partials:{"<fileIcon0":{name:"fileIcon",partials:{},subs:{}}},subs:{}});defaultTemplates["file-summary-wrapper"]=new hoganExports.Template({code:function(c,p,i){var t=this;t.b(i=i||"");t.b('<div class="d2h-file-list-wrapper ');t.b(t.v(t.f("colorScheme",c,p,0)));t.b('">');t.b("\n"+i);t.b(' <div class="d2h-file-list-header">');t.b("\n"+i);t.b(' <span class="d2h-file-list-title">Files changed (');t.b(t.v(t.f("filesNumber",c,p,0)));t.b(")</span>");t.b("\n"+i);t.b(' <a class="d2h-file-switch d2h-hide">hide</a>');t.b("\n"+i);t.b(' <a class="d2h-file-switch d2h-show">show</a>');t.b("\n"+i);t.b(" </div>");t.b("\n"+i);t.b(' <ol class="d2h-file-list">');t.b("\n"+i);t.b(" ");t.b(t.t(t.f("files",c,p,0)));t.b("\n"+i);t.b(" </ol>");t.b("\n"+i);t.b("</div>");return t.fl()},partials:{},subs:{}});defaultTemplates["generic-block-header"]=new hoganExports.Template({code:function(c,p,i){var t=this;t.b(i=i||"");t.b("<tr>");t.b("\n"+i);t.b(' <td class="');t.b(t.v(t.f("lineClass",c,p,0)));t.b(" ");t.b(t.v(t.d("CSSLineClass.INFO",c,p,0)));t.b('"></td>');t.b("\n"+i);t.b(' <td class="');t.b(t.v(t.d("CSSLineClass.INFO",c,p,0)));t.b('">');t.b("\n"+i);t.b(' <div class="');t.b(t.v(t.f("contentClass",c,p,0)));t.b('">');if(t.s(t.f("blockHeader",c,p,1),c,p,0,156,173,"{{ }}")){t.rs(c,p,function(c2,p2,t2){t2.b(t2.t(t2.f("blockHeader",c2,p2,0)))});c.pop()}if(!t.s(t.f("blockHeader",c,p,1),c,p,1,0,0,"")){t.b("&nbsp;")}t.b("</div>");t.b("\n"+i);t.b(" </td>");t.b("\n"+i);t.b("</tr>");return t.fl()},partials:{},subs:{}});defaultTemplates["generic-empty-diff"]=new hoganExports.Template({code:function(c,p,i){var t=this;t.b(i=i||"");t.b("<tr>");t.b("\n"+i);t.b(' <td class="');t.b(t.v(t.d("CSSLineClass.INFO",c,p,0)));t.b('">');t.b("\n"+i);t.b(' <div class="');t.b(t.v(t.f("contentClass",c,p,0)));t.b('">');t.b("\n"+i);t.b(" File without changes");t.b("\n"+i);t.b(" </div>");t.b("\n"+i);t.b(" </td>");t.b("\n"+i);t.b("</tr>");return t.fl()},partials:{},subs:{}});defaultTemplates["generic-file-path"]=new hoganExports.Template({code:function(c,p,i){var t=this;t.b(i=i||"");t.b('<span class="d2h-file-name-wrapper">');t.b("\n"+i);t.b(t.rp("<fileIcon0",c,p," "));t.b(' <span class="d2h-file-name">');t.b(t.v(t.f("fileDiffName",c,p,0)));t.b("</span>");t.b("\n"+i);t.b(t.rp("<fileTag1",c,p," "));t.b("</span>");t.b("\n"+i);t.b('<label class="d2h-file-collapse">');t.b("\n"+i);t.b(' <input class="d2h-file-collapse-input" type="checkbox" name="viewed" value="viewed">');t.b("\n"+i);t.b(" Viewed");t.b("\n"+i);t.b("</label>");return t.fl()},partials:{"<fileIcon0":{name:"fileIcon",partials:{},subs:{}},"<fileTag1":{name:"fileTag",partials:{},subs:{}}},subs:{}});defaultTemplates["generic-line"]=new hoganExports.Template({code:function(c,p,i){var t=this;t.b(i=i||"");t.b("<tr>");t.b("\n"+i);t.b(' <td class="');t.b(t.v(t.f("lineClass",c,p,0)));t.b(" ");t.b(t.v(t.f("type",c,p,0)));t.b('">');t.b("\n"+i);t.b(" ");t.b(t.t(t.f("lineNumber",c,p,0)));t.b("\n"+i);t.b(" </td>");t.b("\n"+i);t.b(' <td class="');t.b(t.v(t.f("type",c,p,0)));t.b('">');t.b("\n"+i);t.b(' <div class="');t.b(t.v(t.f("contentClass",c,p,0)));t.b('">');t.b("\n"+i);if(t.s(t.f("prefix",c,p,1),c,p,0,162,238,"{{ }}")){t.rs(c,p,function(c2,p2,t2){t2.b(' <span class="d2h-code-line-prefix">');t2.b(t2.t(t2.f("prefix",c2,p2,0)));t2.b("</span>");t2.b("\n"+i)});c.pop()}if(!t.s(t.f("prefix",c,p,1),c,p,1,0,0,"")){t.b(' <span class="d2h-code-line-prefix">&nbsp;</span>');t.b("\n"+i)}if(t.s(t.f("content",c,p,1),c,p,0,371,445,"{{ }}")){t.rs(c,p,function(c2,p2,t2){t2.b(' <span class="d2h-code-line-ctn">');t2.b(t2.t(t2.f("content",c2,p2,0)));t2.b("</span>");t2.b("\n"+i)});c.pop()}if(!t.s(t.f("content",c,p,1),c,p,1,0,0,"")){t.b(' <span class="d2h-code-line-ctn"><br></span>');t.b("\n"+i)}t.b(" </div>");t.b("\n"+i);t.b(" </td>");t.b("\n"+i);t.b("</tr>");return t.fl()},partials:{},subs:{}});defaultTemplates["generic-wrapper"]=new hoganExports.Template({code:function(c,p,i){var t=this;t.b(i=i||"");t.b('<div class="d2h-wrapper ');t.b(t.v(t.f("colorScheme",c,p,0)));t.b('">');t.b("\n"+i);t.b(" ");t.b(t.t(t.f("content",c,p,0)));t.b("\n"+i);t.b("</div>");return t.fl()},partials:{},subs:{}});defaultTemplates["icon-file-added"]=new hoganExports.Template({code:function(c,p,i){var t=this;t.b(i=i||"");t.b('<svg aria-hidden="true" class="d2h-icon d2h-added" height="16" title="added" version="1.1" viewBox="0 0 14 16"');t.b("\n"+i);t.b(' width="14">');t.b("\n"+i);t.b(' <path d="M13 1H1C0.45 1 0 1.45 0 2v12c0 0.55 0.45 1 1 1h12c0.55 0 1-0.45 1-1V2c0-0.55-0.45-1-1-1z m0 13H1V2h12v12zM6 9H3V7h3V4h2v3h3v2H8v3H6V9z"></path>');t.b("\n"+i);t.b("</svg>");return t.fl()},partials:{},subs:{}});defaultTemplates["icon-file-changed"]=new hoganExports.Template({code:function(c,p,i){var t=this;t.b(i=i||"");t.b('<svg aria-hidden="true" class="d2h-icon d2h-changed" height="16" title="modified" version="1.1"');t.b("\n"+i);t.b(' viewBox="0 0 14 16" width="14">');t.b("\n"+i);t.b(' <path d="M13 1H1C0.45 1 0 1.45 0 2v12c0 0.55 0.45 1 1 1h12c0.55 0 1-0.45 1-1V2c0-0.55-0.45-1-1-1z m0 13H1V2h12v12zM4 8c0-1.66 1.34-3 3-3s3 1.34 3 3-1.34 3-3 3-3-1.34-3-3z"></path>');t.b("\n"+i);t.b("</svg>");return t.fl()},partials:{},subs:{}});defaultTemplates["icon-file-deleted"]=new hoganExports.Template({code:function(c,p,i){var t=this;t.b(i=i||"");t.b('<svg aria-hidden="true" class="d2h-icon d2h-deleted" height="16" title="removed" version="1.1"');t.b("\n"+i);t.b(' viewBox="0 0 14 16" width="14">');t.b("\n"+i);t.b(' <path d="M13 1H1C0.45 1 0 1.45 0 2v12c0 0.55 0.45 1 1 1h12c0.55 0 1-0.45 1-1V2c0-0.55-0.45-1-1-1z m0 13H1V2h12v12zM11 9H3V7h8v2z"></path>');t.b("\n"+i);t.b("</svg>");return t.fl()},partials:{},subs:{}});defaultTemplates["icon-file-renamed"]=new hoganExports.Template({code:function(c,p,i){var t=this;t.b(i=i||"");t.b('<svg aria-hidden="true" class="d2h-icon d2h-moved" height="16" title="renamed" version="1.1"');t.b("\n"+i);t.b(' viewBox="0 0 14 16" width="14">');t.b("\n"+i);t.b(' <path d="M6 9H3V7h3V4l5 4-5 4V9z m8-7v12c0 0.55-0.45 1-1 1H1c-0.55 0-1-0.45-1-1V2c0-0.55 0.45-1 1-1h12c0.55 0 1 0.45 1 1z m-1 0H1v12h12V2z"></path>');t.b("\n"+i);t.b("</svg>");return t.fl()},partials:{},subs:{}});defaultTemplates["icon-file"]=new hoganExports.Template({code:function(c,p,i){var t=this;t.b(i=i||"");t.b('<svg aria-hidden="true" class="d2h-icon" height="16" version="1.1" viewBox="0 0 12 16" width="12">');t.b("\n"+i);t.b(' <path d="M6 5H2v-1h4v1zM2 8h7v-1H2v1z m0 2h7v-1H2v1z m0 2h7v-1H2v1z m10-7.5v9.5c0 0.55-0.45 1-1 1H1c-0.55 0-1-0.45-1-1V2c0-0.55 0.45-1 1-1h7.5l3.5 3.5z m-1 0.5L8 2H1v12h10V5z"></path>');t.b("\n"+i);t.b("</svg>");return t.fl()},partials:{},subs:{}});defaultTemplates["line-by-line-file-diff"]=new hoganExports.Template({code:function(c,p,i){var t=this;t.b(i=i||"");t.b('<div id="');t.b(t.v(t.f("fileHtmlId",c,p,0)));t.b('" class="d2h-file-wrapper" data-lang="');t.b(t.v(t.d("file.language",c,p,0)));t.b('">');t.b("\n"+i);t.b(' <div class="d2h-file-header">');t.b("\n"+i);t.b(" ");t.b(t.t(t.f("filePath",c,p,0)));t.b("\n"+i);t.b(" </div>");t.b("\n"+i);t.b(' <div class="d2h-file-diff">');t.b("\n"+i);t.b(' <div class="d2h-code-wrapper">');t.b("\n"+i);t.b(' <table class="d2h-diff-table">');t.b("\n"+i);t.b(' <tbody class="d2h-diff-tbody">');t.b("\n"+i);t.b(" ");t.b(t.t(t.f("diffs",c,p,0)));t.b("\n"+i);t.b(" </tbody>");t.b("\n"+i);t.b(" </table>");t.b("\n"+i);t.b(" </div>");t.b("\n"+i);t.b(" </div>");t.b("\n"+i);t.b("</div>");return t.fl()},partials:{},subs:{}});defaultTemplates["line-by-line-numbers"]=new hoganExports.Template({code:function(c,p,i){var t=this;t.b(i=i||"");t.b('<div class="line-num1">');t.b(t.v(t.f("oldNumber",c,p,0)));t.b("</div>");t.b("\n"+i);t.b('<div class="line-num2">');t.b(t.v(t.f("newNumber",c,p,0)));t.b("</div>");return t.fl()},partials:{},subs:{}});defaultTemplates["side-by-side-file-diff"]=new hoganExports.Template({code:function(c,p,i){var t=this;t.b(i=i||"");t.b('<div id="');t.b(t.v(t.f("fileHtmlId",c,p,0)));t.b('" class="d2h-file-wrapper" data-lang="');t.b(t.v(t.d("file.language",c,p,0)));t.b('">');t.b("\n"+i);t.b(' <div class="d2h-file-header">');t.b("\n"+i);t.b(" ");t.b(t.t(t.f("filePath",c,p,0)));t.b("\n"+i);t.b(" </div>");t.b("\n"+i);t.b(' <div class="d2h-files-diff">');t.b("\n"+i);t.b(' <div class="d2h-file-side-diff">');t.b("\n"+i);t.b(' <div class="d2h-code-wrapper">');t.b("\n"+i);t.b(' <table class="d2h-diff-table">');t.b("\n"+i);t.b(' <tbody class="d2h-diff-tbody">');t.b("\n"+i);t.b(" ");t.b(t.t(t.d("diffs.left",c,p,0)));t.b("\n"+i);t.b(" </tbody>");t.b("\n"+i);t.b(" </table>");t.b("\n"+i);t.b(" </div>");t.b("\n"+i);t.b(" </div>");t.b("\n"+i);t.b(' <div class="d2h-file-side-diff">');t.b("\n"+i);t.b(' <div class="d2h-code-wrapper">');t.b("\n"+i);t.b(' <table class="d2h-diff-table">');t.b("\n"+i);t.b(' <tbody class="d2h-diff-tbody">');t.b("\n"+i);t.b(" ");t.b(t.t(t.d("diffs.right",c,p,0)));t.b("\n"+i);t.b(" </tbody>");t.b("\n"+i);t.b(" </table>");t.b("\n"+i);t.b(" </div>");t.b("\n"+i);t.b(" </div>");t.b("\n"+i);t.b(" </div>");t.b("\n"+i);t.b("</div>");return t.fl()},partials:{},subs:{}});defaultTemplates["tag-file-added"]=new hoganExports.Template({code:function(c,p,i){var t=this;t.b(i=i||"");t.b('<span class="d2h-tag d2h-added d2h-added-tag">ADDED</span>');return t.fl()},partials:{},subs:{}});defaultTemplates["tag-file-changed"]=new hoganExports.Template({code:function(c,p,i){var t=this;t.b(i=i||"");t.b('<span class="d2h-tag d2h-changed d2h-changed-tag">CHANGED</span>');return t.fl()},partials:{},subs:{}});defaultTemplates["tag-file-deleted"]=new hoganExports.Template({code:function(c,p,i){var t=this;t.b(i=i||"");t.b('<span class="d2h-tag d2h-deleted d2h-deleted-tag">DELETED</span>');return t.fl()},partials:{},subs:{}});defaultTemplates["tag-file-renamed"]=new hoganExports.Template({code:function(c,p,i){var t=this;t.b(i=i||"");t.b('<span class="d2h-tag d2h-moved d2h-moved-tag">RENAMED</span>');return t.fl()},partials:{},subs:{}});class HoganJsUtils{constructor({compiledTemplates={},rawTemplates={}}){const compiledRawTemplates=Object.entries(rawTemplates).reduce((previousTemplates,[name,templateString])=>{const compiledTemplate=hoganExports.compile(templateString,{asString:false});return Object.assign(Object.assign({},previousTemplates),{[name]:compiledTemplate})},{});this.preCompiledTemplates=Object.assign(Object.assign(Object.assign({},defaultTemplates),compiledTemplates),compiledRawTemplates)}static compile(templateString){return hoganExports.compile(templateString,{asString:false})}render(namespace,view,params,partials,indent){const templateKey=this.templateKey(namespace,view);try{const template2=this.preCompiledTemplates[templateKey];return template2.render(params,partials,indent)}catch(_e){throw new Error(`Could not find template to render '${templateKey}'`)}}template(namespace,view){return this.preCompiledTemplates[this.templateKey(namespace,view)]}templateKey(namespace,view){return`${namespace}-${view}`}}const defaultDiff2HtmlConfig=Object.assign(Object.assign(Object.assign({},defaultLineByLineRendererConfig),defaultSideBySideRendererConfig),{outputFormat:OutputFormatType.LINE_BY_LINE,drawFileList:true});function html(diffInput,configuration={}){const config=Object.assign(Object.assign({},defaultDiff2HtmlConfig),configuration);const diffJson=typeof diffInput==="string"?parse(diffInput,config):diffInput;const hoganUtils=new HoganJsUtils(config);const{colorScheme}=config;const fileListRendererConfig={colorScheme};const fileList=config.drawFileList?new FileListRenderer(hoganUtils,fileListRendererConfig).render(diffJson):"";const diffOutput=config.outputFormat==="side-by-side"?new SideBySideRenderer(hoganUtils,config).render(diffJson):new LineByLineRenderer(hoganUtils,config).render(diffJson);return fileList+diffOutput}const _hoisted_1$2={class:"vibe64-repository-diff"};const _hoisted_2$2=["innerHTML"];const _sfc_main$2={__name:"Vibe64RepositoryDiff",props:{error:{default:"",type:String},loading:{default:false,type:Boolean},payload:{default:null,type:Object}},setup(__props){const props=__props;const rendered=computed(()=>{var _a;const diff=String(((_a=props.payload)==null?void 0:_a.diff)||"");return diff?html(diff,{drawFileList:false,matching:"lines",outputFormat:"side-by-side"}):""});const shownLines=computed(()=>{var _a;return Number(((_a=props.payload)==null?void 0:_a.shownLines)||0)});const totalLines=computed(()=>{var _a;return Number(((_a=props.payload)==null?void 0:_a.totalLines)||0)});const truncated=computed(()=>{var _a;return((_a=props.payload)==null?void 0:_a.truncated)===true});return(_ctx,_cache)=>{return openBlock(),createElementBlock("section",_hoisted_1$2,[__props.loading?(openBlock(),createBlock(VProgressLinear,{key:0,color:"primary",indeterminate:""})):createCommentVNode("",true),__props.error?(openBlock(),createBlock(StudioErrorNotice,{key:1,compact:"",error:__props.error,title:"File changes could not load"},null,8,["error"])):truncated.value?(openBlock(),createBlock(VAlert,{key:2,density:"compact",type:"warning",variant:"tonal"},{default:withCtx(()=>[createTextVNode(" This large file difference is shortened to "+toDisplayString(shownLines.value)+" of "+toDisplayString(totalLines.value)+" lines. ",1)]),_:1})):createCommentVNode("",true),rendered.value?(openBlock(),createElementBlock("div",{key:3,class:"vibe64-repository-diff__rendered",innerHTML:rendered.value},null,8,_hoisted_2$2)):!__props.loading&&!__props.error?(openBlock(),createBlock(VAlert,{key:4,density:"compact",type:"info",variant:"tonal"},{default:withCtx(()=>[..._cache[0]||(_cache[0]=[createTextVNode(" Choose a changed file to see exactly what changed. ",-1)])]),_:1})):createCommentVNode("",true)])}}};const Vibe64RepositoryDiff=_export_sfc(_sfc_main$2,[["__scopeId","data-v-fdf12a43"]]);const _hoisted_1$1=["aria-label"];const _hoisted_2$1={key:0};const _hoisted_3$1={key:0};const _hoisted_4$1=["aria-current","onClick"];const _hoisted_5$1={class:"vibe64-repository-file-browser__path"};const _hoisted_6$1={class:"vibe64-repository-file-browser__meta"};const _hoisted_7$1={class:"vibe64-repository-file-browser__counts"};const _hoisted_8$1={class:"vibe64-repository-file-browser__detail"};const _sfc_main$1={__name:"Vibe64RepositoryFileBrowser",props:{ariaLabel:{default:"Changed files",type:String},embedded:{default:false,type:Boolean},emptyTitle:{default:"Select a file",type:String},error:{default:"",type:String},files:{default:()=>[],type:Array},listDescription:{default:"",type:String},listTitle:{default:"",type:String},loading:{default:false,type:Boolean},loadingMore:{default:false,type:Boolean},payload:{default:null,type:Object},selectedPath:{default:"",type:String},truncated:{default:false,type:Boolean}},emits:["load-more","select"],setup(__props){function fileStatusLabel(value=""){return{A:"Added",C:"Copied",D:"Removed",M:"Changed",R:"Renamed",T:"Type changed",U:"Needs attention"}[String(value||"").slice(0,1).toUpperCase()]||"Changed"}return(_ctx,_cache)=>{return openBlock(),createElementBlock("div",{class:normalizeClass(["vibe64-repository-file-browser",{"vibe64-repository-file-browser--embedded":__props.embedded}])},[createBaseVNode("aside",{"aria-label":__props.ariaLabel,class:"vibe64-repository-file-browser__list"},[__props.listTitle?(openBlock(),createElementBlock("header",_hoisted_2$1,[createBaseVNode("strong",null,toDisplayString(__props.listTitle),1),__props.listDescription?(openBlock(),createElementBlock("span",_hoisted_3$1,toDisplayString(__props.listDescription),1)):createCommentVNode("",true)])):createCommentVNode("",true),(openBlock(true),createElementBlock(Fragment,null,renderList(__props.files,file=>{return openBlock(),createElementBlock("button",{key:file.path,"aria-current":__props.selectedPath===file.path?"true":void 0,class:normalizeClass(["vibe64-repository-file-browser__file",{"vibe64-repository-file-browser__file--active":__props.selectedPath===file.path}]),type:"button",onClick:$event=>_ctx.$emit("select",file)},[createBaseVNode("span",_hoisted_5$1,toDisplayString(file.path),1),createBaseVNode("span",_hoisted_6$1,[createTextVNode(toDisplayString(fileStatusLabel(file.status))+" ",1),createBaseVNode("span",_hoisted_7$1,"+"+toDisplayString(file.added)+" −"+toDisplayString(file.deleted),1)])],10,_hoisted_4$1)}),128)),__props.truncated?(openBlock(),createBlock(VBtn,{key:1,loading:__props.loadingMore,size:"small",type:"button",variant:"text",onClick:_cache[0]||(_cache[0]=$event=>_ctx.$emit("load-more"))},{default:withCtx(()=>[..._cache[1]||(_cache[1]=[createTextVNode(" Load more files ",-1)])]),_:1},8,["loading"])):createCommentVNode("",true)],8,_hoisted_1$1),createBaseVNode("main",_hoisted_8$1,[createBaseVNode("h2",null,toDisplayString(__props.selectedPath||__props.emptyTitle),1),createVNode(Vibe64RepositoryDiff,{error:__props.error,loading:__props.loading,payload:__props.payload},null,8,["error","loading","payload"])])],2)}}};const Vibe64RepositoryFileBrowser=_export_sfc(_sfc_main$1,[["__scopeId","data-v-147b6f7c"]]);function message(error,fallback){return error instanceof Error?error.message:String(error||fallback)}async function requestJson(path,options={}){var _a,_b;if(!path){throw new Error("Repository information is not available yet.")}const result=await getHttpWebClient().request(path,{method:"GET",...options});if((result==null?void 0:result.ok)===false){const error=new Error(vibe64ApiResponseError(result,"Repository information could not be loaded."));error.code=String(result.code||((_b=(_a=result.errors)==null?void 0:_a[0])==null?void 0:_b.code)||"").trim();error.response=result;throw error}return result}function useVibe64RepositoryWorkspace(dashboardContext,{view="changes"}={}){const selectedCurrentPath=ref("");const selectedVersion=ref(null);const selectedVersionPath=ref("");const changes=reactive({error:"",loading:false,loadingMore:false,payload:null});const currentDiff=reactive({error:"",loading:false,payload:null});const history=reactive({error:"",loading:false,nextCursor:"",payload:null,versions:[]});const versionFiles=reactive({error:"",loading:false,loadingMore:false,payload:null});const versionDiff=reactive({error:"",loading:false,payload:null});const updates=reactive({applying:false,canonicalChangePending:false,checking:false,error:"",errorCode:"",payload:null});const saving=ref(false);const requestRevisions=Object.create(null);const updateChecks=new Map;const forcedUpdateFollowups=new Set;let activeChangesRefresh=null;let activeSaveHistoryRefresh=null;let disposed=false;const context=computed(()=>dashboardContext.value||{});const activeView=computed(()=>String(readRefOrGetterValue(view)||"changes")==="history"?"history":"changes");const sessionId=computed(()=>{var _a;return String(context.value.sessionId||((_a=context.value.session)==null?void 0:_a.sessionId)||"").trim()});const sessionsApiPath=computed(()=>String(readRefOrGetterValue(context.value.sessionsApiPath)||"").trim());const sourceOperationsSuspended=computed(()=>readRefOrGetterValue(context.value.sourceOperationsSuspended)===true);let updateAccessRevision=0;function requestContextKey(){return`${sessionsApiPath.value}\0${sessionId.value}`}function updateCheckContextKey(){return`${requestContextKey()}\0${updateAccessRevision}`}function beginRequest(name){const revision=Number(requestRevisions[name]||0)+1;requestRevisions[name]=revision;return{contextKey:requestContextKey(),name,revision}}function requestIsCurrent(request){return!disposed&&(request==null?void 0:request.contextKey)===requestContextKey()&&requestRevisions[request.name]===request.revision}function updateRequestIsCurrent(request){return requestIsCurrent(request)&&(request==null?void 0:request.updateAccessRevision)===updateAccessRevision&&!sourceOperationsSuspended.value}function invalidateRequests(){for(const name of["applyUpdates","changes","currentDiff","history","saveHistory","updates","versionDiff","versionFiles"]){requestRevisions[name]=Number(requestRevisions[name]||0)+1}}function updateCheckIsNewer(candidate={},current={}){const candidateCheck=candidate&&typeof candidate==="object"?candidate:{};const currentCheck=current&&typeof current==="object"?current:{};const candidateTime=Date.parse(String(candidateCheck.checkedAt||""));const currentTime=Date.parse(String(currentCheck.checkedAt||""));if(!Number.isFinite(candidateTime)){return!currentCheck.checkedAt}return!Number.isFinite(currentTime)||candidateTime>=currentTime}async function selectCurrentFile(file){const path=String((file==null?void 0:file.path)||"");selectedCurrentPath.value=path;currentDiff.error="";currentDiff.payload=null;if(!path||!sessionId.value){return}const request=beginRequest("currentDiff");currentDiff.loading=true;try{const result=await requestJson(vibe64SessionChangeDiffPath(sessionsApiPath.value,sessionId.value,path));if(requestIsCurrent(request)&&selectedCurrentPath.value===path){currentDiff.payload=result}}catch(error){if(requestIsCurrent(request)){currentDiff.error=message(error,"This file difference could not be loaded.")}}finally{if(requestIsCurrent(request)){currentDiff.loading=false}}}async function loadChanges({append=false}={}){var _a,_b,_c;changes.error="";if(!append){beginRequest("currentDiff");changes.payload=null;selectedCurrentPath.value="";currentDiff.error="";currentDiff.loading=false;currentDiff.payload=null}if(!sessionId.value){return}const request=beginRequest("changes");changes.loading=!append;changes.loadingMore=append;try{const previousFiles=append?((_a=changes.payload)==null?void 0:_a.files)||[]:[];const result=await requestJson(vibe64SessionChangesPath(sessionsApiPath.value,sessionId.value,{offset:previousFiles.length}));if(!requestIsCurrent(request)){return}changes.payload=append?{...result,files:[...previousFiles,...result.files||[]]}:result;if(!append&&typeof context.value.refreshSessionWork==="function"){const observedWork={...result};delete observedWork.initialDiff;await context.value.refreshSessionWork(observedWork)}const first=!append?(_c=(_b=changes.payload)==null?void 0:_b.files)==null?void 0:_c[0]:null;if(first){const initialDiff=result.initialDiff&&typeof result.initialDiff==="object"?result.initialDiff:null;if(String((initialDiff==null?void 0:initialDiff.path)||"")===String(first.path||"")){selectedCurrentPath.value=first.path;currentDiff.payload=initialDiff}else{void selectCurrentFile(first)}}}catch(error){if(requestIsCurrent(request)){changes.error=message(error,"Current changes could not be loaded.")}}finally{if(requestIsCurrent(request)){changes.loading=false;changes.loadingMore=false}}}function requestChangesRefresh(){const contextKey=requestContextKey();if((activeChangesRefresh==null?void 0:activeChangesRefresh.contextKey)===contextKey){activeChangesRefresh.refreshAfterActive=true;return activeChangesRefresh.promise}const refresh={contextKey,promise:null,refreshAfterActive:false};refresh.promise=loadChanges().finally(()=>{if(activeChangesRefresh!==refresh){return}activeChangesRefresh=null;if(refresh.refreshAfterActive&&!disposed&&refresh.contextKey===requestContextKey()&&activeView.value==="changes"&&!sourceOperationsSuspended.value){void requestChangesRefresh()}});activeChangesRefresh=refresh;return refresh.promise}async function selectVersion(version){var _a,_b,_c,_d,_e;const request=beginRequest("versionFiles");beginRequest("versionDiff");if(((_a=selectedVersion.value)==null?void 0:_a.commit)!==(version==null?void 0:version.commit)){versionFiles.error=""}selectedVersion.value=version||null;selectedVersionPath.value="";versionFiles.loading=false;versionFiles.loadingMore=false;versionFiles.payload=null;versionDiff.error="";versionDiff.loading=false;versionDiff.payload=null;if(!(version==null?void 0:version.commit)||!((_b=history.payload)==null?void 0:_b.historySnapshotCommit)){return}versionFiles.loading=true;try{const result=await requestJson(vibe64RepositoryVersionFilesPath(sessionsApiPath.value,version.commit,{historySnapshotCommit:history.payload.historySnapshotCommit,sessionId:sessionId.value}));if(!requestIsCurrent(request)||((_c=selectedVersion.value)==null?void 0:_c.commit)!==version.commit){return}versionFiles.payload=result;versionFiles.error="";versionFiles.loading=false;const first=(_e=(_d=versionFiles.payload)==null?void 0:_d.files)==null?void 0:_e[0];if(first){await selectVersionFile(first)}}catch(error){if(requestIsCurrent(request)){versionFiles.error=message(error,"This version could not be loaded.")}}finally{if(requestIsCurrent(request)){versionFiles.loading=false}}}async function loadMoreVersionFiles(){var _a,_b,_c;if(versionFiles.loading||versionFiles.loadingMore||!((_a=versionFiles.payload)==null?void 0:_a.truncated)||!((_b=selectedVersion.value)==null?void 0:_b.commit)||!((_c=history.payload)==null?void 0:_c.historySnapshotCommit)){return}versionFiles.loadingMore=true;versionFiles.error="";const request=beginRequest("versionFiles");try{const previousFiles=versionFiles.payload.files||[];const result=await requestJson(vibe64RepositoryVersionFilesPath(sessionsApiPath.value,selectedVersion.value.commit,{historySnapshotCommit:history.payload.historySnapshotCommit,offset:previousFiles.length,sessionId:sessionId.value}));if(!requestIsCurrent(request)){return}versionFiles.payload={...result,files:[...previousFiles,...result.files||[]]}}catch(error){if(requestIsCurrent(request)){versionFiles.error=message(error,"More files from this version could not be loaded.")}}finally{if(requestIsCurrent(request)){versionFiles.loadingMore=false}}}async function selectVersionFile(file){var _a,_b,_c;const path=String((file==null?void 0:file.path)||"");selectedVersionPath.value=path;versionDiff.error="";versionDiff.payload=null;if(!path||!((_a=selectedVersion.value)==null?void 0:_a.commit)||!((_b=history.payload)==null?void 0:_b.historySnapshotCommit)){return}const request=beginRequest("versionDiff");const versionCommit=selectedVersion.value.commit;versionDiff.loading=true;try{const result=await requestJson(vibe64RepositoryVersionDiffPath(sessionsApiPath.value,selectedVersion.value.commit,path,{historySnapshotCommit:history.payload.historySnapshotCommit,sessionId:sessionId.value}));if(requestIsCurrent(request)&&((_c=selectedVersion.value)==null?void 0:_c.commit)===versionCommit&&selectedVersionPath.value===path){versionDiff.payload=result}}catch(error){if(requestIsCurrent(request)){versionDiff.error=message(error,"This file difference could not be loaded.")}}finally{if(requestIsCurrent(request)){versionDiff.loading=false}}}async function loadHistory({append=false}={}){if(!sessionId.value){history.error="";history.payload=null;history.versions=[];history.nextCursor="";return}const request=beginRequest("history");history.loading=true;try{const result=await requestJson(vibe64RepositoryHistoryPath(sessionsApiPath.value,{cursor:append?history.nextCursor:"",sessionId:sessionId.value}));if(!requestIsCurrent(request)){return}history.error="";history.payload=append&&history.payload?{...result,versions:[...history.versions,...result.versions||[]]}:result;history.versions=history.payload.versions||[];history.nextCursor=result.nextCursor||"";if(!append&&result.updateCheck&&updateCheckIsNewer(result.updateCheck,updates.payload)){updates.payload={...result.updateCheck,cached:true}}}catch(error){if(requestIsCurrent(request)){history.error=message(error,"Version history could not be loaded.")}}finally{if(requestIsCurrent(request)){history.loading=false}}}async function checkForUpdates({force=true}={}){if(!sessionId.value||updates.applying||sourceOperationsSuspended.value){return false}const contextKey=updateCheckContextKey();const active=updateChecks.get(contextKey);if(active){if(force&&active.force!==true){forcedUpdateFollowups.add(contextKey)}return active.promise}const request={...beginRequest("updates"),updateAccessRevision};updates.checking=true;updates.error="";updates.errorCode="";const promise=(async()=>{var _a;try{const result=await requestJson(vibe64SessionCheckUpdatesPath(sessionsApiPath.value,sessionId.value),{body:{force},method:"POST"}).finally(async()=>{while(updateRequestIsCurrent(request)&&(activeSaveHistoryRefresh==null?void 0:activeSaveHistoryRefresh.contextKey)===request.contextKey){await activeSaveHistoryRefresh.settled}});if(!updateRequestIsCurrent(request)){return false}updates.payload=result;updates.canonicalChangePending=false;if(activeView.value==="changes"){if(!changes.payload||String(changes.payload.canonicalCommit||"").trim()!==String(result.canonicalCommit||"").trim()){await requestChangesRefresh()}}else if(!history.payload||String(result.canonicalCommit||"").trim()!==String(((_a=history.payload)==null?void 0:_a.historySnapshotCommit)||"").trim()){await loadHistory()}return result}catch(error){if(updateRequestIsCurrent(request)){updates.error=message(error,"Updates could not be checked.");updates.errorCode=String((error==null?void 0:error.code)||"").trim();if(activeView.value==="changes"&&!changes.payload){await requestChangesRefresh()}}return false}finally{if(updateRequestIsCurrent(request)){updates.checking=false}const registered=updateChecks.get(contextKey);if((registered==null?void 0:registered.promise)===promise){updateChecks.delete(contextKey)}if(!disposed&&forcedUpdateFollowups.delete(contextKey)&&contextKey===updateCheckContextKey()){void checkForUpdates({force:true})}}})();updateChecks.set(contextKey,{force,promise});return promise}async function applyUpdates(){var _a;const requestUpdateWork=context.value.requestUpdateWork;if(!sessionId.value||sourceOperationsSuspended.value||updates.checking||updates.applying||!(updates.canonicalChangePending||((_a=updates.payload)==null?void 0:_a.updateAvailable)===true)||typeof requestUpdateWork!=="function"){return false}updates.applying=true;updates.error="";updates.errorCode="";const request=beginRequest("applyUpdates");try{const result=await requestUpdateWork();if(!requestIsCurrent(request)){return false}if(result===false||(result==null?void 0:result.ok)===false){throw new Error("This session could not be updated.")}updates.payload=result;updates.canonicalChangePending=false;if(activeView.value==="history"){await loadHistory()}else{await requestChangesRefresh()}return result}catch(error){if(requestIsCurrent(request)){updates.error=message(error,"This session could not be updated.");updates.errorCode=String((error==null?void 0:error.code)||"").trim()}return false}finally{if(requestIsCurrent(request)){updates.applying=false}}}async function saveWork(){var _a,_b;const requestSaveWork=context.value.requestSaveWork;if(!sessionId.value||context.value.assistantDirectAllowed===false||sourceOperationsSuspended.value||saving.value||updates.checking||updates.applying||updates.canonicalChangePending||updates.error||!updates.payload||((_a=updates.payload)==null?void 0:_a.updateAvailable)===true||changes.error||changes.loading||((_b=changes.payload)==null?void 0:_b.unsaved)!==true||typeof requestSaveWork!=="function"){return false}saving.value=true;try{return await requestSaveWork()}finally{saving.value=false}}watch([sessionsApiPath,sessionId,activeView],async([apiPath])=>{invalidateRequests();activeSaveHistoryRefresh==null?void 0:activeSaveHistoryRefresh.settle();activeSaveHistoryRefresh=null;changes.error="";changes.loading=false;changes.loadingMore=false;changes.payload=null;currentDiff.error="";currentDiff.loading=false;currentDiff.payload=null;history.error="";history.loading=false;history.nextCursor="";history.payload=null;history.versions=[];selectedCurrentPath.value="";selectedVersion.value=null;selectedVersionPath.value="";versionDiff.error="";versionDiff.loading=false;versionDiff.payload=null;versionFiles.error="";versionFiles.loading=false;versionFiles.loadingMore=false;versionFiles.payload=null;updates.applying=false;updates.checking=false;updates.error="";updates.errorCode="";updates.payload=null;updates.canonicalChangePending=false;if(apiPath&&sessionId.value){const initialContext=requestContextKey();if(activeView.value==="history"){await loadHistory();if(disposed||initialContext!==requestContextKey()){return}}else if(!sourceOperationsSuspended.value){await requestChangesRefresh();if(disposed||initialContext!==requestContextKey()){return}}if(!sourceOperationsSuspended.value){void checkForUpdates({force:false})}}},{immediate:true});watch(sourceOperationsSuspended,async(suspended,wasSuspended)=>{if(suspended){updateAccessRevision+=1;updates.checking=false;return}if(wasSuspended!==true){return}updateAccessRevision+=1;if(sessionId.value){const releasedContext=requestContextKey();if(activeView.value==="changes"){await requestChangesRefresh();if(disposed||releasedContext!==requestContextKey()||sourceOperationsSuspended.value){return}}void checkForUpdates({force:false})}},{flush:"sync",immediate:true});useRealtimeEvent({enabled:computed(()=>Boolean(sessionId.value)),event:VIBE64_SESSION_CHANGED_EVENT,matches:({payload={}}={})=>repositoryStatusSessionId(payload)===sessionId.value&&repositoryStatusRealtimeShouldRefresh(payload),onEvent:async({payload={}}={})=>{const reason=String((payload==null?void 0:payload.reason)||"").trim();const checkCanonical=repositoryStatusRealtimeNeedsCanonicalCheck(payload)||["session-repository-checked","session-save-completed","session-update-completed"].includes(reason);if(repositoryStatusRealtimeNeedsCanonicalCheck(payload)){updates.canonicalChangePending=true}if(activeView.value==="history"&&reason==="session-save-completed"){const refresh=beginRequest("saveHistory");refresh.settled=new Promise(resolve=>{refresh.settle=resolve});activeSaveHistoryRefresh==null?void 0:activeSaveHistoryRefresh.settle();activeSaveHistoryRefresh=refresh;try{await loadHistory()}finally{if(activeSaveHistoryRefresh===refresh){activeSaveHistoryRefresh=null}refresh.settle()}if(!requestIsCurrent(refresh)){return}}else if(activeView.value==="changes"&&!checkCanonical){void requestChangesRefresh()}if(checkCanonical){void checkForUpdates({force:repositoryStatusRealtimeNeedsCanonicalCheck(payload)})}}});onScopeDispose(()=>{disposed=true;invalidateRequests();activeChangesRefresh=null;activeSaveHistoryRefresh==null?void 0:activeSaveHistoryRefresh.settle();activeSaveHistoryRefresh=null;updateChecks.clear();forcedUpdateFollowups.clear()});useRealtimeEvent({enabled:computed(()=>Boolean(sessionId.value)&&activeView.value==="changes"),event:VIBE64_SOURCE_EDITOR_FILE_CHANGED_EVENT,matches:({payload={}}={})=>repositoryStatusSessionId(payload)===sessionId.value,onEvent:()=>{void requestChangesRefresh()}});return{applyUpdates,changes,checkForUpdates,currentDiff,history,loadChanges,loadHistory,loadMoreVersionFiles,saveWork,saving,selectCurrentFile,selectedCurrentPath,selectedVersion,selectedVersionPath,selectVersion,selectVersionFile,sessionId,sourceOperationsSuspended,updates,versionDiff,versionFiles}}const _hoisted_1={class:"vibe64-repository-workspace__header"};const _hoisted_2={class:"vibe64-repository-workspace__actions"};const _hoisted_3={class:"vibe64-repository-workspace__changes-area"};const _hoisted_4={key:0,"aria-label":"Saved versions this session needs",class:"vibe64-repository-workspace__incoming-versions"};const _hoisted_5={key:1};const _hoisted_6={class:"vibe64-repository-workspace__summary-copy"};const _hoisted_7={class:"vibe64-repository-workspace__actions"};const _hoisted_8={class:"vibe64-repository-workspace__window"};const _hoisted_9={key:0,class:"vibe64-repository-workspace__changes"};const _hoisted_10={key:0,class:"vibe64-repository-workspace__empty"};const _hoisted_11={key:4,class:"vibe64-repository-workspace__empty"};const _hoisted_12={key:1};const _hoisted_13={key:2,class:"vibe64-repository-workspace__history"};const _hoisted_14={class:"vibe64-repository-workspace__history-intro"};const _hoisted_15={class:"vibe64-repository-workspace__history-heading"};const _hoisted_16={"aria-hidden":"true",class:"vibe64-repository-workspace__history-icon"};const _hoisted_17={class:"vibe64-repository-workspace__versions","aria-label":"Saved versions"};const _hoisted_18=["aria-current","aria-label","onClick"];const _hoisted_19={class:"vibe64-repository-workspace__version-copy"};const _hoisted_20={class:"vibe64-repository-workspace__version-heading"};const _hoisted_21={class:"vibe64-repository-workspace__version-meta"};const _hoisted_22={key:0,class:"vibe64-repository-workspace__load-more"};const _hoisted_23={key:3,class:"vibe64-repository-workspace__empty"};const _hoisted_24={"aria-hidden":"true",class:"vibe64-repository-version-dialog__icon"};const _hoisted_25={class:"vibe64-repository-version-dialog__heading"};const _hoisted_26={class:"vibe64-repository-version-dialog__eyebrow"};const _hoisted_27={key:0,class:"vibe64-repository-version-dialog__meta"};const _sfc_main={__name:"Vibe64RepositoryWorkspace",props:{dashboardContext:{default:()=>({}),type:Object},view:{default:"changes",type:String,validator:value=>["changes","history"].includes(value)}},setup(__props){const props=__props;const dashboard=computed(()=>props.dashboardContext||{});const view=computed(()=>props.view==="history"?"history":"changes");const versionSheetOpen=ref(false);const{applyUpdates,changes,checkForUpdates,currentDiff,history,loadHistory,loadChanges,loadMoreVersionFiles,saveWork,saving,selectCurrentFile,selectedCurrentPath,selectedVersion,selectedVersionPath,selectVersion,selectVersionFile,sessionId,sourceOperationsSuspended,updates,versionDiff,versionFiles}=useVibe64RepositoryWorkspace(dashboard,{view});const versionFileCountLabel=computed(()=>{var _a;const count=Number(((_a=versionFiles.payload)==null?void 0:_a.totalCount)||0);return`${count} changed ${count===1?"file":"files"}`});const pageTitle=computed(()=>view.value==="history"?"Repository":"Current changes");const pageDescription=computed(()=>view.value==="history"?"Review saved versions and bring this session up to date.":"Review exactly what this session changes before saving it.");const repositoryStatus=computed(()=>updates.payload||changes.payload||null);const repositoryOperationBusy=computed(()=>Boolean(!sessionId.value||sourceOperationsSuspended.value||updates.checking||updates.applying||saving.value));const saveWorkDisabled=computed(()=>{var _a,_b;return Boolean(repositoryOperationBusy.value||dashboard.value.assistantDirectAllowed===false||updates.canonicalChangePending||updates.error||!updates.payload||((_a=repositoryStatus.value)==null?void 0:_a.updateAvailable)===true||changes.error||changes.loading||((_b=changes.payload)==null?void 0:_b.unsaved)!==true||typeof dashboard.value.requestSaveWork!=="function")});const saveWorkTitle=computed(()=>{var _a,_b;if(dashboard.value.assistantDirectAllowed===false){return dashboard.value.assistantRestrictionMessage}if(sourceOperationsSuspended.value){return"Session renewal is safely using this session’s source"}if(updates.applying||saving.value){return"Wait for the current repository operation to finish"}if(updates.checking||updates.canonicalChangePending){return"Checking the latest saved project version"}if(updates.error||!updates.payload||changes.error){return"Repository status is unavailable; check for updates before saving"}if(((_a=repositoryStatus.value)==null?void 0:_a.updateAvailable)===true){return"Update this session (rebase) before saving"}if(changes.loading){return"Checking whether this session has work to save"}if(((_b=changes.payload)==null?void 0:_b.unsaved)!==true){return"No work to save"}return"Save this session's work to the project repository"});const repositorySummaryTitle=computed(()=>{var _a;if(!sessionId.value){return"Project versions"}if(changes.loading){return"Checking this session…"}if(updates.checking||updates.canonicalChangePending){return"Checking the latest saved project version…"}if(updates.error||!updates.payload){return"Saved project status unavailable"}if(changes.error||!changes.payload){return"Save status unavailable"}return((_a=changes.payload)==null?void 0:_a.unsaved)?"This session has unsaved work":"This session is saved"});const repositorySummaryDetail=computed(()=>{var _a,_b,_c;if(!sessionId.value){return"Select a session to see its work. Saved project history remains available."}if(changes.loading){return"Comparing this session with the project’s saved version."}if(updates.checking||updates.canonicalChangePending){return"Save will be available after the latest project version has been checked."}if(updates.error||!updates.payload){return"Save is unavailable until Vibe64 can safely compare this session with the saved project."}if(changes.error||!changes.payload){return"Check for updates to compare this session with the project’s saved version."}const count=Number(((_a=changes.payload)==null?void 0:_a.totalCount)||0);const behind=Number(((_b=repositoryStatus.value)==null?void 0:_b.behind)||0);if(behind>0){if(((_c=changes.payload)==null?void 0:_c.unsaved)===true){return`${behind} newer saved ${behind===1?"version is":"versions are"} available. Update this session (rebase) will preserve its unsaved work.`}return`${behind} newer saved ${behind===1?"version is":"versions are"} available. Update this session (rebase) to use ${behind===1?"it":"them"}.`}if(count>0){return`${count} ${count===1?"file differs":"files differ"} from the project’s saved version.`}return"No files differ from the project’s saved version."});const repositoryUpdateTitle=computed(()=>{if(!sessionId.value){return"No session selected"}if(updates.checking){return"Checking for updates…"}if(updates.error){return"Update status unavailable"}if(history.loading&&!history.payload){return"Loading update status…"}if(!repositoryStatus.value){return"Updates have not been checked"}const relationship=repositoryUpdateRelationship(repositoryStatus.value.ahead,repositoryStatus.value.behind);const ahead=Number(repositoryStatus.value.ahead||0);const behind=Number(repositoryStatus.value.behind||0);if(relationship==="diverged"){return"This session and the saved project have both changed"}if(behind>0){return`${behind} ${behind===1?"update":"updates"} available`}if(relationship==="ahead"&&ahead>0){return"This session has work not in the saved project"}return"This session is up to date"});const repositoryIncomingVersions=computed(()=>{var _a,_b,_c;const relationship=repositoryUpdateRelationship((_a=repositoryStatus.value)==null?void 0:_a.ahead,(_b=repositoryStatus.value)==null?void 0:_b.behind);return relationship==="behind"&&Array.isArray((_c=repositoryStatus.value)==null?void 0:_c.incomingVersions)?repositoryStatus.value.incomingVersions:[]});const repositoryIncomingVersionsRemainder=computed(()=>{var _a;return Math.max(0,Number(((_a=repositoryStatus.value)==null?void 0:_a.behind)||0)-repositoryIncomingVersions.value.length)});const repositoryUpdateDetail=computed(()=>{var _a;if(!sessionId.value){return"Select a session to check it against the project’s saved version."}if(updates.checking){return"Reading the latest saved project version."}if(updates.error){return"Review the problem below, then try checking again."}if(history.loading&&!history.payload){return"Reading the last successful update check for this session."}if(!repositoryStatus.value){return"Use Check for updates to compare this session with the latest saved project version."}const relationship=repositoryUpdateRelationship(repositoryStatus.value.ahead,repositoryStatus.value.behind);const ahead=Number(repositoryStatus.value.ahead||0);const behind=Number(repositoryStatus.value.behind||0);const checked=repositoryStatus.value.checkedAt?` Last checked ${formatVersionDate(repositoryStatus.value.checkedAt)}.`:"";if(relationship==="diverged"){return`Someone saved new project work after this session started, and this session also has its own saved work. Vibe64 cannot simply move it forward. Update this session (rebase) will try to combine both without discarding either. If the same files conflict, nothing changes and Temporary AI can help.${checked}`}if(behind>0){const updateEffect=((_a=changes.payload)==null?void 0:_a.unsaved)===true?"will replay its unsaved work on the latest saved version before Save is allowed":"will move it to the latest saved version";return`This session is ${behind} saved ${behind===1?"version":"versions"} behind. Update this session (rebase) ${updateEffect}.${checked}`}if(relationship==="ahead"&&ahead>0){return`There are no incoming updates. This session contains ${ahead} ${ahead===1?"version":"versions"} not yet in the saved project.${checked}`}return`It already includes the latest saved project version.${checked}`});const canResolveUpdateWithTemporaryAi=computed(()=>["vibe64_session_update_conflict","vibe64_session_update_history_diverged"].includes(String(updates.errorCode||"").trim()));const resolvingUpdateProblem=ref(false);function formatVersionDate(value=""){const parsed=new Date(value);return Number.isNaN(parsed.getTime())?"Unknown time":new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"short"}).format(parsed)}function versionButtonLabel(version={},index=-1){const parts=[index===0?"Latest saved version":"Saved version",version.message||"Saved work",version.author||"Unknown author",formatVersionDate(version.committedAt),version.shortCommit];if(version.isMerge){parts.splice(1,0,"merge")}return parts.filter(Boolean).join(", ")}async function resolveUpdateProblem(){if(resolvingUpdateProblem.value||dashboard.value.assistantDirectAllowed===false||typeof dashboard.value.requestTemporaryAi!=="function"){return false}resolvingUpdateProblem.value=true;try{return await dashboard.value.requestTemporaryAi({code:updates.errorCode,error:updates.error,title:"Resolve repository update"})}finally{resolvingUpdateProblem.value=false}}async function openVersion(version){versionSheetOpen.value=true;await selectVersion(version)}function closeVersion(){versionSheetOpen.value=false;void selectVersion(null)}return(_ctx,_cache)=>{var _a,_b,_c;return openBlock(),createElementBlock("section",{class:normalizeClass(["vibe64-repository-workspace",{"vibe64-repository-workspace--changes":view.value==="changes"}])},[createBaseVNode("header",_hoisted_1,[createBaseVNode("div",null,[createBaseVNode("h1",null,toDisplayString(pageTitle.value),1),createBaseVNode("p",null,toDisplayString(pageDescription.value),1)]),createBaseVNode("div",_hoisted_2,[createVNode(VBtn,{disabled:repositoryOperationBusy.value,loading:unref(updates).checking,"prepend-icon":unref(mdiCloudRefreshOutline),size:"small",type:"button",variant:"tonal",onClick:unref(checkForUpdates)},{default:withCtx(()=>[..._cache[5]||(_cache[5]=[createTextVNode(" Check for updates ",-1)])]),_:1},8,["disabled","loading","prepend-icon","onClick"]),view.value==="history"&&(((_a=repositoryStatus.value)==null?void 0:_a.updateAvailable)||unref(updates).canonicalChangePending)?(openBlock(),createBlock(VBtn,{key:0,disabled:repositoryOperationBusy.value,loading:unref(updates).applying,"prepend-icon":unref(mdiSourcePull),size:"small",type:"button",variant:"tonal",onClick:unref(applyUpdates)},{default:withCtx(()=>[..._cache[6]||(_cache[6]=[createTextVNode(" Update this session (rebase) ",-1)])]),_:1},8,["disabled","loading","prepend-icon","onClick"])):createCommentVNode("",true)])]),createBaseVNode("section",_hoisted_3,[view.value==="history"?(openBlock(),createBlock(VSheet,{key:0,"aria-live":"polite",border:"",class:"vibe64-repository-workspace__update-status",role:"status",rounded:"lg"},{default:withCtx(()=>[createBaseVNode("strong",null,toDisplayString(repositoryUpdateTitle.value),1),createBaseVNode("span",null,toDisplayString(repositoryUpdateDetail.value),1),repositoryIncomingVersions.value.length?(openBlock(),createElementBlock("ol",_hoisted_4,[(openBlock(true),createElementBlock(Fragment,null,renderList(repositoryIncomingVersions.value,version=>{return openBlock(),createElementBlock("li",{key:version.commit},[createVNode(VIcon,{"aria-hidden":"true",icon:version.isMerge?unref(mdiSourceMerge):unref(mdiSourceCommit),size:"15"},null,8,["icon"]),createBaseVNode("span",null,toDisplayString(version.message||"Saved work"),1),createBaseVNode("code",null,toDisplayString(version.shortCommit),1)])}),128))])):createCommentVNode("",true),repositoryIncomingVersions.value.length&&repositoryIncomingVersionsRemainder.value>0?(openBlock(),createElementBlock("span",_hoisted_5," And "+toDisplayString(repositoryIncomingVersionsRemainder.value)+" older "+toDisplayString(repositoryIncomingVersionsRemainder.value===1?"update":"updates")+". ",1)):createCommentVNode("",true)]),_:1})):createCommentVNode("",true),view.value==="changes"?(openBlock(),createBlock(VSheet,{key:1,border:"",class:"vibe64-repository-workspace__summary",rounded:"lg"},{default:withCtx(()=>{var _a2,_b2;return[createBaseVNode("div",_hoisted_6,[createBaseVNode("strong",null,toDisplayString(repositorySummaryTitle.value),1),createBaseVNode("span",null,toDisplayString(repositorySummaryDetail.value),1)]),createBaseVNode("div",_hoisted_7,[((_a2=repositoryStatus.value)==null?void 0:_a2.updateAvailable)||unref(updates).canonicalChangePending?(openBlock(),createBlock(VBtn,{key:0,disabled:repositoryOperationBusy.value,loading:unref(updates).applying,"prepend-icon":unref(mdiSourcePull),size:"small",type:"button",variant:"tonal",onClick:unref(applyUpdates)},{default:withCtx(()=>[..._cache[7]||(_cache[7]=[createTextVNode(" Update this session (rebase) ",-1)])]),_:1},8,["disabled","loading","prepend-icon","onClick"])):createCommentVNode("",true),createVNode(VBtn,{color:((_b2=unref(changes).payload)==null?void 0:_b2.unsaved)===true?"error":void 0,disabled:saveWorkDisabled.value,loading:unref(saving),"prepend-icon":unref(mdiContentSaveOutline),size:"small",type:"button",title:saveWorkTitle.value,variant:"tonal",onClick:unref(saveWork)},{default:withCtx(()=>[..._cache[8]||(_cache[8]=[createTextVNode(" Save work ",-1)])]),_:1},8,["color","disabled","loading","prepend-icon","title","onClick"])])]}),_:1})):createCommentVNode("",true),unref(updates).error?(openBlock(),createBlock(StudioErrorNotice,{key:2,compact:"",error:unref(updates).error,title:"Project updates need attention"},{actions:withCtx(()=>[canResolveUpdateWithTemporaryAi.value&&typeof dashboard.value.requestTemporaryAi==="function"?(openBlock(),createBlock(Vibe64TemporaryAiFixAction,{key:0,disabled:resolvingUpdateProblem.value||dashboard.value.assistantDirectAllowed===false,pending:resolvingUpdateProblem.value,title:dashboard.value.assistantDirectAllowed===false?dashboard.value.assistantRestrictionMessage:"Open temporary AI to resolve this repository update",onClick:resolveUpdateProblem},null,8,["disabled","pending","title"])):createCommentVNode("",true)]),_:1},8,["error"])):createCommentVNode("",true),createBaseVNode("div",_hoisted_8,[view.value==="changes"?(openBlock(),createElementBlock("section",_hoisted_9,[!unref(sessionId)?(openBlock(),createElementBlock("div",_hoisted_10,[..._cache[9]||(_cache[9]=[createBaseVNode("strong",null,"No session selected",-1),createBaseVNode("span",null,"Create or select a session to see its current changes.",-1)])])):unref(changes).error?(openBlock(),createBlock(StudioErrorNotice,{key:1,compact:"",error:unref(changes).error,title:"Current changes could not load"},null,8,["error"])):unref(changes).loading?(openBlock(),createBlock(VProgressLinear,{key:2,color:"primary",indeterminate:""})):((_c=(_b=unref(changes).payload)==null?void 0:_b.files)==null?void 0:_c.length)?(openBlock(),createBlock(Vibe64RepositoryFileBrowser,{key:3,"aria-label":"Changed files","empty-title":"File changes",error:unref(currentDiff).error,files:unref(changes).payload.files,"list-description":"Compared with the project’s saved version","list-title":`${unref(changes).payload.totalCount} changed ${unref(changes).payload.totalCount===1?"file":"files"}`,loading:unref(currentDiff).loading,"loading-more":unref(changes).loadingMore,payload:unref(currentDiff).payload,"selected-path":unref(selectedCurrentPath),truncated:unref(changes).payload.truncated,onLoadMore:_cache[0]||(_cache[0]=$event=>unref(loadChanges)({append:true})),onSelect:unref(selectCurrentFile)},null,8,["error","files","list-title","loading","loading-more","payload","selected-path","truncated","onSelect"])):(openBlock(),createElementBlock("div",_hoisted_11,[..._cache[10]||(_cache[10]=[createBaseVNode("strong",null,"No unsaved file changes",-1),createBaseVNode("span",null,"This session has no file changes waiting to be saved.",-1)])]))])):(openBlock(),createElementBlock("section",_hoisted_12,[unref(history).error?(openBlock(),createBlock(StudioErrorNotice,{key:0,compact:"",error:unref(history).error,title:"Version history could not load"},createSlots({_:2},[!unref(history).payload?{name:"actions",fn:withCtx(()=>[createVNode(VBtn,{"aria-busy":unref(history).loading?"true":void 0,disabled:unref(history).loading,size:"small",type:"button",variant:"tonal",onClick:_cache[1]||(_cache[1]=$event=>unref(loadHistory)())},{default:withCtx(()=>[createTextVNode(toDisplayString(unref(history).loading?"Retrying…":"Retry history"),1)]),_:1},8,["aria-busy","disabled"])]),key:"0"}:void 0]),1032,["error"])):createCommentVNode("",true),unref(history).loading&&!unref(history).payload&&!unref(history).error?(openBlock(),createBlock(VProgressLinear,{key:1,color:"primary",indeterminate:""})):unref(history).versions.length?(openBlock(),createElementBlock("div",_hoisted_13,[createBaseVNode("div",_hoisted_14,[createBaseVNode("div",_hoisted_15,[createBaseVNode("span",_hoisted_16,[createVNode(VIcon,{icon:unref(mdiSourceCommit),size:"18"},null,8,["icon"])]),_cache[11]||(_cache[11]=createBaseVNode("div",null,[createBaseVNode("strong",null,"Saved versions"),createBaseVNode("span",null,"Newest first. Open a version to review its files.")],-1))]),createVNode(VChip,{label:"",size:"x-small",variant:"tonal"},{default:withCtx(()=>[createTextVNode(toDisplayString(unref(history).versions.length)+" loaded ",1)]),_:1})]),createBaseVNode("ol",_hoisted_17,[(openBlock(true),createElementBlock(Fragment,null,renderList(unref(history).versions,(version,index)=>{var _a2;return openBlock(),createElementBlock("li",{key:version.commit,class:"vibe64-repository-workspace__history-item"},[createBaseVNode("span",{"aria-hidden":"true",class:normalizeClass(["vibe64-repository-workspace__commit-marker",{"vibe64-repository-workspace__commit-marker--first":index===0,"vibe64-repository-workspace__commit-marker--last":index===unref(history).versions.length-1}])},[createBaseVNode("span",{class:normalizeClass(["vibe64-repository-workspace__commit-node",{"vibe64-repository-workspace__commit-node--latest":index===0}])},[createVNode(VIcon,{icon:version.isMerge?unref(mdiSourceMerge):unref(mdiSourceCommit),size:"15"},null,8,["icon"])],2)],2),createBaseVNode("button",{"aria-current":versionSheetOpen.value&&((_a2=unref(selectedVersion))==null?void 0:_a2.commit)===version.commit?"true":void 0,"aria-label":versionButtonLabel(version,index),class:"vibe64-repository-workspace__version",type:"button",onClick:$event=>openVersion(version)},[createBaseVNode("span",_hoisted_19,[createBaseVNode("span",_hoisted_20,[createBaseVNode("strong",null,toDisplayString(version.message||"Saved work"),1),index===0?(openBlock(),createBlock(VChip,{key:0,color:"primary",label:"",size:"x-small",variant:"tonal"},{default:withCtx(()=>[..._cache[12]||(_cache[12]=[createTextVNode(" Latest ",-1)])]),_:1})):createCommentVNode("",true),version.isMerge?(openBlock(),createBlock(VChip,{key:1,label:"",size:"x-small",variant:"outlined"},{default:withCtx(()=>[..._cache[13]||(_cache[13]=[createTextVNode(" Merge ",-1)])]),_:1})):createCommentVNode("",true)]),createBaseVNode("span",_hoisted_21,[createBaseVNode("span",null,[createVNode(VIcon,{icon:unref(mdiAccountOutline),size:"15"},null,8,["icon"]),createTextVNode(" "+toDisplayString(version.author||"Unknown author"),1)]),createBaseVNode("span",null,[createVNode(VIcon,{icon:unref(mdiClockOutline),size:"15"},null,8,["icon"]),createTextVNode(" "+toDisplayString(formatVersionDate(version.committedAt)),1)]),createBaseVNode("code",null,toDisplayString(version.shortCommit),1)])]),createVNode(VIcon,{"aria-hidden":"true",icon:unref(mdiChevronRight),size:"20"},null,8,["icon"])],8,_hoisted_18)])}),128)),unref(history).nextCursor?(openBlock(),createElementBlock("li",_hoisted_22,[createVNode(VBtn,{loading:unref(history).loading,size:"small",type:"button",variant:"text",onClick:_cache[2]||(_cache[2]=$event=>unref(loadHistory)({append:true}))},{default:withCtx(()=>[..._cache[14]||(_cache[14]=[createTextVNode(" Load older versions ",-1)])]),_:1},8,["loading"])])):createCommentVNode("",true)])])):!unref(history).error?(openBlock(),createElementBlock("div",_hoisted_23,[..._cache[15]||(_cache[15]=[createBaseVNode("strong",null,"No saved versions yet",-1),createBaseVNode("span",null,"Versions will appear here after work is saved.",-1)])])):createCommentVNode("",true)]))])]),createVNode(VDialog,{"model-value":versionSheetOpen.value,class:"vibe64-repository-version-dialog",fullscreen:"",scrollable:"",transition:"dialog-bottom-transition","onUpdate:modelValue":_cache[4]||(_cache[4]=$event=>!$event&&closeVersion())},{default:withCtx(()=>[createVNode(VCard,{class:"vibe64-repository-version-dialog__card"},{default:withCtx(()=>[createVNode(VCardTitle,{class:"vibe64-repository-version-dialog__header"},{default:withCtx(()=>{var _a2,_b2,_c2;return[createBaseVNode("span",_hoisted_24,[createVNode(VIcon,{icon:((_a2=unref(selectedVersion))==null?void 0:_a2.isMerge)?unref(mdiSourceMerge):unref(mdiSourceCommit),size:"22"},null,8,["icon"])]),createBaseVNode("div",_hoisted_25,[createBaseVNode("span",_hoisted_26,toDisplayString(((_b2=unref(selectedVersion))==null?void 0:_b2.isMerge)?"Merge version":"Saved version"),1),createBaseVNode("h2",null,toDisplayString(((_c2=unref(selectedVersion))==null?void 0:_c2.message)||"Saved version"),1),unref(selectedVersion)?(openBlock(),createElementBlock("div",_hoisted_27,[createBaseVNode("span",null,[createVNode(VIcon,{icon:unref(mdiAccountOutline),size:"16"},null,8,["icon"]),createTextVNode(" "+toDisplayString(unref(selectedVersion).author||"Unknown author"),1)]),createBaseVNode("span",null,[createVNode(VIcon,{icon:unref(mdiClockOutline),size:"16"},null,8,["icon"]),createTextVNode(" "+toDisplayString(formatVersionDate(unref(selectedVersion).committedAt)),1)]),createBaseVNode("code",null,toDisplayString(unref(selectedVersion).shortCommit),1),unref(versionFiles).payload?(openBlock(),createBlock(VChip,{key:0,label:"",size:"x-small",variant:"tonal"},{default:withCtx(()=>[createTextVNode(toDisplayString(versionFileCountLabel.value),1)]),_:1})):createCommentVNode("",true)])):createCommentVNode("",true)]),createVNode(VBtn,{"aria-label":"Close version details",icon:unref(mdiClose),size:"small",type:"button",variant:"text",onClick:closeVersion},null,8,["icon"])]}),_:1}),createVNode(VDivider),createVNode(VCardText,{class:"vibe64-repository-version-dialog__body"},{default:withCtx(()=>{var _a2,_b2;return[unref(versionFiles).error?(openBlock(),createBlock(StudioErrorNotice,{key:0,class:"vibe64-repository-version-dialog__error",compact:"",error:unref(versionFiles).error,title:"Version details could not load"},createSlots({_:2},[!unref(versionFiles).payload?{name:"actions",fn:withCtx(()=>[createVNode(VBtn,{"aria-busy":unref(versionFiles).loading?"true":void 0,disabled:unref(versionFiles).loading,size:"small",type:"button",variant:"tonal",onClick:_cache[3]||(_cache[3]=$event=>unref(selectVersion)(unref(selectedVersion)))},{default:withCtx(()=>[createTextVNode(toDisplayString(unref(versionFiles).loading?"Retrying…":"Retry files"),1)]),_:1},8,["aria-busy","disabled"])]),key:"0"}:void 0]),1032,["error"])):createCommentVNode("",true),unref(versionFiles).loading&&!unref(versionFiles).payload&&!unref(versionFiles).error?(openBlock(),createBlock(VProgressLinear,{key:1,color:"primary",indeterminate:""})):createCommentVNode("",true),unref(versionFiles).payload?(openBlock(),createBlock(Vibe64RepositoryFileBrowser,{key:2,"aria-label":"Files in this version",class:"vibe64-repository-version-dialog__files",embedded:"",error:unref(versionDiff).error,files:((_a2=unref(versionFiles).payload)==null?void 0:_a2.files)||[],loading:unref(versionDiff).loading,"loading-more":unref(versionFiles).loadingMore,payload:unref(versionDiff).payload,"selected-path":unref(selectedVersionPath),truncated:((_b2=unref(versionFiles).payload)==null?void 0:_b2.truncated)===true,onLoadMore:unref(loadMoreVersionFiles),onSelect:unref(selectVersionFile)},null,8,["error","files","loading","loading-more","payload","selected-path","truncated","onLoadMore","onSelect"])):createCommentVNode("",true)]}),_:1})]),_:1})]),_:1},8,["model-value"])],2)}}};const Vibe64RepositoryWorkspace=_export_sfc(_sfc_main,[["__scopeId","data-v-cc50b59a"]]);export{Vibe64RepositoryWorkspace as V};