filecat 7.21.0 → 7.21.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "filecat",
3
- "version": "7.21.0",
3
+ "version": "7.21.2",
4
4
  "description": "A self-hosted Web File browser and lightweight server management tool.",
5
5
  "author": "xiaobaidadada",
6
6
  "repository": {
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[2334],{72458(e,t,i){function n(e,t){let i=function(e){let t="\\";for(const i of e)if("/"===i||"\\"===i){t=i;break}return t}(e);if("."===t)return e;if(".."===t){if(e.length>1){let t=e[e.length-1]===i?1:0;for(let n=e.length-1-t;n>=0;n--)if(e[n]===i)return e.substring(0,n+1)}return e}return e.endsWith(i)&&t.startsWith(i)?e.slice(0,-1)+t:e.endsWith(i)||t.startsWith(i)?e+t:e+i+t}i.d(t,{Jn:()=>n,Z1:()=>s});function s(e){if("string"!=typeof e||0===e.length)return!1;return/^[a-zA-Z]:[\\\/]/.test(e)||/^\\\\[^\\/]+[\\/]/.test(e)||/^\//.test(e)}},47374(e,t,i){i.d(t,{e:()=>f});var n=i(96540),s=i(52671),o=i(64694),a=i(34289),l=i(61443),r=i(75725),c=i(22022),d=i(85997),_=i(74848);function f(e){let t=(0,s.zy)();const[i,f]=(0,n.useState)([]),[p,h]=(0,n.useState)("/"),[u,m]=(0,n.useState)(void 0),{t:w,i18n:v}=(0,c.Bd)();n.useEffect(()=>{let t="",i=(0,a.vX)().split("/");i=i.filter(e=>e);const n=i.indexOf(e.baseRoute),s=[];if(-1!=n){t=(0,o.IO)(i.slice(0,n),e.baseRoute);const a=i.slice(n+1);for(let e=0;e<a.length;e++){const i=a[e];s.push({value:i,href:0===e?`${t}${i}/`:(0,o.IO)(s[e-1].href,i)})}h(t),f(s)}},[t]);const g=t=>{t.stopPropagation(),e.clickFun(t)};return(0,_.jsx)("div",{className:"breadcrumbs",onClick:e=>{m(void 0!==u?void 0:"")},children:(0,_.jsx)(n.Fragment,{children:void 0===u?(0,_.jsxs)(n.Fragment,{children:[(0,_.jsx)("span",{className:"chevron",children:(0,_.jsx)(s.N_,{to:p,onClick:g,children:(0,_.jsx)(d.In,{icon:"home"})})}),i.map((e,t)=>(0,_.jsxs)("span",{className:"chevron",children:[(0,_.jsx)(d.In,{icon:"keyboard_arrow_right"}),(0,_.jsx)(s.N_,{to:e.href,onClick:g,children:decodeURIComponent(e.value)})]},t))]}):(0,_.jsx)(r.QM,{click:()=>{m(void 0)},children:(0,_.jsx)(l.Sm,{width:"100%",placeholder:w("输入跳转的目录"),handlerEnter:t=>{e.input_path_enter&&e.input_path_enter(t),m(void 0)}})})})})}},77481(e,t,i){i.d(t,{S:()=>l,X:()=>a});var n=i(96540),s=i(61443),o=i(74848);function a(e){const[t,i]=n.useState([]),a=(0,n.useRef)(-1),[l,r]=(0,n.useState)(-1),[c,d]=(0,n.useState)(-1);(0,n.useEffect)(()=>{e.children?i(Array.isArray(e.children)?e.children:[e.children]):i(e.rows)},[e.rows,e.children]);const _=()=>{a.current=-1,r(-1),d(-1)};return(0,o.jsxs)("table",{children:[(0,o.jsx)("thead",{children:(0,o.jsx)("tr",{children:e.headers?.map((t,i)=>{const n=!!e.filter&&(e.filter.column??0)===i;let a=t;if(n){const i=e.filter,n=i.options.find(e=>e.value===i.value);null!=i.value&&n&&(a=`${t} (${n.label})`)}return(0,o.jsx)("th",{className:n?"table-filter-col":"",children:n?(0,o.jsx)(s.l6,{value:e.filter.value,options:e.filter.options,onChange:e.filter.onChange,bare:!0,trigger_label:a}):t},i)})})}),(0,o.jsx)("tbody",{children:t.map((t,i)=>{const n=!!e.onRowDrag;return(0,o.jsx)("tr",{className:n?(l===i?"row-dragging":"")+(c===i?" row-drop-target":""):"",draggable:n,onContextMenu:()=>{e.handleContextMenu&&e.handleContextMenu(t)},onDragStart:e=>{n&&(a.current=i,r(i),e.dataTransfer.effectAllowed="move")},onDragOver:e=>{!n||a.current<0||(e.preventDefault(),e.dataTransfer.dropEffect="move",d(i))},onDrop:t=>{n&&(t.preventDefault(),(()=>{const t=a.current,i=c;_(),t<0||i<0||t===i||e.onRowDrag?.(t,i)})())},onDragEnd:_,children:t.map((i,n)=>{const s=n===t.length-1?"small":"";return(0,o.jsx)("td",{className:s,style:{width:e.width??"auto"},children:i},n)})},i)})})]})}function l(e){return(0,o.jsx)("div",{style:{display:e.isFlex?"flex":"block"},children:e.columns.map((e,t)=>(0,o.jsx)("div",{children:e},t))})}},62334(e,t,i){i.r(t),i.d(t,{default:()=>Q});var n=i(96540),s=i(47374),o=i(34843),a=i(52035),l=i(82893),r=i(14284),c=i(52671),d=i(4412),_=i(89824),f=i(34289),p=i(53459),h=i(99214),u=i(61443),m=i(47022),w=i(62042),v=i(22022),g=i(7523),x=i(78247),y=i(88815),j=i(6960),k=i(47071),G=i(14944),A=i(92275),b=i(23430),C=i(72458),S=i(34251),M=i(60096),z=i(87361),$=i(97952),D=i(85997),N=i(77481),E=i(70447),F=i(74848);const I=500;function P(e){const{t}=(0,v.Bd)(),i=(0,c.Zp)(),[,s]=(0,o.fp)(l.AG.prompt_card),[a,r]=(0,n.useState)(""),[d,_]=(0,n.useState)(!1),[f,p]=(0,n.useState)([]),[h,m]=(0,n.useState)(0),[w,g]=(0,n.useState)(!1),x=(0,n.useMemo)(()=>new $.I(window.location.host,"file_deep_search"),[]),y=(0,n.useRef)(!1),j=decodeURIComponent(e.base_path);(0,n.useEffect)(()=>{let e=[],t=null;const i=()=>{if(t=null,y.current||!e.length)return;const i=e;e=[],m(e=>e+i.length),p(e=>e.length>=I?e:[...e,...i].slice(0,I))},n=()=>{y.current||_(!1)};return x.addMsg(A.HK.file_deep_search_data,n=>{y.current||(e.push(...n.context??[]),null===t&&(t=setTimeout(i,100)))}),x.addMsg(A.HK.file_deep_search_end,()=>{y.current||(i(),_(!1))}),x.on_message("close",n),()=>{y.current=!0,clearTimeout(t),x.sendData(A.HK.file_deep_search_cancel,{}).catch(()=>{}),x.off_message("close",n),x.close()}},[]);const k=()=>{const t=a.trim();if(!t||d)return;p([]),m(0),g(!0),_(!0);const i={param_path:e.base_path,keyword:t};x.sendData(A.HK.file_deep_search,i).catch(()=>{})},G=e=>{let t=e.is_dir?e.path:e.path.slice(0,e.path.lastIndexOf("/")+1);t.endsWith("/")||(t+="/"),s({open:!1}),i(z.o.file+t.split("/").map(encodeURIComponent).join("/"))};return(0,F.jsxs)("div",{className:"file-deep-search",children:[(0,F.jsxs)("div",{className:"file-deep-search__bar",children:[(0,F.jsx)(u.$Z,{icon:"search",value:a,placeholder:t("搜文件名"),handleInputChange:e=>r(e),handleEnterPress:k}),(0,F.jsx)("button",{className:"button button--flat",onClick:d?()=>{x.sendData(A.HK.file_deep_search_cancel,{}).catch(()=>{}),_(!1)}:k,children:t(d?"取消":"搜索")})]}),(0,F.jsxs)("div",{className:"file-deep-search__hint",children:[(0,F.jsxs)("span",{children:[t("范围"),":",j]}),h>0&&(0,F.jsx)("span",{className:"file-deep-search__count",children:h>I?`${t("已显示")} 500 / ${h}`:`${h}`})]}),(0,F.jsxs)("div",{className:"file-deep-search__body",children:[f.length>0&&(0,F.jsx)(N.X,{headers:[t("名称"),t("路径"),""],rows:f.map(e=>{const i=e.path.slice(0,e.path.lastIndexOf("/")+1);return[e.is_dir?(0,F.jsx)("span",{className:"file-deep-search__dir",children:e.name}):e.name,(0,F.jsx)(E.xP,{context:i}),(0,F.jsx)(D.rA,{icon:"folder_open",title:t("打开所在目录"),onClick:()=>G(e)})]})}),d&&(0,F.jsxs)("div",{className:"file-deep-search__empty",children:[(0,F.jsx)("span",{className:"chat-session-running",title:t("搜索中")}),t("搜索中")]}),!d&&h>I&&(0,F.jsx)("div",{className:"file-deep-search__more",children:t("结果过多")}),!d&&0===f.length&&(0,F.jsx)("div",{className:"file-deep-search__empty",children:t(w?"无匹配":"输入后搜")})]})]})}var X=i(64694),R=i(23496),K=i(12730),L=i(75725),H=i(40505);let U={};function Z(){const{t:e}=(0,v.Bd)();let t=(0,c.zy)();const i=(0,c.Zp)(),{check_user_auth:s}=(0,x.MH)(),[a,d]=(0,o.fp)(l.AG.nowFileList),[p,u]=(0,o.fp)(l.AG.uploadFiles),[y,j]=(0,o.fp)(l.AG.showPrompt),[k,C]=(0,o.fp)(l.AG.selectedFileList),[M,$]=(0,o.fp)(l.AG.copyedFileList),[N,I]=(0,o.fp)(l.AG.cutedFileList),[P,R]=(0,o.fp)(l.AG.selectedFileList),[H,Z]=(0,o.fp)(l.AG.clickFileList),[Y,B]=(0,o.fp)(l.AG.fileShellShow),O=(0,h.Cf)(),[W,T]=(0,o.fp)(l.AG.file_root_list),[V,q]=(0,o.fp)(l.AG.file_root_index),[J,Q]=(0,n.useState)(void 0),[ee,te]=(0,n.useState)(""),[ie,ne]=(0,o.fp)(l.AG.workflow_show),[se,oe]=(0,o.fp)(l.AG.workflow_realtime_show),[ae,le]=(0,o.fp)(l.AG.work_flow_show),{initUserInfo:re}=(0,n.useContext)(g.F),[ce,de]=(0,o.fp)(l.AG.user_base_info),{click_file:_e}=(0,h.kZ)(),[fe,pe]=(0,o.fp)(l.AG.prompt_card),he=(0,n.useMemo)(()=>a.files.reduce((e,t)=>e+(t.type!==m.Iw.folder?1:0),0),[a]),ue=(0,n.useMemo)(()=>a.files.reduce((e,t)=>e+(t.type===m.Iw.folder?1:0),0)+(a.folders?.length??0),[a]);function me(e){(0,w.SK)(e)}(0,n.useEffect)(()=>{U={}},[t]),(0,n.useEffect)(()=>()=>{B({show:!1,path:""})},[]);const we=(0,h.Vs)(),ve=t=>{pe({open:!0,title:e("信息"),context_div:(0,F.jsxs)("div",{style:{maxWidth:"25rem"},children:[(0,F.jsx)(L.Yh,{left:e("挂载位置磁盘"),right:t?.total_size}),(0,F.jsx)(L.Yh,{left:`${e("磁盘剩余")}`,right:t?.left_size}),(0,F.jsx)(L.Yh,{left:`${e("文件系统")}`,right:t?.fs_type}),(0,F.jsx)(L.Yh,{left:`${e("文件夹数")}`,right:ue}),(0,F.jsx)(L.Yh,{left:`${e("文件数")}`,right:he}),(0,F.jsx)(L.Yh,{left:`${e("当前位置")}`,right:(0,F.jsx)(E.xP,{context:t?.now_absolute_path})})]}),cancel:()=>{G.ws.removeMsg(A.HK.file_info)}})};return(0,F.jsxs)(n.Fragment,{children:[k.length>0&&(0,F.jsx)(D.rA,{icon:"delete",title:e("删除"),onClick:()=>{j({show:!0,type:_.PromptEnum.FilesDelete,overlay:!0,data:{}})}}),k.length>0&&(0,F.jsx)(D.rA,{icon:"content_copy",title:e("复制"),onClick:function(){const e=(0,h.ib)(a,k);$(e.map(e=>(0,h.Ok)(e.name))),I([]),me("已复制")}}),k.length>0&&(0,F.jsx)(D.rA,{icon:"content_cut",title:e("剪切"),onClick:function(){const e=(0,h.ib)(a,k);I(e.map(e=>(0,h.Ok)(e.name))),$([]),me("已剪切")}}),(M.length>0||N.length>0)&&(0,F.jsx)(D.rA,{onClick:function(){j({show:!0,type:_.PromptEnum.Confirm,overlay:!0,data:{}})},icon:"content_paste",title:e("粘贴到此处"),tip:M.length+N.length}),k.length>0&&(0,F.jsx)(D.rA,{icon:"download",title:e("下载"),onClick:function(){const e=(0,h.ib)(a,k);for(let t=0;t<e.length;t++){const i=e[t];e[t]=encodeURIComponent((0,h.Ok)(i.name))}const t=r.$M.getDownloadUrl(e);window.open(t)}}),k.length>0&&(0,F.jsx)(D.rA,{icon:"compress",title:e("压缩"),onClick:function(){const t=(0,h.ib)(a,k);for(let e=0;e<t.length;e++){const i=t[e];t[e]=(0,h.Ok)(i.name)}t&&0!==t.length?j({show:!0,type:_.PromptEnum.Compress,overlay:!0,data:{files:t}}):(0,w.zN)(e("没有选中"))}}),1===k.length&&(0,F.jsx)(D.rA,{icon:"edit_attributes",title:e("重命名"),onClick:function(){j({show:!0,type:_.PromptEnum.FileRename,overlay:!0,data:{}})}}),ae&&(0,F.jsx)(D.rA,{icon:"api",title:"workflow",onClick:()=>{ne(!ie)}}),O.can_terminal&&(0,F.jsx)(D.rA,{icon:"terminal",title:"shell",onClick:function(){Y.show?B({show:!1,path:""}):B({show:!0,path:(0,f.GG)("file",(0,f.vX)())})}}),s(b.oV.share_file)&&(0,F.jsx)(D.rA,{icon:"share",title:e("文件分享"),onClick:()=>{i(`${z.o.share_list_setting_page}`)}}),(0,F.jsx)(D.rA,{icon:"grid_view",title:e("切换样式"),onClick:we}),(0,F.jsx)(D.rA,{icon:"create_new_folder",title:e("创建文件夹"),onClick:function(){j({show:!0,type:_.PromptEnum.DirNew,overlay:!0,data:{dir:(0,f.GG)("file",(0,f.vX)())}})}}),(0,F.jsx)(D.rA,{icon:"note_add",title:e("创建文本文件"),onClick:function(){j({show:!0,type:_.PromptEnum.FileNew,overlay:!0,data:{dir:(0,f.GG)("file",(0,f.vX)())}})}}),(0,F.jsx)(D.rA,{icon:"upload_file",title:e("上传"),onClick:()=>{j({show:!0,type:_.PromptEnum.UploadFile,overlay:!0,data:{call:e=>{let t=e.currentTarget?.files;if(!t)return;let i=!!t[0].webkitRelativePath;const n=[],s=new Set;for(let e=0;e<t.length;e++){const o=t[e],a=i?o.webkitRelativePath:`${o.webkitRelativePath}${o.name}`;o.fullPath=a,i&&s.add((0,K.S)(a)),n.push(o)}const o=[];if(i)for(const e of s)o.push({isDir:!0,fullPath:e,name:e});o.push(...n),u(o),j({show:!0,type:_.PromptEnum.FilesUpload,overlay:!1,data:{}})}}})}}),(0,F.jsx)(D.rA,{icon:"info",title:e("信息"),onClick:async()=>{let e;if(!U.now_absolute_path){G.ws.addMsg(A.HK.file_info,t=>{const i=t.context;e&&(U={...U,...i},G.ws.removeMsg(A.HK.file_info),ve(U))});const t=await G.ws.sendData(A.HK.file_info,{type:m.Iw.folder,path:(0,f.GG)("file",(0,f.vX)())});e=t.context,U=e,ve(U)}ve(U)}}),(0,F.jsx)(D.rA,{icon:"more_vert",title:e("切换目录"),onClick:t=>{const n=new S.ik;n.x=t.clientX,n.y=t.clientY,n.type=m.Iw.directory,n.items=W,n.item_pre_value=V,n.textClick=async t=>{if(t.type===S.LU.add)return i(`${z.o.setting_private_env_setting}`),j({data:void 0,overlay:!1,type:"",show:!1}),void(0,w.N9)(e("请配置 文件夹路径"));j({data:void 0,overlay:!1,type:"",show:!1}),t.type!==S.LU.child?(async e=>{q(e),await r.$M.post("base_switch",{root_index:e}),await re(),i("/file/"),R([]),Z([])})(t.index):i((0,X.IO)(z.o.file,t.rel))},j({show:!0,type:_.PromptEnum.FileMenu,overlay:!1,data:n})}})]})}var Y=i(2543),B=i(21499),O=i(17903);const W=n.lazy(()=>Promise.all([i.e(7856),i.e(6349),i.e(3659)]).then(i.bind(i,63659))),T=n.lazy(()=>Promise.all([i.e(7856),i.e(1636)]).then(i.bind(i,81636))),V=n.lazy(()=>i.e(9857).then(i.bind(i,69857)));let q,J="";function Q(){const[e,t]=(0,o.fp)(l.AG.editorSetting),[,i]=(0,o.fp)(l.AG.md_editor),[,w]=(0,o.fp)(l.AG.log_viewer),[,$]=(0,o.fp)(l.AG.image_editor),[,N]=(0,o.fp)(l.AG.markdown),[,E]=(0,o.fp)(l.AG.excalidraw_editor),[,I]=(0,o.fp)(l.AG.mind_editor),[,K]=(0,o.fp)(l.AG.timeline_editor),[,L]=(0,o.fp)(l.AG.excel_editor),[U,Q]=(0,o.fp)(l.AG.file_preview),{t:ee}=(0,v.Bd)();let te=(0,c.zy)();const ie=(0,c.Zp)(),[ne,se]=(0,o.fp)(l.AG.nowFileList),[oe]=(0,o.fp)(l.AG.file_list_refresh),[ae]=(0,o.fp)(l.AG.mount_enabled),[le,re]=(0,o.fp)(l.AG.current_mount),[ce,de]=(0,o.fp)(l.AG.showPrompt),[_e,fe]=(0,o.fp)(l.AG.selectedFileList),[pe,he]=(0,o.fp)(l.AG.clickFileList),[ue,me]=(0,o.fp)(l.AG.fileShellShow),[we,ve]=(0,n.useState)(""),[ge,xe]=(0,o.fp)(l.AG.workflow_show),[ye,je]=(0,o.fp)(l.AG.workflow_realtime_show),[ke,Ge]=(0,o.fp)(l.AG.work_flow_show),{initUserInfo:Ae}=(0,n.useContext)(g.F),[be,Ce]=(0,o.fp)(l.AG.user_base_info),{check_user_auth:Se}=(0,x.MH)(),{click_file:Me}=(0,h.kZ)(),[ze]=(0,c.ok)(),$e=(0,h._A)(),De=n.useRef(null),[Ne,Ee]=(0,o.fp)(l.AG.to_running_files),[Fe,Ie]=(0,o.fp)(l.AG.file_page),[Pe]=(0,o.fp)(l.AG.blank_search_mode),[,Xe]=(0,o.fp)(l.AG.prompt_card),[Re,Ke]=(0,o.fp)(l.AG.blank_search_mode_for_temp),Le=(0,h.oT)(),He="1"===ze.get("chat_open"),Ue=Se(b.oV.ai_agent_page),Ze=(0,h.Cf)();(0,n.useEffect)(()=>{be?.user_data&&He&&!Ue&&Le("chat_open",null)},[He,Ue,be]);const[Ye,Be]=(0,o.fp)(l.AG.studio_chat_width),Oe=n.useRef(null),[We,Te]=(0,n.useState)(!1),[Ve,qe]=(0,n.useState)(void 0),Je=(0,h.dN)();(0,h.rJ)(Je());const[Qe,et]=(0,o.fp)(l.AG.ai_chat_session_by_cwd),tt=function(){const e=(0,h.Cf)(),[t,i]=(0,o.fp)(l.AG.user_base_info),{t:s}=(0,v.Bd)(),{check_user_auth:a}=(0,x.MH)(),[d,p]=(0,o.fp)(l.AG.router_jump),u=(0,c.Zp)(),{initUserInfo:w}=(0,n.useContext)(g.F),[y,j]=(0,o.fp)(l.AG.nowFileList),[k,C]=(0,o.fp)(l.AG.showPrompt),[M,$]=(0,o.fp)(l.AG.fileShellShow),[D,N]=(0,o.fp)(l.AG.blank_search_mode);return i=>{i.preventDefault(),i.stopPropagation();const n=new S.ik;n.x=i.clientX,n.y=i.clientY,n.type=m.Iw.directory;const o=[{r:(0,F.jsx)("span",{style:(0,H.ok)(t.user_data.dir_show_type===b.t8.time_minx_max),children:s("时间逆序")}),v:b.t8.time_minx_max},{r:(0,F.jsx)("span",{style:(0,H.ok)(t.user_data.dir_show_type===b.t8.time_max_min),children:s("时间顺序")}),v:b.t8.time_max_min}],l=[{r:(0,F.jsx)("span",{style:(0,H.ok)(t.user_data.dir_show_type===b.t8.size_min_max),children:s("大小顺序")}),v:b.t8.size_min_max},{r:(0,F.jsx)("span",{style:(0,H.ok)(t.user_data.dir_show_type===b.t8.size_max_min),children:s("大小逆序")}),v:b.t8.size_max_min}],c=[{r:(0,F.jsx)("span",{style:(0,H.ok)(!t.user_data.file_list_pagination_mode||t.user_data.file_list_pagination_mode===b.yM.all),children:s("全部加载文件")}),v:b.yM.all},{r:(0,F.jsx)("span",{style:(0,H.ok)(t.user_data.file_list_pagination_mode===b.yM.pagination),children:s("scrll_l")}),v:b.yM.pagination}],d=[{r:(0,F.jsx)("span",{style:(0,H.ok)(!t.user_data.file_time_show_type||t.user_data.file_time_show_type===b.KD.current),children:s("最近时间")}),v:b.KD.current},{r:(0,F.jsx)("span",{style:(0,H.ok)(t.user_data.file_time_show_type===b.KD.time),children:s("准确时间")}),v:b.KD.time}],v=[{r:s("文件列表展示"),items:[{r:s("文件排序"),v:"",items:[{r:(0,F.jsx)("span",{style:(0,H.ok)(!t.user_data.dir_show_type),children:s("系统默认")}),v:b.t8.defualt},{r:(0,F.jsx)("span",{style:(0,H.ok)(t.user_data.dir_show_type===b.t8.name),children:s("名字")}),v:b.t8.name},{r:(0,F.jsx)("span",{style:(0,H.ok)(t.user_data.dir_show_type===b.t8.time_minx_max||t.user_data.dir_show_type===b.t8.time_max_min),children:s("修改时间")}),v:!1,items:o},{r:(0,F.jsx)("span",{style:(0,H.ok)(t.user_data.dir_show_type===b.t8.size_min_max||t.user_data.dir_show_type===b.t8.size_max_min),children:s("文件大小")}),v:!1,items:l}]},{r:s("文件加载方式"),v:"",items:c},{r:s("时间展示"),v:"",items:d},{r:s("缩放调整"),v:"zoom_adjust"},{r:(0,F.jsx)("span",{style:(0,H.ok)(D),children:s("srchbln")}),v:"blank_search_mode"}]}];e.git_available&&y?.folders?.find(e=>".git"===e.name)&&v.push({r:s("查看Git提交"),v:"git_page"}),a(b.oV.code_resource)&&v.push({r:s("add_rot"),v:"code_resource"}),a(b.oV.http_proxy)&&v.push({r:s("dl_here"),v:"http_resource"}),t?.user_data?.quick_cmd&&(0,h.LL)([...t.user_data.quick_cmd],v),n.items=v,n.textClick=async e=>{if(console.log(e),!1===e)return;const t={};if("gcfg_dir_config"===e){const e=(0,f.GG)("file",(0,f.vX)());return C({data:void 0,overlay:!1,type:"",show:!1}),void u(`${z.o.gcfg_page}/${encodeURIComponent(e)}`)}if("git_page"===e){const e=(0,f.GG)("file",(0,f.vX)());return C({data:void 0,overlay:!1,type:"",show:!1}),void u(`${z.o.git_page}/${encodeURIComponent(e)}`)}if("code_resource"===e){const e=await G.ws.sendData(A.HK.file_info,{path:(0,f.GG)("file",(0,f.vX)())});return p({page_self_router_api_data:[`/api/${Date.now()}`,e.context.now_absolute_path]}),C({data:void 0,overlay:!1,type:"",show:!1}),void u("/setting/customer_router/")}if("http_resource"===e){const e=await G.ws.sendData(A.HK.file_info,{path:(0,f.GG)("file",(0,f.vX)())});return p({http_download_map_path:e.context.now_absolute_path}),C({data:void 0,overlay:!1,type:"",show:!1}),void u("/proxy/http/")}if("zoom_adjust"===e)return C({data:void 0,overlay:!1,type:"",show:!1}),void setTimeout(()=>{C({show:!0,type:_.PromptEnum.ZoomAdjust,overlay:!1,data:{}})},0);if("object"==typeof e&&"quick_cmd"===e.tag){let t=e.cmd;t&&(t.endsWith("\r")||(t+="\r",$({show:!0,path:(0,f.GG)("file",(0,f.vX)()),cmd:t})))}else{if("blank_search_mode"===e)return N(!D),void C({data:void 0,overlay:!1,type:"",show:!1});if(e===b.yM.all||e===b.yM.pagination)t.is_pagination_mode=!0;else if(e===b.KD.current||e===b.KD.time)t.is_file_show_type=!0;else{if(e!==b.t8.defualt&&e!==b.t8.name&&e!==b.t8.size_max_min&&e!==b.t8.size_min_max&&e!==b.t8.time_max_min&&e!==b.t8.time_minx_max)return;t.is_dir_list_type=!0}}await r.wm.post(R.s.user_save_private_attr,{type:e,...t}),await w(),C({data:void 0,overlay:!1,type:"",show:!1}),u((0,f.vX)())},C({show:!0,type:_.PromptEnum.FileMenu,overlay:!1,data:n})}}(),it=async e=>{let t=!1;for(const i of e.files??[])i.origin_size=i.size,i.size=(0,y.v7)(i.size),be.user_data.file_time_show_type===b.KD.time?i.show_mtime=i.mtime?(0,B.Yq)(i.mtime):"":i.show_mtime=i.mtime?(0,j.s)(i.mtime):"",t||!i.name.endsWith(".workflow.yml")&&!i.name.endsWith(".act")||(t=!0),i.name===k.SB&&(t=!0);for(const i of e.folders??[])be.user_data.file_time_show_type===b.KD.time?i.show_mtime=i.mtime?(0,B.Yq)(i.mtime):"":i.show_mtime=i.mtime?(0,j.s)(i.mtime):"",i.name===k.SB&&(t=!0);Ge(t)},nt=n.useRef(null),st=async e=>{if(!0===ae){if(nt.current!==e){nt.current=e;try{const t=await r.$M.post("file/mount_info",{param_path:e});re(t?.data??null),await G.ws.connect()}catch(e){re(null)}}}else re(null)};(0,n.useEffect)(()=>{ke&&(async()=>{const e=new k.Nd,t=(0,a.zp)().get(l.AG.current_mount);e.dir_path=(0,h.Zl)((0,f.GG)("file",(0,f.vX)()),t),G.ws.addMsg(A.HK.workflow_realtime,e=>{const t=e.context;if(e.context){for(const e of t.sucess_file_list)(0,h.Ys)(e);for(const e of t.failed_file_list)(0,h.V$)(e);Ee(new Set(t.running_file_list))}}),await G.ws.sendData(A.HK.workflow_realtime,e)})()},[ke,le,te]);const ot=async()=>{const e=(0,f.GG)("file",(0,f.vX)());if(Pe||Re)return;let t;if(st(e),be.user_data.file_list_pagination_mode===b.yM.pagination){if(J!==e){if(J=e,1!==Fe.page_num)return void Ie({page_size:Fe.page_size,page_num:1})}else if(Fe.page_num<0)return;if(t=await r.$M.post("file_get_page",{param_path:e,page_num:Fe.page_num,page_size:Fe.page_size}),t.code!==p.m.Success)return;const i=t.data;return it(i),i.files?.length?(se(e=>{const t=(0,Y.cloneDeep)(1===Fe.page_num?i.files:[...e?.files??[],...i.files]),n={...e,files:t};return(0,h.yC)(n,be.user_data.dir_show_type),n}),void(q=t.data)):void Ie({page_size:Fe.page_size,page_num:-1})}if(t=await r.$M.get(e),t.code!==p.m.Success)return;const i=t.data;(0,h.yC)(i,be.user_data.dir_show_type),it(t.data),se(t.data),q=t.data};(0,n.useEffect)(()=>async()=>{Ee(new Set)},[]);const at=()=>{Ge(!1),(()=>{const e=ze.get("preview_file_name"),t=ze.get("preview_mode");if(!e||!t)return!1;const n=(0,f.GG)("file",(0,f.vX)());if(De.current===n+e)return!0;De.current=n+e;const s=()=>$e(null);return"md"===t?(i({url:r.$M.getDownloadUrl(`${encodeURIComponent(n)}${e}`),path:`${n}${e}`,name:e,close:s}),!0):"log"===t?(w({show:!0,fileName:e,encoding:ze.get("preview_log_enc")??"utf8",wrap:ze.get("preview_log_wrap")??"wrap",close:s}),!0):"image_edit"===t?($({path:(0,X.IO)((0,f.vX)(),e),name:e,close:s}),!0):(Me({name:e,opt_shell:!0,..."text"===t?{model:"text"}:{},close:s}),!0)})()||(t({open:!1}),Q({open:!1}),i({}),w({show:!1}),$({}),N({}),E({}),I({}),K({}),L({}),ot())};(0,n.useEffect)(()=>{at()},[te,Fe]),(0,n.useEffect)(()=>{oe>0&&ot()},[oe]);const lt=n.useRef(!1);(0,n.useEffect)(()=>{if(null!==ae)return lt.current?void(!0===ae?st((0,f.GG)("file",(0,f.vX)())):re(null)):(lt.current=!0,void(!0===ae&&null===le&&st((0,f.GG)("file",(0,f.vX)()))))},[ae]);const rt=e=>{e.target===e.currentTarget&&(fe([]),he([]))},ct=n.useCallback((0,Y.throttle)(e=>{const t=Oe.current;if(!t||!t.parentElement)return;const i=parseFloat(getComputedStyle(t).fontSize),n=t.parentElement.getBoundingClientRect(),s=n.right-e.clientX,o=Math.min(Math.max(s,320),.7*n.width);Be(parseFloat((o/i).toFixed(2)))},32),[]),dt=()=>{Te(!1),document.removeEventListener("pointermove",ct)},_t=(0,F.jsxs)("div",{className:"file-list-main",children:[(0,F.jsx)(s.e,{baseRoute:"file",clickFun:function(){if(fe([]),he([]),be.user_data.file_list_pagination_mode===b.yM.pagination){const e=document.getElementById("listing");e&&(e.scrollTop=0),Ie({page_size:Fe.page_size,page_num:1})}},input_path_enter:e=>{var t;fe([]),he([]),se({files:[],folders:[]}),(0,C.Z1)(e)?(e=e.replace(0===(t=be.user_data).folder_item_now||void 0===t.folder_item_now?t.cwd:t.folder_items[t.folder_item_now-1].path,""),ie(e)):ie((0,C.Jn)((0,f.vX)(),e))}}),le&&(0,F.jsxs)("div",{className:"mount-tip-bar",style:{borderLeftColor:le.color},children:[(0,F.jsx)("span",{className:"material-icons",style:{color:le.color},children:"cloud"}),(0,F.jsx)("span",{children:[le.credential_note,le.account_note||(O.C1.find(e=>e.value===le.driver)?.title??le.driver),le.name].filter(Boolean).join(" - ")}),le.readonly&&(0,F.jsx)("span",{className:"mount-readonly-tag",children:ee("只读")})]}),be.user_data.file_list_pagination_mode===b.yM.pagination?(0,F.jsx)(M.$J,{handleContextMenu:tt,clickBlank:rt,list:ne.files}):(0,F.jsx)(M.t$,{handleContextMenu:tt,file_list:ne.files,folder_list:ne.folders,clickBlank:rt})]});return(0,F.jsxs)(n.Fragment,{children:[(0,F.jsx)(d.aZ,{children:(0,F.jsx)(u.$Z,{handleEnterPress:async()=>{if(Pe||Re){if(fe([]),he([]),!we||!we.trim())return void se({files:[],folders:[]});const e=(0,f.GG)("file",(0,f.vX)()),t=await r.$M.post("file_get_page",{param_path:e,page_num:1,page_size:1e4,search:we.trim()});if(t.code!==p.m.Success)return;const i=t.data;return(0,h.yC)(i,be.user_data.dir_show_type),it(i),se(i),void(q=i)}if(!q)return;fe([]),he([]);const e=[],t=[];for(const t of q.files??[])t.name.includes(we)&&e.push(t);for(const e of q.folders??[])e.name.includes(we)&&t.push(e);se({files:e,folders:t})},placeholder:ee("搜索当前目录"),icon:"search",value:"",mobile_hidden:!0,handleIconClick:()=>{const e=(0,f.GG)("file",(0,f.vX)());Xe({open:!0,title:ee("深搜"),context_div:(0,F.jsx)(P,{base_path:e})})},handleInputChange:e=>{ve(e)},max_width:"25em"})}),(0,F.jsxs)(d.aZ,{position:"right",children:[Se(b.oV.ai_agent_page)&&Ze.ai_chat_available&&(0,F.jsx)(D.rA,{icon:"smart_toy",title:ee("AI 聊天"),selected:He,onClick:()=>Le("chat_open",!He?"1":null)}),(0,F.jsx)("div",{className:"mobile-context-btn",children:(0,F.jsx)(D.rA,{icon:"more_horiz",title:ee("右键"),onClick:()=>{const e=_e[_e.length-1];if(void 0!==e){const t=[...ne.folders??[],...ne.files??[]][e];if(t){const i=document.querySelectorAll(".item")[e],n=i?i.getBoundingClientRect():{left:window.innerWidth/2,bottom:100},s={preventDefault:()=>{},stopPropagation:()=>{},clientX:n.left+10,clientY:n.bottom??100},o=new S.ik;o.path=(0,X.IO)((0,f.vX)(),t.name),o.filename=t.name,o.x=s.clientX,o.y=s.clientY,o.type=t.type===m.Iw.folder?m.Iw.folder:(0,S.uL)(t.name),o.size=t.origin_size,de({show:!0,type:_.PromptEnum.FileMenu,overlay:!1,data:o})}}else{const e={preventDefault:()=>{},stopPropagation:()=>{},clientX:window.innerWidth/2,clientY:window.innerHeight/2};tt(e)}}})}),(0,F.jsx)(Z,{})]}),(0,F.jsxs)("div",{className:"file-list-split"+(He?" file-list-split--chat":""),children:[_t,He&&(0,F.jsxs)(n.Fragment,{children:[(0,F.jsx)("div",{className:"studio__divider studio__divider--chat",ref:Oe,onPointerDown:e=>{e.preventDefault(),Te(!0),document.addEventListener("pointermove",ct),document.addEventListener("pointerup",dt,{once:!0})}}),(0,F.jsx)("div",{className:"studio-chat-panel",style:{width:`${Ye}em`},children:(0,F.jsx)(n.Suspense,{fallback:null,children:(0,F.jsx)(V,{inline_header:!0,sync_url:!1,file_cwd_path:Je(),session_id:Ve??(ft=Je(),l.AG.get_ai_chat_session(Qe,ft)),on_session_change:e=>{qe(e),((e,t)=>{et({...Qe,[e]:t})})(Je(),e)}})})})]})]}),We&&(0,F.jsx)("div",{className:"shell__overlay",onPointerUp:dt}),ge&&(0,F.jsx)(W,{}),ye.open&&(0,F.jsx)(T,{})]});var ft}}}]);
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[6805],{47996(e,n,t){t.d(n,{d:()=>i});t(96540);var s=t(74848);function i(e){return(0,s.jsxs)("div",{className:"instance-item",children:[(0,s.jsxs)("div",{className:"instance-item__toolbar",children:[(0,s.jsx)("span",{className:"instance-item__label",children:e.title}),e.toolbar]}),e.children]})}},77481(e,n,t){t.d(n,{S:()=>c,X:()=>r});var s=t(96540),i=t(61443),l=t(74848);function r(e){const[n,t]=s.useState([]),r=(0,s.useRef)(-1),[c,a]=(0,s.useState)(-1),[o,d]=(0,s.useState)(-1);(0,s.useEffect)(()=>{e.children?t(Array.isArray(e.children)?e.children:[e.children]):t(e.rows)},[e.rows,e.children]);const _=()=>{r.current=-1,a(-1),d(-1)};return(0,l.jsxs)("table",{children:[(0,l.jsx)("thead",{children:(0,l.jsx)("tr",{children:e.headers?.map((n,t)=>{const s=!!e.filter&&(e.filter.column??0)===t;let r=n;if(s){const t=e.filter,s=t.options.find(e=>e.value===t.value);null!=t.value&&s&&(r=`${n} (${s.label})`)}return(0,l.jsx)("th",{className:s?"table-filter-col":"",children:s?(0,l.jsx)(i.l6,{value:e.filter.value,options:e.filter.options,onChange:e.filter.onChange,bare:!0,trigger_label:r}):n},t)})})}),(0,l.jsx)("tbody",{children:n.map((n,t)=>{const s=!!e.onRowDrag;return(0,l.jsx)("tr",{className:s?(c===t?"row-dragging":"")+(o===t?" row-drop-target":""):"",draggable:s,onContextMenu:()=>{e.handleContextMenu&&e.handleContextMenu(n)},onDragStart:e=>{s&&(r.current=t,a(t),e.dataTransfer.effectAllowed="move")},onDragOver:e=>{!s||r.current<0||(e.preventDefault(),e.dataTransfer.dropEffect="move",d(t))},onDrop:n=>{s&&(n.preventDefault(),(()=>{const n=r.current,t=o;_(),n<0||t<0||n===t||e.onRowDrag?.(n,t)})())},onDragEnd:_,children:n.map((t,s)=>{const i=s===n.length-1?"small":"";return(0,l.jsx)("td",{className:i,style:{width:e.width??"auto"},children:t},s)})},t)})})]})}function c(e){return(0,l.jsx)("div",{style:{display:e.isFlex?"flex":"block"},children:e.columns.map((e,n)=>(0,l.jsx)("div",{children:e},n))})}},36805(e,n,t){t.r(n),t.d(n,{default:()=>B});var s=t(96540),i=t(75725),l=t(22022),r=t(70447),c=t(85997),a=t(77481),o=t(61443),d=t(14284),_=t(53459),x=t(7523),h=t(34843),p=t(82893),u=t(62042),m=(t(23430),t(64694)),j=(t(21499),t(14944)),v=t(92275),f=t(6960),g=t(40505),w=t(4412),y=t(24659),S=t(74848);let C={};function b(){const{t:e,i18n:n}=(0,l.Bd)(),{initUserInfo:t,reloadUserInfo:b}=(0,s.useContext)(x.F),[k,I]=(0,h.fp)(p.AG.user_base_info),[A,P]=(0,s.useState)([]),$=(0,s.useRef)([]),[N,F]=(0,h.fp)(p.AG.prompt_card),K=(0,y.K)(),[B,U]=(0,s.useState)(),[D,E]=(0,s.useState)(void 0),[G,V]=(0,s.useState)(null),[q,M]=(0,s.useState)([]),[X,Z]=(0,s.useState)([]),z=[e("序号"),e("名称"),e("在线状态"),e("时间"),e("备注")],T=[e("序号"),e("服务端口"),e("转发ip"),e("转发端口"),e("开启"),e("备注")],W=[e("序号"),e("服务端口"),e("fwd_nm"),e("转发ip"),e("转发端口"),e("开启"),e("备注")],O=e=>null==e?"":(0,f.s)(e),H=async e=>{const n=await d.s9.post("server_bridge_get_one_fig",{server_client_num_id:e});if(n.code===_.m.Success){const e=n.data;for(const n of e)n.client_name=C?.[n.client_num_id]?.client_name??"";Z(e)}},R=async e=>{const n=void 0===e?G:e,t=await d.s9.get("server_client_get");if(t.code===_.m.Success){const e=t.data,s=[],i=[];C={},$.current=e.map(e=>e.client_num_id);for(const t of e)null!==n&&!!t.status!==n||(D?`${t.index}${t.client_name}${t.note}`.includes(D)&&s.push(t):s.push(t),i.push({label:t.client_name,value:t.client_num_id}),C[t.client_num_id]=t);P(s),M(i)}};(0,s.useEffect)(()=>{j.ws.addMsg(v.HK.tcp_forward_server_load,e=>{R()}),R()},[]);return(0,S.jsxs)(s.Fragment,{children:[(0,S.jsx)(w.aZ,{position:"right",children:B&&(0,S.jsx)("span",{children:`${B.client_name}${B.note?`(${B.note})`:""}`})}),(0,S.jsxs)(i.fI,{children:[(0,S.jsx)(i.VP,{widthPer:50,children:(0,S.jsx)(i.xh,{children:(0,S.jsx)(r.uF,{self_title:(0,S.jsx)("span",{className:" div-row ",children:(0,S.jsx)("h2",{children:e("客户端列表")})}),rightTopCom:(0,S.jsx)(o.Sm,{placeholder:e("过滤"),value:D,handleInputChange:e=>{E(e)},handlerEnter:()=>{R()}}),children:(0,S.jsx)(a.X,{headers:z,filter:{title:e("在线状态"),column:2,value:G,options:[{label:e("全部"),value:null},{label:e("在线"),value:!0},{label:e("离线"),value:!1}],onChange:e=>{V(e),R(e)}},rows:A.map((n,t)=>[(0,S.jsx)("p",{children:t}),(0,S.jsx)(r.xP,{children:n.client_name}),(0,S.jsx)(r.fq,{ok:n.status}),(0,S.jsx)(r.xP,{children:O(n.status?n.online_start_time:n.offline_time)}),(0,S.jsx)(r.xP,{children:n.note}),(0,S.jsxs)("div",{children:[(0,S.jsx)(c.rA,{icon:"edit",title:e("编辑"),onClick:()=>{U({...n}),H(n.client_num_id)}}),(0,S.jsx)(c.rA,{icon:"delete",title:e("删除"),onClick:()=>{F({open:!0,title:"share file",confirm:async()=>{F({open:!1}),await(async n=>{(await d.s9.post("server_client_del",{client_num_id:n})).code===_.m.Success&&((0,u.SK)(e("成功")),R())})(n.client_num_id)},context_div:(0,S.jsx)("div",{className:"card-content",children:e("确定删除这个吗客户端吗?")})})}})]})]),width:"10rem",onRowDrag:(e,n)=>{const t=(0,m.TI)(A,e,n);P(t);const s=A[e],i=A[n];if(!s||!i)return;const l=$.current,r=l.indexOf(s.client_num_id),c=l.indexOf(i.client_num_id);if(r<0||c<0)return;const a=[...l];a.splice(r,1),a.splice(c,0,s.client_num_id),$.current=a,d.s9.post("server_client_sort",{ids:a})}})})})}),(0,S.jsx)(i.VP,{widthPer:50,children:B?(0,S.jsxs)(i.xh,{children:[(0,S.jsxs)(r.Zp,{self_title:(0,S.jsxs)("span",{className:" div-row ",children:[(0,S.jsx)("h2",{children:`服务器 ${e("代理配置")}`})," "]}),rightBottomCom:(0,S.jsx)("div",{children:(0,S.jsx)(c.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await d.s9.post("server_client_save",B)).code===_.m.Success&&(0,u.SK)(e("成功"))}})}),children:[(0,S.jsx)(i.Yh,{left:e("远程地址"),center:B?.client_remote_address??""}),(0,S.jsx)(i.Yh,{left:e(B?.status?"在线时间":"离线时间"),center:O(B?.status?B?.online_start_time:B?.offline_time)}),(0,S.jsx)(o.Sm,{placeholder:"名称",value:B.client_name,handleInputChange:e=>{B.client_name=e,U({...B})}}),(0,S.jsxs)("form",{children:[e("fc_pxy"),":",(0,S.jsx)(a.S,{isFlex:!0,columns:[(0,S.jsx)(o.U6,{value:1,context:e("开启"),selected:B.open_filecat,onchange:()=>{B.open_filecat=!B.open_filecat,U({...B})}}),(0,S.jsx)(o.U6,{value:1,context:e("关闭"),selected:!B.open_filecat,onchange:()=>{B.open_filecat=!B.open_filecat,U({...B})}})]})]}),B.open_filecat&&(0,S.jsxs)(s.Fragment,{children:[(0,S.jsxs)("form",{children:[e("fc_pxyw"),":",(0,S.jsx)(a.S,{isFlex:!0,columns:[(0,S.jsx)(o.U6,{value:1,context:e("开启"),selected:B.filecat_use_local_page,onchange:()=>{B.filecat_use_local_page=!B.filecat_use_local_page,U({...B})}}),(0,S.jsx)(o.U6,{value:1,context:e("关闭"),selected:!B.filecat_use_local_page,onchange:()=>{B.filecat_use_local_page=!B.filecat_use_local_page,U({...B})}})]})]}),(0,S.jsx)(o.Sm,{placeholderOut:e("fc_pxyr"),placeholder:"127.0.0.1:5567",value:B.filecat_proxy_host_port,handleInputChange:e=>{B.filecat_proxy_host_port=e,U({...B})}}),(0,S.jsx)(c.rA,{icon:"content_copy",title:e("fc_pxyc"),onClick:()=>{const e=`${window.location.origin}?tcp_client_num_id=${B.client_num_id}`;(0,g.lW)(e),(0,u.SK)(e)}}),(0,S.jsx)(c.rA,{icon:"open_in_new",title:e("fc_pxyo"),onClick:()=>{const e=`${window.location.origin}?tcp_client_num_id=${B.client_num_id}`;window.open(e,"_blank")}})]}),(0,S.jsx)(o.Sm,{placeholder:"备注",value:B.note,handleInputChange:e=>{B.note=e,U({...B})}}),(0,S.jsx)(c.rA,{icon:"add",onClick:()=>{B.proxy_fig_list.push({open:!1}),U({...B})},title:e("添加")}),e("代理"),(0,S.jsx)(a.X,{headers:T,rows:B.proxy_fig_list.map((n,t)=>[(0,S.jsx)("p",{children:t}),(0,S.jsx)(o.Sm,{value:n.server_port,handleInputChange:e=>{n.server_port=parseInt(e)},no_border:!0}),(0,S.jsx)(o.Sm,{value:n.proxy_host,handleInputChange:e=>{n.proxy_host=e},no_border:!0}),(0,S.jsx)(o.Sm,{value:n.proxy_port,handleInputChange:e=>{n.proxy_port=parseInt(e)},no_border:!0}),(0,S.jsx)(o.l6,{value:!!n.open,onChange:e=>{n.open=e,U({...B})},options:K,no_border:!0}),(0,S.jsx)(o.Sm,{value:n.note,handleInputChange:e=>{n.note=e},no_border:!0}),(0,S.jsx)("div",{children:(0,S.jsx)(c.rA,{icon:"delete",title:e("删除"),onClick:()=>{const e=[];for(let n=0;n<(B.proxy_fig_list.length??0);n++)n!==t&&e.push(B.proxy_fig_list[n]);B.proxy_fig_list=e,U({...B})}})})]),width:"10rem"})]}),(0,S.jsxs)(r.Zp,{self_title:(0,S.jsxs)("span",{className:" div-row ",children:[(0,S.jsx)("h2",{children:`${e("客户端")} ${e("桥接配置")}`}),(0,S.jsx)(c.rA,{title:"info",icon:"info",onClick:()=>{F({open:!0,title:"Info",confirm:async()=>{F({open:!1})},context_div:(0,S.jsx)("div",{className:"card-content",children:e("在客户端设置一个端口,访问这个端口把流量转发到另一个客户端所在网络环境内的第一个地址")})})}})]}),children:[(0,S.jsx)(c.rA,{icon:"add",onClick:()=>{X.push({open:!1,server_client_num_id:B.client_num_id}),Z([...X])},title:e("添加")}),e("代理"),(0,S.jsx)(a.X,{headers:W,rows:X.map((n,t)=>[(0,S.jsx)("p",{children:t}),(0,S.jsx)(o.Sm,{value:n.server_port,handleInputChange:e=>{n.server_port=parseInt(e)},no_border:!0}),(0,S.jsx)(o.Sm,{value:n.client_name,options:q,handleInputChange:e=>{const t=(e=>q.find(n=>String(n.value)===String(e)))(e);n.client_num_id=parseInt(String(t.value)),n.client_name=t.label,Z([...X])},no_border:!0}),(0,S.jsx)(o.Sm,{value:n.client_proxy_host,handleInputChange:e=>{n.client_proxy_host=e},no_border:!0}),(0,S.jsx)(o.Sm,{value:n.client_proxy_port,handleInputChange:e=>{n.client_proxy_port=parseInt(e)},no_border:!0}),(0,S.jsx)(o.l6,{value:!!n.open,onChange:e=>{n.open=e,Z([...X])},options:K,no_border:!0}),(0,S.jsx)(o.Sm,{value:n.note,handleInputChange:e=>{n.note=e},no_border:!0}),(0,S.jsxs)("div",{children:[(0,S.jsx)(c.rA,{icon:"delete",title:e("删除"),onClick:async()=>{if(null==n.id){const e=[];for(let n=0;n<(X.length??0);n++)n!==t&&e.push(X[n]);Z([...e])}else await(async(n,t)=>{(await d.s9.post("server_bridge_del_fig",{id:n})).code===_.m.Success&&((0,u.SK)(e("成功")),H(t))})(n.id,n.server_client_num_id)}}),null==n.id?(0,S.jsx)(c.rA,{icon:"add",title:e("添加"),onClick:async()=>{await(async n=>{if(null==n.client_num_id)return void(0,u.zN)(e("未选择转发送 client"));(await d.s9.post("server_bridge_add_fig",n)).code===_.m.Success&&((0,u.SK)(e("成功")),H(n.server_client_num_id))})(n)}}):(0,S.jsx)(c.rA,{icon:"save",title:e("保存"),onClick:async()=>{await(async n=>{if(null==n.client_num_id)return void(0,u.zN)(e("未选择转发送 client"));(await d.s9.post("server_bridge_edit_fig",n)).code===_.m.Success&&((0,u.SK)(e("成功")),H(n.server_client_num_id))})(n)}})]})]),width:"10rem"})]})]}):(0,S.jsx)(i.xh,{})})]})]})}var k=t(18840),I=t(7463);function A(e){const{t:n}=(0,l.Bd)(),[t,x]=(0,s.useState)([]),[h,p]=(0,s.useState)([]),[m,f]=(0,s.useState)([]),[g,w]=(0,s.useState)([]),C=[n("序号"),n("服务端口"),n("转发客户端名称")],b=[n("序号"),n("原客户端"),n("目标客户端"),n("待同步文件数量")],A=[n("序号"),n("port"),n("host"),n("名称"),n("key"),n("在线"),n("开启"),n("备注")],P=(0,y.K)(),$=async()=>{const e=await d.s9.get("client_get");if(e.code===_.m.Success){const n=e.data;x(n.list)}const n=await d.s9.get("client_bridge_get_all_fig");n.code===_.m.Success&&f(n.data);const t=await d.s9.get("client_sync_task_get");t.code===_.m.Success&&w(t.data)};(0,s.useEffect)(()=>($(),j.ws.sendData(v.HK.tcp_proxy_client_status,{}).then(()=>{const e=(0,I.s)(()=>$(),500);j.ws.addMsg(v.HK.tcp_proxy_client_status,e)}),()=>{j.ws.removeMsg(v.HK.tcp_proxy_client_status)}),[]);const N=async e=>{const t=new k.gE;t.index=e.index,t.key=e.key,t.serverIp=e.serverIp,t.serverPort=e.serverPort,t.open=e.open,t.client_name=e.client_name,t.client_num_id=e.client_num_id;(await d.s9.post("client_save",t)).code===_.m.Success?(0,u.SK)(n("保存成功")):(0,u.zN)(n("网络错误"))};return(0,S.jsxs)("div",{children:[(0,S.jsxs)(i.fI,{children:[(0,S.jsx)(i.VP,{widthPer:33,maxWidth:"30rem",children:(0,S.jsxs)(r.Zp,{title:"",rightBottomCom:(0,S.jsx)(c.C3,{text:n("保存"),clickFun:()=>{t[0].index=0,N(t[0])}}),rightTopCom:(0,S.jsxs)("div",{children:[n("连接状态"),(0,S.jsx)(r.fq,{ok:!!t[0]?.status})]}),children:[(0,S.jsx)(o.Sm,{placeholder:`${n("服务器")} ip`,value:t[0]?.serverIp,handleInputChange:e=>{t[0].serverIp=e}}),(0,S.jsx)(o.Sm,{type:"number",placeholder:`${n("服务器")} port`,value:t[0]?.serverPort,handleInputChange:e=>{const n=parseInt(e);!isNaN(n)&&n>=0&&n<=65535&&(t[0].serverPort=n)}}),(0,S.jsx)(o.Sm,{placeholder:n("名称"),value:t[0]?.client_name,handleInputChange:e=>{t[0].client_name=e}}),(0,S.jsx)(o.Sm,{type:"password",placeholder:"key ",value:t[0]?.key,handleInputChange:e=>{t[0].key=e}}),(0,S.jsxs)("form",{children:[n("状态"),(0,S.jsx)(a.S,{isFlex:!0,columns:[(0,S.jsx)(o.U6,{value:1,context:n("开启"),selected:t[0]?.open,onchange:()=>{t[0].open=!t[0].open,x([...t])}}),(0,S.jsx)(o.U6,{value:1,context:n("关闭"),selected:!t[0]?.open,onchange:()=>{t[0].open=!t[0].open,x([...t])}})]})]})]})}),(0,S.jsx)(i.VP,{widthPer:60,maxWidth:"90rem",children:(0,S.jsxs)(r.Zp,{self_title:(0,S.jsxs)("span",{className:" div-row ",children:[(0,S.jsx)("h2",{children:n("更多服务器")})," "]}),children:[(0,S.jsx)(c.rA,{icon:"add",onClick:()=>{t.push({open:!1,is_new:!0}),x([...t])},title:n("添加")}),n("代理"),(0,S.jsx)(a.X,{headers:A,rows:t.slice(1).map((e,s)=>[(0,S.jsx)("p",{children:s}),(0,S.jsx)(o.Sm,{type:"number",value:e.serverPort,handleInputChange:n=>{const t=parseInt(n);!isNaN(t)&&t>=0&&t<=65535&&(e.serverPort=t)},no_border:!0}),(0,S.jsx)(o.Sm,{value:e.serverIp,handleInputChange:n=>{e.serverIp=n},no_border:!0}),(0,S.jsx)(o.Sm,{value:e.client_name,handleInputChange:n=>{e.client_name=n},no_border:!0}),(0,S.jsx)(o.Sm,{type:"password",value:e.key,handleInputChange:n=>{e.key=n},no_border:!0}),(0,S.jsx)(r.fq,{ok:!!e.status}),(0,S.jsx)(o.l6,{value:!!e.open,onChange:n=>{e.open=n,x([...t])},options:P,no_border:!0}),(0,S.jsx)(o.Sm,{value:e.note,handleInputChange:n=>{e.note=n},no_border:!0}),(0,S.jsxs)("div",{children:[(0,S.jsx)(c.rA,{icon:"delete",title:n("删除"),onClick:async()=>{if(e.is_new){const e=[];for(let n=0;n<(t.length??0);n++)n!==s&&e.push(t[n]);x([...e])}else await(async e=>{(await d.s9.post("client_del",{index:e})).code===_.m.Success?((0,u.SK)(n("保存成功")),$()):(0,u.zN)(n("网络错误"))})(s+1)}}),e.is_new?(0,S.jsx)(c.rA,{icon:"add",title:n("添加"),onClick:async()=>{e.index=s+1,await N(e)}}):(0,S.jsx)(c.rA,{icon:"save",title:n("保存"),onClick:async()=>{e.index=s+1,await N(e)}})]})]),width:"10rem"})]})})]}),(0,S.jsxs)(i.fI,{children:[!!m?.length&&(0,S.jsx)(i.VP,{widthPer:40,maxWidth:"40rem",children:(0,S.jsx)(r.Zp,{title:n("br_port"),children:(0,S.jsx)(a.X,{headers:C,rows:m.map((e,n)=>[(0,S.jsx)("p",{children:n}),(0,S.jsx)(r.xP,{children:e.server_port}),(0,S.jsx)(r.xP,{children:e.client_name})]),width:"10rem"})})}),!!g?.length&&(0,S.jsx)(i.VP,{widthPer:40,maxWidth:"40rem",children:(0,S.jsx)(r.Zp,{title:n("文件同步列表"),children:(0,S.jsx)(a.X,{headers:b,rows:g.map((e,n)=>[(0,S.jsx)("p",{children:n}),(0,S.jsx)(r.xP,{children:e.source_client_name}),(0,S.jsx)(r.xP,{children:e.target_client_name}),(0,S.jsx)(r.xP,{children:e.running_num})]),width:"10rem"})})})]})]})}function P(){const{t:e,i18n:n}=(0,l.Bd)(),{initUserInfo:t,reloadUserInfo:m}=(0,s.useContext)(x.F),[f,g]=(0,h.fp)(p.AG.user_base_info),[w,y]=(0,h.fp)(p.AG.prompt_card),[C,b]=(0,s.useState)(!1),[I,A]=(0,s.useState)([]),[P,$]=(0,s.useState)(null),[N,F]=(0,s.useState)([]),[K,B]=(0,s.useState)(void 0),[U,D]=(0,s.useState)(void 0),E=(0,s.useMemo)(()=>{const e=[...I];return null!=P?(e.sort((e,n)=>P?e.server_port-n.server_port:n.server_port-e.server_port),e):e},[I,P]),G=async()=>{const e=await d.s9.get("get_all_open_server_client_proxy_fig");if(e.code===_.m.Success){const n=[];for(const t of e.data)U?`${t.server_port}${t.client_name}${t.proxy_host}${t.server_port}${t.server_port_note}`.includes(U)&&n.push(t):n.push(t);A(n)}},V=async()=>{const e=await d.s9.get("server_get");e.code===_.m.Success&&(B(e.data.port),b(!!e.data.open),F(e.data.option_keys??[])),G()};(0,s.useEffect)(()=>{j.ws.addMsg(v.HK.tcp_forward_server_load,e=>{V()}),V()},[]);const q=async n=>{const t=new k.I;t.port=K,t.open=C,t.option_keys=N;(await d.s9.post("server_save",{fig:t,notice_client:n})).code===_.m.Success&&(0,u.SK)(e("成功"))};return(0,S.jsxs)(i.fI,{children:[(0,S.jsx)(i.VP,{widthPer:33,children:(0,S.jsx)(i.xh,{children:(0,S.jsxs)(r.Zp,{title:e("服务器配置"),rightBottomCom:(0,S.jsxs)("div",{children:[(0,S.jsx)(c.C3,{text:e("sv_ntf"),clickFun:()=>{q(!0)}}),(0,S.jsx)(c.C3,{text:e("保存"),clickFun:()=>{q(!1)}})]}),children:[(0,S.jsx)(o.Sm,{placeholder:"port",value:K,handleInputChange:e=>{B(e)}}),(0,S.jsxs)("label",{children:[(0,S.jsx)(c.rA,{icon:"add",onClick:()=>{F([...N,""])},title:e("添加")}),e("key")]}),(N??[]).map((n,t)=>(0,S.jsxs)("div",{style:{display:"flex"},children:[(0,S.jsx)("div",{style:{width:"90%"},children:(0,S.jsx)(o.Sm,{type:"password",value:n,handleInputChange:e=>{N[t]=e,F([...N])}})}),(0,S.jsx)(c.rA,{icon:"delete",onClick:()=>{N.splice(t,1),F([...N])},title:e("删除")})]},t)),(0,S.jsxs)("form",{children:[e("状态"),":",(0,S.jsx)(a.S,{isFlex:!0,columns:[(0,S.jsx)(o.U6,{value:1,context:e("开启"),selected:C,onchange:()=>{b(!C)}}),(0,S.jsx)(o.U6,{value:1,context:e("关闭"),selected:!C,onchange:()=>{b(!C)}})]})]})]})})}),(0,S.jsx)(i.VP,{widthPer:50,children:(0,S.jsx)(i.xh,{children:(0,S.jsx)(r.uF,{self_title:(0,S.jsx)("span",{className:" div-row ",children:(0,S.jsx)("h2",{children:e("服务器")+e("端口映射")})}),rightTopCom:(0,S.jsx)(o.Sm,{placeholder:e("过滤"),value:U,handleInputChange:e=>{D(e)},handlerEnter:()=>{G()}}),children:(0,S.jsx)(a.X,{headers:[e("序号"),(0,S.jsx)(c.rA,{title:e("服务端口"),onClick:()=>{$(e=>!e)}}),e("转发ip"),e("转发端口"),"client "+e("名称"),e("开启"),e("备注")],rows:E.map((e,n)=>[(0,S.jsx)("p",{children:n}),(0,S.jsx)(r.xP,{children:e.server_port}),(0,S.jsx)(r.xP,{children:e.proxy_host}),(0,S.jsx)(r.xP,{children:e.proxy_port}),(0,S.jsx)(r.xP,{children:e.client_name}),(0,S.jsx)(r.fq,{ok:!!e.open_success}),(0,S.jsx)(r.xP,{children:e.server_port_note})]),width:"10rem"})})})})]})}var $=t(47996),N=t(78247);function F(){const{t:e,i18n:n}=(0,l.Bd)(),{initUserInfo:t,reloadUserInfo:m}=(0,s.useContext)(x.F),[j,v]=(0,h.fp)(p.AG.user_base_info),[f,g]=(0,h.fp)(p.AG.prompt_card),[,w]=(0,h.fp)(p.AG.confirm),[y,C]=(0,h.fp)(p.AG.editorSetting),[b,I]=(0,s.useState)([]),[A,P]=(0,s.useState)([]),F=[e("编号"),e("原客户端"),e("开启"),e("备注"),e("操作")],[K,B]=(0,s.useState)(null);(0,s.useEffect)(()=>{(async()=>{const e=await d.s9.get("server_client_get");if(e.code===_.m.Success){const n=e.data,t=[];for(const e of n)t.push({label:e.client_name,value:e.client_num_id});P(t),await U()}})()},[]);const U=async()=>{const e=await d.s9.get("sync_task_get");e.code===_.m.Success&&I(e.data)},D=e=>A.find(n=>String(n.value)===String(e))?.label??"",E=e=>A.find(n=>String(n.value)===String(e)),G=(e,n,t)=>{K?.targets&&(K.targets[e]={...K.targets[e],[n]:t},B({...K,targets:[...K.targets]}))},V=async e=>{(await d.s9.post("sync_task_save",e)).code===_.m.Success&&await U()};return(0,S.jsxs)(i.fI,{children:[(0,S.jsx)(i.VP,{widthPer:50,maxWidth:"40rem",children:(0,S.jsx)(i.xh,{children:(0,S.jsx)(r.uF,{self_title:(0,S.jsxs)("span",{className:" div-row ",children:[(0,S.jsx)("h2",{children:e("客户端文件同步")}),(0,S.jsx)(c.rA,{icon:"info",onClick:()=>{g({open:!0,title:"信息",context_div:(0,S.jsx)("div",{children:(0,S.jsxs)("ul",{children:[(0,S.jsx)("li",{children:e("sy_tp1")}),(0,S.jsx)("li",{children:e("sy_tp2")}),(0,S.jsx)("li",{children:e("sy_tp3")})]})})})},title:e("信息")})]}),rightTopCom:(0,S.jsx)("div",{children:(0,S.jsx)(c.rA,{icon:"add",title:e("添加"),onClick:()=>{B({open:!1,source_client_num_id:void 0,source_dir:"",targets:[],delete_missing:!0,is_new:!0})}})}),children:(0,S.jsx)(a.X,{headers:F,rows:b.map((n,t)=>[(0,S.jsx)("p",{children:t}),(0,S.jsx)(r.xP,{children:n.source_client_name}),(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(r.fq,{ok:!!n.open}),n.open?e("开启"):e("关闭")]}),(0,S.jsx)(r.xP,{children:n.note}),(0,S.jsxs)("div",{children:[(0,S.jsx)(c.rA,{icon:"edit",title:e("编辑"),onClick:()=>(e=>{B(JSON.parse(JSON.stringify(e)))})(n)}),(0,S.jsx)(c.rA,{icon:"sync",title:e("立即同步"),onClick:()=>(async n=>{if(!n.id||!n.open)return void(0,u.zN)(e("tsk_off"));const t=await d.s9.post("sync_task_rescan",{id:n.id});t.code===_.m.Success?(0,u.SK)(e("已触发同步")):(0,u.zN)(t.message??e("操作失败"))})(n)}),(0,S.jsx)(c.rA,{icon:"delete",title:e("删除"),onClick:()=>{w({open:!0,title:e("确定删除吗"),handle:async()=>{await(async n=>{(await d.s9.post("sync_task_del",{id:n})).code===_.m.Success&&((0,u.SK)(e("成功")),K?.id===n&&B(null),await U())})(n.id),w({open:!1,handle:null})}})}})]})]),width:"10rem"})})})}),(0,S.jsx)(i.VP,{widthPer:50,children:K&&(0,S.jsx)(i.xh,{children:(0,S.jsxs)(r.Zp,{self_title:(0,S.jsx)("span",{className:" div-row ",children:(0,S.jsx)("h2",{children:e(""+(K.is_new?"添加":"编辑"))})}),rightBottomCom:(0,S.jsxs)("div",{children:[(0,S.jsx)(c.rA,{icon:"cancel",title:e("取消"),onClick:()=>B(null)}),(0,S.jsx)(c.rA,{icon:"save",title:e("保存"),onClick:async()=>{if(!K)return;const n=K,t=await d.s9.post("sync_task_save",n);t.code===_.m.Success?((0,u.SK)(e("成功")),B(null),await U()):(0,u.zN)(t.message??e("操作失败"))}})]}),children:[(0,S.jsx)(o.BC,{label:e("开启"),label_width:"6rem",children:(0,S.jsx)(o.GL,{selected:!!K.open,onchange:()=>{B({...K,open:!K.open})}})}),(0,S.jsx)(o.BC,{label:e("备注"),label_width:"6rem",children:(0,S.jsx)(o.Sm,{value:K.note,handleInputChange:e=>{B({...K,note:e})}})}),(0,S.jsx)(o.BC,{label:e("原客户端"),label_width:"6rem",required:!0,children:(0,S.jsx)(o.Sm,{value:D(K.source_client_num_id),options:A,handleInputChange:e=>{const n=E(e);n&&B({...K,source_client_num_id:parseInt(String(n.value))})}})}),(0,S.jsx)(o.BC,{label:e("原目录"),label_width:"6rem",required:!0,children:(0,S.jsx)(o.Sm,{value:K.source_dir,placeholder:e("被同步的源目录"),handleInputChange:e=>{B({...K,source_dir:e})}})}),(0,S.jsx)("label",{children:e("目标列表")}),(K.targets??[]).map((n,t)=>(0,S.jsxs)($.d,{title:`${e("目标")}${t+1}`,toolbar:(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(o.BC,{label:e("全量同步"),label_width:"6rem",children:(0,S.jsx)(o.GL,{selected:!!n.full_sync,onchange:()=>G(t,"full_sync",!n.full_sync)})}),(0,S.jsx)(c.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{if(!K?.targets)return;const n=[...K.targets];n.splice(e,1),B({...K,targets:n})})(t)})]}),children:[(0,S.jsx)(o.BC,{label:e("客户端"),label_width:"6rem",required:!0,children:(0,S.jsx)(o.Sm,{value:D(n.client_num_id),options:A,handleInputChange:e=>{const n=E(e);n&&G(t,"client_num_id",parseInt(String(n.value)))}})}),(0,S.jsx)(o.BC,{label:e("目标目录"),label_width:"6rem",required:!0,children:(0,S.jsx)(o.Sm,{value:n.dir,handleInputChange:e=>G(t,"dir",e)})})]},t)),(0,S.jsxs)("div",{className:"div-row",children:[(0,S.jsx)(c.rA,{icon:"add",title:e("添加"),onClick:()=>{if(!K)return;const e=[...K.targets??[],{client_num_id:void 0,dir:"",full_sync:!1}];B({...K,targets:e})}}),(0,S.jsx)(c.rA,{icon:"edit",title:e("忽略目录"),onClick:()=>{var e;e=K,N.xK.set_value_temp(e.ignore_text??k.mo),C({model:"ace/mode/gitignore",open:!0,fileName:"",save:async n=>{e.ignore_text=n,B({...e}),N.xK.set_value_temp(""),await V(e)}})}})]})]})})})]})}var K=t(87361);function B(){const{t:e}=(0,l.Bd)(),n=[{index:1,name:e("客户端"),rto:"tcp_proxy_client/",component:(0,S.jsx)(A,{})},{index:2,name:e("服务端"),rto:"tcp_proxy_server_info/",component:(0,S.jsx)(P,{})},{index:3,name:`${e("客户端列表")}(${e("服务端")})`,rto:"tcp_proxy_server_client/",component:(0,S.jsx)(b,{})},{index:4,name:`${e("客户端功能")}(${e("服务端")})`,rto:"tcp_proxy_server_client_setting/",component:(0,S.jsx)(F,{})}];return(0,S.jsx)(i.W1,{optionList:n,father_route:K.o.net_proxy})}},6960(e,n,t){t.d(n,{s:()=>r});var s=t(72635);const i=1440,l=525600;function r(e){e=e>1e12?e:1e3*e;const n=Date.now(),t=Math.abs(n-e)/6e4;return t<1?s.Ay.t("小于一分钟"):t<60?`${t.toFixed(0)} ${s.Ay.t("分钟前")}`:t<i?`${(t/60).toFixed(0)} ${s.Ay.t("小时前")}`:t<43200?`${(t/i).toFixed(0)} ${s.Ay.t("天前")}`:t<l?`${(t/43200).toFixed(0)} ${s.Ay.t("月前")}`:`${(t/l).toFixed(0)} ${s.Ay.t("年前")}`}},24659(e,n,t){t.d(n,{K:()=>i});var s=t(22022);const i=()=>{const{t:e}=(0,s.Bd)();return[{title:e("是"),value:!0,color:"#28a745"},{title:e("否"),value:!1,color:"#666666"}]}}}]);
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[8765],{60096(e,i,t){t.d(i,{QW:()=>z,Ic:()=>b,t$:()=>F,$J:()=>$});var n=t(96540),l=t(47022),s=t(34843),o=t(82893),a=t(52671),r=t(64694),d=t(14284),c=t(34289),m=t(23430),f=t(62042),h=t(99214),p=t(85997),u=t(22022),_=t(74848);function x(e){const[i,t]=(0,s.fp)(o.AG.selectedFileList),[n,a]=(0,s.fp)(o.AG.nowFileList),[c,x]=(0,s.fp)(o.AG.confirm),[g,y]=(0,s.fp)(o.AG.user_base_info),{t:w}=(0,u.Bd)();return(0,_.jsxs)("div",{...e.extraAttr,onClick:()=>{!async function(i){e.click&&e.click(i,e.name)}(e.index)},className:e.mount?"item mount-item":"item",role:"button","data-type":e.isLink?"invalid_link":e.type,"data-dir":!e.type||e.type===l.Iw.folder,"data-mount":e.mount?"true":void 0,"aria-selected":null!==(0,r.kW)(i,e.index),"aria-label":e.name,style:{"--filewidth":e.itemWidth??"33%"},onDragStart:n=>{return l=e.index,void(i.find(e=>e===l)||t([...i,l]));var l},onDrop:t=>((t,s)=>{const o=t.dataTransfer;let a,r=!1;for(let e=0;e<o.items.length;e++)if("file"===o.items[e].kind){r=!0;break}if(r)return;if(g?.user_data?.file_list_pagination_mode===m.yM.pagination){if(a=n.files[s],n.files[s]?.type!==l.Iw.folder)return}else if(a=n.folders[s],n.folders.length<=s)return;(0,h.ib)(n,i).some(e=>e?.name===a?.name)?(0,f.zN)(w("mv_self")):x({open:!0,title:`确定将文件移动并覆盖到${a?.name}吗?`,handle:async()=>{await e.draggable_handle(a?.name)}})})(t,e.index),draggable:void 0!==e.draggable_handle,children:[void 0===e.icon&&(0,_.jsx)("div",{children:e.type!==l.Iw.image||null==e.path||g?.user_data?.not_pre_show_image?(0,_.jsx)(p.In,{icon:""}):(0,_.jsx)("img",{loading:"lazy",src:d.$M.getDownloadUrl(e.path,{mtime:e.mtime,cache:1}),alt:e.name})}),void 0!==e.icon&&(0,_.jsx)("div",{className:"rotating-div",children:(0,_.jsx)("span",{className:"material-icons",children:e.icon})}),(0,_.jsxs)("div",{children:[(0,_.jsxs)("p",{className:"name",children:[(0,_.jsx)("span",{children:e.name}),e.mount_readonly&&(0,_.jsx)("span",{className:"mount-readonly-tag",children:w("只读")})]}),e.size?(0,_.jsx)("p",{children:e.size}):(0,_.jsx)("p",{children:"—"}),(0,_.jsx)("p",{children:e.show_mtime})]}),e.children]})}var g=t(89824),y=t(34251);function w(e){const[i,t]=(0,s.fp)(o.AG.selectedFileList),[n,m]=(0,s.fp)(o.AG.nowFileList),[f,p]=(0,s.fp)(o.AG.confirm),[w,k]=(0,s.fp)(o.AG.file_page),[v,j]=(0,s.fp)(o.AG.enterKey),{click_file:A}=(0,h.kZ)(),G=(0,h._A)(),{t:z}=(0,u.Bd)(),b=(0,a.Zp)();(0,a.zy)();const F=(0,h.A9)(),{clickDouble:$}=(0,h.xI)(),[C,I]=(0,s.fp)(o.AG.showPrompt);return(0,_.jsx)(x,{extraAttr:{onContextMenu:t=>{((t,n,s,o)=>{t.preventDefault(),t.stopPropagation();const a=new y.ik;a.path=(0,r.IO)((0,c.vX)(),n),a.filename=n,a.x=t.clientX,a.y=t.clientY,a.type=s?l.Iw.folder:(0,y.uL)(n),a.size=o,a.useSelectedList=i.includes(e.index),I({show:!0,type:g.PromptEnum.FileMenu,overlay:!1,data:a})})(t,e.name,e.type===l.Iw.folder,e.origin_size)}},draggable_handle:async e=>{const l=(0,h.ib)(n,i).map(e=>(0,h.Ok)(e.name));await d.$M.post("cut",{files:l,to:`${(0,c.GG)("file",(0,c.vX)())}/${e}`});t([]),p({open:!1,handle:null}),b((0,c.vX)())},name:e.name,index:e.index,mtime:e.mtime,size:e.size,type:e.type,isLink:e.isLink,path:e.path,icon:e.icon,show_mtime:e.show_mtime,mount:e.mount,mount_driver:e.mount_driver,mount_color:e.mount_color,mount_readonly:e.mount_readonly,click:(n,s)=>{if($(n,async()=>{if(e.type===l.Iw.folder)F(s);else{await A({name:s,size:e.origin_size,opt_shell:!0,mtime:e.mtime,close:()=>G(null)})&&G({name:s,mode:(0,h.Pc)(e.type)})}}))return;if(null!==(0,r.kW)(i,n))t((0,r.P1)(i,n));else if("ctrl"===v)t([...i,n]);else if("shift"===v){const{max:e,min:l}=(0,r.a7)(i),s=[];if(n>=e)for(let i=e;i<=n;i++)s.push(i);else for(let e=l;e>=n;e--)s.push(e);t(s)}else t([n])},itemWidth:e.itemWidth})}var k=t(78247),v=(t(38240),t(64405)),j=t(88815);function A(e){const[i,t]=(0,s.fp)(o.AG.selectedFileList),[n,m]=(0,s.fp)(o.AG.editorSetting),[f,p]=(0,s.fp)(o.AG.shellNowDir),[g,y]=(0,s.fp)(o.AG.sshInfo),[w,A]=(0,s.fp)(o.AG.nowFileList),[G,z]=(0,s.fp)(o.AG.enterKey),[b,F]=(0,s.fp)(o.AG.confirm),$=(0,a.Zp)(),{t:C}=(0,u.Bd)(),{clickDouble:I}=(0,h.xI)();return(0,_.jsx)(x,{draggable_handle:async n=>{const l=new v.x;Object.assign(l,g),l.target=(0,r.HS)(...f,n);const s=(0,h.ib)(w,i).map(e=>(0,r.HS)(...f,e.name));for(const e of s)if(l.source=e,!await d.Fg.post("move",l))return!1;t([]),F({open:!1,handle:null}),await e.fileHandler()},name:e.name,index:e.index,mtime:e.mtime,size:e.size,type:e.type,itemWidth:e.itemWidth,show_mtime:e.show_mtime,click:(n,s)=>{if(I(n,()=>{if(e.type===l.Iw.folder){const e=new v.x;return e.key=g.key,e.dir=`/${(0,c.GG)("remoteShell",(0,c.vX)())}${s}`,$((0,r.IO)((0,c.vX)(),s)),t([]),void A({files:[],folders:[]})}const i=async()=>{const i=new v.x;i.key=g.key,i.file=`/${(0,c.GG)("remoteShell",(0,c.vX)())}${s}`;const t=await d.Fg.post("get/file/text",i);let n;s.endsWith(l.Iw.workflow_act)?n="ace/mode/yaml":(s.endsWith(l.Iw.draw)||s.endsWith(l.Iw.excalidraw))&&(n="ace/mode/json"),m({model:n,open:!0,fileName:e.name,save:async e=>{i.context=e;0===(await d.Fg.post("update/file/text",i)).code&&k.xK.set_value_temp("")}}),k.xK.set_value_temp(t.data)};"number"==typeof e.origin_size&&e.origin_size>j.o5?F({open:!0,title:C("提示"),sub_title:"文件超过20MB了确定要打开吗?",handle:async()=>{F({open:!1,handle:null}),await i()}}):i()}))return;if(null!==(0,r.kW)(i,n))t((0,r.P1)(i,n));else if("ctrl"===G)t([...i,n]);else if("shift"===G){const{max:e,min:l}=(0,r.a7)(i),s=[];if(n>=e)for(let i=e;i<=n;i++)s.push(i);else for(let e=l;e>=n;e--)s.push(e);t(s)}else t([n])}})}function G(e){const[i,t]=(0,s.fp)(o.AG.selectedFileList),[n,a]=(0,s.fp)(o.AG.enterKey),{click_file:c}=(0,h.kZ)(),[m,f]=(0,s.fp)(o.AG.nowFileList),{t:p}=(0,u.Bd)(),[w,k]=(0,s.fp)(o.AG.showPrompt),v=((0,h.oT)(),(0,h.xp)()),{clickDouble:j}=(0,h.xI)();return(0,_.jsx)(x,{extraAttr:{onContextMenu:i=>{((i,t,n,s)=>{i.preventDefault(),i.stopPropagation();const o=new y.ik,a=e.item_list;for(const e of a)if(e.name===t){o.path=e.path;break}o.is_share=!0,o.filename=t,o.x=i.clientX,o.y=i.clientY,o.type=n?l.Iw.folder:(0,y.uL)(t),o.size=s,o.share_token=e.share.share_token,o.share_id=e.share.share_id,k({show:!0,type:g.PromptEnum.FileMenu,overlay:!1,data:o})})(i,e.name,e.type===l.Iw.folder,e.origin_size)}},name:e.name,index:e.index,mtime:e.mtime,size:e.size,type:e.type,itemWidth:e.itemWidth,show_mtime:e.show_mtime,click:(s,o)=>{if(j(s,()=>{e.type!==l.Iw.folder&&(v(o)||c({file_path:e.item_list[s].path,file_url:d.$M.getDownloadUrlV2(e.item_list[s].path,"share_download",{share_id:e.share.share_id,share_token:e.share.share_token}),name:o,size:e.origin_size,opt_shell:!0,mtime:e.mtime,not_type_tip:p("未知类型,请下载查看")}))}))return;if(null!==(0,r.kW)(i,s))t((0,r.P1)(i,s));else if("ctrl"===n)t([...i,s]);else if("shift"===n){const{max:e,min:n}=(0,r.a7)(i),l=[];if(s>=e)for(let i=e;i<=s;i++)l.push(i);else for(let e=n;e>=s;e--)l.push(e);t(l)}else t([s])}})}function z({handleContextMenu:e,file_list:i,clickBlank:t,share:l}){const[a,r]=(0,s.fp)(o.AG.user_base_info),d=(0,n.useRef)(null),{t:c}=(0,u.Bd)(),m=(0,h.OJ)(),{file_is_running:f}=(0,k.hg)();return(0,h.UK)(i,[],d),(0,_.jsx)("div",{onContextMenu:e,id:"listing",style:{paddingBottom:"10rem"},className:`mosaic file-icons ${a?.user_data?.file_list_show_type??""}`,ref:d,children:(0,_.jsx)("div",{onClick:t,children:i.map((e,t)=>(0,_.jsx)(n.Fragment,{children:(0,_.jsx)(G,{share:l,item_list:i,icon:f(e.name)?"refresh":void 0,itemWidth:m,index:t+0,...e})},t+0))})})}function b({handleContextMenu:e,file_list:i,folder_list:t,clickBlank:l,fileHandler:a}){const[r,d]=(0,s.fp)(o.AG.user_base_info),c=(0,n.useRef)(null),{t:m}=(0,u.Bd)(),f=(0,h.OJ)(),{file_is_running:p}=(0,k.hg)(),[x,y]=(0,s.fp)(o.AG.fileShellShow),w=(0,n.useMemo)(()=>t?.length??0,[t]);return(0,h.ei)(c,g.PromptEnum.SshUpload),(0,h.UK)(i,t,c),(0,n.useEffect)(()=>()=>{x.show&&y({show:!1,path:""})},[]),(0,_.jsxs)("div",{onContextMenu:e,id:"listing",style:{paddingBottom:"10rem"},className:`mosaic file-icons ${r?.user_data?.file_list_show_type??""}`,ref:c,children:[t&&t.length>0&&(0,_.jsx)("h2",{children:m("文件夹")}),t&&(0,_.jsx)("div",{onClick:l,children:t.map((e,i)=>(0,_.jsx)(n.Fragment,{children:(0,_.jsx)(A,{fileHandler:a,itemWidth:f,index:i,...e})},i))}),i&&i.length>0&&(0,_.jsx)("h2",{onClick:l,children:m("文件")}),i&&(0,_.jsx)("div",{onClick:l,children:i.map((e,i)=>(0,_.jsx)(n.Fragment,{children:(0,_.jsx)(A,{fileHandler:a,icon:p(e.name)?"refresh":void 0,itemWidth:f,index:i+w,...e})},i+w))})]})}function F({handleContextMenu:e,file_list:i,folder_list:t,clickBlank:l}){const[a,r]=(0,s.fp)(o.AG.user_base_info),d=(0,n.useRef)(null),{t:c}=(0,u.Bd)(),[m]=(0,s.fp)(o.AG.zoom_style_by_percent),f=(0,h.OJ)(),{file_is_running:p}=(0,k.hg)(),[x,y]=(0,s.fp)(o.AG.fileShellShow),v=(0,n.useMemo)(()=>t?.length??0,[t]),j=(0,h.pi)(m);return(0,h.ei)(d,g.PromptEnum.FilesUpload),(0,h.UK)(i,t,d),(0,n.useEffect)(()=>()=>{x.show&&y({show:!1,path:""})},[]),(0,_.jsxs)("div",{onContextMenu:e,id:"listing",style:{paddingBottom:"10rem",fontSize:j.fontSize},className:`mosaic file-icons ${a?.user_data?.file_list_show_type??""}`,ref:d,children:[t&&t.length>0&&(0,_.jsx)("h2",{children:c("文件夹")}),t&&(0,_.jsx)("div",{onClick:l,children:t.map((e,i)=>(0,_.jsx)(n.Fragment,{children:(0,_.jsx)(w,{itemWidth:f,index:i,...e})},i))}),i&&i.length>0&&(0,_.jsx)("h2",{onClick:l,children:c("文件")}),i&&(0,_.jsx)("div",{onClick:l,children:i.map((e,i)=>(0,_.jsx)(n.Fragment,{children:(0,_.jsx)(w,{icon:p(e.name)?"refresh":void 0,itemWidth:f,index:i+v,...e})},i+v))})]})}function $({handleContextMenu:e,list:i,clickBlank:t}){const[l,a]=(0,s.fp)(o.AG.user_base_info),r=(0,n.useRef)(null),{t:d}=(0,u.Bd)(),[c]=(0,s.fp)(o.AG.zoom_style_by_percent),m=(0,h.OJ)(),{file_is_running:f}=(0,k.hg)(),[p,x]=(0,s.fp)(o.AG.fileShellShow),[y,v]=(0,s.fp)(o.AG.enterKey),[j,A]=(0,s.fp)(o.AG.selectedFileList),[G,z]=(0,s.fp)(o.AG.file_page),b=(0,h.pi)(c);return(0,h.UK)(i,[],r),(0,h.ei)(r,g.PromptEnum.FilesUpload),(0,h.SQ)(r,()=>{z(e=>e.page_num<0?e:{page_size:e.page_size,page_num:e.page_num+1})},()=>{}),(0,n.useEffect)(()=>()=>{p.show&&x({show:!1,path:""})},[]),(0,_.jsx)("div",{onContextMenu:e,id:"listing",style:{paddingBottom:"10rem",fontSize:b.fontSize},className:`mosaic file-icons ${l?.user_data?.file_list_show_type??""}`,ref:r,children:i&&(0,_.jsx)("div",{onClick:t,children:i.map((e,i)=>(0,_.jsx)(n.Fragment,{children:(0,_.jsx)(w,{icon:f(e.name)?"refresh":void 0,itemWidth:m,index:i,...e})},i))})})}},6960(e,i,t){t.d(i,{s:()=>o});var n=t(72635);const l=1440,s=525600;function o(e){e=e>1e12?e:1e3*e;const i=Date.now(),t=Math.abs(i-e)/6e4;return t<1?n.Ay.t("小于一分钟"):t<60?`${t.toFixed(0)} ${n.Ay.t("分钟前")}`:t<l?`${(t/60).toFixed(0)} ${n.Ay.t("小时前")}`:t<43200?`${(t/l).toFixed(0)} ${n.Ay.t("天前")}`:t<s?`${(t/43200).toFixed(0)} ${n.Ay.t("月前")}`:`${(t/s).toFixed(0)} ${n.Ay.t("年前")}`}}}]);