dsh-git-desk 0.22.0 → 0.23.0
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.
- package/README.md +3 -1
- package/client.js +11 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -30,13 +30,14 @@ The tab is not a global panel. It does not sit above the Workspace session list.
|
|
|
30
30
|
|
|
31
31
|
- **Repositories.** Every repository in the workspace is listed. The header picker scopes the whole panel, including its remote, branches, and sync. When the workspace has no repository, the panel offers to initialize one.
|
|
32
32
|
- **Changes.** Conflicts, Staged, and Unstaged groups. A file with both kinds appears in both groups with `↕`.
|
|
33
|
+
- **Multi-select.** Cmd-click on macOS, or Ctrl-click elsewhere, toggles files; Shift-click selects a contiguous range in one section. Ctrl/Cmd+Space and Shift+Space do the same from the keyboard. At two or more selected files a bar above the list shows the count and stages, unstages, or discards the whole selection in one request. A plain click still opens one diff, conflicts cannot join a batch, and a successful action clears the batch. In the compact layout a modifier click keeps the list on screen so the bar stays reachable.
|
|
33
34
|
- **Bulk staging.** Each section header has one icon for the whole section. The plus stages every unstaged file, the minus unstages every staged file, both in a single request. The tooltip names the action. Conflicted files are excluded until they are resolved. A rename sends both of its paths, so the section empties completely.
|
|
34
35
|
- **Full-file diff.** Both sides show the entire file, line 1 to the last line. No unchanged runs are collapsed.
|
|
35
36
|
- **Change navigation.** The toolbar shows which change you are reading and how many the file has. The arrows jump to the previous or next change and keep both sides aligned.
|
|
36
37
|
- **Tooltips.** Every icon-only control shows a native tooltip with the same text as its accessible name, so the sync, layout, and staging icons read without guessing.
|
|
37
38
|
- **Two comparisons.** Staged compares `HEAD` to `Staged` with one arrow per block. Unstaged compares `Staged` to `Local` with two arrows per block.
|
|
38
39
|
- **Block actions.** Left arrow stages a local block. Right arrow in the unstaged diff reverts the block to the staged version after confirmation. Right arrow in the staged diff unstages the block.
|
|
39
|
-
- **Discard.** The trash control in the diff header restores the selected file to the last commit, or deletes it when it is untracked, after a confirmation. This cannot be undone.
|
|
40
|
+
- **Discard.** The trash control in the diff header restores the selected file to the last commit, or deletes it when it is untracked, after a confirmation. This cannot be undone. A batch discard names every path in one confirmation and sends one request.
|
|
40
41
|
- **Commit.** Message, amend toggle, skip hooks toggle, and commit button. The button is disabled until something is staged and no conflict remains. Skip hooks commits with `--no-verify` when a hook is broken.
|
|
41
42
|
- **AI commit actions.** The sparkle button next to Commit offers two actions. **Write a commit message** reads the staged patch and fills the message field. **Create a branch and commit** generates the message, derives the branch name, and opens the branch dialog for confirmation. Both use the model selected in Settings and run only when you click them.
|
|
42
43
|
- **Branches.** The header menu searches local and remote branches, switches local branches, and creates a branch from `HEAD` without a commit. Choosing a remote branch creates a local tracking branch. The commit box still offers **Branch** for create-and-commit.
|
|
@@ -74,6 +75,7 @@ Details, endpoint table, and verification are in [`docs/implementation.md`](docs
|
|
|
74
75
|
|
|
75
76
|
- The tab uses the current session's workspace path. A per-session `workingDirectory` override or a DSH worktree outside the workspace is not followed.
|
|
76
77
|
- Stash is file-level. Hunk-level stash is not implemented.
|
|
78
|
+
- Multi-select has no arrow-key navigation. Tab reaches each row, Ctrl/Cmd+Space toggles a row, and Shift+Space extends the range.
|
|
77
79
|
- Discard has no undo. It is refused for a conflicted file, while another operation is in progress, and for a rename whose old path holds another file. An untracked nested repository is not deleted.
|
|
78
80
|
- Commit messages and branch names are not generated by a model.
|
|
79
81
|
- Conflict resolution is whole-side plus the marker view. There is no three-pane editor.
|
package/client.js
CHANGED
|
@@ -3,7 +3,7 @@ window.__ModuleLoader__.load({
|
|
|
3
3
|
factory(require) {
|
|
4
4
|
var module = { exports: {} };
|
|
5
5
|
var exports = module.exports;
|
|
6
|
-
"use strict";var Ei=Object.create;var Ze=Object.defineProperty;var Di=Object.getOwnPropertyDescriptor;var zi=Object.getOwnPropertyNames;var Ai=Object.getPrototypeOf,Li=Object.prototype.hasOwnProperty;var Bi=(t,i)=>{for(var a in i)Ze(t,a,{get:i[a],enumerable:!0})},Bt=(t,i,a,n)=>{if(i&&typeof i=="object"||typeof i=="function")for(let r of zi(i))!Li.call(t,r)&&r!==a&&Ze(t,r,{get:()=>i[r],enumerable:!(n=Di(i,r))||n.enumerable});return t};var Ii=(t,i,a)=>(a=t!=null?Ei(Ai(t)):{},Bt(i||!t||!t.__esModule?Ze(a,"default",{value:t,enumerable:!0}):a,t)),Fi=t=>Bt(Ze({},"__esModule",{value:!0}),t);var Hn={};Bi(Hn,{apply:()=>Tn,inject:()=>Sn});module.exports=Fi(Hn);var te=Ii(require("react"),1),e=te.default.createElement,{useState:k,useEffect:A,useRef:I,useMemo:Re,useCallback:et}=te.default,gt=class extends Error{code;details;constructor(i,a,n){super(a),this.name="GitCallError",this.code=i,this.details=n}};function It(t){if(!(t instanceof Error)||!("code"in t))return;let{code:i}=t;return typeof i=="string"?i:void 0}function X(t){return t instanceof Error?t:new Error(String(t))}var He="git",dt="dsh-git",Oi="dsh-resource://file/session/",ji=t=>t.startsWith("/")||/^[A-Za-z]:[/\\]/.test(t)||t.startsWith("\\\\"),$i=t=>t.replace(/\\/g,"/").replace(/^(?:\.\/)+/,"").split("/").map(i=>encodeURIComponent(i)).join("/"),Qe=(t,i)=>`${Oi}${encodeURIComponent(t)}/${$i(i)}`;function Wi(t,i,a){let n=a.replace(/\\/g,"/");if(!ji(n))return Qe(t,n);let r=i===void 0?"":i.replace(/\\/g,"/").replace(/\/+$/,"");return r!==""&&n===r?Qe(t,""):r!==""&&n.startsWith(`${r}/`)?Qe(t,n.slice(r.length+1)):Qe(t,n)}function Gi(t){let i=t?.rows??[],a=i.findIndex(n=>n.k!=="ctx");if(a<0)return 1;for(let n=a;n<i.length;n+=1){let r=i[n];if(r!==void 0&&r.r!==null)return r.r}return 1}var Vi={panel:"Git","mode.changes":"Changes","mode.log":"History","mode.stash":"Stashes","guide.title":"Git changes","guide.description":"Review, stage, commit, and sync the workspace repository.","section.conflicts":"Conflicts","section.staged":"Staged","section.unstaged":"Unstaged","section.stagedCount":"{count} staged","section.unstagedCount":"{count} changed","section.conflictCount":"{count} unresolved","empty.noChanges":"No changes","empty.noChangesHint":"The working tree matches the last commit.","empty.selectFile":"Select a file to review it","empty.selectFileHint":"The full file is shown on both sides. Nothing is collapsed.","empty.noRepo":"Not a Git repository","empty.noRepoHint":"This workspace is not a repository yet.","empty.init":"Initialize repository","empty.noWorkspace":"No workspace is open","empty.noWorkspaceHint":"Open a workspace, then return to Git.","empty.noHistory":"No commits yet","empty.noHistoryHint":"The first commit will appear here.","empty.noStashes":"No stashes","empty.noStashesHint":"Park work here before switching tasks.","action.stageFile":"Stage file","action.unstageFile":"Unstage file","action.stageAll":"Stage all","action.unstageAll":"Unstage all","ai.action":"AI actions","ai.write":"Write a commit message","ai.branch":"Create a branch and commit","ai.written":"Message written with {model}","action.stageBlock":"Stage block","action.unstageBlock":"Unstage block","action.revertBlock":"Revert block to the staged version","action.refresh":"Refresh","action.back":"Back to changes","action.openEditor":"Open in editor","action.prevChange":"Previous change","action.nextChange":"Next change","action.close":"Close","action.cancel":"Cancel","action.confirm":"Confirm","action.commit":"Commit","action.committing":"Committing","action.branch":"Branch","action.createBranch":"Create branch and commit","action.checkout":"Checkout","action.fetch":"Fetch","action.pull":"Pull","action.push":"Push","action.apply":"Apply","action.pop":"Pop","action.drop":"Drop","action.stash":"Stash changes","action.discard":"Discard changes","action.acceptOurs":"Accept ours","action.acceptTheirs":"Accept theirs","action.retry":"Retry","action.init":"Initialize","action.newBranch":"New branch","action.createAndSwitch":"Create and switch","repo.title":"Repositories","repo.current":"Current repository","repo.workspace":"Workspace folder","repo.pick":"Switch repository","repo.none":"No repository found","repo.initRoot":"New repository at the workspace root","repo.initRootTitle":"Initialize at the workspace root?","repo.initRootBody":"The workspace contains {count} repositories. A repository at the workspace root treats each of them as an untracked folder. Pick one of the repositories instead.","repo.initRootConfirm":"Initialize anyway","repo.worktree":"Worktree","action.revert":"Revert block","diff.split":"Split","diff.unified":"Unified","diff.head":"HEAD","diff.staged":"Staged","diff.local":"Local","diff.parent":"Parent","diff.commit":"Commit","diff.binary":"Binary file changed","diff.binaryHint":"{before} to {after}","diff.conflictBanner":"This file has unresolved conflicts. Commit is blocked until you resolve it.","diff.loading":"Loading diff","diff.noChanges":"No changes in this file","diff.fullFile":"Full file","diff.layout":"Diff layout","diff.changes":"Changes in this file","diff.lines":"{count} lines","commit.placeholder":"Describe the change","commit.hintStage":"Stage a file to commit.","commit.hintConflict":"Resolve conflicts before committing.","commit.hintMessage":"Write a commit message.","commit.done":"Committed {hash}","commit.amend":"Amend last commit","commit.noVerify":"Skip hooks","commit.noVerifyHint":"Commit without running Git hooks.","branch.title":"Branch and commit","branch.name":"Branch name","branch.nameHint":"Created from the current HEAD, then the staged changes are committed.","branch.message":"Commit message","branch.created":"Created {branch} and committed","branch.current":"Current branch","branch.local":"Local branches","branch.loading":"Loading branches","branch.none":"No branches","branch.new":"New branch","branch.newTitle":"New branch","branch.newHint":"Created from the current HEAD and checked out. No commit is made.","branch.search":"Search branches","branch.remote":"Remote branches","branch.inWorktree":"Checked out in another worktree","branch.createdOnly":"Created {branch}","branch.noneMatch":"No branch matches","stash.title":"Stash changes","stash.message":"Stash message","stash.select":"Files to stash","stash.selectHint":"Only the selected files are stashed. Untracked files are included.","stash.default":"WIP","stash.nothing":"No files to stash.","stash.created":"Stashed {count} files","stash.applied":"Applied {ref}","stash.popped":"Popped {ref}","stash.dropped":"Dropped {ref}","stash.dropTitle":"Drop stash","stash.dropBody":"This deletes {ref} permanently. The changes are not applied.","discard.title":"Discard changes?","discard.body":"Every local change in {path} is lost. This cannot be undone.","discard.deleteTitle":"Delete untracked file?","discard.deleteBody":"{path} is untracked. The file is removed from disk. This cannot be undone.","discard.confirm":"Discard changes","discard.deleteConfirm":"Delete file","discard.done":"Discarded changes in {name}","discard.deleted":"Deleted {name}","sync.fetched":"Fetched","sync.pulled":"Pulled","sync.pulledStashed":"Pulled and restored local changes","sync.pulledStashConflict":"Pulled, but some local changes could not be restored. The stash is kept in Stashes.","sync.pushed":"Pushed","sync.ahead":"{count} ahead","sync.behind":"{count} behind","sync.noUpstream":"This branch has no upstream. Push sets one.","sync.none":"Up to date","log.title":"History","log.loading":"Loading history","log.select":"Select a commit","log.files":"Changed files","log.noFiles":"No file changes","log.author":"Author","log.date":"Date","log.parent":"Parent","log.message":"Message","history.actions":"Commit actions","history.copy":"Copy commit hash","history.undo":"Undo last commit","history.undoHint":"Moves HEAD back and keeps the change staged.","history.revert":"Revert commit","history.revertHint":"Stages the inverse change with a revert message.","history.cherryPick":"Cherry-pick commit","history.cherryPickHint":"Applies the commit here and commits it.","history.reset":"Reset branch to here","history.resetHint":"Moves this branch to the selected commit.","history.blockedOperation":"Finish the current operation first.","history.blockedNotHead":"Only the last commit can be undone.","history.blockedDetached":"Check out a branch first.","history.blockedNoParent":"The first commit cannot be undone.","history.blockedPushed":"This commit is already on the upstream branch. Revert it instead.","history.blockedMerge":"Merge commits are not supported here.","history.blockedStaged":"Commit or unstage the staged files first.","history.blockedContained":"Already in this branch.","history.blockedConflict":"Resolve the conflicts first.","history.undoTitle":"Undo the last commit?","history.undoBody":"The commit leaves the branch and its changes stay staged, so you can edit and commit again.","history.undoAction":"Undo commit","history.revertTitle":"Revert this commit?","history.revertBody":"A new set of changes that reverses this commit is staged with a generated message. The commit stays in history.","history.revertAction":"Revert commit","history.resetTitle":"Reset this branch?","history.resetBody":"This branch moves to {hash}. Choose what happens to the changes after it.","history.resetModeSoft":"Soft","history.resetModeSoftHint":"Keep the changes staged for a new commit.","history.resetModeMixed":"Mixed","history.resetModeMixedHint":"Keep the changes in the working tree, unstaged.","history.resetModeHard":"Hard","history.resetModeHardHint":"Discard the commits and their changes.","history.resetHardWarning":"Hard reset discards every local change after this commit. This cannot be undone.","history.resetAction":"Reset branch","history.undone":"Commit undone. Changes are staged.","history.reverted":"Revert ready. Review it, then commit.","history.revertConflicts":"Revert stopped with conflicts. Resolve them, then commit.","history.picked":"Cherry-picked as {hash}","history.resetDone":"Branch reset to {hash}","status.loading":"Reading repository","status.detached":"Detached HEAD","error.title":"Git action failed","error.notInstalled":"Git is not installed","error.notInstalledHint":"Install Git and make it available on PATH, then refresh.","confirm.revertTitle":"Revert this block?","confirm.revertBody":"The local block is replaced by the staged version. This working tree change is lost.","confirm.checkoutTitle":"Switch branch?","confirm.checkoutBody":"Local changes are carried over when Git can keep them, otherwise the checkout is refused.","confirm.yesRevert":"Revert block","confirm.yesCheckout":"Switch branch","meta.binary":"binary","meta.blocks":"{count} blocks","meta.add":"{count} added","meta.del":"{count} deleted","filter.placeholder":"Filter files","filter.clear":"Clear filter","meta.partial":"partial","meta.partialHint":"Some changes in this file are staged","commit.stagedSummary":"{count} staged","commit.shortcut":"{key}+Enter to commit","diff.added":"Added","diff.removed":"Removed","diff.blockCount":"{count} changes","diff.blockCountOne":"1 change","stash.applyHint":"Apply the changes and keep the stash","stash.popHint":"Apply the changes and delete the stash","stash.dropHint":"Delete the stash","filter.empty":'No files match "{filter}"',"action.copyHash":"Copy commit hash","action.copied":"Copied!","diff.unstaged":"Unstaged","stash.selectAll":"Select all","stash.deselectAll":"Deselect all","header.label":"Git panel","settings.section":"Git","settings.model":"AI model","settings.modelHint":"Used by the commit message actions. The default follows the Composer selection, including later changes.","settings.modelSame":"Same as Composer","settings.modelEmpty":"No models are available in this build.","settings.modelFailed":"The model list could not be read.","settings.instruction":"Commit instructions","settings.instructionHint":"These lines shape the wording. The title line type(scope): summary stays required; a short body is welcome.","settings.instructionReset":"Restore default","settings.instructionFailed":"The default instructions could not be read.","command.toggle":"Open or collapse the Git panel","command.commit":"Commit staged changes","command.writeMessage":"Write the commit message with AI","command.stageAll":"Stage all changes","command.openFirst":"Open the Git panel first","command.nothingToStage":"No changed files to stage","command.notReady":"Stage a file and write a message first","split.files":"Resize the file list","split.commits":"Resize the commit list"},Ui={panel:"Git","mode.changes":"\u66F4\u6539","mode.log":"\u5386\u53F2","mode.stash":"\u8D2E\u85CF","guide.title":"Git \u66F4\u6539","guide.description":"\u67E5\u770B\u3001\u6682\u5B58\u3001\u63D0\u4EA4\u5E76\u540C\u6B65\u5DE5\u4F5C\u533A\u4ED3\u5E93\u3002","section.conflicts":"\u51B2\u7A81","section.staged":"\u5DF2\u6682\u5B58","section.unstaged":"\u672A\u6682\u5B58","section.stagedCount":"\u5DF2\u6682\u5B58 {count}","section.unstagedCount":"\u5DF2\u66F4\u6539 {count}","section.conflictCount":"\u672A\u89E3\u51B3 {count}","empty.noChanges":"\u6CA1\u6709\u66F4\u6539","empty.noChangesHint":"\u5DE5\u4F5C\u533A\u4E0E\u6700\u8FD1\u4E00\u6B21\u63D0\u4EA4\u4E00\u81F4\u3002","empty.selectFile":"\u9009\u62E9\u4E00\u4E2A\u6587\u4EF6\u67E5\u770B\u66F4\u6539","empty.selectFileHint":"\u4E24\u4FA7\u90FD\u663E\u793A\u5B8C\u6574\u6587\u4EF6\uFF0C\u4E0D\u4F1A\u6298\u53E0\u3002","empty.noRepo":"\u4E0D\u662F Git \u4ED3\u5E93","empty.noRepoHint":"\u5F53\u524D\u5DE5\u4F5C\u533A\u8FD8\u4E0D\u662F\u4ED3\u5E93\u3002","empty.init":"\u521D\u59CB\u5316\u4ED3\u5E93","empty.noWorkspace":"\u6CA1\u6709\u6253\u5F00\u7684\u5DE5\u4F5C\u533A","empty.noWorkspaceHint":"\u6253\u5F00\u4E00\u4E2A\u5DE5\u4F5C\u533A\uFF0C\u7136\u540E\u56DE\u5230 Git\u3002","empty.noHistory":"\u8FD8\u6CA1\u6709\u63D0\u4EA4","empty.noHistoryHint":"\u7B2C\u4E00\u6B21\u63D0\u4EA4\u4F1A\u51FA\u73B0\u5728\u8FD9\u91CC\u3002","empty.noStashes":"\u6CA1\u6709\u8D2E\u85CF","empty.noStashesHint":"\u5207\u6362\u4EFB\u52A1\u524D\u53EF\u4EE5\u628A\u5DE5\u4F5C\u653E\u5728\u8FD9\u91CC\u3002","action.stageFile":"\u6682\u5B58\u6587\u4EF6","action.unstageFile":"\u53D6\u6D88\u6682\u5B58\u6587\u4EF6","action.stageAll":"\u5168\u90E8\u6682\u5B58","action.unstageAll":"\u5168\u90E8\u53D6\u6D88\u6682\u5B58","ai.action":"AI \u64CD\u4F5C","ai.write":"\u751F\u6210\u63D0\u4EA4\u4FE1\u606F","ai.branch":"\u521B\u5EFA\u5206\u652F\u5E76\u63D0\u4EA4","ai.written":"\u5DF2\u7531 {model} \u751F\u6210\u63D0\u4EA4\u4FE1\u606F","action.stageBlock":"\u6682\u5B58\u533A\u5757","action.unstageBlock":"\u53D6\u6D88\u6682\u5B58\u533A\u5757","action.revertBlock":"\u5C06\u533A\u5757\u8FD8\u539F\u4E3A\u5DF2\u6682\u5B58\u7248\u672C","action.refresh":"\u5237\u65B0","action.back":"\u8FD4\u56DE\u66F4\u6539","action.openEditor":"\u5728\u7F16\u8F91\u5668\u4E2D\u6253\u5F00","action.prevChange":"\u4E0A\u4E00\u4E2A\u66F4\u6539","action.nextChange":"\u4E0B\u4E00\u4E2A\u66F4\u6539","action.close":"\u5173\u95ED","action.cancel":"\u53D6\u6D88","action.confirm":"\u786E\u8BA4","action.commit":"\u63D0\u4EA4","action.committing":"\u6B63\u5728\u63D0\u4EA4","action.branch":"\u5206\u652F","action.createBranch":"\u521B\u5EFA\u5206\u652F\u5E76\u63D0\u4EA4","action.checkout":"\u5207\u6362","action.fetch":"\u83B7\u53D6","action.pull":"\u62C9\u53D6","action.push":"\u63A8\u9001","action.apply":"\u5E94\u7528","action.pop":"\u5F39\u51FA","action.drop":"\u5220\u9664","action.stash":"\u8D2E\u85CF\u66F4\u6539","action.discard":"\u4E22\u5F03\u66F4\u6539","action.acceptOurs":"\u91C7\u7528\u672C\u5730","action.acceptTheirs":"\u91C7\u7528\u8FDC\u7AEF","action.retry":"\u91CD\u8BD5","action.init":"\u521D\u59CB\u5316","action.newBranch":"\u65B0\u5EFA\u5206\u652F","action.createAndSwitch":"\u521B\u5EFA\u5E76\u5207\u6362","repo.title":"\u4ED3\u5E93","repo.current":"\u5F53\u524D\u4ED3\u5E93","repo.workspace":"\u5DE5\u4F5C\u533A\u76EE\u5F55","repo.pick":"\u5207\u6362\u4ED3\u5E93","repo.none":"\u672A\u627E\u5230\u4ED3\u5E93","repo.initRoot":"\u5728\u5DE5\u4F5C\u533A\u6839\u76EE\u5F55\u65B0\u5EFA\u4ED3\u5E93","repo.initRootTitle":"\u5728\u6839\u76EE\u5F55\u521D\u59CB\u5316\uFF1F","repo.initRootBody":"\u5DE5\u4F5C\u533A\u5305\u542B {count} \u4E2A\u4ED3\u5E93\u3002\u5728\u6839\u76EE\u5F55\u521D\u59CB\u5316\u4F1A\u628A\u5B83\u4EEC\u5F53\u6210\u672A\u8DDF\u8E2A\u76EE\u5F55\u3002\u8BF7\u6539\u7528\u4ED3\u5E93\u9009\u62E9\u5668\u3002","repo.initRootConfirm":"\u4ECD\u8981\u521D\u59CB\u5316","repo.worktree":"\u5DE5\u4F5C\u6811","action.revert":"\u8FD8\u539F\u533A\u5757","diff.split":"\u5E76\u6392","diff.unified":"\u7EDF\u4E00","diff.head":"HEAD","diff.staged":"\u5DF2\u6682\u5B58","diff.local":"\u672C\u5730","diff.parent":"\u7236\u63D0\u4EA4","diff.commit":"\u63D0\u4EA4","diff.binary":"\u4E8C\u8FDB\u5236\u6587\u4EF6\u5DF2\u66F4\u6539","diff.binaryHint":"{before} \u5230 {after}","diff.conflictBanner":"\u6B64\u6587\u4EF6\u6709\u672A\u89E3\u51B3\u7684\u51B2\u7A81\u3002\u89E3\u51B3\u524D\u65E0\u6CD5\u63D0\u4EA4\u3002","diff.loading":"\u6B63\u5728\u8BFB\u53D6\u5DEE\u5F02","diff.noChanges":"\u6B64\u6587\u4EF6\u6CA1\u6709\u66F4\u6539","diff.fullFile":"\u5B8C\u6574\u6587\u4EF6","diff.layout":"\u5DEE\u5F02\u5E03\u5C40","diff.changes":"\u6B64\u6587\u4EF6\u4E2D\u7684\u66F4\u6539","diff.lines":"{count} \u884C","commit.placeholder":"\u63CF\u8FF0\u8FD9\u6B21\u66F4\u6539","commit.hintStage":"\u5148\u6682\u5B58\u4E00\u4E2A\u6587\u4EF6\u3002","commit.hintConflict":"\u8BF7\u5148\u89E3\u51B3\u51B2\u7A81\u3002","commit.hintMessage":"\u5199\u4E00\u6761\u63D0\u4EA4\u4FE1\u606F\u3002","commit.done":"\u5DF2\u63D0\u4EA4 {hash}","commit.amend":"\u4FEE\u8865\u4E0A\u6B21\u63D0\u4EA4","commit.noVerify":"\u8DF3\u8FC7\u94A9\u5B50","commit.noVerifyHint":"\u63D0\u4EA4\u65F6\u4E0D\u8FD0\u884C Git \u94A9\u5B50\u3002","branch.title":"\u5206\u652F\u5E76\u63D0\u4EA4","branch.name":"\u5206\u652F\u540D","branch.nameHint":"\u4ECE\u5F53\u524D HEAD \u521B\u5EFA\u5206\u652F\uFF0C\u7136\u540E\u63D0\u4EA4\u5DF2\u6682\u5B58\u7684\u66F4\u6539\u3002","branch.message":"\u63D0\u4EA4\u4FE1\u606F","branch.created":"\u5DF2\u521B\u5EFA {branch} \u5E76\u63D0\u4EA4","branch.current":"\u5F53\u524D\u5206\u652F","branch.local":"\u672C\u5730\u5206\u652F","branch.loading":"\u6B63\u5728\u8BFB\u53D6\u5206\u652F","branch.none":"\u6CA1\u6709\u5206\u652F","branch.new":"\u65B0\u5EFA\u5206\u652F","branch.newTitle":"\u65B0\u5EFA\u5206\u652F","branch.newHint":"\u4ECE\u5F53\u524D HEAD \u521B\u5EFA\u5E76\u5207\u6362\uFF0C\u4E0D\u4EA7\u751F\u63D0\u4EA4\u3002","branch.search":"\u641C\u7D22\u5206\u652F","branch.remote":"\u8FDC\u7AEF\u5206\u652F","branch.inWorktree":"\u5DF2\u5728\u5176\u4ED6\u5DE5\u4F5C\u6811\u68C0\u51FA","branch.createdOnly":"\u5DF2\u521B\u5EFA {branch}","branch.noneMatch":"\u6CA1\u6709\u5339\u914D\u7684\u5206\u652F","stash.title":"\u8D2E\u85CF\u66F4\u6539","stash.message":"\u8D2E\u85CF\u4FE1\u606F","stash.select":"\u8981\u8D2E\u85CF\u7684\u6587\u4EF6","stash.selectHint":"\u53EA\u8D2E\u85CF\u9009\u4E2D\u7684\u6587\u4EF6\u3002\u672A\u8DDF\u8E2A\u6587\u4EF6\u4E5F\u4F1A\u5305\u542B\u3002","stash.default":"WIP","stash.nothing":"\u6CA1\u6709\u53EF\u8D2E\u85CF\u7684\u6587\u4EF6\u3002","stash.created":"\u5DF2\u8D2E\u85CF {count} \u4E2A\u6587\u4EF6","stash.applied":"\u5DF2\u5E94\u7528 {ref}","stash.popped":"\u5DF2\u5F39\u51FA {ref}","stash.dropped":"\u5DF2\u5220\u9664 {ref}","stash.dropTitle":"\u5220\u9664\u8D2E\u85CF","stash.dropBody":"\u8FD9\u4F1A\u6C38\u4E45\u5220\u9664 {ref}\uFF0C\u4E14\u4E0D\u4F1A\u5E94\u7528\u5176\u4E2D\u7684\u66F4\u6539\u3002","discard.title":"\u4E22\u5F03\u66F4\u6539\uFF1F","discard.body":"{path} \u7684\u6240\u6709\u672C\u5730\u66F4\u6539\u90FD\u4F1A\u4E22\u5931\u3002\u6B64\u64CD\u4F5C\u65E0\u6CD5\u64A4\u9500\u3002","discard.deleteTitle":"\u5220\u9664\u672A\u8DDF\u8E2A\u6587\u4EF6\uFF1F","discard.deleteBody":"{path} \u672A\u88AB\u8DDF\u8E2A\u3002\u6587\u4EF6\u5C06\u4ECE\u78C1\u76D8\u5220\u9664\u3002\u6B64\u64CD\u4F5C\u65E0\u6CD5\u64A4\u9500\u3002","discard.confirm":"\u4E22\u5F03\u66F4\u6539","discard.deleteConfirm":"\u5220\u9664\u6587\u4EF6","discard.done":"\u5DF2\u4E22\u5F03 {name} \u7684\u66F4\u6539","discard.deleted":"\u5DF2\u5220\u9664 {name}","sync.fetched":"\u5DF2\u83B7\u53D6","sync.pulled":"\u5DF2\u62C9\u53D6","sync.pulledStashed":"\u5DF2\u62C9\u53D6\u5E76\u6062\u590D\u672C\u5730\u66F4\u6539","sync.pulledStashConflict":"\u5DF2\u62C9\u53D6\uFF0C\u4F46\u90E8\u5206\u672C\u5730\u66F4\u6539\u672A\u80FD\u6062\u590D\u3002\u66F4\u6539\u4ECD\u4FDD\u7559\u5728\u201C\u8D2E\u85CF\u201D\u4E2D\u3002","sync.pushed":"\u5DF2\u63A8\u9001","sync.ahead":"\u9886\u5148 {count}","sync.behind":"\u843D\u540E {count}","sync.noUpstream":"\u6B64\u5206\u652F\u6CA1\u6709\u4E0A\u6E38\uFF0C\u63A8\u9001\u65F6\u4F1A\u8BBE\u7F6E\u3002","sync.none":"\u5DF2\u662F\u6700\u65B0","log.title":"\u5386\u53F2","log.loading":"\u6B63\u5728\u8BFB\u53D6\u5386\u53F2","log.select":"\u9009\u62E9\u4E00\u4E2A\u63D0\u4EA4","log.files":"\u66F4\u6539\u7684\u6587\u4EF6","log.noFiles":"\u6CA1\u6709\u6587\u4EF6\u66F4\u6539","log.author":"\u4F5C\u8005","log.date":"\u65E5\u671F","log.parent":"\u7236\u63D0\u4EA4","log.message":"\u4FE1\u606F","history.actions":"\u63D0\u4EA4\u64CD\u4F5C","history.copy":"\u590D\u5236\u63D0\u4EA4\u54C8\u5E0C","history.undo":"\u64A4\u9500\u6700\u540E\u4E00\u6B21\u63D0\u4EA4","history.undoHint":"HEAD \u56DE\u9000\uFF0C\u66F4\u6539\u4FDD\u7559\u5728\u6682\u5B58\u533A\u3002","history.revert":"\u8FD8\u539F\u63D0\u4EA4","history.revertHint":"\u751F\u6210\u53CD\u5411\u66F4\u6539\u5E76\u5199\u5165\u8FD8\u539F\u4FE1\u606F\u3002","history.cherryPick":"\u62E3\u9009\u63D0\u4EA4","history.cherryPickHint":"\u5728\u6B64\u5206\u652F\u5E94\u7528\u5E76\u63D0\u4EA4\u8BE5\u63D0\u4EA4\u3002","history.reset":"\u5C06\u5206\u652F\u91CD\u7F6E\u5230\u6B64\u5904","history.resetHint":"\u628A\u5F53\u524D\u5206\u652F\u79FB\u52A8\u5230\u6240\u9009\u63D0\u4EA4\u3002","history.blockedOperation":"\u8BF7\u5148\u5B8C\u6210\u5F53\u524D\u64CD\u4F5C\u3002","history.blockedNotHead":"\u53EA\u80FD\u64A4\u9500\u6700\u540E\u4E00\u6B21\u63D0\u4EA4\u3002","history.blockedDetached":"\u8BF7\u5148\u5207\u6362\u5230\u5206\u652F\u3002","history.blockedNoParent":"\u7B2C\u4E00\u4E2A\u63D0\u4EA4\u65E0\u6CD5\u64A4\u9500\u3002","history.blockedPushed":"\u8BE5\u63D0\u4EA4\u5DF2\u5728\u4E0A\u6E38\u5206\u652F\u4E0A\uFF0C\u8BF7\u6539\u7528\u8FD8\u539F\u3002","history.blockedMerge":"\u6B64\u5904\u4E0D\u652F\u6301\u5408\u5E76\u63D0\u4EA4\u3002","history.blockedStaged":"\u8BF7\u5148\u63D0\u4EA4\u6216\u53D6\u6D88\u6682\u5B58\u5DF2\u6682\u5B58\u7684\u6587\u4EF6\u3002","history.blockedContained":"\u5DF2\u5728\u5F53\u524D\u5206\u652F\u4E2D\u3002","history.blockedConflict":"\u8BF7\u5148\u89E3\u51B3\u51B2\u7A81\u3002","history.undoTitle":"\u64A4\u9500\u6700\u540E\u4E00\u6B21\u63D0\u4EA4\uFF1F","history.undoBody":"\u8BE5\u63D0\u4EA4\u4F1A\u79BB\u5F00\u5206\u652F\uFF0C\u66F4\u6539\u4FDD\u7559\u5728\u6682\u5B58\u533A\uFF0C\u53EF\u7EE7\u7EED\u7F16\u8F91\u5E76\u91CD\u65B0\u63D0\u4EA4\u3002","history.undoAction":"\u64A4\u9500\u63D0\u4EA4","history.revertTitle":"\u8FD8\u539F\u8FD9\u4E2A\u63D0\u4EA4\uFF1F","history.revertBody":"\u4F1A\u6682\u5B58\u53CD\u5411\u66F4\u6539\u5E76\u586B\u5165\u8FD8\u539F\u4FE1\u606F\uFF0C\u539F\u63D0\u4EA4\u4ECD\u4FDD\u7559\u5728\u5386\u53F2\u4E2D\u3002","history.revertAction":"\u8FD8\u539F\u63D0\u4EA4","history.resetTitle":"\u91CD\u7F6E\u8FD9\u4E2A\u5206\u652F\uFF1F","history.resetBody":"\u5206\u652F\u4F1A\u79FB\u52A8\u5230 {hash}\u3002\u9009\u62E9\u5176\u540E\u66F4\u6539\u7684\u5904\u7406\u65B9\u5F0F\u3002","history.resetModeSoft":"\u8F6F\u91CD\u7F6E","history.resetModeSoftHint":"\u66F4\u6539\u4FDD\u7559\u5728\u6682\u5B58\u533A\uFF0C\u53EF\u91CD\u65B0\u63D0\u4EA4\u3002","history.resetModeMixed":"\u6DF7\u5408\u91CD\u7F6E","history.resetModeMixedHint":"\u66F4\u6539\u4FDD\u7559\u5728\u5DE5\u4F5C\u533A\uFF0C\u4E0D\u6682\u5B58\u3002","history.resetModeHard":"\u786C\u91CD\u7F6E","history.resetModeHardHint":"\u4E22\u5F03\u8FD9\u4E9B\u63D0\u4EA4\u53CA\u5176\u66F4\u6539\u3002","history.resetHardWarning":"\u786C\u91CD\u7F6E\u4F1A\u4E22\u5F03\u8BE5\u63D0\u4EA4\u4E4B\u540E\u7684\u5168\u90E8\u672C\u5730\u66F4\u6539\uFF0C\u4E14\u65E0\u6CD5\u64A4\u9500\u3002","history.resetAction":"\u91CD\u7F6E\u5206\u652F","history.undone":"\u5DF2\u64A4\u9500\u63D0\u4EA4\uFF0C\u66F4\u6539\u5DF2\u6682\u5B58\u3002","history.reverted":"\u8FD8\u539F\u5DF2\u5C31\u7EEA\uFF0C\u8BF7\u68C0\u67E5\u540E\u63D0\u4EA4\u3002","history.revertConflicts":"\u8FD8\u539F\u9047\u5230\u51B2\u7A81\uFF0C\u8BF7\u89E3\u51B3\u540E\u63D0\u4EA4\u3002","history.picked":"\u5DF2\u62E3\u9009\u4E3A {hash}","history.resetDone":"\u5206\u652F\u5DF2\u91CD\u7F6E\u5230 {hash}","status.loading":"\u6B63\u5728\u8BFB\u53D6\u4ED3\u5E93","status.detached":"\u6E38\u79BB HEAD","error.title":"Git \u64CD\u4F5C\u5931\u8D25","error.notInstalled":"\u672A\u5B89\u88C5 Git","error.notInstalledHint":"\u5B89\u88C5 Git \u5E76\u786E\u4FDD\u5B83\u5728 PATH \u4E2D\uFF0C\u7136\u540E\u5237\u65B0\u3002","confirm.revertTitle":"\u8FD8\u539F\u8FD9\u4E2A\u533A\u5757\uFF1F","confirm.revertBody":"\u672C\u5730\u533A\u5757\u4F1A\u88AB\u5DF2\u6682\u5B58\u7248\u672C\u66FF\u6362\uFF0C\u8FD9\u90E8\u5206\u5DE5\u4F5C\u533A\u66F4\u6539\u4F1A\u4E22\u5931\u3002","confirm.checkoutTitle":"\u5207\u6362\u5206\u652F\uFF1F","confirm.checkoutBody":"\u5982\u679C Git \u80FD\u4FDD\u7559\uFF0C\u672C\u5730\u66F4\u6539\u4F1A\u5E26\u5230\u65B0\u5206\u652F\uFF0C\u5426\u5219\u4F1A\u62D2\u7EDD\u5207\u6362\u3002","confirm.yesRevert":"\u8FD8\u539F\u533A\u5757","confirm.yesCheckout":"\u5207\u6362\u5206\u652F","meta.binary":"\u4E8C\u8FDB\u5236","meta.blocks":"{count} \u4E2A\u533A\u5757","meta.add":"\u65B0\u589E {count}","meta.del":"\u5220\u9664 {count}","filter.placeholder":"\u8FC7\u6EE4\u6587\u4EF6","filter.clear":"\u6E05\u9664\u8FC7\u6EE4","meta.partial":"\u90E8\u5206","meta.partialHint":"\u6B64\u6587\u4EF6\u7684\u90E8\u5206\u66F4\u6539\u5DF2\u6682\u5B58","commit.stagedSummary":"\u5DF2\u6682\u5B58 {count} \u4E2A","commit.shortcut":"\u6309 {key}+Enter \u63D0\u4EA4","diff.added":"\u65B0\u589E","diff.removed":"\u5220\u9664","diff.blockCount":"{count} \u5904\u66F4\u6539","diff.blockCountOne":"1 \u5904\u66F4\u6539","stash.applyHint":"\u5E94\u7528\u66F4\u6539\u5E76\u4FDD\u7559\u8D2E\u85CF","stash.popHint":"\u5E94\u7528\u66F4\u6539\u5E76\u5220\u9664\u8D2E\u85CF","stash.dropHint":"\u5220\u9664\u8D2E\u85CF","filter.empty":'\u6CA1\u6709\u6587\u4EF6\u5339\u914D "{filter}"',"action.copyHash":"\u590D\u5236\u63D0\u4EA4\u54C8\u5E0C","action.copied":"\u5DF2\u590D\u5236\uFF01","diff.unstaged":"\u672A\u6682\u5B58","stash.selectAll":"\u5168\u9009","stash.deselectAll":"\u5168\u4E0D\u9009","header.label":"Git \u9762\u677F","settings.section":"Git","settings.model":"AI \u6A21\u578B","settings.modelHint":"\u7528\u4E8E\u751F\u6210\u63D0\u4EA4\u4FE1\u606F\u3002\u9ED8\u8BA4\u8DDF\u968F\u8F93\u5165\u6846\u9009\u62E9\u7684\u6A21\u578B\uFF0C\u4E4B\u540E\u5207\u6362\u4E5F\u4F1A\u8DDF\u968F\u3002","settings.modelSame":"\u4E0E\u8F93\u5165\u6846\u76F8\u540C","settings.modelEmpty":"\u6B64\u7248\u672C\u6CA1\u6709\u53EF\u7528\u6A21\u578B\u3002","settings.modelFailed":"\u65E0\u6CD5\u8BFB\u53D6\u6A21\u578B\u5217\u8868\u3002","settings.instruction":"\u63D0\u4EA4\u4FE1\u606F\u6307\u4EE4","settings.instructionHint":"\u8FD9\u4E9B\u5185\u5BB9\u51B3\u5B9A\u63AA\u8F9E\uFF0C\u6807\u9898\u884C type(scope): \u6458\u8981\u59CB\u7EC8\u5FC5\u586B\uFF0C\u53EF\u4EE5\u518D\u5199\u4E00\u6BB5\u8BF4\u660E\u3002","settings.instructionReset":"\u6062\u590D\u9ED8\u8BA4","settings.instructionFailed":"\u65E0\u6CD5\u8BFB\u53D6\u9ED8\u8BA4\u6307\u4EE4\u3002","command.toggle":"\u6253\u5F00\u6216\u6536\u8D77 Git \u9762\u677F","command.commit":"\u63D0\u4EA4\u5DF2\u6682\u5B58\u7684\u66F4\u6539","command.writeMessage":"\u7528 AI \u5199\u63D0\u4EA4\u4FE1\u606F","command.stageAll":"\u6682\u5B58\u5168\u90E8\u66F4\u6539","command.openFirst":"\u8BF7\u5148\u6253\u5F00 Git \u9762\u677F","command.nothingToStage":"\u6CA1\u6709\u53EF\u6682\u5B58\u7684\u66F4\u6539","command.notReady":"\u8BF7\u5148\u6682\u5B58\u6587\u4EF6\u5E76\u586B\u5199\u63D0\u4EA4\u4FE1\u606F","split.files":"\u8C03\u6574\u6587\u4EF6\u5217\u8868\u5BBD\u5EA6","split.commits":"\u8C03\u6574\u63D0\u4EA4\u5217\u8868\u5BBD\u5EA6"},Ft="dsh-git.layout",Ot="dsh-git.layout.compact",We="dsh-git.repo.";function Ve(t,i){try{return window.localStorage.getItem(t)??i}catch{return i}}function Pe(t,i){try{window.localStorage.setItem(t,i)}catch{}}var Ki=/Mac|iPhone|iPad/.test(navigator.platform||navigator.userAgent)?"\u2318":"Ctrl",jt=new Map;function Xt(t){let i=jt.get(t);if(i===void 0){let a=new Set,n=!1;i={hook:{getSnapshot:()=>n,subscribe(r){return a.add(r),()=>{a.delete(r)}}},set(r){if(r!==n){n=r;for(let o of[...a])o()}}},jt.set(t,i)}return i}var Jt="dsh-git.preferences.v1";function _i(){let t={model:null,instruction:""},i=Ve(Jt,"");if(i==="")return t;try{let a=JSON.parse(i),n=a!==null&&typeof a=="object"?a:{};return{model:bt(n.model),instruction:typeof n.instruction=="string"?n.instruction:""}}catch{return t}}var ht=(()=>{let t=_i(),i=new Set;return{hook:{getSnapshot:()=>t,subscribe(a){return i.add(a),()=>{i.delete(a)}}},set(a){t={model:bt(a.model),instruction:typeof a.instruction=="string"?a.instruction:""},Pe(Jt,JSON.stringify(t));for(let n of[...i])n()}}})(),Zt="dsh-git.split",mt=320,Ie=220,$t=280,Qt=1e4,Wt=16;function qi(){let t=Number.parseInt(Ve(Zt,""),10);return Number.isFinite(t)?Math.min(Math.max(t,Ie),Qt):mt}var Ge=(()=>{let t=qi(),i=new Set;return{get:()=>t,subscribe(a){return i.add(a),()=>{i.delete(a)}},set(a){let n=Math.round(a);if(!(!Number.isFinite(n)||n===t)){t=Math.min(Math.max(n,Ie),Qt),Pe(Zt,String(t));for(let r of[...i])r()}}}})();function ei(){let[t,i]=k(Ge.get);return A(()=>(i(Ge.get()),Ge.subscribe(()=>i(Ge.get()))),[]),[t,Ge.set]}function ti(t,i){let a=I(0);A(()=>{let n=t.current;if(n===null)return;let r=()=>{n.style.height="auto";let d=n.offsetHeight-n.clientHeight,c=n.closest(".gitp-root"),l=c===null?600:c.getBoundingClientRect().height,m=Math.max(140,Math.round(l*.45)),p=n.scrollHeight+d;n.style.height=`${Math.min(p,m)}px`,n.style.overflowY=p>m?"auto":"hidden"};if(r(),typeof ResizeObserver>"u")return;let o=n.parentElement;if(o===null)return;let u=new ResizeObserver(d=>{let c=d[0];if(c===void 0)return;let l=Math.round(c.contentRect.width);l!==a.current&&(a.current=l,r())});return u.observe(o),()=>u.disconnect()},[t,i])}function Gt(t){return JSON.stringify({provider:t.provider,model:t.model})}function bt(t){if(t===null||typeof t!="object")return null;let i=t;return typeof i.provider!="string"||i.provider===""||typeof i.model!="string"||i.model===""?null:{provider:i.provider,model:i.model}}function Yi(t){try{return bt(JSON.parse(t))}catch{return null}}function $(...t){return t.filter(Boolean).join(" ")}function Ue(t){let i=t.lastIndexOf("/");return i===-1?{dir:"",base:t}:{dir:t.slice(0,i+1),base:t.slice(i+1)}}function De(t){return typeof t=="string"?t.slice(0,7):""}function vt(t){switch(t){case"A":return"is-added";case"D":return"is-deleted";case"R":return"is-renamed";case"U":return"is-untracked";case"C":return"is-conflict";default:return"is-modified"}}function Vt(t){return String(t??"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,60)}function Xi(t,i){let a=Vt(String(t??"").split(/\r?\n/)[0]);if(a!=="")return a;let n=i?Ue(i).base.replace(/\.[^.]+$/,""):"changes";return`${Vt(n)||"changes"}-changes`.slice(0,60)}function Ut(t){return t.match(/\s+|[A-Za-z0-9_]+|[^\sA-Za-z0-9_]/g)??[]}function Ji(t,i){if(t===i||t.length>2e3||i.length>2e3)return null;let a=Ut(t),n=Ut(i),r=0;for(;r<a.length&&r<n.length&&a[r]===n[r];)r+=1;let o=0;for(;o<a.length-r&&o<n.length-r&&a[a.length-1-o]===n[n.length-1-o];)o+=1;return{lPre:a.slice(0,r).join(""),lMid:a.slice(r,a.length-o).join(""),lSuf:o===0?"":a.slice(a.length-o).join(""),rPre:n.slice(0,r).join(""),rMid:n.slice(r,n.length-o).join(""),rSuf:o===0?"":n.slice(n.length-o).join("")}}function Kt(t,i,a){return i===""?e(te.default.Fragment,null,t,a):e(te.default.Fragment,null,t,e("span",{className:"gitp-word"},i),a)}function _t(t){let i=new Date(t);if(Number.isNaN(i.getTime()))return t;let a=Math.round((i.getTime()-Date.now())/1e3),n=new Intl.RelativeTimeFormat(void 0,{numeric:"auto"});if(Math.abs(a)<60)return n.format(a,"second");let r=Math.round(a/60);if(Math.abs(r)<60)return n.format(r,"minute");let o=Math.round(r/60);if(Math.abs(o)<24)return n.format(o,"hour");let u=Math.round(o/24);return Math.abs(u)<30?n.format(u,"day"):i.toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}function Zi(t){let i=[],a=[];for(let n of t){let r=i.indexOf(n.hash);r===-1&&(r=i.length,i.push(n.hash));let o=n.parents??[];i[r]=o[0]??null;for(let u=1;u<o.length;u+=1){let d=o[u];d!==void 0&&i.splice(r+u,0,d)}for(;i.length>0&&i[i.length-1]===null;)i.pop();a.push({...n,lane:r,laneCount:Math.max(1,i.length)})}return a}function fe(t){return t==null?"":t instanceof Error?t.message:String(t)}function H({path:t,size:i=16,viewBox:a="0 0 24 24",className:n,filled:r=!1}){return e("svg",{className:n,width:i,height:i,viewBox:a,fill:r?"currentColor":"none",stroke:r?"none":"currentColor",strokeWidth:r?0:1.8,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},e("path",{d:t}))}var N={branch:"M6 3v12a3 3 0 0 0 3 3h6M6 9h6a3 3 0 0 0 3-3V3M6 3.5a1 1 0 1 0 0-.1M18 3.5a1 1 0 1 0 0-.1M18 21a1 1 0 1 0 0-.1",changes:"M4 6h16M4 12h10M4 18h13M18 9l3 3-3 3",history:"M3 12a9 9 0 1 0 3-6.7M3 4v5h5M12 7v5l3 2",stash:"M4 8h16M6 8v11a1 1 0 0 0 1 1h10a1 1 0 0 0 1-1V8M9 8V5a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v3M10 12h4",plus:"M12 5v14M5 12h14",minus:"M5 12h14",left:"M19 12H5m0 0l6-6m-6 6l6 6",right:"M5 12h14m0 0l-6-6m6 6l-6 6",refresh:"M20 11a8 8 0 1 0-2.3 5.7M20 4v7h-7",fetch:"M6 15a4 4 0 0 1 .8-7.9 5 5 0 0 1 9.6-1.1A3.5 3.5 0 0 1 17 15M12 11v7m0 0l-3-3m3 3l3-3",pull:"M12 4v11m0 0l-4-4m4 4l4-4M5 20h14",push:"M12 20V9m0 0l-4 4m4-4l4 4M5 4h14",close:"M6 6l12 12M18 6L6 18",chevron:"M6 9l6 6 6-6",chevronUp:"M6 15l6-6 6 6",sparkles:"M12 3l1.9 5.1L19 10l-5.1 1.9L12 17l-1.9-5.1L5 10l5.1-1.9zM18.5 15l.9 2.1 2.1.9-2.1.9-.9 2.1-.9-2.1-2.1-.9 2.1-.9z",file:"M14 3H7a1 1 0 0 0-1 1v16a1 1 0 0 0 1 1h10a1 1 0 0 0 1-1V7zM14 3v4h4",code:"M8 7l-5 5 5 5M16 7l5 5-5 5",warning:"M12 3l9 16H3zM12 9v5M12 17v.5",check:"M5 12l5 5L20 7",folder:"M3 6a1 1 0 0 1 1-1h5l2 2h8a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1z",split:"M4 5h16v14H4zM12 5v14",unified:"M4 5h16M4 9h16M4 13h16M4 17h16",search:"M11 19a8 8 0 1 0 0-16 8 8 0 0 0 0 16zM21 21l-4.35-4.35",copy:"M8 4v12a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V7.242a2 2 0 0 0-.602-1.43L16.08 2.5a2 2 0 0 0-1.43-.5H10a2 2 0 0 0-2 2zM4 8H3a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-1",checkAlt:"M20 6L9 17l-5-5",more:"M6 12h.01M12 12h.01M18 12h.01",undo:"M9 14L4 9l5-5M4 9h10a6 6 0 0 1 0 12h-2",revert:"M10 7L5 12l5 5M5 12h9a5 5 0 0 1 5 5",cherry:"M12 17.5m-3.5 0a3.5 3.5 0 1 0 7 0a3.5 3.5 0 1 0 -7 0M7 6.5m-2.5 0a2.5 2.5 0 1 0 5 0a2.5 2.5 0 1 0 -5 0M12 14c0-3 2-5.5 6-7M12 14c-1-2.5-2.5-4-5-5.5",reset:"M3 12a9 9 0 1 0 3-6.7M3 4v5h5M12 8v4l2.5 2",trash:"M3 6h18M8 6V4h8v2M19 6l-1 14H6L5 6M10 11v5M14 11v5"},Ee=20;function tt({size:t=20}){return e("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none","aria-hidden":"true"},e("path",{d:"M12 3v18",stroke:"currentColor",strokeWidth:1.8,strokeLinecap:"round"}),e("path",{d:"M12 12c0-4 3-6 7-6h1",stroke:"currentColor",strokeWidth:1.8,strokeLinecap:"round"}),e("circle",{cx:12,cy:3.5,r:2.3,fill:"currentColor"}),e("circle",{cx:12,cy:12,r:2.3,fill:"currentColor"}),e("circle",{cx:12,cy:20.5,r:2.3,fill:"currentColor"}))}function Qi({size:t=20}){return e(tt,{size:t})}var en=`
|
|
6
|
+
"use strict";var Ai=Object.create;var ht=Object.defineProperty;var Li=Object.getOwnPropertyDescriptor;var Bi=Object.getOwnPropertyNames;var Ii=Object.getPrototypeOf,Fi=Object.prototype.hasOwnProperty;var Oi=(t,i)=>{for(var a in i)ht(t,a,{get:i[a],enumerable:!0})},Gt=(t,i,a,n)=>{if(i&&typeof i=="object"||typeof i=="function")for(let o of Bi(i))!Fi.call(t,o)&&o!==a&&ht(t,o,{get:()=>i[o],enumerable:!(n=Li(i,o))||n.enumerable});return t};var ji=(t,i,a)=>(a=t!=null?Ai(Ii(t)):{},Gt(i||!t||!t.__esModule?ht(a,"default",{value:t,enumerable:!0}):a,t)),$i=t=>Gt(ht({},"__esModule",{value:!0}),t);var Dn={};Oi(Dn,{apply:()=>Hn,inject:()=>Pn});module.exports=$i(Dn);var pe=ji(require("react"),1),e=pe.default.createElement,{useState:N,useEffect:I,useRef:j,useMemo:Se,useCallback:mt}=pe.default,Mt=class extends Error{code;details;constructor(i,a,n){super(a),this.name="GitCallError",this.code=i,this.details=n}};function Vt(t){if(!(t instanceof Error)||!("code"in t))return;let{code:i}=t;return typeof i=="string"?i:void 0}function te(t){return t instanceof Error?t:new Error(String(t))}var Be="git",kt="dsh-git",Wi="dsh-resource://file/session/",Gi=t=>t.startsWith("/")||/^[A-Za-z]:[/\\]/.test(t)||t.startsWith("\\\\"),Vi=t=>t.replace(/\\/g,"/").replace(/^(?:\.\/)+/,"").split("/").map(i=>encodeURIComponent(i)).join("/"),ft=(t,i)=>`${Wi}${encodeURIComponent(t)}/${Vi(i)}`;function Ki(t,i,a){let n=a.replace(/\\/g,"/");if(!Gi(n))return ft(t,n);let o=i===void 0?"":i.replace(/\\/g,"/").replace(/\/+$/,"");return o!==""&&n===o?ft(t,""):o!==""&&n.startsWith(`${o}/`)?ft(t,n.slice(o.length+1)):ft(t,n)}function Ui(t){let i=t?.rows??[],a=i.findIndex(n=>n.k!=="ctx");if(a<0)return 1;for(let n=a;n<i.length;n+=1){let o=i[n];if(o!==void 0&&o.r!==null)return o.r}return 1}var _i={panel:"Git","mode.changes":"Changes","mode.log":"History","mode.stash":"Stashes","guide.title":"Git changes","guide.description":"Review, stage, commit, and sync the workspace repository.","section.conflicts":"Conflicts","section.staged":"Staged","section.unstaged":"Unstaged","section.stagedCount":"{count} staged","section.unstagedCount":"{count} changed","section.conflictCount":"{count} unresolved","empty.noChanges":"No changes","empty.noChangesHint":"The working tree matches the last commit.","empty.selectFile":"Select a file to review it","empty.selectFileHint":"The full file is shown on both sides. Nothing is collapsed.","empty.noRepo":"Not a Git repository","empty.noRepoHint":"This workspace is not a repository yet.","empty.init":"Initialize repository","empty.noWorkspace":"No workspace is open","empty.noWorkspaceHint":"Open a workspace, then return to Git.","empty.noHistory":"No commits yet","empty.noHistoryHint":"The first commit will appear here.","empty.noStashes":"No stashes","empty.noStashesHint":"Park work here before switching tasks.","action.stageFile":"Stage file","action.unstageFile":"Unstage file","action.stageAll":"Stage all","action.unstageAll":"Unstage all","selection.count":"{count} selected","selection.stage":"Stage selected files","selection.unstage":"Unstage selected files","selection.discard":"Discard selected files","selection.clear":"Clear selection","ai.action":"AI actions","ai.write":"Write a commit message","ai.branch":"Create a branch and commit","ai.written":"Message written with {model}","action.stageBlock":"Stage block","action.unstageBlock":"Unstage block","action.revertBlock":"Revert block to the staged version","action.refresh":"Refresh","action.back":"Back to changes","action.openEditor":"Open in editor","action.prevChange":"Previous change","action.nextChange":"Next change","action.close":"Close","action.cancel":"Cancel","action.confirm":"Confirm","action.commit":"Commit","action.committing":"Committing","action.branch":"Branch","action.createBranch":"Create branch and commit","action.checkout":"Checkout","action.fetch":"Fetch","action.pull":"Pull","action.push":"Push","action.apply":"Apply","action.pop":"Pop","action.drop":"Drop","action.stash":"Stash changes","action.discard":"Discard changes","action.acceptOurs":"Accept ours","action.acceptTheirs":"Accept theirs","action.retry":"Retry","action.init":"Initialize","action.newBranch":"New branch","action.createAndSwitch":"Create and switch","repo.title":"Repositories","repo.current":"Current repository","repo.workspace":"Workspace folder","repo.pick":"Switch repository","repo.none":"No repository found","repo.initRoot":"New repository at the workspace root","repo.initRootTitle":"Initialize at the workspace root?","repo.initRootBody":"The workspace contains {count} repositories. A repository at the workspace root treats each of them as an untracked folder. Pick one of the repositories instead.","repo.initRootConfirm":"Initialize anyway","repo.worktree":"Worktree","action.revert":"Revert block","diff.split":"Split","diff.unified":"Unified","diff.head":"HEAD","diff.staged":"Staged","diff.local":"Local","diff.parent":"Parent","diff.commit":"Commit","diff.binary":"Binary file changed","diff.binaryHint":"{before} to {after}","diff.conflictBanner":"This file has unresolved conflicts. Commit is blocked until you resolve it.","diff.loading":"Loading diff","diff.noChanges":"No changes in this file","diff.fullFile":"Full file","diff.layout":"Diff layout","diff.changes":"Changes in this file","diff.lines":"{count} lines","commit.placeholder":"Describe the change","commit.hintStage":"Stage a file to commit.","commit.hintConflict":"Resolve conflicts before committing.","commit.hintMessage":"Write a commit message.","commit.done":"Committed {hash}","commit.amend":"Amend last commit","commit.noVerify":"Skip hooks","commit.noVerifyHint":"Commit without running Git hooks.","branch.title":"Branch and commit","branch.name":"Branch name","branch.nameHint":"Created from the current HEAD, then the staged changes are committed.","branch.message":"Commit message","branch.created":"Created {branch} and committed","branch.current":"Current branch","branch.local":"Local branches","branch.loading":"Loading branches","branch.none":"No branches","branch.new":"New branch","branch.newTitle":"New branch","branch.newHint":"Created from the current HEAD and checked out. No commit is made.","branch.search":"Search branches","branch.remote":"Remote branches","branch.inWorktree":"Checked out in another worktree","branch.createdOnly":"Created {branch}","branch.noneMatch":"No branch matches","stash.title":"Stash changes","stash.message":"Stash message","stash.select":"Files to stash","stash.selectHint":"Only the selected files are stashed. Untracked files are included.","stash.default":"WIP","stash.nothing":"No files to stash.","stash.created":"Stashed {count} files","stash.applied":"Applied {ref}","stash.popped":"Popped {ref}","stash.dropped":"Dropped {ref}","stash.dropTitle":"Drop stash","stash.dropBody":"This deletes {ref} permanently. The changes are not applied.","discard.title":"Discard changes?","discard.body":"Every local change in {path} is lost. This cannot be undone.","discard.deleteTitle":"Delete untracked file?","discard.deleteBody":"{path} is untracked. The file is removed from disk. This cannot be undone.","discard.confirm":"Discard changes","discard.deleteConfirm":"Delete file","discard.done":"Discarded changes in {name}","discard.deleted":"Deleted {name}","discard.titleMany":"Discard changes in {count} files?","discard.titleOne":"Discard changes in this file?","discard.bodyMany":"Every local change in these files is lost. This cannot be undone.","discard.doneMany":"Discarded changes in {count} files","discard.doneOne":"Discarded changes in this file","discard.more":"{count} more","sync.fetched":"Fetched","sync.pulled":"Pulled","sync.pulledStashed":"Pulled and restored local changes","sync.pulledStashConflict":"Pulled, but some local changes could not be restored. The stash is kept in Stashes.","sync.pushed":"Pushed","sync.ahead":"{count} ahead","sync.behind":"{count} behind","sync.noUpstream":"This branch has no upstream. Push sets one.","sync.none":"Up to date","log.title":"History","log.loading":"Loading history","log.select":"Select a commit","log.files":"Changed files","log.noFiles":"No file changes","log.author":"Author","log.date":"Date","log.parent":"Parent","log.message":"Message","history.actions":"Commit actions","history.copy":"Copy commit hash","history.undo":"Undo last commit","history.undoHint":"Moves HEAD back and keeps the change staged.","history.revert":"Revert commit","history.revertHint":"Stages the inverse change with a revert message.","history.cherryPick":"Cherry-pick commit","history.cherryPickHint":"Applies the commit here and commits it.","history.reset":"Reset branch to here","history.resetHint":"Moves this branch to the selected commit.","history.blockedOperation":"Finish the current operation first.","history.blockedNotHead":"Only the last commit can be undone.","history.blockedDetached":"Check out a branch first.","history.blockedNoParent":"The first commit cannot be undone.","history.blockedPushed":"This commit is already on the upstream branch. Revert it instead.","history.blockedMerge":"Merge commits are not supported here.","history.blockedStaged":"Commit or unstage the staged files first.","history.blockedContained":"Already in this branch.","history.blockedConflict":"Resolve the conflicts first.","history.undoTitle":"Undo the last commit?","history.undoBody":"The commit leaves the branch and its changes stay staged, so you can edit and commit again.","history.undoAction":"Undo commit","history.revertTitle":"Revert this commit?","history.revertBody":"A new set of changes that reverses this commit is staged with a generated message. The commit stays in history.","history.revertAction":"Revert commit","history.resetTitle":"Reset this branch?","history.resetBody":"This branch moves to {hash}. Choose what happens to the changes after it.","history.resetModeSoft":"Soft","history.resetModeSoftHint":"Keep the changes staged for a new commit.","history.resetModeMixed":"Mixed","history.resetModeMixedHint":"Keep the changes in the working tree, unstaged.","history.resetModeHard":"Hard","history.resetModeHardHint":"Discard the commits and their changes.","history.resetHardWarning":"Hard reset discards every local change after this commit. This cannot be undone.","history.resetAction":"Reset branch","history.undone":"Commit undone. Changes are staged.","history.reverted":"Revert ready. Review it, then commit.","history.revertConflicts":"Revert stopped with conflicts. Resolve them, then commit.","history.picked":"Cherry-picked as {hash}","history.resetDone":"Branch reset to {hash}","status.loading":"Reading repository","status.detached":"Detached HEAD","error.title":"Git action failed","error.notInstalled":"Git is not installed","error.notInstalledHint":"Install Git and make it available on PATH, then refresh.","confirm.revertTitle":"Revert this block?","confirm.revertBody":"The local block is replaced by the staged version. This working tree change is lost.","confirm.checkoutTitle":"Switch branch?","confirm.checkoutBody":"Local changes are carried over when Git can keep them, otherwise the checkout is refused.","confirm.yesRevert":"Revert block","confirm.yesCheckout":"Switch branch","meta.binary":"binary","meta.blocks":"{count} blocks","meta.add":"{count} added","meta.del":"{count} deleted","filter.placeholder":"Filter files","filter.clear":"Clear filter","meta.partial":"partial","meta.partialHint":"Some changes in this file are staged","commit.stagedSummary":"{count} staged","commit.shortcut":"{key}+Enter to commit","diff.added":"Added","diff.removed":"Removed","diff.blockCount":"{count} changes","diff.blockCountOne":"1 change","stash.applyHint":"Apply the changes and keep the stash","stash.popHint":"Apply the changes and delete the stash","stash.dropHint":"Delete the stash","filter.empty":'No files match "{filter}"',"action.copyHash":"Copy commit hash","action.copied":"Copied!","diff.unstaged":"Unstaged","stash.selectAll":"Select all","stash.deselectAll":"Deselect all","header.label":"Git panel","settings.section":"Git","settings.model":"AI model","settings.modelHint":"Used by the commit message actions. The default follows the Composer selection, including later changes.","settings.modelSame":"Same as Composer","settings.modelEmpty":"No models are available in this build.","settings.modelFailed":"The model list could not be read.","settings.instruction":"Commit instructions","settings.instructionHint":"These lines shape the wording. The title line type(scope): summary stays required; a short body is welcome.","settings.instructionReset":"Restore default","settings.instructionFailed":"The default instructions could not be read.","command.toggle":"Open or collapse the Git panel","command.commit":"Commit staged changes","command.writeMessage":"Write the commit message with AI","command.stageAll":"Stage all changes","command.openFirst":"Open the Git panel first","command.nothingToStage":"No changed files to stage","command.notReady":"Stage a file and write a message first","split.files":"Resize the file list","split.commits":"Resize the commit list"},qi={panel:"Git","mode.changes":"\u66F4\u6539","mode.log":"\u5386\u53F2","mode.stash":"\u8D2E\u85CF","guide.title":"Git \u66F4\u6539","guide.description":"\u67E5\u770B\u3001\u6682\u5B58\u3001\u63D0\u4EA4\u5E76\u540C\u6B65\u5DE5\u4F5C\u533A\u4ED3\u5E93\u3002","section.conflicts":"\u51B2\u7A81","section.staged":"\u5DF2\u6682\u5B58","section.unstaged":"\u672A\u6682\u5B58","section.stagedCount":"\u5DF2\u6682\u5B58 {count}","section.unstagedCount":"\u5DF2\u66F4\u6539 {count}","section.conflictCount":"\u672A\u89E3\u51B3 {count}","empty.noChanges":"\u6CA1\u6709\u66F4\u6539","empty.noChangesHint":"\u5DE5\u4F5C\u533A\u4E0E\u6700\u8FD1\u4E00\u6B21\u63D0\u4EA4\u4E00\u81F4\u3002","empty.selectFile":"\u9009\u62E9\u4E00\u4E2A\u6587\u4EF6\u67E5\u770B\u66F4\u6539","empty.selectFileHint":"\u4E24\u4FA7\u90FD\u663E\u793A\u5B8C\u6574\u6587\u4EF6\uFF0C\u4E0D\u4F1A\u6298\u53E0\u3002","empty.noRepo":"\u4E0D\u662F Git \u4ED3\u5E93","empty.noRepoHint":"\u5F53\u524D\u5DE5\u4F5C\u533A\u8FD8\u4E0D\u662F\u4ED3\u5E93\u3002","empty.init":"\u521D\u59CB\u5316\u4ED3\u5E93","empty.noWorkspace":"\u6CA1\u6709\u6253\u5F00\u7684\u5DE5\u4F5C\u533A","empty.noWorkspaceHint":"\u6253\u5F00\u4E00\u4E2A\u5DE5\u4F5C\u533A\uFF0C\u7136\u540E\u56DE\u5230 Git\u3002","empty.noHistory":"\u8FD8\u6CA1\u6709\u63D0\u4EA4","empty.noHistoryHint":"\u7B2C\u4E00\u6B21\u63D0\u4EA4\u4F1A\u51FA\u73B0\u5728\u8FD9\u91CC\u3002","empty.noStashes":"\u6CA1\u6709\u8D2E\u85CF","empty.noStashesHint":"\u5207\u6362\u4EFB\u52A1\u524D\u53EF\u4EE5\u628A\u5DE5\u4F5C\u653E\u5728\u8FD9\u91CC\u3002","action.stageFile":"\u6682\u5B58\u6587\u4EF6","action.unstageFile":"\u53D6\u6D88\u6682\u5B58\u6587\u4EF6","action.stageAll":"\u5168\u90E8\u6682\u5B58","action.unstageAll":"\u5168\u90E8\u53D6\u6D88\u6682\u5B58","selection.count":"\u5DF2\u9009\u62E9 {count} \u4E2A\u6587\u4EF6","selection.stage":"\u6682\u5B58\u6240\u9009\u6587\u4EF6","selection.unstage":"\u53D6\u6D88\u6682\u5B58\u6240\u9009\u6587\u4EF6","selection.discard":"\u4E22\u5F03\u6240\u9009\u6587\u4EF6","selection.clear":"\u6E05\u9664\u9009\u62E9","ai.action":"AI \u64CD\u4F5C","ai.write":"\u751F\u6210\u63D0\u4EA4\u4FE1\u606F","ai.branch":"\u521B\u5EFA\u5206\u652F\u5E76\u63D0\u4EA4","ai.written":"\u5DF2\u7531 {model} \u751F\u6210\u63D0\u4EA4\u4FE1\u606F","action.stageBlock":"\u6682\u5B58\u533A\u5757","action.unstageBlock":"\u53D6\u6D88\u6682\u5B58\u533A\u5757","action.revertBlock":"\u5C06\u533A\u5757\u8FD8\u539F\u4E3A\u5DF2\u6682\u5B58\u7248\u672C","action.refresh":"\u5237\u65B0","action.back":"\u8FD4\u56DE\u66F4\u6539","action.openEditor":"\u5728\u7F16\u8F91\u5668\u4E2D\u6253\u5F00","action.prevChange":"\u4E0A\u4E00\u4E2A\u66F4\u6539","action.nextChange":"\u4E0B\u4E00\u4E2A\u66F4\u6539","action.close":"\u5173\u95ED","action.cancel":"\u53D6\u6D88","action.confirm":"\u786E\u8BA4","action.commit":"\u63D0\u4EA4","action.committing":"\u6B63\u5728\u63D0\u4EA4","action.branch":"\u5206\u652F","action.createBranch":"\u521B\u5EFA\u5206\u652F\u5E76\u63D0\u4EA4","action.checkout":"\u5207\u6362","action.fetch":"\u83B7\u53D6","action.pull":"\u62C9\u53D6","action.push":"\u63A8\u9001","action.apply":"\u5E94\u7528","action.pop":"\u5F39\u51FA","action.drop":"\u5220\u9664","action.stash":"\u8D2E\u85CF\u66F4\u6539","action.discard":"\u4E22\u5F03\u66F4\u6539","action.acceptOurs":"\u91C7\u7528\u672C\u5730","action.acceptTheirs":"\u91C7\u7528\u8FDC\u7AEF","action.retry":"\u91CD\u8BD5","action.init":"\u521D\u59CB\u5316","action.newBranch":"\u65B0\u5EFA\u5206\u652F","action.createAndSwitch":"\u521B\u5EFA\u5E76\u5207\u6362","repo.title":"\u4ED3\u5E93","repo.current":"\u5F53\u524D\u4ED3\u5E93","repo.workspace":"\u5DE5\u4F5C\u533A\u76EE\u5F55","repo.pick":"\u5207\u6362\u4ED3\u5E93","repo.none":"\u672A\u627E\u5230\u4ED3\u5E93","repo.initRoot":"\u5728\u5DE5\u4F5C\u533A\u6839\u76EE\u5F55\u65B0\u5EFA\u4ED3\u5E93","repo.initRootTitle":"\u5728\u6839\u76EE\u5F55\u521D\u59CB\u5316\uFF1F","repo.initRootBody":"\u5DE5\u4F5C\u533A\u5305\u542B {count} \u4E2A\u4ED3\u5E93\u3002\u5728\u6839\u76EE\u5F55\u521D\u59CB\u5316\u4F1A\u628A\u5B83\u4EEC\u5F53\u6210\u672A\u8DDF\u8E2A\u76EE\u5F55\u3002\u8BF7\u6539\u7528\u4ED3\u5E93\u9009\u62E9\u5668\u3002","repo.initRootConfirm":"\u4ECD\u8981\u521D\u59CB\u5316","repo.worktree":"\u5DE5\u4F5C\u6811","action.revert":"\u8FD8\u539F\u533A\u5757","diff.split":"\u5E76\u6392","diff.unified":"\u7EDF\u4E00","diff.head":"HEAD","diff.staged":"\u5DF2\u6682\u5B58","diff.local":"\u672C\u5730","diff.parent":"\u7236\u63D0\u4EA4","diff.commit":"\u63D0\u4EA4","diff.binary":"\u4E8C\u8FDB\u5236\u6587\u4EF6\u5DF2\u66F4\u6539","diff.binaryHint":"{before} \u5230 {after}","diff.conflictBanner":"\u6B64\u6587\u4EF6\u6709\u672A\u89E3\u51B3\u7684\u51B2\u7A81\u3002\u89E3\u51B3\u524D\u65E0\u6CD5\u63D0\u4EA4\u3002","diff.loading":"\u6B63\u5728\u8BFB\u53D6\u5DEE\u5F02","diff.noChanges":"\u6B64\u6587\u4EF6\u6CA1\u6709\u66F4\u6539","diff.fullFile":"\u5B8C\u6574\u6587\u4EF6","diff.layout":"\u5DEE\u5F02\u5E03\u5C40","diff.changes":"\u6B64\u6587\u4EF6\u4E2D\u7684\u66F4\u6539","diff.lines":"{count} \u884C","commit.placeholder":"\u63CF\u8FF0\u8FD9\u6B21\u66F4\u6539","commit.hintStage":"\u5148\u6682\u5B58\u4E00\u4E2A\u6587\u4EF6\u3002","commit.hintConflict":"\u8BF7\u5148\u89E3\u51B3\u51B2\u7A81\u3002","commit.hintMessage":"\u5199\u4E00\u6761\u63D0\u4EA4\u4FE1\u606F\u3002","commit.done":"\u5DF2\u63D0\u4EA4 {hash}","commit.amend":"\u4FEE\u8865\u4E0A\u6B21\u63D0\u4EA4","commit.noVerify":"\u8DF3\u8FC7\u94A9\u5B50","commit.noVerifyHint":"\u63D0\u4EA4\u65F6\u4E0D\u8FD0\u884C Git \u94A9\u5B50\u3002","branch.title":"\u5206\u652F\u5E76\u63D0\u4EA4","branch.name":"\u5206\u652F\u540D","branch.nameHint":"\u4ECE\u5F53\u524D HEAD \u521B\u5EFA\u5206\u652F\uFF0C\u7136\u540E\u63D0\u4EA4\u5DF2\u6682\u5B58\u7684\u66F4\u6539\u3002","branch.message":"\u63D0\u4EA4\u4FE1\u606F","branch.created":"\u5DF2\u521B\u5EFA {branch} \u5E76\u63D0\u4EA4","branch.current":"\u5F53\u524D\u5206\u652F","branch.local":"\u672C\u5730\u5206\u652F","branch.loading":"\u6B63\u5728\u8BFB\u53D6\u5206\u652F","branch.none":"\u6CA1\u6709\u5206\u652F","branch.new":"\u65B0\u5EFA\u5206\u652F","branch.newTitle":"\u65B0\u5EFA\u5206\u652F","branch.newHint":"\u4ECE\u5F53\u524D HEAD \u521B\u5EFA\u5E76\u5207\u6362\uFF0C\u4E0D\u4EA7\u751F\u63D0\u4EA4\u3002","branch.search":"\u641C\u7D22\u5206\u652F","branch.remote":"\u8FDC\u7AEF\u5206\u652F","branch.inWorktree":"\u5DF2\u5728\u5176\u4ED6\u5DE5\u4F5C\u6811\u68C0\u51FA","branch.createdOnly":"\u5DF2\u521B\u5EFA {branch}","branch.noneMatch":"\u6CA1\u6709\u5339\u914D\u7684\u5206\u652F","stash.title":"\u8D2E\u85CF\u66F4\u6539","stash.message":"\u8D2E\u85CF\u4FE1\u606F","stash.select":"\u8981\u8D2E\u85CF\u7684\u6587\u4EF6","stash.selectHint":"\u53EA\u8D2E\u85CF\u9009\u4E2D\u7684\u6587\u4EF6\u3002\u672A\u8DDF\u8E2A\u6587\u4EF6\u4E5F\u4F1A\u5305\u542B\u3002","stash.default":"WIP","stash.nothing":"\u6CA1\u6709\u53EF\u8D2E\u85CF\u7684\u6587\u4EF6\u3002","stash.created":"\u5DF2\u8D2E\u85CF {count} \u4E2A\u6587\u4EF6","stash.applied":"\u5DF2\u5E94\u7528 {ref}","stash.popped":"\u5DF2\u5F39\u51FA {ref}","stash.dropped":"\u5DF2\u5220\u9664 {ref}","stash.dropTitle":"\u5220\u9664\u8D2E\u85CF","stash.dropBody":"\u8FD9\u4F1A\u6C38\u4E45\u5220\u9664 {ref}\uFF0C\u4E14\u4E0D\u4F1A\u5E94\u7528\u5176\u4E2D\u7684\u66F4\u6539\u3002","discard.title":"\u4E22\u5F03\u66F4\u6539\uFF1F","discard.body":"{path} \u7684\u6240\u6709\u672C\u5730\u66F4\u6539\u90FD\u4F1A\u4E22\u5931\u3002\u6B64\u64CD\u4F5C\u65E0\u6CD5\u64A4\u9500\u3002","discard.deleteTitle":"\u5220\u9664\u672A\u8DDF\u8E2A\u6587\u4EF6\uFF1F","discard.deleteBody":"{path} \u672A\u88AB\u8DDF\u8E2A\u3002\u6587\u4EF6\u5C06\u4ECE\u78C1\u76D8\u5220\u9664\u3002\u6B64\u64CD\u4F5C\u65E0\u6CD5\u64A4\u9500\u3002","discard.confirm":"\u4E22\u5F03\u66F4\u6539","discard.deleteConfirm":"\u5220\u9664\u6587\u4EF6","discard.done":"\u5DF2\u4E22\u5F03 {name} \u7684\u66F4\u6539","discard.deleted":"\u5DF2\u5220\u9664 {name}","discard.titleMany":"\u4E22\u5F03 {count} \u4E2A\u6587\u4EF6\u7684\u66F4\u6539\uFF1F","discard.titleOne":"\u4E22\u5F03\u6B64\u6587\u4EF6\u7684\u66F4\u6539\uFF1F","discard.bodyMany":"\u8FD9\u4E9B\u6587\u4EF6\u7684\u6240\u6709\u672C\u5730\u66F4\u6539\u90FD\u4F1A\u4E22\u5931\u3002\u6B64\u64CD\u4F5C\u65E0\u6CD5\u64A4\u9500\u3002","discard.doneMany":"\u5DF2\u4E22\u5F03 {count} \u4E2A\u6587\u4EF6\u7684\u66F4\u6539","discard.doneOne":"\u5DF2\u4E22\u5F03\u6B64\u6587\u4EF6\u7684\u66F4\u6539","discard.more":"\u8FD8\u6709 {count} \u4E2A","sync.fetched":"\u5DF2\u83B7\u53D6","sync.pulled":"\u5DF2\u62C9\u53D6","sync.pulledStashed":"\u5DF2\u62C9\u53D6\u5E76\u6062\u590D\u672C\u5730\u66F4\u6539","sync.pulledStashConflict":"\u5DF2\u62C9\u53D6\uFF0C\u4F46\u90E8\u5206\u672C\u5730\u66F4\u6539\u672A\u80FD\u6062\u590D\u3002\u66F4\u6539\u4ECD\u4FDD\u7559\u5728\u201C\u8D2E\u85CF\u201D\u4E2D\u3002","sync.pushed":"\u5DF2\u63A8\u9001","sync.ahead":"\u9886\u5148 {count}","sync.behind":"\u843D\u540E {count}","sync.noUpstream":"\u6B64\u5206\u652F\u6CA1\u6709\u4E0A\u6E38\uFF0C\u63A8\u9001\u65F6\u4F1A\u8BBE\u7F6E\u3002","sync.none":"\u5DF2\u662F\u6700\u65B0","log.title":"\u5386\u53F2","log.loading":"\u6B63\u5728\u8BFB\u53D6\u5386\u53F2","log.select":"\u9009\u62E9\u4E00\u4E2A\u63D0\u4EA4","log.files":"\u66F4\u6539\u7684\u6587\u4EF6","log.noFiles":"\u6CA1\u6709\u6587\u4EF6\u66F4\u6539","log.author":"\u4F5C\u8005","log.date":"\u65E5\u671F","log.parent":"\u7236\u63D0\u4EA4","log.message":"\u4FE1\u606F","history.actions":"\u63D0\u4EA4\u64CD\u4F5C","history.copy":"\u590D\u5236\u63D0\u4EA4\u54C8\u5E0C","history.undo":"\u64A4\u9500\u6700\u540E\u4E00\u6B21\u63D0\u4EA4","history.undoHint":"HEAD \u56DE\u9000\uFF0C\u66F4\u6539\u4FDD\u7559\u5728\u6682\u5B58\u533A\u3002","history.revert":"\u8FD8\u539F\u63D0\u4EA4","history.revertHint":"\u751F\u6210\u53CD\u5411\u66F4\u6539\u5E76\u5199\u5165\u8FD8\u539F\u4FE1\u606F\u3002","history.cherryPick":"\u62E3\u9009\u63D0\u4EA4","history.cherryPickHint":"\u5728\u6B64\u5206\u652F\u5E94\u7528\u5E76\u63D0\u4EA4\u8BE5\u63D0\u4EA4\u3002","history.reset":"\u5C06\u5206\u652F\u91CD\u7F6E\u5230\u6B64\u5904","history.resetHint":"\u628A\u5F53\u524D\u5206\u652F\u79FB\u52A8\u5230\u6240\u9009\u63D0\u4EA4\u3002","history.blockedOperation":"\u8BF7\u5148\u5B8C\u6210\u5F53\u524D\u64CD\u4F5C\u3002","history.blockedNotHead":"\u53EA\u80FD\u64A4\u9500\u6700\u540E\u4E00\u6B21\u63D0\u4EA4\u3002","history.blockedDetached":"\u8BF7\u5148\u5207\u6362\u5230\u5206\u652F\u3002","history.blockedNoParent":"\u7B2C\u4E00\u4E2A\u63D0\u4EA4\u65E0\u6CD5\u64A4\u9500\u3002","history.blockedPushed":"\u8BE5\u63D0\u4EA4\u5DF2\u5728\u4E0A\u6E38\u5206\u652F\u4E0A\uFF0C\u8BF7\u6539\u7528\u8FD8\u539F\u3002","history.blockedMerge":"\u6B64\u5904\u4E0D\u652F\u6301\u5408\u5E76\u63D0\u4EA4\u3002","history.blockedStaged":"\u8BF7\u5148\u63D0\u4EA4\u6216\u53D6\u6D88\u6682\u5B58\u5DF2\u6682\u5B58\u7684\u6587\u4EF6\u3002","history.blockedContained":"\u5DF2\u5728\u5F53\u524D\u5206\u652F\u4E2D\u3002","history.blockedConflict":"\u8BF7\u5148\u89E3\u51B3\u51B2\u7A81\u3002","history.undoTitle":"\u64A4\u9500\u6700\u540E\u4E00\u6B21\u63D0\u4EA4\uFF1F","history.undoBody":"\u8BE5\u63D0\u4EA4\u4F1A\u79BB\u5F00\u5206\u652F\uFF0C\u66F4\u6539\u4FDD\u7559\u5728\u6682\u5B58\u533A\uFF0C\u53EF\u7EE7\u7EED\u7F16\u8F91\u5E76\u91CD\u65B0\u63D0\u4EA4\u3002","history.undoAction":"\u64A4\u9500\u63D0\u4EA4","history.revertTitle":"\u8FD8\u539F\u8FD9\u4E2A\u63D0\u4EA4\uFF1F","history.revertBody":"\u4F1A\u6682\u5B58\u53CD\u5411\u66F4\u6539\u5E76\u586B\u5165\u8FD8\u539F\u4FE1\u606F\uFF0C\u539F\u63D0\u4EA4\u4ECD\u4FDD\u7559\u5728\u5386\u53F2\u4E2D\u3002","history.revertAction":"\u8FD8\u539F\u63D0\u4EA4","history.resetTitle":"\u91CD\u7F6E\u8FD9\u4E2A\u5206\u652F\uFF1F","history.resetBody":"\u5206\u652F\u4F1A\u79FB\u52A8\u5230 {hash}\u3002\u9009\u62E9\u5176\u540E\u66F4\u6539\u7684\u5904\u7406\u65B9\u5F0F\u3002","history.resetModeSoft":"\u8F6F\u91CD\u7F6E","history.resetModeSoftHint":"\u66F4\u6539\u4FDD\u7559\u5728\u6682\u5B58\u533A\uFF0C\u53EF\u91CD\u65B0\u63D0\u4EA4\u3002","history.resetModeMixed":"\u6DF7\u5408\u91CD\u7F6E","history.resetModeMixedHint":"\u66F4\u6539\u4FDD\u7559\u5728\u5DE5\u4F5C\u533A\uFF0C\u4E0D\u6682\u5B58\u3002","history.resetModeHard":"\u786C\u91CD\u7F6E","history.resetModeHardHint":"\u4E22\u5F03\u8FD9\u4E9B\u63D0\u4EA4\u53CA\u5176\u66F4\u6539\u3002","history.resetHardWarning":"\u786C\u91CD\u7F6E\u4F1A\u4E22\u5F03\u8BE5\u63D0\u4EA4\u4E4B\u540E\u7684\u5168\u90E8\u672C\u5730\u66F4\u6539\uFF0C\u4E14\u65E0\u6CD5\u64A4\u9500\u3002","history.resetAction":"\u91CD\u7F6E\u5206\u652F","history.undone":"\u5DF2\u64A4\u9500\u63D0\u4EA4\uFF0C\u66F4\u6539\u5DF2\u6682\u5B58\u3002","history.reverted":"\u8FD8\u539F\u5DF2\u5C31\u7EEA\uFF0C\u8BF7\u68C0\u67E5\u540E\u63D0\u4EA4\u3002","history.revertConflicts":"\u8FD8\u539F\u9047\u5230\u51B2\u7A81\uFF0C\u8BF7\u89E3\u51B3\u540E\u63D0\u4EA4\u3002","history.picked":"\u5DF2\u62E3\u9009\u4E3A {hash}","history.resetDone":"\u5206\u652F\u5DF2\u91CD\u7F6E\u5230 {hash}","status.loading":"\u6B63\u5728\u8BFB\u53D6\u4ED3\u5E93","status.detached":"\u6E38\u79BB HEAD","error.title":"Git \u64CD\u4F5C\u5931\u8D25","error.notInstalled":"\u672A\u5B89\u88C5 Git","error.notInstalledHint":"\u5B89\u88C5 Git \u5E76\u786E\u4FDD\u5B83\u5728 PATH \u4E2D\uFF0C\u7136\u540E\u5237\u65B0\u3002","confirm.revertTitle":"\u8FD8\u539F\u8FD9\u4E2A\u533A\u5757\uFF1F","confirm.revertBody":"\u672C\u5730\u533A\u5757\u4F1A\u88AB\u5DF2\u6682\u5B58\u7248\u672C\u66FF\u6362\uFF0C\u8FD9\u90E8\u5206\u5DE5\u4F5C\u533A\u66F4\u6539\u4F1A\u4E22\u5931\u3002","confirm.checkoutTitle":"\u5207\u6362\u5206\u652F\uFF1F","confirm.checkoutBody":"\u5982\u679C Git \u80FD\u4FDD\u7559\uFF0C\u672C\u5730\u66F4\u6539\u4F1A\u5E26\u5230\u65B0\u5206\u652F\uFF0C\u5426\u5219\u4F1A\u62D2\u7EDD\u5207\u6362\u3002","confirm.yesRevert":"\u8FD8\u539F\u533A\u5757","confirm.yesCheckout":"\u5207\u6362\u5206\u652F","meta.binary":"\u4E8C\u8FDB\u5236","meta.blocks":"{count} \u4E2A\u533A\u5757","meta.add":"\u65B0\u589E {count}","meta.del":"\u5220\u9664 {count}","filter.placeholder":"\u8FC7\u6EE4\u6587\u4EF6","filter.clear":"\u6E05\u9664\u8FC7\u6EE4","meta.partial":"\u90E8\u5206","meta.partialHint":"\u6B64\u6587\u4EF6\u7684\u90E8\u5206\u66F4\u6539\u5DF2\u6682\u5B58","commit.stagedSummary":"\u5DF2\u6682\u5B58 {count} \u4E2A","commit.shortcut":"\u6309 {key}+Enter \u63D0\u4EA4","diff.added":"\u65B0\u589E","diff.removed":"\u5220\u9664","diff.blockCount":"{count} \u5904\u66F4\u6539","diff.blockCountOne":"1 \u5904\u66F4\u6539","stash.applyHint":"\u5E94\u7528\u66F4\u6539\u5E76\u4FDD\u7559\u8D2E\u85CF","stash.popHint":"\u5E94\u7528\u66F4\u6539\u5E76\u5220\u9664\u8D2E\u85CF","stash.dropHint":"\u5220\u9664\u8D2E\u85CF","filter.empty":'\u6CA1\u6709\u6587\u4EF6\u5339\u914D "{filter}"',"action.copyHash":"\u590D\u5236\u63D0\u4EA4\u54C8\u5E0C","action.copied":"\u5DF2\u590D\u5236\uFF01","diff.unstaged":"\u672A\u6682\u5B58","stash.selectAll":"\u5168\u9009","stash.deselectAll":"\u5168\u4E0D\u9009","header.label":"Git \u9762\u677F","settings.section":"Git","settings.model":"AI \u6A21\u578B","settings.modelHint":"\u7528\u4E8E\u751F\u6210\u63D0\u4EA4\u4FE1\u606F\u3002\u9ED8\u8BA4\u8DDF\u968F\u8F93\u5165\u6846\u9009\u62E9\u7684\u6A21\u578B\uFF0C\u4E4B\u540E\u5207\u6362\u4E5F\u4F1A\u8DDF\u968F\u3002","settings.modelSame":"\u4E0E\u8F93\u5165\u6846\u76F8\u540C","settings.modelEmpty":"\u6B64\u7248\u672C\u6CA1\u6709\u53EF\u7528\u6A21\u578B\u3002","settings.modelFailed":"\u65E0\u6CD5\u8BFB\u53D6\u6A21\u578B\u5217\u8868\u3002","settings.instruction":"\u63D0\u4EA4\u4FE1\u606F\u6307\u4EE4","settings.instructionHint":"\u8FD9\u4E9B\u5185\u5BB9\u51B3\u5B9A\u63AA\u8F9E\uFF0C\u6807\u9898\u884C type(scope): \u6458\u8981\u59CB\u7EC8\u5FC5\u586B\uFF0C\u53EF\u4EE5\u518D\u5199\u4E00\u6BB5\u8BF4\u660E\u3002","settings.instructionReset":"\u6062\u590D\u9ED8\u8BA4","settings.instructionFailed":"\u65E0\u6CD5\u8BFB\u53D6\u9ED8\u8BA4\u6307\u4EE4\u3002","command.toggle":"\u6253\u5F00\u6216\u6536\u8D77 Git \u9762\u677F","command.commit":"\u63D0\u4EA4\u5DF2\u6682\u5B58\u7684\u66F4\u6539","command.writeMessage":"\u7528 AI \u5199\u63D0\u4EA4\u4FE1\u606F","command.stageAll":"\u6682\u5B58\u5168\u90E8\u66F4\u6539","command.openFirst":"\u8BF7\u5148\u6253\u5F00 Git \u9762\u677F","command.nothingToStage":"\u6CA1\u6709\u53EF\u6682\u5B58\u7684\u66F4\u6539","command.notReady":"\u8BF7\u5148\u6682\u5B58\u6587\u4EF6\u5E76\u586B\u5199\u63D0\u4EA4\u4FE1\u606F","split.files":"\u8C03\u6574\u6587\u4EF6\u5217\u8868\u5BBD\u5EA6","split.commits":"\u8C03\u6574\u63D0\u4EA4\u5217\u8868\u5BBD\u5EA6"},Kt="dsh-git.layout",Ut="dsh-git.layout.compact",st="dsh-git.repo.";function ot(t,i){try{return window.localStorage.getItem(t)??i}catch{return i}}function Ie(t,i){try{window.localStorage.setItem(t,i)}catch{}}var Yi=/Mac|iPhone|iPad/.test(navigator.platform||navigator.userAgent)?"\u2318":"Ctrl",_t=new Map;function ni(t){let i=_t.get(t);if(i===void 0){let a=new Set,n=!1;i={hook:{getSnapshot:()=>n,subscribe(o){return a.add(o),()=>{a.delete(o)}}},set(o){if(o!==n){n=o;for(let r of[...a])r()}}},_t.set(t,i)}return i}var ai="dsh-git.preferences.v1";function Xi(){let t={model:null,instruction:""},i=ot(ai,"");if(i==="")return t;try{let a=JSON.parse(i),n=a!==null&&typeof a=="object"?a:{};return{model:Et(n.model),instruction:typeof n.instruction=="string"?n.instruction:""}}catch{return t}}var Rt=(()=>{let t=Xi(),i=new Set;return{hook:{getSnapshot:()=>t,subscribe(a){return i.add(a),()=>{i.delete(a)}}},set(a){t={model:Et(a.model),instruction:typeof a.instruction=="string"?a.instruction:""},Ie(ai,JSON.stringify(t));for(let n of[...i])n()}}})(),si="dsh-git.split",St=320,Ze=220,qt=280,ri=1e4,Yt=16;function Ji(){let t=Number.parseInt(ot(si,""),10);return Number.isFinite(t)?Math.min(Math.max(t,Ze),ri):St}var rt=(()=>{let t=Ji(),i=new Set;return{get:()=>t,subscribe(a){return i.add(a),()=>{i.delete(a)}},set(a){let n=Math.round(a);if(!(!Number.isFinite(n)||n===t)){t=Math.min(Math.max(n,Ze),ri),Ie(si,String(t));for(let o of[...i])o()}}}})();function oi(){let[t,i]=N(rt.get);return I(()=>(i(rt.get()),rt.subscribe(()=>i(rt.get()))),[]),[t,rt.set]}function li(t,i){let a=j(0);I(()=>{let n=t.current;if(n===null)return;let o=()=>{n.style.height="auto";let u=n.offsetHeight-n.clientHeight,d=n.closest(".gitp-root"),l=d===null?600:d.getBoundingClientRect().height,m=Math.max(140,Math.round(l*.45)),g=n.scrollHeight+u;n.style.height=`${Math.min(g,m)}px`,n.style.overflowY=g>m?"auto":"hidden"};if(o(),typeof ResizeObserver>"u")return;let r=n.parentElement;if(r===null)return;let p=new ResizeObserver(u=>{let d=u[0];if(d===void 0)return;let l=Math.round(d.contentRect.width);l!==a.current&&(a.current=l,o())});return p.observe(r),()=>p.disconnect()},[t,i])}function Xt(t){return JSON.stringify({provider:t.provider,model:t.model})}function Et(t){if(t===null||typeof t!="object")return null;let i=t;return typeof i.provider!="string"||i.provider===""||typeof i.model!="string"||i.model===""?null:{provider:i.provider,model:i.model}}function Zi(t){try{return Et(JSON.parse(t))}catch{return null}}function G(...t){return t.filter(Boolean).join(" ")}function lt(t){let i=t.lastIndexOf("/");return i===-1?{dir:"",base:t}:{dir:t.slice(0,i+1),base:t.slice(i+1)}}function Oe(t){return typeof t=="string"?t.slice(0,7):""}function Pt(t){switch(t){case"A":return"is-added";case"D":return"is-deleted";case"R":return"is-renamed";case"U":return"is-untracked";case"C":return"is-conflict";default:return"is-modified"}}function Jt(t){return String(t??"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,60)}function Qi(t,i){let a=Jt(String(t??"").split(/\r?\n/)[0]);if(a!=="")return a;let n=i?lt(i).base.replace(/\.[^.]+$/,""):"changes";return`${Jt(n)||"changes"}-changes`.slice(0,60)}function Zt(t){return t.match(/\s+|[A-Za-z0-9_]+|[^\sA-Za-z0-9_]/g)??[]}function en(t,i){if(t===i||t.length>2e3||i.length>2e3)return null;let a=Zt(t),n=Zt(i),o=0;for(;o<a.length&&o<n.length&&a[o]===n[o];)o+=1;let r=0;for(;r<a.length-o&&r<n.length-o&&a[a.length-1-r]===n[n.length-1-r];)r+=1;return{lPre:a.slice(0,o).join(""),lMid:a.slice(o,a.length-r).join(""),lSuf:r===0?"":a.slice(a.length-r).join(""),rPre:n.slice(0,o).join(""),rMid:n.slice(o,n.length-r).join(""),rSuf:r===0?"":n.slice(n.length-r).join("")}}function Qt(t,i,a){return i===""?e(pe.default.Fragment,null,t,a):e(pe.default.Fragment,null,t,e("span",{className:"gitp-word"},i),a)}function ei(t){let i=new Date(t);if(Number.isNaN(i.getTime()))return t;let a=Math.round((i.getTime()-Date.now())/1e3),n=new Intl.RelativeTimeFormat(void 0,{numeric:"auto"});if(Math.abs(a)<60)return n.format(a,"second");let o=Math.round(a/60);if(Math.abs(o)<60)return n.format(o,"minute");let r=Math.round(o/60);if(Math.abs(r)<24)return n.format(r,"hour");let p=Math.round(r/24);return Math.abs(p)<30?n.format(p,"day"):i.toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}function tn(t){let i=[],a=[];for(let n of t){let o=i.indexOf(n.hash);o===-1&&(o=i.length,i.push(n.hash));let r=n.parents??[];i[o]=r[0]??null;for(let p=1;p<r.length;p+=1){let u=r[p];u!==void 0&&i.splice(o+p,0,u)}for(;i.length>0&&i[i.length-1]===null;)i.pop();a.push({...n,lane:o,laneCount:Math.max(1,i.length)})}return a}function Ce(t){return t==null?"":t instanceof Error?t.message:String(t)}function P({path:t,size:i=16,viewBox:a="0 0 24 24",className:n,filled:o=!1}){return e("svg",{className:n,width:i,height:i,viewBox:a,fill:o?"currentColor":"none",stroke:o?"none":"currentColor",strokeWidth:o?0:1.8,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},e("path",{d:t}))}var x={branch:"M6 3v12a3 3 0 0 0 3 3h6M6 9h6a3 3 0 0 0 3-3V3M6 3.5a1 1 0 1 0 0-.1M18 3.5a1 1 0 1 0 0-.1M18 21a1 1 0 1 0 0-.1",changes:"M4 6h16M4 12h10M4 18h13M18 9l3 3-3 3",history:"M3 12a9 9 0 1 0 3-6.7M3 4v5h5M12 7v5l3 2",stash:"M4 8h16M6 8v11a1 1 0 0 0 1 1h10a1 1 0 0 0 1-1V8M9 8V5a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v3M10 12h4",plus:"M12 5v14M5 12h14",minus:"M5 12h14",left:"M19 12H5m0 0l6-6m-6 6l6 6",right:"M5 12h14m0 0l-6-6m6 6l-6 6",refresh:"M20 11a8 8 0 1 0-2.3 5.7M20 4v7h-7",fetch:"M6 15a4 4 0 0 1 .8-7.9 5 5 0 0 1 9.6-1.1A3.5 3.5 0 0 1 17 15M12 11v7m0 0l-3-3m3 3l3-3",pull:"M12 4v11m0 0l-4-4m4 4l4-4M5 20h14",push:"M12 20V9m0 0l-4 4m4-4l4 4M5 4h14",close:"M6 6l12 12M18 6L6 18",chevron:"M6 9l6 6 6-6",chevronUp:"M6 15l6-6 6 6",sparkles:"M12 3l1.9 5.1L19 10l-5.1 1.9L12 17l-1.9-5.1L5 10l5.1-1.9zM18.5 15l.9 2.1 2.1.9-2.1.9-.9 2.1-.9-2.1-2.1-.9 2.1-.9z",file:"M14 3H7a1 1 0 0 0-1 1v16a1 1 0 0 0 1 1h10a1 1 0 0 0 1-1V7zM14 3v4h4",code:"M8 7l-5 5 5 5M16 7l5 5-5 5",warning:"M12 3l9 16H3zM12 9v5M12 17v.5",check:"M5 12l5 5L20 7",folder:"M3 6a1 1 0 0 1 1-1h5l2 2h8a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1z",split:"M4 5h16v14H4zM12 5v14",unified:"M4 5h16M4 9h16M4 13h16M4 17h16",search:"M11 19a8 8 0 1 0 0-16 8 8 0 0 0 0 16zM21 21l-4.35-4.35",copy:"M8 4v12a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V7.242a2 2 0 0 0-.602-1.43L16.08 2.5a2 2 0 0 0-1.43-.5H10a2 2 0 0 0-2 2zM4 8H3a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-1",checkAlt:"M20 6L9 17l-5-5",more:"M6 12h.01M12 12h.01M18 12h.01",undo:"M9 14L4 9l5-5M4 9h10a6 6 0 0 1 0 12h-2",revert:"M10 7L5 12l5 5M5 12h9a5 5 0 0 1 5 5",cherry:"M12 17.5m-3.5 0a3.5 3.5 0 1 0 7 0a3.5 3.5 0 1 0 -7 0M7 6.5m-2.5 0a2.5 2.5 0 1 0 5 0a2.5 2.5 0 1 0 -5 0M12 14c0-3 2-5.5 6-7M12 14c-1-2.5-2.5-4-5-5.5",reset:"M3 12a9 9 0 1 0 3-6.7M3 4v5h5M12 8v4l2.5 2",trash:"M3 6h18M8 6V4h8v2M19 6l-1 14H6L5 6M10 11v5M14 11v5"},Fe=20;function bt({size:t=20}){return e("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none","aria-hidden":"true"},e("path",{d:"M12 3v18",stroke:"currentColor",strokeWidth:1.8,strokeLinecap:"round"}),e("path",{d:"M12 12c0-4 3-6 7-6h1",stroke:"currentColor",strokeWidth:1.8,strokeLinecap:"round"}),e("circle",{cx:12,cy:3.5,r:2.3,fill:"currentColor"}),e("circle",{cx:12,cy:12,r:2.3,fill:"currentColor"}),e("circle",{cx:12,cy:20.5,r:2.3,fill:"currentColor"}))}function nn({size:t=20}){return e(bt,{size:t})}var an=`
|
|
7
7
|
.gitp-root{--gitp-mono:var(--dsh-font-family-code,var(--dsh-font-family-code-default,ui-monospace,SFMono-Regular,Menlo,Consolas,monospace));--gitp-ease:cubic-bezier(.2,.7,.3,1);--gitp-hair:var(--dsh-hairline-width,.5px);--gitp-ring:var(--dsw-alias-state-business-primary);position:relative;display:flex;flex-direction:column;height:100%;min-height:0;width:100%;overflow:hidden;background:var(--dsw-alias-bg-base);color:var(--dsw-alias-label-primary);font-family:var(--dsw-font-family,system-ui,sans-serif);font-size:13px;line-height:20px;-webkit-font-smoothing:antialiased}
|
|
8
8
|
.gitp-root *{box-sizing:border-box}
|
|
9
9
|
.gitp-root button,.gitp-root input,.gitp-root textarea{font:inherit;color:inherit}
|
|
@@ -73,6 +73,7 @@ button[data-forge-header]{display:none}
|
|
|
73
73
|
.gitp-filerow{display:flex;align-items:center;gap:8px;width:100%;height:30px;padding:0 4px 0 8px;border:0;border-radius:var(--dsw-radius-sm,8px);background:transparent;cursor:pointer;text-align:left;color:var(--dsw-alias-label-primary);transition:background-color 100ms ease;user-select:none}
|
|
74
74
|
.gitp-filerow:hover{background:var(--dsw-alias-interactive-bg-hover)}
|
|
75
75
|
.gitp-filerow.is-selected{background:var(--dsw-alias-interactive-bg-active)}
|
|
76
|
+
.gitp-filerow.is-focused{box-shadow:inset 2px 0 0 var(--dsw-alias-state-business-primary)}
|
|
76
77
|
.gitp-status{display:inline-flex;align-items:center;justify-content:center;width:14px;font-family:var(--gitp-mono);font-size:11px;font-weight:600;flex:none}
|
|
77
78
|
.gitp-status.is-modified{color:var(--dsw-alias-state-business-primary)}
|
|
78
79
|
.gitp-status.is-added{color:var(--dsw-alias-state-success-primary)}
|
|
@@ -88,6 +89,14 @@ button[data-forge-header]{display:none}
|
|
|
88
89
|
.gitp-filerow:hover .gitp-rowaction,.gitp-filerow:focus-within .gitp-rowaction,.gitp-filerow.is-selected .gitp-rowaction,.gitp-rowaction:focus-visible{opacity:1}
|
|
89
90
|
.gitp-rowaction:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover-accent,var(--dsw-alias-interactive-bg-active));color:var(--dsw-alias-label-primary)}
|
|
90
91
|
.gitp-rowaction:disabled{opacity:.4;cursor:default}
|
|
92
|
+
.gitp-batchbar{display:flex;align-items:center;gap:2px;height:30px;margin:0 8px 4px;padding:0 2px 0 8px;border-radius:var(--dsw-radius-sm,8px);background:var(--dsw-alias-interactive-bg-active);flex:none}
|
|
93
|
+
.gitp-batch-count{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:12px;color:var(--dsw-alias-label-secondary);font-variant-numeric:tabular-nums}
|
|
94
|
+
.gitp-batch-btn{display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;padding:0;border:0;border-radius:6px;background:transparent;color:var(--dsw-alias-label-secondary);cursor:pointer;flex:none;transition:background-color 120ms ease,color 120ms ease}
|
|
95
|
+
.gitp-batch-btn:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}
|
|
96
|
+
.gitp-batch-btn.is-danger:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover-danger,color-mix(in srgb,var(--dsw-alias-state-error-primary) 12%,transparent));color:var(--dsw-alias-state-error-primary)}
|
|
97
|
+
.gitp-batch-btn:disabled{opacity:.4;cursor:default}
|
|
98
|
+
.gitp-confirm-paths{margin:8px 0 0;padding-left:18px;max-height:160px;overflow:auto;font-family:var(--gitp-mono);font-size:12px;line-height:18px;color:var(--dsw-alias-label-secondary)}
|
|
99
|
+
.gitp-confirm-more{margin-top:4px;font-size:12px;color:var(--dsw-alias-label-tertiary)}
|
|
91
100
|
.gitp-commitbox{position:relative;flex:none;padding:8px;display:flex;flex-direction:column;gap:6px;border-top:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-base)}
|
|
92
101
|
.gitp-commitbox textarea{display:block;box-sizing:border-box;width:100%;height:72px;min-height:72px;overflow-y:hidden;resize:none;padding:8px 10px;border:var(--gitp-hair) solid var(--dsw-alias-border-l4);border-radius:var(--dsw-radius-sm,8px);background:var(--dsw-specific-input-major,var(--dsw-alias-bg-layer-1));color:var(--dsw-alias-label-primary);font-size:13px;line-height:20px;transition:border-color 120ms ease}
|
|
93
102
|
.gitp-commitbox textarea:focus{outline:none;border-color:var(--dsw-alias-state-business-primary)}
|
|
@@ -318,7 +327,7 @@ button[data-forge-header]{display:none}
|
|
|
318
327
|
.gitp-settings select:focus,.gitp-settings textarea:focus{outline:none;border-color:var(--dsw-alias-state-business-primary)}
|
|
319
328
|
.gitp-settings select:focus-visible,.gitp-settings textarea:focus-visible{outline:2px solid var(--dsw-alias-state-business-primary);outline-offset:1px}
|
|
320
329
|
.gitp-settings-actions{display:flex;justify-content:flex-end}
|
|
321
|
-
`,qt="dsh-git-desk/styles";if(typeof document<"u"&&document.querySelector(`style[data-plugin-css=${JSON.stringify(qt)}]`)===null){let t=document.createElement("style");t.dataset.plugin="dsh-git-desk",t.dataset.pluginCss=qt,t.textContent=en,document.head.appendChild(t)}function ge({icon:t,title:i,hint:a,action:n}){return e("div",{className:"gitp-center"},t?e("div",{className:"gitp-center-icon"},t):null,e("div",{className:"gitp-center-title"},i),a?e("div",{className:"gitp-center-hint"},a):null,n??null)}function ee(){return e("span",{className:"gitp-spinner","aria-hidden":"true"})}function we({label:t,icon:i,onClick:a,disabled:n,active:r}){return e("button",{type:"button",className:$("gitp-iconbtn",r&&"is-active"),onClick:a,disabled:n,"aria-label":t,title:t},e(H,{path:i}))}function pt({label:t,icon:i,count:a,onClick:n,disabled:r,busy:o}){return e("button",{type:"button",className:$("gitp-toolbtn",a>0&&"has-count"),onClick:n,disabled:r||o,"aria-label":a>0?`${t}, ${a}`:t,title:a>0?`${t} (${a})`:t},o?e(ee):e(H,{path:i,size:14}),a>0?e("span",{className:"gitp-toolbtn-num"},a>99?"99+":String(a)):null)}function Ke({title:t,onClose:i,children:a,danger:n,closeLabel:r="Close"}){let o=I(null),u=I(i);return u.current=i,A(()=>{let d=document.activeElement,c=o.current;c?.querySelector("input, textarea, select, button")?.focus();let m=p=>{if(p.key==="Escape"){p.preventDefault(),p.stopPropagation(),u.current();return}if(p.key!=="Tab"||c===null)return;let b=[...c.querySelectorAll('button, input, textarea, select, [href], [tabindex]:not([tabindex="-1"])')].filter(g=>!g.hasAttribute("disabled")&&g.offsetParent!==null);if(b.length===0)return;let h=b[0],C=b[b.length-1];h===void 0||C===void 0||(p.shiftKey&&document.activeElement===h?(p.preventDefault(),C.focus()):!p.shiftKey&&document.activeElement===C&&(p.preventDefault(),h.focus()))};return document.addEventListener("keydown",m,!0),()=>{document.removeEventListener("keydown",m,!0),d instanceof HTMLElement&&typeof d.focus=="function"&&d.focus()}},[]),e("div",{className:"gitp-modal-layer",onMouseDown:d=>{d.target===d.currentTarget&&u.current()}},e("div",{className:$("gitp-modal",n&&"is-danger"),ref:o,role:"dialog","aria-modal":"true","aria-label":t},e("div",{className:"gitp-modal-head"},e("div",{className:"gitp-modal-title"},t),e(we,{label:r,icon:N.close,onClick:i})),a))}function yt({title:t,body:i,confirmLabel:a,cancelLabel:n,danger:r,busy:o,onConfirm:u,onClose:d}){return e(Ke,{title:t,onClose:d,danger:r},e("div",{className:"gitp-modal-sub"},i),e("div",{className:"gitp-modal-actions"},e("button",{type:"button",className:"gitp-btn",onClick:d,disabled:o},n),e("button",{type:"button",className:$("gitp-btn",r?"is-danger":"is-primary"),onClick:u,disabled:o},o?e(ee):null,a)))}function tn({t,defaultName:i,defaultMessage:a,busy:n,noVerify:r,error:o,onCreate:u,onNoVerify:d,onClose:c}){let[l,m]=k(i),[p,b]=k(a),h=I(null);ti(h,p);let C=l.trim()!==""&&p.trim()!==""&&!n;return e(Ke,{title:t("branch.title"),onClose:c,closeLabel:t("action.close")},e("div",{className:"gitp-field"},e("label",{htmlFor:"gitp-branch-name"},t("branch.name")),e("input",{id:"gitp-branch-name",value:l,onChange:g=>m(g.target.value),spellCheck:!1,autoComplete:"off"}),e("div",{className:"gitp-field-hint"},t("branch.nameHint"))),e("div",{className:"gitp-field"},e("label",{htmlFor:"gitp-branch-message"},t("branch.message")),e("textarea",{id:"gitp-branch-message",ref:h,value:p,onChange:g=>b(g.target.value)})),e("label",{className:"gitp-dialog-option",title:t("commit.noVerifyHint")},e("input",{type:"checkbox",checked:r,onChange:g=>d(g.target.checked),disabled:n}),t("commit.noVerify")),o?e("div",{className:"gitp-modal-error"},o):null,e("div",{className:"gitp-modal-actions"},e("button",{type:"button",className:"gitp-btn",onClick:c,disabled:n},t("action.cancel")),e("button",{type:"button",className:"gitp-btn is-primary",disabled:!C,onClick:()=>u({name:l.trim(),message:p.trim()})},n?e(ee):null,t("action.createBranch"))))}function nn({t,files:i,busy:a,error:n,onCreate:r,onClose:o}){let[u,d]=k(()=>new Set(i.map(p=>p.path))),[c,l]=k(""),m=p=>{d(b=>{let h=new Set(b);return h.has(p)?h.delete(p):h.add(p),h})};return e(Ke,{title:t("stash.title"),onClose:o,closeLabel:t("action.close")},e("div",{className:"gitp-modal-sub"},t("stash.selectHint")),i.length>1?e("div",{style:{display:"flex",justifyContent:"flex-end",marginBottom:"4px"}},e("button",{type:"button",className:"gitp-linkbtn",onClick:()=>d(u.size===i.length?new Set:new Set(i.map(p=>p.path)))},u.size===i.length?t("stash.deselectAll"):t("stash.selectAll"))):null,i.length===0?e("div",{className:"gitp-modal-sub"},t("stash.nothing")):e("div",{className:"gitp-filechecks"},i.map(p=>e("label",{className:"gitp-check",key:p.path},e("input",{type:"checkbox",checked:u.has(p.path),onChange:()=>m(p.path)}),e("span",{className:"gitp-check-path"},p.path)))),e("div",{className:"gitp-field"},e("label",{htmlFor:"gitp-stash-message"},t("stash.message")),e("input",{id:"gitp-stash-message",value:c,onChange:p=>l(p.target.value),placeholder:t("stash.default")})),n?e("div",{className:"gitp-modal-error"},n):null,e("div",{className:"gitp-modal-actions"},e("button",{type:"button",className:"gitp-btn",onClick:o,disabled:a},t("action.cancel")),e("button",{type:"button",className:"gitp-btn is-primary",disabled:a||u.size===0,onClick:()=>r({paths:[...u],message:c.trim()})},a?e(ee):null,t("action.stash"))))}function ut({entry:t,side:i,selected:a,busy:n,t:r,onSelect:o,onToggle:u}){let d=Ue(t.path),c=i==="staged"?t.stagedAdd:t.add,l=i==="staged"?t.stagedDel:t.del,m=r(i==="staged"?"action.unstageFile":"action.stageFile");return e("div",{className:$("gitp-filerow",a&&"is-selected"),role:"button",tabIndex:0,"aria-current":a?"true":void 0,onClick:()=>o(),onKeyDown:p=>{(p.key==="Enter"||p.key===" ")&&(p.preventDefault(),o())}},e("span",{className:$("gitp-status",vt(t.letter))},t.letter),e("span",{className:"gitp-filename"},d.dir?e("span",{className:"gitp-filedir"},d.dir):null,d.base,t.both?e("span",{className:"gitp-both-tag",title:r("meta.partialHint")},r("meta.partial")):null),t.binary?e("span",{className:"gitp-delta"},r("meta.binary")):e("span",{className:"gitp-delta"},c!==null&&c>0?e("span",{className:"gitp-add"},`+${c}`):null,l!==null&&l>0?e("span",{className:"gitp-del"},`\u2212${l}`):null),i==="conflict"?null:e("button",{type:"button",className:"gitp-rowaction","aria-label":m,title:m,disabled:n,onClick:p=>{p.stopPropagation(),u()}},e(H,{path:i==="staged"?N.minus:N.plus,size:14})))}function an({t,snapshot:i,conflicts:a,staged:n,unstaged:r,selection:o,onSelect:u,busy:d,fileBusy:c,onToggleFile:l,onToggleAll:m,onDiscard:p,diff:b,diffLoading:h,layout:C,onLayout:g,onRefresh:x,onBlock:y,onResolve:F,onOpen:S,message:W,onMessage:V,onCommit:P,onBranch:T,canCommit:E,commitBusy:L,aiBusy:M,aiMenuOpen:G,onAiToggle:U,onAiClose:q,onAiWrite:K,onAiBranch:Be,selectionKey:he,amend:re,onAmend:de,noVerify:z,onNoVerify:J,canAmend:oe,compact:ie,onBack:Me}){let[ne,le]=k(""),[be,me]=ei(),ze=I(null),Ae=I(null),Le=I(null);ti(Le,W);let[ae,Se]=k({conflicts:!1,staged:!1,unstaged:!1}),ve=f=>Se(_=>({..._,[f]:!_[f]})),ce=ne.trim().toLowerCase(),ke=f=>ce===""||f.path.toLowerCase().includes(ce),Ne=Re(()=>a.filter(ke),[a,ce]),Ce=Re(()=>n.filter(ke),[n,ce]),Z=Re(()=>r.filter(ke),[r,ce]),ye=o===null||o.side==="conflict"?null:(o.side==="staged"?n:r).find(f=>f.path===o.path)??null,Q=Re(()=>{let f=0,_=0;for(let Fe of n)f+=Fe.stagedAdd??0,_+=Fe.stagedDel??0;return{add:f,del:_}},[n]),v=!ie||o===null,R=!ie||o!==null,O=Ne.length+Ce.length+Z.length,j=a.length+n.length+r.length;return e("div",{className:"gitp-changes",ref:ze},v?e("div",{className:"gitp-listcol",ref:Ae,style:ie?void 0:{width:`${be}px`}},j>0?e("div",{className:"gitp-filter-box"},e(H,{path:N.search,size:13}),e("input",{type:"text",value:ne,onChange:f=>le(f.target.value),placeholder:t("filter.placeholder"),"aria-label":t("filter.placeholder"),spellCheck:!1}),ne?e("button",{type:"button",className:"gitp-filter-clear",onClick:()=>le(""),"aria-label":t("filter.clear")},e(H,{path:N.close,size:10})):null):null,e("div",{className:"gitp-filelist"},Ne.length>0?e(te.default.Fragment,null,e("div",{className:"gitp-section-head is-conflict",onClick:()=>ve("conflicts"),onKeyDown:f=>{f.target!==f.currentTarget||f.key!=="Enter"&&f.key!==" "||(f.preventDefault(),ve("conflicts"))},role:"button","aria-expanded":!ae.conflicts,tabIndex:0},e(H,{path:N.chevron,size:14,className:$("gitp-section-chev",ae.conflicts&&"is-collapsed")}),e("span",{className:"gitp-section-title"},t("section.conflicts")),e("span",{className:"gitp-section-count"},String(Ne.length))),ae.conflicts?null:Ne.map(f=>e(ut,{key:`conflict:${f.path}`,entry:f,side:"conflict",selected:o?.side==="conflict"&&o.path===f.path,busy:c,t,onSelect:()=>u({side:"conflict",path:f.path,renamed:!1}),onToggle:()=>{}}))):null,Ce.length>0?e(te.default.Fragment,null,e("div",{className:"gitp-section-head",onClick:()=>ve("staged"),onKeyDown:f=>{f.target!==f.currentTarget||f.key!=="Enter"&&f.key!==" "||(f.preventDefault(),ve("staged"))},role:"button","aria-expanded":!ae.staged,tabIndex:0},e(H,{path:N.chevron,size:14,className:$("gitp-section-chev",ae.staged&&"is-collapsed")}),e("span",{className:"gitp-section-title"},t("section.staged")),e("span",{className:"gitp-section-count"},String(Ce.length)),e("button",{type:"button",className:"gitp-section-action","aria-label":t("action.unstageAll"),title:t("action.unstageAll"),disabled:c,onClick:f=>{f.stopPropagation(),m("staged")}},e(H,{path:N.minus,size:14}))),ae.staged?null:Ce.map(f=>e(ut,{key:`staged:${f.path}`,entry:f,side:"staged",selected:o?.side==="staged"&&o.path===f.path,busy:c,t,onSelect:()=>u({side:"staged",path:f.path,renamed:f.kind==="renamed"}),onToggle:()=>l(f,"staged")}))):null,Z.length>0?e(te.default.Fragment,null,e("div",{className:"gitp-section-head",onClick:()=>ve("unstaged"),onKeyDown:f=>{f.target!==f.currentTarget||f.key!=="Enter"&&f.key!==" "||(f.preventDefault(),ve("unstaged"))},role:"button","aria-expanded":!ae.unstaged,tabIndex:0},e(H,{path:N.chevron,size:14,className:$("gitp-section-chev",ae.unstaged&&"is-collapsed")}),e("span",{className:"gitp-section-title"},t("section.unstaged")),e("span",{className:"gitp-section-count"},String(Z.length)),e("button",{type:"button",className:"gitp-section-action","aria-label":t("action.stageAll"),title:t("action.stageAll"),disabled:c,onClick:f=>{f.stopPropagation(),m("unstaged")}},e(H,{path:N.plus,size:14}))),ae.unstaged?null:Z.map(f=>e(ut,{key:`unstaged:${f.path}`,entry:f,side:"unstaged",selected:o?.side==="unstaged"&&o.path===f.path,busy:c,t,onSelect:()=>u({side:"unstaged",path:f.path,renamed:f.kind==="renamed"}),onToggle:()=>l(f,"unstaged")}))):null,ce!==""&&O===0?e("div",{className:"gitp-center",style:{padding:"24px"}},t("filter.empty",{filter:ne})):null,j===0?e(ge,{icon:e(H,{path:N.check,size:28}),title:t("empty.noChanges"),hint:t("empty.noChangesHint"),action:e("button",{type:"button",className:"gitp-btn is-small",onClick:x,disabled:d},t("action.refresh"))}):null),e("div",{className:"gitp-commitbox"},e("textarea",{ref:Le,value:W,onChange:f=>V(f.target.value),onKeyDown:f=>{f.defaultPrevented||(f.ctrlKey||f.metaKey)&&f.key==="Enter"&&(f.preventDefault(),E&&!L&&P())},placeholder:t("commit.placeholder"),"aria-label":t("commit.placeholder")}),e("div",{className:$("gitp-commit-status-line",a.length>0&&"has-conflict")},a.length>0?e("span",null,t("commit.hintConflict")):n.length>0?e(te.default.Fragment,null,e("span",null,t("commit.stagedSummary",{count:n.length})," ",e("span",{className:"gitp-add"},`+${Q.add}`)," ",e("span",{className:"gitp-del"},`\u2212${Q.del}`)),e("span",null,t("commit.shortcut",{key:Ki}))):e("span",null,t("commit.hintStage"))),e("div",{className:"gitp-commit-actions"},e("div",{className:"gitp-commit-opts"},oe?e("label",{className:"gitp-amend"},e("input",{type:"checkbox",checked:re,onChange:f=>de(f.target.checked)}),t("commit.amend")):null,e("label",{className:"gitp-amend",title:t("commit.noVerifyHint")},e("input",{type:"checkbox",checked:z,onChange:f=>J(f.target.checked),disabled:L}),t("commit.noVerify"))),e("div",{className:"gitp-ai-wrap"},e("button",{type:"button",className:"gitp-btn is-small is-icon","aria-label":t("ai.action"),"aria-haspopup":"menu","aria-expanded":G===!0,title:t("ai.action"),disabled:L||M||n.length===0,onClick:U},M?e(ee):e(H,{path:N.sparkles,size:13}))),e("button",{type:"button",className:"gitp-btn is-small",onClick:T,disabled:L||a.length>0||n.length===0,"aria-label":t("action.branch")},e(H,{path:N.branch,size:13}),t("action.branch")),e("button",{type:"button",className:"gitp-btn is-primary is-small",onClick:P,disabled:!E||L},L?e(ee):null,t(L?"action.committing":"action.commit"))),G?e(ln,{t,busy:M,canUse:n.length>0,canBranch:n.length>0&&a.length===0,onWrite:K,onBranch:Be,onClose:q}):null)):null,v&&R?e(ni,{label:t("split.files"),containerRef:ze,columnRef:Ae,width:be,onChange:me}):null,R?e("div",{className:"gitp-diffcol"},o?e(ii,{t,diff:b,loading:h,layout:C,onLayout:g,onBlock:y,onResolve:F,busy:c,selectionKey:he,renamed:o.renamed===!0,compact:ie,onBack:Me,onOpen:S,onDiscard:ye===null?void 0:()=>p(ye)}):e(ge,{icon:e(H,{path:N.file,size:28}),title:t("empty.selectFile"),hint:t("empty.selectFileHint")})):null)}function ii({t,diff:i,loading:a,layout:n,onLayout:r,onBlock:o,onResolve:u,busy:d,selectionKey:c,renamed:l=!1,compact:m,onBack:p,onOpen:b,onDiscard:h}){let C=I(null),[g,x]=k({index:-1,canPrev:!1,canNext:!1}),y=Re(()=>i===null?[]:[...i.blocks??[]].sort((T,E)=>T.row-E.row),[i]),F=()=>{let T=C.current;if(T===null)return[];let E=[...T.querySelectorAll(".gitp-pane")];if(E.length>0)return E;let L=T.querySelector(".gitp-unified");return L===null?[]:[L]},S=T=>{let E=-1;for(let L=0;L<y.length;L+=1){let M=y[L];M!==void 0&&M.row*Ee<=T+40&&(E=L)}return{index:E,canPrev:E>0,canNext:y.some(L=>L.row*Ee>T+40)}};A(()=>{let T=C.current;if(T===null)return;let E=0,L=()=>{let G=F()[0];x(S(G===void 0?0:G.scrollTop))},M=()=>{E===0&&(E=requestAnimationFrame(()=>{E=0,L()}))};return T.addEventListener("scroll",M,!0),L(),()=>{T.removeEventListener("scroll",M,!0),E!==0&&cancelAnimationFrame(E)}},[i,n]);let W=T=>{let E=F()[0],L=E===void 0?0:E.scrollTop,M=null;if(T>0)M=y.find(K=>K.row*Ee>L+40)??null;else{for(let K of y)K.row*Ee<=L+40&&(M=K);M=M===null?null:y[y.indexOf(M)-1]??null}if(M===null)return;let G=Math.max(0,M.row*Ee-40),U=F();for(let K of U)K.scrollTop=G;let q=U[0]===void 0?G:U[0].scrollTop;x(S(q))};if(a&&i===null)return e("div",{className:"gitp-diff"},e("div",{className:"gitp-center"},e(ee),e("div",{className:"gitp-center-hint"},t("diff.loading"))));if(i===null)return e("div",{className:"gitp-diff"},e(ge,{icon:e(H,{path:N.file,size:28}),title:t("empty.selectFile"),hint:t("empty.selectFileHint")}));let V=Ue(i.path),P={left:i.labels.left==="HEAD"?t("diff.head"):i.labels.left==="Staged"?t("diff.staged"):i.labels.left==="Local"?t("diff.local"):i.labels.left==="Parent"?t("diff.parent"):i.labels.left,right:i.labels.right==="Staged"?t("diff.staged"):i.labels.right==="Local"?t("diff.local"):i.labels.right==="Commit"?t("diff.commit"):i.labels.right==="Incoming"?t("action.acceptTheirs"):i.labels.right};return e("div",{className:"gitp-diff",ref:C},e("div",{className:"gitp-diff-head"},m&&p?e(we,{label:t("action.back"),icon:N.left,onClick:p}):null,e("div",{className:"gitp-diff-title"},e("span",{className:$("gitp-status",vt(i.conflict?"C":"M"))},i.conflict?"C":"M"),e("div",{className:"gitp-diff-path"},V.dir?e("span",{className:"gitp-diff-dir"},V.dir):null,e("span",{className:"gitp-diff-base"},V.base)),i.conflict?e("span",{className:"gitp-diff-pill is-conflict"},t("section.conflicts")):i.side==="staged"?e("span",{className:"gitp-diff-pill is-staged"},t("diff.staged")):i.side==="unstaged"?e("span",{className:"gitp-diff-pill is-unstaged"},t("diff.unstaged")):i.side==="log"?e("span",{className:"gitp-diff-pill is-commit"},t("diff.commit")):null),i.conflict?e("span",{className:"gitp-diff-stats gitp-del"},t("section.conflicts")):i.binary?e("span",{className:"gitp-diff-stats"},t("diff.binary")):e("span",{className:"gitp-diff-stats"},e("span",{className:"gitp-add"},`+${i.add??0}`),e("span",{className:"gitp-del"},`\u2212${i.del??0}`)),y.length>0&&!i.conflict&&!i.binary?e("div",{className:"gitp-change-nav",role:"group","aria-label":t("diff.changes")},e(we,{label:t("action.prevChange"),icon:N.chevronUp,onClick:()=>W(-1),disabled:!g.canPrev}),e("span",{className:"gitp-change-count"},`${Math.max(0,g.index)+1}/${y.length}`),e(we,{label:t("action.nextChange"),icon:N.chevron,onClick:()=>W(1),disabled:!g.canNext})):null,e("div",{className:"gitp-diff-actions"},b!==void 0&&!i.binary?e(we,{label:t("action.openEditor"),icon:N.code,onClick:()=>b(i)}):null,i.conflict?null:e("div",{className:"gitp-seg",role:"group","aria-label":t("diff.layout")},e("button",{type:"button",className:n==="split"?"is-active":"","aria-pressed":n==="split","aria-label":t("diff.split"),title:t("diff.split"),onClick:()=>r("split")},e(H,{path:N.split,size:13})),e("button",{type:"button",className:n==="unified"?"is-active":"","aria-pressed":n==="unified","aria-label":t("diff.unified"),title:t("diff.unified"),onClick:()=>r("unified")},e(H,{path:N.unified,size:13}))),h!==void 0?e(we,{label:t("action.discard"),icon:N.trash,onClick:h,disabled:d}):null)),i.conflict?e("div",{className:"gitp-conflict-banner"},e(H,{path:N.warning,size:14}),e("span",null,t("diff.conflictBanner")),e("button",{type:"button",className:"gitp-btn is-small",onClick:()=>u?.("ours"),disabled:d},t("action.acceptOurs")),e("button",{type:"button",className:"gitp-btn is-small",onClick:()=>u?.("theirs"),disabled:d},t("action.acceptTheirs"))):null,i.binary?e("div",{className:"gitp-binary"},e("div",{className:"gitp-binary-title"},t("diff.binary")),e("div",null,t("diff.binaryHint",{before:i.leftSize??0,after:i.rightSize??0}))):i.conflict?e(sn,{diff:i}):n==="unified"?e(on,{t,diff:i,onBlock:o,busy:d,selectionKey:c,renamed:l}):e(rn,{t,diff:i,labels:P,onBlock:o,busy:d,selectionKey:c,renamed:l}),!i.binary&&!i.conflict?e("div",{className:"gitp-diff-foot"},e("span",{className:"gitp-diff-legend"},e("span",{className:"gitp-diff-dot is-add"}),t("diff.added")),e("span",{className:"gitp-diff-legend"},e("span",{className:"gitp-diff-dot is-del"}),t("diff.removed")),e("span",{className:"gitp-diff-foot-spacer"}),e("span",null,y.length===1?t("diff.blockCountOne"):t("diff.blockCount",{count:y.length}))):null)}function sn({diff:t}){return e("div",{className:"gitp-unified"},t.right.map((i,a)=>e("div",{className:$("gitp-urow",/^(<{7}|={7}|>{7})/.test(i)&&"is-conflict-marker"),key:a},e("span",{className:"gitp-uno"},a+1),e("span",{className:"gitp-ucontent"},i||"\xA0"))))}function rn({t,diff:i,labels:a,onBlock:n,busy:r,selectionKey:o,renamed:u}){let d=I(null),c=I(null),l=I(null),m=g=>{l.current&&(l.current.style.transform=`translateY(${-g}px)`)},p=g=>{let x=g.scrollTop;d.current&&d.current!==g&&(d.current.scrollTop=x),c.current&&c.current!==g&&(c.current.scrollTop=x),m(x)};A(()=>{let g=i.blocks[0];if(!g||g.row<=10)return;let x=Math.max(0,g.row*Ee-80);d.current&&(d.current.scrollTop=x),c.current&&(c.current.scrollTop=x),m(x)},[o]);let b=Re(()=>{let g=new Map;for(let x of i.rows){if(x.k!=="mod"||x.l===null||x.r===null)continue;let y=i.left[x.l-1]??"",F=i.right[x.r-1]??"";g.set(x,Ji(y,F))}return g},[i]),h=Re(()=>{let g=new Map;for(let x of i.blocks)g.set(x.row,x);return g},[i]),C=g=>{if(u)return[];let x={action:"unstaged",icon:N.left,label:t("action.stageBlock"),revert:!1},y={action:"revert",icon:N.right,label:t("action.revertBlock"),revert:!0};return i.side==="unstaged"?i.leftMissing?[x]:[x,y]:i.side==="staged"?[{action:"staged",icon:N.right,label:t("action.unstageBlock"),revert:!1}]:[]};return e(te.default.Fragment,null,e("div",{className:"gitp-pane-heads"},e("div",{className:"gitp-pane-head"},a.left),e("div",{className:"gitp-pane-head-gutter"}),e("div",{className:"gitp-pane-head"},a.right)),e("div",{className:"gitp-panes"},e("div",{className:"gitp-pane",ref:d,tabIndex:0,role:"region","aria-label":a.left,onScroll:g=>p(g.currentTarget)},i.rows.map((g,x)=>{let y=g.l?i.left[g.l-1]??"":"",F=g.k==="add"?"blank":g.k==="mod"?"del":g.k,S=b.get(g);return e("div",{className:$("gitp-line",F!=="ctx"&&`is-${F}`),key:`l${x}`},e("span",{className:"gitp-ln"},g.l??""),e("span",{className:"gitp-code"},g.l===null?"\xA0":S?Kt(S.lPre,S.lMid,S.lSuf):y||"\xA0"))})),e("div",{className:"gitp-gutter","aria-hidden":!1},e("div",{className:"gitp-gutter-inner",ref:l},i.blocks.map(g=>{let x=C(g);return x.length===0?null:e("div",{className:"gitp-arrows",key:g.id,style:{top:g.row*Ee}},x.map(y=>e("button",{type:"button",className:$("gitp-arrow",y.revert&&"is-revert"),key:y.action,"aria-label":y.label,title:y.label,disabled:r,onClick:()=>n(g,y.action)},e(H,{path:y.icon,size:12}))))}))),e("div",{className:"gitp-pane",ref:c,tabIndex:0,role:"region","aria-label":a.right,onScroll:g=>p(g.currentTarget)},i.rows.map((g,x)=>{let y=g.r?i.right[g.r-1]??"":"",F=g.k==="del"?"blank":g.k==="mod"?"add":g.k,S=b.get(g);return e("div",{className:$("gitp-line",F!=="ctx"&&`is-${F}`),key:`r${x}`},e("span",{className:"gitp-ln"},g.r??""),e("span",{className:"gitp-code"},g.r===null?"\xA0":S?Kt(S.rPre,S.rMid,S.rSuf):y||"\xA0"))}))))}function on({t,diff:i,onBlock:a,busy:n,selectionKey:r,renamed:o}){let u=Re(()=>{let l=new Map;for(let p of i.blocks)l.set(p.row,p);let m=[];return i.rows.forEach((p,b)=>{let h=l.get(b),C=p.l===null?"":i.left[p.l-1]??"",g=p.r===null?"":i.right[p.r-1]??"";p.k==="ctx"?m.push({l:p.l,r:p.r,text:C,kind:"ctx",block:h}):p.k==="mod"?(m.push({l:p.l,r:null,text:C,kind:"del",block:h}),m.push({l:null,r:p.r,text:g,kind:"add"})):p.k==="del"?m.push({l:p.l,r:null,text:C,kind:"del",block:h}):m.push({l:null,r:p.r,text:g,kind:"add",block:h})}),m},[i]),d=I(null);A(()=>{let l=u.find(m=>m.block!==void 0);!l||u.indexOf(l)<=10||d.current===null||(d.current.scrollTop=Math.max(0,u.indexOf(l)*Ee-80))},[r]);let c=l=>{if(o)return[];let m={action:"unstaged",icon:N.left,label:t("action.stageBlock"),revert:!1},p={action:"revert",icon:N.right,label:t("action.revertBlock"),revert:!0};return i.side==="unstaged"?i.leftMissing?[m]:[m,p]:i.side==="staged"?[{action:"staged",icon:N.right,label:t("action.unstageBlock"),revert:!1}]:[]};return e("div",{className:"gitp-unified",ref:d,tabIndex:0,role:"region","aria-label":t("diff.unified")},u.map((l,m)=>{let p=l.block?c(l.block):[];return e("div",{className:$("gitp-urow",l.kind!=="ctx"&&`is-${l.kind}`),key:m},e("span",{className:"gitp-uarrows"},p.map(b=>e("button",{type:"button",className:$("gitp-arrow",b.revert&&"is-revert"),key:b.action,"aria-label":b.label,title:b.label,disabled:n,onClick:()=>{l.block!==void 0&&a(l.block,b.action)}},e(H,{path:b.icon,size:12})))),e("span",{className:"gitp-uno"},l.l??""),e("span",{className:"gitp-uno"},l.r??""),e("span",{className:"gitp-ucontent"},l.text||"\xA0"))}))}function ln({t,busy:i,canUse:a,canBranch:n,onWrite:r,onBranch:o,onClose:u}){let d=I(u);d.current=u;let c=I(null);A(()=>{let m=b=>{b.key==="Escape"&&(b.preventDefault(),b.stopPropagation(),d.current())},p=b=>{let h=b.target;c.current!==null&&h instanceof Node&&c.current.contains(h)||h instanceof Element&&h.closest(".gitp-ai-wrap")!==null||d.current()};return document.addEventListener("keydown",m,!0),document.addEventListener("mousedown",p,!0),()=>{document.removeEventListener("keydown",m,!0),document.removeEventListener("mousedown",p,!0)}},[]);let l=(m,p,b,h,C)=>e("button",{type:"button",key:m,className:"gitp-popover-row",role:"menuitem",disabled:h,onClick:C},e(H,{path:p,size:13}),e("span",{className:"gitp-popover-row-text"},b));return e("div",{className:"gitp-popover is-menu",ref:c,role:"menu","aria-label":t("ai.action")},l("write",N.sparkles,t("ai.write"),!a||i,r),l("branch",N.branch,t("ai.branch"),!n||i,o))}function cn({t,workspaceTitle:i,branch:a,repo:n,ahead:r,behind:o,upstream:u,onBranchMenu:d,onRepoMenu:c,repos:l,repoRoot:m,onSync:p,busy:b,onRefresh:h,syncing:C}){let g=a?.name??(a?.oid?De(a.oid):t(n===!1?"empty.noRepo":"status.detached")),x=l.find(V=>V.root===m)??null,y=l[0],F=l.length>1||y!==void 0&&l.length===1&&y.name!=="."&&!y.name.startsWith(".."),S=x===null?t("repo.none"):x.name==="."?t("repo.workspace"):x.label??x.name,W=x?.worktree===!0;return e("div",{className:"gitp-head"},e("div",{className:"gitp-head-left"},e("span",{className:"gitp-repo"},i),F?e("button",{type:"button",className:"gitp-branch gitp-repo-pick",onClick:c,"aria-haspopup":"listbox","aria-label":t("repo.pick"),title:t("repo.pick")},e(H,{path:N.folder,size:13}),e("span",{className:"gitp-branch-name"},S),e("span",{className:"gitp-chevron"},e(H,{path:N.chevron,size:11}))):null,e("button",{type:"button",className:"gitp-branch",onClick:d,disabled:n===!1,"aria-haspopup":"listbox","aria-label":t("branch.title"),title:t("branch.title")},e(H,{path:N.branch,size:13}),e("span",{className:"gitp-branch-name"},g),e("span",{className:"gitp-chevron"},e(H,{path:N.chevron,size:11}))),W?e("span",{className:"gitp-worktree",title:m??void 0},t("repo.worktree")):null),e("div",{className:"gitp-head-right"},e(pt,{label:t("action.fetch"),icon:N.fetch,count:0,onClick:()=>p("fetch"),busy:C==="fetch",disabled:b}),e(pt,{label:t("action.pull"),icon:N.pull,count:o,onClick:()=>p("pull"),busy:C==="pull",disabled:b||u===null}),e(pt,{label:t("action.push"),icon:N.push,count:r,onClick:()=>p("push"),busy:C==="push",disabled:b}),e(we,{label:t("action.refresh"),icon:N.refresh,onClick:h,disabled:b})))}function dn({t,mode:i,onMode:a,counts:n}){let r=[{id:"changes",label:t("mode.changes"),count:n.changes},{id:"log",label:t("mode.log"),count:0},{id:"stash",label:t("mode.stash"),count:0}];return e("nav",{className:"gitp-rail","aria-label":t("panel")},r.map(o=>e("button",{type:"button",key:o.id,className:$("gitp-rail-item",i===o.id&&"is-active"),onClick:()=>a(o.id),"aria-label":o.count>0?`${o.label}, ${o.count}`:o.label,"aria-current":i===o.id?"page":void 0},e("span",{className:"gitp-rail-label"},o.label),o.count>0?e("span",{className:"gitp-rail-count"},String(o.count)):null)))}function pn({t,repos:i,current:a,onPick:n,onInitRoot:r,onClose:o}){let u=I(null),d=I(o);d.current=o,A(()=>{u.current?.querySelector("button:not(:disabled)")?.focus();let l=m=>{m.key==="Escape"&&(m.preventDefault(),m.stopPropagation(),d.current())};return document.addEventListener("keydown",l,!0),()=>document.removeEventListener("keydown",l,!0)},[]);let c=!i.some(l=>!l.worktree&&(l.name==="."||l.name.startsWith("..")));return e("div",{className:"gitp-popover-layer",onMouseDown:l=>{l.target===l.currentTarget&&d.current()}},e("div",{className:"gitp-popover is-wide",ref:u,role:"listbox","aria-label":t("repo.title")},e("div",{className:"gitp-popover-title"},t("repo.title")),e("div",{className:"gitp-popover-list"},i.map(l=>e("button",{type:"button",key:l.root,className:$("gitp-popover-row",l.worktree&&"is-nested"),role:"option","aria-selected":l.root===a,disabled:l.root===a,title:l.root,onClick:()=>n(l.root)},e(H,{path:l.worktree?N.branch:N.folder,size:13}),e("span",{className:"gitp-popover-row-text"},l.name==="."?t("repo.workspace"):l.label??l.name),l.worktree&&l.branch!==null?e("span",{className:"gitp-popover-hint"},l.branch):null,l.root===a?e(H,{path:N.check,size:13,className:"gitp-checkmark"}):null))),c?e(te.default.Fragment,null,e("div",{className:"gitp-popover-sep"}),e("button",{type:"button",className:"gitp-popover-row",onClick:r},e(H,{path:N.plus,size:13}),e("span",{className:"gitp-popover-row-text"},t("repo.initRoot")))):null))}function un({t,branches:i,loading:a,busy:n,onCheckout:r,onNew:o,onClose:u}){let d=I(null),c=I(u);c.current=u;let[l,m]=k("");A(()=>{d.current?.querySelector("input")?.focus();let S=W=>{W.key==="Escape"&&(W.preventDefault(),W.stopPropagation(),c.current())};return document.addEventListener("keydown",S,!0),()=>document.removeEventListener("keydown",S,!0)},[]);let p=l.trim().toLowerCase(),b=i.filter(S=>!S.remote),h=new Set(b.map(S=>S.name)),C=i.filter(S=>{if(!S.remote)return!1;let W=S.name.split("/").slice(1).join("/");return W!==""&&!h.has(W)}),g=S=>p===""||S.name.toLowerCase().includes(p),x=b.filter(g),y=C.filter(g),F=(S,W)=>S.map(V=>{let P=V.worktree!==null;return e("button",{type:"button",key:`${W?"r":"l"}:${V.name}`,className:"gitp-popover-row",role:"option","aria-selected":V.current===!0,disabled:n||V.current===!0||P,title:P?`${t("branch.inWorktree")}: ${V.worktree??""}`:void 0,onClick:()=>r(V.name,W)},e(H,{path:N.branch,size:13}),e("span",{className:"gitp-popover-row-text"},V.name),P?e("span",{className:"gitp-popover-hint"},V.worktree??""):null,V.current?e(H,{path:N.check,size:13,className:"gitp-checkmark"}):null)});return e("div",{className:"gitp-popover-layer",onMouseDown:S=>{S.target===S.currentTarget&&c.current()}},e("div",{className:"gitp-popover is-wide",ref:d,role:"listbox","aria-label":t("branch.local")},e("input",{className:"gitp-search",value:l,placeholder:t("branch.search"),onChange:S=>m(S.target.value),"aria-label":t("branch.search")}),e("button",{type:"button",className:"gitp-popover-row",disabled:n,onClick:o},e(H,{path:N.plus,size:13}),e("span",{className:"gitp-popover-row-text"},t("branch.new"))),e("div",{className:"gitp-popover-sep"}),a?e("div",{className:"gitp-modal-sub"},t("branch.loading")):null,!a&&x.length===0&&y.length===0?e("div",{className:"gitp-modal-sub"},t(p===""?"branch.none":"branch.noneMatch")):null,x.length>0?e(te.default.Fragment,null,e("div",{className:"gitp-popover-title"},t("branch.local")),e("div",{className:"gitp-popover-list"},F(x,!1))):null,y.length>0?e(te.default.Fragment,null,e("div",{className:"gitp-popover-title"},t("branch.remote")),e("div",{className:"gitp-popover-list"},F(y,!0))):null))}function gn({t,busy:i,error:a,onCreate:n,onClose:r}){let[o,u]=k("");return e(Ke,{title:t("branch.newTitle"),onClose:r,closeLabel:t("action.close")},e("div",{className:"gitp-field"},e("label",{htmlFor:"gitp-new-branch"},t("branch.name")),e("input",{id:"gitp-new-branch",value:o,onChange:d=>u(d.target.value),spellCheck:!1,autoComplete:"off"}),e("div",{className:"gitp-field-hint"},t("branch.newHint"))),a?e("div",{className:"gitp-modal-error"},a):null,e("div",{className:"gitp-modal-actions"},e("button",{type:"button",className:"gitp-btn",onClick:r,disabled:i},t("action.cancel")),e("button",{type:"button",className:"gitp-btn is-primary",disabled:i||o.trim()==="",onClick:()=>n({name:o.trim()})},i?e(ee):null,t("action.createAndSwitch"))))}function hn(t,i,a,n){let r=i?.branch??null,o=i?.merging===!0||i?.rebasing===!0||i?.reverting===!0||i?.cherryPicking===!0,u=(i?.conflicts?.length??0)>0,d=(i?.entries??[]).some(C=>C.staged),c=r===null||r.detached===!0,l=r?.oid!==null&&r?.oid!==void 0&&r.oid===t.hash,m=typeof r?.upstream=="string"&&r.upstream!==""&&r.ahead===0,p=(t.parents?.length??0)>1,b=[];b.push({id:"copy",label:n("history.copy"),icon:N.copy,hint:null,reason:null});let h=null;return o?h=n("history.blockedOperation"):c?h=n("history.blockedDetached"):l?(t.parents?.length??0)===0?h=n("history.blockedNoParent"):m&&(h=n("history.blockedPushed")):h=n("history.blockedNotHead"),b.push({id:"undo",label:n("history.undo"),icon:N.undo,hint:n("history.undoHint"),reason:h}),h=null,o?h=n("history.blockedOperation"):p?h=n("history.blockedMerge"):u?h=n("history.blockedConflict"):d&&(h=n("history.blockedStaged")),b.push({id:"revert",label:n("history.revert"),icon:N.revert,hint:n("history.revertHint"),reason:h}),h=null,o?h=n("history.blockedOperation"):p?h=n("history.blockedMerge"):u?h=n("history.blockedConflict"):a.has(t.hash)&&(h=n("history.blockedContained")),b.push({id:"cherry",label:n("history.cherryPick"),icon:N.cherry,hint:n("history.cherryPickHint"),reason:h}),h=null,o?h=n("history.blockedOperation"):c&&(h=n("history.blockedDetached")),b.push({id:"reset",label:n("history.reset"),icon:N.reset,hint:n("history.resetHint"),reason:h}),b}function mn({t,commit:i,rows:a,busy:n,onPick:r,onClose:o}){let u=I(null),d=I(o),c=I(null);return d.current=o,A(()=>{c.current=document.activeElement instanceof HTMLElement?document.activeElement:null,u.current?.querySelector("button:not(:disabled)")?.focus();let l=m=>{m.key==="Escape"&&(m.preventDefault(),m.stopPropagation(),d.current())};return document.addEventListener("keydown",l,!0),()=>{document.removeEventListener("keydown",l,!0),c.current&&typeof c.current.focus=="function"&&c.current.focus()}},[]),e("div",{className:"gitp-popover-layer",onMouseDown:l=>{l.target===l.currentTarget&&d.current()}},e("div",{className:"gitp-popover is-wide",ref:u,role:"menu","aria-label":t("history.actions")},e("div",{className:"gitp-popover-title"},t("history.actions")),e("div",{className:"gitp-popover-blurb",title:i.subject},`${De(i.hash)} \xB7 ${i.subject}`),e("div",{className:"gitp-popover-sep"}),a.map(l=>e("button",{type:"button",key:l.id,className:"gitp-action-row",role:"menuitem",disabled:n||l.reason!==null,title:l.reason??l.hint??void 0,onClick:()=>r(l.id)},e(H,{path:l.icon??N.more,size:13}),e("span",{className:"gitp-action-text"},e("span",{className:"gitp-action-label"},l.label),l.reason!==null||l.hint!==null?e("span",{className:"gitp-action-reason"},l.reason??l.hint):null)))))}function fn({t,commit:i,busy:a,error:n,onReset:r,onClose:o}){let[u,d]=k("soft"),c=[["soft","history.resetModeSoft","history.resetModeSoftHint"],["mixed","history.resetModeMixed","history.resetModeMixedHint"],["hard","history.resetModeHard","history.resetModeHardHint"]];return e(Ke,{title:t("history.resetTitle"),onClose:o,danger:u==="hard"},e("div",{className:"gitp-modal-sub"},t("history.resetBody",{hash:De(i.hash)})),e("div",{role:"radiogroup","aria-label":t("history.resetTitle")},c.map(([l,m,p])=>e("label",{key:l,className:"gitp-reset-mode"},e("input",{type:"radio",name:"gitp-reset-mode",value:l,checked:u===l,disabled:a,onChange:()=>d(l)}),e("span",{className:"gitp-reset-mode-text"},e("span",{className:"gitp-reset-mode-title"},t(m)),e("span",{className:"gitp-reset-mode-hint"},t(p)))))),u==="hard"?e("div",{className:"gitp-modal-warn",role:"alert"},t("history.resetHardWarning")):null,n!==null?e("div",{className:"gitp-modal-error"},n):null,e("div",{className:"gitp-modal-actions"},e("button",{type:"button",className:"gitp-btn",onClick:o,disabled:a},t("action.cancel")),e("button",{type:"button",className:$("gitp-btn",u==="hard"?"is-danger":"is-primary"),onClick:()=>r(u),disabled:a},a?e(ee):null,t("history.resetAction"))))}function bn({call:t,workspaceId:i,repo:a,t:n,refreshToken:r,compact:o,layout:u,onLayout:d,snapshot:c,onApplied:l}){let[m,p]=k(null),[b,h]=k(null),[C,g]=k(null),[x,y]=k(null),[F,S]=k(null),[W,V]=k(!1),[P,T]=k(!1),[E,L]=k(!1),[M,G]=k(null),[U,q]=k(!1),[K,Be]=ei(),[he,re]=k(null),[de,z]=k(null),[J,oe]=k(null),[ie,Me]=k(null),[ne,le]=k(null),[be,me]=k(null),ze=I(null),Ae=I(null),Le=I(a),ae=v=>{navigator?.clipboard?.writeText&&(navigator.clipboard.writeText(v).catch(()=>{}),q(!0),setTimeout(()=>q(!1),2e3))};A(()=>{if(be===null)return;let v=setTimeout(()=>me(null),4e3);return()=>clearTimeout(v)},[be]),A(()=>{re(null),z(null),oe(null),Me(null)},[a]),A(()=>{Le.current!==a&&(Le.current=a,h(null),g(null),y(null),S(null))},[a]),A(()=>{let v=!0,R=new AbortController;return V(!0),t("log",{workspaceId:i,repo:a},R.signal).then(O=>{if(!v)return;let j=Zi(O.commits??[]);p(j);let f=j[0];f!==void 0&&h(_=>_??f.hash)}).catch(O=>{let j=X(O);v&&j.name!=="AbortError"&&G(j)}).finally(()=>{v&&V(!1)}),()=>{v=!1,R.abort()}},[i,a,r]),A(()=>{if(!b){g(null);return}let v=!0,R=new AbortController;return T(!0),t("commitDetail",{workspaceId:i,repo:a,hash:b},R.signal).then(O=>{if(v){g(O);let j=O.files[0];!o&&j!==void 0?y(f=>f!==null&&O.files.some(_=>_.path===f)?f:j.path):o&&y(null),S(null)}}).catch(O=>{let j=X(O);v&&j.name!=="AbortError"&&G(j)}).finally(()=>{v&&T(!1)}),()=>{v=!1,R.abort()}},[i,a,b,o]),A(()=>{if(!x||!C){S(null);return}let v=!0,R=new AbortController;return L(!0),t("diff",{workspaceId:i,repo:a,path:x,side:"log",commit:C.hash,parent:C.parents?.[0]},R.signal).then(O=>{v&&S(O)}).catch(O=>{let j=X(O);v&&j.name!=="AbortError"&&G(j)}).finally(()=>{v&&L(!1)}),()=>{v=!1,R.abort()}},[i,a,x,C]);let Se=Re(()=>{let v=new Map;for(let f of m??[])v.set(f.hash,f.parents);let R=new Set,O=[],j=c?.branch?.oid;for(typeof j=="string"&&j!==""&&O.push(j);O.length>0;){let f=O.pop();if(f===void 0)break;if(!R.has(f)){R.add(f);for(let _ of v.get(f)??[])O.push(_)}}return R},[m,c?.branch?.oid]),ve=he===null?[]:hn(he,c,Se,n);async function ce(v){le("undo");try{let R=await t("undoCommit",{workspaceId:i,repo:a,hash:v.hash});z(null),l({status:R.status,message:R.message,goToChanges:!0,toast:n("history.undone")})}catch(R){z(null),me({text:fe(R),error:!0}),l({})}finally{le(null)}}async function ke(v){le("revert");try{let R=await t("revertCommit",{workspaceId:i,repo:a,hash:v.hash});z(null),l({status:R.status,message:R.message,goToChanges:!0,toast:n(R.conflicted?"history.revertConflicts":"history.reverted")})}catch(R){z(null),me({text:fe(R),error:!0}),l({})}finally{le(null)}}async function Ne(v){le("cherry");try{let R=await t("cherryPickCommit",{workspaceId:i,repo:a,hash:v.hash});me({text:n("history.picked",{hash:De(R.hash)}),error:!1}),l({status:R.status})}catch(R){me({text:fe(R),error:!0}),l({})}finally{le(null)}}async function Ce(v,R){le("reset"),Me(null);try{let O=await t("resetToCommit",{workspaceId:i,repo:a,hash:v.hash,mode:R,confirm:!0});oe(null),me({text:n("history.resetDone",{hash:De(v.hash)}),error:!1}),l({status:O.status})}catch(O){Me(fe(O))}finally{le(null)}}function Z(v){let R=he;if(R!==null){if(v==="copy"){ae(R.hash),re(null),me({text:n("action.copied"),error:!1});return}re(null),v==="undo"?z({type:"undo",commit:R}):v==="revert"?z({type:"revert",commit:R}):v==="cherry"?Ne(R):v==="reset"&&oe(R)}}if(W&&m===null)return e(ge,{icon:e(ee),title:n("log.loading")});if(m===null&&M!==null)return e(ge,{icon:e(H,{path:N.warning,size:28}),title:n("error.title"),hint:fe(M)});if(m!==null&&m.length===0)return e(ge,{icon:e(H,{path:N.history,size:28}),title:n("empty.noHistory"),hint:n("empty.noHistoryHint")});let ye=!o||!x,Q=!o||!!x;return e("div",{className:"gitp-changes",ref:ze},ye?e("div",{className:"gitp-listcol",ref:Ae,style:o?void 0:{width:`${K}px`}},e("div",{className:"gitp-loglist"},M?e("div",{className:"gitp-error"},e("span",{className:"gitp-error-text"},fe(M))):null,(m??[]).map(v=>e("button",{type:"button",key:v.hash,className:$("gitp-commitrow",b===v.hash&&"is-selected"),onClick:()=>h(v.hash),onContextMenu:R=>{R.preventDefault(),h(v.hash),re(v)},"aria-haspopup":"menu"},e("span",{className:"gitp-graph",style:{width:Math.max(14,v.laneCount*10+8)}},e("span",{className:"gitp-graph-line",style:{left:6+v.lane*10}}),e("span",{className:$("gitp-graph-dot",v.lane%4?`g${v.lane%4}`:""),style:{left:6+v.lane*10}})),e("span",{className:"gitp-commitmain"},e("div",{className:"gitp-commit-subject"},v.subject),e("div",{className:"gitp-commit-meta"},e("span",null,v.author),e("span",null,"\xB7"),e("span",null,_t(v.date))),v.refs.length>0?e("div",{className:"gitp-refs"},v.refs.map(R=>e("span",{key:R,className:$("gitp-ref",R.startsWith("HEAD")&&"is-head")},R.replace(/^HEAD -> /,"")))):null)))),e("div",{className:"gitp-logdetail-summary"},P&&C===null?e("div",{className:"gitp-center",style:{padding:"24px"}},e(ee)):C===null?e(ge,{title:n("log.select")}):e(te.default.Fragment,null,e("div",{className:"gitp-detail-head"},e("div",{className:"gitp-detail-title"},e("div",{className:"gitp-detail-subject"},C.subject),e(we,{label:n("history.actions"),icon:N.more,disabled:ne!==null,onClick:()=>re({hash:C.hash,parents:C.parents??[],subject:C.subject})})),e("div",{className:"gitp-detail-meta"},e("button",{type:"button",className:"gitp-detail-hash-btn",onClick:()=>ae(C.hash),title:n(U?"action.copied":"action.copyHash")},De(C.hash),e(H,{path:U?N.check:N.copy,size:11})),e("span",null,C.author),e("span",null,_t(C.date)))),C.body?e("div",{className:"gitp-detail-body"},C.body):null,e("div",{className:"gitp-detail-section-head"},e("span",null,n("log.files")),e("span",{className:"gitp-section-count"},String(C.files?.length??0))),e("div",{className:"gitp-detail-files"},!C.files||C.files.length===0?e("div",{className:"gitp-center-hint",style:{padding:"4px 8px"}},n("log.noFiles")):C.files.map(v=>{let R=Ue(v.path);return e("button",{type:"button",key:v.path,className:$("gitp-detail-file",x===v.path&&"is-selected"),onClick:()=>y(v.path)},e("span",{className:$("gitp-status",vt("M"))},"M"),e("span",{className:"gitp-filename"},R.dir?e("span",{className:"gitp-filedir"},R.dir):null,R.base),v.binary?e("span",{className:"gitp-delta"},n("meta.binary")):e("span",{className:"gitp-delta"},v.add!==null&&v.add>0?e("span",{className:"gitp-add"},`+${v.add}`):null,v.del!==null&&v.del>0?e("span",{className:"gitp-del"},`\u2212${v.del}`):null))}))))):null,ye&&Q?e(ni,{label:n("split.commits"),containerRef:ze,columnRef:Ae,width:K,onChange:Be}):null,Q?e("div",{className:"gitp-diffcol"},x?e(ii,{t:n,diff:F,loading:E,layout:u,onLayout:d,onBlock:()=>{},busy:!0,selectionKey:`${C?.hash??""}:${x}`,compact:o,onBack:o?()=>y(null):void 0}):e(ge,{icon:e(H,{path:N.changes,size:28}),title:n("empty.selectFile"),hint:n("empty.selectFileHint")})):null,he?e(mn,{t:n,commit:he,rows:ve,busy:ne!==null,onPick:Z,onClose:()=>re(null)}):null,de?e(yt,{title:n(de.type==="undo"?"history.undoTitle":"history.revertTitle"),body:n(de.type==="undo"?"history.undoBody":"history.revertBody"),confirmLabel:n(de.type==="undo"?"history.undoAction":"history.revertAction"),cancelLabel:n("action.cancel"),busy:ne!==null,onConfirm:()=>de.type==="undo"?ce(de.commit):ke(de.commit),onClose:()=>{ne===null&&z(null)}}):null,J?e(fn,{t:n,commit:J,busy:ne==="reset",error:ie,onReset:v=>Ce(J,v),onClose:()=>{ne===null&&(oe(null),Me(null))}}):null,be?e("div",{className:$("gitp-toast",be.error&&"is-error"),role:"status","aria-live":"polite"},be.text):null)}function vn({call:t,workspaceId:i,repo:a,t:n,snapshot:r,onStatus:o,refreshToken:u}){let[d,c]=k(null),[l,m]=k(null),[p,b]=k(!1),[h,C]=k(null),[g,x]=k(null),[y,F]=k(null),[S,W]=k(null),V=I(a);A(()=>{V.current!==a&&(V.current=a,c(null))},[a]);let P=et(async M=>{try{let G=await t("stashList",{workspaceId:i,repo:a},M);c(G.stashes??[]),m(null)}catch(G){let U=X(G);U.name!=="AbortError"&&m(U)}},[i,a,t]);A(()=>{let M=new AbortController;return P(M.signal),()=>M.abort()},[P,u]),A(()=>{if(S===null)return;let M=setTimeout(()=>W(null),4e3);return()=>clearTimeout(M)},[S]);let T=(r?.entries??[]).filter(M=>M.unstaged&&!M.conflicted);async function E({paths:M,message:G}){C("create"),x(null);try{let U=await t("stashPush",{workspaceId:i,repo:a,paths:M,message:G,includeUntracked:M.some(q=>T.find(K=>K.path===q)?.untracked===!0)});o(U.status),c(U.stashes??[]),b(!1),W(n("stash.created",{count:M.length}))}catch(U){x(fe(U))}finally{C(null)}}async function L(M,G,U){C(M+G),m(null);try{let q=await t(M==="drop"?"stashDrop":"stashApply",{workspaceId:i,repo:a,ref:G,pop:U});o(q.status),c(q.stashes??[]),W(M==="drop"?n("stash.dropped",{ref:G}):n(U?"stash.popped":"stash.applied",{ref:G})),F(null)}catch(q){m(X(q))}finally{C(null)}}return e("div",{className:"gitp-stash"},e("div",{className:"gitp-stash-head"},e("div",{className:"gitp-stash-title"},e("span",null,n("mode.stash")),d?.length?e("span",{className:"gitp-section-count"},String(d.length)):null),e("button",{type:"button",className:"gitp-btn is-small is-primary",onClick:()=>b(!0),disabled:T.length===0},e(H,{path:N.plus,size:12}),n("action.stash"))),l?e("div",{className:"gitp-error"},e("span",{className:"gitp-error-text"},fe(l))):null,d===null?e("div",{className:"gitp-center"},e(ee)):d.length===0?e(ge,{icon:e(H,{path:N.stash,size:28}),title:n("empty.noStashes"),hint:n("empty.noStashesHint"),action:T.length>0?e("button",{type:"button",className:"gitp-btn is-primary is-small",onClick:()=>b(!0)},e(H,{path:N.plus,size:12}),n("action.stash")):null}):e("div",{className:"gitp-stashlist"},d.map(M=>e("div",{className:"gitp-stashrow",key:M.ref},e("div",{className:"gitp-stash-main"},e("div",{className:"gitp-stash-msg"},M.message||"WIP"),e("div",{className:"gitp-stash-meta"},e("span",{className:"gitp-stash-ref"},M.ref),e("span",null,"\xB7"),e("span",null,De(M.hash)))),e("div",{className:"gitp-stash-actions"},e("button",{type:"button",className:"gitp-btn is-small",onClick:()=>L("apply",M.ref,!1),disabled:h!==null,title:n("stash.applyHint")},h==="apply"+M.ref?e(ee):null,n("action.apply")),e("button",{type:"button",className:"gitp-btn is-small",onClick:()=>L("apply",M.ref,!0),disabled:h!==null,title:n("stash.popHint")},h==="apply"+M.ref?e(ee):null,n("action.pop")),e("button",{type:"button",className:"gitp-btn is-small gitp-stash-btn-danger","aria-label":n("action.drop"),onClick:()=>F(M.ref),disabled:h!==null,title:n("stash.dropHint")},n("action.drop")))))),p?e(nn,{t:n,files:T,busy:h==="create",error:g,onCreate:E,onClose:()=>{b(!1),x(null)}}):null,y?e(yt,{title:n("stash.dropTitle"),body:n("stash.dropBody",{ref:y}),confirmLabel:n("action.drop"),cancelLabel:n("action.cancel"),danger:!0,busy:h==="drop"+y,onConfirm:()=>L("drop",y,!1),onClose:()=>F(null)}):null,S?e("div",{className:"gitp-toast",role:"status","aria-live":"polite"},S):null)}function yn(t){let i=t?.projectionValues?.workingDirectory;if(typeof i=="string"&&i.trim()!=="")return i.trim();let a=t?.cwd;return typeof a=="string"&&a!==""?a:null}function xn(t,i,a){let n=typeof t.sessionRoot=="string"?t.sessionRoot:null;if(t.worktree===!0&&n!==null){let u=i.find(d=>d.root===n);if(u!==void 0)return u}let r=i.find(u=>u.root===a);return r!==void 0?r:(n===null?void 0:i.find(u=>u.root===n))??i[0]??null}function wn(t){let i=typeof t.sessionRoot=="string"?t.sessionRoot:"";return`${t.worktree===!0?"worktree":"checkout"}:${i}`}function kn({call:t,t:i,useWorkspaces:a,useSessions:n,sessionId:r,useTabInfo:o,sidebarRight:u}){let{tab:d}=o(),c=Xt(r).set;A(()=>{c(d.visible===!0)},[c,d.visible]),A(()=>()=>{c(!1)},[c]),A(()=>{ft={visible:d.visible===!0,canStageAll:()=>rt.length>0&&T===null,stageAll:()=>Mt("unstaged"),canCommit:()=>ot&&T===null,commit:()=>Tt(),canWriteMessage:()=>Te.length>0&&T===null&&!ke,writeMessage:()=>Pt()}}),A(()=>()=>{ft=null},[]);let l=a(s=>s.items),m=n(s=>s.byId[r]),p=yn(m),b=l.find(s=>s.sessionIds?.includes(r))??l.find(s=>m?.cwd!==void 0&&(m.cwd===s.path||m.cwd.startsWith(`${s.path}/`)))??null,h=b===null?"":b.workspaceId,C=I(null),[g,x]=k(!1),[y,F]=k(null),[S,W]=k(!1),[V,P]=k(null),[T,E]=k(null),[L,M]=k(null),[G,U]=k("changes"),[q,K]=k(""),[Be,he]=k(!1),[re,de]=k(!1),[z,J]=k(null),[oe,ie]=k(null),[Me,ne]=k(!1),[le,be]=k(0),[me,ze]=k(()=>Ve(Ft,"split")==="unified"?"unified":"split"),[Ae,Le]=k(()=>Ve(Ot,"split")==="unified"?"unified":"split"),[ae,Se]=k(!1),[ve,ce]=k(!1),[ke,Ne]=k(!1),[Ce,Z]=k(null),[ye,Q]=k(null),[v,R]=k(!1),[O,j]=k(null),[f,_]=k(null),[Fe,it]=k(null),[xt,wt]=k(0),[nt,_e]=k([]),[B,Oe]=k(null),ai=s=>{if(B===null||u===void 0)return;let w=Gi(s),D=Wi(r,m===void 0?void 0:m.cwd,`${B}/${s.path}`);u.openResource(D,{params:{line:w}})},[si,ri]=k(0),[oi,qe]=k(!1),[li,at]=k(!1),je=I(0),st=I(null);A(()=>{let s=C.current;if(s===null||typeof ResizeObserver>"u")return;let w=0,D=new ResizeObserver(Y=>{w&&cancelAnimationFrame(w),w=requestAnimationFrame(()=>{w=0;let ue=Y[0]?.contentRect.width??0;x(ue>0&&ue<900)})});return D.observe(s),()=>{D.disconnect(),w&&cancelAnimationFrame(w)}},[b?.workspaceId]);let se=et(s=>{!s||!Array.isArray(s.entries)||(je.current+=1,F(s))},[]),xe=et(async(s,w)=>{if(!b||B===null)return;let D=++je.current;w||W(!0);try{let Y=await t("status",{workspaceId:h,repo:B,sessionDir:p},s);D===je.current&&(st.current=null,F(Y),Array.isArray(Y.repos)&&Y.repos.length>0&&_e(Y.repos),P(null))}catch(Y){let ue=X(Y);if(ue.name==="AbortError"||D!==je.current)return;let $e=It(Y);if($e==="git/not-repo"||$e==="git/repo-invalid"){if(st.current===B){P(ue);return}st.current=B,Pe(We+h,""),Oe(null),F(null),P(null),ri(ct=>ct+1);return}P(ue)}finally{D===je.current&&W(!1)}},[b?.workspaceId,B,t,p]),ci=et(s=>{s?.status&&se(s.status),typeof s.message=="string"&&(K(s.message),he(!1)),s?.goToChanges&&(J(null),ie(null),U("changes")),s?.toast&&_(s.toast),wt(w=>w+1),xe(void 0,!1)},[se,xe]),kt=I(null),Nt=I(null),Ct=I(null);Ct.current=B,A(()=>{if(!b?.workspaceId)return;let s=h,w=kt.current!==s;w&&(kt.current=s,_e([]),Oe(null),F(null));let D=new AbortController;return(async()=>{try{let Y=await t("status",{workspaceId:s,sessionDir:p},D.signal);if(D.signal.aborted)return;let ue=Array.isArray(Y.repos)?Y.repos:[];_e(ue);let $e=wn(Y),ct=Nt.current!==$e;if(Nt.current=$e,!w&&!ct&&Ct.current!==null)return;let Je=xn(Y,ue,Ve(We+s,""));Je?(Oe(Je.root),(Y.worktree!==!0||Je.root!==Y.sessionRoot)&&Pe(We+s,Je.root)):F(Y)}catch(Y){let ue=X(Y);ue.name!=="AbortError"&&P(ue)}})(),()=>D.abort()},[b?.workspaceId,t,si,p]),A(()=>{if(B===null)return;let s=new AbortController;return xe(s.signal,!1),()=>s.abort()},[B,xe]),A(()=>{if(!b||B===null)return;let s=setInterval(()=>{document.visibilityState==="visible"&&xe(void 0,!0)},8e3);return()=>clearInterval(s)},[b?.workspaceId,B,xe]),A(()=>{let s=()=>xe(void 0,!0);return window.addEventListener("focus",s),()=>window.removeEventListener("focus",s)},[xe]),A(()=>{if(f===null)return;let s=setTimeout(()=>_(null),4e3);return()=>clearTimeout(s)},[f]);let Ye=y?.entries?.filter(s=>s.conflicted)??[],Te=y?.entries?.filter(s=>s.staged&&!s.conflicted)??[],rt=y?.entries?.filter(s=>s.unstaged&&!s.conflicted)??[],ot=Te.length>0&&Ye.length===0&&q.trim()!==""&&y?.repo!==!1,lt=z?`${z.side}:${z.path}:${z.commit??""}`:"",di=z===null?!0:z.side==="staged"?y?.entries?.some(s=>s.path===z.path&&s.staged&&!s.conflicted):z.side==="unstaged"?y?.entries?.some(s=>s.path===z.path&&s.unstaged&&!s.conflicted):z.side==="conflict"?y?.entries?.some(s=>s.path===z.path&&s.conflicted):!0;A(()=>{y!==null&&z!==null&&!di&&J(null)},[y,lt]),A(()=>{if(!b||z===null){ie(null);return}let s=new AbortController;return ne(!0),t("diff",{workspaceId:h,repo:B,path:z.path,side:z.side},s.signal).then(w=>{s.signal.aborted||ie(w)}).catch(w=>{let D=X(w);!s.signal.aborted&&D.name!=="AbortError"&&P(D)}).finally(()=>{s.signal.aborted||ne(!1)}),()=>s.abort()},[b?.workspaceId,B,lt,le,t]);function pe(){be(s=>s+1)}function pi(s){z!==null&&z.side===s.side&&z.path===s.path||(ie(null),J(s))}function Rt(s){let w=new Set;for(let D of s)w.add(D.path),D.from&&w.add(D.from);return[...w]}async function ui(s,w){if(T===null){E("file"),P(null);try{let D=await t(w==="staged"?"unstage":"stage",{workspaceId:h,repo:B,paths:Rt([s])});se(D),z?.path===s.path&&z.side===w&&J(null),pe()}catch(D){P(X(D))}finally{E(null)}}}async function Mt(s){let w=s==="staged"?Te:rt;if(!(T!==null||w.length===0)){E("file"),P(null);try{let D=await t(s==="staged"?"unstage":"stage",{workspaceId:h,repo:B,paths:Rt(w)});se(D),pe()}catch(D){P(X(D))}finally{E(null)}}}function gi(s){T===null&&j({title:i(s.untracked?"discard.deleteTitle":"discard.title"),body:i(s.untracked?"discard.deleteBody":"discard.body",{path:s.path}),confirmLabel:i(s.untracked?"discard.deleteConfirm":"discard.confirm"),danger:!0,run:()=>void hi(s)})}async function hi(s){if(T===null){E("discard"),P(null);try{let w=await t("discard",{workspaceId:h,repo:B,paths:[s.path],confirm:!0});se(w),z?.path===s.path&&(J(null),ie(null)),pe(),_(i(s.untracked?"discard.deleted":"discard.done",{name:Ue(s.path).base}))}catch(w){P(X(w))}finally{E(null),j(null)}}}async function mi(s,w){if(!(T!==null||oe===null)){if(w==="revert"){j({title:i("confirm.revertTitle"),body:i("confirm.revertBody"),confirmLabel:i("confirm.yesRevert"),danger:!0,run:()=>St(s,"revert")});return}await St(s,w)}}async function St(s,w){if(oe!==null){E("block"),P(null);try{let D=await t("applyBlocks",{workspaceId:h,repo:B,path:oe.path,side:w,blocks:[s],baseHash:oe.baseHash,targetHash:oe.targetHash,confirm:!0});se(D),pe()}catch(D){P(X(D)),It(D)==="git/stale"&&pe()}finally{E(null),j(null)}}}async function fi(s){if(!(!z||T!==null)){E("resolve"),P(null);try{let w=await t("resolve",{workspaceId:h,repo:B,path:z.path,side:s});se(w),J(null),pe()}catch(w){P(X(w))}finally{E(null)}}}async function Tt(){if(!(!ot||T!==null)){E("commit"),P(null);try{let s=await t("commit",{workspaceId:h,repo:B,message:q,amend:Be,noVerify:re});se(s.status),K(""),he(!1),_(i("commit.done",{hash:De(s.hash)})),pe()}catch(s){P(X(s))}finally{E(null)}}}function bi(){Te.length===0||Ye.length>0||(Z(null),Se(!0))}async function Ht(){if(ke||Te.length===0)return null;Ne(!0),P(null);try{let s=ht.hook.getSnapshot(),w=await t("aiMessage",{workspaceId:h,repo:B,...s.model===null?{}:{model:s.model},...s.instruction.trim()===""?{}:{instruction:s.instruction}});return w.model!==null&&w.model!==""&&_(i("ai.written",{model:w.model})),w.message!==""?w.message:null}catch(s){return P(X(s)),null}finally{Ne(!1)}}async function Pt(){ce(!1);let s=await Ht();s!==null&&K(s)}async function vi(){if(ce(!1),Te.length===0||Ye.length>0)return;let s=await Ht();s!==null&&(K(s),Z(null),Se(!0))}async function yi({name:s,message:w}){R(!0),Z(null);try{let D=await t("createBranchAndCommit",{workspaceId:h,repo:B,name:s,message:w,noVerify:re});se(D.status),K(""),Se(!1),_(i("branch.created",{branch:s})),pe()}catch(D){Z(fe(D))}finally{R(!1)}}async function xi(s){if(T===null){E("sync"),M(s),P(null),it(null);try{let w=await t(s,{workspaceId:h,repo:B});se(w.status),s==="pull"&&w.autoStash==="conflict"?(U("changes"),J(null),ie(null),it(i("sync.pulledStashConflict"))):_(i(s==="fetch"?"sync.fetched":s==="pull"?w.autoStash==="restored"?"sync.pulledStashed":"sync.pulled":"sync.pushed"))}catch(w){P(X(w))}finally{E(null),M(null)}}}async function wi(){if(y?.repo!==!1){if(ye!==null){Q(null);return}Q({branches:[],loading:!0});try{let s=await t("branches",{workspaceId:h,repo:B});Q({branches:s.branches??[],loading:!1})}catch(s){Q(null),P(X(s))}}}function ki(s,w){if(Q(null),(y?.entries?.length??0)>0){j({title:i("confirm.checkoutTitle"),body:i("confirm.checkoutBody"),confirmLabel:i("confirm.yesCheckout"),danger:!1,run:()=>Et(s,w)});return}Et(s,w)}async function Et(s,w){j(null),R(!0),P(null);try{let D=await t("checkout",{workspaceId:h,repo:B,branch:s,remote:w===!0});se(D.status),Q(null),J(null),pe()}catch(D){Q(null),P(X(D))}finally{R(!1)}}async function Dt(){if(T===null){E("init"),P(null);try{let s=await t("init",{workspaceId:h});Array.isArray(s.repos)&&_e(s.repos);let w=s.selected??s.root??null;typeof w=="string"&&w!==""&&(Pe(We+h,w),Oe(w)),se(s)}catch(s){P(X(s))}finally{E(null)}}}function Ni(s){qe(!1),s!==B&&(Pe(We+h,s??""),Oe(s),F(null),J(null),ie(null),Q(null))}function Ci(){qe(!1),j({title:i("repo.initRootTitle"),body:i("repo.initRootBody",{count:nt.length}),confirmLabel:i("repo.initRootConfirm"),danger:!0,run:()=>{j(null),Dt()}})}async function Ri({name:s}){if(B!==null){R(!0),Z(null);try{let w=await t("createBranch",{workspaceId:h,repo:B,name:s});se(w.status),at(!1),_(i("branch.createdOnly",{branch:s})),pe()}catch(w){Z(fe(w))}finally{R(!1)}}}let zt=g?Ae:me;function At(s){g?(Le(s),Pe(Ot,s)):(ze(s),Pe(Ft,s))}if(b===null)return e("div",{className:"gitp-root"},e(ge,{icon:e(H,{path:N.branch,size:28}),title:i("empty.noWorkspace"),hint:i("empty.noWorkspaceHint")}));let Xe=y?.branch??null,Mi=Xe?.ahead??0,Si=Xe?.behind??0,Lt=V,Ti=Te[0]?.path,Hi=Xi(q,Ti),Pi=q;return e("div",{className:$("gitp-root",g&&"is-compact"),ref:C},e(cn,{t:i,workspaceTitle:b.title,branch:Xe,repo:y?.repo!==!1,ahead:Mi,behind:Si,upstream:Xe?.upstream??null,onBranchMenu:wi,onRepoMenu:()=>qe(!0),repos:nt,repoRoot:B,onSync:xi,busy:T!==null,onRefresh:()=>{xe(void 0,!1),z&&pe(),wt(s=>s+1)},syncing:L}),Lt?e("div",{className:"gitp-error",role:"alert"},e(H,{path:N.warning,size:14}),e("span",{className:"gitp-error-text"},fe(Lt)),e(we,{label:i("action.close"),icon:N.close,onClick:()=>P(null)})):null,Fe?e("div",{className:"gitp-error",role:"status"},e(H,{path:N.warning,size:14}),e("span",{className:"gitp-error-text"},Fe),e(we,{label:i("action.close"),icon:N.close,onClick:()=>it(null)})):null,e("div",{className:"gitp-body"},e(dn,{t:i,mode:G,onMode:U,counts:{changes:y?.entries?.length??0}}),e("div",{className:"gitp-content"},y===null?e(ge,{icon:e(ee),title:i("status.loading")}):y.repo===!1?e(ge,{icon:e(H,{path:N.branch,size:28}),title:i("empty.noRepo"),hint:i("empty.noRepoHint"),action:e("button",{type:"button",className:"gitp-btn is-primary",onClick:Dt,disabled:T!==null},T==="init"?e(ee):null,i("empty.init"))}):G==="log"?e(bn,{call:t,workspaceId:h,repo:B??"",t:i,refreshToken:xt,compact:g,layout:zt,onLayout:At,snapshot:y,onApplied:ci}):G==="stash"?e(vn,{call:t,workspaceId:h,repo:B??"",t:i,snapshot:y,onStatus:se,refreshToken:xt}):e(an,{t:i,snapshot:y,conflicts:Ye,staged:Te,unstaged:rt,selection:z,onSelect:pi,busy:T!==null,fileBusy:T!==null,onToggleFile:ui,onToggleAll:Mt,onDiscard:gi,diff:oe,diffLoading:Me,layout:zt,onLayout:At,onRefresh:()=>{pe(),xe(void 0,!1)},onBlock:mi,onResolve:fi,onOpen:ai,message:q,onMessage:K,onCommit:Tt,onBranch:bi,canCommit:ot,commitBusy:T==="commit",aiBusy:ke,aiMenuOpen:ve,onAiToggle:()=>ce(s=>!s),onAiClose:()=>ce(!1),onAiWrite:Pt,onAiBranch:vi,selectionKey:lt,amend:Be,onAmend:he,noVerify:re,onNoVerify:de,canAmend:y.branch?.initial!==!0,compact:g,onBack:()=>J(null)}))),ye?e(un,{t:i,branches:ye.branches,loading:ye.loading===!0,busy:v,onCheckout:ki,onNew:()=>{Q(null),Z(null),at(!0)},onClose:()=>Q(null)}):null,oi?e(pn,{t:i,repos:nt,current:B,onPick:Ni,onInitRoot:Ci,onClose:()=>qe(!1)}):null,li?e(gn,{t:i,busy:v,error:Ce,onCreate:Ri,onClose:()=>{at(!1),Z(null)}}):null,ae?e(tn,{t:i,defaultName:Hi,defaultMessage:Pi,busy:v,noVerify:re,error:Ce,onCreate:yi,onNoVerify:de,onClose:()=>{Se(!1),Z(null)}}):null,O?e(yt,{title:O.title,body:O.body,confirmLabel:O.confirmLabel,cancelLabel:i("action.cancel"),danger:O.danger,busy:T!==null||v,onConfirm:()=>O.run(),onClose:()=>j(null)}):null,f?e("div",{className:"gitp-toast",role:"status","aria-live":"polite"},f):null)}function Nn({t}){return e(te.default.Fragment,null,e(tt,{size:14}),e("span",{className:"gitp-tab-title"},t("panel")))}function Yt({sessionId:t,sidebarRight:i,useVisible:a,t:n}){let r=a(u=>u===!0),o=n("header.label");return e("button",{type:"button",className:$("gitp-iconbtn","gitp-header-btn",r&&"is-active"),"aria-label":o,"aria-pressed":r,title:o,onClick(){if(!r){i.openTab("git");return}let u=i.tabsIn(t).find(d=>d.kind==="git");u!==void 0&&i.hide(u.id)}},e(tt,{size:16}))}function ni({label:t,containerRef:i,columnRef:a,width:n,onChange:r}){let o=I(null),u=()=>{let c=i.current;return c===null?n:Math.max(Ie,Math.round(c.getBoundingClientRect().width)-$t)},d=c=>Math.min(Math.max(Math.round(c),Ie),u());return A(()=>()=>{o.current=null,document.body.style.cursor="",document.body.style.userSelect=""},[]),A(()=>{let c=i.current;if(c===null||typeof ResizeObserver>"u")return;let l=new ResizeObserver(()=>{let m=Math.round(c.getBoundingClientRect().width);if(m===0)return;let p=Math.max(Ie,m-$t);n>p&&r(p)});return l.observe(c),()=>l.disconnect()},[i,n,r]),e("div",{className:"gitp-resizer",role:"separator","aria-orientation":"vertical","aria-label":t,"aria-valuemin":Ie,"aria-valuemax":u(),"aria-valuenow":n,tabIndex:0,onPointerDown(c){c.button===0&&(o.current={x:c.clientX,width:n,next:n},c.currentTarget.setPointerCapture(c.pointerId),document.body.style.cursor="col-resize",document.body.style.userSelect="none",c.preventDefault())},onPointerMove(c){let l=o.current;if(l===null)return;let m=d(l.width+(c.clientX-l.x));m!==l.next&&(l.next=m,a.current!==null&&(a.current.style.width=`${m}px`),c.currentTarget.setAttribute("aria-valuenow",String(m)))},onPointerUp(c){let l=o.current;l!==null&&(o.current=null,c.currentTarget.hasPointerCapture(c.pointerId)&&c.currentTarget.releasePointerCapture(c.pointerId),document.body.style.cursor="",document.body.style.userSelect="",r(l.next))},onPointerCancel(){o.current=null,document.body.style.cursor="",document.body.style.userSelect=""},onDoubleClick(){r(d(mt))},onKeyDown(c){if(c.key==="ArrowLeft"||c.key==="ArrowRight"){c.preventDefault();let l=c.key==="ArrowRight"?Wt:-Wt;r(d(n+l));return}c.key==="Home"&&(c.preventDefault(),r(d(mt)))}})}var ft=null;function Cn({t,call:i,usePrefs:a,savePrefs:n}){let r=a(g=>g),[o,u]=k(null),[d,c]=k(!1);A(()=>{let g=new AbortController,x=!0;return i("preferences",{},g.signal).then(y=>{x&&u(y)},()=>{x&&c(!0)}),()=>{x=!1,g.abort()}},[i]);let l=o?.groups??[],m=r.model,p=m===null?"":Gt(m),b=m!==null&&l.some(g=>g.id===m.provider&&g.models.some(x=>x.id===m.model)),h=r.instruction===""?o?.instruction??"":r.instruction,C=o===null&&!d;return e("div",{className:"gitp-settings"},e("div",{className:"gitp-settings-row"},e("div",{className:"gitp-settings-copy"},e("label",{className:"gitp-settings-label",htmlFor:"gitp-settings-model"},t("settings.model")),e("p",{className:"gitp-settings-hint"},t("settings.modelHint"))),e("select",{id:"gitp-settings-model",value:p,disabled:C,onChange:g=>{let x=g.target.value;if(x===""){n({...r,model:null});return}let y=Yi(x);y!==null&&n({...r,model:y})}},e("option",{value:""},t("settings.modelSame")),b||r.model===null?null:e("option",{value:p},`${r.model.provider} \xB7 ${r.model.model}`),l.map(g=>e("optgroup",{key:g.id,label:g.label},g.models.map(x=>e("option",{key:x.id,value:Gt({provider:g.id,model:x.id})},x.name))))),d?e("p",{className:"gitp-settings-error"},t("settings.modelFailed")):null,!d&&o!==null&&l.length===0?e("p",{className:"gitp-settings-error"},t("settings.modelEmpty")):null),e("div",{className:"gitp-settings-row"},e("div",{className:"gitp-settings-copy"},e("label",{className:"gitp-settings-label",htmlFor:"gitp-settings-instruction"},t("settings.instruction")),e("p",{className:"gitp-settings-hint"},t("settings.instructionHint"))),e("textarea",{id:"gitp-settings-instruction",value:h,spellCheck:!1,disabled:C,onChange:g=>n({...r,instruction:g.target.value})}),e("div",{className:"gitp-settings-actions"},e("button",{type:"button",className:"gitp-btn is-small",disabled:r.instruction==="",onClick:()=>n({...r,instruction:""})},t("settings.instructionReset"))),d?e("p",{className:"gitp-settings-error"},t("settings.instructionFailed")):null))}function Rn(){return e(tt,{size:16})}function Mn(t,i){let a=o=>({status:"blocked",reason:o}),n=["page","editable","terminal"],r=o=>{let u=ft;return u===null||!u.visible?a(i("command.openFirst")):o(u)};return[{id:"git.panel.toggle",label:()=>i("command.toggle"),aliases:["git","source control","toggle panel"],defaults:{},regions:n,modals:[],resolve:()=>({status:"handled",run:()=>{let o=t.sidebarRight.active();if(t.sidebarRight.isExpanded()&&o!==void 0&&o.kind==="git"){t.sidebarRight.hide(o.id);return}try{t.sidebarRight.openTab("git")}catch{}}})},{id:"git.stageAll",label:()=>i("command.stageAll"),aliases:["git","stage"],defaults:{},regions:n,modals:[],resolve:()=>r(o=>o.canStageAll()?{status:"handled",run:()=>o.stageAll()}:a(i("command.nothingToStage")))},{id:"git.commit",label:()=>i("command.commit"),aliases:["git","commit"],defaults:{},regions:n,modals:[],resolve:()=>r(o=>o.canCommit()?{status:"handled",run:()=>o.commit()}:a(i("command.notReady")))},{id:"git.writeMessage",label:()=>i("command.writeMessage"),aliases:["git","commit message","ai"],defaults:{},regions:n,modals:[],resolve:()=>r(o=>o.canWriteMessage()?{status:"handled",run:()=>o.writeMessage()}:a(i("command.notReady")))}]}var Sn=["connection","slots","locale","sidebarRightTabs","sidebarRight"];function Tn(t){t.locale.register(He,"en",Vi),t.locale.register(He,"zh",Ui);let i=t.locale.bind(He),a=async(r,o,u)=>{let d=await t.connection.rpc.call("/git-rpc",r,o,u);if(!d.ok)throw new gt(d.error.code,d.error.message,d.error.details);return d.value};t.effect(()=>t.sidebarRightTabs.register({id:dt,kind:"git",priority:"extension",title:()=>i("panel"),guide:[{id:"git",order:50,title:()=>i("guide.title"),description:()=>i("guide.description"),icon:()=>e(Qi,null)}]}),"dsh-git: right sidebar tab type");let n=r=>({sessionId:r,sidebarRight:t.sidebarRight,hooks:{visible:Xt(r).hook}});t.slots.inject("conversation.session.header.utilities",()=>t.slots.register({name:"conversation.session.header.utilities",id:"git-panel",order:-7,locale:He,inject:n},Yt)),t.slots.inject("conversation.hero.options",()=>t.slots.register({name:"conversation.hero.options",id:"git-panel",order:-7,locale:He,inject:n},Yt)),t.slots.inject("settings.section",()=>t.slots.register({name:"settings.section",id:"git",order:25,label:()=>i("settings.section"),locale:He,inject:()=>({t:i,call:a,savePrefs:ht.set,hooks:{prefs:ht.hook}})},Cn)),t.slots.inject("settings.section.icon",()=>t.slots.register({name:"settings.section.icon",id:"git",order:25},Rn)),t.inject(["shortcuts"],r=>{for(let o of Mn(t,i))r.effect(()=>r.shortcuts.register(o),`dsh-git: ${o.id}`)}),t.slots.inject("sidebar.right.pane.tab",()=>t.slots.register({name:"sidebar.right.pane.tab",key:dt,locale:He,inject:()=>({call:a,t:i,sidebarRight:t.sidebarRight})},kn)),t.slots.inject("sidebar.right.pane.tab.title",()=>t.slots.register({name:"sidebar.right.pane.tab.title",key:dt,locale:He,inject:()=>({t:i})},Nn))}
|
|
330
|
+
`,ti="dsh-git-desk/styles";if(typeof document<"u"&&document.querySelector(`style[data-plugin-css=${JSON.stringify(ti)}]`)===null){let t=document.createElement("style");t.dataset.plugin="dsh-git-desk",t.dataset.pluginCss=ti,t.textContent=an,document.head.appendChild(t)}function xe({icon:t,title:i,hint:a,action:n}){return e("div",{className:"gitp-center"},t?e("div",{className:"gitp-center-icon"},t):null,e("div",{className:"gitp-center-title"},i),a?e("div",{className:"gitp-center-hint"},a):null,n??null)}function le(){return e("span",{className:"gitp-spinner","aria-hidden":"true"})}function Te({label:t,icon:i,onClick:a,disabled:n,active:o}){return e("button",{type:"button",className:G("gitp-iconbtn",o&&"is-active"),onClick:a,disabled:n,"aria-label":t,title:t},e(P,{path:i}))}function Nt({label:t,icon:i,count:a,onClick:n,disabled:o,busy:r}){return e("button",{type:"button",className:G("gitp-toolbtn",a>0&&"has-count"),onClick:n,disabled:o||r,"aria-label":a>0?`${t}, ${a}`:t,title:a>0?`${t} (${a})`:t},r?e(le):e(P,{path:i,size:14}),a>0?e("span",{className:"gitp-toolbtn-num"},a>99?"99+":String(a)):null)}function ct({title:t,onClose:i,children:a,danger:n,closeLabel:o="Close"}){let r=j(null),p=j(i);return p.current=i,I(()=>{let u=document.activeElement,d=r.current;d?.querySelector("input, textarea, select, button")?.focus();let m=g=>{if(g.key==="Escape"){g.preventDefault(),g.stopPropagation(),p.current();return}if(g.key!=="Tab"||d===null)return;let v=[...d.querySelectorAll('button, input, textarea, select, [href], [tabindex]:not([tabindex="-1"])')].filter(f=>!f.hasAttribute("disabled")&&f.offsetParent!==null);if(v.length===0)return;let h=v[0],M=v[v.length-1];h===void 0||M===void 0||(g.shiftKey&&document.activeElement===h?(g.preventDefault(),M.focus()):!g.shiftKey&&document.activeElement===M&&(g.preventDefault(),h.focus()))};return document.addEventListener("keydown",m,!0),()=>{document.removeEventListener("keydown",m,!0),u instanceof HTMLElement&&typeof u.focus=="function"&&u.focus()}},[]),e("div",{className:"gitp-modal-layer",onMouseDown:u=>{u.target===u.currentTarget&&p.current()}},e("div",{className:G("gitp-modal",n&&"is-danger"),ref:r,role:"dialog","aria-modal":"true","aria-label":t},e("div",{className:"gitp-modal-head"},e("div",{className:"gitp-modal-title"},t),e(Te,{label:o,icon:x.close,onClick:i})),a))}function Ht({title:t,body:i,confirmLabel:a,cancelLabel:n,danger:o,busy:r,onConfirm:p,onClose:u}){return e(ct,{title:t,onClose:u,danger:o},e("div",{className:"gitp-modal-sub"},i),e("div",{className:"gitp-modal-actions"},e("button",{type:"button",className:"gitp-btn",onClick:u,disabled:r},n),e("button",{type:"button",className:G("gitp-btn",o?"is-danger":"is-primary"),onClick:p,disabled:r},r?e(le):null,a)))}function sn({t,defaultName:i,defaultMessage:a,busy:n,noVerify:o,error:r,onCreate:p,onNoVerify:u,onClose:d}){let[l,m]=N(i),[g,v]=N(a),h=j(null);li(h,g);let M=l.trim()!==""&&g.trim()!==""&&!n;return e(ct,{title:t("branch.title"),onClose:d,closeLabel:t("action.close")},e("div",{className:"gitp-field"},e("label",{htmlFor:"gitp-branch-name"},t("branch.name")),e("input",{id:"gitp-branch-name",value:l,onChange:f=>m(f.target.value),spellCheck:!1,autoComplete:"off"}),e("div",{className:"gitp-field-hint"},t("branch.nameHint"))),e("div",{className:"gitp-field"},e("label",{htmlFor:"gitp-branch-message"},t("branch.message")),e("textarea",{id:"gitp-branch-message",ref:h,value:g,onChange:f=>v(f.target.value)})),e("label",{className:"gitp-dialog-option",title:t("commit.noVerifyHint")},e("input",{type:"checkbox",checked:o,onChange:f=>u(f.target.checked),disabled:n}),t("commit.noVerify")),r?e("div",{className:"gitp-modal-error"},r):null,e("div",{className:"gitp-modal-actions"},e("button",{type:"button",className:"gitp-btn",onClick:d,disabled:n},t("action.cancel")),e("button",{type:"button",className:"gitp-btn is-primary",disabled:!M,onClick:()=>p({name:l.trim(),message:g.trim()})},n?e(le):null,t("action.createBranch"))))}function rn({t,files:i,busy:a,error:n,onCreate:o,onClose:r}){let[p,u]=N(()=>new Set(i.map(g=>g.path))),[d,l]=N(""),m=g=>{u(v=>{let h=new Set(v);return h.has(g)?h.delete(g):h.add(g),h})};return e(ct,{title:t("stash.title"),onClose:r,closeLabel:t("action.close")},e("div",{className:"gitp-modal-sub"},t("stash.selectHint")),i.length>1?e("div",{style:{display:"flex",justifyContent:"flex-end",marginBottom:"4px"}},e("button",{type:"button",className:"gitp-linkbtn",onClick:()=>u(p.size===i.length?new Set:new Set(i.map(g=>g.path)))},p.size===i.length?t("stash.deselectAll"):t("stash.selectAll"))):null,i.length===0?e("div",{className:"gitp-modal-sub"},t("stash.nothing")):e("div",{className:"gitp-filechecks"},i.map(g=>e("label",{className:"gitp-check",key:g.path},e("input",{type:"checkbox",checked:p.has(g.path),onChange:()=>m(g.path)}),e("span",{className:"gitp-check-path"},g.path)))),e("div",{className:"gitp-field"},e("label",{htmlFor:"gitp-stash-message"},t("stash.message")),e("input",{id:"gitp-stash-message",value:d,onChange:g=>l(g.target.value),placeholder:t("stash.default")})),n?e("div",{className:"gitp-modal-error"},n):null,e("div",{className:"gitp-modal-actions"},e("button",{type:"button",className:"gitp-btn",onClick:r,disabled:a},t("action.cancel")),e("button",{type:"button",className:"gitp-btn is-primary",disabled:a||p.size===0,onClick:()=>o({paths:[...p],message:d.trim()})},a?e(le):null,t("action.stash"))))}function Ct({entry:t,side:i,selected:a,focused:n,busy:o,t:r,onActivate:p,onToggle:u}){let d=lt(t.path),l=i==="staged"?t.stagedAdd:t.add,m=i==="staged"?t.stagedDel:t.del,g=r(i==="staged"?"action.unstageFile":"action.stageFile");return e("div",{className:G("gitp-filerow",a&&"is-selected",n&&"is-focused"),role:"button",tabIndex:0,"aria-pressed":a,onClick:v=>p(v),onKeyDown:v=>{(v.key==="Enter"||v.key===" ")&&(v.preventDefault(),p(v))}},e("span",{className:G("gitp-status",Pt(t.letter))},t.letter),e("span",{className:"gitp-filename"},d.dir?e("span",{className:"gitp-filedir"},d.dir):null,d.base,t.both?e("span",{className:"gitp-both-tag",title:r("meta.partialHint")},r("meta.partial")):null),t.binary?e("span",{className:"gitp-delta"},r("meta.binary")):e("span",{className:"gitp-delta"},l!==null&&l>0?e("span",{className:"gitp-add"},`+${l}`):null,m!==null&&m>0?e("span",{className:"gitp-del"},`\u2212${m}`):null),i==="conflict"?null:e("button",{type:"button",className:"gitp-rowaction","aria-label":g,title:g,disabled:o,onClick:v=>{v.stopPropagation(),u()}},e(P,{path:i==="staged"?x.minus:x.plus,size:14})))}function on({t,snapshot:i,conflicts:a,staged:n,unstaged:o,selection:r,onSelect:p,busy:u,fileBusy:d,onToggleFile:l,onToggleAll:m,onDiscard:g,onBatchStage:v,onBatchUnstage:h,onBatchDiscard:M,diff:f,diffLoading:k,layout:y,onLayout:$,onRefresh:H,onBlock:U,onResolve:_,onOpen:D,message:E,onMessage:z,onCommit:V,onBranch:S,canCommit:K,commitBusy:W,aiBusy:J,aiMenuOpen:Z,onAiToggle:Ke,onAiClose:ke,onAiWrite:fe,onAiBranch:ye,selectionKey:A,amend:ie,onAmend:me,noVerify:be,onNoVerify:De,canAmend:Ne,compact:ce,onBack:Ee}){let[ue,Ue]=N(""),[je,_e]=oi(),$e=j(null),Me=j(null),qe=j(null);li(qe,E);let ve=(c,R)=>`${c}\0${R}`,[Y,ge]=N(()=>r===null||r.side==="conflict"?new Set:new Set([ve(r.side,r.path)])),[ze,Q]=N(!1),re=j(null),[X,w]=N({conflicts:!1,staged:!1,unstaged:!1}),C=c=>w(R=>({...R,[c]:!R[c]})),L=ue.trim().toLowerCase(),O=c=>L===""||c.path.toLowerCase().includes(L),q=Se(()=>a.filter(O),[a,L]),ee=Se(()=>n.filter(O),[n,L]),Ae=Se(()=>o.filter(O),[o,L]),We=c=>{let R=c.indexOf("\0");if(R<0)return null;let F=c.slice(0,R);if(F!=="staged"&&F!=="unstaged")return null;let de=c.slice(R+1),se=(F==="staged"?n:o).find(oe=>oe.path===de);return se===void 0?null:{side:F,entry:se}},Ye=Se(()=>{let c=[];for(let R of Y){let F=We(R);F!==null&&c.push(F)}return c},[Y,n,o]),Qe=Ye.filter(c=>c.side==="unstaged"),Xe=Ye.filter(c=>c.side==="staged");I(()=>{ge(c=>{if(c.size===0)return c;let R=new Set;for(let F of c)We(F)!==null&&R.add(F);return R.size===c.size?c:R})},[i,r]),I(()=>{Y.size===0&&Q(!1)},[Y.size]);function Pe(c,R){if(c==="conflict"){re.current=null,ge(new Set),p({side:c,path:R.path,renamed:!1});return}re.current={side:c,path:R.path,renamed:R.kind==="renamed"},ge(new Set([ve(c,R.path)])),p({side:c,path:R.path,renamed:R.kind==="renamed"})}function B(c,R){let F=ve(c,R.path);if(Y.has(F)){let de=new Set(Y);if(de.delete(F),r!==null&&r.side===c&&r.path===R.path){let se=[...de].pop(),oe=se===void 0?null:We(se);p(oe===null?null:{side:oe.side,path:oe.entry.path,renamed:oe.entry.kind==="renamed"})}ge(de);return}re.current={side:c,path:R.path,renamed:R.kind==="renamed"},ge(new Set([...Y,F])),p({side:c,path:R.path,renamed:R.kind==="renamed"})}function Ge(c,R){let F=c==="staged"?ee:Ae,de=re.current!==null&&re.current.side===c?re.current.path:null,se=de===null?-1:F.findIndex(He=>He.path===de),oe=F.findIndex(He=>He.path===R.path);if(se<0||oe<0){Pe(c,R);return}let[Re,nt]=se<=oe?[se,oe]:[oe,se];ge(new Set(F.slice(Re,nt+1).map(He=>ve(c,He.path)))),p({side:c,path:R.path,renamed:R.kind==="renamed"})}function et(c,R,F){let de=F!==null&&(F.metaKey||F.ctrlKey),se=F!==null&&F.shiftKey;if(c==="conflict"){if(de||se)return;Q(!1),Pe(c,R);return}if(F===null){Q(!1),Pe(c,R);return}if(se){Q(!0),Ge(c,R);return}if(de){Q(!0),B(c,R);return}Q(!1),Pe(c,R)}function dt(c){if(Ue(c),Y.size===0)return;let R=ze;ge(new Set),Q(!1),re.current=null,R&&p(null)}function vt(){ge(new Set),Q(!1),re.current=null,p(null)}async function tt(c){let R=c==="stage"?Qe:c==="unstage"?Xe:Ye;if(R.length===0)return;let F=R.map(se=>se.entry);if(c==="discard"){M(F);return}(c==="stage"?await v(F):await h(F))&&(ge(new Set),Q(!1),Me.current?.querySelector(".gitp-filerow")?.focus())}let Ve=r===null||r.side==="conflict"?null:(r.side==="staged"?n:o).find(c=>c.path===r.path)??null,pt=Se(()=>{let c=0,R=0;for(let F of n)c+=F.stagedAdd??0,R+=F.stagedDel??0;return{add:c,del:R}},[n]),Je=!ce||r===null||ze,Le=!ce||r!==null&&!ze,it=q.length+ee.length+Ae.length,ne=a.length+n.length+o.length;return e("div",{className:"gitp-changes",ref:$e},Je?e("div",{className:"gitp-listcol",ref:Me,style:ce?void 0:{width:`${je}px`}},ne>0?e("div",{className:"gitp-filter-box"},e(P,{path:x.search,size:13}),e("input",{type:"text",value:ue,onChange:c=>dt(c.target.value),placeholder:t("filter.placeholder"),"aria-label":t("filter.placeholder"),spellCheck:!1}),ue?e("button",{type:"button",className:"gitp-filter-clear",onClick:()=>dt(""),"aria-label":t("filter.clear")},e(P,{path:x.close,size:10})):null):null,Y.size>1?e("div",{className:"gitp-batchbar",role:"group","aria-label":t("selection.count",{count:Y.size})},e("span",{className:"gitp-batch-count"},t("selection.count",{count:Y.size})),e("button",{type:"button",className:"gitp-batch-btn","aria-label":t("selection.stage"),title:t("selection.stage"),disabled:d||Qe.length===0,onClick:()=>tt("stage")},e(P,{path:x.plus,size:14})),e("button",{type:"button",className:"gitp-batch-btn","aria-label":t("selection.unstage"),title:t("selection.unstage"),disabled:d||Xe.length===0,onClick:()=>tt("unstage")},e(P,{path:x.minus,size:14})),e("button",{type:"button",className:"gitp-batch-btn is-danger","aria-label":t("selection.discard"),title:t("selection.discard"),disabled:d,onClick:()=>tt("discard")},e(P,{path:x.trash,size:14})),e("button",{type:"button",className:"gitp-batch-btn","aria-label":t("selection.clear"),title:t("selection.clear"),disabled:d,onClick:vt},e(P,{path:x.close,size:14}))):null,e("div",{className:"gitp-filelist"},q.length>0?e(pe.default.Fragment,null,e("div",{className:"gitp-section-head is-conflict",onClick:()=>C("conflicts"),onKeyDown:c=>{c.target!==c.currentTarget||c.key!=="Enter"&&c.key!==" "||(c.preventDefault(),C("conflicts"))},role:"button","aria-expanded":!X.conflicts,tabIndex:0},e(P,{path:x.chevron,size:14,className:G("gitp-section-chev",X.conflicts&&"is-collapsed")}),e("span",{className:"gitp-section-title"},t("section.conflicts")),e("span",{className:"gitp-section-count"},String(q.length))),X.conflicts?null:q.map(c=>e(Ct,{key:`conflict:${c.path}`,entry:c,side:"conflict",selected:r?.side==="conflict"&&r.path===c.path,focused:!1,busy:d,t,onActivate:R=>et("conflict",c,R),onToggle:()=>{}}))):null,ee.length>0?e(pe.default.Fragment,null,e("div",{className:"gitp-section-head",onClick:()=>C("staged"),onKeyDown:c=>{c.target!==c.currentTarget||c.key!=="Enter"&&c.key!==" "||(c.preventDefault(),C("staged"))},role:"button","aria-expanded":!X.staged,tabIndex:0},e(P,{path:x.chevron,size:14,className:G("gitp-section-chev",X.staged&&"is-collapsed")}),e("span",{className:"gitp-section-title"},t("section.staged")),e("span",{className:"gitp-section-count"},String(ee.length)),e("button",{type:"button",className:"gitp-section-action","aria-label":t("action.unstageAll"),title:t("action.unstageAll"),disabled:d,onClick:c=>{c.stopPropagation(),m("staged")}},e(P,{path:x.minus,size:14}))),X.staged?null:ee.map(c=>e(Ct,{key:`staged:${c.path}`,entry:c,side:"staged",selected:Y.has(ve("staged",c.path))||Y.size===0&&r?.side==="staged"&&r.path===c.path,focused:Y.size>1&&r?.side==="staged"&&r.path===c.path,busy:d,t,onActivate:R=>et("staged",c,R),onToggle:()=>l(c,"staged")}))):null,Ae.length>0?e(pe.default.Fragment,null,e("div",{className:"gitp-section-head",onClick:()=>C("unstaged"),onKeyDown:c=>{c.target!==c.currentTarget||c.key!=="Enter"&&c.key!==" "||(c.preventDefault(),C("unstaged"))},role:"button","aria-expanded":!X.unstaged,tabIndex:0},e(P,{path:x.chevron,size:14,className:G("gitp-section-chev",X.unstaged&&"is-collapsed")}),e("span",{className:"gitp-section-title"},t("section.unstaged")),e("span",{className:"gitp-section-count"},String(Ae.length)),e("button",{type:"button",className:"gitp-section-action","aria-label":t("action.stageAll"),title:t("action.stageAll"),disabled:d,onClick:c=>{c.stopPropagation(),m("unstaged")}},e(P,{path:x.plus,size:14}))),X.unstaged?null:Ae.map(c=>e(Ct,{key:`unstaged:${c.path}`,entry:c,side:"unstaged",selected:Y.has(ve("unstaged",c.path))||Y.size===0&&r?.side==="unstaged"&&r.path===c.path,focused:Y.size>1&&r?.side==="unstaged"&&r.path===c.path,busy:d,t,onActivate:R=>et("unstaged",c,R),onToggle:()=>l(c,"unstaged")}))):null,L!==""&&it===0?e("div",{className:"gitp-center",style:{padding:"24px"}},t("filter.empty",{filter:ue})):null,ne===0?e(xe,{icon:e(P,{path:x.check,size:28}),title:t("empty.noChanges"),hint:t("empty.noChangesHint"),action:e("button",{type:"button",className:"gitp-btn is-small",onClick:H,disabled:u},t("action.refresh"))}):null),e("div",{className:"gitp-commitbox"},e("textarea",{ref:qe,value:E,onChange:c=>z(c.target.value),onKeyDown:c=>{c.defaultPrevented||(c.ctrlKey||c.metaKey)&&c.key==="Enter"&&(c.preventDefault(),K&&!W&&V())},placeholder:t("commit.placeholder"),"aria-label":t("commit.placeholder")}),e("div",{className:G("gitp-commit-status-line",a.length>0&&"has-conflict")},a.length>0?e("span",null,t("commit.hintConflict")):n.length>0?e(pe.default.Fragment,null,e("span",null,t("commit.stagedSummary",{count:n.length})," ",e("span",{className:"gitp-add"},`+${pt.add}`)," ",e("span",{className:"gitp-del"},`\u2212${pt.del}`)),e("span",null,t("commit.shortcut",{key:Yi}))):e("span",null,t("commit.hintStage"))),e("div",{className:"gitp-commit-actions"},e("div",{className:"gitp-commit-opts"},Ne?e("label",{className:"gitp-amend"},e("input",{type:"checkbox",checked:ie,onChange:c=>me(c.target.checked)}),t("commit.amend")):null,e("label",{className:"gitp-amend",title:t("commit.noVerifyHint")},e("input",{type:"checkbox",checked:be,onChange:c=>De(c.target.checked),disabled:W}),t("commit.noVerify"))),e("div",{className:"gitp-ai-wrap"},e("button",{type:"button",className:"gitp-btn is-small is-icon","aria-label":t("ai.action"),"aria-haspopup":"menu","aria-expanded":Z===!0,title:t("ai.action"),disabled:W||J||n.length===0,onClick:Ke},J?e(le):e(P,{path:x.sparkles,size:13}))),e("button",{type:"button",className:"gitp-btn is-small",onClick:S,disabled:W||a.length>0||n.length===0,"aria-label":t("action.branch")},e(P,{path:x.branch,size:13}),t("action.branch")),e("button",{type:"button",className:"gitp-btn is-primary is-small",onClick:V,disabled:!K||W},W?e(le):null,t(W?"action.committing":"action.commit"))),Z?e(pn,{t,busy:J,canUse:n.length>0,canBranch:n.length>0&&a.length===0,onWrite:fe,onBranch:ye,onClose:ke}):null)):null,Je&&Le?e(di,{label:t("split.files"),containerRef:$e,columnRef:Me,width:je,onChange:_e}):null,Le?e("div",{className:"gitp-diffcol"},r?e(ci,{t,diff:f,loading:k,layout:y,onLayout:$,onBlock:U,onResolve:_,busy:d,selectionKey:A,renamed:r.renamed===!0,compact:ce,onBack:Ee,onOpen:D,onDiscard:Ve===null?void 0:()=>g(Ve)}):e(xe,{icon:e(P,{path:x.file,size:28}),title:t("empty.selectFile"),hint:t("empty.selectFileHint")})):null)}function ci({t,diff:i,loading:a,layout:n,onLayout:o,onBlock:r,onResolve:p,busy:u,selectionKey:d,renamed:l=!1,compact:m,onBack:g,onOpen:v,onDiscard:h}){let M=j(null),[f,k]=N({index:-1,canPrev:!1,canNext:!1}),y=Se(()=>i===null?[]:[...i.blocks??[]].sort((E,z)=>E.row-z.row),[i]),$=()=>{let E=M.current;if(E===null)return[];let z=[...E.querySelectorAll(".gitp-pane")];if(z.length>0)return z;let V=E.querySelector(".gitp-unified");return V===null?[]:[V]},H=E=>{let z=-1;for(let V=0;V<y.length;V+=1){let S=y[V];S!==void 0&&S.row*Fe<=E+40&&(z=V)}return{index:z,canPrev:z>0,canNext:y.some(V=>V.row*Fe>E+40)}};I(()=>{let E=M.current;if(E===null)return;let z=0,V=()=>{let K=$()[0];k(H(K===void 0?0:K.scrollTop))},S=()=>{z===0&&(z=requestAnimationFrame(()=>{z=0,V()}))};return E.addEventListener("scroll",S,!0),V(),()=>{E.removeEventListener("scroll",S,!0),z!==0&&cancelAnimationFrame(z)}},[i,n]);let U=E=>{let z=$()[0],V=z===void 0?0:z.scrollTop,S=null;if(E>0)S=y.find(Z=>Z.row*Fe>V+40)??null;else{for(let Z of y)Z.row*Fe<=V+40&&(S=Z);S=S===null?null:y[y.indexOf(S)-1]??null}if(S===null)return;let K=Math.max(0,S.row*Fe-40),W=$();for(let Z of W)Z.scrollTop=K;let J=W[0]===void 0?K:W[0].scrollTop;k(H(J))};if(a&&i===null)return e("div",{className:"gitp-diff"},e("div",{className:"gitp-center"},e(le),e("div",{className:"gitp-center-hint"},t("diff.loading"))));if(i===null)return e("div",{className:"gitp-diff"},e(xe,{icon:e(P,{path:x.file,size:28}),title:t("empty.selectFile"),hint:t("empty.selectFileHint")}));let _=lt(i.path),D={left:i.labels.left==="HEAD"?t("diff.head"):i.labels.left==="Staged"?t("diff.staged"):i.labels.left==="Local"?t("diff.local"):i.labels.left==="Parent"?t("diff.parent"):i.labels.left,right:i.labels.right==="Staged"?t("diff.staged"):i.labels.right==="Local"?t("diff.local"):i.labels.right==="Commit"?t("diff.commit"):i.labels.right==="Incoming"?t("action.acceptTheirs"):i.labels.right};return e("div",{className:"gitp-diff",ref:M},e("div",{className:"gitp-diff-head"},m&&g?e(Te,{label:t("action.back"),icon:x.left,onClick:g}):null,e("div",{className:"gitp-diff-title"},e("span",{className:G("gitp-status",Pt(i.conflict?"C":"M"))},i.conflict?"C":"M"),e("div",{className:"gitp-diff-path"},_.dir?e("span",{className:"gitp-diff-dir"},_.dir):null,e("span",{className:"gitp-diff-base"},_.base)),i.conflict?e("span",{className:"gitp-diff-pill is-conflict"},t("section.conflicts")):i.side==="staged"?e("span",{className:"gitp-diff-pill is-staged"},t("diff.staged")):i.side==="unstaged"?e("span",{className:"gitp-diff-pill is-unstaged"},t("diff.unstaged")):i.side==="log"?e("span",{className:"gitp-diff-pill is-commit"},t("diff.commit")):null),i.conflict?e("span",{className:"gitp-diff-stats gitp-del"},t("section.conflicts")):i.binary?e("span",{className:"gitp-diff-stats"},t("diff.binary")):e("span",{className:"gitp-diff-stats"},e("span",{className:"gitp-add"},`+${i.add??0}`),e("span",{className:"gitp-del"},`\u2212${i.del??0}`)),y.length>0&&!i.conflict&&!i.binary?e("div",{className:"gitp-change-nav",role:"group","aria-label":t("diff.changes")},e(Te,{label:t("action.prevChange"),icon:x.chevronUp,onClick:()=>U(-1),disabled:!f.canPrev}),e("span",{className:"gitp-change-count"},`${Math.max(0,f.index)+1}/${y.length}`),e(Te,{label:t("action.nextChange"),icon:x.chevron,onClick:()=>U(1),disabled:!f.canNext})):null,e("div",{className:"gitp-diff-actions"},v!==void 0&&!i.binary?e(Te,{label:t("action.openEditor"),icon:x.code,onClick:()=>v(i)}):null,i.conflict?null:e("div",{className:"gitp-seg",role:"group","aria-label":t("diff.layout")},e("button",{type:"button",className:n==="split"?"is-active":"","aria-pressed":n==="split","aria-label":t("diff.split"),title:t("diff.split"),onClick:()=>o("split")},e(P,{path:x.split,size:13})),e("button",{type:"button",className:n==="unified"?"is-active":"","aria-pressed":n==="unified","aria-label":t("diff.unified"),title:t("diff.unified"),onClick:()=>o("unified")},e(P,{path:x.unified,size:13}))),h!==void 0?e(Te,{label:t("action.discard"),icon:x.trash,onClick:h,disabled:u}):null)),i.conflict?e("div",{className:"gitp-conflict-banner"},e(P,{path:x.warning,size:14}),e("span",null,t("diff.conflictBanner")),e("button",{type:"button",className:"gitp-btn is-small",onClick:()=>p?.("ours"),disabled:u},t("action.acceptOurs")),e("button",{type:"button",className:"gitp-btn is-small",onClick:()=>p?.("theirs"),disabled:u},t("action.acceptTheirs"))):null,i.binary?e("div",{className:"gitp-binary"},e("div",{className:"gitp-binary-title"},t("diff.binary")),e("div",null,t("diff.binaryHint",{before:i.leftSize??0,after:i.rightSize??0}))):i.conflict?e(ln,{diff:i}):n==="unified"?e(dn,{t,diff:i,onBlock:r,busy:u,selectionKey:d,renamed:l}):e(cn,{t,diff:i,labels:D,onBlock:r,busy:u,selectionKey:d,renamed:l}),!i.binary&&!i.conflict?e("div",{className:"gitp-diff-foot"},e("span",{className:"gitp-diff-legend"},e("span",{className:"gitp-diff-dot is-add"}),t("diff.added")),e("span",{className:"gitp-diff-legend"},e("span",{className:"gitp-diff-dot is-del"}),t("diff.removed")),e("span",{className:"gitp-diff-foot-spacer"}),e("span",null,y.length===1?t("diff.blockCountOne"):t("diff.blockCount",{count:y.length}))):null)}function ln({diff:t}){return e("div",{className:"gitp-unified"},t.right.map((i,a)=>e("div",{className:G("gitp-urow",/^(<{7}|={7}|>{7})/.test(i)&&"is-conflict-marker"),key:a},e("span",{className:"gitp-uno"},a+1),e("span",{className:"gitp-ucontent"},i||"\xA0"))))}function cn({t,diff:i,labels:a,onBlock:n,busy:o,selectionKey:r,renamed:p}){let u=j(null),d=j(null),l=j(null),m=f=>{l.current&&(l.current.style.transform=`translateY(${-f}px)`)},g=f=>{let k=f.scrollTop;u.current&&u.current!==f&&(u.current.scrollTop=k),d.current&&d.current!==f&&(d.current.scrollTop=k),m(k)};I(()=>{let f=i.blocks[0];if(!f||f.row<=10)return;let k=Math.max(0,f.row*Fe-80);u.current&&(u.current.scrollTop=k),d.current&&(d.current.scrollTop=k),m(k)},[r]);let v=Se(()=>{let f=new Map;for(let k of i.rows){if(k.k!=="mod"||k.l===null||k.r===null)continue;let y=i.left[k.l-1]??"",$=i.right[k.r-1]??"";f.set(k,en(y,$))}return f},[i]),h=Se(()=>{let f=new Map;for(let k of i.blocks)f.set(k.row,k);return f},[i]),M=f=>{if(p)return[];let k={action:"unstaged",icon:x.left,label:t("action.stageBlock"),revert:!1},y={action:"revert",icon:x.right,label:t("action.revertBlock"),revert:!0};return i.side==="unstaged"?i.leftMissing?[k]:[k,y]:i.side==="staged"?[{action:"staged",icon:x.right,label:t("action.unstageBlock"),revert:!1}]:[]};return e(pe.default.Fragment,null,e("div",{className:"gitp-pane-heads"},e("div",{className:"gitp-pane-head"},a.left),e("div",{className:"gitp-pane-head-gutter"}),e("div",{className:"gitp-pane-head"},a.right)),e("div",{className:"gitp-panes"},e("div",{className:"gitp-pane",ref:u,tabIndex:0,role:"region","aria-label":a.left,onScroll:f=>g(f.currentTarget)},i.rows.map((f,k)=>{let y=f.l?i.left[f.l-1]??"":"",$=f.k==="add"?"blank":f.k==="mod"?"del":f.k,H=v.get(f);return e("div",{className:G("gitp-line",$!=="ctx"&&`is-${$}`),key:`l${k}`},e("span",{className:"gitp-ln"},f.l??""),e("span",{className:"gitp-code"},f.l===null?"\xA0":H?Qt(H.lPre,H.lMid,H.lSuf):y||"\xA0"))})),e("div",{className:"gitp-gutter","aria-hidden":!1},e("div",{className:"gitp-gutter-inner",ref:l},i.blocks.map(f=>{let k=M(f);return k.length===0?null:e("div",{className:"gitp-arrows",key:f.id,style:{top:f.row*Fe}},k.map(y=>e("button",{type:"button",className:G("gitp-arrow",y.revert&&"is-revert"),key:y.action,"aria-label":y.label,title:y.label,disabled:o,onClick:()=>n(f,y.action)},e(P,{path:y.icon,size:12}))))}))),e("div",{className:"gitp-pane",ref:d,tabIndex:0,role:"region","aria-label":a.right,onScroll:f=>g(f.currentTarget)},i.rows.map((f,k)=>{let y=f.r?i.right[f.r-1]??"":"",$=f.k==="del"?"blank":f.k==="mod"?"add":f.k,H=v.get(f);return e("div",{className:G("gitp-line",$!=="ctx"&&`is-${$}`),key:`r${k}`},e("span",{className:"gitp-ln"},f.r??""),e("span",{className:"gitp-code"},f.r===null?"\xA0":H?Qt(H.rPre,H.rMid,H.rSuf):y||"\xA0"))}))))}function dn({t,diff:i,onBlock:a,busy:n,selectionKey:o,renamed:r}){let p=Se(()=>{let l=new Map;for(let g of i.blocks)l.set(g.row,g);let m=[];return i.rows.forEach((g,v)=>{let h=l.get(v),M=g.l===null?"":i.left[g.l-1]??"",f=g.r===null?"":i.right[g.r-1]??"";g.k==="ctx"?m.push({l:g.l,r:g.r,text:M,kind:"ctx",block:h}):g.k==="mod"?(m.push({l:g.l,r:null,text:M,kind:"del",block:h}),m.push({l:null,r:g.r,text:f,kind:"add"})):g.k==="del"?m.push({l:g.l,r:null,text:M,kind:"del",block:h}):m.push({l:null,r:g.r,text:f,kind:"add",block:h})}),m},[i]),u=j(null);I(()=>{let l=p.find(m=>m.block!==void 0);!l||p.indexOf(l)<=10||u.current===null||(u.current.scrollTop=Math.max(0,p.indexOf(l)*Fe-80))},[o]);let d=l=>{if(r)return[];let m={action:"unstaged",icon:x.left,label:t("action.stageBlock"),revert:!1},g={action:"revert",icon:x.right,label:t("action.revertBlock"),revert:!0};return i.side==="unstaged"?i.leftMissing?[m]:[m,g]:i.side==="staged"?[{action:"staged",icon:x.right,label:t("action.unstageBlock"),revert:!1}]:[]};return e("div",{className:"gitp-unified",ref:u,tabIndex:0,role:"region","aria-label":t("diff.unified")},p.map((l,m)=>{let g=l.block?d(l.block):[];return e("div",{className:G("gitp-urow",l.kind!=="ctx"&&`is-${l.kind}`),key:m},e("span",{className:"gitp-uarrows"},g.map(v=>e("button",{type:"button",className:G("gitp-arrow",v.revert&&"is-revert"),key:v.action,"aria-label":v.label,title:v.label,disabled:n,onClick:()=>{l.block!==void 0&&a(l.block,v.action)}},e(P,{path:v.icon,size:12})))),e("span",{className:"gitp-uno"},l.l??""),e("span",{className:"gitp-uno"},l.r??""),e("span",{className:"gitp-ucontent"},l.text||"\xA0"))}))}function pn({t,busy:i,canUse:a,canBranch:n,onWrite:o,onBranch:r,onClose:p}){let u=j(p);u.current=p;let d=j(null);I(()=>{let m=v=>{v.key==="Escape"&&(v.preventDefault(),v.stopPropagation(),u.current())},g=v=>{let h=v.target;d.current!==null&&h instanceof Node&&d.current.contains(h)||h instanceof Element&&h.closest(".gitp-ai-wrap")!==null||u.current()};return document.addEventListener("keydown",m,!0),document.addEventListener("mousedown",g,!0),()=>{document.removeEventListener("keydown",m,!0),document.removeEventListener("mousedown",g,!0)}},[]);let l=(m,g,v,h,M)=>e("button",{type:"button",key:m,className:"gitp-popover-row",role:"menuitem",disabled:h,onClick:M},e(P,{path:g,size:13}),e("span",{className:"gitp-popover-row-text"},v));return e("div",{className:"gitp-popover is-menu",ref:d,role:"menu","aria-label":t("ai.action")},l("write",x.sparkles,t("ai.write"),!a||i,o),l("branch",x.branch,t("ai.branch"),!n||i,r))}function un({t,workspaceTitle:i,branch:a,repo:n,ahead:o,behind:r,upstream:p,onBranchMenu:u,onRepoMenu:d,repos:l,repoRoot:m,onSync:g,busy:v,onRefresh:h,syncing:M}){let f=a?.name??(a?.oid?Oe(a.oid):t(n===!1?"empty.noRepo":"status.detached")),k=l.find(_=>_.root===m)??null,y=l[0],$=l.length>1||y!==void 0&&l.length===1&&y.name!=="."&&!y.name.startsWith(".."),H=k===null?t("repo.none"):k.name==="."?t("repo.workspace"):k.label??k.name,U=k?.worktree===!0;return e("div",{className:"gitp-head"},e("div",{className:"gitp-head-left"},e("span",{className:"gitp-repo"},i),$?e("button",{type:"button",className:"gitp-branch gitp-repo-pick",onClick:d,"aria-haspopup":"listbox","aria-label":t("repo.pick"),title:t("repo.pick")},e(P,{path:x.folder,size:13}),e("span",{className:"gitp-branch-name"},H),e("span",{className:"gitp-chevron"},e(P,{path:x.chevron,size:11}))):null,e("button",{type:"button",className:"gitp-branch",onClick:u,disabled:n===!1,"aria-haspopup":"listbox","aria-label":t("branch.title"),title:t("branch.title")},e(P,{path:x.branch,size:13}),e("span",{className:"gitp-branch-name"},f),e("span",{className:"gitp-chevron"},e(P,{path:x.chevron,size:11}))),U?e("span",{className:"gitp-worktree",title:m??void 0},t("repo.worktree")):null),e("div",{className:"gitp-head-right"},e(Nt,{label:t("action.fetch"),icon:x.fetch,count:0,onClick:()=>g("fetch"),busy:M==="fetch",disabled:v}),e(Nt,{label:t("action.pull"),icon:x.pull,count:r,onClick:()=>g("pull"),busy:M==="pull",disabled:v||p===null}),e(Nt,{label:t("action.push"),icon:x.push,count:o,onClick:()=>g("push"),busy:M==="push",disabled:v}),e(Te,{label:t("action.refresh"),icon:x.refresh,onClick:h,disabled:v})))}function gn({t,mode:i,onMode:a,counts:n}){let o=[{id:"changes",label:t("mode.changes"),count:n.changes},{id:"log",label:t("mode.log"),count:0},{id:"stash",label:t("mode.stash"),count:0}];return e("nav",{className:"gitp-rail","aria-label":t("panel")},o.map(r=>e("button",{type:"button",key:r.id,className:G("gitp-rail-item",i===r.id&&"is-active"),onClick:()=>a(r.id),"aria-label":r.count>0?`${r.label}, ${r.count}`:r.label,"aria-current":i===r.id?"page":void 0},e("span",{className:"gitp-rail-label"},r.label),r.count>0?e("span",{className:"gitp-rail-count"},String(r.count)):null)))}function hn({t,repos:i,current:a,onPick:n,onInitRoot:o,onClose:r}){let p=j(null),u=j(r);u.current=r,I(()=>{p.current?.querySelector("button:not(:disabled)")?.focus();let l=m=>{m.key==="Escape"&&(m.preventDefault(),m.stopPropagation(),u.current())};return document.addEventListener("keydown",l,!0),()=>document.removeEventListener("keydown",l,!0)},[]);let d=!i.some(l=>!l.worktree&&(l.name==="."||l.name.startsWith("..")));return e("div",{className:"gitp-popover-layer",onMouseDown:l=>{l.target===l.currentTarget&&u.current()}},e("div",{className:"gitp-popover is-wide",ref:p,role:"listbox","aria-label":t("repo.title")},e("div",{className:"gitp-popover-title"},t("repo.title")),e("div",{className:"gitp-popover-list"},i.map(l=>e("button",{type:"button",key:l.root,className:G("gitp-popover-row",l.worktree&&"is-nested"),role:"option","aria-selected":l.root===a,disabled:l.root===a,title:l.root,onClick:()=>n(l.root)},e(P,{path:l.worktree?x.branch:x.folder,size:13}),e("span",{className:"gitp-popover-row-text"},l.name==="."?t("repo.workspace"):l.label??l.name),l.worktree&&l.branch!==null?e("span",{className:"gitp-popover-hint"},l.branch):null,l.root===a?e(P,{path:x.check,size:13,className:"gitp-checkmark"}):null))),d?e(pe.default.Fragment,null,e("div",{className:"gitp-popover-sep"}),e("button",{type:"button",className:"gitp-popover-row",onClick:o},e(P,{path:x.plus,size:13}),e("span",{className:"gitp-popover-row-text"},t("repo.initRoot")))):null))}function fn({t,branches:i,loading:a,busy:n,onCheckout:o,onNew:r,onClose:p}){let u=j(null),d=j(p);d.current=p;let[l,m]=N("");I(()=>{u.current?.querySelector("input")?.focus();let H=U=>{U.key==="Escape"&&(U.preventDefault(),U.stopPropagation(),d.current())};return document.addEventListener("keydown",H,!0),()=>document.removeEventListener("keydown",H,!0)},[]);let g=l.trim().toLowerCase(),v=i.filter(H=>!H.remote),h=new Set(v.map(H=>H.name)),M=i.filter(H=>{if(!H.remote)return!1;let U=H.name.split("/").slice(1).join("/");return U!==""&&!h.has(U)}),f=H=>g===""||H.name.toLowerCase().includes(g),k=v.filter(f),y=M.filter(f),$=(H,U)=>H.map(_=>{let D=_.worktree!==null;return e("button",{type:"button",key:`${U?"r":"l"}:${_.name}`,className:"gitp-popover-row",role:"option","aria-selected":_.current===!0,disabled:n||_.current===!0||D,title:D?`${t("branch.inWorktree")}: ${_.worktree??""}`:void 0,onClick:()=>o(_.name,U)},e(P,{path:x.branch,size:13}),e("span",{className:"gitp-popover-row-text"},_.name),D?e("span",{className:"gitp-popover-hint"},_.worktree??""):null,_.current?e(P,{path:x.check,size:13,className:"gitp-checkmark"}):null)});return e("div",{className:"gitp-popover-layer",onMouseDown:H=>{H.target===H.currentTarget&&d.current()}},e("div",{className:"gitp-popover is-wide",ref:u,role:"listbox","aria-label":t("branch.local")},e("input",{className:"gitp-search",value:l,placeholder:t("branch.search"),onChange:H=>m(H.target.value),"aria-label":t("branch.search")}),e("button",{type:"button",className:"gitp-popover-row",disabled:n,onClick:r},e(P,{path:x.plus,size:13}),e("span",{className:"gitp-popover-row-text"},t("branch.new"))),e("div",{className:"gitp-popover-sep"}),a?e("div",{className:"gitp-modal-sub"},t("branch.loading")):null,!a&&k.length===0&&y.length===0?e("div",{className:"gitp-modal-sub"},t(g===""?"branch.none":"branch.noneMatch")):null,k.length>0?e(pe.default.Fragment,null,e("div",{className:"gitp-popover-title"},t("branch.local")),e("div",{className:"gitp-popover-list"},$(k,!1))):null,y.length>0?e(pe.default.Fragment,null,e("div",{className:"gitp-popover-title"},t("branch.remote")),e("div",{className:"gitp-popover-list"},$(y,!0))):null))}function mn({t,busy:i,error:a,onCreate:n,onClose:o}){let[r,p]=N("");return e(ct,{title:t("branch.newTitle"),onClose:o,closeLabel:t("action.close")},e("div",{className:"gitp-field"},e("label",{htmlFor:"gitp-new-branch"},t("branch.name")),e("input",{id:"gitp-new-branch",value:r,onChange:u=>p(u.target.value),spellCheck:!1,autoComplete:"off"}),e("div",{className:"gitp-field-hint"},t("branch.newHint"))),a?e("div",{className:"gitp-modal-error"},a):null,e("div",{className:"gitp-modal-actions"},e("button",{type:"button",className:"gitp-btn",onClick:o,disabled:i},t("action.cancel")),e("button",{type:"button",className:"gitp-btn is-primary",disabled:i||r.trim()==="",onClick:()=>n({name:r.trim()})},i?e(le):null,t("action.createAndSwitch"))))}function bn(t,i,a,n){let o=i?.branch??null,r=i?.merging===!0||i?.rebasing===!0||i?.reverting===!0||i?.cherryPicking===!0,p=(i?.conflicts?.length??0)>0,u=(i?.entries??[]).some(M=>M.staged),d=o===null||o.detached===!0,l=o?.oid!==null&&o?.oid!==void 0&&o.oid===t.hash,m=typeof o?.upstream=="string"&&o.upstream!==""&&o.ahead===0,g=(t.parents?.length??0)>1,v=[];v.push({id:"copy",label:n("history.copy"),icon:x.copy,hint:null,reason:null});let h=null;return r?h=n("history.blockedOperation"):d?h=n("history.blockedDetached"):l?(t.parents?.length??0)===0?h=n("history.blockedNoParent"):m&&(h=n("history.blockedPushed")):h=n("history.blockedNotHead"),v.push({id:"undo",label:n("history.undo"),icon:x.undo,hint:n("history.undoHint"),reason:h}),h=null,r?h=n("history.blockedOperation"):g?h=n("history.blockedMerge"):p?h=n("history.blockedConflict"):u&&(h=n("history.blockedStaged")),v.push({id:"revert",label:n("history.revert"),icon:x.revert,hint:n("history.revertHint"),reason:h}),h=null,r?h=n("history.blockedOperation"):g?h=n("history.blockedMerge"):p?h=n("history.blockedConflict"):a.has(t.hash)&&(h=n("history.blockedContained")),v.push({id:"cherry",label:n("history.cherryPick"),icon:x.cherry,hint:n("history.cherryPickHint"),reason:h}),h=null,r?h=n("history.blockedOperation"):d&&(h=n("history.blockedDetached")),v.push({id:"reset",label:n("history.reset"),icon:x.reset,hint:n("history.resetHint"),reason:h}),v}function vn({t,commit:i,rows:a,busy:n,onPick:o,onClose:r}){let p=j(null),u=j(r),d=j(null);return u.current=r,I(()=>{d.current=document.activeElement instanceof HTMLElement?document.activeElement:null,p.current?.querySelector("button:not(:disabled)")?.focus();let l=m=>{m.key==="Escape"&&(m.preventDefault(),m.stopPropagation(),u.current())};return document.addEventListener("keydown",l,!0),()=>{document.removeEventListener("keydown",l,!0),d.current&&typeof d.current.focus=="function"&&d.current.focus()}},[]),e("div",{className:"gitp-popover-layer",onMouseDown:l=>{l.target===l.currentTarget&&u.current()}},e("div",{className:"gitp-popover is-wide",ref:p,role:"menu","aria-label":t("history.actions")},e("div",{className:"gitp-popover-title"},t("history.actions")),e("div",{className:"gitp-popover-blurb",title:i.subject},`${Oe(i.hash)} \xB7 ${i.subject}`),e("div",{className:"gitp-popover-sep"}),a.map(l=>e("button",{type:"button",key:l.id,className:"gitp-action-row",role:"menuitem",disabled:n||l.reason!==null,title:l.reason??l.hint??void 0,onClick:()=>o(l.id)},e(P,{path:l.icon??x.more,size:13}),e("span",{className:"gitp-action-text"},e("span",{className:"gitp-action-label"},l.label),l.reason!==null||l.hint!==null?e("span",{className:"gitp-action-reason"},l.reason??l.hint):null)))))}function yn({t,commit:i,busy:a,error:n,onReset:o,onClose:r}){let[p,u]=N("soft"),d=[["soft","history.resetModeSoft","history.resetModeSoftHint"],["mixed","history.resetModeMixed","history.resetModeMixedHint"],["hard","history.resetModeHard","history.resetModeHardHint"]];return e(ct,{title:t("history.resetTitle"),onClose:r,danger:p==="hard"},e("div",{className:"gitp-modal-sub"},t("history.resetBody",{hash:Oe(i.hash)})),e("div",{role:"radiogroup","aria-label":t("history.resetTitle")},d.map(([l,m,g])=>e("label",{key:l,className:"gitp-reset-mode"},e("input",{type:"radio",name:"gitp-reset-mode",value:l,checked:p===l,disabled:a,onChange:()=>u(l)}),e("span",{className:"gitp-reset-mode-text"},e("span",{className:"gitp-reset-mode-title"},t(m)),e("span",{className:"gitp-reset-mode-hint"},t(g)))))),p==="hard"?e("div",{className:"gitp-modal-warn",role:"alert"},t("history.resetHardWarning")):null,n!==null?e("div",{className:"gitp-modal-error"},n):null,e("div",{className:"gitp-modal-actions"},e("button",{type:"button",className:"gitp-btn",onClick:r,disabled:a},t("action.cancel")),e("button",{type:"button",className:G("gitp-btn",p==="hard"?"is-danger":"is-primary"),onClick:()=>o(p),disabled:a},a?e(le):null,t("history.resetAction"))))}function wn({call:t,workspaceId:i,repo:a,t:n,refreshToken:o,compact:r,layout:p,onLayout:u,snapshot:d,onApplied:l}){let[m,g]=N(null),[v,h]=N(null),[M,f]=N(null),[k,y]=N(null),[$,H]=N(null),[U,_]=N(!1),[D,E]=N(!1),[z,V]=N(!1),[S,K]=N(null),[W,J]=N(!1),[Z,Ke]=oi(),[ke,fe]=N(null),[ye,A]=N(null),[ie,me]=N(null),[be,De]=N(null),[Ne,ce]=N(null),[Ee,ue]=N(null),Ue=j(null),je=j(null),_e=j(a),$e=w=>{navigator?.clipboard?.writeText&&(navigator.clipboard.writeText(w).catch(()=>{}),J(!0),setTimeout(()=>J(!1),2e3))};I(()=>{if(Ee===null)return;let w=setTimeout(()=>ue(null),4e3);return()=>clearTimeout(w)},[Ee]),I(()=>{fe(null),A(null),me(null),De(null)},[a]),I(()=>{_e.current!==a&&(_e.current=a,h(null),f(null),y(null),H(null))},[a]),I(()=>{let w=!0,C=new AbortController;return _(!0),t("log",{workspaceId:i,repo:a},C.signal).then(L=>{if(!w)return;let O=tn(L.commits??[]);g(O);let q=O[0];q!==void 0&&h(ee=>ee??q.hash)}).catch(L=>{let O=te(L);w&&O.name!=="AbortError"&&K(O)}).finally(()=>{w&&_(!1)}),()=>{w=!1,C.abort()}},[i,a,o]),I(()=>{if(!v){f(null);return}let w=!0,C=new AbortController;return E(!0),t("commitDetail",{workspaceId:i,repo:a,hash:v},C.signal).then(L=>{if(w){f(L);let O=L.files[0];!r&&O!==void 0?y(q=>q!==null&&L.files.some(ee=>ee.path===q)?q:O.path):r&&y(null),H(null)}}).catch(L=>{let O=te(L);w&&O.name!=="AbortError"&&K(O)}).finally(()=>{w&&E(!1)}),()=>{w=!1,C.abort()}},[i,a,v,r]),I(()=>{if(!k||!M){H(null);return}let w=!0,C=new AbortController;return V(!0),t("diff",{workspaceId:i,repo:a,path:k,side:"log",commit:M.hash,parent:M.parents?.[0]},C.signal).then(L=>{w&&H(L)}).catch(L=>{let O=te(L);w&&O.name!=="AbortError"&&K(O)}).finally(()=>{w&&V(!1)}),()=>{w=!1,C.abort()}},[i,a,k,M]);let Me=Se(()=>{let w=new Map;for(let q of m??[])w.set(q.hash,q.parents);let C=new Set,L=[],O=d?.branch?.oid;for(typeof O=="string"&&O!==""&&L.push(O);L.length>0;){let q=L.pop();if(q===void 0)break;if(!C.has(q)){C.add(q);for(let ee of w.get(q)??[])L.push(ee)}}return C},[m,d?.branch?.oid]),qe=ke===null?[]:bn(ke,d,Me,n);async function ve(w){ce("undo");try{let C=await t("undoCommit",{workspaceId:i,repo:a,hash:w.hash});A(null),l({status:C.status,message:C.message,goToChanges:!0,toast:n("history.undone")})}catch(C){A(null),ue({text:Ce(C),error:!0}),l({})}finally{ce(null)}}async function Y(w){ce("revert");try{let C=await t("revertCommit",{workspaceId:i,repo:a,hash:w.hash});A(null),l({status:C.status,message:C.message,goToChanges:!0,toast:n(C.conflicted?"history.revertConflicts":"history.reverted")})}catch(C){A(null),ue({text:Ce(C),error:!0}),l({})}finally{ce(null)}}async function ge(w){ce("cherry");try{let C=await t("cherryPickCommit",{workspaceId:i,repo:a,hash:w.hash});ue({text:n("history.picked",{hash:Oe(C.hash)}),error:!1}),l({status:C.status})}catch(C){ue({text:Ce(C),error:!0}),l({})}finally{ce(null)}}async function ze(w,C){ce("reset"),De(null);try{let L=await t("resetToCommit",{workspaceId:i,repo:a,hash:w.hash,mode:C,confirm:!0});me(null),ue({text:n("history.resetDone",{hash:Oe(w.hash)}),error:!1}),l({status:L.status})}catch(L){De(Ce(L))}finally{ce(null)}}function Q(w){let C=ke;if(C!==null){if(w==="copy"){$e(C.hash),fe(null),ue({text:n("action.copied"),error:!1});return}fe(null),w==="undo"?A({type:"undo",commit:C}):w==="revert"?A({type:"revert",commit:C}):w==="cherry"?ge(C):w==="reset"&&me(C)}}if(U&&m===null)return e(xe,{icon:e(le),title:n("log.loading")});if(m===null&&S!==null)return e(xe,{icon:e(P,{path:x.warning,size:28}),title:n("error.title"),hint:Ce(S)});if(m!==null&&m.length===0)return e(xe,{icon:e(P,{path:x.history,size:28}),title:n("empty.noHistory"),hint:n("empty.noHistoryHint")});let re=!r||!k,X=!r||!!k;return e("div",{className:"gitp-changes",ref:Ue},re?e("div",{className:"gitp-listcol",ref:je,style:r?void 0:{width:`${Z}px`}},e("div",{className:"gitp-loglist"},S?e("div",{className:"gitp-error"},e("span",{className:"gitp-error-text"},Ce(S))):null,(m??[]).map(w=>e("button",{type:"button",key:w.hash,className:G("gitp-commitrow",v===w.hash&&"is-selected"),onClick:()=>h(w.hash),onContextMenu:C=>{C.preventDefault(),h(w.hash),fe(w)},"aria-haspopup":"menu"},e("span",{className:"gitp-graph",style:{width:Math.max(14,w.laneCount*10+8)}},e("span",{className:"gitp-graph-line",style:{left:6+w.lane*10}}),e("span",{className:G("gitp-graph-dot",w.lane%4?`g${w.lane%4}`:""),style:{left:6+w.lane*10}})),e("span",{className:"gitp-commitmain"},e("div",{className:"gitp-commit-subject"},w.subject),e("div",{className:"gitp-commit-meta"},e("span",null,w.author),e("span",null,"\xB7"),e("span",null,ei(w.date))),w.refs.length>0?e("div",{className:"gitp-refs"},w.refs.map(C=>e("span",{key:C,className:G("gitp-ref",C.startsWith("HEAD")&&"is-head")},C.replace(/^HEAD -> /,"")))):null)))),e("div",{className:"gitp-logdetail-summary"},D&&M===null?e("div",{className:"gitp-center",style:{padding:"24px"}},e(le)):M===null?e(xe,{title:n("log.select")}):e(pe.default.Fragment,null,e("div",{className:"gitp-detail-head"},e("div",{className:"gitp-detail-title"},e("div",{className:"gitp-detail-subject"},M.subject),e(Te,{label:n("history.actions"),icon:x.more,disabled:Ne!==null,onClick:()=>fe({hash:M.hash,parents:M.parents??[],subject:M.subject})})),e("div",{className:"gitp-detail-meta"},e("button",{type:"button",className:"gitp-detail-hash-btn",onClick:()=>$e(M.hash),title:n(W?"action.copied":"action.copyHash")},Oe(M.hash),e(P,{path:W?x.check:x.copy,size:11})),e("span",null,M.author),e("span",null,ei(M.date)))),M.body?e("div",{className:"gitp-detail-body"},M.body):null,e("div",{className:"gitp-detail-section-head"},e("span",null,n("log.files")),e("span",{className:"gitp-section-count"},String(M.files?.length??0))),e("div",{className:"gitp-detail-files"},!M.files||M.files.length===0?e("div",{className:"gitp-center-hint",style:{padding:"4px 8px"}},n("log.noFiles")):M.files.map(w=>{let C=lt(w.path);return e("button",{type:"button",key:w.path,className:G("gitp-detail-file",k===w.path&&"is-selected"),onClick:()=>y(w.path)},e("span",{className:G("gitp-status",Pt("M"))},"M"),e("span",{className:"gitp-filename"},C.dir?e("span",{className:"gitp-filedir"},C.dir):null,C.base),w.binary?e("span",{className:"gitp-delta"},n("meta.binary")):e("span",{className:"gitp-delta"},w.add!==null&&w.add>0?e("span",{className:"gitp-add"},`+${w.add}`):null,w.del!==null&&w.del>0?e("span",{className:"gitp-del"},`\u2212${w.del}`):null))}))))):null,re&&X?e(di,{label:n("split.commits"),containerRef:Ue,columnRef:je,width:Z,onChange:Ke}):null,X?e("div",{className:"gitp-diffcol"},k?e(ci,{t:n,diff:$,loading:z,layout:p,onLayout:u,onBlock:()=>{},busy:!0,selectionKey:`${M?.hash??""}:${k}`,compact:r,onBack:r?()=>y(null):void 0}):e(xe,{icon:e(P,{path:x.changes,size:28}),title:n("empty.selectFile"),hint:n("empty.selectFileHint")})):null,ke?e(vn,{t:n,commit:ke,rows:qe,busy:Ne!==null,onPick:Q,onClose:()=>fe(null)}):null,ye?e(Ht,{title:n(ye.type==="undo"?"history.undoTitle":"history.revertTitle"),body:n(ye.type==="undo"?"history.undoBody":"history.revertBody"),confirmLabel:n(ye.type==="undo"?"history.undoAction":"history.revertAction"),cancelLabel:n("action.cancel"),busy:Ne!==null,onConfirm:()=>ye.type==="undo"?ve(ye.commit):Y(ye.commit),onClose:()=>{Ne===null&&A(null)}}):null,ie?e(yn,{t:n,commit:ie,busy:Ne==="reset",error:be,onReset:w=>ze(ie,w),onClose:()=>{Ne===null&&(me(null),De(null))}}):null,Ee?e("div",{className:G("gitp-toast",Ee.error&&"is-error"),role:"status","aria-live":"polite"},Ee.text):null)}function xn({call:t,workspaceId:i,repo:a,t:n,snapshot:o,onStatus:r,refreshToken:p}){let[u,d]=N(null),[l,m]=N(null),[g,v]=N(!1),[h,M]=N(null),[f,k]=N(null),[y,$]=N(null),[H,U]=N(null),_=j(a);I(()=>{_.current!==a&&(_.current=a,d(null))},[a]);let D=mt(async S=>{try{let K=await t("stashList",{workspaceId:i,repo:a},S);d(K.stashes??[]),m(null)}catch(K){let W=te(K);W.name!=="AbortError"&&m(W)}},[i,a,t]);I(()=>{let S=new AbortController;return D(S.signal),()=>S.abort()},[D,p]),I(()=>{if(H===null)return;let S=setTimeout(()=>U(null),4e3);return()=>clearTimeout(S)},[H]);let E=(o?.entries??[]).filter(S=>S.unstaged&&!S.conflicted);async function z({paths:S,message:K}){M("create"),k(null);try{let W=await t("stashPush",{workspaceId:i,repo:a,paths:S,message:K,includeUntracked:S.some(J=>E.find(Z=>Z.path===J)?.untracked===!0)});r(W.status),d(W.stashes??[]),v(!1),U(n("stash.created",{count:S.length}))}catch(W){k(Ce(W))}finally{M(null)}}async function V(S,K,W){M(S+K),m(null);try{let J=await t(S==="drop"?"stashDrop":"stashApply",{workspaceId:i,repo:a,ref:K,pop:W});r(J.status),d(J.stashes??[]),U(S==="drop"?n("stash.dropped",{ref:K}):n(W?"stash.popped":"stash.applied",{ref:K})),$(null)}catch(J){m(te(J))}finally{M(null)}}return e("div",{className:"gitp-stash"},e("div",{className:"gitp-stash-head"},e("div",{className:"gitp-stash-title"},e("span",null,n("mode.stash")),u?.length?e("span",{className:"gitp-section-count"},String(u.length)):null),e("button",{type:"button",className:"gitp-btn is-small is-primary",onClick:()=>v(!0),disabled:E.length===0},e(P,{path:x.plus,size:12}),n("action.stash"))),l?e("div",{className:"gitp-error"},e("span",{className:"gitp-error-text"},Ce(l))):null,u===null?e("div",{className:"gitp-center"},e(le)):u.length===0?e(xe,{icon:e(P,{path:x.stash,size:28}),title:n("empty.noStashes"),hint:n("empty.noStashesHint"),action:E.length>0?e("button",{type:"button",className:"gitp-btn is-primary is-small",onClick:()=>v(!0)},e(P,{path:x.plus,size:12}),n("action.stash")):null}):e("div",{className:"gitp-stashlist"},u.map(S=>e("div",{className:"gitp-stashrow",key:S.ref},e("div",{className:"gitp-stash-main"},e("div",{className:"gitp-stash-msg"},S.message||"WIP"),e("div",{className:"gitp-stash-meta"},e("span",{className:"gitp-stash-ref"},S.ref),e("span",null,"\xB7"),e("span",null,Oe(S.hash)))),e("div",{className:"gitp-stash-actions"},e("button",{type:"button",className:"gitp-btn is-small",onClick:()=>V("apply",S.ref,!1),disabled:h!==null,title:n("stash.applyHint")},h==="apply"+S.ref?e(le):null,n("action.apply")),e("button",{type:"button",className:"gitp-btn is-small",onClick:()=>V("apply",S.ref,!0),disabled:h!==null,title:n("stash.popHint")},h==="apply"+S.ref?e(le):null,n("action.pop")),e("button",{type:"button",className:"gitp-btn is-small gitp-stash-btn-danger","aria-label":n("action.drop"),onClick:()=>$(S.ref),disabled:h!==null,title:n("stash.dropHint")},n("action.drop")))))),g?e(rn,{t:n,files:E,busy:h==="create",error:f,onCreate:z,onClose:()=>{v(!1),k(null)}}):null,y?e(Ht,{title:n("stash.dropTitle"),body:n("stash.dropBody",{ref:y}),confirmLabel:n("action.drop"),cancelLabel:n("action.cancel"),danger:!0,busy:h==="drop"+y,onConfirm:()=>V("drop",y,!1),onClose:()=>$(null)}):null,H?e("div",{className:"gitp-toast",role:"status","aria-live":"polite"},H):null)}function kn(t){let i=t?.projectionValues?.workingDirectory;if(typeof i=="string"&&i.trim()!=="")return i.trim();let a=t?.cwd;return typeof a=="string"&&a!==""?a:null}function Nn(t,i,a){let n=typeof t.sessionRoot=="string"?t.sessionRoot:null;if(t.worktree===!0&&n!==null){let p=i.find(u=>u.root===n);if(p!==void 0)return p}let o=i.find(p=>p.root===a);return o!==void 0?o:(n===null?void 0:i.find(p=>p.root===n))??i[0]??null}function Cn(t){let i=typeof t.sessionRoot=="string"?t.sessionRoot:"";return`${t.worktree===!0?"worktree":"checkout"}:${i}`}function Mn({call:t,t:i,useWorkspaces:a,useSessions:n,sessionId:o,useTabInfo:r,sidebarRight:p}){let{tab:u}=r(),d=ni(o).set;I(()=>{d(u.visible===!0)},[d,u.visible]),I(()=>()=>{d(!1)},[d]),I(()=>{Tt={visible:u.visible===!0,canStageAll:()=>nt.length>0&&E===null,stageAll:()=>Dt("unstaged"),canCommit:()=>He&&E===null,commit:()=>Lt(),canWriteMessage:()=>Re.length>0&&E===null&&!Y,writeMessage:()=>It()}}),I(()=>()=>{Tt=null},[]);let l=a(s=>s.items),m=n(s=>s.byId[o]),g=kn(m),v=l.find(s=>s.sessionIds?.includes(o))??l.find(s=>m?.cwd!==void 0&&(m.cwd===s.path||m.cwd.startsWith(`${s.path}/`)))??null,h=v===null?"":v.workspaceId,M=j(null),[f,k]=N(!1),[y,$]=N(null),[H,U]=N(!1),[_,D]=N(null),[E,z]=N(null),[V,S]=N(null),[K,W]=N("changes"),[J,Z]=N(""),[Ke,ke]=N(!1),[fe,ye]=N(!1),[A,ie]=N(null),[me,be]=N(null),[De,Ne]=N(!1),[ce,Ee]=N(0),[ue,Ue]=N(()=>ot(Kt,"split")==="unified"?"unified":"split"),[je,_e]=N(()=>ot(Ut,"split")==="unified"?"unified":"split"),[$e,Me]=N(!1),[qe,ve]=N(!1),[Y,ge]=N(!1),[ze,Q]=N(null),[re,X]=N(null),[w,C]=N(!1),[L,O]=N(null),[q,ee]=N(null),[Ae,We]=N(null),[Ye,Qe]=N(0),[Xe,Pe]=N([]),[B,Ge]=N(null),et=s=>{if(B===null||p===void 0)return;let b=Ui(s),T=Ki(o,m===void 0?void 0:m.cwd,`${B}/${s.path}`);p.openResource(T,{params:{line:b}})},[dt,vt]=N(0),[tt,Ve]=N(!1),[pt,Je]=N(!1),Le=j(0),it=j(null);I(()=>{let s=M.current;if(s===null||typeof ResizeObserver>"u")return;let b=0,T=new ResizeObserver(ae=>{b&&cancelAnimationFrame(b),b=requestAnimationFrame(()=>{b=0;let we=ae[0]?.contentRect.width??0;k(we>0&&we<900)})});return T.observe(s),()=>{T.disconnect(),b&&cancelAnimationFrame(b)}},[v?.workspaceId]);let ne=mt(s=>{!s||!Array.isArray(s.entries)||(Le.current+=1,$(s))},[]),c=mt(async(s,b)=>{if(!v||B===null)return;let T=++Le.current;b||U(!0);try{let ae=await t("status",{workspaceId:h,repo:B,sessionDir:g},s);T===Le.current&&(it.current=null,$(ae),Array.isArray(ae.repos)&&ae.repos.length>0&&Pe(ae.repos),D(null))}catch(ae){let we=te(ae);if(we.name==="AbortError"||T!==Le.current)return;let at=Vt(ae);if(at==="git/not-repo"||at==="git/repo-invalid"){if(it.current===B){D(we);return}it.current=B,Ie(st+h,""),Ge(null),$(null),D(null),vt(xt=>xt+1);return}D(we)}finally{T===Le.current&&U(!1)}},[v?.workspaceId,B,t,g]),R=mt(s=>{s?.status&&ne(s.status),typeof s.message=="string"&&(Z(s.message),ke(!1)),s?.goToChanges&&(ie(null),be(null),W("changes")),s?.toast&&ee(s.toast),Qe(b=>b+1),c(void 0,!1)},[ne,c]),F=j(null),de=j(null),se=j(null);se.current=B,I(()=>{if(!v?.workspaceId)return;let s=h,b=F.current!==s;b&&(F.current=s,Pe([]),Ge(null),$(null));let T=new AbortController;return(async()=>{try{let ae=await t("status",{workspaceId:s,sessionDir:g},T.signal);if(T.signal.aborted)return;let we=Array.isArray(ae.repos)?ae.repos:[];Pe(we);let at=Cn(ae),xt=de.current!==at;if(de.current=at,!b&&!xt&&se.current!==null)return;let gt=Nn(ae,we,ot(st+s,""));gt?(Ge(gt.root),(ae.worktree!==!0||gt.root!==ae.sessionRoot)&&Ie(st+s,gt.root)):$(ae)}catch(ae){let we=te(ae);we.name!=="AbortError"&&D(we)}})(),()=>T.abort()},[v?.workspaceId,t,dt,g]),I(()=>{if(B===null)return;let s=new AbortController;return c(s.signal,!1),()=>s.abort()},[B,c]),I(()=>{if(!v||B===null)return;let s=setInterval(()=>{document.visibilityState==="visible"&&c(void 0,!0)},8e3);return()=>clearInterval(s)},[v?.workspaceId,B,c]),I(()=>{let s=()=>c(void 0,!0);return window.addEventListener("focus",s),()=>window.removeEventListener("focus",s)},[c]),I(()=>{if(q===null)return;let s=setTimeout(()=>ee(null),4e3);return()=>clearTimeout(s)},[q]);let oe=y?.entries?.filter(s=>s.conflicted)??[],Re=y?.entries?.filter(s=>s.staged&&!s.conflicted)??[],nt=y?.entries?.filter(s=>s.unstaged&&!s.conflicted)??[],He=Re.length>0&&oe.length===0&&J.trim()!==""&&y?.repo!==!1,yt=A?`${A.side}:${A.path}:${A.commit??""}`:"",pi=A===null?!0:A.side==="staged"?y?.entries?.some(s=>s.path===A.path&&s.staged&&!s.conflicted):A.side==="unstaged"?y?.entries?.some(s=>s.path===A.path&&s.unstaged&&!s.conflicted):A.side==="conflict"?y?.entries?.some(s=>s.path===A.path&&s.conflicted):!0;I(()=>{y!==null&&A!==null&&!pi&&ie(null)},[y,yt]),I(()=>{if(!v||A===null){be(null);return}let s=new AbortController;return Ne(!0),t("diff",{workspaceId:h,repo:B,path:A.path,side:A.side},s.signal).then(b=>{s.signal.aborted||be(b)}).catch(b=>{let T=te(b);!s.signal.aborted&&T.name!=="AbortError"&&D(T)}).finally(()=>{s.signal.aborted||Ne(!1)}),()=>s.abort()},[v?.workspaceId,B,yt,ce,t]);function he(){Ee(s=>s+1)}function ui(s){if(s===null){ie(null);return}A!==null&&A.side===s.side&&A.path===s.path||(be(null),ie(s))}function wt(s){let b=new Set;for(let T of s)b.add(T.path),T.from&&b.add(T.from);return[...b]}async function gi(s,b){if(E===null){z("file"),D(null);try{let T=await t(b==="staged"?"unstage":"stage",{workspaceId:h,repo:B,paths:wt([s])});ne(T),A?.path===s.path&&A.side===b&&ie(null),he()}catch(T){D(te(T))}finally{z(null)}}}async function Dt(s){let b=s==="staged"?Re:nt;if(!(E!==null||b.length===0)){z("file"),D(null);try{let T=await t(s==="staged"?"unstage":"stage",{workspaceId:h,repo:B,paths:wt(b)});ne(T),he()}catch(T){D(te(T))}finally{z(null)}}}async function zt(s,b){if(E!==null||s.length===0)return!1;z("file"),D(null);try{let T=await t(b==="staged"?"unstage":"stage",{workspaceId:h,repo:B,paths:wt(s)});return ne(T),ie(null),be(null),he(),!0}catch(T){return D(te(T)),!1}finally{z(null)}}function hi(s){if(E!==null)return;let b=[...new Set(s.map(T=>T.path))];b.length!==0&&O({title:i(b.length===1?"discard.titleOne":"discard.titleMany",{count:b.length}),body:e("div",null,e("div",null,i("discard.bodyMany")),e("ul",{className:"gitp-confirm-paths"},b.slice(0,8).map(T=>e("li",{key:T},T))),b.length>8?e("div",{className:"gitp-confirm-more"},i("discard.more",{count:b.length-8})):null),confirmLabel:i("discard.confirm"),danger:!0,run:()=>void fi(b)})}async function fi(s){if(E===null){z("discard"),D(null);try{let b=await t("discard",{workspaceId:h,repo:B,paths:s,confirm:!0});ne(b),ie(null),be(null),he(),ee(s.length===1?i("discard.doneOne"):i("discard.doneMany",{count:s.length}))}catch(b){D(te(b))}finally{z(null),O(null)}}}function mi(s){E===null&&O({title:i(s.untracked?"discard.deleteTitle":"discard.title"),body:i(s.untracked?"discard.deleteBody":"discard.body",{path:s.path}),confirmLabel:i(s.untracked?"discard.deleteConfirm":"discard.confirm"),danger:!0,run:()=>void bi(s)})}async function bi(s){if(E===null){z("discard"),D(null);try{let b=await t("discard",{workspaceId:h,repo:B,paths:[s.path],confirm:!0});ne(b),A?.path===s.path&&(ie(null),be(null)),he(),ee(i(s.untracked?"discard.deleted":"discard.done",{name:lt(s.path).base}))}catch(b){D(te(b))}finally{z(null),O(null)}}}async function vi(s,b){if(!(E!==null||me===null)){if(b==="revert"){O({title:i("confirm.revertTitle"),body:i("confirm.revertBody"),confirmLabel:i("confirm.yesRevert"),danger:!0,run:()=>At(s,"revert")});return}await At(s,b)}}async function At(s,b){if(me!==null){z("block"),D(null);try{let T=await t("applyBlocks",{workspaceId:h,repo:B,path:me.path,side:b,blocks:[s],baseHash:me.baseHash,targetHash:me.targetHash,confirm:!0});ne(T),he()}catch(T){D(te(T)),Vt(T)==="git/stale"&&he()}finally{z(null),O(null)}}}async function yi(s){if(!(!A||E!==null)){z("resolve"),D(null);try{let b=await t("resolve",{workspaceId:h,repo:B,path:A.path,side:s});ne(b),ie(null),he()}catch(b){D(te(b))}finally{z(null)}}}async function Lt(){if(!(!He||E!==null)){z("commit"),D(null);try{let s=await t("commit",{workspaceId:h,repo:B,message:J,amend:Ke,noVerify:fe});ne(s.status),Z(""),ke(!1),ee(i("commit.done",{hash:Oe(s.hash)})),he()}catch(s){D(te(s))}finally{z(null)}}}function wi(){Re.length===0||oe.length>0||(Q(null),Me(!0))}async function Bt(){if(Y||Re.length===0)return null;ge(!0),D(null);try{let s=Rt.hook.getSnapshot(),b=await t("aiMessage",{workspaceId:h,repo:B,...s.model===null?{}:{model:s.model},...s.instruction.trim()===""?{}:{instruction:s.instruction}});return b.model!==null&&b.model!==""&&ee(i("ai.written",{model:b.model})),b.message!==""?b.message:null}catch(s){return D(te(s)),null}finally{ge(!1)}}async function It(){ve(!1);let s=await Bt();s!==null&&Z(s)}async function xi(){if(ve(!1),Re.length===0||oe.length>0)return;let s=await Bt();s!==null&&(Z(s),Q(null),Me(!0))}async function ki({name:s,message:b}){C(!0),Q(null);try{let T=await t("createBranchAndCommit",{workspaceId:h,repo:B,name:s,message:b,noVerify:fe});ne(T.status),Z(""),Me(!1),ee(i("branch.created",{branch:s})),he()}catch(T){Q(Ce(T))}finally{C(!1)}}async function Ni(s){if(E===null){z("sync"),S(s),D(null),We(null);try{let b=await t(s,{workspaceId:h,repo:B});ne(b.status),s==="pull"&&b.autoStash==="conflict"?(W("changes"),ie(null),be(null),We(i("sync.pulledStashConflict"))):ee(i(s==="fetch"?"sync.fetched":s==="pull"?b.autoStash==="restored"?"sync.pulledStashed":"sync.pulled":"sync.pushed"))}catch(b){D(te(b))}finally{z(null),S(null)}}}async function Ci(){if(y?.repo!==!1){if(re!==null){X(null);return}X({branches:[],loading:!0});try{let s=await t("branches",{workspaceId:h,repo:B});X({branches:s.branches??[],loading:!1})}catch(s){X(null),D(te(s))}}}function Mi(s,b){if(X(null),(y?.entries?.length??0)>0){O({title:i("confirm.checkoutTitle"),body:i("confirm.checkoutBody"),confirmLabel:i("confirm.yesCheckout"),danger:!1,run:()=>Ft(s,b)});return}Ft(s,b)}async function Ft(s,b){O(null),C(!0),D(null);try{let T=await t("checkout",{workspaceId:h,repo:B,branch:s,remote:b===!0});ne(T.status),X(null),ie(null),he()}catch(T){X(null),D(te(T))}finally{C(!1)}}async function Ot(){if(E===null){z("init"),D(null);try{let s=await t("init",{workspaceId:h});Array.isArray(s.repos)&&Pe(s.repos);let b=s.selected??s.root??null;typeof b=="string"&&b!==""&&(Ie(st+h,b),Ge(b)),ne(s)}catch(s){D(te(s))}finally{z(null)}}}function Ri(s){Ve(!1),s!==B&&(Ie(st+h,s??""),Ge(s),$(null),ie(null),be(null),X(null))}function Si(){Ve(!1),O({title:i("repo.initRootTitle"),body:i("repo.initRootBody",{count:Xe.length}),confirmLabel:i("repo.initRootConfirm"),danger:!0,run:()=>{O(null),Ot()}})}async function Ti({name:s}){if(B!==null){C(!0),Q(null);try{let b=await t("createBranch",{workspaceId:h,repo:B,name:s});ne(b.status),Je(!1),ee(i("branch.createdOnly",{branch:s})),he()}catch(b){Q(Ce(b))}finally{C(!1)}}}let jt=f?je:ue;function $t(s){f?(_e(s),Ie(Ut,s)):(Ue(s),Ie(Kt,s))}if(v===null)return e("div",{className:"gitp-root"},e(xe,{icon:e(P,{path:x.branch,size:28}),title:i("empty.noWorkspace"),hint:i("empty.noWorkspaceHint")}));let ut=y?.branch??null,Ei=ut?.ahead??0,Pi=ut?.behind??0,Wt=_,Hi=Re[0]?.path,Di=Qi(J,Hi),zi=J;return e("div",{className:G("gitp-root",f&&"is-compact"),ref:M},e(un,{t:i,workspaceTitle:v.title,branch:ut,repo:y?.repo!==!1,ahead:Ei,behind:Pi,upstream:ut?.upstream??null,onBranchMenu:Ci,onRepoMenu:()=>Ve(!0),repos:Xe,repoRoot:B,onSync:Ni,busy:E!==null,onRefresh:()=>{c(void 0,!1),A&&he(),Qe(s=>s+1)},syncing:V}),Wt?e("div",{className:"gitp-error",role:"alert"},e(P,{path:x.warning,size:14}),e("span",{className:"gitp-error-text"},Ce(Wt)),e(Te,{label:i("action.close"),icon:x.close,onClick:()=>D(null)})):null,Ae?e("div",{className:"gitp-error",role:"status"},e(P,{path:x.warning,size:14}),e("span",{className:"gitp-error-text"},Ae),e(Te,{label:i("action.close"),icon:x.close,onClick:()=>We(null)})):null,e("div",{className:"gitp-body"},e(gn,{t:i,mode:K,onMode:W,counts:{changes:y?.entries?.length??0}}),e("div",{className:"gitp-content"},y===null?e(xe,{icon:e(le),title:i("status.loading")}):y.repo===!1?e(xe,{icon:e(P,{path:x.branch,size:28}),title:i("empty.noRepo"),hint:i("empty.noRepoHint"),action:e("button",{type:"button",className:"gitp-btn is-primary",onClick:Ot,disabled:E!==null},E==="init"?e(le):null,i("empty.init"))}):K==="log"?e(wn,{call:t,workspaceId:h,repo:B??"",t:i,refreshToken:Ye,compact:f,layout:jt,onLayout:$t,snapshot:y,onApplied:R}):K==="stash"?e(xn,{call:t,workspaceId:h,repo:B??"",t:i,snapshot:y,onStatus:ne,refreshToken:Ye}):e(on,{t:i,snapshot:y,conflicts:oe,staged:Re,unstaged:nt,selection:A,onSelect:ui,busy:E!==null,fileBusy:E!==null,onToggleFile:gi,onToggleAll:Dt,onDiscard:mi,onBatchStage:s=>zt(s,"unstaged"),onBatchUnstage:s=>zt(s,"staged"),onBatchDiscard:hi,diff:me,diffLoading:De,layout:jt,onLayout:$t,onRefresh:()=>{he(),c(void 0,!1)},onBlock:vi,onResolve:yi,onOpen:et,message:J,onMessage:Z,onCommit:Lt,onBranch:wi,canCommit:He,commitBusy:E==="commit",aiBusy:Y,aiMenuOpen:qe,onAiToggle:()=>ve(s=>!s),onAiClose:()=>ve(!1),onAiWrite:It,onAiBranch:xi,selectionKey:yt,amend:Ke,onAmend:ke,noVerify:fe,onNoVerify:ye,canAmend:y.branch?.initial!==!0,compact:f,onBack:()=>ie(null)}))),re?e(fn,{t:i,branches:re.branches,loading:re.loading===!0,busy:w,onCheckout:Mi,onNew:()=>{X(null),Q(null),Je(!0)},onClose:()=>X(null)}):null,tt?e(hn,{t:i,repos:Xe,current:B,onPick:Ri,onInitRoot:Si,onClose:()=>Ve(!1)}):null,pt?e(mn,{t:i,busy:w,error:ze,onCreate:Ti,onClose:()=>{Je(!1),Q(null)}}):null,$e?e(sn,{t:i,defaultName:Di,defaultMessage:zi,busy:w,noVerify:fe,error:ze,onCreate:ki,onNoVerify:ye,onClose:()=>{Me(!1),Q(null)}}):null,L?e(Ht,{title:L.title,body:L.body,confirmLabel:L.confirmLabel,cancelLabel:i("action.cancel"),danger:L.danger,busy:E!==null||w,onConfirm:()=>L.run(),onClose:()=>O(null)}):null,q?e("div",{className:"gitp-toast",role:"status","aria-live":"polite"},q):null)}function Rn({t}){return e(pe.default.Fragment,null,e(bt,{size:14}),e("span",{className:"gitp-tab-title"},t("panel")))}function ii({sessionId:t,sidebarRight:i,useVisible:a,t:n}){let o=a(p=>p===!0),r=n("header.label");return e("button",{type:"button",className:G("gitp-iconbtn","gitp-header-btn",o&&"is-active"),"aria-label":r,"aria-pressed":o,title:r,onClick(){if(!o){i.openTab("git");return}let p=i.tabsIn(t).find(u=>u.kind==="git");p!==void 0&&i.hide(p.id)}},e(bt,{size:16}))}function di({label:t,containerRef:i,columnRef:a,width:n,onChange:o}){let r=j(null),p=()=>{let d=i.current;return d===null?n:Math.max(Ze,Math.round(d.getBoundingClientRect().width)-qt)},u=d=>Math.min(Math.max(Math.round(d),Ze),p());return I(()=>()=>{r.current=null,document.body.style.cursor="",document.body.style.userSelect=""},[]),I(()=>{let d=i.current;if(d===null||typeof ResizeObserver>"u")return;let l=new ResizeObserver(()=>{let m=Math.round(d.getBoundingClientRect().width);if(m===0)return;let g=Math.max(Ze,m-qt);n>g&&o(g)});return l.observe(d),()=>l.disconnect()},[i,n,o]),e("div",{className:"gitp-resizer",role:"separator","aria-orientation":"vertical","aria-label":t,"aria-valuemin":Ze,"aria-valuemax":p(),"aria-valuenow":n,tabIndex:0,onPointerDown(d){d.button===0&&(r.current={x:d.clientX,width:n,next:n},d.currentTarget.setPointerCapture(d.pointerId),document.body.style.cursor="col-resize",document.body.style.userSelect="none",d.preventDefault())},onPointerMove(d){let l=r.current;if(l===null)return;let m=u(l.width+(d.clientX-l.x));m!==l.next&&(l.next=m,a.current!==null&&(a.current.style.width=`${m}px`),d.currentTarget.setAttribute("aria-valuenow",String(m)))},onPointerUp(d){let l=r.current;l!==null&&(r.current=null,d.currentTarget.hasPointerCapture(d.pointerId)&&d.currentTarget.releasePointerCapture(d.pointerId),document.body.style.cursor="",document.body.style.userSelect="",o(l.next))},onPointerCancel(){r.current=null,document.body.style.cursor="",document.body.style.userSelect=""},onDoubleClick(){o(u(St))},onKeyDown(d){if(d.key==="ArrowLeft"||d.key==="ArrowRight"){d.preventDefault();let l=d.key==="ArrowRight"?Yt:-Yt;o(u(n+l));return}d.key==="Home"&&(d.preventDefault(),o(u(St)))}})}var Tt=null;function Sn({t,call:i,usePrefs:a,savePrefs:n}){let o=a(f=>f),[r,p]=N(null),[u,d]=N(!1);I(()=>{let f=new AbortController,k=!0;return i("preferences",{},f.signal).then(y=>{k&&p(y)},()=>{k&&d(!0)}),()=>{k=!1,f.abort()}},[i]);let l=r?.groups??[],m=o.model,g=m===null?"":Xt(m),v=m!==null&&l.some(f=>f.id===m.provider&&f.models.some(k=>k.id===m.model)),h=o.instruction===""?r?.instruction??"":o.instruction,M=r===null&&!u;return e("div",{className:"gitp-settings"},e("div",{className:"gitp-settings-row"},e("div",{className:"gitp-settings-copy"},e("label",{className:"gitp-settings-label",htmlFor:"gitp-settings-model"},t("settings.model")),e("p",{className:"gitp-settings-hint"},t("settings.modelHint"))),e("select",{id:"gitp-settings-model",value:g,disabled:M,onChange:f=>{let k=f.target.value;if(k===""){n({...o,model:null});return}let y=Zi(k);y!==null&&n({...o,model:y})}},e("option",{value:""},t("settings.modelSame")),v||o.model===null?null:e("option",{value:g},`${o.model.provider} \xB7 ${o.model.model}`),l.map(f=>e("optgroup",{key:f.id,label:f.label},f.models.map(k=>e("option",{key:k.id,value:Xt({provider:f.id,model:k.id})},k.name))))),u?e("p",{className:"gitp-settings-error"},t("settings.modelFailed")):null,!u&&r!==null&&l.length===0?e("p",{className:"gitp-settings-error"},t("settings.modelEmpty")):null),e("div",{className:"gitp-settings-row"},e("div",{className:"gitp-settings-copy"},e("label",{className:"gitp-settings-label",htmlFor:"gitp-settings-instruction"},t("settings.instruction")),e("p",{className:"gitp-settings-hint"},t("settings.instructionHint"))),e("textarea",{id:"gitp-settings-instruction",value:h,spellCheck:!1,disabled:M,onChange:f=>n({...o,instruction:f.target.value})}),e("div",{className:"gitp-settings-actions"},e("button",{type:"button",className:"gitp-btn is-small",disabled:o.instruction==="",onClick:()=>n({...o,instruction:""})},t("settings.instructionReset"))),u?e("p",{className:"gitp-settings-error"},t("settings.instructionFailed")):null))}function Tn(){return e(bt,{size:16})}function En(t,i){let a=r=>({status:"blocked",reason:r}),n=["page","editable","terminal"],o=r=>{let p=Tt;return p===null||!p.visible?a(i("command.openFirst")):r(p)};return[{id:"git.panel.toggle",label:()=>i("command.toggle"),aliases:["git","source control","toggle panel"],defaults:{},regions:n,modals:[],resolve:()=>({status:"handled",run:()=>{let r=t.sidebarRight.active();if(t.sidebarRight.isExpanded()&&r!==void 0&&r.kind==="git"){t.sidebarRight.hide(r.id);return}try{t.sidebarRight.openTab("git")}catch{}}})},{id:"git.stageAll",label:()=>i("command.stageAll"),aliases:["git","stage"],defaults:{},regions:n,modals:[],resolve:()=>o(r=>r.canStageAll()?{status:"handled",run:()=>r.stageAll()}:a(i("command.nothingToStage")))},{id:"git.commit",label:()=>i("command.commit"),aliases:["git","commit"],defaults:{},regions:n,modals:[],resolve:()=>o(r=>r.canCommit()?{status:"handled",run:()=>r.commit()}:a(i("command.notReady")))},{id:"git.writeMessage",label:()=>i("command.writeMessage"),aliases:["git","commit message","ai"],defaults:{},regions:n,modals:[],resolve:()=>o(r=>r.canWriteMessage()?{status:"handled",run:()=>r.writeMessage()}:a(i("command.notReady")))}]}var Pn=["connection","slots","locale","sidebarRightTabs","sidebarRight"];function Hn(t){t.locale.register(Be,"en",_i),t.locale.register(Be,"zh",qi);let i=t.locale.bind(Be),a=async(o,r,p)=>{let u=await t.connection.rpc.call("/git-rpc",o,r,p);if(!u.ok)throw new Mt(u.error.code,u.error.message,u.error.details);return u.value};t.effect(()=>t.sidebarRightTabs.register({id:kt,kind:"git",priority:"extension",title:()=>i("panel"),guide:[{id:"git",order:50,title:()=>i("guide.title"),description:()=>i("guide.description"),icon:()=>e(nn,null)}]}),"dsh-git: right sidebar tab type");let n=o=>({sessionId:o,sidebarRight:t.sidebarRight,hooks:{visible:ni(o).hook}});t.slots.inject("conversation.session.header.utilities",()=>t.slots.register({name:"conversation.session.header.utilities",id:"git-panel",order:-7,locale:Be,inject:n},ii)),t.slots.inject("conversation.hero.options",()=>t.slots.register({name:"conversation.hero.options",id:"git-panel",order:-7,locale:Be,inject:n},ii)),t.slots.inject("settings.section",()=>t.slots.register({name:"settings.section",id:"git",order:25,label:()=>i("settings.section"),locale:Be,inject:()=>({t:i,call:a,savePrefs:Rt.set,hooks:{prefs:Rt.hook}})},Sn)),t.slots.inject("settings.section.icon",()=>t.slots.register({name:"settings.section.icon",id:"git",order:25},Tn)),t.inject(["shortcuts"],o=>{for(let r of En(t,i))o.effect(()=>o.shortcuts.register(r),`dsh-git: ${r.id}`)}),t.slots.inject("sidebar.right.pane.tab",()=>t.slots.register({name:"sidebar.right.pane.tab",key:kt,locale:Be,inject:()=>({call:a,t:i,sidebarRight:t.sidebarRight})},Mn)),t.slots.inject("sidebar.right.pane.tab.title",()=>t.slots.register({name:"sidebar.right.pane.tab.title",key:kt,locale:Be,inject:()=>({t:i})},Rn))}
|
|
322
331
|
|
|
323
332
|
return module.exports;
|
|
324
333
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-git-desk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.23.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Git desk for DeepSeek Harness: a right-sidebar Git workbench with full-file side-by-side diffs, block staging, commits, history, branches, stash, and sync.",
|
|
6
6
|
"keywords": [
|