@xbzbing/dsh-git-panel 1.5.2 → 1.5.3

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 (2) hide show
  1. package/lib/client.js +8 -7
  2. package/package.json +1 -1
package/lib/client.js CHANGED
@@ -1,6 +1,6 @@
1
1
  window.__ModuleLoader__.load({ id: "@xbzbing/dsh-git-panel", factory: (require) => {
2
2
  var module = { exports: {} }; var exports = module.exports;
3
- "use strict";var Zt=require("react");var la=`
3
+ "use strict";var en=require("react");var ma=`
4
4
  .gp-panel{display:flex;flex-direction:column;height:100%;min-height:0;color:var(--dsw-alias-label-primary);font-size:13px;position:relative;
5
5
  /* One selection language across the three list panes (Overview commits,
6
6
  * Changes rows, Files tree): primary-tinted fill + a 3px inset left bar. */
@@ -148,6 +148,7 @@ a.gp-statusbar__repo:hover{background:var(--dsw-alias-interactive-bg-hover);colo
148
148
  .gp-tree-chev{flex:none;width:11px;display:inline-flex;align-items:center;justify-content:center;color:var(--dsw-alias-label-tertiary)}
149
149
  .gp-tree-ic{flex:none;display:inline-flex;align-items:center;color:var(--dsw-alias-label-tertiary)}
150
150
  .gp-tree-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;flex:1;min-width:0}
151
+ .gp-tree-row--dir .gp-tree-name{font-weight:600}
151
152
  .gp-files__entry{width:100%;border:0;background:transparent;color:inherit;text-align:left;font:inherit}
152
153
  .gp-files__entry--dir .gp-tree-name{font-weight:600}
153
154
  .gp-files__entry:focus-visible{outline:2px solid var(--dsw-alias-state-business-primary);outline-offset:-2px}
@@ -531,12 +532,12 @@ a.gp-statusbar__repo:hover{background:var(--dsw-alias-interactive-bg-hover);colo
531
532
  @media (prefers-reduced-motion:reduce){
532
533
  .gp-sheet,.gp-sheet-backdrop,.gp-modal,.gp-modal-backdrop{animation:none}
533
534
  }
534
- `,dn=!1;function $n(){if(dn||typeof document>"u")return;let e="dsh-git-panel/client.css";if(document.querySelector(`style[data-plugin-css="${e}"]`)!==null){dn=!0;return}let t=document.createElement("style");t.dataset.plugin="@xbzbing/dsh-git-panel",t.dataset.pluginCss=e,t.textContent=la,document.head.appendChild(t),dn=!0}var In={"panel.tab":"Git","panel.fontDecrease":"\u7F29\u5C0F\u5B57\u4F53","panel.fontReset":"\u91CD\u7F6E\u5B57\u4F53\u5927\u5C0F","panel.fontIncrease":"\u653E\u5927\u5B57\u4F53","tab.overview":"Git \u603B\u89C8","tab.changes":"\u53D8\u66F4\u8BB0\u5F55","tab.files":"\u6587\u4EF6\u6D4F\u89C8","pill.unavailable":"Git \u4E0D\u53EF\u7528","pill.detached":"\u6E38\u79BB HEAD","pill.synced":"\u672C\u5730\u5DF2\u540C\u6B65","pill.dirty":"\u6709\u5F85\u63D0\u4EA4\u7684\u53D8\u66F4","common.loading":"\u52A0\u8F7D\u4E2D\u2026","common.retry":"\u91CD\u8BD5","common.close":"\u5173\u95ED","common.cancel":"\u53D6\u6D88","ops.aiHint":"\u63D0\u793A\uFF1A\u7ED9 AI \u591A\u4E00\u70B9\u4FE1\u4EFB\uFF0C\u4F60\u53EF\u4EE5\u5C1D\u8BD5\u8BA9 AI \u76F4\u63A5\u6267\u884C Git \u64CD\u4F5C\u3002","version.check":"\u68C0\u67E5\u65B0\u7248\u672C","version.checking":"\u68C0\u67E5\u4E2D\u2026","version.upToDate":"\u5DF2\u662F\u6700\u65B0\uFF08{current}\uFF09","version.updateAvailable":"\u6709\u65B0\u7248\u672C {latest}\uFF08\u5F53\u524D {current}\uFF09","version.viewRelease":"\u67E5\u770B\u53D1\u5E03","version.error":"\u68C0\u67E5\u5931\u8D25","version.noRepo":"\u672A\u914D\u7F6E\u4ED3\u5E93\u5730\u5740","version.openRepo":"\u8BBF\u95EE GitHub \u67E5\u770B @xbzbing/dsh-git-panel \u9879\u76EE\uFF0C\u8BF7\u4E3A\u9879\u76EE\u70B9\u4EAE\u4E00\u9897\u5C0F\u661F\u661F\u5427 \u2B50","overview.head":"\u5168\u90E8\u5206\u652F","overview.local":"\u672C\u5730","overview.remote":"\u8FDC\u7A0B","overview.tags":"\u6807\u7B7E","overview.search":"\u641C\u7D22\u63D0\u4EA4\uFF08\u6D88\u606F / \u54C8\u5E0C\uFF09","overview.searchShort":"\u641C\u7D22\u63D0\u4EA4","overview.allUsers":"\u5168\u90E8\u4F5C\u8005","overview.allTime":"\u5168\u90E8\u65F6\u95F4","overview.today":"\u4ECA\u5929","overview.last7d":"\u8FD1 7 \u5929","overview.last30d":"\u8FD1 30 \u5929","overview.selectCommit":"\u9009\u62E9\u4E00\u4E2A\u63D0\u4EA4\u67E5\u770B\u8BE6\u60C5","overview.noMessage":"\uFF08\u65E0\u63D0\u4EA4\u6B63\u6587\uFF09","overview.noResults":"\u6CA1\u6709\u5339\u914D\u7684\u63D0\u4EA4","overview.loadFailed":"\u52A0\u8F7D\u5931\u8D25","overview.detailFailed":"\u8BE6\u60C5\u52A0\u8F7D\u5931\u8D25","overview.diffFailed":"\u5DEE\u5F02\u52A0\u8F7D\u5931\u8D25","overview.openFileDiff":"\u67E5\u770B\u8BE5\u6587\u4EF6\u5728\u6B64\u63D0\u4EA4\u4E2D\u7684\u53D8\u66F4","overview.changeSummary":"{files} \u4E2A\u6587\u4EF6","overview.fetch":"\u62C9\u53D6\u8FDC\u7A0B","overview.branchesError":"\u5206\u652F\u52A0\u8F7D\u5931\u8D25","overview.filterBranch":"\u6309\u5206\u652F\u7B5B\u9009","overview.backToList":"\u8FD4\u56DE\u5217\u8868","overview.createTag":"\u521B\u5EFA\u6807\u7B7E","overview.revert":"\u8FD8\u539F\u6B64\u63D0\u4EA4","overview.reset":"\u91CD\u7F6E\u5230\u6B64","tag.createTitle":"\u5728\u6B64\u63D0\u4EA4\u521B\u5EFA\u6807\u7B7E","tag.namePlaceholder":"\u6807\u7B7E\u540D","tag.annotated":"\u9644\u6CE8\u6807\u7B7E\uFF08\u5E26\u8BF4\u660E\uFF09","tag.messagePlaceholder":"\u6807\u7B7E\u8BF4\u660E","tag.create":"\u521B\u5EFA\u6807\u7B7E","tag.deleteTitle":"\u5220\u9664\u6807\u7B7E","tag.deleteConfirm":"\u786E\u5B9A\u5220\u9664\u6807\u7B7E\u300C{name}\u300D\uFF1F","tag.deleteOne":"\u5220\u9664\u6807\u7B7E\u300C{name}\u300D","ops.dirtyWarn":"\u68C0\u6D4B\u5230\u672A\u63D0\u4EA4\u6539\u52A8\uFF0C\u8FD9\u4E9B\u6539\u52A8\u53EF\u80FD\u662F dsh AI \u6B63\u5728\u8FDB\u884C\u7684\u5DE5\u4F5C\u3002","revert.title":"\u8FD8\u539F\u63D0\u4EA4","revert.body":"\u5C06\u5728\u5F53\u524D HEAD \u8FFD\u52A0\u4E00\u4E2A\u53CD\u5411\u63D0\u4EA4\uFF0C\u8FD8\u539F {ref} \u7684\u6539\u52A8\u3002\u4E0D\u4F1A\u4E22\u5F03\u4F60\u7684\u5DE5\u4F5C\u533A\u6539\u52A8\u3002","revert.confirm":"\u8FD8\u539F","reset.title":"\u91CD\u7F6E\u5206\u652F","reset.body":"\u5C06\u628A\u5F53\u524D\u5206\u652F\u7684 HEAD \u4ECE {from} \u79FB\u52A8\u5230 {to}\u3002","reset.modeSoft":"\u8F6F\u91CD\u7F6E\uFF08--soft\uFF09","reset.softHint":"\u79FB\u52A8 HEAD\uFF0C\u6539\u52A8\u4FDD\u7559\u5728\u6682\u5B58\u533A\u3002","reset.modeMixed":"\u6DF7\u5408\u91CD\u7F6E\uFF08--mixed\uFF0C\u9ED8\u8BA4\uFF09","reset.mixedHint":"\u79FB\u52A8 HEAD\uFF0C\u6539\u52A8\u4FDD\u7559\u5728\u5DE5\u4F5C\u533A\u3002","reset.modeHard":"\u786C\u91CD\u7F6E\uFF08--hard\uFF09","reset.hardHint":"\u79FB\u52A8 HEAD \u5230\u6B64\u63D0\u4EA4\u5E76\u4E22\u5F03\u6240\u6709\u672A\u63D0\u4EA4\u6539\u52A8\uFF08\u672A\u63D0\u4EA4\u6539\u52A8\u65E0\u6CD5\u6062\u590D\uFF09\u3002","reset.hardOrphan":"\u5F53\u524D\u5206\u652F\u4E0A\u665A\u4E8E\u76EE\u6807\u7684\u63D0\u4EA4\u4F1A\u79BB\u5F00\u5206\u652F\uFF08\u4ECD\u53EF\u7528 git reflog \u627E\u56DE\uFF09\u3002","reset.hardWarn":"\u4EE5\u4E0B\u672A\u63D0\u4EA4\u6539\u52A8\u5C06\u88AB\u6C38\u4E45\u4E22\u5F03\uFF1A","reset.lostMore":"\u2026\u8FD8\u6709\u66F4\u591A\u672A\u63D0\u4EA4\u6539\u52A8\u672A\u663E\u793A\uFF08\u5217\u8868\u5DF2\u622A\u65AD\uFF09","reset.hardAck":"\u6211\u5DF2\u4E86\u89E3\uFF0C\u786E\u8BA4\u4E22\u5F03\u8FD9\u4E9B\u672A\u63D0\u4EA4\u6539\u52A8","reset.hardAckClean":"\u6211\u5DF2\u4E86\u89E3\u6B64\u64CD\u4F5C\u7684\u540E\u679C\uFF0C\u786E\u8BA4\u91CD\u7F6E","reset.confirm":"\u91CD\u7F6E","changes.groupStaged":"\u5DF2\u6682\u5B58\u7684\u66F4\u6539","changes.groupUnstaged":"\u66F4\u6539","changes.groupUntracked":"\u672A\u7248\u672C\u63A7\u5236\u7684\u6587\u4EF6","changes.selectFile":"\u9009\u62E9\u4E00\u4E2A\u6587\u4EF6\u67E5\u770B\u53D8\u66F4","changes.noChanges":"\u6CA1\u6709\u672A\u63D0\u4EA4\u7684\u53D8\u66F4","changes.stageAll":"\u5168\u90E8\u6682\u5B58","changes.unstageAll":"\u5168\u90E8\u53D6\u6D88\u6682\u5B58","changes.stage":"\u6682\u5B58","changes.unstage":"\u53D6\u6D88\u6682\u5B58","changes.discard":"\u653E\u5F03\u66F4\u6539","changes.discardConfirm":"\u518D\u6B21\u70B9\u51FB\u4EE5\u786E\u8BA4\u653E\u5F03","changes.backToList":"\u8FD4\u56DE\u5217\u8868","changes.stash":"\u8D2E\u85CF\u66F4\u6539","stash.title":"\u8D2E\u85CF\u5F53\u524D\u66F4\u6539","stash.messagePlaceholder":"\u8D2E\u85CF\u8BF4\u660E\uFF08\u53EF\u9009\uFF09","stash.save":"\u8D2E\u85CF","stash.section":"\u8D2E\u85CF","stash.onBranch":"\u4F4D\u4E8E {branch}","stash.apply":"\u5E94\u7528","stash.pop":"\u5F39\u51FA","stash.drop":"\u4E22\u5F03","stash.dropTitle":"\u4E22\u5F03\u8D2E\u85CF","stash.dropConfirm":"\u786E\u5B9A\u4E22\u5F03\u6B64\u8D2E\u85CF\u6761\u76EE\uFF1F\u4E22\u5F03\u540E\u65E0\u6CD5\u6062\u590D\uFF1A{name}","files.selectFile":"\u9009\u62E9\u4E00\u4E2A\u6587\u4EF6\u67E5\u770B\u5185\u5BB9","files.loadFailed":"\u52A0\u8F7D\u5931\u8D25","files.backToTree":"\u8FD4\u56DE\u6587\u4EF6\u6811","files.truncated":"\u6761\u76EE\u8FC7\u591A\uFF0C\u5DF2\u622A\u65AD","files.tooLarge":"\u6587\u4EF6\u8FC7\u5927\uFF0C\u65E0\u6CD5\u9884\u89C8","files.binary":"\u4E8C\u8FDB\u5236\u6587\u4EF6\uFF0C\u65E0\u6CD5\u9884\u89C8","files.highlightOff":"\u6587\u4EF6\u8F83\u5927\uFF0C\u5DF2\u5173\u95ED\u8BED\u6CD5\u9AD8\u4EAE\u4EE5\u4FDD\u6301\u6D41\u7545","files.lineTruncated":" \u2026\uFF08\u6B64\u884C\u8FC7\u957F\uFF0C\u5DF2\u622A\u65AD\uFF09","files.findPlaceholder":"\u5728\u6B64\u6587\u4EF6\u4E2D\u67E5\u627E","files.findNoMatch":"\u65E0\u5339\u914D","files.findPrev":"\u4E0A\u4E00\u4E2A","files.findNext":"\u4E0B\u4E00\u4E2A","files.findClose":"\u5173\u95ED\u67E5\u627E","files.findCase":"\u533A\u5206\u5927\u5C0F\u5199","files.previewMode":"\u9884\u89C8\u65B9\u5F0F","files.source":"\u6E90\u7801","files.render":"\u6E32\u67D3","files.copyPath":"\u590D\u5236\u76F8\u5BF9\u8DEF\u5F84","files.pathCopied":"\u8DEF\u5F84\u5DF2\u590D\u5236","files.pathCopyFailed":"\u590D\u5236\u5931\u8D25","files.copyContent":"\u590D\u5236\u6587\u4EF6\u5185\u5BB9","files.contentCopied":"\u5185\u5BB9\u5DF2\u590D\u5236","files.contentCopyFailed":"\u590D\u5236\u5931\u8D25","files.ignored":"\u5DF2\u88AB Git \u5FFD\u7565","files.copy":"\u590D\u5236\u4EE3\u7801","files.copied":"\u5DF2\u590D\u5236","files.footnotes":"\u6CE8\u91CA","files.gitNotInstalled":"\u7CFB\u7EDF\u672A\u5B89\u88C5 Git\uFF0CGit \u9762\u677F\u4E0D\u53EF\u7528\uFF0C\u8BF7\u5B89\u88C5 Git \u5DE5\u5177\u540E\u91CD\u8BD5\u3002","stats.files":"{n} \u4E2A\u6587\u4EF6","stats.lastChange":"\u6700\u8FD1\u53D8\u66F4 {time}","stats.lastCommit":"\u4E0A\u6B21\u63D0\u4EA4 {time}","stats.staged":"\u5DF2\u6682\u5B58 {n}","stats.modified":"\u5DF2\u4FEE\u6539 {n}","stats.untracked":"\u672A\u8DDF\u8E2A {n}","stats.partial":"\u7EDF\u8BA1\u5DF2\u7B80\u5316","stats.partialHint":"\u53D8\u66F4\u6570\u91CF\u8F83\u591A\uFF0C\u5DF2\u8DF3\u8FC7\u672A\u8DDF\u8E2A\u6587\u4EF6\u884C\u6570\u4E0E\u6700\u8FD1\u53D8\u66F4\u65F6\u95F4\u7684\u7CBE\u786E\u7EDF\u8BA1\u4EE5\u4FDD\u6301\u9762\u677F\u6D41\u7545\u3002","commit.placeholder":"\u63D0\u4EA4\u4FE1\u606F","commit.commit":"\u63D0\u4EA4","commit.amend":"\u4FEE\u6B63\u4E0A\u6B21\u63D0\u4EA4\uFF08amend\uFF09","commit.suggest":"AI \u751F\u6210","commit.suggesting":"\u751F\u6210\u4E2D\u2026","commit.suggestOverwrite":"\u518D\u6B21\u70B9\u51FB\u300CAI \u751F\u6210\u300D\u4EE5\u8986\u76D6\u5F53\u524D\u63D0\u4EA4\u4FE1\u606F","commit.suggestTruncated":"diff \u8FC7\u957F\u5DF2\u622A\u65AD\uFF0C\u751F\u6210\u7684\u5EFA\u8BAE\u53EF\u80FD\u4E0D\u5B8C\u6574","diff.unified":"\u7EDF\u4E00","diff.split":"\u5BF9\u7167","diff.before":"\u53D8\u66F4\u524D","diff.after":"\u53D8\u66F4\u540E","diff.binary":"\u4E8C\u8FDB\u5236\u6587\u4EF6\uFF0C\u65E0\u6CD5\u663E\u793A\u5BF9\u7167","diff.tooLarge":"\u56FE\u7247\u8FC7\u5927\uFF0C\u65E0\u6CD5\u663E\u793A\u5BF9\u7167","diff.imageMissing":"\u4E0D\u5B58\u5728","diff.svgRender":"\u6E32\u67D3","diff.svgSource":"\u6E90\u7801","diff.empty":"\u65E0\u5DEE\u5F02","diff.expandAll":"\u5C55\u5F00\u5168\u90E8","diff.collapse":"\u6298\u53E0\u672A\u53D8\u66F4","diff.expandGap":"\u5C55\u5F00\u5168\u90E8 {n} \u884C","diff.expandUp":"\u5411\u4E0A\u5C55\u5F00 {n} \u884C","diff.expandDown":"\u5411\u4E0B\u5C55\u5F00 {n} \u884C","time.justNow":"\u521A\u521A","time.minutesAgo":"{n} \u5206\u949F\u524D","time.hoursAgo":"{n} \u5C0F\u65F6\u524D","time.daysAgo":"{n} \u5929\u524D","error.generic":"\u64CD\u4F5C\u5931\u8D25","error.notARepo":"\u5F53\u524D\u76EE\u5F55\u4E0D\u662F Git \u4ED3\u5E93","error.noCwd":"\u5F53\u524D\u4F1A\u8BDD\u65E0\u5DE5\u4F5C\u76EE\u5F55","error.localChangesBlock":"\u672C\u5730\u6709\u672A\u63D0\u4EA4\u53D8\u66F4\uFF0C\u64CD\u4F5C\u88AB\u963B\u6B62","error.emptyMessage":"\u63D0\u4EA4\u4FE1\u606F\u4E0D\u80FD\u4E3A\u7A7A","error.emptyDiff":"\u6CA1\u6709\u53EF\u751F\u6210\u7684\u53D8\u66F4","error.llmUnavailable":"AI \u670D\u52A1\u4E0D\u53EF\u7528","error.llmFailed":"AI \u751F\u6210\u5931\u8D25","error.suggestDisabled":"AI \u751F\u6210\u5DF2\u5728\u63D2\u4EF6\u914D\u7F6E\u4E2D\u5173\u95ED","error.conflict":"\u8D2E\u85CF\u5E94\u7528\u4EA7\u751F\u51B2\u7A81\uFF0C\u8D2E\u85CF\u6761\u76EE\u5DF2\u4FDD\u7559\uFF0C\u8BF7\u624B\u52A8\u89E3\u51B3\u51B2\u7A81\u540E\u518D\u8BD5","error.revertConflict":"\u8FD8\u539F\u4F1A\u4E0E\u5F53\u524D\u5185\u5BB9\u51B2\u7A81\uFF0C\u5DF2\u81EA\u52A8\u53D6\u6D88\u8FD8\u539F\uFF08\u672A\u6539\u52A8\u4F60\u7684\u5DE5\u4F5C\u533A\uFF09","error.revertStuck":"\u8FD8\u539F\u4EA7\u751F\u51B2\u7A81\u4E14\u81EA\u52A8\u53D6\u6D88\u5931\u8D25\uFF0C\u4ED3\u5E93\u4ECD\u5904\u4E8E\u8FD8\u539F\u4E2D\uFF0C\u8BF7\u624B\u52A8\u6267\u884C git revert --abort \u6216\u89E3\u51B3\u51B2\u7A81","error.revertMerge":"\u8FD9\u662F\u4E00\u4E2A\u5408\u5E76\u63D0\u4EA4\uFF0C\u9762\u677F\u6682\u4E0D\u652F\u6301\u8FD8\u539F\uFF08\u9700\u6307\u5B9A\u4E3B\u7EBF\u7236\u63D0\u4EA4\uFF09\uFF0C\u8BF7\u5728\u547D\u4EE4\u884C\u7528 git revert -m \u5904\u7406","error.indexBusy":"Git \u6B63\u5FD9\uFF08\u53E6\u4E00\u8FDB\u7A0B\u5360\u7528\u7D22\u5F15\uFF09\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5","error.notFound":"\u76EE\u6807\u4E0D\u5B58\u5728\uFF08\u6807\u7B7E\u6216\u8D2E\u85CF\u53EF\u80FD\u5DF2\u88AB\u5220\u9664\uFF09","error.invalidName":"\u540D\u79F0\u4E0D\u5408\u6CD5","error.notFastForward":"\u672C\u5730\u4E0E\u8FDC\u7A0B\u5206\u652F\u5DF2\u5206\u53C9\uFF0C\u65E0\u6CD5\u5FEB\u8FDB\u62C9\u53D6\uFF0C\u8BF7\u624B\u52A8\u5408\u5E76\u6216\u53D8\u57FA","error.pushRejected":"\u63A8\u9001\u88AB\u62D2\u7EDD\uFF1A\u8FDC\u7A0B\u5DF2\u6709\u65B0\u63D0\u4EA4\uFF0C\u8BF7\u5148\u300C\u68C0\u67E5\u540C\u6B65\u300D\u5E76\u62C9\u53D6\u540E\u518D\u63A8\u9001","error.authFailed":"\u8BA4\u8BC1\u5931\u8D25\uFF1A\u6CA1\u6709\u53EF\u7528\u7684 git \u51ED\u636E\uFF08HTTPS \u9700\u51ED\u636E\u52A9\u624B\u3001SSH \u9700\u5BC6\u94A5\uFF09\u3002\u8BF7\u5148\u5728\u547D\u4EE4\u884C\u5B8C\u6210\u4E00\u6B21\u63A8\u9001\u4EE5\u7F13\u5B58\u51ED\u636E","status.openRepo":"\u5728\u6D4F\u89C8\u5668\u6253\u5F00\u4ED3\u5E93\u4E3B\u9875","status.openRepoOn":"\u5728 {host} \u6253\u5F00\u4ED3\u5E93\u4E3B\u9875","status.synced":"\u5DF2\u4E0E\u8FDC\u7A0B\u540C\u6B65","status.ahead":"\u9886\u5148 {n}","status.behind":"\u843D\u540E {n}","status.diverged":"\u5DF2\u5206\u53C9\uFF08\u9886\u5148 {ahead} / \u843D\u540E {behind}\uFF09","status.noUpstream":"\u672A\u8DDF\u8E2A\u8FDC\u7A0B\u5206\u652F","status.detached":"\u6E38\u79BB HEAD\uFF0C\u65E0\u5206\u652F\u540C\u6B65\u72B6\u6001","status.check":"\u68C0\u67E5\u540C\u6B65\u72B6\u6001","status.checkTitle":"\u68C0\u67E5\u4E0E\u8FDC\u7A0B\u7684\u540C\u6B65\u72B6\u6001\uFF1A\u6267\u884C git fetch \u62C9\u53D6\u6700\u65B0\u5F15\u7528\u5E76\u5237\u65B0\u9886\u5148/\u843D\u540E\u8BA1\u6570\uFF0C\u4E0D\u6539\u52A8\u5DE5\u4F5C\u533A","status.pull":"\u62C9\u53D6","status.pulling":"\u540C\u6B65\u4E2D\u2026","status.pullTitle":"\u5FEB\u8FDB\u62C9\u53D6\u8FDC\u7A0B\u66F4\u65B0","status.pullConfirmTitle":"\u62C9\u53D6\u8FDC\u7A0B\u66F4\u65B0","status.pullConfirmBody":"\u5C06\u4EE5\u5FEB\u8FDB\u65B9\u5F0F\u628A\u5F53\u524D\u5206\u652F {branch} \u66F4\u65B0\u5230\u8FDC\u7A0B\u6700\u65B0\u63D0\u4EA4\uFF08\u843D\u540E {behind} \u4E2A\u63D0\u4EA4\uFF09\u3002\u4EC5\u5728\u672A\u5206\u53C9\u65F6\u53EF\u884C\uFF0C\u4E0D\u4F1A\u4EA7\u751F\u5408\u5E76\u63D0\u4EA4\uFF0C\u4E5F\u4E0D\u4F1A\u6539\u52A8\u4F60\u7684\u672A\u63D0\u4EA4\u5185\u5BB9\u3002","status.pullConfirm":"\u62C9\u53D6","status.pullScope":"\u5C06\u5F15\u5165 {commits} \u4E2A\u63D0\u4EA4 \xB7 {files} \u4E2A\u6587\u4EF6 \xB7 +{ins} / \u2212{del} \u884C","status.pullScopeLoading":"\u6B63\u5728\u7EDF\u8BA1\u8FDC\u7A0B\u5DEE\u5F02\u2026","status.push":"\u63A8\u9001","status.pushTitle":"\u63A8\u9001\u672C\u5730\u63D0\u4EA4\u5230\u8FDC\u7A0B","status.pushConfirmTitle":"\u63A8\u9001\u5230\u8FDC\u7A0B","status.pushConfirmBody":"\u5C06\u628A\u5F53\u524D\u5206\u652F {branch} \u9886\u5148\u8FDC\u7A0B\u7684 {ahead} \u4E2A\u63D0\u4EA4\u63A8\u9001\u5230\u4E0A\u6E38\u3002\u4EC5\u505A\u5FEB\u8FDB\u63A8\u9001\uFF0C\u4E0D\u4F1A\u5F3A\u5236\u8986\u76D6\u8FDC\u7A0B\u5386\u53F2\u3002","status.pushConfirm":"\u63A8\u9001","status.pushing":"\u63A8\u9001\u4E2D\u2026","status.pushScope":"\u5C06\u63A8\u9001 {commits} \u4E2A\u63D0\u4EA4 \xB7 {files} \u4E2A\u6587\u4EF6 \xB7 +{ins} / \u2212{del} \u884C","status.pushScopeLoading":"\u6B63\u5728\u7EDF\u8BA1\u5F85\u63A8\u9001\u5DEE\u5F02\u2026","status.publish":"\u53D1\u5E03","status.publishTitle":"\u53D1\u5E03\u5206\u652F\u5E76\u8BBE\u7F6E\u4E0A\u6E38","status.publishConfirmTitle":"\u53D1\u5E03\u5206\u652F\u5230\u8FDC\u7A0B","status.publishConfirmBody":"\u5F53\u524D\u5206\u652F {branch} \u5C1A\u672A\u8DDF\u8E2A\u8FDC\u7A0B\u3002\u5C06\u6267\u884C git push -u {remote} \u5728\u8FDC\u7A0B\u521B\u5EFA\u540C\u540D\u5206\u652F\u5E76\u8BBE\u4E3A\u4E0A\u6E38\u8DDF\u8E2A\u3002","status.publishConfirm":"\u53D1\u5E03","status.publishing":"\u53D1\u5E03\u4E2D\u2026","cfg.title":"\u8F93\u5165\u6846\u5206\u652F\u6807\u8BB0","cfg.toggle":"\u663E\u793A\u8F93\u5165\u6846\u6807\u8BB0","cfg.hint":"\u5F00\u542F\u65F6\u5728\u8F93\u5165\u6846\u663E\u793A zsh \u98CE\u683C\u7684 <\u4ED3\u5E93\u540D> (\u5206\u652F) \u6807\u8BB0\uFF1B\u5173\u95ED\u540E\u6539\u4E3A\u5728 Git \u6807\u7B7E\u65C1\u663E\u793A\u72B6\u6001\u5706\u70B9\u3002\u4FDD\u5B58\u540E\u7ACB\u5373\u751F\u6548\u3002","cfg.diffTitle":"\u5DEE\u5F02\u5BF9\u6BD4\u9ED8\u8BA4\u89C6\u56FE","cfg.diffHint":"\u9009\u62E9\u53D8\u66F4\u5BF9\u6BD4\u9ED8\u8BA4\u6253\u5F00\u7684\u5E03\u5C40\uFF1A\u7EDF\u4E00\u89C6\u56FE\u4E3A\u5355\u680F\u884C\u5185\u5BF9\u6BD4\uFF0C\u5E76\u6392\u89C6\u56FE\u4E3A\u5DE6\u53F3\u5206\u680F\u5BF9\u6BD4\u3002\u4ECD\u53EF\u5728\u6BCF\u4E2A\u5DEE\u5F02\u89C6\u56FE\u4E2D\u4E34\u65F6\u5207\u6362\u3002\u4FDD\u5B58\u540E\u7ACB\u5373\u751F\u6548\u3002","cfg.diffUnified":"\u7EDF\u4E00\u89C6\u56FE\uFF08\u5355\u680F\u884C\u5185\uFF09","cfg.diffSplit":"\u5E76\u6392\u89C6\u56FE\uFF08\u5DE6\u53F3\u5206\u680F\uFF09","cfg.graphTitle":"\u63D0\u4EA4\u5386\u53F2\u56FE\u7EBF\u6761\u6837\u5F0F","cfg.graphHint":"\u9009\u62E9\u63D0\u4EA4\u5386\u53F2\u56FE\u7684\u8FDE\u7EBF\u753B\u6CD5\uFF1A\u5E73\u884C\u7EBF\u4E3A VSCode / \u56FE\u5F62\u754C\u9762\u98CE\u683C\uFF0C\u5206\u652F\u5404\u5360\u4E00\u5217\u3001\u5171\u4EAB\u7956\u5148\u4EE5\u5E76\u884C\u7EBF\u8868\u793A\uFF1B\u7D27\u51D1\u4E3A git log \u547D\u4EE4\u884C\u98CE\u683C\uFF0C\u5171\u4EAB\u7956\u5148\u5408\u5E76\u4E3A\u4E00\u5217\u3001\u7EBF\u66F4\u5C11\u3002\u4FDD\u5B58\u540E\u7ACB\u5373\u751F\u6548\u3002","cfg.graphParallel":"\u5E73\u884C\u7EBF\uFF08VSCode \u98CE\u683C\uFF09","cfg.graphCompact":"\u7D27\u51D1\uFF08git log \u98CE\u683C\uFF09","cfg.suggestTitle":"AI \u751F\u6210\u63D0\u4EA4\u4FE1\u606F","cfg.suggestToggle":"\u63D0\u4EA4\u6846\u663E\u793A AI \u751F\u6210\u6309\u94AE","cfg.suggestHint":"\u5F00\u542F\u540E\u63D0\u4EA4\u6846\u65C1\u4F1A\u51FA\u73B0\u300CAI \u751F\u6210\u300D\u6309\u94AE\uFF1A\u6839\u636E\u5F53\u524D\u53D8\u66F4\u4E0E\u6700\u8FD1\u63D0\u4EA4\u98CE\u683C\u751F\u6210\u63D0\u4EA4\u4FE1\u606F\uFF0C\u586B\u5165\u540E\u53EF\u7F16\u8F91\u518D\u63D0\u4EA4\u3002\u751F\u6210\u7684\u8BF7\u6C42\u4F1A\u4F7F\u7528\u4F60\u5728 DSH \u4E2D\u914D\u7F6E\u7684\u6A21\u578B\uFF0Cdiff \u5185\u5BB9\u4F1A\u53D1\u9001\u7ED9\u6A21\u578B\u4F9B\u5E94\u5546\u3002\u4FDD\u5B58\u540E\u7ACB\u5373\u751F\u6548\u3002","cfg.notLoaded":"\u914D\u7F6E\u672A\u52A0\u8F7D\uFF1A\u8BE5\u914D\u7F6E\u7531\u8FD0\u884C\u4E2D\u7684\u5BBF\u4E3B\u63D0\u4F9B\uFF0C\u82E5\u957F\u65F6\u95F4\u7A7A\u767D\u8BF7\u91CD\u542F DSH \u540E\u91CD\u8BD5\u3002","cfg.saveFailed":"\u4FDD\u5B58\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5"},Bn={"panel.tab":"Git","panel.fontDecrease":"Decrease font size","panel.fontReset":"Reset font size","panel.fontIncrease":"Increase font size","tab.overview":"Overview","tab.changes":"Changes","tab.files":"Files","pill.unavailable":"Git unavailable","pill.detached":"detached HEAD","pill.synced":"Everything committed","pill.dirty":"Uncommitted changes","common.loading":"Loading\u2026","common.retry":"Retry","common.close":"Close","common.cancel":"Cancel","ops.aiHint":"Tip: Trust AI more, try direct Git\u2011operation execution by AI.","version.check":"Check for updates","version.checking":"Checking\u2026","version.upToDate":"Up to date ({current})","version.updateAvailable":"New version {latest} available (current {current})","version.viewRelease":"View release","version.error":"Check failed","version.noRepo":"Repository not configured","version.openRepo":"Visit @xbzbing/dsh-git-panel on GitHub \u2014 please give the project a little star \u2B50","overview.head":"All branches","overview.local":"Local","overview.remote":"Remote","overview.tags":"Tags","overview.search":"Search commits (message / hash)","overview.searchShort":"Search","overview.allUsers":"All authors","overview.allTime":"All time","overview.today":"Today","overview.last7d":"Last 7 days","overview.last30d":"Last 30 days","overview.selectCommit":"Select a commit to see details","overview.noMessage":"(no commit body)","overview.noResults":"No matching commits","overview.loadFailed":"Load failed","overview.detailFailed":"Failed to load details","overview.diffFailed":"Failed to load diff","overview.openFileDiff":"View this file\u2019s changes in this commit","overview.changeSummary":"{files} files","overview.fetch":"Fetch","overview.branchesError":"Failed to load branches","overview.filterBranch":"Filter by branch","overview.backToList":"Back to list","overview.createTag":"Create tag","overview.revert":"Revert this commit","overview.reset":"Reset to here","tag.createTitle":"Create a tag at this commit","tag.namePlaceholder":"Tag name","tag.annotated":"Annotated tag (with message)","tag.messagePlaceholder":"Tag message","tag.create":"Create tag","tag.deleteTitle":"Delete tag","tag.deleteConfirm":'Delete tag "{name}"?',"tag.deleteOne":'Delete tag "{name}"',"ops.dirtyWarn":"There are uncommitted changes \u2014 they may be work the dsh AI is doing.","revert.title":"Revert commit","revert.body":"Appends a reverse commit at the current HEAD that undoes the changes in {ref}. Your working-tree changes are kept.","revert.confirm":"Revert","reset.title":"Reset branch","reset.body":"Moves the current branch HEAD from {from} to {to}.","reset.modeSoft":"Soft (--soft)","reset.softHint":"Moves HEAD; changes stay staged.","reset.modeMixed":"Mixed (--mixed, default)","reset.mixedHint":"Moves HEAD; changes stay in the working tree.","reset.modeHard":"Hard (--hard)","reset.hardHint":"Moves HEAD to this commit and discards all uncommitted changes (uncommitted changes cannot be recovered).","reset.hardOrphan":"Commits after the target leave the branch (still recoverable via git reflog).","reset.hardWarn":"The following uncommitted changes will be permanently discarded:","reset.lostMore":"\u2026 more uncommitted changes not shown (list capped)","reset.hardAck":"I understand these uncommitted changes will be lost","reset.hardAckClean":"I understand the consequences and confirm the reset","reset.confirm":"Reset","changes.groupStaged":"Staged changes","changes.groupUnstaged":"Changes","changes.groupUntracked":"Unversioned files","changes.selectFile":"Select a file to see its diff","changes.noChanges":"No uncommitted changes","changes.stageAll":"Stage all","changes.unstageAll":"Unstage all","changes.stage":"Stage","changes.unstage":"Unstage","changes.discard":"Discard changes","changes.discardConfirm":"Click again to confirm discard","changes.backToList":"Back to list","changes.stash":"Stash changes","stash.title":"Stash current changes","stash.messagePlaceholder":"Stash message (optional)","stash.save":"Stash","stash.section":"Stashes","stash.onBranch":"on {branch}","stash.apply":"Apply","stash.pop":"Pop","stash.drop":"Drop","stash.dropTitle":"Drop stash","stash.dropConfirm":"Drop this stash? This cannot be undone: {name}","files.selectFile":"Select a file to preview","files.loadFailed":"Load failed","files.backToTree":"Back to files","files.truncated":"Too many entries \u2014 truncated","files.tooLarge":"File too large to preview","files.binary":"Binary file \u2014 no preview","files.highlightOff":"Large file \u2014 syntax highlighting disabled for performance","files.lineTruncated":" \u2026 (line too long, truncated)","files.findPlaceholder":"Find in file","files.findNoMatch":"No results","files.findPrev":"Previous match","files.findNext":"Next match","files.findClose":"Close find","files.findCase":"Match case","files.previewMode":"Preview mode","files.source":"Source","files.render":"Rendered","files.copyPath":"Copy relative path","files.pathCopied":"Path copied","files.pathCopyFailed":"Copy failed","files.copyContent":"Copy file content","files.contentCopied":"Content copied","files.contentCopyFailed":"Copy failed","files.ignored":"Ignored by Git","files.copy":"Copy code","files.copied":"Copied","files.footnotes":"Footnotes","files.gitNotInstalled":"Git is not installed; the Git panel is unavailable. Please install Git and try again.","stats.files":"{n} files","stats.lastChange":"changed {time}","stats.lastCommit":"last commit {time}","stats.staged":"{n} staged","stats.modified":"{n} modified","stats.untracked":"{n} untracked","stats.partial":"simplified","stats.partialHint":"Large change set \u2014 untracked line counts and last-change time are omitted to keep the panel responsive.","commit.placeholder":"Commit message","commit.commit":"Commit","commit.amend":"Amend previous commit","commit.suggest":"AI suggest","commit.suggesting":"Generating\u2026","commit.suggestOverwrite":'Click "AI suggest" again to replace the current message',"commit.suggestTruncated":"The diff was truncated; the suggestion may be incomplete","diff.unified":"Unified","diff.split":"Split","diff.before":"Before","diff.after":"After","diff.binary":"Binary file \u2014 no diff to show","diff.tooLarge":"Image too large to compare","diff.imageMissing":"Does not exist","diff.svgRender":"Rendered","diff.svgSource":"Source","diff.empty":"No differences","diff.expandAll":"Expand all","diff.collapse":"Collapse unchanged","diff.expandGap":"Expand all {n} lines","diff.expandUp":"Expand up {n} lines","diff.expandDown":"Expand down {n} lines","time.justNow":"just now","time.minutesAgo":"{n}m ago","time.hoursAgo":"{n}h ago","time.daysAgo":"{n}d ago","error.generic":"Operation failed","error.notARepo":"Not a Git repository","error.noCwd":"This session has no working directory","error.localChangesBlock":"Local changes block this operation","error.emptyMessage":"Commit message cannot be empty","error.emptyDiff":"No changes to summarize","error.llmUnavailable":"AI service unavailable","error.llmFailed":"AI generation failed","error.suggestDisabled":"AI suggest is turned off in the plugin config","error.conflict":"Applying the stash produced conflicts; the stash entry is kept \u2014 resolve them and retry","error.revertConflict":"The revert would conflict with the current content; it was cancelled automatically (your working tree is unchanged)","error.revertStuck":"The revert conflicted and could not be auto-cancelled; the repository is mid-revert \u2014 run `git revert --abort` or resolve it manually","error.revertMerge":"This is a merge commit; the panel cannot revert it (a mainline parent is required) \u2014 use `git revert -m` on the command line","error.indexBusy":"Git is busy (another process holds the index lock); try again shortly","error.notFound":"Target not found (the tag or stash may have been removed)","error.invalidName":"Invalid name","error.notFastForward":"Local and remote have diverged \u2014 a fast-forward pull is not possible; merge or rebase manually","error.pushRejected":"Push rejected: the remote has new commits \u2014 run \u201CCheck sync\u201D and pull first, then push","error.authFailed":"Authentication failed: no usable git credentials (HTTPS needs a credential helper, SSH needs a key). Push once from the command line first to cache them","status.openRepo":"Open the repository home in the browser","status.openRepoOn":"Open the repository home on {host}","status.synced":"Up to date with remote","status.ahead":"{n} ahead","status.behind":"{n} behind","status.diverged":"Diverged ({ahead} ahead / {behind} behind)","status.noUpstream":"No upstream branch","status.detached":"Detached HEAD \u2014 no branch sync state","status.check":"Check sync status","status.checkTitle":"Check sync with the remote: runs git fetch to update refs and refresh the ahead/behind counts; your working tree is untouched","status.pull":"Pull","status.pulling":"Syncing\u2026","status.pullTitle":"Fast-forward pull of remote updates","status.pullConfirmTitle":"Pull remote updates","status.pullConfirmBody":"Fast-forwards the current branch {branch} to the latest remote commit ({behind} behind). Only possible when not diverged; it creates no merge commit and leaves your uncommitted work untouched.","status.pullConfirm":"Pull","status.pullScope":"Brings in {commits} commits \xB7 {files} files \xB7 +{ins} / \u2212{del} lines","status.pullScopeLoading":"Measuring incoming changes\u2026","status.push":"Push","status.pushTitle":"Push local commits to the remote","status.pushConfirmTitle":"Push to remote","status.pushConfirmBody":"Pushes the {ahead} commits that {branch} is ahead of the remote to its upstream. Fast-forward only \u2014 it never force-overwrites remote history.","status.pushConfirm":"Push","status.pushing":"Pushing\u2026","status.pushScope":"Pushes {commits} commits \xB7 {files} files \xB7 +{ins} / \u2212{del} lines","status.pushScopeLoading":"Measuring outgoing changes\u2026","status.publish":"Publish","status.publishTitle":"Publish the branch and set its upstream","status.publishConfirmTitle":"Publish branch to remote","status.publishConfirmBody":"The current branch {branch} has no upstream yet. This runs git push -u {remote} to create a same-named branch on the remote and set it as the upstream.","status.publishConfirm":"Publish","status.publishing":"Publishing\u2026","cfg.title":"Input-bar branch marker","cfg.toggle":"Show input-bar marker","cfg.hint":"When on, the input bar shows the zsh-style <repo> (branch) marker; when off, a status dot appears beside the Git tab instead. Saved changes apply immediately.","cfg.diffTitle":"Default diff view","cfg.diffHint":"Choose the layout diffs open with: unified is a single inline column, split is side-by-side. You can still switch per diff. Saved changes apply immediately.","cfg.diffUnified":"Unified (single inline column)","cfg.diffSplit":"Split (side-by-side)","cfg.graphTitle":"Commit graph line style","cfg.graphHint":"Choose how the commit graph draws its lines: parallel is the VSCode / GUI style \u2014 each branch keeps its own column and a shared ancestor shows as parallel lines; compact is the git log style \u2014 a shared ancestor merges into one column with fewer lines. Saved changes apply immediately.","cfg.graphParallel":"Parallel (VSCode style)","cfg.graphCompact":"Compact (git log style)","cfg.suggestTitle":"AI commit message","cfg.suggestToggle":"Show AI suggest button in the commit box","cfg.suggestHint":'When on, an "AI suggest" button appears beside the commit button: it writes a commit message from the current changes and the recent commit style, filled in for you to edit before committing. Generation uses the model configured in DSH; the diff is sent to that model provider. Saved changes apply immediately.',"cfg.notLoaded":"Config not loaded: it is served by the running host. Restart DSH if this stays blank.","cfg.saveFailed":"Save failed, please retry"};var St=require("react");var da=new Set(["cwd-unavailable"]),cn=3e4,ca=6e4,kt=class{constructor(t,n){this.remote=t;this.sessionId=n}view={state:"cold"};listeners=new Set;timer;inflight;pendingRefresh=!1;disposed=!1;pollMs=cn;subscribe(t){return this.listeners.add(t),()=>{this.listeners.delete(t)}}getSnapshot(){return this.view}ensure(){this.view.state!=="cold"&&this.view.state!=="no-cwd"||this.refresh()}refresh(){return this.inflight!==void 0?(this.pendingRefresh=!0,this.inflight):this.disposed?Promise.resolve():(this.view.state==="cold"&&this.setView({state:"loading"}),this.inflight=this.remote.snapshot({sessionId:this.sessionId}).then(t=>{if(!this.disposed){if(t.ok)this.pollMs=t.value.refreshIntervalMs||cn,this.setView({state:"ready",snapshot:t.value});else if(t.error.code!=="cancelled")if(da.has(t.error.code))this.pollMs=ca,this.setView({state:"no-cwd"});else if(t.error.code==="not-a-git-repo"){let n=t.error;this.setView({state:"error",error:{code:"not-a-git-repo",...n.cwd?{cwd:n.cwd}:{},...n.showInputPill!==void 0?{showInputPill:n.showInputPill}:{}}})}else if(t.error.code==="git-unavailable"){let n=t.error;this.setView({state:"error",error:{code:"git-unavailable",...n.detail?{detail:n.detail}:{},...n.cwd?{cwd:n.cwd}:{},...n.isGitRepo!==void 0?{isGitRepo:n.isGitRepo}:{}}})}else this.setView({state:"error",error:{code:t.error.code,..."detail"in t.error?{detail:t.error.detail}:{}}})}}).catch(t=>{this.disposed||this.setView({state:"error",error:{code:"git-unavailable",detail:t instanceof Error?t.message:String(t)}})}).finally(()=>{this.inflight=void 0,this.pendingRefresh&&!this.disposed?(this.pendingRefresh=!1,this.refresh()):this.schedulePoll()}),this.inflight)}resync(){this.disposed||this.refresh()}accept(t){this.disposed||(this.pollMs=t.refreshIntervalMs||cn,this.setView({state:"ready",snapshot:t}),this.schedulePoll())}schedulePoll(){this.disposed||(this.timer!==void 0&&clearTimeout(this.timer),!(this.pollMs<=0)&&(this.timer=setTimeout(()=>{this.refresh()},this.pollMs)))}setView(t){this.view=t;for(let n of this.listeners)n()}dispose(){this.disposed=!0,this.timer!==void 0&&clearTimeout(this.timer),this.timer=void 0,this.listeners.clear()}};var pa="/api",ua="gitPanel";function ga(e){try{let t=e.get("connection")?.rpc,n=t?.call;if(t!==void 0&&typeof n=="function")return(r,a,i)=>n.call(t,pa,r,a,i)}catch{}}function fa(e){let t=e;if(t===null||typeof t!="object")return{ok:!1,error:{code:"git-unavailable",message:"malformed rpc result"}};if(t.ok!==!0){let n=t.error;return{ok:!1,error:{code:typeof n?.code=="string"?n.code:"git-unavailable",message:typeof n?.message=="string"?n.message:void 0}}}return t.value===void 0?{ok:!1,error:{code:"git-unavailable",message:"missing value"}}:t.value}function de(e,t){return!e.ok||e.value.kind!==t?null:e.value}function Me(e){return e!==void 0&&e!==""}var Xn=new WeakMap;function lt(e){let t=Xn.get(e);if(t!==void 0)return t;let n=async(a,i,o)=>{let s=ga(e);if(s===void 0)return{ok:!1,error:{code:"git-unavailable",message:"no connection"}};try{let l=await s(`${ua}/${a}`,{args:{request:i}},o);return fa(l)}catch(l){return{ok:!1,error:{code:"git-unavailable",message:l instanceof Error?l.message:String(l)}}}},r={snapshot:(a,i)=>n("snapshot",a,i),run:(a,i)=>n("run",a,i),query:(a,i)=>n("query",a,i),suggest:(a,i)=>n("suggest",a,i),version:(a,i)=>n("version",a,i)};return Xn.set(e,r),r}var He=new Map,Jn,pn;function Kn(e){pn=e,Jn=lt(e)}function dt(e){let t=He.get(e);if(t===void 0){let n=Jn??(pn?lt(pn):void 0);t=new kt(n??ba(),e),He.set(e,t)}return t}var ma=6e4,_t=new Map;function ha(e){let t=_t.get(e);t!==void 0&&(clearTimeout(t),_t.delete(e)),Ke.set(e,(Ke.get(e)??0)+1)}function ya(e){let t=(Ke.get(e)??1)-1;if(t>0){Ke.set(e,t);return}Ke.delete(e);let n=setTimeout(()=>{_t.delete(e),!((Ke.get(e)??0)>0)&&(He.get(e)?.dispose(),He.delete(e))},ma);_t.set(e,n)}var Ke=new Map;function ct(){for(let e of He.values())e.resync()}function Vn(){for(let e of He.values())e.dispose();He.clear()}function ba(){let e=async()=>({ok:!1,error:{code:"git-unavailable"}});return{snapshot:e,run:e,query:e,suggest:e,version:e}}function Ct(e){let[,t]=(0,St.useState)(0),n=e?dt(e):void 0;return(0,St.useEffect)(()=>{if(n===void 0||e===void 0)return;ha(e);let r=n.subscribe(()=>t(a=>a+1));return n.ensure(),()=>{r(),ya(e)}},[n,e]),n?n.getSnapshot():{state:"cold"}}var E=require("react");var On="[data-conversation-tabs]",ut='[data-conversation-tabs] button[role="tab"]',un=new Map,pt=new Map;function qn(e,t){let n=pt.get(e);if(n!==void 0&&n.size>0){for(let r of n)r(t);return}un.set(e,t)}function Wn(e){let t=un.get(e);return t===void 0?null:(un.delete(e),t)}function jn(e,t){let n=pt.get(e);return n===void 0&&(n=new Set,pt.set(e,n)),n.add(t),()=>{let r=pt.get(e);r!==void 0&&(r.delete(t),r.size===0&&pt.delete(e))}}var va=6e4,gn=new Map;function Un(e,t){gn.set(e,{tab:t,leftAt:Date.now()})}function Qn(e){let t=gn.get(e);return t===void 0?null:Date.now()-t.leftAt>va?(gn.delete(e),null):t.tab}function Yn(e){if(typeof document>"u")return!1;let t=document.querySelectorAll(ut);for(let n of t)if((n.textContent??"").trim()===e)return n.getAttribute("aria-selected")!=="true"&&n.click(),!0;return!1}function Zn(e){if(typeof document>"u")return!1;let t=document.querySelectorAll(ut);for(let n of t)if((n.textContent??"").trim()===e)return n.getAttribute("aria-selected")==="true";return!1}function er(e){if(typeof document>"u")return!1;let t=document.querySelectorAll(ut);for(let n of t)if((n.textContent??"").trim()!==e)return n.getAttribute("aria-selected")!=="true"&&n.click(),!0;return!1}var d=require("react"),Vt=require("react-dom");var R=require("react");function ue(e,t=15){return(0,R.createElement)("svg",{width:t,height:t,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round"},e)}function Tt({size:e}){return ue([(0,R.createElement)("circle",{key:"c",cx:8,cy:8,r:2.4}),(0,R.createElement)("line",{key:"l1",x1:8,y1:1.5,x2:8,y2:5.6}),(0,R.createElement)("line",{key:"l2",x1:8,y1:10.4,x2:8,y2:14.5})],e)}function tr({size:e}){return ue([(0,R.createElement)("path",{key:"a",d:"M4 2v8"}),(0,R.createElement)("path",{key:"b",d:"M2 4h4"}),(0,R.createElement)("circle",{key:"c",cx:4,cy:12,r:1.6}),(0,R.createElement)("circle",{key:"d",cx:12,cy:4,r:1.6}),(0,R.createElement)("path",{key:"e",d:"M12 6v4"}),(0,R.createElement)("path",{key:"f",d:"M10 12h4"})],e)}function fn({size:e}){return ue([(0,R.createElement)("circle",{key:"a",cx:4,cy:3,r:1.6}),(0,R.createElement)("circle",{key:"b",cx:4,cy:13,r:1.6}),(0,R.createElement)("circle",{key:"c",cx:12,cy:5,r:1.6}),(0,R.createElement)("path",{key:"d",d:"M4 4.6v6.8"}),(0,R.createElement)("path",{key:"e",d:"M12 6.6c0 3-4 2.4-8 4"})],e)}function Ve({size:e}){return ue([(0,R.createElement)("path",{key:"a",d:"M2 7V3h4l8 8-4 4z"}),(0,R.createElement)("circle",{key:"b",cx:4.5,cy:5.5,r:.8,fill:"currentColor"})],e)}function Pe({size:e,open:t}){return ue([(0,R.createElement)("path",{key:"a",d:t?"M3 6l5 5 5-5":"M6 3l5 5-5 5"})],e)}function Oe({size:e}){return ue([(0,R.createElement)("path",{key:"a",d:"M4 4l8 8M12 4l-8 8"})],e)}function qe({size:e}){return ue([(0,R.createElement)("path",{key:"a",d:"M10 3L5 8l5 5"}),(0,R.createElement)("path",{key:"b",d:"M5 8h8"})],e)}function nr({size:e}){return ue([(0,R.createElement)("path",{key:"a",d:"M2 3h12l-4.5 5.5V13L6.5 11V8.5z"})],e)}function Nt({size:e}){return ue([(0,R.createElement)("path",{key:"a",d:"M13 8a5 5 0 1 1-1.5-3.5"}),(0,R.createElement)("path",{key:"b",d:"M13 2v3h-3"})],e)}function rr({size:e}){return ue([(0,R.createElement)("path",{key:"a",d:"M8 2.6l1.4 4 4 1.4-4 1.4-1.4 4-1.4-4-4-1.4 4-1.4z"}),(0,R.createElement)("path",{key:"b",d:"M13 11.6v2.8M11.6 13h2.8"})],e)}function ar({size:e}){return ue([(0,R.createElement)("path",{key:"a",d:"M4 2h5l3 3v9H4z"}),(0,R.createElement)("path",{key:"b",d:"M9 2v3h3"})],e)}function mn({size:e}){return ue([(0,R.createElement)("path",{key:"a",d:"M2 5.5h12V13H2z"}),(0,R.createElement)("path",{key:"b",d:"M1.5 3h13v2.5h-13z"}),(0,R.createElement)("path",{key:"c",d:"M6.5 8.5h3"})],e)}function ir({size:e}){return ue([(0,R.createElement)("path",{key:"a",d:"M3 4.5h10"}),(0,R.createElement)("path",{key:"b",d:"M5.5 4.5V3h5v1.5"}),(0,R.createElement)("path",{key:"c",d:"M4.5 4.5l.7 9h5.6l.7-9"})],e)}function or({size:e}){return ue([(0,R.createElement)("path",{key:"a",d:"M3 7a5 5 0 1 1 1.3 3.4"}),(0,R.createElement)("path",{key:"b",d:"M3 3.5V7h3.5"})],e)}function Et({size:e}){return ue([(0,R.createElement)("path",{key:"a",d:"M13 3v10"}),(0,R.createElement)("path",{key:"b",d:"M10.5 8L3 3.5v9z",fill:"currentColor"})],e)}function sr({size:e}){return ue([(0,R.createElement)("path",{key:"a",d:"M5 2.5h4l2.5 2.5v7.5h-6.5z"}),(0,R.createElement)("path",{key:"b",d:"M9 2.5V5h2.5"}),(0,R.createElement)("path",{key:"c",d:"M11 12.5v1.5h-6.5V6"})],e)}function lr({size:e=15}){return(0,R.createElement)("svg",{width:e,height:e,viewBox:"0 0 16 16",fill:"currentColor"},(0,R.createElement)("path",{"fill-rule":"evenodd",d:"M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.01 8.01 0 0 0 16 8c0-4.42-3.58-8-8-8z"}))}function dr({size:e}){return ue([(0,R.createElement)("path",{key:"a",d:"M8 2.5v7"}),(0,R.createElement)("path",{key:"b",d:"M4.5 7L8 10.5 11.5 7"}),(0,R.createElement)("path",{key:"c",d:"M3 13h10"})],e)}function hn({size:e}){return ue([(0,R.createElement)("path",{key:"a",d:"M8 10.5v-7"}),(0,R.createElement)("path",{key:"b",d:"M4.5 6L8 2.5 11.5 6"}),(0,R.createElement)("path",{key:"c",d:"M3 13h10"})],e)}function cr({size:e}){return ue([(0,R.createElement)("path",{key:"a",d:"M12.5 7a4.5 4.5 0 0 0-8-2.3"}),(0,R.createElement)("path",{key:"b",d:"M3.5 9a4.5 4.5 0 0 0 8 2.3"}),(0,R.createElement)("path",{key:"c",d:"M4.3 2.2v2.5h2.5"}),(0,R.createElement)("path",{key:"d",d:"M11.7 13.8v-2.5H9.2"})],e)}function pr({size:e=15,filled:t}){return(0,R.createElement)("svg",{width:e,height:e,viewBox:"0 0 16 16",fill:t?"currentColor":"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round"},(0,R.createElement)("path",{d:"M8 1.8l1.76 3.57 3.94.57-2.85 2.78.67 3.92L8 10.78l-3.52 1.85.67-3.92L2.3 5.94l3.94-.57z"}))}function ur(e){let t=0;for(let n of e){t=Math.max(t,n.lane+1);for(let r of n.edges)t=Math.max(t,r.fromLane+1,r.toLane+1)}return t}function gr(e,t){let n=[],r=[],a=[],i=[],o=0,s=()=>{if(i.length===0)return o++;let c=Math.min(...i);return i.splice(i.indexOf(c),1),c},l=c=>{c!==null&&!i.includes(c)&&i.push(c)};for(let c of e){let p=v=>{let L=r.findIndex(P=>P===v);return L===-1&&(L=r.findIndex(P=>P===null),L===-1&&(L=r.length,r.push(null),a.push(null)),r[L]=v,a[L]=s()),L},u=r.some(v=>v===c.hash),f=p(c.hash),w=a[f],b=[...r],k=[...a],_=c.parents,N=_.length>=2;for(let v=0;v<r.length;v++)v!==f&&r[v]===c.hash&&(l(a[v]),r[v]=null,a[v]=null);let A=-1,J=[];if(_.length===0)l(a[f]),r[f]=null,a[f]=null;else{let v=_[0],L=t==="compact"?r.findIndex((P,W)=>P===v&&W!==f):-1;if(L===-1)r[f]=v,A=f;else{let P=Math.min(f,L),W=Math.max(f,L);r[P]=v,l(a[W]),r[W]=null,a[W]=null,A=P}for(let P=1;P<_.length;P++)J.push(p(_[P]))}let M=[];for(let v=0;v<b.length;v++){let L=b[v];if(L!==null)if(L===c.hash){if(v===f&&!u)continue;M.push({fromLane:v,toLane:f,color:k[v],kind:"into"})}else{let P=r[v]===L?v:r.findIndex(W=>W===L);P!==-1&&M.push({fromLane:v,toLane:P,color:k[v],kind:"pass"})}}A!==-1&&M.push({fromLane:f,toLane:A,color:a[A],kind:"out"});for(let v of J)M.push({fromLane:f,toLane:v,color:a[v],kind:"out"});for(n.push({commit:c,lane:f,color:w,edges:M,merge:N});r.length>0&&r[r.length-1]===null;)r=r.slice(0,-1),a=a.slice(0,-1)}return n}function fr(e){let t={name:"",path:"",dir:!0,children:[]};for(let n of e){let r=n.path.split("/").filter(o=>o!==""),a=t,i="";for(let o=0;o<r.length;o++){let s=r[o];i=i===""?s:`${i}/${s}`;let l=o===r.length-1,c=a.children.find(p=>p.name===s&&p.dir===!l);c===void 0&&(c={name:s,path:i,dir:!l,children:[],...l?{meta:n.meta}:{}},a.children.push(c)),a=c}}return mr(t),hr(t.children)}function mr(e){e.children.sort((t,n)=>t.dir!==n.dir?t.dir?-1:1:t.name.localeCompare(n.name));for(let t of e.children)mr(t)}function hr(e){return e.map(t=>{if(!t.dir)return t;let n=t;for(;n.children.length===1&&n.children[0].dir;){let r=n.children[0];n={name:`${n.name}/${r.name}`,path:r.path,dir:!0,children:r.children}}return{...n,children:hr(n.children)}})}function We(e,t,n){if(e===null)return"";let r=typeof e=="number"?e:Date.parse(e);if(!Number.isFinite(r))return"";let a=Math.max(0,t-r),i=Math.floor(a/6e4);if(i<1)return n("time.justNow");if(i<60)return n("time.minutesAgo",{n:i});let o=Math.floor(i/60);if(o<24)return n("time.hoursAgo",{n:o});let s=Math.floor(o/24);return n("time.daysAgo",{n:s})}function gt(e){if(e===null)return"";let t=new Date(typeof e=="number"?e:Date.parse(e));if(Number.isNaN(t.getTime()))return"";let n=r=>String(r).padStart(2,"0");return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())} ${n(t.getHours())}:${n(t.getMinutes())}`}function yn(e){if(e===null)return"";let t=new Date(typeof e=="number"?e:Date.parse(e));if(Number.isNaN(t.getTime()))return"";let n=r=>String(r).padStart(2,"0");return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())} ${n(t.getHours())}:${n(t.getMinutes())}:${n(t.getSeconds())}`}var Rt={added:"A",modified:"M",deleted:"D",renamed:"R",untracked:"U",conflicted:"!",typechange:"T"};function Gt(e){return e==="added"||e==="untracked"?"gp-status--added":e==="deleted"?"gp-status--deleted":e==="renamed"?"gp-status--renamed":"gp-status--modified"}var x=require("react");var wa={png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",webp:"image/webp",avif:"image/avif",bmp:"image/bmp",svg:"image/svg+xml",ico:"image/x-icon",tif:"image/tiff",tiff:"image/tiff"};function bn(e){let t=e.lastIndexOf(".");return t<0?null:wa[e.slice(t+1).toLowerCase()]??null}function yr(e){return/^Binary files .* differ$/m.test(e)||/^GIT binary patch$/m.test(e)}function br(e){return bn(e)!==null}function vr(e){return/\.svg$/i.test(e)}function xa(e){let t=vn(e);return t.length===0?!1:t.every(n=>n.startsWith("+")||n.startsWith(" "))&&t.some(n=>n.startsWith("+"))&&/^\+\+\+ /m.test(e)&&/--- \/dev\/null/m.test(e)}function ka(e){let t=vn(e);return t.length===0?!1:t.every(n=>n.startsWith("-")||n.startsWith(" "))&&t.some(n=>n.startsWith("-"))&&/^\+\+\+ \/dev\/null/m.test(e)}function vn(e){let t=e.split(`
535
- `),n=[],r=!1;for(let a of t){if(a.startsWith("@@")){r=!0;continue}if(r){if(a.startsWith("diff ")||a.startsWith("index ")){r=!1;continue}a!==""&&n.push(a)}}return n}function wr(e){let t=0,n=0;for(let r of vn(e))r.startsWith("+")?t++:r.startsWith("-")&&n++;return{add:t,del:n}}var _a=/@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/;function xr(e){let t=[],n=e.split(`
536
- `),r=0,a=0,i=!0,o=!1,s=0;for(;s<n.length&&!n[s].startsWith("@@");s++);for(;s<n.length;s++){let l=n[s];if(l.startsWith("@@")){let u=_a.exec(l);if(u){let f=Number(u[1]),w=Number(u[3]),b=f-w;if(i)w>1&&t.push(je({rightStart:1,count:w-1,delta:b,atStart:!0,atEnd:!1}));else{let k=w-a;k>0&&t.push(je({rightStart:a,count:k,delta:b,atStart:!1,atEnd:!1}))}r=f,a=w,i=!1}t.push({kind:"hunk",leftNo:null,rightNo:null,leftText:null,rightText:null,text:l});continue}if(l.startsWith("\\"))continue;let c=l[0],p=l.slice(1);c==="+"?(t.push({kind:"add",leftNo:null,rightNo:a,leftText:null,rightText:p}),a++,o=!0):c==="-"?(t.push({kind:"del",leftNo:r,rightNo:null,leftText:p,rightText:null}),r++,o=!0):c===" "&&(t.push({kind:"context",leftNo:r,rightNo:a,leftText:p,rightText:p}),r++,a++,o=!0)}return o&&!i&&!xa(e)&&!ka(e)&&t.push(je({rightStart:a,count:null,delta:r-a,atStart:!1,atEnd:!0})),Sa(t)}function je(e){return{kind:"gap",leftNo:null,rightNo:null,leftText:null,rightText:null,gap:e}}function Sa(e){let t=[],n=0;for(;n<e.length;){let r=e[n];if(r.kind==="del"){let a=[],i=n;for(;i<e.length&&e[i].kind==="del";)a.push(e[i]),i++;let o=[];for(;i<e.length&&e[i].kind==="add";)o.push(e[i]),i++;let s=Math.max(a.length,o.length);for(let l=0;l<s;l++){let c=a[l],p=o[l];if(c&&p){let u=Ca(c.leftText??"",p.rightText??"");t.push({kind:"mod",leftNo:c.leftNo,rightNo:p.rightNo,leftText:c.leftText,rightText:p.rightText,...u!==null?{leftWord:u.left,rightWord:u.right}:{}})}else c?t.push({kind:"del",leftNo:c.leftNo,rightNo:null,leftText:c.leftText,rightText:null}):p&&t.push({kind:"add",leftNo:null,rightNo:p.rightNo,leftText:null,rightText:p.rightText})}n=i}else t.push(r),n++}return t}function Ca(e,t){let n=Math.min(e.length,t.length),r=0;for(;r<n&&e[r]===t[r];)r++;let a=0;for(;a<n-r&&e[e.length-1-a]===t[t.length-1-a];)a++;return r===0&&a===0?null:{left:[r,e.length-a],right:[r,t.length-a]}}function Ta(e,t,n){return n.map((r,a)=>{let i=t+a;return{kind:"context",leftNo:i+e,rightNo:i,leftText:r,rightText:r}})}var ke=20;function wn(e){let t=[];for(let n of e)n.kind==="mod"?(t.push({kind:"del",leftNo:n.leftNo,rightNo:null,leftText:n.leftText,rightText:null,...n.leftWord!==void 0?{leftWord:n.leftWord}:{}}),t.push({kind:"add",leftNo:null,rightNo:n.rightNo,leftText:null,rightText:n.rightText,...n.rightWord!==void 0?{rightWord:n.rightWord}:{}})):t.push(n);return t}function kr(e,t,n,r,a,i){let o=e.findIndex(u=>u.kind==="gap"&&u.gap?.rightStart===t);if(o<0)return e.slice();let s=e[o].gap,l=Ta(s.delta,r,a),c=[];if(s.atEnd)return c.push(...l),!i&&a.length>0&&c.push(je({rightStart:r+a.length,count:null,delta:s.delta,atStart:!1,atEnd:!0})),[...e.slice(0,o),...c,...e.slice(o+1)];let p=s.count??a.length;if(n==="all"||a.length>=p)c.push(...l);else if(n==="down"){c.push(...l);let u=p-a.length;c.push(je({rightStart:s.rightStart+a.length,count:u,delta:s.delta,atStart:!1,atEnd:!1}))}else{let u=p-a.length;c.push(je({rightStart:s.rightStart,count:u,delta:s.delta,atStart:s.atStart,atEnd:!1})),c.push(...l)}return[...e.slice(0,o),...c,...e.slice(o+1)]}var It=require("@deepseek-ai/dsh-client-ui-primitives");function _r(e,t){let n=[[],[],[]],r=0;for(let a of e){let i=r+a.text.length,o=[r,Math.max(r,Math.min(i,t[0])),Math.max(r,Math.min(i,t[1])),i];for(let s=0;s<3;s++){let l=a.text.slice(o[s]-r,o[s+1]-r);l!==""&&n[s].push({text:l,style:a.style})}r=i}return n}var ye=require("react"),Mt=5e3,Pt=120;function Dt(e,t){let[n,r]=(0,ye.useState)(e);return(0,ye.useEffect)(()=>{let a=setTimeout(()=>r(e),t);return()=>clearTimeout(a)},[e,t]),n}function At(e,t){if(t==="")return[];let n=[],r=0;for(;;){let a=e.indexOf(t,r);if(a<0)break;n.push([a,a+t.length]),r=a+t.length}return n}function xn(e,t,n,r,a){if(n>=r)return[];if(e===void 0)return[t.slice(n,r)];let i=[],o=0,s=0;for(let l of e){let c=o+l.text.length,p=Math.max(n,o),u=Math.min(r,c);if(u>p&&i.push((0,ye.createElement)("span",{key:`${a}-${s++}`,style:l.style},l.text.slice(p-o,u-o))),o=c,o>=r)break}return i}function Lt(e,t,n,r,a,i){let o=[],s=0,l=[...t].sort((c,p)=>c[0]-p[0]);for(let[c,p]of l){if(c<s)continue;c>s&&o.push(...xn(n,e,s,c,`${r}b${s}`));let u=a!==null&&a[0]===c&&a[1]===p;o.push((0,ye.createElement)("mark",{key:`mk${r}-${c}`,className:`gp-find-hit${u?" gp-find-hit--active":""}`,...u?{ref:i}:{}},xn(n,e,c,p,`mk${r}-${c}`))),s=p}return s<e.length&&o.push(...xn(n,e,s,e.length,`${r}e`)),o}function Ht(e){return(0,ye.createElement)("div",{key:"find",className:"gp-find"},[(0,ye.createElement)("input",{key:"in",ref:e.inputRef,className:"gp-find__input",type:"text",placeholder:e.t("files.findPlaceholder"),value:e.query,spellCheck:!1,"aria-label":e.t("files.findPlaceholder"),onChange:t=>e.onChange(t.target.value),onKeyDown:t=>{t.key==="Escape"?(t.preventDefault(),t.stopPropagation(),e.onClose()):t.key==="Enter"&&(t.preventDefault(),e.onStep(t.shiftKey?-1:1))}}),(0,ye.createElement)("button",{key:"case",type:"button",className:`gp-find__btn gp-find__case${e.caseSensitive?" gp-find__case--active":""}`,title:e.t("files.findCase"),"aria-label":e.t("files.findCase"),"aria-pressed":e.caseSensitive,onClick:()=>e.onToggleCase()},"Aa"),(0,ye.createElement)("span",{key:"cnt",className:"gp-find__count"},e.query===""?"":e.matches===0?e.t("files.findNoMatch"):`${e.active+1}/${e.matches}`),(0,ye.createElement)("button",{key:"prev",type:"button",className:"gp-find__btn",title:e.t("files.findPrev"),"aria-label":e.t("files.findPrev"),disabled:e.matches===0,onClick:()=>e.onStep(-1)},"\u2039"),(0,ye.createElement)("button",{key:"next",type:"button",className:"gp-find__btn",title:e.t("files.findNext"),"aria-label":e.t("files.findNext"),disabled:e.matches===0,onClick:()=>e.onStep(1)},"\u203A"),(0,ye.createElement)("button",{key:"x",type:"button",className:"gp-find__btn",title:e.t("files.findClose"),"aria-label":e.t("files.findClose"),onClick:()=>e.onClose()},"\u2715")])}var Ne=require("react");function Ft(e,t,n){let r=n(`diff.${e}`);return(0,Ne.createElement)("div",{className:`gp-imgcmp__pane gp-imgcmp__pane--${e}`},[(0,Ne.createElement)("div",{key:"head",className:"gp-imgcmp__head"},r),t===void 0?(0,Ne.createElement)("div",{key:"missing",className:"gp-imgcmp__missing"},n("diff.imageMissing")):(0,Ne.createElement)("div",{key:"img",className:"gp-imgcmp__img"},(0,Ne.createElement)("img",{src:t,alt:r}))])}function Sr({oldUrl:e,newUrl:t,mode:n,t:r}){return n==="before"?(0,Ne.createElement)("div",{className:"gp-imgcmp gp-imgcmp--single"},Ft("before",e,r)):n==="after"?(0,Ne.createElement)("div",{className:"gp-imgcmp gp-imgcmp--single"},Ft("after",t,r)):(0,Ne.createElement)("div",{className:"gp-imgcmp"},[Ft("before",e,r),Ft("after",t,r)])}var Bt=(0,x.memo)(function({text:t,mode:n,path:r,remote:a,sessionId:i,imageSpec:o,t:s}){let l=(0,x.useMemo)(()=>xr(t),[t]),c=yr(t),p=(0,It.useCodeHighlighter)(r===void 0?void 0:(0,It.languageForPath)(r)),[u,f]=(0,x.useState)(l);(0,x.useEffect)(()=>{f(l)},[l]);let w=Ra(u,f,a,i,r,o),b=r!==void 0&&vr(r),[k,_]=(0,x.useState)("render");(0,x.useEffect)(()=>{_("render")},[r]);let A=(c||b)&&r!==void 0&&br(r)&&a!==void 0&&i!==void 0&&o!==void 0&&(!b||k==="render"),J=Ma(A?a:void 0,A?i:void 0,A?r:void 0,A?o:void 0),[M,v]=(0,x.useState)(!1),[L,P]=(0,x.useState)(""),[W,S]=(0,x.useState)(!1),[$,oe]=(0,x.useState)(0),ee=(0,x.useRef)(null),ce=(0,x.useRef)(null),ne=(0,x.useRef)(null);(0,x.useEffect)(()=>{v(!1),P(""),oe(0)},[t,r]);let z=(0,x.useMemo)(()=>Na(n,u),[n,u]),te=(0,x.useMemo)(()=>z.map(Y=>({key:Y.key,text:Y.text.toLowerCase()})),[z]),T=Dt(L,Pt),pe=W?T:T.toLowerCase(),H=W?z:te,C=(0,x.useMemo)(()=>Ea(H,pe),[H,pe]);(0,x.useEffect)(()=>{oe(0)},[pe]);let I=C.length===0?0:Math.min($,C.length-1),B=C.length>0?C[I]:null,U=(0,x.useMemo)(()=>{let Y=new Map;for(let Q of C){let he=Y.get(Q.cellKey)??[];he.push([Q.start,Q.end]),Y.set(Q.cellKey,he)}return Y},[C]);(0,x.useEffect)(()=>{let Y=Q=>{if(!((Q.ctrlKey||Q.metaKey)&&(Q.key==="f"||Q.key==="F")))return;let he=ee.current;he===null||he.offsetParent===null||(Q.preventDefault(),v(!0),requestAnimationFrame(()=>ce.current?.select()))};return document.addEventListener("keydown",Y),()=>document.removeEventListener("keydown",Y)},[]),(0,x.useEffect)(()=>{ne.current?.scrollIntoView({block:"center",inline:"nearest"})},[I,C]);let ge=(0,x.useCallback)(Y=>{oe(Q=>C.length===0?0:(Q+Y+C.length)%C.length)},[C.length]),D=M&&pe!==""?{perCell:U,activeKey:B?.cellKey??null,activeRange:B?[B.start,B.end]:null,activeRef:ne}:null;if(A){let Y=(()=>{if(J.kind==="idle"||J.kind==="loading")return(0,x.createElement)("div",{className:"gp-empty"},s("common.loading"));if(J.kind==="ready"){let Q=J.res;if(Q.tooLarge===!0)return(0,x.createElement)("div",{className:"gp-empty"},s("diff.tooLarge"));if(Q.mime!==null&&(Q.old!==void 0||Q.new!==void 0))return(0,x.createElement)(Sr,{oldUrl:Q.old,newUrl:Q.new,mode:n,t:s})}return(0,x.createElement)("div",{className:"gp-empty"},s("diff.binary"))})();return b?Cr(k,_,Y,s):Y}if(c&&!b)return(0,x.createElement)("div",{className:"gp-empty"},s("diff.binary"));let re=(()=>{if(t.trim()==="")return(0,x.createElement)("div",{className:"gp-empty"},s("diff.empty"));if(n==="before")return Tr(Er(u),p,D);if(n==="after")return Tr(Rr(u),p,D);if(n==="unified"){let Y=wn(u);return(0,x.createElement)("div",{className:"gp-diff__unified"},Y.flatMap((Q,he)=>Da(Q,he,p,w,D,s)))}return(0,x.createElement)("div",{className:"gp-diff__side"},u.flatMap((Y,Q)=>Pa(Y,Q,p,w,D,s)))})(),me=M?(0,x.createElement)(Ht,{inputRef:ce,query:L,matches:C.length,active:I,caseSensitive:W,onChange:P,onToggleCase:()=>S(Y=>!Y),onStep:ge,onClose:()=>v(!1),t:s}):null,ve=(0,x.createElement)("div",{className:"gp-diff__wrap",ref:ee},[me,re]);return b?Cr(k,_,ve,s):ve});function Na(e,t){let n=[];return e==="before"?(Er(t).forEach((r,a)=>n.push({key:`c${a}`,text:r.text})),n):e==="after"?(Rr(t).forEach((r,a)=>n.push({key:`c${a}`,text:r.text})),n):e==="unified"?(wn(t).forEach((r,a)=>{if(r.kind==="hunk"||r.kind==="gap")return;let i=r.rightText??r.leftText??"";i!==""&&n.push({key:`c${a}`,text:i})}),n):(t.forEach((r,a)=>{r.kind==="hunk"||r.kind==="gap"||(r.leftText!==null&&r.leftText!==""&&n.push({key:`l${a}`,text:r.leftText}),r.rightText!==null&&r.rightText!==""&&n.push({key:`r${a}`,text:r.rightText}))}),n)}function Ea(e,t){if(t==="")return[];let n=[];for(let r of e)for(let[a,i]of At(r.text,t))if(n.push({cellKey:r.key,start:a,end:i}),n.length>=Mt)return n;return n}function Cr(e,t,n,r){let a=(i,o)=>(0,x.createElement)("button",{key:i,type:"button",className:`gp-seg__btn${e===i?" gp-seg__btn--active":""}`,"aria-pressed":e===i,onClick:()=>t(i)},o);return(0,x.createElement)("div",{className:"gp-svgdiff"},[(0,x.createElement)("div",{key:"bar",className:"gp-svgdiff__bar"},(0,x.createElement)("div",{className:"gp-seg"},[a("render",r("diff.svgRender")),a("source",r("diff.svgSource"))])),(0,x.createElement)("div",{key:"body",className:"gp-svgdiff__body"},n)])}function Ra(e,t,n,r,a,i){let[o,s]=(0,x.useState)(null),l=(0,x.useRef)(0);(0,x.useEffect)(()=>{l.current+=1,s(null)},[e]);let c=(0,x.useCallback)((p,u)=>{if(n===void 0||r===void 0||a===void 0||i===void 0)return;let f=`${p.rightStart}:${u}`;s(f);let w=++l.current,{start:b,end:k}=Ga(p,u),_=i.base==="commit"&&i.commit!==void 0?{kind:"file-lines",path:a,base:"commit",commit:i.commit,start:b,end:k}:i.base==="staged"?{kind:"file-lines",path:a,base:"staged",start:b,end:k}:{kind:"file-lines",path:a,base:"worktree",start:b,end:k};n.query({sessionId:r,query:_}).then(N=>{if(w!==l.current)return;let A=de(N,"file-lines");s(null),A!==null&&t(J=>kr(J,p.rightStart,u,A.start,A.lines,A.eof))}).catch(()=>{w===l.current&&s(null)})},[n,r,a,i,t]);return{busy:o,run:c}}function Ga(e,t){if(e.atEnd)return{start:e.rightStart,end:e.rightStart+ke-1};let n=e.count??ke;return t==="all"||n<=ke?{start:e.rightStart,end:e.rightStart+n-1}:t==="down"?{start:e.rightStart,end:e.rightStart+ke-1}:{start:e.rightStart+n-ke,end:e.rightStart+n-1}}function Ma(e,t,n,r){let[a,i]=(0,x.useState)({kind:"idle"}),o=r?.base,s=r?.commit;return(0,x.useEffect)(()=>{if(e===void 0||t===void 0||n===void 0||o===void 0)return;let l=!0;i({kind:"loading"});let c=o==="commit"&&s!==void 0?{kind:"image-diff",path:n,base:"commit",commit:s}:o==="staged"?{kind:"image-diff",path:n,base:"staged"}:{kind:"image-diff",path:n,base:"worktree"};return e.query({sessionId:t,query:c}).then(p=>{if(!l)return;let u=de(p,"image-diff");i(u!==null?{kind:"ready",res:u}:{kind:"failed"})}).catch(()=>{l&&i({kind:"failed"})}),()=>{l=!1}},[e,t,n,o,s]),a}function zt(e,t=""){return e.map((n,r)=>(0,x.createElement)("span",{key:`${t}${r}`,style:n.style},n.text))}function Nr(e,t,n,r){if(n===null)return null;let a=n.perCell.get(t);if(a===void 0||a.length===0)return null;let i=n.activeKey===t?n.activeRange:null;return Lt(e,a,r,t,i,n.activeRef)}function $t(e,t,n,r,a=null){if(n==="")return(0,x.createElement)("div",{key:t,className:e},"\xA0");let i=r(n)?.[0],o=Nr(n,t,a,i);return o!==null?(0,x.createElement)("div",{key:t,className:e},o):(0,x.createElement)("div",{key:t,className:e},i===void 0?n:zt(i))}function kn(e,t,n,r,a,i,o=null){let s=i(n)?.[0]??[{text:n,style:{}}],l=Nr(n,t,o,s);if(l!==null)return(0,x.createElement)("div",{key:t,className:e},l);let[c,p,u]=_r(s,r);return(0,x.createElement)("div",{key:t,className:e},[...zt(c,"p"),(0,x.createElement)("span",{key:"w",className:a},p.length===0?"\xA0":zt(p)),...zt(u,"s")])}function Er(e){return e.filter(t=>t.leftText!==null).map(t=>({no:t.leftNo,text:t.leftText}))}function Rr(e){return e.filter(t=>t.rightText!==null).map(t=>({no:t.rightNo,text:t.rightText}))}function Tr(e,t,n=null){return(0,x.createElement)("div",{className:"gp-diff__single"},e.flatMap((r,a)=>[(0,x.createElement)("div",{key:`n${a}`,className:"gp-diff-no"},r.no??""),$t("gp-diff-cell",`c${a}`,r.text,t,n)]))}function Pa(e,t,n,r,a,i){if(e.kind==="hunk")return[(0,x.createElement)("div",{key:`h${t}`,className:"gp-diff-row--hunk gp-diff-cell",style:{gridColumn:"1 / -1"}},e.text??"")];if(e.kind==="gap")return[Gr(e.gap,t,r,i)];let o=e.kind==="del"||e.kind==="mod"?"gp-diff-row--del":"",s=e.kind==="add"||e.kind==="mod"?"gp-diff-row--add":"",l=e.leftText===null?(0,x.createElement)("div",{key:`l${t}`,className:`gp-diff-cell ${o}`}):e.kind==="mod"&&e.leftWord!==void 0?kn(`gp-diff-cell ${o}`,`l${t}`,e.leftText,e.leftWord,"gp-diff-word gp-diff-word--del",n,a):$t(`gp-diff-cell ${o}`,`l${t}`,e.leftText,n,a),c=e.rightText===null?(0,x.createElement)("div",{key:`r${t}`,className:`gp-diff-cell ${s}`}):e.kind==="mod"&&e.rightWord!==void 0?kn(`gp-diff-cell ${s}`,`r${t}`,e.rightText,e.rightWord,"gp-diff-word gp-diff-word--add",n,a):$t(`gp-diff-cell ${s}`,`r${t}`,e.rightText,n,a);return[(0,x.createElement)("div",{key:`ln${t}`,className:"gp-diff-no"},e.leftNo??""),l,(0,x.createElement)("div",{key:`rn${t}`,className:"gp-diff-no"},e.rightNo??""),c]}function Da(e,t,n,r,a,i){if(e.kind==="hunk")return[(0,x.createElement)("div",{key:`h${t}`,className:"gp-diff-row--hunk gp-diff-cell",style:{gridColumn:"1 / -1"}},e.text??"")];if(e.kind==="gap")return[Gr(e.gap,t,r,i)];let o=e.kind==="del",s=e.kind==="add",l=s?"gp-diff-row--add":o?"gp-diff-row--del":"",c=s?"+":o?"\u2212":"\xA0",p=e.rightText??e.leftText??"",u=s?e.rightWord:o?e.leftWord:void 0,f=s?"gp-diff-word gp-diff-word--add":"gp-diff-word gp-diff-word--del",w=`gp-diff-cell gp-diff-uni__code ${l}`,b=u!==void 0?kn(w,`c${t}`,p,u,f,n,a):$t(w,`c${t}`,p,n,a);return[(0,x.createElement)("div",{key:`ol${t}`,className:"gp-diff-no"},e.leftNo??""),(0,x.createElement)("div",{key:`nl${t}`,className:"gp-diff-no"},e.rightNo??""),(0,x.createElement)("div",{key:`sg${t}`,className:`gp-diff-uni__sign ${l}`},c),b]}function Gr(e,t,n,r){let a=n.busy===`${e.rightStart}:all`,i=n.busy===`${e.rightStart}:up`,o=n.busy===`${e.rightStart}:down`,s=(c,p,u)=>(0,x.createElement)("button",{key:c,type:"button",className:"gp-gap__btn",disabled:n.busy!==null,onClick:f=>{f.stopPropagation(),n.run(e,c)}},u?r("common.loading"):p),l=[];if(e.atEnd)l.push(s("down",r("diff.expandDown",{n:ke}),o));else{let c=e.count??0;c>0&&c<=ke?l.push(s("all",r("diff.expandGap",{n:c}),a)):(e.atStart||l.push(s("up",r("diff.expandUp",{n:ke}),i)),l.push(s("all",r("diff.expandGap",{n:c}),a)),l.push(s("down",r("diff.expandDown",{n:ke}),o)))}return(0,x.createElement)("div",{key:`g${t}`,className:"gp-diff-row--gap",style:{gridColumn:"1 / -1"}},l)}function Xt(e){return wr(e)}var F=require("react");var Aa=100;function Mr(e,t,n){let[r,a]=(0,F.useState)(null),[i,o]=(0,F.useState)(!1),[s,l]=(0,F.useState)([]),c=(0,F.useCallback)(()=>{o(!1),(async()=>{let[p,u]=await Promise.all([e.query({sessionId:t,query:{kind:"branches"}}),e.query({sessionId:t,query:{kind:"tags"}})]),f=de(p,"branches");if(f===null){o(!0);return}let w=de(u,"tags");a({current:f.current,defaultBranch:f.defaultBranch,local:f.local,remote:f.remote,tags:w?.tags??[]}),e.query({sessionId:t,query:{kind:"authors"}}).then(b=>{l(de(b,"authors")?.authors??[])})})()},[e,t]);return(0,F.useEffect)(()=>{c()},[n]),{tree:r,treeError:i,authors:s,reload:c}}function Pr(e,t,n,r,a){let[i,o]=(0,F.useState)([]),[s,l]=(0,F.useState)(0),[c,p]=(0,F.useState)(!1),[u,f]=(0,F.useState)(!1),w=(0,F.useRef)(0),b=(0,F.useRef)(!1),k=(0,F.useRef)(null),_=(0,F.useCallback)(async(M,v)=>{if(b.current)return;b.current=!0;let L=w.current;p(!0),f(!1);let P=await e.query({sessionId:t,query:{kind:"history",limit:Aa,skip:M,...v.ref?{ref:v.ref}:{},...v.search?{search:v.search}:{},...v.author?{author:v.author}:{},...v.since?{since:v.since}:{}}});if(b.current=!1,L!==w.current)return;p(!1);let W=de(P,"history");if(W===null){f(!0);return}let S=W.commits;o($=>M===0?S:[...$,...S]),l(W.total)},[e,t]),N=(0,F.useRef)(n);(0,F.useEffect)(()=>{w.current+=1,b.current=!1,N.current!==n&&(N.current=n,a(),k.current&&(k.current.scrollTop=0)),_(0,n)},[n,r]);let A=s<0?!0:i.length<s,J=(0,F.useCallback)(()=>{b.current||!A||_(i.length,n)},[_,i.length,n,A]);return{commits:i,total:s,loading:c,listError:u,hasMore:A,listRef:k,loadMore:J}}function Dr(e,t,n){let[r,a]=(0,F.useState)(null),[i,o]=(0,F.useState)(null),[s,l]=(0,F.useState)(!1),[c,p]=(0,F.useState)(null),[u,f]=(0,F.useState)(null),[w,b]=(0,F.useState)(!1),[k,_]=(0,F.useState)(n),[N,A]=(0,F.useState)(!1),J=(0,F.useRef)(0),M=(0,F.useRef)(null),v=(0,F.useRef)(new Map),L=(0,F.useCallback)((C,I)=>{let B=v.current;for(B.set(C,I);B.size>50;){let U=B.keys().next().value;if(U===void 0)break;B.delete(U)}},[]),P=(0,F.useCallback)(()=>{a(null),o(null),M.current=null},[]),W=(0,F.useCallback)(C=>{M.current===C.hash&&a(C)},[]),S=(0,F.useCallback)(async C=>{M.current=C.hash,a(C),l(!1),J.current+=1,p(null),f(null),b(!1);let I=v.current.get(C.hash);if(I!==void 0){o(I);return}o(null);let B=await e.query({sessionId:t,query:{kind:"show",ref:C.hash}});if(M.current!==C.hash)return;let U=de(B,"show");if(U!==null){let ge={commit:U.commit,body:U.body,stats:U.stats,insertions:U.insertions,deletions:U.deletions};L(C.hash,ge),o(ge)}else l(!0)},[e,t,L]),$=(0,F.useCallback)(async(C,I,B,U=!1)=>{let ge=++J.current;p({path:C,hash:I,shortHash:B}),f(null),b(!1),A(U);let D=await e.query({sessionId:t,query:{kind:"diff",path:C,base:"commit",commit:I,...U?{context:1e5}:{}}});if(ge!==J.current)return;let re=de(D,"diff");re!==null?f(re.text):b(!0)},[e,t]),oe=(0,F.useCallback)(()=>{J.current+=1,p(null),f(null),b(!1),A(!1)},[]);(0,F.useEffect)(()=>{if(c===null)return;let C=I=>{I.key==="Escape"&&oe()};return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[c,oe]);let[ee,ce]=(0,F.useState)(null),[ne,z]=(0,F.useState)(null),te=(0,F.useRef)(void 0),T=(0,F.useRef)(null),pe=(0,F.useCallback)((C,I,B)=>{te.current!==void 0&&clearTimeout(te.current),te.current=setTimeout(()=>{T.current=C.hash,ce({commit:C,x:I,y:B});let U=v.current.get(C.hash);if(U!==void 0){z(U.body);return}z(null),e.query({sessionId:t,query:{kind:"show",ref:C.hash}}).then(ge=>{if(T.current!==C.hash)return;let D=de(ge,"show");D!==null?(L(C.hash,{commit:D.commit,body:D.body,stats:D.stats,insertions:D.insertions,deletions:D.deletions}),z(D.body)):z("")})},260)},[e,t,L]),H=(0,F.useCallback)(()=>{te.current!==void 0&&clearTimeout(te.current),T.current=null,ce(null),z(null)},[]);return(0,F.useEffect)(()=>()=>{te.current!==void 0&&clearTimeout(te.current)},[]),{selected:r,detail:i,detailError:s,select:S,resyncSelected:W,clearSelection:P,fileDiff:c,fileDiffText:u,fileDiffError:w,fileDiffMode:k,setFileDiffMode:_,fileDiffExpanded:N,openFileDiff:$,closeFileDiff:oe,hover:ee,hoverBody:ne,onHoverEnter:pe,onHoverLeave:H}}var xe=require("react"),La=(e,t,n)=>Math.max(t,Math.min(n,e));function Ha(e,t){try{let n=typeof localStorage<"u"?localStorage.getItem(e):null,r=n===null?NaN:Number(n);return Number.isFinite(r)?r:t}catch{return t}}function Fa(e,t){try{typeof localStorage<"u"&&localStorage.setItem(e,String(Math.round(t)))}catch{}}function Fe(e){let{storageKey:t,initial:n,min:r,reserve:a,edge:i}=e,[o,s]=(0,xe.useState)(()=>Ha(t,n)),l=(0,xe.useRef)(null),c=(0,xe.useRef)(null),p=(0,xe.useCallback)(f=>{let b=l.current?.parentElement?.clientWidth??Number.MAX_SAFE_INTEGER;c.current={x:f.clientX,w:o,max:Math.max(r,b-a)},f.preventDefault(),typeof document<"u"&&(document.body.style.cursor="col-resize",document.body.style.userSelect="none")},[o,r,a]);(0,xe.useEffect)(()=>{if(typeof window>"u")return;let f=b=>{let k=c.current;if(k===null)return;let _=b.clientX-k.x;s(La(k.w+(i==="end"?_:-_),r,k.max))},w=()=>{c.current!==null&&(c.current=null,typeof document<"u"&&(document.body.style.cursor="",document.body.style.userSelect=""),s(b=>(Fa(t,b),b)))};return window.addEventListener("pointermove",f),window.addEventListener("pointerup",w),()=>{window.removeEventListener("pointermove",f),window.removeEventListener("pointerup",w)}},[i,r,t]);let u=(0,xe.createElement)("div",{key:`rz-${t}`,ref:l,className:"gp-resizer",role:"separator","aria-orientation":"vertical",onPointerDown:p});return{width:o,divider:u}}var Ar=require("react");function ze(e,t,n,r,a=!1){return e.map(i=>(0,Ar.createElement)("button",{key:i,type:"button",className:`gp-seg__btn${t===i?" gp-seg__btn--active":""}`,...a?{disabled:!0}:{},onClick:()=>n(i)},r(i)))}var le=require("react"),Lr=require("react-dom");function ft(e,t,n){switch(e){case"empty-message":return n("error.emptyMessage");case"not-a-git-repo":return n("error.notARepo");case"cwd-unavailable":return n("error.noCwd");case"local-changes-block":return n("error.localChangesBlock");case"not-ff":return n("error.notFastForward");case"push-rejected":return n("error.pushRejected");case"auth-failed":return n("error.authFailed");case"conflict":return n("error.conflict");case"revert-conflict":return n("error.revertConflict");case"revert-stuck":return n("error.revertStuck");case"revert-merge":return n("error.revertMerge");case"index-busy":return n("error.indexBusy");case"not-found":return n("error.notFound");case"invalid-name":case"invalid-index":return n("error.invalidName");default:return t??n("error.generic")}}function Ue(e){return(0,le.createElement)("div",{key:"aihint",className:"gp-modal__hint"},e("ops.aiHint"))}function Qe(e){return(0,le.createElement)("div",{key:"footer",className:"gp-modal__footer"},[(0,le.createElement)("button",{key:"cancel",type:"button",className:"gp-btn",onClick:e.onClose},e.t("common.cancel")),(0,le.createElement)("button",{key:"ok",type:"button",className:`gp-btn ${e.danger?"gp-btn--danger":"gp-btn--primary"}`,disabled:e.confirmDisabled,onClick:e.onConfirm},e.confirmLabel)])}function Ye(e){return typeof document>"u"?null:(0,le.createElement)(za,e)}function za({onClose:e,title:t,icon:n,hash:r,body:a,footer:i,overlay:o,portalKey:s,t:l}){let c=o!=null;(0,le.useEffect)(()=>{let u=f=>{f.key==="Escape"&&!c&&e()};return document.addEventListener("keydown",u),()=>document.removeEventListener("keydown",u)},[e,c]);let p=(0,le.createElement)("div",{className:"gp-modal-backdrop",onClick:u=>{!c&&u.target===u.currentTarget&&e()}},(0,le.createElement)("div",{className:"gp-modal gp-modal--sm",role:"dialog","aria-modal":!0},[(0,le.createElement)("div",{key:"bar",className:"gp-modal__bar"},[n!==void 0?(0,le.createElement)("span",{key:"ic",className:"gp-modal__fileicon"},n):null,(0,le.createElement)("span",{key:"title",className:"gp-modal__path"},t),r!==void 0?(0,le.createElement)("span",{key:"hash",className:"gp-modal__hash"},r):null,(0,le.createElement)("button",{key:"close",type:"button",className:"gp-icon-btn gp-modal__close",title:l("common.close"),disabled:c,onClick:e},(0,le.createElement)(Oe,{size:15}))]),(0,le.createElement)("div",{key:"body",className:"gp-modal__form"},a),i,o??null]));return(0,Lr.createPortal)(p,document.body,s)}function $a(e){return(0,le.createElement)("div",{key:"overlay",className:"gp-modal__overlay"},[(0,le.createElement)("div",{key:"sp",className:"gp-spinner"}),(0,le.createElement)("div",{key:"lb",className:"gp-modal__overlay-label"},e)])}function De(e){let t=e.confirmBusy===!0&&e.busyLabel!==void 0;return Ye({onClose:e.onClose,title:e.title,portalKey:"confirm-modal",t:e.t,body:[(0,le.createElement)("div",{key:"txt",className:"gp-modal__confirmtext"},e.body),e.extra??null,Ue(e.t),e.error!==null?(0,le.createElement)("div",{key:"err",className:"gp-feedback"},e.error):null],footer:Qe({onClose:e.onClose,onConfirm:e.onConfirm,confirmLabel:e.confirmLabel,confirmDisabled:e.confirmBusy===!0,danger:e.danger,t:e.t}),...t?{overlay:$a(e.busyLabel)}:{}})}var q=require("react");function Hr(e,t){return typeof document>"u"?null:(0,q.createElement)(Ia,{target:e,...t})}function Ia({target:e,onClose:t,onCreate:n,error:r,t:a}){let[i,o]=(0,q.useState)(""),[s,l]=(0,q.useState)(!1),[c,p]=(0,q.useState)(""),u=()=>{i.trim()!==""&&n(i.trim(),s?c:"")};return Ye({onClose:t,title:a("tag.createTitle"),icon:(0,q.createElement)(Ve,{size:15}),hash:e.shortHash,portalKey:"tag-create-modal",t:a,body:[(0,q.createElement)("input",{key:"name",className:"gp-input",placeholder:a("tag.namePlaceholder"),value:i,autoFocus:!0,onChange:f=>o(f.target.value),onKeyDown:f=>{f.key==="Enter"&&u()}}),(0,q.createElement)("label",{key:"ann",className:"gp-modal__check"},[(0,q.createElement)("input",{key:"cb",type:"checkbox",className:"gp-check",checked:s,onChange:()=>l(f=>!f)}),a("tag.annotated")]),s?(0,q.createElement)("textarea",{key:"msg",className:"gp-input gp-input--area",placeholder:a("tag.messagePlaceholder"),value:c,onChange:f=>p(f.target.value)}):null,Ue(a),r!==null?(0,q.createElement)("div",{key:"err",className:"gp-feedback"},r):null],footer:Qe({onClose:t,onConfirm:u,confirmLabel:a("tag.create"),confirmDisabled:i.trim()==="",danger:!1,t:a})})}function Fr(e,t){return typeof document>"u"?null:(0,q.createElement)(Ba,{target:e,...t})}function Ba({target:e,from:t,dirty:n,lostFiles:r,lostTotal:a,lostTruncated:i,busy:o,error:s,onReset:l,onClose:c,t:p}){let[u,f]=(0,q.useState)("mixed"),[w,b]=(0,q.useState)(!1);(0,q.useEffect)(()=>{u!=="hard"&&b(!1)},[u]);let k=[{value:"mixed",label:"reset.modeMixed",hint:"reset.mixedHint"},{value:"soft",label:"reset.modeSoft",hint:"reset.softHint"},{value:"hard",label:"reset.modeHard",hint:"reset.hardHint"}],_=o||u==="hard"&&!w;return Ye({onClose:c,title:p("reset.title"),icon:(0,q.createElement)(Et,{size:15}),hash:e.shortHash,portalKey:"reset-modal",t:p,body:[(0,q.createElement)("div",{key:"txt",className:"gp-modal__confirmtext"},p("reset.body",{from:t,to:e.shortHash})),(0,q.createElement)("div",{key:"modes",className:"gp-reset__modes"},k.map(N=>(0,q.createElement)("label",{key:N.value,className:`gp-reset__mode${u===N.value?" gp-reset__mode--on":""}${N.value==="hard"?" gp-reset__mode--danger":""}`},[(0,q.createElement)("input",{key:"r",type:"radio",name:"gp-reset-mode",className:"gp-check",checked:u===N.value,onChange:()=>f(N.value)}),(0,q.createElement)("span",{key:"tx",className:"gp-reset__modetext"},[(0,q.createElement)("span",{key:"l",className:"gp-reset__modelabel"},p(N.label)),(0,q.createElement)("span",{key:"h",className:"gp-reset__modehint"},p(N.hint))])]))),u==="hard"?(0,q.createElement)("div",{key:"orphan",className:"gp-reset__dirtywarn"},p("reset.hardOrphan")):null,u==="hard"&&a>0?(0,q.createElement)("div",{key:"lost",className:"gp-reset__lost"},[(0,q.createElement)("div",{key:"w",className:"gp-reset__warn"},p("reset.hardWarn")),(0,q.createElement)("ul",{key:"ul",className:"gp-reset__lostlist"},[...r.map(N=>(0,q.createElement)("li",{key:N,title:N},N)),i?(0,q.createElement)("li",{key:"_more",className:"gp-reset__lostmore"},p("reset.lostMore")):null])]):null,u==="hard"?(0,q.createElement)("label",{key:"ack",className:"gp-modal__check gp-reset__ack"},[(0,q.createElement)("input",{key:"cb",type:"checkbox",className:"gp-check",checked:w,onChange:()=>b(N=>!N)}),p(a>0?"reset.hardAck":"reset.hardAckClean")]):null,n?(0,q.createElement)("div",{key:"dirty",className:"gp-reset__dirtywarn"},p("ops.dirtyWarn")):null,Ue(p),s!==null?(0,q.createElement)("div",{key:"err",className:"gp-feedback"},s):null],footer:Qe({onClose:c,onConfirm:()=>void l(u),confirmLabel:p("reset.confirm"),confirmDisabled:_,danger:u==="hard",t:p})})}var ae=require("react");var _e=require("react"),zr=require("react-dom"),Xa=140,Ja=260;function Jt(e){let t=e?.placement??"above",n=e?.delayMs??Xa,r=e?.maxWidth??Ja,[a,i]=(0,_e.useState)(null),o=(0,_e.useRef)(void 0),s=(0,_e.useCallback)(()=>{o.current!==void 0&&(clearTimeout(o.current),o.current=void 0),i(null)},[]),l=(0,_e.useCallback)((f,w)=>{o.current!==void 0&&clearTimeout(o.current),o.current=setTimeout(()=>{let b=f.getBoundingClientRect(),k=Math.max(8,Math.min(b.left,window.innerWidth-r-8));i(t==="below"?{text:w,left:k,top:b.bottom+6}:{text:w,left:k,bottom:Math.max(8,window.innerHeight-b.top+6)})},n)},[t,n,r]),c=(0,_e.useCallback)(f=>({onMouseEnter:w=>l(w.currentTarget,f),onMouseLeave:s,onFocus:w=>l(w.currentTarget,f),onBlur:s}),[l,s]),p={left:a?.left??0,maxWidth:r};a?.top!==void 0&&(p.top=a.top),a?.bottom!==void 0&&(p.bottom=a.bottom);let u=a!==null&&typeof document<"u"?(0,zr.createPortal)((0,_e.createElement)("div",{className:"gp-tip gp-tip--sb",style:p},a.text),document.body):null;return{tipProps:c,tipNode:u,hideTip:s}}function $r(e,t,n){if(e==="loading"||e===null)return(0,ae.createElement)("div",{className:"gp-pullscope gp-pullscope--loading"},t(n.loading));let r=t(n.line,{commits:e.commits,files:e.files,ins:e.insertions,del:e.deletions}),a=r.match(/(\+\d+)\s*\/\s*([-−]\d+)/);if(a===null)return(0,ae.createElement)("div",{className:"gp-pullscope"},r);let i=r.indexOf(a[0]);return(0,ae.createElement)("div",{className:"gp-pullscope"},[r.slice(0,i),(0,ae.createElement)("span",{key:"add",className:"gp-pullscope__add"},a[1])," / ",(0,ae.createElement)("span",{key:"del",className:"gp-pullscope__del"},a[2]),r.slice(i+a[0].length)])}function Ir(e,t){return $r(e,t,{line:"status.pullScope",loading:"status.pullScopeLoading"})}function Br(e,t){return $r(e,t,{line:"status.pushScope",loading:"status.pushScopeLoading"})}function Ka(e){let t=e.replace(/^https?:\/\/[^/]+\//,"").replace(/\/+$/,""),n=t.split("/");return n.length>=2?n.slice(-2).join("/"):t}function _n(e,t){return(0,ae.createElement)(Va,{snapshot:e,cb:t})}function Va({snapshot:e,cb:t}){let{t:n}=t,{tipProps:r,tipNode:a,hideTip:i}=Jt({placement:"above"}),o=e.remote??null,s=e.hasUpstream===!0,l=(()=>{if(o===null||o.hostKind!=="github")return null;let N=(0,ae.createElement)(lr,{size:14});if(o.webUrl===null)return(0,ae.createElement)("span",{key:"r",className:"gp-statusbar__repo gp-statusbar__repo--none","aria-label":o.url,...r(o.url)},(0,ae.createElement)("span",{className:"gp-statusbar__ic"},N));let A=o.host!==null?n("status.openRepoOn",{host:o.host}):n("status.openRepo"),J=`${Ka(o.webUrl)} \xB7 ${A}`;return(0,ae.createElement)("a",{key:"r",className:"gp-statusbar__repo",href:o.webUrl,target:"_blank",rel:"noreferrer","aria-label":J,...r(J)},(0,ae.createElement)("span",{className:"gp-statusbar__ic"},N))})(),{ahead:c,behind:p,branch:u}=e,f=s&&p>0&&c===0,w=s&&c>0&&p===0,b=!s&&u!==null&&o!==null,k=(()=>{let N,A="";return u===null?N=n("status.detached"):s?c===0&&p===0?(N=n("status.synced"),A=" gp-statusbar__state--ok"):c>0&&p>0?(N=n("status.diverged",{ahead:c,behind:p}),A=" gp-statusbar__state--warn"):p>0?(N=n("status.behind",{n:p}),A=" gp-statusbar__state--warn"):N=n("status.ahead",{n:c}):N=n("status.noUpstream"),(0,ae.createElement)("span",{key:"s",className:`gp-statusbar__state${A}`},N)})(),_=[o!==null?(0,ae.createElement)("button",{key:"check",type:"button",className:"gp-icon-btn gp-statusbar__btn",disabled:t.syncBusy,"aria-label":n("status.check"),...r(n("status.checkTitle")),onClick:()=>{i(),t.onCheck()}},(0,ae.createElement)(cr,{size:13})):null,f?(0,ae.createElement)("button",{key:"pull",type:"button",className:"gp-btn gp-btn--sm gp-statusbar__pull",disabled:t.pullBusy,"aria-label":n("status.pullTitle"),...r(n("status.pullTitle")),onClick:()=>{i(),t.onPull()}},[(0,ae.createElement)(dr,{key:"i",size:12}),n("status.pull")]):null,w?(0,ae.createElement)("button",{key:"push",type:"button",className:"gp-btn gp-btn--sm gp-statusbar__pull",disabled:t.pushBusy,"aria-label":n("status.pushTitle"),...r(n("status.pushTitle")),onClick:()=>{i(),t.onPush()}},[(0,ae.createElement)(hn,{key:"i",size:12}),n("status.push")]):null,b?(0,ae.createElement)("button",{key:"publish",type:"button",className:"gp-btn gp-btn--sm gp-statusbar__pull",disabled:t.publishBusy,"aria-label":n("status.publishTitle"),...r(n("status.publishTitle")),onClick:()=>{i(),t.onPublish()}},[(0,ae.createElement)(hn,{key:"i",size:12}),n("status.publish")]):null];return(0,ae.createElement)("div",{key:"statusbar",className:`gp-statusbar${t.syncBusy?" gp-statusbar--busy":""}`},[l,(0,ae.createElement)("div",{key:"sync",className:"gp-statusbar__sync"},[k,..._]),a])}var Ze=14,Xr=30;function Oa(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n].kind!==t[n].kind||e[n].name!==t[n].name||e[n].head!==t[n].head)return!1;return!0}var qa=46,Wa=260;function ja(e,t){let[n,r]=(0,d.useState)(!1);return(0,d.useEffect)(()=>{if(e===null||typeof ResizeObserver>"u")return;let a=()=>r(e.clientWidth>0&&e.clientWidth<t);a();let i=new ResizeObserver(a);return i.observe(e),()=>i.disconnect()},[e,t]),n}function Jr({remote:e,sessionId:t,refreshKey:n,defaultDiffView:r,snapshot:a,onAction:i,onResync:o,compact:s,t:l}){let[c,p]=(0,d.useState)({ref:null,search:"",author:"",since:""}),[u,f]=(0,d.useState)(""),[w,b]=(0,d.useState)(null),k=ja(w,Wa),[_,N]=(0,d.useState)(new Set(["tags","remote"])),[A,J]=(0,d.useState)(0),M=n+A,v=()=>J(h=>h+1),[L,P]=(0,d.useState)(null),[W,S]=(0,d.useState)(null),[$,oe]=(0,d.useState)(null),[ee,ce]=(0,d.useState)(null),[ne,z]=(0,d.useState)(null),[te,T]=(0,d.useState)(!1),[pe,H]=(0,d.useState)(!1),[C,I]=(0,d.useState)(!1),[B,U]=(0,d.useState)(!1),[ge,D]=(0,d.useState)(!1),[re,me]=(0,d.useState)(!1),[ve,Y]=(0,d.useState)(!1),[Q,he]=(0,d.useState)(!1),[en,Ae]=(0,d.useState)(null),[Re,Ie]=(0,d.useState)(null),[ht,tt]=(0,d.useState)("list"),[Be,Le]=(0,d.useState)(!1);(0,d.useEffect)(()=>{if(!Be)return;let h=X=>{X.key==="Escape"&&Le(!1)};return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[Be]),(0,d.useEffect)(()=>{!s&&Be&&Le(!1)},[s,Be]),(0,d.useEffect)(()=>{if(!B){Ae(null);return}let h=!0;return Ae("loading"),e.query({sessionId:t,query:{kind:"pull-preview"}}).then(X=>{if(!h)return;let Z=de(X,"pull-preview");Ae(Z!==null&&Z.hasUpstream?{commits:Z.commits,files:Z.files,insertions:Z.insertions,deletions:Z.deletions}:null)}),()=>{h=!1}},[B,e,t]),(0,d.useEffect)(()=>{if(!re){Ie(null);return}let h=!0;return Ie("loading"),e.query({sessionId:t,query:{kind:"push-preview"}}).then(X=>{if(!h)return;let Z=de(X,"push-preview");Ie(Z!==null&&Z.hasUpstream?{commits:Z.commits,files:Z.files,insertions:Z.insertions,deletions:Z.deletions}:null)}),()=>{h=!1}},[re,e,t]);let{tree:yt,treeError:Xe,authors:tn,reload:Se}=Mr(e,t,M),K=Dr(e,t,r),{commits:Ce,loading:nt,listError:nn,hasMore:we,listRef:bt,loadMore:rn}=Pr(e,t,c,M,K.clearSelection);(0,d.useEffect)(()=>{let h=setTimeout(()=>p(X=>X.search===u?X:{...X,search:u}),300);return()=>clearTimeout(h)},[u]);let Ge=c.search!=="",rt=(0,d.useMemo)(()=>Ge?Ce.map(h=>({commit:h,lane:0,color:0,edges:[],merge:!1})):gr(Ce,a.graphStyle),[Ce,Ge,a.graphStyle]),vt=(0,d.useMemo)(()=>Ge?0:ur(rt),[rt,Ge]),at=Ge?12:Math.max(Ze,vt*Ze),an=s?qa:Xr,on=s?`${at}px minmax(0,1fr)`:`${at}px minmax(120px,1fr) 72px 120px 96px`,Je=()=>{let h=bt.current;h===null||!we||h.scrollTop+h.clientHeight>=h.scrollHeight-240&&rn()},wt=h=>{K.select(h),s&&tt("detail")},sn=(0,d.useMemo)(()=>Date.now(),[Ce]),ln=(0,d.useMemo)(()=>K.detail===null?[]:fr(K.detail.stats.map(h=>({path:h.path,meta:h.status}))),[K.detail]),j=K.selected;(0,d.useEffect)(()=>{if(j===null)return;let h=Ce.find(X=>X.hash===j.hash);h!==void 0&&h!==j&&!Oa(h.refs,j.refs)&&K.resyncSelected(h)},[Ce,j]);let it=Fe({storageKey:"gp.overview.left",initial:200,min:130,reserve:360,edge:"end"}),ot=Fe({storageKey:"gp.overview.right",initial:340,min:190,reserve:360,edge:"start"}),st=h=>p(X=>({...X,ref:h})),y=async(h,X)=>{if(!(L===null||te)){z(null),T(!0);try{let Z=await e.run({sessionId:t,action:{kind:"tag-create",name:h,commit:L.hash,...X.trim()!==""?{message:X}:{}}});Z.ok?(P(null),v()):z(ft(Z.error.code,Z.error.message,l))}finally{T(!1)}}},G=async h=>{if(!te){z(null),T(!0);try{let X=await e.run({sessionId:t,action:{kind:"tag-delete",name:h}});X.ok?(S(null),v()):z(ft(X.error.code,X.error.message,l))}finally{T(!1)}}},V=async()=>{if(!($===null||te)){z(null),T(!0);try{let h=await i({kind:"revert",commit:$.hash});h.ok?oe(null):z(h.error??l("error.generic"))}finally{T(!1)}}},se=async h=>{if(!(ee===null||te)){z(null),T(!0);try{let X=await i({kind:"reset",commit:ee.hash,mode:h});X.ok?ce(null):z(X.error??l("error.generic"))}finally{T(!1)}}},fe=async()=>{if(!pe){z(null),H(!0);try{let h=await i({kind:"fetch"});h.ok?Se():z(h.error??l("error.generic"))}finally{H(!1)}}},Te=async()=>{if(!C){z(null),I(!0);try{let h=await i({kind:"pull-ff"});h.ok?(U(!1),Se()):z(h.error??l("error.generic"))}finally{I(!1)}}},xt=async()=>{if(!ge){z(null),D(!0);try{let h=await i({kind:"push"});h.ok?(me(!1),Se()):z(h.error??l("error.generic"))}finally{D(!1)}}},sa=async()=>{if(!(ve||a.remote===null)){z(null),Y(!0);try{let h=await i({kind:"publish",remote:a.remote.name});h.ok?(he(!1),Se()):z(h.error??l("error.generic"))}finally{Y(!1)}}},Dn={syncBusy:pe,pullBusy:C,pushBusy:ge,publishBusy:ve,onCheck:()=>void fe(),onPull:()=>{z(null),U(!0)},onPush:()=>{z(null),me(!0)},onPublish:()=>{z(null),he(!0)},t:l},An=ti(K.fileDiff,{text:K.fileDiffText,error:K.fileDiffError,mode:K.fileDiffMode,onMode:K.setFileDiffMode,expanded:K.fileDiffExpanded,onExpand:h=>{K.fileDiff!==null&&K.openFileDiff(K.fileDiff.path,K.fileDiff.hash,K.fileDiff.shortHash,h)},onClose:K.closeFileDiff,remote:e,sessionId:t,compact:s,t:l}),Ln=(0,d.useMemo)(()=>[...new Set(a.changes.filter(h=>h.status!=="untracked").map(h=>h.path))],[a.changes]),Hn=[L!==null?Hr(L,{onClose:()=>P(null),onCreate:y,error:ne,compact:s,t:l}):null,W!==null?De({title:l("tag.deleteTitle"),body:l("tag.deleteConfirm",{name:W}),confirmLabel:l("tag.deleteTitle"),danger:!0,error:ne,confirmBusy:te,onConfirm:()=>void G(W),onClose:()=>S(null),t:l}):null,$!==null?De({title:l("revert.title"),body:l("revert.body",{ref:`${$.shortHash} ${$.subject}`})+(a.dirty?`
535
+ `,cn=!1;function Bn(){if(cn||typeof document>"u")return;let e="dsh-git-panel/client.css";if(document.querySelector(`style[data-plugin-css="${e}"]`)!==null){cn=!0;return}let t=document.createElement("style");t.dataset.plugin="@xbzbing/dsh-git-panel",t.dataset.pluginCss=e,t.textContent=ma,document.head.appendChild(t),cn=!0}var Xn={"panel.tab":"Git","panel.fontDecrease":"\u7F29\u5C0F\u5B57\u4F53","panel.fontReset":"\u91CD\u7F6E\u5B57\u4F53\u5927\u5C0F","panel.fontIncrease":"\u653E\u5927\u5B57\u4F53","tab.overview":"Git \u603B\u89C8","tab.changes":"\u53D8\u66F4\u8BB0\u5F55","tab.files":"\u6587\u4EF6\u6D4F\u89C8","pill.unavailable":"Git \u4E0D\u53EF\u7528","pill.detached":"\u6E38\u79BB HEAD","pill.synced":"\u672C\u5730\u5DF2\u540C\u6B65","pill.dirty":"\u6709\u5F85\u63D0\u4EA4\u7684\u53D8\u66F4","common.loading":"\u52A0\u8F7D\u4E2D\u2026","common.retry":"\u91CD\u8BD5","common.close":"\u5173\u95ED","common.cancel":"\u53D6\u6D88","ops.aiHint":"\u63D0\u793A\uFF1A\u7ED9 AI \u591A\u4E00\u70B9\u4FE1\u4EFB\uFF0C\u4F60\u53EF\u4EE5\u5C1D\u8BD5\u8BA9 AI \u76F4\u63A5\u6267\u884C Git \u64CD\u4F5C\u3002","version.check":"\u68C0\u67E5\u65B0\u7248\u672C","version.checking":"\u68C0\u67E5\u4E2D\u2026","version.upToDate":"\u5DF2\u662F\u6700\u65B0\uFF08{current}\uFF09","version.updateAvailable":"\u6709\u65B0\u7248\u672C {latest}\uFF08\u5F53\u524D {current}\uFF09","version.viewRelease":"\u67E5\u770B\u53D1\u5E03","version.error":"\u68C0\u67E5\u5931\u8D25","version.noRepo":"\u672A\u914D\u7F6E\u4ED3\u5E93\u5730\u5740","version.openRepo":"\u8BBF\u95EE GitHub \u67E5\u770B @xbzbing/dsh-git-panel \u9879\u76EE\uFF0C\u8BF7\u4E3A\u9879\u76EE\u70B9\u4EAE\u4E00\u9897\u5C0F\u661F\u661F\u5427 \u2B50","overview.head":"\u5168\u90E8\u5206\u652F","overview.local":"\u672C\u5730","overview.remote":"\u8FDC\u7A0B","overview.tags":"\u6807\u7B7E","overview.search":"\u641C\u7D22\u63D0\u4EA4\uFF08\u6D88\u606F / \u54C8\u5E0C\uFF09","overview.searchShort":"\u641C\u7D22\u63D0\u4EA4","overview.allUsers":"\u5168\u90E8\u4F5C\u8005","overview.allTime":"\u5168\u90E8\u65F6\u95F4","overview.today":"\u4ECA\u5929","overview.last7d":"\u8FD1 7 \u5929","overview.last30d":"\u8FD1 30 \u5929","overview.selectCommit":"\u9009\u62E9\u4E00\u4E2A\u63D0\u4EA4\u67E5\u770B\u8BE6\u60C5","overview.noMessage":"\uFF08\u65E0\u63D0\u4EA4\u6B63\u6587\uFF09","overview.noResults":"\u6CA1\u6709\u5339\u914D\u7684\u63D0\u4EA4","overview.loadFailed":"\u52A0\u8F7D\u5931\u8D25","overview.detailFailed":"\u8BE6\u60C5\u52A0\u8F7D\u5931\u8D25","overview.diffFailed":"\u5DEE\u5F02\u52A0\u8F7D\u5931\u8D25","overview.openFileDiff":"\u67E5\u770B\u8BE5\u6587\u4EF6\u5728\u6B64\u63D0\u4EA4\u4E2D\u7684\u53D8\u66F4","overview.changeSummary":"{files} \u4E2A\u6587\u4EF6","overview.expandDir":"\u5C55\u5F00\u76EE\u5F55","overview.collapseDir":"\u6298\u53E0\u76EE\u5F55","overview.fetch":"\u62C9\u53D6\u8FDC\u7A0B","overview.branchesError":"\u5206\u652F\u52A0\u8F7D\u5931\u8D25","overview.filterBranch":"\u6309\u5206\u652F\u7B5B\u9009","overview.backToList":"\u8FD4\u56DE\u5217\u8868","overview.createTag":"\u521B\u5EFA\u6807\u7B7E","overview.revert":"\u8FD8\u539F\u6B64\u63D0\u4EA4","overview.reset":"\u91CD\u7F6E\u5230\u6B64","tag.createTitle":"\u5728\u6B64\u63D0\u4EA4\u521B\u5EFA\u6807\u7B7E","tag.namePlaceholder":"\u6807\u7B7E\u540D","tag.annotated":"\u9644\u6CE8\u6807\u7B7E\uFF08\u5E26\u8BF4\u660E\uFF09","tag.messagePlaceholder":"\u6807\u7B7E\u8BF4\u660E","tag.create":"\u521B\u5EFA\u6807\u7B7E","tag.deleteTitle":"\u5220\u9664\u6807\u7B7E","tag.deleteConfirm":"\u786E\u5B9A\u5220\u9664\u6807\u7B7E\u300C{name}\u300D\uFF1F","tag.deleteOne":"\u5220\u9664\u6807\u7B7E\u300C{name}\u300D","ops.dirtyWarn":"\u68C0\u6D4B\u5230\u672A\u63D0\u4EA4\u6539\u52A8\uFF0C\u8FD9\u4E9B\u6539\u52A8\u53EF\u80FD\u662F dsh AI \u6B63\u5728\u8FDB\u884C\u7684\u5DE5\u4F5C\u3002","revert.title":"\u8FD8\u539F\u63D0\u4EA4","revert.body":"\u5C06\u5728\u5F53\u524D HEAD \u8FFD\u52A0\u4E00\u4E2A\u53CD\u5411\u63D0\u4EA4\uFF0C\u8FD8\u539F {ref} \u7684\u6539\u52A8\u3002\u4E0D\u4F1A\u4E22\u5F03\u4F60\u7684\u5DE5\u4F5C\u533A\u6539\u52A8\u3002","revert.confirm":"\u8FD8\u539F","reset.title":"\u91CD\u7F6E\u5206\u652F","reset.body":"\u5C06\u628A\u5F53\u524D\u5206\u652F\u7684 HEAD \u4ECE {from} \u79FB\u52A8\u5230 {to}\u3002","reset.modeSoft":"\u8F6F\u91CD\u7F6E\uFF08--soft\uFF09","reset.softHint":"\u79FB\u52A8 HEAD\uFF0C\u6539\u52A8\u4FDD\u7559\u5728\u6682\u5B58\u533A\u3002","reset.modeMixed":"\u6DF7\u5408\u91CD\u7F6E\uFF08--mixed\uFF0C\u9ED8\u8BA4\uFF09","reset.mixedHint":"\u79FB\u52A8 HEAD\uFF0C\u6539\u52A8\u4FDD\u7559\u5728\u5DE5\u4F5C\u533A\u3002","reset.modeHard":"\u786C\u91CD\u7F6E\uFF08--hard\uFF09","reset.hardHint":"\u79FB\u52A8 HEAD \u5230\u6B64\u63D0\u4EA4\u5E76\u4E22\u5F03\u6240\u6709\u672A\u63D0\u4EA4\u6539\u52A8\uFF08\u672A\u63D0\u4EA4\u6539\u52A8\u65E0\u6CD5\u6062\u590D\uFF09\u3002","reset.hardOrphan":"\u5F53\u524D\u5206\u652F\u4E0A\u665A\u4E8E\u76EE\u6807\u7684\u63D0\u4EA4\u4F1A\u79BB\u5F00\u5206\u652F\uFF08\u4ECD\u53EF\u7528 git reflog \u627E\u56DE\uFF09\u3002","reset.hardWarn":"\u4EE5\u4E0B\u672A\u63D0\u4EA4\u6539\u52A8\u5C06\u88AB\u6C38\u4E45\u4E22\u5F03\uFF1A","reset.lostMore":"\u2026\u8FD8\u6709\u66F4\u591A\u672A\u63D0\u4EA4\u6539\u52A8\u672A\u663E\u793A\uFF08\u5217\u8868\u5DF2\u622A\u65AD\uFF09","reset.hardAck":"\u6211\u5DF2\u4E86\u89E3\uFF0C\u786E\u8BA4\u4E22\u5F03\u8FD9\u4E9B\u672A\u63D0\u4EA4\u6539\u52A8","reset.hardAckClean":"\u6211\u5DF2\u4E86\u89E3\u6B64\u64CD\u4F5C\u7684\u540E\u679C\uFF0C\u786E\u8BA4\u91CD\u7F6E","reset.confirm":"\u91CD\u7F6E","changes.groupStaged":"\u5DF2\u6682\u5B58\u7684\u66F4\u6539","changes.groupUnstaged":"\u66F4\u6539","changes.groupUntracked":"\u672A\u7248\u672C\u63A7\u5236\u7684\u6587\u4EF6","changes.selectFile":"\u9009\u62E9\u4E00\u4E2A\u6587\u4EF6\u67E5\u770B\u53D8\u66F4","changes.noChanges":"\u6CA1\u6709\u672A\u63D0\u4EA4\u7684\u53D8\u66F4","changes.stageAll":"\u5168\u90E8\u6682\u5B58","changes.unstageAll":"\u5168\u90E8\u53D6\u6D88\u6682\u5B58","changes.stage":"\u6682\u5B58","changes.unstage":"\u53D6\u6D88\u6682\u5B58","changes.discard":"\u653E\u5F03\u66F4\u6539","changes.discardConfirm":"\u518D\u6B21\u70B9\u51FB\u4EE5\u786E\u8BA4\u653E\u5F03","changes.backToList":"\u8FD4\u56DE\u5217\u8868","changes.stash":"\u8D2E\u85CF\u66F4\u6539","stash.title":"\u8D2E\u85CF\u5F53\u524D\u66F4\u6539","stash.messagePlaceholder":"\u8D2E\u85CF\u8BF4\u660E\uFF08\u53EF\u9009\uFF09","stash.save":"\u8D2E\u85CF","stash.section":"\u8D2E\u85CF","stash.onBranch":"\u4F4D\u4E8E {branch}","stash.apply":"\u5E94\u7528","stash.pop":"\u5F39\u51FA","stash.drop":"\u4E22\u5F03","stash.dropTitle":"\u4E22\u5F03\u8D2E\u85CF","stash.dropConfirm":"\u786E\u5B9A\u4E22\u5F03\u6B64\u8D2E\u85CF\u6761\u76EE\uFF1F\u4E22\u5F03\u540E\u65E0\u6CD5\u6062\u590D\uFF1A{name}","files.selectFile":"\u9009\u62E9\u4E00\u4E2A\u6587\u4EF6\u67E5\u770B\u5185\u5BB9","files.loadFailed":"\u52A0\u8F7D\u5931\u8D25","files.backToTree":"\u8FD4\u56DE\u6587\u4EF6\u6811","files.truncated":"\u6761\u76EE\u8FC7\u591A\uFF0C\u5DF2\u622A\u65AD","files.tooLarge":"\u6587\u4EF6\u8FC7\u5927\uFF0C\u65E0\u6CD5\u9884\u89C8","files.binary":"\u4E8C\u8FDB\u5236\u6587\u4EF6\uFF0C\u65E0\u6CD5\u9884\u89C8","files.highlightOff":"\u6587\u4EF6\u8F83\u5927\uFF0C\u5DF2\u5173\u95ED\u8BED\u6CD5\u9AD8\u4EAE\u4EE5\u4FDD\u6301\u6D41\u7545","files.lineTruncated":" \u2026\uFF08\u6B64\u884C\u8FC7\u957F\uFF0C\u5DF2\u622A\u65AD\uFF09","files.findPlaceholder":"\u5728\u6B64\u6587\u4EF6\u4E2D\u67E5\u627E","files.findNoMatch":"\u65E0\u5339\u914D","files.findPrev":"\u4E0A\u4E00\u4E2A","files.findNext":"\u4E0B\u4E00\u4E2A","files.findClose":"\u5173\u95ED\u67E5\u627E","files.findCase":"\u533A\u5206\u5927\u5C0F\u5199","files.previewMode":"\u9884\u89C8\u65B9\u5F0F","files.source":"\u6E90\u7801","files.render":"\u6E32\u67D3","files.copyPath":"\u590D\u5236\u76F8\u5BF9\u8DEF\u5F84","files.pathCopied":"\u8DEF\u5F84\u5DF2\u590D\u5236","files.pathCopyFailed":"\u590D\u5236\u5931\u8D25","files.copyContent":"\u590D\u5236\u6587\u4EF6\u5185\u5BB9","files.contentCopied":"\u5185\u5BB9\u5DF2\u590D\u5236","files.contentCopyFailed":"\u590D\u5236\u5931\u8D25","files.ignored":"\u5DF2\u88AB Git \u5FFD\u7565","files.copy":"\u590D\u5236\u4EE3\u7801","files.copied":"\u5DF2\u590D\u5236","files.footnotes":"\u6CE8\u91CA","files.gitNotInstalled":"\u7CFB\u7EDF\u672A\u5B89\u88C5 Git\uFF0CGit \u9762\u677F\u4E0D\u53EF\u7528\uFF0C\u8BF7\u5B89\u88C5 Git \u5DE5\u5177\u540E\u91CD\u8BD5\u3002","stats.files":"{n} \u4E2A\u6587\u4EF6","stats.lastChange":"\u6700\u8FD1\u53D8\u66F4 {time}","stats.lastCommit":"\u4E0A\u6B21\u63D0\u4EA4 {time}","stats.staged":"\u5DF2\u6682\u5B58 {n}","stats.modified":"\u5DF2\u4FEE\u6539 {n}","stats.untracked":"\u672A\u8DDF\u8E2A {n}","stats.partial":"\u7EDF\u8BA1\u5DF2\u7B80\u5316","stats.partialHint":"\u53D8\u66F4\u6570\u91CF\u8F83\u591A\uFF0C\u5DF2\u8DF3\u8FC7\u672A\u8DDF\u8E2A\u6587\u4EF6\u884C\u6570\u4E0E\u6700\u8FD1\u53D8\u66F4\u65F6\u95F4\u7684\u7CBE\u786E\u7EDF\u8BA1\u4EE5\u4FDD\u6301\u9762\u677F\u6D41\u7545\u3002","commit.placeholder":"\u63D0\u4EA4\u4FE1\u606F","commit.commit":"\u63D0\u4EA4","commit.amend":"\u4FEE\u6B63\u4E0A\u6B21\u63D0\u4EA4\uFF08amend\uFF09","commit.suggest":"AI \u751F\u6210","commit.suggesting":"\u751F\u6210\u4E2D\u2026","commit.suggestOverwrite":"\u518D\u6B21\u70B9\u51FB\u300CAI \u751F\u6210\u300D\u4EE5\u8986\u76D6\u5F53\u524D\u63D0\u4EA4\u4FE1\u606F","commit.suggestTruncated":"diff \u8FC7\u957F\u5DF2\u622A\u65AD\uFF0C\u751F\u6210\u7684\u5EFA\u8BAE\u53EF\u80FD\u4E0D\u5B8C\u6574","diff.unified":"\u7EDF\u4E00","diff.split":"\u5BF9\u7167","diff.before":"\u53D8\u66F4\u524D","diff.after":"\u53D8\u66F4\u540E","diff.binary":"\u4E8C\u8FDB\u5236\u6587\u4EF6\uFF0C\u65E0\u6CD5\u663E\u793A\u5BF9\u7167","diff.tooLarge":"\u56FE\u7247\u8FC7\u5927\uFF0C\u65E0\u6CD5\u663E\u793A\u5BF9\u7167","diff.imageMissing":"\u4E0D\u5B58\u5728","diff.svgRender":"\u6E32\u67D3","diff.svgSource":"\u6E90\u7801","diff.empty":"\u65E0\u5DEE\u5F02","diff.expandAll":"\u5C55\u5F00\u5168\u90E8","diff.collapse":"\u6298\u53E0\u672A\u53D8\u66F4","diff.expandGap":"\u5C55\u5F00\u5168\u90E8 {n} \u884C","diff.expandUp":"\u5411\u4E0A\u5C55\u5F00 {n} \u884C","diff.expandDown":"\u5411\u4E0B\u5C55\u5F00 {n} \u884C","time.justNow":"\u521A\u521A","time.minutesAgo":"{n} \u5206\u949F\u524D","time.hoursAgo":"{n} \u5C0F\u65F6\u524D","time.daysAgo":"{n} \u5929\u524D","error.generic":"\u64CD\u4F5C\u5931\u8D25","error.notARepo":"\u5F53\u524D\u76EE\u5F55\u4E0D\u662F Git \u4ED3\u5E93","error.noCwd":"\u5F53\u524D\u4F1A\u8BDD\u65E0\u5DE5\u4F5C\u76EE\u5F55","error.localChangesBlock":"\u672C\u5730\u6709\u672A\u63D0\u4EA4\u53D8\u66F4\uFF0C\u64CD\u4F5C\u88AB\u963B\u6B62","error.emptyMessage":"\u63D0\u4EA4\u4FE1\u606F\u4E0D\u80FD\u4E3A\u7A7A","error.emptyDiff":"\u6CA1\u6709\u53EF\u751F\u6210\u7684\u53D8\u66F4","error.llmUnavailable":"AI \u670D\u52A1\u4E0D\u53EF\u7528","error.llmFailed":"AI \u751F\u6210\u5931\u8D25","error.suggestDisabled":"AI \u751F\u6210\u5DF2\u5728\u63D2\u4EF6\u914D\u7F6E\u4E2D\u5173\u95ED","error.conflict":"\u8D2E\u85CF\u5E94\u7528\u4EA7\u751F\u51B2\u7A81\uFF0C\u8D2E\u85CF\u6761\u76EE\u5DF2\u4FDD\u7559\uFF0C\u8BF7\u624B\u52A8\u89E3\u51B3\u51B2\u7A81\u540E\u518D\u8BD5","error.revertConflict":"\u8FD8\u539F\u4F1A\u4E0E\u5F53\u524D\u5185\u5BB9\u51B2\u7A81\uFF0C\u5DF2\u81EA\u52A8\u53D6\u6D88\u8FD8\u539F\uFF08\u672A\u6539\u52A8\u4F60\u7684\u5DE5\u4F5C\u533A\uFF09","error.revertStuck":"\u8FD8\u539F\u4EA7\u751F\u51B2\u7A81\u4E14\u81EA\u52A8\u53D6\u6D88\u5931\u8D25\uFF0C\u4ED3\u5E93\u4ECD\u5904\u4E8E\u8FD8\u539F\u4E2D\uFF0C\u8BF7\u624B\u52A8\u6267\u884C git revert --abort \u6216\u89E3\u51B3\u51B2\u7A81","error.revertMerge":"\u8FD9\u662F\u4E00\u4E2A\u5408\u5E76\u63D0\u4EA4\uFF0C\u9762\u677F\u6682\u4E0D\u652F\u6301\u8FD8\u539F\uFF08\u9700\u6307\u5B9A\u4E3B\u7EBF\u7236\u63D0\u4EA4\uFF09\uFF0C\u8BF7\u5728\u547D\u4EE4\u884C\u7528 git revert -m \u5904\u7406","error.indexBusy":"Git \u6B63\u5FD9\uFF08\u53E6\u4E00\u8FDB\u7A0B\u5360\u7528\u7D22\u5F15\uFF09\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5","error.notFound":"\u76EE\u6807\u4E0D\u5B58\u5728\uFF08\u6807\u7B7E\u6216\u8D2E\u85CF\u53EF\u80FD\u5DF2\u88AB\u5220\u9664\uFF09","error.invalidName":"\u540D\u79F0\u4E0D\u5408\u6CD5","error.notFastForward":"\u672C\u5730\u4E0E\u8FDC\u7A0B\u5206\u652F\u5DF2\u5206\u53C9\uFF0C\u65E0\u6CD5\u5FEB\u8FDB\u62C9\u53D6\uFF0C\u8BF7\u624B\u52A8\u5408\u5E76\u6216\u53D8\u57FA","error.pushRejected":"\u63A8\u9001\u88AB\u62D2\u7EDD\uFF1A\u8FDC\u7A0B\u5DF2\u6709\u65B0\u63D0\u4EA4\uFF0C\u8BF7\u5148\u300C\u68C0\u67E5\u540C\u6B65\u300D\u5E76\u62C9\u53D6\u540E\u518D\u63A8\u9001","error.authFailed":"\u8BA4\u8BC1\u5931\u8D25\uFF1A\u6CA1\u6709\u53EF\u7528\u7684 git \u51ED\u636E\uFF08HTTPS \u9700\u51ED\u636E\u52A9\u624B\u3001SSH \u9700\u5BC6\u94A5\uFF09\u3002\u8BF7\u5148\u5728\u547D\u4EE4\u884C\u5B8C\u6210\u4E00\u6B21\u63A8\u9001\u4EE5\u7F13\u5B58\u51ED\u636E","status.openRepo":"\u5728\u6D4F\u89C8\u5668\u6253\u5F00\u4ED3\u5E93\u4E3B\u9875","status.openRepoOn":"\u5728 {host} \u6253\u5F00\u4ED3\u5E93\u4E3B\u9875","status.synced":"\u5DF2\u4E0E\u8FDC\u7A0B\u540C\u6B65","status.ahead":"\u9886\u5148 {n}","status.behind":"\u843D\u540E {n}","status.diverged":"\u5DF2\u5206\u53C9\uFF08\u9886\u5148 {ahead} / \u843D\u540E {behind}\uFF09","status.noUpstream":"\u672A\u8DDF\u8E2A\u8FDC\u7A0B\u5206\u652F","status.detached":"\u6E38\u79BB HEAD\uFF0C\u65E0\u5206\u652F\u540C\u6B65\u72B6\u6001","status.check":"\u68C0\u67E5\u540C\u6B65\u72B6\u6001","status.checkTitle":"\u68C0\u67E5\u4E0E\u8FDC\u7A0B\u7684\u540C\u6B65\u72B6\u6001\uFF1A\u6267\u884C git fetch \u62C9\u53D6\u6700\u65B0\u5F15\u7528\u5E76\u5237\u65B0\u9886\u5148/\u843D\u540E\u8BA1\u6570\uFF0C\u4E0D\u6539\u52A8\u5DE5\u4F5C\u533A","status.pull":"\u62C9\u53D6","status.pulling":"\u540C\u6B65\u4E2D\u2026","status.pullTitle":"\u5FEB\u8FDB\u62C9\u53D6\u8FDC\u7A0B\u66F4\u65B0","status.pullConfirmTitle":"\u62C9\u53D6\u8FDC\u7A0B\u66F4\u65B0","status.pullConfirmBody":"\u5C06\u4EE5\u5FEB\u8FDB\u65B9\u5F0F\u628A\u5F53\u524D\u5206\u652F {branch} \u66F4\u65B0\u5230\u8FDC\u7A0B\u6700\u65B0\u63D0\u4EA4\uFF08\u843D\u540E {behind} \u4E2A\u63D0\u4EA4\uFF09\u3002\u4EC5\u5728\u672A\u5206\u53C9\u65F6\u53EF\u884C\uFF0C\u4E0D\u4F1A\u4EA7\u751F\u5408\u5E76\u63D0\u4EA4\uFF0C\u4E5F\u4E0D\u4F1A\u6539\u52A8\u4F60\u7684\u672A\u63D0\u4EA4\u5185\u5BB9\u3002","status.pullConfirm":"\u62C9\u53D6","status.pullScope":"\u5C06\u5F15\u5165 {commits} \u4E2A\u63D0\u4EA4 \xB7 {files} \u4E2A\u6587\u4EF6 \xB7 +{ins} / \u2212{del} \u884C","status.pullScopeLoading":"\u6B63\u5728\u7EDF\u8BA1\u8FDC\u7A0B\u5DEE\u5F02\u2026","status.push":"\u63A8\u9001","status.pushTitle":"\u63A8\u9001\u672C\u5730\u63D0\u4EA4\u5230\u8FDC\u7A0B","status.pushConfirmTitle":"\u63A8\u9001\u5230\u8FDC\u7A0B","status.pushConfirmBody":"\u5C06\u628A\u5F53\u524D\u5206\u652F {branch} \u9886\u5148\u8FDC\u7A0B\u7684 {ahead} \u4E2A\u63D0\u4EA4\u63A8\u9001\u5230\u4E0A\u6E38\u3002\u4EC5\u505A\u5FEB\u8FDB\u63A8\u9001\uFF0C\u4E0D\u4F1A\u5F3A\u5236\u8986\u76D6\u8FDC\u7A0B\u5386\u53F2\u3002","status.pushConfirm":"\u63A8\u9001","status.pushing":"\u63A8\u9001\u4E2D\u2026","status.pushScope":"\u5C06\u63A8\u9001 {commits} \u4E2A\u63D0\u4EA4 \xB7 {files} \u4E2A\u6587\u4EF6 \xB7 +{ins} / \u2212{del} \u884C","status.pushScopeLoading":"\u6B63\u5728\u7EDF\u8BA1\u5F85\u63A8\u9001\u5DEE\u5F02\u2026","status.publish":"\u53D1\u5E03","status.publishTitle":"\u53D1\u5E03\u5206\u652F\u5E76\u8BBE\u7F6E\u4E0A\u6E38","status.publishConfirmTitle":"\u53D1\u5E03\u5206\u652F\u5230\u8FDC\u7A0B","status.publishConfirmBody":"\u5F53\u524D\u5206\u652F {branch} \u5C1A\u672A\u8DDF\u8E2A\u8FDC\u7A0B\u3002\u5C06\u6267\u884C git push -u {remote} \u5728\u8FDC\u7A0B\u521B\u5EFA\u540C\u540D\u5206\u652F\u5E76\u8BBE\u4E3A\u4E0A\u6E38\u8DDF\u8E2A\u3002","status.publishConfirm":"\u53D1\u5E03","status.publishing":"\u53D1\u5E03\u4E2D\u2026","cfg.title":"\u8F93\u5165\u6846\u5206\u652F\u6807\u8BB0","cfg.toggle":"\u663E\u793A\u8F93\u5165\u6846\u6807\u8BB0","cfg.hint":"\u5F00\u542F\u65F6\u5728\u8F93\u5165\u6846\u663E\u793A zsh \u98CE\u683C\u7684 <\u4ED3\u5E93\u540D> (\u5206\u652F) \u6807\u8BB0\uFF1B\u5173\u95ED\u540E\u6539\u4E3A\u5728 Git \u6807\u7B7E\u65C1\u663E\u793A\u72B6\u6001\u5706\u70B9\u3002\u4FDD\u5B58\u540E\u7ACB\u5373\u751F\u6548\u3002","cfg.diffTitle":"\u5DEE\u5F02\u5BF9\u6BD4\u9ED8\u8BA4\u89C6\u56FE","cfg.diffHint":"\u9009\u62E9\u53D8\u66F4\u5BF9\u6BD4\u9ED8\u8BA4\u6253\u5F00\u7684\u5E03\u5C40\uFF1A\u7EDF\u4E00\u89C6\u56FE\u4E3A\u5355\u680F\u884C\u5185\u5BF9\u6BD4\uFF0C\u5E76\u6392\u89C6\u56FE\u4E3A\u5DE6\u53F3\u5206\u680F\u5BF9\u6BD4\u3002\u4ECD\u53EF\u5728\u6BCF\u4E2A\u5DEE\u5F02\u89C6\u56FE\u4E2D\u4E34\u65F6\u5207\u6362\u3002\u4FDD\u5B58\u540E\u7ACB\u5373\u751F\u6548\u3002","cfg.diffUnified":"\u7EDF\u4E00\u89C6\u56FE\uFF08\u5355\u680F\u884C\u5185\uFF09","cfg.diffSplit":"\u5E76\u6392\u89C6\u56FE\uFF08\u5DE6\u53F3\u5206\u680F\uFF09","cfg.graphTitle":"\u63D0\u4EA4\u5386\u53F2\u56FE\u7EBF\u6761\u6837\u5F0F","cfg.graphHint":"\u9009\u62E9\u63D0\u4EA4\u5386\u53F2\u56FE\u7684\u8FDE\u7EBF\u753B\u6CD5\uFF1A\u5E73\u884C\u7EBF\u4E3A VSCode / \u56FE\u5F62\u754C\u9762\u98CE\u683C\uFF0C\u5206\u652F\u5404\u5360\u4E00\u5217\u3001\u5171\u4EAB\u7956\u5148\u4EE5\u5E76\u884C\u7EBF\u8868\u793A\uFF1B\u7D27\u51D1\u4E3A git log \u547D\u4EE4\u884C\u98CE\u683C\uFF0C\u5171\u4EAB\u7956\u5148\u5408\u5E76\u4E3A\u4E00\u5217\u3001\u7EBF\u66F4\u5C11\u3002\u4FDD\u5B58\u540E\u7ACB\u5373\u751F\u6548\u3002","cfg.graphParallel":"\u5E73\u884C\u7EBF\uFF08VSCode \u98CE\u683C\uFF09","cfg.graphCompact":"\u7D27\u51D1\uFF08git log \u98CE\u683C\uFF09","cfg.suggestTitle":"AI \u751F\u6210\u63D0\u4EA4\u4FE1\u606F","cfg.suggestToggle":"\u63D0\u4EA4\u6846\u663E\u793A AI \u751F\u6210\u6309\u94AE","cfg.suggestHint":"\u5F00\u542F\u540E\u63D0\u4EA4\u6846\u65C1\u4F1A\u51FA\u73B0\u300CAI \u751F\u6210\u300D\u6309\u94AE\uFF1A\u6839\u636E\u5F53\u524D\u53D8\u66F4\u4E0E\u6700\u8FD1\u63D0\u4EA4\u98CE\u683C\u751F\u6210\u63D0\u4EA4\u4FE1\u606F\uFF0C\u586B\u5165\u540E\u53EF\u7F16\u8F91\u518D\u63D0\u4EA4\u3002\u751F\u6210\u7684\u8BF7\u6C42\u4F1A\u4F7F\u7528\u4F60\u5728 DSH \u4E2D\u914D\u7F6E\u7684\u6A21\u578B\uFF0Cdiff \u5185\u5BB9\u4F1A\u53D1\u9001\u7ED9\u6A21\u578B\u4F9B\u5E94\u5546\u3002\u4FDD\u5B58\u540E\u7ACB\u5373\u751F\u6548\u3002","cfg.notLoaded":"\u914D\u7F6E\u672A\u52A0\u8F7D\uFF1A\u8BE5\u914D\u7F6E\u7531\u8FD0\u884C\u4E2D\u7684\u5BBF\u4E3B\u63D0\u4F9B\uFF0C\u82E5\u957F\u65F6\u95F4\u7A7A\u767D\u8BF7\u91CD\u542F DSH \u540E\u91CD\u8BD5\u3002","cfg.saveFailed":"\u4FDD\u5B58\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5"},Jn={"panel.tab":"Git","panel.fontDecrease":"Decrease font size","panel.fontReset":"Reset font size","panel.fontIncrease":"Increase font size","tab.overview":"Overview","tab.changes":"Changes","tab.files":"Files","pill.unavailable":"Git unavailable","pill.detached":"detached HEAD","pill.synced":"Everything committed","pill.dirty":"Uncommitted changes","common.loading":"Loading\u2026","common.retry":"Retry","common.close":"Close","common.cancel":"Cancel","ops.aiHint":"Tip: Trust AI more, try direct Git\u2011operation execution by AI.","version.check":"Check for updates","version.checking":"Checking\u2026","version.upToDate":"Up to date ({current})","version.updateAvailable":"New version {latest} available (current {current})","version.viewRelease":"View release","version.error":"Check failed","version.noRepo":"Repository not configured","version.openRepo":"Visit @xbzbing/dsh-git-panel on GitHub \u2014 please give the project a little star \u2B50","overview.head":"All branches","overview.local":"Local","overview.remote":"Remote","overview.tags":"Tags","overview.search":"Search commits (message / hash)","overview.searchShort":"Search","overview.allUsers":"All authors","overview.allTime":"All time","overview.today":"Today","overview.last7d":"Last 7 days","overview.last30d":"Last 30 days","overview.selectCommit":"Select a commit to see details","overview.noMessage":"(no commit body)","overview.noResults":"No matching commits","overview.loadFailed":"Load failed","overview.detailFailed":"Failed to load details","overview.diffFailed":"Failed to load diff","overview.openFileDiff":"View this file\u2019s changes in this commit","overview.changeSummary":"{files} files","overview.expandDir":"Expand folder","overview.collapseDir":"Collapse folder","overview.fetch":"Fetch","overview.branchesError":"Failed to load branches","overview.filterBranch":"Filter by branch","overview.backToList":"Back to list","overview.createTag":"Create tag","overview.revert":"Revert this commit","overview.reset":"Reset to here","tag.createTitle":"Create a tag at this commit","tag.namePlaceholder":"Tag name","tag.annotated":"Annotated tag (with message)","tag.messagePlaceholder":"Tag message","tag.create":"Create tag","tag.deleteTitle":"Delete tag","tag.deleteConfirm":'Delete tag "{name}"?',"tag.deleteOne":'Delete tag "{name}"',"ops.dirtyWarn":"There are uncommitted changes \u2014 they may be work the dsh AI is doing.","revert.title":"Revert commit","revert.body":"Appends a reverse commit at the current HEAD that undoes the changes in {ref}. Your working-tree changes are kept.","revert.confirm":"Revert","reset.title":"Reset branch","reset.body":"Moves the current branch HEAD from {from} to {to}.","reset.modeSoft":"Soft (--soft)","reset.softHint":"Moves HEAD; changes stay staged.","reset.modeMixed":"Mixed (--mixed, default)","reset.mixedHint":"Moves HEAD; changes stay in the working tree.","reset.modeHard":"Hard (--hard)","reset.hardHint":"Moves HEAD to this commit and discards all uncommitted changes (uncommitted changes cannot be recovered).","reset.hardOrphan":"Commits after the target leave the branch (still recoverable via git reflog).","reset.hardWarn":"The following uncommitted changes will be permanently discarded:","reset.lostMore":"\u2026 more uncommitted changes not shown (list capped)","reset.hardAck":"I understand these uncommitted changes will be lost","reset.hardAckClean":"I understand the consequences and confirm the reset","reset.confirm":"Reset","changes.groupStaged":"Staged changes","changes.groupUnstaged":"Changes","changes.groupUntracked":"Unversioned files","changes.selectFile":"Select a file to see its diff","changes.noChanges":"No uncommitted changes","changes.stageAll":"Stage all","changes.unstageAll":"Unstage all","changes.stage":"Stage","changes.unstage":"Unstage","changes.discard":"Discard changes","changes.discardConfirm":"Click again to confirm discard","changes.backToList":"Back to list","changes.stash":"Stash changes","stash.title":"Stash current changes","stash.messagePlaceholder":"Stash message (optional)","stash.save":"Stash","stash.section":"Stashes","stash.onBranch":"on {branch}","stash.apply":"Apply","stash.pop":"Pop","stash.drop":"Drop","stash.dropTitle":"Drop stash","stash.dropConfirm":"Drop this stash? This cannot be undone: {name}","files.selectFile":"Select a file to preview","files.loadFailed":"Load failed","files.backToTree":"Back to files","files.truncated":"Too many entries \u2014 truncated","files.tooLarge":"File too large to preview","files.binary":"Binary file \u2014 no preview","files.highlightOff":"Large file \u2014 syntax highlighting disabled for performance","files.lineTruncated":" \u2026 (line too long, truncated)","files.findPlaceholder":"Find in file","files.findNoMatch":"No results","files.findPrev":"Previous match","files.findNext":"Next match","files.findClose":"Close find","files.findCase":"Match case","files.previewMode":"Preview mode","files.source":"Source","files.render":"Rendered","files.copyPath":"Copy relative path","files.pathCopied":"Path copied","files.pathCopyFailed":"Copy failed","files.copyContent":"Copy file content","files.contentCopied":"Content copied","files.contentCopyFailed":"Copy failed","files.ignored":"Ignored by Git","files.copy":"Copy code","files.copied":"Copied","files.footnotes":"Footnotes","files.gitNotInstalled":"Git is not installed; the Git panel is unavailable. Please install Git and try again.","stats.files":"{n} files","stats.lastChange":"changed {time}","stats.lastCommit":"last commit {time}","stats.staged":"{n} staged","stats.modified":"{n} modified","stats.untracked":"{n} untracked","stats.partial":"simplified","stats.partialHint":"Large change set \u2014 untracked line counts and last-change time are omitted to keep the panel responsive.","commit.placeholder":"Commit message","commit.commit":"Commit","commit.amend":"Amend previous commit","commit.suggest":"AI suggest","commit.suggesting":"Generating\u2026","commit.suggestOverwrite":'Click "AI suggest" again to replace the current message',"commit.suggestTruncated":"The diff was truncated; the suggestion may be incomplete","diff.unified":"Unified","diff.split":"Split","diff.before":"Before","diff.after":"After","diff.binary":"Binary file \u2014 no diff to show","diff.tooLarge":"Image too large to compare","diff.imageMissing":"Does not exist","diff.svgRender":"Rendered","diff.svgSource":"Source","diff.empty":"No differences","diff.expandAll":"Expand all","diff.collapse":"Collapse unchanged","diff.expandGap":"Expand all {n} lines","diff.expandUp":"Expand up {n} lines","diff.expandDown":"Expand down {n} lines","time.justNow":"just now","time.minutesAgo":"{n}m ago","time.hoursAgo":"{n}h ago","time.daysAgo":"{n}d ago","error.generic":"Operation failed","error.notARepo":"Not a Git repository","error.noCwd":"This session has no working directory","error.localChangesBlock":"Local changes block this operation","error.emptyMessage":"Commit message cannot be empty","error.emptyDiff":"No changes to summarize","error.llmUnavailable":"AI service unavailable","error.llmFailed":"AI generation failed","error.suggestDisabled":"AI suggest is turned off in the plugin config","error.conflict":"Applying the stash produced conflicts; the stash entry is kept \u2014 resolve them and retry","error.revertConflict":"The revert would conflict with the current content; it was cancelled automatically (your working tree is unchanged)","error.revertStuck":"The revert conflicted and could not be auto-cancelled; the repository is mid-revert \u2014 run `git revert --abort` or resolve it manually","error.revertMerge":"This is a merge commit; the panel cannot revert it (a mainline parent is required) \u2014 use `git revert -m` on the command line","error.indexBusy":"Git is busy (another process holds the index lock); try again shortly","error.notFound":"Target not found (the tag or stash may have been removed)","error.invalidName":"Invalid name","error.notFastForward":"Local and remote have diverged \u2014 a fast-forward pull is not possible; merge or rebase manually","error.pushRejected":"Push rejected: the remote has new commits \u2014 run \u201CCheck sync\u201D and pull first, then push","error.authFailed":"Authentication failed: no usable git credentials (HTTPS needs a credential helper, SSH needs a key). Push once from the command line first to cache them","status.openRepo":"Open the repository home in the browser","status.openRepoOn":"Open the repository home on {host}","status.synced":"Up to date with remote","status.ahead":"{n} ahead","status.behind":"{n} behind","status.diverged":"Diverged ({ahead} ahead / {behind} behind)","status.noUpstream":"No upstream branch","status.detached":"Detached HEAD \u2014 no branch sync state","status.check":"Check sync status","status.checkTitle":"Check sync with the remote: runs git fetch to update refs and refresh the ahead/behind counts; your working tree is untouched","status.pull":"Pull","status.pulling":"Syncing\u2026","status.pullTitle":"Fast-forward pull of remote updates","status.pullConfirmTitle":"Pull remote updates","status.pullConfirmBody":"Fast-forwards the current branch {branch} to the latest remote commit ({behind} behind). Only possible when not diverged; it creates no merge commit and leaves your uncommitted work untouched.","status.pullConfirm":"Pull","status.pullScope":"Brings in {commits} commits \xB7 {files} files \xB7 +{ins} / \u2212{del} lines","status.pullScopeLoading":"Measuring incoming changes\u2026","status.push":"Push","status.pushTitle":"Push local commits to the remote","status.pushConfirmTitle":"Push to remote","status.pushConfirmBody":"Pushes the {ahead} commits that {branch} is ahead of the remote to its upstream. Fast-forward only \u2014 it never force-overwrites remote history.","status.pushConfirm":"Push","status.pushing":"Pushing\u2026","status.pushScope":"Pushes {commits} commits \xB7 {files} files \xB7 +{ins} / \u2212{del} lines","status.pushScopeLoading":"Measuring outgoing changes\u2026","status.publish":"Publish","status.publishTitle":"Publish the branch and set its upstream","status.publishConfirmTitle":"Publish branch to remote","status.publishConfirmBody":"The current branch {branch} has no upstream yet. This runs git push -u {remote} to create a same-named branch on the remote and set it as the upstream.","status.publishConfirm":"Publish","status.publishing":"Publishing\u2026","cfg.title":"Input-bar branch marker","cfg.toggle":"Show input-bar marker","cfg.hint":"When on, the input bar shows the zsh-style <repo> (branch) marker; when off, a status dot appears beside the Git tab instead. Saved changes apply immediately.","cfg.diffTitle":"Default diff view","cfg.diffHint":"Choose the layout diffs open with: unified is a single inline column, split is side-by-side. You can still switch per diff. Saved changes apply immediately.","cfg.diffUnified":"Unified (single inline column)","cfg.diffSplit":"Split (side-by-side)","cfg.graphTitle":"Commit graph line style","cfg.graphHint":"Choose how the commit graph draws its lines: parallel is the VSCode / GUI style \u2014 each branch keeps its own column and a shared ancestor shows as parallel lines; compact is the git log style \u2014 a shared ancestor merges into one column with fewer lines. Saved changes apply immediately.","cfg.graphParallel":"Parallel (VSCode style)","cfg.graphCompact":"Compact (git log style)","cfg.suggestTitle":"AI commit message","cfg.suggestToggle":"Show AI suggest button in the commit box","cfg.suggestHint":'When on, an "AI suggest" button appears beside the commit button: it writes a commit message from the current changes and the recent commit style, filled in for you to edit before committing. Generation uses the model configured in DSH; the diff is sent to that model provider. Saved changes apply immediately.',"cfg.notLoaded":"Config not loaded: it is served by the running host. Restart DSH if this stays blank.","cfg.saveFailed":"Save failed, please retry"};var Ct=require("react");var ha=new Set(["cwd-unavailable"]),pn=3e4,ya=6e4,_t=class{constructor(t,n){this.remote=t;this.sessionId=n}view={state:"cold"};listeners=new Set;timer;inflight;pendingRefresh=!1;disposed=!1;pollMs=pn;subscribe(t){return this.listeners.add(t),()=>{this.listeners.delete(t)}}getSnapshot(){return this.view}ensure(){this.view.state!=="cold"&&this.view.state!=="no-cwd"||this.refresh()}refresh(){return this.inflight!==void 0?(this.pendingRefresh=!0,this.inflight):this.disposed?Promise.resolve():(this.view.state==="cold"&&this.setView({state:"loading"}),this.inflight=this.remote.snapshot({sessionId:this.sessionId}).then(t=>{if(!this.disposed){if(t.ok)this.pollMs=t.value.refreshIntervalMs||pn,this.setView({state:"ready",snapshot:t.value});else if(t.error.code!=="cancelled")if(ha.has(t.error.code))this.pollMs=ya,this.setView({state:"no-cwd"});else if(t.error.code==="not-a-git-repo"){let n=t.error;this.setView({state:"error",error:{code:"not-a-git-repo",...n.cwd?{cwd:n.cwd}:{},...n.showInputPill!==void 0?{showInputPill:n.showInputPill}:{}}})}else if(t.error.code==="git-unavailable"){let n=t.error;this.setView({state:"error",error:{code:"git-unavailable",...n.detail?{detail:n.detail}:{},...n.cwd?{cwd:n.cwd}:{},...n.isGitRepo!==void 0?{isGitRepo:n.isGitRepo}:{}}})}else this.setView({state:"error",error:{code:t.error.code,..."detail"in t.error?{detail:t.error.detail}:{}}})}}).catch(t=>{this.disposed||this.setView({state:"error",error:{code:"git-unavailable",detail:t instanceof Error?t.message:String(t)}})}).finally(()=>{this.inflight=void 0,this.pendingRefresh&&!this.disposed?(this.pendingRefresh=!1,this.refresh()):this.schedulePoll()}),this.inflight)}resync(){this.disposed||this.refresh()}accept(t){this.disposed||(this.pollMs=t.refreshIntervalMs||pn,this.setView({state:"ready",snapshot:t}),this.schedulePoll())}schedulePoll(){this.disposed||(this.timer!==void 0&&clearTimeout(this.timer),!(this.pollMs<=0)&&(this.timer=setTimeout(()=>{this.refresh()},this.pollMs)))}setView(t){this.view=t;for(let n of this.listeners)n()}dispose(){this.disposed=!0,this.timer!==void 0&&clearTimeout(this.timer),this.timer=void 0,this.listeners.clear()}};var ba="/api",va="gitPanel";function wa(e){try{let t=e.get("connection")?.rpc,n=t?.call;if(t!==void 0&&typeof n=="function")return(r,a,i)=>n.call(t,ba,r,a,i)}catch{}}function xa(e){let t=e;if(t===null||typeof t!="object")return{ok:!1,error:{code:"git-unavailable",message:"malformed rpc result"}};if(t.ok!==!0){let n=t.error;return{ok:!1,error:{code:typeof n?.code=="string"?n.code:"git-unavailable",message:typeof n?.message=="string"?n.message:void 0}}}return t.value===void 0?{ok:!1,error:{code:"git-unavailable",message:"missing value"}}:t.value}function de(e,t){return!e.ok||e.value.kind!==t?null:e.value}function Me(e){return e!==void 0&&e!==""}var Kn=new WeakMap;function st(e){let t=Kn.get(e);if(t!==void 0)return t;let n=async(a,i,l)=>{let s=wa(e);if(s===void 0)return{ok:!1,error:{code:"git-unavailable",message:"no connection"}};try{let o=await s(`${va}/${a}`,{args:{request:i}},l);return xa(o)}catch(o){return{ok:!1,error:{code:"git-unavailable",message:o instanceof Error?o.message:String(o)}}}},r={snapshot:(a,i)=>n("snapshot",a,i),run:(a,i)=>n("run",a,i),query:(a,i)=>n("query",a,i),suggest:(a,i)=>n("suggest",a,i),version:(a,i)=>n("version",a,i)};return Kn.set(e,r),r}var Fe=new Map,Vn,un;function On(e){un=e,Vn=st(e)}function lt(e){let t=Fe.get(e);if(t===void 0){let n=Vn??(un?st(un):void 0);t=new _t(n??Ca(),e),Fe.set(e,t)}return t}var ka=6e4,St=new Map;function _a(e){let t=St.get(e);t!==void 0&&(clearTimeout(t),St.delete(e)),Ve.set(e,(Ve.get(e)??0)+1)}function Sa(e){let t=(Ve.get(e)??1)-1;if(t>0){Ve.set(e,t);return}Ve.delete(e);let n=setTimeout(()=>{St.delete(e),!((Ve.get(e)??0)>0)&&(Fe.get(e)?.dispose(),Fe.delete(e))},ka);St.set(e,n)}var Ve=new Map;function dt(){for(let e of Fe.values())e.resync()}function qn(){for(let e of Fe.values())e.dispose();Fe.clear()}function Ca(){let e=async()=>({ok:!1,error:{code:"git-unavailable"}});return{snapshot:e,run:e,query:e,suggest:e,version:e}}function Tt(e){let[,t]=(0,Ct.useState)(0),n=e?lt(e):void 0;return(0,Ct.useEffect)(()=>{if(n===void 0||e===void 0)return;_a(e);let r=n.subscribe(()=>t(a=>a+1));return n.ensure(),()=>{r(),Sa(e)}},[n,e]),n?n.getSnapshot():{state:"cold"}}var E=require("react");var Wn="[data-conversation-tabs]",pt='[data-conversation-tabs] button[role="tab"]',gn=new Map,ct=new Map;function jn(e,t){let n=ct.get(e);if(n!==void 0&&n.size>0){for(let r of n)r(t);return}gn.set(e,t)}function Un(e){let t=gn.get(e);return t===void 0?null:(gn.delete(e),t)}function Qn(e,t){let n=ct.get(e);return n===void 0&&(n=new Set,ct.set(e,n)),n.add(t),()=>{let r=ct.get(e);r!==void 0&&(r.delete(t),r.size===0&&ct.delete(e))}}var Ta=6e4,fn=new Map;function Yn(e,t){fn.set(e,{tab:t,leftAt:Date.now()})}function Zn(e){let t=fn.get(e);return t===void 0?null:Date.now()-t.leftAt>Ta?(fn.delete(e),null):t.tab}function er(e){if(typeof document>"u")return!1;let t=document.querySelectorAll(pt);for(let n of t)if((n.textContent??"").trim()===e)return n.getAttribute("aria-selected")!=="true"&&n.click(),!0;return!1}function tr(e){if(typeof document>"u")return!1;let t=document.querySelectorAll(pt);for(let n of t)if((n.textContent??"").trim()===e)return n.getAttribute("aria-selected")==="true";return!1}function nr(e){if(typeof document>"u")return!1;let t=document.querySelectorAll(pt);for(let n of t)if((n.textContent??"").trim()!==e)return n.getAttribute("aria-selected")!=="true"&&n.click(),!0;return!1}var d=require("react"),Ot=require("react-dom");var R=require("react");function ue(e,t=15){return(0,R.createElement)("svg",{width:t,height:t,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round"},e)}function Nt({size:e}){return ue([(0,R.createElement)("circle",{key:"c",cx:8,cy:8,r:2.4}),(0,R.createElement)("line",{key:"l1",x1:8,y1:1.5,x2:8,y2:5.6}),(0,R.createElement)("line",{key:"l2",x1:8,y1:10.4,x2:8,y2:14.5})],e)}function rr({size:e}){return ue([(0,R.createElement)("path",{key:"a",d:"M4 2v8"}),(0,R.createElement)("path",{key:"b",d:"M2 4h4"}),(0,R.createElement)("circle",{key:"c",cx:4,cy:12,r:1.6}),(0,R.createElement)("circle",{key:"d",cx:12,cy:4,r:1.6}),(0,R.createElement)("path",{key:"e",d:"M12 6v4"}),(0,R.createElement)("path",{key:"f",d:"M10 12h4"})],e)}function mn({size:e}){return ue([(0,R.createElement)("circle",{key:"a",cx:4,cy:3,r:1.6}),(0,R.createElement)("circle",{key:"b",cx:4,cy:13,r:1.6}),(0,R.createElement)("circle",{key:"c",cx:12,cy:5,r:1.6}),(0,R.createElement)("path",{key:"d",d:"M4 4.6v6.8"}),(0,R.createElement)("path",{key:"e",d:"M12 6.6c0 3-4 2.4-8 4"})],e)}function Oe({size:e}){return ue([(0,R.createElement)("path",{key:"a",d:"M2 7V3h4l8 8-4 4z"}),(0,R.createElement)("circle",{key:"b",cx:4.5,cy:5.5,r:.8,fill:"currentColor"})],e)}function Pe({size:e,open:t}){return ue([(0,R.createElement)("path",{key:"a",d:t?"M3 6l5 5 5-5":"M6 3l5 5-5 5"})],e)}function qe({size:e}){return ue([(0,R.createElement)("path",{key:"a",d:"M4 4l8 8M12 4l-8 8"})],e)}function We({size:e}){return ue([(0,R.createElement)("path",{key:"a",d:"M10 3L5 8l5 5"}),(0,R.createElement)("path",{key:"b",d:"M5 8h8"})],e)}function ar({size:e}){return ue([(0,R.createElement)("path",{key:"a",d:"M2 3h12l-4.5 5.5V13L6.5 11V8.5z"})],e)}function Et({size:e}){return ue([(0,R.createElement)("path",{key:"a",d:"M13 8a5 5 0 1 1-1.5-3.5"}),(0,R.createElement)("path",{key:"b",d:"M13 2v3h-3"})],e)}function ir({size:e}){return ue([(0,R.createElement)("path",{key:"a",d:"M8 2.6l1.4 4 4 1.4-4 1.4-1.4 4-1.4-4-4-1.4 4-1.4z"}),(0,R.createElement)("path",{key:"b",d:"M13 11.6v2.8M11.6 13h2.8"})],e)}function or({size:e}){return ue([(0,R.createElement)("path",{key:"a",d:"M4 2h5l3 3v9H4z"}),(0,R.createElement)("path",{key:"b",d:"M9 2v3h3"})],e)}function hn({size:e}){return ue([(0,R.createElement)("path",{key:"a",d:"M2 5.5h12V13H2z"}),(0,R.createElement)("path",{key:"b",d:"M1.5 3h13v2.5h-13z"}),(0,R.createElement)("path",{key:"c",d:"M6.5 8.5h3"})],e)}function sr({size:e}){return ue([(0,R.createElement)("path",{key:"a",d:"M3 4.5h10"}),(0,R.createElement)("path",{key:"b",d:"M5.5 4.5V3h5v1.5"}),(0,R.createElement)("path",{key:"c",d:"M4.5 4.5l.7 9h5.6l.7-9"})],e)}function lr({size:e}){return ue([(0,R.createElement)("path",{key:"a",d:"M3 7a5 5 0 1 1 1.3 3.4"}),(0,R.createElement)("path",{key:"b",d:"M3 3.5V7h3.5"})],e)}function Rt({size:e}){return ue([(0,R.createElement)("path",{key:"a",d:"M13 3v10"}),(0,R.createElement)("path",{key:"b",d:"M10.5 8L3 3.5v9z",fill:"currentColor"})],e)}function dr({size:e}){return ue([(0,R.createElement)("path",{key:"a",d:"M5 2.5h4l2.5 2.5v7.5h-6.5z"}),(0,R.createElement)("path",{key:"b",d:"M9 2.5V5h2.5"}),(0,R.createElement)("path",{key:"c",d:"M11 12.5v1.5h-6.5V6"})],e)}function cr({size:e=15}){return(0,R.createElement)("svg",{width:e,height:e,viewBox:"0 0 16 16",fill:"currentColor"},(0,R.createElement)("path",{"fill-rule":"evenodd",d:"M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.01 8.01 0 0 0 16 8c0-4.42-3.58-8-8-8z"}))}function pr({size:e}){return ue([(0,R.createElement)("path",{key:"a",d:"M8 2.5v7"}),(0,R.createElement)("path",{key:"b",d:"M4.5 7L8 10.5 11.5 7"}),(0,R.createElement)("path",{key:"c",d:"M3 13h10"})],e)}function yn({size:e}){return ue([(0,R.createElement)("path",{key:"a",d:"M8 10.5v-7"}),(0,R.createElement)("path",{key:"b",d:"M4.5 6L8 2.5 11.5 6"}),(0,R.createElement)("path",{key:"c",d:"M3 13h10"})],e)}function ur({size:e}){return ue([(0,R.createElement)("path",{key:"a",d:"M12.5 7a4.5 4.5 0 0 0-8-2.3"}),(0,R.createElement)("path",{key:"b",d:"M3.5 9a4.5 4.5 0 0 0 8 2.3"}),(0,R.createElement)("path",{key:"c",d:"M4.3 2.2v2.5h2.5"}),(0,R.createElement)("path",{key:"d",d:"M11.7 13.8v-2.5H9.2"})],e)}function gr({size:e=15,filled:t}){return(0,R.createElement)("svg",{width:e,height:e,viewBox:"0 0 16 16",fill:t?"currentColor":"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round"},(0,R.createElement)("path",{d:"M8 1.8l1.76 3.57 3.94.57-2.85 2.78.67 3.92L8 10.78l-3.52 1.85.67-3.92L2.3 5.94l3.94-.57z"}))}function fr(e){let t=0;for(let n of e){t=Math.max(t,n.lane+1);for(let r of n.edges)t=Math.max(t,r.fromLane+1,r.toLane+1)}return t}function mr(e,t){let n=[],r=[],a=[],i=[],l=0,s=()=>{if(i.length===0)return l++;let c=Math.min(...i);return i.splice(i.indexOf(c),1),c},o=c=>{c!==null&&!i.includes(c)&&i.push(c)};for(let c of e){let p=v=>{let L=r.findIndex(P=>P===v);return L===-1&&(L=r.findIndex(P=>P===null),L===-1&&(L=r.length,r.push(null),a.push(null)),r[L]=v,a[L]=s()),L},u=r.some(v=>v===c.hash),f=p(c.hash),w=a[f],b=[...r],k=[...a],_=c.parents,N=_.length>=2;for(let v=0;v<r.length;v++)v!==f&&r[v]===c.hash&&(o(a[v]),r[v]=null,a[v]=null);let A=-1,J=[];if(_.length===0)o(a[f]),r[f]=null,a[f]=null;else{let v=_[0],L=t==="compact"?r.findIndex((P,W)=>P===v&&W!==f):-1;if(L===-1)r[f]=v,A=f;else{let P=Math.min(f,L),W=Math.max(f,L);r[P]=v,o(a[W]),r[W]=null,a[W]=null,A=P}for(let P=1;P<_.length;P++)J.push(p(_[P]))}let M=[];for(let v=0;v<b.length;v++){let L=b[v];if(L!==null)if(L===c.hash){if(v===f&&!u)continue;M.push({fromLane:v,toLane:f,color:k[v],kind:"into"})}else{let P=r[v]===L?v:r.findIndex(W=>W===L);P!==-1&&M.push({fromLane:v,toLane:P,color:k[v],kind:"pass"})}}A!==-1&&M.push({fromLane:f,toLane:A,color:a[A],kind:"out"});for(let v of J)M.push({fromLane:f,toLane:v,color:a[v],kind:"out"});for(n.push({commit:c,lane:f,color:w,edges:M,merge:N});r.length>0&&r[r.length-1]===null;)r=r.slice(0,-1),a=a.slice(0,-1)}return n}function hr(e){let t={name:"",path:"",dir:!0,children:[]};for(let n of e){let r=n.path.split("/").filter(l=>l!==""),a=t,i="";for(let l=0;l<r.length;l++){let s=r[l];i=i===""?s:`${i}/${s}`;let o=l===r.length-1,c=a.children.find(p=>p.name===s&&p.dir===!o);c===void 0&&(c={name:s,path:i,dir:!o,children:[],...o?{meta:n.meta}:{}},a.children.push(c)),a=c}}return yr(t),br(t.children)}function yr(e){e.children.sort((t,n)=>t.dir!==n.dir?t.dir?-1:1:t.name.localeCompare(n.name));for(let t of e.children)yr(t)}function br(e){return e.map(t=>{if(!t.dir)return t;let n=t;for(;n.children.length===1&&n.children[0].dir;){let r=n.children[0];n={name:`${n.name}/${r.name}`,path:r.path,dir:!0,children:r.children}}return{...n,children:br(n.children)}})}function je(e,t,n){if(e===null)return"";let r=typeof e=="number"?e:Date.parse(e);if(!Number.isFinite(r))return"";let a=Math.max(0,t-r),i=Math.floor(a/6e4);if(i<1)return n("time.justNow");if(i<60)return n("time.minutesAgo",{n:i});let l=Math.floor(i/60);if(l<24)return n("time.hoursAgo",{n:l});let s=Math.floor(l/24);return n("time.daysAgo",{n:s})}function ut(e){if(e===null)return"";let t=new Date(typeof e=="number"?e:Date.parse(e));if(Number.isNaN(t.getTime()))return"";let n=r=>String(r).padStart(2,"0");return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())} ${n(t.getHours())}:${n(t.getMinutes())}`}function bn(e){if(e===null)return"";let t=new Date(typeof e=="number"?e:Date.parse(e));if(Number.isNaN(t.getTime()))return"";let n=r=>String(r).padStart(2,"0");return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())} ${n(t.getHours())}:${n(t.getMinutes())}:${n(t.getSeconds())}`}var Gt={added:"A",modified:"M",deleted:"D",renamed:"R",untracked:"U",conflicted:"!",typechange:"T"};function Mt(e){return e==="added"||e==="untracked"?"gp-status--added":e==="deleted"?"gp-status--deleted":e==="renamed"?"gp-status--renamed":"gp-status--modified"}var x=require("react");var Na={png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",webp:"image/webp",avif:"image/avif",bmp:"image/bmp",svg:"image/svg+xml",ico:"image/x-icon",tif:"image/tiff",tiff:"image/tiff"};function vn(e){let t=e.lastIndexOf(".");return t<0?null:Na[e.slice(t+1).toLowerCase()]??null}function vr(e){return/^Binary files .* differ$/m.test(e)||/^GIT binary patch$/m.test(e)}function wr(e){return vn(e)!==null}function xr(e){return/\.svg$/i.test(e)}function Ea(e){let t=wn(e);return t.length===0?!1:t.every(n=>n.startsWith("+")||n.startsWith(" "))&&t.some(n=>n.startsWith("+"))&&/^\+\+\+ /m.test(e)&&/--- \/dev\/null/m.test(e)}function Ra(e){let t=wn(e);return t.length===0?!1:t.every(n=>n.startsWith("-")||n.startsWith(" "))&&t.some(n=>n.startsWith("-"))&&/^\+\+\+ \/dev\/null/m.test(e)}function wn(e){let t=e.split(`
536
+ `),n=[],r=!1;for(let a of t){if(a.startsWith("@@")){r=!0;continue}if(r){if(a.startsWith("diff ")||a.startsWith("index ")){r=!1;continue}a!==""&&n.push(a)}}return n}function kr(e){let t=0,n=0;for(let r of wn(e))r.startsWith("+")?t++:r.startsWith("-")&&n++;return{add:t,del:n}}var Ga=/@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/;function _r(e){let t=[],n=e.split(`
537
+ `),r=0,a=0,i=!0,l=!1,s=0;for(;s<n.length&&!n[s].startsWith("@@");s++);for(;s<n.length;s++){let o=n[s];if(o.startsWith("@@")){let u=Ga.exec(o);if(u){let f=Number(u[1]),w=Number(u[3]),b=f-w;if(i)w>1&&t.push(Ue({rightStart:1,count:w-1,delta:b,atStart:!0,atEnd:!1}));else{let k=w-a;k>0&&t.push(Ue({rightStart:a,count:k,delta:b,atStart:!1,atEnd:!1}))}r=f,a=w,i=!1}t.push({kind:"hunk",leftNo:null,rightNo:null,leftText:null,rightText:null,text:o});continue}if(o.startsWith("\\"))continue;let c=o[0],p=o.slice(1);c==="+"?(t.push({kind:"add",leftNo:null,rightNo:a,leftText:null,rightText:p}),a++,l=!0):c==="-"?(t.push({kind:"del",leftNo:r,rightNo:null,leftText:p,rightText:null}),r++,l=!0):c===" "&&(t.push({kind:"context",leftNo:r,rightNo:a,leftText:p,rightText:p}),r++,a++,l=!0)}return l&&!i&&!Ea(e)&&!Ra(e)&&t.push(Ue({rightStart:a,count:null,delta:r-a,atStart:!1,atEnd:!0})),Ma(t)}function Ue(e){return{kind:"gap",leftNo:null,rightNo:null,leftText:null,rightText:null,gap:e}}function Ma(e){let t=[],n=0;for(;n<e.length;){let r=e[n];if(r.kind==="del"){let a=[],i=n;for(;i<e.length&&e[i].kind==="del";)a.push(e[i]),i++;let l=[];for(;i<e.length&&e[i].kind==="add";)l.push(e[i]),i++;let s=Math.max(a.length,l.length);for(let o=0;o<s;o++){let c=a[o],p=l[o];if(c&&p){let u=Pa(c.leftText??"",p.rightText??"");t.push({kind:"mod",leftNo:c.leftNo,rightNo:p.rightNo,leftText:c.leftText,rightText:p.rightText,...u!==null?{leftWord:u.left,rightWord:u.right}:{}})}else c?t.push({kind:"del",leftNo:c.leftNo,rightNo:null,leftText:c.leftText,rightText:null}):p&&t.push({kind:"add",leftNo:null,rightNo:p.rightNo,leftText:null,rightText:p.rightText})}n=i}else t.push(r),n++}return t}function Pa(e,t){let n=Math.min(e.length,t.length),r=0;for(;r<n&&e[r]===t[r];)r++;let a=0;for(;a<n-r&&e[e.length-1-a]===t[t.length-1-a];)a++;return r===0&&a===0?null:{left:[r,e.length-a],right:[r,t.length-a]}}function Da(e,t,n){return n.map((r,a)=>{let i=t+a;return{kind:"context",leftNo:i+e,rightNo:i,leftText:r,rightText:r}})}var ke=20;function xn(e){let t=[];for(let n of e)n.kind==="mod"?(t.push({kind:"del",leftNo:n.leftNo,rightNo:null,leftText:n.leftText,rightText:null,...n.leftWord!==void 0?{leftWord:n.leftWord}:{}}),t.push({kind:"add",leftNo:null,rightNo:n.rightNo,leftText:null,rightText:n.rightText,...n.rightWord!==void 0?{rightWord:n.rightWord}:{}})):t.push(n);return t}function Sr(e,t,n,r,a,i){let l=e.findIndex(u=>u.kind==="gap"&&u.gap?.rightStart===t);if(l<0)return e.slice();let s=e[l].gap,o=Da(s.delta,r,a),c=[];if(s.atEnd)return c.push(...o),!i&&a.length>0&&c.push(Ue({rightStart:r+a.length,count:null,delta:s.delta,atStart:!1,atEnd:!0})),[...e.slice(0,l),...c,...e.slice(l+1)];let p=s.count??a.length;if(n==="all"||a.length>=p)c.push(...o);else if(n==="down"){c.push(...o);let u=p-a.length;c.push(Ue({rightStart:s.rightStart+a.length,count:u,delta:s.delta,atStart:!1,atEnd:!1}))}else{let u=p-a.length;c.push(Ue({rightStart:s.rightStart,count:u,delta:s.delta,atStart:s.atStart,atEnd:!1})),c.push(...o)}return[...e.slice(0,l),...c,...e.slice(l+1)]}var Bt=require("@deepseek-ai/dsh-client-ui-primitives");function Cr(e,t){let n=[[],[],[]],r=0;for(let a of e){let i=r+a.text.length,l=[r,Math.max(r,Math.min(i,t[0])),Math.max(r,Math.min(i,t[1])),i];for(let s=0;s<3;s++){let o=a.text.slice(l[s]-r,l[s+1]-r);o!==""&&n[s].push({text:o,style:a.style})}r=i}return n}var ye=require("react"),Pt=5e3,Dt=120;function At(e,t){let[n,r]=(0,ye.useState)(e);return(0,ye.useEffect)(()=>{let a=setTimeout(()=>r(e),t);return()=>clearTimeout(a)},[e,t]),n}function Lt(e,t){if(t==="")return[];let n=[],r=0;for(;;){let a=e.indexOf(t,r);if(a<0)break;n.push([a,a+t.length]),r=a+t.length}return n}function kn(e,t,n,r,a){if(n>=r)return[];if(e===void 0)return[t.slice(n,r)];let i=[],l=0,s=0;for(let o of e){let c=l+o.text.length,p=Math.max(n,l),u=Math.min(r,c);if(u>p&&i.push((0,ye.createElement)("span",{key:`${a}-${s++}`,style:o.style},o.text.slice(p-l,u-l))),l=c,l>=r)break}return i}function Ht(e,t,n,r,a,i){let l=[],s=0,o=[...t].sort((c,p)=>c[0]-p[0]);for(let[c,p]of o){if(c<s)continue;c>s&&l.push(...kn(n,e,s,c,`${r}b${s}`));let u=a!==null&&a[0]===c&&a[1]===p;l.push((0,ye.createElement)("mark",{key:`mk${r}-${c}`,className:`gp-find-hit${u?" gp-find-hit--active":""}`,...u?{ref:i}:{}},kn(n,e,c,p,`mk${r}-${c}`))),s=p}return s<e.length&&l.push(...kn(n,e,s,e.length,`${r}e`)),l}function Ft(e){return(0,ye.createElement)("div",{key:"find",className:"gp-find"},[(0,ye.createElement)("input",{key:"in",ref:e.inputRef,className:"gp-find__input",type:"text",placeholder:e.t("files.findPlaceholder"),value:e.query,spellCheck:!1,"aria-label":e.t("files.findPlaceholder"),onChange:t=>e.onChange(t.target.value),onKeyDown:t=>{t.key==="Escape"?(t.preventDefault(),t.stopPropagation(),e.onClose()):t.key==="Enter"&&(t.preventDefault(),e.onStep(t.shiftKey?-1:1))}}),(0,ye.createElement)("button",{key:"case",type:"button",className:`gp-find__btn gp-find__case${e.caseSensitive?" gp-find__case--active":""}`,title:e.t("files.findCase"),"aria-label":e.t("files.findCase"),"aria-pressed":e.caseSensitive,onClick:()=>e.onToggleCase()},"Aa"),(0,ye.createElement)("span",{key:"cnt",className:"gp-find__count"},e.query===""?"":e.matches===0?e.t("files.findNoMatch"):`${e.active+1}/${e.matches}`),(0,ye.createElement)("button",{key:"prev",type:"button",className:"gp-find__btn",title:e.t("files.findPrev"),"aria-label":e.t("files.findPrev"),disabled:e.matches===0,onClick:()=>e.onStep(-1)},"\u2039"),(0,ye.createElement)("button",{key:"next",type:"button",className:"gp-find__btn",title:e.t("files.findNext"),"aria-label":e.t("files.findNext"),disabled:e.matches===0,onClick:()=>e.onStep(1)},"\u203A"),(0,ye.createElement)("button",{key:"x",type:"button",className:"gp-find__btn",title:e.t("files.findClose"),"aria-label":e.t("files.findClose"),onClick:()=>e.onClose()},"\u2715")])}var Ne=require("react");function zt(e,t,n){let r=n(`diff.${e}`);return(0,Ne.createElement)("div",{className:`gp-imgcmp__pane gp-imgcmp__pane--${e}`},[(0,Ne.createElement)("div",{key:"head",className:"gp-imgcmp__head"},r),t===void 0?(0,Ne.createElement)("div",{key:"missing",className:"gp-imgcmp__missing"},n("diff.imageMissing")):(0,Ne.createElement)("div",{key:"img",className:"gp-imgcmp__img"},(0,Ne.createElement)("img",{src:t,alt:r}))])}function Tr({oldUrl:e,newUrl:t,mode:n,t:r}){return n==="before"?(0,Ne.createElement)("div",{className:"gp-imgcmp gp-imgcmp--single"},zt("before",e,r)):n==="after"?(0,Ne.createElement)("div",{className:"gp-imgcmp gp-imgcmp--single"},zt("after",t,r)):(0,Ne.createElement)("div",{className:"gp-imgcmp"},[zt("before",e,r),zt("after",t,r)])}var Xt=(0,x.memo)(function({text:t,mode:n,path:r,remote:a,sessionId:i,imageSpec:l,t:s}){let o=(0,x.useMemo)(()=>_r(t),[t]),c=vr(t),p=(0,Bt.useCodeHighlighter)(r===void 0?void 0:(0,Bt.languageForPath)(r)),[u,f]=(0,x.useState)(o);(0,x.useEffect)(()=>{f(o)},[o]);let w=Ha(u,f,a,i,r,l),b=r!==void 0&&xr(r),[k,_]=(0,x.useState)("render");(0,x.useEffect)(()=>{_("render")},[r]);let A=(c||b)&&r!==void 0&&wr(r)&&a!==void 0&&i!==void 0&&l!==void 0&&(!b||k==="render"),J=za(A?a:void 0,A?i:void 0,A?r:void 0,A?l:void 0),[M,v]=(0,x.useState)(!1),[L,P]=(0,x.useState)(""),[W,S]=(0,x.useState)(!1),[$,se]=(0,x.useState)(0),ee=(0,x.useRef)(null),ce=(0,x.useRef)(null),ne=(0,x.useRef)(null);(0,x.useEffect)(()=>{v(!1),P(""),se(0)},[t,r]);let z=(0,x.useMemo)(()=>Aa(n,u),[n,u]),te=(0,x.useMemo)(()=>z.map(Z=>({key:Z.key,text:Z.text.toLowerCase()})),[z]),T=At(L,Dt),pe=W?T:T.toLowerCase(),H=W?z:te,C=(0,x.useMemo)(()=>La(H,pe),[H,pe]);(0,x.useEffect)(()=>{se(0)},[pe]);let I=C.length===0?0:Math.min($,C.length-1),X=C.length>0?C[I]:null,Q=(0,x.useMemo)(()=>{let Z=new Map;for(let Y of C){let he=Z.get(Y.cellKey)??[];he.push([Y.start,Y.end]),Z.set(Y.cellKey,he)}return Z},[C]);(0,x.useEffect)(()=>{let Z=Y=>{if(!((Y.ctrlKey||Y.metaKey)&&(Y.key==="f"||Y.key==="F")))return;let he=ee.current;he===null||he.offsetParent===null||(Y.preventDefault(),v(!0),requestAnimationFrame(()=>ce.current?.select()))};return document.addEventListener("keydown",Z),()=>document.removeEventListener("keydown",Z)},[]),(0,x.useEffect)(()=>{ne.current?.scrollIntoView({block:"center",inline:"nearest"})},[I,C]);let ge=(0,x.useCallback)(Z=>{se(Y=>C.length===0?0:(Y+Z+C.length)%C.length)},[C.length]),D=M&&pe!==""?{perCell:Q,activeKey:X?.cellKey??null,activeRange:X?[X.start,X.end]:null,activeRef:ne}:null;if(A){let Z=(()=>{if(J.kind==="idle"||J.kind==="loading")return(0,x.createElement)("div",{className:"gp-empty"},s("common.loading"));if(J.kind==="ready"){let Y=J.res;if(Y.tooLarge===!0)return(0,x.createElement)("div",{className:"gp-empty"},s("diff.tooLarge"));if(Y.mime!==null&&(Y.old!==void 0||Y.new!==void 0))return(0,x.createElement)(Tr,{oldUrl:Y.old,newUrl:Y.new,mode:n,t:s})}return(0,x.createElement)("div",{className:"gp-empty"},s("diff.binary"))})();return b?Nr(k,_,Z,s):Z}if(c&&!b)return(0,x.createElement)("div",{className:"gp-empty"},s("diff.binary"));let re=(()=>{if(t.trim()==="")return(0,x.createElement)("div",{className:"gp-empty"},s("diff.empty"));if(n==="before")return Er(Gr(u),p,D);if(n==="after")return Er(Mr(u),p,D);if(n==="unified"){let Z=xn(u);return(0,x.createElement)("div",{className:"gp-diff__unified"},Z.flatMap((Y,he)=>Ia(Y,he,p,w,D,s)))}return(0,x.createElement)("div",{className:"gp-diff__side"},u.flatMap((Z,Y)=>$a(Z,Y,p,w,D,s)))})(),me=M?(0,x.createElement)(Ft,{inputRef:ce,query:L,matches:C.length,active:I,caseSensitive:W,onChange:P,onToggleCase:()=>S(Z=>!Z),onStep:ge,onClose:()=>v(!1),t:s}):null,ve=(0,x.createElement)("div",{className:"gp-diff__wrap",ref:ee},[me,re]);return b?Nr(k,_,ve,s):ve});function Aa(e,t){let n=[];return e==="before"?(Gr(t).forEach((r,a)=>n.push({key:`c${a}`,text:r.text})),n):e==="after"?(Mr(t).forEach((r,a)=>n.push({key:`c${a}`,text:r.text})),n):e==="unified"?(xn(t).forEach((r,a)=>{if(r.kind==="hunk"||r.kind==="gap")return;let i=r.rightText??r.leftText??"";i!==""&&n.push({key:`c${a}`,text:i})}),n):(t.forEach((r,a)=>{r.kind==="hunk"||r.kind==="gap"||(r.leftText!==null&&r.leftText!==""&&n.push({key:`l${a}`,text:r.leftText}),r.rightText!==null&&r.rightText!==""&&n.push({key:`r${a}`,text:r.rightText}))}),n)}function La(e,t){if(t==="")return[];let n=[];for(let r of e)for(let[a,i]of Lt(r.text,t))if(n.push({cellKey:r.key,start:a,end:i}),n.length>=Pt)return n;return n}function Nr(e,t,n,r){let a=(i,l)=>(0,x.createElement)("button",{key:i,type:"button",className:`gp-seg__btn${e===i?" gp-seg__btn--active":""}`,"aria-pressed":e===i,onClick:()=>t(i)},l);return(0,x.createElement)("div",{className:"gp-svgdiff"},[(0,x.createElement)("div",{key:"bar",className:"gp-svgdiff__bar"},(0,x.createElement)("div",{className:"gp-seg"},[a("render",r("diff.svgRender")),a("source",r("diff.svgSource"))])),(0,x.createElement)("div",{key:"body",className:"gp-svgdiff__body"},n)])}function Ha(e,t,n,r,a,i){let[l,s]=(0,x.useState)(null),o=(0,x.useRef)(0);(0,x.useEffect)(()=>{o.current+=1,s(null)},[e]);let c=(0,x.useCallback)((p,u)=>{if(n===void 0||r===void 0||a===void 0||i===void 0)return;let f=`${p.rightStart}:${u}`;s(f);let w=++o.current,{start:b,end:k}=Fa(p,u),_=i.base==="commit"&&i.commit!==void 0?{kind:"file-lines",path:a,base:"commit",commit:i.commit,start:b,end:k}:i.base==="staged"?{kind:"file-lines",path:a,base:"staged",start:b,end:k}:{kind:"file-lines",path:a,base:"worktree",start:b,end:k};n.query({sessionId:r,query:_}).then(N=>{if(w!==o.current)return;let A=de(N,"file-lines");s(null),A!==null&&t(J=>Sr(J,p.rightStart,u,A.start,A.lines,A.eof))}).catch(()=>{w===o.current&&s(null)})},[n,r,a,i,t]);return{busy:l,run:c}}function Fa(e,t){if(e.atEnd)return{start:e.rightStart,end:e.rightStart+ke-1};let n=e.count??ke;return t==="all"||n<=ke?{start:e.rightStart,end:e.rightStart+n-1}:t==="down"?{start:e.rightStart,end:e.rightStart+ke-1}:{start:e.rightStart+n-ke,end:e.rightStart+n-1}}function za(e,t,n,r){let[a,i]=(0,x.useState)({kind:"idle"}),l=r?.base,s=r?.commit;return(0,x.useEffect)(()=>{if(e===void 0||t===void 0||n===void 0||l===void 0)return;let o=!0;i({kind:"loading"});let c=l==="commit"&&s!==void 0?{kind:"image-diff",path:n,base:"commit",commit:s}:l==="staged"?{kind:"image-diff",path:n,base:"staged"}:{kind:"image-diff",path:n,base:"worktree"};return e.query({sessionId:t,query:c}).then(p=>{if(!o)return;let u=de(p,"image-diff");i(u!==null?{kind:"ready",res:u}:{kind:"failed"})}).catch(()=>{o&&i({kind:"failed"})}),()=>{o=!1}},[e,t,n,l,s]),a}function $t(e,t=""){return e.map((n,r)=>(0,x.createElement)("span",{key:`${t}${r}`,style:n.style},n.text))}function Rr(e,t,n,r){if(n===null)return null;let a=n.perCell.get(t);if(a===void 0||a.length===0)return null;let i=n.activeKey===t?n.activeRange:null;return Ht(e,a,r,t,i,n.activeRef)}function It(e,t,n,r,a=null){if(n==="")return(0,x.createElement)("div",{key:t,className:e},"\xA0");let i=r(n)?.[0],l=Rr(n,t,a,i);return l!==null?(0,x.createElement)("div",{key:t,className:e},l):(0,x.createElement)("div",{key:t,className:e},i===void 0?n:$t(i))}function _n(e,t,n,r,a,i,l=null){let s=i(n)?.[0]??[{text:n,style:{}}],o=Rr(n,t,l,s);if(o!==null)return(0,x.createElement)("div",{key:t,className:e},o);let[c,p,u]=Cr(s,r);return(0,x.createElement)("div",{key:t,className:e},[...$t(c,"p"),(0,x.createElement)("span",{key:"w",className:a},p.length===0?"\xA0":$t(p)),...$t(u,"s")])}function Gr(e){return e.filter(t=>t.leftText!==null).map(t=>({no:t.leftNo,text:t.leftText}))}function Mr(e){return e.filter(t=>t.rightText!==null).map(t=>({no:t.rightNo,text:t.rightText}))}function Er(e,t,n=null){return(0,x.createElement)("div",{className:"gp-diff__single"},e.flatMap((r,a)=>[(0,x.createElement)("div",{key:`n${a}`,className:"gp-diff-no"},r.no??""),It("gp-diff-cell",`c${a}`,r.text,t,n)]))}function $a(e,t,n,r,a,i){if(e.kind==="hunk")return[(0,x.createElement)("div",{key:`h${t}`,className:"gp-diff-row--hunk gp-diff-cell",style:{gridColumn:"1 / -1"}},e.text??"")];if(e.kind==="gap")return[Pr(e.gap,t,r,i)];let l=e.kind==="del"||e.kind==="mod"?"gp-diff-row--del":"",s=e.kind==="add"||e.kind==="mod"?"gp-diff-row--add":"",o=e.leftText===null?(0,x.createElement)("div",{key:`l${t}`,className:`gp-diff-cell ${l}`}):e.kind==="mod"&&e.leftWord!==void 0?_n(`gp-diff-cell ${l}`,`l${t}`,e.leftText,e.leftWord,"gp-diff-word gp-diff-word--del",n,a):It(`gp-diff-cell ${l}`,`l${t}`,e.leftText,n,a),c=e.rightText===null?(0,x.createElement)("div",{key:`r${t}`,className:`gp-diff-cell ${s}`}):e.kind==="mod"&&e.rightWord!==void 0?_n(`gp-diff-cell ${s}`,`r${t}`,e.rightText,e.rightWord,"gp-diff-word gp-diff-word--add",n,a):It(`gp-diff-cell ${s}`,`r${t}`,e.rightText,n,a);return[(0,x.createElement)("div",{key:`ln${t}`,className:"gp-diff-no"},e.leftNo??""),o,(0,x.createElement)("div",{key:`rn${t}`,className:"gp-diff-no"},e.rightNo??""),c]}function Ia(e,t,n,r,a,i){if(e.kind==="hunk")return[(0,x.createElement)("div",{key:`h${t}`,className:"gp-diff-row--hunk gp-diff-cell",style:{gridColumn:"1 / -1"}},e.text??"")];if(e.kind==="gap")return[Pr(e.gap,t,r,i)];let l=e.kind==="del",s=e.kind==="add",o=s?"gp-diff-row--add":l?"gp-diff-row--del":"",c=s?"+":l?"\u2212":"\xA0",p=e.rightText??e.leftText??"",u=s?e.rightWord:l?e.leftWord:void 0,f=s?"gp-diff-word gp-diff-word--add":"gp-diff-word gp-diff-word--del",w=`gp-diff-cell gp-diff-uni__code ${o}`,b=u!==void 0?_n(w,`c${t}`,p,u,f,n,a):It(w,`c${t}`,p,n,a);return[(0,x.createElement)("div",{key:`ol${t}`,className:"gp-diff-no"},e.leftNo??""),(0,x.createElement)("div",{key:`nl${t}`,className:"gp-diff-no"},e.rightNo??""),(0,x.createElement)("div",{key:`sg${t}`,className:`gp-diff-uni__sign ${o}`},c),b]}function Pr(e,t,n,r){let a=n.busy===`${e.rightStart}:all`,i=n.busy===`${e.rightStart}:up`,l=n.busy===`${e.rightStart}:down`,s=(c,p,u)=>(0,x.createElement)("button",{key:c,type:"button",className:"gp-gap__btn",disabled:n.busy!==null,onClick:f=>{f.stopPropagation(),n.run(e,c)}},u?r("common.loading"):p),o=[];if(e.atEnd)o.push(s("down",r("diff.expandDown",{n:ke}),l));else{let c=e.count??0;c>0&&c<=ke?o.push(s("all",r("diff.expandGap",{n:c}),a)):(e.atStart||o.push(s("up",r("diff.expandUp",{n:ke}),i)),o.push(s("all",r("diff.expandGap",{n:c}),a)),o.push(s("down",r("diff.expandDown",{n:ke}),l)))}return(0,x.createElement)("div",{key:`g${t}`,className:"gp-diff-row--gap",style:{gridColumn:"1 / -1"}},o)}function Jt(e){return kr(e)}var F=require("react");var Ba=100;function Dr(e,t,n){let[r,a]=(0,F.useState)(null),[i,l]=(0,F.useState)(!1),[s,o]=(0,F.useState)([]),c=(0,F.useCallback)(()=>{l(!1),(async()=>{let[p,u]=await Promise.all([e.query({sessionId:t,query:{kind:"branches"}}),e.query({sessionId:t,query:{kind:"tags"}})]),f=de(p,"branches");if(f===null){l(!0);return}let w=de(u,"tags");a({current:f.current,defaultBranch:f.defaultBranch,local:f.local,remote:f.remote,tags:w?.tags??[]}),e.query({sessionId:t,query:{kind:"authors"}}).then(b=>{o(de(b,"authors")?.authors??[])})})()},[e,t]);return(0,F.useEffect)(()=>{c()},[n]),{tree:r,treeError:i,authors:s,reload:c}}function Ar(e,t,n,r,a){let[i,l]=(0,F.useState)([]),[s,o]=(0,F.useState)(0),[c,p]=(0,F.useState)(!1),[u,f]=(0,F.useState)(!1),w=(0,F.useRef)(0),b=(0,F.useRef)(!1),k=(0,F.useRef)(null),_=(0,F.useCallback)(async(M,v)=>{if(b.current)return;b.current=!0;let L=w.current;p(!0),f(!1);let P=await e.query({sessionId:t,query:{kind:"history",limit:Ba,skip:M,...v.ref?{ref:v.ref}:{},...v.search?{search:v.search}:{},...v.author?{author:v.author}:{},...v.since?{since:v.since}:{}}});if(b.current=!1,L!==w.current)return;p(!1);let W=de(P,"history");if(W===null){f(!0);return}let S=W.commits;l($=>M===0?S:[...$,...S]),o(W.total)},[e,t]),N=(0,F.useRef)(n);(0,F.useEffect)(()=>{w.current+=1,b.current=!1,N.current!==n&&(N.current=n,a(),k.current&&(k.current.scrollTop=0)),_(0,n)},[n,r]);let A=s<0?!0:i.length<s,J=(0,F.useCallback)(()=>{b.current||!A||_(i.length,n)},[_,i.length,n,A]);return{commits:i,total:s,loading:c,listError:u,hasMore:A,listRef:k,loadMore:J}}function Lr(e,t,n){let[r,a]=(0,F.useState)(null),[i,l]=(0,F.useState)(null),[s,o]=(0,F.useState)(!1),[c,p]=(0,F.useState)(null),[u,f]=(0,F.useState)(null),[w,b]=(0,F.useState)(!1),[k,_]=(0,F.useState)(n),[N,A]=(0,F.useState)(!1),J=(0,F.useRef)(0),M=(0,F.useRef)(null),v=(0,F.useRef)(new Map),L=(0,F.useCallback)((C,I)=>{let X=v.current;for(X.set(C,I);X.size>50;){let Q=X.keys().next().value;if(Q===void 0)break;X.delete(Q)}},[]),P=(0,F.useCallback)(()=>{a(null),l(null),M.current=null},[]),W=(0,F.useCallback)(C=>{M.current===C.hash&&a(C)},[]),S=(0,F.useCallback)(async C=>{M.current=C.hash,a(C),o(!1),J.current+=1,p(null),f(null),b(!1);let I=v.current.get(C.hash);if(I!==void 0){l(I);return}l(null);let X=await e.query({sessionId:t,query:{kind:"show",ref:C.hash}});if(M.current!==C.hash)return;let Q=de(X,"show");if(Q!==null){let ge={commit:Q.commit,body:Q.body,stats:Q.stats,insertions:Q.insertions,deletions:Q.deletions};L(C.hash,ge),l(ge)}else o(!0)},[e,t,L]),$=(0,F.useCallback)(async(C,I,X,Q=!1)=>{let ge=++J.current;p({path:C,hash:I,shortHash:X}),f(null),b(!1),A(Q);let D=await e.query({sessionId:t,query:{kind:"diff",path:C,base:"commit",commit:I,...Q?{context:1e5}:{}}});if(ge!==J.current)return;let re=de(D,"diff");re!==null?f(re.text):b(!0)},[e,t]),se=(0,F.useCallback)(()=>{J.current+=1,p(null),f(null),b(!1),A(!1)},[]);(0,F.useEffect)(()=>{if(c===null)return;let C=I=>{I.key==="Escape"&&se()};return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[c,se]);let[ee,ce]=(0,F.useState)(null),[ne,z]=(0,F.useState)(null),te=(0,F.useRef)(void 0),T=(0,F.useRef)(null),pe=(0,F.useCallback)((C,I,X)=>{te.current!==void 0&&clearTimeout(te.current),te.current=setTimeout(()=>{T.current=C.hash,ce({commit:C,x:I,y:X});let Q=v.current.get(C.hash);if(Q!==void 0){z(Q.body);return}z(null),e.query({sessionId:t,query:{kind:"show",ref:C.hash}}).then(ge=>{if(T.current!==C.hash)return;let D=de(ge,"show");D!==null?(L(C.hash,{commit:D.commit,body:D.body,stats:D.stats,insertions:D.insertions,deletions:D.deletions}),z(D.body)):z("")})},260)},[e,t,L]),H=(0,F.useCallback)(()=>{te.current!==void 0&&clearTimeout(te.current),T.current=null,ce(null),z(null)},[]);return(0,F.useEffect)(()=>()=>{te.current!==void 0&&clearTimeout(te.current)},[]),{selected:r,detail:i,detailError:s,select:S,resyncSelected:W,clearSelection:P,fileDiff:c,fileDiffText:u,fileDiffError:w,fileDiffMode:k,setFileDiffMode:_,fileDiffExpanded:N,openFileDiff:$,closeFileDiff:se,hover:ee,hoverBody:ne,onHoverEnter:pe,onHoverLeave:H}}var xe=require("react"),Xa=(e,t,n)=>Math.max(t,Math.min(n,e));function Ja(e,t){try{let n=typeof localStorage<"u"?localStorage.getItem(e):null,r=n===null?NaN:Number(n);return Number.isFinite(r)?r:t}catch{return t}}function Ka(e,t){try{typeof localStorage<"u"&&localStorage.setItem(e,String(Math.round(t)))}catch{}}function ze(e){let{storageKey:t,initial:n,min:r,reserve:a,edge:i}=e,[l,s]=(0,xe.useState)(()=>Ja(t,n)),o=(0,xe.useRef)(null),c=(0,xe.useRef)(null),p=(0,xe.useCallback)(f=>{let b=o.current?.parentElement?.clientWidth??Number.MAX_SAFE_INTEGER;c.current={x:f.clientX,w:l,max:Math.max(r,b-a)},f.preventDefault(),typeof document<"u"&&(document.body.style.cursor="col-resize",document.body.style.userSelect="none")},[l,r,a]);(0,xe.useEffect)(()=>{if(typeof window>"u")return;let f=b=>{let k=c.current;if(k===null)return;let _=b.clientX-k.x;s(Xa(k.w+(i==="end"?_:-_),r,k.max))},w=()=>{c.current!==null&&(c.current=null,typeof document<"u"&&(document.body.style.cursor="",document.body.style.userSelect=""),s(b=>(Ka(t,b),b)))};return window.addEventListener("pointermove",f),window.addEventListener("pointerup",w),()=>{window.removeEventListener("pointermove",f),window.removeEventListener("pointerup",w)}},[i,r,t]);let u=(0,xe.createElement)("div",{key:`rz-${t}`,ref:o,className:"gp-resizer",role:"separator","aria-orientation":"vertical",onPointerDown:p});return{width:l,divider:u}}var Hr=require("react");function $e(e,t,n,r,a=!1){return e.map(i=>(0,Hr.createElement)("button",{key:i,type:"button",className:`gp-seg__btn${t===i?" gp-seg__btn--active":""}`,...a?{disabled:!0}:{},onClick:()=>n(i)},r(i)))}var le=require("react"),Fr=require("react-dom");function gt(e,t,n){switch(e){case"empty-message":return n("error.emptyMessage");case"not-a-git-repo":return n("error.notARepo");case"cwd-unavailable":return n("error.noCwd");case"local-changes-block":return n("error.localChangesBlock");case"not-ff":return n("error.notFastForward");case"push-rejected":return n("error.pushRejected");case"auth-failed":return n("error.authFailed");case"conflict":return n("error.conflict");case"revert-conflict":return n("error.revertConflict");case"revert-stuck":return n("error.revertStuck");case"revert-merge":return n("error.revertMerge");case"index-busy":return n("error.indexBusy");case"not-found":return n("error.notFound");case"invalid-name":case"invalid-index":return n("error.invalidName");default:return t??n("error.generic")}}function Qe(e){return(0,le.createElement)("div",{key:"aihint",className:"gp-modal__hint"},e("ops.aiHint"))}function Ye(e){return(0,le.createElement)("div",{key:"footer",className:"gp-modal__footer"},[(0,le.createElement)("button",{key:"cancel",type:"button",className:"gp-btn",onClick:e.onClose},e.t("common.cancel")),(0,le.createElement)("button",{key:"ok",type:"button",className:`gp-btn ${e.danger?"gp-btn--danger":"gp-btn--primary"}`,disabled:e.confirmDisabled,onClick:e.onConfirm},e.confirmLabel)])}function Ze(e){return typeof document>"u"?null:(0,le.createElement)(Va,e)}function Va({onClose:e,title:t,icon:n,hash:r,body:a,footer:i,overlay:l,portalKey:s,t:o}){let c=l!=null;(0,le.useEffect)(()=>{let u=f=>{f.key==="Escape"&&!c&&e()};return document.addEventListener("keydown",u),()=>document.removeEventListener("keydown",u)},[e,c]);let p=(0,le.createElement)("div",{className:"gp-modal-backdrop",onClick:u=>{!c&&u.target===u.currentTarget&&e()}},(0,le.createElement)("div",{className:"gp-modal gp-modal--sm",role:"dialog","aria-modal":!0},[(0,le.createElement)("div",{key:"bar",className:"gp-modal__bar"},[n!==void 0?(0,le.createElement)("span",{key:"ic",className:"gp-modal__fileicon"},n):null,(0,le.createElement)("span",{key:"title",className:"gp-modal__path"},t),r!==void 0?(0,le.createElement)("span",{key:"hash",className:"gp-modal__hash"},r):null,(0,le.createElement)("button",{key:"close",type:"button",className:"gp-icon-btn gp-modal__close",title:o("common.close"),disabled:c,onClick:e},(0,le.createElement)(qe,{size:15}))]),(0,le.createElement)("div",{key:"body",className:"gp-modal__form"},a),i,l??null]));return(0,Fr.createPortal)(p,document.body,s)}function Oa(e){return(0,le.createElement)("div",{key:"overlay",className:"gp-modal__overlay"},[(0,le.createElement)("div",{key:"sp",className:"gp-spinner"}),(0,le.createElement)("div",{key:"lb",className:"gp-modal__overlay-label"},e)])}function De(e){let t=e.confirmBusy===!0&&e.busyLabel!==void 0;return Ze({onClose:e.onClose,title:e.title,portalKey:"confirm-modal",t:e.t,body:[(0,le.createElement)("div",{key:"txt",className:"gp-modal__confirmtext"},e.body),e.extra??null,Qe(e.t),e.error!==null?(0,le.createElement)("div",{key:"err",className:"gp-feedback"},e.error):null],footer:Ye({onClose:e.onClose,onConfirm:e.onConfirm,confirmLabel:e.confirmLabel,confirmDisabled:e.confirmBusy===!0,danger:e.danger,t:e.t}),...t?{overlay:Oa(e.busyLabel)}:{}})}var q=require("react");function zr(e,t){return typeof document>"u"?null:(0,q.createElement)(qa,{target:e,...t})}function qa({target:e,onClose:t,onCreate:n,error:r,t:a}){let[i,l]=(0,q.useState)(""),[s,o]=(0,q.useState)(!1),[c,p]=(0,q.useState)(""),u=()=>{i.trim()!==""&&n(i.trim(),s?c:"")};return Ze({onClose:t,title:a("tag.createTitle"),icon:(0,q.createElement)(Oe,{size:15}),hash:e.shortHash,portalKey:"tag-create-modal",t:a,body:[(0,q.createElement)("input",{key:"name",className:"gp-input",placeholder:a("tag.namePlaceholder"),value:i,autoFocus:!0,onChange:f=>l(f.target.value),onKeyDown:f=>{f.key==="Enter"&&u()}}),(0,q.createElement)("label",{key:"ann",className:"gp-modal__check"},[(0,q.createElement)("input",{key:"cb",type:"checkbox",className:"gp-check",checked:s,onChange:()=>o(f=>!f)}),a("tag.annotated")]),s?(0,q.createElement)("textarea",{key:"msg",className:"gp-input gp-input--area",placeholder:a("tag.messagePlaceholder"),value:c,onChange:f=>p(f.target.value)}):null,Qe(a),r!==null?(0,q.createElement)("div",{key:"err",className:"gp-feedback"},r):null],footer:Ye({onClose:t,onConfirm:u,confirmLabel:a("tag.create"),confirmDisabled:i.trim()==="",danger:!1,t:a})})}function $r(e,t){return typeof document>"u"?null:(0,q.createElement)(Wa,{target:e,...t})}function Wa({target:e,from:t,dirty:n,lostFiles:r,lostTotal:a,lostTruncated:i,busy:l,error:s,onReset:o,onClose:c,t:p}){let[u,f]=(0,q.useState)("mixed"),[w,b]=(0,q.useState)(!1);(0,q.useEffect)(()=>{u!=="hard"&&b(!1)},[u]);let k=[{value:"mixed",label:"reset.modeMixed",hint:"reset.mixedHint"},{value:"soft",label:"reset.modeSoft",hint:"reset.softHint"},{value:"hard",label:"reset.modeHard",hint:"reset.hardHint"}],_=l||u==="hard"&&!w;return Ze({onClose:c,title:p("reset.title"),icon:(0,q.createElement)(Rt,{size:15}),hash:e.shortHash,portalKey:"reset-modal",t:p,body:[(0,q.createElement)("div",{key:"txt",className:"gp-modal__confirmtext"},p("reset.body",{from:t,to:e.shortHash})),(0,q.createElement)("div",{key:"modes",className:"gp-reset__modes"},k.map(N=>(0,q.createElement)("label",{key:N.value,className:`gp-reset__mode${u===N.value?" gp-reset__mode--on":""}${N.value==="hard"?" gp-reset__mode--danger":""}`},[(0,q.createElement)("input",{key:"r",type:"radio",name:"gp-reset-mode",className:"gp-check",checked:u===N.value,onChange:()=>f(N.value)}),(0,q.createElement)("span",{key:"tx",className:"gp-reset__modetext"},[(0,q.createElement)("span",{key:"l",className:"gp-reset__modelabel"},p(N.label)),(0,q.createElement)("span",{key:"h",className:"gp-reset__modehint"},p(N.hint))])]))),u==="hard"?(0,q.createElement)("div",{key:"orphan",className:"gp-reset__dirtywarn"},p("reset.hardOrphan")):null,u==="hard"&&a>0?(0,q.createElement)("div",{key:"lost",className:"gp-reset__lost"},[(0,q.createElement)("div",{key:"w",className:"gp-reset__warn"},p("reset.hardWarn")),(0,q.createElement)("ul",{key:"ul",className:"gp-reset__lostlist"},[...r.map(N=>(0,q.createElement)("li",{key:N,title:N},N)),i?(0,q.createElement)("li",{key:"_more",className:"gp-reset__lostmore"},p("reset.lostMore")):null])]):null,u==="hard"?(0,q.createElement)("label",{key:"ack",className:"gp-modal__check gp-reset__ack"},[(0,q.createElement)("input",{key:"cb",type:"checkbox",className:"gp-check",checked:w,onChange:()=>b(N=>!N)}),p(a>0?"reset.hardAck":"reset.hardAckClean")]):null,n?(0,q.createElement)("div",{key:"dirty",className:"gp-reset__dirtywarn"},p("ops.dirtyWarn")):null,Qe(p),s!==null?(0,q.createElement)("div",{key:"err",className:"gp-feedback"},s):null],footer:Ye({onClose:c,onConfirm:()=>void o(u),confirmLabel:p("reset.confirm"),confirmDisabled:_,danger:u==="hard",t:p})})}var ie=require("react");var _e=require("react"),Ir=require("react-dom"),ja=140,Ua=260;function Kt(e){let t=e?.placement??"above",n=e?.delayMs??ja,r=e?.maxWidth??Ua,[a,i]=(0,_e.useState)(null),l=(0,_e.useRef)(void 0),s=(0,_e.useCallback)(()=>{l.current!==void 0&&(clearTimeout(l.current),l.current=void 0),i(null)},[]),o=(0,_e.useCallback)((f,w)=>{l.current!==void 0&&clearTimeout(l.current),l.current=setTimeout(()=>{let b=f.getBoundingClientRect(),k=Math.max(8,Math.min(b.left,window.innerWidth-r-8));i(t==="below"?{text:w,left:k,top:b.bottom+6}:{text:w,left:k,bottom:Math.max(8,window.innerHeight-b.top+6)})},n)},[t,n,r]),c=(0,_e.useCallback)(f=>({onMouseEnter:w=>o(w.currentTarget,f),onMouseLeave:s,onFocus:w=>o(w.currentTarget,f),onBlur:s}),[o,s]),p={left:a?.left??0,maxWidth:r};a?.top!==void 0&&(p.top=a.top),a?.bottom!==void 0&&(p.bottom=a.bottom);let u=a!==null&&typeof document<"u"?(0,Ir.createPortal)((0,_e.createElement)("div",{className:"gp-tip gp-tip--sb",style:p},a.text),document.body):null;return{tipProps:c,tipNode:u,hideTip:s}}function Br(e,t,n){if(e==="loading"||e===null)return(0,ie.createElement)("div",{className:"gp-pullscope gp-pullscope--loading"},t(n.loading));let r=t(n.line,{commits:e.commits,files:e.files,ins:e.insertions,del:e.deletions}),a=r.match(/(\+\d+)\s*\/\s*([-−]\d+)/);if(a===null)return(0,ie.createElement)("div",{className:"gp-pullscope"},r);let i=r.indexOf(a[0]);return(0,ie.createElement)("div",{className:"gp-pullscope"},[r.slice(0,i),(0,ie.createElement)("span",{key:"add",className:"gp-pullscope__add"},a[1])," / ",(0,ie.createElement)("span",{key:"del",className:"gp-pullscope__del"},a[2]),r.slice(i+a[0].length)])}function Xr(e,t){return Br(e,t,{line:"status.pullScope",loading:"status.pullScopeLoading"})}function Jr(e,t){return Br(e,t,{line:"status.pushScope",loading:"status.pushScopeLoading"})}function Qa(e){let t=e.replace(/^https?:\/\/[^/]+\//,"").replace(/\/+$/,""),n=t.split("/");return n.length>=2?n.slice(-2).join("/"):t}function Sn(e,t){return(0,ie.createElement)(Ya,{snapshot:e,cb:t})}function Ya({snapshot:e,cb:t}){let{t:n}=t,{tipProps:r,tipNode:a,hideTip:i}=Kt({placement:"above"}),l=e.remote??null,s=e.hasUpstream===!0,o=(()=>{if(l===null||l.hostKind!=="github")return null;let N=(0,ie.createElement)(cr,{size:14});if(l.webUrl===null)return(0,ie.createElement)("span",{key:"r",className:"gp-statusbar__repo gp-statusbar__repo--none","aria-label":l.url,...r(l.url)},(0,ie.createElement)("span",{className:"gp-statusbar__ic"},N));let A=l.host!==null?n("status.openRepoOn",{host:l.host}):n("status.openRepo"),J=`${Qa(l.webUrl)} \xB7 ${A}`;return(0,ie.createElement)("a",{key:"r",className:"gp-statusbar__repo",href:l.webUrl,target:"_blank",rel:"noreferrer","aria-label":J,...r(J)},(0,ie.createElement)("span",{className:"gp-statusbar__ic"},N))})(),{ahead:c,behind:p,branch:u}=e,f=s&&p>0&&c===0,w=s&&c>0&&p===0,b=!s&&u!==null&&l!==null,k=(()=>{let N,A="";return u===null?N=n("status.detached"):s?c===0&&p===0?(N=n("status.synced"),A=" gp-statusbar__state--ok"):c>0&&p>0?(N=n("status.diverged",{ahead:c,behind:p}),A=" gp-statusbar__state--warn"):p>0?(N=n("status.behind",{n:p}),A=" gp-statusbar__state--warn"):N=n("status.ahead",{n:c}):N=n("status.noUpstream"),(0,ie.createElement)("span",{key:"s",className:`gp-statusbar__state${A}`},N)})(),_=[l!==null?(0,ie.createElement)("button",{key:"check",type:"button",className:"gp-icon-btn gp-statusbar__btn",disabled:t.syncBusy,"aria-label":n("status.check"),...r(n("status.checkTitle")),onClick:()=>{i(),t.onCheck()}},(0,ie.createElement)(ur,{size:13})):null,f?(0,ie.createElement)("button",{key:"pull",type:"button",className:"gp-btn gp-btn--sm gp-statusbar__pull",disabled:t.pullBusy,"aria-label":n("status.pullTitle"),...r(n("status.pullTitle")),onClick:()=>{i(),t.onPull()}},[(0,ie.createElement)(pr,{key:"i",size:12}),n("status.pull")]):null,w?(0,ie.createElement)("button",{key:"push",type:"button",className:"gp-btn gp-btn--sm gp-statusbar__pull",disabled:t.pushBusy,"aria-label":n("status.pushTitle"),...r(n("status.pushTitle")),onClick:()=>{i(),t.onPush()}},[(0,ie.createElement)(yn,{key:"i",size:12}),n("status.push")]):null,b?(0,ie.createElement)("button",{key:"publish",type:"button",className:"gp-btn gp-btn--sm gp-statusbar__pull",disabled:t.publishBusy,"aria-label":n("status.publishTitle"),...r(n("status.publishTitle")),onClick:()=>{i(),t.onPublish()}},[(0,ie.createElement)(yn,{key:"i",size:12}),n("status.publish")]):null];return(0,ie.createElement)("div",{key:"statusbar",className:`gp-statusbar${t.syncBusy?" gp-statusbar--busy":""}`},[o,(0,ie.createElement)("div",{key:"sync",className:"gp-statusbar__sync"},[k,..._]),a])}var Cn=new Set,et=14,Kr=30;function Za(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n].kind!==t[n].kind||e[n].name!==t[n].name||e[n].head!==t[n].head)return!1;return!0}var ei=46,ti=260;function ni(e,t){let[n,r]=(0,d.useState)(!1);return(0,d.useEffect)(()=>{if(e===null||typeof ResizeObserver>"u")return;let a=()=>r(e.clientWidth>0&&e.clientWidth<t);a();let i=new ResizeObserver(a);return i.observe(e),()=>i.disconnect()},[e,t]),n}function Vr({remote:e,sessionId:t,refreshKey:n,defaultDiffView:r,snapshot:a,onAction:i,onResync:l,compact:s,t:o}){let[c,p]=(0,d.useState)({ref:null,search:"",author:"",since:""}),[u,f]=(0,d.useState)(""),[w,b]=(0,d.useState)(null),k=ni(w,ti),[_,N]=(0,d.useState)(new Set(["tags","remote"])),[A,J]=(0,d.useState)(0),M=n+A,v=()=>J(h=>h+1),[L,P]=(0,d.useState)(null),[W,S]=(0,d.useState)(null),[$,se]=(0,d.useState)(null),[ee,ce]=(0,d.useState)(null),[ne,z]=(0,d.useState)(null),[te,T]=(0,d.useState)(!1),[pe,H]=(0,d.useState)(!1),[C,I]=(0,d.useState)(!1),[X,Q]=(0,d.useState)(!1),[ge,D]=(0,d.useState)(!1),[re,me]=(0,d.useState)(!1),[ve,Z]=(0,d.useState)(!1),[Y,he]=(0,d.useState)(!1),[tn,Ae]=(0,d.useState)(null),[Re,Be]=(0,d.useState)(null),[mt,nt]=(0,d.useState)("list"),[Xe,Le]=(0,d.useState)(!1);(0,d.useEffect)(()=>{if(!Xe)return;let h=B=>{B.key==="Escape"&&Le(!1)};return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[Xe]),(0,d.useEffect)(()=>{!s&&Xe&&Le(!1)},[s,Xe]),(0,d.useEffect)(()=>{if(!X){Ae(null);return}let h=!0;return Ae("loading"),e.query({sessionId:t,query:{kind:"pull-preview"}}).then(B=>{if(!h)return;let U=de(B,"pull-preview");Ae(U!==null&&U.hasUpstream?{commits:U.commits,files:U.files,insertions:U.insertions,deletions:U.deletions}:null)}),()=>{h=!1}},[X,e,t]),(0,d.useEffect)(()=>{if(!re){Be(null);return}let h=!0;return Be("loading"),e.query({sessionId:t,query:{kind:"push-preview"}}).then(B=>{if(!h)return;let U=de(B,"push-preview");Be(U!==null&&U.hasUpstream?{commits:U.commits,files:U.files,insertions:U.insertions,deletions:U.deletions}:null)}),()=>{h=!1}},[re,e,t]);let{tree:ht,treeError:Je,authors:nn,reload:Se}=Dr(e,t,M),V=Lr(e,t,r),{commits:Ce,loading:rt,listError:rn,hasMore:we,listRef:yt,loadMore:an}=Ar(e,t,c,M,V.clearSelection);(0,d.useEffect)(()=>{let h=setTimeout(()=>p(B=>B.search===u?B:{...B,search:u}),300);return()=>clearTimeout(h)},[u]);let Ge=c.search!=="",at=(0,d.useMemo)(()=>Ge?Ce.map(h=>({commit:h,lane:0,color:0,edges:[],merge:!1})):mr(Ce,a.graphStyle),[Ce,Ge,a.graphStyle]),bt=(0,d.useMemo)(()=>Ge?0:fr(at),[at,Ge]),it=Ge?12:Math.max(et,bt*et),on=s?ei:Kr,sn=s?`${it}px minmax(0,1fr)`:`${it}px minmax(120px,1fr) 72px 120px 96px`,Ke=()=>{let h=yt.current;h===null||!we||h.scrollTop+h.clientHeight>=h.scrollHeight-240&&an()},vt=h=>{V.select(h),s&&nt("detail")},ln=(0,d.useMemo)(()=>Date.now(),[Ce]),dn=(0,d.useMemo)(()=>V.detail===null?[]:hr(V.detail.stats.map(h=>({path:h.path,meta:h.status}))),[V.detail]),j=V.selected,He=j?.hash??null,[ot,wt]=(0,d.useState)({hash:null,dirs:Cn}),y=ot.hash===He?ot.dirs:Cn,G=(0,d.useCallback)(h=>{wt(B=>{let U=B.hash===He?B.dirs:Cn,kt=new Set(U);return kt.has(h)?kt.delete(h):kt.add(h),{hash:He,dirs:kt}})},[He]);(0,d.useEffect)(()=>{if(j===null)return;let h=Ce.find(B=>B.hash===j.hash);h!==void 0&&h!==j&&!Za(h.refs,j.refs)&&V.resyncSelected(h)},[Ce,j]);let K=ze({storageKey:"gp.overview.left",initial:200,min:130,reserve:360,edge:"end"}),ae=ze({storageKey:"gp.overview.right",initial:340,min:190,reserve:360,edge:"start"}),fe=h=>p(B=>({...B,ref:h})),Te=async(h,B)=>{if(!(L===null||te)){z(null),T(!0);try{let U=await e.run({sessionId:t,action:{kind:"tag-create",name:h,commit:L.hash,...B.trim()!==""?{message:B}:{}}});U.ok?(P(null),v()):z(gt(U.error.code,U.error.message,o))}finally{T(!1)}}},xt=async h=>{if(!te){z(null),T(!0);try{let B=await e.run({sessionId:t,action:{kind:"tag-delete",name:h}});B.ok?(S(null),v()):z(gt(B.error.code,B.error.message,o))}finally{T(!1)}}},da=async()=>{if(!($===null||te)){z(null),T(!0);try{let h=await i({kind:"revert",commit:$.hash});h.ok?se(null):z(h.error??o("error.generic"))}finally{T(!1)}}},ca=async h=>{if(!(ee===null||te)){z(null),T(!0);try{let B=await i({kind:"reset",commit:ee.hash,mode:h});B.ok?ce(null):z(B.error??o("error.generic"))}finally{T(!1)}}},pa=async()=>{if(!pe){z(null),H(!0);try{let h=await i({kind:"fetch"});h.ok?Se():z(h.error??o("error.generic"))}finally{H(!1)}}},ua=async()=>{if(!C){z(null),I(!0);try{let h=await i({kind:"pull-ff"});h.ok?(Q(!1),Se()):z(h.error??o("error.generic"))}finally{I(!1)}}},ga=async()=>{if(!ge){z(null),D(!0);try{let h=await i({kind:"push"});h.ok?(me(!1),Se()):z(h.error??o("error.generic"))}finally{D(!1)}}},fa=async()=>{if(!(ve||a.remote===null)){z(null),Z(!0);try{let h=await i({kind:"publish",remote:a.remote.name});h.ok?(he(!1),Se()):z(h.error??o("error.generic"))}finally{Z(!1)}}},Ln={syncBusy:pe,pullBusy:C,pushBusy:ge,publishBusy:ve,onCheck:()=>void pa(),onPull:()=>{z(null),Q(!0)},onPush:()=>{z(null),me(!0)},onPublish:()=>{z(null),he(!0)},t:o},Hn=li(V.fileDiff,{text:V.fileDiffText,error:V.fileDiffError,mode:V.fileDiffMode,onMode:V.setFileDiffMode,expanded:V.fileDiffExpanded,onExpand:h=>{V.fileDiff!==null&&V.openFileDiff(V.fileDiff.path,V.fileDiff.hash,V.fileDiff.shortHash,h)},onClose:V.closeFileDiff,remote:e,sessionId:t,compact:s,t:o}),Fn=(0,d.useMemo)(()=>[...new Set(a.changes.filter(h=>h.status!=="untracked").map(h=>h.path))],[a.changes]),zn=[L!==null?zr(L,{onClose:()=>P(null),onCreate:Te,error:ne,compact:s,t:o}):null,W!==null?De({title:o("tag.deleteTitle"),body:o("tag.deleteConfirm",{name:W}),confirmLabel:o("tag.deleteTitle"),danger:!0,error:ne,confirmBusy:te,onConfirm:()=>void xt(W),onClose:()=>S(null),t:o}):null,$!==null?De({title:o("revert.title"),body:o("revert.body",{ref:`${$.shortHash} ${$.subject}`})+(a.dirty?`
537
538
 
538
- ${l("ops.dirtyWarn")}`:""),confirmLabel:l("revert.confirm"),danger:!1,error:ne,confirmBusy:te,onConfirm:()=>void V(),onClose:()=>oe(null),t:l}):null,ee!==null?Fr(ee,{from:a.head??ee.shortHash,dirty:a.dirty,lostFiles:Ln,lostTotal:Ln.length,lostTruncated:a.truncated,busy:te,error:ne,onReset:se,onClose:()=>ce(null),t:l}):null,B?De({title:l("status.pullConfirmTitle"),body:l("status.pullConfirmBody",{branch:a.branch??"HEAD",behind:a.behind}),extra:Ir(en,l),confirmLabel:l("status.pullConfirm"),danger:!1,error:ne,confirmBusy:C,busyLabel:l("status.pulling"),onConfirm:()=>void Te(),onClose:()=>U(!1),t:l}):null,re?De({title:l("status.pushConfirmTitle"),body:l("status.pushConfirmBody",{branch:a.branch??"HEAD",ahead:a.ahead}),extra:Br(Re,l),confirmLabel:l("status.pushConfirm"),danger:!1,error:ne,confirmBusy:ge,busyLabel:l("status.pushing"),onConfirm:()=>void xt(),onClose:()=>me(!1),t:l}):null,Q?De({title:l("status.publishConfirmTitle"),body:l("status.publishConfirmBody",{branch:a.branch??"HEAD",remote:a.remote?.name??"origin"}),confirmLabel:l("status.publishConfirm"),danger:!1,error:ne,confirmBusy:ve,busyLabel:l("status.publishing"),onConfirm:()=>void sa(),onClose:()=>he(!1),t:l}):null],Fn=(0,d.createElement)("div",{key:"mid",className:"gp-col gp-col--mid gp-history"},[(0,d.createElement)("div",{key:"tb",className:"gp-toolbar",ref:b},[s?(0,d.createElement)("button",{key:"filter",type:"button",className:`gp-btn${c.ref!==null?" gp-btn--primary":""}`,title:l("overview.filterBranch"),onClick:()=>Le(!0)},[(0,d.createElement)(nr,{key:"ic",size:13}),c.ref??l("overview.filterBranch")]):null,(0,d.createElement)("input",{key:"search",className:"gp-search",placeholder:l(k||s?"overview.searchShort":"overview.search"),value:u,onChange:h=>f(h.target.value)}),(0,d.createElement)("select",{key:"author",className:"gp-select",value:c.author,onChange:h=>p(X=>({...X,author:h.target.value}))},[(0,d.createElement)("option",{key:"",value:""},l("overview.allUsers")),...tn.map(h=>(0,d.createElement)("option",{key:h,value:h},h))]),(0,d.createElement)("select",{key:"since",className:"gp-select",value:c.since,onChange:h=>p(X=>({...X,since:h.target.value}))},[(0,d.createElement)("option",{key:"",value:""},l("overview.allTime")),(0,d.createElement)("option",{key:"today",value:"1 day ago"},l("overview.today")),(0,d.createElement)("option",{key:"7d",value:"7 days ago"},l("overview.last7d")),(0,d.createElement)("option",{key:"30d",value:"30 days ago"},l("overview.last30d"))]),(0,d.createElement)("button",{key:"fetch",type:"button",className:"gp-icon-btn",title:l("overview.fetch"),onClick:()=>{e.run({sessionId:t,action:{kind:"fetch"}}).then(()=>Se())}},(0,d.createElement)(Nt,{size:14}))]),(0,d.createElement)("div",{key:"list",className:"gp-history__list",ref:bt,onScroll:Je},Ce.length===0?(0,d.createElement)("div",{className:"gp-empty"},l(nt?"common.loading":nn?"overview.loadFailed":"overview.noResults")):rt.map(h=>Ya(h,{selected:j?.hash===h.commit.hash,gridTpl:on,graphW:at,laneCount:vt,searching:Ge,now:sn,compact:s,rowH:an,onSelect:()=>wt(h.commit),onHoverEnter:K.onHoverEnter,onHoverLeave:K.onHoverLeave,t:l})))]),zn=j===null?[(0,d.createElement)("div",{key:"empty",className:"gp-empty"},[(0,d.createElement)(Tt,{key:"i",size:20}),l("overview.selectCommit")])]:[(0,d.createElement)("div",{key:"files",className:"gp-detail__files"},K.detail===null?(0,d.createElement)("div",{className:"gp-empty"},K.detailError?l("overview.detailFailed"):l("common.loading")):[K.detail.stats.length>0?(0,d.createElement)("div",{key:"sum",className:"gp-detail__summary"},[(0,d.createElement)("span",{key:"f"},l("overview.changeSummary",{files:K.detail.stats.length})),(0,d.createElement)("span",{key:"sep",className:"gp-detail__summary-sep"},"\xB7"),(0,d.createElement)("span",{key:"a",className:"gp-stats__add"},`+${K.detail.insertions}`),(0,d.createElement)("span",{key:"d",className:"gp-stats__del"},`\u2212${K.detail.deletions}`)]):null,ei(ln,{activePath:K.fileDiff?.path??null,openTitle:l("overview.openFileDiff"),onOpen:h=>{j!==null&&K.openFileDiff(h,j.hash,j.shortHash)}})]),(0,d.createElement)("div",{key:"msg",className:"gp-detail__msg"},[(0,d.createElement)("div",{key:"subj",className:"gp-detail__subject"},j.subject),(0,d.createElement)("div",{key:"meta",className:"gp-detail__meta"},[(0,d.createElement)("span",{key:"h",className:"gp-commit-hash"},j.shortHash),(0,d.createElement)("span",{key:"a"},j.author),(0,d.createElement)("span",{key:"t"},yn(j.dateIso))]),(0,d.createElement)("div",{key:"ops",className:"gp-detail__ops"},(()=>{let h=j.refs.filter(X=>X.kind==="tag");return[h.length>0?(0,d.createElement)("div",{key:"tags",className:"gp-detail__tags"},h.map(X=>(0,d.createElement)("span",{key:`tag-${X.name}`,className:"gp-ref-chip gp-ref-chip--tag gp-ref-chip--del",title:X.name},[(0,d.createElement)(Ve,{key:"i",size:11}),(0,d.createElement)("span",{key:"n",className:"gp-detail__tagname"},X.name),(0,d.createElement)("button",{key:"x",type:"button",className:"gp-ref-chip__x",title:l("tag.deleteOne",{name:X.name}),onClick:()=>{z(null),S(X.name)}},(0,d.createElement)(Oe,{size:11}))]))):null,(0,d.createElement)("div",{key:"actions",className:"gp-detail__actions"},[(0,d.createElement)("button",{key:"revert",type:"button",className:"gp-btn gp-btn--sm",title:l("overview.revert"),onClick:()=>{z(null),oe({hash:j.hash,shortHash:j.shortHash,subject:j.subject})}},[(0,d.createElement)(or,{key:"i",size:12}),l("overview.revert")]),(0,d.createElement)("button",{key:"reset",type:"button",className:"gp-btn gp-btn--sm",title:l("overview.reset"),onClick:()=>{z(null),o(),ce({hash:j.hash,shortHash:j.shortHash,subject:j.subject})}},[(0,d.createElement)(Et,{key:"i",size:12}),l("overview.reset")]),(0,d.createElement)("button",{key:"addtag",type:"button",className:"gp-btn gp-btn--sm",title:l("overview.createTag"),onClick:()=>{z(null),P({hash:j.hash,shortHash:j.shortHash})}},[(0,d.createElement)(Ve,{key:"i",size:12}),l("overview.createTag")])])]})()),K.detail!==null&&K.detail.body!==""?(0,d.createElement)("pre",{key:"body",className:"gp-detail__body"},K.detail.body):(0,d.createElement)("div",{key:"nb",className:"gp-empty"},l("overview.noMessage"))])];return s?(0,d.createElement)("div",{className:"gp-overview gp-overview--compact"},[An,...Hn,ht==="detail"?(0,d.createElement)("div",{key:"detail",className:"gp-col gp-col--mid gp-detail"},[(0,d.createElement)("div",{key:"back",className:"gp-subhead"},[(0,d.createElement)("button",{key:"b",type:"button",className:"gp-subhead__back",onClick:()=>tt("list")},[(0,d.createElement)(qe,{key:"i",size:14}),l("overview.backToList")]),j!==null?(0,d.createElement)("span",{key:"h",className:"gp-subhead__title gp-commit-hash"},j.shortHash):null]),...zn]):Fn,_n(a,Dn),Be?Qa(yt,Xe,c.ref,_,{onFilter:h=>{st(h),Le(!1)},onToggle:h=>N(X=>{let Z=new Set(X);return Z.has(h)?Z.delete(h):Z.add(h),Z}),onRetry:Se,onClose:()=>Le(!1),t:l}):null]):(0,d.createElement)("div",{className:"gp-overview"},[An,...Hn,(0,d.createElement)("div",{key:"left",className:"gp-col gp-col--left",style:{flex:`0 0 ${it.width}px`}},[(0,d.createElement)("div",{key:"scroll",className:"gp-col-left__scroll"},Kr(yt,Xe,c.ref,_,{onFilter:h=>st(h),onToggle:h=>N(X=>{let Z=new Set(X);return Z.has(h)?Z.delete(h):Z.add(h),Z}),onRetry:Se,t:l})),_n(a,Dn)]),it.divider,Fn,ot.divider,(0,d.createElement)("div",{key:"right",className:"gp-col gp-col--right gp-detail",style:{flex:`0 0 ${ot.width}px`}},zn),Ua(K.hover,K.hoverBody,l)])}function Ua(e,t,n){if(e===null||typeof document>"u")return null;let r=460,a=Math.min(e.x+16,(typeof window<"u"?window.innerWidth:1200)-r-12),i=e.y+14,o=(0,d.createElement)("div",{className:"gp-hovercard",style:{left:a,top:i,maxWidth:r}},[(0,d.createElement)("div",{key:"subj",className:"gp-hovercard__subject"},e.commit.subject),(0,d.createElement)("div",{key:"meta",className:"gp-hovercard__meta"},[(0,d.createElement)("span",{key:"h",className:"gp-commit-hash"},e.commit.shortHash),(0,d.createElement)("span",{key:"a"},e.commit.author),(0,d.createElement)("span",{key:"t"},yn(e.commit.dateIso))]),t===null?(0,d.createElement)("div",{key:"l",className:"gp-hovercard__loading"},n("common.loading")):t===""?(0,d.createElement)("div",{key:"e",className:"gp-hovercard__loading"},n("overview.noMessage")):(0,d.createElement)("pre",{key:"body",className:"gp-hovercard__body"},t)]);return(0,Vt.createPortal)(o,document.body,"commit-hovercard")}function Kr(e,t,n,r,a){if(t)return(0,d.createElement)("div",{className:"gp-empty"},[(0,d.createElement)("span",{key:"m"},a.t("overview.branchesError")),(0,d.createElement)("button",{key:"r",type:"button",className:"gp-btn",style:{marginTop:8},onClick:a.onRetry},a.t("common.retry"))]);if(e===null)return(0,d.createElement)("div",{className:"gp-empty"},a.t("common.loading"));let i=(o,s,l,c,p="")=>(0,d.createElement)("div",{key:o,className:"gp-branch-group"},[(0,d.createElement)("div",{key:"head",className:"gp-branch-group__head",onClick:()=>a.onToggle(o)},[(0,d.createElement)(Pe,{key:"c",size:11,open:!r.has(o)}),`${a.t(s)} (${l.length})`]),r.has(o)?null:l.map(u=>{let f=p+u.name,w=e.current===u.name,b=`gp-branch-row${n===f?" gp-branch-row--active":""}${w?" gp-branch-row--current":""}`;return(0,d.createElement)("div",{key:u.name,className:b,title:u.name,onClick:()=>a.onFilter(n===f?null:f)},[(0,d.createElement)("span",{key:"i",style:{display:"inline-flex",width:14}},c),(0,d.createElement)("span",{key:"n",className:"gp-tree-name"},u.name),u.ahead||u.behind?(0,d.createElement)("span",{key:"t",className:"gp-branch-row__track"},`${u.ahead?`\u2191${u.ahead}`:""}${u.behind?`\u2193${u.behind}`:""}`):null])})]);return(0,d.createElement)("div",{},[(0,d.createElement)("div",{key:"head-row",className:"gp-branch-row",style:{fontWeight:600,paddingLeft:10},onClick:()=>a.onFilter(null)},a.t("overview.head")),i("local","overview.local",e.local,(0,d.createElement)(fn,{size:13})),i("remote","overview.remote",e.remote,(0,d.createElement)(fn,{size:13})),i("tags","overview.tags",e.tags,(0,d.createElement)(Ve,{size:13}))])}function Qa(e,t,n,r,a){if(typeof document>"u")return null;let i=(0,d.createElement)("div",{className:"gp-sheet-backdrop",onClick:o=>{o.target===o.currentTarget&&a.onClose()}},(0,d.createElement)("div",{className:"gp-sheet",role:"dialog","aria-modal":!0},[(0,d.createElement)("div",{key:"bar",className:"gp-sheet__bar"},[(0,d.createElement)("span",{key:"title",className:"gp-sheet__title"},a.t("overview.filterBranch")),(0,d.createElement)("button",{key:"close",type:"button",className:"gp-icon-btn gp-sheet__close",title:a.t("common.close"),onClick:a.onClose},(0,d.createElement)(Oe,{size:15}))]),(0,d.createElement)("div",{key:"body",className:"gp-sheet__body"},Kr(e,t,n,r,a))]));return(0,Vt.createPortal)(i,document.body,"branch-filter-sheet")}function Ya(e,t){let n=e.commit,r=n.refs.map(i=>(0,d.createElement)("span",{key:i.name,className:`gp-ref-chip${i.head?" gp-ref-chip--head":""}${i.kind==="remote"?" gp-ref-chip--remote":""}${i.kind==="tag"?" gp-ref-chip--tag":""}`},i.name)),a=(0,d.createElement)("div",{key:"g",className:"gp-graph-cell"},t.searching?null:Za(e,t.laneCount,t.rowH));return t.compact?(0,d.createElement)("div",{key:n.hash,className:`gp-commit-row gp-commit-row--compact${t.selected?" gp-commit-row--active":""}`,style:{gridTemplateColumns:t.gridTpl,height:`${t.rowH}px`},onClick:t.onSelect},[a,(0,d.createElement)("div",{key:"tx",className:"gp-commit-lines"},[(0,d.createElement)("div",{key:"s",className:"gp-commit-subject"},[...r,n.subject]),(0,d.createElement)("div",{key:"m",className:"gp-commit-sub"},[(0,d.createElement)("span",{key:"h",className:"gp-commit-hash"},n.shortHash),(0,d.createElement)("span",{key:"a",className:"gp-commit-author"},n.author),(0,d.createElement)("span",{key:"d",className:"gp-commit-date"},We(n.dateIso,t.now,t.t))])])]):(0,d.createElement)("div",{key:n.hash,className:`gp-commit-row${t.selected?" gp-commit-row--active":""}`,style:{gridTemplateColumns:t.gridTpl},onClick:t.onSelect,onMouseEnter:i=>t.onHoverEnter(n,i.clientX,i.clientY),onMouseLeave:t.onHoverLeave},[a,(0,d.createElement)("div",{key:"s",className:"gp-commit-subject"},[...r,n.subject]),(0,d.createElement)("div",{key:"h",className:"gp-commit-hash"},n.shortHash),(0,d.createElement)("div",{key:"a",className:"gp-commit-author"},n.author),(0,d.createElement)("div",{key:"d",className:"gp-commit-date",title:gt(n.dateIso)},We(n.dateIso,t.now,t.t))])}var Kt=["#4e9bff","#3fb950","#e0982e","#d05ce3","#e5534b","#2dc6c6","#d29922","#8b949e"];function Za(e,t,n=Xr){let r=Math.max(Ze,t*Ze),a=s=>s*Ze+Ze/2,i=n/2,o=[];for(let s of e.edges){let l=Kt[s.color%Kt.length],c=s.kind==="out"?i:0,p=s.kind==="into"?i:n,u=(c+p)/2;o.push((0,d.createElement)("path",{key:`e${s.kind}-${s.fromLane}-${s.toLane}-${s.color}`,d:`M ${a(s.fromLane)} ${c} C ${a(s.fromLane)} ${u}, ${a(s.toLane)} ${u}, ${a(s.toLane)} ${p}`,stroke:l,strokeWidth:1.6,fill:"none"}))}return o.push((0,d.createElement)("circle",{key:"node",cx:a(e.lane),cy:i,r:e.merge?4:3.2,fill:Kt[e.color%Kt.length],stroke:"var(--dsw-alias-bg-layer-1)",strokeWidth:1})),(0,d.createElement)("svg",{className:"gp-graph-svg",width:r,height:n},o)}function ei(e,t){let n=[],r=(a,i)=>{for(let o of a)if(o.dir)n.push((0,d.createElement)("div",{key:o.path,className:"gp-tree-row",style:{paddingLeft:10+i*14}},[(0,d.createElement)(Pe,{key:"c",size:11,open:!0}),(0,d.createElement)("span",{key:"n",className:"gp-tree-name"},o.name)])),r(o.children,i+1);else{let s=String(o.meta??"modified"),l=t.activePath===o.path;n.push((0,d.createElement)("div",{key:o.path,className:`gp-tree-row${l?" gp-tree-row--active":""}`,style:{paddingLeft:10+i*14},title:t.openTitle,onClick:()=>t.onOpen(o.path)},[(0,d.createElement)("span",{key:"st",className:`gp-status-badge ${Gt(s)}`},(Rt[s]??s[0]??"M").toUpperCase()),(0,d.createElement)("span",{key:"n",className:"gp-tree-name"},o.name)]))}};return r(e,0),(0,d.createElement)("div",{},n)}function ti(e,t){if(e===null||typeof document>"u")return null;let{text:n,error:r,mode:a,onMode:i,expanded:o,onExpand:s,onClose:l,remote:c,sessionId:p,compact:u,t:f}=t,w=u?["unified","before","after"]:["unified","split","before","after"],b=u&&a==="split"?"unified":a,k=(0,d.createElement)("div",{className:"gp-modal-backdrop",onClick:_=>{_.target===_.currentTarget&&l()}},(0,d.createElement)("div",{className:"gp-modal",role:"dialog","aria-modal":!0},[(0,d.createElement)("div",{key:"bar",className:"gp-modal__bar"},[(0,d.createElement)("span",{key:"fileicon",className:"gp-modal__fileicon"},(0,d.createElement)(ar,{size:15})),(0,d.createElement)("span",{key:"path",className:"gp-modal__path",title:e.path},ni(e.path)),(0,d.createElement)("span",{key:"hash",className:"gp-modal__hash"},e.shortHash),n!==null&&n!==""?(()=>{let _=Xt(n);return(0,d.createElement)("span",{key:"sum",className:"gp-modal__sum"},[(0,d.createElement)("span",{key:"a",className:"gp-stats__add"},`+${_.add}`),(0,d.createElement)("span",{key:"d",className:"gp-stats__del"},`\u2212${_.del}`)])})():null,(0,d.createElement)("button",{key:"expand",type:"button",className:`gp-seg__btn gp-diff__expand${o?" gp-seg__btn--active":""}`,disabled:b!=="split"&&b!=="unified",title:f(o?"diff.collapse":"diff.expandAll"),onClick:()=>s(!o)},f(o?"diff.collapse":"diff.expandAll")),(0,d.createElement)("div",{key:"seg",className:"gp-seg"},ze(w,b,i,_=>f(`diff.${_}`))),(0,d.createElement)("button",{key:"close",type:"button",className:"gp-icon-btn gp-modal__close",title:f("common.close"),onClick:l},(0,d.createElement)(Oe,{size:15}))]),(0,d.createElement)("div",{key:"scroll",className:"gp-modal__scroll"},n===null?(0,d.createElement)("div",{className:"gp-empty"},f(r?"overview.diffFailed":"common.loading")):(0,d.createElement)(Bt,{text:n,mode:b,path:e.path,remote:c,sessionId:p,imageSpec:{base:"commit",commit:e.hash},t:f}))]));return(0,Vt.createPortal)(k,document.body,"file-diff-modal")}function ni(e){let t=e.lastIndexOf("/");return t<0?[(0,d.createElement)("span",{key:"n",className:"gp-modal__name"},e)]:[(0,d.createElement)("span",{key:"d",className:"gp-modal__dir"},e.slice(0,t+1)),(0,d.createElement)("span",{key:"n",className:"gp-modal__name"},e.slice(t+1))]}var g=require("react");var be=require("react");function Vr({stats:e,t}){let n=Date.now(),r=[(0,be.createElement)("span",{key:"files",className:"gp-stats__item"},t("stats.files",{n:e.fileCount})),(0,be.createElement)("span",{key:"lines",className:"gp-stats__item"},[(0,be.createElement)("span",{key:"a",className:"gp-stats__add"},`+${e.insertions}`)," ",(0,be.createElement)("span",{key:"d",className:"gp-stats__del"},`\u2212${e.deletions}`)])];e.staged>0&&r.push((0,be.createElement)("span",{key:"st",className:"gp-stats__item"},t("stats.staged",{n:e.staged}))),e.modified>0&&r.push((0,be.createElement)("span",{key:"mo",className:"gp-stats__item"},t("stats.modified",{n:e.modified}))),e.untracked>0&&r.push((0,be.createElement)("span",{key:"un",className:"gp-stats__item"},t("stats.untracked",{n:e.untracked}))),e.partial&&r.push((0,be.createElement)("span",{key:"partial",className:"gp-stats__item gp-stats__partial",title:t("stats.partialHint")},t("stats.partial")));let a=[];return e.lastChangeAt!==null&&a.push((0,be.createElement)("span",{key:"lc",className:"gp-stats__item",title:gt(e.lastChangeAt)},t("stats.lastChange",{time:We(e.lastChangeAt,n,t)}))),e.headCommittedAt!==null&&a.push((0,be.createElement)("span",{key:"hc",className:"gp-stats__item",title:gt(e.headCommittedAt)},t("stats.lastCommit",{time:We(e.headCommittedAt,n,t)}))),a.length>0&&r.push((0,be.createElement)("span",{key:"times",className:"gp-stats__times"},a)),(0,be.createElement)("div",{className:"gp-stats"},r)}function Ot(e){let t=new Array(e.length+1);t[0]=0;for(let n=0;n<e.length;n++)t[n+1]=t[n]+e[n];return t}function Or(e,t){let n=0,r=e.length-1;for(;n<r;){let a=n+r+1>>1;e[a]<=t?n=a:r=a-1}return n}function qt(e,t,n,r){let a=e.length-1;if(a<=0)return{first:0,last:0};let i=Or(e,t-r),o=Math.min(a,Or(e,t+n+r)+1);return{first:i,last:o}}var $e=require("react");function Wt(){let[e,t]=(0,$e.useState)({top:0,height:0}),n=(0,$e.useRef)(null),r=(0,$e.useRef)(null);return{setEl:(0,$e.useCallback)(i=>{if(r.current!==null&&(r.current(),r.current=null),n.current=i,i===null)return;let o=()=>t(l=>{let c=i.scrollTop,p=i.clientHeight;return l.top===c&&l.height===p?l:{top:c,height:p}});o(),i.addEventListener("scroll",o,{passive:!0});let s=typeof ResizeObserver<"u"?new ResizeObserver(o):null;s?.observe(i),r.current=()=>{i.removeEventListener("scroll",o),s?.disconnect()}},[]),viewport:e,elRef:n}}var Sn=28,qr=26,ri=8,ai=600;function Wr({remote:e,sessionId:t,snapshot:n,onAction:r,compact:a,t:i}){let[o,s]=(0,g.useState)(new Set),[l,c]=(0,g.useState)(""),[p,u]=(0,g.useState)(!1),[f,w]=(0,g.useState)(!1),[b,k]=(0,g.useState)(null),[_,N]=(0,g.useState)(new Set),[A,J]=(0,g.useState)(null),[M,v]=(0,g.useState)(null),[L,P]=(0,g.useState)(null),[W,S]=(0,g.useState)(()=>n.defaultDiffView),[$,oe]=(0,g.useState)(!1),[ee,ce]=(0,g.useState)(!1),[ne,z]=(0,g.useState)(!1),[te,T]=(0,g.useState)(!1),[pe,H]=(0,g.useState)(null),[C,I]=(0,g.useState)("list"),[B,U]=(0,g.useState)([]),[ge,D]=(0,g.useState)(!0),[re,me]=(0,g.useState)(!1),[ve,Y]=(0,g.useState)(null),Q=(0,g.useRef)(null),he=(0,g.useRef)(0),{setEl:en,viewport:Ae}=Wt(),Re=(0,g.useCallback)(async()=>{let y=await e.query({sessionId:t,query:{kind:"stash-list"}}),G=de(y,"stash-list");U(G?.entries??[])},[e,t]);(0,g.useEffect)(()=>{Re()},[Re,n.checkedAt]);let Ie=(0,g.useMemo)(()=>n.changes.filter(y=>y.staged).sort(Cn),[n]),ht=(0,g.useMemo)(()=>n.changes.filter(y=>!y.staged&&y.status!=="untracked").sort(Cn),[n]),tt=(0,g.useMemo)(()=>n.changes.filter(y=>y.status==="untracked").sort(Cn),[n]),Le=[{key:"staged",labelKey:"changes.groupStaged",items:Ie},{key:"unstaged",labelKey:"changes.groupUnstaged",items:ht},{key:"untracked",labelKey:"changes.groupUntracked",items:tt}].filter(y=>y.items.length>0),{items:yt,tops:Xe,totalH:tn}=(0,g.useMemo)(()=>{let y=[];for(let V of Le)if(y.push({kind:"head",g:{key:V.key,labelKey:V.labelKey,count:V.items.length}}),!_.has(V.key))for(let se of V.items)y.push({kind:"row",c:se});let G=Ot(y.map(V=>V.kind==="head"?qr:Sn));return{items:y,tops:G,totalH:G[y.length]}},[Ie,ht,tt,_]),Se=Ae.height>0?Ae.height:ai,{first:K,last:Ce}=qt(Xe,Ae.top,Se,ri*Sn);(0,g.useEffect)(()=>{s(y=>{if(y.size===0)return y;let G=new Set(n.changes.map(fe=>fe.path+(fe.staged?":s":":w"))),V=new Set,se=!1;for(let fe of y)G.has(fe)?V.add(fe):se=!0;return se?V:y})},[n]),(0,g.useEffect)(()=>{if(!p||ee||l.trim()!=="")return;let y=!0;return e.query({sessionId:t,query:{kind:"last-commit-message"}}).then(G=>{let V=de(G,"last-commit-message");y&&V!==null&&(c(V.message),ce(!0))}),()=>{y=!1}},[p,ee,l,e,t]);let nt=(0,g.useCallback)(async(y,G,V=!1,se=!1)=>{let fe=++he.current;v({path:y,base:G}),se||P(null),oe(V);let Te=await e.query({sessionId:t,query:{kind:"diff",path:y,base:G,...V?{context:1e5}:{}}});if(fe!==he.current)return;let xt=de(Te,"diff");P(xt!==null?xt.text:"")},[e,t]);(0,g.useEffect)(()=>{if(M===null)return;if(!n.changes.some(G=>G.path===M.path)){v(null),P(null),I("list");return}nt(M.path,M.base,$,!0)},[n]),(0,g.useEffect)(()=>{J(null)},[n]),(0,g.useEffect)(()=>{T(!1)},[n]);let nn=y=>{s(G=>{let V=new Set(G);return V.has(y)?V.delete(y):V.add(y),V})},we=async y=>{if(f)return!1;w(!0),k(null),H(null);try{let G=await r(y);return G.ok?!0:(k(G.error??i("error.generic")),!1)}catch(G){return k(G instanceof Error?G.message:i("error.generic")),!1}finally{w(!1)}},bt=async()=>{let y=l.trim();if(y===""&&!p){k(i("error.emptyMessage"));return}let G=o.size>0?[...new Set([...o].map(se=>se.replace(/:[sw]$/,"")))]:void 0;await we({kind:"commit",message:y,...G?{paths:G}:{},...p?{amend:!0}:{}})&&(c(""),s(new Set),u(!1),ce(!1))},rn=async y=>{await we({kind:"stash-push",...y.trim()!==""?{message:y}:{}})&&(me(!1),Re())},Ge=(y,G)=>{we({kind:"stash-apply",index:y,sha:G}).then(V=>{V&&Re()})},rt=(y,G)=>{we({kind:"stash-pop",index:y,sha:G}).then(V=>{V&&Re()})},vt=async(y,G)=>{await we({kind:"stash-drop",index:y,sha:G})&&(Y(null),Re())},at=(y,G)=>{switch(y){case"empty-diff":return i("error.emptyDiff");case"llm-unavailable":return i("error.llmUnavailable");case"suggest-disabled":return i("error.suggestDisabled");case"llm-error":case"llm-output":return G===void 0?i("error.llmFailed"):`${i("error.llmFailed")}: ${G}`;default:return G??i("error.generic")}},an=async()=>{if(ne)return;if(p&&!te&&l.trim()!==""){T(!0),k(null),H(i("commit.suggestOverwrite"));return}T(!1);let y=o.size>0?[...new Set([...o].map(G=>G.replace(/:[sw]$/,"")))]:void 0;z(!0),k(null),H(null);try{let G=await e.suggest({sessionId:t,...y&&y.length>0?{paths:y}:{}});G.ok?(c(G.value.message),G.value.truncated===!0&&H(i("commit.suggestTruncated")),Q.current?.focus()):k(at(G.error.code,G.error.message))}catch(G){k(G instanceof Error?G.message:i("error.generic"))}finally{z(!1)}},on=y=>{N(G=>{let V=new Set(G);return V.has(y)?V.delete(y):V.add(y),V})},Je=L!==null&&L!==""?Xt(L):null,wt=Fe({storageKey:"gp.changes.left",initial:380,min:220,reserve:200,edge:"end"}),sn=(y,G)=>{nt(y,G),a&&I("diff")},ln=a?["unified","before","after"]:["unified","split","before","after"],j=a&&W==="split"?"unified":W,it=[(0,g.createElement)(Vr,{key:"stats",stats:n.stats,t:i}),(0,g.createElement)("div",{key:"toolbar",className:"gp-toolbar"},[(0,g.createElement)("button",{key:"sa",type:"button",className:"gp-btn",disabled:f||n.changes.length===0,onClick:()=>void we({kind:"stage-all"})},i("changes.stageAll")),(0,g.createElement)("button",{key:"ua",type:"button",className:"gp-btn",disabled:f||n.staged===0,onClick:()=>void we({kind:"unstage-all"})},i("changes.unstageAll")),(0,g.createElement)("button",{key:"stash",type:"button",className:"gp-btn",disabled:f||n.staged===0&&n.modified===0,title:i("changes.stash"),onClick:()=>{k(null),me(!0)}},[(0,g.createElement)(mn,{key:"ic",size:13}),i("changes.stash")])]),b!==null?(0,g.createElement)("div",{key:"err",className:"gp-feedback"},b):null,pe!==null?(0,g.createElement)("div",{key:"notice",className:"gp-notice"},pe):null,(0,g.createElement)("div",{key:"list",className:"gp-changes__list",ref:en},n.changes.length===0?(0,g.createElement)("div",{className:"gp-empty"},i("changes.noChanges")):(0,g.createElement)("div",{className:"gp-changes__vlist",style:{height:tn}},yt.slice(K,Ce).map((y,G)=>{let V=K+G;if(y.kind==="head"){let Te=y.g;return(0,g.createElement)("div",{key:`h:${Te.key}`,className:"gp-changes__vrow",style:{top:Xe[V],height:qr}},(0,g.createElement)("div",{className:"gp-group-head",onClick:()=>on(Te.key)},[(0,g.createElement)(Pe,{key:"chev",size:12,open:!_.has(Te.key)}),`${i(Te.labelKey)} (${Te.count})`]))}let se=y.c,fe=se.path+(se.staged?":s":":w");return(0,g.createElement)("div",{key:fe,className:"gp-changes__vrow",style:{top:Xe[V],height:Sn}},si(se,{selected:o.has(fe),active:M?.path===se.path&&M.base===(se.staged?"staged":"worktree"),busy:f,armed:A===fe,onToggle:()=>nn(fe),onOpen:()=>sn(se.path,se.staged?"staged":"worktree"),onStage:()=>void we(se.staged?{kind:"unstage",paths:[se.path]}:{kind:"stage",paths:[se.path]}),onDiscard:()=>{A===fe?(we({kind:"discard",paths:[se.path]}),J(null)):J(fe)},t:i}))}))),B.length>0?(0,g.createElement)("div",{key:"stashes",className:"gp-stash"},[(0,g.createElement)("div",{key:"head",className:"gp-group-head",onClick:()=>D(y=>!y)},[(0,g.createElement)(Pe,{key:"chev",size:12,open:!ge}),`${i("stash.section")} (${B.length})`]),ge?null:(0,g.createElement)("div",{key:"items"},B.map(y=>oi(y,{busy:f,onApply:()=>Ge(y.index,y.sha),onPop:()=>rt(y.index,y.sha),onDrop:()=>{k(null),Y(y)},t:i})))]):null,(0,g.createElement)("div",{key:"box",className:"gp-commitbox"},[(0,g.createElement)("textarea",{key:"msg",className:"gp-commitbox__msg",placeholder:i("commit.placeholder"),value:l,ref:Q,onChange:y=>c(y.target.value)}),(0,g.createElement)("div",{key:"row",className:"gp-commitbox__row"},[(0,g.createElement)("label",{key:"amend",className:"gp-commitbox__amend"},[(0,g.createElement)("input",{key:"cb",type:"checkbox",className:"gp-check",checked:p,onChange:()=>{u(y=>!y),ce(!1)}}),i("commit.amend")]),(0,g.createElement)("div",{key:"actions",className:"gp-commitbox__actions"},[n.suggestEnabled!==!1?(0,g.createElement)("button",{key:"suggest",type:"button",className:"gp-btn",disabled:f||ne||n.changes.length===0,onClick:()=>void an(),title:i("commit.suggest")},[(0,g.createElement)(rr,{key:"ic",size:13}),i(ne?"commit.suggesting":"commit.suggest")]):null,(0,g.createElement)("button",{key:"commit",type:"button",className:"gp-btn gp-btn--primary",disabled:f||ne||l.trim()==="",onClick:()=>void bt()},i("commit.commit"))])])])],ot=M===null?(0,g.createElement)("div",{className:"gp-empty"},i("changes.selectFile")):(0,g.createElement)("div",{className:"gp-diff"},[(0,g.createElement)("div",{key:"tb",className:"gp-diff__toolbar"},[a?(0,g.createElement)("button",{key:"back",type:"button",className:"gp-subhead__back",onClick:()=>I("list")},[(0,g.createElement)(qe,{key:"i",size:14}),i("changes.backToList")]):null,(0,g.createElement)("span",{key:"path",className:"gp-diff__path"},M.path),Je?(0,g.createElement)("span",{key:"sum",className:"gp-stats__item",style:{marginLeft:"auto"}},[(0,g.createElement)("span",{key:"a",className:"gp-stats__add"},`+${Je.add}`)," ",(0,g.createElement)("span",{key:"d",className:"gp-stats__del"},`\u2212${Je.del}`)]):null,(0,g.createElement)("button",{key:"expand",type:"button",className:`gp-seg__btn gp-diff__expand${$?" gp-seg__btn--active":""}`,style:Je?{}:{marginLeft:"auto"},disabled:j!=="split"&&j!=="unified",title:i($?"diff.collapse":"diff.expandAll"),onClick:()=>void nt(M.path,M.base,!$)},i($?"diff.collapse":"diff.expandAll")),(0,g.createElement)("div",{key:"seg",className:"gp-seg"},ze(ln,j,S,y=>i(`diff.${y}`)))]),(0,g.createElement)("div",{key:"scroll",className:"gp-diff__scroll"},L===null?(0,g.createElement)("div",{className:"gp-empty"},i("common.loading")):(0,g.createElement)(Bt,{text:L,mode:j,path:M.path,remote:e,sessionId:t,imageSpec:{base:M.base},t:i}))]),st=[re?(0,g.createElement)(ii,{key:"push",onClose:()=>me(!1),onStash:rn,error:b,t:i}):null,ve!==null?De({title:i("stash.dropTitle"),body:i("stash.dropConfirm",{name:ve.message}),confirmLabel:i("stash.drop"),danger:!0,error:b,onConfirm:()=>void vt(ve.index,ve.sha),onClose:()=>Y(null),t:i}):null];return a?(0,g.createElement)("div",{className:"gp-changes gp-changes--compact"},[...st,C==="diff"?(0,g.createElement)("div",{key:"right",className:"gp-changes__right"},ot):(0,g.createElement)("div",{key:"left",className:"gp-changes__left"},it)]):(0,g.createElement)("div",{className:"gp-changes"},[...st,(0,g.createElement)("div",{key:"left",className:"gp-changes__left",style:{flex:`0 0 ${wt.width}px`}},it),wt.divider,(0,g.createElement)("div",{key:"right",className:"gp-changes__right"},ot)])}function ii({onClose:e,onStash:t,error:n,t:r}){let[a,i]=(0,g.useState)("");return Ye({onClose:e,title:r("stash.title"),icon:(0,g.createElement)(mn,{size:15}),portalKey:"stash-push-modal",t:r,body:[(0,g.createElement)("input",{key:"msg",className:"gp-input",placeholder:r("stash.messagePlaceholder"),value:a,autoFocus:!0,onChange:o=>i(o.target.value),onKeyDown:o=>{o.key==="Enter"&&t(a)}}),Ue(r),n!==null?(0,g.createElement)("div",{key:"err",className:"gp-feedback"},n):null],footer:Qe({onClose:e,onConfirm:()=>void t(a),confirmLabel:r("stash.save"),confirmDisabled:!1,danger:!1,t:r})})}function oi(e,t){return(0,g.createElement)("div",{key:e.index,className:"gp-stash-row"},[(0,g.createElement)("div",{key:"info",className:"gp-stash-row__info"},[(0,g.createElement)("span",{key:"m",className:"gp-stash-row__msg",title:e.message},e.message),(0,g.createElement)("span",{key:"meta",className:"gp-stash-row__meta"},[e.branch!==null?(0,g.createElement)("span",{key:"b"},t.t("stash.onBranch",{branch:e.branch})):null,e.relTime!==""?(0,g.createElement)("span",{key:"t"},e.relTime):null])]),(0,g.createElement)("div",{key:"act",className:"gp-stash-row__actions"},[(0,g.createElement)("button",{key:"apply",type:"button",className:"gp-btn gp-btn--sm",disabled:t.busy,onClick:t.onApply},t.t("stash.apply")),(0,g.createElement)("button",{key:"pop",type:"button",className:"gp-btn gp-btn--sm",disabled:t.busy,onClick:t.onPop},t.t("stash.pop")),(0,g.createElement)("button",{key:"drop",type:"button",className:"gp-icon-btn",disabled:t.busy,title:t.t("stash.drop"),onClick:t.onDrop},(0,g.createElement)(ir,{size:14}))])])}function Cn(e,t){return e.path.localeCompare(t.path)}function si(e,t){let n=e.path.split("/").pop()??e.path,r=e.path.includes("/")?e.path.slice(0,e.path.lastIndexOf("/")):"";return(0,g.createElement)("div",{key:e.path+(e.staged?":s":":w"),className:`gp-file-row${t.active?" gp-file-row--active":""}`,onClick:t.onOpen},[(0,g.createElement)("input",{key:"cb",type:"checkbox",className:"gp-check",checked:t.selected,onClick:a=>a.stopPropagation(),onChange:t.onToggle}),(0,g.createElement)("span",{key:"st",className:`gp-status-badge ${Gt(e.status)}`},Rt[e.status]??"?"),(0,g.createElement)("span",{key:"nm",className:"gp-tree-name",title:e.path},[n,r?(0,g.createElement)("span",{key:"d",style:{color:"var(--dsw-alias-label-tertiary)",marginLeft:6,fontSize:11}},r):null]),(0,g.createElement)("span",{key:"act",className:"gp-file-row__actions"},[(0,g.createElement)("button",{key:"stg",type:"button",className:"gp-icon-btn",title:e.staged?t.t("changes.unstage"):t.t("changes.stage"),disabled:t.busy,onClick:a=>{a.stopPropagation(),t.onStage()}},e.staged?"\u2212":"+"),(0,g.createElement)("button",{key:"dis",type:"button",className:"gp-icon-btn",title:t.armed?t.t("changes.discardConfirm"):t.t("changes.discard"),style:t.armed?{color:"var(--dsw-alias-state-error-primary)"}:{},disabled:t.busy,onClick:a=>{a.stopPropagation(),t.onDiscard()}},"\u21BA")])])}var m=require("react");var Ee=require("@deepseek-ai/dsh-client-ui-primitives");function Ur(e){return/\.(?:md|markdown)$/i.test(e)}function En(e){return/\.(?:html?|xhtml)$/i.test(e)}function li(e){return Ur(e)||En(e)}var di=256*1024,ci=5e3,jr=5e3,jt=20,Tn=12,pi=600,ui=6e4,Nn=new Map;function gi(e,t){let n=t.file.kind==="loading"?{kind:"idle"}:t.file;Nn.set(e,{state:{...t,file:n},leftAt:Date.now()})}function fi(e){let t=Nn.get(e);return t===void 0?null:Date.now()-t.leftAt>ui?(Nn.delete(e),null):t.state}function Rn({remote:e,sessionId:t,compact:n,t:r}){let a=(0,m.useRef)(void 0);a.current===void 0&&(a.current=fi(t));let i=a.current,[o,s]=(0,m.useState)(()=>i?.dirs??new Map),[l,c]=(0,m.useState)(()=>i?.open??new Set([""])),[p,u]=(0,m.useState)(()=>i?.selected??null),[f,w]=(0,m.useState)(()=>i?.file??{kind:"idle"}),[b,k]=(0,m.useState)(()=>i?.renderMarkdown??!0),[_,N]=(0,m.useState)("idle"),[A,J]=(0,m.useState)("idle"),[M,v]=(0,m.useState)(()=>i?.pane??"tree"),L=(0,m.useMemo)(()=>({code:{copyLabel:r("files.copy"),copiedLabel:r("files.copied")},footnotes:r("files.footnotes")}),[r]),P=(0,m.useRef)(0),W=Fe({storageKey:"gp.files.left",initial:300,min:180,reserve:220,edge:"end"}),S=(0,m.useCallback)(H=>{s(C=>{let I=C.get(H);if(I!==void 0&&I.status!=="error")return C;let B=new Map(C);return B.set(H,{status:"loading"}),B}),e.query({sessionId:t,query:{kind:"dir-list",path:H}}).then(C=>{let I=de(C,"dir-list");s(B=>{let U=new Map(B);return U.set(H,I===null?{status:"error"}:{status:"ready",entries:I.entries,truncated:I.truncated}),U})}).catch(()=>{s(C=>{let I=new Map(C);return I.set(H,{status:"error"}),I})})},[e,t]);(0,m.useEffect)(()=>{S("")},[S]);let $=(0,m.useCallback)(H=>{c(C=>{let I=new Set(C);return I.has(H)?(I.delete(H),I):(I.add(H),o.get(H)===void 0&&S(H),I)})},[o,S]),oe=(0,m.useCallback)(H=>{u(H),n&&v("preview"),k(!En(H)),N("idle"),J("idle");let C=++P.current;w({kind:"loading",path:H}),e.query({sessionId:t,query:{kind:"file-content",path:H}}).then(I=>{if(C!==P.current)return;let B=de(I,"file-content");if(B===null){w({kind:"error",path:H});return}if(B.tooLarge===!0){w({kind:"tooLarge",path:H});return}if(B.variant==="image"&&B.dataUrl!==void 0){w({kind:"image",path:H,dataUrl:B.dataUrl});return}if(B.variant==="text"){w({kind:"text",path:H,content:B.content??"",lines:B.lines??0});return}w({kind:"binary",path:H})}).catch(()=>{C===P.current&&w({kind:"error",path:H})})},[e,t,n]),ee=(0,m.useRef)({dirs:o,open:l,selected:p,file:f,renderMarkdown:b,pane:M});ee.current={dirs:o,open:l,selected:p,file:f,renderMarkdown:b,pane:M},(0,m.useEffect)(()=>()=>{gi(t,ee.current)},[t]);let ce=(0,m.useRef)(!1);(0,m.useEffect)(()=>{ce.current||(ce.current=!0,i!==null&&i.selected!==null&&f.kind==="idle"&&oe(i.selected))},[i,f.kind,oe]);let ne=(0,m.useMemo)(()=>Qr("",0,{dirs:o,open:l,selected:p,toggleDir:$,selectFile:oe,t:r}),[o,l,p,$,oe,r]),z=async()=>{if(p===null)return;let H=P.current;try{await navigator.clipboard.writeText(p),H===P.current&&N("copied")}catch{H===P.current&&N("error")}},te=async()=>{if(f.kind!=="text")return;let H=P.current;try{await navigator.clipboard.writeText(f.content),H===P.current&&J("copied")}catch{H===P.current&&J("error")}},T=(0,m.createElement)("div",{key:"left",className:"gp-files__tree",style:n?void 0:{flex:`0 0 ${W.width}px`}},ne),pe=(0,m.createElement)("div",{key:"right",className:"gp-files__preview"},[p!==null?(0,m.createElement)("div",{key:"bar",className:"gp-files__bar"},[n?(0,m.createElement)("button",{key:"back",type:"button",className:"gp-subhead__back",onClick:()=>v("tree")},[(0,m.createElement)(qe,{key:"i",size:14}),r("files.backToTree")]):null,(0,m.createElement)("code",{key:"path",className:"gp-files__path",title:p},p),f.kind==="text"&&li(f.path)?(0,m.createElement)("div",{key:"mode",className:"gp-files__mode",role:"group","aria-label":r("files.previewMode")},[(0,m.createElement)("button",{key:"source",type:"button",className:`gp-files__mode-btn${b?"":" gp-files__mode-btn--active"}`,"aria-pressed":!b,onClick:()=>k(!1)},r("files.source")),(0,m.createElement)("button",{key:"render",type:"button",className:`gp-files__mode-btn${b?" gp-files__mode-btn--active":""}`,"aria-pressed":b,onClick:()=>k(!0)},r("files.render"))]):null,(0,m.createElement)("button",{key:"copy",type:"button",className:`gp-files__copy-path${_==="error"?" gp-files__copy-path--error":""}`,"aria-live":"polite",onClick:()=>{z()}},r(_==="copied"?"files.pathCopied":_==="error"?"files.pathCopyFailed":"files.copyPath")),f.kind==="text"?(0,m.createElement)("button",{key:"copy-content",type:"button",className:`gp-files__copy-path${A==="error"?" gp-files__copy-path--error":""}`,"aria-live":"polite",onClick:()=>{te()}},r(A==="copied"?"files.contentCopied":A==="error"?"files.contentCopyFailed":"files.copyContent")):null]):null,(0,m.createElement)("div",{key:"content",className:"gp-files__preview-content"},mi(f,b,L,r))]);return n?(0,m.createElement)("div",{className:"gp-files gp-files--compact"},M==="preview"?pe:T):(0,m.createElement)("div",{className:"gp-files"},[T,W.divider,pe])}function mi(e,t,n,r){return e.kind==="text"&&t&&Ur(e.path)?(0,m.createElement)("div",{className:"gp-files__markdown"},(0,m.createElement)(Ee.MarkdownText,{text:e.content,labels:n,variant:"body"})):e.kind==="text"&&t&&En(e.path)?(0,m.createElement)("iframe",{className:"gp-files__html",title:e.path,srcDoc:e.content,sandbox:"allow-scripts",referrerPolicy:"no-referrer"}):hi(e,r)}function Qr(e,t,n){let r=n.dirs.get(e);if(r===void 0||r.status==="loading")return t===0?[(0,m.createElement)("div",{key:"l",className:"gp-empty"},n.t("common.loading"))]:[(0,m.createElement)("div",{key:`l${e}`,className:"gp-tree-row gp-tree-row--muted",style:{paddingLeft:10+t*14}},n.t("common.loading"))];if(r.status==="error")return[(0,m.createElement)("div",{key:`e${e}`,className:"gp-tree-row gp-tree-row--muted",style:{paddingLeft:10+t*14}},n.t("files.loadFailed"))];let a=[];for(let i of r.entries){let o=e===""?i.name:`${e}/${i.name}`;if(i.dir){let s=n.open.has(o);a.push((0,m.createElement)("button",{key:o,type:"button",className:`gp-tree-row gp-files__entry gp-files__entry--dir${i.ignored?" gp-tree-row--ignored":""}`,style:{paddingLeft:10+t*14},"aria-expanded":s,"aria-label":i.ignored?`${i.name} (${n.t("files.ignored")})`:i.name,onClick:()=>n.toggleDir(o)},[(0,m.createElement)("span",{key:"c",className:"gp-tree-chev"},(0,m.createElement)(Pe,{size:11,open:s})),(0,m.createElement)("span",{key:"i",className:"gp-tree-ic"},(0,m.createElement)(Ee.FileTypeIcon,{kind:"folder",size:18})),(0,m.createElement)("span",{key:"n",className:"gp-tree-name"},i.name)])),s&&a.push(...Qr(o,t+1,n))}else{let s=n.selected===o;a.push((0,m.createElement)("button",{key:o,type:"button",className:`gp-tree-row gp-files__entry${s?" gp-tree-row--active":""}${i.ignored?" gp-tree-row--ignored":""}`,style:{paddingLeft:10+t*14},"aria-current":s?"true":void 0,"aria-label":i.ignored?`${i.name} (${n.t("files.ignored")})`:i.name,onClick:()=>n.selectFile(o)},[(0,m.createElement)("span",{key:"c",className:"gp-tree-chev"}),(0,m.createElement)("span",{key:"i",className:"gp-tree-ic"},(0,m.createElement)(Ee.FileTypeIcon,{path:o,size:18})),(0,m.createElement)("span",{key:"n",className:"gp-tree-name"},i.name)]))}}return r.truncated&&a.push((0,m.createElement)("div",{key:`t${e}`,className:"gp-tree-row gp-tree-row--muted",style:{paddingLeft:10+t*14}},n.t("files.truncated"))),a}function hi(e,t){switch(e.kind){case"idle":return(0,m.createElement)("div",{className:"gp-empty"},t("files.selectFile"));case"loading":return(0,m.createElement)("div",{className:"gp-empty"},t("common.loading"));case"error":return(0,m.createElement)("div",{className:"gp-empty"},t("files.loadFailed"));case"tooLarge":return(0,m.createElement)("div",{className:"gp-empty"},t("files.tooLarge"));case"binary":return(0,m.createElement)("div",{className:"gp-empty"},t("files.binary"));case"image":return(0,m.createElement)("div",{className:"gp-files__image"},(0,m.createElement)("img",{src:e.dataUrl,alt:e.path}));case"text":return(0,m.createElement)(bi,{content:e.content,path:e.path,t})}}function yi(e,t){if(t==="")return[];let n=[];for(let r=0;r<e.length;r++)for(let[a,i]of At(e[r],t))if(n.push({line:r,start:a,end:i}),n.length>=Mt)return n;return n}function bi({content:e,path:t,t:n}){let r=(0,m.useMemo)(()=>{let D=e.split(`
539
- `);return D.length>0&&D[D.length-1]===""&&D.pop(),D},[e]),a=e.length>di||r.length>ci,i=a?void 0:(0,Ee.languageForPath)(t),o=(0,Ee.useCodeHighlighter)(i),s=(0,m.useMemo)(()=>a?void 0:o(r.join(`
540
- `)),[a,o,r]),[l,c]=(0,m.useState)(!1),[p,u]=(0,m.useState)(""),[f,w]=(0,m.useState)(!1),[b,k]=(0,m.useState)(0),{setEl:_,viewport:N,elRef:A}=Wt(),J=(0,m.useRef)(null),M=(0,m.useRef)(null);(0,m.useEffect)(()=>{c(!1),u(""),k(0)},[t]);let v=Dt(p,Pt),L=(0,m.useMemo)(()=>r.map(D=>D.toLowerCase()),[r]),P=f?v:v.toLowerCase(),W=f?r:L,S=(0,m.useMemo)(()=>yi(W,P),[W,P]);(0,m.useEffect)(()=>{k(0)},[P]);let $=S.length===0?0:Math.min(b,S.length-1),oe=(0,m.useMemo)(()=>{let D=new Map;for(let re of S){let me=D.get(re.line)??[];me.push([re.start,re.end]),D.set(re.line,me)}return D},[S]);(0,m.useEffect)(()=>{let D=re=>{if(!((re.ctrlKey||re.metaKey)&&(re.key==="f"||re.key==="F")))return;let me=A.current;me===null||me.offsetParent===null||(re.preventDefault(),c(!0),requestAnimationFrame(()=>J.current?.select()))};return document.addEventListener("keydown",D),()=>document.removeEventListener("keydown",D)},[]);let ee=r.length,ce=(0,m.useMemo)(()=>Ot(new Array(ee).fill(jt)),[ee]),ne=N.height>0?N.height:pi,{first:z,last:te}=qt(ce,N.top,ne,Tn*jt),T=S.length>0?S[$].line:-1,pe=T>=0?Math.min(z,Math.max(0,T-Tn)):z,H=T>=0?Math.max(te,Math.min(ee,T+Tn)):te;(0,m.useEffect)(()=>{if(T<0)return;let D=requestAnimationFrame(()=>M.current?.scrollIntoView({block:"center",inline:"nearest"}));return()=>cancelAnimationFrame(D)},[$,S,T]);let C=(0,m.useCallback)(D=>{k(re=>S.length===0?0:(re+D+S.length)%S.length)},[S.length]),I=S.length>0?S[$]:null,B=l?(0,m.createElement)(Ht,{inputRef:J,query:p,matches:S.length,active:$,caseSensitive:f,onChange:u,onToggleCase:()=>w(D=>!D),onStep:C,onClose:()=>c(!1),t:n}):null,U=a||l?(0,m.createElement)("div",{key:"hd",className:"gp-files__header"},[a?(0,m.createElement)("div",{key:"note",className:"gp-files__note"},n("files.highlightOff")):null,B]):null,ge=[];for(let D=pe;D<H;D++)ge.push((0,m.createElement)("div",{key:D,className:"gp-files__row",style:{top:D*jt}},[(0,m.createElement)("div",{key:"n",className:"gp-diff-no"},D+1),vi(r[D],D,s?.[D],oe.get(D),I,M,n)]));return(0,m.createElement)("div",{className:"gp-files__code gp-diff__scroll",ref:_},[U,(0,m.createElement)("div",{key:"grid",className:"gp-files__single gp-files__single--virt",style:{height:ee*jt}},ge)])}function vi(e,t,n,r,a,i,o){if(e==="")return(0,m.createElement)("div",{key:`c${t}`,className:"gp-diff-cell"},"\xA0");if(e.length>jr)return(0,m.createElement)("div",{key:`c${t}`,className:"gp-diff-cell"},[e.slice(0,jr),(0,m.createElement)("span",{key:"trunc",className:"gp-files__trunc"},o("files.lineTruncated"))]);if(r===void 0||r.length===0)return(0,m.createElement)("div",{key:`c${t}`,className:"gp-diff-cell"},n!==void 0?n.map((l,c)=>(0,m.createElement)("span",{key:c,style:l.style},l.text)):e);let s=a!==null&&a.line===t?[a.start,a.end]:null;return(0,m.createElement)("div",{key:`c${t}`,className:"gp-diff-cell"},Lt(e,r,n,`c${t}`,s,i))}var Ut=require("react"),wi=620;function Yr(e){let[t,n]=(0,Ut.useState)(!1);return(0,Ut.useLayoutEffect)(()=>{if(e===null||typeof ResizeObserver>"u")return;let r=()=>n(e.clientWidth>0&&e.clientWidth<=wi);r();let a=new ResizeObserver(r);return a.observe(e),()=>a.disconnect()},[e]),t}var Zr="gp.panel.fontDelta";function xi(){if(typeof localStorage>"u")return 0;let e=Number(localStorage.getItem(Zr));return e===-1||e===1?e:0}function ea({ctx:e,sessionId:t,t:n}){let[r,a]=(0,E.useState)(xi),[i,o]=(0,E.useState)(null),[s,l]=(0,E.useState)(null),c=Yr(s),p=Ct(t),u=lt(e),f=p.state==="error"&&p.error.code==="git-unavailable",w=p.state==="error"&&(p.error.code==="not-a-git-repo"||p.error.code==="git-unavailable"),b=f&&p.state==="error"&&p.error.isGitRepo===!0,k=w?"files":i!==null&&i.sessionId===t?i.tab:null,_=(0,E.useRef)({tabs:new Set});_.current.sessionId!==t&&(_.current={sessionId:t,tabs:new Set}),k!==null&&_.current.tabs.add(k);let N=_.current.tabs.has("files");(0,E.useEffect)(()=>{if(!Me(t))return;if(w){o(null);return}if(i?.sessionId===t)return;let S=Wn(t);if(S!==null){o({sessionId:t,tab:S});return}let $=Qn(t);if($!==null){o({sessionId:t,tab:$});return}p.state==="ready"&&o({sessionId:t,tab:p.snapshot.dirty?"changes":"overview"})},[t,p,w,i?.sessionId]),(0,E.useEffect)(()=>{if(Me(t))return jn(t,S=>o({sessionId:t,tab:S}))},[t]);let A=(0,E.useRef)({tab:null});A.current={sessionId:t,tab:k},(0,E.useEffect)(()=>()=>{let{sessionId:S,tab:$}=A.current;S!==void 0&&$!==null&&Un(S,$)},[]);let J=p.state==="ready"?p.snapshot.checkedAt:0,M=async S=>{if(!Me(t))return{ok:!1,error:n("error.noCwd")};let $=await u.run({sessionId:t,action:S});return $.ok?(dt(t).accept($.snapshot),{ok:!0}):(dt(t).resync(),{ok:!1,error:ft($.error.code,$.error.message,n)})},v=S=>{a(S),typeof localStorage<"u"&&localStorage.setItem(Zr,String(S))},L=[{key:"overview",label:n("tab.overview"),icon:(0,E.createElement)(Tt,{size:14})},{key:"changes",label:n("tab.changes"),icon:(0,E.createElement)(tr,{size:14})},{key:"files",label:n("tab.files"),icon:(0,E.createElement)(sr,{size:14})}],P=w?L.filter(S=>S.key==="files"):L,W=(()=>{if(!Me(t))return(0,E.createElement)("div",{className:"gp-empty"},n("error.noCwd"));if(p.state==="no-cwd")return(0,E.createElement)("div",{className:"gp-empty"},n("error.noCwd"));if(w){let $=N?(0,E.createElement)(Rn,{key:t,remote:u,sessionId:t,compact:c,t:n}):null;return b?(0,E.createElement)("div",{className:"gp-files-wrap"},[(0,E.createElement)("div",{key:"notice",className:"gp-notice"},n("files.gitNotInstalled")),$]):(0,E.createElement)("div",{style:{display:"contents"}},$)}if(p.state==="error")return(0,E.createElement)("div",{className:"gp-empty"},n("pill.unavailable"));if(p.state==="cold"||p.state==="loading"||k===null)return(0,E.createElement)("div",{className:"gp-empty"},n("common.loading"));let S=p.snapshot;return(0,E.createElement)("div",{style:{display:"contents"}},[_.current.tabs.has("overview")?(0,E.createElement)("div",{key:"overview",style:k==="overview"?{display:"contents"}:{display:"none"}},(0,E.createElement)(Jr,{key:t,remote:u,sessionId:t,refreshKey:J,defaultDiffView:S.defaultDiffView,snapshot:S,onAction:M,onResync:()=>dt(t).resync(),compact:c,t:n})):null,_.current.tabs.has("changes")?(0,E.createElement)("div",{key:"changes",style:k==="changes"?{display:"contents"}:{display:"none"}},(0,E.createElement)(Wr,{key:t,remote:u,sessionId:t,snapshot:S,onAction:M,compact:c,t:n})):null,N?(0,E.createElement)("div",{key:"files",style:k==="files"?{display:"contents"}:{display:"none"}},(0,E.createElement)(Rn,{key:t,remote:u,sessionId:t,compact:c,t:n})):null])})();return(0,E.createElement)("div",{className:"gp-panel",ref:l,"data-conversation-composer-overlay":"","data-font-delta":r,"data-layout":c?"compact":"wide"},[(0,E.createElement)("div",{key:"tabs",className:"gp-tabbar",role:"tablist"},[...P.map(S=>(0,E.createElement)("button",{key:S.key,type:"button",role:"tab","aria-selected":k===S.key,className:`gp-tab${k===S.key?" gp-tab--active":""}`,onClick:()=>{Me(t)&&o({sessionId:t,tab:S.key})}},[(0,E.createElement)("span",{key:"i",className:"gp-tab__icon"},S.icon),(0,E.createElement)("span",{key:"l",className:"gp-tab__label"},S.label)])),(0,E.createElement)("div",{key:"trailing",className:"gp-tabbar__trailing"},[(0,E.createElement)("div",{key:"font",className:"gp-font"},[(0,E.createElement)("button",{key:"dec",type:"button",className:"gp-font__decrease",onClick:()=>v(-1),"aria-label":n("panel.fontDecrease")},"A\u2212"),(0,E.createElement)("button",{key:"reset",type:"button",className:"gp-font__reset",onClick:()=>v(0),"aria-label":n("panel.fontReset")},"A"),(0,E.createElement)("button",{key:"inc",type:"button",className:"gp-font__increase",onClick:()=>v(1),"aria-label":n("panel.fontIncrease")},"A+")]),(0,E.createElement)(ki,{key:"ver",remote:u,t:n})])]),(0,E.createElement)("div",{key:"body",className:"gp-body"},W)])}function ki({remote:e,t}){let[n,r]=(0,E.useState)({kind:"idle"}),{tipProps:a,tipNode:i}=Jt({placement:"below",maxWidth:300});(0,E.useEffect)(()=>{let c=!0;return e.version({}).then(p=>{c&&"current"in p&&r(u=>({...u,info:p}))}),()=>{c=!1}},[e]);let o=async()=>{r(p=>({kind:"checking",info:p.info}));let c=await e.version({check:!0});r({kind:"idle",info:"current"in c?c:void 0})},s=n.info,l=n.kind==="checking"?(0,E.createElement)("span",{className:"gp-verbar__status"},t("version.checking")):s===void 0||!s.checkedRemote?null:s.error!==void 0?(0,E.createElement)("span",{className:"gp-verbar__status gp-verbar__status--err",title:s.error},s.error==="repository is not configured"?t("version.noRepo"):t("version.error")):s.updateAvailable&&s.latest!==void 0?(0,E.createElement)("span",{},[(0,E.createElement)("span",{key:"s",className:"gp-verbar__status gp-verbar__status--new"},t("version.updateAvailable",{latest:s.latest,current:s.current})),s.releaseUrl!==void 0?(0,E.createElement)("a",{key:"l",className:"gp-verbar__link",href:s.releaseUrl,target:"_blank",rel:"noreferrer",style:{marginLeft:8}},t("version.viewRelease")):null]):(0,E.createElement)("span",{className:"gp-verbar__status gp-verbar__status--ok"},t("version.upToDate",{current:s.current}));return(0,E.createElement)("div",{className:"gp-verbar"},[s!==void 0?(0,E.createElement)("span",{key:"tag",className:"gp-verbar__tag"},`v${s.current}`):null,l,(0,E.createElement)("button",{key:"btn",type:"button",className:"gp-verbar__btn",disabled:n.kind==="checking",onClick:()=>void o()},[(0,E.createElement)("span",{key:"i",className:"gp-tab__icon"},(0,E.createElement)(Nt,{size:12})),t("version.check")]),s?.repositoryUrl!==void 0?(0,E.createElement)("a",{key:"gh",className:"gp-icon-btn gp-verbar__gh gp-verbar__gh--starred",href:s.repositoryUrl,target:"_blank",rel:"noreferrer","aria-label":t("version.openRepo"),...a(t("version.openRepo"))},(0,E.createElement)(pr,{size:15})):null,i])}var ie=require("react"),aa=require("react-dom");var ta="data-gp-tab-dot",et,Gn=null,na="",Yt=null,Qt;function _i(e){if(typeof document>"u")return null;let t=document.querySelectorAll(ut);for(let n of t)if((n.textContent??"").trim()===e)return n;return null}function Mn(){let e=_i(na);if(e===null)return;let t=e.querySelector(`[${ta}]`);if(Yt===null){t?.remove();return}let n=`gp-tab-dot gp-tab-dot--${Yt}`;if(t!==null){t.className!==n&&(t.className=n);return}let r=document.createElement("span");r.className=n,r.setAttribute(ta,""),r.setAttribute("aria-hidden","true"),e.appendChild(r)}function Si(){if(typeof document>"u"||typeof MutationObserver>"u")return;let e=document.querySelector(On);if(e!==Gn){if(et?.disconnect(),Gn=e,e===null){et=void 0;return}et=new MutationObserver(()=>Mn()),et.observe(e,{childList:!0,subtree:!0})}}function Ci(){et?.disconnect(),et=void 0,Gn=null}function ra(e,t,n){if(!(typeof document>"u")){if(n===null){Pn(e);return}Qt=e,na=t,Yt=n,Si(),Mn()}}function Pn(e){Qt!==void 0&&Qt!==e||(Qt=void 0,Yt=null,Mn(),Ci())}function Ti(e){let t=e.replace(/[/\\]+$/,"").split(/[/\\]/);return t[t.length-1]||e}function Ni(){let[e,t]=(0,ie.useState)(!1),[n,r]=(0,ie.useState)(null),a=(0,ie.useRef)(null);return(0,ie.useLayoutEffect)(()=>{if(!e||a.current===null){r(null);return}let s=a.current.getBoundingClientRect();r({left:s.left,bottom:window.innerHeight-s.top+8})},[e]),{bind:{ref:s=>{a.current=s},onMouseEnter:()=>t(!0),onMouseLeave:()=>t(!1)},render:s=>!e||n===null||typeof document>"u"?null:(0,aa.createPortal)((0,ie.createElement)("div",{className:"gp-tip",style:{left:n.left,bottom:n.bottom}},s.map((l,c)=>(0,ie.createElement)("div",{key:c,className:c===0?"gp-tip__path":"gp-tip__note"},l))),document.body)}}function Ei(e){let[t,n]=(0,ie.useState)(!1);return(0,ie.useEffect)(()=>{if(e===null||typeof ResizeObserver>"u")return;let a=e.closest("[data-conversation-region]")??document.body,i=()=>n(a.clientWidth>0&&a.clientWidth<Ri);i();let o=new ResizeObserver(i);return o.observe(a),()=>o.disconnect()},[e]),t}var Ri=620;function ia({sessionId:e,t}){let n=Ct(e),r=Ni(),[a,i]=(0,ie.useState)(null),o=Ei(a),s=(0,ie.useRef)(Symbol("gp-tab-dot")),l=n.state==="ready"&&n.snapshot.showInputPill===!1?n.snapshot.dirty?"dirty":"synced":null,c=t("panel.tab");if((0,ie.useEffect)(()=>{ra(s.current,c,l);let _=s.current;return()=>{Pn(_)}},[c,l]),n.state==="cold"||n.state==="loading"||n.state==="no-cwd")return null;if(n.state==="error")return n.error.code==="not-a-git-repo"||n.error.code==="git-unavailable"||n.error.showInputPill===!1?null:(0,ie.createElement)("span",{className:"gp-pill gp-pill--degraded",title:n.error.detail??t("pill.unavailable")},t("pill.unavailable"));let p=n.snapshot;if(p.showInputPill===!1)return null;let u=Ti(p.root),f=p.branch??`(${t("pill.detached")})`,w=p.dirty,b=w?"gp-pill--dirty":"gp-pill--synced",k=()=>{if(Zn(c)){er(c);return}Me(e)&&qn(e,w?"changes":"overview"),Yn(c)};return(0,ie.createElement)("span",{className:"gp-pill-wrap",ref:i},[(0,ie.createElement)("button",{key:"btn",type:"button",className:`gp-pill ${b}${o?" gp-pill--compact":""}`,onClick:k,ref:r.bind.ref,onMouseEnter:r.bind.onMouseEnter,onMouseLeave:r.bind.onMouseLeave},[(0,ie.createElement)("span",{key:"dot",className:"gp-pill__dot","aria-hidden":"true"}),(0,ie.createElement)("span",{key:"repo",className:"gp-pill__repo"},u),(0,ie.createElement)("span",{key:"git",className:"gp-pill__git"},["(",(0,ie.createElement)("span",{key:"b",className:"gp-pill__branch"},f),")"])]),r.render([p.root,t(w?"pill.dirty":"pill.synced")])])}var O=require("react");function Gi(e){for(let t of e){let n=t.schema?.dict;if(n!==void 0&&"showInputPill"in n||JSON.stringify(t.schema).includes("showInputPill"))return t.ns}}function oa({ctx:e,t}){let[,n]=(0,O.useState)(0),[r,a]=(0,O.useState)(!1),[i,o]=(0,O.useState)(!1),[s,l]=(0,O.useState)(null),[c,p]=(0,O.useState)(null),[u,f]=(0,O.useState)(null),[w,b]=(0,O.useState)(null),k=()=>{n(T=>T+1)},_=e.get("configForms"),N=(0,O.useMemo)(()=>_?.describe(),[_]);(0,O.useEffect)(()=>{if(N!==void 0)return N.ensure(),N.subscribe(k)},[N]);let A=N?.getSnapshot().view,J=(0,O.useMemo)(()=>A===void 0?void 0:Gi(A.namespaces),[A]),M=(0,O.useMemo)(()=>_!==void 0&&J!==void 0?_.get(J):void 0,[_,J]);(0,O.useEffect)(()=>{if(M!==void 0)return M.subscribe(k)},[M]);let v=M?.getSnapshot(),L=M!==void 0&&v!==void 0&&v.status==="ready",P=N?.getSnapshot().status,W=s??(typeof v?.value?.showInputPill=="boolean"?v.value.showInputPill:!0),S=c??(v?.value?.defaultDiffView==="split"?"split":"unified"),$=u??(v?.value?.graphStyle==="compact"?"compact":"parallel"),oe=w??(typeof v?.value?.suggestEnabled=="boolean"?v.value.suggestEnabled:!0),ee=async(T,pe,H)=>{if(M!==void 0){o(!1),a(!0);try{let C=await M.set(T,pe);H(),C?(ct(),setTimeout(()=>ct(),1e3)):o(!0)}catch{H(),o(!0)}finally{a(!1)}}},ce=T=>(l(T),ee("showInputPill",T,()=>l(null))),ne=T=>T===S?Promise.resolve():(p(T),ee("defaultDiffView",T,()=>p(null))),z=T=>T===$?Promise.resolve():(f(T),ee("graphStyle",T,()=>f(null))),te=T=>(b(T),ee("suggestEnabled",T,()=>b(null)));return _===void 0?(0,O.createElement)("p",{className:"gp-cfg__hint"},t("cfg.notLoaded")):L?(0,O.createElement)("div",{className:"gp-cfg"},[(0,O.createElement)("h3",{key:"title",className:"gp-cfg__title"},t("cfg.title")),(0,O.createElement)("label",{key:"row",className:"gp-cfg__row"},[(0,O.createElement)("input",{key:"switch",type:"checkbox",role:"switch",className:"gp-cfg__switch",checked:W,disabled:r||v?.writable===!1,onChange:T=>{ce(T.currentTarget.checked)}}),(0,O.createElement)("span",{key:"text",className:"gp-cfg__text"},t("cfg.toggle"))]),(0,O.createElement)("p",{key:"hint",className:"gp-cfg__hint"},t("cfg.hint")),(0,O.createElement)("h3",{key:"difftitle",className:"gp-cfg__title",style:{marginTop:6}},t("cfg.diffTitle")),(0,O.createElement)("div",{key:"diffseg",className:"gp-seg gp-cfg__seg"},ze(["unified","split"],S,T=>{ne(T)},T=>t(T==="unified"?"cfg.diffUnified":"cfg.diffSplit"),r||v?.writable===!1)),(0,O.createElement)("p",{key:"diffhint",className:"gp-cfg__hint"},t("cfg.diffHint")),(0,O.createElement)("h3",{key:"graphtitle",className:"gp-cfg__title",style:{marginTop:6}},t("cfg.graphTitle")),(0,O.createElement)("div",{key:"graphseg",className:"gp-seg gp-cfg__seg"},ze(["parallel","compact"],$,T=>{z(T)},T=>t(T==="parallel"?"cfg.graphParallel":"cfg.graphCompact"),r||v?.writable===!1)),(0,O.createElement)("p",{key:"graphhint",className:"gp-cfg__hint"},t("cfg.graphHint")),(0,O.createElement)("h3",{key:"sgtitle",className:"gp-cfg__title",style:{marginTop:6}},t("cfg.suggestTitle")),(0,O.createElement)("label",{key:"sgrow",className:"gp-cfg__row"},[(0,O.createElement)("input",{key:"switch",type:"checkbox",role:"switch",className:"gp-cfg__switch",checked:oe,disabled:r||v?.writable===!1,onChange:T=>{te(T.currentTarget.checked)}}),(0,O.createElement)("span",{key:"text",className:"gp-cfg__text"},t("cfg.suggestToggle"))]),(0,O.createElement)("p",{key:"sghint",className:"gp-cfg__hint"},t("cfg.suggestHint")),i?(0,O.createElement)("p",{key:"error",className:"gp-cfg__err",role:"alert"},t("cfg.saveFailed")):null]):P==="idle"||P==="loading"?(0,O.createElement)("p",{className:"gp-cfg__hint"},t("common.loading")):(0,O.createElement)("p",{className:"gp-cfg__hint"},t("cfg.notLoaded"))}var mt="gitPanel",Mi=["dsh-git-panel","@xbzbing/dsh-git-panel"],Pi=["slots","locale","connection"],Di="dsh-git-panel";function Ai(e){$n(),Kn(e),e.effect(()=>e.locale.register(mt,{zh:In,en:Bn})??void 0,"dsh-git-panel: dictionaries");let t=e.locale.bind(mt),n=[],r=a=>{typeof a=="function"&&n.push(a)};r(e.slots.inject("conversation.view",()=>e.slots.register({name:"conversation.view",id:"git-panel",order:30,locale:mt,label:()=>t("panel.tab")},a=>(0,Zt.createElement)(ea,{ctx:e,sessionId:a.sessionId,t})))),r(e.slots.inject("conversation.input.left",()=>e.slots.register({name:"conversation.input.left",id:"git-panel-pill",order:100,locale:mt},a=>(0,Zt.createElement)(ia,{sessionId:a.sessionId,t}))));for(let a of Mi)r(e.slots.inject("plugins.bundle.config",()=>e.slots.register({name:"plugins.bundle.config",key:a,locale:mt},i=>i.view==="summary"?t("cfg.title"):(0,Zt.createElement)(oa,{ctx:e,t}))));e.effect(()=>{let a=e.on("connection/reset",()=>ct());return()=>{typeof a=="function"&&a();for(let i of n.splice(0))try{i()}catch{}Vn()}},"dsh-git-panel: lifecycle")}module.exports={name:Di,inject:Pi,apply:Ai};
539
+ ${o("ops.dirtyWarn")}`:""),confirmLabel:o("revert.confirm"),danger:!1,error:ne,confirmBusy:te,onConfirm:()=>void da(),onClose:()=>se(null),t:o}):null,ee!==null?$r(ee,{from:a.head??ee.shortHash,dirty:a.dirty,lostFiles:Fn,lostTotal:Fn.length,lostTruncated:a.truncated,busy:te,error:ne,onReset:ca,onClose:()=>ce(null),t:o}):null,X?De({title:o("status.pullConfirmTitle"),body:o("status.pullConfirmBody",{branch:a.branch??"HEAD",behind:a.behind}),extra:Xr(tn,o),confirmLabel:o("status.pullConfirm"),danger:!1,error:ne,confirmBusy:C,busyLabel:o("status.pulling"),onConfirm:()=>void ua(),onClose:()=>Q(!1),t:o}):null,re?De({title:o("status.pushConfirmTitle"),body:o("status.pushConfirmBody",{branch:a.branch??"HEAD",ahead:a.ahead}),extra:Jr(Re,o),confirmLabel:o("status.pushConfirm"),danger:!1,error:ne,confirmBusy:ge,busyLabel:o("status.pushing"),onConfirm:()=>void ga(),onClose:()=>me(!1),t:o}):null,Y?De({title:o("status.publishConfirmTitle"),body:o("status.publishConfirmBody",{branch:a.branch??"HEAD",remote:a.remote?.name??"origin"}),confirmLabel:o("status.publishConfirm"),danger:!1,error:ne,confirmBusy:ve,busyLabel:o("status.publishing"),onConfirm:()=>void fa(),onClose:()=>he(!1),t:o}):null],$n=(0,d.createElement)("div",{key:"mid",className:"gp-col gp-col--mid gp-history"},[(0,d.createElement)("div",{key:"tb",className:"gp-toolbar",ref:b},[s?(0,d.createElement)("button",{key:"filter",type:"button",className:`gp-btn${c.ref!==null?" gp-btn--primary":""}`,title:o("overview.filterBranch"),onClick:()=>Le(!0)},[(0,d.createElement)(ar,{key:"ic",size:13}),c.ref??o("overview.filterBranch")]):null,(0,d.createElement)("input",{key:"search",className:"gp-search",placeholder:o(k||s?"overview.searchShort":"overview.search"),value:u,onChange:h=>f(h.target.value)}),(0,d.createElement)("select",{key:"author",className:"gp-select",value:c.author,onChange:h=>p(B=>({...B,author:h.target.value}))},[(0,d.createElement)("option",{key:"",value:""},o("overview.allUsers")),...nn.map(h=>(0,d.createElement)("option",{key:h,value:h},h))]),(0,d.createElement)("select",{key:"since",className:"gp-select",value:c.since,onChange:h=>p(B=>({...B,since:h.target.value}))},[(0,d.createElement)("option",{key:"",value:""},o("overview.allTime")),(0,d.createElement)("option",{key:"today",value:"1 day ago"},o("overview.today")),(0,d.createElement)("option",{key:"7d",value:"7 days ago"},o("overview.last7d")),(0,d.createElement)("option",{key:"30d",value:"30 days ago"},o("overview.last30d"))]),(0,d.createElement)("button",{key:"fetch",type:"button",className:"gp-icon-btn",title:o("overview.fetch"),onClick:()=>{e.run({sessionId:t,action:{kind:"fetch"}}).then(()=>Se())}},(0,d.createElement)(Et,{size:14}))]),(0,d.createElement)("div",{key:"list",className:"gp-history__list",ref:yt,onScroll:Ke},Ce.length===0?(0,d.createElement)("div",{className:"gp-empty"},o(rt?"common.loading":rn?"overview.loadFailed":"overview.noResults")):at.map(h=>ii(h,{selected:j?.hash===h.commit.hash,gridTpl:sn,graphW:it,laneCount:bt,searching:Ge,now:ln,compact:s,rowH:on,onSelect:()=>vt(h.commit),onHoverEnter:V.onHoverEnter,onHoverLeave:V.onHoverLeave,t:o})))]),In=j===null?[(0,d.createElement)("div",{key:"empty",className:"gp-empty"},[(0,d.createElement)(Nt,{key:"i",size:20}),o("overview.selectCommit")])]:[(0,d.createElement)("div",{key:"files",className:"gp-detail__files"},V.detail===null?(0,d.createElement)("div",{className:"gp-empty"},V.detailError?o("overview.detailFailed"):o("common.loading")):[V.detail.stats.length>0?(0,d.createElement)("div",{key:"sum",className:"gp-detail__summary"},[(0,d.createElement)("span",{key:"f"},o("overview.changeSummary",{files:V.detail.stats.length})),(0,d.createElement)("span",{key:"sep",className:"gp-detail__summary-sep"},"\xB7"),(0,d.createElement)("span",{key:"a",className:"gp-stats__add"},`+${V.detail.insertions}`),(0,d.createElement)("span",{key:"d",className:"gp-stats__del"},`\u2212${V.detail.deletions}`)]):null,si(dn,{activePath:V.fileDiff?.path??null,openTitle:o("overview.openFileDiff"),onOpen:h=>{j!==null&&V.openFileDiff(h,j.hash,j.shortHash)},collapsed:y,onToggleDir:G,expandLabel:o("overview.expandDir"),collapseLabel:o("overview.collapseDir")})]),(0,d.createElement)("div",{key:"msg",className:"gp-detail__msg"},[(0,d.createElement)("div",{key:"subj",className:"gp-detail__subject"},j.subject),(0,d.createElement)("div",{key:"meta",className:"gp-detail__meta"},[(0,d.createElement)("span",{key:"h",className:"gp-commit-hash"},j.shortHash),(0,d.createElement)("span",{key:"a"},j.author),(0,d.createElement)("span",{key:"t"},bn(j.dateIso))]),(0,d.createElement)("div",{key:"ops",className:"gp-detail__ops"},(()=>{let h=j.refs.filter(B=>B.kind==="tag");return[h.length>0?(0,d.createElement)("div",{key:"tags",className:"gp-detail__tags"},h.map(B=>(0,d.createElement)("span",{key:`tag-${B.name}`,className:"gp-ref-chip gp-ref-chip--tag gp-ref-chip--del",title:B.name},[(0,d.createElement)(Oe,{key:"i",size:11}),(0,d.createElement)("span",{key:"n",className:"gp-detail__tagname"},B.name),(0,d.createElement)("button",{key:"x",type:"button",className:"gp-ref-chip__x",title:o("tag.deleteOne",{name:B.name}),onClick:()=>{z(null),S(B.name)}},(0,d.createElement)(qe,{size:11}))]))):null,(0,d.createElement)("div",{key:"actions",className:"gp-detail__actions"},[(0,d.createElement)("button",{key:"revert",type:"button",className:"gp-btn gp-btn--sm",title:o("overview.revert"),onClick:()=>{z(null),se({hash:j.hash,shortHash:j.shortHash,subject:j.subject})}},[(0,d.createElement)(lr,{key:"i",size:12}),o("overview.revert")]),(0,d.createElement)("button",{key:"reset",type:"button",className:"gp-btn gp-btn--sm",title:o("overview.reset"),onClick:()=>{z(null),l(),ce({hash:j.hash,shortHash:j.shortHash,subject:j.subject})}},[(0,d.createElement)(Rt,{key:"i",size:12}),o("overview.reset")]),(0,d.createElement)("button",{key:"addtag",type:"button",className:"gp-btn gp-btn--sm",title:o("overview.createTag"),onClick:()=>{z(null),P({hash:j.hash,shortHash:j.shortHash})}},[(0,d.createElement)(Oe,{key:"i",size:12}),o("overview.createTag")])])]})()),V.detail!==null&&V.detail.body!==""?(0,d.createElement)("pre",{key:"body",className:"gp-detail__body"},V.detail.body):(0,d.createElement)("div",{key:"nb",className:"gp-empty"},o("overview.noMessage"))])];return s?(0,d.createElement)("div",{className:"gp-overview gp-overview--compact"},[Hn,...zn,mt==="detail"?(0,d.createElement)("div",{key:"detail",className:"gp-col gp-col--mid gp-detail"},[(0,d.createElement)("div",{key:"back",className:"gp-subhead"},[(0,d.createElement)("button",{key:"b",type:"button",className:"gp-subhead__back",onClick:()=>nt("list")},[(0,d.createElement)(We,{key:"i",size:14}),o("overview.backToList")]),j!==null?(0,d.createElement)("span",{key:"h",className:"gp-subhead__title gp-commit-hash"},j.shortHash):null]),...In]):$n,Sn(a,Ln),Xe?ai(ht,Je,c.ref,_,{onFilter:h=>{fe(h),Le(!1)},onToggle:h=>N(B=>{let U=new Set(B);return U.has(h)?U.delete(h):U.add(h),U}),onRetry:Se,onClose:()=>Le(!1),t:o}):null]):(0,d.createElement)("div",{className:"gp-overview"},[Hn,...zn,(0,d.createElement)("div",{key:"left",className:"gp-col gp-col--left",style:{flex:`0 0 ${K.width}px`}},[(0,d.createElement)("div",{key:"scroll",className:"gp-col-left__scroll"},Or(ht,Je,c.ref,_,{onFilter:h=>fe(h),onToggle:h=>N(B=>{let U=new Set(B);return U.has(h)?U.delete(h):U.add(h),U}),onRetry:Se,t:o})),Sn(a,Ln)]),K.divider,$n,ae.divider,(0,d.createElement)("div",{key:"right",className:"gp-col gp-col--right gp-detail",style:{flex:`0 0 ${ae.width}px`}},In),ri(V.hover,V.hoverBody,o)])}function ri(e,t,n){if(e===null||typeof document>"u")return null;let r=460,a=Math.min(e.x+16,(typeof window<"u"?window.innerWidth:1200)-r-12),i=e.y+14,l=(0,d.createElement)("div",{className:"gp-hovercard",style:{left:a,top:i,maxWidth:r}},[(0,d.createElement)("div",{key:"subj",className:"gp-hovercard__subject"},e.commit.subject),(0,d.createElement)("div",{key:"meta",className:"gp-hovercard__meta"},[(0,d.createElement)("span",{key:"h",className:"gp-commit-hash"},e.commit.shortHash),(0,d.createElement)("span",{key:"a"},e.commit.author),(0,d.createElement)("span",{key:"t"},bn(e.commit.dateIso))]),t===null?(0,d.createElement)("div",{key:"l",className:"gp-hovercard__loading"},n("common.loading")):t===""?(0,d.createElement)("div",{key:"e",className:"gp-hovercard__loading"},n("overview.noMessage")):(0,d.createElement)("pre",{key:"body",className:"gp-hovercard__body"},t)]);return(0,Ot.createPortal)(l,document.body,"commit-hovercard")}function Or(e,t,n,r,a){if(t)return(0,d.createElement)("div",{className:"gp-empty"},[(0,d.createElement)("span",{key:"m"},a.t("overview.branchesError")),(0,d.createElement)("button",{key:"r",type:"button",className:"gp-btn",style:{marginTop:8},onClick:a.onRetry},a.t("common.retry"))]);if(e===null)return(0,d.createElement)("div",{className:"gp-empty"},a.t("common.loading"));let i=(l,s,o,c,p="")=>(0,d.createElement)("div",{key:l,className:"gp-branch-group"},[(0,d.createElement)("div",{key:"head",className:"gp-branch-group__head",onClick:()=>a.onToggle(l)},[(0,d.createElement)(Pe,{key:"c",size:11,open:!r.has(l)}),`${a.t(s)} (${o.length})`]),r.has(l)?null:o.map(u=>{let f=p+u.name,w=e.current===u.name,b=`gp-branch-row${n===f?" gp-branch-row--active":""}${w?" gp-branch-row--current":""}`;return(0,d.createElement)("div",{key:u.name,className:b,title:u.name,onClick:()=>a.onFilter(n===f?null:f)},[(0,d.createElement)("span",{key:"i",style:{display:"inline-flex",width:14}},c),(0,d.createElement)("span",{key:"n",className:"gp-tree-name"},u.name),u.ahead||u.behind?(0,d.createElement)("span",{key:"t",className:"gp-branch-row__track"},`${u.ahead?`\u2191${u.ahead}`:""}${u.behind?`\u2193${u.behind}`:""}`):null])})]);return(0,d.createElement)("div",{},[(0,d.createElement)("div",{key:"head-row",className:"gp-branch-row",style:{fontWeight:600,justifyContent:"center",padding:"4px 10px"},onClick:()=>a.onFilter(null)},a.t("overview.head")),i("local","overview.local",e.local,(0,d.createElement)(mn,{size:13})),i("remote","overview.remote",e.remote,(0,d.createElement)(mn,{size:13})),i("tags","overview.tags",e.tags,(0,d.createElement)(Oe,{size:13}))])}function ai(e,t,n,r,a){if(typeof document>"u")return null;let i=(0,d.createElement)("div",{className:"gp-sheet-backdrop",onClick:l=>{l.target===l.currentTarget&&a.onClose()}},(0,d.createElement)("div",{className:"gp-sheet",role:"dialog","aria-modal":!0},[(0,d.createElement)("div",{key:"bar",className:"gp-sheet__bar"},[(0,d.createElement)("span",{key:"title",className:"gp-sheet__title"},a.t("overview.filterBranch")),(0,d.createElement)("button",{key:"close",type:"button",className:"gp-icon-btn gp-sheet__close",title:a.t("common.close"),onClick:a.onClose},(0,d.createElement)(qe,{size:15}))]),(0,d.createElement)("div",{key:"body",className:"gp-sheet__body"},Or(e,t,n,r,a))]));return(0,Ot.createPortal)(i,document.body,"branch-filter-sheet")}function ii(e,t){let n=e.commit,r=n.refs.map(i=>(0,d.createElement)("span",{key:i.name,className:`gp-ref-chip${i.head?" gp-ref-chip--head":""}${i.kind==="remote"?" gp-ref-chip--remote":""}${i.kind==="tag"?" gp-ref-chip--tag":""}`},i.name)),a=(0,d.createElement)("div",{key:"g",className:"gp-graph-cell"},t.searching?null:oi(e,t.laneCount,t.rowH));return t.compact?(0,d.createElement)("div",{key:n.hash,className:`gp-commit-row gp-commit-row--compact${t.selected?" gp-commit-row--active":""}`,style:{gridTemplateColumns:t.gridTpl,height:`${t.rowH}px`},onClick:t.onSelect},[a,(0,d.createElement)("div",{key:"tx",className:"gp-commit-lines"},[(0,d.createElement)("div",{key:"s",className:"gp-commit-subject"},[...r,n.subject]),(0,d.createElement)("div",{key:"m",className:"gp-commit-sub"},[(0,d.createElement)("span",{key:"h",className:"gp-commit-hash"},n.shortHash),(0,d.createElement)("span",{key:"a",className:"gp-commit-author"},n.author),(0,d.createElement)("span",{key:"d",className:"gp-commit-date"},je(n.dateIso,t.now,t.t))])])]):(0,d.createElement)("div",{key:n.hash,className:`gp-commit-row${t.selected?" gp-commit-row--active":""}`,style:{gridTemplateColumns:t.gridTpl},onClick:t.onSelect,onMouseEnter:i=>t.onHoverEnter(n,i.clientX,i.clientY),onMouseLeave:t.onHoverLeave},[a,(0,d.createElement)("div",{key:"s",className:"gp-commit-subject"},[...r,n.subject]),(0,d.createElement)("div",{key:"h",className:"gp-commit-hash"},n.shortHash),(0,d.createElement)("div",{key:"a",className:"gp-commit-author"},n.author),(0,d.createElement)("div",{key:"d",className:"gp-commit-date",title:ut(n.dateIso)},je(n.dateIso,t.now,t.t))])}var Vt=["#4e9bff","#3fb950","#e0982e","#d05ce3","#e5534b","#2dc6c6","#d29922","#8b949e"];function oi(e,t,n=Kr){let r=Math.max(et,t*et),a=s=>s*et+et/2,i=n/2,l=[];for(let s of e.edges){let o=Vt[s.color%Vt.length],c=s.kind==="out"?i:0,p=s.kind==="into"?i:n,u=(c+p)/2;l.push((0,d.createElement)("path",{key:`e${s.kind}-${s.fromLane}-${s.toLane}-${s.color}`,d:`M ${a(s.fromLane)} ${c} C ${a(s.fromLane)} ${u}, ${a(s.toLane)} ${u}, ${a(s.toLane)} ${p}`,stroke:o,strokeWidth:1.6,fill:"none"}))}return l.push((0,d.createElement)("circle",{key:"node",cx:a(e.lane),cy:i,r:e.merge?4:3.2,fill:Vt[e.color%Vt.length],stroke:"var(--dsw-alias-bg-layer-1)",strokeWidth:1})),(0,d.createElement)("svg",{className:"gp-graph-svg",width:r,height:n},l)}function si(e,t){let n=[],r=(a,i)=>{for(let l of a)if(l.dir){let s=t.collapsed.has(l.path);n.push((0,d.createElement)("div",{key:l.path,className:"gp-tree-row gp-tree-row--dir",style:{paddingLeft:10+i*14},title:s?t.expandLabel:t.collapseLabel,role:"button",tabIndex:0,"aria-expanded":!s,onClick:()=>t.onToggleDir(l.path),onKeyDown:o=>{(o.key==="Enter"||o.key===" ")&&(o.preventDefault(),t.onToggleDir(l.path))}},[(0,d.createElement)(Pe,{key:"c",size:11,open:!s}),(0,d.createElement)("span",{key:"n",className:"gp-tree-name"},l.name)])),s||r(l.children,i+1)}else{let s=String(l.meta??"modified"),o=t.activePath===l.path;n.push((0,d.createElement)("div",{key:l.path,className:`gp-tree-row${o?" gp-tree-row--active":""}`,style:{paddingLeft:10+i*14},title:t.openTitle,onClick:()=>t.onOpen(l.path)},[(0,d.createElement)("span",{key:"st",className:`gp-status-badge ${Mt(s)}`},(Gt[s]??s[0]??"M").toUpperCase()),(0,d.createElement)("span",{key:"n",className:"gp-tree-name"},l.name)]))}};return r(e,0),(0,d.createElement)("div",{},n)}function li(e,t){if(e===null||typeof document>"u")return null;let{text:n,error:r,mode:a,onMode:i,expanded:l,onExpand:s,onClose:o,remote:c,sessionId:p,compact:u,t:f}=t,w=u?["unified","before","after"]:["unified","split","before","after"],b=u&&a==="split"?"unified":a,k=(0,d.createElement)("div",{className:"gp-modal-backdrop",onClick:_=>{_.target===_.currentTarget&&o()}},(0,d.createElement)("div",{className:"gp-modal",role:"dialog","aria-modal":!0},[(0,d.createElement)("div",{key:"bar",className:"gp-modal__bar"},[(0,d.createElement)("span",{key:"fileicon",className:"gp-modal__fileicon"},(0,d.createElement)(or,{size:15})),(0,d.createElement)("span",{key:"path",className:"gp-modal__path",title:e.path},di(e.path)),(0,d.createElement)("span",{key:"hash",className:"gp-modal__hash"},e.shortHash),n!==null&&n!==""?(()=>{let _=Jt(n);return(0,d.createElement)("span",{key:"sum",className:"gp-modal__sum"},[(0,d.createElement)("span",{key:"a",className:"gp-stats__add"},`+${_.add}`),(0,d.createElement)("span",{key:"d",className:"gp-stats__del"},`\u2212${_.del}`)])})():null,(0,d.createElement)("button",{key:"expand",type:"button",className:`gp-seg__btn gp-diff__expand${l?" gp-seg__btn--active":""}`,disabled:b!=="split"&&b!=="unified",title:f(l?"diff.collapse":"diff.expandAll"),onClick:()=>s(!l)},f(l?"diff.collapse":"diff.expandAll")),(0,d.createElement)("div",{key:"seg",className:"gp-seg"},$e(w,b,i,_=>f(`diff.${_}`))),(0,d.createElement)("button",{key:"close",type:"button",className:"gp-icon-btn gp-modal__close",title:f("common.close"),onClick:o},(0,d.createElement)(qe,{size:15}))]),(0,d.createElement)("div",{key:"scroll",className:"gp-modal__scroll"},n===null?(0,d.createElement)("div",{className:"gp-empty"},f(r?"overview.diffFailed":"common.loading")):(0,d.createElement)(Xt,{text:n,mode:b,path:e.path,remote:c,sessionId:p,imageSpec:{base:"commit",commit:e.hash},t:f}))]));return(0,Ot.createPortal)(k,document.body,"file-diff-modal")}function di(e){let t=e.lastIndexOf("/");return t<0?[(0,d.createElement)("span",{key:"n",className:"gp-modal__name"},e)]:[(0,d.createElement)("span",{key:"d",className:"gp-modal__dir"},e.slice(0,t+1)),(0,d.createElement)("span",{key:"n",className:"gp-modal__name"},e.slice(t+1))]}var g=require("react");var be=require("react");function qr({stats:e,t}){let n=Date.now(),r=[(0,be.createElement)("span",{key:"files",className:"gp-stats__item"},t("stats.files",{n:e.fileCount})),(0,be.createElement)("span",{key:"lines",className:"gp-stats__item"},[(0,be.createElement)("span",{key:"a",className:"gp-stats__add"},`+${e.insertions}`)," ",(0,be.createElement)("span",{key:"d",className:"gp-stats__del"},`\u2212${e.deletions}`)])];e.staged>0&&r.push((0,be.createElement)("span",{key:"st",className:"gp-stats__item"},t("stats.staged",{n:e.staged}))),e.modified>0&&r.push((0,be.createElement)("span",{key:"mo",className:"gp-stats__item"},t("stats.modified",{n:e.modified}))),e.untracked>0&&r.push((0,be.createElement)("span",{key:"un",className:"gp-stats__item"},t("stats.untracked",{n:e.untracked}))),e.partial&&r.push((0,be.createElement)("span",{key:"partial",className:"gp-stats__item gp-stats__partial",title:t("stats.partialHint")},t("stats.partial")));let a=[];return e.lastChangeAt!==null&&a.push((0,be.createElement)("span",{key:"lc",className:"gp-stats__item",title:ut(e.lastChangeAt)},t("stats.lastChange",{time:je(e.lastChangeAt,n,t)}))),e.headCommittedAt!==null&&a.push((0,be.createElement)("span",{key:"hc",className:"gp-stats__item",title:ut(e.headCommittedAt)},t("stats.lastCommit",{time:je(e.headCommittedAt,n,t)}))),a.length>0&&r.push((0,be.createElement)("span",{key:"times",className:"gp-stats__times"},a)),(0,be.createElement)("div",{className:"gp-stats"},r)}function qt(e){let t=new Array(e.length+1);t[0]=0;for(let n=0;n<e.length;n++)t[n+1]=t[n]+e[n];return t}function Wr(e,t){let n=0,r=e.length-1;for(;n<r;){let a=n+r+1>>1;e[a]<=t?n=a:r=a-1}return n}function Wt(e,t,n,r){let a=e.length-1;if(a<=0)return{first:0,last:0};let i=Wr(e,t-r),l=Math.min(a,Wr(e,t+n+r)+1);return{first:i,last:l}}var Ie=require("react");function jt(){let[e,t]=(0,Ie.useState)({top:0,height:0}),n=(0,Ie.useRef)(null),r=(0,Ie.useRef)(null);return{setEl:(0,Ie.useCallback)(i=>{if(r.current!==null&&(r.current(),r.current=null),n.current=i,i===null)return;let l=()=>t(o=>{let c=i.scrollTop,p=i.clientHeight;return o.top===c&&o.height===p?o:{top:c,height:p}});l(),i.addEventListener("scroll",l,{passive:!0});let s=typeof ResizeObserver<"u"?new ResizeObserver(l):null;s?.observe(i),r.current=()=>{i.removeEventListener("scroll",l),s?.disconnect()}},[]),viewport:e,elRef:n}}var Tn=28,jr=26,ci=8,pi=600;function Ur({remote:e,sessionId:t,snapshot:n,onAction:r,compact:a,t:i}){let[l,s]=(0,g.useState)(new Set),[o,c]=(0,g.useState)(""),[p,u]=(0,g.useState)(!1),[f,w]=(0,g.useState)(!1),[b,k]=(0,g.useState)(null),[_,N]=(0,g.useState)(new Set),[A,J]=(0,g.useState)(null),[M,v]=(0,g.useState)(null),[L,P]=(0,g.useState)(null),[W,S]=(0,g.useState)(()=>n.defaultDiffView),[$,se]=(0,g.useState)(!1),[ee,ce]=(0,g.useState)(!1),[ne,z]=(0,g.useState)(!1),[te,T]=(0,g.useState)(!1),[pe,H]=(0,g.useState)(null),[C,I]=(0,g.useState)("list"),[X,Q]=(0,g.useState)([]),[ge,D]=(0,g.useState)(!0),[re,me]=(0,g.useState)(!1),[ve,Z]=(0,g.useState)(null),Y=(0,g.useRef)(null),he=(0,g.useRef)(0),{setEl:tn,viewport:Ae}=jt(),Re=(0,g.useCallback)(async()=>{let y=await e.query({sessionId:t,query:{kind:"stash-list"}}),G=de(y,"stash-list");Q(G?.entries??[])},[e,t]);(0,g.useEffect)(()=>{Re()},[Re,n.checkedAt]);let Be=(0,g.useMemo)(()=>n.changes.filter(y=>y.staged).sort(Nn),[n]),mt=(0,g.useMemo)(()=>n.changes.filter(y=>!y.staged&&y.status!=="untracked").sort(Nn),[n]),nt=(0,g.useMemo)(()=>n.changes.filter(y=>y.status==="untracked").sort(Nn),[n]),Le=[{key:"staged",labelKey:"changes.groupStaged",items:Be},{key:"unstaged",labelKey:"changes.groupUnstaged",items:mt},{key:"untracked",labelKey:"changes.groupUntracked",items:nt}].filter(y=>y.items.length>0),{items:ht,tops:Je,totalH:nn}=(0,g.useMemo)(()=>{let y=[];for(let K of Le)if(y.push({kind:"head",g:{key:K.key,labelKey:K.labelKey,count:K.items.length}}),!_.has(K.key))for(let ae of K.items)y.push({kind:"row",c:ae});let G=qt(y.map(K=>K.kind==="head"?jr:Tn));return{items:y,tops:G,totalH:G[y.length]}},[Be,mt,nt,_]),Se=Ae.height>0?Ae.height:pi,{first:V,last:Ce}=Wt(Je,Ae.top,Se,ci*Tn);(0,g.useEffect)(()=>{s(y=>{if(y.size===0)return y;let G=new Set(n.changes.map(fe=>fe.path+(fe.staged?":s":":w"))),K=new Set,ae=!1;for(let fe of y)G.has(fe)?K.add(fe):ae=!0;return ae?K:y})},[n]),(0,g.useEffect)(()=>{if(!p||ee||o.trim()!=="")return;let y=!0;return e.query({sessionId:t,query:{kind:"last-commit-message"}}).then(G=>{let K=de(G,"last-commit-message");y&&K!==null&&(c(K.message),ce(!0))}),()=>{y=!1}},[p,ee,o,e,t]);let rt=(0,g.useCallback)(async(y,G,K=!1,ae=!1)=>{let fe=++he.current;v({path:y,base:G}),ae||P(null),se(K);let Te=await e.query({sessionId:t,query:{kind:"diff",path:y,base:G,...K?{context:1e5}:{}}});if(fe!==he.current)return;let xt=de(Te,"diff");P(xt!==null?xt.text:"")},[e,t]);(0,g.useEffect)(()=>{if(M===null)return;if(!n.changes.some(G=>G.path===M.path)){v(null),P(null),I("list");return}rt(M.path,M.base,$,!0)},[n]),(0,g.useEffect)(()=>{J(null)},[n]),(0,g.useEffect)(()=>{T(!1)},[n]);let rn=y=>{s(G=>{let K=new Set(G);return K.has(y)?K.delete(y):K.add(y),K})},we=async y=>{if(f)return!1;w(!0),k(null),H(null);try{let G=await r(y);return G.ok?!0:(k(G.error??i("error.generic")),!1)}catch(G){return k(G instanceof Error?G.message:i("error.generic")),!1}finally{w(!1)}},yt=async()=>{let y=o.trim();if(y===""&&!p){k(i("error.emptyMessage"));return}let G=l.size>0?[...new Set([...l].map(ae=>ae.replace(/:[sw]$/,"")))]:void 0;await we({kind:"commit",message:y,...G?{paths:G}:{},...p?{amend:!0}:{}})&&(c(""),s(new Set),u(!1),ce(!1))},an=async y=>{await we({kind:"stash-push",...y.trim()!==""?{message:y}:{}})&&(me(!1),Re())},Ge=(y,G)=>{we({kind:"stash-apply",index:y,sha:G}).then(K=>{K&&Re()})},at=(y,G)=>{we({kind:"stash-pop",index:y,sha:G}).then(K=>{K&&Re()})},bt=async(y,G)=>{await we({kind:"stash-drop",index:y,sha:G})&&(Z(null),Re())},it=(y,G)=>{switch(y){case"empty-diff":return i("error.emptyDiff");case"llm-unavailable":return i("error.llmUnavailable");case"suggest-disabled":return i("error.suggestDisabled");case"llm-error":case"llm-output":return G===void 0?i("error.llmFailed"):`${i("error.llmFailed")}: ${G}`;default:return G??i("error.generic")}},on=async()=>{if(ne)return;if(p&&!te&&o.trim()!==""){T(!0),k(null),H(i("commit.suggestOverwrite"));return}T(!1);let y=l.size>0?[...new Set([...l].map(G=>G.replace(/:[sw]$/,"")))]:void 0;z(!0),k(null),H(null);try{let G=await e.suggest({sessionId:t,...y&&y.length>0?{paths:y}:{}});G.ok?(c(G.value.message),G.value.truncated===!0&&H(i("commit.suggestTruncated")),Y.current?.focus()):k(it(G.error.code,G.error.message))}catch(G){k(G instanceof Error?G.message:i("error.generic"))}finally{z(!1)}},sn=y=>{N(G=>{let K=new Set(G);return K.has(y)?K.delete(y):K.add(y),K})},Ke=L!==null&&L!==""?Jt(L):null,vt=ze({storageKey:"gp.changes.left",initial:380,min:220,reserve:200,edge:"end"}),ln=(y,G)=>{rt(y,G),a&&I("diff")},dn=a?["unified","before","after"]:["unified","split","before","after"],j=a&&W==="split"?"unified":W,He=[(0,g.createElement)(qr,{key:"stats",stats:n.stats,t:i}),(0,g.createElement)("div",{key:"toolbar",className:"gp-toolbar"},[(0,g.createElement)("button",{key:"sa",type:"button",className:"gp-btn",disabled:f||n.changes.length===0,onClick:()=>void we({kind:"stage-all"})},i("changes.stageAll")),(0,g.createElement)("button",{key:"ua",type:"button",className:"gp-btn",disabled:f||n.staged===0,onClick:()=>void we({kind:"unstage-all"})},i("changes.unstageAll")),(0,g.createElement)("button",{key:"stash",type:"button",className:"gp-btn",disabled:f||n.staged===0&&n.modified===0,title:i("changes.stash"),onClick:()=>{k(null),me(!0)}},[(0,g.createElement)(hn,{key:"ic",size:13}),i("changes.stash")])]),b!==null?(0,g.createElement)("div",{key:"err",className:"gp-feedback"},b):null,pe!==null?(0,g.createElement)("div",{key:"notice",className:"gp-notice"},pe):null,(0,g.createElement)("div",{key:"list",className:"gp-changes__list",ref:tn},n.changes.length===0?(0,g.createElement)("div",{className:"gp-empty"},i("changes.noChanges")):(0,g.createElement)("div",{className:"gp-changes__vlist",style:{height:nn}},ht.slice(V,Ce).map((y,G)=>{let K=V+G;if(y.kind==="head"){let Te=y.g;return(0,g.createElement)("div",{key:`h:${Te.key}`,className:"gp-changes__vrow",style:{top:Je[K],height:jr}},(0,g.createElement)("div",{className:"gp-group-head",onClick:()=>sn(Te.key)},[(0,g.createElement)(Pe,{key:"chev",size:12,open:!_.has(Te.key)}),`${i(Te.labelKey)} (${Te.count})`]))}let ae=y.c,fe=ae.path+(ae.staged?":s":":w");return(0,g.createElement)("div",{key:fe,className:"gp-changes__vrow",style:{top:Je[K],height:Tn}},fi(ae,{selected:l.has(fe),active:M?.path===ae.path&&M.base===(ae.staged?"staged":"worktree"),busy:f,armed:A===fe,onToggle:()=>rn(fe),onOpen:()=>ln(ae.path,ae.staged?"staged":"worktree"),onStage:()=>void we(ae.staged?{kind:"unstage",paths:[ae.path]}:{kind:"stage",paths:[ae.path]}),onDiscard:()=>{A===fe?(we({kind:"discard",paths:[ae.path]}),J(null)):J(fe)},t:i}))}))),X.length>0?(0,g.createElement)("div",{key:"stashes",className:"gp-stash"},[(0,g.createElement)("div",{key:"head",className:"gp-group-head",onClick:()=>D(y=>!y)},[(0,g.createElement)(Pe,{key:"chev",size:12,open:!ge}),`${i("stash.section")} (${X.length})`]),ge?null:(0,g.createElement)("div",{key:"items"},X.map(y=>gi(y,{busy:f,onApply:()=>Ge(y.index,y.sha),onPop:()=>at(y.index,y.sha),onDrop:()=>{k(null),Z(y)},t:i})))]):null,(0,g.createElement)("div",{key:"box",className:"gp-commitbox"},[(0,g.createElement)("textarea",{key:"msg",className:"gp-commitbox__msg",placeholder:i("commit.placeholder"),value:o,ref:Y,onChange:y=>c(y.target.value)}),(0,g.createElement)("div",{key:"row",className:"gp-commitbox__row"},[(0,g.createElement)("label",{key:"amend",className:"gp-commitbox__amend"},[(0,g.createElement)("input",{key:"cb",type:"checkbox",className:"gp-check",checked:p,onChange:()=>{u(y=>!y),ce(!1)}}),i("commit.amend")]),(0,g.createElement)("div",{key:"actions",className:"gp-commitbox__actions"},[n.suggestEnabled!==!1?(0,g.createElement)("button",{key:"suggest",type:"button",className:"gp-btn",disabled:f||ne||n.changes.length===0,onClick:()=>void on(),title:i("commit.suggest")},[(0,g.createElement)(ir,{key:"ic",size:13}),i(ne?"commit.suggesting":"commit.suggest")]):null,(0,g.createElement)("button",{key:"commit",type:"button",className:"gp-btn gp-btn--primary",disabled:f||ne||o.trim()==="",onClick:()=>void yt()},i("commit.commit"))])])])],ot=M===null?(0,g.createElement)("div",{className:"gp-empty"},i("changes.selectFile")):(0,g.createElement)("div",{className:"gp-diff"},[(0,g.createElement)("div",{key:"tb",className:"gp-diff__toolbar"},[a?(0,g.createElement)("button",{key:"back",type:"button",className:"gp-subhead__back",onClick:()=>I("list")},[(0,g.createElement)(We,{key:"i",size:14}),i("changes.backToList")]):null,(0,g.createElement)("span",{key:"path",className:"gp-diff__path"},M.path),Ke?(0,g.createElement)("span",{key:"sum",className:"gp-stats__item",style:{marginLeft:"auto"}},[(0,g.createElement)("span",{key:"a",className:"gp-stats__add"},`+${Ke.add}`)," ",(0,g.createElement)("span",{key:"d",className:"gp-stats__del"},`\u2212${Ke.del}`)]):null,(0,g.createElement)("button",{key:"expand",type:"button",className:`gp-seg__btn gp-diff__expand${$?" gp-seg__btn--active":""}`,style:Ke?{}:{marginLeft:"auto"},disabled:j!=="split"&&j!=="unified",title:i($?"diff.collapse":"diff.expandAll"),onClick:()=>void rt(M.path,M.base,!$)},i($?"diff.collapse":"diff.expandAll")),(0,g.createElement)("div",{key:"seg",className:"gp-seg"},$e(dn,j,S,y=>i(`diff.${y}`)))]),(0,g.createElement)("div",{key:"scroll",className:"gp-diff__scroll"},L===null?(0,g.createElement)("div",{className:"gp-empty"},i("common.loading")):(0,g.createElement)(Xt,{text:L,mode:j,path:M.path,remote:e,sessionId:t,imageSpec:{base:M.base},t:i}))]),wt=[re?(0,g.createElement)(ui,{key:"push",onClose:()=>me(!1),onStash:an,error:b,t:i}):null,ve!==null?De({title:i("stash.dropTitle"),body:i("stash.dropConfirm",{name:ve.message}),confirmLabel:i("stash.drop"),danger:!0,error:b,onConfirm:()=>void bt(ve.index,ve.sha),onClose:()=>Z(null),t:i}):null];return a?(0,g.createElement)("div",{className:"gp-changes gp-changes--compact"},[...wt,C==="diff"?(0,g.createElement)("div",{key:"right",className:"gp-changes__right"},ot):(0,g.createElement)("div",{key:"left",className:"gp-changes__left"},He)]):(0,g.createElement)("div",{className:"gp-changes"},[...wt,(0,g.createElement)("div",{key:"left",className:"gp-changes__left",style:{flex:`0 0 ${vt.width}px`}},He),vt.divider,(0,g.createElement)("div",{key:"right",className:"gp-changes__right"},ot)])}function ui({onClose:e,onStash:t,error:n,t:r}){let[a,i]=(0,g.useState)("");return Ze({onClose:e,title:r("stash.title"),icon:(0,g.createElement)(hn,{size:15}),portalKey:"stash-push-modal",t:r,body:[(0,g.createElement)("input",{key:"msg",className:"gp-input",placeholder:r("stash.messagePlaceholder"),value:a,autoFocus:!0,onChange:l=>i(l.target.value),onKeyDown:l=>{l.key==="Enter"&&t(a)}}),Qe(r),n!==null?(0,g.createElement)("div",{key:"err",className:"gp-feedback"},n):null],footer:Ye({onClose:e,onConfirm:()=>void t(a),confirmLabel:r("stash.save"),confirmDisabled:!1,danger:!1,t:r})})}function gi(e,t){return(0,g.createElement)("div",{key:e.index,className:"gp-stash-row"},[(0,g.createElement)("div",{key:"info",className:"gp-stash-row__info"},[(0,g.createElement)("span",{key:"m",className:"gp-stash-row__msg",title:e.message},e.message),(0,g.createElement)("span",{key:"meta",className:"gp-stash-row__meta"},[e.branch!==null?(0,g.createElement)("span",{key:"b"},t.t("stash.onBranch",{branch:e.branch})):null,e.relTime!==""?(0,g.createElement)("span",{key:"t"},e.relTime):null])]),(0,g.createElement)("div",{key:"act",className:"gp-stash-row__actions"},[(0,g.createElement)("button",{key:"apply",type:"button",className:"gp-btn gp-btn--sm",disabled:t.busy,onClick:t.onApply},t.t("stash.apply")),(0,g.createElement)("button",{key:"pop",type:"button",className:"gp-btn gp-btn--sm",disabled:t.busy,onClick:t.onPop},t.t("stash.pop")),(0,g.createElement)("button",{key:"drop",type:"button",className:"gp-icon-btn",disabled:t.busy,title:t.t("stash.drop"),onClick:t.onDrop},(0,g.createElement)(sr,{size:14}))])])}function Nn(e,t){return e.path.localeCompare(t.path)}function fi(e,t){let n=e.path.split("/").pop()??e.path,r=e.path.includes("/")?e.path.slice(0,e.path.lastIndexOf("/")):"";return(0,g.createElement)("div",{key:e.path+(e.staged?":s":":w"),className:`gp-file-row${t.active?" gp-file-row--active":""}`,onClick:t.onOpen},[(0,g.createElement)("input",{key:"cb",type:"checkbox",className:"gp-check",checked:t.selected,onClick:a=>a.stopPropagation(),onChange:t.onToggle}),(0,g.createElement)("span",{key:"st",className:`gp-status-badge ${Mt(e.status)}`},Gt[e.status]??"?"),(0,g.createElement)("span",{key:"nm",className:"gp-tree-name",title:e.path},[n,r?(0,g.createElement)("span",{key:"d",style:{color:"var(--dsw-alias-label-tertiary)",marginLeft:6,fontSize:11}},r):null]),(0,g.createElement)("span",{key:"act",className:"gp-file-row__actions"},[(0,g.createElement)("button",{key:"stg",type:"button",className:"gp-icon-btn",title:e.staged?t.t("changes.unstage"):t.t("changes.stage"),disabled:t.busy,onClick:a=>{a.stopPropagation(),t.onStage()}},e.staged?"\u2212":"+"),(0,g.createElement)("button",{key:"dis",type:"button",className:"gp-icon-btn",title:t.armed?t.t("changes.discardConfirm"):t.t("changes.discard"),style:t.armed?{color:"var(--dsw-alias-state-error-primary)"}:{},disabled:t.busy,onClick:a=>{a.stopPropagation(),t.onDiscard()}},"\u21BA")])])}var m=require("react");var Ee=require("@deepseek-ai/dsh-client-ui-primitives");function Yr(e){return/\.(?:md|markdown)$/i.test(e)}function Gn(e){return/\.(?:html?|xhtml)$/i.test(e)}function mi(e){return Yr(e)||Gn(e)}var hi=256*1024,yi=5e3,Qr=5e3,Ut=20,En=12,bi=600,vi=6e4,Rn=new Map;function wi(e,t){let n=t.file.kind==="loading"?{kind:"idle"}:t.file;Rn.set(e,{state:{...t,file:n},leftAt:Date.now()})}function xi(e){let t=Rn.get(e);return t===void 0?null:Date.now()-t.leftAt>vi?(Rn.delete(e),null):t.state}function Mn({remote:e,sessionId:t,compact:n,t:r}){let a=(0,m.useRef)(void 0);a.current===void 0&&(a.current=xi(t));let i=a.current,[l,s]=(0,m.useState)(()=>i?.dirs??new Map),[o,c]=(0,m.useState)(()=>i?.open??new Set([""])),[p,u]=(0,m.useState)(()=>i?.selected??null),[f,w]=(0,m.useState)(()=>i?.file??{kind:"idle"}),[b,k]=(0,m.useState)(()=>i?.renderMarkdown??!0),[_,N]=(0,m.useState)("idle"),[A,J]=(0,m.useState)("idle"),[M,v]=(0,m.useState)(()=>i?.pane??"tree"),L=(0,m.useMemo)(()=>({code:{copyLabel:r("files.copy"),copiedLabel:r("files.copied")},footnotes:r("files.footnotes")}),[r]),P=(0,m.useRef)(0),W=ze({storageKey:"gp.files.left",initial:300,min:180,reserve:220,edge:"end"}),S=(0,m.useCallback)(H=>{s(C=>{let I=C.get(H);if(I!==void 0&&I.status!=="error")return C;let X=new Map(C);return X.set(H,{status:"loading"}),X}),e.query({sessionId:t,query:{kind:"dir-list",path:H}}).then(C=>{let I=de(C,"dir-list");s(X=>{let Q=new Map(X);return Q.set(H,I===null?{status:"error"}:{status:"ready",entries:I.entries,truncated:I.truncated}),Q})}).catch(()=>{s(C=>{let I=new Map(C);return I.set(H,{status:"error"}),I})})},[e,t]);(0,m.useEffect)(()=>{S("")},[S]);let $=(0,m.useCallback)(H=>{c(C=>{let I=new Set(C);return I.has(H)?(I.delete(H),I):(I.add(H),l.get(H)===void 0&&S(H),I)})},[l,S]),se=(0,m.useCallback)(H=>{u(H),n&&v("preview"),k(!Gn(H)),N("idle"),J("idle");let C=++P.current;w({kind:"loading",path:H}),e.query({sessionId:t,query:{kind:"file-content",path:H}}).then(I=>{if(C!==P.current)return;let X=de(I,"file-content");if(X===null){w({kind:"error",path:H});return}if(X.tooLarge===!0){w({kind:"tooLarge",path:H});return}if(X.variant==="image"&&X.dataUrl!==void 0){w({kind:"image",path:H,dataUrl:X.dataUrl});return}if(X.variant==="text"){w({kind:"text",path:H,content:X.content??"",lines:X.lines??0});return}w({kind:"binary",path:H})}).catch(()=>{C===P.current&&w({kind:"error",path:H})})},[e,t,n]),ee=(0,m.useRef)({dirs:l,open:o,selected:p,file:f,renderMarkdown:b,pane:M});ee.current={dirs:l,open:o,selected:p,file:f,renderMarkdown:b,pane:M},(0,m.useEffect)(()=>()=>{wi(t,ee.current)},[t]);let ce=(0,m.useRef)(!1);(0,m.useEffect)(()=>{ce.current||(ce.current=!0,i!==null&&i.selected!==null&&f.kind==="idle"&&se(i.selected))},[i,f.kind,se]);let ne=(0,m.useMemo)(()=>Zr("",0,{dirs:l,open:o,selected:p,toggleDir:$,selectFile:se,t:r}),[l,o,p,$,se,r]),z=async()=>{if(p===null)return;let H=P.current;try{await navigator.clipboard.writeText(p),H===P.current&&N("copied")}catch{H===P.current&&N("error")}},te=async()=>{if(f.kind!=="text")return;let H=P.current;try{await navigator.clipboard.writeText(f.content),H===P.current&&J("copied")}catch{H===P.current&&J("error")}},T=(0,m.createElement)("div",{key:"left",className:"gp-files__tree",style:n?void 0:{flex:`0 0 ${W.width}px`}},ne),pe=(0,m.createElement)("div",{key:"right",className:"gp-files__preview"},[p!==null?(0,m.createElement)("div",{key:"bar",className:"gp-files__bar"},[n?(0,m.createElement)("button",{key:"back",type:"button",className:"gp-subhead__back",onClick:()=>v("tree")},[(0,m.createElement)(We,{key:"i",size:14}),r("files.backToTree")]):null,(0,m.createElement)("code",{key:"path",className:"gp-files__path",title:p},p),f.kind==="text"&&mi(f.path)?(0,m.createElement)("div",{key:"mode",className:"gp-files__mode",role:"group","aria-label":r("files.previewMode")},[(0,m.createElement)("button",{key:"source",type:"button",className:`gp-files__mode-btn${b?"":" gp-files__mode-btn--active"}`,"aria-pressed":!b,onClick:()=>k(!1)},r("files.source")),(0,m.createElement)("button",{key:"render",type:"button",className:`gp-files__mode-btn${b?" gp-files__mode-btn--active":""}`,"aria-pressed":b,onClick:()=>k(!0)},r("files.render"))]):null,(0,m.createElement)("button",{key:"copy",type:"button",className:`gp-files__copy-path${_==="error"?" gp-files__copy-path--error":""}`,"aria-live":"polite",onClick:()=>{z()}},r(_==="copied"?"files.pathCopied":_==="error"?"files.pathCopyFailed":"files.copyPath")),f.kind==="text"?(0,m.createElement)("button",{key:"copy-content",type:"button",className:`gp-files__copy-path${A==="error"?" gp-files__copy-path--error":""}`,"aria-live":"polite",onClick:()=>{te()}},r(A==="copied"?"files.contentCopied":A==="error"?"files.contentCopyFailed":"files.copyContent")):null]):null,(0,m.createElement)("div",{key:"content",className:"gp-files__preview-content"},ki(f,b,L,r))]);return n?(0,m.createElement)("div",{className:"gp-files gp-files--compact"},M==="preview"?pe:T):(0,m.createElement)("div",{className:"gp-files"},[T,W.divider,pe])}function ki(e,t,n,r){return e.kind==="text"&&t&&Yr(e.path)?(0,m.createElement)("div",{className:"gp-files__markdown"},(0,m.createElement)(Ee.MarkdownText,{text:e.content,labels:n,variant:"body"})):e.kind==="text"&&t&&Gn(e.path)?(0,m.createElement)("iframe",{className:"gp-files__html",title:e.path,srcDoc:e.content,sandbox:"allow-scripts",referrerPolicy:"no-referrer"}):_i(e,r)}function Zr(e,t,n){let r=n.dirs.get(e);if(r===void 0||r.status==="loading")return t===0?[(0,m.createElement)("div",{key:"l",className:"gp-empty"},n.t("common.loading"))]:[(0,m.createElement)("div",{key:`l${e}`,className:"gp-tree-row gp-tree-row--muted",style:{paddingLeft:10+t*14}},n.t("common.loading"))];if(r.status==="error")return[(0,m.createElement)("div",{key:`e${e}`,className:"gp-tree-row gp-tree-row--muted",style:{paddingLeft:10+t*14}},n.t("files.loadFailed"))];let a=[];for(let i of r.entries){let l=e===""?i.name:`${e}/${i.name}`;if(i.dir){let s=n.open.has(l);a.push((0,m.createElement)("button",{key:l,type:"button",className:`gp-tree-row gp-files__entry gp-files__entry--dir${i.ignored?" gp-tree-row--ignored":""}`,style:{paddingLeft:10+t*14},"aria-expanded":s,"aria-label":i.ignored?`${i.name} (${n.t("files.ignored")})`:i.name,onClick:()=>n.toggleDir(l)},[(0,m.createElement)("span",{key:"c",className:"gp-tree-chev"},(0,m.createElement)(Pe,{size:11,open:s})),(0,m.createElement)("span",{key:"i",className:"gp-tree-ic"},(0,m.createElement)(Ee.FileTypeIcon,{kind:"folder",size:18})),(0,m.createElement)("span",{key:"n",className:"gp-tree-name"},i.name)])),s&&a.push(...Zr(l,t+1,n))}else{let s=n.selected===l;a.push((0,m.createElement)("button",{key:l,type:"button",className:`gp-tree-row gp-files__entry${s?" gp-tree-row--active":""}${i.ignored?" gp-tree-row--ignored":""}`,style:{paddingLeft:10+t*14},"aria-current":s?"true":void 0,"aria-label":i.ignored?`${i.name} (${n.t("files.ignored")})`:i.name,onClick:()=>n.selectFile(l)},[(0,m.createElement)("span",{key:"c",className:"gp-tree-chev"}),(0,m.createElement)("span",{key:"i",className:"gp-tree-ic"},(0,m.createElement)(Ee.FileTypeIcon,{path:l,size:18})),(0,m.createElement)("span",{key:"n",className:"gp-tree-name"},i.name)]))}}return r.truncated&&a.push((0,m.createElement)("div",{key:`t${e}`,className:"gp-tree-row gp-tree-row--muted",style:{paddingLeft:10+t*14}},n.t("files.truncated"))),a}function _i(e,t){switch(e.kind){case"idle":return(0,m.createElement)("div",{className:"gp-empty"},t("files.selectFile"));case"loading":return(0,m.createElement)("div",{className:"gp-empty"},t("common.loading"));case"error":return(0,m.createElement)("div",{className:"gp-empty"},t("files.loadFailed"));case"tooLarge":return(0,m.createElement)("div",{className:"gp-empty"},t("files.tooLarge"));case"binary":return(0,m.createElement)("div",{className:"gp-empty"},t("files.binary"));case"image":return(0,m.createElement)("div",{className:"gp-files__image"},(0,m.createElement)("img",{src:e.dataUrl,alt:e.path}));case"text":return(0,m.createElement)(Ci,{content:e.content,path:e.path,t})}}function Si(e,t){if(t==="")return[];let n=[];for(let r=0;r<e.length;r++)for(let[a,i]of Lt(e[r],t))if(n.push({line:r,start:a,end:i}),n.length>=Pt)return n;return n}function Ci({content:e,path:t,t:n}){let r=(0,m.useMemo)(()=>{let D=e.split(`
540
+ `);return D.length>0&&D[D.length-1]===""&&D.pop(),D},[e]),a=e.length>hi||r.length>yi,i=a?void 0:(0,Ee.languageForPath)(t),l=(0,Ee.useCodeHighlighter)(i),s=(0,m.useMemo)(()=>a?void 0:l(r.join(`
541
+ `)),[a,l,r]),[o,c]=(0,m.useState)(!1),[p,u]=(0,m.useState)(""),[f,w]=(0,m.useState)(!1),[b,k]=(0,m.useState)(0),{setEl:_,viewport:N,elRef:A}=jt(),J=(0,m.useRef)(null),M=(0,m.useRef)(null);(0,m.useEffect)(()=>{c(!1),u(""),k(0)},[t]);let v=At(p,Dt),L=(0,m.useMemo)(()=>r.map(D=>D.toLowerCase()),[r]),P=f?v:v.toLowerCase(),W=f?r:L,S=(0,m.useMemo)(()=>Si(W,P),[W,P]);(0,m.useEffect)(()=>{k(0)},[P]);let $=S.length===0?0:Math.min(b,S.length-1),se=(0,m.useMemo)(()=>{let D=new Map;for(let re of S){let me=D.get(re.line)??[];me.push([re.start,re.end]),D.set(re.line,me)}return D},[S]);(0,m.useEffect)(()=>{let D=re=>{if(!((re.ctrlKey||re.metaKey)&&(re.key==="f"||re.key==="F")))return;let me=A.current;me===null||me.offsetParent===null||(re.preventDefault(),c(!0),requestAnimationFrame(()=>J.current?.select()))};return document.addEventListener("keydown",D),()=>document.removeEventListener("keydown",D)},[]);let ee=r.length,ce=(0,m.useMemo)(()=>qt(new Array(ee).fill(Ut)),[ee]),ne=N.height>0?N.height:bi,{first:z,last:te}=Wt(ce,N.top,ne,En*Ut),T=S.length>0?S[$].line:-1,pe=T>=0?Math.min(z,Math.max(0,T-En)):z,H=T>=0?Math.max(te,Math.min(ee,T+En)):te;(0,m.useEffect)(()=>{if(T<0)return;let D=requestAnimationFrame(()=>M.current?.scrollIntoView({block:"center",inline:"nearest"}));return()=>cancelAnimationFrame(D)},[$,S,T]);let C=(0,m.useCallback)(D=>{k(re=>S.length===0?0:(re+D+S.length)%S.length)},[S.length]),I=S.length>0?S[$]:null,X=o?(0,m.createElement)(Ft,{inputRef:J,query:p,matches:S.length,active:$,caseSensitive:f,onChange:u,onToggleCase:()=>w(D=>!D),onStep:C,onClose:()=>c(!1),t:n}):null,Q=a||o?(0,m.createElement)("div",{key:"hd",className:"gp-files__header"},[a?(0,m.createElement)("div",{key:"note",className:"gp-files__note"},n("files.highlightOff")):null,X]):null,ge=[];for(let D=pe;D<H;D++)ge.push((0,m.createElement)("div",{key:D,className:"gp-files__row",style:{top:D*Ut}},[(0,m.createElement)("div",{key:"n",className:"gp-diff-no"},D+1),Ti(r[D],D,s?.[D],se.get(D),I,M,n)]));return(0,m.createElement)("div",{className:"gp-files__code gp-diff__scroll",ref:_},[Q,(0,m.createElement)("div",{key:"grid",className:"gp-files__single gp-files__single--virt",style:{height:ee*Ut}},ge)])}function Ti(e,t,n,r,a,i,l){if(e==="")return(0,m.createElement)("div",{key:`c${t}`,className:"gp-diff-cell"},"\xA0");if(e.length>Qr)return(0,m.createElement)("div",{key:`c${t}`,className:"gp-diff-cell"},[e.slice(0,Qr),(0,m.createElement)("span",{key:"trunc",className:"gp-files__trunc"},l("files.lineTruncated"))]);if(r===void 0||r.length===0)return(0,m.createElement)("div",{key:`c${t}`,className:"gp-diff-cell"},n!==void 0?n.map((o,c)=>(0,m.createElement)("span",{key:c,style:o.style},o.text)):e);let s=a!==null&&a.line===t?[a.start,a.end]:null;return(0,m.createElement)("div",{key:`c${t}`,className:"gp-diff-cell"},Ht(e,r,n,`c${t}`,s,i))}var Qt=require("react"),Ni=620;function ea(e){let[t,n]=(0,Qt.useState)(!1);return(0,Qt.useLayoutEffect)(()=>{if(e===null||typeof ResizeObserver>"u")return;let r=()=>n(e.clientWidth>0&&e.clientWidth<=Ni);r();let a=new ResizeObserver(r);return a.observe(e),()=>a.disconnect()},[e]),t}var ta="gp.panel.fontDelta";function Ei(){if(typeof localStorage>"u")return 0;let e=Number(localStorage.getItem(ta));return e===-1||e===1?e:0}function na({ctx:e,sessionId:t,t:n}){let[r,a]=(0,E.useState)(Ei),[i,l]=(0,E.useState)(null),[s,o]=(0,E.useState)(null),c=ea(s),p=Tt(t),u=st(e),f=p.state==="error"&&p.error.code==="git-unavailable",w=p.state==="error"&&(p.error.code==="not-a-git-repo"||p.error.code==="git-unavailable"),b=f&&p.state==="error"&&p.error.isGitRepo===!0,k=w?"files":i!==null&&i.sessionId===t?i.tab:null,_=(0,E.useRef)({tabs:new Set});_.current.sessionId!==t&&(_.current={sessionId:t,tabs:new Set}),k!==null&&_.current.tabs.add(k);let N=_.current.tabs.has("files");(0,E.useEffect)(()=>{if(!Me(t))return;if(w){l(null);return}if(i?.sessionId===t)return;let S=Un(t);if(S!==null){l({sessionId:t,tab:S});return}let $=Zn(t);if($!==null){l({sessionId:t,tab:$});return}p.state==="ready"&&l({sessionId:t,tab:p.snapshot.dirty?"changes":"overview"})},[t,p,w,i?.sessionId]),(0,E.useEffect)(()=>{if(Me(t))return Qn(t,S=>l({sessionId:t,tab:S}))},[t]);let A=(0,E.useRef)({tab:null});A.current={sessionId:t,tab:k},(0,E.useEffect)(()=>()=>{let{sessionId:S,tab:$}=A.current;S!==void 0&&$!==null&&Yn(S,$)},[]);let J=p.state==="ready"?p.snapshot.checkedAt:0,M=async S=>{if(!Me(t))return{ok:!1,error:n("error.noCwd")};let $=await u.run({sessionId:t,action:S});return $.ok?(lt(t).accept($.snapshot),{ok:!0}):(lt(t).resync(),{ok:!1,error:gt($.error.code,$.error.message,n)})},v=S=>{a(S),typeof localStorage<"u"&&localStorage.setItem(ta,String(S))},L=[{key:"overview",label:n("tab.overview"),icon:(0,E.createElement)(Nt,{size:14})},{key:"changes",label:n("tab.changes"),icon:(0,E.createElement)(rr,{size:14})},{key:"files",label:n("tab.files"),icon:(0,E.createElement)(dr,{size:14})}],P=w?L.filter(S=>S.key==="files"):L,W=(()=>{if(!Me(t))return(0,E.createElement)("div",{className:"gp-empty"},n("error.noCwd"));if(p.state==="no-cwd")return(0,E.createElement)("div",{className:"gp-empty"},n("error.noCwd"));if(w){let $=N?(0,E.createElement)(Mn,{key:t,remote:u,sessionId:t,compact:c,t:n}):null;return b?(0,E.createElement)("div",{className:"gp-files-wrap"},[(0,E.createElement)("div",{key:"notice",className:"gp-notice"},n("files.gitNotInstalled")),$]):(0,E.createElement)("div",{style:{display:"contents"}},$)}if(p.state==="error")return(0,E.createElement)("div",{className:"gp-empty"},n("pill.unavailable"));if(p.state==="cold"||p.state==="loading"||k===null)return(0,E.createElement)("div",{className:"gp-empty"},n("common.loading"));let S=p.snapshot;return(0,E.createElement)("div",{style:{display:"contents"}},[_.current.tabs.has("overview")?(0,E.createElement)("div",{key:"overview",style:k==="overview"?{display:"contents"}:{display:"none"}},(0,E.createElement)(Vr,{key:t,remote:u,sessionId:t,refreshKey:J,defaultDiffView:S.defaultDiffView,snapshot:S,onAction:M,onResync:()=>lt(t).resync(),compact:c,t:n})):null,_.current.tabs.has("changes")?(0,E.createElement)("div",{key:"changes",style:k==="changes"?{display:"contents"}:{display:"none"}},(0,E.createElement)(Ur,{key:t,remote:u,sessionId:t,snapshot:S,onAction:M,compact:c,t:n})):null,N?(0,E.createElement)("div",{key:"files",style:k==="files"?{display:"contents"}:{display:"none"}},(0,E.createElement)(Mn,{key:t,remote:u,sessionId:t,compact:c,t:n})):null])})();return(0,E.createElement)("div",{className:"gp-panel",ref:o,"data-conversation-composer-overlay":"","data-font-delta":r,"data-layout":c?"compact":"wide"},[(0,E.createElement)("div",{key:"tabs",className:"gp-tabbar",role:"tablist"},[...P.map(S=>(0,E.createElement)("button",{key:S.key,type:"button",role:"tab","aria-selected":k===S.key,className:`gp-tab${k===S.key?" gp-tab--active":""}`,onClick:()=>{Me(t)&&l({sessionId:t,tab:S.key})}},[(0,E.createElement)("span",{key:"i",className:"gp-tab__icon"},S.icon),(0,E.createElement)("span",{key:"l",className:"gp-tab__label"},S.label)])),(0,E.createElement)("div",{key:"trailing",className:"gp-tabbar__trailing"},[(0,E.createElement)("div",{key:"font",className:"gp-font"},[(0,E.createElement)("button",{key:"dec",type:"button",className:"gp-font__decrease",onClick:()=>v(-1),"aria-label":n("panel.fontDecrease")},"A\u2212"),(0,E.createElement)("button",{key:"reset",type:"button",className:"gp-font__reset",onClick:()=>v(0),"aria-label":n("panel.fontReset")},"A"),(0,E.createElement)("button",{key:"inc",type:"button",className:"gp-font__increase",onClick:()=>v(1),"aria-label":n("panel.fontIncrease")},"A+")]),(0,E.createElement)(Ri,{key:"ver",remote:u,t:n})])]),(0,E.createElement)("div",{key:"body",className:"gp-body"},W)])}function Ri({remote:e,t}){let[n,r]=(0,E.useState)({kind:"idle"}),{tipProps:a,tipNode:i}=Kt({placement:"below",maxWidth:300});(0,E.useEffect)(()=>{let c=!0;return e.version({}).then(p=>{c&&"current"in p&&r(u=>({...u,info:p}))}),()=>{c=!1}},[e]);let l=async()=>{r(p=>({kind:"checking",info:p.info}));let c=await e.version({check:!0});r({kind:"idle",info:"current"in c?c:void 0})},s=n.info,o=n.kind==="checking"?(0,E.createElement)("span",{className:"gp-verbar__status"},t("version.checking")):s===void 0||!s.checkedRemote?null:s.error!==void 0?(0,E.createElement)("span",{className:"gp-verbar__status gp-verbar__status--err",title:s.error},s.error==="repository is not configured"?t("version.noRepo"):t("version.error")):s.updateAvailable&&s.latest!==void 0?(0,E.createElement)("span",{},[(0,E.createElement)("span",{key:"s",className:"gp-verbar__status gp-verbar__status--new"},t("version.updateAvailable",{latest:s.latest,current:s.current})),s.releaseUrl!==void 0?(0,E.createElement)("a",{key:"l",className:"gp-verbar__link",href:s.releaseUrl,target:"_blank",rel:"noreferrer",style:{marginLeft:8}},t("version.viewRelease")):null]):(0,E.createElement)("span",{className:"gp-verbar__status gp-verbar__status--ok"},t("version.upToDate",{current:s.current}));return(0,E.createElement)("div",{className:"gp-verbar"},[s!==void 0?(0,E.createElement)("span",{key:"tag",className:"gp-verbar__tag"},`v${s.current}`):null,o,(0,E.createElement)("button",{key:"btn",type:"button",className:"gp-verbar__btn",disabled:n.kind==="checking",onClick:()=>void l()},[(0,E.createElement)("span",{key:"i",className:"gp-tab__icon"},(0,E.createElement)(Et,{size:12})),t("version.check")]),s?.repositoryUrl!==void 0?(0,E.createElement)("a",{key:"gh",className:"gp-icon-btn gp-verbar__gh gp-verbar__gh--starred",href:s.repositoryUrl,target:"_blank",rel:"noreferrer","aria-label":t("version.openRepo"),...a(t("version.openRepo"))},(0,E.createElement)(gr,{size:15})):null,i])}var oe=require("react"),oa=require("react-dom");var ra="data-gp-tab-dot",tt,Pn=null,aa="",Zt=null,Yt;function Gi(e){if(typeof document>"u")return null;let t=document.querySelectorAll(pt);for(let n of t)if((n.textContent??"").trim()===e)return n;return null}function Dn(){let e=Gi(aa);if(e===null)return;let t=e.querySelector(`[${ra}]`);if(Zt===null){t?.remove();return}let n=`gp-tab-dot gp-tab-dot--${Zt}`;if(t!==null){t.className!==n&&(t.className=n);return}let r=document.createElement("span");r.className=n,r.setAttribute(ra,""),r.setAttribute("aria-hidden","true"),e.appendChild(r)}function Mi(){if(typeof document>"u"||typeof MutationObserver>"u")return;let e=document.querySelector(Wn);if(e!==Pn){if(tt?.disconnect(),Pn=e,e===null){tt=void 0;return}tt=new MutationObserver(()=>Dn()),tt.observe(e,{childList:!0,subtree:!0})}}function Pi(){tt?.disconnect(),tt=void 0,Pn=null}function ia(e,t,n){if(!(typeof document>"u")){if(n===null){An(e);return}Yt=e,aa=t,Zt=n,Mi(),Dn()}}function An(e){Yt!==void 0&&Yt!==e||(Yt=void 0,Zt=null,Dn(),Pi())}function Di(e){let t=e.replace(/[/\\]+$/,"").split(/[/\\]/);return t[t.length-1]||e}function Ai(){let[e,t]=(0,oe.useState)(!1),[n,r]=(0,oe.useState)(null),a=(0,oe.useRef)(null);return(0,oe.useLayoutEffect)(()=>{if(!e||a.current===null){r(null);return}let s=a.current.getBoundingClientRect();r({left:s.left,bottom:window.innerHeight-s.top+8})},[e]),{bind:{ref:s=>{a.current=s},onMouseEnter:()=>t(!0),onMouseLeave:()=>t(!1)},render:s=>!e||n===null||typeof document>"u"?null:(0,oa.createPortal)((0,oe.createElement)("div",{className:"gp-tip",style:{left:n.left,bottom:n.bottom}},s.map((o,c)=>(0,oe.createElement)("div",{key:c,className:c===0?"gp-tip__path":"gp-tip__note"},o))),document.body)}}function Li(e){let[t,n]=(0,oe.useState)(!1);return(0,oe.useEffect)(()=>{if(e===null||typeof ResizeObserver>"u")return;let a=e.closest("[data-conversation-region]")??document.body,i=()=>n(a.clientWidth>0&&a.clientWidth<Hi);i();let l=new ResizeObserver(i);return l.observe(a),()=>l.disconnect()},[e]),t}var Hi=620;function sa({sessionId:e,t}){let n=Tt(e),r=Ai(),[a,i]=(0,oe.useState)(null),l=Li(a),s=(0,oe.useRef)(Symbol("gp-tab-dot")),o=n.state==="ready"&&n.snapshot.showInputPill===!1?n.snapshot.dirty?"dirty":"synced":null,c=t("panel.tab");if((0,oe.useEffect)(()=>{ia(s.current,c,o);let _=s.current;return()=>{An(_)}},[c,o]),n.state==="cold"||n.state==="loading"||n.state==="no-cwd")return null;if(n.state==="error")return n.error.code==="not-a-git-repo"||n.error.code==="git-unavailable"||n.error.showInputPill===!1?null:(0,oe.createElement)("span",{className:"gp-pill gp-pill--degraded",title:n.error.detail??t("pill.unavailable")},t("pill.unavailable"));let p=n.snapshot;if(p.showInputPill===!1)return null;let u=Di(p.root),f=p.branch??`(${t("pill.detached")})`,w=p.dirty,b=w?"gp-pill--dirty":"gp-pill--synced",k=()=>{if(tr(c)){nr(c);return}Me(e)&&jn(e,w?"changes":"overview"),er(c)};return(0,oe.createElement)("span",{className:"gp-pill-wrap",ref:i},[(0,oe.createElement)("button",{key:"btn",type:"button",className:`gp-pill ${b}${l?" gp-pill--compact":""}`,onClick:k,ref:r.bind.ref,onMouseEnter:r.bind.onMouseEnter,onMouseLeave:r.bind.onMouseLeave},[(0,oe.createElement)("span",{key:"dot",className:"gp-pill__dot","aria-hidden":"true"}),(0,oe.createElement)("span",{key:"repo",className:"gp-pill__repo"},u),(0,oe.createElement)("span",{key:"git",className:"gp-pill__git"},["(",(0,oe.createElement)("span",{key:"b",className:"gp-pill__branch"},f),")"])]),r.render([p.root,t(w?"pill.dirty":"pill.synced")])])}var O=require("react");function Fi(e){for(let t of e){let n=t.schema?.dict;if(n!==void 0&&"showInputPill"in n||JSON.stringify(t.schema).includes("showInputPill"))return t.ns}}function la({ctx:e,t}){let[,n]=(0,O.useState)(0),[r,a]=(0,O.useState)(!1),[i,l]=(0,O.useState)(!1),[s,o]=(0,O.useState)(null),[c,p]=(0,O.useState)(null),[u,f]=(0,O.useState)(null),[w,b]=(0,O.useState)(null),k=()=>{n(T=>T+1)},_=e.get("configForms"),N=(0,O.useMemo)(()=>_?.describe(),[_]);(0,O.useEffect)(()=>{if(N!==void 0)return N.ensure(),N.subscribe(k)},[N]);let A=N?.getSnapshot().view,J=(0,O.useMemo)(()=>A===void 0?void 0:Fi(A.namespaces),[A]),M=(0,O.useMemo)(()=>_!==void 0&&J!==void 0?_.get(J):void 0,[_,J]);(0,O.useEffect)(()=>{if(M!==void 0)return M.subscribe(k)},[M]);let v=M?.getSnapshot(),L=M!==void 0&&v!==void 0&&v.status==="ready",P=N?.getSnapshot().status,W=s??(typeof v?.value?.showInputPill=="boolean"?v.value.showInputPill:!0),S=c??(v?.value?.defaultDiffView==="split"?"split":"unified"),$=u??(v?.value?.graphStyle==="compact"?"compact":"parallel"),se=w??(typeof v?.value?.suggestEnabled=="boolean"?v.value.suggestEnabled:!0),ee=async(T,pe,H)=>{if(M!==void 0){l(!1),a(!0);try{let C=await M.set(T,pe);H(),C?(dt(),setTimeout(()=>dt(),1e3)):l(!0)}catch{H(),l(!0)}finally{a(!1)}}},ce=T=>(o(T),ee("showInputPill",T,()=>o(null))),ne=T=>T===S?Promise.resolve():(p(T),ee("defaultDiffView",T,()=>p(null))),z=T=>T===$?Promise.resolve():(f(T),ee("graphStyle",T,()=>f(null))),te=T=>(b(T),ee("suggestEnabled",T,()=>b(null)));return _===void 0?(0,O.createElement)("p",{className:"gp-cfg__hint"},t("cfg.notLoaded")):L?(0,O.createElement)("div",{className:"gp-cfg"},[(0,O.createElement)("h3",{key:"title",className:"gp-cfg__title"},t("cfg.title")),(0,O.createElement)("label",{key:"row",className:"gp-cfg__row"},[(0,O.createElement)("input",{key:"switch",type:"checkbox",role:"switch",className:"gp-cfg__switch",checked:W,disabled:r||v?.writable===!1,onChange:T=>{ce(T.currentTarget.checked)}}),(0,O.createElement)("span",{key:"text",className:"gp-cfg__text"},t("cfg.toggle"))]),(0,O.createElement)("p",{key:"hint",className:"gp-cfg__hint"},t("cfg.hint")),(0,O.createElement)("h3",{key:"difftitle",className:"gp-cfg__title",style:{marginTop:6}},t("cfg.diffTitle")),(0,O.createElement)("div",{key:"diffseg",className:"gp-seg gp-cfg__seg"},$e(["unified","split"],S,T=>{ne(T)},T=>t(T==="unified"?"cfg.diffUnified":"cfg.diffSplit"),r||v?.writable===!1)),(0,O.createElement)("p",{key:"diffhint",className:"gp-cfg__hint"},t("cfg.diffHint")),(0,O.createElement)("h3",{key:"graphtitle",className:"gp-cfg__title",style:{marginTop:6}},t("cfg.graphTitle")),(0,O.createElement)("div",{key:"graphseg",className:"gp-seg gp-cfg__seg"},$e(["parallel","compact"],$,T=>{z(T)},T=>t(T==="parallel"?"cfg.graphParallel":"cfg.graphCompact"),r||v?.writable===!1)),(0,O.createElement)("p",{key:"graphhint",className:"gp-cfg__hint"},t("cfg.graphHint")),(0,O.createElement)("h3",{key:"sgtitle",className:"gp-cfg__title",style:{marginTop:6}},t("cfg.suggestTitle")),(0,O.createElement)("label",{key:"sgrow",className:"gp-cfg__row"},[(0,O.createElement)("input",{key:"switch",type:"checkbox",role:"switch",className:"gp-cfg__switch",checked:se,disabled:r||v?.writable===!1,onChange:T=>{te(T.currentTarget.checked)}}),(0,O.createElement)("span",{key:"text",className:"gp-cfg__text"},t("cfg.suggestToggle"))]),(0,O.createElement)("p",{key:"sghint",className:"gp-cfg__hint"},t("cfg.suggestHint")),i?(0,O.createElement)("p",{key:"error",className:"gp-cfg__err",role:"alert"},t("cfg.saveFailed")):null]):P==="idle"||P==="loading"?(0,O.createElement)("p",{className:"gp-cfg__hint"},t("common.loading")):(0,O.createElement)("p",{className:"gp-cfg__hint"},t("cfg.notLoaded"))}var ft="gitPanel",zi=["dsh-git-panel","@xbzbing/dsh-git-panel"],$i=["slots","locale","connection"],Ii="dsh-git-panel";function Bi(e){Bn(),On(e),e.effect(()=>e.locale.register(ft,{zh:Xn,en:Jn})??void 0,"dsh-git-panel: dictionaries");let t=e.locale.bind(ft),n=[],r=a=>{typeof a=="function"&&n.push(a)};r(e.slots.inject("conversation.view",()=>e.slots.register({name:"conversation.view",id:"git-panel",order:30,locale:ft,label:()=>t("panel.tab")},a=>(0,en.createElement)(na,{ctx:e,sessionId:a.sessionId,t})))),r(e.slots.inject("conversation.input.left",()=>e.slots.register({name:"conversation.input.left",id:"git-panel-pill",order:100,locale:ft},a=>(0,en.createElement)(sa,{sessionId:a.sessionId,t}))));for(let a of zi)r(e.slots.inject("plugins.bundle.config",()=>e.slots.register({name:"plugins.bundle.config",key:a,locale:ft},i=>i.view==="summary"?t("cfg.title"):(0,en.createElement)(la,{ctx:e,t}))));e.effect(()=>{let a=e.on("connection/reset",()=>dt());return()=>{typeof a=="function"&&a();for(let i of n.splice(0))try{i()}catch{}qn()}},"dsh-git-panel: lifecycle")}module.exports={name:Ii,inject:$i,apply:Bi};
541
542
  return module.exports;
542
543
  } });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xbzbing/dsh-git-panel",
3
- "version": "1.5.2",
3
+ "version": "1.5.3",
4
4
  "description": "DeepSeek Harness (dsh) plugin: an IDE-style Git panel in the Web GUI — branch/history overview, uncommitted changes with commit & amend, diff stats, and a zsh-style branch marker in the input bar.",
5
5
  "type": "module",
6
6
  "license": "MIT",