@xbzbing/dsh-git-panel 0.1.0 → 0.1.1

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 CHANGED
@@ -10,10 +10,10 @@
10
10
 
11
11
  ```bash
12
12
  # npm(默认)
13
- dsh plugin add @xbzbing/dsh-git-panel
13
+ dsh plugin --profile web add @xbzbing/dsh-git-panel@latest
14
14
 
15
15
  # 或从 GitHub 仓库安装(仓库已提交构建产物,无需本地构建)
16
- dsh plugin add github:xbzbing/dsh-git-panel
16
+ dsh plugin --profile web add github:xbzbing/dsh-git-panel
17
17
  ```
18
18
 
19
19
  安装后重启或刷新 Web GUI,工作区标签栏(「对话」「轨迹」之后)就会出现 **Git** 面板。
package/README_EN.md CHANGED
@@ -10,10 +10,10 @@ The panel only reads the Git repository at the current session's working directo
10
10
 
11
11
  ```bash
12
12
  # npm (default)
13
- dsh plugin add @xbzbing/dsh-git-panel
13
+ dsh plugin --profile web add @xbzbing/dsh-git-panel@latest
14
14
 
15
15
  # or from the GitHub repository (the built tree is committed, no local build needed)
16
- dsh plugin add github:xbzbing/dsh-git-panel
16
+ dsh plugin --profile web add github:xbzbing/dsh-git-panel
17
17
  ```
18
18
 
19
19
  Restart or refresh the Web GUI afterwards and the **Git** panel appears in the workspace tab bar (after Chat and Trajectory).
package/cordis.patch.yml CHANGED
@@ -4,7 +4,7 @@
4
4
  # metadata composes the browser half (lib/client.js).
5
5
  - insert:
6
6
  - id: git-panel
7
- name: dsh-git-panel
7
+ name: '@xbzbing/dsh-git-panel'
8
8
  config:
9
9
  timeoutMs: 8000
10
10
  maxBytes: 4194304
package/lib/client.js CHANGED
@@ -1,4 +1,4 @@
1
- window.__ModuleLoader__.load({ id: "dsh-git-panel", factory: (require) => {
1
+ window.__ModuleLoader__.load({ id: "@xbzbing/dsh-git-panel", factory: (require) => {
2
2
  var module = { exports: {} }; var exports = module.exports;
3
3
  "use strict";var Da=Object.create;var je=Object.defineProperty;var La=Object.getOwnPropertyDescriptor;var Pa=Object.getOwnPropertyNames;var Ba=Object.getPrototypeOf,Ga=Object.prototype.hasOwnProperty;var X=(e,t)=>()=>(e&&(t=e(e=0)),t);var Fa=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Vt=(e,t)=>{for(var n in t)je(e,n,{get:t[n],enumerable:!0})},Zt=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Pa(t))!Ga.call(e,o)&&o!==n&&je(e,o,{get:()=>t[o],enumerable:!(r=La(t,o))||r.enumerable});return e};var Ua=(e,t,n)=>(n=e!=null?Da(Ba(e)):{},Zt(t||!e||!e.__esModule?je(n,"default",{value:e,enumerable:!0}):n,e)),za=e=>Zt(je({},"__esModule",{value:!0}),e);var Wn=Fa((bs,qn)=>{function In(e){return e instanceof Map?e.clear=e.delete=e.set=function(){throw new Error("map is read-only")}:e instanceof Set&&(e.add=e.clear=e.delete=function(){throw new Error("set is read-only")}),Object.freeze(e),Object.getOwnPropertyNames(e).forEach(t=>{let n=e[t],r=typeof n;(r==="object"||r==="function")&&!Object.isFrozen(n)&&In(n)}),e}var ot=class{constructor(t){t.data===void 0&&(t.data={}),this.data=t.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}};function Dn(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;")}function Ne(e,...t){let n=Object.create(null);for(let r in e)n[r]=e[r];return t.forEach(function(r){for(let o in r)n[o]=r[o]}),n}var Qa="</span>",Tn=e=>!!e.scope,ja=(e,{prefix:t})=>{if(e.startsWith("language:"))return e.replace("language:","language-");if(e.includes(".")){let n=e.split(".");return[`${t}${n.shift()}`,...n.map((r,o)=>`${r}${"_".repeat(o+1)}`)].join(" ")}return`${t}${e}`},Ot=class{constructor(t,n){this.buffer="",this.classPrefix=n.classPrefix,t.walk(this)}addText(t){this.buffer+=Dn(t)}openNode(t){if(!Tn(t))return;let n=ja(t.scope,{prefix:this.classPrefix});this.span(n)}closeNode(t){Tn(t)&&(this.buffer+=Qa)}value(){return this.buffer}span(t){this.buffer+=`<span class="${t}">`}},Rn=(e={})=>{let t={children:[]};return Object.assign(t,e),t},Mt=class e{constructor(){this.rootNode=Rn(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(t){this.top.children.push(t)}openNode(t){let n=Rn({scope:t});this.add(n),this.stack.push(n)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(t){return this.constructor._walk(t,this.rootNode)}static _walk(t,n){return typeof n=="string"?t.addText(n):n.children&&(t.openNode(n),n.children.forEach(r=>this._walk(t,r)),t.closeNode(n)),t}static _collapse(t){typeof t!="string"&&t.children&&(t.children.every(n=>typeof n=="string")?t.children=[t.children.join("")]:t.children.forEach(n=>{e._collapse(n)}))}},It=class extends Mt{constructor(t){super(),this.options=t}addText(t){t!==""&&this.add(t)}startScope(t){this.openNode(t)}endScope(){this.closeNode()}__addSublanguage(t,n){let r=t.root;n&&(r.scope=`language:${n}`),this.add(r)}toHTML(){return new Ot(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}};function Xe(e){return e?typeof e=="string"?e:e.source:null}function Ln(e){return Oe("(?=",e,")")}function ei(e){return Oe("(?:",e,")*")}function ti(e){return Oe("(?:",e,")?")}function Oe(...e){return e.map(n=>Xe(n)).join("")}function ni(e){let t=e[e.length-1];return typeof t=="object"&&t.constructor===Object?(e.splice(e.length-1,1),t):{}}function Lt(...e){return"("+(ni(e).capture?"":"?:")+e.map(r=>Xe(r)).join("|")+")"}function Pn(e){return new RegExp(e.toString()+"|").exec("").length-1}function ri(e,t){let n=e&&e.exec(t);return n&&n.index===0}var ai=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function Pt(e,{joinWith:t}){let n=0;return e.map(r=>{n+=1;let o=n,s=Xe(r),i="";for(;s.length>0;){let a=ai.exec(s);if(!a){i+=s;break}i+=s.substring(0,a.index),s=s.substring(a.index+a[0].length),a[0][0]==="\\"&&a[1]?i+="\\"+String(Number(a[1])+o):(i+=a[0],a[0]==="("&&n++)}return i}).map(r=>`(${r})`).join(t)}var ii=/\b\B/,Bn="[a-zA-Z]\\w*",Bt="[a-zA-Z_]\\w*",Gn="\\b\\d+(\\.\\d+)?",Fn="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",Un="\\b(0b[01]+)",oi="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",si=(e={})=>{let t=/^#![ ]*\//;return e.binary&&(e.begin=Oe(t,/.*\b/,e.binary,/\b.*/)),Ne({scope:"meta",begin:t,end:/$/,relevance:0,"on:begin":(n,r)=>{n.index!==0&&r.ignoreMatch()}},e)},Ve={begin:"\\\\[\\s\\S]",relevance:0},li={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[Ve]},ci={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[Ve]},di={begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},lt=function(e,t,n={}){let r=Ne({scope:"comment",begin:e,end:t,contains:[]},n);r.contains.push({scope:"doctag",begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});let o=Lt("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return r.contains.push({begin:Oe(/[ ]+/,"(",o,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),r},pi=lt("//","$"),gi=lt("/\\*","\\*/"),ui=lt("#","$"),mi={scope:"number",begin:Gn,relevance:0},fi={scope:"number",begin:Fn,relevance:0},bi={scope:"number",begin:Un,relevance:0},hi={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[Ve,{begin:/\[/,end:/\]/,relevance:0,contains:[Ve]}]},yi={scope:"title",begin:Bn,relevance:0},_i={scope:"title",begin:Bt,relevance:0},vi={begin:"\\.\\s*"+Bt,relevance:0},Ei=function(e){return Object.assign(e,{"on:begin":(t,n)=>{n.data._beginMatch=t[1]},"on:end":(t,n)=>{n.data._beginMatch!==t[1]&&n.ignoreMatch()}})},it=Object.freeze({__proto__:null,APOS_STRING_MODE:li,BACKSLASH_ESCAPE:Ve,BINARY_NUMBER_MODE:bi,BINARY_NUMBER_RE:Un,COMMENT:lt,C_BLOCK_COMMENT_MODE:gi,C_LINE_COMMENT_MODE:pi,C_NUMBER_MODE:fi,C_NUMBER_RE:Fn,END_SAME_AS_BEGIN:Ei,HASH_COMMENT_MODE:ui,IDENT_RE:Bn,MATCH_NOTHING_RE:ii,METHOD_GUARD:vi,NUMBER_MODE:mi,NUMBER_RE:Gn,PHRASAL_WORDS_MODE:di,QUOTE_STRING_MODE:ci,REGEXP_MODE:hi,RE_STARTERS_RE:oi,SHEBANG:si,TITLE_MODE:yi,UNDERSCORE_IDENT_RE:Bt,UNDERSCORE_TITLE_MODE:_i});function wi(e,t){e.input[e.index-1]==="."&&t.ignoreMatch()}function xi(e,t){e.className!==void 0&&(e.scope=e.className,delete e.className)}function ki(e,t){t&&e.beginKeywords&&(e.begin="\\b("+e.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",e.__beforeBegin=wi,e.keywords=e.keywords||e.beginKeywords,delete e.beginKeywords,e.relevance===void 0&&(e.relevance=0))}function Ni(e,t){Array.isArray(e.illegal)&&(e.illegal=Lt(...e.illegal))}function Si(e,t){if(e.match){if(e.begin||e.end)throw new Error("begin & end are not supported with match");e.begin=e.match,delete e.match}}function Ti(e,t){e.relevance===void 0&&(e.relevance=1)}var Ri=(e,t)=>{if(!e.beforeMatch)return;if(e.starts)throw new Error("beforeMatch cannot be used with starts");let n=Object.assign({},e);Object.keys(e).forEach(r=>{delete e[r]}),e.keywords=n.keywords,e.begin=Oe(n.beforeMatch,Ln(n.begin)),e.starts={relevance:0,contains:[Object.assign(n,{endsParent:!0})]},e.relevance=0,delete n.beforeMatch},Ci=["of","and","for","in","not","or","if","then","parent","list","value"],Ai="keyword";function zn(e,t,n=Ai){let r=Object.create(null);return typeof e=="string"?o(n,e.split(" ")):Array.isArray(e)?o(n,e):Object.keys(e).forEach(function(s){Object.assign(r,zn(e[s],t,s))}),r;function o(s,i){t&&(i=i.map(a=>a.toLowerCase())),i.forEach(function(a){let l=a.split("|");r[l[0]]=[s,Oi(l[0],l[1])]})}}function Oi(e,t){return t?Number(t):Mi(e)?0:1}function Mi(e){return Ci.includes(e.toLowerCase())}var Cn={},Ae=e=>{console.error(e)},An=(e,...t)=>{console.log(`WARN: ${e}`,...t)},Le=(e,t)=>{Cn[`${e}/${t}`]||(console.log(`Deprecated as of ${e}. ${t}`),Cn[`${e}/${t}`]=!0)},st=new Error;function $n(e,t,{key:n}){let r=0,o=e[n],s={},i={};for(let a=1;a<=t.length;a++)i[a+r]=o[a],s[a+r]=!0,r+=Pn(t[a-1]);e[n]=i,e[n]._emit=s,e[n]._multi=!0}function Ii(e){if(Array.isArray(e.begin)){if(e.skip||e.excludeBegin||e.returnBegin)throw Ae("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),st;if(typeof e.beginScope!="object"||e.beginScope===null)throw Ae("beginScope must be object"),st;$n(e,e.begin,{key:"beginScope"}),e.begin=Pt(e.begin,{joinWith:""})}}function Di(e){if(Array.isArray(e.end)){if(e.skip||e.excludeEnd||e.returnEnd)throw Ae("skip, excludeEnd, returnEnd not compatible with endScope: {}"),st;if(typeof e.endScope!="object"||e.endScope===null)throw Ae("endScope must be object"),st;$n(e,e.end,{key:"endScope"}),e.end=Pt(e.end,{joinWith:""})}}function Li(e){e.scope&&typeof e.scope=="object"&&e.scope!==null&&(e.beginScope=e.scope,delete e.scope)}function Pi(e){Li(e),typeof e.beginScope=="string"&&(e.beginScope={_wrap:e.beginScope}),typeof e.endScope=="string"&&(e.endScope={_wrap:e.endScope}),Ii(e),Di(e)}function Bi(e){function t(i,a){return new RegExp(Xe(i),"m"+(e.case_insensitive?"i":"")+(e.unicodeRegex?"u":"")+(a?"g":""))}class n{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(a,l){l.position=this.position++,this.matchIndexes[this.matchAt]=l,this.regexes.push([l,a]),this.matchAt+=Pn(a)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);let a=this.regexes.map(l=>l[1]);this.matcherRe=t(Pt(a,{joinWith:"|"}),!0),this.lastIndex=0}exec(a){this.matcherRe.lastIndex=this.lastIndex;let l=this.matcherRe.exec(a);if(!l)return null;let c=l.findIndex((b,f)=>f>0&&b!==void 0),d=this.matchIndexes[c];return l.splice(0,c),Object.assign(l,d)}}class r{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(a){if(this.multiRegexes[a])return this.multiRegexes[a];let l=new n;return this.rules.slice(a).forEach(([c,d])=>l.addRule(c,d)),l.compile(),this.multiRegexes[a]=l,l}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(a,l){this.rules.push([a,l]),l.type==="begin"&&this.count++}exec(a){let l=this.getMatcher(this.regexIndex);l.lastIndex=this.lastIndex;let c=l.exec(a);if(this.resumingScanAtSamePosition()&&!(c&&c.index===this.lastIndex)){let d=this.getMatcher(0);d.lastIndex=this.lastIndex+1,c=d.exec(a)}return c&&(this.regexIndex+=c.position+1,this.regexIndex===this.count&&this.considerAll()),c}}function o(i){let a=new r;return i.contains.forEach(l=>a.addRule(l.begin,{rule:l,type:"begin"})),i.terminatorEnd&&a.addRule(i.terminatorEnd,{type:"end"}),i.illegal&&a.addRule(i.illegal,{type:"illegal"}),a}function s(i,a){let l=i;if(i.isCompiled)return l;[xi,Si,Pi,Ri].forEach(d=>d(i,a)),e.compilerExtensions.forEach(d=>d(i,a)),i.__beforeBegin=null,[ki,Ni,Ti].forEach(d=>d(i,a)),i.isCompiled=!0;let c=null;return typeof i.keywords=="object"&&i.keywords.$pattern&&(i.keywords=Object.assign({},i.keywords),c=i.keywords.$pattern,delete i.keywords.$pattern),c=c||/\w+/,i.keywords&&(i.keywords=zn(i.keywords,e.case_insensitive)),l.keywordPatternRe=t(c,!0),a&&(i.begin||(i.begin=/\B|\b/),l.beginRe=t(l.begin),!i.end&&!i.endsWithParent&&(i.end=/\B|\b/),i.end&&(l.endRe=t(l.end)),l.terminatorEnd=Xe(l.end)||"",i.endsWithParent&&a.terminatorEnd&&(l.terminatorEnd+=(i.end?"|":"")+a.terminatorEnd)),i.illegal&&(l.illegalRe=t(i.illegal)),i.contains||(i.contains=[]),i.contains=[].concat(...i.contains.map(function(d){return Gi(d==="self"?i:d)})),i.contains.forEach(function(d){s(d,l)}),i.starts&&s(i.starts,a),l.matcher=o(l),l}if(e.compilerExtensions||(e.compilerExtensions=[]),e.contains&&e.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return e.classNameAliases=Ne(e.classNameAliases||{}),s(e)}function Kn(e){return e?e.endsWithParent||Kn(e.starts):!1}function Gi(e){return e.variants&&!e.cachedVariants&&(e.cachedVariants=e.variants.map(function(t){return Ne(e,{variants:null},t)})),e.cachedVariants?e.cachedVariants:Kn(e)?Ne(e,{starts:e.starts?Ne(e.starts):null}):Object.isFrozen(e)?Ne(e):e}var Fi="11.11.1",Dt=class extends Error{constructor(t,n){super(t),this.name="HTMLInjectionError",this.html=n}},At=Dn,On=Ne,Mn=Symbol("nomatch"),Ui=7,Hn=function(e){let t=Object.create(null),n=Object.create(null),r=[],o=!0,s="Could not find the language '{}', did you forget to load/include a language module?",i={disableAutodetect:!0,name:"Plain text",contains:[]},a={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:It};function l(g){return a.noHighlightRe.test(g)}function c(g){let w=g.className+" ";w+=g.parentNode?g.parentNode.className:"";let v=a.languageDetectRe.exec(w);if(v){let M=F(v[1]);return M||(An(s.replace("{}",v[1])),An("Falling back to no-highlight mode for this block.",g)),M?v[1]:"no-highlight"}return w.split(/\s+/).find(M=>l(M)||F(M))}function d(g,w,v){let M="",L="";typeof w=="object"?(M=g,v=w.ignoreIllegals,L=w.language):(Le("10.7.0","highlight(lang, code, ...args) has been deprecated."),Le("10.7.0",`Please use highlight(code, options) instead.
4
4
  https://github.com/highlightjs/highlight.js/issues/2277`),L=g,M=w),v===void 0&&(v=!0);let U={code:M,language:L};ee("before:highlight",U);let z=U.result?U.result:b(U.language,U.code,v);return z.code=U.code,ee("after:highlight",z),z}function b(g,w,v,M){let L=Object.create(null);function U(_,S){return _.keywords[S]}function z(){if(!C.keywords){ae.addText(q);return}let _=0;C.keywordPatternRe.lastIndex=0;let S=C.keywordPatternRe.exec(q),P="";for(;S;){P+=q.substring(_,S.index);let u=de.case_insensitive?S[0].toLowerCase():S[0],A=U(C,u);if(A){let[K,pe]=A;if(ae.addText(P),P="",L[u]=(L[u]||0)+1,L[u]<=Ui&&(Ce+=pe),K.startsWith("_"))P+=S[0];else{let ie=de.classNameAliases[K]||K;R(S[0],ie)}}else P+=S[0];_=C.keywordPatternRe.lastIndex,S=C.keywordPatternRe.exec(q)}P+=q.substring(_),ae.addText(P)}function te(){if(q==="")return;let _=null;if(typeof C.subLanguage=="string"){if(!t[C.subLanguage]){ae.addText(q);return}_=b(C.subLanguage,q,!0,Re[C.subLanguage]),Re[C.subLanguage]=_._top}else _=m(q,C.subLanguage.length?C.subLanguage:null);C.relevance>0&&(Ce+=_.relevance),ae.__addSublanguage(_._emitter,_.language)}function E(){C.subLanguage!=null?te():z(),q=""}function R(_,S){_!==""&&(ae.startScope(S),ae.addText(_),ae.endScope())}function Y(_,S){let P=1,u=S.length-1;for(;P<=u;){if(!_._emit[P]){P++;continue}let A=de.classNameAliases[_[P]]||_[P],K=S[P];A?R(K,A):(q=K,z(),q=""),P++}}function me(_,S){return _.scope&&typeof _.scope=="string"&&ae.openNode(de.classNameAliases[_.scope]||_.scope),_.beginScope&&(_.beginScope._wrap?(R(q,de.classNameAliases[_.beginScope._wrap]||_.beginScope._wrap),q=""):_.beginScope._multi&&(Y(_.beginScope,S),q="")),C=Object.create(_,{parent:{value:C}}),C}function ce(_,S,P){let u=ri(_.endRe,P);if(u){if(_["on:end"]){let A=new ot(_);_["on:end"](S,A),A.isMatchIgnored&&(u=!1)}if(u){for(;_.endsParent&&_.parent;)_=_.parent;return _}}if(_.endsWithParent)return ce(_.parent,S,P)}function ze(_){return C.matcher.regexIndex===0?(q+=_[0],1):(Ee=!0,0)}function Me(_){let S=_[0],P=_.rule,u=new ot(P),A=[P.__beforeBegin,P["on:begin"]];for(let K of A)if(K&&(K(_,u),u.isMatchIgnored))return ze(S);return P.skip?q+=S:(P.excludeBegin&&(q+=S),E(),!P.returnBegin&&!P.excludeBegin&&(q=S)),me(P,_),P.returnBegin?0:S.length}function Se(_){let S=_[0],P=w.substring(_.index),u=ce(C,_,P);if(!u)return Mn;let A=C;C.endScope&&C.endScope._wrap?(E(),R(S,C.endScope._wrap)):C.endScope&&C.endScope._multi?(E(),Y(C.endScope,_)):A.skip?q+=S:(A.returnEnd||A.excludeEnd||(q+=S),E(),A.excludeEnd&&(q=S));do C.scope&&ae.closeNode(),!C.skip&&!C.subLanguage&&(Ce+=C.relevance),C=C.parent;while(C!==u.parent);return u.starts&&me(u.starts,_),A.returnEnd?0:S.length}function fe(){let _=[];for(let S=C;S!==de;S=S.parent)S.scope&&_.unshift(S.scope);_.forEach(S=>ae.openNode(S))}let be={};function Te(_,S){let P=S&&S[0];if(q+=_,P==null)return E(),0;if(be.type==="begin"&&S.type==="end"&&be.index===S.index&&P===""){if(q+=w.slice(S.index,S.index+1),!o){let u=new Error(`0 width match regex (${g})`);throw u.languageName=g,u.badRule=be.rule,u}return 1}if(be=S,S.type==="begin")return Me(S);if(S.type==="illegal"&&!v){let u=new Error('Illegal lexeme "'+P+'" for mode "'+(C.scope||"<unnamed>")+'"');throw u.mode=C,u}else if(S.type==="end"){let u=Se(S);if(u!==Mn)return u}if(S.type==="illegal"&&P==="")return q+=`
@@ -237,7 +237,7 @@ https://github.com/highlightjs/highlight.js/issues/2277`),L=g,M=w),v===void 0&&(
237
237
  .gp-tip{position:fixed;z-index:60;max-width:520px;padding:8px 12px;border:1px solid var(--dsw-alias-border-l1,var(--dsw-alias-border-l2));border-radius:12px;background:var(--dsw-alias-bg-layer-3,var(--dsw-alias-bg-layer-2));box-shadow:0 6px 24px rgba(0,0,0,.18),0 1px 3px rgba(0,0,0,.12);font-size:12px;line-height:1.5;pointer-events:none}
238
238
  .gp-tip__path{color:var(--dsw-alias-label-primary);font-family:var(--dsw-font-mono,ui-monospace,monospace);word-break:break-all}
239
239
  .gp-tip__note{margin-top:4px;color:var(--dsw-alias-label-tertiary)}
240
- `,xt=!1;function Yt(){if(xt||typeof document>"u")return;let e="dsh-git-panel/client.css";if(document.querySelector(`style[data-plugin-css="${e}"]`)!==null){xt=!0;return}let t=document.createElement("style");t.dataset.plugin="dsh-git-panel",t.dataset.pluginCss=e,t.textContent=$a,document.head.appendChild(t),xt=!0}var Jt={"panel.tab":"Git","tab.overview":"Git \u603B\u89C8","tab.changes":"\u53D8\u66F4\u8BB0\u5F55","pill.noRepo":"\u65E0 Git \u4ED3\u5E93","pill.unavailable":"Git \u4E0D\u53EF\u7528","pill.detached":"\u6E38\u79BB HEAD","pill.synced":"\u672C\u5730\u5DF2\u540C\u6B65","pill.dirty":"\u6709\u5F85\u63D0\u4EA4\u7684\u53D8\u66F4","common.loading":"\u52A0\u8F7D\u4E2D\u2026","common.refresh":"\u5237\u65B0","common.empty":"\u5DE5\u4F5C\u533A\u5E72\u51C0","common.retry":"\u91CD\u8BD5","common.close":"\u5173\u95ED","common.expandAll":"\u5C55\u5F00\u5168\u90E8","common.collapseAll":"\u6536\u8D77\u5168\u90E8","version.check":"\u68C0\u67E5\u65B0\u7248\u672C","version.checking":"\u68C0\u67E5\u4E2D\u2026","version.upToDate":"\u5DF2\u662F\u6700\u65B0\uFF08{current}\uFF09","version.updateAvailable":"\u6709\u65B0\u7248\u672C {latest}\uFF08\u5F53\u524D {current}\uFF09","version.viewRelease":"\u67E5\u770B\u53D1\u5E03","version.error":"\u68C0\u67E5\u5931\u8D25","version.noRepo":"\u672A\u914D\u7F6E\u4ED3\u5E93\u5730\u5740","version.openRepo":"\u5728 GitHub \u4E0A\u6253\u5F00\u4ED3\u5E93","overview.branches":"\u5206\u652F","overview.head":"HEAD\uFF08\u5F53\u524D\u5206\u652F\uFF09","overview.local":"\u672C\u5730","overview.remote":"\u8FDC\u7A0B","overview.tags":"\u6807\u7B7E","overview.allBranches":"\u5168\u90E8\u5206\u652F","overview.search":"\u641C\u7D22\u63D0\u4EA4\uFF08\u6D88\u606F / \u54C8\u5E0C\uFF09","overview.clearSearch":"\u6E05\u9664\u641C\u7D22","overview.allUsers":"\u5168\u90E8\u4F5C\u8005","overview.allTime":"\u5168\u90E8\u65F6\u95F4","overview.today":"\u4ECA\u5929","overview.last7d":"\u8FD1 7 \u5929","overview.last30d":"\u8FD1 30 \u5929","overview.colGraph":"","overview.colSubject":"\u63D0\u4EA4","overview.colHash":"\u54C8\u5E0C","overview.colAuthor":"\u4F5C\u8005","overview.colDate":"\u65E5\u671F","overview.selectCommit":"\u9009\u62E9\u4E00\u4E2A\u63D0\u4EA4\u67E5\u770B\u8BE6\u60C5","overview.commitFiles":"\u53D8\u66F4\u6587\u4EF6","overview.commitMessage":"\u63D0\u4EA4\u4FE1\u606F","overview.noMessage":"\uFF08\u65E0\u63D0\u4EA4\u6B63\u6587\uFF09","overview.noResults":"\u6CA1\u6709\u5339\u914D\u7684\u63D0\u4EA4","overview.loadFailed":"\u52A0\u8F7D\u5931\u8D25","overview.detailFailed":"\u8BE6\u60C5\u52A0\u8F7D\u5931\u8D25","overview.diffFailed":"\u5DEE\u5F02\u52A0\u8F7D\u5931\u8D25","overview.openFileDiff":"\u67E5\u770B\u8BE5\u6587\u4EF6\u5728\u6B64\u63D0\u4EA4\u4E2D\u7684\u53D8\u66F4","overview.fetch":"\u62C9\u53D6\u8FDC\u7A0B","changes.title":"\u672C\u5730\u53D8\u66F4","changes.groupStaged":"\u5DF2\u6682\u5B58\u7684\u66F4\u6539","changes.groupUnstaged":"\u66F4\u6539","changes.groupUntracked":"\u672A\u7248\u672C\u63A7\u5236\u7684\u6587\u4EF6","changes.selectFile":"\u9009\u62E9\u4E00\u4E2A\u6587\u4EF6\u67E5\u770B\u53D8\u66F4","changes.noChanges":"\u6CA1\u6709\u672A\u63D0\u4EA4\u7684\u53D8\u66F4","changes.stageAll":"\u5168\u90E8\u6682\u5B58","changes.unstageAll":"\u5168\u90E8\u53D6\u6D88\u6682\u5B58","changes.discard":"\u653E\u5F03\u66F4\u6539","changes.discardConfirm":"\u518D\u6B21\u70B9\u51FB\u4EE5\u786E\u8BA4\u653E\u5F03","stats.files":"{n} \u4E2A\u6587\u4EF6","stats.lines":"+{add} \u2212{del} \u884C","stats.lastChange":"\u6700\u8FD1\u53D8\u66F4 {time}","stats.lastCommit":"\u4E0A\u6B21\u63D0\u4EA4 {time}","stats.staged":"\u5DF2\u6682\u5B58 {n}","stats.modified":"\u5DF2\u4FEE\u6539 {n}","stats.untracked":"\u672A\u8DDF\u8E2A {n}","commit.placeholder":"\u63D0\u4EA4\u4FE1\u606F","commit.commit":"\u63D0\u4EA4","commit.commitAndPush":"\u63D0\u4EA4\u5E76\u63A8\u9001\u2026","commit.amend":"\u4FEE\u6B63\u4E0A\u6B21\u63D0\u4EA4\uFF08amend\uFF09","commit.done":"\u5B8C\u6210","commit.pushing":"\u63A8\u9001\u4E2D\u2026","diff.split":"\u5BF9\u7167","diff.before":"\u53D8\u66F4\u524D","diff.after":"\u53D8\u66F4\u540E","diff.binary":"\u4E8C\u8FDB\u5236\u6587\u4EF6\uFF0C\u65E0\u6CD5\u663E\u793A\u5BF9\u7167","diff.tooLarge":"\u56FE\u7247\u8FC7\u5927\uFF0C\u65E0\u6CD5\u663E\u793A\u5BF9\u7167","diff.imageMissing":"\u4E0D\u5B58\u5728","diff.empty":"\u65E0\u5DEE\u5F02","diff.newFile":"\u65B0\u6587\u4EF6","diff.deletedFile":"\u5DF2\u5220\u9664","diff.expandAll":"\u5C55\u5F00\u5168\u90E8","diff.collapse":"\u6298\u53E0\u672A\u53D8\u66F4","diff.expanding":"\u5C55\u5F00\u4E2D\u2026","time.justNow":"\u521A\u521A","time.minutesAgo":"{n} \u5206\u949F\u524D","time.hoursAgo":"{n} \u5C0F\u65F6\u524D","time.daysAgo":"{n} \u5929\u524D","error.generic":"\u64CD\u4F5C\u5931\u8D25","error.notARepo":"\u5F53\u524D\u76EE\u5F55\u4E0D\u662F Git \u4ED3\u5E93","error.noCwd":"\u5F53\u524D\u4F1A\u8BDD\u65E0\u5DE5\u4F5C\u76EE\u5F55","error.localChangesBlock":"\u672C\u5730\u6709\u672A\u63D0\u4EA4\u53D8\u66F4\uFF0C\u65E0\u6CD5\u5207\u6362","error.emptyMessage":"\u63D0\u4EA4\u4FE1\u606F\u4E0D\u80FD\u4E3A\u7A7A","cfg.title":"\u8F93\u5165\u6846\u5206\u652F\u6807\u8BB0","cfg.toggle":"\u663E\u793A\u8F93\u5165\u6846\u6807\u8BB0","cfg.hint":"\u5F00\u542F\u65F6\u5728\u8F93\u5165\u6846\u663E\u793A zsh \u98CE\u683C\u7684 <\u4ED3\u5E93\u540D> (\u5206\u652F) \u6807\u8BB0\uFF1B\u5173\u95ED\u540E\u6539\u4E3A\u5728 Git \u6807\u7B7E\u65C1\u663E\u793A\u72B6\u6001\u5706\u70B9\u3002\u4FDD\u5B58\u540E\u7ACB\u5373\u751F\u6548\u3002","cfg.notLoaded":"\u914D\u7F6E\u672A\u52A0\u8F7D\uFF1A\u8BE5\u914D\u7F6E\u7531\u8FD0\u884C\u4E2D\u7684\u5BBF\u4E3B\u63D0\u4F9B\uFF0C\u82E5\u957F\u65F6\u95F4\u7A7A\u767D\u8BF7\u91CD\u542F DSH \u540E\u91CD\u8BD5\u3002","cfg.saveFailed":"\u4FDD\u5B58\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5"},Qt={"panel.tab":"Git","tab.overview":"Overview","tab.changes":"Changes","pill.noRepo":"No Git repo","pill.unavailable":"Git unavailable","pill.detached":"detached HEAD","pill.synced":"Everything committed","pill.dirty":"Uncommitted changes","common.loading":"Loading\u2026","common.refresh":"Refresh","common.empty":"Working tree clean","common.retry":"Retry","common.close":"Close","common.expandAll":"Expand all","common.collapseAll":"Collapse all","version.check":"Check for updates","version.checking":"Checking\u2026","version.upToDate":"Up to date ({current})","version.updateAvailable":"New version {latest} available (current {current})","version.viewRelease":"View release","version.error":"Check failed","version.noRepo":"Repository not configured","version.openRepo":"Open repository on GitHub","overview.branches":"Branches","overview.head":"HEAD (Current Branch)","overview.local":"Local","overview.remote":"Remote","overview.tags":"Tags","overview.allBranches":"All branches","overview.search":"Search commits (message / hash)","overview.clearSearch":"Clear search","overview.allUsers":"All authors","overview.allTime":"All time","overview.today":"Today","overview.last7d":"Last 7 days","overview.last30d":"Last 30 days","overview.colGraph":"","overview.colSubject":"Commit","overview.colHash":"Hash","overview.colAuthor":"Author","overview.colDate":"Date","overview.selectCommit":"Select a commit to see details","overview.commitFiles":"Changed files","overview.commitMessage":"Commit message","overview.noMessage":"(no commit body)","overview.noResults":"No matching commits","overview.loadFailed":"Load failed","overview.detailFailed":"Failed to load details","overview.diffFailed":"Failed to load diff","overview.openFileDiff":"View this file\u2019s changes in this commit","overview.fetch":"Fetch","changes.title":"Local changes","changes.groupStaged":"Staged changes","changes.groupUnstaged":"Changes","changes.groupUntracked":"Unversioned files","changes.selectFile":"Select a file to see its diff","changes.noChanges":"No uncommitted changes","changes.stageAll":"Stage all","changes.unstageAll":"Unstage all","changes.discard":"Discard changes","changes.discardConfirm":"Click again to confirm discard","stats.files":"{n} files","stats.lines":"+{add} \u2212{del} lines","stats.lastChange":"changed {time}","stats.lastCommit":"last commit {time}","stats.staged":"{n} staged","stats.modified":"{n} modified","stats.untracked":"{n} untracked","commit.placeholder":"Commit message","commit.commit":"Commit","commit.commitAndPush":"Commit and Push\u2026","commit.amend":"Amend previous commit","commit.done":"Done","commit.pushing":"Pushing\u2026","diff.split":"Split","diff.before":"Before","diff.after":"After","diff.binary":"Binary file \u2014 no diff to show","diff.tooLarge":"Image too large to compare","diff.imageMissing":"Does not exist","diff.empty":"No differences","diff.newFile":"New file","diff.deletedFile":"Deleted","diff.expandAll":"Expand all","diff.collapse":"Collapse unchanged","diff.expanding":"Expanding\u2026","time.justNow":"just now","time.minutesAgo":"{n}m ago","time.hoursAgo":"{n}h ago","time.daysAgo":"{n}d ago","error.generic":"Operation failed","error.notARepo":"Not a Git repository","error.noCwd":"This session has no working directory","error.localChangesBlock":"Local changes block the checkout","error.emptyMessage":"Commit message cannot be empty","cfg.title":"Input-bar branch marker","cfg.toggle":"Show input-bar marker","cfg.hint":"When on, the input bar shows the zsh-style <repo> (branch) marker; when off, a status dot appears beside the Git tab instead. Saved changes apply immediately.","cfg.notLoaded":"Config not loaded: it is served by the running host. Restart DSH if this stays blank.","cfg.saveFailed":"Save failed, please retry"};var tt=require("react");var Ka=new Set(["cwd-unavailable","session-not-found"]),jt=3e4,Ha=6e4,et=class{constructor(t,n){this.remote=t;this.sessionId=n}view={state:"cold"};listeners=new Set;timer;inflight;disposed=!1;pollMs=jt;subscribe(t){return this.listeners.add(t),()=>{this.listeners.delete(t)}}getSnapshot(){return this.view}ensure(){this.view.state!=="cold"&&this.view.state!=="no-cwd"||this.refresh()}refresh(){return this.inflight!==void 0?this.inflight:this.disposed?Promise.resolve():(this.view.state==="cold"&&this.setView({state:"loading"}),this.inflight=this.remote.snapshot({sessionId:this.sessionId}).then(t=>{if(!this.disposed)if(t.ok)this.pollMs=t.value.refreshIntervalMs||jt,this.setView({state:"ready",snapshot:t.value});else if(Ka.has(t.error.code))this.pollMs=Ha,this.setView({state:"no-cwd"});else if(t.error.code==="not-a-git-repo"){let n=t.error;this.setView({state:"error",error:{code:"not-a-git-repo",...n.cwd?{cwd:n.cwd}:{},...n.showInputPill!==void 0?{showInputPill:n.showInputPill}:{}}})}else this.setView({state:"error",error:{code:t.error.code,..."detail"in t.error?{detail:t.error.detail}:{}}})}).catch(t=>{this.disposed||this.setView({state:"error",error:{code:"git-unavailable",detail:t instanceof Error?t.message:String(t)}})}).finally(()=>{this.inflight=void 0,this.schedulePoll()}),this.inflight)}resync(){this.disposed||this.refresh()}schedulePoll(){this.disposed||(this.timer!==void 0&&clearTimeout(this.timer),!(this.pollMs<=0)&&(this.timer=setTimeout(()=>{this.refresh()},this.pollMs)))}setView(t){this.view=t;for(let n of this.listeners)n()}dispose(){this.disposed=!0,this.timer!==void 0&&clearTimeout(this.timer),this.timer=void 0,this.listeners.clear()}};var qa="/api",Wa="gitPanel";function Xa(e){try{let t=e.get("connection")?.rpc,n=t?.call;if(t!==void 0&&typeof n=="function")return(r,o,s)=>n.call(t,qa,r,o,s)}catch{}}function Va(e){let t=e;if(t===null||typeof t!="object")return{ok:!1,error:{code:"git-unavailable",message:"malformed rpc result"}};if(t.ok!==!0){let n=t.error;return{ok:!1,error:{code:typeof n?.code=="string"?n.code:"git-unavailable",message:typeof n?.message=="string"?n.message:void 0}}}return t.value}var en=new WeakMap;function $e(e){let t=en.get(e);if(t!==void 0)return t;let n=async(o,s,i)=>{let a=Xa(e);if(a===void 0)return{ok:!1,error:{code:"git-unavailable",message:"no connection"}};try{let l=await a(`${Wa}/${o}`,{args:{request:s}},i);return Va(l)}catch(l){return{ok:!1,error:{code:"git-unavailable",message:l instanceof Error?l.message:String(l)}}}},r={snapshot:(o,s)=>n("snapshot",o,s),run:(o,s)=>n("run",o,s),query:(o,s)=>n("query",o,s),version:(o,s)=>n("version",o,s)};return en.set(e,r),r}var Ke=new Map,tn,kt;function nn(e){kt=e,tn=$e(e)}function Nt(e){let t=Ke.get(e);if(t===void 0){let n=tn??(kt?$e(kt):void 0);t=new et(n??Za(),e),Ke.set(e,t)}return t}function He(){for(let e of Ke.values())e.resync()}function rn(){for(let e of Ke.values())e.dispose();Ke.clear()}function Za(){let e=async()=>({ok:!1,error:{code:"git-unavailable"}});return{snapshot:e,run:e,query:e,version:e}}function nt(e){let[,t]=(0,tt.useState)(0),n=e?Nt(e):void 0;return(0,tt.useEffect)(()=>{if(n===void 0)return;let r=n.subscribe(()=>t(o=>o+1));return n.ensure(),r},[n]),n?n.getSnapshot():{state:"cold"}}var G=require("react");var an="[data-conversation-tabs]",Tt='[data-conversation-tabs] button[role="tab"]',St=new Map;function on(e,t){St.set(e,t)}function sn(e){let t=St.get(e);return t===void 0?null:(St.delete(e),t)}function ln(e){if(typeof document>"u")return!1;let t=document.querySelectorAll(Tt);for(let n of t)if((n.textContent??"").trim()===e)return n.getAttribute("aria-selected")!=="true"&&n.click(),!0;return!1}var p=require("react"),Ht=require("react-dom");var J=require("react");function ke(e,t=15){return(0,J.createElement)("svg",{width:t,height:t,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round"},e)}function rt({size:e}){return ke([(0,J.createElement)("circle",{key:"c",cx:8,cy:8,r:2.4}),(0,J.createElement)("line",{key:"l1",x1:8,y1:1.5,x2:8,y2:5.6}),(0,J.createElement)("line",{key:"l2",x1:8,y1:10.4,x2:8,y2:14.5})],e)}function cn({size:e}){return ke([(0,J.createElement)("path",{key:"a",d:"M4 2v8"}),(0,J.createElement)("path",{key:"b",d:"M2 4h4"}),(0,J.createElement)("circle",{key:"c",cx:4,cy:12,r:1.6}),(0,J.createElement)("circle",{key:"d",cx:12,cy:4,r:1.6}),(0,J.createElement)("path",{key:"e",d:"M12 6v4"}),(0,J.createElement)("path",{key:"f",d:"M10 12h4"})],e)}function Rt({size:e}){return ke([(0,J.createElement)("circle",{key:"a",cx:4,cy:3,r:1.6}),(0,J.createElement)("circle",{key:"b",cx:4,cy:13,r:1.6}),(0,J.createElement)("circle",{key:"c",cx:12,cy:5,r:1.6}),(0,J.createElement)("path",{key:"d",d:"M4 4.6v6.8"}),(0,J.createElement)("path",{key:"e",d:"M12 6.6c0 3-4 2.4-8 4"})],e)}function dn({size:e}){return ke([(0,J.createElement)("path",{key:"a",d:"M2 7V3h4l8 8-4 4z"}),(0,J.createElement)("circle",{key:"b",cx:4.5,cy:5.5,r:.8,fill:"currentColor"})],e)}function qe({size:e,open:t}){return ke([(0,J.createElement)("path",{key:"a",d:t?"M3 6l5 5 5-5":"M6 3l5 5-5 5"})],e)}function pn({size:e}){return ke([(0,J.createElement)("path",{key:"a",d:"M4 4l8 8M12 4l-8 8"})],e)}function at({size:e}){return ke([(0,J.createElement)("path",{key:"a",d:"M13 8a5 5 0 1 1-1.5-3.5"}),(0,J.createElement)("path",{key:"b",d:"M13 2v3h-3"})],e)}function gn({size:e}){return ke([(0,J.createElement)("path",{key:"a",d:"M4 2h5l3 3v9H4z"}),(0,J.createElement)("path",{key:"b",d:"M9 2v3h3"})],e)}function un({size:e=15}){return(0,J.createElement)("svg",{width:e,height:e,viewBox:"0 0 16 16",fill:"currentColor"},(0,J.createElement)("path",{"fill-rule":"evenodd",d:"M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.01 8.01 0 0 0 16 8c0-4.42-3.58-8-8-8z"}))}function mn(e){let t=0;for(let n of e){t=Math.max(t,n.lane+1);for(let r of n.edges)t=Math.max(t,r.fromLane+1,r.toLane+1)}return t}function fn(e){let t=[],n=[],r=new Map,o=0,s=i=>{let a=r.get(i);return a===void 0&&(a=o++,r.set(i,a)),a};for(let i of e){let a=n.findIndex(y=>y===i.hash);a===-1&&(a=n.findIndex(y=>y===null),a===-1&&(a=n.length,n.push(null)),n[a]=i.hash);let l=s(i.hash),c=[...n],d=i.parents,b=d.length>=2;for(let y=0;y<n.length;y++)y!==a&&n[y]===i.hash&&(n[y]=null);if(d.length===0)n[a]=null;else{n[a]=d[0],s(d[0]);for(let y=1;y<d.length;y++){let h=d[y],x=n.findIndex(N=>N===h);x===-1&&(x=n.findIndex(N=>N===null),x===-1&&(x=n.length,n.push(null)),n[x]=h),s(h)}}let f=[],m=n;for(let y=0;y<c.length;y++){let h=c[y];if(h!==null)if(h===i.hash)f.push({fromLane:y,toLane:a,color:s(i.hash)});else{let x=m.findIndex(N=>N===h);x!==-1&&f.push({fromLane:y,toLane:x,color:s(h)})}}for(let y of d){let h=m.findIndex(x=>x===y);h!==-1&&f.push({fromLane:a,toLane:h,color:s(y)})}for(t.push({commit:i,lane:a,color:l,edges:f,merge:b});n.length>0&&n[n.length-1]===null;)n=n.slice(0,-1)}return t}function bn(e){let t={name:"",path:"",dir:!0,children:[]};for(let n of e){let r=n.path.split("/").filter(i=>i!==""),o=t,s="";for(let i=0;i<r.length;i++){let a=r[i];s=s===""?a:`${s}/${a}`;let l=i===r.length-1,c=o.children.find(d=>d.name===a&&d.dir===!l);c===void 0&&(c={name:a,path:s,dir:!l,children:[],...l?{meta:n.meta}:{}},o.children.push(c)),o=c}}return hn(t),yn(t.children)}function hn(e){e.children.sort((t,n)=>t.dir!==n.dir?t.dir?-1:1:t.name.localeCompare(n.name));for(let t of e.children)hn(t)}function yn(e){return e.map(t=>{if(!t.dir)return t;let n=t;for(;n.children.length===1&&n.children[0].dir;){let r=n.children[0];n={name:`${n.name}/${r.name}`,path:r.path,dir:!0,children:r.children}}return{...n,children:yn(n.children)}})}function Ie(e,t,n){if(e===null)return"";let r=typeof e=="number"?e:Date.parse(e);if(!Number.isFinite(r))return"";let o=Math.max(0,t-r),s=Math.floor(o/6e4);if(s<1)return n("time.justNow");if(s<60)return n("time.minutesAgo",{n:s});let i=Math.floor(s/60);if(i<24)return n("time.hoursAgo",{n:i});let a=Math.floor(i/24);return n("time.daysAgo",{n:a})}function De(e){if(e===null)return"";let t=new Date(typeof e=="number"?e:Date.parse(e));if(Number.isNaN(t.getTime()))return"";let n=r=>String(r).padStart(2,"0");return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())} ${n(t.getHours())}:${n(t.getMinutes())}`}var V=require("react");var Ya={png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",webp:"image/webp",avif:"image/avif",bmp:"image/bmp",svg:"image/svg+xml",ico:"image/x-icon",tif:"image/tiff",tiff:"image/tiff"};function Ct(e){let t=e.lastIndexOf(".");return t<0?null:Ya[e.slice(t+1).toLowerCase()]??null}function _n(e){return/^Binary files .* differ$/m.test(e)||/^GIT binary patch$/m.test(e)}function vn(e){return Ct(e)!==null}function En(e){let t=We(e);return t.length===0?!1:t.every(n=>n.startsWith("+")||n.startsWith(" "))&&t.some(n=>n.startsWith("+"))&&/^\+\+\+ /m.test(e)&&/--- \/dev\/null/m.test(e)}function wn(e){let t=We(e);return t.length===0?!1:t.every(n=>n.startsWith("-")||n.startsWith(" "))&&t.some(n=>n.startsWith("-"))&&/^\+\+\+ \/dev\/null/m.test(e)}function We(e){let t=e.split(`
240
+ `,xt=!1;function Yt(){if(xt||typeof document>"u")return;let e="dsh-git-panel/client.css";if(document.querySelector(`style[data-plugin-css="${e}"]`)!==null){xt=!0;return}let t=document.createElement("style");t.dataset.plugin="@xbzbing/dsh-git-panel",t.dataset.pluginCss=e,t.textContent=$a,document.head.appendChild(t),xt=!0}var Jt={"panel.tab":"Git","tab.overview":"Git \u603B\u89C8","tab.changes":"\u53D8\u66F4\u8BB0\u5F55","pill.noRepo":"\u65E0 Git \u4ED3\u5E93","pill.unavailable":"Git \u4E0D\u53EF\u7528","pill.detached":"\u6E38\u79BB HEAD","pill.synced":"\u672C\u5730\u5DF2\u540C\u6B65","pill.dirty":"\u6709\u5F85\u63D0\u4EA4\u7684\u53D8\u66F4","common.loading":"\u52A0\u8F7D\u4E2D\u2026","common.refresh":"\u5237\u65B0","common.empty":"\u5DE5\u4F5C\u533A\u5E72\u51C0","common.retry":"\u91CD\u8BD5","common.close":"\u5173\u95ED","common.expandAll":"\u5C55\u5F00\u5168\u90E8","common.collapseAll":"\u6536\u8D77\u5168\u90E8","version.check":"\u68C0\u67E5\u65B0\u7248\u672C","version.checking":"\u68C0\u67E5\u4E2D\u2026","version.upToDate":"\u5DF2\u662F\u6700\u65B0\uFF08{current}\uFF09","version.updateAvailable":"\u6709\u65B0\u7248\u672C {latest}\uFF08\u5F53\u524D {current}\uFF09","version.viewRelease":"\u67E5\u770B\u53D1\u5E03","version.error":"\u68C0\u67E5\u5931\u8D25","version.noRepo":"\u672A\u914D\u7F6E\u4ED3\u5E93\u5730\u5740","version.openRepo":"\u5728 GitHub \u4E0A\u6253\u5F00\u4ED3\u5E93","overview.branches":"\u5206\u652F","overview.head":"HEAD\uFF08\u5F53\u524D\u5206\u652F\uFF09","overview.local":"\u672C\u5730","overview.remote":"\u8FDC\u7A0B","overview.tags":"\u6807\u7B7E","overview.allBranches":"\u5168\u90E8\u5206\u652F","overview.search":"\u641C\u7D22\u63D0\u4EA4\uFF08\u6D88\u606F / \u54C8\u5E0C\uFF09","overview.clearSearch":"\u6E05\u9664\u641C\u7D22","overview.allUsers":"\u5168\u90E8\u4F5C\u8005","overview.allTime":"\u5168\u90E8\u65F6\u95F4","overview.today":"\u4ECA\u5929","overview.last7d":"\u8FD1 7 \u5929","overview.last30d":"\u8FD1 30 \u5929","overview.colGraph":"","overview.colSubject":"\u63D0\u4EA4","overview.colHash":"\u54C8\u5E0C","overview.colAuthor":"\u4F5C\u8005","overview.colDate":"\u65E5\u671F","overview.selectCommit":"\u9009\u62E9\u4E00\u4E2A\u63D0\u4EA4\u67E5\u770B\u8BE6\u60C5","overview.commitFiles":"\u53D8\u66F4\u6587\u4EF6","overview.commitMessage":"\u63D0\u4EA4\u4FE1\u606F","overview.noMessage":"\uFF08\u65E0\u63D0\u4EA4\u6B63\u6587\uFF09","overview.noResults":"\u6CA1\u6709\u5339\u914D\u7684\u63D0\u4EA4","overview.loadFailed":"\u52A0\u8F7D\u5931\u8D25","overview.detailFailed":"\u8BE6\u60C5\u52A0\u8F7D\u5931\u8D25","overview.diffFailed":"\u5DEE\u5F02\u52A0\u8F7D\u5931\u8D25","overview.openFileDiff":"\u67E5\u770B\u8BE5\u6587\u4EF6\u5728\u6B64\u63D0\u4EA4\u4E2D\u7684\u53D8\u66F4","overview.fetch":"\u62C9\u53D6\u8FDC\u7A0B","changes.title":"\u672C\u5730\u53D8\u66F4","changes.groupStaged":"\u5DF2\u6682\u5B58\u7684\u66F4\u6539","changes.groupUnstaged":"\u66F4\u6539","changes.groupUntracked":"\u672A\u7248\u672C\u63A7\u5236\u7684\u6587\u4EF6","changes.selectFile":"\u9009\u62E9\u4E00\u4E2A\u6587\u4EF6\u67E5\u770B\u53D8\u66F4","changes.noChanges":"\u6CA1\u6709\u672A\u63D0\u4EA4\u7684\u53D8\u66F4","changes.stageAll":"\u5168\u90E8\u6682\u5B58","changes.unstageAll":"\u5168\u90E8\u53D6\u6D88\u6682\u5B58","changes.discard":"\u653E\u5F03\u66F4\u6539","changes.discardConfirm":"\u518D\u6B21\u70B9\u51FB\u4EE5\u786E\u8BA4\u653E\u5F03","stats.files":"{n} \u4E2A\u6587\u4EF6","stats.lines":"+{add} \u2212{del} \u884C","stats.lastChange":"\u6700\u8FD1\u53D8\u66F4 {time}","stats.lastCommit":"\u4E0A\u6B21\u63D0\u4EA4 {time}","stats.staged":"\u5DF2\u6682\u5B58 {n}","stats.modified":"\u5DF2\u4FEE\u6539 {n}","stats.untracked":"\u672A\u8DDF\u8E2A {n}","commit.placeholder":"\u63D0\u4EA4\u4FE1\u606F","commit.commit":"\u63D0\u4EA4","commit.commitAndPush":"\u63D0\u4EA4\u5E76\u63A8\u9001\u2026","commit.amend":"\u4FEE\u6B63\u4E0A\u6B21\u63D0\u4EA4\uFF08amend\uFF09","commit.done":"\u5B8C\u6210","commit.pushing":"\u63A8\u9001\u4E2D\u2026","diff.split":"\u5BF9\u7167","diff.before":"\u53D8\u66F4\u524D","diff.after":"\u53D8\u66F4\u540E","diff.binary":"\u4E8C\u8FDB\u5236\u6587\u4EF6\uFF0C\u65E0\u6CD5\u663E\u793A\u5BF9\u7167","diff.tooLarge":"\u56FE\u7247\u8FC7\u5927\uFF0C\u65E0\u6CD5\u663E\u793A\u5BF9\u7167","diff.imageMissing":"\u4E0D\u5B58\u5728","diff.empty":"\u65E0\u5DEE\u5F02","diff.newFile":"\u65B0\u6587\u4EF6","diff.deletedFile":"\u5DF2\u5220\u9664","diff.expandAll":"\u5C55\u5F00\u5168\u90E8","diff.collapse":"\u6298\u53E0\u672A\u53D8\u66F4","diff.expanding":"\u5C55\u5F00\u4E2D\u2026","time.justNow":"\u521A\u521A","time.minutesAgo":"{n} \u5206\u949F\u524D","time.hoursAgo":"{n} \u5C0F\u65F6\u524D","time.daysAgo":"{n} \u5929\u524D","error.generic":"\u64CD\u4F5C\u5931\u8D25","error.notARepo":"\u5F53\u524D\u76EE\u5F55\u4E0D\u662F Git \u4ED3\u5E93","error.noCwd":"\u5F53\u524D\u4F1A\u8BDD\u65E0\u5DE5\u4F5C\u76EE\u5F55","error.localChangesBlock":"\u672C\u5730\u6709\u672A\u63D0\u4EA4\u53D8\u66F4\uFF0C\u65E0\u6CD5\u5207\u6362","error.emptyMessage":"\u63D0\u4EA4\u4FE1\u606F\u4E0D\u80FD\u4E3A\u7A7A","cfg.title":"\u8F93\u5165\u6846\u5206\u652F\u6807\u8BB0","cfg.toggle":"\u663E\u793A\u8F93\u5165\u6846\u6807\u8BB0","cfg.hint":"\u5F00\u542F\u65F6\u5728\u8F93\u5165\u6846\u663E\u793A zsh \u98CE\u683C\u7684 <\u4ED3\u5E93\u540D> (\u5206\u652F) \u6807\u8BB0\uFF1B\u5173\u95ED\u540E\u6539\u4E3A\u5728 Git \u6807\u7B7E\u65C1\u663E\u793A\u72B6\u6001\u5706\u70B9\u3002\u4FDD\u5B58\u540E\u7ACB\u5373\u751F\u6548\u3002","cfg.notLoaded":"\u914D\u7F6E\u672A\u52A0\u8F7D\uFF1A\u8BE5\u914D\u7F6E\u7531\u8FD0\u884C\u4E2D\u7684\u5BBF\u4E3B\u63D0\u4F9B\uFF0C\u82E5\u957F\u65F6\u95F4\u7A7A\u767D\u8BF7\u91CD\u542F DSH \u540E\u91CD\u8BD5\u3002","cfg.saveFailed":"\u4FDD\u5B58\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5"},Qt={"panel.tab":"Git","tab.overview":"Overview","tab.changes":"Changes","pill.noRepo":"No Git repo","pill.unavailable":"Git unavailable","pill.detached":"detached HEAD","pill.synced":"Everything committed","pill.dirty":"Uncommitted changes","common.loading":"Loading\u2026","common.refresh":"Refresh","common.empty":"Working tree clean","common.retry":"Retry","common.close":"Close","common.expandAll":"Expand all","common.collapseAll":"Collapse all","version.check":"Check for updates","version.checking":"Checking\u2026","version.upToDate":"Up to date ({current})","version.updateAvailable":"New version {latest} available (current {current})","version.viewRelease":"View release","version.error":"Check failed","version.noRepo":"Repository not configured","version.openRepo":"Open repository on GitHub","overview.branches":"Branches","overview.head":"HEAD (Current Branch)","overview.local":"Local","overview.remote":"Remote","overview.tags":"Tags","overview.allBranches":"All branches","overview.search":"Search commits (message / hash)","overview.clearSearch":"Clear search","overview.allUsers":"All authors","overview.allTime":"All time","overview.today":"Today","overview.last7d":"Last 7 days","overview.last30d":"Last 30 days","overview.colGraph":"","overview.colSubject":"Commit","overview.colHash":"Hash","overview.colAuthor":"Author","overview.colDate":"Date","overview.selectCommit":"Select a commit to see details","overview.commitFiles":"Changed files","overview.commitMessage":"Commit message","overview.noMessage":"(no commit body)","overview.noResults":"No matching commits","overview.loadFailed":"Load failed","overview.detailFailed":"Failed to load details","overview.diffFailed":"Failed to load diff","overview.openFileDiff":"View this file\u2019s changes in this commit","overview.fetch":"Fetch","changes.title":"Local changes","changes.groupStaged":"Staged changes","changes.groupUnstaged":"Changes","changes.groupUntracked":"Unversioned files","changes.selectFile":"Select a file to see its diff","changes.noChanges":"No uncommitted changes","changes.stageAll":"Stage all","changes.unstageAll":"Unstage all","changes.discard":"Discard changes","changes.discardConfirm":"Click again to confirm discard","stats.files":"{n} files","stats.lines":"+{add} \u2212{del} lines","stats.lastChange":"changed {time}","stats.lastCommit":"last commit {time}","stats.staged":"{n} staged","stats.modified":"{n} modified","stats.untracked":"{n} untracked","commit.placeholder":"Commit message","commit.commit":"Commit","commit.commitAndPush":"Commit and Push\u2026","commit.amend":"Amend previous commit","commit.done":"Done","commit.pushing":"Pushing\u2026","diff.split":"Split","diff.before":"Before","diff.after":"After","diff.binary":"Binary file \u2014 no diff to show","diff.tooLarge":"Image too large to compare","diff.imageMissing":"Does not exist","diff.empty":"No differences","diff.newFile":"New file","diff.deletedFile":"Deleted","diff.expandAll":"Expand all","diff.collapse":"Collapse unchanged","diff.expanding":"Expanding\u2026","time.justNow":"just now","time.minutesAgo":"{n}m ago","time.hoursAgo":"{n}h ago","time.daysAgo":"{n}d ago","error.generic":"Operation failed","error.notARepo":"Not a Git repository","error.noCwd":"This session has no working directory","error.localChangesBlock":"Local changes block the checkout","error.emptyMessage":"Commit message cannot be empty","cfg.title":"Input-bar branch marker","cfg.toggle":"Show input-bar marker","cfg.hint":"When on, the input bar shows the zsh-style <repo> (branch) marker; when off, a status dot appears beside the Git tab instead. Saved changes apply immediately.","cfg.notLoaded":"Config not loaded: it is served by the running host. Restart DSH if this stays blank.","cfg.saveFailed":"Save failed, please retry"};var tt=require("react");var Ka=new Set(["cwd-unavailable","session-not-found"]),jt=3e4,Ha=6e4,et=class{constructor(t,n){this.remote=t;this.sessionId=n}view={state:"cold"};listeners=new Set;timer;inflight;disposed=!1;pollMs=jt;subscribe(t){return this.listeners.add(t),()=>{this.listeners.delete(t)}}getSnapshot(){return this.view}ensure(){this.view.state!=="cold"&&this.view.state!=="no-cwd"||this.refresh()}refresh(){return this.inflight!==void 0?this.inflight:this.disposed?Promise.resolve():(this.view.state==="cold"&&this.setView({state:"loading"}),this.inflight=this.remote.snapshot({sessionId:this.sessionId}).then(t=>{if(!this.disposed)if(t.ok)this.pollMs=t.value.refreshIntervalMs||jt,this.setView({state:"ready",snapshot:t.value});else if(Ka.has(t.error.code))this.pollMs=Ha,this.setView({state:"no-cwd"});else if(t.error.code==="not-a-git-repo"){let n=t.error;this.setView({state:"error",error:{code:"not-a-git-repo",...n.cwd?{cwd:n.cwd}:{},...n.showInputPill!==void 0?{showInputPill:n.showInputPill}:{}}})}else this.setView({state:"error",error:{code:t.error.code,..."detail"in t.error?{detail:t.error.detail}:{}}})}).catch(t=>{this.disposed||this.setView({state:"error",error:{code:"git-unavailable",detail:t instanceof Error?t.message:String(t)}})}).finally(()=>{this.inflight=void 0,this.schedulePoll()}),this.inflight)}resync(){this.disposed||this.refresh()}schedulePoll(){this.disposed||(this.timer!==void 0&&clearTimeout(this.timer),!(this.pollMs<=0)&&(this.timer=setTimeout(()=>{this.refresh()},this.pollMs)))}setView(t){this.view=t;for(let n of this.listeners)n()}dispose(){this.disposed=!0,this.timer!==void 0&&clearTimeout(this.timer),this.timer=void 0,this.listeners.clear()}};var qa="/api",Wa="gitPanel";function Xa(e){try{let t=e.get("connection")?.rpc,n=t?.call;if(t!==void 0&&typeof n=="function")return(r,o,s)=>n.call(t,qa,r,o,s)}catch{}}function Va(e){let t=e;if(t===null||typeof t!="object")return{ok:!1,error:{code:"git-unavailable",message:"malformed rpc result"}};if(t.ok!==!0){let n=t.error;return{ok:!1,error:{code:typeof n?.code=="string"?n.code:"git-unavailable",message:typeof n?.message=="string"?n.message:void 0}}}return t.value}var en=new WeakMap;function $e(e){let t=en.get(e);if(t!==void 0)return t;let n=async(o,s,i)=>{let a=Xa(e);if(a===void 0)return{ok:!1,error:{code:"git-unavailable",message:"no connection"}};try{let l=await a(`${Wa}/${o}`,{args:{request:s}},i);return Va(l)}catch(l){return{ok:!1,error:{code:"git-unavailable",message:l instanceof Error?l.message:String(l)}}}},r={snapshot:(o,s)=>n("snapshot",o,s),run:(o,s)=>n("run",o,s),query:(o,s)=>n("query",o,s),version:(o,s)=>n("version",o,s)};return en.set(e,r),r}var Ke=new Map,tn,kt;function nn(e){kt=e,tn=$e(e)}function Nt(e){let t=Ke.get(e);if(t===void 0){let n=tn??(kt?$e(kt):void 0);t=new et(n??Za(),e),Ke.set(e,t)}return t}function He(){for(let e of Ke.values())e.resync()}function rn(){for(let e of Ke.values())e.dispose();Ke.clear()}function Za(){let e=async()=>({ok:!1,error:{code:"git-unavailable"}});return{snapshot:e,run:e,query:e,version:e}}function nt(e){let[,t]=(0,tt.useState)(0),n=e?Nt(e):void 0;return(0,tt.useEffect)(()=>{if(n===void 0)return;let r=n.subscribe(()=>t(o=>o+1));return n.ensure(),r},[n]),n?n.getSnapshot():{state:"cold"}}var G=require("react");var an="[data-conversation-tabs]",Tt='[data-conversation-tabs] button[role="tab"]',St=new Map;function on(e,t){St.set(e,t)}function sn(e){let t=St.get(e);return t===void 0?null:(St.delete(e),t)}function ln(e){if(typeof document>"u")return!1;let t=document.querySelectorAll(Tt);for(let n of t)if((n.textContent??"").trim()===e)return n.getAttribute("aria-selected")!=="true"&&n.click(),!0;return!1}var p=require("react"),Ht=require("react-dom");var J=require("react");function ke(e,t=15){return(0,J.createElement)("svg",{width:t,height:t,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round"},e)}function rt({size:e}){return ke([(0,J.createElement)("circle",{key:"c",cx:8,cy:8,r:2.4}),(0,J.createElement)("line",{key:"l1",x1:8,y1:1.5,x2:8,y2:5.6}),(0,J.createElement)("line",{key:"l2",x1:8,y1:10.4,x2:8,y2:14.5})],e)}function cn({size:e}){return ke([(0,J.createElement)("path",{key:"a",d:"M4 2v8"}),(0,J.createElement)("path",{key:"b",d:"M2 4h4"}),(0,J.createElement)("circle",{key:"c",cx:4,cy:12,r:1.6}),(0,J.createElement)("circle",{key:"d",cx:12,cy:4,r:1.6}),(0,J.createElement)("path",{key:"e",d:"M12 6v4"}),(0,J.createElement)("path",{key:"f",d:"M10 12h4"})],e)}function Rt({size:e}){return ke([(0,J.createElement)("circle",{key:"a",cx:4,cy:3,r:1.6}),(0,J.createElement)("circle",{key:"b",cx:4,cy:13,r:1.6}),(0,J.createElement)("circle",{key:"c",cx:12,cy:5,r:1.6}),(0,J.createElement)("path",{key:"d",d:"M4 4.6v6.8"}),(0,J.createElement)("path",{key:"e",d:"M12 6.6c0 3-4 2.4-8 4"})],e)}function dn({size:e}){return ke([(0,J.createElement)("path",{key:"a",d:"M2 7V3h4l8 8-4 4z"}),(0,J.createElement)("circle",{key:"b",cx:4.5,cy:5.5,r:.8,fill:"currentColor"})],e)}function qe({size:e,open:t}){return ke([(0,J.createElement)("path",{key:"a",d:t?"M3 6l5 5 5-5":"M6 3l5 5-5 5"})],e)}function pn({size:e}){return ke([(0,J.createElement)("path",{key:"a",d:"M4 4l8 8M12 4l-8 8"})],e)}function at({size:e}){return ke([(0,J.createElement)("path",{key:"a",d:"M13 8a5 5 0 1 1-1.5-3.5"}),(0,J.createElement)("path",{key:"b",d:"M13 2v3h-3"})],e)}function gn({size:e}){return ke([(0,J.createElement)("path",{key:"a",d:"M4 2h5l3 3v9H4z"}),(0,J.createElement)("path",{key:"b",d:"M9 2v3h3"})],e)}function un({size:e=15}){return(0,J.createElement)("svg",{width:e,height:e,viewBox:"0 0 16 16",fill:"currentColor"},(0,J.createElement)("path",{"fill-rule":"evenodd",d:"M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.01 8.01 0 0 0 16 8c0-4.42-3.58-8-8-8z"}))}function mn(e){let t=0;for(let n of e){t=Math.max(t,n.lane+1);for(let r of n.edges)t=Math.max(t,r.fromLane+1,r.toLane+1)}return t}function fn(e){let t=[],n=[],r=new Map,o=0,s=i=>{let a=r.get(i);return a===void 0&&(a=o++,r.set(i,a)),a};for(let i of e){let a=n.findIndex(y=>y===i.hash);a===-1&&(a=n.findIndex(y=>y===null),a===-1&&(a=n.length,n.push(null)),n[a]=i.hash);let l=s(i.hash),c=[...n],d=i.parents,b=d.length>=2;for(let y=0;y<n.length;y++)y!==a&&n[y]===i.hash&&(n[y]=null);if(d.length===0)n[a]=null;else{n[a]=d[0],s(d[0]);for(let y=1;y<d.length;y++){let h=d[y],x=n.findIndex(N=>N===h);x===-1&&(x=n.findIndex(N=>N===null),x===-1&&(x=n.length,n.push(null)),n[x]=h),s(h)}}let f=[],m=n;for(let y=0;y<c.length;y++){let h=c[y];if(h!==null)if(h===i.hash)f.push({fromLane:y,toLane:a,color:s(i.hash)});else{let x=m.findIndex(N=>N===h);x!==-1&&f.push({fromLane:y,toLane:x,color:s(h)})}}for(let y of d){let h=m.findIndex(x=>x===y);h!==-1&&f.push({fromLane:a,toLane:h,color:s(y)})}for(t.push({commit:i,lane:a,color:l,edges:f,merge:b});n.length>0&&n[n.length-1]===null;)n=n.slice(0,-1)}return t}function bn(e){let t={name:"",path:"",dir:!0,children:[]};for(let n of e){let r=n.path.split("/").filter(i=>i!==""),o=t,s="";for(let i=0;i<r.length;i++){let a=r[i];s=s===""?a:`${s}/${a}`;let l=i===r.length-1,c=o.children.find(d=>d.name===a&&d.dir===!l);c===void 0&&(c={name:a,path:s,dir:!l,children:[],...l?{meta:n.meta}:{}},o.children.push(c)),o=c}}return hn(t),yn(t.children)}function hn(e){e.children.sort((t,n)=>t.dir!==n.dir?t.dir?-1:1:t.name.localeCompare(n.name));for(let t of e.children)hn(t)}function yn(e){return e.map(t=>{if(!t.dir)return t;let n=t;for(;n.children.length===1&&n.children[0].dir;){let r=n.children[0];n={name:`${n.name}/${r.name}`,path:r.path,dir:!0,children:r.children}}return{...n,children:yn(n.children)}})}function Ie(e,t,n){if(e===null)return"";let r=typeof e=="number"?e:Date.parse(e);if(!Number.isFinite(r))return"";let o=Math.max(0,t-r),s=Math.floor(o/6e4);if(s<1)return n("time.justNow");if(s<60)return n("time.minutesAgo",{n:s});let i=Math.floor(s/60);if(i<24)return n("time.hoursAgo",{n:i});let a=Math.floor(i/24);return n("time.daysAgo",{n:a})}function De(e){if(e===null)return"";let t=new Date(typeof e=="number"?e:Date.parse(e));if(Number.isNaN(t.getTime()))return"";let n=r=>String(r).padStart(2,"0");return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())} ${n(t.getHours())}:${n(t.getMinutes())}`}var V=require("react");var Ya={png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",webp:"image/webp",avif:"image/avif",bmp:"image/bmp",svg:"image/svg+xml",ico:"image/x-icon",tif:"image/tiff",tiff:"image/tiff"};function Ct(e){let t=e.lastIndexOf(".");return t<0?null:Ya[e.slice(t+1).toLowerCase()]??null}function _n(e){return/^Binary files .* differ$/m.test(e)||/^GIT binary patch$/m.test(e)}function vn(e){return Ct(e)!==null}function En(e){let t=We(e);return t.length===0?!1:t.every(n=>n.startsWith("+")||n.startsWith(" "))&&t.some(n=>n.startsWith("+"))&&/^\+\+\+ /m.test(e)&&/--- \/dev\/null/m.test(e)}function wn(e){let t=We(e);return t.length===0?!1:t.every(n=>n.startsWith("-")||n.startsWith(" "))&&t.some(n=>n.startsWith("-"))&&/^\+\+\+ \/dev\/null/m.test(e)}function We(e){let t=e.split(`
241
241
  `),n=[],r=!1;for(let o of t){if(o.startsWith("@@")){r=!0;continue}if(r){if(o.startsWith("diff ")||o.startsWith("index ")){r=!1;continue}o!==""&&n.push(o)}}return n}function xn(e){let t=0,n=0;for(let r of We(e))r.startsWith("+")?t++:r.startsWith("-")&&n++;return{add:t,del:n}}function kn(e){let t=[],n=e.split(`
242
242
  `),r=0,o=0,s=0;for(;s<n.length&&!n[s].startsWith("@@");s++);for(;s<n.length;s++){let i=n[s];if(i.startsWith("@@")){let c=/@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/.exec(i);c&&(r=Number(c[1]),o=Number(c[2])),t.push({kind:"hunk",leftNo:null,rightNo:null,leftText:null,rightText:null,text:i});continue}if(i.startsWith("\\"))continue;let a=i[0],l=i.slice(1);a==="+"?(t.push({kind:"add",leftNo:null,rightNo:o,leftText:null,rightText:l}),o++):a==="-"?(t.push({kind:"del",leftNo:r,rightNo:null,leftText:l,rightText:null}),r++):a===" "&&(t.push({kind:"context",leftNo:r,rightNo:o,leftText:l,rightText:l}),r++,o++)}return Ja(t)}function Ja(e){let t=[],n=0;for(;n<e.length;){let r=e[n];if(r.kind==="del"){let o=[],s=n;for(;s<e.length&&e[s].kind==="del";)o.push(e[s]),s++;let i=[];for(;s<e.length&&e[s].kind==="add";)i.push(e[s]),s++;let a=Math.max(o.length,i.length);for(let l=0;l<a;l++){let c=o[l],d=i[l];t.push({kind:c&&d?"context":c?"del":"add",leftNo:c?c.leftNo:null,rightNo:d?d.rightNo:null,leftText:c?c.leftText:null,rightText:d?d.rightText:null})}n=s}else t.push(r),n++}return t}function Nn(e){return We(e).filter(t=>t.startsWith("+")).map(t=>t.slice(1)).join(`
243
243
  `)}function Sn(e){return We(e).filter(t=>t.startsWith("-")).map(t=>t.slice(1)).join(`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xbzbing/dsh-git-panel",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "DeepSeek Harness (dsh) plugin: an IDE-style Git panel in the Web GUI — branch/history overview, uncommitted changes with commit & amend, diff stats, and a zsh-style branch marker in the input bar.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -44,7 +44,8 @@
44
44
  "test:unit": "node build.mjs && node --test --test-force-exit test/unit/*.test.mjs",
45
45
  "test:e2e": "node build.mjs && node test/e2e/setup.mjs && node test/e2e/run.mjs && node test/e2e/run2.mjs",
46
46
  "test": "npm run test:unit && npm run test:e2e",
47
- "check": "npm run typecheck && npm run test"
47
+ "check": "npm run typecheck && npm run test",
48
+ "prepare": "node build.mjs"
48
49
  },
49
50
  "dsh": {
50
51
  "bundle": {
@@ -88,4 +89,4 @@
88
89
  "react-dom": "18.3.1",
89
90
  "typescript": "5.7.3"
90
91
  }
91
- }
92
+ }