@lemoncat7/dsh-ssh 1.5.1 → 1.5.2

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
@@ -6,7 +6,13 @@
6
6
 
7
7
  ## 兼容性
8
8
 
9
- 版本 `1.5.1` 针对 DeepSeek Harness `0.1.2-rc.1` 构建,需要 Node.js `22.19+` 或 `24+`。Agent、Session/Workspace Controller、Credentials、Tools 与客户端 UI 接口均对应 `0.1.2-rc.1`。
9
+ 版本 `1.5.2` 针对 DeepSeek Harness `0.1.2-rc.1` 构建,需要 Node.js `22.19+` 或 `24+`。Agent、Session/Workspace Controller、Credentials、Tools 与客户端 UI 接口均对应 `0.1.2-rc.1`。
10
+
11
+ ## 1.5.2 连接稳定性修复
12
+
13
+ - SSH 错误监听保留至连接关闭,避免握手超时后的二次错误终止后端进程;同时处理连接取消及握手前关闭。
14
+ - 匿名 FTP 表单明确提交标准用户名 `anonymous`,不携带私人密码。
15
+ - 增加直连与 SOCKS5 无响应握手回归,以及匿名 FTP 新建、重开和修改的浏览器验证。
10
16
 
11
17
  ## 1.5.1 匿名 FTP 登录
12
18
 
package/lib/client.js CHANGED
@@ -5620,7 +5620,7 @@ ${ys(e)}`,children:t})]})]}),S!==void 0&&(0,Be.jsxs)("div",{className:"dsh-ssh-c
5620
5620
  @media (prefers-reduced-transparency: reduce) {
5621
5621
  .dsh-ssh-workspace :is(.dsh-ssh-command-list, .dsh-ssh-forward-list, .dsh-ssh-vault-list, .dsh-ssh-proxy-list, .dsh-ssh-workbench-split) { backdrop-filter: none; -webkit-backdrop-filter: none; background: var(--ssh-surface-raised); }
5622
5622
  }
5623
- `;var _t=require("react"),ot=require("@deepseek-ai/dsh-client-ui-primitives");var xs=require("react"),br=require("@deepseek-ai/dsh-client-ui-primitives"),xe=require("react/jsx-runtime");function Cf({profile:e,project:t,workspaces:s,currentWorkspaceId:r,recentWorkspaceId:o,returnFocus:i,onClose:n,onCreate:a}){let h=s.some(x=>String(x.workspaceId)===r)?r:s.some(x=>String(x.workspaceId)===o)?o:s[0]===void 0?void 0:String(s[0].workspaceId),[l,c]=(0,xs.useState)(h),[f,v]=(0,xs.useState)(!1),[g,d]=(0,xs.useState)(),u=(0,xs.useRef)(null),p=(0,xs.useRef)(null);(0,xs.useEffect)(()=>((u.current??p.current)?.focus(),()=>{i.isConnected&&i.focus()}),[i]);let m=()=>{f||n()},b=async x=>{if(x.preventDefault(),l!==void 0){v(!0),d(void 0);try{await a(t,l)}catch(y){d(Mx(y)),v(!1)}}};return(0,xe.jsx)(br.Modal,{open:!0,onClose:m,title:"\u9009\u62E9\u4F1A\u8BDD\u5F52\u5C5E\u7A7A\u95F4",headless:!0,className:"dsh-ssh-session-create-modal",children:(0,xe.jsxs)("section",{className:"dsh-ssh-session-create-shell",onKeyDown:Ox,children:[(0,xe.jsxs)("header",{children:[(0,xe.jsxs)("span",{children:[(0,xe.jsx)("h2",{children:"\u65B0\u5EFA\u8FDC\u7AEF\u4F1A\u8BDD"}),(0,xe.jsx)("p",{children:"\u9009\u62E9\u8FD9\u4E2A\u4F1A\u8BDD\u5728 DSH \u4E2D\u5F52\u5C5E\u7684\u672C\u5730\u9879\u76EE"})]}),(0,xe.jsx)("button",{ref:p,type:"button",className:"dsh-ssh-icon-button",disabled:f,onClick:m,"aria-label":"\u5173\u95ED",children:(0,xe.jsx)(br.IconCloseOutline16,{size:16})})]}),(0,xe.jsxs)("form",{onSubmit:x=>{b(x)},children:[(0,xe.jsxs)("dl",{className:"dsh-ssh-session-create-target",children:[(0,xe.jsxs)("div",{children:[(0,xe.jsx)("dt",{children:"\u8FDC\u7AEF\u4E3B\u673A"}),(0,xe.jsxs)("dd",{children:[e.name,(0,xe.jsxs)("small",{children:[e.username,"@",e.host,":",e.port]})]})]}),(0,xe.jsxs)("div",{children:[(0,xe.jsx)("dt",{children:"\u8FDC\u7AEF\u5DE5\u4F5C\u76EE\u5F55"}),(0,xe.jsxs)("dd",{children:[t.name,(0,xe.jsx)("small",{title:t.path,children:t.path})]})]})]}),(0,xe.jsxs)("fieldset",{className:"dsh-ssh-workspace-picker",children:[(0,xe.jsx)("legend",{children:"\u4F1A\u8BDD\u5F52\u5C5E\u7A7A\u95F4"}),(0,xe.jsx)("p",{children:"\u4F1A\u8BDD\u8BB0\u5F55\u4FDD\u5B58\u5728\u6240\u9009 DSH \u9879\u76EE\u4E2D\uFF0CSSH \u547D\u4EE4\u4E0E\u7EC8\u7AEF\u56FA\u5B9A\u4F7F\u7528\u4E0A\u9762\u7684\u8FDC\u7AEF\u76EE\u5F55\u3002"}),s.length===0?(0,xe.jsxs)("div",{className:"dsh-ssh-workspace-picker-empty",children:[(0,xe.jsx)(br.IconFolderClose16,{size:18}),(0,xe.jsxs)("span",{children:[(0,xe.jsx)("strong",{children:"\u8FD8\u6CA1\u6709\u53EF\u7528\u7684 DSH \u9879\u76EE"}),(0,xe.jsx)("small",{children:"\u8BF7\u5148\u5173\u95ED\u6B64\u7A97\u53E3\uFF0C\u5728 DSH \u5DE6\u4FA7\u7A7A\u95F4\u4E2D\u65B0\u5EFA\u6216\u6DFB\u52A0\u9879\u76EE\u3002"})]})]}):(0,xe.jsx)("div",{className:"dsh-ssh-workspace-options dsh-ssh-scroll-surface",role:"radiogroup","aria-label":"\u9009\u62E9 DSH \u9879\u76EE",children:s.map(x=>{let y=String(x.workspaceId),S=y===r?"\u5F53\u524D\u9879\u76EE":y===o?"\u6700\u8FD1\u4F7F\u7528":void 0;return(0,xe.jsxs)("label",{className:"dsh-ssh-workspace-option",children:[(0,xe.jsx)("input",{ref:y===h?u:void 0,className:"sr-only",type:"radio",name:"dsh-ssh-session-workspace",value:y,checked:l===y,disabled:f,onChange:()=>c(y)}),(0,xe.jsxs)("span",{children:[(0,xe.jsx)("span",{className:"dsh-ssh-workspace-option-icon",children:(0,xe.jsx)(br.IconFolderClose16,{size:16})}),(0,xe.jsxs)("span",{className:"dsh-ssh-workspace-option-copy",children:[(0,xe.jsx)("strong",{children:x.title}),(0,xe.jsx)("small",{title:x.path,children:x.path})]}),S&&(0,xe.jsx)("em",{children:S}),(0,xe.jsx)("i",{"aria-hidden":"true"})]})]},y)})})]}),g&&(0,xe.jsx)("p",{className:"dsh-ssh-inline-error",role:"alert",children:g}),(0,xe.jsxs)("div",{className:"dsh-ssh-dialog-actions",children:[(0,xe.jsx)("button",{type:"button",className:"dsh-ssh-secondary-button",disabled:f,onClick:m,children:"\u53D6\u6D88"}),(0,xe.jsx)("button",{type:"submit",className:"dsh-ssh-primary-button",disabled:f||l===void 0,children:f?"\u6B63\u5728\u65B0\u5EFA\u2026":"\u65B0\u5EFA\u5E76\u6253\u5F00"})]})]})]})})}function Ox(e){if(e.key!=="Tab")return;let t=Array.from(e.currentTarget.querySelectorAll('button:not(:disabled), input:not(:disabled), a[href], [tabindex]:not([tabindex="-1"])')).filter(o=>o.getClientRects().length>0),s=t[0],r=t[t.length-1];s===void 0||r===void 0||(e.shiftKey&&document.activeElement===s?(e.preventDefault(),r.focus()):!e.shiftKey&&document.activeElement===r&&(e.preventDefault(),s.focus()))}function Mx(e){return e instanceof Error?e.message:String(e)}var Kt=require("react"),Qn=require("@deepseek-ai/dsh-client-ui-primitives");var qt=require("react/jsx-runtime"),Nx="project-directory-picker",Fx=600;function Ef({profileId:e,value:t,disabled:s,onChange:r}){let o=(0,Kt.useId)(),i=(0,Kt.useId)(),n=(0,Kt.useRef)(0),[a,h]=(0,Kt.useState)({kind:"idle"}),l=`sftp:${e}`,c=(0,Kt.useMemo)(()=>a.kind==="ready"?a.directory.entries.filter(Ps):[],[a]);(0,Kt.useEffect)(()=>{let v=++n.current,g=t.trim();if(g.length===0){h({kind:"idle"});return}h({kind:"checking"});let d=window.setTimeout(()=>{zi(Nx,l,g).then(u=>{v===n.current&&h({kind:"ready",directory:u})}).catch(u=>{v===n.current&&h({kind:"error",message:Bx(u)})})},Fx);return()=>window.clearTimeout(d)},[l,t]);let f=a.kind==="idle"?"\u53EF\u76F4\u63A5\u8F93\u5165\uFF1B\u505C\u6B62\u8F93\u5165\u540E\u4F1A\u81EA\u52A8\u68C0\u67E5\u8FDC\u7AEF\u8DEF\u5F84\u3002":a.kind==="checking"?"\u6B63\u5728\u68C0\u67E5\u8FDC\u7AEF\u8DEF\u5F84\u2026":a.kind==="error"?`\u8DEF\u5F84\u4E0D\u5B58\u5728\u6216\u65E0\u6CD5\u8BBF\u95EE\uFF1A${a.message}\u3002\u4ECD\u53EF\u6309\u5F53\u524D\u8F93\u5165\u4FDD\u5B58\u3002`:c.length===0?"\u8DEF\u5F84\u53EF\u8BBF\u95EE\uFF0C\u5F53\u524D\u6CA1\u6709\u5B50\u76EE\u5F55\u3002":`\u8DEF\u5F84\u53EF\u8BBF\u95EE\uFF0C\u627E\u5230 ${c.length} \u4E2A\u5B50\u76EE\u5F55\u3002`;return(0,qt.jsxs)("div",{className:"dsh-ssh-field dsh-ssh-remote-path-field",children:[(0,qt.jsx)("label",{htmlFor:o,children:"\u8FDC\u7AEF\u8DEF\u5F84"}),(0,qt.jsx)("input",{id:o,required:!0,maxLength:4096,value:t,disabled:s,spellCheck:!1,placeholder:"/var/www/example","aria-invalid":a.kind==="error"?"true":void 0,"aria-describedby":i,onChange:v=>r(v.target.value)}),(0,qt.jsx)("small",{id:i,className:`dsh-ssh-remote-path-feedback is-${a.kind}`,role:a.kind==="error"?"alert":"status",children:f}),a.kind==="ready"&&c.length>0&&(0,qt.jsx)("div",{className:"dsh-ssh-remote-path-options","aria-label":"\u53EF\u9009\u62E9\u7684\u8FDC\u7AEF\u5B50\u76EE\u5F55",children:c.map(v=>(0,qt.jsxs)("button",{type:"button",disabled:s,title:`\u9009\u62E9 ${v.path}`,onClick:()=>r(v.path),children:[(0,qt.jsx)(Qn.IconFolderClose16,{size:15,"aria-hidden":"true"}),(0,qt.jsx)("span",{children:v.name}),(0,qt.jsx)(Qn.IconChevronRightOutline14,{size:13,"aria-hidden":"true"})]},v.path))})]})}function Bx(e){return e instanceof Error?e.message:String(e)}function qr(e,t){return e.mountedProjectIds?.[t]??(e.workingProjectIds[t]?[e.workingProjectIds[t]]:[])}var re=require("react/jsx-runtime");function Tf(e){let t=vr(),[s,r]=(0,_t.useState)(""),[o,i]=(0,_t.useState)(()=>new Set),[n,a]=(0,_t.useState)(()=>new Set),[h,l]=(0,_t.useState)({}),[c,f]=(0,_t.useState)(),[v,g]=(0,_t.useState)(),[d,u]=(0,_t.useState)(),[p,m]=(0,_t.useState)(),b=s.trim().toLocaleLowerCase(),x=(0,_t.useMemo)(()=>$x(e.profiles.filter(E=>jx(E).includes(b))),[b,e.profiles]),y=async E=>{f(E);try{let C=await bh(E);l(P=>({...P,[E]:C})),m(void 0)}catch(C){m(Xl(C))}finally{f(C=>C===E?void 0:C)}},S=E=>{a(new Set([E])),h[E]===void 0&&y(E),e.onSelect({profileId:E,path:"~"})},_=E=>{let C=e.access?.profileIds??[],P=C.includes(E);e.onProfiles(P?C.filter(A=>A!==E):[...C,E]),P&&e.onDirectory(E,void 0)},w=E=>i(C=>{let P=new Set(C);return P.has(E)?P.delete(E):P.add(E),P});return(0,re.jsxs)("aside",{ref:t.ref,onPointerMove:t.onPointerMove,onPointerLeave:t.onPointerLeave,className:"dsh-ssh-remote-tree dsh-ssh-border-surface",children:[(0,re.jsxs)("header",{className:"dsh-ssh-tree-header",children:[(0,re.jsxs)("span",{children:[(0,re.jsx)("strong",{children:"\u4E3B\u673A\u4E0E\u9879\u76EE"}),(0,re.jsxs)("small",{children:[e.profiles.length," \u53F0\u4E3B\u673A"]})]}),(0,re.jsx)("button",{type:"button",className:"dsh-ssh-icon-button",onClick:e.onNewProfile,"aria-label":"\u65B0\u5EFA\u8FDE\u63A5",title:"\u65B0\u5EFA\u8FDE\u63A5",children:(0,re.jsx)(ot.IconPlusOutline16,{size:16})})]}),(0,re.jsxs)("label",{className:"dsh-ssh-search",children:[(0,re.jsx)("span",{className:"sr-only",children:"\u641C\u7D22\u4E3B\u673A"}),(0,re.jsx)("input",{value:s,onChange:E=>r(E.target.value),placeholder:"\u641C\u7D22\u4E3B\u673A\u3001\u5206\u7EC4\u3001\u6807\u7B7E\u2026"})]}),(0,re.jsxs)("div",{className:"dsh-ssh-tree-scroll dsh-ssh-scroll-surface",children:[x.map(E=>{let C=o.has(E.name);return(0,re.jsxs)("section",{className:"dsh-ssh-tree-group","data-collapsed":C,children:[(0,re.jsx)("h3",{children:(0,re.jsxs)("button",{type:"button","aria-expanded":!C,onClick:()=>w(E.name),children:[C?(0,re.jsx)(ot.IconChevronRightOutline14,{size:14}):(0,re.jsx)(ot.IconChevronDownOutline14,{size:14}),(0,re.jsx)("span",{children:E.name}),(0,re.jsx)("small",{children:E.profiles.length})]})}),!C&&E.profiles.map(P=>{let A=n.has(P.id),M=e.access?.profileIds.includes(P.id)===!0,F=h[P.id]??[],$=e.selected?.profileId===P.id&&e.selected.projectId===void 0;return(0,re.jsxs)("div",{className:"dsh-ssh-tree-host","data-open":A,children:[(0,re.jsxs)("div",{"data-ssh-interactive":"row","data-ssh-context-row":!0,className:`dsh-ssh-tree-host-row${M?" is-authorized":""}${$?" is-active":""}`,children:[(0,re.jsxs)("button",{type:"button",className:"dsh-ssh-tree-host-main","aria-pressed":$,"aria-expanded":A,title:`\u9009\u62E9\u5E76\u5C55\u5F00 ${P.name}`,onClick:()=>S(P.id),children:[(0,re.jsx)("span",{className:"dsh-ssh-host-monogram",children:P.name.slice(0,1).toUpperCase()}),(0,re.jsxs)("span",{children:[(0,re.jsx)("strong",{children:P.name}),(0,re.jsxs)("small",{children:[P.username,"@",P.host]})]})]}),(0,re.jsx)("button",{type:"button","data-ssh-interactive":"choice",className:`dsh-ssh-tree-mount dsh-ssh-context-action${M?" is-mounted":""}`,"aria-label":`${M?"\u5378\u8F7D":"\u6302\u8F7D"} ${P.name}`,"aria-pressed":M,title:e.access===null?"\u6253\u5F00\u4E00\u4E2A DSH \u4F1A\u8BDD\u540E\u624D\u80FD\u6302\u8F7D\u4E3B\u673A":M?"\u4ECE\u5F53\u524D\u4F1A\u8BDD\u5378\u8F7D":"\u6302\u8F7D\u5230\u5F53\u524D\u4F1A\u8BDD",disabled:e.access===null||e.accessLoading||e.accessSaving,onClick:()=>_(P.id),children:M?"\u5378\u8F7D":"\u6302\u8F7D"}),(0,re.jsx)("button",{type:"button",className:"dsh-ssh-tree-add","aria-label":`\u4E3A ${P.name} \u6DFB\u52A0\u56FA\u5B9A\u76EE\u5F55`,title:"\u6DFB\u52A0\u56FA\u5B9A\u76EE\u5F55",onClick:()=>g({profile:P}),children:(0,re.jsx)(ot.IconPlusOutline16,{size:14})})]}),A&&(0,re.jsx)("div",{className:"dsh-ssh-tree-branches",children:c===P.id&&h[P.id]===void 0?(0,re.jsx)("p",{className:"dsh-ssh-tree-state",children:"\u6B63\u5728\u8BFB\u53D6\u56FA\u5B9A\u76EE\u5F55\u2026"}):F.length===0?(0,re.jsxs)("button",{type:"button",className:"dsh-ssh-tree-empty",onClick:()=>g({profile:P}),children:[(0,re.jsx)(ot.IconPlusOutline16,{size:13}),"\u6DFB\u52A0\u9879\u76EE\u76EE\u5F55"]}):F.map(H=>{let j=e.selected?.projectId===H.id,k=e.access!==null&&qr(e.access,P.id).includes(H.id),R=e.access?.workingProjectIds[P.id]===H.id;return(0,re.jsx)("div",{className:"dsh-ssh-tree-project",children:(0,re.jsxs)("div",{"data-ssh-interactive":"row",className:`dsh-ssh-tree-project-row${j?" is-active":""}${k?" is-bound":""}`,children:[(0,re.jsxs)("button",{type:"button",className:"dsh-ssh-tree-project-main","aria-pressed":e.access===null?void 0:k,title:e.access===null?"\u5F53\u524D\u6CA1\u6709\u53EF\u6302\u8F7D\u76EE\u5F55\u7684 DSH \u4F1A\u8BDD":M?k?"\u4ECE\u5F53\u524D\u4F1A\u8BDD\u5378\u8F7D\u6B64\u76EE\u5F55":"\u6302\u8F7D\u76EE\u5F55\uFF0C\u53EF\u540C\u65F6\u9009\u62E9\u591A\u4E2A":"\u8BF7\u5148\u6302\u8F7D\u8BE5\u4E3B\u673A",onClick:()=>{M&&!e.accessLoading&&!e.accessSaving&&(e.onToggleProject(P.id,H.id,H.path),e.onSelect(k?{profileId:P.id,path:"~"}:{profileId:P.id,path:H.path,projectId:H.id}))},children:[(0,re.jsx)("span",{children:k?(0,re.jsx)(ot.IconFolderOpenOutline16,{size:15}):(0,re.jsx)(ot.IconFolderClose16,{size:15})}),(0,re.jsxs)("span",{children:[(0,re.jsx)("strong",{children:H.name}),(0,re.jsx)("small",{children:H.path}),k&&(0,re.jsx)("em",{children:R?"\u5DF2\u6302\u8F7D \xB7 \u9ED8\u8BA4\u5DE5\u4F5C\u76EE\u5F55":"\u5DF2\u6302\u8F7D"})]})]}),(0,re.jsxs)("div",{className:"dsh-ssh-tree-project-actions",children:[k&&!R&&(0,re.jsx)("button",{type:"button",className:"dsh-ssh-tree-project-edit",disabled:e.accessSaving,title:"\u8BBE\u4E3A\u9ED8\u8BA4\u5DE5\u4F5C\u76EE\u5F55","aria-label":`\u5C06 ${H.name} \u8BBE\u4E3A\u9ED8\u8BA4\u76EE\u5F55`,onClick:()=>e.onDirectory(P.id,H.path,H.id),children:(0,re.jsx)(ot.IconFolderOpenOutline16,{size:13})}),(0,re.jsx)("button",{type:"button",className:"dsh-ssh-tree-project-new","aria-label":`\u5728 ${H.name} \u65B0\u5EFA\u4F1A\u8BDD`,title:"\u65B0\u5EFA\u4F1A\u8BDD",onClick:L=>{m(void 0),u({profile:P,project:H,returnFocus:L.currentTarget})},children:(0,re.jsx)(ot.IconPlusOutline16,{size:13})}),(0,re.jsx)("button",{type:"button",className:"dsh-ssh-tree-project-edit","aria-label":`\u7F16\u8F91 ${H.name}`,title:"\u7F16\u8F91\u56FA\u5B9A\u76EE\u5F55",onClick:()=>g({profile:P,project:H}),children:(0,re.jsx)(ot.IconEditOutline16,{size:13})})]})]})},H.id)})})]},P.id)})]},E.name)}),x.length===0&&(0,re.jsx)("p",{className:"dsh-ssh-tree-no-results",children:e.profiles.length===0?"\u8FD8\u6CA1\u6709 SSH \u4E3B\u673A":"\u6CA1\u6709\u5339\u914D\u7684\u4E3B\u673A"})]}),(0,re.jsx)(zx,{access:e.access,loading:e.accessLoading,saving:e.accessSaving,error:e.accessError??p,onPermission:e.onPermission,onApproval:e.onApproval}),v!==void 0&&(0,re.jsx)(Hx,{profile:v.profile,project:v.project,onClose:()=>g(void 0),onSaved:async()=>{let E=v.profile.id;g(void 0),await y(E),await e.onProjectsChanged()}}),d!==void 0&&(0,re.jsx)(Cf,{...d,workspaces:e.workspaces,currentWorkspaceId:e.currentWorkspaceId,recentWorkspaceId:e.recentWorkspaceId,onClose:()=>u(void 0),onCreate:e.onCreateSession})]})}function zx({access:e,loading:t,saving:s,error:r,onPermission:o,onApproval:i}){return(0,re.jsxs)("footer",{className:"dsh-ssh-access-footer",children:[(0,re.jsxs)("div",{className:"dsh-ssh-access-heading",children:[(0,re.jsxs)("span",{children:[(0,re.jsx)("strong",{children:"\u5F53\u524D\u4F1A\u8BDD\u6743\u9650"}),(0,re.jsxs)("small",{children:[e?.profileIds.length??0," \u53F0\u4E3B\u673A\u53EF\u7528"]})]}),(0,re.jsx)("em",{children:t?"\u8BFB\u53D6\u4E2D":s?"\u4FDD\u5B58\u4E2D":r?"\u672A\u540C\u6B65":"\u5DF2\u540C\u6B65"})]}),(0,re.jsxs)("div",{className:"dsh-ssh-access-segments","aria-label":"SSH \u6743\u9650",children:[(0,re.jsx)("button",{type:"button","data-ssh-interactive":"choice",className:e?.permission==="exec"?"is-active":"","aria-pressed":e?.permission==="exec",disabled:e===null,onClick:()=>o("exec"),children:"\u4EC5\u547D\u4EE4"}),(0,re.jsx)("button",{type:"button","data-ssh-interactive":"choice",className:e?.permission==="terminal"?"is-active":"","aria-pressed":e?.permission==="terminal",disabled:e===null,onClick:()=>o("terminal"),children:"\u7EC8\u7AEF\u63A7\u5236"})]}),(0,re.jsxs)("label",{className:"dsh-ssh-access-approval",children:[(0,re.jsxs)("span",{children:[(0,re.jsx)("strong",{children:"\u6267\u884C\u524D\u786E\u8BA4"}),(0,re.jsx)("small",{children:e?.requireCommandApproval===!1?"\u5173\u95ED\u540E\u6309\u5F53\u524D\u4F1A\u8BDD\u6743\u9650\u76F4\u63A5\u6267\u884C":"\u9700 DSH \u4F7F\u7528 Ask\uFF1BFull Access \u4F1A\u76F4\u63A5\u62D2\u7EDD"})]}),(0,re.jsx)("input",{type:"checkbox",checked:e?.requireCommandApproval??!0,disabled:e===null,onChange:n=>i(n.target.checked)}),(0,re.jsx)("i",{"aria-hidden":"true"})]}),r&&(0,re.jsx)("p",{className:"dsh-ssh-inline-error",role:"alert",children:r})]})}function Hx({profile:e,project:t,onClose:s,onSaved:r}){let[o,i]=(0,_t.useState)(t?.name??""),[n,a]=(0,_t.useState)(t?.path??""),[h,l]=(0,_t.useState)(!1),[c,f]=(0,_t.useState)(),v=async d=>{d.preventDefault(),l(!0),f(void 0);try{t===void 0?await _h(e.id,{name:o,path:n}):await xh(e.id,t.id,{name:o,path:n}),await r()}catch(u){f(Xl(u)),l(!1)}},g=async()=>{if(!(t===void 0||!window.confirm(`\u5220\u9664\u56FA\u5B9A\u76EE\u5F55\u201C${t.name}\u201D\uFF1F\u76F8\u5173 DSH \u4F1A\u8BDD\u4E0D\u4F1A\u5220\u9664\u3002`))){l(!0),f(void 0);try{await yh(e.id,t.id),await r()}catch(d){f(Xl(d)),l(!1)}}};return(0,re.jsx)(Ne,{className:"dsh-ssh-project-dialog",title:t===void 0?"\u6DFB\u52A0\u56FA\u5B9A\u76EE\u5F55":"\u7F16\u8F91\u56FA\u5B9A\u76EE\u5F55",subtitle:`${e.name} \xB7 \u7EC8\u7AEF\u4E0E SFTP \u7684\u9ED8\u8BA4\u8FDC\u7AEF\u8DEF\u5F84`,onClose:s,children:(0,re.jsxs)("form",{className:"dsh-ssh-form",onSubmit:d=>{v(d)},children:[(0,re.jsxs)("label",{className:"dsh-ssh-field",children:[(0,re.jsx)("span",{children:"\u540D\u79F0"}),(0,re.jsx)("input",{required:!0,maxLength:80,value:o,placeholder:"\u7F51\u7AD9\u9879\u76EE",onChange:d=>i(d.target.value)})]}),(0,re.jsx)(Ef,{profileId:e.id,value:n,disabled:h,onChange:a}),c&&(0,re.jsx)("p",{className:"dsh-ssh-inline-error",role:"alert",children:c}),(0,re.jsxs)("div",{className:"dsh-ssh-dialog-actions",children:[t!==void 0&&(0,re.jsxs)("button",{type:"button",className:"dsh-ssh-danger-button",disabled:h,onClick:()=>{g()},children:[(0,re.jsx)(ot.IconTrashOutline16,{size:15}),"\u5220\u9664"]}),(0,re.jsx)("span",{className:"dsh-ssh-dialog-spacer"}),(0,re.jsx)("button",{type:"button",className:"dsh-ssh-secondary-button","data-ssh-dialog-close":!0,disabled:h,onClick:s,children:"\u53D6\u6D88"}),(0,re.jsx)("button",{className:"dsh-ssh-primary-button",disabled:h,children:h?"\u4FDD\u5B58\u4E2D\u2026":"\u4FDD\u5B58\u76EE\u5F55"})]})]})})}function $x(e){let t=new Map;for(let s of e){let r=s.group?.trim()||"\u672A\u5206\u7EC4",o=t.get(r);o===void 0?t.set(r,[s]):o.push(s)}return[...t].map(([s,r])=>({name:s,profiles:r}))}function jx(e){return`${e.name} ${e.group??""} ${e.host} ${e.username} ${e.tags.join(" ")}`.toLocaleLowerCase()}function Xl(e){return e instanceof Error?e.message:String(e)}var ft=require("react");var Jl=new Set;function Kr(e){for(let t of Jl)t(e)}function Pf(e){return Jl.add(e),()=>Jl.delete(e)}function Df(e){let[t,s]=(0,ft.useState)(null),[r,o]=(0,ft.useState)(e!==void 0),[i,n]=(0,ft.useState)(!1),[a,h]=(0,ft.useState)(),l=(0,ft.useRef)(null),c=(0,ft.useRef)(null),f=(0,ft.useRef)(e),v=(0,ft.useRef)(Promise.resolve()),g=(0,ft.useRef)(0);f.current=e,(0,ft.useEffect)(()=>{let p=!1;return l.current=null,c.current=null,s(null),h(void 0),o(e!==void 0),e===void 0?()=>{p=!0}:(ei(e).then(m=>{if(p)return;let b=m??Gr(e);l.current=b,c.current=b,s(b),Kr(b)}).catch(m=>{p||h(Yl(m))}).finally(()=>{p||o(!1)}),()=>{p=!0})},[e]);let d=(0,ft.useCallback)(async p=>{l.current=p,s(p),Kr(p),h(void 0),g.current+=1,n(!0);let m=v.current.catch(()=>{}).then(()=>Hi(p));v.current=m;try{let b=await m;return f.current===b.sessionId&&(c.current=b),f.current===b.sessionId&&l.current===p&&(l.current=b,s(b),Kr(b)),b}catch(b){throw f.current===p.sessionId&&(h(Yl(b)),l.current===p&&c.current&&(l.current=c.current,s(c.current),Kr(c.current))),b}finally{g.current=Math.max(0,g.current-1),f.current===p.sessionId&&g.current===0&&n(!1)}},[]),u=(0,ft.useCallback)(p=>{let m=f.current;if(m===void 0)return;let b=l.current??Gr(m);d({...b,...p,sessionId:m}).catch(()=>{})},[d]);return{value:t,loading:r,saving:i,error:a,refresh:async()=>{let p=f.current;if(p)try{await v.current.catch(()=>{});let m=l.current,b=await ei(p)??Gr(p);if(p!==f.current||m!==l.current)return;l.current=b,c.current=b,s(b),Kr(b)}catch(m){p===f.current&&h(Yl(m))}},setProfiles:p=>{let m=l.current;u({profileIds:p,mountedProjectIds:Object.fromEntries(p.map(b=>[b,m?qr(m,b):[]]))})},toggleProject:(p,m,b)=>{let x=l.current;if(!x||!x.profileIds.includes(p))return;let y=qr(x,p),S=y.includes(m),_=S?y.filter(C=>C!==m):[...y,m],w={...x.workingDirectories},E={...x.workingProjectIds};!S&&E[p]===void 0?(w[p]=b,E[p]=m):S&&E[p]===m&&(delete w[p],delete E[p]),u({workingDirectories:w,workingProjectIds:E,mountedProjectIds:Object.fromEntries(x.profileIds.map(C=>[C,C===p?_:qr(x,C)]))})},setDirectory:(p,m,b)=>{let x=f.current;if(x===void 0)return;let y=l.current??Gr(x),S={...y.workingDirectories},_={...y.workingProjectIds};m===void 0?delete S[p]:S[p]=m,b===void 0?delete _[p]:_[p]=b,u({workingDirectories:S,workingProjectIds:_})},setPermission:p=>u({permission:p}),setRequireCommandApproval:p=>u({requireCommandApproval:p}),setFileEndpoints:p=>u({fileEndpointIds:p}),setFilePermission:p=>u({filePermission:p}),setRequireFileApproval:p=>u({requireFileApproval:p}),replace:d}}function Gr(e){return{sessionId:e,profileIds:[],permission:"exec",requireCommandApproval:!0,fileEndpointIds:[],filePermission:"browse",requireFileApproval:!0,workingDirectories:{},workingProjectIds:{},updatedAt:0}}function Yl(e){return e instanceof Error?e.message:String(e)}var _r=require("react"),Ni=require("react/jsx-runtime"),Zn=38,Oi=28,Mi=66,Vx=320,Ux=280,Wx=7;function Rf(e,t,s){return Math.min(s,Math.max(t,e))}function qx(e){if(typeof window>"u")return Zn;try{let t=Number.parseFloat(window.localStorage.getItem(e)??"");return Number.isFinite(t)?Rf(t,Oi,Mi):Zn}catch{return Zn}}function Ql(e,t){try{window.localStorage.setItem(e,t.toFixed(2))}catch{}}function Kx(e){if(e<=0)return{min:Oi,max:Mi};let t=Ux/e*100,s=(e-Vx-Wx)/e*100,r=Math.max(Oi,t),o=Math.max(r,Math.min(Mi,s));return{min:r,max:o}}function If({primary:e,secondary:t,storageKey:s,label:r,secondaryHidden:o=!1}){let[i,n]=(0,_r.useState)(()=>qx(s)),a=(0,_r.useRef)(null),h=(0,_r.useRef)(null),l=(0,_r.useRef)(i),c=(0,_r.useRef)(),f=b=>{let x=a.current;if(x===null)return b;let y=Kx(x.getBoundingClientRect().width),S=Rf(b,y.min,y.max);return x.style.setProperty("--ssh-sftp-width",`${S}%`),h.current?.setAttribute("aria-valuenow",String(Math.round(S))),l.current=S,S},v=b=>{if(c.current===void 0)return;let x=h.current;c.current=void 0,b!==void 0&&x?.hasPointerCapture(b)&&x.releasePointerCapture(b),a.current?.classList.remove("is-resizing");let y=l.current;n(y),Ql(s,y)},g=b=>{b.button===0&&(c.current=b.pointerId,l.current=i,b.currentTarget.setPointerCapture(b.pointerId),a.current?.classList.add("is-resizing"),b.preventDefault())},d=b=>{if(c.current!==b.pointerId)return;let x=a.current?.getBoundingClientRect();x===void 0||x.width===0||(f((x.right-b.clientX)/x.width*100),b.preventDefault())},u=b=>{let x=b.shiftKey?5:2,y;if(b.key==="ArrowLeft"&&(y=i+x),b.key==="ArrowRight"&&(y=i-x),b.key==="Home"&&(y=Oi),b.key==="End"&&(y=Mi),y===void 0)return;let S=f(y);n(S),Ql(s,S),b.preventDefault()},p=()=>{let b=f(Zn);n(b),Ql(s,b)},m={"--ssh-sftp-width":`${i}%`};return(0,Ni.jsxs)("div",{ref:a,className:`dsh-ssh-workbench-split${o?" is-secondary-hidden":""}`,style:m,children:[e,(0,Ni.jsx)("div",{ref:h,hidden:o,className:"dsh-ssh-workbench-resizer",role:"separator","aria-label":r,"aria-orientation":"vertical","aria-valuemin":Oi,"aria-valuemax":Mi,"aria-valuenow":Math.round(i),tabIndex:0,title:"\u62D6\u52A8\u8C03\u6574\u5BBD\u5EA6\uFF0C\u53CC\u51FB\u6062\u590D\u9ED8\u8BA4",onDoubleClick:p,onKeyDown:u,onPointerDown:g,onPointerMove:d,onPointerUp:b=>v(b.pointerId),onPointerCancel:b=>v(b.pointerId),onLostPointerCapture:()=>v()}),(0,Ni.jsx)("div",{className:"dsh-ssh-split-secondary",hidden:o,children:t})]})}var rt=require("react"),Ot=require("@deepseek-ai/dsh-client-ui-primitives");function Af(e){let t=e.port??22;if(!Number.isSafeInteger(t)||t<1||t>65535)return;let s=e.host.trim().normalize("NFKC").toLocaleLowerCase();return s.startsWith("[")&&s.endsWith("]")&&(s=s.slice(1,-1)),s=s.replace(/\.+$/u,""),s.length===0?void 0:`${s}\0${t}`}function Lf(e,t,s){let r=Af(t);if(r!==void 0)return e.find(o=>o.id!==s&&Af(o)===r)}var G=require("react/jsx-runtime");function Of({profile:e,dependents:t,onClose:s,onDeleted:r}){let[o,i]=(0,rt.useState)(!1),[n,a]=(0,rt.useState)(),h=async()=>{if(!(o||t.length>0)){i(!0),a(void 0);try{await ie(`/profiles/${encodeURIComponent(e.id)}`,{method:"DELETE"}),r()}catch(l){a(Ce(l))}finally{i(!1)}}};return(0,G.jsx)(Ne,{title:`\u5220\u9664 ${e.name}`,subtitle:ys(e),onClose:s,children:(0,G.jsxs)("div",{className:"dsh-ssh-delete-profile",children:[(0,G.jsx)("span",{className:"dsh-ssh-delete-profile-mark",children:(0,G.jsx)(Ot.IconTrashOutline16,{size:19})}),(0,G.jsxs)("div",{children:[(0,G.jsx)("strong",{children:"\u8FD9\u4E2A\u64CD\u4F5C\u65E0\u6CD5\u64A4\u9500"}),(0,G.jsx)("p",{children:"\u8FDE\u63A5\u914D\u7F6E\u3001\u8BE5\u4E3B\u673A\u7684\u72EC\u7ACB\u51ED\u636E\u548C\u5173\u8054\u7AEF\u53E3\u8F6C\u53D1\u4F1A\u4E00\u5E76\u5220\u9664\uFF1B\u5B83\u4E5F\u4F1A\u4ECE\u6240\u6709\u4F1A\u8BDD\u6388\u6743\u4E2D\u79FB\u9664\u3002\u5BC6\u94A5\u5E93\u4E2D\u7684\u5171\u4EAB\u51ED\u636E\u4E0D\u4F1A\u5220\u9664\u3002"})]}),t.length>0&&(0,G.jsxs)("div",{className:"dsh-ssh-delete-profile-block",role:"alert",children:[(0,G.jsx)("strong",{children:"\u6682\u65F6\u4E0D\u80FD\u5220\u9664"}),(0,G.jsxs)("p",{children:["\u4EE5\u4E0B\u8FDE\u63A5\u4ECD\u5C06\u5B83\u4F5C\u4E3A SSH \u8DF3\u677F\uFF1A",t.map(l=>l.name).join("\u3001"),"\u3002\u8BF7\u5148\u4FEE\u6539\u8FD9\u4E9B\u8FDE\u63A5\u7684\u8DF3\u677F\u94FE\u3002"]})]}),n&&(0,G.jsx)("p",{className:"dsh-ssh-inline-error",role:"alert",children:n}),(0,G.jsxs)("div",{className:"dsh-ssh-dialog-actions",children:[(0,G.jsx)("button",{type:"button",className:"dsh-ssh-secondary-button","data-ssh-dialog-close":!0,disabled:o,onClick:s,children:"\u53D6\u6D88"}),(0,G.jsx)("button",{type:"button",className:"dsh-ssh-danger-button",disabled:o||t.length>0,onClick:()=>{h()},children:o?"\u6B63\u5728\u5220\u9664\u2026":"\u5220\u9664\u4E3B\u673A"})]})]})})}function Mf({profile:e,profiles:t,vaultEntries:s,proxyEntries:r,onClose:o,onSaved:i}){let[n,a]=(0,rt.useState)(()=>({name:e?.name??"",group:e?.group??"",host:e?.host??"",port:String(e?.port??22),username:e?.username??"",authType:e?.authType??"password",credentialId:e?.credentialId??"",proxyType:e?.proxy.type??"none",proxyEntryId:e?.proxy.type==="saved"?e.proxy.proxyId:"",proxyHost:e?.proxy.type==="http"||e?.proxy.type==="socks5"?e.proxy.host:"",proxyPort:e?.proxy.type==="http"||e?.proxy.type==="socks5"?String(e.proxy.port):"1080",proxyUsername:e?.proxy.type==="http"||e?.proxy.type==="socks5"?e.proxy.username??"":"",jumpProfileIds:e?.proxy.type==="jump"?e.proxy.profileIds:[],tags:e?.tags.join(", ")??"",password:"",privateKey:"",passphrase:"",proxyPassword:"",hostFingerprint:e?.hostFingerprint??""})),[h,l]=(0,rt.useState)(!1),[c,f]=(0,rt.useState)(!1),[v,g]=(0,rt.useState)(),[d,u]=(0,rt.useState)(),[p,m]=(0,rt.useState)(),[b,x]=(0,rt.useState)(),[y,S]=(0,rt.useState)(!1),_=(0,rt.useId)(),w=(0,rt.useRef)(null),E=k=>({value:n[k],onChange:R=>{a(L=>({...L,[k]:R.target.value})),(k==="host"||k==="port")&&x(void 0),g(void 0),u(void 0)}}),C=s.find(k=>k.id===n.credentialId),P=(0,rt.useMemo)(()=>t.flatMap(k=>k.group===void 0?[]:[k.group]),[t]),A=(0,rt.useMemo)(()=>t.flatMap(k=>k.tags),[t]),M=(0,rt.useMemo)(()=>Lf(t,{host:n.host,port:Number(n.port)},e?.id),[n.host,n.port,e?.id,t]),F=y?M===void 0?b:`\u8BE5\u5730\u5740\u548C\u7AEF\u53E3\u5DF2\u7531\u201C${M.name}\u201D\u4F7F\u7528\uFF0C\u8BF7\u4FEE\u6539\u4E3B\u673A\u6216\u7AEF\u53E3\u3002`:void 0,$=(k=n.hostFingerprint)=>{let R=n.proxyType==="none"?{type:"none"}:n.proxyType==="saved"?{type:"saved",proxyId:n.proxyEntryId}:n.proxyType==="jump"?{type:"jump",profileIds:n.jumpProfileIds}:{type:n.proxyType,host:n.proxyHost,port:Number(n.proxyPort),...n.proxyUsername.trim()?{username:n.proxyUsername.trim()}:{}};return{profile:{name:n.name,...n.group.trim()?{group:n.group.trim()}:{},host:n.host,port:Number(n.port),username:C?.username??n.username,authType:C?.authType??n.authType,...n.credentialId?{credentialId:n.credentialId}:{},...k?{hostFingerprint:k}:{},proxy:R,keepAliveIntervalMs:e?.keepAliveIntervalMs??15e3,connectTimeoutMs:e?.connectTimeoutMs??15e3,terminalType:e?.terminalType??"xterm-256color",tags:n.tags.split(",").map(L=>L.trim()).filter(Boolean)},secrets:{password:n.password,privateKey:n.privateKey,passphrase:n.passphrase,proxyPassword:n.proxyPassword}}},H=async k=>{if(S(!0),M!==void 0){w.current?.focus();return}f(!0),m(void 0),g(void 0),u(void 0);try{await ie("/profiles/test-draft",{method:"POST",body:JSON.stringify({...$(k),...e===void 0?{}:{profileId:e.id}})}),k!==void 0&&a(R=>({...R,hostFingerprint:k})),g("success")}catch(R){R instanceof Nt&&R.body?.code==="HOST_KEY_REQUIRED"&&typeof R.body.fingerprint=="string"?u(R.body.fingerprint):R instanceof Nt&&R.body?.code==="DUPLICATE_PROFILE_ENDPOINT"?(x(Ce(R)),w.current?.focus()):m(Ce(R))}finally{f(!1)}},j=async k=>{if(k.preventDefault(),S(!0),M!==void 0){w.current?.focus();return}l(!0),m(void 0);try{await ie(e===void 0?"/profiles":`/profiles/${e.id}`,{method:e===void 0?"POST":"PUT",body:JSON.stringify($())}),i()}catch(R){R instanceof Nt&&R.body?.code==="DUPLICATE_PROFILE_ENDPOINT"?(x(Ce(R)),w.current?.focus()):m(Ce(R))}finally{l(!1)}};return(0,G.jsx)(Ne,{title:e===void 0?"\u65B0\u5EFA SSH \u8FDE\u63A5":`\u7F16\u8F91 ${e.name}`,subtitle:"\u51ED\u636E\u4FDD\u5B58\u540E\u4E0D\u4F1A\u56DE\u663E",onClose:o,children:(0,G.jsxs)("form",{className:"dsh-ssh-form",onSubmit:k=>{j(k)},children:[(0,G.jsxs)("div",{className:"dsh-ssh-form-section",children:[(0,G.jsxs)("div",{className:"dsh-ssh-form-section-heading",children:[(0,G.jsx)("strong",{children:"\u8FDE\u63A5\u4FE1\u606F"}),(0,G.jsx)("small",{children:"\u4E3B\u673A\u5730\u5740\u4E0E\u663E\u793A\u65B9\u5F0F"})]}),(0,G.jsxs)("div",{className:"dsh-ssh-form-grid",children:[(0,G.jsx)(ae,{label:"\u540D\u79F0",children:(0,G.jsx)("input",{required:!0,maxLength:80,placeholder:"\u5F00\u53D1\u670D\u52A1\u5668",...E("name")})}),(0,G.jsx)(ae,{label:"\u5206\u7EC4",children:(0,G.jsx)($r,{ariaLabel:"\u4E3B\u673A\u5206\u7EC4",maxLength:64,options:P,placeholder:"\u9009\u62E9\u5DF2\u6709\u5206\u7EC4\u6216\u8F93\u5165\u65B0\u5206\u7EC4",value:n.group,onChange:k=>a(R=>({...R,group:k}))})})]}),(0,G.jsxs)("div",{className:"dsh-ssh-form-grid is-host",children:[(0,G.jsxs)(ae,{label:"\u4E3B\u673A",children:[(0,G.jsx)("input",{ref:w,required:!0,"aria-invalid":F===void 0?void 0:!0,"aria-describedby":F===void 0?void 0:_,placeholder:"server.example.com",spellCheck:!1,...E("host"),onBlur:()=>S(!0)}),F&&(0,G.jsx)("small",{id:_,className:"dsh-ssh-field-error",role:"alert",children:F})]}),(0,G.jsx)(ae,{label:"\u7AEF\u53E3",children:(0,G.jsx)("input",{required:!0,"aria-invalid":F===void 0?void 0:!0,"aria-describedby":F===void 0?void 0:_,type:"number",inputMode:"numeric",min:"1",max:"65535",...E("port"),onBlur:()=>S(!0)})})]}),(0,G.jsx)(ae,{label:"\u6807\u7B7E",hint:"\u53EF\u9009\u62E9\u5DF2\u6709\u6807\u7B7E\u6216\u76F4\u63A5\u8F93\u5165\uFF1B\u591A\u4E2A\u6807\u7B7E\u4F7F\u7528\u9017\u53F7\u5206\u9694\u3002",children:(0,G.jsx)($r,{ariaLabel:"\u4E3B\u673A\u6807\u7B7E",multiple:!0,options:A,placeholder:"\u9009\u62E9\u6216\u8F93\u5165\u6807\u7B7E",value:n.tags,onChange:k=>a(R=>({...R,tags:k}))})})]}),(0,G.jsxs)("div",{className:"dsh-ssh-form-section",children:[(0,G.jsxs)("div",{className:"dsh-ssh-form-section-heading",children:[(0,G.jsx)("strong",{children:"\u8EAB\u4EFD\u8BA4\u8BC1"}),(0,G.jsx)("small",{children:"\u9009\u62E9\u5171\u4EAB\u51ED\u636E\u6216\u5355\u72EC\u4FDD\u5B58"})]}),(0,G.jsx)(ae,{label:"\u51ED\u636E\u6765\u6E90",hint:"\u53EF\u4F7F\u7528\u6B64\u8FDE\u63A5\u81EA\u5DF1\u7684\u51ED\u636E\uFF0C\u6216\u5F15\u7528\u5BC6\u94A5\u5E93\u4E2D\u7684\u5E38\u7528\u8D26\u53F7\u3002",children:(0,G.jsxs)("select",{...E("credentialId"),children:[(0,G.jsx)("option",{value:"",children:"\u6B64\u8FDE\u63A5\u72EC\u7ACB\u4FDD\u5B58"}),s.map(k=>(0,G.jsxs)("option",{value:k.id,children:[k.name," \xB7 ",k.username]},k.id))]})}),C?(0,G.jsxs)("div",{className:"dsh-ssh-credential-reference",children:[(0,G.jsx)("span",{children:(0,G.jsx)(Ot.IconUserOutline16,{size:16})}),(0,G.jsxs)("span",{children:[(0,G.jsx)("strong",{children:C.name}),(0,G.jsxs)("small",{children:[C.username," \xB7 ",C.authType==="password"?"\u5BC6\u7801":"\u79C1\u94A5"]})]}),(0,G.jsx)("em",{children:C.credential.configured?"\u5DF2\u5C31\u7EEA":"\u7F3A\u5C11\u51ED\u636E"})]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)("div",{className:"dsh-ssh-form-grid",children:[(0,G.jsx)(ae,{label:"\u7528\u6237\u540D",children:(0,G.jsx)("input",{required:!0,autoComplete:"username",...E("username")})}),(0,G.jsx)(ae,{label:"\u8BA4\u8BC1\u65B9\u5F0F",children:(0,G.jsxs)("select",{...E("authType"),children:[(0,G.jsx)("option",{value:"password",children:"\u5BC6\u7801"}),(0,G.jsx)("option",{value:"private-key",children:"\u79C1\u94A5"}),(0,G.jsx)("option",{value:"agent",children:"SSH Agent"})]})})]}),n.authType==="password"&&(0,G.jsx)(ae,{label:"\u5BC6\u7801",hint:e?.credential.source==="profile"&&e.credential.fields.includes("password")?"\u5DF2\u4FDD\u5B58\uFF1B\u7559\u7A7A\u4FDD\u6301\u4E0D\u53D8":"\u4FDD\u5B58\u540E\u4E0D\u53EF\u8BFB\u56DE",children:(0,G.jsx)("input",{required:e===void 0,type:"password",autoComplete:"new-password",placeholder:e?.credential.source==="profile"&&e.credential.fields.includes("password")?"\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022":"",...E("password")})}),n.authType==="private-key"&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(ae,{label:"\u79C1\u94A5",hint:e?.credential.source==="profile"&&e.credential.fields.includes("privateKey")?"\u5DF2\u4FDD\u5B58\uFF1B\u7559\u7A7A\u4FDD\u6301\u4E0D\u53D8":"\u7C98\u8D34 OpenSSH/PEM \u79C1\u94A5",children:(0,G.jsx)("textarea",{required:e===void 0,rows:5,spellCheck:!1,...E("privateKey")})}),(0,G.jsx)(ae,{label:"\u79C1\u94A5\u53E3\u4EE4",children:(0,G.jsx)("input",{type:"password",autoComplete:"new-password",...E("passphrase")})})]})]})]}),(0,G.jsxs)("div",{className:"dsh-ssh-form-section",children:[(0,G.jsxs)("div",{className:"dsh-ssh-form-section-heading",children:[(0,G.jsx)("strong",{children:"\u8FDE\u63A5\u8DEF\u5F84"}),(0,G.jsx)("small",{children:"\u76F4\u8FDE\u3001\u4EE3\u7406\u6216\u8DF3\u677F\u94FE"})]}),(0,G.jsx)(ae,{label:"\u8FDE\u63A5\u65B9\u5F0F",children:(0,G.jsxs)("select",{...E("proxyType"),children:[(0,G.jsx)("option",{value:"none",children:"\u76F4\u8FDE"}),(0,G.jsx)("option",{value:"saved",children:"\u5E38\u7528\u4EE3\u7406"}),(0,G.jsx)("option",{value:"http",children:"\u81EA\u5B9A\u4E49 HTTP CONNECT"}),(0,G.jsx)("option",{value:"socks5",children:"\u81EA\u5B9A\u4E49 SOCKS5"}),(0,G.jsx)("option",{value:"jump",children:"SSH \u8DF3\u677F"})]})}),n.proxyType==="saved"&&(0,G.jsx)(ae,{label:"\u5E38\u7528\u4EE3\u7406",hint:r.length===0?"\u8BF7\u5148\u5728\u4EE3\u7406\u5E93\u4E2D\u6DFB\u52A0 HTTP \u6216 SOCKS5 \u4EE3\u7406\u3002":"\u591A\u53F0\u4E3B\u673A\u53EF\u5F15\u7528\u540C\u4E00\u6761\u4EE3\u7406\u914D\u7F6E\u3002",children:(0,G.jsxs)("select",{required:!0,...E("proxyEntryId"),children:[(0,G.jsx)("option",{value:"",children:"\u9009\u62E9\u4EE3\u7406"}),r.map(k=>(0,G.jsxs)("option",{value:k.id,children:[k.name," \xB7 ",k.proxyType==="http"?"HTTP":"SOCKS5"," \xB7 ",k.host,":",k.port]},k.id))]})}),(n.proxyType==="http"||n.proxyType==="socks5")&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)("div",{className:"dsh-ssh-form-grid is-host",children:[(0,G.jsx)(ae,{label:"\u4EE3\u7406\u4E3B\u673A",children:(0,G.jsx)("input",{required:!0,spellCheck:!1,...E("proxyHost")})}),(0,G.jsx)(ae,{label:"\u4EE3\u7406\u7AEF\u53E3",children:(0,G.jsx)("input",{required:!0,type:"number",inputMode:"numeric",min:"1",max:"65535",...E("proxyPort")})})]}),(0,G.jsxs)("div",{className:"dsh-ssh-form-grid",children:[(0,G.jsx)(ae,{label:"\u4EE3\u7406\u7528\u6237\u540D",children:(0,G.jsx)("input",{autoComplete:"username",...E("proxyUsername")})}),(0,G.jsx)(ae,{label:"\u4EE3\u7406\u5BC6\u7801",children:(0,G.jsx)("input",{type:"password",autoComplete:"new-password",...E("proxyPassword")})})]})]}),n.proxyType==="jump"&&(0,G.jsx)(Gx,{profiles:t.filter(k=>k.id!==e?.id),value:n.jumpProfileIds,onChange:k=>a(R=>({...R,jumpProfileIds:k}))})]}),d&&(0,G.jsxs)("div",{className:"dsh-ssh-test-result is-warning",role:"alert",children:[(0,G.jsxs)("span",{children:[(0,G.jsx)("strong",{children:"\u9996\u6B21\u8FDE\u63A5\uFF0C\u8BF7\u6838\u5BF9\u4E3B\u673A\u6307\u7EB9"}),(0,G.jsx)("code",{children:d})]}),(0,G.jsx)("button",{type:"button",className:"dsh-ssh-small-primary",disabled:c,onClick:()=>{H(d)},children:"\u786E\u8BA4\u5E76\u91CD\u8BD5"})]}),v==="success"&&(0,G.jsxs)("p",{className:"dsh-ssh-test-result is-success",role:"status",children:[(0,G.jsx)(Ot.IconCheckOutline14,{size:14}),"\u8FDE\u63A5\u6D4B\u8BD5\u6210\u529F"]}),p&&(0,G.jsx)("p",{className:"dsh-ssh-inline-error",role:"alert",children:p}),(0,G.jsxs)("div",{className:"dsh-ssh-dialog-actions",children:[(0,G.jsx)("button",{type:"button",className:"dsh-ssh-secondary-button dsh-ssh-test-button",disabled:h||c,onClick:k=>{k.currentTarget.form?.reportValidity()&&H()},children:c?"\u6B63\u5728\u6D4B\u8BD5\u2026":"\u6D4B\u8BD5\u8FDE\u63A5"}),(0,G.jsx)("button",{type:"button",className:"dsh-ssh-secondary-button","data-ssh-dialog-close":!0,disabled:h||c,onClick:o,children:"\u53D6\u6D88"}),(0,G.jsx)("button",{className:"dsh-ssh-primary-button",disabled:h||c,children:h?"\u6B63\u5728\u4FDD\u5B58\u2026":"\u4FDD\u5B58\u8FDE\u63A5"})]})]})})}function Gx({profiles:e,value:t,onChange:s}){let r=()=>{let n=e.find(a=>!t.includes(a.id));n!==void 0&&t.length<8&&s([...t,n.id])},o=(n,a)=>s(t.map((h,l)=>l===n?a:h)),i=(n,a)=>{let h=n+a;if(h<0||h>=t.length)return;let l=[...t];[l[n],l[h]]=[l[h],l[n]],s(l)};return(0,G.jsxs)("fieldset",{className:"dsh-ssh-jump-chain",children:[(0,G.jsx)("legend",{children:"\u8DF3\u677F\u94FE"}),(0,G.jsx)("p",{children:"\u8FDE\u63A5\u4F1A\u6309\u4ECE\u4E0A\u5230\u4E0B\u7684\u987A\u5E8F\u9010\u7EA7\u5EFA\u7ACB\u3002"}),(0,G.jsx)("div",{children:t.map((n,a)=>(0,G.jsxs)("div",{className:"dsh-ssh-jump-row",children:[(0,G.jsx)("em",{children:a+1}),(0,G.jsxs)("select",{required:!0,value:n,onChange:h=>o(a,h.target.value),children:[(0,G.jsx)("option",{value:"",children:"\u9009\u62E9\u5DF2\u6709\u8FDE\u63A5"}),e.filter(h=>h.id===n||!t.includes(h.id)).map(h=>(0,G.jsxs)("option",{value:h.id,children:[h.name," \xB7 ",h.host]},h.id))]}),(0,G.jsx)("button",{type:"button",className:"dsh-ssh-icon-button",disabled:a===0,"aria-label":"\u4E0A\u79FB\u8DF3\u677F",onClick:()=>i(a,-1),children:(0,G.jsx)(Ot.IconChevronUpOutline14,{size:14})}),(0,G.jsx)("button",{type:"button",className:"dsh-ssh-icon-button",disabled:a===t.length-1,"aria-label":"\u4E0B\u79FB\u8DF3\u677F",onClick:()=>i(a,1),children:(0,G.jsx)(Ot.IconChevronDownOutline14,{size:14})}),(0,G.jsx)("button",{type:"button",className:"dsh-ssh-icon-button is-danger","aria-label":"\u79FB\u9664\u8DF3\u677F",onClick:()=>s(t.filter((h,l)=>l!==a)),children:(0,G.jsx)(Ot.IconTrashOutline16,{size:15})})]},`${n}-${a}`))}),t.length===0&&(0,G.jsx)("p",{className:"dsh-ssh-jump-empty",children:"\u81F3\u5C11\u6DFB\u52A0\u4E00\u53F0\u8DF3\u677F\u4E3B\u673A\u3002"}),(0,G.jsxs)("button",{type:"button",className:"dsh-ssh-secondary-button",disabled:t.length>=8||e.every(n=>t.includes(n.id)),onClick:r,children:[(0,G.jsx)(Ot.IconPlusOutline16,{size:15}),"\u6DFB\u52A0\u8DF3\u677F"]})]})}var ye=require("react"),Et=require("@deepseek-ai/dsh-client-ui-primitives");var Mt=require("react"),Vt=require("@deepseek-ai/dsh-client-ui-primitives");var U=require("react/jsx-runtime");function Nf({profiles:e,vaultEntries:t,proxyEntries:s,onClose:r,onChanged:o}){let[i,n]=(0,Mt.useState)(),[a,h]=(0,Mt.useState)(),[l,c]=(0,Mt.useState)(),f=i!==void 0||a!==void 0,v=p=>{h(void 0),n(p),c(void 0)},g=()=>{h(void 0),n("new"),c(void 0)},d=p=>{n(void 0),h(p),c(void 0)},u=async p=>{c(void 0);try{await ie(`/ftp-profiles/${encodeURIComponent(p.id)}`,{method:"DELETE"}),h(void 0),o()}catch(m){c(Ce(m))}};return(0,U.jsx)(Ne,{className:"dsh-ssh-ftp-manager-dialog",title:"\u6587\u4EF6\u8FDE\u63A5",subtitle:"\u7BA1\u7406 FTP \u4E0E FTPS\uFF1BSFTP \u76F4\u63A5\u590D\u7528\u5DF2\u6709 SSH \u4E3B\u673A",onClose:r,children:(0,U.jsxs)("div",{className:`dsh-ssh-ftp-manager${f?" has-detail":""}`,children:[(0,U.jsxs)("aside",{className:"dsh-ssh-ftp-manager-list",children:[(0,U.jsxs)("header",{children:[(0,U.jsxs)("span",{children:[(0,U.jsx)("strong",{children:"FTP / FTPS"}),(0,U.jsxs)("small",{children:[e.length," \u4E2A\u8FDE\u63A5"]})]}),(0,U.jsxs)("button",{type:"button",className:"dsh-ssh-primary-button",onClick:g,children:[(0,U.jsx)(Vt.IconPlusOutline16,{size:15}),"\u65B0\u5EFA"]})]}),e.length===0?(0,U.jsxs)("div",{className:"dsh-ssh-ftp-list-empty",children:[(0,U.jsx)("span",{children:(0,U.jsx)(Vt.IconDataOutline16,{size:20})}),(0,U.jsx)("strong",{children:"\u8FD8\u6CA1\u6709\u72EC\u7ACB\u6587\u4EF6\u8FDE\u63A5"}),(0,U.jsx)("p",{children:"SFTP \u4F1A\u663E\u793A\u5728\u6587\u4EF6\u7A97\u683C\u7684\u8FDE\u63A5\u5217\u8868\u4E2D\uFF1B\u8FD9\u91CC\u53EA\u7BA1\u7406 FTP \u4E0E FTPS\u3002"}),(0,U.jsx)("button",{type:"button",className:"dsh-ssh-secondary-button",onClick:g,children:"\u65B0\u5EFA FTPS \u8FDE\u63A5"})]}):(0,U.jsx)("div",{className:"dsh-ssh-ftp-profile-list",role:"list",children:e.map(p=>{let m=i!=="new"&&i?.id===p.id||a?.id===p.id;return(0,U.jsxs)("article",{role:"listitem","data-ssh-interactive":"choice","aria-selected":m,className:m?"is-active":"",children:[(0,U.jsxs)("button",{type:"button",className:"dsh-ssh-ftp-profile-main",onClick:()=>v(p),children:[(0,U.jsx)("span",{className:`dsh-ssh-protocol-badge is-${p.protocol}`,children:Yx(p.protocol)}),(0,U.jsxs)("span",{children:[(0,U.jsx)("strong",{title:p.name,children:p.name}),(0,U.jsxs)("small",{title:`${p.username}@${p.host}:${p.port}`,children:[p.username,"@",p.host,":",p.port]})]}),(0,U.jsx)("i",{className:p.authMode==="anonymous"||p.credential.configured?"is-ready":"is-missing",children:p.authMode==="anonymous"?"\u533F\u540D\u767B\u5F55":p.credential.configured?"\u53EF\u7528":"\u7F3A\u5C11\u5BC6\u7801"})]}),(0,U.jsx)("button",{type:"button",className:"dsh-ssh-icon-button is-danger","aria-label":`\u5220\u9664 ${p.name}`,onClick:()=>d(p),children:(0,U.jsx)(Vt.IconTrashOutline16,{size:15})})]},p.id)})})]}),(0,U.jsx)("main",{className:"dsh-ssh-ftp-manager-detail",children:a!==void 0?(0,U.jsx)(Xx,{profile:a,error:l,onBack:()=>h(void 0),onDelete:()=>u(a)}):i!==void 0?(0,U.jsx)(Jx,{value:i==="new"?void 0:i,profiles:e,vaultEntries:t,proxyEntries:s,onBack:()=>n(void 0),onSaved:()=>{n(void 0),o()}},i==="new"?"new":i.id):(0,U.jsxs)("div",{className:"dsh-ssh-ftp-manager-overview",children:[(0,U.jsx)("span",{children:(0,U.jsx)(Vt.IconDataOutline16,{size:22})}),(0,U.jsx)("h3",{children:"\u9009\u62E9\u4E00\u4E2A\u8FDE\u63A5\u8FDB\u884C\u7F16\u8F91"}),(0,U.jsx)("p",{children:"\u6587\u4EF6\u7A97\u683C\u4F1A\u628A\u8FD9\u91CC\u4FDD\u5B58\u7684 FTP\u3001FTPS \u4E0E SSH \u4E3B\u673A\u63D0\u4F9B\u7684 SFTP \u6C47\u603B\u6210\u8FDE\u63A5\u5217\u8868\u3002"}),(0,U.jsxs)("dl",{children:[(0,U.jsxs)("div",{children:[(0,U.jsx)("dt",{children:"FTPS"}),(0,U.jsx)("dd",{children:"\u52A0\u5BC6\u63A7\u5236\u4E0E\u6587\u4EF6\u6570\u636E\uFF0C\u9ED8\u8BA4\u4E25\u683C\u6821\u9A8C\u8BC1\u4E66"})]}),(0,U.jsxs)("div",{children:[(0,U.jsx)("dt",{children:"FTP"}),(0,U.jsx)("dd",{children:"\u517C\u5BB9\u65E7\u670D\u52A1\u5668\uFF0C\u4F46\u8D26\u53F7\u548C\u6587\u4EF6\u5185\u5BB9\u4E0D\u52A0\u5BC6"})]}),(0,U.jsxs)("div",{children:[(0,U.jsx)("dt",{children:"SFTP"}),(0,U.jsx)("dd",{children:"\u7531 SSH \u4E3B\u673A\u7BA1\u7406\uFF0C\u4E0D\u5728\u8FD9\u91CC\u91CD\u590D\u914D\u7F6E"})]})]})]})})]})})}function Xx({profile:e,error:t,onBack:s,onDelete:r}){let[o,i]=(0,Mt.useState)(!1);return(0,U.jsxs)("div",{className:"dsh-ssh-ftp-delete-panel",children:[(0,U.jsxs)("button",{type:"button",className:"dsh-ssh-ftp-detail-back",onClick:s,children:[(0,U.jsx)(Vt.IconChevronLeftOutline14,{size:14}),"\u8FD4\u56DE\u8FDE\u63A5\u5217\u8868"]}),(0,U.jsx)("span",{className:"dsh-ssh-ftp-delete-mark",children:(0,U.jsx)(Vt.IconWarningOutline16,{size:20})}),(0,U.jsxs)("h3",{children:["\u5220\u9664\u201C",e.name,"\u201D\uFF1F"]}),(0,U.jsx)("p",{children:"\u5C06\u79FB\u9664\u8BE5 FTP/FTPS \u8FDE\u63A5\u53CA\u5176\u72EC\u7ACB\u4FDD\u5B58\u7684\u5BC6\u7801\uFF0C\u4E0D\u4F1A\u5220\u9664\u8FDC\u7AEF\u670D\u52A1\u5668\u4E0A\u7684\u4EFB\u4F55\u6587\u4EF6\u3002"}),(0,U.jsxs)("code",{children:[e.username,"@",e.host,":",e.port]}),t&&(0,U.jsx)("p",{className:"dsh-ssh-inline-error",role:"alert",children:t}),(0,U.jsxs)("div",{className:"dsh-ssh-dialog-actions",children:[(0,U.jsx)("button",{type:"button",className:"dsh-ssh-secondary-button",onClick:s,disabled:o,children:"\u53D6\u6D88"}),(0,U.jsx)("button",{type:"button",className:"dsh-ssh-danger-button",disabled:o,onClick:()=>{i(!0),r().finally(()=>i(!1))},children:o?"\u6B63\u5728\u5220\u9664\u2026":"\u5220\u9664\u8FDE\u63A5"})]})]})}function Jx({value:e,profiles:t,vaultEntries:s,proxyEntries:r,onBack:o,onSaved:i}){let n=s.filter(w=>w.authType==="password"),[a,h]=(0,Mt.useState)({authMode:e?.authMode??"password",name:e?.name??"",group:e?.group??"",protocol:e?.protocol??"ftps-explicit",host:e?.host??"",port:String(e?.port??21),username:e?.username??"",credentialId:e?.credentialId??"",password:"",proxyId:e?.proxy.type==="saved"?e.proxy.proxyId:"",initialPath:e?.initialPath??"/",connectTimeoutMs:String(e?.connectTimeoutMs??15e3),tlsServerName:e?.tlsServerName??"",tags:e?.tags.join(", ")??""}),[l,c]=(0,Mt.useState)(!1),[f,v]=(0,Mt.useState)(!1),[g,d]=(0,Mt.useState)(),[u,p]=(0,Mt.useState)(),m=()=>({profile:{authMode:a.authMode,name:a.name,...a.group.trim()?{group:a.group.trim()}:{},protocol:a.protocol,host:a.host,port:Number(a.port),username:a.username,...a.authMode!=="anonymous"&&a.credentialId?{credentialId:a.credentialId}:{},proxy:a.proxyId?{type:"saved",proxyId:a.proxyId}:{type:"none"},initialPath:a.initialPath,connectTimeoutMs:Number(a.connectTimeoutMs),...a.tlsServerName.trim()?{tlsServerName:a.tlsServerName.trim()}:{},tags:a.tags.split(/[,,]/u).map(w=>w.trim()).filter(Boolean)},secrets:a.authMode==="anonymous"?{}:{password:a.password}}),b=async w=>{w.preventDefault(),c(!0),p(void 0),d(void 0);try{await ie(e===void 0?"/ftp-profiles":`/ftp-profiles/${encodeURIComponent(e.id)}`,{method:e===void 0?"POST":"PUT",body:JSON.stringify(m())}),i()}catch(E){p(Ce(E))}finally{c(!1)}},x=async()=>{v(!0),p(void 0),d(void 0);try{await ie("/ftp-profiles/test-draft",{method:"POST",body:JSON.stringify({...m(),...e===void 0?{}:{profileId:e.id}})}),d("\u8FDE\u63A5\u6210\u529F\uFF0C\u521D\u59CB\u76EE\u5F55\u53EF\u8BFB\u53D6")}catch(w){p(Ce(w))}finally{v(!1)}},y=w=>h(E=>({...E,protocol:w,port:E.port==="21"||E.port==="990"?String(w==="ftps-implicit"?990:21):E.port})),S=(0,Mt.useMemo)(()=>t.flatMap(w=>w.group===void 0?[]:[w.group]),[t]),_=(0,Mt.useMemo)(()=>t.flatMap(w=>w.tags),[t]);return(0,U.jsxs)("form",{className:"dsh-ssh-ftp-editor-form",onSubmit:w=>{b(w)},children:[(0,U.jsxs)("header",{className:"dsh-ssh-ftp-editor-heading",children:[(0,U.jsxs)("button",{type:"button",className:"dsh-ssh-ftp-detail-back",onClick:o,children:[(0,U.jsx)(Vt.IconChevronLeftOutline14,{size:14}),"\u8FD4\u56DE\u8FDE\u63A5\u5217\u8868"]}),(0,U.jsxs)("span",{children:[(0,U.jsx)("strong",{children:e===void 0?"\u65B0\u5EFA\u6587\u4EF6\u8FDE\u63A5":e.name}),(0,U.jsx)("small",{children:e===void 0?"\u586B\u5199\u670D\u52A1\u5668\u548C\u8BA4\u8BC1\u4FE1\u606F":"\u4FEE\u6539\u540E\u53EF\u5148\u6D4B\u8BD5\u518D\u4FDD\u5B58"})]})]}),(0,U.jsxs)("div",{className:"dsh-ssh-ftp-editor-scroll",children:[(0,U.jsxs)("section",{className:"dsh-ssh-ftp-editor-section",children:[(0,U.jsxs)("div",{className:"dsh-ssh-form-section-heading",children:[(0,U.jsx)("strong",{children:"\u8FDE\u63A5\u7C7B\u578B"}),(0,U.jsx)("small",{children:"\u4F18\u5148\u4F7F\u7528 FTPS\uFF1B\u4EC5\u5728\u670D\u52A1\u5668\u4E0D\u652F\u6301 TLS \u65F6\u9009\u62E9 FTP"})]}),(0,U.jsx)("div",{className:"dsh-ssh-ftp-protocol-options",role:"radiogroup","aria-label":"\u8FDE\u63A5\u534F\u8BAE",children:[["ftps-explicit","FTPS","\u663E\u5F0F TLS \xB7 \u63A8\u8350"],["ftps-implicit","FTPS-I","\u9690\u5F0F TLS"],["ftp","FTP","\u672A\u52A0\u5BC6"]].map(w=>(0,U.jsxs)("button",{type:"button","data-ssh-interactive":"choice",role:"radio","aria-checked":a.protocol===w[0],className:a.protocol===w[0]?"is-active":"",onClick:()=>y(w[0]),children:[(0,U.jsx)("span",{className:`dsh-ssh-protocol-badge is-${w[0]}`,children:w[1]}),(0,U.jsxs)("span",{children:[(0,U.jsx)("strong",{children:w[1]}),(0,U.jsx)("small",{children:w[2]})]})]},w[0]))}),a.protocol==="ftp"&&(0,U.jsx)("p",{className:"dsh-ssh-form-warning",children:"\u666E\u901A FTP \u7684\u8D26\u53F7\u3001\u5BC6\u7801\u548C\u6587\u4EF6\u5185\u5BB9\u5747\u4E0D\u52A0\u5BC6\u3002"})]}),(0,U.jsxs)("section",{className:"dsh-ssh-ftp-editor-section",children:[(0,U.jsxs)("div",{className:"dsh-ssh-form-section-heading",children:[(0,U.jsx)("strong",{children:"\u670D\u52A1\u5668"}),(0,U.jsx)("small",{children:"\u540D\u79F0\u7528\u4E8E\u8FDE\u63A5\u5217\u8868\uFF0C\u5206\u7EC4\u4E0E\u6807\u7B7E\u53EF\u590D\u7528\u5DF2\u6709\u9009\u9879"})]}),(0,U.jsxs)("div",{className:"dsh-ssh-form-grid",children:[(0,U.jsx)(ae,{label:"\u8FDE\u63A5\u540D\u79F0",children:(0,U.jsx)("input",{autoFocus:e===void 0,required:!0,maxLength:80,value:a.name,onChange:w=>h({...a,name:w.target.value})})}),(0,U.jsx)(ae,{label:"\u5206\u7EC4\uFF08\u53EF\u9009\uFF09",children:(0,U.jsx)($r,{ariaLabel:"FTP \u5206\u7EC4",maxLength:64,options:S,placeholder:"\u9009\u62E9\u5DF2\u6709\u5206\u7EC4\u6216\u8F93\u5165\u65B0\u5206\u7EC4",value:a.group,onChange:w=>h(E=>({...E,group:w}))})})]}),(0,U.jsxs)("div",{className:"dsh-ssh-form-grid is-host",children:[(0,U.jsx)(ae,{label:"\u670D\u52A1\u5668\u5730\u5740",children:(0,U.jsx)("input",{required:!0,maxLength:253,spellCheck:!1,value:a.host,onChange:w=>h({...a,host:w.target.value})})}),(0,U.jsx)(ae,{label:"\u7AEF\u53E3",children:(0,U.jsx)("input",{required:!0,type:"number",min:"1",max:"65535",value:a.port,onChange:w=>h({...a,port:w.target.value})})})]}),(0,U.jsx)(ae,{label:"\u6807\u7B7E\uFF08\u53EF\u9009\uFF09",hint:"\u53EF\u9009\u62E9\u5DF2\u6709\u6807\u7B7E\u6216\u76F4\u63A5\u8F93\u5165\uFF1B\u591A\u4E2A\u6807\u7B7E\u4F7F\u7528\u9017\u53F7\u5206\u9694\u3002",children:(0,U.jsx)($r,{ariaLabel:"FTP \u6807\u7B7E",multiple:!0,options:_,placeholder:"\u9009\u62E9\u6216\u8F93\u5165\u6807\u7B7E",value:a.tags,onChange:w=>h(E=>({...E,tags:w}))})})]}),(0,U.jsxs)("section",{className:"dsh-ssh-ftp-editor-section",children:[(0,U.jsxs)("div",{className:"dsh-ssh-form-section-heading",children:[(0,U.jsx)("strong",{children:"\u8EAB\u4EFD\u8BA4\u8BC1"}),(0,U.jsx)("small",{children:"\u5BC6\u7801\u53EA\u5199\u5165 DSH \u51ED\u636E\u670D\u52A1\uFF0C\u4E0D\u4F1A\u5728\u754C\u9762\u56DE\u663E"})]}),(0,U.jsx)(ae,{label:"\u767B\u5F55\u65B9\u5F0F",children:(0,U.jsxs)("select",{value:a.authMode,onChange:w=>{h({...a,authMode:w.target.value}),d(void 0)},children:[(0,U.jsx)("option",{value:"password",children:"\u8D26\u53F7\u5BC6\u7801"}),(0,U.jsx)("option",{value:"anonymous",children:"\u533F\u540D\u767B\u5F55"})]})}),a.authMode==="anonymous"?(0,U.jsx)("p",{children:"\u4F7F\u7528 anonymous \u767B\u5F55\uFF0C\u65E0\u9700\u586B\u5199\u8D26\u53F7\u5BC6\u7801\uFF1B\u670D\u52A1\u5668\u5FC5\u987B\u5F00\u653E\u533F\u540D\u8BBF\u95EE\u3002"}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)("div",{className:"dsh-ssh-form-grid",children:[(0,U.jsx)(ae,{label:"\u7528\u6237\u540D",children:(0,U.jsx)("input",{required:!0,maxLength:128,autoComplete:"username",value:a.username,onChange:w=>h({...a,username:w.target.value})})}),(0,U.jsx)(ae,{label:"\u51ED\u636E\u6765\u6E90",children:(0,U.jsxs)("select",{value:a.credentialId,onChange:w=>h({...a,credentialId:w.target.value}),children:[(0,U.jsx)("option",{value:"",children:"\u6B64\u8FDE\u63A5\u5355\u72EC\u4FDD\u5B58\u5BC6\u7801"}),n.map(w=>(0,U.jsxs)("option",{value:w.id,children:[w.name," \xB7 ",w.username]},w.id))]})})]}),!a.credentialId&&(0,U.jsx)(ae,{label:"\u5BC6\u7801",hint:e?.credential.configured&&e.credential.source==="profile"?"\u5DF2\u4FDD\u5B58\uFF1B\u7559\u7A7A\u4FDD\u6301\u4E0D\u53D8":"\u4FDD\u5B58\u540E\u4E0D\u4F1A\u56DE\u663E",children:(0,U.jsx)("input",{required:e===void 0||e.credential.source!=="profile"||!e.credential.configured,type:"password",autoComplete:"new-password",value:a.password,onChange:w=>h({...a,password:w.target.value})})})]})]}),(0,U.jsxs)("section",{className:"dsh-ssh-ftp-editor-section",children:[(0,U.jsxs)("div",{className:"dsh-ssh-form-section-heading",children:[(0,U.jsx)("strong",{children:"\u8DEF\u5F84\u4E0E\u7F51\u7EDC"}),(0,U.jsx)("small",{children:"\u4EE3\u7406\u590D\u7528 SSH \u63D2\u4EF6\u7684\u4EE3\u7406\u5E93\uFF0C\u63A7\u5236\u548C\u6570\u636E\u8FDE\u63A5\u4F7F\u7528\u540C\u4E00\u8DEF\u5F84"})]}),(0,U.jsxs)("div",{className:"dsh-ssh-form-grid",children:[(0,U.jsx)(ae,{label:"\u521D\u59CB\u76EE\u5F55",children:(0,U.jsx)("input",{required:!0,maxLength:4096,spellCheck:!1,value:a.initialPath,onChange:w=>h({...a,initialPath:w.target.value})})}),(0,U.jsx)(ae,{label:"\u8FDE\u63A5\u4EE3\u7406",children:(0,U.jsxs)("select",{value:a.proxyId,onChange:w=>h({...a,proxyId:w.target.value}),children:[(0,U.jsx)("option",{value:"",children:"\u76F4\u8FDE"}),r.map(w=>(0,U.jsxs)("option",{value:w.id,children:[w.name," \xB7 ",w.proxyType.toUpperCase()]},w.id))]})})]}),(0,U.jsxs)("details",{className:"dsh-ssh-form-advanced",children:[(0,U.jsx)("summary",{children:"\u9AD8\u7EA7\u8FDE\u63A5\u8BBE\u7F6E"}),(0,U.jsxs)("div",{className:"dsh-ssh-form-grid",children:[(0,U.jsx)(ae,{label:"\u8FDE\u63A5\u8D85\u65F6\uFF08\u6BEB\u79D2\uFF09",children:(0,U.jsx)("input",{required:!0,type:"number",min:"1000",max:"120000",step:"1000",value:a.connectTimeoutMs,onChange:w=>h({...a,connectTimeoutMs:w.target.value})})}),(0,U.jsx)(ae,{label:"TLS \u670D\u52A1\u5668\u540D\u79F0",hint:"\u8BC1\u4E66\u540D\u79F0\u4E0E\u4E3B\u673A\u4E0D\u540C\u65F6\u586B\u5199",children:(0,U.jsx)("input",{maxLength:253,spellCheck:!1,value:a.tlsServerName,onChange:w=>h({...a,tlsServerName:w.target.value})})})]})]})]}),g&&(0,U.jsx)("p",{className:"dsh-ssh-inline-success",role:"status",children:g}),u&&(0,U.jsx)("p",{className:"dsh-ssh-inline-error",role:"alert",children:u})]}),(0,U.jsxs)("footer",{className:"dsh-ssh-ftp-editor-actions",children:[(0,U.jsx)("button",{type:"button",className:"dsh-ssh-secondary-button",onClick:()=>{x()},disabled:f||l,children:f?"\u6B63\u5728\u6D4B\u8BD5\u2026":"\u6D4B\u8BD5\u8FDE\u63A5"}),(0,U.jsx)("span",{}),(0,U.jsx)("button",{type:"button",className:"dsh-ssh-secondary-button",onClick:o,disabled:l||f,children:"\u53D6\u6D88"}),(0,U.jsx)("button",{type:"submit",className:"dsh-ssh-primary-button",disabled:l||f,children:l?"\u6B63\u5728\u4FDD\u5B58\u2026":"\u4FDD\u5B58\u8FDE\u63A5"})]})]})}function Yx(e){return e==="ftp"?"FTP":e==="ftps-explicit"?"FTPS":"FTPS-I"}var Qx=new Intl.Collator(void 0,{numeric:!0,sensitivity:"base"}),Zl=Qx.compare;function Ff(e,t,s){let r=s==="asc"?1:-1;return e.map((o,i)=>({entry:o,index:i})).sort((o,i)=>{let n=o.entry.kind==="directory"||o.entry.navigable===!0,a=i.entry.kind==="directory"||i.entry.navigable===!0;if(n!==a)return n?-1:1;let h=Zx(o.entry,i.entry,t);if(h!==0)return h*r;let l=t==="name"?0:Zl(o.entry.name,i.entry.name);return l!==0?l:o.index-i.index}).map(o=>o.entry)}function Zx(e,t,s){return s==="name"?Zl(e.name,t.name):e[s]-t[s]}var B=require("react/jsx-runtime"),Hf="dsh-ssh:file-transfer:tabs:v2",eh=38,ey=new Intl.DateTimeFormat(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit"});function $f({ftpProfiles:e,vaultEntries:t,proxyEntries:s,access:r,onProfilesChanged:o}){let i=vr(),[n,a]=(0,ye.useState)([]),[h,l]=(0,ye.useState)([]),[c,f]=(0,ye.useState)(()=>dy()),[v,g]=(0,ye.useState)(()=>c[0]?.id??"transfer-1"),[d,u]=(0,ye.useState)(!1),[p,m]=(0,ye.useState)(!1),[b,x]=(0,ye.useState)(),[y,S]=(0,ye.useState)(),[_,w]=(0,ye.useState)(),[E,C]=(0,ye.useState)({}),P=(0,ye.useRef)(new Map),A=(0,ye.useCallback)(async()=>{try{let L=await ch();a(L),f(T=>uy(T,L))}catch(L){w(Ce(L))}},[]);(0,ye.useEffect)(()=>{A()},[A,e]),(0,ye.useEffect)(()=>{try{localStorage.setItem(Hf,JSON.stringify(c))}catch{}},[c]),(0,ye.useEffect)(()=>{let L=P.current,T=h.filter(z=>Bf(z.state)&&L.has(z.id)&&!Bf(L.get(z.id)));P.current=new Map(h.map(z=>[z.id,z.state])),T.length!==0&&C(z=>{let K={...z};for(let O of T){let J=eo(O.request.destinationEndpointId,O.request.destinationDirectory);K[J]=(K[J]??0)+1}return K})},[h]),(0,ye.useEffect)(()=>{let L=!1,T,z=async()=>{if(document.visibilityState==="hidden"){T=window.setTimeout(()=>{z()},1800);return}try{let K=await ph();L||l(K)}catch{}L||(T=window.setTimeout(()=>{z()},800))};return z(),()=>{L=!0,T!==void 0&&clearTimeout(T)}},[]);let M=c.find(L=>L.id===v)??c[0],F=L=>f(T=>T.map(z=>z.id===M?.id?L(z):z)),$=()=>{let L=`transfer-${Date.now().toString(36)}`,T=sh(L,c.length+1);f(z=>[...z,T]),g(L)},H=L=>{if(c.length===1)return;let T=c.findIndex(K=>K.id===L),z=c.filter(K=>K.id!==L);f(z),v===L&&g(z[Math.max(0,T-1)].id)},j=L=>F(T=>({...T,panes:Array.from({length:L},(z,K)=>T.panes[K]??to(`${T.id}-pane-${K}`))})),k=async(L,T,z,K,O)=>{let J={endpointId:L,directory:T},N={endpointId:K,directory:O};if(!(gi(J,N)||!vi(J,z,N)))try{w(void 0);let I=await Zr({sourceEndpointId:L,sourcePaths:z,destinationEndpointId:K,destinationDirectory:O,conflictPolicy:"fail"});l(W=>[I,...W.filter(X=>X.id!==I.id)])}catch(I){w(Ce(I))}},R=async(L,T,z)=>{try{w(void 0);let K=await Cn(L,{paneId:T.id,endpointId:T.endpointId,directory:z});K.job!==void 0&&l(O=>[K.job,...O.filter(J=>J.id!==K.job.id)]),K.operation==="move"&&C(O=>{let J={...O};for(let N of[eo(L.endpointId,L.directory),eo(T.endpointId,z)])J[N]=(J[N]??0)+1;return J})}catch(K){w(Ce(K))}};return(0,B.jsxs)("div",{className:"dsh-ssh-transfer-workspace",children:[(0,B.jsxs)("header",{className:"dsh-ssh-transfer-header",children:[(0,B.jsxs)("div",{children:[(0,B.jsx)("h1",{children:"\u6587\u4EF6\u4F20\u8F93"}),(0,B.jsx)("p",{children:"FTP\u3001FTPS \u4E0E SFTP \u4E4B\u95F4\u76F4\u63A5\u6D41\u5F0F\u4E92\u4F20"})]}),(0,B.jsxs)("div",{className:"dsh-ssh-transfer-actions",children:[(0,B.jsxs)("button",{type:"button","data-ssh-interactive":"control",className:"dsh-ssh-secondary-button",onClick:()=>m(!0),children:["\u4F1A\u8BDD\u8BBF\u95EE \xB7 ",r.value?.fileEndpointIds.length??0]}),(0,B.jsx)("button",{type:"button","data-ssh-interactive":"control",className:"dsh-ssh-secondary-button",onClick:()=>u(!0),children:"FTP \u7BA1\u7406"})]})]}),_&&(0,B.jsxs)("div",{className:"dsh-ssh-banner is-error",role:"alert",children:[(0,B.jsx)("span",{children:_}),(0,B.jsx)("button",{type:"button",onClick:()=>w(void 0),"aria-label":"\u5173\u95ED",children:(0,B.jsx)(Et.IconCloseOutline16,{size:16})})]}),(0,B.jsxs)("section",{ref:i.ref,onPointerMove:i.onPointerMove,onPointerLeave:i.onPointerLeave,className:"dsh-ssh-transfer-stage dsh-ssh-border-surface",children:[(0,B.jsxs)("div",{className:"dsh-ssh-transfer-tabbar",role:"tablist","aria-label":"\u6587\u4EF6\u4F20\u8F93\u4EFB\u52A1\u9875",children:[(0,B.jsxs)("div",{className:"dsh-ssh-transfer-tabs",children:[c.map(L=>(0,B.jsxs)("span",{"data-ssh-interactive":"choice",className:`dsh-ssh-transfer-tab${L.id===M?.id?" is-active":""}`,children:[(0,B.jsx)("button",{type:"button",role:"tab","aria-selected":L.id===M?.id,onClick:()=>g(L.id),children:L.name}),c.length>1&&(0,B.jsx)("button",{type:"button",className:"is-close","aria-label":`\u5173\u95ED ${L.name}`,onClick:()=>H(L.id),children:(0,B.jsx)(Et.IconCloseOutline16,{size:13})})]},L.id)),(0,B.jsx)("button",{type:"button","data-ssh-interactive":"control",className:"is-add","aria-label":"\u65B0\u5EFA\u4F20\u8F93\u4EFB\u52A1\u9875",onClick:$,children:(0,B.jsx)(Et.IconPlusOutline16,{size:15})})]}),(0,B.jsx)("div",{className:"dsh-ssh-pane-layout","aria-label":"\u7A97\u683C\u6570\u91CF",children:[2,3,4].map(L=>(0,B.jsxs)("button",{type:"button","data-ssh-interactive":"choice","aria-pressed":M?.panes.length===L,className:M?.panes.length===L?"is-active":"",onClick:()=>j(L),children:[L," \u680F"]},L))})]}),n.length===0?(0,B.jsxs)("div",{className:"dsh-ssh-transfer-empty",children:[(0,B.jsx)(Et.IconDataOutline16,{size:24}),(0,B.jsx)("strong",{children:"\u8FD8\u6CA1\u6709\u53EF\u7528\u6587\u4EF6\u8FDE\u63A5"}),(0,B.jsx)("p",{children:"\u65B0\u5EFA FTP/FTPS \u8FDE\u63A5\uFF0C\u6216\u5148\u6DFB\u52A0\u4E00\u53F0 SSH \u4E3B\u673A\u4F7F\u7528 SFTP\u3002"}),(0,B.jsx)("button",{type:"button",className:"dsh-ssh-primary-button",onClick:()=>u(!0),children:"\u65B0\u5EFA FTP \u8FDE\u63A5"})]}):M&&(0,B.jsx)("div",{className:`dsh-ssh-transfer-panes has-${M.panes.length}`,children:M.panes.map((L,T)=>{let z=M.panes[(T+1)%M.panes.length];return(0,B.jsx)(ty,{pane:L,endpoints:n,dragSource:y,refreshRevision:E[eo(L.endpointId,L.path)]??0,...z===void 0?{}:{destination:z},onManageConnections:()=>u(!0),onDragSourceChange:S,onChange:K=>F(O=>({...O,panes:O.panes.map(J=>J.id===L.id?{...J,...K}:J)})),onTransfer:(K,O)=>{k(L.endpointId,L.path,K,O.endpointId,O.path)},onExternalDrop:(K,O)=>{R(K,L,O)}},L.id)})}),(0,B.jsx)(iy,{jobs:h,endpoints:n,onCancel:async L=>{try{await fh(L),l(T=>T.map(z=>z.id===L?{...z,state:"cancelled"}:z))}catch(T){w(Ce(T))}},onConflict:x})]}),d&&(0,B.jsx)(Nf,{profiles:e,vaultEntries:t,proxyEntries:s,onClose:()=>u(!1),onChanged:()=>{o(),A()}}),p&&(0,B.jsx)(oy,{endpoints:n,access:r,onClose:()=>m(!1)}),b&&(0,B.jsx)(ny,{job:b,onClose:()=>x(void 0),onRetry:async L=>{try{let T=await Zr({...b.request,conflictPolicy:L});l(z=>[T,...z]),x(void 0)}catch(T){w(Ce(T))}}})]})}function ty({pane:e,endpoints:t,destination:s,dragSource:r,refreshRevision:o,onChange:i,onTransfer:n,onExternalDrop:a,onDragSourceChange:h,onManageConnections:l}){let[c,f]=(0,ye.useState)(),[v,g]=(0,ye.useState)(),[d,u]=(0,ye.useState)([]),[p,m]=(0,ye.useState)(e.path),[b,x]=(0,ye.useState)(!1),[y,S]=(0,ye.useState)(0),[_,w]=(0,ye.useState)({key:"name",direction:"asc"}),[E,C]=(0,ye.useState)(!1),[P,A]=(0,ye.useState)(),[M,F]=(0,ye.useState)(),[$,H]=(0,ye.useState)(),j=(0,ye.useRef)(null),k=(0,ye.useRef)(0),R=t.find(ee=>ee.id===e.endpointId),L=(0,ye.useMemo)(()=>Ff(v?.entries??[],_.key,_.direction),[v?.entries,_]),T=L.length>200,z=T?Math.max(0,Math.floor(y/eh)-8):0,K=(0,ye.useMemo)(()=>T?L.slice(z,Math.min(L.length,z+56)):L,[L,z,T]),O=(0,ye.useCallback)(async(ee=e.path)=>{if(R===void 0)return;let ge=++k.current;x(!0),H(void 0);try{let Se=await zi(e.id,R.id,ee);if(ge!==k.current)return;g(Se),m(Se.path),u([]),S(0),j.current&&(j.current.scrollTop=0),i({endpointId:R.id,path:Se.path})}catch(Se){ge===k.current&&H(Ce(Se))}finally{ge===k.current&&x(!1)}},[R?.id,e.path]);(0,ye.useEffect)(()=>{R!==void 0&&O(e.path)},[R?.id,o]),(0,ye.useEffect)(()=>{r===void 0&&(C(!1),A(void 0))},[r]);let J=async ee=>{if(!R)return;let ge=++k.current;x(!0),H(void 0);try{let Se=await dh(e.id,R.id,ee);if(ge!==k.current)return;Ps(Se)?await O(Se.path):f(Se)}catch(Se){ge===k.current&&H(Ce(Se))}finally{ge===k.current&&x(!1)}};(0,ye.useEffect)(()=>{f(void 0)},[R?.id]);let N=ee=>{ee.preventDefault(),J(p)},I=ee=>{w(ge=>ge.key===ee?{key:ee,direction:ge.direction==="asc"?"desc":"asc"}:{key:ee,direction:"asc"}),S(0),j.current&&(j.current.scrollTop=0)},W=ee=>{k.current+=1,i({endpointId:ee.id,path:ee.initialPath}),m(ee.initialPath),g(void 0),H(void 0)},X=()=>{k.current+=1,i({endpointId:"",path:"/"}),g(void 0),u([]),H(void 0),x(!1)},te=(ee,ge)=>u(Se=>ge?Se.includes(ee.path)?Se.filter(de=>de!==ee.path):[...Se,ee.path]:[ee.path]),Z=async()=>{if(!(M===void 0||v===void 0||R===void 0))try{await Qr({paneId:e.id,endpointId:R.id,directory:v.path,paths:M.map(ee=>ee.path)}),u([])}finally{await O(v.path)}},pe=ee=>{ee.preventDefault(),C(!1);let ge=Rr(ee.dataTransfer.getData(Wt));h(void 0),!(ge===void 0||ge.paneId===e.id||gi(ge,{endpointId:e.endpointId,directory:e.path}))&&a(ge,e.path)};return R===void 0?(0,B.jsxs)("section",{className:"dsh-ssh-file-pane is-connections",children:[(0,B.jsxs)("header",{children:[(0,B.jsxs)("span",{className:"dsh-ssh-pane-heading",children:[(0,B.jsx)("strong",{children:"\u8FDE\u63A5\u5217\u8868"}),(0,B.jsx)("small",{children:"\u5355\u51FB\u8FDE\u63A5\u540E\u6D4F\u89C8\u8FDC\u7AEF\u6587\u4EF6"})]}),(0,B.jsx)("button",{type:"button","data-ssh-interactive":"control",className:"dsh-ssh-pane-manage-button",onClick:l,children:"FTP \u7BA1\u7406"})]}),(0,B.jsx)("div",{className:"dsh-ssh-endpoint-list",children:t.map(ee=>(0,B.jsxs)("button",{type:"button","data-ssh-interactive":"row",className:"dsh-ssh-endpoint-row",onClick:()=>W(ee),children:[(0,B.jsx)("span",{className:`dsh-ssh-protocol-badge is-${ee.protocol}`,children:rh(ee.protocol)}),(0,B.jsxs)("span",{children:[(0,B.jsx)("strong",{title:ee.name,children:ee.name}),(0,B.jsx)("small",{title:ee.address,children:ee.address})]}),(0,B.jsxs)("span",{children:[(0,B.jsx)("i",{className:`dsh-ssh-protocol-dot is-${ee.protocol}`,"aria-hidden":"true"}),ee.group??(ee.kind==="sftp"?"SSH \u4E3B\u673A":"\u6587\u4EF6\u8FDE\u63A5")]})]},ee.id))}),(0,B.jsxs)("footer",{children:[(0,B.jsxs)("span",{children:[t.length," \u4E2A\u53EF\u7528\u8FDE\u63A5"]}),(0,B.jsx)("small",{children:"SFTP \u590D\u7528 SSH \u4E3B\u673A\u914D\u7F6E"})]})]}):(0,B.jsxs)("section",{className:`dsh-ssh-file-pane${E?" is-drop-target":""}`,onDragOver:ee=>{ee.dataTransfer.types.includes(Wt)&&fy(r,e)?(ee.preventDefault(),ee.dataTransfer.dropEffect=r?.endpointId===e.endpointId?"move":"copy",A(void 0),C(!0)):E&&C(!1)},onDragLeave:ee=>{ee.currentTarget.contains(ee.relatedTarget)||(C(!1),A(void 0))},onDrop:pe,children:[(0,B.jsxs)("header",{children:[(0,B.jsx)("button",{type:"button",className:"dsh-ssh-pane-back","aria-label":"\u8FD4\u56DE\u8FDE\u63A5\u5217\u8868",onClick:X,children:(0,B.jsx)(Et.IconChevronLeftOutline14,{size:14})}),(0,B.jsxs)("span",{className:"dsh-ssh-pane-endpoint",children:[(0,B.jsx)("strong",{children:R.name}),(0,B.jsx)("small",{title:R.address,children:R.address})]}),(0,B.jsx)("span",{className:`dsh-ssh-protocol-badge is-${R.protocol}`,children:rh(R.protocol)})]}),(0,B.jsxs)("form",{className:"dsh-ssh-file-pathbar",onSubmit:N,children:[(0,B.jsx)("button",{type:"button","aria-label":"\u4E0A\u4E00\u7EA7\u76EE\u5F55",disabled:v?.parent===null||b,onClick:()=>{v?.parent&&O(v.parent)},children:(0,B.jsx)(_y,{})}),(0,B.jsx)("button",{type:"button","aria-label":"\u5237\u65B0\u76EE\u5F55",disabled:b,onClick:()=>{O()},children:(0,B.jsx)(xy,{})}),(0,B.jsx)("input",{"aria-label":"\u8FDC\u7AEF\u8DEF\u5F84",value:p,onChange:ee=>m(ee.target.value)}),(0,B.jsx)("button",{type:"submit",disabled:b,children:"\u524D\u5F80"})]}),(0,B.jsxs)("div",{className:"dsh-ssh-file-table",role:"grid","aria-busy":b,children:[(0,B.jsxs)("div",{className:"dsh-ssh-file-table-head",role:"row",children:[(0,B.jsx)(th,{label:"\u540D\u79F0",sortKey:"name",current:_,onSort:I}),(0,B.jsx)(th,{label:"\u5927\u5C0F",sortKey:"size",current:_,onSort:I}),(0,B.jsx)(th,{label:"\u4FEE\u6539\u65F6\u95F4",sortKey:"modifiedAt",current:_,onSort:I}),(0,B.jsx)("span",{role:"columnheader","aria-label":"\u64CD\u4F5C"})]}),(0,B.jsx)("div",{ref:j,className:"dsh-ssh-file-table-body",onScroll:ee=>{T&&S(ee.currentTarget.scrollTop)},children:b&&!v?(0,B.jsx)("div",{className:"dsh-ssh-file-loading",children:"\u6B63\u5728\u8BFB\u53D6\u76EE\u5F55\u2026"}):$?(0,B.jsxs)("div",{className:"dsh-ssh-file-error",children:[(0,B.jsx)("span",{children:$}),(0,B.jsx)("button",{type:"button",onClick:()=>{O()},children:"\u91CD\u8BD5"})]}):L.length===0?(0,B.jsx)("div",{className:"dsh-ssh-table-empty",children:"\u8FD9\u4E2A\u76EE\u5F55\u662F\u7A7A\u7684\u3002"}):(0,B.jsx)("div",{className:T?"dsh-ssh-file-virtual-list":void 0,style:T?{height:`${L.length*eh}px`}:void 0,children:K.map((ee,ge)=>(0,B.jsx)(ry,{entry:ee,paneId:e.id,endpointId:R.id,sourceDirectory:v?.path??e.path,dragSource:r,dropTarget:P===ee.path,selected:d.includes(ee.path),selectedPaths:d,...T?{style:{position:"absolute",insetInline:0,transform:`translateY(${(z+ge)*eh}px)`}}:{},onDelete:()=>F([ee]),onDirectoryTarget:Se=>{C(!1),A(Se)},onDropIntoDirectory:(Se,de)=>{A(void 0),h(void 0),a(Se,de)},onDragSourceChange:h,onSelect:Se=>te(ee,Se),onOpen:()=>{J(ee.path)}},ee.path))})})]}),(0,B.jsxs)("footer",{children:[(0,B.jsx)("span",{children:d.length>0?`\u5DF2\u9009\u62E9 ${d.length} \u9879`:`${v?.entries.length??0} \u9879`}),(0,B.jsx)("span",{className:"dsh-ssh-file-pane-actions",children:(0,B.jsxs)("button",{type:"button","data-ssh-interactive":"control",className:"dsh-ssh-transfer-to-button",disabled:d.length===0||s===void 0||!s.endpointId||b,onClick:()=>{s?.endpointId&&n(d,s)},children:["\u4F20\u9001\u5230\u4E0B\u4E00\u680F ",(0,B.jsx)("span",{"aria-hidden":"true",children:"\u2192"})]})})]}),E&&(0,B.jsxs)("div",{className:"dsh-ssh-file-drop-overlay",children:[(0,B.jsx)("strong",{children:r?.endpointId===e.endpointId?"\u79FB\u52A8\u5230\u6B64\u76EE\u5F55":"\u590D\u5236\u5230\u6B64\u76EE\u5F55"}),(0,B.jsx)("span",{children:v?.path??e.path})]}),c!==void 0&&(0,B.jsx)(Ne,{className:"dsh-ssh-file-download-dialog",title:c.name,subtitle:c.path,onClose:()=>f(void 0),children:(0,B.jsx)("div",{className:"dsh-ssh-dialog-actions",children:(0,B.jsxs)("a",{className:"dsh-ssh-secondary-button",href:ao(R.id,c.path),download:!0,children:[(0,B.jsx)(jf,{}),(0,B.jsx)("span",{children:"\u4E0B\u8F7D\u5230\u672C\u5730"})]})})}),M!==void 0&&(0,B.jsx)(Wn,{locationName:R.name,locationKind:"remote",entries:M,onClose:()=>F(void 0),onDelete:Z})]})}function th({label:e,sortKey:t,current:s,onSort:r}){let o=s.key===t;return(0,B.jsx)("span",{role:"columnheader","aria-sort":o?s.direction==="asc"?"ascending":"descending":"none",children:(0,B.jsxs)("button",{type:"button",onClick:()=>r(t),children:[e,(0,B.jsx)(sy,{active:o,direction:s.direction})]})})}function sy({active:e,direction:t}){return(0,B.jsx)("svg",{className:e?"is-active":"",viewBox:"0 0 12 12","aria-hidden":"true",children:(0,B.jsx)("path",{d:"m3.5 5 2.5 2.5L8.5 5",transform:t==="desc"?void 0:"rotate(180 6 6)"})})}function jf(){return(0,B.jsx)("svg",{width:16,height:16,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:(0,B.jsx)("path",{d:"M8 2v7m0 0 2.6-2.6M8 9 5.4 6.4M3 11.5v1.25h10V11.5"})})}function ry({entry:e,paneId:t,endpointId:s,sourceDirectory:r,dragSource:o,dropTarget:i,selected:n,selectedPaths:a,style:h,onSelect:l,onOpen:c,onDelete:f,onDirectoryTarget:v,onDropIntoDirectory:g,onDragSourceChange:d}){let u=Ps(e),p=s.startsWith("ftp:")&&e.navigable===void 0&&(e.kind==="symlink"||e.kind==="other"),m=!0,b=u&&(o===void 0||vi(o,o.paths,{endpointId:s,directory:e.path})),x=y=>{if(!u)return;y.preventDefault(),y.stopPropagation(),v(void 0);let S=Rr(y.dataTransfer.getData(Wt));S!==void 0&&vi(S,S.paths,{endpointId:s,directory:e.path})&&g(S,e.path)};return(0,B.jsxs)("div",{role:"row","data-ssh-interactive":"row","data-ssh-context-row":!0,tabIndex:0,"aria-selected":n,"aria-label":`${e.name}${u?"\uFF0C\u76EE\u5F55\uFF0C\u5355\u51FB\u8FDB\u5165\uFF1B\u53EF\u63A5\u6536\u62D6\u653E":p?"\uFF0C\u5355\u51FB\u67E5\u770B":""}`,draggable:e.kind==="file"||u,className:`dsh-ssh-file-row is-${u?"directory":e.kind}${n?" is-selected":""}${i?" is-drop-target":""}`,style:h,onClick:y=>{m&&!y.ctrlKey&&!y.metaKey&&!y.shiftKey?c():l(y.ctrlKey||y.metaKey)},onKeyDown:y=>{y.target===y.currentTarget&&(y.key==="Enter"&&m&&c(),y.key===" "&&(y.preventDefault(),l(y.ctrlKey||y.metaKey)))},onDragStart:y=>{let S=n?a:[e.path],_={paneId:t,endpointId:s,directory:r,paths:S};d(_),y.dataTransfer.effectAllowed="copyMove",y.dataTransfer.setData(Wt,JSON.stringify(_))},onDragEnd:()=>d(void 0),onDragOver:y=>{y.dataTransfer.types.includes(Wt)&&b&&(y.preventDefault(),y.stopPropagation(),y.dataTransfer.dropEffect=o?.endpointId===s?"move":"copy",v(e.path))},onDragLeave:y=>{i&&!y.currentTarget.contains(y.relatedTarget)&&v(void 0)},onDrop:x,children:[(0,B.jsxs)("span",{children:[(0,B.jsx)(yy,{directory:u}),(0,B.jsx)("i",{title:e.name,children:e.name})]}),(0,B.jsx)("span",{children:u?"\u2014":Uf(e.size)}),(0,B.jsx)("span",{children:e.modifiedAt>0?new Date(e.modifiedAt).toLocaleString():"\u2014"}),(0,B.jsxs)("span",{className:"dsh-ssh-file-row-actions dsh-ssh-context-action",children:[(0,B.jsx)("a",{className:"dsh-ssh-file-row-download",href:ao(s,e.path),download:!0,draggable:!1,"aria-label":`\u4E0B\u8F7D ${e.name} \u5230\u672C\u5730`,title:e.kind==="directory"?`\u5C06 ${e.name} \u6253\u5305\u4E0B\u8F7D\u5230\u672C\u5730`:`\u4E0B\u8F7D ${e.name} \u5230\u672C\u5730`,onClick:y=>y.stopPropagation(),children:(0,B.jsx)(jf,{})}),(0,B.jsx)("button",{type:"button",className:"dsh-ssh-file-row-delete",draggable:!1,"aria-label":`\u5220\u9664 ${e.name}`,title:`\u5220\u9664 ${e.name}`,onClick:y=>{y.stopPropagation(),f()},children:(0,B.jsx)(Et.IconTrashOutline16,{size:14})})]})]})}function iy({jobs:e,endpoints:t,onCancel:s,onConflict:r}){let[o,i]=(0,ye.useState)(!0),n=e.filter(a=>a.state==="queued"||a.state==="scanning"||a.state==="transferring");return(0,B.jsxs)("section",{className:`dsh-ssh-transfer-queue${o?" is-open":""}`,children:[(0,B.jsxs)("button",{type:"button",className:"dsh-ssh-transfer-queue-heading","aria-expanded":o,title:o?"\u6536\u8D77\u4F20\u8F93\u4EFB\u52A1":"\u5C55\u5F00\u4F20\u8F93\u4EFB\u52A1",onClick:()=>i(a=>!a),children:[(0,B.jsxs)("span",{children:[(0,B.jsx)("strong",{children:"\u4F20\u8F93\u4EFB\u52A1"}),(0,B.jsx)("small",{children:n.length>0?`${n.length} \u4E2A\u8FDB\u884C\u4E2D`:e.length>0?"\u6700\u8FD1\u4EFB\u52A1":"\u6682\u65E0\u4EFB\u52A1"})]}),(0,B.jsx)("span",{className:"dsh-ssh-transfer-queue-disclosure","aria-hidden":"true",children:(0,B.jsx)(Et.IconChevronDownOutline14,{size:14})})]}),o&&(0,B.jsx)("div",{className:"dsh-ssh-transfer-job-list",children:e.length===0?(0,B.jsx)("p",{children:"\u4ECE\u4E00\u4E2A\u7A97\u683C\u62D6\u5230\u53E6\u4E00\u4E2A\u7A97\u683C\uFF0C\u6216\u9009\u4E2D\u6587\u4EF6\u540E\u70B9\u51FB\u201C\u4F20\u9001\u5230\u4E0B\u4E00\u680F\u201D\u3002"}):e.slice(0,12).map(a=>{let h=a.totalBytes>0?Math.min(100,a.transferredBytes/a.totalBytes*100):a.state==="completed"?100:0;return(0,B.jsxs)("article",{children:[(0,B.jsx)("span",{className:`dsh-ssh-transfer-state is-${a.state}`,"aria-hidden":"true"}),(0,B.jsxs)("span",{className:"dsh-ssh-transfer-job-copy",children:[(0,B.jsxs)("strong",{children:[Vf(a.request.sourcePaths)," ",(0,B.jsx)("i",{children:"\u2192"})," ",py(t,a.request.destinationEndpointId)]}),(0,B.jsx)("small",{children:a.error??my(a,h)}),(0,B.jsx)("span",{className:"dsh-ssh-transfer-job-time",children:gy(a)}),(0,B.jsx)("span",{className:"dsh-ssh-transfer-progress",children:(0,B.jsx)("i",{style:{transform:`scaleX(${h/100})`}})})]}),a.state==="queued"||a.state==="scanning"||a.state==="transferring"?(0,B.jsx)("button",{type:"button",className:"dsh-ssh-icon-button","aria-label":"\u53D6\u6D88\u4F20\u8F93",onClick:()=>{s(a.id)},children:(0,B.jsx)(Et.IconCloseOutline16,{size:15})}):a.state==="failed"&&a.error?.includes("destination already contains")?(0,B.jsx)("button",{type:"button",className:"dsh-ssh-job-resolve",onClick:()=>r(a),children:"\u5904\u7406"}):null]},a.id)})})]})}function ny({job:e,onClose:t,onRetry:s}){let[r,o]=(0,ye.useState)("rename"),[i,n]=(0,ye.useState)(!1);return(0,B.jsxs)(Ne,{className:"dsh-ssh-transfer-conflict-dialog",title:"\u76EE\u6807\u4E2D\u5B58\u5728\u540C\u540D\u6587\u4EF6",subtitle:"\u4E3A\u672C\u6279\u4F20\u8F93\u9009\u62E9\u5904\u7406\u65B9\u5F0F",onClose:t,children:[(0,B.jsxs)("div",{className:"dsh-ssh-transfer-conflict-copy",children:[(0,B.jsx)("strong",{children:Vf(e.request.sourcePaths)}),(0,B.jsx)("span",{children:e.request.destinationDirectory})]}),(0,B.jsx)("div",{className:"dsh-ssh-conflict-options",children:[["rename","\u81EA\u52A8\u91CD\u547D\u540D","\u4FDD\u7559\u4E24\u4EFD\u6587\u4EF6\uFF0C\u5728\u540D\u79F0\u540E\u6DFB\u52A0\u5E8F\u53F7"],["skip","\u8DF3\u8FC7\u540C\u540D\u6587\u4EF6","\u7EE7\u7EED\u4F20\u8F93\u5176\u4ED6\u5185\u5BB9"],["overwrite","\u8986\u76D6\u76EE\u6807\u6587\u4EF6","\u4F7F\u7528\u6765\u6E90\u5185\u5BB9\u66FF\u6362\u76EE\u6807\u5185\u5BB9"]].map(a=>(0,B.jsxs)("button",{type:"button","data-ssh-interactive":"choice","aria-pressed":r===a[0],className:r===a[0]?"is-active":"",onClick:()=>o(a[0]),children:[(0,B.jsx)("i",{"aria-hidden":"true"}),(0,B.jsxs)("span",{children:[(0,B.jsx)("strong",{children:a[1]}),(0,B.jsx)("small",{children:a[2]})]})]},a[0]))}),(0,B.jsxs)("div",{className:"dsh-ssh-dialog-actions",children:[(0,B.jsx)("button",{type:"button",className:"dsh-ssh-secondary-button","data-ssh-dialog-close":!0,onClick:t,children:"\u53D6\u6D88"}),(0,B.jsx)("button",{type:"button",className:"dsh-ssh-primary-button",disabled:i,onClick:()=>{n(!0),s(r).finally(()=>n(!1))},children:i?"\u6B63\u5728\u91CD\u65B0\u52A0\u5165\u961F\u5217\u2026":"\u7EE7\u7EED\u4F20\u8F93"})]})]})}function oy({endpoints:e,access:t,onClose:s}){let r=t.value,o=e.filter(n=>r?.fileEndpointIds.includes(n.id)).length,i=n=>t.setFileEndpoints(r?.fileEndpointIds.includes(n)?r.fileEndpointIds.filter(a=>a!==n):[...r?.fileEndpointIds??[],n]);return(0,B.jsxs)(Ne,{className:"dsh-ssh-file-access-dialog",title:"\u4F1A\u8BDD\u8BBF\u95EE",subtitle:"\u5355\u72EC\u7BA1\u7406\u5F53\u524D\u4F1A\u8BDD\u53EF\u4F7F\u7528\u7684\u8FDC\u7AEF\u6587\u4EF6\u8FDE\u63A5",onClose:s,children:[(0,B.jsxs)("div",{className:"dsh-ssh-file-access-body dsh-ssh-scroll-surface",children:[t.error&&(0,B.jsx)("p",{className:"dsh-ssh-inline-error",role:"alert",children:t.error}),(0,B.jsxs)("section",{className:"dsh-ssh-file-access-section","aria-labelledby":"dsh-ssh-file-access-connections",children:[(0,B.jsxs)("header",{children:[(0,B.jsxs)("span",{children:[(0,B.jsx)("strong",{id:"dsh-ssh-file-access-connections",children:"\u6587\u4EF6\u8FDE\u63A5"}),(0,B.jsx)("small",{children:"\u5141\u8BB8\u5F53\u524D\u4F1A\u8BDD\u6D4F\u89C8\u6307\u5B9A\u7684 FTP\u3001FTPS \u6216 SFTP"})]}),(0,B.jsxs)("i",{children:[o.toString().padStart(2,"0")," / ",e.length.toString().padStart(2,"0")]})]}),(0,B.jsx)("div",{className:"dsh-ssh-file-access-list",children:t.loading?(0,B.jsx)(ly,{}):e.length===0?(0,B.jsxs)("div",{className:"dsh-ssh-file-access-empty",children:[(0,B.jsx)("strong",{children:"\u6CA1\u6709\u53EF\u7528\u8FDE\u63A5"}),(0,B.jsx)("small",{children:"\u8BF7\u5148\u5728\u6587\u4EF6\u4F20\u8F93\u4E2D\u6DFB\u52A0 FTP\uFF0C\u6216\u5728\u4E3B\u673A\u9762\u677F\u4E2D\u6DFB\u52A0 SSH \u4E3B\u673A\u3002"})]}):e.map(n=>(0,B.jsx)(ay,{endpoint:n,enabled:r?.fileEndpointIds.includes(n.id)??!1,onToggle:()=>i(n.id)},n.id))})]}),(0,B.jsxs)("section",{className:"dsh-ssh-file-access-section is-options","aria-labelledby":"dsh-ssh-file-access-policy",children:[(0,B.jsx)("header",{children:(0,B.jsxs)("span",{children:[(0,B.jsx)("strong",{id:"dsh-ssh-file-access-policy",children:"\u8BBF\u95EE\u7B56\u7565"}),(0,B.jsx)("small",{children:"\u6587\u4EF6\u6743\u9650\u4E0E SSH \u547D\u4EE4\u3001\u7EC8\u7AEF\u6743\u9650\u76F8\u4E92\u72EC\u7ACB"})]})}),(0,B.jsxs)("div",{className:"dsh-ssh-file-access-options",children:[(0,B.jsxs)("div",{className:"dsh-ssh-file-access-policy-row",children:[(0,B.jsxs)("span",{children:[(0,B.jsx)("strong",{children:"\u6587\u4EF6\u64CD\u4F5C\u6743\u9650"}),(0,B.jsx)("small",{children:"\u6D4F\u89C8\u6A21\u5F0F\u4E0D\u4F1A\u5411 AI \u66B4\u9732\u8DE8\u7AEF\u4F20\u8F93\u5DE5\u5177"})]}),(0,B.jsx)(hy,{value:r?.filePermission??"browse",onChange:t.setFilePermission})]}),(0,B.jsxs)("div",{className:"dsh-ssh-file-access-policy-row",children:[(0,B.jsxs)("span",{children:[(0,B.jsx)("strong",{children:"\u4F20\u8F93\u524D\u786E\u8BA4"}),(0,B.jsx)("small",{children:"AI \u53D1\u8D77\u4F20\u8F93\u65F6\u8BF7\u6C42 DSH \u6388\u6743"})]}),(0,B.jsx)(cy,{checked:r?.requireFileApproval??!0,onChange:t.setRequireFileApproval})]})]})]})]}),(0,B.jsxs)("footer",{className:"dsh-ssh-file-access-footer",children:[(0,B.jsxs)("span",{className:t.saving?"is-saving":"is-saved",children:[(0,B.jsx)("i",{"aria-hidden":"true"}),t.saving?"\u6B63\u5728\u4FDD\u5B58\u66F4\u6539":`${o>0?`\u5DF2\u6388\u6743 ${o} \u4E2A\u8FDE\u63A5`:"\u672A\u6388\u6743\u8FDE\u63A5"} \xB7 \u81EA\u52A8\u4FDD\u5B58`]}),(0,B.jsx)("button",{type:"button",className:"dsh-ssh-primary-button","data-ssh-dialog-close":!0,disabled:t.saving,onClick:s,children:t.saving?"\u4FDD\u5B58\u4E2D\u2026":"\u5B8C\u6210"})]})]})}function ay({endpoint:e,enabled:t,onToggle:s}){return(0,B.jsxs)("button",{type:"button","data-ssh-interactive":"choice",className:`dsh-ssh-file-access-endpoint${t?" is-mounted":""}`,"aria-pressed":t,onClick:s,children:[(0,B.jsx)("span",{className:`dsh-ssh-protocol-badge is-${e.protocol}`,children:rh(e.protocol)}),(0,B.jsxs)("span",{className:"dsh-ssh-file-access-endpoint-copy",children:[(0,B.jsx)("strong",{title:e.name,children:e.name}),(0,B.jsx)("small",{title:e.address,children:e.address})]}),(0,B.jsxs)("span",{className:"dsh-ssh-file-access-state",children:[(0,B.jsx)("i",{"aria-hidden":"true",children:(0,B.jsx)("b",{})}),(0,B.jsx)("em",{children:t?"\u5DF2\u6388\u6743":"\u672A\u6388\u6743"})]})]})}function ly(){return(0,B.jsx)("div",{className:"dsh-ssh-file-access-skeleton","aria-label":"\u6B63\u5728\u8BFB\u53D6\u4F1A\u8BDD\u6743\u9650",children:[0,1,2].map(e=>(0,B.jsxs)("span",{style:{"--ssh-skeleton-index":e},children:[(0,B.jsx)("i",{}),(0,B.jsxs)("b",{children:[(0,B.jsx)("i",{}),(0,B.jsx)("i",{})]}),(0,B.jsx)("em",{})]},e))})}function hy({value:e,onChange:t}){return(0,B.jsx)("div",{className:"dsh-ssh-file-permission-picker",role:"radiogroup","aria-label":"\u6587\u4EF6\u64CD\u4F5C\u6743\u9650",children:[["browse","\u4EC5\u6D4F\u89C8"],["transfer","\u5141\u8BB8\u4F20\u8F93"]].map(([s,r])=>(0,B.jsx)("button",{type:"button","data-ssh-interactive":"choice",role:"radio","aria-checked":e===s,className:e===s?"is-active":"",onClick:()=>t(s),children:r},s))})}function cy({checked:e,onChange:t}){return(0,B.jsxs)("button",{type:"button","data-ssh-interactive":"choice",role:"switch","aria-checked":e,className:`dsh-ssh-file-approval-switch${e?" is-active":""}`,onClick:()=>t(!e),children:[(0,B.jsx)("i",{"aria-hidden":"true",children:(0,B.jsx)("b",{})}),(0,B.jsx)("span",{children:e?"\u9700\u8981\u786E\u8BA4":"\u76F4\u63A5\u6267\u884C"})]})}function dy(){try{let e=JSON.parse(localStorage.getItem(Hf)??"[]");if(!Array.isArray(e))return[sh("transfer-1",1)];let t=e.slice(0,8).flatMap(s=>{if(typeof s!="object"||s===null)return[];let r=s;if(typeof r.id!="string"||!/^[a-zA-Z0-9_-]{1,100}$/.test(r.id)||typeof r.name!="string"||!Array.isArray(r.panes))return[];let o=r.panes.slice(0,4).flatMap(i=>{if(typeof i!="object"||i===null)return[];let n=i;return typeof n.id=="string"&&/^[a-zA-Z0-9_-]{1,100}$/.test(n.id)&&typeof n.endpointId=="string"&&typeof n.path=="string"?[{id:n.id,endpointId:"",path:"/"}]:[]});return o.length>=2?[{id:r.id,name:r.name.slice(0,40),panes:o}]:[]});if(t.length>0)return t}catch{}return[sh("transfer-1",1)]}function sh(e,t){return{id:e,name:`\u4EFB\u52A1 ${t}`,panes:[to(`${e}-a`),to(`${e}-b`)]}}function to(e){return{id:e,endpointId:"",path:"/"}}function uy(e,t){return e.map(s=>({...s,panes:s.panes.map(r=>!r.endpointId||t.some(o=>o.id===r.endpointId)?r:to(r.id))}))}function py(e,t){return e.find(s=>s.id===t)?.name??t}function Vf(e){let t=e[0]?.replaceAll("\\","/").split("/").filter(Boolean).at(-1)??"\u6587\u4EF6";return e.length>1?`${t} \u7B49 ${e.length} \u9879`:t}function rh(e){return e==="sftp"?"SFTP":e==="ftp"?"FTP":e==="ftps-explicit"?"FTPS":"FTPS-I"}function eo(e,t){return JSON.stringify([e,t.replaceAll("\\","/").replace(/\/+$/,"")||"/"])}function fy(e,t){return e===void 0||e.paneId!==t.id&&!gi(e,{endpointId:t.endpointId,directory:t.path})}function Bf(e){return e==="completed"||e==="failed"||e==="cancelled"}function Uf(e){return e<1024?`${e} B`:e<1024**2?`${(e/1024).toFixed(1)} KB`:e<1024**3?`${(e/1024**2).toFixed(1)} MB`:`${(e/1024**3).toFixed(2)} GB`}function my(e,t){if(e.state==="queued")return"\u7B49\u5F85\u4F20\u8F93";if(e.state==="scanning")return"\u6B63\u5728\u626B\u63CF\u76EE\u5F55";if(e.state==="transferring"){let s=Math.max(1,(Date.now()-(e.startedAt??Date.now()))/1e3),r=e.transferredBytes/s,o=r>0?Math.max(0,(e.totalBytes-e.transferredBytes)/r):0;return`${t.toFixed(0)}% \xB7 ${Uf(r)}/s${o>1?` \xB7 \u7EA6 ${by(o)}`:""}`}return e.state==="completed"?`\u5DF2\u5B8C\u6210 ${e.completedFiles} \u4E2A\u6587\u4EF6${e.skippedFiles?`\uFF0C\u8DF3\u8FC7 ${e.skippedFiles}`:""}`:e.state==="cancelled"?"\u5DF2\u53D6\u6D88":"\u4F20\u8F93\u5931\u8D25"}function gy(e){if(e.startedAt===void 0)return`\u521B\u5EFA\u4E8E ${zf(e.createdAt)}`;let t=e.completedAt??Date.now(),s=vy(Math.max(0,t-e.startedAt));return e.completedAt===void 0?`\u5DF2\u6267\u884C ${s}`:`\u8017\u65F6 ${s} \xB7 \u5B8C\u6210\u4E8E ${zf(e.completedAt)}`}function zf(e){return ey.format(e)}function vy(e){let t=Math.max(0,Math.floor(e/1e3));if(t<60)return`${t} \u79D2`;let s=Math.floor(t/60);return s<60?`${s} \u5206 ${String(t%60).padStart(2,"0")} \u79D2`:`${Math.floor(s/60)} \u5C0F\u65F6 ${String(s%60).padStart(2,"0")} \u5206`}function by(e){if(e<60)return`${Math.ceil(e)} \u79D2`;let t=Math.ceil(e/60);return t<60?`${t} \u5206\u949F`:`${Math.floor(t/60)} \u5C0F\u65F6 ${t%60} \u5206\u949F`}function _y(){return(0,B.jsx)("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:(0,B.jsx)("path",{d:"M8 12V4m0 0L4.8 7.2M8 4l3.2 3.2"})})}function xy(){return(0,B.jsx)("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:(0,B.jsx)("path",{d:"M12.2 5.2A5 5 0 1 0 13 9M12.2 5.2V2.5m0 2.7H9.5"})})}function yy({directory:e}){return(0,B.jsx)("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:e?(0,B.jsx)("path",{d:"M2 4.3h4l1.2 1.4H14v6.8H2z"}):(0,B.jsx)("path",{d:"M3.2 2h6l3.6 3.6V14H3.2zm6 0v3.6h3.6"})})}var Wf=`.dsh-ssh-transfer-workspace {
5623
+ `;var _t=require("react"),ot=require("@deepseek-ai/dsh-client-ui-primitives");var xs=require("react"),br=require("@deepseek-ai/dsh-client-ui-primitives"),xe=require("react/jsx-runtime");function Cf({profile:e,project:t,workspaces:s,currentWorkspaceId:r,recentWorkspaceId:o,returnFocus:i,onClose:n,onCreate:a}){let h=s.some(x=>String(x.workspaceId)===r)?r:s.some(x=>String(x.workspaceId)===o)?o:s[0]===void 0?void 0:String(s[0].workspaceId),[l,c]=(0,xs.useState)(h),[f,v]=(0,xs.useState)(!1),[g,d]=(0,xs.useState)(),u=(0,xs.useRef)(null),p=(0,xs.useRef)(null);(0,xs.useEffect)(()=>((u.current??p.current)?.focus(),()=>{i.isConnected&&i.focus()}),[i]);let m=()=>{f||n()},b=async x=>{if(x.preventDefault(),l!==void 0){v(!0),d(void 0);try{await a(t,l)}catch(y){d(Mx(y)),v(!1)}}};return(0,xe.jsx)(br.Modal,{open:!0,onClose:m,title:"\u9009\u62E9\u4F1A\u8BDD\u5F52\u5C5E\u7A7A\u95F4",headless:!0,className:"dsh-ssh-session-create-modal",children:(0,xe.jsxs)("section",{className:"dsh-ssh-session-create-shell",onKeyDown:Ox,children:[(0,xe.jsxs)("header",{children:[(0,xe.jsxs)("span",{children:[(0,xe.jsx)("h2",{children:"\u65B0\u5EFA\u8FDC\u7AEF\u4F1A\u8BDD"}),(0,xe.jsx)("p",{children:"\u9009\u62E9\u8FD9\u4E2A\u4F1A\u8BDD\u5728 DSH \u4E2D\u5F52\u5C5E\u7684\u672C\u5730\u9879\u76EE"})]}),(0,xe.jsx)("button",{ref:p,type:"button",className:"dsh-ssh-icon-button",disabled:f,onClick:m,"aria-label":"\u5173\u95ED",children:(0,xe.jsx)(br.IconCloseOutline16,{size:16})})]}),(0,xe.jsxs)("form",{onSubmit:x=>{b(x)},children:[(0,xe.jsxs)("dl",{className:"dsh-ssh-session-create-target",children:[(0,xe.jsxs)("div",{children:[(0,xe.jsx)("dt",{children:"\u8FDC\u7AEF\u4E3B\u673A"}),(0,xe.jsxs)("dd",{children:[e.name,(0,xe.jsxs)("small",{children:[e.username,"@",e.host,":",e.port]})]})]}),(0,xe.jsxs)("div",{children:[(0,xe.jsx)("dt",{children:"\u8FDC\u7AEF\u5DE5\u4F5C\u76EE\u5F55"}),(0,xe.jsxs)("dd",{children:[t.name,(0,xe.jsx)("small",{title:t.path,children:t.path})]})]})]}),(0,xe.jsxs)("fieldset",{className:"dsh-ssh-workspace-picker",children:[(0,xe.jsx)("legend",{children:"\u4F1A\u8BDD\u5F52\u5C5E\u7A7A\u95F4"}),(0,xe.jsx)("p",{children:"\u4F1A\u8BDD\u8BB0\u5F55\u4FDD\u5B58\u5728\u6240\u9009 DSH \u9879\u76EE\u4E2D\uFF0CSSH \u547D\u4EE4\u4E0E\u7EC8\u7AEF\u56FA\u5B9A\u4F7F\u7528\u4E0A\u9762\u7684\u8FDC\u7AEF\u76EE\u5F55\u3002"}),s.length===0?(0,xe.jsxs)("div",{className:"dsh-ssh-workspace-picker-empty",children:[(0,xe.jsx)(br.IconFolderClose16,{size:18}),(0,xe.jsxs)("span",{children:[(0,xe.jsx)("strong",{children:"\u8FD8\u6CA1\u6709\u53EF\u7528\u7684 DSH \u9879\u76EE"}),(0,xe.jsx)("small",{children:"\u8BF7\u5148\u5173\u95ED\u6B64\u7A97\u53E3\uFF0C\u5728 DSH \u5DE6\u4FA7\u7A7A\u95F4\u4E2D\u65B0\u5EFA\u6216\u6DFB\u52A0\u9879\u76EE\u3002"})]})]}):(0,xe.jsx)("div",{className:"dsh-ssh-workspace-options dsh-ssh-scroll-surface",role:"radiogroup","aria-label":"\u9009\u62E9 DSH \u9879\u76EE",children:s.map(x=>{let y=String(x.workspaceId),S=y===r?"\u5F53\u524D\u9879\u76EE":y===o?"\u6700\u8FD1\u4F7F\u7528":void 0;return(0,xe.jsxs)("label",{className:"dsh-ssh-workspace-option",children:[(0,xe.jsx)("input",{ref:y===h?u:void 0,className:"sr-only",type:"radio",name:"dsh-ssh-session-workspace",value:y,checked:l===y,disabled:f,onChange:()=>c(y)}),(0,xe.jsxs)("span",{children:[(0,xe.jsx)("span",{className:"dsh-ssh-workspace-option-icon",children:(0,xe.jsx)(br.IconFolderClose16,{size:16})}),(0,xe.jsxs)("span",{className:"dsh-ssh-workspace-option-copy",children:[(0,xe.jsx)("strong",{children:x.title}),(0,xe.jsx)("small",{title:x.path,children:x.path})]}),S&&(0,xe.jsx)("em",{children:S}),(0,xe.jsx)("i",{"aria-hidden":"true"})]})]},y)})})]}),g&&(0,xe.jsx)("p",{className:"dsh-ssh-inline-error",role:"alert",children:g}),(0,xe.jsxs)("div",{className:"dsh-ssh-dialog-actions",children:[(0,xe.jsx)("button",{type:"button",className:"dsh-ssh-secondary-button",disabled:f,onClick:m,children:"\u53D6\u6D88"}),(0,xe.jsx)("button",{type:"submit",className:"dsh-ssh-primary-button",disabled:f||l===void 0,children:f?"\u6B63\u5728\u65B0\u5EFA\u2026":"\u65B0\u5EFA\u5E76\u6253\u5F00"})]})]})]})})}function Ox(e){if(e.key!=="Tab")return;let t=Array.from(e.currentTarget.querySelectorAll('button:not(:disabled), input:not(:disabled), a[href], [tabindex]:not([tabindex="-1"])')).filter(o=>o.getClientRects().length>0),s=t[0],r=t[t.length-1];s===void 0||r===void 0||(e.shiftKey&&document.activeElement===s?(e.preventDefault(),r.focus()):!e.shiftKey&&document.activeElement===r&&(e.preventDefault(),s.focus()))}function Mx(e){return e instanceof Error?e.message:String(e)}var Kt=require("react"),Qn=require("@deepseek-ai/dsh-client-ui-primitives");var qt=require("react/jsx-runtime"),Nx="project-directory-picker",Fx=600;function Ef({profileId:e,value:t,disabled:s,onChange:r}){let o=(0,Kt.useId)(),i=(0,Kt.useId)(),n=(0,Kt.useRef)(0),[a,h]=(0,Kt.useState)({kind:"idle"}),l=`sftp:${e}`,c=(0,Kt.useMemo)(()=>a.kind==="ready"?a.directory.entries.filter(Ps):[],[a]);(0,Kt.useEffect)(()=>{let v=++n.current,g=t.trim();if(g.length===0){h({kind:"idle"});return}h({kind:"checking"});let d=window.setTimeout(()=>{zi(Nx,l,g).then(u=>{v===n.current&&h({kind:"ready",directory:u})}).catch(u=>{v===n.current&&h({kind:"error",message:Bx(u)})})},Fx);return()=>window.clearTimeout(d)},[l,t]);let f=a.kind==="idle"?"\u53EF\u76F4\u63A5\u8F93\u5165\uFF1B\u505C\u6B62\u8F93\u5165\u540E\u4F1A\u81EA\u52A8\u68C0\u67E5\u8FDC\u7AEF\u8DEF\u5F84\u3002":a.kind==="checking"?"\u6B63\u5728\u68C0\u67E5\u8FDC\u7AEF\u8DEF\u5F84\u2026":a.kind==="error"?`\u8DEF\u5F84\u4E0D\u5B58\u5728\u6216\u65E0\u6CD5\u8BBF\u95EE\uFF1A${a.message}\u3002\u4ECD\u53EF\u6309\u5F53\u524D\u8F93\u5165\u4FDD\u5B58\u3002`:c.length===0?"\u8DEF\u5F84\u53EF\u8BBF\u95EE\uFF0C\u5F53\u524D\u6CA1\u6709\u5B50\u76EE\u5F55\u3002":`\u8DEF\u5F84\u53EF\u8BBF\u95EE\uFF0C\u627E\u5230 ${c.length} \u4E2A\u5B50\u76EE\u5F55\u3002`;return(0,qt.jsxs)("div",{className:"dsh-ssh-field dsh-ssh-remote-path-field",children:[(0,qt.jsx)("label",{htmlFor:o,children:"\u8FDC\u7AEF\u8DEF\u5F84"}),(0,qt.jsx)("input",{id:o,required:!0,maxLength:4096,value:t,disabled:s,spellCheck:!1,placeholder:"/var/www/example","aria-invalid":a.kind==="error"?"true":void 0,"aria-describedby":i,onChange:v=>r(v.target.value)}),(0,qt.jsx)("small",{id:i,className:`dsh-ssh-remote-path-feedback is-${a.kind}`,role:a.kind==="error"?"alert":"status",children:f}),a.kind==="ready"&&c.length>0&&(0,qt.jsx)("div",{className:"dsh-ssh-remote-path-options","aria-label":"\u53EF\u9009\u62E9\u7684\u8FDC\u7AEF\u5B50\u76EE\u5F55",children:c.map(v=>(0,qt.jsxs)("button",{type:"button",disabled:s,title:`\u9009\u62E9 ${v.path}`,onClick:()=>r(v.path),children:[(0,qt.jsx)(Qn.IconFolderClose16,{size:15,"aria-hidden":"true"}),(0,qt.jsx)("span",{children:v.name}),(0,qt.jsx)(Qn.IconChevronRightOutline14,{size:13,"aria-hidden":"true"})]},v.path))})]})}function Bx(e){return e instanceof Error?e.message:String(e)}function qr(e,t){return e.mountedProjectIds?.[t]??(e.workingProjectIds[t]?[e.workingProjectIds[t]]:[])}var re=require("react/jsx-runtime");function Tf(e){let t=vr(),[s,r]=(0,_t.useState)(""),[o,i]=(0,_t.useState)(()=>new Set),[n,a]=(0,_t.useState)(()=>new Set),[h,l]=(0,_t.useState)({}),[c,f]=(0,_t.useState)(),[v,g]=(0,_t.useState)(),[d,u]=(0,_t.useState)(),[p,m]=(0,_t.useState)(),b=s.trim().toLocaleLowerCase(),x=(0,_t.useMemo)(()=>$x(e.profiles.filter(E=>jx(E).includes(b))),[b,e.profiles]),y=async E=>{f(E);try{let C=await bh(E);l(P=>({...P,[E]:C})),m(void 0)}catch(C){m(Xl(C))}finally{f(C=>C===E?void 0:C)}},S=E=>{a(new Set([E])),h[E]===void 0&&y(E),e.onSelect({profileId:E,path:"~"})},_=E=>{let C=e.access?.profileIds??[],P=C.includes(E);e.onProfiles(P?C.filter(A=>A!==E):[...C,E]),P&&e.onDirectory(E,void 0)},w=E=>i(C=>{let P=new Set(C);return P.has(E)?P.delete(E):P.add(E),P});return(0,re.jsxs)("aside",{ref:t.ref,onPointerMove:t.onPointerMove,onPointerLeave:t.onPointerLeave,className:"dsh-ssh-remote-tree dsh-ssh-border-surface",children:[(0,re.jsxs)("header",{className:"dsh-ssh-tree-header",children:[(0,re.jsxs)("span",{children:[(0,re.jsx)("strong",{children:"\u4E3B\u673A\u4E0E\u9879\u76EE"}),(0,re.jsxs)("small",{children:[e.profiles.length," \u53F0\u4E3B\u673A"]})]}),(0,re.jsx)("button",{type:"button",className:"dsh-ssh-icon-button",onClick:e.onNewProfile,"aria-label":"\u65B0\u5EFA\u8FDE\u63A5",title:"\u65B0\u5EFA\u8FDE\u63A5",children:(0,re.jsx)(ot.IconPlusOutline16,{size:16})})]}),(0,re.jsxs)("label",{className:"dsh-ssh-search",children:[(0,re.jsx)("span",{className:"sr-only",children:"\u641C\u7D22\u4E3B\u673A"}),(0,re.jsx)("input",{value:s,onChange:E=>r(E.target.value),placeholder:"\u641C\u7D22\u4E3B\u673A\u3001\u5206\u7EC4\u3001\u6807\u7B7E\u2026"})]}),(0,re.jsxs)("div",{className:"dsh-ssh-tree-scroll dsh-ssh-scroll-surface",children:[x.map(E=>{let C=o.has(E.name);return(0,re.jsxs)("section",{className:"dsh-ssh-tree-group","data-collapsed":C,children:[(0,re.jsx)("h3",{children:(0,re.jsxs)("button",{type:"button","aria-expanded":!C,onClick:()=>w(E.name),children:[C?(0,re.jsx)(ot.IconChevronRightOutline14,{size:14}):(0,re.jsx)(ot.IconChevronDownOutline14,{size:14}),(0,re.jsx)("span",{children:E.name}),(0,re.jsx)("small",{children:E.profiles.length})]})}),!C&&E.profiles.map(P=>{let A=n.has(P.id),M=e.access?.profileIds.includes(P.id)===!0,F=h[P.id]??[],$=e.selected?.profileId===P.id&&e.selected.projectId===void 0;return(0,re.jsxs)("div",{className:"dsh-ssh-tree-host","data-open":A,children:[(0,re.jsxs)("div",{"data-ssh-interactive":"row","data-ssh-context-row":!0,className:`dsh-ssh-tree-host-row${M?" is-authorized":""}${$?" is-active":""}`,children:[(0,re.jsxs)("button",{type:"button",className:"dsh-ssh-tree-host-main","aria-pressed":$,"aria-expanded":A,title:`\u9009\u62E9\u5E76\u5C55\u5F00 ${P.name}`,onClick:()=>S(P.id),children:[(0,re.jsx)("span",{className:"dsh-ssh-host-monogram",children:P.name.slice(0,1).toUpperCase()}),(0,re.jsxs)("span",{children:[(0,re.jsx)("strong",{children:P.name}),(0,re.jsxs)("small",{children:[P.username,"@",P.host]})]})]}),(0,re.jsx)("button",{type:"button","data-ssh-interactive":"choice",className:`dsh-ssh-tree-mount dsh-ssh-context-action${M?" is-mounted":""}`,"aria-label":`${M?"\u5378\u8F7D":"\u6302\u8F7D"} ${P.name}`,"aria-pressed":M,title:e.access===null?"\u6253\u5F00\u4E00\u4E2A DSH \u4F1A\u8BDD\u540E\u624D\u80FD\u6302\u8F7D\u4E3B\u673A":M?"\u4ECE\u5F53\u524D\u4F1A\u8BDD\u5378\u8F7D":"\u6302\u8F7D\u5230\u5F53\u524D\u4F1A\u8BDD",disabled:e.access===null||e.accessLoading||e.accessSaving,onClick:()=>_(P.id),children:M?"\u5378\u8F7D":"\u6302\u8F7D"}),(0,re.jsx)("button",{type:"button",className:"dsh-ssh-tree-add","aria-label":`\u4E3A ${P.name} \u6DFB\u52A0\u56FA\u5B9A\u76EE\u5F55`,title:"\u6DFB\u52A0\u56FA\u5B9A\u76EE\u5F55",onClick:()=>g({profile:P}),children:(0,re.jsx)(ot.IconPlusOutline16,{size:14})})]}),A&&(0,re.jsx)("div",{className:"dsh-ssh-tree-branches",children:c===P.id&&h[P.id]===void 0?(0,re.jsx)("p",{className:"dsh-ssh-tree-state",children:"\u6B63\u5728\u8BFB\u53D6\u56FA\u5B9A\u76EE\u5F55\u2026"}):F.length===0?(0,re.jsxs)("button",{type:"button",className:"dsh-ssh-tree-empty",onClick:()=>g({profile:P}),children:[(0,re.jsx)(ot.IconPlusOutline16,{size:13}),"\u6DFB\u52A0\u9879\u76EE\u76EE\u5F55"]}):F.map(H=>{let j=e.selected?.projectId===H.id,k=e.access!==null&&qr(e.access,P.id).includes(H.id),R=e.access?.workingProjectIds[P.id]===H.id;return(0,re.jsx)("div",{className:"dsh-ssh-tree-project",children:(0,re.jsxs)("div",{"data-ssh-interactive":"row",className:`dsh-ssh-tree-project-row${j?" is-active":""}${k?" is-bound":""}`,children:[(0,re.jsxs)("button",{type:"button",className:"dsh-ssh-tree-project-main","aria-pressed":e.access===null?void 0:k,title:e.access===null?"\u5F53\u524D\u6CA1\u6709\u53EF\u6302\u8F7D\u76EE\u5F55\u7684 DSH \u4F1A\u8BDD":M?k?"\u4ECE\u5F53\u524D\u4F1A\u8BDD\u5378\u8F7D\u6B64\u76EE\u5F55":"\u6302\u8F7D\u76EE\u5F55\uFF0C\u53EF\u540C\u65F6\u9009\u62E9\u591A\u4E2A":"\u8BF7\u5148\u6302\u8F7D\u8BE5\u4E3B\u673A",onClick:()=>{M&&!e.accessLoading&&!e.accessSaving&&(e.onToggleProject(P.id,H.id,H.path),e.onSelect(k?{profileId:P.id,path:"~"}:{profileId:P.id,path:H.path,projectId:H.id}))},children:[(0,re.jsx)("span",{children:k?(0,re.jsx)(ot.IconFolderOpenOutline16,{size:15}):(0,re.jsx)(ot.IconFolderClose16,{size:15})}),(0,re.jsxs)("span",{children:[(0,re.jsx)("strong",{children:H.name}),(0,re.jsx)("small",{children:H.path}),k&&(0,re.jsx)("em",{children:R?"\u5DF2\u6302\u8F7D \xB7 \u9ED8\u8BA4\u5DE5\u4F5C\u76EE\u5F55":"\u5DF2\u6302\u8F7D"})]})]}),(0,re.jsxs)("div",{className:"dsh-ssh-tree-project-actions",children:[k&&!R&&(0,re.jsx)("button",{type:"button",className:"dsh-ssh-tree-project-edit",disabled:e.accessSaving,title:"\u8BBE\u4E3A\u9ED8\u8BA4\u5DE5\u4F5C\u76EE\u5F55","aria-label":`\u5C06 ${H.name} \u8BBE\u4E3A\u9ED8\u8BA4\u76EE\u5F55`,onClick:()=>e.onDirectory(P.id,H.path,H.id),children:(0,re.jsx)(ot.IconFolderOpenOutline16,{size:13})}),(0,re.jsx)("button",{type:"button",className:"dsh-ssh-tree-project-new","aria-label":`\u5728 ${H.name} \u65B0\u5EFA\u4F1A\u8BDD`,title:"\u65B0\u5EFA\u4F1A\u8BDD",onClick:L=>{m(void 0),u({profile:P,project:H,returnFocus:L.currentTarget})},children:(0,re.jsx)(ot.IconPlusOutline16,{size:13})}),(0,re.jsx)("button",{type:"button",className:"dsh-ssh-tree-project-edit","aria-label":`\u7F16\u8F91 ${H.name}`,title:"\u7F16\u8F91\u56FA\u5B9A\u76EE\u5F55",onClick:()=>g({profile:P,project:H}),children:(0,re.jsx)(ot.IconEditOutline16,{size:13})})]})]})},H.id)})})]},P.id)})]},E.name)}),x.length===0&&(0,re.jsx)("p",{className:"dsh-ssh-tree-no-results",children:e.profiles.length===0?"\u8FD8\u6CA1\u6709 SSH \u4E3B\u673A":"\u6CA1\u6709\u5339\u914D\u7684\u4E3B\u673A"})]}),(0,re.jsx)(zx,{access:e.access,loading:e.accessLoading,saving:e.accessSaving,error:e.accessError??p,onPermission:e.onPermission,onApproval:e.onApproval}),v!==void 0&&(0,re.jsx)(Hx,{profile:v.profile,project:v.project,onClose:()=>g(void 0),onSaved:async()=>{let E=v.profile.id;g(void 0),await y(E),await e.onProjectsChanged()}}),d!==void 0&&(0,re.jsx)(Cf,{...d,workspaces:e.workspaces,currentWorkspaceId:e.currentWorkspaceId,recentWorkspaceId:e.recentWorkspaceId,onClose:()=>u(void 0),onCreate:e.onCreateSession})]})}function zx({access:e,loading:t,saving:s,error:r,onPermission:o,onApproval:i}){return(0,re.jsxs)("footer",{className:"dsh-ssh-access-footer",children:[(0,re.jsxs)("div",{className:"dsh-ssh-access-heading",children:[(0,re.jsxs)("span",{children:[(0,re.jsx)("strong",{children:"\u5F53\u524D\u4F1A\u8BDD\u6743\u9650"}),(0,re.jsxs)("small",{children:[e?.profileIds.length??0," \u53F0\u4E3B\u673A\u53EF\u7528"]})]}),(0,re.jsx)("em",{children:t?"\u8BFB\u53D6\u4E2D":s?"\u4FDD\u5B58\u4E2D":r?"\u672A\u540C\u6B65":"\u5DF2\u540C\u6B65"})]}),(0,re.jsxs)("div",{className:"dsh-ssh-access-segments","aria-label":"SSH \u6743\u9650",children:[(0,re.jsx)("button",{type:"button","data-ssh-interactive":"choice",className:e?.permission==="exec"?"is-active":"","aria-pressed":e?.permission==="exec",disabled:e===null,onClick:()=>o("exec"),children:"\u4EC5\u547D\u4EE4"}),(0,re.jsx)("button",{type:"button","data-ssh-interactive":"choice",className:e?.permission==="terminal"?"is-active":"","aria-pressed":e?.permission==="terminal",disabled:e===null,onClick:()=>o("terminal"),children:"\u7EC8\u7AEF\u63A7\u5236"})]}),(0,re.jsxs)("label",{className:"dsh-ssh-access-approval",children:[(0,re.jsxs)("span",{children:[(0,re.jsx)("strong",{children:"\u6267\u884C\u524D\u786E\u8BA4"}),(0,re.jsx)("small",{children:e?.requireCommandApproval===!1?"\u5173\u95ED\u540E\u6309\u5F53\u524D\u4F1A\u8BDD\u6743\u9650\u76F4\u63A5\u6267\u884C":"\u9700 DSH \u4F7F\u7528 Ask\uFF1BFull Access \u4F1A\u76F4\u63A5\u62D2\u7EDD"})]}),(0,re.jsx)("input",{type:"checkbox",checked:e?.requireCommandApproval??!0,disabled:e===null,onChange:n=>i(n.target.checked)}),(0,re.jsx)("i",{"aria-hidden":"true"})]}),r&&(0,re.jsx)("p",{className:"dsh-ssh-inline-error",role:"alert",children:r})]})}function Hx({profile:e,project:t,onClose:s,onSaved:r}){let[o,i]=(0,_t.useState)(t?.name??""),[n,a]=(0,_t.useState)(t?.path??""),[h,l]=(0,_t.useState)(!1),[c,f]=(0,_t.useState)(),v=async d=>{d.preventDefault(),l(!0),f(void 0);try{t===void 0?await _h(e.id,{name:o,path:n}):await xh(e.id,t.id,{name:o,path:n}),await r()}catch(u){f(Xl(u)),l(!1)}},g=async()=>{if(!(t===void 0||!window.confirm(`\u5220\u9664\u56FA\u5B9A\u76EE\u5F55\u201C${t.name}\u201D\uFF1F\u76F8\u5173 DSH \u4F1A\u8BDD\u4E0D\u4F1A\u5220\u9664\u3002`))){l(!0),f(void 0);try{await yh(e.id,t.id),await r()}catch(d){f(Xl(d)),l(!1)}}};return(0,re.jsx)(Ne,{className:"dsh-ssh-project-dialog",title:t===void 0?"\u6DFB\u52A0\u56FA\u5B9A\u76EE\u5F55":"\u7F16\u8F91\u56FA\u5B9A\u76EE\u5F55",subtitle:`${e.name} \xB7 \u7EC8\u7AEF\u4E0E SFTP \u7684\u9ED8\u8BA4\u8FDC\u7AEF\u8DEF\u5F84`,onClose:s,children:(0,re.jsxs)("form",{className:"dsh-ssh-form",onSubmit:d=>{v(d)},children:[(0,re.jsxs)("label",{className:"dsh-ssh-field",children:[(0,re.jsx)("span",{children:"\u540D\u79F0"}),(0,re.jsx)("input",{required:!0,maxLength:80,value:o,placeholder:"\u7F51\u7AD9\u9879\u76EE",onChange:d=>i(d.target.value)})]}),(0,re.jsx)(Ef,{profileId:e.id,value:n,disabled:h,onChange:a}),c&&(0,re.jsx)("p",{className:"dsh-ssh-inline-error",role:"alert",children:c}),(0,re.jsxs)("div",{className:"dsh-ssh-dialog-actions",children:[t!==void 0&&(0,re.jsxs)("button",{type:"button",className:"dsh-ssh-danger-button",disabled:h,onClick:()=>{g()},children:[(0,re.jsx)(ot.IconTrashOutline16,{size:15}),"\u5220\u9664"]}),(0,re.jsx)("span",{className:"dsh-ssh-dialog-spacer"}),(0,re.jsx)("button",{type:"button",className:"dsh-ssh-secondary-button","data-ssh-dialog-close":!0,disabled:h,onClick:s,children:"\u53D6\u6D88"}),(0,re.jsx)("button",{className:"dsh-ssh-primary-button",disabled:h,children:h?"\u4FDD\u5B58\u4E2D\u2026":"\u4FDD\u5B58\u76EE\u5F55"})]})]})})}function $x(e){let t=new Map;for(let s of e){let r=s.group?.trim()||"\u672A\u5206\u7EC4",o=t.get(r);o===void 0?t.set(r,[s]):o.push(s)}return[...t].map(([s,r])=>({name:s,profiles:r}))}function jx(e){return`${e.name} ${e.group??""} ${e.host} ${e.username} ${e.tags.join(" ")}`.toLocaleLowerCase()}function Xl(e){return e instanceof Error?e.message:String(e)}var ft=require("react");var Jl=new Set;function Kr(e){for(let t of Jl)t(e)}function Pf(e){return Jl.add(e),()=>Jl.delete(e)}function Df(e){let[t,s]=(0,ft.useState)(null),[r,o]=(0,ft.useState)(e!==void 0),[i,n]=(0,ft.useState)(!1),[a,h]=(0,ft.useState)(),l=(0,ft.useRef)(null),c=(0,ft.useRef)(null),f=(0,ft.useRef)(e),v=(0,ft.useRef)(Promise.resolve()),g=(0,ft.useRef)(0);f.current=e,(0,ft.useEffect)(()=>{let p=!1;return l.current=null,c.current=null,s(null),h(void 0),o(e!==void 0),e===void 0?()=>{p=!0}:(ei(e).then(m=>{if(p)return;let b=m??Gr(e);l.current=b,c.current=b,s(b),Kr(b)}).catch(m=>{p||h(Yl(m))}).finally(()=>{p||o(!1)}),()=>{p=!0})},[e]);let d=(0,ft.useCallback)(async p=>{l.current=p,s(p),Kr(p),h(void 0),g.current+=1,n(!0);let m=v.current.catch(()=>{}).then(()=>Hi(p));v.current=m;try{let b=await m;return f.current===b.sessionId&&(c.current=b),f.current===b.sessionId&&l.current===p&&(l.current=b,s(b),Kr(b)),b}catch(b){throw f.current===p.sessionId&&(h(Yl(b)),l.current===p&&c.current&&(l.current=c.current,s(c.current),Kr(c.current))),b}finally{g.current=Math.max(0,g.current-1),f.current===p.sessionId&&g.current===0&&n(!1)}},[]),u=(0,ft.useCallback)(p=>{let m=f.current;if(m===void 0)return;let b=l.current??Gr(m);d({...b,...p,sessionId:m}).catch(()=>{})},[d]);return{value:t,loading:r,saving:i,error:a,refresh:async()=>{let p=f.current;if(p)try{await v.current.catch(()=>{});let m=l.current,b=await ei(p)??Gr(p);if(p!==f.current||m!==l.current)return;l.current=b,c.current=b,s(b),Kr(b)}catch(m){p===f.current&&h(Yl(m))}},setProfiles:p=>{let m=l.current;u({profileIds:p,mountedProjectIds:Object.fromEntries(p.map(b=>[b,m?qr(m,b):[]]))})},toggleProject:(p,m,b)=>{let x=l.current;if(!x||!x.profileIds.includes(p))return;let y=qr(x,p),S=y.includes(m),_=S?y.filter(C=>C!==m):[...y,m],w={...x.workingDirectories},E={...x.workingProjectIds};!S&&E[p]===void 0?(w[p]=b,E[p]=m):S&&E[p]===m&&(delete w[p],delete E[p]),u({workingDirectories:w,workingProjectIds:E,mountedProjectIds:Object.fromEntries(x.profileIds.map(C=>[C,C===p?_:qr(x,C)]))})},setDirectory:(p,m,b)=>{let x=f.current;if(x===void 0)return;let y=l.current??Gr(x),S={...y.workingDirectories},_={...y.workingProjectIds};m===void 0?delete S[p]:S[p]=m,b===void 0?delete _[p]:_[p]=b,u({workingDirectories:S,workingProjectIds:_})},setPermission:p=>u({permission:p}),setRequireCommandApproval:p=>u({requireCommandApproval:p}),setFileEndpoints:p=>u({fileEndpointIds:p}),setFilePermission:p=>u({filePermission:p}),setRequireFileApproval:p=>u({requireFileApproval:p}),replace:d}}function Gr(e){return{sessionId:e,profileIds:[],permission:"exec",requireCommandApproval:!0,fileEndpointIds:[],filePermission:"browse",requireFileApproval:!0,workingDirectories:{},workingProjectIds:{},updatedAt:0}}function Yl(e){return e instanceof Error?e.message:String(e)}var _r=require("react"),Ni=require("react/jsx-runtime"),Zn=38,Oi=28,Mi=66,Vx=320,Ux=280,Wx=7;function Rf(e,t,s){return Math.min(s,Math.max(t,e))}function qx(e){if(typeof window>"u")return Zn;try{let t=Number.parseFloat(window.localStorage.getItem(e)??"");return Number.isFinite(t)?Rf(t,Oi,Mi):Zn}catch{return Zn}}function Ql(e,t){try{window.localStorage.setItem(e,t.toFixed(2))}catch{}}function Kx(e){if(e<=0)return{min:Oi,max:Mi};let t=Ux/e*100,s=(e-Vx-Wx)/e*100,r=Math.max(Oi,t),o=Math.max(r,Math.min(Mi,s));return{min:r,max:o}}function If({primary:e,secondary:t,storageKey:s,label:r,secondaryHidden:o=!1}){let[i,n]=(0,_r.useState)(()=>qx(s)),a=(0,_r.useRef)(null),h=(0,_r.useRef)(null),l=(0,_r.useRef)(i),c=(0,_r.useRef)(),f=b=>{let x=a.current;if(x===null)return b;let y=Kx(x.getBoundingClientRect().width),S=Rf(b,y.min,y.max);return x.style.setProperty("--ssh-sftp-width",`${S}%`),h.current?.setAttribute("aria-valuenow",String(Math.round(S))),l.current=S,S},v=b=>{if(c.current===void 0)return;let x=h.current;c.current=void 0,b!==void 0&&x?.hasPointerCapture(b)&&x.releasePointerCapture(b),a.current?.classList.remove("is-resizing");let y=l.current;n(y),Ql(s,y)},g=b=>{b.button===0&&(c.current=b.pointerId,l.current=i,b.currentTarget.setPointerCapture(b.pointerId),a.current?.classList.add("is-resizing"),b.preventDefault())},d=b=>{if(c.current!==b.pointerId)return;let x=a.current?.getBoundingClientRect();x===void 0||x.width===0||(f((x.right-b.clientX)/x.width*100),b.preventDefault())},u=b=>{let x=b.shiftKey?5:2,y;if(b.key==="ArrowLeft"&&(y=i+x),b.key==="ArrowRight"&&(y=i-x),b.key==="Home"&&(y=Oi),b.key==="End"&&(y=Mi),y===void 0)return;let S=f(y);n(S),Ql(s,S),b.preventDefault()},p=()=>{let b=f(Zn);n(b),Ql(s,b)},m={"--ssh-sftp-width":`${i}%`};return(0,Ni.jsxs)("div",{ref:a,className:`dsh-ssh-workbench-split${o?" is-secondary-hidden":""}`,style:m,children:[e,(0,Ni.jsx)("div",{ref:h,hidden:o,className:"dsh-ssh-workbench-resizer",role:"separator","aria-label":r,"aria-orientation":"vertical","aria-valuemin":Oi,"aria-valuemax":Mi,"aria-valuenow":Math.round(i),tabIndex:0,title:"\u62D6\u52A8\u8C03\u6574\u5BBD\u5EA6\uFF0C\u53CC\u51FB\u6062\u590D\u9ED8\u8BA4",onDoubleClick:p,onKeyDown:u,onPointerDown:g,onPointerMove:d,onPointerUp:b=>v(b.pointerId),onPointerCancel:b=>v(b.pointerId),onLostPointerCapture:()=>v()}),(0,Ni.jsx)("div",{className:"dsh-ssh-split-secondary",hidden:o,children:t})]})}var rt=require("react"),Ot=require("@deepseek-ai/dsh-client-ui-primitives");function Af(e){let t=e.port??22;if(!Number.isSafeInteger(t)||t<1||t>65535)return;let s=e.host.trim().normalize("NFKC").toLocaleLowerCase();return s.startsWith("[")&&s.endsWith("]")&&(s=s.slice(1,-1)),s=s.replace(/\.+$/u,""),s.length===0?void 0:`${s}\0${t}`}function Lf(e,t,s){let r=Af(t);if(r!==void 0)return e.find(o=>o.id!==s&&Af(o)===r)}var G=require("react/jsx-runtime");function Of({profile:e,dependents:t,onClose:s,onDeleted:r}){let[o,i]=(0,rt.useState)(!1),[n,a]=(0,rt.useState)(),h=async()=>{if(!(o||t.length>0)){i(!0),a(void 0);try{await ie(`/profiles/${encodeURIComponent(e.id)}`,{method:"DELETE"}),r()}catch(l){a(Ce(l))}finally{i(!1)}}};return(0,G.jsx)(Ne,{title:`\u5220\u9664 ${e.name}`,subtitle:ys(e),onClose:s,children:(0,G.jsxs)("div",{className:"dsh-ssh-delete-profile",children:[(0,G.jsx)("span",{className:"dsh-ssh-delete-profile-mark",children:(0,G.jsx)(Ot.IconTrashOutline16,{size:19})}),(0,G.jsxs)("div",{children:[(0,G.jsx)("strong",{children:"\u8FD9\u4E2A\u64CD\u4F5C\u65E0\u6CD5\u64A4\u9500"}),(0,G.jsx)("p",{children:"\u8FDE\u63A5\u914D\u7F6E\u3001\u8BE5\u4E3B\u673A\u7684\u72EC\u7ACB\u51ED\u636E\u548C\u5173\u8054\u7AEF\u53E3\u8F6C\u53D1\u4F1A\u4E00\u5E76\u5220\u9664\uFF1B\u5B83\u4E5F\u4F1A\u4ECE\u6240\u6709\u4F1A\u8BDD\u6388\u6743\u4E2D\u79FB\u9664\u3002\u5BC6\u94A5\u5E93\u4E2D\u7684\u5171\u4EAB\u51ED\u636E\u4E0D\u4F1A\u5220\u9664\u3002"})]}),t.length>0&&(0,G.jsxs)("div",{className:"dsh-ssh-delete-profile-block",role:"alert",children:[(0,G.jsx)("strong",{children:"\u6682\u65F6\u4E0D\u80FD\u5220\u9664"}),(0,G.jsxs)("p",{children:["\u4EE5\u4E0B\u8FDE\u63A5\u4ECD\u5C06\u5B83\u4F5C\u4E3A SSH \u8DF3\u677F\uFF1A",t.map(l=>l.name).join("\u3001"),"\u3002\u8BF7\u5148\u4FEE\u6539\u8FD9\u4E9B\u8FDE\u63A5\u7684\u8DF3\u677F\u94FE\u3002"]})]}),n&&(0,G.jsx)("p",{className:"dsh-ssh-inline-error",role:"alert",children:n}),(0,G.jsxs)("div",{className:"dsh-ssh-dialog-actions",children:[(0,G.jsx)("button",{type:"button",className:"dsh-ssh-secondary-button","data-ssh-dialog-close":!0,disabled:o,onClick:s,children:"\u53D6\u6D88"}),(0,G.jsx)("button",{type:"button",className:"dsh-ssh-danger-button",disabled:o||t.length>0,onClick:()=>{h()},children:o?"\u6B63\u5728\u5220\u9664\u2026":"\u5220\u9664\u4E3B\u673A"})]})]})})}function Mf({profile:e,profiles:t,vaultEntries:s,proxyEntries:r,onClose:o,onSaved:i}){let[n,a]=(0,rt.useState)(()=>({name:e?.name??"",group:e?.group??"",host:e?.host??"",port:String(e?.port??22),username:e?.username??"",authType:e?.authType??"password",credentialId:e?.credentialId??"",proxyType:e?.proxy.type??"none",proxyEntryId:e?.proxy.type==="saved"?e.proxy.proxyId:"",proxyHost:e?.proxy.type==="http"||e?.proxy.type==="socks5"?e.proxy.host:"",proxyPort:e?.proxy.type==="http"||e?.proxy.type==="socks5"?String(e.proxy.port):"1080",proxyUsername:e?.proxy.type==="http"||e?.proxy.type==="socks5"?e.proxy.username??"":"",jumpProfileIds:e?.proxy.type==="jump"?e.proxy.profileIds:[],tags:e?.tags.join(", ")??"",password:"",privateKey:"",passphrase:"",proxyPassword:"",hostFingerprint:e?.hostFingerprint??""})),[h,l]=(0,rt.useState)(!1),[c,f]=(0,rt.useState)(!1),[v,g]=(0,rt.useState)(),[d,u]=(0,rt.useState)(),[p,m]=(0,rt.useState)(),[b,x]=(0,rt.useState)(),[y,S]=(0,rt.useState)(!1),_=(0,rt.useId)(),w=(0,rt.useRef)(null),E=k=>({value:n[k],onChange:R=>{a(L=>({...L,[k]:R.target.value})),(k==="host"||k==="port")&&x(void 0),g(void 0),u(void 0)}}),C=s.find(k=>k.id===n.credentialId),P=(0,rt.useMemo)(()=>t.flatMap(k=>k.group===void 0?[]:[k.group]),[t]),A=(0,rt.useMemo)(()=>t.flatMap(k=>k.tags),[t]),M=(0,rt.useMemo)(()=>Lf(t,{host:n.host,port:Number(n.port)},e?.id),[n.host,n.port,e?.id,t]),F=y?M===void 0?b:`\u8BE5\u5730\u5740\u548C\u7AEF\u53E3\u5DF2\u7531\u201C${M.name}\u201D\u4F7F\u7528\uFF0C\u8BF7\u4FEE\u6539\u4E3B\u673A\u6216\u7AEF\u53E3\u3002`:void 0,$=(k=n.hostFingerprint)=>{let R=n.proxyType==="none"?{type:"none"}:n.proxyType==="saved"?{type:"saved",proxyId:n.proxyEntryId}:n.proxyType==="jump"?{type:"jump",profileIds:n.jumpProfileIds}:{type:n.proxyType,host:n.proxyHost,port:Number(n.proxyPort),...n.proxyUsername.trim()?{username:n.proxyUsername.trim()}:{}};return{profile:{name:n.name,...n.group.trim()?{group:n.group.trim()}:{},host:n.host,port:Number(n.port),username:C?.username??n.username,authType:C?.authType??n.authType,...n.credentialId?{credentialId:n.credentialId}:{},...k?{hostFingerprint:k}:{},proxy:R,keepAliveIntervalMs:e?.keepAliveIntervalMs??15e3,connectTimeoutMs:e?.connectTimeoutMs??15e3,terminalType:e?.terminalType??"xterm-256color",tags:n.tags.split(",").map(L=>L.trim()).filter(Boolean)},secrets:{password:n.password,privateKey:n.privateKey,passphrase:n.passphrase,proxyPassword:n.proxyPassword}}},H=async k=>{if(S(!0),M!==void 0){w.current?.focus();return}f(!0),m(void 0),g(void 0),u(void 0);try{await ie("/profiles/test-draft",{method:"POST",body:JSON.stringify({...$(k),...e===void 0?{}:{profileId:e.id}})}),k!==void 0&&a(R=>({...R,hostFingerprint:k})),g("success")}catch(R){R instanceof Nt&&R.body?.code==="HOST_KEY_REQUIRED"&&typeof R.body.fingerprint=="string"?u(R.body.fingerprint):R instanceof Nt&&R.body?.code==="DUPLICATE_PROFILE_ENDPOINT"?(x(Ce(R)),w.current?.focus()):m(Ce(R))}finally{f(!1)}},j=async k=>{if(k.preventDefault(),S(!0),M!==void 0){w.current?.focus();return}l(!0),m(void 0);try{await ie(e===void 0?"/profiles":`/profiles/${e.id}`,{method:e===void 0?"POST":"PUT",body:JSON.stringify($())}),i()}catch(R){R instanceof Nt&&R.body?.code==="DUPLICATE_PROFILE_ENDPOINT"?(x(Ce(R)),w.current?.focus()):m(Ce(R))}finally{l(!1)}};return(0,G.jsx)(Ne,{title:e===void 0?"\u65B0\u5EFA SSH \u8FDE\u63A5":`\u7F16\u8F91 ${e.name}`,subtitle:"\u51ED\u636E\u4FDD\u5B58\u540E\u4E0D\u4F1A\u56DE\u663E",onClose:o,children:(0,G.jsxs)("form",{className:"dsh-ssh-form",onSubmit:k=>{j(k)},children:[(0,G.jsxs)("div",{className:"dsh-ssh-form-section",children:[(0,G.jsxs)("div",{className:"dsh-ssh-form-section-heading",children:[(0,G.jsx)("strong",{children:"\u8FDE\u63A5\u4FE1\u606F"}),(0,G.jsx)("small",{children:"\u4E3B\u673A\u5730\u5740\u4E0E\u663E\u793A\u65B9\u5F0F"})]}),(0,G.jsxs)("div",{className:"dsh-ssh-form-grid",children:[(0,G.jsx)(ae,{label:"\u540D\u79F0",children:(0,G.jsx)("input",{required:!0,maxLength:80,placeholder:"\u5F00\u53D1\u670D\u52A1\u5668",...E("name")})}),(0,G.jsx)(ae,{label:"\u5206\u7EC4",children:(0,G.jsx)($r,{ariaLabel:"\u4E3B\u673A\u5206\u7EC4",maxLength:64,options:P,placeholder:"\u9009\u62E9\u5DF2\u6709\u5206\u7EC4\u6216\u8F93\u5165\u65B0\u5206\u7EC4",value:n.group,onChange:k=>a(R=>({...R,group:k}))})})]}),(0,G.jsxs)("div",{className:"dsh-ssh-form-grid is-host",children:[(0,G.jsxs)(ae,{label:"\u4E3B\u673A",children:[(0,G.jsx)("input",{ref:w,required:!0,"aria-invalid":F===void 0?void 0:!0,"aria-describedby":F===void 0?void 0:_,placeholder:"server.example.com",spellCheck:!1,...E("host"),onBlur:()=>S(!0)}),F&&(0,G.jsx)("small",{id:_,className:"dsh-ssh-field-error",role:"alert",children:F})]}),(0,G.jsx)(ae,{label:"\u7AEF\u53E3",children:(0,G.jsx)("input",{required:!0,"aria-invalid":F===void 0?void 0:!0,"aria-describedby":F===void 0?void 0:_,type:"number",inputMode:"numeric",min:"1",max:"65535",...E("port"),onBlur:()=>S(!0)})})]}),(0,G.jsx)(ae,{label:"\u6807\u7B7E",hint:"\u53EF\u9009\u62E9\u5DF2\u6709\u6807\u7B7E\u6216\u76F4\u63A5\u8F93\u5165\uFF1B\u591A\u4E2A\u6807\u7B7E\u4F7F\u7528\u9017\u53F7\u5206\u9694\u3002",children:(0,G.jsx)($r,{ariaLabel:"\u4E3B\u673A\u6807\u7B7E",multiple:!0,options:A,placeholder:"\u9009\u62E9\u6216\u8F93\u5165\u6807\u7B7E",value:n.tags,onChange:k=>a(R=>({...R,tags:k}))})})]}),(0,G.jsxs)("div",{className:"dsh-ssh-form-section",children:[(0,G.jsxs)("div",{className:"dsh-ssh-form-section-heading",children:[(0,G.jsx)("strong",{children:"\u8EAB\u4EFD\u8BA4\u8BC1"}),(0,G.jsx)("small",{children:"\u9009\u62E9\u5171\u4EAB\u51ED\u636E\u6216\u5355\u72EC\u4FDD\u5B58"})]}),(0,G.jsx)(ae,{label:"\u51ED\u636E\u6765\u6E90",hint:"\u53EF\u4F7F\u7528\u6B64\u8FDE\u63A5\u81EA\u5DF1\u7684\u51ED\u636E\uFF0C\u6216\u5F15\u7528\u5BC6\u94A5\u5E93\u4E2D\u7684\u5E38\u7528\u8D26\u53F7\u3002",children:(0,G.jsxs)("select",{...E("credentialId"),children:[(0,G.jsx)("option",{value:"",children:"\u6B64\u8FDE\u63A5\u72EC\u7ACB\u4FDD\u5B58"}),s.map(k=>(0,G.jsxs)("option",{value:k.id,children:[k.name," \xB7 ",k.username]},k.id))]})}),C?(0,G.jsxs)("div",{className:"dsh-ssh-credential-reference",children:[(0,G.jsx)("span",{children:(0,G.jsx)(Ot.IconUserOutline16,{size:16})}),(0,G.jsxs)("span",{children:[(0,G.jsx)("strong",{children:C.name}),(0,G.jsxs)("small",{children:[C.username," \xB7 ",C.authType==="password"?"\u5BC6\u7801":"\u79C1\u94A5"]})]}),(0,G.jsx)("em",{children:C.credential.configured?"\u5DF2\u5C31\u7EEA":"\u7F3A\u5C11\u51ED\u636E"})]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)("div",{className:"dsh-ssh-form-grid",children:[(0,G.jsx)(ae,{label:"\u7528\u6237\u540D",children:(0,G.jsx)("input",{required:!0,autoComplete:"username",...E("username")})}),(0,G.jsx)(ae,{label:"\u8BA4\u8BC1\u65B9\u5F0F",children:(0,G.jsxs)("select",{...E("authType"),children:[(0,G.jsx)("option",{value:"password",children:"\u5BC6\u7801"}),(0,G.jsx)("option",{value:"private-key",children:"\u79C1\u94A5"}),(0,G.jsx)("option",{value:"agent",children:"SSH Agent"})]})})]}),n.authType==="password"&&(0,G.jsx)(ae,{label:"\u5BC6\u7801",hint:e?.credential.source==="profile"&&e.credential.fields.includes("password")?"\u5DF2\u4FDD\u5B58\uFF1B\u7559\u7A7A\u4FDD\u6301\u4E0D\u53D8":"\u4FDD\u5B58\u540E\u4E0D\u53EF\u8BFB\u56DE",children:(0,G.jsx)("input",{required:e===void 0,type:"password",autoComplete:"new-password",placeholder:e?.credential.source==="profile"&&e.credential.fields.includes("password")?"\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022":"",...E("password")})}),n.authType==="private-key"&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(ae,{label:"\u79C1\u94A5",hint:e?.credential.source==="profile"&&e.credential.fields.includes("privateKey")?"\u5DF2\u4FDD\u5B58\uFF1B\u7559\u7A7A\u4FDD\u6301\u4E0D\u53D8":"\u7C98\u8D34 OpenSSH/PEM \u79C1\u94A5",children:(0,G.jsx)("textarea",{required:e===void 0,rows:5,spellCheck:!1,...E("privateKey")})}),(0,G.jsx)(ae,{label:"\u79C1\u94A5\u53E3\u4EE4",children:(0,G.jsx)("input",{type:"password",autoComplete:"new-password",...E("passphrase")})})]})]})]}),(0,G.jsxs)("div",{className:"dsh-ssh-form-section",children:[(0,G.jsxs)("div",{className:"dsh-ssh-form-section-heading",children:[(0,G.jsx)("strong",{children:"\u8FDE\u63A5\u8DEF\u5F84"}),(0,G.jsx)("small",{children:"\u76F4\u8FDE\u3001\u4EE3\u7406\u6216\u8DF3\u677F\u94FE"})]}),(0,G.jsx)(ae,{label:"\u8FDE\u63A5\u65B9\u5F0F",children:(0,G.jsxs)("select",{...E("proxyType"),children:[(0,G.jsx)("option",{value:"none",children:"\u76F4\u8FDE"}),(0,G.jsx)("option",{value:"saved",children:"\u5E38\u7528\u4EE3\u7406"}),(0,G.jsx)("option",{value:"http",children:"\u81EA\u5B9A\u4E49 HTTP CONNECT"}),(0,G.jsx)("option",{value:"socks5",children:"\u81EA\u5B9A\u4E49 SOCKS5"}),(0,G.jsx)("option",{value:"jump",children:"SSH \u8DF3\u677F"})]})}),n.proxyType==="saved"&&(0,G.jsx)(ae,{label:"\u5E38\u7528\u4EE3\u7406",hint:r.length===0?"\u8BF7\u5148\u5728\u4EE3\u7406\u5E93\u4E2D\u6DFB\u52A0 HTTP \u6216 SOCKS5 \u4EE3\u7406\u3002":"\u591A\u53F0\u4E3B\u673A\u53EF\u5F15\u7528\u540C\u4E00\u6761\u4EE3\u7406\u914D\u7F6E\u3002",children:(0,G.jsxs)("select",{required:!0,...E("proxyEntryId"),children:[(0,G.jsx)("option",{value:"",children:"\u9009\u62E9\u4EE3\u7406"}),r.map(k=>(0,G.jsxs)("option",{value:k.id,children:[k.name," \xB7 ",k.proxyType==="http"?"HTTP":"SOCKS5"," \xB7 ",k.host,":",k.port]},k.id))]})}),(n.proxyType==="http"||n.proxyType==="socks5")&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)("div",{className:"dsh-ssh-form-grid is-host",children:[(0,G.jsx)(ae,{label:"\u4EE3\u7406\u4E3B\u673A",children:(0,G.jsx)("input",{required:!0,spellCheck:!1,...E("proxyHost")})}),(0,G.jsx)(ae,{label:"\u4EE3\u7406\u7AEF\u53E3",children:(0,G.jsx)("input",{required:!0,type:"number",inputMode:"numeric",min:"1",max:"65535",...E("proxyPort")})})]}),(0,G.jsxs)("div",{className:"dsh-ssh-form-grid",children:[(0,G.jsx)(ae,{label:"\u4EE3\u7406\u7528\u6237\u540D",children:(0,G.jsx)("input",{autoComplete:"username",...E("proxyUsername")})}),(0,G.jsx)(ae,{label:"\u4EE3\u7406\u5BC6\u7801",children:(0,G.jsx)("input",{type:"password",autoComplete:"new-password",...E("proxyPassword")})})]})]}),n.proxyType==="jump"&&(0,G.jsx)(Gx,{profiles:t.filter(k=>k.id!==e?.id),value:n.jumpProfileIds,onChange:k=>a(R=>({...R,jumpProfileIds:k}))})]}),d&&(0,G.jsxs)("div",{className:"dsh-ssh-test-result is-warning",role:"alert",children:[(0,G.jsxs)("span",{children:[(0,G.jsx)("strong",{children:"\u9996\u6B21\u8FDE\u63A5\uFF0C\u8BF7\u6838\u5BF9\u4E3B\u673A\u6307\u7EB9"}),(0,G.jsx)("code",{children:d})]}),(0,G.jsx)("button",{type:"button",className:"dsh-ssh-small-primary",disabled:c,onClick:()=>{H(d)},children:"\u786E\u8BA4\u5E76\u91CD\u8BD5"})]}),v==="success"&&(0,G.jsxs)("p",{className:"dsh-ssh-test-result is-success",role:"status",children:[(0,G.jsx)(Ot.IconCheckOutline14,{size:14}),"\u8FDE\u63A5\u6D4B\u8BD5\u6210\u529F"]}),p&&(0,G.jsx)("p",{className:"dsh-ssh-inline-error",role:"alert",children:p}),(0,G.jsxs)("div",{className:"dsh-ssh-dialog-actions",children:[(0,G.jsx)("button",{type:"button",className:"dsh-ssh-secondary-button dsh-ssh-test-button",disabled:h||c,onClick:k=>{k.currentTarget.form?.reportValidity()&&H()},children:c?"\u6B63\u5728\u6D4B\u8BD5\u2026":"\u6D4B\u8BD5\u8FDE\u63A5"}),(0,G.jsx)("button",{type:"button",className:"dsh-ssh-secondary-button","data-ssh-dialog-close":!0,disabled:h||c,onClick:o,children:"\u53D6\u6D88"}),(0,G.jsx)("button",{className:"dsh-ssh-primary-button",disabled:h||c,children:h?"\u6B63\u5728\u4FDD\u5B58\u2026":"\u4FDD\u5B58\u8FDE\u63A5"})]})]})})}function Gx({profiles:e,value:t,onChange:s}){let r=()=>{let n=e.find(a=>!t.includes(a.id));n!==void 0&&t.length<8&&s([...t,n.id])},o=(n,a)=>s(t.map((h,l)=>l===n?a:h)),i=(n,a)=>{let h=n+a;if(h<0||h>=t.length)return;let l=[...t];[l[n],l[h]]=[l[h],l[n]],s(l)};return(0,G.jsxs)("fieldset",{className:"dsh-ssh-jump-chain",children:[(0,G.jsx)("legend",{children:"\u8DF3\u677F\u94FE"}),(0,G.jsx)("p",{children:"\u8FDE\u63A5\u4F1A\u6309\u4ECE\u4E0A\u5230\u4E0B\u7684\u987A\u5E8F\u9010\u7EA7\u5EFA\u7ACB\u3002"}),(0,G.jsx)("div",{children:t.map((n,a)=>(0,G.jsxs)("div",{className:"dsh-ssh-jump-row",children:[(0,G.jsx)("em",{children:a+1}),(0,G.jsxs)("select",{required:!0,value:n,onChange:h=>o(a,h.target.value),children:[(0,G.jsx)("option",{value:"",children:"\u9009\u62E9\u5DF2\u6709\u8FDE\u63A5"}),e.filter(h=>h.id===n||!t.includes(h.id)).map(h=>(0,G.jsxs)("option",{value:h.id,children:[h.name," \xB7 ",h.host]},h.id))]}),(0,G.jsx)("button",{type:"button",className:"dsh-ssh-icon-button",disabled:a===0,"aria-label":"\u4E0A\u79FB\u8DF3\u677F",onClick:()=>i(a,-1),children:(0,G.jsx)(Ot.IconChevronUpOutline14,{size:14})}),(0,G.jsx)("button",{type:"button",className:"dsh-ssh-icon-button",disabled:a===t.length-1,"aria-label":"\u4E0B\u79FB\u8DF3\u677F",onClick:()=>i(a,1),children:(0,G.jsx)(Ot.IconChevronDownOutline14,{size:14})}),(0,G.jsx)("button",{type:"button",className:"dsh-ssh-icon-button is-danger","aria-label":"\u79FB\u9664\u8DF3\u677F",onClick:()=>s(t.filter((h,l)=>l!==a)),children:(0,G.jsx)(Ot.IconTrashOutline16,{size:15})})]},`${n}-${a}`))}),t.length===0&&(0,G.jsx)("p",{className:"dsh-ssh-jump-empty",children:"\u81F3\u5C11\u6DFB\u52A0\u4E00\u53F0\u8DF3\u677F\u4E3B\u673A\u3002"}),(0,G.jsxs)("button",{type:"button",className:"dsh-ssh-secondary-button",disabled:t.length>=8||e.every(n=>t.includes(n.id)),onClick:r,children:[(0,G.jsx)(Ot.IconPlusOutline16,{size:15}),"\u6DFB\u52A0\u8DF3\u677F"]})]})}var ye=require("react"),Et=require("@deepseek-ai/dsh-client-ui-primitives");var Mt=require("react"),Vt=require("@deepseek-ai/dsh-client-ui-primitives");var U=require("react/jsx-runtime");function Nf({profiles:e,vaultEntries:t,proxyEntries:s,onClose:r,onChanged:o}){let[i,n]=(0,Mt.useState)(),[a,h]=(0,Mt.useState)(),[l,c]=(0,Mt.useState)(),f=i!==void 0||a!==void 0,v=p=>{h(void 0),n(p),c(void 0)},g=()=>{h(void 0),n("new"),c(void 0)},d=p=>{n(void 0),h(p),c(void 0)},u=async p=>{c(void 0);try{await ie(`/ftp-profiles/${encodeURIComponent(p.id)}`,{method:"DELETE"}),h(void 0),o()}catch(m){c(Ce(m))}};return(0,U.jsx)(Ne,{className:"dsh-ssh-ftp-manager-dialog",title:"\u6587\u4EF6\u8FDE\u63A5",subtitle:"\u7BA1\u7406 FTP \u4E0E FTPS\uFF1BSFTP \u76F4\u63A5\u590D\u7528\u5DF2\u6709 SSH \u4E3B\u673A",onClose:r,children:(0,U.jsxs)("div",{className:`dsh-ssh-ftp-manager${f?" has-detail":""}`,children:[(0,U.jsxs)("aside",{className:"dsh-ssh-ftp-manager-list",children:[(0,U.jsxs)("header",{children:[(0,U.jsxs)("span",{children:[(0,U.jsx)("strong",{children:"FTP / FTPS"}),(0,U.jsxs)("small",{children:[e.length," \u4E2A\u8FDE\u63A5"]})]}),(0,U.jsxs)("button",{type:"button",className:"dsh-ssh-primary-button",onClick:g,children:[(0,U.jsx)(Vt.IconPlusOutline16,{size:15}),"\u65B0\u5EFA"]})]}),e.length===0?(0,U.jsxs)("div",{className:"dsh-ssh-ftp-list-empty",children:[(0,U.jsx)("span",{children:(0,U.jsx)(Vt.IconDataOutline16,{size:20})}),(0,U.jsx)("strong",{children:"\u8FD8\u6CA1\u6709\u72EC\u7ACB\u6587\u4EF6\u8FDE\u63A5"}),(0,U.jsx)("p",{children:"SFTP \u4F1A\u663E\u793A\u5728\u6587\u4EF6\u7A97\u683C\u7684\u8FDE\u63A5\u5217\u8868\u4E2D\uFF1B\u8FD9\u91CC\u53EA\u7BA1\u7406 FTP \u4E0E FTPS\u3002"}),(0,U.jsx)("button",{type:"button",className:"dsh-ssh-secondary-button",onClick:g,children:"\u65B0\u5EFA FTPS \u8FDE\u63A5"})]}):(0,U.jsx)("div",{className:"dsh-ssh-ftp-profile-list",role:"list",children:e.map(p=>{let m=i!=="new"&&i?.id===p.id||a?.id===p.id;return(0,U.jsxs)("article",{role:"listitem","data-ssh-interactive":"choice","aria-selected":m,className:m?"is-active":"",children:[(0,U.jsxs)("button",{type:"button",className:"dsh-ssh-ftp-profile-main",onClick:()=>v(p),children:[(0,U.jsx)("span",{className:`dsh-ssh-protocol-badge is-${p.protocol}`,children:Yx(p.protocol)}),(0,U.jsxs)("span",{children:[(0,U.jsx)("strong",{title:p.name,children:p.name}),(0,U.jsxs)("small",{title:`${p.username}@${p.host}:${p.port}`,children:[p.username,"@",p.host,":",p.port]})]}),(0,U.jsx)("i",{className:p.authMode==="anonymous"||p.credential.configured?"is-ready":"is-missing",children:p.authMode==="anonymous"?"\u533F\u540D\u767B\u5F55":p.credential.configured?"\u53EF\u7528":"\u7F3A\u5C11\u5BC6\u7801"})]}),(0,U.jsx)("button",{type:"button",className:"dsh-ssh-icon-button is-danger","aria-label":`\u5220\u9664 ${p.name}`,onClick:()=>d(p),children:(0,U.jsx)(Vt.IconTrashOutline16,{size:15})})]},p.id)})})]}),(0,U.jsx)("main",{className:"dsh-ssh-ftp-manager-detail",children:a!==void 0?(0,U.jsx)(Xx,{profile:a,error:l,onBack:()=>h(void 0),onDelete:()=>u(a)}):i!==void 0?(0,U.jsx)(Jx,{value:i==="new"?void 0:i,profiles:e,vaultEntries:t,proxyEntries:s,onBack:()=>n(void 0),onSaved:()=>{n(void 0),o()}},i==="new"?"new":i.id):(0,U.jsxs)("div",{className:"dsh-ssh-ftp-manager-overview",children:[(0,U.jsx)("span",{children:(0,U.jsx)(Vt.IconDataOutline16,{size:22})}),(0,U.jsx)("h3",{children:"\u9009\u62E9\u4E00\u4E2A\u8FDE\u63A5\u8FDB\u884C\u7F16\u8F91"}),(0,U.jsx)("p",{children:"\u6587\u4EF6\u7A97\u683C\u4F1A\u628A\u8FD9\u91CC\u4FDD\u5B58\u7684 FTP\u3001FTPS \u4E0E SSH \u4E3B\u673A\u63D0\u4F9B\u7684 SFTP \u6C47\u603B\u6210\u8FDE\u63A5\u5217\u8868\u3002"}),(0,U.jsxs)("dl",{children:[(0,U.jsxs)("div",{children:[(0,U.jsx)("dt",{children:"FTPS"}),(0,U.jsx)("dd",{children:"\u52A0\u5BC6\u63A7\u5236\u4E0E\u6587\u4EF6\u6570\u636E\uFF0C\u9ED8\u8BA4\u4E25\u683C\u6821\u9A8C\u8BC1\u4E66"})]}),(0,U.jsxs)("div",{children:[(0,U.jsx)("dt",{children:"FTP"}),(0,U.jsx)("dd",{children:"\u517C\u5BB9\u65E7\u670D\u52A1\u5668\uFF0C\u4F46\u8D26\u53F7\u548C\u6587\u4EF6\u5185\u5BB9\u4E0D\u52A0\u5BC6"})]}),(0,U.jsxs)("div",{children:[(0,U.jsx)("dt",{children:"SFTP"}),(0,U.jsx)("dd",{children:"\u7531 SSH \u4E3B\u673A\u7BA1\u7406\uFF0C\u4E0D\u5728\u8FD9\u91CC\u91CD\u590D\u914D\u7F6E"})]})]})]})})]})})}function Xx({profile:e,error:t,onBack:s,onDelete:r}){let[o,i]=(0,Mt.useState)(!1);return(0,U.jsxs)("div",{className:"dsh-ssh-ftp-delete-panel",children:[(0,U.jsxs)("button",{type:"button",className:"dsh-ssh-ftp-detail-back",onClick:s,children:[(0,U.jsx)(Vt.IconChevronLeftOutline14,{size:14}),"\u8FD4\u56DE\u8FDE\u63A5\u5217\u8868"]}),(0,U.jsx)("span",{className:"dsh-ssh-ftp-delete-mark",children:(0,U.jsx)(Vt.IconWarningOutline16,{size:20})}),(0,U.jsxs)("h3",{children:["\u5220\u9664\u201C",e.name,"\u201D\uFF1F"]}),(0,U.jsx)("p",{children:"\u5C06\u79FB\u9664\u8BE5 FTP/FTPS \u8FDE\u63A5\u53CA\u5176\u72EC\u7ACB\u4FDD\u5B58\u7684\u5BC6\u7801\uFF0C\u4E0D\u4F1A\u5220\u9664\u8FDC\u7AEF\u670D\u52A1\u5668\u4E0A\u7684\u4EFB\u4F55\u6587\u4EF6\u3002"}),(0,U.jsxs)("code",{children:[e.username,"@",e.host,":",e.port]}),t&&(0,U.jsx)("p",{className:"dsh-ssh-inline-error",role:"alert",children:t}),(0,U.jsxs)("div",{className:"dsh-ssh-dialog-actions",children:[(0,U.jsx)("button",{type:"button",className:"dsh-ssh-secondary-button",onClick:s,disabled:o,children:"\u53D6\u6D88"}),(0,U.jsx)("button",{type:"button",className:"dsh-ssh-danger-button",disabled:o,onClick:()=>{i(!0),r().finally(()=>i(!1))},children:o?"\u6B63\u5728\u5220\u9664\u2026":"\u5220\u9664\u8FDE\u63A5"})]})]})}function Jx({value:e,profiles:t,vaultEntries:s,proxyEntries:r,onBack:o,onSaved:i}){let n=s.filter(w=>w.authType==="password"),[a,h]=(0,Mt.useState)({authMode:e?.authMode??"password",name:e?.name??"",group:e?.group??"",protocol:e?.protocol??"ftps-explicit",host:e?.host??"",port:String(e?.port??21),username:e?.username??"",credentialId:e?.credentialId??"",password:"",proxyId:e?.proxy.type==="saved"?e.proxy.proxyId:"",initialPath:e?.initialPath??"/",connectTimeoutMs:String(e?.connectTimeoutMs??15e3),tlsServerName:e?.tlsServerName??"",tags:e?.tags.join(", ")??""}),[l,c]=(0,Mt.useState)(!1),[f,v]=(0,Mt.useState)(!1),[g,d]=(0,Mt.useState)(),[u,p]=(0,Mt.useState)(),m=()=>({profile:{authMode:a.authMode,name:a.name,...a.group.trim()?{group:a.group.trim()}:{},protocol:a.protocol,host:a.host,port:Number(a.port),username:a.authMode==="anonymous"?"anonymous":a.username,...a.authMode!=="anonymous"&&a.credentialId?{credentialId:a.credentialId}:{},proxy:a.proxyId?{type:"saved",proxyId:a.proxyId}:{type:"none"},initialPath:a.initialPath,connectTimeoutMs:Number(a.connectTimeoutMs),...a.tlsServerName.trim()?{tlsServerName:a.tlsServerName.trim()}:{},tags:a.tags.split(/[,,]/u).map(w=>w.trim()).filter(Boolean)},secrets:a.authMode==="anonymous"?{}:{password:a.password}}),b=async w=>{w.preventDefault(),c(!0),p(void 0),d(void 0);try{await ie(e===void 0?"/ftp-profiles":`/ftp-profiles/${encodeURIComponent(e.id)}`,{method:e===void 0?"POST":"PUT",body:JSON.stringify(m())}),i()}catch(E){p(Ce(E))}finally{c(!1)}},x=async()=>{v(!0),p(void 0),d(void 0);try{await ie("/ftp-profiles/test-draft",{method:"POST",body:JSON.stringify({...m(),...e===void 0?{}:{profileId:e.id}})}),d("\u8FDE\u63A5\u6210\u529F\uFF0C\u521D\u59CB\u76EE\u5F55\u53EF\u8BFB\u53D6")}catch(w){p(Ce(w))}finally{v(!1)}},y=w=>h(E=>({...E,protocol:w,port:E.port==="21"||E.port==="990"?String(w==="ftps-implicit"?990:21):E.port})),S=(0,Mt.useMemo)(()=>t.flatMap(w=>w.group===void 0?[]:[w.group]),[t]),_=(0,Mt.useMemo)(()=>t.flatMap(w=>w.tags),[t]);return(0,U.jsxs)("form",{className:"dsh-ssh-ftp-editor-form",onSubmit:w=>{b(w)},children:[(0,U.jsxs)("header",{className:"dsh-ssh-ftp-editor-heading",children:[(0,U.jsxs)("button",{type:"button",className:"dsh-ssh-ftp-detail-back",onClick:o,children:[(0,U.jsx)(Vt.IconChevronLeftOutline14,{size:14}),"\u8FD4\u56DE\u8FDE\u63A5\u5217\u8868"]}),(0,U.jsxs)("span",{children:[(0,U.jsx)("strong",{children:e===void 0?"\u65B0\u5EFA\u6587\u4EF6\u8FDE\u63A5":e.name}),(0,U.jsx)("small",{children:e===void 0?"\u586B\u5199\u670D\u52A1\u5668\u548C\u8BA4\u8BC1\u4FE1\u606F":"\u4FEE\u6539\u540E\u53EF\u5148\u6D4B\u8BD5\u518D\u4FDD\u5B58"})]})]}),(0,U.jsxs)("div",{className:"dsh-ssh-ftp-editor-scroll",children:[(0,U.jsxs)("section",{className:"dsh-ssh-ftp-editor-section",children:[(0,U.jsxs)("div",{className:"dsh-ssh-form-section-heading",children:[(0,U.jsx)("strong",{children:"\u8FDE\u63A5\u7C7B\u578B"}),(0,U.jsx)("small",{children:"\u4F18\u5148\u4F7F\u7528 FTPS\uFF1B\u4EC5\u5728\u670D\u52A1\u5668\u4E0D\u652F\u6301 TLS \u65F6\u9009\u62E9 FTP"})]}),(0,U.jsx)("div",{className:"dsh-ssh-ftp-protocol-options",role:"radiogroup","aria-label":"\u8FDE\u63A5\u534F\u8BAE",children:[["ftps-explicit","FTPS","\u663E\u5F0F TLS \xB7 \u63A8\u8350"],["ftps-implicit","FTPS-I","\u9690\u5F0F TLS"],["ftp","FTP","\u672A\u52A0\u5BC6"]].map(w=>(0,U.jsxs)("button",{type:"button","data-ssh-interactive":"choice",role:"radio","aria-checked":a.protocol===w[0],className:a.protocol===w[0]?"is-active":"",onClick:()=>y(w[0]),children:[(0,U.jsx)("span",{className:`dsh-ssh-protocol-badge is-${w[0]}`,children:w[1]}),(0,U.jsxs)("span",{children:[(0,U.jsx)("strong",{children:w[1]}),(0,U.jsx)("small",{children:w[2]})]})]},w[0]))}),a.protocol==="ftp"&&(0,U.jsx)("p",{className:"dsh-ssh-form-warning",children:"\u666E\u901A FTP \u7684\u8D26\u53F7\u3001\u5BC6\u7801\u548C\u6587\u4EF6\u5185\u5BB9\u5747\u4E0D\u52A0\u5BC6\u3002"})]}),(0,U.jsxs)("section",{className:"dsh-ssh-ftp-editor-section",children:[(0,U.jsxs)("div",{className:"dsh-ssh-form-section-heading",children:[(0,U.jsx)("strong",{children:"\u670D\u52A1\u5668"}),(0,U.jsx)("small",{children:"\u540D\u79F0\u7528\u4E8E\u8FDE\u63A5\u5217\u8868\uFF0C\u5206\u7EC4\u4E0E\u6807\u7B7E\u53EF\u590D\u7528\u5DF2\u6709\u9009\u9879"})]}),(0,U.jsxs)("div",{className:"dsh-ssh-form-grid",children:[(0,U.jsx)(ae,{label:"\u8FDE\u63A5\u540D\u79F0",children:(0,U.jsx)("input",{autoFocus:e===void 0,required:!0,maxLength:80,value:a.name,onChange:w=>h({...a,name:w.target.value})})}),(0,U.jsx)(ae,{label:"\u5206\u7EC4\uFF08\u53EF\u9009\uFF09",children:(0,U.jsx)($r,{ariaLabel:"FTP \u5206\u7EC4",maxLength:64,options:S,placeholder:"\u9009\u62E9\u5DF2\u6709\u5206\u7EC4\u6216\u8F93\u5165\u65B0\u5206\u7EC4",value:a.group,onChange:w=>h(E=>({...E,group:w}))})})]}),(0,U.jsxs)("div",{className:"dsh-ssh-form-grid is-host",children:[(0,U.jsx)(ae,{label:"\u670D\u52A1\u5668\u5730\u5740",children:(0,U.jsx)("input",{required:!0,maxLength:253,spellCheck:!1,value:a.host,onChange:w=>h({...a,host:w.target.value})})}),(0,U.jsx)(ae,{label:"\u7AEF\u53E3",children:(0,U.jsx)("input",{required:!0,type:"number",min:"1",max:"65535",value:a.port,onChange:w=>h({...a,port:w.target.value})})})]}),(0,U.jsx)(ae,{label:"\u6807\u7B7E\uFF08\u53EF\u9009\uFF09",hint:"\u53EF\u9009\u62E9\u5DF2\u6709\u6807\u7B7E\u6216\u76F4\u63A5\u8F93\u5165\uFF1B\u591A\u4E2A\u6807\u7B7E\u4F7F\u7528\u9017\u53F7\u5206\u9694\u3002",children:(0,U.jsx)($r,{ariaLabel:"FTP \u6807\u7B7E",multiple:!0,options:_,placeholder:"\u9009\u62E9\u6216\u8F93\u5165\u6807\u7B7E",value:a.tags,onChange:w=>h(E=>({...E,tags:w}))})})]}),(0,U.jsxs)("section",{className:"dsh-ssh-ftp-editor-section",children:[(0,U.jsxs)("div",{className:"dsh-ssh-form-section-heading",children:[(0,U.jsx)("strong",{children:"\u8EAB\u4EFD\u8BA4\u8BC1"}),(0,U.jsx)("small",{children:"\u5BC6\u7801\u53EA\u5199\u5165 DSH \u51ED\u636E\u670D\u52A1\uFF0C\u4E0D\u4F1A\u5728\u754C\u9762\u56DE\u663E"})]}),(0,U.jsx)(ae,{label:"\u767B\u5F55\u65B9\u5F0F",children:(0,U.jsxs)("select",{value:a.authMode,onChange:w=>{h({...a,authMode:w.target.value}),d(void 0)},children:[(0,U.jsx)("option",{value:"password",children:"\u8D26\u53F7\u5BC6\u7801"}),(0,U.jsx)("option",{value:"anonymous",children:"\u533F\u540D\u767B\u5F55"})]})}),a.authMode==="anonymous"?(0,U.jsx)("p",{children:"\u4F7F\u7528 anonymous \u767B\u5F55\uFF0C\u65E0\u9700\u586B\u5199\u8D26\u53F7\u5BC6\u7801\uFF1B\u670D\u52A1\u5668\u5FC5\u987B\u5F00\u653E\u533F\u540D\u8BBF\u95EE\u3002"}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)("div",{className:"dsh-ssh-form-grid",children:[(0,U.jsx)(ae,{label:"\u7528\u6237\u540D",children:(0,U.jsx)("input",{required:!0,maxLength:128,autoComplete:"username",value:a.username,onChange:w=>h({...a,username:w.target.value})})}),(0,U.jsx)(ae,{label:"\u51ED\u636E\u6765\u6E90",children:(0,U.jsxs)("select",{value:a.credentialId,onChange:w=>h({...a,credentialId:w.target.value}),children:[(0,U.jsx)("option",{value:"",children:"\u6B64\u8FDE\u63A5\u5355\u72EC\u4FDD\u5B58\u5BC6\u7801"}),n.map(w=>(0,U.jsxs)("option",{value:w.id,children:[w.name," \xB7 ",w.username]},w.id))]})})]}),!a.credentialId&&(0,U.jsx)(ae,{label:"\u5BC6\u7801",hint:e?.credential.configured&&e.credential.source==="profile"?"\u5DF2\u4FDD\u5B58\uFF1B\u7559\u7A7A\u4FDD\u6301\u4E0D\u53D8":"\u4FDD\u5B58\u540E\u4E0D\u4F1A\u56DE\u663E",children:(0,U.jsx)("input",{required:e===void 0||e.credential.source!=="profile"||!e.credential.configured,type:"password",autoComplete:"new-password",value:a.password,onChange:w=>h({...a,password:w.target.value})})})]})]}),(0,U.jsxs)("section",{className:"dsh-ssh-ftp-editor-section",children:[(0,U.jsxs)("div",{className:"dsh-ssh-form-section-heading",children:[(0,U.jsx)("strong",{children:"\u8DEF\u5F84\u4E0E\u7F51\u7EDC"}),(0,U.jsx)("small",{children:"\u4EE3\u7406\u590D\u7528 SSH \u63D2\u4EF6\u7684\u4EE3\u7406\u5E93\uFF0C\u63A7\u5236\u548C\u6570\u636E\u8FDE\u63A5\u4F7F\u7528\u540C\u4E00\u8DEF\u5F84"})]}),(0,U.jsxs)("div",{className:"dsh-ssh-form-grid",children:[(0,U.jsx)(ae,{label:"\u521D\u59CB\u76EE\u5F55",children:(0,U.jsx)("input",{required:!0,maxLength:4096,spellCheck:!1,value:a.initialPath,onChange:w=>h({...a,initialPath:w.target.value})})}),(0,U.jsx)(ae,{label:"\u8FDE\u63A5\u4EE3\u7406",children:(0,U.jsxs)("select",{value:a.proxyId,onChange:w=>h({...a,proxyId:w.target.value}),children:[(0,U.jsx)("option",{value:"",children:"\u76F4\u8FDE"}),r.map(w=>(0,U.jsxs)("option",{value:w.id,children:[w.name," \xB7 ",w.proxyType.toUpperCase()]},w.id))]})})]}),(0,U.jsxs)("details",{className:"dsh-ssh-form-advanced",children:[(0,U.jsx)("summary",{children:"\u9AD8\u7EA7\u8FDE\u63A5\u8BBE\u7F6E"}),(0,U.jsxs)("div",{className:"dsh-ssh-form-grid",children:[(0,U.jsx)(ae,{label:"\u8FDE\u63A5\u8D85\u65F6\uFF08\u6BEB\u79D2\uFF09",children:(0,U.jsx)("input",{required:!0,type:"number",min:"1000",max:"120000",step:"1000",value:a.connectTimeoutMs,onChange:w=>h({...a,connectTimeoutMs:w.target.value})})}),(0,U.jsx)(ae,{label:"TLS \u670D\u52A1\u5668\u540D\u79F0",hint:"\u8BC1\u4E66\u540D\u79F0\u4E0E\u4E3B\u673A\u4E0D\u540C\u65F6\u586B\u5199",children:(0,U.jsx)("input",{maxLength:253,spellCheck:!1,value:a.tlsServerName,onChange:w=>h({...a,tlsServerName:w.target.value})})})]})]})]}),g&&(0,U.jsx)("p",{className:"dsh-ssh-inline-success",role:"status",children:g}),u&&(0,U.jsx)("p",{className:"dsh-ssh-inline-error",role:"alert",children:u})]}),(0,U.jsxs)("footer",{className:"dsh-ssh-ftp-editor-actions",children:[(0,U.jsx)("button",{type:"button",className:"dsh-ssh-secondary-button",onClick:()=>{x()},disabled:f||l,children:f?"\u6B63\u5728\u6D4B\u8BD5\u2026":"\u6D4B\u8BD5\u8FDE\u63A5"}),(0,U.jsx)("span",{}),(0,U.jsx)("button",{type:"button",className:"dsh-ssh-secondary-button",onClick:o,disabled:l||f,children:"\u53D6\u6D88"}),(0,U.jsx)("button",{type:"submit",className:"dsh-ssh-primary-button",disabled:l||f,children:l?"\u6B63\u5728\u4FDD\u5B58\u2026":"\u4FDD\u5B58\u8FDE\u63A5"})]})]})}function Yx(e){return e==="ftp"?"FTP":e==="ftps-explicit"?"FTPS":"FTPS-I"}var Qx=new Intl.Collator(void 0,{numeric:!0,sensitivity:"base"}),Zl=Qx.compare;function Ff(e,t,s){let r=s==="asc"?1:-1;return e.map((o,i)=>({entry:o,index:i})).sort((o,i)=>{let n=o.entry.kind==="directory"||o.entry.navigable===!0,a=i.entry.kind==="directory"||i.entry.navigable===!0;if(n!==a)return n?-1:1;let h=Zx(o.entry,i.entry,t);if(h!==0)return h*r;let l=t==="name"?0:Zl(o.entry.name,i.entry.name);return l!==0?l:o.index-i.index}).map(o=>o.entry)}function Zx(e,t,s){return s==="name"?Zl(e.name,t.name):e[s]-t[s]}var B=require("react/jsx-runtime"),Hf="dsh-ssh:file-transfer:tabs:v2",eh=38,ey=new Intl.DateTimeFormat(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit"});function $f({ftpProfiles:e,vaultEntries:t,proxyEntries:s,access:r,onProfilesChanged:o}){let i=vr(),[n,a]=(0,ye.useState)([]),[h,l]=(0,ye.useState)([]),[c,f]=(0,ye.useState)(()=>dy()),[v,g]=(0,ye.useState)(()=>c[0]?.id??"transfer-1"),[d,u]=(0,ye.useState)(!1),[p,m]=(0,ye.useState)(!1),[b,x]=(0,ye.useState)(),[y,S]=(0,ye.useState)(),[_,w]=(0,ye.useState)(),[E,C]=(0,ye.useState)({}),P=(0,ye.useRef)(new Map),A=(0,ye.useCallback)(async()=>{try{let L=await ch();a(L),f(T=>uy(T,L))}catch(L){w(Ce(L))}},[]);(0,ye.useEffect)(()=>{A()},[A,e]),(0,ye.useEffect)(()=>{try{localStorage.setItem(Hf,JSON.stringify(c))}catch{}},[c]),(0,ye.useEffect)(()=>{let L=P.current,T=h.filter(z=>Bf(z.state)&&L.has(z.id)&&!Bf(L.get(z.id)));P.current=new Map(h.map(z=>[z.id,z.state])),T.length!==0&&C(z=>{let K={...z};for(let O of T){let J=eo(O.request.destinationEndpointId,O.request.destinationDirectory);K[J]=(K[J]??0)+1}return K})},[h]),(0,ye.useEffect)(()=>{let L=!1,T,z=async()=>{if(document.visibilityState==="hidden"){T=window.setTimeout(()=>{z()},1800);return}try{let K=await ph();L||l(K)}catch{}L||(T=window.setTimeout(()=>{z()},800))};return z(),()=>{L=!0,T!==void 0&&clearTimeout(T)}},[]);let M=c.find(L=>L.id===v)??c[0],F=L=>f(T=>T.map(z=>z.id===M?.id?L(z):z)),$=()=>{let L=`transfer-${Date.now().toString(36)}`,T=sh(L,c.length+1);f(z=>[...z,T]),g(L)},H=L=>{if(c.length===1)return;let T=c.findIndex(K=>K.id===L),z=c.filter(K=>K.id!==L);f(z),v===L&&g(z[Math.max(0,T-1)].id)},j=L=>F(T=>({...T,panes:Array.from({length:L},(z,K)=>T.panes[K]??to(`${T.id}-pane-${K}`))})),k=async(L,T,z,K,O)=>{let J={endpointId:L,directory:T},N={endpointId:K,directory:O};if(!(gi(J,N)||!vi(J,z,N)))try{w(void 0);let I=await Zr({sourceEndpointId:L,sourcePaths:z,destinationEndpointId:K,destinationDirectory:O,conflictPolicy:"fail"});l(W=>[I,...W.filter(X=>X.id!==I.id)])}catch(I){w(Ce(I))}},R=async(L,T,z)=>{try{w(void 0);let K=await Cn(L,{paneId:T.id,endpointId:T.endpointId,directory:z});K.job!==void 0&&l(O=>[K.job,...O.filter(J=>J.id!==K.job.id)]),K.operation==="move"&&C(O=>{let J={...O};for(let N of[eo(L.endpointId,L.directory),eo(T.endpointId,z)])J[N]=(J[N]??0)+1;return J})}catch(K){w(Ce(K))}};return(0,B.jsxs)("div",{className:"dsh-ssh-transfer-workspace",children:[(0,B.jsxs)("header",{className:"dsh-ssh-transfer-header",children:[(0,B.jsxs)("div",{children:[(0,B.jsx)("h1",{children:"\u6587\u4EF6\u4F20\u8F93"}),(0,B.jsx)("p",{children:"FTP\u3001FTPS \u4E0E SFTP \u4E4B\u95F4\u76F4\u63A5\u6D41\u5F0F\u4E92\u4F20"})]}),(0,B.jsxs)("div",{className:"dsh-ssh-transfer-actions",children:[(0,B.jsxs)("button",{type:"button","data-ssh-interactive":"control",className:"dsh-ssh-secondary-button",onClick:()=>m(!0),children:["\u4F1A\u8BDD\u8BBF\u95EE \xB7 ",r.value?.fileEndpointIds.length??0]}),(0,B.jsx)("button",{type:"button","data-ssh-interactive":"control",className:"dsh-ssh-secondary-button",onClick:()=>u(!0),children:"FTP \u7BA1\u7406"})]})]}),_&&(0,B.jsxs)("div",{className:"dsh-ssh-banner is-error",role:"alert",children:[(0,B.jsx)("span",{children:_}),(0,B.jsx)("button",{type:"button",onClick:()=>w(void 0),"aria-label":"\u5173\u95ED",children:(0,B.jsx)(Et.IconCloseOutline16,{size:16})})]}),(0,B.jsxs)("section",{ref:i.ref,onPointerMove:i.onPointerMove,onPointerLeave:i.onPointerLeave,className:"dsh-ssh-transfer-stage dsh-ssh-border-surface",children:[(0,B.jsxs)("div",{className:"dsh-ssh-transfer-tabbar",role:"tablist","aria-label":"\u6587\u4EF6\u4F20\u8F93\u4EFB\u52A1\u9875",children:[(0,B.jsxs)("div",{className:"dsh-ssh-transfer-tabs",children:[c.map(L=>(0,B.jsxs)("span",{"data-ssh-interactive":"choice",className:`dsh-ssh-transfer-tab${L.id===M?.id?" is-active":""}`,children:[(0,B.jsx)("button",{type:"button",role:"tab","aria-selected":L.id===M?.id,onClick:()=>g(L.id),children:L.name}),c.length>1&&(0,B.jsx)("button",{type:"button",className:"is-close","aria-label":`\u5173\u95ED ${L.name}`,onClick:()=>H(L.id),children:(0,B.jsx)(Et.IconCloseOutline16,{size:13})})]},L.id)),(0,B.jsx)("button",{type:"button","data-ssh-interactive":"control",className:"is-add","aria-label":"\u65B0\u5EFA\u4F20\u8F93\u4EFB\u52A1\u9875",onClick:$,children:(0,B.jsx)(Et.IconPlusOutline16,{size:15})})]}),(0,B.jsx)("div",{className:"dsh-ssh-pane-layout","aria-label":"\u7A97\u683C\u6570\u91CF",children:[2,3,4].map(L=>(0,B.jsxs)("button",{type:"button","data-ssh-interactive":"choice","aria-pressed":M?.panes.length===L,className:M?.panes.length===L?"is-active":"",onClick:()=>j(L),children:[L," \u680F"]},L))})]}),n.length===0?(0,B.jsxs)("div",{className:"dsh-ssh-transfer-empty",children:[(0,B.jsx)(Et.IconDataOutline16,{size:24}),(0,B.jsx)("strong",{children:"\u8FD8\u6CA1\u6709\u53EF\u7528\u6587\u4EF6\u8FDE\u63A5"}),(0,B.jsx)("p",{children:"\u65B0\u5EFA FTP/FTPS \u8FDE\u63A5\uFF0C\u6216\u5148\u6DFB\u52A0\u4E00\u53F0 SSH \u4E3B\u673A\u4F7F\u7528 SFTP\u3002"}),(0,B.jsx)("button",{type:"button",className:"dsh-ssh-primary-button",onClick:()=>u(!0),children:"\u65B0\u5EFA FTP \u8FDE\u63A5"})]}):M&&(0,B.jsx)("div",{className:`dsh-ssh-transfer-panes has-${M.panes.length}`,children:M.panes.map((L,T)=>{let z=M.panes[(T+1)%M.panes.length];return(0,B.jsx)(ty,{pane:L,endpoints:n,dragSource:y,refreshRevision:E[eo(L.endpointId,L.path)]??0,...z===void 0?{}:{destination:z},onManageConnections:()=>u(!0),onDragSourceChange:S,onChange:K=>F(O=>({...O,panes:O.panes.map(J=>J.id===L.id?{...J,...K}:J)})),onTransfer:(K,O)=>{k(L.endpointId,L.path,K,O.endpointId,O.path)},onExternalDrop:(K,O)=>{R(K,L,O)}},L.id)})}),(0,B.jsx)(iy,{jobs:h,endpoints:n,onCancel:async L=>{try{await fh(L),l(T=>T.map(z=>z.id===L?{...z,state:"cancelled"}:z))}catch(T){w(Ce(T))}},onConflict:x})]}),d&&(0,B.jsx)(Nf,{profiles:e,vaultEntries:t,proxyEntries:s,onClose:()=>u(!1),onChanged:()=>{o(),A()}}),p&&(0,B.jsx)(oy,{endpoints:n,access:r,onClose:()=>m(!1)}),b&&(0,B.jsx)(ny,{job:b,onClose:()=>x(void 0),onRetry:async L=>{try{let T=await Zr({...b.request,conflictPolicy:L});l(z=>[T,...z]),x(void 0)}catch(T){w(Ce(T))}}})]})}function ty({pane:e,endpoints:t,destination:s,dragSource:r,refreshRevision:o,onChange:i,onTransfer:n,onExternalDrop:a,onDragSourceChange:h,onManageConnections:l}){let[c,f]=(0,ye.useState)(),[v,g]=(0,ye.useState)(),[d,u]=(0,ye.useState)([]),[p,m]=(0,ye.useState)(e.path),[b,x]=(0,ye.useState)(!1),[y,S]=(0,ye.useState)(0),[_,w]=(0,ye.useState)({key:"name",direction:"asc"}),[E,C]=(0,ye.useState)(!1),[P,A]=(0,ye.useState)(),[M,F]=(0,ye.useState)(),[$,H]=(0,ye.useState)(),j=(0,ye.useRef)(null),k=(0,ye.useRef)(0),R=t.find(ee=>ee.id===e.endpointId),L=(0,ye.useMemo)(()=>Ff(v?.entries??[],_.key,_.direction),[v?.entries,_]),T=L.length>200,z=T?Math.max(0,Math.floor(y/eh)-8):0,K=(0,ye.useMemo)(()=>T?L.slice(z,Math.min(L.length,z+56)):L,[L,z,T]),O=(0,ye.useCallback)(async(ee=e.path)=>{if(R===void 0)return;let ge=++k.current;x(!0),H(void 0);try{let Se=await zi(e.id,R.id,ee);if(ge!==k.current)return;g(Se),m(Se.path),u([]),S(0),j.current&&(j.current.scrollTop=0),i({endpointId:R.id,path:Se.path})}catch(Se){ge===k.current&&H(Ce(Se))}finally{ge===k.current&&x(!1)}},[R?.id,e.path]);(0,ye.useEffect)(()=>{R!==void 0&&O(e.path)},[R?.id,o]),(0,ye.useEffect)(()=>{r===void 0&&(C(!1),A(void 0))},[r]);let J=async ee=>{if(!R)return;let ge=++k.current;x(!0),H(void 0);try{let Se=await dh(e.id,R.id,ee);if(ge!==k.current)return;Ps(Se)?await O(Se.path):f(Se)}catch(Se){ge===k.current&&H(Ce(Se))}finally{ge===k.current&&x(!1)}};(0,ye.useEffect)(()=>{f(void 0)},[R?.id]);let N=ee=>{ee.preventDefault(),J(p)},I=ee=>{w(ge=>ge.key===ee?{key:ee,direction:ge.direction==="asc"?"desc":"asc"}:{key:ee,direction:"asc"}),S(0),j.current&&(j.current.scrollTop=0)},W=ee=>{k.current+=1,i({endpointId:ee.id,path:ee.initialPath}),m(ee.initialPath),g(void 0),H(void 0)},X=()=>{k.current+=1,i({endpointId:"",path:"/"}),g(void 0),u([]),H(void 0),x(!1)},te=(ee,ge)=>u(Se=>ge?Se.includes(ee.path)?Se.filter(de=>de!==ee.path):[...Se,ee.path]:[ee.path]),Z=async()=>{if(!(M===void 0||v===void 0||R===void 0))try{await Qr({paneId:e.id,endpointId:R.id,directory:v.path,paths:M.map(ee=>ee.path)}),u([])}finally{await O(v.path)}},pe=ee=>{ee.preventDefault(),C(!1);let ge=Rr(ee.dataTransfer.getData(Wt));h(void 0),!(ge===void 0||ge.paneId===e.id||gi(ge,{endpointId:e.endpointId,directory:e.path}))&&a(ge,e.path)};return R===void 0?(0,B.jsxs)("section",{className:"dsh-ssh-file-pane is-connections",children:[(0,B.jsxs)("header",{children:[(0,B.jsxs)("span",{className:"dsh-ssh-pane-heading",children:[(0,B.jsx)("strong",{children:"\u8FDE\u63A5\u5217\u8868"}),(0,B.jsx)("small",{children:"\u5355\u51FB\u8FDE\u63A5\u540E\u6D4F\u89C8\u8FDC\u7AEF\u6587\u4EF6"})]}),(0,B.jsx)("button",{type:"button","data-ssh-interactive":"control",className:"dsh-ssh-pane-manage-button",onClick:l,children:"FTP \u7BA1\u7406"})]}),(0,B.jsx)("div",{className:"dsh-ssh-endpoint-list",children:t.map(ee=>(0,B.jsxs)("button",{type:"button","data-ssh-interactive":"row",className:"dsh-ssh-endpoint-row",onClick:()=>W(ee),children:[(0,B.jsx)("span",{className:`dsh-ssh-protocol-badge is-${ee.protocol}`,children:rh(ee.protocol)}),(0,B.jsxs)("span",{children:[(0,B.jsx)("strong",{title:ee.name,children:ee.name}),(0,B.jsx)("small",{title:ee.address,children:ee.address})]}),(0,B.jsxs)("span",{children:[(0,B.jsx)("i",{className:`dsh-ssh-protocol-dot is-${ee.protocol}`,"aria-hidden":"true"}),ee.group??(ee.kind==="sftp"?"SSH \u4E3B\u673A":"\u6587\u4EF6\u8FDE\u63A5")]})]},ee.id))}),(0,B.jsxs)("footer",{children:[(0,B.jsxs)("span",{children:[t.length," \u4E2A\u53EF\u7528\u8FDE\u63A5"]}),(0,B.jsx)("small",{children:"SFTP \u590D\u7528 SSH \u4E3B\u673A\u914D\u7F6E"})]})]}):(0,B.jsxs)("section",{className:`dsh-ssh-file-pane${E?" is-drop-target":""}`,onDragOver:ee=>{ee.dataTransfer.types.includes(Wt)&&fy(r,e)?(ee.preventDefault(),ee.dataTransfer.dropEffect=r?.endpointId===e.endpointId?"move":"copy",A(void 0),C(!0)):E&&C(!1)},onDragLeave:ee=>{ee.currentTarget.contains(ee.relatedTarget)||(C(!1),A(void 0))},onDrop:pe,children:[(0,B.jsxs)("header",{children:[(0,B.jsx)("button",{type:"button",className:"dsh-ssh-pane-back","aria-label":"\u8FD4\u56DE\u8FDE\u63A5\u5217\u8868",onClick:X,children:(0,B.jsx)(Et.IconChevronLeftOutline14,{size:14})}),(0,B.jsxs)("span",{className:"dsh-ssh-pane-endpoint",children:[(0,B.jsx)("strong",{children:R.name}),(0,B.jsx)("small",{title:R.address,children:R.address})]}),(0,B.jsx)("span",{className:`dsh-ssh-protocol-badge is-${R.protocol}`,children:rh(R.protocol)})]}),(0,B.jsxs)("form",{className:"dsh-ssh-file-pathbar",onSubmit:N,children:[(0,B.jsx)("button",{type:"button","aria-label":"\u4E0A\u4E00\u7EA7\u76EE\u5F55",disabled:v?.parent===null||b,onClick:()=>{v?.parent&&O(v.parent)},children:(0,B.jsx)(_y,{})}),(0,B.jsx)("button",{type:"button","aria-label":"\u5237\u65B0\u76EE\u5F55",disabled:b,onClick:()=>{O()},children:(0,B.jsx)(xy,{})}),(0,B.jsx)("input",{"aria-label":"\u8FDC\u7AEF\u8DEF\u5F84",value:p,onChange:ee=>m(ee.target.value)}),(0,B.jsx)("button",{type:"submit",disabled:b,children:"\u524D\u5F80"})]}),(0,B.jsxs)("div",{className:"dsh-ssh-file-table",role:"grid","aria-busy":b,children:[(0,B.jsxs)("div",{className:"dsh-ssh-file-table-head",role:"row",children:[(0,B.jsx)(th,{label:"\u540D\u79F0",sortKey:"name",current:_,onSort:I}),(0,B.jsx)(th,{label:"\u5927\u5C0F",sortKey:"size",current:_,onSort:I}),(0,B.jsx)(th,{label:"\u4FEE\u6539\u65F6\u95F4",sortKey:"modifiedAt",current:_,onSort:I}),(0,B.jsx)("span",{role:"columnheader","aria-label":"\u64CD\u4F5C"})]}),(0,B.jsx)("div",{ref:j,className:"dsh-ssh-file-table-body",onScroll:ee=>{T&&S(ee.currentTarget.scrollTop)},children:b&&!v?(0,B.jsx)("div",{className:"dsh-ssh-file-loading",children:"\u6B63\u5728\u8BFB\u53D6\u76EE\u5F55\u2026"}):$?(0,B.jsxs)("div",{className:"dsh-ssh-file-error",children:[(0,B.jsx)("span",{children:$}),(0,B.jsx)("button",{type:"button",onClick:()=>{O()},children:"\u91CD\u8BD5"})]}):L.length===0?(0,B.jsx)("div",{className:"dsh-ssh-table-empty",children:"\u8FD9\u4E2A\u76EE\u5F55\u662F\u7A7A\u7684\u3002"}):(0,B.jsx)("div",{className:T?"dsh-ssh-file-virtual-list":void 0,style:T?{height:`${L.length*eh}px`}:void 0,children:K.map((ee,ge)=>(0,B.jsx)(ry,{entry:ee,paneId:e.id,endpointId:R.id,sourceDirectory:v?.path??e.path,dragSource:r,dropTarget:P===ee.path,selected:d.includes(ee.path),selectedPaths:d,...T?{style:{position:"absolute",insetInline:0,transform:`translateY(${(z+ge)*eh}px)`}}:{},onDelete:()=>F([ee]),onDirectoryTarget:Se=>{C(!1),A(Se)},onDropIntoDirectory:(Se,de)=>{A(void 0),h(void 0),a(Se,de)},onDragSourceChange:h,onSelect:Se=>te(ee,Se),onOpen:()=>{J(ee.path)}},ee.path))})})]}),(0,B.jsxs)("footer",{children:[(0,B.jsx)("span",{children:d.length>0?`\u5DF2\u9009\u62E9 ${d.length} \u9879`:`${v?.entries.length??0} \u9879`}),(0,B.jsx)("span",{className:"dsh-ssh-file-pane-actions",children:(0,B.jsxs)("button",{type:"button","data-ssh-interactive":"control",className:"dsh-ssh-transfer-to-button",disabled:d.length===0||s===void 0||!s.endpointId||b,onClick:()=>{s?.endpointId&&n(d,s)},children:["\u4F20\u9001\u5230\u4E0B\u4E00\u680F ",(0,B.jsx)("span",{"aria-hidden":"true",children:"\u2192"})]})})]}),E&&(0,B.jsxs)("div",{className:"dsh-ssh-file-drop-overlay",children:[(0,B.jsx)("strong",{children:r?.endpointId===e.endpointId?"\u79FB\u52A8\u5230\u6B64\u76EE\u5F55":"\u590D\u5236\u5230\u6B64\u76EE\u5F55"}),(0,B.jsx)("span",{children:v?.path??e.path})]}),c!==void 0&&(0,B.jsx)(Ne,{className:"dsh-ssh-file-download-dialog",title:c.name,subtitle:c.path,onClose:()=>f(void 0),children:(0,B.jsx)("div",{className:"dsh-ssh-dialog-actions",children:(0,B.jsxs)("a",{className:"dsh-ssh-secondary-button",href:ao(R.id,c.path),download:!0,children:[(0,B.jsx)(jf,{}),(0,B.jsx)("span",{children:"\u4E0B\u8F7D\u5230\u672C\u5730"})]})})}),M!==void 0&&(0,B.jsx)(Wn,{locationName:R.name,locationKind:"remote",entries:M,onClose:()=>F(void 0),onDelete:Z})]})}function th({label:e,sortKey:t,current:s,onSort:r}){let o=s.key===t;return(0,B.jsx)("span",{role:"columnheader","aria-sort":o?s.direction==="asc"?"ascending":"descending":"none",children:(0,B.jsxs)("button",{type:"button",onClick:()=>r(t),children:[e,(0,B.jsx)(sy,{active:o,direction:s.direction})]})})}function sy({active:e,direction:t}){return(0,B.jsx)("svg",{className:e?"is-active":"",viewBox:"0 0 12 12","aria-hidden":"true",children:(0,B.jsx)("path",{d:"m3.5 5 2.5 2.5L8.5 5",transform:t==="desc"?void 0:"rotate(180 6 6)"})})}function jf(){return(0,B.jsx)("svg",{width:16,height:16,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:(0,B.jsx)("path",{d:"M8 2v7m0 0 2.6-2.6M8 9 5.4 6.4M3 11.5v1.25h10V11.5"})})}function ry({entry:e,paneId:t,endpointId:s,sourceDirectory:r,dragSource:o,dropTarget:i,selected:n,selectedPaths:a,style:h,onSelect:l,onOpen:c,onDelete:f,onDirectoryTarget:v,onDropIntoDirectory:g,onDragSourceChange:d}){let u=Ps(e),p=s.startsWith("ftp:")&&e.navigable===void 0&&(e.kind==="symlink"||e.kind==="other"),m=!0,b=u&&(o===void 0||vi(o,o.paths,{endpointId:s,directory:e.path})),x=y=>{if(!u)return;y.preventDefault(),y.stopPropagation(),v(void 0);let S=Rr(y.dataTransfer.getData(Wt));S!==void 0&&vi(S,S.paths,{endpointId:s,directory:e.path})&&g(S,e.path)};return(0,B.jsxs)("div",{role:"row","data-ssh-interactive":"row","data-ssh-context-row":!0,tabIndex:0,"aria-selected":n,"aria-label":`${e.name}${u?"\uFF0C\u76EE\u5F55\uFF0C\u5355\u51FB\u8FDB\u5165\uFF1B\u53EF\u63A5\u6536\u62D6\u653E":p?"\uFF0C\u5355\u51FB\u67E5\u770B":""}`,draggable:e.kind==="file"||u,className:`dsh-ssh-file-row is-${u?"directory":e.kind}${n?" is-selected":""}${i?" is-drop-target":""}`,style:h,onClick:y=>{m&&!y.ctrlKey&&!y.metaKey&&!y.shiftKey?c():l(y.ctrlKey||y.metaKey)},onKeyDown:y=>{y.target===y.currentTarget&&(y.key==="Enter"&&m&&c(),y.key===" "&&(y.preventDefault(),l(y.ctrlKey||y.metaKey)))},onDragStart:y=>{let S=n?a:[e.path],_={paneId:t,endpointId:s,directory:r,paths:S};d(_),y.dataTransfer.effectAllowed="copyMove",y.dataTransfer.setData(Wt,JSON.stringify(_))},onDragEnd:()=>d(void 0),onDragOver:y=>{y.dataTransfer.types.includes(Wt)&&b&&(y.preventDefault(),y.stopPropagation(),y.dataTransfer.dropEffect=o?.endpointId===s?"move":"copy",v(e.path))},onDragLeave:y=>{i&&!y.currentTarget.contains(y.relatedTarget)&&v(void 0)},onDrop:x,children:[(0,B.jsxs)("span",{children:[(0,B.jsx)(yy,{directory:u}),(0,B.jsx)("i",{title:e.name,children:e.name})]}),(0,B.jsx)("span",{children:u?"\u2014":Uf(e.size)}),(0,B.jsx)("span",{children:e.modifiedAt>0?new Date(e.modifiedAt).toLocaleString():"\u2014"}),(0,B.jsxs)("span",{className:"dsh-ssh-file-row-actions dsh-ssh-context-action",children:[(0,B.jsx)("a",{className:"dsh-ssh-file-row-download",href:ao(s,e.path),download:!0,draggable:!1,"aria-label":`\u4E0B\u8F7D ${e.name} \u5230\u672C\u5730`,title:e.kind==="directory"?`\u5C06 ${e.name} \u6253\u5305\u4E0B\u8F7D\u5230\u672C\u5730`:`\u4E0B\u8F7D ${e.name} \u5230\u672C\u5730`,onClick:y=>y.stopPropagation(),children:(0,B.jsx)(jf,{})}),(0,B.jsx)("button",{type:"button",className:"dsh-ssh-file-row-delete",draggable:!1,"aria-label":`\u5220\u9664 ${e.name}`,title:`\u5220\u9664 ${e.name}`,onClick:y=>{y.stopPropagation(),f()},children:(0,B.jsx)(Et.IconTrashOutline16,{size:14})})]})]})}function iy({jobs:e,endpoints:t,onCancel:s,onConflict:r}){let[o,i]=(0,ye.useState)(!0),n=e.filter(a=>a.state==="queued"||a.state==="scanning"||a.state==="transferring");return(0,B.jsxs)("section",{className:`dsh-ssh-transfer-queue${o?" is-open":""}`,children:[(0,B.jsxs)("button",{type:"button",className:"dsh-ssh-transfer-queue-heading","aria-expanded":o,title:o?"\u6536\u8D77\u4F20\u8F93\u4EFB\u52A1":"\u5C55\u5F00\u4F20\u8F93\u4EFB\u52A1",onClick:()=>i(a=>!a),children:[(0,B.jsxs)("span",{children:[(0,B.jsx)("strong",{children:"\u4F20\u8F93\u4EFB\u52A1"}),(0,B.jsx)("small",{children:n.length>0?`${n.length} \u4E2A\u8FDB\u884C\u4E2D`:e.length>0?"\u6700\u8FD1\u4EFB\u52A1":"\u6682\u65E0\u4EFB\u52A1"})]}),(0,B.jsx)("span",{className:"dsh-ssh-transfer-queue-disclosure","aria-hidden":"true",children:(0,B.jsx)(Et.IconChevronDownOutline14,{size:14})})]}),o&&(0,B.jsx)("div",{className:"dsh-ssh-transfer-job-list",children:e.length===0?(0,B.jsx)("p",{children:"\u4ECE\u4E00\u4E2A\u7A97\u683C\u62D6\u5230\u53E6\u4E00\u4E2A\u7A97\u683C\uFF0C\u6216\u9009\u4E2D\u6587\u4EF6\u540E\u70B9\u51FB\u201C\u4F20\u9001\u5230\u4E0B\u4E00\u680F\u201D\u3002"}):e.slice(0,12).map(a=>{let h=a.totalBytes>0?Math.min(100,a.transferredBytes/a.totalBytes*100):a.state==="completed"?100:0;return(0,B.jsxs)("article",{children:[(0,B.jsx)("span",{className:`dsh-ssh-transfer-state is-${a.state}`,"aria-hidden":"true"}),(0,B.jsxs)("span",{className:"dsh-ssh-transfer-job-copy",children:[(0,B.jsxs)("strong",{children:[Vf(a.request.sourcePaths)," ",(0,B.jsx)("i",{children:"\u2192"})," ",py(t,a.request.destinationEndpointId)]}),(0,B.jsx)("small",{children:a.error??my(a,h)}),(0,B.jsx)("span",{className:"dsh-ssh-transfer-job-time",children:gy(a)}),(0,B.jsx)("span",{className:"dsh-ssh-transfer-progress",children:(0,B.jsx)("i",{style:{transform:`scaleX(${h/100})`}})})]}),a.state==="queued"||a.state==="scanning"||a.state==="transferring"?(0,B.jsx)("button",{type:"button",className:"dsh-ssh-icon-button","aria-label":"\u53D6\u6D88\u4F20\u8F93",onClick:()=>{s(a.id)},children:(0,B.jsx)(Et.IconCloseOutline16,{size:15})}):a.state==="failed"&&a.error?.includes("destination already contains")?(0,B.jsx)("button",{type:"button",className:"dsh-ssh-job-resolve",onClick:()=>r(a),children:"\u5904\u7406"}):null]},a.id)})})]})}function ny({job:e,onClose:t,onRetry:s}){let[r,o]=(0,ye.useState)("rename"),[i,n]=(0,ye.useState)(!1);return(0,B.jsxs)(Ne,{className:"dsh-ssh-transfer-conflict-dialog",title:"\u76EE\u6807\u4E2D\u5B58\u5728\u540C\u540D\u6587\u4EF6",subtitle:"\u4E3A\u672C\u6279\u4F20\u8F93\u9009\u62E9\u5904\u7406\u65B9\u5F0F",onClose:t,children:[(0,B.jsxs)("div",{className:"dsh-ssh-transfer-conflict-copy",children:[(0,B.jsx)("strong",{children:Vf(e.request.sourcePaths)}),(0,B.jsx)("span",{children:e.request.destinationDirectory})]}),(0,B.jsx)("div",{className:"dsh-ssh-conflict-options",children:[["rename","\u81EA\u52A8\u91CD\u547D\u540D","\u4FDD\u7559\u4E24\u4EFD\u6587\u4EF6\uFF0C\u5728\u540D\u79F0\u540E\u6DFB\u52A0\u5E8F\u53F7"],["skip","\u8DF3\u8FC7\u540C\u540D\u6587\u4EF6","\u7EE7\u7EED\u4F20\u8F93\u5176\u4ED6\u5185\u5BB9"],["overwrite","\u8986\u76D6\u76EE\u6807\u6587\u4EF6","\u4F7F\u7528\u6765\u6E90\u5185\u5BB9\u66FF\u6362\u76EE\u6807\u5185\u5BB9"]].map(a=>(0,B.jsxs)("button",{type:"button","data-ssh-interactive":"choice","aria-pressed":r===a[0],className:r===a[0]?"is-active":"",onClick:()=>o(a[0]),children:[(0,B.jsx)("i",{"aria-hidden":"true"}),(0,B.jsxs)("span",{children:[(0,B.jsx)("strong",{children:a[1]}),(0,B.jsx)("small",{children:a[2]})]})]},a[0]))}),(0,B.jsxs)("div",{className:"dsh-ssh-dialog-actions",children:[(0,B.jsx)("button",{type:"button",className:"dsh-ssh-secondary-button","data-ssh-dialog-close":!0,onClick:t,children:"\u53D6\u6D88"}),(0,B.jsx)("button",{type:"button",className:"dsh-ssh-primary-button",disabled:i,onClick:()=>{n(!0),s(r).finally(()=>n(!1))},children:i?"\u6B63\u5728\u91CD\u65B0\u52A0\u5165\u961F\u5217\u2026":"\u7EE7\u7EED\u4F20\u8F93"})]})]})}function oy({endpoints:e,access:t,onClose:s}){let r=t.value,o=e.filter(n=>r?.fileEndpointIds.includes(n.id)).length,i=n=>t.setFileEndpoints(r?.fileEndpointIds.includes(n)?r.fileEndpointIds.filter(a=>a!==n):[...r?.fileEndpointIds??[],n]);return(0,B.jsxs)(Ne,{className:"dsh-ssh-file-access-dialog",title:"\u4F1A\u8BDD\u8BBF\u95EE",subtitle:"\u5355\u72EC\u7BA1\u7406\u5F53\u524D\u4F1A\u8BDD\u53EF\u4F7F\u7528\u7684\u8FDC\u7AEF\u6587\u4EF6\u8FDE\u63A5",onClose:s,children:[(0,B.jsxs)("div",{className:"dsh-ssh-file-access-body dsh-ssh-scroll-surface",children:[t.error&&(0,B.jsx)("p",{className:"dsh-ssh-inline-error",role:"alert",children:t.error}),(0,B.jsxs)("section",{className:"dsh-ssh-file-access-section","aria-labelledby":"dsh-ssh-file-access-connections",children:[(0,B.jsxs)("header",{children:[(0,B.jsxs)("span",{children:[(0,B.jsx)("strong",{id:"dsh-ssh-file-access-connections",children:"\u6587\u4EF6\u8FDE\u63A5"}),(0,B.jsx)("small",{children:"\u5141\u8BB8\u5F53\u524D\u4F1A\u8BDD\u6D4F\u89C8\u6307\u5B9A\u7684 FTP\u3001FTPS \u6216 SFTP"})]}),(0,B.jsxs)("i",{children:[o.toString().padStart(2,"0")," / ",e.length.toString().padStart(2,"0")]})]}),(0,B.jsx)("div",{className:"dsh-ssh-file-access-list",children:t.loading?(0,B.jsx)(ly,{}):e.length===0?(0,B.jsxs)("div",{className:"dsh-ssh-file-access-empty",children:[(0,B.jsx)("strong",{children:"\u6CA1\u6709\u53EF\u7528\u8FDE\u63A5"}),(0,B.jsx)("small",{children:"\u8BF7\u5148\u5728\u6587\u4EF6\u4F20\u8F93\u4E2D\u6DFB\u52A0 FTP\uFF0C\u6216\u5728\u4E3B\u673A\u9762\u677F\u4E2D\u6DFB\u52A0 SSH \u4E3B\u673A\u3002"})]}):e.map(n=>(0,B.jsx)(ay,{endpoint:n,enabled:r?.fileEndpointIds.includes(n.id)??!1,onToggle:()=>i(n.id)},n.id))})]}),(0,B.jsxs)("section",{className:"dsh-ssh-file-access-section is-options","aria-labelledby":"dsh-ssh-file-access-policy",children:[(0,B.jsx)("header",{children:(0,B.jsxs)("span",{children:[(0,B.jsx)("strong",{id:"dsh-ssh-file-access-policy",children:"\u8BBF\u95EE\u7B56\u7565"}),(0,B.jsx)("small",{children:"\u6587\u4EF6\u6743\u9650\u4E0E SSH \u547D\u4EE4\u3001\u7EC8\u7AEF\u6743\u9650\u76F8\u4E92\u72EC\u7ACB"})]})}),(0,B.jsxs)("div",{className:"dsh-ssh-file-access-options",children:[(0,B.jsxs)("div",{className:"dsh-ssh-file-access-policy-row",children:[(0,B.jsxs)("span",{children:[(0,B.jsx)("strong",{children:"\u6587\u4EF6\u64CD\u4F5C\u6743\u9650"}),(0,B.jsx)("small",{children:"\u6D4F\u89C8\u6A21\u5F0F\u4E0D\u4F1A\u5411 AI \u66B4\u9732\u8DE8\u7AEF\u4F20\u8F93\u5DE5\u5177"})]}),(0,B.jsx)(hy,{value:r?.filePermission??"browse",onChange:t.setFilePermission})]}),(0,B.jsxs)("div",{className:"dsh-ssh-file-access-policy-row",children:[(0,B.jsxs)("span",{children:[(0,B.jsx)("strong",{children:"\u4F20\u8F93\u524D\u786E\u8BA4"}),(0,B.jsx)("small",{children:"AI \u53D1\u8D77\u4F20\u8F93\u65F6\u8BF7\u6C42 DSH \u6388\u6743"})]}),(0,B.jsx)(cy,{checked:r?.requireFileApproval??!0,onChange:t.setRequireFileApproval})]})]})]})]}),(0,B.jsxs)("footer",{className:"dsh-ssh-file-access-footer",children:[(0,B.jsxs)("span",{className:t.saving?"is-saving":"is-saved",children:[(0,B.jsx)("i",{"aria-hidden":"true"}),t.saving?"\u6B63\u5728\u4FDD\u5B58\u66F4\u6539":`${o>0?`\u5DF2\u6388\u6743 ${o} \u4E2A\u8FDE\u63A5`:"\u672A\u6388\u6743\u8FDE\u63A5"} \xB7 \u81EA\u52A8\u4FDD\u5B58`]}),(0,B.jsx)("button",{type:"button",className:"dsh-ssh-primary-button","data-ssh-dialog-close":!0,disabled:t.saving,onClick:s,children:t.saving?"\u4FDD\u5B58\u4E2D\u2026":"\u5B8C\u6210"})]})]})}function ay({endpoint:e,enabled:t,onToggle:s}){return(0,B.jsxs)("button",{type:"button","data-ssh-interactive":"choice",className:`dsh-ssh-file-access-endpoint${t?" is-mounted":""}`,"aria-pressed":t,onClick:s,children:[(0,B.jsx)("span",{className:`dsh-ssh-protocol-badge is-${e.protocol}`,children:rh(e.protocol)}),(0,B.jsxs)("span",{className:"dsh-ssh-file-access-endpoint-copy",children:[(0,B.jsx)("strong",{title:e.name,children:e.name}),(0,B.jsx)("small",{title:e.address,children:e.address})]}),(0,B.jsxs)("span",{className:"dsh-ssh-file-access-state",children:[(0,B.jsx)("i",{"aria-hidden":"true",children:(0,B.jsx)("b",{})}),(0,B.jsx)("em",{children:t?"\u5DF2\u6388\u6743":"\u672A\u6388\u6743"})]})]})}function ly(){return(0,B.jsx)("div",{className:"dsh-ssh-file-access-skeleton","aria-label":"\u6B63\u5728\u8BFB\u53D6\u4F1A\u8BDD\u6743\u9650",children:[0,1,2].map(e=>(0,B.jsxs)("span",{style:{"--ssh-skeleton-index":e},children:[(0,B.jsx)("i",{}),(0,B.jsxs)("b",{children:[(0,B.jsx)("i",{}),(0,B.jsx)("i",{})]}),(0,B.jsx)("em",{})]},e))})}function hy({value:e,onChange:t}){return(0,B.jsx)("div",{className:"dsh-ssh-file-permission-picker",role:"radiogroup","aria-label":"\u6587\u4EF6\u64CD\u4F5C\u6743\u9650",children:[["browse","\u4EC5\u6D4F\u89C8"],["transfer","\u5141\u8BB8\u4F20\u8F93"]].map(([s,r])=>(0,B.jsx)("button",{type:"button","data-ssh-interactive":"choice",role:"radio","aria-checked":e===s,className:e===s?"is-active":"",onClick:()=>t(s),children:r},s))})}function cy({checked:e,onChange:t}){return(0,B.jsxs)("button",{type:"button","data-ssh-interactive":"choice",role:"switch","aria-checked":e,className:`dsh-ssh-file-approval-switch${e?" is-active":""}`,onClick:()=>t(!e),children:[(0,B.jsx)("i",{"aria-hidden":"true",children:(0,B.jsx)("b",{})}),(0,B.jsx)("span",{children:e?"\u9700\u8981\u786E\u8BA4":"\u76F4\u63A5\u6267\u884C"})]})}function dy(){try{let e=JSON.parse(localStorage.getItem(Hf)??"[]");if(!Array.isArray(e))return[sh("transfer-1",1)];let t=e.slice(0,8).flatMap(s=>{if(typeof s!="object"||s===null)return[];let r=s;if(typeof r.id!="string"||!/^[a-zA-Z0-9_-]{1,100}$/.test(r.id)||typeof r.name!="string"||!Array.isArray(r.panes))return[];let o=r.panes.slice(0,4).flatMap(i=>{if(typeof i!="object"||i===null)return[];let n=i;return typeof n.id=="string"&&/^[a-zA-Z0-9_-]{1,100}$/.test(n.id)&&typeof n.endpointId=="string"&&typeof n.path=="string"?[{id:n.id,endpointId:"",path:"/"}]:[]});return o.length>=2?[{id:r.id,name:r.name.slice(0,40),panes:o}]:[]});if(t.length>0)return t}catch{}return[sh("transfer-1",1)]}function sh(e,t){return{id:e,name:`\u4EFB\u52A1 ${t}`,panes:[to(`${e}-a`),to(`${e}-b`)]}}function to(e){return{id:e,endpointId:"",path:"/"}}function uy(e,t){return e.map(s=>({...s,panes:s.panes.map(r=>!r.endpointId||t.some(o=>o.id===r.endpointId)?r:to(r.id))}))}function py(e,t){return e.find(s=>s.id===t)?.name??t}function Vf(e){let t=e[0]?.replaceAll("\\","/").split("/").filter(Boolean).at(-1)??"\u6587\u4EF6";return e.length>1?`${t} \u7B49 ${e.length} \u9879`:t}function rh(e){return e==="sftp"?"SFTP":e==="ftp"?"FTP":e==="ftps-explicit"?"FTPS":"FTPS-I"}function eo(e,t){return JSON.stringify([e,t.replaceAll("\\","/").replace(/\/+$/,"")||"/"])}function fy(e,t){return e===void 0||e.paneId!==t.id&&!gi(e,{endpointId:t.endpointId,directory:t.path})}function Bf(e){return e==="completed"||e==="failed"||e==="cancelled"}function Uf(e){return e<1024?`${e} B`:e<1024**2?`${(e/1024).toFixed(1)} KB`:e<1024**3?`${(e/1024**2).toFixed(1)} MB`:`${(e/1024**3).toFixed(2)} GB`}function my(e,t){if(e.state==="queued")return"\u7B49\u5F85\u4F20\u8F93";if(e.state==="scanning")return"\u6B63\u5728\u626B\u63CF\u76EE\u5F55";if(e.state==="transferring"){let s=Math.max(1,(Date.now()-(e.startedAt??Date.now()))/1e3),r=e.transferredBytes/s,o=r>0?Math.max(0,(e.totalBytes-e.transferredBytes)/r):0;return`${t.toFixed(0)}% \xB7 ${Uf(r)}/s${o>1?` \xB7 \u7EA6 ${by(o)}`:""}`}return e.state==="completed"?`\u5DF2\u5B8C\u6210 ${e.completedFiles} \u4E2A\u6587\u4EF6${e.skippedFiles?`\uFF0C\u8DF3\u8FC7 ${e.skippedFiles}`:""}`:e.state==="cancelled"?"\u5DF2\u53D6\u6D88":"\u4F20\u8F93\u5931\u8D25"}function gy(e){if(e.startedAt===void 0)return`\u521B\u5EFA\u4E8E ${zf(e.createdAt)}`;let t=e.completedAt??Date.now(),s=vy(Math.max(0,t-e.startedAt));return e.completedAt===void 0?`\u5DF2\u6267\u884C ${s}`:`\u8017\u65F6 ${s} \xB7 \u5B8C\u6210\u4E8E ${zf(e.completedAt)}`}function zf(e){return ey.format(e)}function vy(e){let t=Math.max(0,Math.floor(e/1e3));if(t<60)return`${t} \u79D2`;let s=Math.floor(t/60);return s<60?`${s} \u5206 ${String(t%60).padStart(2,"0")} \u79D2`:`${Math.floor(s/60)} \u5C0F\u65F6 ${String(s%60).padStart(2,"0")} \u5206`}function by(e){if(e<60)return`${Math.ceil(e)} \u79D2`;let t=Math.ceil(e/60);return t<60?`${t} \u5206\u949F`:`${Math.floor(t/60)} \u5C0F\u65F6 ${t%60} \u5206\u949F`}function _y(){return(0,B.jsx)("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:(0,B.jsx)("path",{d:"M8 12V4m0 0L4.8 7.2M8 4l3.2 3.2"})})}function xy(){return(0,B.jsx)("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:(0,B.jsx)("path",{d:"M12.2 5.2A5 5 0 1 0 13 9M12.2 5.2V2.5m0 2.7H9.5"})})}function yy({directory:e}){return(0,B.jsx)("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:e?(0,B.jsx)("path",{d:"M2 4.3h4l1.2 1.4H14v6.8H2z"}):(0,B.jsx)("path",{d:"M3.2 2h6l3.6 3.6V14H3.2zm6 0v3.6h3.6"})})}var Wf=`.dsh-ssh-transfer-workspace {
5624
5624
  display: flex;
5625
5625
  width: 100%;
5626
5626
  height: 100%;