filecat 7.21.2 → 7.22.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/build/dist/122.4dcdda2738126091bb48.js +1 -0
- package/build/dist/1317.4d1617ed6eddfd2960b5.js +1 -0
- package/build/dist/2334.9568f51c698d1e261092.js +1 -0
- package/build/dist/{4924.32129da284e5464bf078.js → 2543.c1df37b86fd6b03c3976.js} +2 -2
- package/build/dist/259.5dbfcbe6ecd5e8ce07ca.js +1 -0
- package/build/dist/2674.983f76fc32b01e807e4d.js +1 -0
- package/build/dist/3355.221b11ae8755cb58412f.js +1 -0
- package/build/dist/{3402.30e70a3fe5d2c355bae5.js → 3402.913056b796b3aa4dfd5f.js} +1 -1
- package/build/dist/4091.4ec37d360601d3f388ee.js +1 -0
- package/build/dist/4564.d7a5595346660e89760b.js +2 -0
- package/build/dist/4564.d7a5595346660e89760b.js.LICENSE.txt +39 -0
- package/build/dist/4598.48aad39fc631a51c30d3.js +1 -0
- package/build/dist/47.423c0f43594850475f8d.js +1 -0
- package/build/dist/5272.16c3f9821799656a93a9.js +1 -0
- package/build/dist/6097.3b8a75477b58137301a6.js +1 -0
- package/build/dist/676.ad9fb1447bfc5b04b30a.js +1 -0
- package/build/dist/7181.031a335fc6a96a548882.js +1 -0
- package/build/dist/7678.b2889b36fac2b90a9061.js +1 -0
- package/build/dist/{8435.5cf0507f0dfbd7576fff.js → 8435.1f63fa3aa621962786b1.js} +1 -1
- package/build/dist/{8765.13b3b3db8cf2edb74526.js → 8765.800f703d3d31566267ab.js} +1 -1
- package/build/dist/9202.acca2abe478020a45f13.js +1 -0
- package/build/dist/9260.2f474cb25f7647cb995a.js +1 -0
- package/build/dist/{9546.cd3b1747ad87bbd7ccc4.js → 9546.2dc17877ae589e21d6d2.js} +1 -1
- package/build/dist/9765.15869054c7b8e56ccc76.js +1 -0
- package/build/dist/991.2ff5a3ada566cb075df6.js +1 -0
- package/build/dist/index.html +1 -1
- package/build/dist/main.19ecdddaf894b36f1a47.js +2 -0
- package/build/main.js +1 -1
- package/package.json +5 -1
- package/build/dist/2334.8944eba9ea6bea2c873b.js +0 -1
- package/build/dist/2543.a6ee7f78b6f447ccae9f.js +0 -1
- package/build/dist/259.ed90168189edc15b3ea6.js +0 -1
- package/build/dist/2674.26ef7b92f7a50dde4275.js +0 -1
- package/build/dist/3355.70ffd73778049aa73d5c.js +0 -1
- package/build/dist/3528.f4bf3684610c3ce28c08.js +0 -1
- package/build/dist/4091.bbca4ee92e5d078ee770.js +0 -1
- package/build/dist/4598.6528d76c619352e7e1f3.js +0 -1
- package/build/dist/47.0ad0f7d1c95e6691b317.js +0 -1
- package/build/dist/5272.124204f2cb80d69e8561.js +0 -1
- package/build/dist/5877.afb89fcd6cbae1ab8e39.js +0 -1
- package/build/dist/6097.98ee6ec678fafcc2c2ba.js +0 -1
- package/build/dist/676.4671c5b267b93fd2112d.js +0 -1
- package/build/dist/7181.2403d6d75f9d4ea6917d.js +0 -1
- package/build/dist/7678.5769d70f52981f9434d1.js +0 -1
- package/build/dist/8358.1d1c09cc6b9185e388a2.js +0 -1
- package/build/dist/9260.72cae497ae765cc00d54.js +0 -1
- package/build/dist/9765.2f0daa101ea2bc02379a.js +0 -1
- package/build/dist/main.f512bdab9a0595432be0.js +0 -2
- /package/build/dist/{4924.32129da284e5464bf078.js.LICENSE.txt → 2543.c1df37b86fd6b03c3976.js.LICENSE.txt} +0 -0
- /package/build/dist/{main.f512bdab9a0595432be0.js.LICENSE.txt → main.19ecdddaf894b36f1a47.js.LICENSE.txt} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[1317],{20734(e,t,s){s.d(t,{A:()=>c});var a=s(96540),i=s(48890),n=s(74848);function c({valueA:e,valueB:t,mode:s="split",theme:c,filename:l}){const o=(0,a.useRef)(null),r=(0,a.useRef)(null),d=(0,a.useMemo)(()=>l&&i.Tt.getModeForPath(l).mode||"ace/mode/text",[l]);return(0,a.useEffect)(()=>{const a=o.current;if(!a)return;const n=i.Kw.require("ace/ext/diff"),l={valueA:e??"",valueB:t??"",diffProvider:new n.DiffProvider},h="inline"===s,m=h?new n.InlineDiffView({...l,inline:"a"},a):new n.SplitDiffView(l);h||(m.container=a,a.appendChild(m.editorA.container),a.appendChild(m.editorB.container)),c&&m.setTheme(c),m.editorA?.session.setMode(d),m.editorB?.session.setMode(d),m.onInput(),m.foldUnchanged();const _=requestAnimationFrame(()=>{m.editorA?.resize(!0),m.editorB?.resize(!0)});return r.current=m,()=>{cancelAnimationFrame(_);try{m.destroy()}catch(e){}r.current=null,a.innerHTML=""}},[e,t,s,c,d]),(0,n.jsx)("div",{className:"ace-diff",ref:o})}},48890(e,t,s){s.d(t,{Kw:()=>a,Tt:()=>i});var a=s(80952),i=(s(82327),s(1766),s(24854),s(90008),s(90846),s(40975),s(44286),s(30766),s(14973),s(69687),s(1234),s(47507),s(87268),s(55208),s(34678),s(24522));const n=`https://gcore.jsdelivr.net/npm/ace-builds@${a.version}/src-min-noconflict/`;a.config.set("basePath",n),a.config.set("modePath",n),a.config.set("themePath",n),a.config.set("workerPath",n)},81317(e,t,s){s.r(t),s.d(t,{default:()=>Z});var a=s(96540),i=s(14284),n=s(62042),c=s(22022),l=s(85997),o=s(61443),r=s(57952),d=s(52671),h=s(34289),m=s(87361),_=s(2543),g=s(34251),p=s(47022),u=s(74848);const f={M:{label:"M",cls:"mod"},A:{label:"A",cls:"add"},D:{label:"D",cls:"del"},R:{label:"R",cls:"ren"},C:{label:"C",cls:"ren"},U:{label:"U",cls:"conf"},"?":{label:"?",cls:"untracked"}};function x(e){const t=e.lastIndexOf("/");return-1===t?e:e.substring(t+1)}function j(e){const t={type:"folder",name:"",full_path:"",children:[]};for(const s of e){const e=s.path.split("/").filter(Boolean);let a=t;for(let t=0;t<e.length;t++){const i=e[t],n=t===e.length-1;let c=a.children.find(e=>e.name===i);c||(c={type:n?"file":"folder",name:i,full_path:a.full_path?`${a.full_path}/${i}`:i,children:[]},a.children.push(c)),n&&(c.data=s.data),a=c}}const s=e=>{e.sort((e,t)=>e.type!==t.type?"folder"===e.type?-1:1:e.name.localeCompare(t.name));for(const t of e)t.children.length&&s(t.children)};return s(t.children),t.children}function N(e){const{t}=(0,c.Bd)(),{file:s,staged:a,status:i,selected:n,active:o,leaf:r}=e,d=f[i]??{label:i,cls:"mod"},h=r?s.path.substring(0,s.path.lastIndexOf("/")):"";return(0,u.jsxs)("div",{className:"git-file"+(o?" git-file--active":""),children:[(0,u.jsx)("input",{type:"checkbox",checked:n.has(s.path),onChange:()=>e.on_toggle(s.path),onClick:e=>e.stopPropagation()}),(0,u.jsx)("span",{className:"file-icons",children:(0,u.jsx)("span",{"data-type":(0,g.uL)(s.path),"data-dir":!1,"aria-label":s.path,children:(0,u.jsx)(l.In,{icon:"",aria_label:s.path})})}),(0,u.jsx)("span",{className:"git-file__name",title:s.oldPath?`${s.oldPath} → ${s.path}`:s.path,onClick:()=>e.on_view_diff(s,a),children:r?x(s.path):s.path}),(0,u.jsx)("span",{className:`git-file__badge git-file__badge--${d.cls}`,children:d.label}),h&&(0,u.jsx)("span",{className:"git-file__dir",title:h,children:h}),(0,u.jsxs)("span",{className:"git-file__ops",children:[(0,u.jsx)(l.rA,{icon:"format_list_numbered",title:t("逐行归属"),onClick:()=>e.on_view_blame(s)}),(0,u.jsx)(l.rA,{icon:a?"remove":"add",title:t(a?"取消暂存":"暂存"),onClick:()=>e.on_stage_one(s,a)}),(0,u.jsx)(l.rA,{icon:"undo",title:t("discard"),onClick:()=>e.on_discard_one(s,a)})]})]})}function v(e){const{node:t,staged:s,file_map:i,prefix:n}=e,[c,o]=(0,a.useState)(!0),r=n?`${n}/${t.name}`:t.name;if("file"===t.type){const t=i.get(r);if(!t)return null;const a=s?t.conflicted?"U":t.index:t.untracked?"?":t.conflicted?"U":t.worktree;return(0,u.jsx)(N,{file:t,staged:s,status:a,selected:e.selected,active:e.active_path===t.path,leaf:!0,on_toggle:e.on_toggle,on_view_diff:e.on_view_diff,on_stage_one:e.on_stage_one,on_view_blame:e.on_view_blame,on_discard_one:e.on_discard_one})}return(0,u.jsxs)("div",{className:"git-tree__folder",children:[(0,u.jsxs)("div",{className:"git-tree__dir",onClick:()=>o(!c),children:[(0,u.jsx)("i",{className:"material-icons git-tree__arrow","data-icon":c?"arrow_drop_down":"arrow_right",children:c?"arrow_drop_down":"arrow_right"}),(0,u.jsx)("span",{className:"file-icons",children:(0,u.jsx)("span",{"data-type":p.Iw.folder,"data-dir":!0,"aria-label":t.name,children:(0,u.jsx)(l.In,{icon:"",aria_label:t.name})})}),(0,u.jsx)("span",{className:"git-tree__dir-name",children:t.name})]}),c&&(0,u.jsx)("div",{className:"git-tree__children",children:t.children?.map((t,a)=>(0,u.jsx)(v,{node:t,staged:s,file_map:i,prefix:r,selected:e.selected,active_path:e.active_path,on_toggle:e.on_toggle,on_view_diff:e.on_view_diff,on_stage_one:e.on_stage_one,on_view_blame:e.on_view_blame,on_discard_one:e.on_discard_one},a))})]})}function y(e){const{t}=(0,c.Bd)(),{title:s,files:i,staged:n,selected:l}=e,o=(0,a.useMemo)(()=>i.map(e=>e.path),[i]),r=o.filter(e=>l.has(e)).length,d=i.length>0&&r===i.length,h=r>0&&!d,m=(0,a.useMemo)(()=>{const e=new Map;for(const t of i)e.set(t.path,t);return e},[i]),_=(0,a.useMemo)(()=>e.tree_mode?function(e){const t=j(e.map(e=>({path:e.path,data:e}))),s=e=>({type:e.type,name:e.name,size:0,children:e.children.length?e.children.map(s):void 0});return t.map(s)}(i):[],[i,e.tree_mode]);return 0===i.length?null:(0,u.jsxs)("div",{className:"git-section",children:[(0,u.jsxs)("div",{className:"git-section__header",children:[(0,u.jsx)("input",{type:"checkbox",checked:d,ref:e=>{e&&(e.indeterminate=h)},onChange:()=>e.on_toggle_all(o,!d)}),(0,u.jsxs)("span",{className:"git-section__title",children:[s," (",i.length,")"]}),(0,u.jsx)("span",{className:"git-section__action",onClick:()=>e.on_stage_section(i,n),children:t(n?"全部取消暂存":"全部暂存")})]}),e.tree_mode?(0,u.jsx)("div",{className:"git-tree",children:_.map((t,s)=>(0,u.jsx)(v,{node:t,staged:n,file_map:m,prefix:"",selected:e.selected,active_path:e.active_path,on_toggle:e.on_toggle,on_view_diff:e.on_view_diff,on_stage_one:e.on_stage_one,on_view_blame:e.on_view_blame,on_discard_one:e.on_discard_one},s))}):i.map(t=>(0,u.jsx)(N,{file:t,staged:n,status:e.status_of(t),selected:e.selected,active:e.active_path===t.path,leaf:!0,on_toggle:e.on_toggle,on_view_diff:e.on_view_diff,on_stage_one:e.on_stage_one,on_view_blame:e.on_view_blame,on_discard_one:e.on_discard_one},t.path+(n?"_s":"_w")))]})}function b(e){const{t}=(0,c.Bd)(),{files:s}=e,[i,n]=(0,a.useState)(!1),o=s.filter(e=>e.staged),r=s.filter(e=>e.untracked||" "!==e.worktree),d={selected:e.selected,on_toggle:e.on_toggle,on_toggle_all:e.on_toggle_all,active_path:e.active_path,tree_mode:i,on_view_diff:e.on_view_diff,on_stage_section:e.on_stage_section,on_stage_one:e.on_stage_one,on_view_blame:e.on_view_blame,on_discard_one:e.on_discard_one};return(0,u.jsxs)("div",{className:"git-change-list",children:[(0,u.jsxs)("div",{className:"git-change-toolbar",children:[(0,u.jsx)(l.rA,{icon:"account_tree",title:t("树形展示"),selected:i,onClick:()=>n(!i)}),e.selected.size>0&&(0,u.jsx)(l.rA,{icon:"undo",title:`${t("discard")} (${e.selected.size})`,onClick:e.on_discard_selected})]}),(0,u.jsx)(y,{title:t("已暂存的更改"),files:o,staged:!0,status_of:e=>e.conflicted?"U":e.index,...d}),(0,u.jsx)(y,{title:t("更改"),files:r,staged:!1,status_of:e=>e.untracked?"?":e.conflicted?"U":e.worktree,...d}),0===s.length&&(0,u.jsx)("div",{className:"git-change-empty",children:t("没有已更改的文件")})]})}var w=s(20734);const k={text:"",binary:!1,exists:!1};function S({dir_path:e,file:t,left_ref:s,right_ref:n,mode:l="unified"}){const{t:o}=(0,c.Bd)(),[r,d]=(0,a.useState)(k),[h,m]=(0,a.useState)(k),[_,g]=(0,a.useState)(!1),[p,f]=(0,a.useState)(""),x=(0,a.useRef)(0);return(0,a.useEffect)(()=>{const a=++x.current;g(!0),f("");const c=s=>i.TU.post("file_content",{path:e,file:t,ref:s});Promise.all([c(s),c(n)]).then(([e,t])=>{a===x.current&&(d(0===e.code?e.data:k),m(0===t.code?t.data:k))}).catch(e=>{a===x.current&&(f("string"==typeof e?e:e?.message||""),d(k),m(k))}).finally(()=>{a===x.current&&g(!1)})},[e,t,s,n]),_?(0,u.jsx)("div",{className:"git-diff-empty",children:(0,u.jsx)("span",{children:o("加载中")})}):p?(0,u.jsx)("div",{className:"git-diff-empty",children:(0,u.jsx)("span",{children:p})}):r.binary||h.binary?(0,u.jsx)("div",{className:"git-diff-empty",children:(0,u.jsx)("span",{children:o("二进制文件无法比较")})}):r.text===h.text?(0,u.jsx)("div",{className:"git-diff-empty",children:(0,u.jsx)("span",{children:o("无差异")})}):(0,u.jsx)(w.A,{valueA:r.text??"",valueB:h.text??"",mode:"split"===l?"split":"inline",filename:t})}function C({dir_path:e,entries:t,is_search:s,has_more:o,loading_more:r,active_hash:d,on_select:h,on_scroll_bottom:m,on_search_result:_}){const{t:g}=(0,c.Bd)(),[p,f]=(0,a.useState)(!1),[x,j]=(0,a.useState)(""),[N,v]=(0,a.useState)(""),[y,b]=(0,a.useState)(!1),{rows:w,width:k}=function(e){const t=[],s=[];let a=1;for(const i of e){let e=t.indexOf(i.hash);e<0&&(e=t.indexOf(null),e<0&&(e=t.length,t.push(null)));const n=i.parents||[],c=[];for(const s of n)s&&t.forEach((a,i)=>{i!==e&&a===s&&(c.push(i),t[i]=null)});const l=[];t.forEach((t,s)=>{null===t||s===e||c.includes(s)||l.push(s)}),t[e]=n[0]??null;const o=[e];for(const e of n.slice(1)){let s=t.indexOf(e);s<0&&(s=t.indexOf(null),s<0&&(s=t.length,t.push(null)),t[s]=e),o.push(s)}for(;t.length&&null===t[t.length-1];)t.pop();s.push({column:e,pass_through:l,out_edges:o,merge_in:c}),a=Math.max(a,t.length,e+1,...o.map(e=>e+1))}return{rows:s,width:a}}(s?[]:t),S=async()=>{if(x.trim()||N.trim()){b(!0);try{const t=await i.TU.post("search_commit",{path:e,keyword:x.trim(),author:N.trim(),maxCount:100});0===t.code?_(t.data||[]):(0,n.zN)(t.message)}catch(e){(0,n.zN)(e?.message)}finally{b(!1)}}else(0,n.zN)(g("请输入搜索条件"))},C=(e,t,s)=>{const a=39,i=12,n=s?i:-2,c=e=>16*e+8,l=c(e.column),o=[];for(const t of e.pass_through)o.push((0,u.jsx)("line",{x1:c(t),y1:n,x2:c(t),y2:41,className:"git-log__graph-edge"},`p${t}`));for(const[t,a]of e.merge_in.entries()){const e=c(a);s||o.push((0,u.jsx)("path",{fill:"none",d:`M ${e} -2 C ${e} 19.5 ${l} 19.5 ${l} 12`,className:"git-log__graph-edge"},`m${t}`))}for(const[t,s]of e.out_edges.entries())if(s===e.column)o.push((0,u.jsx)("line",{x1:l,y1:n,x2:l,y2:41,className:"git-log__graph-edge"},`o${t}`));else{const e=c(s);o.push((0,u.jsx)("path",{fill:"none",d:`M ${l} 12 C ${l} 25.5 ${e} 25.5 ${e} 39`,className:"git-log__graph-edge"},`o${t}`))}return(0,u.jsx)("div",{className:"git-log__graph",children:(0,u.jsxs)("svg",{width:16*k,height:a,overflow:"visible",children:[o,(0,u.jsx)("circle",{cx:l,cy:i,r:3.5,className:"git-log__graph-dot"+(t?" git-log__graph-dot--unpushed":"")})]})})};return(0,u.jsxs)("div",{className:"git-log-wrap",children:[(0,u.jsxs)("div",{className:"git-log-search",children:[(0,u.jsx)(l.rA,{icon:"search",title:g("搜索提交"),onClick:()=>{p?(j(""),v(""),_(null),f(!1)):f(!0)}}),p&&(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)("input",{className:"input input--block",autoFocus:!0,value:x,placeholder:g("提交信息关键词"),onChange:e=>j(e.target.value),onKeyDown:e=>"Enter"===e.key&&S()}),(0,u.jsx)("input",{className:"input input--block",value:N,placeholder:g("作者"),onChange:e=>v(e.target.value),onKeyDown:e=>"Enter"===e.key&&S()}),(0,u.jsx)(l.rA,{icon:"check",title:g("搜索"),onClick:S})]})]}),(0,u.jsxs)("div",{className:"git-log",onScroll:m,children:[y&&(0,u.jsx)("div",{className:"git-change-empty",children:g("加载中")}),!y&&0===t.length&&(0,u.jsx)("div",{className:"git-change-empty",children:g("暂无提交记录")}),!y&&t.map((e,t)=>(0,u.jsxs)("div",{className:`git-log__entry${d===e.hash?" git-log__entry--active":""}${e.unpushed?" git-log__entry--unpushed":""}`,onClick:()=>h(e.hash),children:[!s&&C(w[t],!!e.unpushed,0===t),(0,u.jsxs)("div",{className:"git-log__main",children:[(0,u.jsxs)("div",{className:"git-log__row",children:[e.unpushed&&(0,u.jsx)("span",{className:"git-log__unpushed",title:g("未推送")}),(0,u.jsx)("span",{className:"git-log__hash",children:e.hash}),(e.refs||[]).map(e=>(0,u.jsx)("span",{className:"git-log__ref"+(e.includes("HEAD")?" git-log__ref--head":""),children:e.replace("HEAD -> ","")},e)),(0,u.jsx)("span",{className:"git-log__msg",title:e.message,children:e.message})]}),(0,u.jsxs)("div",{className:"git-log__meta",children:[e.author," · ",e.date]})]})]},e.hash)),!y&&!s&&r&&(0,u.jsx)("div",{className:"git-log__more",children:g("加载中")}),!y&&!s&&!r&&!o&&t.length>0&&(0,u.jsx)("div",{className:"git-log__more",children:g("已到底部")})]})]})}var z=s(45907);function A({nodes:e,selected:t,on_select:s}){const[i,n]=(0,a.useState)(new Set),c=e=>e.map(e=>{if("folder"===e.type){const t=!i.has(e.full_path);return(0,u.jsxs)("div",{children:[(0,u.jsxs)("div",{className:"git-commit-tree__dir",onClick:()=>{return t=e.full_path,void n(e=>{const s=new Set(e);return s.has(t)?s.delete(t):s.add(t),s});var t},children:[(0,u.jsx)("i",{className:"material-icons git-tree__arrow",children:t?"arrow_drop_down":"arrow_right"}),(0,u.jsx)("span",{className:"file-icons",children:(0,u.jsx)("span",{"data-type":p.Iw.folder,"data-dir":!0,"aria-label":e.name,children:(0,u.jsx)(l.In,{icon:"",aria_label:e.name})})}),(0,u.jsx)("span",{className:"git-commit-tree__dir-name",children:e.name})]}),t&&(0,u.jsx)("div",{className:"git-commit-tree__children",children:c(e.children)})]},e.full_path)}const a=e.data;return(0,u.jsxs)("div",{className:"git-commit-file git-commit-file--leaf"+(t===e.full_path?" git-commit-file--active":""),onClick:()=>s(e.full_path),title:e.full_path,children:[(0,u.jsx)("span",{className:"file-icons",children:(0,u.jsx)("span",{"data-type":(0,g.uL)(e.name),"aria-label":e.name,children:(0,u.jsx)(l.In,{icon:"",aria_label:e.name})})}),(0,u.jsx)("span",{className:"git-commit-file__name",children:e.name}),a&&null!==a.additions&&(0,u.jsxs)("span",{className:"git-commit-file__stat",children:[(0,u.jsxs)("span",{className:"git-stat--add",children:["+",a.additions]}),(0,u.jsxs)("span",{className:"git-stat--del",children:["-",a.deletions]})]})]},e.full_path)});return(0,u.jsx)(u.Fragment,{children:c(e)})}function $({dir_path:e,hash:t,on_close:s,on_changed:o}){const{t:r}=(0,c.Bd)(),d=(0,z.y)(),[h,m]=(0,a.useState)(null),[_,g]=(0,a.useState)(null),[p,f]=(0,a.useState)("unified"),[x,N]=(0,a.useState)(!1),[v,y]=(0,a.useState)(!1);(0,a.useEffect)(()=>{t&&(g(null),y(!1),w())},[t,e]);const b=(0,a.useMemo)(()=>j((h?.files??[]).map(e=>({path:e.path,data:e}))),[h]),w=async()=>{try{const s=await i.TU.post("commit_detail",{path:e,hash:t});0===s.code?m(s.data):(0,n.zN)(s.message)}catch(e){(0,n.zN)(e?.message)}};if(!h)return(0,u.jsx)("div",{className:"git-card git-card--diff",children:(0,u.jsx)("div",{className:"git-change-empty",children:r("加载中")})});return(0,u.jsxs)("div",{className:"git-card git-card--diff",children:[(0,u.jsxs)("div",{className:"git-commit-meta",children:[(0,u.jsxs)("div",{className:"git-commit-meta__row",children:[(0,u.jsx)("span",{className:"git-commit-meta__hash",children:h.short_hash}),(0,u.jsx)("span",{className:"git-commit-meta__subject",title:h.subject,children:h.subject}),_&&(0,u.jsx)(l.rA,{icon:"compare_arrows",title:r("与工作区对比"),onClick:()=>{_?y(!0):(0,n.zN)(r("请先选择文件"))}}),(0,u.jsx)(l.rA,{icon:"undo",title:r("撤销提交"),onClick:()=>{d({title:r("撤销提交"),sub_title:`${r("将生成一个反向提交来撤销")} ${h.short_hash} ?`,confirm_fun:async()=>{try{const s=await i.TU.post("revert",{path:e,hash:t});0===s.code?((0,n.SK)(r("已撤销")),o?.()):(0,n.zN)(s.message)}catch(e){(0,n.zN)(e?.message)}}})}}),(0,u.jsx)(l.rA,{icon:"content_cut",title:r("摘取提交"),onClick:()=>{d({title:r("摘取提交"),sub_title:`${r("将该提交应用到当前分支")} ${h.short_hash} ?`,confirm_fun:async()=>{try{const s=await i.TU.post("cherry_pick",{path:e,hash:t});0===s.code?((0,n.SK)(r("摘取成功")),o?.()):(0,n.zN)(s.message)}catch(e){(0,n.zN)(e?.message)}}})}}),(0,u.jsx)(l.rA,{icon:"close",title:r("关闭"),onClick:s})]}),(0,u.jsxs)("div",{className:"git-commit-meta__sub",children:[h.author," <",h.email,"> · ",h.date]})]}),(0,u.jsxs)("div",{className:"git-commit-body",children:[(0,u.jsxs)("div",{className:"git-commit-files",children:[(0,u.jsxs)("div",{className:"git-commit-file__count",children:[r("全部文件")," (",h.files.length,")"]}),(0,u.jsx)(A,{nodes:b,selected:_,on_select:e=>{g(e),y(!1)}})]}),(0,u.jsxs)("div",{className:"git-commit-diff",children:[(0,u.jsxs)("div",{className:"git-diff-header",children:[(0,u.jsx)("span",{className:"git-diff-header__badge",children:v?r("与工作区对比"):`${r("提交")} ${h.short_hash}`}),(0,u.jsx)("span",{className:"git-diff-header__path",title:_??"",children:_??`${r("全部文件")} (${h.files.length})`}),(0,u.jsxs)("div",{className:"git-diff-header__modes",children:[(0,u.jsx)(l.rA,{icon:"view_agenda",title:r("单栏"),selected:"unified"===p,onClick:()=>f("unified")}),(0,u.jsx)(l.rA,{icon:"view_column",title:r("并排"),selected:"split"===p,onClick:()=>f("split")})]})]}),_?v?(0,u.jsx)(S,{dir_path:e,file:_,left_ref:t,right_ref:"worktree",mode:p}):(0,u.jsx)(S,{dir_path:e,file:_,left_ref:`${t}^`,right_ref:t,mode:p}):(0,u.jsx)("div",{className:"git-diff-empty",children:(0,u.jsx)("span",{children:r("请选择文件查看改动")})})]})]})]})}function U(e){let t=0;for(let s=0;s<e.length;s++)t+=e.charCodeAt(s);return`hsl(${t%360}, 55%, 45%)`}function T({dir_path:e,file:t,on_close:s}){const{t:o}=(0,c.Bd)(),[r,d]=(0,a.useState)([]),[h,m]=(0,a.useState)(!1);(0,a.useEffect)(()=>{t&&_()},[t,e]);const _=async()=>{m(!0);try{const s=await i.TU.post("blame",{path:e,file:t});0===s.code?d(s.data||[]):((0,n.zN)(s.message),d([]))}catch(e){(0,n.zN)(e?.message),d([])}finally{m(!1)}};return(0,u.jsxs)("div",{className:"git-card git-card--diff",children:[(0,u.jsxs)("div",{className:"git-diff-header",children:[(0,u.jsx)("span",{className:"git-diff-header__badge",children:o("逐行归属")}),(0,u.jsx)("span",{className:"git-diff-header__path",title:t,children:t}),(0,u.jsx)("div",{className:"git-diff-header__modes",children:(0,u.jsx)(l.rA,{icon:"close",title:o("关闭"),onClick:s})})]}),h&&(0,u.jsx)("div",{className:"git-change-empty",children:o("加载中")}),!h&&0===r.length&&(0,u.jsx)("div",{className:"git-change-empty",children:o("无法读取该文件的归属信息")}),!h&&r.length>0&&(0,u.jsx)("div",{className:"git-blame",children:r.map((e,t)=>(0,u.jsxs)("div",{className:"git-blame__row",children:[(0,u.jsx)("span",{className:"git-blame__hash",title:e.hash,children:e.hash}),(0,u.jsx)("span",{className:"git-blame__author",style:{color:U(e.author)},title:`${e.author} · ${e.date}`,children:e.author}),(0,u.jsx)("span",{className:"git-blame__date",children:e.date}),(0,u.jsx)("span",{className:"git-blame__num",children:e.line_num}),(0,u.jsx)("span",{className:"git-blame__code",children:e.text||" "})]},t))})]})}function K({current:e,branches:t,on_checkout:s,on_create:i,on_delete:n,on_merge:o,ahead:r,behind:d}){const{t:h}=(0,c.Bd)(),m=(0,z.y)(),[_,g]=(0,a.useState)(!1),[p,f]=(0,a.useState)(""),x=()=>{const e=p.trim();e&&(i(e),f(""),g(!1))};return(0,u.jsxs)("div",{className:"git-branch-row",children:[(0,u.jsxs)("span",{className:"git-branch__name",children:[h("分支"),": ",e]}),(r>0||d>0)&&(0,u.jsxs)("span",{className:"git-branch__counts",children:[r>0&&(0,u.jsxs)("span",{className:"git-ahead",title:h("领先上游"),children:["↑",r]}),d>0&&(0,u.jsxs)("span",{className:"git-behind",title:h("落后上游"),children:["↓",d]})]}),(0,u.jsx)("div",{className:"git-branch__list",children:t.map(t=>{const a=t===e;return(0,u.jsxs)("div",{className:"git-branch-chip"+(a?" git-branch-chip--current":""),onClick:()=>!a&&s(t),title:a?h("当前分支"):`${h("切换到")} ${t}`,children:[t,!a&&(0,u.jsxs)("span",{className:"git-branch-chip__ops",children:[(0,u.jsx)("span",{className:"git-branch-chip__op",title:h("合并到此分支"),onClick:e=>{e.stopPropagation(),o(t)},children:"⇥"}),(0,u.jsx)("span",{className:"git-branch-chip__op",title:h("删除分支"),onClick:e=>{var s;e.stopPropagation(),s=t,m({title:h("删除分支"),sub_title:`${h("确认删除分支")} ${s} ?`,confirm_fun:()=>n(s,!1)})},children:"×"})]})]},t)})}),_?(0,u.jsxs)("span",{className:"git-branch-new",children:[(0,u.jsx)("input",{className:"input input--block",autoFocus:!0,value:p,placeholder:h("新分支名"),onChange:e=>f(e.target.value),onKeyDown:e=>{"Enter"===e.key&&x(),"Escape"===e.key&&(g(!1),f(""))}}),(0,u.jsx)(l.rA,{icon:"check",title:h("确定"),onClick:x}),(0,u.jsx)(l.rA,{icon:"close",title:h("取消"),onClick:()=>{g(!1),f("")}})]}):(0,u.jsx)(l.rA,{icon:"add",title:h("新建分支"),onClick:()=>g(!0)})]})}function E(e){const{t}=(0,c.Bd)(),{dir_path:s,user_config:r,proxy_config:d}=e,[h,m]=(0,a.useState)(!1),[_,g]=(0,a.useState)(r.name),[p,f]=(0,a.useState)(r.email),[x,j]=(0,a.useState)(!1),[N,v]=(0,a.useState)(d?.global.http||""),[y,b]=(0,a.useState)(d?.global.https||""),[w,k]=(0,a.useState)(d?.local.http||""),[S,C]=(0,a.useState)(d?.local.https||"");return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsxs)("div",{className:"git-config-row",children:[(0,u.jsx)("span",{className:"git-config__label",children:t("用户配置")}),h?(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(o.Sm,{maxWidth:"15rem",value:_,placeholder:"user.name",handleInputChange:e=>g(e)}),(0,u.jsx)(o.Sm,{maxWidth:"15rem",value:p,placeholder:"user.email",handleInputChange:e=>f(e)}),(0,u.jsx)(l.rA,{icon:"check",title:t("保存"),onClick:async()=>{try{const a=await i.TU.post("set_user_config",{path:s,name:_,email:p});0===a.code?((0,n.SK)(t("用户配置已保存")),m(!1),e.on_user_config_saved({name:_,email:p})):(0,n.zN)(a.message)}catch(e){(0,n.zN)(e?.message)}}}),(0,u.jsx)(l.rA,{icon:"close",title:t("取消"),onClick:()=>m(!1)})]}):(0,u.jsxs)(u.Fragment,{children:[(0,u.jsxs)("span",{className:"git-config__value",children:[r.name," / ",r.email]}),(0,u.jsx)(l.rA,{icon:"edit",title:t("编辑"),onClick:()=>{g(r.name),f(r.email),m(!0)}})]})]}),(0,u.jsxs)("div",{className:"git-config-row",children:[(0,u.jsx)("span",{className:"git-config__label",children:t("代理配置")}),x?(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(o.Sm,{maxWidth:"15rem",value:N,placeholder:"global http",handleInputChange:e=>v(e)}),(0,u.jsx)(o.Sm,{maxWidth:"15rem",value:y,placeholder:"global https",handleInputChange:e=>b(e)}),(0,u.jsx)(o.Sm,{maxWidth:"15rem",value:w,placeholder:"local http",handleInputChange:e=>k(e)}),(0,u.jsx)(o.Sm,{maxWidth:"15rem",value:S,placeholder:"local https",handleInputChange:e=>C(e)}),(0,u.jsx)(l.rA,{icon:"check",title:t("保存"),onClick:async()=>{const a=[{scope:"global",type:"http",value:N},{scope:"global",type:"https",value:y},{scope:"local",type:"http",value:w},{scope:"local",type:"https",value:S}];try{for(const e of a)await i.TU.post("set_proxy",{path:s,...e});(0,n.SK)(t("代理配置已保存")),j(!1),e.on_proxy_saved({global:{http:N,https:y},local:{http:w,https:S}})}catch(e){(0,n.zN)(e?.message)}}}),(0,u.jsx)(l.rA,{icon:"close",title:t("取消"),onClick:()=>j(!1)})]}):(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)("span",{className:"git-config__value",children:(()=>{if(!d)return"-";const e=d.global;if(e.http||e.https)return`global ${e.http||e.https}`;const t=d.local;return t.http||t.https?`local ${t.http||t.https}`:"-"})()}),(0,u.jsx)(l.rA,{icon:"edit",title:t("编辑"),onClick:()=>{v(d?.global.http||""),b(d?.global.https||""),k(d?.local.http||""),C(d?.local.https||""),j(!0)}})]})]})]})}function B({dir_path:e,target_hash:t,on_changed:s}){const{t:o}=(0,c.Bd)(),r=(0,z.y)(),[d,h]=(0,a.useState)([]),[m,_]=(0,a.useState)(!1),[g,p]=(0,a.useState)(""),[f,x]=(0,a.useState)(""),[j,N]=(0,a.useState)(!1);(0,a.useEffect)(()=>{v()},[e]);const v=async()=>{try{const t=await i.TU.post("tags",{path:e});0===t.code&&h(t.data||[])}catch(e){}};return(0,u.jsxs)("div",{className:"git-sub-panel",children:[(0,u.jsxs)("div",{className:"git-sub-panel__header",children:[(0,u.jsxs)("span",{className:"git-sub-panel__title",children:[o("标签")," (",d.length,")"]}),(0,u.jsx)(l.rA,{icon:"add",title:o("新建标签"),onClick:()=>_(!m)})]}),m&&(0,u.jsxs)("div",{className:"git-sub-panel__form",children:[(0,u.jsx)("input",{className:"input input--block",autoFocus:!0,value:g,placeholder:o("标签名"),onChange:e=>p(e.target.value)}),(0,u.jsx)("input",{className:"input input--block",value:f,placeholder:o("备注"),onChange:e=>x(e.target.value)}),(0,u.jsxs)("div",{className:"git-sub-panel__form-actions",children:[(0,u.jsx)("span",{className:"git-sub-panel__hint",children:t?`${o("基于提交")} ${t}`:o("基于当前提交")}),(0,u.jsx)(l.rA,{icon:"check",title:o("保存"),onClick:async()=>{const a=g.trim();if(a){N(!0);try{const c=await i.TU.post("tag_create",{path:e,name:a,message:f.trim(),hash:t});0===c.code?((0,n.SK)(o("标签创建成功")),p(""),x(""),_(!1),await v(),s()):(0,n.zN)(c.message)}catch(e){(0,n.zN)(e?.message)}finally{N(!1)}}else(0,n.zN)(o("请输入标签名"))}}),(0,u.jsx)(l.rA,{icon:"close",title:o("取消"),onClick:()=>{_(!1),p(""),x("")}})]})]}),(0,u.jsxs)("div",{className:"git-sub-panel__list",children:[0===d.length&&(0,u.jsx)("div",{className:"git-change-empty",children:o("暂无标签")}),d.map(t=>(0,u.jsxs)("div",{className:"git-sub-item",children:[(0,u.jsx)("span",{className:"git-sub-item__name",title:t.name,children:t.name}),(0,u.jsx)("span",{className:"git-sub-item__desc",title:t.message,children:t.message}),(0,u.jsx)("span",{className:"git-sub-item__meta",children:t.date}),(0,u.jsxs)("span",{className:"git-sub-item__ops",children:[(0,u.jsx)(l.rA,{icon:"upload",title:o("推送到远程"),onClick:()=>(async t=>{try{const s=await i.TU.post("tag_push",{path:e,name:t});0===s.code?(0,n.SK)(o("标签推送成功")):(0,n.zN)(s.message)}catch(e){(0,n.zN)(e?.message)}})(t.name)}),(0,u.jsx)(l.rA,{icon:"delete",title:o("删除标签"),onClick:()=>{return s=t.name,void r({title:o("删除标签"),sub_title:`${o("确认删除标签")} ${s} ?`,confirm_fun:async()=>{try{const t=await i.TU.post("tag_delete",{path:e,name:s});0===t.code?((0,n.SK)(o("标签删除成功")),await v()):(0,n.zN)(t.message)}catch(e){(0,n.zN)(e?.message)}}});var s}})]})]},t.name))]})]})}function F({dir_path:e,on_changed:t}){const{t:s}=(0,c.Bd)(),o=(0,z.y)(),[r,d]=(0,a.useState)([]),[h,m]=(0,a.useState)(!1);(0,a.useEffect)(()=>{h&&_()},[e,h]);const _=async()=>{try{const t=await i.TU.post("stash_list",{path:e});0===t.code&&d(t.data||[])}catch(e){}},g=async(a,c)=>{try{const l=await i.TU.post("stash_apply",{path:e,ref:a,pop:c});0===l.code?((0,n.SK)(s(c?"已恢复并删除记录":"已应用")),await _(),t()):(0,n.zN)(l.message)}catch(e){(0,n.zN)(e?.message)}};return(0,u.jsxs)("div",{className:"git-stash",children:[(0,u.jsx)("div",{className:"git-sub-panel__header",children:(0,u.jsxs)("span",{className:"git-sub-panel__title",onClick:()=>m(!h),style:{cursor:"pointer"},children:[s("暂存工作区记录")," ",h?"▾":"▸"]})}),h&&(0,u.jsxs)("div",{className:"git-sub-panel__list",children:[0===r.length&&(0,u.jsx)("div",{className:"git-change-empty",children:s("暂无记录")}),r.map(t=>(0,u.jsxs)("div",{className:"git-sub-item",children:[(0,u.jsx)("span",{className:"git-sub-item__name",title:t.message,children:t.message}),(0,u.jsx)("span",{className:"git-sub-item__meta",children:t.date}),(0,u.jsxs)("span",{className:"git-sub-item__ops",children:[(0,u.jsx)(l.rA,{icon:"play_arrow",title:s("应用"),onClick:()=>g(t.ref,!1)}),(0,u.jsx)(l.rA,{icon:"unarchive",title:s("恢复并删除"),onClick:()=>g(t.ref,!0)}),(0,u.jsx)(l.rA,{icon:"delete",title:s("删除"),onClick:()=>{return a=t.ref,void o({title:s("删除记录"),sub_title:`${s("确认删除")} ${a} ?`,confirm_fun:async()=>{try{const t=await i.TU.post("stash_drop",{path:e,ref:a});0===t.code?((0,n.SK)(s("已删除")),await _()):(0,n.zN)(t.message)}catch(e){(0,n.zN)(e?.message)}}});var a}})]})]},t.ref))]})]})}function I({dir_path:e,current_branch:t,on_checkout:s,on_compare:r}){const{t:d}=(0,c.Bd)(),h=(0,z.y)(),[m,_]=(0,a.useState)([]),[g,p]=(0,a.useState)([]),[f,x]=(0,a.useState)(!1),[j,N]=(0,a.useState)(!1),[v,y]=(0,a.useState)(null),[b,w]=(0,a.useState)("");(0,a.useEffect)(()=>{f&&k()},[e,f]);const k=async()=>{try{const t=await i.TU.post("remote_branches",{path:e});0===t.code&&(_(t.data?.branches||[]),p(t.data?.remotes||[]))}catch(e){}},S=async t=>{N(!0);try{const s=await i.TU.post("fetch",{path:e,prune:t});0===s.code?((0,n.SK)(d("拉取完成")),await k()):(0,n.zN)(s.message)}catch(e){(0,n.zN)(e?.message)}finally{N(!1)}},C=async()=>{const t=v;if(t&&b.trim()){N(!0);try{const a=await i.TU.post("remote_branch_rename",{path:e,branch:t,new_name:b.trim()});0===a.code?((0,n.SK)(d("重命名成功")),y(null),await k(),s()):(0,n.zN)(a.message)}catch(e){(0,n.zN)(e?.message)}finally{N(!1)}}};return(0,u.jsxs)("div",{className:"git-remote",children:[(0,u.jsxs)("div",{className:"git-sub-panel__header",children:[(0,u.jsxs)("span",{className:"git-sub-panel__title",onClick:()=>x(!f),children:[d("远程分支")," (",m.length,") ",f?"▾":"▸"]}),(0,u.jsx)(l.rA,{icon:"cloud_download",title:d("拉取远程信息"),onClick:()=>S(!1)}),(0,u.jsx)(l.rA,{icon:"cleaning_services",title:d("拉取并清理已删除分支"),onClick:()=>S(!0)})]}),f&&(0,u.jsxs)("div",{className:"git-sub-panel__list",children:[0===g.length&&(0,u.jsx)("div",{className:"git-change-empty",children:d("未配置远程仓库")}),m.map(c=>(0,u.jsxs)(a.Fragment,{children:[(0,u.jsxs)("div",{className:"git-sub-item",children:[(0,u.jsx)("span",{className:"git-sub-item__name",title:c.name,children:c.name}),(0,u.jsx)("span",{className:"git-sub-item__meta",children:c.date}),(0,u.jsxs)("span",{className:"git-sub-item__ops",children:[(0,u.jsx)(l.rA,{icon:"call_split",title:d("签出到本地"),onClick:()=>(async t=>{N(!0);try{const a=await i.TU.post("checkout_remote",{path:e,branch:t});0===a.code?((0,n.SK)(d("切换分支成功")),s()):(0,n.zN)(a.message)}catch(e){(0,n.zN)(e?.message)}finally{N(!1)}})(c.name)}),(0,u.jsx)(l.rA,{icon:"compare_arrows",title:d("与当前分支比较"),onClick:()=>r(c.name)}),(0,u.jsx)(l.rA,{icon:"merge",title:d("合并到当前分支"),onClick:()=>(async a=>{h({title:d("合并到当前分支"),sub_title:`${d("将")} ${a} ${d("合并到")} ${t} ?`,confirm_fun:async()=>{try{const t=await i.TU.post("merge",{path:e,branch:a});0===t.code?((0,n.SK)(d("合并成功")),s()):(0,n.zN)(t.message)}catch(e){(0,n.zN)(e?.message)}}})})(c.name)}),(0,u.jsx)(l.rA,{icon:"drive_file_rename_outline",title:d("重命名"),onClick:()=>(e=>{const t=e.indexOf("/"),s=t>=0?e.substring(t+1):e;w(s),y(e)})(c.name)}),(0,u.jsx)(l.rA,{icon:"delete",title:d("删除"),onClick:()=>{return t=c.name,void h({title:d("删除远程分支"),sub_title:`${d("确认删除远程分支")} ${t} ? ${d("该分支会从远程仓库删除")}`,confirm_fun:async()=>{try{const s=await i.TU.post("remote_branch_delete",{path:e,branch:t});0===s.code?((0,n.SK)(d("删除成功")),await k()):(0,n.zN)(s.message)}catch(e){(0,n.zN)(e?.message)}}});var t}})]})]}),v===c.name&&(0,u.jsxs)("div",{className:"git-remote__rename",children:[(0,u.jsx)(o.Sm,{value:b,width:"12rem",handleInputChange:e=>w(e)}),(0,u.jsx)(l.rA,{icon:"check",title:d("确定"),onClick:C}),(0,u.jsx)(l.rA,{icon:"close",title:d("取消"),onClick:()=>y(null)})]})]},c.name))]})]})}function M({dir_path:e,branch:t,current_branch:s,on_close:o}){const{t:r}=(0,c.Bd)(),[d,h]=(0,a.useState)([]),[m,_]=(0,a.useState)(null),[g,p]=(0,a.useState)("unified"),[f,x]=(0,a.useState)(!0);(0,a.useEffect)(()=>{_(null),N()},[e,t,s]);const N=async()=>{x(!0);try{const a=await i.TU.post("diff_files",{path:e,from:s,to:t});0===a.code?h(a.data||[]):(0,n.zN)(a.message)}catch(e){(0,n.zN)(e?.message)}finally{x(!1)}},v=(0,a.useMemo)(()=>j(d.map(e=>({path:e.path,data:e}))),[d]);return(0,u.jsxs)("div",{className:"git-card git-card--diff",children:[(0,u.jsxs)("div",{className:"git-diff-header",children:[(0,u.jsx)("span",{className:"git-diff-header__badge",children:r("分支比较")}),(0,u.jsxs)("span",{className:"git-diff-header__path",title:`${s} ↔ ${t}`,children:[s," ↔ ",t]}),m&&(0,u.jsxs)("div",{className:"git-diff-header__modes",children:[(0,u.jsx)(l.rA,{icon:"view_agenda",title:r("单栏"),selected:"unified"===g,onClick:()=>p("unified")}),(0,u.jsx)(l.rA,{icon:"view_column",title:r("并排"),selected:"split"===g,onClick:()=>p("split")})]}),(0,u.jsx)(l.rA,{icon:"close",title:r("关闭"),onClick:o})]}),(0,u.jsxs)("div",{className:"git-commit-body",children:[(0,u.jsxs)("div",{className:"git-commit-files",children:[(0,u.jsxs)("div",{className:"git-commit-file__count",children:[r("全部文件")," (",d.length,")"]}),(0,u.jsx)(A,{nodes:v,selected:m,on_select:_})]}),(0,u.jsx)("div",{className:"git-commit-diff",children:f?(0,u.jsx)("div",{className:"git-diff-empty",children:(0,u.jsx)("span",{children:r("加载中")})}):m?(0,u.jsx)(S,{dir_path:e,file:m,left_ref:s,right_ref:t,mode:g}):(0,u.jsx)("div",{className:"git-diff-empty",children:(0,u.jsx)("span",{children:r("请选择文件查看改动")})})})]})]})}function P({dir_path:e,on_resolved:t}){const{t:s}=(0,c.Bd)(),o=(0,z.y)(),[r,d]=(0,a.useState)([]),[h,m]=(0,a.useState)("");(0,a.useEffect)(()=>{_()},[e]);const _=async()=>{try{const t=await i.TU.post("conflicts",{path:e});0===t.code&&(d(t.data?.files||[]),m(t.data?.state||""))}catch(e){}},g=async(a,c)=>{try{const l=await i.TU.post("resolve",{path:e,file:a,side:c});0===l.code?((0,n.SK)(s("已解决冲突")),await _(),t()):(0,n.zN)(l.message)}catch(e){(0,n.zN)(e?.message)}};return 0===r.length?null:(0,u.jsxs)("div",{className:"git-card git-conflict",children:[(0,u.jsxs)("div",{className:"git-sub-panel__header",children:[(0,u.jsxs)("span",{className:"git-sub-panel__title",children:[s("冲突")," (",r.length,")",h&&(0,u.jsx)("span",{className:"git-conflict__state",children:h})]}),(0,u.jsx)(l.rA,{icon:"done_all",title:s("标记全部已解决"),onClick:async()=>{try{const a=await i.TU.post("conflict_action",{path:e,action:"merge_continue"});0===a.code?((0,n.SK)(s("合并已完成")),t()):(0,n.zN)(a.message)}catch(e){(0,n.zN)(e?.message)}}}),(0,u.jsx)(l.rA,{icon:"undo",title:s("放弃合并"),onClick:()=>{const a="rebase"===h?"rebase_abort":"cherry-pick"===h?"cherry_pick_abort":"revert"===h?"revert_abort":"merge_abort";o({title:s("放弃合并"),sub_title:s("确认放弃当前合并并恢复到操作前状态"),confirm_fun:async()=>{try{const c=await i.TU.post("conflict_action",{path:e,action:a});0===c.code?((0,n.SK)(s("已放弃合并")),t()):(0,n.zN)(c.message)}catch(e){(0,n.zN)(e?.message)}}})}})]}),r.map(e=>(0,u.jsxs)("div",{className:"git-sub-item",children:[(0,u.jsx)("span",{className:"git-sub-item__name",title:e,children:e}),(0,u.jsxs)("span",{className:"git-sub-item__ops",children:[(0,u.jsx)(l.rA,{icon:"person",title:s("采用我方版本"),onClick:()=>g(e,"ours")}),(0,u.jsx)(l.rA,{icon:"group",title:s("采用对方版本"),onClick:()=>g(e,"theirs")}),(0,u.jsx)(l.rA,{icon:"check",title:s("标记已解决"),onClick:()=>g(e,"resolved")})]})]},e))]})}function D({dir_path:e,on_changed:t}){const{t:s}=(0,c.Bd)(),o=(0,z.y)(),[r,d]=(0,a.useState)([]),[h,m]=(0,a.useState)(!1);(0,a.useEffect)(()=>{h&&_()},[e,h]);const _=async()=>{try{const t=await i.TU.post("reflog",{path:e,maxCount:100});0===t.code&&d(t.data||[])}catch(e){}};return(0,u.jsxs)("div",{className:"git-reflog",children:[(0,u.jsx)("div",{className:"git-sub-panel__header",children:(0,u.jsxs)("span",{className:"git-sub-panel__title",onClick:()=>m(!h),style:{cursor:"pointer"},children:[s("操作历史")," (",r.length,") ",h?"▾":"▸"]})}),h&&(0,u.jsxs)("div",{className:"git-sub-panel__list",children:[0===r.length&&(0,u.jsx)("div",{className:"git-change-empty",children:s("暂无记录")}),r.map(a=>(0,u.jsxs)("div",{className:"git-sub-item",children:[(0,u.jsx)("span",{className:"git-sub-item__name",title:a.message,children:a.selector}),(0,u.jsx)("span",{className:"git-sub-item__desc",title:a.message,children:a.message}),(0,u.jsx)("span",{className:"git-sub-item__meta",children:a.date}),(0,u.jsxs)("span",{className:"git-sub-item__ops",children:[(0,u.jsx)(l.rA,{icon:"undo",title:s("回退到此处"),onClick:()=>{return c=a,void o({title:s("回退到此处"),sub_title:`${c.selector} · ${c.message}`,confirm_fun:async()=>{try{const a=await i.TU.post("reset_commit",{path:e,hash:c.selector,mode:"mixed"});0===a.code?((0,n.SK)(s("已回退")),await _(),t()):(0,n.zN)(a.message)}catch(e){(0,n.zN)(e?.message)}}});var c}}),(0,u.jsx)(l.rA,{icon:"delete_forever",title:s("强制回退(丢弃改动)"),onClick:()=>{return c=a,void o({title:s("强制回退(丢弃改动)"),sub_title:`${s("此操作将永久丢弃未提交的改动")}:${c.selector} · ${c.message}`,confirm_fun:async()=>{try{const a=await i.TU.post("reset_commit",{path:e,hash:c.selector,mode:"hard"});0===a.code?((0,n.SK)(s("已强制回退")),await _(),t()):(0,n.zN)(a.message)}catch(e){(0,n.zN)(e?.message)}}});var c}})]})]},a.selector))]})]})}function R({items:e,on_read:t,on_save:s,on_delete:i}){const{t:n}=(0,c.Bd)(),[r,d]=(0,a.useState)(null),[h,m]=(0,a.useState)(""),[_,g]=(0,a.useState)(!1);(0,a.useEffect)(()=>{r&&!e.some(e=>e.name===r)&&d(null)},[e,r]);const p=async()=>{if(r){g(!0);try{await s(r,h)}finally{g(!1)}}};return(0,u.jsx)("div",{className:"hook-editor",children:(0,u.jsxs)("div",{className:"hook-editor__list",children:[e.map(e=>(0,u.jsxs)(a.Fragment,{children:[(0,u.jsxs)("div",{className:"hook-item"+(r===e.name?" hook-item--editing":""),children:[(0,u.jsx)("span",{className:"hook-item__dot"+(e.enabled?" hook-item__dot--on":"")}),(0,u.jsx)("span",{className:"hook-item__name",children:e.name}),(0,u.jsxs)("span",{className:"hook-item__ops",children:[(0,u.jsx)(l.rA,{icon:r===e.name?"expand_less":"edit",title:n("编辑"),onClick:()=>(async e=>{if(r!==e){g(!0);try{m(await t(e)),d(e)}finally{g(!1)}}else d(null)})(e.name)}),e.enabled&&(0,u.jsx)(l.rA,{icon:"block",title:n("停用钩子"),onClick:()=>(async e=>{g(!0);try{await i(e)}finally{g(!1)}})(e.name)})]})]}),r===e.name&&(0,u.jsxs)("div",{className:"hook-item__editor",children:[(0,u.jsxs)("div",{className:"hook-item__editor-bar",children:[(0,u.jsx)("span",{className:"hook-item__editor-name",children:e.name}),(0,u.jsx)(l.rA,{icon:"check",title:n("保存并启用"),onClick:p}),(0,u.jsx)(l.rA,{icon:"close",title:n("取消"),onClick:()=>d(null)})]}),(0,u.jsx)(o.Z2,{className:"hook-item__text",value:h,spellCheck:!1,disabled:_,onChange:e=>m(e.target.value)})]})]},e.name)),0===e.length&&(0,u.jsx)("div",{className:"git-change-empty",children:n("暂无记录")})]})})}function W({dir_path:e}){const{t}=(0,c.Bd)(),s=(0,z.y)(),[l,o]=(0,a.useState)([]),[r,d]=(0,a.useState)(!1);(0,a.useEffect)(()=>{r&&h()},[e,r]);const h=async()=>{try{const t=await i.TU.post("hooks",{path:e});0===t.code&&o(t.data||[])}catch(e){}};return(0,u.jsxs)("div",{className:"git-hook",children:[(0,u.jsx)("div",{className:"git-sub-panel__header",children:(0,u.jsxs)("span",{className:"git-sub-panel__title",onClick:()=>d(!r),children:[t("钩子")," ",r?"▾":"▸"]})}),r&&(0,u.jsx)(R,{items:l,on_read:async t=>{try{const s=await i.TU.post("hook_read",{path:e,name:t});if(0===s.code)return s.data?.content||"";(0,n.zN)(s.message)}catch(e){(0,n.zN)(e?.message)}return""},on_save:async(s,a)=>{try{const c=await i.TU.post("hook_save",{path:e,name:s,content:a});0===c.code?((0,n.SK)(t("已保存并启用")),await h()):(0,n.zN)(c.message)}catch(e){(0,n.zN)(e?.message)}},on_delete:async a=>{s({title:t("停用钩子"),sub_title:`${t("确认删除并停用")} ${a} ?`,confirm_fun:async()=>{try{const s=await i.TU.post("hook_delete",{path:e,name:a});0===s.code?((0,n.SK)(t("已停用")),await h()):(0,n.zN)(s.message)}catch(e){(0,n.zN)(e?.message)}}})}})]})}function H({dir_path:e,on_info_loaded:t,on_changed:s}){const{t:o}=(0,c.Bd)(),[r,d]=(0,a.useState)(null),[h,m]=(0,a.useState)([]),[_,g]=(0,a.useState)(!1),[p,f]=(0,a.useState)(!1);(0,a.useEffect)(()=>{x(),j()},[e]);const x=async()=>{try{const s=await i.TU.post("repo_info",{path:e});0===s.code&&(d(s.data),t(s.data))}catch(e){}},j=async()=>{try{const t=await i.TU.post("submodules",{path:e});0===t.code&&m(t.data||[])}catch(e){}},N=e=>o("uninitialized"===e?"未初始化":"modified"===e?"与记录不一致":"正常");return(0,u.jsxs)("div",{className:"git-repo-panel",children:[(0,u.jsxs)("div",{className:"git-config-row",children:[(0,u.jsx)("span",{className:"git-config__label",children:o("远程地址")}),(0,u.jsx)("span",{className:"git-config__value",title:r?.remote_url,children:r?.remote_url||o("未配置")})]}),(0,u.jsxs)("div",{className:"git-config-row",children:[(0,u.jsx)("span",{className:"git-config__label",children:o("当前提交")}),(0,u.jsxs)("span",{className:"git-config__value",children:[r?.head_hash||"",r&&(r.ahead>0||r.behind>0)&&(0,u.jsxs)("span",{className:"git-repo-panel__counts",children:[r.ahead>0&&(0,u.jsxs)("span",{className:"git-ahead",children:["↑",r.ahead]}),r.behind>0&&(0,u.jsxs)("span",{className:"git-behind",children:["↓",r.behind]})]})]})]}),(0,u.jsxs)("div",{className:"git-sub-panel__header",children:[(0,u.jsxs)("span",{className:"git-sub-panel__title",onClick:()=>g(!_),style:{cursor:"pointer"},children:[o("子模块")," (",h.length,") ",_?"▾":"▸"]}),h.length>0&&(0,u.jsx)(l.rA,{icon:"sync",title:o("初始化并更新子模块"),onClick:async()=>{f(!0);try{const t=await i.TU.post("submodule_update",{path:e});0===t.code?((0,n.SK)(o("子模块更新完成")),await j(),s()):(0,n.zN)(t.message)}catch(e){(0,n.zN)(e?.message)}finally{f(!1)}}})]}),_&&(0,u.jsxs)("div",{className:"git-sub-panel__list",children:[0===h.length&&(0,u.jsx)("div",{className:"git-change-empty",children:o("无子模块")}),h.map(e=>(0,u.jsxs)("div",{className:"git-sub-item",children:[(0,u.jsx)("span",{className:"git-sub-item__name",title:e.path,children:e.path}),(0,u.jsx)("span",{className:"git-sub-item__desc",title:e.desc,children:e.desc}),(0,u.jsx)("span",{className:`git-sub-item__meta git-sub-status--${e.status}`,children:N(e.status)})]},e.path))]})]})}function O({dir_path:e,on_changed:t}){const{t:s}=(0,c.Bd)(),o=(0,d.Zp)(),[r,h]=(0,a.useState)([]),[_,g]=(0,a.useState)([]),[p,f]=(0,a.useState)("none"),[x,j]=(0,a.useState)(""),[N,v]=(0,a.useState)(""),[y,b]=(0,a.useState)(!1);(0,a.useEffect)(()=>{w(),k()},[e]);const w=async()=>{try{const t=await i.TU.post("repos",{path:e});0===t.code&&h(t.data||[])}catch(e){}},k=async()=>{try{const t=await i.TU.post("dirs",{path:e});0===t.code&&g(t.data?.dirs||[])}catch(e){}},S=async()=>{const a=x.trim();if(a){b(!0);try{const c=await i.TU.post("init",{path:`${e}/${a}`.replace(/\/+/g,"/")});0===c.code?((0,n.SK)(s("仓库初始化成功")),f("none"),j(""),await w(),await k(),t()):(0,n.zN)(c.message)}catch(e){(0,n.zN)(e?.message)}finally{b(!1)}}else(0,n.zN)(s("请输入目录名"))},C=async()=>{const a=x.trim();if(a)if(N.trim()){b(!0);try{const c=await i.TU.post("clone",{target:`${e}/${a}`.replace(/\/+/g,"/"),url:N.trim()});0===c.code?((0,n.SK)(s("克隆成功")),f("none"),j(""),v(""),await w(),await k(),t()):(0,n.zN)(c.message)}catch(e){(0,n.zN)(e?.message)}finally{b(!1)}}else(0,n.zN)(s("请输入仓库地址"));else(0,n.zN)(s("请输入目录名"))};return(0,u.jsxs)("div",{className:"git-repo-manager",children:[(0,u.jsxs)("div",{className:"git-repo-manager__header",children:[(0,u.jsxs)("span",{className:"git-sub-panel__title",children:[s("仓库")," (",r.length,")"]}),(0,u.jsx)(l.rA,{icon:"add",title:s("初始化仓库"),selected:"init"===p,onClick:()=>{f("init"===p?"none":"init"),j("")}}),(0,u.jsx)(l.rA,{icon:"cloud_download",title:s("克隆仓库"),selected:"clone"===p,onClick:()=>{f("clone"===p?"none":"clone"),j("")}})]}),"none"!==p&&(0,u.jsxs)("div",{className:"git-sub-panel__form",children:[(0,u.jsx)("input",{className:"input input--block",autoFocus:!0,value:x,placeholder:s("目录名"),onChange:e=>j(e.target.value),onKeyDown:e=>"Enter"===e.key&&("init"===p?S():C())}),"clone"===p&&(0,u.jsx)("input",{className:"input input--block",value:N,placeholder:s("仓库地址"),onChange:e=>v(e.target.value),onKeyDown:e=>"Enter"===e.key&&C()}),(0,u.jsxs)("div",{className:"git-sub-panel__form-actions",children:[(0,u.jsx)("span",{className:"git-sub-panel__hint",children:`${e}/${x||"..."}`.replace(/\/+/g,"/")}),(0,u.jsx)(l.rA,{icon:"check",title:s("保存"),onClick:"init"===p?S:C}),(0,u.jsx)(l.rA,{icon:"close",title:s("取消"),onClick:()=>{f("none"),j(""),v("")}})]}),_.length>0&&(0,u.jsx)("div",{className:"git-repo-manager__dirs",children:_.map(e=>(0,u.jsx)("span",{className:"git-repo-manager__dir",onClick:()=>j(e),children:e},e))})]}),(0,u.jsxs)("div",{className:"git-sub-panel__list",children:[0===r.length&&(0,u.jsx)("div",{className:"git-change-empty",children:s("当前目录下没有仓库")}),r.map(t=>(0,u.jsxs)("div",{className:"git-sub-item",children:[(0,u.jsx)("span",{className:"git-sub-item__name",title:t.name,children:t.name}),(0,u.jsx)("span",{className:"git-sub-item__meta",children:t.branch}),(0,u.jsx)("span",{className:"git-sub-item__ops",children:(0,u.jsx)(l.rA,{icon:"login",title:s("进入"),onClick:()=>{return s=t,void o(`${m.o.git_page}/${e}/${s.name}/`.replace(/\/+/g,"/"));var s}})})]},t.path))]})]})}const L=100;function Z(){const{t:e}=(0,c.Bd)(),t=(0,z.y)(),s=(0,z.y)(),g=(0,d.Zp)();let p=(0,h.GG)(m.o.git_page,(0,h.vX)());for(let e=0;e<3;e++){let e;try{e=decodeURIComponent(p)}catch{break}if(e===p)break;p=e}p=p.replace(/\/+$/,"");const[f,x]=(0,a.useState)([]),[j,N]=(0,a.useState)([]),[v,y]=(0,a.useState)(!1),[w,k]=(0,a.useState)(!1),A=(0,a.useRef)(!1),[U,R]=(0,a.useState)({current:"",branches:[]}),[Z,q]=(0,a.useState)(""),[G,V]=(0,a.useState)(new Set),[X,J]=(0,a.useState)("status"),[Q,Y]=(0,a.useState)(!1),[ee,te]=(0,a.useState)(20),[se,ae]=(0,a.useState)(!1),ie=(0,a.useRef)(null),ne=(0,a.useRef)(null),[ce,le]=(0,a.useState)(null),[oe,re]=(0,a.useState)("unified"),[de,he]=(0,a.useState)({name:"",email:""}),[me,_e]=(0,a.useState)(null),[ge,pe]=(0,a.useState)(0),[ue,fe]=(0,a.useState)(null),[xe,je]=(0,a.useState)(null),[Ne,ve]=(0,a.useState)(!1);(0,a.useEffect)(()=>{p&&be().then(e=>{e&&(we(),ke(),Se(),Ce(),ye())})},[p]);const ye=async()=>{try{const e=await i.TU.post("conflicts",{path:p});0===e.code&&pe((e.data?.files||[]).length)}catch(e){}},be=async()=>{try{Y(!0);const e=await i.TU.post("status",{path:p});return 0===e.code&&(x(e.data||[]),ve(!1),!0)}catch(e){const t="string"==typeof e?e:e?.message;return t&&t.includes("not a git repository")&&ve(!0),!1}finally{Y(!1)}},we=async()=>{try{const e=await i.TU.post("log",{path:p,maxCount:L,skip:0});if(0===e.code){const t=e.data||[];N(t),y(t.length>=L)}}catch(e){}},ke=async()=>{try{const e=await i.TU.post("branches",{path:p});0===e.code&&R(e.data||{current:"",branches:[]})}catch(e){}},Se=async()=>{try{const e=await i.TU.post("get_user_config",{path:p});0===e.code&&he(e.data)}catch(e){}},Ce=async()=>{try{const e=await i.TU.post("get_proxy",{path:p});0===e.code&&_e(e.data)}catch(e){}},ze=async(t,s)=>{t.untracked?(0,n.zN)(e("未跟踪文件无差异")):le({kind:"working",path:t.path,staged:s})},Ae=async t=>{try{Y(!0);const s=await i.TU.post("discard",{path:p,files:t});0===s.code?((0,n.SK)(e("discarded")),"working"===ce?.kind&&t.some(e=>e.path===ce.path)&&le(null),await be()):(0,n.zN)(s.message)}catch(e){(0,n.zN)(e?.message)}finally{Y(!1)}},$e=async()=>{const e=f.filter(e=>!e.staged);try{Y(!0);const t=await i.TU.post("add",{path:p,files:e.map(e=>e.path)});if(0!==t.code)return void(0,n.zN)(t.message)}catch(e){return void(0,n.zN)(e?.message)}finally{Y(!1)}await Ue(!1)},Ue=async t=>{try{Y(!0);const s=await i.TU.post("commit",{path:p,message:Z.trim(),allChanged:t});0===s.code?((0,n.SK)(e("提交成功")),q(""),le(null),await be(),we()):(0,n.zN)(s.message)}catch(e){(0,n.zN)(e?.message)}finally{Y(!1)}},Te=async(t=!1)=>{try{Y(!0);const s=await i.TU.post("push",{path:p,force:t});0===s.code?(0,n.SK)(e("推送成功")):(0,n.zN)(s.message)}catch(e){(0,n.zN)(e?.message)}finally{Y(!1)}},Ke=async()=>{le(null),await be(),we(),ke()},Ee=(0,a.useCallback)(_.throttle(e=>{const t=parseFloat(getComputedStyle(ne.current).fontSize),s=window.innerWidth/t-4,a=e.clientX/t,i=2.25+ie.current.offsetWidth/t;a<=s&&a>=i&&te(parseFloat(a.toFixed(2)))},32),[]),Be=()=>{ae(!1),ne.current.removeEventListener("pointermove",Ee)},Fe=p.split("/").filter(Boolean).pop()||p;return(0,u.jsxs)("div",{className:"studio",children:[(0,u.jsx)(r.A,{ignore_tags:!0,left_children:[(0,u.jsx)(l.rA,{title:e("取消"),icon:"close",onClick:()=>g(-1)},"close"),(0,u.jsx)("span",{children:Fe},"title")],children:(0,u.jsx)(l.rA,{icon:"refresh",title:e("刷新"),onClick:()=>{be(),we(),ke(),Se(),Ce()}})}),Ne?(0,u.jsx)("div",{className:"studio-body",children:(0,u.jsx)("div",{className:"studio-editor",children:(0,u.jsx)("div",{className:"git-main",children:(0,u.jsx)("div",{className:"git-card",children:(0,u.jsx)(O,{dir_path:p,on_changed:()=>{ve(!1),be(),we(),ke()}})})})})}):(0,u.jsxs)("div",{className:"studio-body",ref:ne,children:[(0,u.jsxs)("div",{className:"studio-nav studio-nav--git",style:{width:ee-1+"em"},children:[(0,u.jsx)("div",{className:"menu git-menu not-select-div",children:(0,u.jsx)("div",{className:"wrapper",children:(0,u.jsxs)("ul",{children:[(0,u.jsxs)("li",{className:"status"===X?"active":"",onClick:()=>J("status"),children:[e("变更")," (",f.length,")"]}),(0,u.jsxs)("li",{className:"log"===X?"active":"",onClick:()=>J("log"),children:[e("提交记录")," (",j.length,")"]})]})})}),"status"===X&&(0,u.jsx)("div",{className:"git-scroll",children:(0,u.jsx)(b,{files:f,selected:G,on_toggle:e=>{const t=new Set(G);t.has(e)?t.delete(e):t.add(e),V(t)},on_toggle_all:(e,t)=>{const s=new Set(G);for(const a of e)t?s.add(a):s.delete(a);V(s)},active_path:"working"===ce?.kind?ce.path:null,on_view_diff:ze,on_stage_section:async(t,s)=>{if(0===t.length)return;const a=t.map(e=>e.path);try{const t=s?await i.TU.post("reset",{path:p,files:a}):await i.TU.post("add",{path:p,files:a});0===t.code?((0,n.SK)(e(s?"已取消暂存":"已暂存")),await be()):(0,n.zN)(t.message)}catch(e){(0,n.zN)(e?.message)}},on_stage_one:async(e,t)=>{try{const s=t?await i.TU.post("reset",{path:p,files:[e.path]}):await i.TU.post("add",{path:p,files:[e.path]});0===s.code?(await be(),"working"===ce?.kind&&ce.path===e.path&&ze(e,!t)):(0,n.zN)(s.message)}catch(e){(0,n.zN)(e?.message)}},on_view_blame:e=>{le({kind:"blame",file:e.path})},on_discard_one:(t,a)=>{s({title:e("discard"),sub_title:t.untracked?e("discard_untracked_tip"):e("discard_modified_tip"),confirm_fun:()=>Ae([{path:t.path,staged:a,untracked:t.untracked}])})},on_discard_selected:()=>{const t=f.filter(e=>G.has(e.path));0!==t.length&&s({title:e("discard"),sub_title:e("discard_selected_tip",{n:t.length}),confirm_fun:()=>Ae(t.map(e=>({path:e.path,staged:e.staged,untracked:e.untracked})))})}})}),"log"===X&&(0,u.jsx)("div",{className:"git-scroll",children:(0,u.jsx)(C,{dir_path:p,entries:ue??j,is_search:null!==ue,has_more:v,loading_more:w,active_hash:"commit"===ce?.kind?ce.hash:null,on_select:e=>{le({kind:"commit",hash:e})},on_scroll_bottom:e=>{if(null!==ue)return;const t=e.currentTarget;t.scrollHeight-t.scrollTop-t.clientHeight<200&&(async()=>{if(!A.current&&v){A.current=!0,k(!0);try{const e=await i.TU.post("log",{path:p,maxCount:L,skip:j.length});if(0===e.code){const t=e.data||[];N(e=>[...e,...t]),y(t.length>=L)}}catch(e){}finally{A.current=!1,k(!1)}}})()},on_search_result:e=>{fe(e),null===e&&we()}})})]}),(0,u.jsx)("div",{className:"studio__divider",ref:ie,onPointerDown:()=>{ae(!0),ne.current.addEventListener("pointermove",Ee)},onPointerUp:Be}),se&&(0,u.jsx)("div",{className:"shell__overlay",onPointerUp:Be}),(0,u.jsx)("div",{className:"studio-editor",children:(0,u.jsxs)("div",{className:"git-main",children:[(0,u.jsx)(P,{dir_path:p,on_resolved:Ke}),(0,u.jsxs)("div",{className:"git-card",children:[(0,u.jsx)(K,{current:U.current,branches:U.branches,on_checkout:async t=>{try{Y(!0);const s=await i.TU.post("checkout",{path:p,branch:t});0===s.code?((0,n.SK)(e("切换分支成功")),await Ke()):(0,n.zN)(s.message)}catch(e){(0,n.zN)(e?.message)}finally{Y(!1)}},on_create:async t=>{try{Y(!0);const s=await i.TU.post("branch_create",{path:p,name:t});0===s.code?((0,n.SK)(e("分支创建成功")),await Ke()):(0,n.zN)(s.message)}catch(e){(0,n.zN)(e?.message)}finally{Y(!1)}},on_delete:async(t,s)=>{try{Y(!0);const a=await i.TU.post("branch_delete",{path:p,name:t,force:s});0===a.code?((0,n.SK)(e("分支删除成功")),await Ke()):(0,n.zN)(a.message)}catch(e){(0,n.zN)(e?.message)}finally{Y(!1)}},on_merge:async t=>{try{Y(!0);const s=await i.TU.post("merge",{path:p,branch:t});0===s.code?((0,n.SK)(e("合并成功")),await Ke()):(0,n.zN)(s.message)}catch(e){(0,n.zN)(e?.message)}finally{Y(!1)}},ahead:xe?.ahead,behind:xe?.behind}),(0,u.jsx)(I,{dir_path:p,current_branch:U.current,on_checkout:Ke,on_compare:e=>le({kind:"remote",branch:e})}),(0,u.jsx)(o.Z2,{placeholder:e("git_msg"),value:Z,onChange:e=>q(e.target.value),rows:3}),(0,u.jsxs)("div",{className:"git-btn-row",children:[(0,u.jsx)(l.rA,{icon:"check",title:e("提交"),onClick:async()=>{if(!Z.trim())return void(0,n.zN)(e("请输入提交信息"));if(0===f.filter(e=>e.staged).length){return 0===f.filter(e=>!e.staged).length?void(0,n.zN)(e("没有可提交的更改")):void t({title:e("提交"),sub_title:e("存在未暂存的改动,是否一并暂存并提交?"),confirm_fun:$e})}await Ue(!1)}}),(0,u.jsx)(l.rA,{icon:"edit_note",title:e("修改最后一次提交"),onClick:async()=>{try{Y(!0);const t=await i.TU.post("commit_amend",{path:p,message:Z});0===t.code?((0,n.SK)(e("已修改最后一次提交")),q(""),le(null),await be(),we()):(0,n.zN)(t.message)}catch(e){(0,n.zN)(e?.message)}finally{Y(!1)}}}),(0,u.jsx)(l.rA,{icon:"download",title:e("拉取"),onClick:async()=>{try{Y(!0);const t=await i.TU.post("pull",{path:p});0===t.code?((0,n.SK)(e("拉取成功")),await be(),we()):(0,n.zN)(t.message)}catch(e){(0,n.zN)(e?.message)}finally{Y(!1)}}}),(0,u.jsx)(l.rA,{icon:"upload",title:e("推送"),onClick:()=>Te(!1)}),(0,u.jsx)(l.rA,{icon:"keyboard_double_arrow_up",title:e("强制推送"),onClick:()=>Te(!0)}),(0,u.jsx)("span",{className:"git-btn-gap"}),(0,u.jsx)(l.rA,{icon:"inventory_2",title:e("暂存工作区"),onClick:async()=>{try{const t=await i.TU.post("stash",{path:p});0===t.code?((0,n.SK)(e("暂存工作区成功")),le(null),await be()):(0,n.zN)(t.message)}catch(e){(0,n.zN)(e?.message)}}}),(0,u.jsx)(l.rA,{icon:"unarchive",title:e("恢复工作区"),onClick:async()=>{try{const t=await i.TU.post("stash_pop",{path:p});0===t.code?((0,n.SK)(e("恢复工作区成功")),await be()):(0,n.zN)(t.message)}catch(e){(0,n.zN)(e?.message)}}})]}),(0,u.jsx)(F,{dir_path:p,on_changed:Ke}),(0,u.jsx)(B,{dir_path:p,target_hash:"commit"===ce?.kind?ce.hash:void 0,on_changed:Ke}),(0,u.jsx)(D,{dir_path:p,on_changed:Ke})]}),ce?"commit"===ce.kind?(0,u.jsx)($,{dir_path:p,hash:ce.hash,on_close:()=>le(null),on_changed:Ke}):"blame"===ce.kind?(0,u.jsx)(T,{dir_path:p,file:ce.file,on_close:()=>le(null)}):"remote"===ce.kind?(0,u.jsx)(M,{dir_path:p,branch:ce.branch,current_branch:U.current,on_close:()=>le(null)}):(0,u.jsxs)("div",{className:"git-card git-card--diff",children:[(0,u.jsxs)("div",{className:"git-diff-header",children:[(0,u.jsx)("span",{className:"git-diff-header__badge",children:ce.staged?e("已暂存"):e("未暂存")}),(0,u.jsx)("span",{className:"git-diff-header__path",title:ce.path,children:ce.path}),(0,u.jsxs)("div",{className:"git-diff-header__modes",children:[(0,u.jsx)(l.rA,{icon:"view_agenda",title:e("单栏"),selected:"unified"===oe,onClick:()=>re("unified")}),(0,u.jsx)(l.rA,{icon:"view_column",title:e("并排"),selected:"split"===oe,onClick:()=>re("split")}),(0,u.jsx)(l.rA,{icon:"close",title:e("关闭"),onClick:()=>le(null)})]})]}),ce.staged?(0,u.jsx)(S,{dir_path:p,file:ce.path,left_ref:"HEAD",right_ref:"staged",mode:oe}):(0,u.jsx)(S,{dir_path:p,file:ce.path,left_ref:"HEAD",right_ref:"worktree",mode:oe})]}):(0,u.jsx)("div",{className:"git-card git-card--placeholder",children:e("点击左侧文件查看差异")}),(0,u.jsxs)("div",{className:"git-card",children:[(0,u.jsx)(E,{dir_path:p,user_config:de,proxy_config:me,on_user_config_saved:he,on_proxy_saved:_e}),(0,u.jsx)(H,{dir_path:p,on_info_loaded:je,on_changed:Ke}),(0,u.jsx)(W,{dir_path:p})]})]})})]})]})}}}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[2334],{72458(e,t,n){function i(e,t){let n=function(e){let t="\\";for(const n of e)if("/"===n||"\\"===n){t=n;break}return t}(e);if("."===t)return e;if(".."===t){if(e.length>1){let t=e[e.length-1]===n?1:0;for(let i=e.length-1-t;i>=0;i--)if(e[i]===n)return e.substring(0,i+1)}return e}return e.endsWith(n)&&t.startsWith(n)?e.slice(0,-1)+t:e.endsWith(n)||t.startsWith(n)?e+t:e+n+t}n.d(t,{Jn:()=>i,Z1:()=>s});function s(e){if("string"!=typeof e||0===e.length)return!1;return/^[a-zA-Z]:[\\\/]/.test(e)||/^\\\\[^\\/]+[\\/]/.test(e)||/^\//.test(e)}},47374(e,t,n){n.d(t,{e:()=>f});var i=n(96540),s=n(52671),o=n(64694),a=n(34289),l=n(61443),r=n(75725),c=n(22022),d=n(85997),_=n(74848);function f(e){let t=(0,s.zy)();const n=(0,s.Zp)(),[f,p]=(0,i.useState)([]),[u,h]=(0,i.useState)("/"),[m,w]=(0,i.useState)(void 0),{t:v,i18n:g}=(0,c.Bd)();i.useEffect(()=>{let t="",n=(0,a.vX)().split("/");n=n.filter(e=>e);const i=n.indexOf(e.baseRoute),s=[];if(-1!=i){t=(0,o.IO)(n.slice(0,i),e.baseRoute);const a=n.slice(i+1);for(let e=0;e<a.length;e++){const n=a[e];s.push({value:n,href:0===e?`${t}${n}/`:(0,o.IO)(s[e-1].href,n)})}h(t),p(s)}},[t]);const x=t=>{t.stopPropagation(),e.clickFun(t)},[y,j]=(0,i.useState)(0),k=(0,i.useRef)(null),G=(0,i.useRef)(null),A=()=>{const e=k.current,t=G.current;if(!e||!t)return;const n=[];for(const e of Array.from(t.children))n.push(e.getBoundingClientRect().width);const i=e.clientWidth;if(n.reduce((e,t)=>e+t,0)<=i||n.length<=2)return void j(e=>0===e?e:0);let s=n[0]+48,o=0;for(let e=n.length-1;e>=1&&!(s+n[e]>i);e--)s+=n[e],o++;const a=Math.max(n.length-1-o,0);j(e=>e===a?e:a)};(0,i.useEffect)(()=>{A();const e=new ResizeObserver(A);return k.current&&e.observe(k.current),()=>e.disconnect()},[f,u,t]),(0,i.useEffect)(()=>{const e=k.current;e&&0!==y&&e.scrollWidth>e.clientWidth&&y<f.length-1&&j(e=>e+1)});const b=y>0?1+y:1,C=y>0?f.slice(1,b):[],[N,S]=(0,i.useState)(null);return(0,i.useEffect)(()=>{S(null)},[t,y]),(0,_.jsxs)("div",{className:"breadcrumbs",ref:k,onClick:e=>{w(void 0!==m?void 0:"")},children:[(0,_.jsx)(i.Fragment,{children:void 0===m?(0,_.jsxs)(i.Fragment,{children:[(0,_.jsx)("span",{className:"chevron",children:(0,_.jsx)(s.N_,{to:u,onClick:x,children:(0,_.jsx)(d.In,{icon:"home"})})}),f.map((e,t)=>y>0&&t>=1&&t<b?1!==t?null:(0,_.jsxs)("span",{className:"chevron",children:[(0,_.jsx)(d.In,{icon:"keyboard_arrow_right"}),(0,_.jsx)("span",{className:"breadcrumbs-fold-dot",onClick:e=>{e.stopPropagation();const t=e.currentTarget.getBoundingClientRect();S({x:t.left,y:t.bottom})},children:"..."})]},"fold"):(0,_.jsxs)("span",{className:"chevron",children:[(0,_.jsx)(d.In,{icon:"keyboard_arrow_right"}),(0,_.jsx)(s.N_,{to:e.href,onClick:x,children:decodeURIComponent(e.value)})]},t)),(0,_.jsxs)("div",{className:"breadcrumbs-measure",ref:G,"aria-hidden":!0,children:[(0,_.jsx)("span",{className:"chevron",children:(0,_.jsx)(s.N_,{to:u,children:(0,_.jsx)(d.In,{icon:"home"})})}),f.map((e,t)=>(0,_.jsxs)("span",{className:"chevron",children:[(0,_.jsx)(d.In,{icon:"keyboard_arrow_right"}),(0,_.jsx)(s.N_,{to:e.href,children:decodeURIComponent(e.value)})]},t))]})]}):(0,_.jsx)(r.QM,{click:()=>{w(void 0)},children:(0,_.jsx)(l.Sm,{width:"100%",placeholder:v("输入跳转的目录"),handlerEnter:t=>{e.input_path_enter&&e.input_path_enter(t),w(void 0)}})})}),N&&(0,_.jsx)(r.rY,{click:()=>S(null),children:(0,_.jsx)(r.sw,{x:N.x,y:N.y,items:C.map(e=>({r:decodeURIComponent(e.value),v:e.href})),click:e=>{S(null),n(e)}})})]})}},77481(e,t,n){n.d(t,{S:()=>l,X:()=>a});var i=n(96540),s=n(61443),o=n(74848);function a(e){const[t,n]=i.useState([]),a=(0,i.useRef)(-1),[l,r]=(0,i.useState)(-1),[c,d]=(0,i.useState)(-1);(0,i.useEffect)(()=>{e.children?n(Array.isArray(e.children)?e.children:[e.children]):n(e.rows)},[e.rows,e.children]);const _=()=>{a.current=-1,r(-1),d(-1)};return(0,o.jsxs)("table",{children:[(0,o.jsx)("thead",{children:(0,o.jsx)("tr",{children:e.headers?.map((t,n)=>{const i=!!e.filter&&(e.filter.column??0)===n;let a=t;if(i){const n=e.filter,i=n.options.find(e=>e.value===n.value);null!=n.value&&i&&(a=`${t} (${i.label})`)}return(0,o.jsx)("th",{className:i?"table-filter-col":"",children:i?(0,o.jsx)(s.l6,{value:e.filter.value,options:e.filter.options,onChange:e.filter.onChange,bare:!0,trigger_label:a}):t},n)})})}),(0,o.jsx)("tbody",{children:t.map((t,n)=>{const i=!!e.onRowDrag;return(0,o.jsx)("tr",{className:i?(l===n?"row-dragging":"")+(c===n?" row-drop-target":""):"",draggable:i,onContextMenu:()=>{e.handleContextMenu&&e.handleContextMenu(t)},onDragStart:e=>{i&&(a.current=n,r(n),e.dataTransfer.effectAllowed="move")},onDragOver:e=>{!i||a.current<0||(e.preventDefault(),e.dataTransfer.dropEffect="move",d(n))},onDrop:t=>{i&&(t.preventDefault(),(()=>{const t=a.current,n=c;_(),t<0||n<0||t===n||e.onRowDrag?.(t,n)})())},onDragEnd:_,children:t.map((n,i)=>{const s=i===t.length-1?"small":"";return(0,o.jsx)("td",{className:s,style:{width:e.width??"auto"},children:n},i)})},n)})})]})}function l(e){return(0,o.jsx)("div",{style:{display:e.isFlex?"flex":"block"},children:e.columns.map((e,t)=>(0,o.jsx)("div",{children:e},t))})}},62334(e,t,n){n.r(t),n.d(t,{default:()=>J});var i=n(96540),s=n(47374),o=n(34843),a=n(52035),l=n(82893),r=n(14284),c=n(52671),d=n(4412),_=n(78150),f=n(34289),p=n(53459),u=n(99214),h=n(61443),m=n(47022),w=n(62042),v=n(22022),g=n(7523),x=n(78247),y=n(88815),j=n(6960),k=n(47071),G=n(14944),A=n(92275),b=n(23430),C=n(72458),N=n(34251),S=n(60096),M=n(87361),$=n(97952),z=n(85997),I=n(77481),E=n(70447),D=n(74848);const F=500;function P(e){const{t}=(0,v.Bd)(),n=(0,c.Zp)(),[,s]=(0,o.fp)(l.AG.prompt_card),[a,r]=(0,i.useState)(""),[d,_]=(0,i.useState)(!1),[f,p]=(0,i.useState)([]),[u,m]=(0,i.useState)(0),[w,g]=(0,i.useState)(!1),x=(0,i.useMemo)(()=>new $.I(window.location.host,"file_deep_search"),[]),y=(0,i.useRef)(!1),j=decodeURIComponent(e.base_path);(0,i.useEffect)(()=>{let e=[],t=null;const n=()=>{if(t=null,y.current||!e.length)return;const n=e;e=[],m(e=>e+n.length),p(e=>e.length>=F?e:[...e,...n].slice(0,F))},i=()=>{y.current||_(!1)};return x.addMsg(A.HK.file_deep_search_data,i=>{y.current||(e.push(...i.context??[]),null===t&&(t=setTimeout(n,100)))}),x.addMsg(A.HK.file_deep_search_end,()=>{y.current||(n(),_(!1))}),x.on_message("close",i),()=>{y.current=!0,clearTimeout(t),x.sendData(A.HK.file_deep_search_cancel,{}).catch(()=>{}),x.off_message("close",i),x.close()}},[]);const k=()=>{const t=a.trim();if(!t||d)return;p([]),m(0),g(!0),_(!0);const n={param_path:e.base_path,keyword:t};x.sendData(A.HK.file_deep_search,n).catch(()=>{})},G=e=>{let t=e.is_dir?e.path:e.path.slice(0,e.path.lastIndexOf("/")+1);t.endsWith("/")||(t+="/"),s({open:!1}),n(M.o.file+t.split("/").map(encodeURIComponent).join("/"))};return(0,D.jsxs)("div",{className:"file-deep-search",children:[(0,D.jsxs)("div",{className:"file-deep-search__bar",children:[(0,D.jsx)(h.$Z,{icon:"search",value:a,placeholder:t("搜文件名"),handleInputChange:e=>r(e),handleEnterPress:k}),(0,D.jsx)("button",{className:"button button--flat",onClick:d?()=>{x.sendData(A.HK.file_deep_search_cancel,{}).catch(()=>{}),_(!1)}:k,children:t(d?"取消":"搜索")})]}),(0,D.jsxs)("div",{className:"file-deep-search__hint",children:[(0,D.jsxs)("span",{children:[t("范围"),":",j]}),u>0&&(0,D.jsx)("span",{className:"file-deep-search__count",children:u>F?`${t("已显示")} 500 / ${u}`:`${u}`})]}),(0,D.jsxs)("div",{className:"file-deep-search__body",children:[f.length>0&&(0,D.jsx)(I.X,{headers:[t("名称"),t("路径"),""],rows:f.map(e=>{const n=e.path.slice(0,e.path.lastIndexOf("/")+1);return[e.is_dir?(0,D.jsx)("span",{className:"file-deep-search__dir",children:e.name}):e.name,(0,D.jsx)(E.xP,{context:n}),(0,D.jsx)(z.rA,{icon:"folder_open",title:t("打开所在目录"),onClick:()=>G(e)})]})}),d&&(0,D.jsxs)("div",{className:"file-deep-search__empty",children:[(0,D.jsx)("span",{className:"chat-session-running",title:t("搜索中")}),t("搜索中")]}),!d&&u>F&&(0,D.jsx)("div",{className:"file-deep-search__more",children:t("结果过多")}),!d&&0===f.length&&(0,D.jsx)("div",{className:"file-deep-search__empty",children:t(w?"无匹配":"输入后搜")})]})]})}var R=n(64694),X=n(23496),K=n(12730),L=n(75725),U=n(40505);let H={};function Z(){const{t:e}=(0,v.Bd)();let t=(0,c.zy)();const n=(0,c.Zp)(),{check_user_auth:s}=(0,x.MH)(),[a,d]=(0,o.fp)(l.AG.nowFileList),[p,h]=(0,o.fp)(l.AG.uploadFiles),[y,j]=(0,o.fp)(l.AG.showPrompt),[k,C]=(0,o.fp)(l.AG.selectedFileList),[S,$]=(0,o.fp)(l.AG.copyedFileList),[I,F]=(0,o.fp)(l.AG.cutedFileList),[P,X]=(0,o.fp)(l.AG.selectedFileList),[U,Z]=(0,o.fp)(l.AG.clickFileList),[B,Y]=(0,o.fp)(l.AG.fileShellShow),O=(0,u.Cf)(),[W,T]=(0,o.fp)(l.AG.file_root_list),[V,q]=(0,o.fp)(l.AG.file_root_index),[J,Q]=(0,i.useState)(void 0),[ee,te]=(0,i.useState)(""),[ne,ie]=(0,o.fp)(l.AG.workflow_show),[se,oe]=(0,o.fp)(l.AG.workflow_realtime_show),[ae,le]=(0,o.fp)(l.AG.work_flow_show),{initUserInfo:re}=(0,i.useContext)(g.F),[ce,de]=(0,o.fp)(l.AG.user_base_info),{click_file:_e}=(0,u.kZ)(),[fe,pe]=(0,o.fp)(l.AG.prompt_card),ue=(0,i.useMemo)(()=>a.files.reduce((e,t)=>e+(t.type!==m.Iw.folder?1:0),0),[a]),he=(0,i.useMemo)(()=>a.files.reduce((e,t)=>e+(t.type===m.Iw.folder?1:0),0)+(a.folders?.length??0),[a]);function me(e){(0,w.SK)(e)}(0,i.useEffect)(()=>{H={}},[t]),(0,i.useEffect)(()=>()=>{Y({show:!1,path:""})},[]);const we=(0,u.Vs)(),ve=t=>{pe({open:!0,title:e("信息"),context_div:(0,D.jsxs)("div",{style:{maxWidth:"25rem"},children:[(0,D.jsx)(L.Yh,{left:e("挂载位置磁盘"),right:t?.total_size}),(0,D.jsx)(L.Yh,{left:`${e("磁盘剩余")}`,right:t?.left_size}),(0,D.jsx)(L.Yh,{left:`${e("文件系统")}`,right:t?.fs_type}),(0,D.jsx)(L.Yh,{left:`${e("文件夹数")}`,right:he}),(0,D.jsx)(L.Yh,{left:`${e("文件数")}`,right:ue}),(0,D.jsx)(L.Yh,{left:`${e("当前位置")}`,right:(0,D.jsx)(E.xP,{context:t?.now_absolute_path})})]}),cancel:()=>{G.ws.removeMsg(A.HK.file_info)}})};return(0,D.jsxs)(i.Fragment,{children:[k.length>0&&(0,D.jsx)(z.rA,{icon:"delete",title:e("删除"),onClick:()=>{j({show:!0,type:_.PromptEnum.FilesDelete,overlay:!0,data:{}})}}),k.length>0&&(0,D.jsx)(z.rA,{icon:"content_copy",title:e("复制"),onClick:function(){const e=(0,u.ib)(a,k);$(e.map(e=>(0,u.Ok)(e.name))),F([]),me("已复制")}}),k.length>0&&(0,D.jsx)(z.rA,{icon:"content_cut",title:e("剪切"),onClick:function(){const e=(0,u.ib)(a,k);F(e.map(e=>(0,u.Ok)(e.name))),$([]),me("已剪切")}}),(S.length>0||I.length>0)&&(0,D.jsx)(z.rA,{onClick:function(){j({show:!0,type:_.PromptEnum.Confirm,overlay:!0,data:{}})},icon:"content_paste",title:e("粘贴到此处"),tip:S.length+I.length}),k.length>0&&(0,D.jsx)(z.rA,{icon:"download",title:e("下载"),onClick:function(){const e=(0,u.ib)(a,k);for(let t=0;t<e.length;t++){const n=e[t];e[t]=encodeURIComponent((0,u.Ok)(n.name))}const t=r.$M.getDownloadUrl(e);window.open(t)}}),k.length>0&&(0,D.jsx)(z.rA,{icon:"compress",title:e("压缩"),onClick:function(){const t=(0,u.ib)(a,k);for(let e=0;e<t.length;e++){const n=t[e];t[e]=(0,u.Ok)(n.name)}t&&0!==t.length?j({show:!0,type:_.PromptEnum.Compress,overlay:!0,data:{files:t}}):(0,w.zN)(e("没有选中"))}}),1===k.length&&(0,D.jsx)(z.rA,{icon:"edit_attributes",title:e("重命名"),onClick:function(){j({show:!0,type:_.PromptEnum.FileRename,overlay:!0,data:{}})}}),ae&&(0,D.jsx)(z.rA,{icon:"api",title:"workflow",onClick:()=>{ie(!ne)}}),O.can_terminal&&(0,D.jsx)(z.rA,{icon:"terminal",title:"shell",onClick:function(){B.show?Y({show:!1,path:""}):Y({show:!0,path:(0,f.GG)("file",(0,f.vX)())})}}),s(b.oV.share_file)&&(0,D.jsx)(z.rA,{icon:"share",title:e("文件分享"),onClick:()=>{n(`${M.o.share_list_setting_page}`)}}),(0,D.jsx)(z.rA,{icon:"grid_view",title:e("切换样式"),onClick:we}),(0,D.jsx)(z.rA,{icon:"create_new_folder",title:e("创建文件夹"),onClick:function(){j({show:!0,type:_.PromptEnum.DirNew,overlay:!0,data:{dir:(0,f.GG)("file",(0,f.vX)())}})}}),(0,D.jsx)(z.rA,{icon:"note_add",title:e("创建文本文件"),onClick:function(){j({show:!0,type:_.PromptEnum.FileNew,overlay:!0,data:{dir:(0,f.GG)("file",(0,f.vX)())}})}}),(0,D.jsx)(z.rA,{icon:"upload_file",title:e("上传"),onClick:()=>{j({show:!0,type:_.PromptEnum.UploadFile,overlay:!0,data:{call:e=>{let t=e.currentTarget?.files;if(!t)return;let n=!!t[0].webkitRelativePath;const i=[],s=new Set;for(let e=0;e<t.length;e++){const o=t[e],a=n?o.webkitRelativePath:`${o.webkitRelativePath}${o.name}`;o.fullPath=a,n&&s.add((0,K.S)(a)),i.push(o)}const o=[];if(n)for(const e of s)o.push({isDir:!0,fullPath:e,name:e});o.push(...i),h(o),j({show:!0,type:_.PromptEnum.FilesUpload,overlay:!1,data:{}})}}})}}),(0,D.jsx)(z.rA,{icon:"info",title:e("信息"),onClick:async()=>{let e;if(!H.now_absolute_path){G.ws.addMsg(A.HK.file_info,t=>{const n=t.context;e&&(H={...H,...n},G.ws.removeMsg(A.HK.file_info),ve(H))});const t=await G.ws.sendData(A.HK.file_info,{type:m.Iw.folder,path:(0,f.GG)("file",(0,f.vX)())});e=t.context,H=e,ve(H)}ve(H)}}),(0,D.jsx)(z.rA,{icon:"more_vert",title:e("切换目录"),onClick:t=>{const i=new N.ik;i.x=t.clientX,i.y=t.clientY,i.type=m.Iw.directory,i.items=W,i.item_pre_value=V,i.textClick=async t=>{if(t.type===N.LU.add)return n(`${M.o.setting_private_env_setting}`),j({data:void 0,overlay:!1,type:"",show:!1}),void(0,w.N9)(e("请配置 文件夹路径"));j({data:void 0,overlay:!1,type:"",show:!1}),t.type!==N.LU.child?(async e=>{q(e),await r.$M.post("base_switch",{root_index:e}),await re(),n("/file/"),X([]),Z([])})(t.index):n((0,R.IO)(M.o.file,t.rel))},j({show:!0,type:_.PromptEnum.FileMenu,overlay:!1,data:i})}})]})}var B=n(2543),Y=n(21499);const O=i.lazy(()=>Promise.all([n.e(7856),n.e(6349),n.e(3659)]).then(n.bind(n,63659))),W=i.lazy(()=>Promise.all([n.e(7856),n.e(1636)]).then(n.bind(n,81636))),T=i.lazy(()=>n.e(9857).then(n.bind(n,69857)));let V,q="";function J(){const[e,t]=(0,o.fp)(l.AG.editorSetting),[,n]=(0,o.fp)(l.AG.md_editor),[,w]=(0,o.fp)(l.AG.log_viewer),[,$]=(0,o.fp)(l.AG.image_editor),[,I]=(0,o.fp)(l.AG.markdown),[,E]=(0,o.fp)(l.AG.excalidraw_editor),[,F]=(0,o.fp)(l.AG.mind_editor),[,K]=(0,o.fp)(l.AG.timeline_editor),[,L]=(0,o.fp)(l.AG.excel_editor),[H,J]=(0,o.fp)(l.AG.file_preview),{t:Q}=(0,v.Bd)();let ee=(0,c.zy)();const te=(0,c.Zp)(),[ne,ie]=(0,o.fp)(l.AG.nowFileList),[se]=(0,o.fp)(l.AG.file_list_refresh),[oe]=(0,o.fp)(l.AG.mount_enabled),[ae,le]=(0,o.fp)(l.AG.current_mount),[re,ce]=(0,o.fp)(l.AG.showPrompt),[de,_e]=(0,o.fp)(l.AG.selectedFileList),[fe,pe]=(0,o.fp)(l.AG.clickFileList),[ue,he]=(0,o.fp)(l.AG.fileShellShow),[me,we]=(0,i.useState)(""),[ve,ge]=(0,o.fp)(l.AG.workflow_show),[xe,ye]=(0,o.fp)(l.AG.workflow_realtime_show),[je,ke]=(0,o.fp)(l.AG.work_flow_show),{initUserInfo:Ge}=(0,i.useContext)(g.F),[Ae,be]=(0,o.fp)(l.AG.user_base_info),{check_user_auth:Ce}=(0,x.MH)(),{click_file:Ne}=(0,u.kZ)(),[Se]=(0,c.ok)(),Me=(0,u._A)(),$e=i.useRef(null),[ze,Ie]=(0,o.fp)(l.AG.to_running_files),[Ee,De]=(0,o.fp)(l.AG.file_page),[Fe]=(0,o.fp)(l.AG.blank_search_mode),[,Pe]=(0,o.fp)(l.AG.prompt_card),[Re,Xe]=(0,o.fp)(l.AG.blank_search_mode_for_temp),Ke=(0,u.oT)(),Le="1"===Se.get("chat_open"),Ue=Ce(b.oV.ai_agent_page),He=(0,u.Cf)();(0,i.useEffect)(()=>{Ae?.user_data&&Le&&!Ue&&Ke("chat_open",null)},[Le,Ue,Ae]);const[Ze,Be]=(0,o.fp)(l.AG.studio_chat_width),Ye=i.useRef(null),[Oe,We]=(0,i.useState)(!1),[Te,Ve]=(0,i.useState)(void 0),qe=(0,u.dN)();(0,u.rJ)(qe());const[Je,Qe]=(0,o.fp)(l.AG.ai_chat_session_by_cwd),et=function(){const e=(0,u.Cf)(),[t,n]=(0,o.fp)(l.AG.user_base_info),{t:s}=(0,v.Bd)(),{check_user_auth:a}=(0,x.MH)(),[d,p]=(0,o.fp)(l.AG.router_jump),h=(0,c.Zp)(),{initUserInfo:w}=(0,i.useContext)(g.F),[y,j]=(0,o.fp)(l.AG.nowFileList),[k,C]=(0,o.fp)(l.AG.showPrompt),[S,$]=(0,o.fp)(l.AG.fileShellShow),[z,I]=(0,o.fp)(l.AG.blank_search_mode);return n=>{n.preventDefault(),n.stopPropagation();const i=new N.ik;i.x=n.clientX,i.y=n.clientY,i.type=m.Iw.directory;const o=[{r:(0,D.jsx)("span",{style:(0,U.ok)(t.user_data.dir_show_type===b.t8.time_minx_max),children:s("时间逆序")}),v:b.t8.time_minx_max},{r:(0,D.jsx)("span",{style:(0,U.ok)(t.user_data.dir_show_type===b.t8.time_max_min),children:s("时间顺序")}),v:b.t8.time_max_min}],l=[{r:(0,D.jsx)("span",{style:(0,U.ok)(t.user_data.dir_show_type===b.t8.size_min_max),children:s("大小顺序")}),v:b.t8.size_min_max},{r:(0,D.jsx)("span",{style:(0,U.ok)(t.user_data.dir_show_type===b.t8.size_max_min),children:s("大小逆序")}),v:b.t8.size_max_min}],c=[{r:(0,D.jsx)("span",{style:(0,U.ok)(!t.user_data.file_list_pagination_mode||t.user_data.file_list_pagination_mode===b.yM.all),children:s("全部加载文件")}),v:b.yM.all},{r:(0,D.jsx)("span",{style:(0,U.ok)(t.user_data.file_list_pagination_mode===b.yM.pagination),children:s("scrll_l")}),v:b.yM.pagination}],d=[{r:(0,D.jsx)("span",{style:(0,U.ok)(!t.user_data.file_time_show_type||t.user_data.file_time_show_type===b.KD.current),children:s("最近时间")}),v:b.KD.current},{r:(0,D.jsx)("span",{style:(0,U.ok)(t.user_data.file_time_show_type===b.KD.time),children:s("准确时间")}),v:b.KD.time}],v=[{r:s("文件列表展示"),items:[{r:s("文件排序"),v:"",items:[{r:(0,D.jsx)("span",{style:(0,U.ok)(!t.user_data.dir_show_type),children:s("系统默认")}),v:b.t8.defualt},{r:(0,D.jsx)("span",{style:(0,U.ok)(t.user_data.dir_show_type===b.t8.name),children:s("名字")}),v:b.t8.name},{r:(0,D.jsx)("span",{style:(0,U.ok)(t.user_data.dir_show_type===b.t8.time_minx_max||t.user_data.dir_show_type===b.t8.time_max_min),children:s("修改时间")}),v:!1,items:o},{r:(0,D.jsx)("span",{style:(0,U.ok)(t.user_data.dir_show_type===b.t8.size_min_max||t.user_data.dir_show_type===b.t8.size_max_min),children:s("文件大小")}),v:!1,items:l}]},{r:s("文件加载方式"),v:"",items:c},{r:s("时间展示"),v:"",items:d},{r:s("缩放调整"),v:"zoom_adjust"},{r:(0,D.jsx)("span",{style:(0,U.ok)(z),children:s("srchbln")}),v:"blank_search_mode"}]}];e.git_available&&y?.folders?.find(e=>".git"===e.name)&&v.push({r:s("查看Git提交"),v:"git_page"}),a(b.oV.code_resource)&&v.push({r:s("add_rot"),v:"code_resource"}),a(b.oV.http_proxy)&&v.push({r:s("dl_here"),v:"http_resource"}),t?.user_data?.quick_cmd&&(0,u.LL)([...t.user_data.quick_cmd],v),i.items=v,i.textClick=async e=>{if(console.log(e),!1===e)return;const t={};if("gcfg_dir_config"===e){const e=(0,f.GG)("file",(0,f.vX)());return C({data:void 0,overlay:!1,type:"",show:!1}),void h(`${M.o.gcfg_page}/${encodeURIComponent(e)}`)}if("git_page"===e){const e=(0,f.GG)("file",(0,f.vX)());return C({data:void 0,overlay:!1,type:"",show:!1}),void h(`${M.o.git_page}/${encodeURIComponent(e)}`)}if("code_resource"===e){const e=await G.ws.sendData(A.HK.file_info,{path:(0,f.GG)("file",(0,f.vX)())});return p({page_self_router_api_data:[`/api/${Date.now()}`,e.context.now_absolute_path]}),C({data:void 0,overlay:!1,type:"",show:!1}),void h("/setting/customer_router/")}if("http_resource"===e){const e=await G.ws.sendData(A.HK.file_info,{path:(0,f.GG)("file",(0,f.vX)())});return p({http_download_map_path:e.context.now_absolute_path}),C({data:void 0,overlay:!1,type:"",show:!1}),void h("/proxy/http/")}if("zoom_adjust"===e)return C({data:void 0,overlay:!1,type:"",show:!1}),void setTimeout(()=>{C({show:!0,type:_.PromptEnum.ZoomAdjust,overlay:!1,data:{}})},0);if("object"==typeof e&&"quick_cmd"===e.tag){let t=e.cmd;t&&(t.endsWith("\r")||(t+="\r",$({show:!0,path:(0,f.GG)("file",(0,f.vX)()),cmd:t})))}else{if("blank_search_mode"===e)return I(!z),void C({data:void 0,overlay:!1,type:"",show:!1});if(e===b.yM.all||e===b.yM.pagination)t.is_pagination_mode=!0;else if(e===b.KD.current||e===b.KD.time)t.is_file_show_type=!0;else{if(e!==b.t8.defualt&&e!==b.t8.name&&e!==b.t8.size_max_min&&e!==b.t8.size_min_max&&e!==b.t8.time_max_min&&e!==b.t8.time_minx_max)return;t.is_dir_list_type=!0}}await r.wm.post(X.s.user_save_private_attr,{type:e,...t}),await w(),C({data:void 0,overlay:!1,type:"",show:!1}),h((0,f.vX)())},C({show:!0,type:_.PromptEnum.FileMenu,overlay:!1,data:i})}}(),tt=async e=>{let t=!1;for(const n of e.files??[])n.origin_size=n.size,n.size=(0,y.v7)(n.size),Ae.user_data.file_time_show_type===b.KD.time?n.show_mtime=n.mtime?(0,Y.Yq)(n.mtime):"":n.show_mtime=n.mtime?(0,j.s)(n.mtime):"",t||!n.name.endsWith(".workflow.yml")&&!n.name.endsWith(".act")||(t=!0),n.name===k.SB&&(t=!0);for(const n of e.folders??[])Ae.user_data.file_time_show_type===b.KD.time?n.show_mtime=n.mtime?(0,Y.Yq)(n.mtime):"":n.show_mtime=n.mtime?(0,j.s)(n.mtime):"",n.name===k.SB&&(t=!0);ke(t)},nt=i.useRef(null),it=async e=>{if(!0===oe){if(nt.current!==e){nt.current=e;try{const t=await r.$M.post("file/mount_info",{param_path:e});le(t?.data??null),await G.ws.connect()}catch(e){le(null)}}}else le(null)};(0,i.useEffect)(()=>{je&&(async()=>{const e=new k.Nd,t=(0,a.zp)().get(l.AG.current_mount);e.dir_path=(0,u.Zl)((0,f.GG)("file",(0,f.vX)()),t),G.ws.addMsg(A.HK.workflow_realtime,e=>{const t=e.context;if(e.context){for(const e of t.sucess_file_list)(0,u.Ys)(e);for(const e of t.failed_file_list)(0,u.V$)(e);Ie(new Set(t.running_file_list))}}),await G.ws.sendData(A.HK.workflow_realtime,e)})()},[je,ae,ee]);const st=async()=>{const e=(0,f.GG)("file",(0,f.vX)());if(Fe||Re)return;let t;if(it(e),Ae.user_data.file_list_pagination_mode===b.yM.pagination){if(q!==e){if(q=e,1!==Ee.page_num)return void De({page_size:Ee.page_size,page_num:1})}else if(Ee.page_num<0)return;if(t=await r.$M.post("file_get_page",{param_path:e,page_num:Ee.page_num,page_size:Ee.page_size}),t.code!==p.m.Success)return;const n=t.data;return tt(n),n.files?.length?(ie(e=>{const t=(0,B.cloneDeep)(1===Ee.page_num?n.files:[...e?.files??[],...n.files]),i={...e,files:t};return(0,u.yC)(i,Ae.user_data.dir_show_type),i}),void(V=t.data)):void De({page_size:Ee.page_size,page_num:-1})}if(t=await r.$M.get(e),t.code!==p.m.Success)return;const n=t.data;(0,u.yC)(n,Ae.user_data.dir_show_type),tt(t.data),ie(t.data),V=t.data};(0,i.useEffect)(()=>async()=>{Ie(new Set)},[]);const ot=()=>{ke(!1),(()=>{const e=Se.get("preview_file_name"),t=Se.get("preview_mode");if(!e||!t)return!1;const i=(0,f.GG)("file",(0,f.vX)());if($e.current===i+e)return!0;$e.current=i+e;const s=()=>Me(null);return"md"===t?(n({url:r.$M.getDownloadUrl(`${encodeURIComponent(i)}${e}`),path:`${i}${e}`,name:e,close:s}),!0):"log"===t?(w({show:!0,fileName:e,encoding:Se.get("preview_log_enc")??"utf8",wrap:Se.get("preview_log_wrap")??"wrap",close:s}),!0):"image_edit"===t?($({path:(0,R.IO)((0,f.vX)(),e),name:e,close:s}),!0):(0,N.uL)(e)===m.Iw.url?(Ne({name:e,opt_shell:!0,close:s}),!0):(Ne({name:e,opt_shell:!0,..."text"===t?{model:"text"}:{},close:s}),!0)})()||(t({open:!1}),J({open:!1}),n({}),w({show:!1}),$({}),I({}),E({}),F({}),K({}),L({}),st())};(0,i.useEffect)(()=>{ot()},[ee,Ee]),(0,i.useEffect)(()=>{se>0&&st()},[se]);const at=i.useRef(!1);(0,i.useEffect)(()=>{if(null!==oe)return at.current?void(!0===oe?it((0,f.GG)("file",(0,f.vX)())):le(null)):(at.current=!0,void(!0===oe&&null===ae&&it((0,f.GG)("file",(0,f.vX)()))))},[oe]);const lt=e=>{e.target===e.currentTarget&&(_e([]),pe([]))},rt=i.useCallback((0,B.throttle)(e=>{const t=Ye.current;if(!t||!t.parentElement)return;const n=parseFloat(getComputedStyle(t).fontSize),i=t.parentElement.getBoundingClientRect(),s=i.right-e.clientX,o=Math.min(Math.max(s,320),.7*i.width);Be(parseFloat((o/n).toFixed(2)))},32),[]),ct=()=>{We(!1),document.removeEventListener("pointermove",rt)},dt=(0,D.jsxs)("div",{className:"file-list-main",children:[(0,D.jsx)(s.e,{baseRoute:"file",clickFun:function(){if(_e([]),pe([]),Ae.user_data.file_list_pagination_mode===b.yM.pagination){const e=document.getElementById("listing");e&&(e.scrollTop=0),De({page_size:Ee.page_size,page_num:1})}},input_path_enter:e=>{var t;_e([]),pe([]),ie({files:[],folders:[]}),(0,C.Z1)(e)?(e=e.replace(0===(t=Ae.user_data).folder_item_now||void 0===t.folder_item_now?t.cwd:t.folder_items[t.folder_item_now-1].path,""),te(e)):te((0,C.Jn)((0,f.vX)(),e))}}),ae&&(0,D.jsxs)("div",{className:"mount-tip-bar",style:{borderLeftColor:ae.color},children:[(0,D.jsx)("span",{className:"material-icons",style:{color:ae.color},children:"cloud"}),(0,D.jsx)("span",{children:[{v:ae.driver,t:Q("驱动")},{v:ae.credential_note,t:Q("凭据")},{v:ae.account_note,t:Q("账号")}].filter(e=>Boolean(e.v)).map(e=>`${e.v}(${e.t})`).join(" - ")}),ae.readonly&&(0,D.jsx)("span",{className:"mount-readonly-tag",children:Q("只读")})]}),Ae.user_data.file_list_pagination_mode===b.yM.pagination?(0,D.jsx)(S.$J,{handleContextMenu:et,clickBlank:lt,list:ne.files}):(0,D.jsx)(S.t$,{handleContextMenu:et,file_list:ne.files,folder_list:ne.folders,clickBlank:lt})]});return(0,D.jsxs)(i.Fragment,{children:[(0,D.jsx)(d.aZ,{children:(0,D.jsx)(h.$Z,{handleEnterPress:async()=>{if(Fe||Re){if(_e([]),pe([]),!me||!me.trim())return void ie({files:[],folders:[]});const e=(0,f.GG)("file",(0,f.vX)()),t=await r.$M.post("file_get_page",{param_path:e,page_num:1,page_size:1e4,search:me.trim()});if(t.code!==p.m.Success)return;const n=t.data;return(0,u.yC)(n,Ae.user_data.dir_show_type),tt(n),ie(n),void(V=n)}if(!V)return;_e([]),pe([]);const e=[],t=[];for(const t of V.files??[])t.name.includes(me)&&e.push(t);for(const e of V.folders??[])e.name.includes(me)&&t.push(e);ie({files:e,folders:t})},placeholder:Q("搜索当前目录"),icon:"search",value:"",mobile_hidden:!0,handleIconClick:()=>{const e=(0,f.GG)("file",(0,f.vX)());Pe({open:!0,title:Q("深搜"),context_div:(0,D.jsx)(P,{base_path:e})})},handleInputChange:e=>{we(e)},max_width:"25em"})}),(0,D.jsxs)(d.aZ,{position:"right",children:[Ce(b.oV.ai_agent_page)&&He.ai_chat_available&&(0,D.jsx)(z.rA,{icon:"smart_toy",title:Q("AI 聊天"),selected:Le,onClick:()=>Ke("chat_open",!Le?"1":null)}),(0,D.jsx)("div",{className:"mobile-context-btn",children:(0,D.jsx)(z.rA,{icon:"more_horiz",title:Q("右键"),onClick:()=>{const e=de[de.length-1];if(void 0!==e){const t=[...ne.folders??[],...ne.files??[]][e];if(t){const n=document.querySelectorAll(".item")[e],i=n?n.getBoundingClientRect():{left:window.innerWidth/2,bottom:100},s={preventDefault:()=>{},stopPropagation:()=>{},clientX:i.left+10,clientY:i.bottom??100},o=new N.ik;o.path=(0,R.IO)((0,f.vX)(),t.name),o.filename=t.name,o.x=s.clientX,o.y=s.clientY,o.type=t.type===m.Iw.folder?m.Iw.folder:(0,N.uL)(t.name),o.size=t.origin_size,ce({show:!0,type:_.PromptEnum.FileMenu,overlay:!1,data:o})}}else{const e={preventDefault:()=>{},stopPropagation:()=>{},clientX:window.innerWidth/2,clientY:window.innerHeight/2};et(e)}}})}),(0,D.jsx)(Z,{})]}),(0,D.jsxs)("div",{className:"file-list-split"+(Le?" file-list-split--chat":""),children:[dt,Le&&(0,D.jsxs)(i.Fragment,{children:[(0,D.jsx)("div",{className:"studio__divider studio__divider--chat",ref:Ye,onPointerDown:e=>{e.preventDefault(),We(!0),document.addEventListener("pointermove",rt),document.addEventListener("pointerup",ct,{once:!0})}}),(0,D.jsx)("div",{className:"studio-chat-panel",style:{width:`${Ze}em`},children:(0,D.jsx)(i.Suspense,{fallback:null,children:(0,D.jsx)(T,{inline_header:!0,sync_url:!1,file_cwd_path:qe(),session_id:Te??(_t=qe(),l.AG.get_ai_chat_session(Je,_t)),on_session_change:e=>{Ve(e),((e,t)=>{Qe({...Je,[e]:t})})(qe(),e)}})})})]})]}),Oe&&(0,D.jsx)("div",{className:"shell__overlay",onPointerUp:ct}),ve&&(0,D.jsx)(O,{}),xe.open&&(0,D.jsx)(W,{})]});var _t}}}]);
|