filecat 7.27.0 → 7.27.3

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.
Files changed (25) hide show
  1. package/build/dist/{1317.6fd3354a8ea9df744438.js → 1317.88c4debdc07e0dc950c2.js} +1 -1
  2. package/build/dist/{1636.2be7829caf415f5ac3ef.js → 1636.72a76243c352d7b14b86.js} +1 -1
  3. package/build/dist/{2502.4a025e24ceade6fe41d2.js → 2502.c8f9f2c98369af4a1a3c.js} +1 -1
  4. package/build/dist/{259.c3d200599bc8d98f81bc.js → 259.a205a786acd6321cf443.js} +1 -1
  5. package/build/dist/{3659.068bbdd237be9cbcb260.js → 3659.6d636b2698d3b12a31b9.js} +1 -1
  6. package/build/dist/{3753.7cc36f8a982a052cbdc7.js → 3753.d78d7ec8d40588a28593.js} +1 -1
  7. package/build/dist/3884.9fbc20ef46caa60d805a.js +1 -0
  8. package/build/dist/5574.2f9e5b3f43901da83741.js +1 -0
  9. package/build/dist/{7133.cf2a4a51286b78a653af.js → 7133.867e3e82cd874862ec1f.js} +1 -1
  10. package/build/dist/{8603.f1cbcfd64cde885f9809.js → 8603.8fd3023b066ebaf71bfc.js} +1 -1
  11. package/build/dist/{8765.c91328121327a9359893.js → 8765.44f7008caa0a952f2c65.js} +1 -1
  12. package/build/dist/{9546.9692a1544a1c17aa0467.js → 9546.f1c334f1614f2cdcc91b.js} +1 -1
  13. package/build/dist/index.html +1 -1
  14. package/build/dist/main.f73b97bc561e0c3f5f91.js +2 -0
  15. package/build/main.js +1 -1
  16. package/package.json +7 -7
  17. package/shell/build.js +13 -24
  18. package/shell/config/webpack.exe.config.js +2 -2
  19. package/shell/config/webpack.npm.config.js +2 -2
  20. package/shell/dev.js +1 -1
  21. package/shell/filecat-watch +1 -1
  22. package/build/dist/1629.3d855a7e2ad5567924e4.js +0 -1
  23. package/build/dist/3884.bdde4e88356129e80bd1.js +0 -1
  24. package/build/dist/main.262952a5e81044442376.js +0 -2
  25. /package/build/dist/{main.262952a5e81044442376.js.LICENSE.txt → main.f73b97bc561e0c3f5f91.js.LICENSE.txt} +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "filecat",
3
- "version": "7.27.0",
3
+ "version": "7.27.3",
4
4
  "description": "A self-hosted Web File browser and lightweight server management tool.",
5
5
  "author": "xiaobaidadada",
6
6
  "repository": {
@@ -14,12 +14,12 @@
14
14
  "license": "Apache-2.0",
15
15
  "scripts": {
16
16
  "dev": "ts-node --transpile-only ./shell/dev.js --env ./env",
17
- "server-debug-js": "tsc && node build/server/main/server.js --env ./env",
17
+ "server-debug-js": "tsc && node build/server/main/main.js --env ./env",
18
18
  "dev-inspect": "node --inspect=0.0.0.0:9001 --require ts-node/register ./shell/dev.js --env ./env",
19
- "server-dev-inspect": "node --inspect=0.0.0.0:9001 --require ts-node/register ./src/main/server.ts --env ./env ",
20
- "server-dev": "ts-node --transpile-only ./src/main/server.ts --env ./env",
21
- "server-dev2": "ts-node --transpile-only ./src/main/server.ts --env ./env.local",
22
- "server-watch": "node ./src/main/watch.js --env ./env dev",
19
+ "server-dev-inspect": "node --inspect=0.0.0.0:9001 --require ts-node/register ./src/main/main.ts --env ./env ",
20
+ "server-dev": "ts-node --transpile-only ./src/main/main.ts --env ./env",
21
+ "server-dev2": "ts-node --transpile-only ./src/main/main.ts --env ./env.local",
22
+ "server-watch": "node ./build/main.js --env ./env dev",
23
23
  "webpack-dev": "cross-env NODE_ENV=development npx webpack serve --mode development --config shell/config/webpack.web.config.js",
24
24
  "i-dev": "npm i --omit=dev",
25
25
  "build": "npm run npm-build",
@@ -35,7 +35,7 @@
35
35
  "build-exe-mac-arm": "npm run exe-build && npm run build-exe-pkg filecat-mac-arm.tar.gz",
36
36
  "start": "node build/main.js",
37
37
  "test": "prebuild --upload-files-gz filecat-linux --set-version \"\" -u 11234 ",
38
- "server-debug-js2": "tsc && node build/server/main/server.js --env ./env2",
38
+ "server-debug-js2": "tsc && node build/server/main/main.js --env ./env2",
39
39
  "tcp-client-build-test": "tsc && npx webpack --config shell/config/webpack.tcp-client-cli.config.js"
40
40
  },
41
41
  "optionalDependencies": {
package/shell/build.js CHANGED
@@ -9,12 +9,12 @@ const is_exe = args[0]==="exe"
9
9
  const is_npm = args[0]==="npm"
10
10
  if (args.length ===0 || is_npm) {
11
11
  serverConfig = require('./config/webpack.npm.config.js');
12
- console.log('npm打包')
12
+ console.log('npm way')
13
13
  } else if (is_exe) {
14
- console.log('二进制打包')
14
+ console.log('exe way')
15
15
  serverConfig = require('./config/webpack.exe.config.js');
16
16
  } else {
17
- console.error('无法识别打包环境')
17
+ console.error('unknown way')
18
18
  }
19
19
  const {copyFileSync} = require("fs");
20
20
  const fs = require("fs");
@@ -46,20 +46,20 @@ function exec_sync(cmd) {
46
46
  const tasksLister = new Listr(
47
47
  [
48
48
  {
49
- title:"清理build目录执行tsc",
49
+ title:"clean build and tsc",
50
50
  task:async ()=>{
51
51
  fse.removeSync(path.join(__dirname, "..", "build"));
52
52
  exec_sync("npx tsc")
53
53
  }
54
54
  },
55
55
  {
56
- title:"编译plugin到build/plugin目录",
56
+ title:"compile plugin to build/plugin dir",
57
57
  task:async ()=>{
58
58
  exec_sync("npx tsc -p tsconfig.plugin.json")
59
59
  }
60
60
  },
61
61
  {
62
- title:"子线程构建",
62
+ title:"worker build",
63
63
  task:async ()=>{
64
64
  return Promise.all([new Promise((res, rej) => {
65
65
  const config = {...serverConfig};
@@ -80,28 +80,19 @@ const tasksLister = new Listr(
80
80
  }
81
81
  },
82
82
  {
83
- title: "构建服务端",
83
+ title: "server build",
84
84
  task: async () => {
85
85
  return new Promise((res, rej) => {
86
- webpack(serverConfig, (err, stats) => {
86
+ const server_config = {...serverConfig};
87
+ server_config['entry'] = path.join(__dirname, "..", "build", "server", "main", "main.js")
88
+ server_config['output'] = {...server_config['output']}
89
+ server_config['output']['filename'] = 'main.js'
90
+ webpack(server_config, (err, stats) => {
87
91
  if (err || stats.hasErrors()) {
88
92
  console.error(err || stats.toString());
89
93
  rej(false);
90
94
  return;
91
95
  }
92
- // copyFileSync(path.join(__dirname, "..", "src", "main", "domain", "bin", "win-process.node"), path.join(__dirname, "..", "build", "win-process.node"))
93
- // copyFileSync(path.join(__dirname, "..", "src", "main", "domain", "bin", "linux-process.node"), path.join(__dirname, "..", "build", "linux-process.node"))
94
- // copyFileSync(path.join(__dirname, "..", "src", "main", "domain", "net", "tun","ts","linux","linuxtun.node"), path.join(__dirname, "..", "build", "linuxtun.node"))
95
- // copyFileSync(path.join(__dirname, "..", "src", "main", "domain", "net", "tun","ts","win","wintun.node"), path.join(__dirname, "..", "build", "wintun.node"))
96
- // copyFileSync(path.join(__dirname, "..", "src", "main", "domain", "net", "wintun-amd64.dll"), path.join(__dirname, "..", "build", "wintun-amd64.dll"))
97
- // copyFileSync(path.join(__dirname, "..", "src", "main", "domain", "net", "wintun-arm.dll"), path.join(__dirname, "..", "build", "wintun-arm.dll"))
98
- // copyFileSync(path.join(__dirname, "..", "src", "main", "domain", "net", "wintun-arm64.dll"), path.join(__dirname, "..", "build", "wintun-arm64.dll"))
99
- // copyFileSync(path.join(__dirname, "..", "src", "main", "domain", "net", "wintun-x86.dll"), path.join(__dirname, "..", "build", "wintun-x86.dll"))
100
- // copyFileSync(path.join(__dirname, "..", "src", "main", "domain", "bin", "ffmpeg"), path.join(__dirname, "..", "build", "ffmpeg"))
101
- // copyFileSync(path.resolve("build/server/main/domain/file/file.worker.js"), path.join(__dirname, "..", "build", "file.worker.js"))
102
-
103
- // 复制 子进程监控脚本
104
- // ensure_copyFileSync(path.resolve("src/main/watch.js"), path.join(__dirname, "..", "build", "watch.js"))
105
96
  if(is_exe) {
106
97
  copy_wintun_dll()
107
98
  fs.copyFileSync(path.resolve('package.json'), path.resolve('build','package.json'));
@@ -115,13 +106,11 @@ const tasksLister = new Listr(
115
106
 
116
107
  res(true);
117
108
  });
118
-
119
109
  })
120
-
121
110
  },
122
111
  },
123
112
  {
124
- title: "构建web",
113
+ title: "web build",
125
114
  task: async () => {
126
115
  return new Promise((res, rej) => {
127
116
  webpack(config, (err, stats) => {
@@ -9,10 +9,10 @@ const { _node_rules, get_exe_plugins, pkg_externals} = require("./base.webpack.c
9
9
  module.exports = {
10
10
  target: 'node', // 指定打包结果运行在node环境下
11
11
  mode: 'production', // 或者 'production'
12
- entry: path.join(__dirname, "..", "..", "build", "server", "main", "server.js"), // 你的TypeScript入口文件路径
12
+ entry: path.join(__dirname, "..", "..", "build", "server", "main", "main.js"), // 由 build.js 各阶段覆盖
13
13
  output: {
14
14
  path: path.resolve(__dirname, "..", "..", "build"), // 输出目录
15
- filename: 'main.js', // 输出文件名
15
+ filename: 'main.js', // 由 build.js 各阶段覆盖
16
16
  },
17
17
  resolve: {
18
18
  extensions: ['.ts', '.js', '.node'], // 解析文件时自动补全的文件扩展名
@@ -7,10 +7,10 @@ const {npm_externals, common_plugins} = require("./base.webpack.config");
7
7
  module.exports = {
8
8
  target: 'node', // 指定打包结果运行在node环境下
9
9
  mode: 'production', // 或者 'production'
10
- entry: path.join(__dirname, "..", "..", "build", "server", "main", "server.js"), // 你的TypeScript入口文件路径
10
+ entry: path.join(__dirname, "..", "..", "build", "server", "main", "main.js"), // 由 build.js 各阶段覆盖
11
11
  output: {
12
12
  path: path.resolve(__dirname, "..", "..", "build"), // 输出目录
13
- filename: 'main.js', // 输出文件名
13
+ filename: 'main.js', // 由 build.js 各阶段覆盖
14
14
  },
15
15
  resolve: {
16
16
  // 入口是 tsc 编译后的 .js,不需要 webpack 解析 .ts
package/shell/dev.js CHANGED
@@ -40,7 +40,7 @@ const runServer = async () => {
40
40
  const devServerOptions = { ...webpackConfig.devServer, open: false };
41
41
  const server = new WebpackDevServer(devServerOptions, compiler);
42
42
  server.start();
43
- require("../src/main/server")
43
+ require("../src/main/main")
44
44
  };
45
45
 
46
46
  runServer();
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- require("../build/watch.js");
2
+ require("../build/main.js");
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[1629],{47996(e,s,t){t.d(s,{d:()=>i});t(96540);var n=t(74848);function i(e){return(0,n.jsxs)("div",{className:"instance-item",children:[(0,n.jsxs)("div",{className:"instance-item__toolbar",children:[(0,n.jsx)("span",{className:"instance-item__label",children:e.title}),e.toolbar]}),e.children]})}},77481(e,s,t){t.d(s,{S:()=>o,X:()=>a});var n=t(96540),i=t(61443),l=t(74848);function a(e){const[s,t]=n.useState([]),a=(0,n.useRef)(-1),[o,r]=(0,n.useState)(-1),[d,c]=(0,n.useState)(-1);(0,n.useEffect)(()=>{e.children?t(Array.isArray(e.children)?e.children:[e.children]):t(e.rows)},[e.rows,e.children]);const h=()=>{a.current=-1,r(-1),c(-1)};return(0,l.jsxs)("table",{children:[(0,l.jsx)("thead",{children:(0,l.jsx)("tr",{children:e.headers?.map((s,t)=>{const n=!!e.filter&&(e.filter.column??0)===t;let a=s;if(n){const t=e.filter,n=t.options.find(e=>e.value===t.value);null!=t.value&&n&&(a=`${s} (${n.label})`)}return(0,l.jsx)("th",{className:n?"table-filter-col":"",children:n?(0,l.jsx)(i.l6,{value:e.filter.value,options:e.filter.options,onChange:e.filter.onChange,bare:!0,trigger_label:a}):s},t)})})}),(0,l.jsx)("tbody",{children:s.map((s,t)=>{const n=!!e.onRowDrag;return(0,l.jsx)("tr",{className:n?(o===t?"row-dragging":"")+(d===t?" row-drop-target":""):"",draggable:n,onContextMenu:()=>{e.handleContextMenu&&e.handleContextMenu(s)},onDragStart:e=>{n&&(a.current=t,r(t),e.dataTransfer.effectAllowed="move")},onDragOver:e=>{!n||a.current<0||(e.preventDefault(),e.dataTransfer.dropEffect="move",c(t))},onDrop:s=>{n&&(s.preventDefault(),(()=>{const s=a.current,t=d;h(),s<0||t<0||s===t||e.onRowDrag?.(s,t)})())},onDragEnd:h,children:s.map((t,n)=>{const i=n===s.length-1?"small":"";return(0,l.jsx)("td",{className:i,style:{width:e.width??"auto"},children:t},n)})},t)})})]})}function o(e){return(0,l.jsx)("div",{style:{display:e.isFlex?"flex":"block"},children:e.columns.map((e,s)=>(0,l.jsx)("div",{children:e},s))})}},31629(e,s,t){t.r(s),t.d(s,{default:()=>xe});var n=t(96540),i=t(75725),l=t(23430),a=t(70447),o=t(85997),r=t(61443),d=t(14284),c=t(53459),h=t(34843),u=t(82893),m=t(77481),p=t(74777),_=t(22022),x=t(4412),j=t(78247),v=t(62042),f=t(64484),g=t(23496),w=t(18840),y=t(6960),b=t(7523),C=t(74848);function S(){const{t:e}=(0,_.Bd)(),[,s]=(0,h.fp)(u.AG.prompt_card),[t,i]=(0,n.useState)(""),[l,x]=(0,n.useState)(5610),[j,f]=(0,n.useState)(5710);(0,n.useEffect)(()=>{(async()=>{const e=await d.XO.get("sys_option/status");if(e.code===c.m.Success){const s=e.data?.sys_env;i((s?.browser_proxy_allow||[]).join("\n")),x(s?.browser_proxy_port_start||5610),f(s?.browser_proxy_port_end||5710)}})()},[]);return(0,C.jsxs)(a.Zp,{self_title:(0,C.jsxs)("span",{className:" div-row ",children:[(0,C.jsx)("h2",{children:e("网页代理")}),(0,C.jsx)(o.rA,{icon:"info",title:e("信息"),onClick:()=>{s({open:!0,title:e("信息"),context_div:(0,C.jsx)("div",{children:(0,C.jsx)("div",{children:e("wbvpn_tip")})})})}})]}),rightBottomCom:(0,C.jsx)(o.C3,{text:e("确定修改"),clickFun:async()=>{const s=t.split("\n").map(e=>e.trim()).filter(e=>!!e);(await d.XO.post(g.s.setting_sys_option_status_save,{type:p.Mu.sys_env,value:{browser_proxy_allow:s,browser_proxy_port_start:Number(l)||5610,browser_proxy_port_end:Number(j)||5710}})).code===c.m.Success&&(0,v.SK)(e("修改成功"))}}),children:[(0,C.jsx)("div",{children:e("wbvpn_allow")}),(0,C.jsx)(r.Z2,{style:{minHeight:"5rem",resize:"vertical"},placeholder:e("wbvpn_allow_ph"),value:t,onChange:e=>{i(e.target.value)}}),(0,C.jsx)("div",{children:e("wbvpn_port_range")}),(0,C.jsx)(m.S,{isFlex:!0,columns:[(0,C.jsx)(r.Sm,{placeholder:"5610",value:l,handleInputChange:e=>x(e)}),(0,C.jsx)("span",{style:{padding:"0 6px"},children:"-"}),(0,C.jsx)(r.Sm,{placeholder:"5710",value:j,handleInputChange:e=>f(e)})]})]})}function k(){const[e,s]=(0,n.useState)(""),[t,l]=(0,n.useState)(""),[k,A]=(0,n.useState)(!1),[I,N]=(0,n.useState)(""),[$,V]=(0,n.useState)(!1),[B,F]=(0,n.useState)(""),[P,X]=(0,h.fp)(u.AG.prompt_card),[,z]=(0,h.fp)(u.AG.editorSetting),[K,T]=(0,n.useState)(p.aM.close),[O,M]=(0,n.useState)(!1),[q,E]=(0,n.useState)(p.Hb.independent),D=(0,f.T)(),[H,W]=(0,n.useState)(void 0),[Z,G]=(0,n.useState)(""),{t:U,i18n:R}=(0,_.Bd)(),J=[`- ${U("过期策略:默认表示使用系统内置的1小时过期时间;指定时间按填写的秒数过期;永不过期则token一直有效")}`,`- ${U("独立token:每次登录都签发新的token,同一账号可以在多个设备同时登录,互不影响")}`,`- ${U("复用token:该账号已有未过期的token时直接复用它,不会签发新的")}`,`- ${U("单会话:每次登录签发新的token,并让该账号此前的所有token立即失效")}`].join("\n"),[L,Q]=(0,h.fp)(u.AG.user_base_info),{check_user_auth:Y}=(0,j.MH)(),{initUserInfo:ee}=(0,n.useContext)(b.F),se=async()=>{const e=await d.XO.get("sys_option/status");if(e.code===c.m.Success){V(e.data.recycle_open),F(e.data.recycle_dir);const t=e.data.sys_env;s(t?.web_site_title),l(t?.logo||""),A(t?.show_login_user_info),N(t?.http_proxy||""),G(t?.control_env_str||w.CU)}const t=await d.XO.get("token");if(t.code===c.m.Success){const e=t.data;if(!e)return;e.length&&W(e.length),e.mode&&T(e.mode),void 0!==e.persist&&M(e.persist),void 0!==e.session_mode&&E(e.session_mode)}};(0,n.useEffect)(()=>{se()},[]);return(0,C.jsxs)("div",{children:[(0,C.jsx)(x.aZ,{children:(0,C.jsxs)(C.Fragment,{children:[(0,C.jsxs)("span",{className:"credits",children:[U("系统运行于"),": ",(0,y.s)(L.runing_time_length)]}),(0,C.jsx)("span",{className:"credits",children:(0,C.jsxs)("a",{href:"https://github.com/xiaobaidadada/filecat",target:"_blank",children:["version:7.27.0",null!=L.latest_version&&"7.27.0"!==L.latest_version?` -> ${L.latest_version}`:""]})}),(0,C.jsx)("span",{className:"credits",children:(0,C.jsx)("a",{href:U("官网地址"),target:"_blank",children:`filecat ${U("功能文档")}`})}),(0,C.jsxs)("span",{className:"credits",children:[U("安装方式")," :",L.process_env_run_env]})]})}),(0,C.jsx)(i.xh,{children:(0,C.jsxs)(i.fI,{children:[(0,C.jsxs)(i.VP,{widthPer:33,children:[(0,C.jsxs)(a.Zp,{self_title:(0,C.jsxs)("span",{className:" div-row ",children:[(0,C.jsx)("h2",{children:U("通用设置")})," ",(0,C.jsx)(o.rA,{icon:"info",onClick:()=>{X({open:!0,title:U("信息"),context_div:(0,C.jsx)("div",{children:(0,C.jsx)("div",{children:U("sys_env_setting_tip")})})})},title:U("信息")})]}),rightBottomCom:(0,C.jsx)(o.C3,{text:U("确定修改"),clickFun:async()=>{(await d.XO.post(g.s.setting_sys_option_status_save,{type:p.Mu.sys_env,value:{web_site_title:e,show_login_user_info:k,http_proxy:I,logo:t}})).code===c.m.Success&&((0,v.SK)(U("修改成功")),ee())}}),rightTopCom:(0,C.jsx)(o.rA,{icon:"tune",title:U("环境控制"),onClick:()=>{j.xK.set_value_temp(Z||w.CU),z({model:"ace/mode/yaml",open:!0,fileName:"",not_auto_save:!0,save:async e=>{const s=await d.XO.post(g.s.setting_sys_option_status_save,{type:p.Mu.sys_env,value:{control_env_str:e}});s.code===c.m.Success?(G(e),(0,v.SK)(U("修改成功")),se()):(0,v.zN)(`${s.message??U("保存失败")}`)}})}}),children:[U("网站标题"),(0,C.jsx)(r.Sm,{value:e,handleInputChange:e=>{s(e)}}),U("网站 Logo"),(0,C.jsx)(r.Sm,{placeholder:U("lclorur"),value:t,handleInputChange:e=>{l(e)}}),U("lgn_usr"),(0,C.jsx)("input",{type:"checkbox",checked:k,onChange:()=>{A(!k)}})]}),(0,C.jsx)(S,{})]}),(0,C.jsxs)(i.VP,{widthPer:33,children:[(0,C.jsxs)(a.Zp,{self_title:(0,C.jsxs)("span",{className:" div-row ",children:[(0,C.jsx)("h2",{children:U("文件回收站")})," ",(0,C.jsx)(o.rA,{icon:"info",onClick:()=>{X({open:!0,title:U("信息"),context_div:(0,C.jsx)("div",{children:U("格式:[被删除的文件所在父目录] 回收站目录 [; ...]")})})},title:U("信息")})]}),rightBottomCom:(0,C.jsx)(o.C3,{text:U("确定修改"),clickFun:async()=>{if($&&!B)return void(0,v.zN)(U("目录不能为空"));(await d.XO.post(g.s.setting_sys_option_status_save,{type:p.Mu.cyc,value:B,open:$})).code===c.m.Success&&(0,v.SK)(U("修改成功"))}}),children:[(0,C.jsx)(r.Sm,{placeholder:U("目录"),value:B,handleInputChange:e=>{F(e)}}),(0,C.jsx)(r.l6,{value:$,onChange:e=>{V(e)},options:[{title:U("开启"),value:!0},{title:U("关闭"),value:!1}]})]}),(0,C.jsxs)(a.Zp,{self_title:(0,C.jsxs)("span",{className:" div-row ",children:[(0,C.jsx)("h2",{children:U("会话token设置")}),(0,C.jsx)(o.rA,{icon:"info",title:U("登录会话"),onClick:()=>D(J)})]}),rightBottomCom:(0,C.jsx)(m.S,{isFlex:!0,columns:[(0,C.jsx)(o.C3,{text:U("清空token"),clickFun:async()=>{(await d.XO.get("token/clear")).code===c.m.Success&&(0,v.SK)(U("清理完成,重新登录"))}}),(0,C.jsx)(o.C3,{text:U("保存"),clickFun:async()=>{const e=new p.Gd;e.mode=K,e.persist=O,e.session_mode=q,p.aM.length!==e.mode||H||(0,v.zN)(U("秒数不能为空")),e.length=parseInt(H);(await d.XO.post("token/save",e)).code===c.m.Success&&(0,v.SK)(U("保存成功"))}})]}),children:[(0,C.jsxs)("div",{className:"form_group",children:[(0,C.jsx)("div",{className:"form_label",children:U("过期策略")}),(0,C.jsx)(m.S,{isFlex:!0,columns:[(0,C.jsx)(r.U6,{name:"token_time_mode",value:1,context:U("默认"),selected:K===p.aM.close,onchange:()=>{T(p.aM.close)}}),(0,C.jsx)(r.U6,{name:"token_time_mode",value:1,context:U("指定时间"),selected:K===p.aM.length,onchange:()=>{T(p.aM.length)}}),(0,C.jsx)(r.U6,{name:"token_time_mode",value:1,context:U("永不过期"),selected:K===p.aM.forver,onchange:()=>{T(p.aM.forver)}})]}),K===p.aM.length&&(0,C.jsx)(r.Sm,{placeholder:U("秒"),value:H,handleInputChange:e=>{W(e)}}),(0,C.jsx)(r.GL,{context:U("持久化"),selected:O,onchange:()=>M(!O)})]}),(0,C.jsxs)("div",{className:"form_group",children:[(0,C.jsx)("div",{className:"form_label",children:U("登录会话")}),(0,C.jsx)(m.S,{isFlex:!0,columns:[(0,C.jsx)(r.U6,{name:"token_session_mode",value:p.Hb.independent,context:U("独立token"),selected:q===p.Hb.independent,onchange:()=>E(p.Hb.independent)}),(0,C.jsx)(r.U6,{name:"token_session_mode",value:p.Hb.reuse,context:U("复用token"),selected:q===p.Hb.reuse,onchange:()=>E(p.Hb.reuse)}),(0,C.jsx)(r.U6,{name:"token_session_mode",value:p.Hb.single,context:U("单会话"),selected:q===p.Hb.single,onchange:()=>E(p.Hb.single)})]})]})]})]})]})})]})}var A=t(64694),I=t(92350),N=t(69675),$=t(32361);const V=[{key:"second",min:0,max:59,label:"秒"},{key:"minute",min:0,max:59,label:"分"},{key:"hour",min:0,max:23,label:"时"},{key:"day",min:1,max:31,label:"日"},{key:"month",min:1,max:12,label:"月"},{key:"week",min:0,max:7,label:"星期"}];function B(e){switch(e.mode){case"step":return`*/${e.step??1}`;case"range":return`${e.from??0}-${e.to??0}`;case"list":return(e.values??[]).join(",");default:return"*"}}function F(e){return[B(e.second),B(e.minute),B(e.hour),B(e.day),B(e.month),B(e.week)].join(" ")}function P(e,s,t){const n=(e??"").trim();if(!n)return null;if("*"===n)return{mode:"every"};if(n.startsWith("*/")){const e=Number(n.slice(2));return!Number.isInteger(e)||e<=0?null:{mode:"step",step:e}}if(n.includes("-")&&!n.includes(",")){const[e,i]=n.split("-").map(Number);return Number.isInteger(e)&&Number.isInteger(i)?e<s||i>t||e>i?null:{mode:"range",from:e,to:i}:null}const i=n.split(","),l=[];for(const e of i){const n=Number(e.trim());if(!Number.isInteger(n)||n<s||n>t)return null;l.push(n)}return 0===l.length?null:{mode:"list",values:l}}function X(e){const s=(e??"").trim().split(/\s+/);if(6!==s.length)return null;const t={};for(let e=0;e<6;e++){const n=V[e],i=P(s[e],n.min,n.max);if(!i)return null;t[n.key]=i}return t}function z(e){return e<10?`0${e}`:`${e}`}function K(e,s,t){switch(e.mode){case"step":return`每 ${e.step} ${s}`;case"range":return`${e.from} 到 ${e.to} ${s}`;case"list":return`${(e.values??[]).slice().sort((e,s)=>e-s).join("、")} ${s}`;default:return null}}function T(e){const{second:s,minute:t,hour:n,day:i,month:l,week:a}=e,o=(e,s)=>"list"===e.mode&&1===(e.values??[]).length&&e.values[0]===s,r=[];if("list"===n.mode&&"list"===t.mode&&o(s,0)){const e=(n.values??[]).slice().sort((e,s)=>e-s),s=(t.values??[]).slice().sort((e,s)=>e-s);e.length===s.length&&e.length>1&&s.length>1?r.push(e.map((e,t)=>`${z(e)}:${z(s[t])}`).join("、")):1===e.length&&1===s.length?r.push(`${z(e[0])}:${z(s[0])}`):r.push(`${e.map(z).join("、")} 时 ${s.join("、")} 分`)}else if("list"===n.mode&&"step"===t.mode&&o(s,0))r.push(`${(n.values??[]).map(z).join("、")} 时内每 ${t.step} 分钟`);else if("every"===n.mode&&"list"===t.mode&&o(s,0))r.push(`每小时的 ${(t.values??[]).join("、")} 分`);else if("every"===n.mode&&"step"===t.mode&&o(s,0))r.push(`每 ${t.step} 分钟`);else if("every"===n.mode&&"every"===t.mode&&o(s,0))r.push("每分钟");else if("every"===n.mode&&"every"===t.mode&&"step"===s.mode)r.push(`每 ${s.step} 秒`);else if("every"===n.mode&&"every"===t.mode&&"every"===s.mode)r.push("每秒");else if("every"===n.mode&&"every"===t.mode&&"list"===s.mode)r.push(`每分钟的第 ${(s.values??[]).join("、")} 秒`);else{const e=[],i=K(n,"时"),l=K(t,"分"),a=o(s,0)?null:K(s,"秒");i&&e.push(i),l&&e.push(l),a&&e.push(a),e.length>0&&r.push(e.join(" "))}const d="list"===i.mode&&1===(i.values??[]).length?i.values[0]:null,c="list"===l.mode&&1===(l.values??[]).length?l.values[0]:null,h="list"===a.mode&&1===(a.values??[]).length?a.values[0]:null;let u="";if(null!==c&&null!==d)u=`每年 ${c} 月 ${d} 号`;else if(null!==c)u=`每年 ${c} 月`;else if(null!==d)u=`每月 ${d} 号`;else if(null!==h)u=`每${["周日","周一","周二","周三","周四","周五","周六","周日"][h]??`星期 ${h}`}`;else{const e=[];"every"!==l.mode&&e.push(K(l,"月")),"every"!==i.mode&&e.push(K(i,"号")),"every"!==a.mode&&e.push(`星期 ${K(a,"")}`),e.length&&(u=e.join(" "))}u||(u="每天");const m=r.join(",");return/^(每|每天)/.test(m)?`${m}${"每天"===u?"":","+u} 执行`:`${u} ${m} 执行`}const O=[{label:"任意 (*)",value:"every"},{label:"每隔 (*/n)",value:"step"},{label:"区间 (a-b)",value:"range"},{label:"指定 (a,b)",value:"list"}];function M(e,s,t=!1){const n=[];for(let i=e;i<=s;i++)n.push({label:t?String(i).padStart(2,"0"):String(i),value:i});return n}const q=({label:e,field:s,min:t,max:i,pad:l,week_label:a,onChange:o})=>{const d=(0,n.useMemo)(()=>M(t,i,l),[t,i,l]),c=(0,n.useMemo)(()=>{if(!a)return d;const e=["周日","周一","周二","周三","周四","周五","周六","周日"];return d.map(s=>({value:s.value,label:`${s.value} (${e[s.value]})`}))},[d,a]);return(0,C.jsxs)("div",{className:"cron-field",children:[(0,C.jsx)("span",{className:"cron-field__label",children:e}),(0,C.jsx)(r.l6,{value:s.mode,onChange:e=>{o("every"===e?{mode:"every"}:"step"===e?{mode:"step",step:s.step??1}:"range"===e?{mode:"range",from:s.from??t,to:s.to??i}:{mode:"list",values:s.values??[t]})},options:O,no_border:!0,width:"7.5rem"}),"step"===s.mode&&(0,C.jsxs)("div",{className:"cron-field__param",children:[(0,C.jsx)("span",{children:"每"}),(0,C.jsx)(r.l6,{value:s.step??1,onChange:e=>o({mode:"step",step:e}),options:M(1,i),no_border:!0,width:"4.5rem"}),(0,C.jsx)("span",{children:e})]}),"range"===s.mode&&(0,C.jsxs)("div",{className:"cron-field__param",children:[(0,C.jsx)(r.l6,{value:s.from??t,onChange:e=>o({mode:"range",from:e,to:s.to??i}),options:c,no_border:!0,width:"6.5rem"}),(0,C.jsx)("span",{children:"到"}),(0,C.jsx)(r.l6,{value:s.to??i,onChange:e=>o({mode:"range",from:s.from??t,to:e}),options:c,no_border:!0,width:"6.5rem"})]}),"list"===s.mode&&(0,C.jsxs)("div",{className:"cron-field__param cron-field__param--list",children:[(s.values??[]).map((e,t)=>(0,C.jsxs)("span",{className:"cron-tag",children:[(0,C.jsx)(r.l6,{value:e,onChange:e=>((e,t)=>{const n=[...s.values??[]];n[e]=t,o({mode:"list",values:n})})(t,e),options:c,no_border:!0,width:"6.5rem"}),(0,C.jsx)("i",{className:"material-icons cron-tag__del",onClick:()=>(e=>{const t=(s.values??[]).filter((s,t)=>t!==e);o(t.length?{mode:"list",values:t}:{mode:"every"})})(t),children:"close"})]},t)),(0,C.jsx)("i",{className:"material-icons cron-tag__add",onClick:()=>{const e=[...s.values??[]],n=new Set(e);let l=t;for(;n.has(l)&&l<i;)l++;o({mode:"list",values:[...e,l]})},children:"add"})]})]})};const E=[{label:"每分钟",make:()=>({second:{mode:"every"},minute:{mode:"every"},hour:{mode:"every"},day:{mode:"every"},month:{mode:"every"},week:{mode:"every"},second:{mode:"list",values:[0]}})},{label:"每 5 分钟",make:()=>({second:{mode:"every"},minute:{mode:"every"},hour:{mode:"every"},day:{mode:"every"},month:{mode:"every"},week:{mode:"every"},minute:{mode:"step",step:5},second:{mode:"list",values:[0]}})},{label:"每小时",make:()=>({second:{mode:"every"},minute:{mode:"every"},hour:{mode:"every"},day:{mode:"every"},month:{mode:"every"},week:{mode:"every"},minute:{mode:"list",values:[0]},second:{mode:"list",values:[0]}})},{label:"每天 0 点",make:()=>({second:{mode:"every"},minute:{mode:"every"},hour:{mode:"every"},day:{mode:"every"},month:{mode:"every"},week:{mode:"every"},hour:{mode:"list",values:[0]},minute:{mode:"list",values:[0]},second:{mode:"list",values:[0]}})},{label:"每天 8 点",make:()=>({second:{mode:"every"},minute:{mode:"every"},hour:{mode:"every"},day:{mode:"every"},month:{mode:"every"},week:{mode:"every"},hour:{mode:"list",values:[8]},minute:{mode:"list",values:[0]},second:{mode:"list",values:[0]}})},{label:"每周一 0 点",make:()=>({second:{mode:"every"},minute:{mode:"every"},hour:{mode:"every"},day:{mode:"every"},month:{mode:"every"},week:{mode:"every"},hour:{mode:"list",values:[0]},minute:{mode:"list",values:[0]},second:{mode:"list",values:[0]},week:{mode:"list",values:[1]}})},{label:"每月 1 号 0 点",make:()=>({second:{mode:"every"},minute:{mode:"every"},hour:{mode:"every"},day:{mode:"every"},month:{mode:"every"},week:{mode:"every"},hour:{mode:"list",values:[0]},minute:{mode:"list",values:[0]},second:{mode:"list",values:[0]},day:{mode:"list",values:[1]}})}],D=({value:e,onChange:s,no_border:t})=>{const[i,l]=(0,n.useState)(!1),a=(0,n.useRef)(null),o=(0,n.useRef)(null),r=(0,n.useMemo)(()=>X(e??"")??{second:{mode:"every"},minute:{mode:"every"},hour:{mode:"every"},day:{mode:"every"},month:{mode:"every"},week:{mode:"every"}},[e]),d=!!e&&!X(e??""),c=(0,$.r)({active:i,trigger_ref:a,floating_ref:o,width:384,max_height:26});(0,N.$)(i,[a,o],()=>l(!1));const h=e=>{s(F(e))};return(0,C.jsxs)("div",{className:"cron-input "+(i?"cron-input--open":""),children:[(0,C.jsxs)("div",{ref:a,className:"cron-input__display "+(t?"cron-input__display--no-border":""),title:d?"表达式格式不正确":`${e||""} ${T(r)}`.trim(),onClick:()=>l(!i),children:[(0,C.jsx)("span",{className:"cron-input__expr "+(d?"cron-input__expr--invalid":""),children:e||"(未设置)"}),!t&&(0,C.jsx)("span",{className:"cron-input__desc",children:d?"表达式格式不正确":T(r)}),(0,C.jsx)("i",{className:"material-icons cron-input__arrow",children:"arrow_drop_down"})]}),i&&(0,C.jsxs)("div",{ref:o,className:"cron-editor",style:{left:c.left,top:c.top,...c.css_vars,visibility:c.ready?"visible":"hidden"},children:[(0,C.jsxs)("div",{className:"cron-editor__scroll",children:[(0,C.jsxs)("div",{className:"cron-editor__row",children:[(0,C.jsx)("span",{className:"cron-editor__title",children:"常用"}),(0,C.jsx)("div",{className:"cron-editor__presets",children:E.map(e=>(0,C.jsx)("button",{className:"cron-preset",onClick:()=>h(e.make()),children:e.label},e.label))})]}),(0,C.jsx)("div",{className:"cron-editor__fields",children:V.map(e=>(0,C.jsx)(q,{label:e.label,field:r[e.key],min:e.min,max:e.max,pad:"day"!==e.key&&"month"!==e.key&&"week"!==e.key,week_label:"week"===e.key,onChange:s=>{return t=e.key,n=s,void h({...r,[t]:n});var t,n}},e.key))})]}),(0,C.jsxs)("div",{className:"cron-editor__footer",children:[(0,C.jsx)("span",{className:"cron-editor__preview",children:F(r)}),(0,C.jsx)("button",{className:"cron-editor__done",onClick:()=>l(!1),children:"完成"})]})]})]})};var H=t(24659);function W(){const{t:e,i18n:s}=(0,_.Bd)(),{initUserInfo:t,reloadUserInfo:l}=(0,n.useContext)(b.F),[p,x]=(0,n.useState)([]),[f,g]=(0,n.useState)([]),[w,y]=(0,h.fp)(u.AG.prompt_card),[,S]=(0,h.fp)(u.AG.editorSetting),[k,N]=(0,n.useState)([]),[$,V]=(0,n.useState)([]),[B,F]=(0,n.useState)([]),[P,X]=(0,n.useState)([]),[z,K]=(0,n.useState)(""),[T,O]=(0,n.useState)([]),M=(0,H.K)(),q=[e("软件"),e("是否安装"),e("路径")],E=[e("编号"),e("路径"),e("备注")],W=[e("编号"),e("路径"),e("是否开启"),e("备注")],Z=[e("编号"),e("文件路径"),e("是否开启"),e("系统启动执行"),e("cron表达式"),e("用户id"),e("备注")],G=[e("编号"),e("路径"),e("单用户并发数量"),e("系统并发数量"),e("big_res"),e("big_sz"),e("大文件并发数量"),e("big_ck"),e("备注")],U=[e("编号"),e("名称"),e("路径"),e("是否开启"),e("params"),e("备注")],{check_user_auth:R}=(0,j.MH)(),J=async()=>{const e=await d.XO.get("env/path/get");e.code===c.m.Success&&F(e.data)},L=async()=>{const e=await d.XO.get("workflow_setting_get");e.code===c.m.Success&&X(e.data)};(0,n.useEffect)(()=>{(async()=>{const e=await d.XO.get("outside/software/get");e.code===c.m.Success&&g(e.data);const s=await d.XO.get("pty_cmd");s.code===c.m.Success&&K(s.data),J(),L();const t=await d.XO.get("protection_dir/sys");t.code===c.m.Success&&N(t.data??[]);const n=await d.XO.get("dir_upload_max_num");n.code===c.m.Success&&V(n.data??[]);const i=await d.XO.get("plugin/list");i.code===c.m.Success&&O(i.data??[])})()},[]);const Q=(0,I.Q)(),Y=async()=>{await d.XO.post("plugin/list/save",T)};return(0,C.jsxs)(n.Fragment,{children:[(0,C.jsx)(i.J,{widthPer:100,maxWidth:"100rem",children:(0,C.jsx)(a.uF,{self_title:(0,C.jsxs)("span",{className:" div-row ",children:[(0,C.jsx)("h2",{children:e("up_conc")})," ",(0,C.jsx)(o.rA,{icon:"info",onClick:()=>{Q("文件上传")},title:e("信息")})]}),rightTopCom:(0,C.jsxs)("div",{children:[(0,C.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{V([...$,{path:"",note:"",user_upload_num:2,sys_upload_num:6,ws_file_standard_size:52428800,ws_file_parallel_num:2,ws_file_block_mb_size:524288}])}}),(0,C.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{for(const e of $)if(e.open_ws_file){if("number"!=typeof e.ws_file_block_mb_size)return void(0,v.zN)(`编号:${e.index??""} 文件块的大小设置有问题`);if("number"!=typeof e.ws_file_parallel_num)return void(0,v.zN)(`编号:${e.index??""} 并发数量设置有问题`);if("number"!=typeof e.ws_file_standard_size)return void(0,v.zN)(`编号:${e.index??""} 大文件size设置有问题`)}(0,A.di)($,e=>e.index??0);(await d.XO.post("dir_upload_max_num/save",$)).code===c.m.Success&&((0,v.SK)(e("保存成功")),l())}})]}),children:(0,C.jsx)(m.X,{headers:G,rows:$.map((s,t)=>{const n=[(0,C.jsx)(r.Sm,{value:s.index,placeholder:t,handleInputChange:e=>{s.index=parseInt(e)},no_border:!0}),(0,C.jsx)(r.Sm,{value:s.path,handleInputChange:e=>{s.path=e},no_border:!0}),(0,C.jsx)(r.Sm,{value:s.user_upload_num,handleInputChange:e=>{s.user_upload_num=parseInt(e)},no_border:!0}),(0,C.jsx)(r.Sm,{value:s.sys_upload_num,handleInputChange:e=>{s.sys_upload_num=parseInt(e)},no_border:!0}),(0,C.jsx)(r.l6,{value:!0===s.open_ws_file,onChange:e=>{s.open_ws_file=e,V([...$])},options:M,no_border:!0}),(0,C.jsx)(r.Sm,{value:"number"==typeof s.ws_file_standard_size?s.ws_file_standard_size/1024/1024:void 0,handleInputChange:e=>{s.ws_file_standard_size=1024*parseInt(e)*1024},no_border:!0}),(0,C.jsx)(r.Sm,{value:s.ws_file_parallel_num,handleInputChange:e=>{s.ws_file_parallel_num=parseInt(e)},no_border:!0}),(0,C.jsx)(r.Sm,{value:"number"==typeof s.ws_file_block_mb_size?s.ws_file_block_mb_size/1024/1024:void 0,handleInputChange:e=>{s.ws_file_block_mb_size=1024*parseInt(e)*1024},no_border:!0}),(0,C.jsx)(r.Sm,{value:s.note,handleInputChange:e=>{s.note=e},no_border:!0}),(0,C.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{$.splice(e,1),V([...$])})(t)})];return n}),width:"10rem",onRowDrag:(e,s)=>{V((0,A.TI)($,e,s))}})})}),(0,C.jsx)(i.J,{widthPer:100,maxWidth:"100rem",children:(0,C.jsx)(a.uF,{self_title:(0,C.jsxs)("span",{className:" div-row ",children:[(0,C.jsx)("h2",{children:e("Workflow Job")}),(0,C.jsx)(o.rA,{icon:"info",onClick:()=>{Q("Workflow")},title:e("信息")})]}),rightTopCom:(0,C.jsxs)("div",{children:[(0,C.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{X([...P,{open:!1}])}}),(0,C.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await d.XO.post("workflow_setting_save",P)).code===c.m.Success&&((0,v.SK)("ok"),L())}})]}),children:(0,C.jsx)(m.X,{headers:Z,rows:P.map((s,t)=>{const n=[(0,C.jsx)("div",{children:t}),(0,C.jsx)(r.Sm,{value:s.file_path,handleInputChange:e=>{s.file_path=e},no_border:!0}),(0,C.jsx)(r.l6,{value:!!s.open,onChange:e=>{s.open=e,X([...P])},options:M,no_border:!0}),(0,C.jsx)(r.l6,{value:!!s.sys_power_on,onChange:e=>{s.sys_power_on=e,X([...P])},options:M,no_border:!0}),(0,C.jsx)(D,{value:s.cron_str,onChange:e=>{s.cron_str=e,X([...P])},no_border:!0}),(0,C.jsx)(r.Sm,{value:s.user_id,handleInputChange:e=>{s.user_id=e},no_border:!0}),(0,C.jsx)(r.Sm,{value:s.note,handleInputChange:e=>{s.note=e},no_border:!0}),(0,C.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{P.splice(e,1),X([...P])})(t)})];return n}),width:"10rem",onRowDrag:(e,s)=>{X((0,A.TI)(P,e,s))}})})}),(0,C.jsxs)(i.fI,{children:[(0,C.jsx)(i.VP,{widthPer:50,maxWidth:"50rem",children:(0,C.jsxs)(i.xh,{children:[(0,C.jsx)(a.uF,{self_title:(0,C.jsxs)("span",{className:" div-row ",children:[(0,C.jsx)("h2",{children:e("PATH")}),(0,C.jsx)(o.rA,{icon:"info",onClick:()=>{Q("环境路径")},title:e("信息")})]}),rightTopCom:(0,C.jsxs)("div",{children:[(0,C.jsx)(o.rA,{icon:"list",title:e("查看"),onClick:async()=>{const s=await d.XO.get("env/process/view");s.code===c.m.Success?y({open:!0,title:e("进程环境变量"),context_div:(0,C.jsx)("pre",{style:{whiteSpace:"pre-wrap",wordBreak:"break-all",maxHeight:"60vh",overflow:"auto",margin:0,fontSize:"0.85rem",lineHeight:"1.5"},children:s.data})}):(0,v.zN)(e("获取失败"))}}),(0,C.jsx)(o.rA,{icon:"edit",title:e("编辑"),onClick:async()=>{const s=await d.XO.get("env/process/get");s.code===c.m.Success?(j.xK.set_value_temp(s.data??""),S({model:"ace/mode/ini",open:!0,fileName:"",save:async e=>{await d.XO.post("env/process/save",{text:e})}})):(0,v.zN)(e("获取失败"))}}),(0,C.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{F([...B,{path:"",note:""}])}}),(0,C.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await d.XO.post("env/path/save",{paths:B})).code===c.m.Success&&((0,v.SK)(e("保存成功")),J(),t())}})]}),children:(0,C.jsx)(m.X,{headers:W,rows:B.map((s,t)=>{const n=[(0,C.jsx)("div",{children:t}),(0,C.jsx)(r.Sm,{value:s.path,handleInputChange:e=>{s.path=e},no_border:!0}),(0,C.jsx)(r.l6,{value:!!s.open,onChange:e=>{s.open=e,F([...B])},options:M,no_border:!0}),(0,C.jsx)(r.Sm,{value:s.note,handleInputChange:e=>{s.note=e},no_border:!0}),(0,C.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{B.splice(e,1),F([...B])})(t)})];return n}),width:"10rem",onRowDrag:(e,s)=>{F((0,A.TI)(B,e,s))}})}),(0,C.jsx)(a.Zp,{self_title:(0,C.jsxs)("span",{className:" div-row ",children:[(0,C.jsx)("h2",{children:e("PTY CMD")}),(0,C.jsx)(o.rA,{icon:"info",onClick:()=>{Q("pty")},title:e("信息")})]}),rightBottomCom:(0,C.jsx)(o.C3,{text:e("更新"),clickFun:async()=>{(await d.XO.post("pty_cmd/save",{str:z})).code===c.m.Success&&((0,v.SK)(e("保存成功")),l())}}),children:(0,C.jsx)(r.Sm,{placeholder:e("cmd need pty env"),value:z,handleInputChange:e=>{K(e)}})}),(0,C.jsx)(a.uF,{self_title:(0,C.jsxs)("span",{className:" div-row ",children:[(0,C.jsx)("h2",{children:e("插件配置")}),(0,C.jsx)(o.rA,{icon:"info",onClick:()=>{Q("插件配置")},title:e("信息")})]}),rightTopCom:(0,C.jsxs)("div",{children:[(0,C.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{O([...T,{name:"",path:"",note:"",open:!1}])}}),(0,C.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:Y})]}),children:(0,C.jsx)(m.X,{headers:U,rows:T.map((s,t)=>{const n=[t,(0,C.jsx)(r.Sm,{value:s.name,handleInputChange:e=>{s.name=e},no_border:!0}),(0,C.jsx)(r.Sm,{value:s.path,handleInputChange:e=>{s.path=e},no_border:!0}),(0,C.jsx)(r.l6,{value:!!s.open,onChange:e=>{s.open=e,O([...T])},options:M,no_border:!0}),(0,C.jsx)(o.mu,{icon:"edit",value:s.params,save:async e=>{s.params=e,await Y()},title:""}),(0,C.jsx)(r.Sm,{value:s.note,handleInputChange:e=>{s.note=e},no_border:!0}),(0,C.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{T.splice(e,1),O([...T])})(t)})];return n}),width:"10rem",onRowDrag:(e,s)=>{O((0,A.TI)(T,e,s))}})})]})}),(0,C.jsx)(i.VP,{widthPer:50,maxWidth:"50rem",children:(0,C.jsxs)(i.xh,{children:[(0,C.jsx)(a.uF,{self_title:(0,C.jsxs)("span",{className:" div-row ",children:[(0,C.jsx)("h2",{children:e("系统保护路径")})," ",(0,C.jsx)(o.rA,{icon:"info",onClick:()=>{Q("保护目录")},title:e("信息")})]}),rightTopCom:(0,C.jsxs)("div",{children:[(0,C.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{N([...k,{path:"",note:""}])}}),(0,C.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await d.XO.post("protection_dir/sys/save",k)).code===c.m.Success&&((0,v.SK)(e("保存成功")),l())}})]}),children:(0,C.jsx)(m.X,{headers:E,rows:k.map((s,t)=>{const n=[(0,C.jsx)("div",{children:t}),(0,C.jsx)(r.Sm,{value:s.path,handleInputChange:e=>{s.path=e},no_border:!0}),(0,C.jsx)(r.Sm,{value:s.note,handleInputChange:e=>{s.note=e},no_border:!0}),(0,C.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{k.splice(e,1),N([...k])})(t)})];return n}),width:"10rem",onRowDrag:(e,s)=>{N((0,A.TI)(k,e,s))}})}),(0,C.jsx)(a.uF,{title:e("外部软件"),rightTopCom:(0,C.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await d.XO.post("outside/software/save",f)).code===c.m.Success&&((0,v.SK)(e("保存成功")),t())}}),children:(0,C.jsx)(m.X,{headers:q,rows:f.map((s,t)=>[(0,C.jsx)("div",{children:s.id}),(0,C.jsx)(a.fq,{ok:s.installed}),(0,C.jsx)(r.Sm,{value:s.path,handleInputChange:e=>{s.path=e},no_border:!0,placeholder:e("use_env")}),(0,C.jsx)(o.rA,{icon:"info",onClick:()=>{Q(s.id)},title:e("信息")})]),width:"10rem"})})]})})]})]})}var Z=t(21499);function G(e){const{t:s,i18n:t}=(0,_.Bd)(),[i,a]=(0,h.fp)(u.AG.user_base_info),o=[{title:s("用户权限"),list:[{title:s("用户管理"),permission:l.oV.user_manage},{title:s("角色管理"),permission:l.oV.role_manage}]},{title:s("系统管理权限"),list:[{title:s("系统信息"),permission:l.oV.all_sys},{title:s("系统进程关闭"),permission:l.oV.sys_process_close},{title:s("dc_ctdl"),permission:l.oV.docker_container_update},{title:s("dc_idl"),permission:l.oV.docker_images_delete},{title:s("systemd管理"),permission:l.oV.systemd},{title:s("防火墙管理"),permission:l.oV.firewall}]},{title:s("网络功能权限"),list:[{title:s("系统网络"),permission:l.oV.vir_net},{title:s("内网穿透"),permission:l.oV.tcp_proxy},{title:"ddns",permission:l.oV.ddns}]},{title:s("Ai 设置权限"),list:[{title:s("Ai 配置"),permission:l.oV.ai_agent_setting},{title:s("ai_page"),permission:l.oV.ai_agent_page},{title:s("sw_mdl"),permission:l.oV.ai_model_switch}]},{title:s("文件权限"),list:[{title:s("log_del"),permission:l.oV.filecat_file_delete_cut_rename},{title:s("log_wr"),permission:l.oV.filecat_file_context_update_upload_created_copy_decompression},{title:s("内容更新"),permission:l.oV.filecat_file_context_update},{title:s("文件回收站修改"),permission:l.oV.recycle_file_save},{title:s("文件分享"),permission:l.oV.share_file}]},{title:s("系统设置权限"),list:[{title:s("系统页面"),permission:l.oV.sys_setting_page},{title:s("tk_time"),permission:l.oV.token_update},{title:s("修改密码"),permission:l.oV.update_password},{title:s("磁盘挂载"),permission:l.oV.sys_disk_mount},{title:s("通用设置"),permission:l.oV.sys_env_setting_key},{title:s("md_set"),permission:l.oV.md_editor_setting},{title:s("目录挂载"),permission:l.oV.file_mount},{title:s("文件服务"),permission:l.oV.file_server}]},{title:s("系统环境设置"),list:[{title:s("sys_env"),permission:l.oV.sys_env_page},{title:s("up_lim"),permission:l.oV.dir_upload_max_num},{title:s("path_md"),permission:l.oV.env_path_update},{title:"pty cmd "+s("更新"),permission:l.oV.pty_cmd_update},{title:"workflow job",permission:l.oV.workflow_job},{title:s("path_up"),permission:l.oV.sys_protection_dir},{title:s("外部软件路径"),permission:l.oV.outside_software_path}]},{title:s("个人环境设置"),list:[{title:s("个性化设置"),permission:l.oV.private_sys_env}]},{title:s("标签编辑权限"),list:[{title:s("ssh代理"),permission:l.oV.ssh_proxy_tag_update},{title:s("http代理"),permission:l.oV.http_proxy_tag_update},{title:s("浏览器代理"),permission:l.oV.browser_proxy_tag_update},{title:s("rdp代理"),permission:l.oV.rdp_proxy_tag_update},{title:s("网络唤醒"),permission:l.oV.wol_proxy_tag_update},{title:s("rtsp播放器"),permission:l.oV.rtsp_proxy_tag_update}]},{title:s("代理功能"),list:[{title:s("ssh代理"),permission:l.oV.ssh_proxy},{title:s("http代理"),permission:l.oV.http_proxy},{title:s("pxy_off"),permission:l.oV.http_proxy_download_cancel},{title:s("浏览器代理"),permission:l.oV.browser_proxy},{title:s("浏览器代理编辑"),permission:l.oV.browser_proxy_edit},{title:s("rdp代理"),permission:l.oV.rdp_proxy}]},{title:s("其他功能"),list:[{title:s("wf_run"),permission:l.oV.workflow_exe},{title:s("wf_user"),permission:l.oV.workflow_exe_user,noDisable:!0},{title:s("网络唤醒"),permission:l.oV.wol_proxy},{title:s("端口扫描"),permission:l.oV.port_scan},{title:s("rtsp播放器"),permission:l.oV.rtsp_proxy},{title:s("ssh_sv"),permission:l.oV.crypto_ssh_file},{title:s("cmd_rst"),permission:l.oV.shell_cmd_filecat_restart},{title:s("cmd_upg"),permission:l.oV.shell_cmd_filecat_upgrade},{title:s("cmd_dwn"),permission:l.oV.shell_cmd_filecat_kill_self},{title:s("cmd_ai"),permission:l.oV.ai_chat_cmd}]}];return(0,C.jsx)(n.Fragment,{children:o.map((s,t)=>(0,C.jsxs)("div",{children:[(0,C.jsx)("h3",{children:s.title}),s.list.map((s,t)=>(0,C.jsxs)("div",{children:[(0,C.jsx)("input",{type:"checkbox",disabled:!s.noDisable&&e.is_disable(s.permission),checked:e.is_selected(s.permission,s.noDisable),onChange:()=>{e.select_auth(s.permission)}}),s.title]},t))]},t))})}const U=new Map;function R(){const{t:e,i18n:s}=(0,_.Bd)(),{initUserInfo:t,reloadUserInfo:p}=(0,n.useContext)(b.F),[x,j]=(0,h.fp)(u.AG.user_base_info),[f,g]=(0,n.useState)([]),[w,y]=(0,h.fp)(u.AG.prompt_card),[S,k]=(0,n.useState)(!1),[N,$]=(0,n.useState)(!1),[V,B]=(0,h.fp)(u.AG.confirm),[F,P]=(0,n.useState)(""),[X,z]=(0,n.useState)(""),[K,T]=(0,n.useState)(""),[O,M]=(0,n.useState)([]),[q,E]=(0,n.useState)([]),[D,H]=(0,n.useState)([]),[W,R]=(0,n.useState)(""),[J,L]=(0,n.useState)(""),[Q,Y]=(0,n.useState)("en"),[ee,se]=(0,n.useState)(""),[te,ne]=(0,n.useState)([]),[ie,le]=(0,n.useState)(""),[ae,oe]=(0,n.useState)(!1),[re,de]=(0,n.useState)(""),[ce,he]=(0,n.useState)(""),[ue,me]=(0,n.useState)({}),pe=(0,I.o)(),[_e,xe]=(0,n.useState)([]),[je,ve]=(0,n.useState)(void 0),fe=[e("用户id"),e("用户名"),e("目录范围"),e("备注")],ge=async()=>{const e=await d.wm.get("all_users");if(e.code===c.m.Success){const s=e.data??[];if(je){const e=[];for(const t of s)`${t.id}${t.username}${t.cwd}${t.note}`.includes(je)&&e.push(t);g(e)}else g(s)}const s=await d.wm.get("all_roles");if(s.code===c.m.Success){xe(s.data),U.clear();for(const e of s.data)U.set(e.role_id,e)}},we=e=>{P(e?.username??""),z(e?.password??""),T(e?.cwd??""),M(e?.access_dirs??[]),E(e?.not_access_dirs??[]),H(e?.only_read_dirs??[]),R(e?.access_cmd??""),L(e?.not_access_cmd??""),Y(e?.language??""),se(e?.theme??""),ne(e?.auth_list??[]),le(e?.note??""),oe(e?.is_root??!1),de(e?.id??""),e?.bind_role_id?ye(e.bind_role_id,e.auth_list??[]):(he(""),me({}))};(0,n.useEffect)(()=>{ge()},[]);const ye=(e,s=[])=>{if(!e)return he(""),void me({});const t=U.get(e);if(t){if(t.cwd&&T(t.cwd),t.access_dirs&&t.access_dirs.length>0&&M(t.access_dirs),t.not_access_dirs&&t.not_access_dirs.length>0&&E(t.not_access_dirs),t.only_read_dirs&&t.only_read_dirs.length>0&&H(t.only_read_dirs),t.access_cmd&&R(t.access_cmd),t.not_access_cmd&&L(t.not_access_cmd),t.language&&Y(t.language),t.theme&&se(t.theme),t.auth_list&&t.auth_list.length>0){const e=new Set(t.auth_list);for(const t of s)e.add(t);ne(Array.from(e))}he(e),me(t)}},be=()=>{if(!F)return void(0,v.zN)("username not empty");if((0,Z.CB)(F))return void(0,v.zN)("username not empty char");if(!K)return void(0,v.zN)("cwd not empty");const e=new l.E0;return e.language=Q,e.theme=ee,e.access_dirs=O,e.username=F,e.password=X,e.not_access_dirs=q,e.only_read_dirs=D,e.cwd=K,e.note=ie,e.access_cmd=W,e.not_access_cmd=J,e.auth_list=te,e.bind_role_id=ce,e};return(0,C.jsxs)(i.fI,{children:[(0,C.jsx)(i.VP,{widthPer:50,maxWidth:"40rem",children:(0,C.jsx)(i.xh,{children:(0,C.jsx)(a.uF,{self_title:(0,C.jsx)("span",{className:" div-row ",children:(0,C.jsx)("h2",{children:e("用户")})}),rightTopCom:(0,C.jsxs)("div",{className:"div-row",style:{gap:"0.5rem"},children:[(0,C.jsx)(r.Sm,{placeholder:e("过滤"),value:je,handleInputChange:e=>{ve(e)},handlerEnter:()=>{ge()}}),(0,C.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{k(!0),$(!1),we(void 0)}})]}),children:(0,C.jsx)(m.X,{headers:fe,rows:f.map((s,t)=>{const n=[(0,C.jsx)("p",{children:s.id}),(0,C.jsx)(a.xP,{children:s.username}),(0,C.jsx)(a.xP,{children:s.cwd}),(0,C.jsx)(a.xP,{children:s.note}),(0,C.jsxs)("div",{children:[(0,C.jsx)(o.rA,{icon:"edit",title:e("编辑"),onClick:()=>(e=>{k(!1),$(!0),we(e)})(s)}),!s.is_root&&(0,C.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(async s=>{B({open:!0,title:e("确定删除吗"),handle:async()=>{const t=new l.E0;t.username=s,(await d.wm.post("delete_user",t)).code===c.m.Success&&((0,v.SK)(e("删除完成")),ge(),B({open:!1,handle:null}))}})})(s.username)})]})];return n}),width:"10rem"})})})}),(0,C.jsx)(i.VP,{widthPer:50,maxWidth:"40rem",children:(S||N)&&(0,C.jsx)(i.xh,{children:(0,C.jsxs)(a.Zp,{self_title:(0,C.jsxs)("span",{className:" div-row ",children:[(0,C.jsx)("h2",{children:e(""+(S?"添加":"编辑"))})," "]}),rightBottomCom:(0,C.jsxs)("div",{children:[(0,C.jsx)(o.rA,{icon:"cancel",title:e("取消"),onClick:()=>{k(!1),$(!1),we(void 0)}}),S&&(0,C.jsx)(o.rA,{icon:"add_circle",title:e("添加"),onClick:async()=>{if(!X)return void(0,v.zN)("password not empty");if((0,Z.CB)(X))return void(0,v.zN)("username not empty char");const s=be(),t=await d.wm.post("create_user",s);ge(),t.code===c.m.Success&&((0,v.SK)(e("创建完成")),ge(),k(!1),$(!1),we(void 0))}}),N&&(0,C.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{const s=be();if(!s)return;s.id=re;(await d.wm.post("save_user",s)).code===c.m.Success&&((0,v.SK)(e("保存完成")),ge())}})]}),children:[(0,C.jsx)("label",{children:e("用户名")}),(0,C.jsx)(r.Sm,{value:F,handleInputChange:e=>P(e)}),(0,C.jsx)("label",{children:e("密码")}),(0,C.jsx)(r.Sm,{type:"password",value:X,handleInputChange:e=>z(e)}),(0,C.jsxs)("label",{children:[!ue?.access_dirs?.length&&(0,C.jsx)(o.rA,{icon:"add",onClick:()=>{M([...O,""])},title:"添加"}),e("目录范围")]}),(0,C.jsx)(r.Sm,{disabled:""!==ue.cwd&&void 0!==ue.cwd,value:K,handleInputChange:e=>T(e)}),(O??[]).map((s,t)=>(0,C.jsxs)("div",{style:{display:"flex"},children:[(0,C.jsx)("div",{style:{width:"90%"},children:(0,C.jsx)(r.Sm,{disabled:0!==ue?.access_dirs?.length&&void 0!==ue?.access_dirs?.length,value:s,handleInputChange:e=>{O[t]=e,M([...O])}})}),0===ue?.access_dirs?.length||void 0===ue?.access_dirs?.length&&(0,C.jsx)(o.rA,{icon:"delete",onClick:()=>{O.splice(t,1),M([...O])},title:e("删除")})]},t)),(0,C.jsxs)("label",{children:[!ue?.not_access_dirs?.length&&(0,C.jsx)(o.rA,{icon:"add",onClick:()=>{E([...q,""])},title:e("添加")}),e("禁止目录范围")]}),(q??[]).map((s,t)=>(0,C.jsxs)("div",{style:{display:"flex"},children:[(0,C.jsx)("div",{style:{width:"90%"},children:(0,C.jsx)(r.Sm,{disabled:0!==ue?.not_access_dirs?.length&&void 0!==ue?.not_access_dirs?.length,value:s,handleInputChange:e=>{q[t]=e,E([...q])}})}),0===ue?.not_access_dirs?.length||void 0===ue?.not_access_dirs?.length&&(0,C.jsx)(o.rA,{icon:"delete",onClick:()=>{q.splice(t,1),E([...q])},title:e("删除")})]},t)),(0,C.jsxs)("label",{children:[!ue?.only_read_dirs?.length&&(0,C.jsx)(o.rA,{icon:"add",onClick:()=>{H([...D,""])},title:e("添加")}),e("只读目录范围")]}),(D??[]).map((s,t)=>(0,C.jsxs)("div",{style:{display:"flex"},children:[(0,C.jsx)("div",{style:{width:"90%"},children:(0,C.jsx)(r.Sm,{disabled:0!==ue?.only_read_dirs?.length&&void 0!==ue?.only_read_dirs?.length,value:s,handleInputChange:e=>{D[t]=e,H([...D])}})}),0===ue?.only_read_dirs?.length||void 0===ue?.only_read_dirs?.length&&(0,C.jsx)(o.rA,{icon:"delete",onClick:()=>{D.splice(t,1),H([...D])},title:e("删除")})]},t)),(0,C.jsx)("label",{children:e("可执行的命令")}),(0,C.jsx)(r.Sm,{disabled:""!==ue.access_cmd&&void 0!==ue.access_cmd,value:W,placeholder:"use blank split",handleInputChange:e=>R(e)}),(0,C.jsx)("label",{children:e("禁止执行的命令")}),(0,C.jsx)(r.Sm,{disabled:""!==ue.not_access_cmd&&void 0!==ue.not_access_cmd,value:J,placeholder:"use blank split",handleInputChange:e=>L(e)}),!ae&&(0,C.jsxs)(n.Fragment,{children:[(0,C.jsx)("label",{children:e("角色")}),(0,C.jsx)(r.l6,{value:ce,onChange:e=>{ye(e)},options:(()=>{const e=[];e.push({title:"NOT",value:""});for(let s of _e)e.push({title:s.role_name,value:s.role_id});return e})()})]}),(0,C.jsx)("label",{children:e("语言")}),(0,C.jsx)(r.l6,{disabled:""!==ue.language&&void 0!==ue.language,value:Q,onChange:e=>{Y(e)},options:[{title:e("跟随系统"),value:"sys"},{title:"English",value:"en"},{title:"中文",value:"zh"}]}),(0,C.jsx)("label",{children:e("主题")}),(0,C.jsx)(r.l6,{disabled:""!==ue.theme&&void 0!==ue.theme,value:ee,onChange:e=>{se(e)},options:pe}),(0,C.jsx)(G,{is_disable:e=>{if(!0===ae)return!0;if(ce){const s=U.get(ce);if(s)return(s.auth_list??[]).includes(e)}return!1},is_selected:(e,s)=>!s&&!0===ae||void 0!==te?.find(s=>s===e),select_auth:e=>{te?te.includes(e)?((0,A.I)(te,s=>s===e),ne([...te])):ne([...te,e]):ne([e])}}),(0,C.jsx)("label",{children:e("备注")}),(0,C.jsx)(r.Sm,{value:ie,handleInputChange:e=>le(e)})]})})})]})}function J(){const{t:e,i18n:s}=(0,_.Bd)(),{initUserInfo:t}=(0,n.useContext)(b.F),[p,x]=(0,n.useState)([]),[j,f]=(0,h.fp)(u.AG.prompt_card),[g,w]=(0,n.useState)(!1),[y,S]=(0,n.useState)(!1),[k,N]=(0,h.fp)(u.AG.confirm),[$,V]=(0,n.useState)(""),[B,F]=(0,n.useState)(""),[P,X]=(0,n.useState)([]),[z,K]=(0,n.useState)([]),[T,O]=(0,n.useState)([]),[M,q]=(0,n.useState)(""),[E,D]=(0,n.useState)(""),[H,W]=(0,n.useState)(""),[Z,U]=(0,n.useState)(""),[R,J]=(0,n.useState)([]),[L,Q]=(0,n.useState)(""),[Y,ee]=(0,n.useState)(""),se=(0,I.o)(),te=[e("角色id"),e("角色名"),e("备注")],ne=async()=>{const e=await d.wm.get("all_roles");e.code===c.m.Success&&x(e.data)},ie=e=>{V(e?.role_name??""),F(e?.cwd??""),X(e?.access_dirs??[]),K(e?.not_access_dirs??[]),O(e?.only_read_dirs??[]),q(e?.access_cmd??""),D(e?.not_access_cmd??""),W(e?.language??""),U(e?.theme??""),J(e?.auth_list??[]),Q(e?.role_id??""),ee(e?.role_note??"")};(0,n.useEffect)(()=>{ne()},[]);const le=()=>{if(!$)return void(0,v.zN)("role_name not empty");const e=new l.E0;return e.language=H,e.theme=Z,e.access_dirs=P,e.role_name=$,e.not_access_dirs=z,e.only_read_dirs=T,e.cwd=B,e.access_cmd=M,e.not_access_cmd=E,e.auth_list=R,e.role_note=Y,e};return(0,C.jsxs)(i.fI,{children:[(0,C.jsx)(i.VP,{widthPer:50,maxWidth:"40rem",children:(0,C.jsx)(i.xh,{children:(0,C.jsx)(a.uF,{self_title:(0,C.jsx)("span",{className:" div-row ",children:(0,C.jsx)("h2",{children:e("角色")})}),rightTopCom:(0,C.jsx)("div",{children:(0,C.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{w(!0),S(!1),ie(void 0)}})}),children:(0,C.jsx)(m.X,{headers:te,rows:p.map((s,t)=>{const n=[(0,C.jsx)("p",{children:s.role_id}),(0,C.jsx)(a.xP,{children:s.role_name}),(0,C.jsx)(a.xP,{children:s.role_note}),(0,C.jsxs)("div",{children:[(0,C.jsx)(o.rA,{icon:"edit",title:e("编辑"),onClick:()=>(e=>{w(!1),S(!0),ie(e)})(s)}),!s.is_root&&(0,C.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(async s=>{N({open:!0,title:e("确定删除吗"),handle:async()=>{const t=new l.E0;t.role_id=s,(await d.wm.post("delete_role",t)).code===c.m.Success&&((0,v.SK)(e("删除完成")),ne(),N({open:!1,handle:null}))}})})(s.role_id)})]})];return n}),width:"10rem"})})})}),(0,C.jsx)(i.VP,{widthPer:50,maxWidth:"40rem",children:(g||y)&&(0,C.jsx)(i.xh,{children:(0,C.jsxs)(a.Zp,{self_title:(0,C.jsxs)("span",{className:" div-row ",children:[(0,C.jsx)("h2",{children:e(""+(g?"添加":"编辑"))})," "]}),rightBottomCom:(0,C.jsxs)("div",{children:[(0,C.jsx)(o.rA,{icon:"cancel",title:e("取消"),onClick:()=>{w(!1),S(!1),ie(void 0)}}),g&&(0,C.jsx)(o.rA,{icon:"add_circle",title:e("添加"),onClick:async()=>{const s=le();if(!s)return;const t=await d.wm.post("create_role",s);ne(),t.code===c.m.Success&&((0,v.SK)(e("创建完成")),ne(),w(!1),S(!1),ie(void 0))}}),y&&(0,C.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{const s=le();if(!s)return;s.role_id=L;(await d.wm.post("save_role",s)).code===c.m.Success&&((0,v.SK)(e("保存完成")),ne())}})]}),children:[(0,C.jsx)("label",{children:e("角色名")}),(0,C.jsx)(r.Sm,{value:$,handleInputChange:e=>V(e)}),(0,C.jsx)("label",{children:e("角色备注")}),(0,C.jsx)(r.Sm,{value:Y,handleInputChange:e=>ee(e)}),(0,C.jsxs)("label",{children:[(0,C.jsx)(o.rA,{icon:"add",onClick:()=>{X([...P,""])},title:"添加"}),e("目录范围")]}),(0,C.jsx)(r.Sm,{value:B,handleInputChange:e=>F(e)}),(P??[]).map((e,s)=>(0,C.jsxs)("div",{style:{display:"flex"},children:[(0,C.jsx)("div",{style:{width:"90%"},children:(0,C.jsx)(r.Sm,{value:e,handleInputChange:e=>{P[s]=e,X([...P])}})}),(0,C.jsx)(o.rA,{icon:"delete",onClick:()=>{P.splice(s,1),X([...P])},title:"删除"})]},s)),(0,C.jsxs)("label",{children:[(0,C.jsx)(o.rA,{icon:"add",onClick:()=>{K([...z,""])},title:"添加"}),e("禁止目录范围")]}),(z??[]).map((s,t)=>(0,C.jsxs)("div",{style:{display:"flex"},children:[(0,C.jsx)("div",{style:{width:"90%"},children:(0,C.jsx)(r.Sm,{value:s,handleInputChange:e=>{z[t]=e,K([...z])}})}),(0,C.jsx)(o.rA,{icon:"delete",onClick:()=>{z.splice(t,1),K([...z])},title:e("删除")})]},t)),(0,C.jsxs)("label",{children:[(0,C.jsx)(o.rA,{icon:"add",onClick:()=>{O([...T,""])},title:e("添加")}),e("只读目录范围")]}),(T??[]).map((e,s)=>(0,C.jsxs)("div",{style:{display:"flex"},children:[(0,C.jsx)("div",{style:{width:"90%"},children:(0,C.jsx)(r.Sm,{value:e,handleInputChange:e=>{T[s]=e,O([...T])}})}),(0,C.jsx)(o.rA,{icon:"delete",onClick:()=>{T.splice(s,1),O([...T])},title:"删除"})]},s)),(0,C.jsx)("label",{children:e("可执行的命令")}),(0,C.jsx)(r.Sm,{value:M,placeholder:"use blank split",handleInputChange:e=>q(e)}),(0,C.jsx)("label",{children:e("禁止执行的命令")}),(0,C.jsx)(r.Sm,{value:E,placeholder:"use blank split",handleInputChange:e=>D(e)}),(0,C.jsx)("label",{children:e("语言")}),(0,C.jsx)(r.l6,{value:H,onChange:e=>{W(e)},options:[{title:e("跟随系统"),value:"sys"},{title:"NOT",value:""},{title:"English",value:"en"},{title:"中文",value:"zh"}]}),(0,C.jsx)("label",{children:e("主题")}),(0,C.jsx)(r.l6,{value:Z,onChange:e=>{U(e)},options:se}),(0,C.jsx)(G,{is_disable:()=>!1,is_selected:(e,s)=>void 0!==R?.find(s=>s===e),select_auth:e=>{R?(R.find(s=>s==e)?(0,A.I)(R,s=>s===e):R.push(e),J([...R])):J([e])}})]})})})]})}var L=t(93245);function Q(e){const{t:s}=(0,_.Bd)(),[t,i]=(0,n.useState)((e.children_list??[]).map(e=>({path:e.path,note:e.note}))),l=[s("编号"),s("目录"),s("备注")],d=()=>{i([...t,{path:"",note:""}])};(0,n.useEffect)(()=>{t?.length||d()});return(0,C.jsx)(a.uF,{self_title:(0,C.jsx)("span",{className:" div-row ",children:(0,C.jsx)("h2",{children:s("sub_dir")})}),rightTopCom:(0,C.jsxs)("div",{children:[(0,C.jsx)(o.rA,{icon:"add",title:s("添加"),onClick:d}),(0,C.jsx)(o.rA,{icon:"save",title:s("保存"),onClick:()=>{e.on_confirm(t.filter(e=>e.path))}}),(0,C.jsx)(o.rA,{icon:"close",title:s("取消"),onClick:e.on_cancel})]}),children:(0,C.jsx)(m.X,{headers:l,rows:t.map((e,n)=>[(0,C.jsx)("span",{children:n}),(0,C.jsx)(r.Sm,{value:e.path,handleInputChange:s=>{e.path=s},no_border:!0}),(0,C.jsx)(r.Sm,{value:e.note,handleInputChange:s=>{e.note=s},no_border:!0}),(0,C.jsx)("div",{children:(0,C.jsx)(o.rA,{icon:"delete",title:s("删除"),onClick:()=>{i(t.filter((e,s)=>s!==n))}})})]),width:"10rem"})})}function Y(){const{t:e,i18n:s}=(0,_.Bd)(),{initUserInfo:t,reloadUserInfo:x}=(0,n.useContext)(b.F),[j,f]=(0,n.useState)([]),[w,y]=(0,h.fp)(u.AG.prompt_card),[S,k]=(0,n.useState)([]),[N,$]=(0,n.useState)([]),[V,B]=(0,n.useState)([]),[F,P]=(0,h.fp)(u.AG.user_base_info),X=(0,H.K)(),z=(0,I.o)(),K=[e("编号"),e("路径"),e("是否默认"),e("备注"),e("sub_dir")],T=[e("编号"),e("路径"),e("备注")],O=[e("编号"),e("命令"),e("父编号"),e("备注")],M=[e("文件后缀"),e("命令"),e("其他参数"),e("备注")],[q,E]=(0,n.useState)(""),[D,W]=(0,n.useState)(""),[Z,G]=(0,n.useState)(""),[U,R]=(0,n.useState)(!1),[J,Y]=(0,n.useState)(""),[ee,se]=(0,n.useState)(""),[te,ne]=(0,n.useState)(""),[ie,le]=(0,n.useState)(!1),[ae,oe]=(0,n.useState)(""),[re,de]=(0,n.useState)([]);(0,n.useEffect)(()=>{(async()=>{const e=await d.XO.get("filesSetting");e.code===c.m.Success&&(f(e.data.dirs),$(e.data.quick_cmd),B(e.data.file_quick_cmd));const s=await d.XO.get("protection_dir");s.code===c.m.Success&&k(s.data??[])})(),Y(F?.user_data?.language),se(F?.user_data?.theme),ne(F?.user_data?.upload_file_ignore);const e=F?.user_data?.editor_auto_save;le(!!e?.enable),oe(null!=e?.interval?String(e.interval):""),de(e?.editors??[])},[]);const ce=(0,I.Q)();return(0,C.jsx)(n.Fragment,{children:(0,C.jsxs)(i.fI,{children:[(0,C.jsxs)(i.VP,{widthPer:33,children:[(0,C.jsx)(i.xh,{children:(0,C.jsxs)(a.Zp,{title:e("修改密码"),rightBottomCom:(0,C.jsx)(o.C3,{text:e("确定修改"),clickFun:async()=>{if(!q||!D)return void(0,v.zN)(e("账号密码不能为空"));if(D!==Z)return void(0,v.zN)(e("两次密码不一样"));const s=new l.tl;s.username=q,s.password=D,s.confirm_password=Z,s.user_id=F.user_data.id;(await d.wm.post("updatePassword",s)).code===c.m.Success&&(0,v.SK)(e("修改成功"))}}),children:[(0,C.jsx)(r.Sm,{placeholder:e("新账号"),value:q,handleInputChange:e=>{E(e)}}),(0,C.jsx)(r.cA,{placeholder:e("新密码"),handleInputChange:e=>{W(e)}}),(0,C.jsx)(r.cA,{placeholder:e("确认密码"),handleInputChange:e=>{G(e)}})]})}),(0,C.jsx)(i.xh,{children:(0,C.jsxs)(a.Zp,{title:e("个性化设置"),rightBottomCom:(0,C.jsx)(o.C3,{text:e("确定修改"),clickFun:async()=>{(await d.XO.post(g.s.setting_sys_option_status_save,{type:p.Mu.private_sys_env,value:{language:J,theme:ee,upload_file_ignore:te}})).code===c.m.Success&&((0,v.SK)(e("修改成功")),t())}}),children:[e("语言"),(0,C.jsx)(r.l6,{value:J,onChange:e=>{Y(e)},options:[{title:e("跟随系统"),value:"sys"},{title:"English",value:"en"},{title:"中文",value:"zh"},{title:"Deutsch",value:"de"},{title:"ドイツ語",value:"ja"},{title:"독일어",value:"ko"},{title:"Немецкий язык",value:"ru"},{title:"Allemand",value:"fr"},{title:"Alemán",value:"es"}]}),e("主题"),(0,C.jsx)(r.l6,{value:ee,onChange:e=>{se(e)},options:z}),(0,C.jsx)(r.Sm,{value:te,handleInputChange:e=>{ne(e)},placeholderOut:e("拖拽文件上传忽略列表"),placeholder:"node_modules *.js",no_border:!0})]})}),(0,C.jsx)(i.xh,{children:(0,C.jsxs)(a.Zp,{title:e("编辑器自动保存"),rightBottomCom:(0,C.jsx)(o.C3,{text:e("确定修改"),clickFun:async()=>{const s=parseInt(String(ae),10);if(isNaN(s)||s<1)return void(0,v.zN)(e("请输入不小于 1 的整数(秒)"));(await d.wm.post(g.s.user_save_private_attr,{is_editor_auto_save:!0,editor_auto_save:{enable:ie,interval:s,editors:re}})).code===c.m.Success&&((0,v.SK)(e("修改成功")),t())}}),children:[(0,C.jsx)(r.BC,{label:e("开启"),children:(0,C.jsx)(r.l6,{value:ie,onChange:e=>{le(e)},options:X,no_border:!0})}),(0,C.jsx)(r.BC,{label:e("自动保存间隔(秒)"),children:(0,C.jsx)(r.Sm,{type:"number",value:ae,handleInputChange:e=>{oe(e)},placeholder:"30",no_border:!0})}),(0,C.jsx)("h3",{children:e("编辑器")}),L.d.map(s=>(0,C.jsxs)("div",{children:[(0,C.jsx)("input",{type:"checkbox",checked:re.includes(s.id),onChange:e=>{const t=e.target.checked;de(t?[...re,s.id]:re.filter(e=>e!==s.id))}}),e(s.label)]},s.id))]})})]}),(0,C.jsxs)(i.VP,{children:[(0,C.jsxs)(i.xh,{children:[(0,C.jsx)(a.uF,{self_title:(0,C.jsxs)("span",{className:" div-row ",children:[(0,C.jsx)("h2",{children:e("文件夹路径")})," ",(0,C.jsx)(o.rA,{icon:"info",onClick:()=>{ce("文件夹路径")},title:e("信息")})]}),rightTopCom:(0,C.jsxs)("div",{children:[(0,C.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{f([...j,{note:"",default:!1,path:""}])}}),(0,C.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{for(let e=0;e<j.length;e++)j[e].index=e;(await d.XO.post("filesSetting/save",{dirs:j})).code===c.m.Success&&((0,v.SK)(e("保存成功")),x(),t())}})]}),children:(0,C.jsx)(m.X,{headers:K,rows:j.map((s,t)=>{const n=[(0,C.jsx)("div",{children:t}),(0,C.jsx)(r.Sm,{value:s.path,handleInputChange:e=>{s.path=e},no_border:!0}),(0,C.jsx)(r.l6,{value:s.default,onChange:e=>{((e,s,t)=>{const n=[];for(let e=0;e<j.length;e++)j[e].default=e===t&&s,n.push(j[e]);f(n)})(0,e,t)},options:X,no_border:!0}),(0,C.jsx)(r.Sm,{value:s.note,handleInputChange:e=>{s.note=e},no_border:!0}),(0,C.jsxs)("div",{className:"div-row",children:[(0,C.jsx)("span",{children:s.children?.length??0}),0!==t&&(0,C.jsx)(o.rA,{icon:"folder_open",title:e("sub_dir"),onClick:()=>(e=>{y({open:!0,main_context_div:(0,C.jsx)(Q,{children_list:e.children,on_cancel:()=>{y({open:!1})},on_confirm:s=>{e.children=s,f([...j]),y({open:!1})}})})})(s)})]}),(0,C.jsx)("div",{children:0!==t&&(0,C.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{j.splice(e,1),f([...j])})(t)})})];return n}),width:"10rem",onRowDrag:(e,s)=>{0!==e&&0!==s&&f((0,A.TI)(j,e,s))}})}),(0,C.jsx)(a.uF,{self_title:(0,C.jsxs)("span",{className:" div-row ",children:[(0,C.jsx)("h2",{children:e("个人保护路径")})," ",(0,C.jsx)(o.rA,{icon:"info",onClick:()=>{ce("保护目录")},title:e("信息")})]}),rightTopCom:(0,C.jsxs)("div",{children:[(0,C.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{k([...S,{path:"",note:""}])}}),(0,C.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await d.XO.post("protection_dir/save",S)).code===c.m.Success&&((0,v.SK)(e("保存成功")),x())}})]}),children:(0,C.jsx)(m.X,{headers:T,rows:S.map((s,t)=>{const n=[(0,C.jsx)("div",{children:t}),(0,C.jsx)(r.Sm,{value:s.path,handleInputChange:e=>{s.path=e},no_border:!0}),(0,C.jsx)(r.Sm,{value:s.note,handleInputChange:e=>{s.note=e},no_border:!0}),(0,C.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{S.splice(e,1),k([...S])})(t)})];return n}),width:"10rem",onRowDrag:(e,s)=>{k((0,A.TI)(S,e,s))}})})]}),(0,C.jsxs)(i.xh,{children:[(0,C.jsx)(a.uF,{self_title:(0,C.jsxs)("span",{className:" div-row ",children:[(0,C.jsx)("h2",{children:e("目录快捷命令")}),(0,C.jsx)(o.rA,{icon:"info",onClick:()=>{ce("目录快捷命令")},title:"info"})]}),rightTopCom:(0,C.jsxs)("div",{children:[(0,C.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{$([...N,{cmd:"",note:""}])}}),(0,C.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await d.XO.post("filesSetting/save",{quick_cmd:N})).code===c.m.Success&&((0,v.SK)(e("保存成功")),t())}})]}),children:(0,C.jsx)(m.X,{headers:O,rows:N.map((s,t)=>{const n=[(0,C.jsx)(r.Sm,{value:s.index,handleInputChange:e=>{s.index=e},no_border:!0}),(0,C.jsx)(r.Sm,{value:s.cmd,handleInputChange:e=>{s.cmd=e},no_border:!0}),(0,C.jsx)(r.Sm,{value:s.father_index,handleInputChange:e=>{s.father_index=e},no_border:!0}),(0,C.jsx)(r.Sm,{value:s.note,handleInputChange:e=>{s.note=e},no_border:!0}),(0,C.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{N.splice(e,1),$([...N])})(t)})];return n}),width:"10rem",onRowDrag:(e,s)=>{$((0,A.TI)(N,e,s))}})}),(0,C.jsx)(a.uF,{self_title:(0,C.jsxs)("span",{className:" div-row ",children:[(0,C.jsx)("h2",{children:e("文件快捷命令")}),(0,C.jsx)(o.rA,{icon:"info",onClick:()=>{ce("文件快捷命令")},title:"info"})]}),rightTopCom:(0,C.jsxs)("div",{children:[(0,C.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{B([...V,{cmd:"",note:"",file_suffix:"",params:""}])}}),(0,C.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await d.XO.post("filesSetting/save",{file_quick_cmd:V})).code===c.m.Success&&((0,v.SK)(e("保存成功")),t())}})]}),children:(0,C.jsx)(m.X,{headers:M,rows:V.map((s,t)=>{const n=[(0,C.jsx)(r.Sm,{value:s.file_suffix,handleInputChange:e=>{s.file_suffix=e},no_border:!0}),(0,C.jsx)(r.Sm,{value:s.cmd,handleInputChange:e=>{s.cmd=e},no_border:!0}),(0,C.jsx)(r.Sm,{value:s.params,handleInputChange:e=>{s.params=e},no_border:!0}),(0,C.jsx)(r.Sm,{value:s.note,handleInputChange:e=>{s.note=e},no_border:!0}),(0,C.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{V.splice(e,1),B([...V])})(t)})];return n}),width:"10rem",onRowDrag:(e,s)=>{B((0,A.TI)(V,e,s))}})})]})]})]})})}var ee=t(16445),se=t(45907),te=t(17903);function ne(){const{t:e}=(0,_.Bd)(),s=(0,se.y)(),[t,l]=(0,n.useState)([]),[c,h]=(0,n.useState)([]),[u,p]=(0,n.useState)([]),[x,j]=(0,n.useState)(!1),[f,g]=(0,n.useState)(""),[w,y]=(0,n.useState)("webdav"),[b,S]=(0,n.useState)(""),[k,A]=(0,n.useState)(""),[I,N]=(0,n.useState)(""),[$,V]=(0,n.useState)(""),[B,F]=(0,n.useState)(""),[P,X]=(0,n.useState)(!1),z=async()=>{try{const[e,s,t]=await Promise.all([d.I2.post("list",{}),d.I2.post("credential/list",{}),d.I2.post("driver/list",{})]);l(Array.isArray(e?.data)?e.data:[]),h(Array.isArray(s?.data)?s.data:[]),p(Array.isArray(t?.data)?t.data:[])}catch(e){}};(0,n.useEffect)(()=>{z()},[]);const K=(0,te.p_)(k,c),T=(0,te.ln)(k,c),O=()=>{j(!1),g(""),y("webdav"),S(""),A(""),N(""),V(""),F(""),X(!1)},M=u.find(e=>e.type===w),q="share"===M?.location,E="local"===M?.location,D=(c.find(e=>e.id===k)?.local_sources??[]).map(e=>({title:`${e.name}(${e.path})`,value:e.name}));return(0,C.jsxs)(i.fI,{children:[(0,C.jsx)(i.VP,{widthPer:50,maxWidth:"40rem",children:(0,C.jsx)(i.xh,{children:(0,C.jsx)(a.uF,{self_title:(0,C.jsx)("span",{className:" div-row ",children:(0,C.jsx)("h2",{children:e("网盘挂载")})}),rightTopCom:(0,C.jsx)("div",{className:"div-row",children:(0,C.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{O(),j(!0)}})}),children:(0,C.jsx)(m.X,{headers:[e("备注"),e("挂载类型"),e("凭据"),e("账号"),e("操作")],rows:t.map(t=>{const n=c.find(e=>e.id===t.credential_id),i=(n?.accounts??[]).find(e=>e.id===t.account_id);return[(0,C.jsx)(a.xP,{context:t.note||"-"}),(0,C.jsx)("p",{children:(l=t.driver,u.find(e=>e.type===l)?.name??l)}),(0,C.jsx)(a.xP,{context:n?n.note:e("凭据已丢失")}),(0,C.jsx)(a.xP,{context:t.account_id?i?i.note||i.account_name||i.nickname||i.id:e("账号已丢失"):"-"}),(0,C.jsxs)("div",{children:[(0,C.jsx)(o.rA,{icon:"edit",title:e("编辑"),onClick:()=>(e=>{j(!0),g(e.id),y(e.driver),S(e.mount_path??""),A(e.credential_id??""),N(e.account_id??""),V(e.root_dir??""),F(e.note??""),X(Boolean(e.forward_to_remote))})(t)}),(0,C.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(async t=>{s({title:e("确认删除"),sub_title:t.mount_path,confirm_fun:async()=>{try{await d.I2.post("delete",{id:t.id}),(0,v.SK)(e("已删除")),await z()}catch(e){}}})})(t)})]})];var l})})})})}),(0,C.jsx)(i.VP,{widthPer:50,maxWidth:"40rem",children:x&&(0,C.jsx)(i.xh,{children:(0,C.jsxs)(a.Zp,{self_title:(0,C.jsx)("span",{className:" div-row ",children:(0,C.jsx)("h2",{children:e(f?"编辑":"添加")})}),rightBottomCom:(0,C.jsxs)("div",{children:[(0,C.jsx)(o.rA,{icon:"network_check",title:e("测试连接"),onClick:async()=>{if(k)try{const s=await d.I2.post("test",{id:f||void 0,driver:w,credential_id:k,account_id:I,root_dir:$}),t=s?.data;t?.ok?(0,v.SK)(`${e("连接成功")}(${t.count??0})`):(0,v.zN)(`${e("连接失败")}:${t?.error??""}`)}catch(e){}else(0,v.zN)(e("请选择凭据"))}}),(0,C.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{if(k)if(!T||I)if(b.trim())try{await d.I2.post(f?"update":"add",{id:f||void 0,driver:w,mount_path:b,credential_id:k,account_id:T?I:void 0,root_dir:$,note:B,color:te.OT,readonly:!1,enabled:!0,forward_to_remote:P}),(0,v.SK)(e("保存成功")),O(),await z()}catch(e){}else(0,v.zN)(e("munt_rq"));else(0,v.zN)(e("请选择账号"));else(0,v.zN)(e("请选择凭据"))}}),(0,C.jsx)(o.rA,{icon:"cancel",title:e("取消"),onClick:O})]}),children:[(0,C.jsx)(r.BC,{label:e("挂载类型"),label_width:"6rem",children:(0,C.jsx)(r.l6,{value:w,options:u.map(e=>({title:e.name,value:e.type})),onChange:e=>{y(e),A(""),N(""),V("")}})}),(0,C.jsx)(r.BC,{label:e("凭据"),label_width:"6rem",required:!0,children:(0,C.jsx)(r.l6,{value:k,options:(H=w,(0,te.XT)(H,c)),onChange:e=>{A(e),N(""),V("")}})}),T&&(0,C.jsx)(r.BC,{label:e("账号"),label_width:"6rem",required:!0,children:(0,C.jsx)(r.l6,{value:I,options:K,onChange:N})}),(0,C.jsx)(r.BC,{label:e("本地目录"),label_width:"6rem",required:!0,children:(0,C.jsx)(r.Sm,{placeholder:e("被挂载的本地绝对路径"),value:b,handleInputChange:S})}),q&&(0,C.jsx)(r.BC,{label:e("s3_bucket"===M?.location_label?"存储桶":"共享目录"),label_width:"6rem",required:!0,children:(0,C.jsx)(ee.A,{driver:w,credential_id:k,account_id:I,require_account:T,editable:!0,value:$,onChange:V})}),E&&(0,C.jsxs)(r.BC,{label:e("源目录"),label_width:"6rem",required:!0,children:[(0,C.jsx)(r.l6,{value:$,options:D,placeholder:e("选择源目录"),onChange:e=>V(e)}),(0,C.jsx)(r.Sm,{value:String($??""),placeholder:e("src_dir_ph"),handleInputChange:e=>V(String(e??"").trim())})]}),!q&&!E&&(0,C.jsx)(r.BC,{label:e("smb"===w||"s3"===w?"子路径":"baidu"===w?"网盘目录":"tcp_proxy"===w?"对端目录":"目录"),label_width:"6rem",children:(0,C.jsx)(ee.A,{driver:w,credential_id:k,account_id:I,require_account:T,editable:!0,editable_placeholder:"sftp"===w?e("sftp_path_ph"):void 0,value:$,onChange:V})}),(0,C.jsx)(r.BC,{label:e("备注"),label_width:"6rem",children:(0,C.jsx)(r.Sm,{placeholder:e("列表显示的名称"),value:B,handleInputChange:F})}),"tcp_proxy"===w&&(0,C.jsx)(r.BC,{label:e("ftr2rmt"),label_width:"6rem",children:(0,C.jsx)(o.Ay,{checked:P,onChange:X,title:e("ftr2rmt_tip")})})]})})})]});var H}function ie(){const{t:e}=(0,_.Bd)(),{check_user_auth:s}=(0,j.MH)(),t=s(l.oV.file_mount),[r,c]=(0,h.fp)(u.AG.mount_enabled);(0,n.useEffect)(()=>{t&&(async()=>{try{const e=await d.I2.post("enabled/get",{});c(!0===e?.data)}catch(e){c(!1)}})()},[t]);return t?(0,C.jsxs)(n.Fragment,{children:[(0,C.jsxs)(x.aZ,{position:"right",children:[(0,C.jsx)("span",{className:"header-label",children:e("总开关")}),(0,C.jsx)(o.rA,{icon:!0===r?"cloud_done":"cloud_off",title:e(!0===r?"muntont":"muntoff"),selected:!0===r,onClick:async()=>{const s=!r;try{const t=await d.I2.post("enabled/set",{enabled:s}),n=!0===t?.data;c(n),(0,v.SK)(e(n?"挂载已启用":"挂载已停用"))}catch(e){}}})]}),(0,C.jsx)(i.xh,{children:(0,C.jsx)(i.fI,{children:(0,C.jsx)(i.VP,{widthPer:100,maxWidth:"90rem",children:(0,C.jsx)(ne,{})})})})]}):(0,C.jsx)(i.fI,{children:(0,C.jsx)(i.VP,{children:(0,C.jsx)(a.Zp,{self_title:(0,C.jsx)("h2",{children:e("网盘挂载")}),children:(0,C.jsx)("p",{children:e("nmuntpr")})})})})}var le=t(47996);const ae="webdav",oe="@authorize",re="@tcp_account",de={baidu:[{keys:["baidu_app_id","baidu_app_key","baidu_secret_key"],on_next:"save_app"},{keys:[oe]}],tcp_proxy:[{keys:["tcp_client_num_id"],on_next:"save_app"},{keys:[re]}]};function ce(){const{t:e}=(0,_.Bd)(),s=(0,se.y)(),[,t]=(0,h.fp)(u.AG.prompt_card),[l,c]=(0,n.useState)([]),[p,x]=(0,n.useState)([]),[j,f]=(0,n.useState)(!1),[g,w]=(0,n.useState)(""),[y,b]=(0,n.useState)(ae),[S,k]=(0,n.useState)(""),[A,I]=(0,n.useState)({}),[N,$]=(0,n.useState)({}),[V,B]=(0,n.useState)("oob"),[F,P]=(0,n.useState)(""),[X,z]=(0,n.useState)([]),[K,T]=(0,n.useState)(!0),O=async()=>{try{const[e,s]=await Promise.all([d.I2.post("credential/list",{}),d.I2.post("credential/meta",{})]),t=Array.isArray(e?.data)?e.data:[];return c(t),x(Array.isArray(s?.data)?s.data:[]),t}catch(e){return[]}},M=async e=>{const s=(await O()).find(s=>s.id===e);s&&z(s.accounts??[])};(0,n.useEffect)(()=>{O()},[]);const q=p.find(e=>e.type===y),E=q?.fields??[],D=!0===q?.sources,H=!0===q?.accounts,W=q?.account_fields??[],Z=A.local_sources??[],G=(e,s)=>{I({...A,local_sources:Z.map((t,n)=>n===e?{...t,...s}:t)})},U=()=>{z(e=>[...e,{id:"",account_name:"",password:"",secret_key:""}])},R=(e,s)=>{z(t=>t.map((t,n)=>n===e?{...t,...s}:t))},J=de[y],L=()=>{f(!1),w(""),b(ae),k(""),I({}),z([]),P(""),T(!0)},Q=async e=>{const s=Array.from(new Set(e.map(e=>e.options_source).filter(e=>Boolean(e)))),t={};for(const e of s){const s=await d.I2.post("credential/options",{source:e});t[e]=(s?.data??[]).map(e=>({label:e.label,value:e.value}))}$(t)},Y=async()=>{try{const e=await d.I2.post("baidu/authorize_url",{id:g,mode:V});e?.data&&window.open(e.data,"_blank","noopener,noreferrer")}catch(e){}},ee=async()=>{if(F.trim())try{const s=await d.I2.post("baidu/exchange",{id:g,code:F.trim(),mode:V});(0,v.SK)(`${e("授权成功")}:${s?.data?.baidu_name??""}`),P(""),await O()}catch(e){}else(0,v.zN)(e("请填写授权码"))};return(0,C.jsxs)(i.fI,{children:[(0,C.jsx)(i.VP,{widthPer:50,maxWidth:"40rem",children:(0,C.jsx)(i.xh,{children:(0,C.jsx)(a.uF,{self_title:(0,C.jsxs)("span",{className:" div-row ",children:[(0,C.jsx)("h2",{children:e("网盘凭据")}),(0,C.jsx)(o.rA,{icon:"info",title:e("信息"),onClick:()=>{t({open:!0,title:e("信息"),context_div:(0,C.jsxs)("div",{children:[(0,C.jsxs)("ul",{children:[(0,C.jsx)("li",{children:e("crd_tp")}),(0,C.jsx)("li",{children:e("pwdkept")}),(0,C.jsx)("li",{children:e("tstbfrs")})]}),(0,C.jsxs)("ul",{children:[(0,C.jsxs)("li",{children:[(0,C.jsx)("b",{children:"WebDAV"}),":",e("prtwbdv")]}),(0,C.jsxs)("li",{children:[(0,C.jsx)("b",{children:"SSH / SFTP"}),":",e("prtsftp")]}),(0,C.jsxs)("li",{children:[(0,C.jsx)("b",{children:"S3 兼容对象存储"}),":",e("prt_s3")]}),(0,C.jsxs)("li",{children:[(0,C.jsx)("b",{children:"SMB"}),":",e("prt_smb")]}),(0,C.jsxs)("li",{children:[(0,C.jsx)("b",{children:"百度网盘"}),":",e("prt_bd")]}),(0,C.jsxs)("li",{children:[(0,C.jsx)("b",{children:e("内网穿透 FileCat")}),":",e("prt_tcp")]}),(0,C.jsxs)("li",{children:[(0,C.jsx)("b",{children:e("本地目录")}),":",e("prt_local")]})]})]})})}})]}),rightTopCom:(0,C.jsx)("div",{className:"div-row",children:(0,C.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{L(),f(!0)}})}),children:(0,C.jsx)(m.X,{headers:[e("备注"),e("类型"),e("操作")],rows:l.map(t=>{return[(0,C.jsx)(a.xP,{context:t.note||"-"}),(0,C.jsx)(a.xP,{context:(n=t.type,p.find(e=>e.type===n)?.name??n)}),(0,C.jsxs)("div",{children:[(0,C.jsx)(o.rA,{icon:"edit",title:e("编辑"),onClick:()=>(e=>{f(!0),w(e.id),b(e.type),k(e.note??""),I({webdav_url:e.webdav_url,ssh_host:e.ssh_host,ssh_port:e.ssh_port,ssh_private_key:e.ssh_private_key,smb_server:e.smb_server,s3_endpoint:e.s3_endpoint,s3_region:e.s3_region,s3_force_path_style:e.s3_force_path_style,baidu_app_id:e.baidu_app_id,baidu_app_key:e.baidu_app_key,baidu_secret_key:e.baidu_secret_key,local_sources:e.local_sources,tcp_client_num_id:e.tcp_client_num_id,tcp_base_url:e.tcp_base_url}),z(e.accounts??[]),P(""),T(!1!==e.enabled);const s=p.find(s=>s.type===e.type)?.fields??[];s.some(e=>e.options_source)&&Q(s).catch(()=>{})})(t)}),(0,C.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(async t=>{s({title:e("确认删除"),sub_title:t.note,confirm_fun:async()=>{try{await d.I2.post("credential/delete",{id:t.id}),(0,v.SK)(e("已删除")),await O()}catch(e){}}})})(t)})]})];var n})})})})}),(0,C.jsx)(i.VP,{widthPer:50,maxWidth:"40rem",children:j&&(0,C.jsxs)(n.Fragment,{children:[(0,C.jsx)(i.xh,{children:(0,C.jsxs)(a.Zp,{self_title:(0,C.jsx)("span",{className:" div-row ",children:(0,C.jsx)("h2",{children:e("凭据")})}),rightBottomCom:(0,C.jsxs)("div",{children:[(0,C.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{const s=(s=>{if(!S.trim())return e("请填写备注");for(const t of E){if(!1===s.includes(t.key))continue;const n=String(A[t.key]??"").trim();if(t.required&&!n)return e(t.label)}})(E.map(e=>e.key));if(s)(0,v.zN)(`${e("请填写")}${s}`);else{if(D){const s=new Set;for(const t of Z){const n=String(t.name??"").trim(),i=String(t.path??"").trim();if(!n||!i)return void(0,v.zN)(e("源目录的名称和路径都不能为空"));if(s.has(n))return void(0,v.zN)(`${e("源目录名称重复")}:${n}`);s.add(n)}}if(H)for(const s of X)for(const t of W)if(t.required&&!String(s[t.key]??"").trim())return void(0,v.zN)(`${e("请填写")}${e(t.label)}`);try{const s=await d.I2.post(g?"credential/update":"credential/add",{id:g||void 0,type:y,note:S,...A,accounts:H?X:void 0,enabled:K});(0,v.SK)(e("保存成功")),!g&&s.data?.id&&w(s.data.id),await O()}catch(e){}}}}),(0,C.jsx)(o.rA,{icon:"cancel",title:e("取消"),onClick:L})]}),children:[(0,C.jsx)(r.Sm,{placeholder:e("备注"),value:S,handleInputChange:k}),(0,C.jsx)(r.l6,{value:y,options:p.map(e=>({title:e.name,value:e.type})),onChange:e=>{b(e),I({}),$({}),P("");const s=p.find(s=>s.type===e)?.fields??[];s.some(e=>e.options_source)&&Q(s)}}),D?(0,C.jsxs)(n.Fragment,{children:[(0,C.jsxs)("div",{className:"div-row",children:[(0,C.jsx)("h3",{children:e("目录")}),(0,C.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{I({...A,local_sources:[...Z,{name:"",path:""}]})}})]}),Z.map((s,t)=>(0,C.jsxs)(le.d,{title:`${e("目录")} #${t+1}`,toolbar:(0,C.jsx)(C.Fragment,{children:(0,C.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{I({...A,local_sources:Z.filter((s,t)=>t!==e)})})(t)})}),children:[(0,C.jsx)(r.BC,{label:e("名称"),label_width:"6rem",children:(0,C.jsx)(r.Sm,{placeholder:e("便于辨认的名字"),value:s.name,handleInputChange:e=>G(t,{name:e})})}),(0,C.jsx)(r.BC,{label:e("目录"),label_width:"6rem",required:!0,children:(0,C.jsx)(r.Sm,{placeholder:e("本地绝对路径"),value:s.path,handleInputChange:e=>G(t,{path:e})})})]},t))]}):(0,C.jsxs)(n.Fragment,{children:[E.map(s=>{const t=A[s.key];return s.options_source?(0,C.jsx)(r.BC,{label:e(s.label),label_width:"6rem",children:(0,C.jsx)(r.l6,{value:String(t??""),options:N[s.options_source]??[],onChange:e=>I({...A,[s.key]:e})})},s.key):"switch"===s.type?(0,C.jsx)(r.BC,{label:e(s.label),label_width:"6rem",children:(0,C.jsx)(r.l6,{value:!0===t?"on":"off",options:[{title:e("开启"),value:"on"},{title:e("关闭"),value:"off"}],onChange:e=>I({...A,[s.key]:"on"===e})})},s.key):(0,C.jsx)(n.Fragment,{children:(0,C.jsx)(r.Sm,{type:"password"===s.type?"password":"text",placeholder:s.label,value:String(t??""),handleInputChange:e=>I({...A,[s.key]:e})})},s.key)}),H&&(0,C.jsxs)(n.Fragment,{children:[(0,C.jsxs)("div",{className:"div-row",children:[(0,C.jsx)("h3",{children:e("账号")}),(0,C.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:U})]}),X.map((s,t)=>(0,C.jsx)(le.d,{title:`${e("账号")} #${t+1}`,toolbar:(0,C.jsx)(C.Fragment,{children:(0,C.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{z(s=>s.filter((s,t)=>t!==e))})(t)})}),children:W.map(n=>(0,C.jsx)(r.BC,{label:e(n.label),label_width:"7rem",required:n.required,children:(0,C.jsx)(r.Sm,{type:"password"===n.type?"password":"text",placeholder:n.placeholder?e(n.placeholder):"",value:s[n.key]??"",handleInputChange:e=>R(t,{[n.key]:e})})},n.key))},t))]})]})]})}),J?.[1]?.keys?.includes(oe)&&(0,C.jsx)(i.xh,{children:(0,C.jsx)(a.Zp,{self_title:(0,C.jsx)("span",{className:" div-row ",children:(0,C.jsx)("h2",{children:e("账号")})}),children:(()=>{const t=l.find(e=>e.id===g)?.accounts??[];return(0,C.jsxs)(n.Fragment,{children:[(0,C.jsx)(r.BC,{label:e("授权方式"),label_width:"6rem",children:(0,C.jsxs)("div",{className:"div-row",children:[(0,C.jsx)(r.U6,{name:"baidu_auth_mode",value:"one_click",context:e("一键授权"),selected:"one_click"===V,onchange:()=>B("one_click")}),(0,C.jsx)(r.U6,{name:"baidu_auth_mode",value:"oob",context:e("outh_ob"),selected:"oob"===V,onchange:()=>B("oob")})]})}),"oob"===V&&(0,C.jsx)(r.BC,{label:e("授权码"),label_width:"6rem",children:(0,C.jsx)(r.Sm,{placeholder:e("粘贴授权码 code"),value:F,handleInputChange:P})}),(0,C.jsxs)("div",{className:"div-row",children:[(0,C.jsx)(o.rA,{icon:"open_in_new",title:e("去授权"),onClick:Y}),"oob"===V&&(0,C.jsx)(o.rA,{icon:"check",title:e("完成授权"),onClick:ee})]}),t.map((t,n)=>(0,C.jsxs)(le.d,{title:`${e("账号")} #${n+1}`,toolbar:(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(o.rA,{icon:"network_check",title:e("授权检测"),onClick:()=>(async(s,t)=>{try{const n=await d.I2.post("baidu/verify",{id:s,account_id:t}),i=n?.data??{};i.valid?(0,v.SK)(e("账号可用")):(0,v.zN)(`${e("账号不可用")}:${i.error??""}`),await O()}catch(e){}})(g,t.id)}),(0,C.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>((t,n)=>{s({title:e("确认删除"),sub_title:n.note||n.account_name||n.id,confirm_fun:async()=>{try{await d.I2.post("baidu/deauthorize",{id:t,account_id:n.id}),(0,v.SK)(e("已删除")),await O()}catch(e){}}})})(g,t)})]}),children:[(0,C.jsx)(r.BC,{label:e("备注"),label_width:"6rem",children:(0,C.jsx)(a.xP,{context:t.note||"-"})}),(0,C.jsx)(r.BC,{label:e("百度账号"),label_width:"6rem",children:(0,C.jsx)(a.xP,{context:t.account_name||t.id})}),(0,C.jsx)(r.BC,{label:e("授权状态"),label_width:"6rem",children:(0,C.jsx)("p",{children:t.token?e("已授权"):e("未授权")})}),(0,C.jsx)(r.BC,{label:e("授权时间"),label_width:"6rem",children:(0,C.jsx)("p",{children:t.token?.obtained_at?(0,te.eK)(t.token.obtained_at):"-"})})]},t.id))]},oe)})()})}),J?.[1]?.keys?.includes(re)&&(0,C.jsx)(i.xh,{children:(0,C.jsx)(a.Zp,{self_title:(0,C.jsx)("span",{className:" div-row ",children:(0,C.jsx)("h2",{children:e("账号")})}),children:(0,C.jsxs)(n.Fragment,{children:[(0,C.jsxs)("div",{className:"div-row",children:[(0,C.jsx)("h3",{children:e("账号")}),(0,C.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:U})]}),X.map((t,n)=>(0,C.jsxs)(le.d,{title:`${e("账号")} #${n+1}`,toolbar:(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:()=>(async s=>{if(String(s.account_name??"").trim())try{await d.I2.post("credential/account_save",{credential_id:g,account_id:s.id||void 0,note:s.note,account_name:s.account_name,password:s.password}),(0,v.SK)(e("已保存")),await M(g)}catch(e){}else(0,v.zN)(e("请填写对端账号"))})(t)}),(0,C.jsx)(o.rA,{icon:"network_check",title:e("验证登录"),onClick:()=>(async s=>{try{const t=await d.I2.post("credential/account_verify",{credential_id:g,account_id:s.id,account_name:s.account_name,password:s.password}),n=t?.data??{};n.ok?(0,v.SK)(e("账号可用")):(0,v.zN)(`${e("账号不可用")}:${n.error??""}`)}catch(e){}})(t)}),(0,C.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(t=>{t.id?s({title:e("确认删除"),sub_title:t.note||t.account_name||t.id,confirm_fun:async()=>{try{await d.I2.post("credential/account_remove",{credential_id:g,account_id:t.id}),(0,v.SK)(e("已删除")),await M(g)}catch(e){}}}):z(e=>e.filter(e=>e!==t))})(t)})]}),children:[(0,C.jsx)(r.BC,{label:e("备注"),label_width:"6rem",children:(0,C.jsx)(r.Sm,{placeholder:e("便于辨认的名字"),value:t.note??"",handleInputChange:e=>R(n,{note:e})})}),(0,C.jsx)(r.BC,{label:e("对端账号"),label_width:"6rem",required:!0,children:(0,C.jsx)(r.Sm,{placeholder:e("对端 FileCat 登录名"),value:t.account_name??"",handleInputChange:e=>R(n,{account_name:e})})}),(0,C.jsx)(r.BC,{label:e("对端密码"),label_width:"6rem",children:(0,C.jsx)(r.Sm,{type:"password",value:t.password??"",handleInputChange:e=>R(n,{password:e})})})]},n))]},re)})})]})})," "]})}function he(){const{t:e}=(0,_.Bd)(),{check_user_auth:s}=(0,j.MH)();return s(l.oV.file_mount)?(0,C.jsx)(i.xh,{children:(0,C.jsx)(i.fI,{children:(0,C.jsx)(i.VP,{widthPer:100,maxWidth:"90rem",children:(0,C.jsx)(ce,{})})})}):(0,C.jsx)(i.fI,{children:(0,C.jsx)(i.VP,{children:(0,C.jsx)(a.Zp,{self_title:(0,C.jsx)("h2",{children:e("网盘凭据")}),children:(0,C.jsx)("p",{children:e("nmuntpr")})})})})}const ue=[{value:"sftp",label:"SFTP"},{value:"webdav",label:"WebDAV"},{value:"smb",label:"SMB"}];function me(){const{t:e}=(0,_.Bd)(),s=(0,se.y)(),t=(0,f.T)(),[l,c]=(0,n.useState)([]),[h,u]=(0,n.useState)("none"),[p,x]=(0,n.useState)(""),[j,g]=(0,n.useState)("sftp"),[w,y]=(0,n.useState)(""),[b,S]=(0,n.useState)(0),[k,A]=(0,n.useState)(!1),[I,N]=(0,n.useState)(""),[$,V]=(0,n.useState)(""),[B,F]=(0,n.useState)(""),[P,X]=(0,n.useState)([{share_name:"",path:"",readonly:!1}]),[z,K]=(0,n.useState)(""),[T,O]=(0,n.useState)(""),[M,q]=(0,n.useState)([{url_path:"",path:"",readonly:!1}]),[E,D]=(0,n.useState)([{username:"",password:"",path:"",readonly:!1}]),H=async()=>{const e=await d.od.post("list",{});c(e?.data??[])};(0,n.useEffect)(()=>{H()},[]);const W=()=>{x(""),g("sftp"),y(""),S(0),A(!1),N(""),V(""),F(""),X([{share_name:"",path:"",readonly:!1}]),K(""),O(""),q([{url_path:"",path:"",readonly:!1}]),D([{username:"",password:"",path:"",readonly:!1}])},Z=()=>{u("none"),W()},G=e=>"smb"===e?P:"webdav"===e?M:E,U=(e,s)=>{"smb"!==e?"webdav"!==e?D(s):q(s):X(s)},R=(e,s,t)=>{U(e,G(e).map((e,n)=>n===s?{...e,...t}:e))},J=e=>"smb"===e.type?(e.smb?.shares??[]).map(e=>e.share_name).join(", "):"webdav"===e.type?(e.webdav?.shares??[]).map(e=>e.url_path).join(", "):(e.sftp?.shares??[]).map(e=>e.username).join(", ");return(0,C.jsxs)(i.fI,{children:[(0,C.jsx)(i.VP,{widthPer:50,maxWidth:"40rem",children:(0,C.jsx)(i.xh,{children:(0,C.jsx)(a.uF,{self_title:(0,C.jsx)("span",{className:" div-row ",children:(0,C.jsx)("h2",{children:e("文件服务")})}),rightTopCom:(0,C.jsx)("div",{className:"div-row",children:(0,C.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{W(),S(2022),u("add")}})}),children:(0,C.jsx)(m.X,{headers:[e("状态"),e("备注"),e("协议"),e("端口"),e("共享"),e("操作")],rows:l.map(t=>{return[(0,C.jsx)(o.Ay,{checked:t.running,title:e("启用"),onChange:s=>(async(s,t)=>{await d.od.post(t?"start":"stop",{id:s.id}),(0,v.SK)(e(t?"已启用":"已禁用")),await H()})(t,s)}),(0,C.jsx)(a.xP,{children:t.note||"-"}),(0,C.jsx)("p",{children:(n=t.type,ue.find(e=>e.value===n)?.label??n)}),(0,C.jsx)("p",{children:t.port}),(0,C.jsx)(a.xP,{children:J(t)||"-"}),(0,C.jsxs)("div",{children:[(0,C.jsx)(o.rA,{icon:"edit",title:e("编辑"),onClick:()=>(e=>{W(),x(e.id),g(e.type),y(e.note),S(e.port),A(e.readonly),N(e.smb?.hostname??""),V(e.smb?.username??""),F(e.smb?.password??""),X(e.smb?.shares?.length?e.smb.shares.map(e=>({...e})):[{share_name:"",path:"",readonly:!1}]),K(e.webdav?.username??""),O(e.webdav?.password??""),q(e.webdav?.shares?.length?e.webdav.shares.map(e=>({...e})):[{url_path:"",path:"",readonly:!1}]),D(e.sftp?.shares?.length?e.sftp.shares.map(e=>({...e})):[{username:"",password:"",path:"",readonly:!1}]),u("edit")})(t)}),(0,C.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(t=>{s({title:e("确认删除"),confirm_fun:async()=>{await d.od.post("delete",{id:t.id}),(0,v.SK)(e("删除成功")),p===t.id&&Z(),await H()}})})(t)})]})];var n})})})})}),(0,C.jsx)(i.VP,{widthPer:50,maxWidth:"40rem",children:"none"!==h&&(0,C.jsx)(i.xh,{children:(0,C.jsxs)(a.Zp,{self_title:(0,C.jsxs)("span",{className:" div-row ",children:[(0,C.jsx)("h2",{children:e("add"===h?"添加":"编辑")}),(0,C.jsx)(o.rA,{icon:"info",title:e("说明"),onClick:()=>t(e("smb_known_issue_tip"))})]}),rightBottomCom:(0,C.jsxs)("div",{children:[(0,C.jsx)(o.rA,{icon:"cancel",title:e("取消"),onClick:Z}),(0,C.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{const s={type:j,note:w,port:Number(b),readonly:k};"smb"===j&&(s.smb={hostname:I,username:$,password:B,shares:P}),"webdav"===j&&(s.webdav={username:z,password:T,shares:M}),"sftp"===j&&(s.sftp={shares:E}),p?(s.id=p,await d.od.post("update",s)):await d.od.post("add",s),(0,v.SK)(e("保存成功")),Z(),await H()}})]}),children:[(0,C.jsx)(r.BC,{label:e("协议"),label_width:"7rem",required:!0,children:(0,C.jsx)(r.l6,{value:j,options:ue,onChange:e=>g(e)})}),(0,C.jsx)(r.BC,{label:e("端口"),label_width:"7rem",required:!0,children:(0,C.jsx)(r.Sm,{placeholder:"1-65535",value:String(b||""),handleInputChange:e=>S(Number(e)||0)})}),(0,C.jsx)(r.BC,{label:e("备注"),label_width:"7rem",children:(0,C.jsx)(r.Sm,{placeholder:e("列表显示的名称"),value:w,handleInputChange:y})}),(0,C.jsx)(r.BC,{label:e("只读"),label_width:"7rem",children:(0,C.jsx)(o.Ay,{checked:k,onChange:A})}),"webdav"===j&&(0,C.jsxs)(n.Fragment,{children:[(0,C.jsx)(r.BC,{label:e("用户名"),label_width:"7rem",children:(0,C.jsx)(r.Sm,{placeholder:e("留空则不验证身份"),value:z,handleInputChange:K})}),(0,C.jsx)(r.BC,{label:e("密码"),label_width:"7rem",children:(0,C.jsx)(r.Sm,{type:"password",value:T,handleInputChange:O})})]}),"smb"===j&&(0,C.jsxs)(n.Fragment,{children:[(0,C.jsx)(r.BC,{label:e("主机名"),label_width:"7rem",children:(0,C.jsx)(r.Sm,{value:I,handleInputChange:N})}),(0,C.jsx)(r.BC,{label:e("用户名"),label_width:"7rem",children:(0,C.jsx)(r.Sm,{placeholder:e("留空则不验证身份"),value:$,handleInputChange:V})}),(0,C.jsx)(r.BC,{label:e("密码"),label_width:"7rem",children:(0,C.jsx)(r.Sm,{type:"password",value:B,handleInputChange:F})})]}),G(j).map((s,t)=>(0,C.jsxs)(le.d,{title:e("sftp"===j?"账号":"共享")+` #${t+1}`,toolbar:(0,C.jsxs)(C.Fragment,{children:["smb"===j&&(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)("span",{children:e("共享名")}),(0,C.jsx)(r.Sm,{value:s.share_name,no_border:!0,width:"8rem",placeholder:"share",handleInputChange:e=>R(j,t,{share_name:e})})]}),"webdav"===j&&(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)("span",{children:e("路径")}),(0,C.jsx)(r.Sm,{value:s.url_path,no_border:!0,width:"8rem",placeholder:"docs",handleInputChange:e=>R(j,t,{url_path:e})})]}),"sftp"===j&&(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)("span",{children:e("用户名")}),(0,C.jsx)(r.Sm,{value:s.username,no_border:!0,width:"8rem",handleInputChange:e=>R(j,t,{username:e})}),(0,C.jsx)("span",{children:e("密码")}),(0,C.jsx)(r.Sm,{type:"password",value:s.password,no_border:!0,width:"8rem",handleInputChange:e=>R(j,t,{password:e})})]}),(0,C.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>(e=>{const s="smb"===e?{share_name:"",path:"",readonly:!1}:"webdav"===e?{url_path:"",path:"",readonly:!1}:{username:"",password:"",path:"",readonly:!1};U(e,[...G(e),s])})(j)}),(0,C.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>((e,s)=>{U(e,G(e).filter((e,t)=>t!==s))})(j,t)})]}),children:[(0,C.jsx)(r.BC,{label:e("目录"),label_width:"7rem",required:!0,children:(0,C.jsx)(r.Sm,{placeholder:e("对外提供的本地绝对路径"),value:s.path,handleInputChange:e=>R(j,t,{path:e})})}),(0,C.jsx)(r.BC,{label:e("只读"),label_width:"7rem",children:(0,C.jsx)(o.Ay,{checked:s.readonly,onChange:e=>R(j,t,{readonly:e})})})]},t))]})})})]})}function pe(){const{t:e}=(0,_.Bd)(),{check_user_auth:s}=(0,j.MH)();return s(l.oV.file_mount)?(0,C.jsx)(me,{}):(0,C.jsx)(i.fI,{children:(0,C.jsx)(a.Zp,{self_title:(0,C.jsx)("h2",{children:e("文件服务")}),children:(0,C.jsx)("p",{children:e("没有权限")})})})}var _e=t(87361);function xe(){const{t:e}=(0,_.Bd)(),{check_user_auth:s}=(0,j.MH)(),t=[{index:2,name:`${e("个人环境")}`,rto:"private_env_setting",component:(0,C.jsx)(Y,{})}];return s(l.oV.sys_setting_page)&&t.unshift({index:1,name:e("系统"),rto:"password",component:(0,C.jsx)(k,{})}),s(l.oV.sys_env_page)&&t.push({index:3,name:`${e("系统环境")}`,rto:"env_setting/",component:(0,C.jsx)(W,{})}),s(l.oV.file_mount)&&(t.push({index:5,name:e("网盘凭据"),rto:"credential_setting/",component:(0,C.jsx)(he,{})}),t.push({index:5,name:e("网盘挂载"),rto:"mount_setting/",component:(0,C.jsx)(ie,{})})),s(l.oV.file_server)&&t.push({index:6,name:e("文件服务"),rto:"file_server_setting/",component:(0,C.jsx)(pe,{})}),s(l.oV.user_manage)&&t.push({index:7,name:e("用户管理"),rto:"user_manager/",component:(0,C.jsx)(R,{})}),s(l.oV.role_manage)&&t.push({index:8,name:e("角色管理"),rto:"role_manager/",component:(0,C.jsx)(J,{})}),(0,C.jsx)(i.W1,{optionList:t,father_route:_e.o.setting})}},92350(e,s,t){t.d(s,{Q:()=>h,o:()=>m});var n=t(34843),i=t(82893),l=t(74777),a=t(96540),o=t(22022),r=t(23430),d=t(14284),c=t(74848);function h(){const[e,s]=(0,n.fp)(i.AG.prompt_card),{t,i18n:a}=(0,o.Bd)();return e=>{let n;e===l.jk.ffmpeg?n=(0,c.jsx)("div",{children:"视频转换,rtsp播放器等媒体功能都需要这个软件。linux下你可以使用apt或者yum来安装,或者直接输入软件的位置"}):e===l.jk.smartmontools?n=(0,c.jsx)("div",{children:"磁盘检查需要这个软件。linux下你可以使用apt或者yum来安装,或者直接输入软件的位置。"}):"保护目录"===e?n=(0,c.jsxs)("div",{children:["在删除的时候保护目录会拒绝删除。",(0,c.jsxs)("ul",{children:[(0,c.jsx)("li",{children:"可以使用 /* 来表达该目录下所有文件都禁止删除"}),(0,c.jsx)("li",{children:"可以使用 /** 来表达该目录下所有子目录文件都禁止删除"})]})]}):"文件夹路径"===e?n=(0,c.jsx)("div",{children:"用于在文件夹下切换根目录"}):"环境路径"===e?n=(0,c.jsx)("div",{children:"当在不同用户环境下运行的时候由于没有执行终端去加载PATH,这里可以添加额外的PATH路径,点击这里的保存还会更新系统上的path路径"}):"pty"===e?n=(0,c.jsx)("div",{children:"一些需要Pty环境的命令"}):"文件上传"===e?n=(0,c.jsx)("div",{children:(0,c.jsxs)("ul",{children:[(0,c.jsx)("li",{children:"对于不同的目录(包括所有子目录),可能是机械或者固态硬盘,机械硬盘在处理多个小文件的时候会做随机i/o,由于一般只有一个盘头所以会影响整体效率,特别是写操作,这里提供了上传时候的最大数量限制,对于下载数量目前不做限制."}),(0,c.jsx)("li",{children:"大文件支持断点和分块并发传输,建议并发数量设置为2,分块大小设置为10MB,大文件判断为500MB,设置过大的话会上传的时候会占据较大内存"})]})}):"目录快捷命令"===e?n=(0,c.jsx)("div",{children:"右键文件夹空白处用于,打开终端快捷执行命令"}):"文件快捷命令"===e?n=(0,c.jsx)("div",{children:"用于右键特定后缀的文件,执行一些快捷命令,文件后缀可以是多个,用空格分割"}):"Workflow"===e?n=(0,c.jsx)("div",{children:(0,c.jsxs)("ul",{children:[(0,c.jsx)("li",{children:"在特定的时间启动系统中的workflow任务"}),(0,c.jsx)("li",{children:"cron表达式是定时器 格式为: 秒 分 时 日 月 星期"}),(0,c.jsxs)("li",{children:[(0,c.jsx)("li",{children:'1. "*"(通配符,所有值)'}),(0,c.jsx)("li",{children:'2. "," 是枚举: 0 0 1,15 * * *'}),(0,c.jsx)("li",{children:'3. "-" 是范围: 0 0 1-5 * * *'}),(0,c.jsx)("li",{children:'4. "/" 是步长,标识每隔n执行 */3 * * * * * 每隔三秒,必须配合 * 使用 ,/ 只能写一次 ,有了/就成了定时器,而不是指定时间执行'})]})]})}):"插件配置"===e?n=(0,c.jsx)("div",{children:t("路径可以是一个 js 文件也可以是一个node 项目目录")}):"机器人配置"===e&&(n=(0,c.jsxs)("div",{children:[(0,c.jsx)("dv",{children:"机器人功能用于开通各种第三方支持的机器人,让第三方机器人接入本地的 AI 模型。"}),(0,c.jsxs)("ul",{children:[(0,c.jsx)("li",{children:" 1. qq 机器人需要先在手机 app 中添加,然后在https://q.qq.com/qqbot/ 登录机器人配置页面,在开发管理中复制机器人的 appId,appSecret 到这里就完成了配置了。目前 qq 机器人不稳定,且创建后无法删除(2026.07.05)"}),(0,c.jsx)("li",{children:" 2. https://opensource.dingtalk.com/developerpedia/docs/explore/tutorials/stream/bot/nodejs/create-bot 这个是钉钉机器人开通教程,注意复制钉钉的 clientId 的是时候不要复制成appId 了。"}),(0,c.jsx)("li",{children:" 3. 企业微信机器人的开通甚至不需要 pc 操作,在通讯录中点击智能机器人,选择 api 模式,就创建完成了,手机上直接复制 id 和密钥。"}),(0,c.jsx)("li",{children:" 4. 飞书https://open.feishu.cn/document/develop-an-echo-bot/introduction?from=banner 登录这个开发者后台,按照这个地址教程创建机器人,使用的时候这个机器人是作为一个应用,可以在工作台内搜索你的这个机器人的名字。"})]})]})),s({open:!0,title:"信息",context_div:(0,c.jsx)("div",{children:n})})}}let u=r.Ky;function m(){const[e,s]=(0,a.useState)([]);return(0,a.useEffect)(()=>{(async()=>{try{const e=await d.XO.get("themes");if(0===e.code){const t=e.data||[];u=[...r.Ky,...t],s(u)}else console.warn("获取主题列表失败,使用默认列表"),s(u)}catch(e){s(u)}})()},[]),e}},6960(e,s,t){t.d(s,{s:()=>a});var n=t(72635);const i=1440,l=525600;function a(e){e=e>1e12?e:1e3*e;const s=Date.now(),t=Math.abs(s-e)/6e4;return t<1?n.Ay.t("小于一分钟"):t<60?`${t.toFixed(0)} ${n.Ay.t("分钟前")}`:t<i?`${(t/60).toFixed(0)} ${n.Ay.t("小时前")}`:t<43200?`${(t/i).toFixed(0)} ${n.Ay.t("天前")}`:t<l?`${(t/43200).toFixed(0)} ${n.Ay.t("月前")}`:`${(t/l).toFixed(0)} ${n.Ay.t("年前")}`}},93245(e,s,t){t.d(s,{a:()=>r});var n=t(96540),i=t(34843),l=t(82893),a=t(23430);const o=[{id:a.nE.ace,label:"文本编辑器(ace)"},{id:a.nE.md,label:"md编辑器"},{id:a.nE.mind,label:"思维导图编辑器"},{id:a.nE.draw,label:"draw编辑器"},{id:a.nE.timeline,label:"时间线编辑器"},{id:a.nE.image,label:"图片编辑器"},{id:a.nE.excel,label:"excel编辑器"}];function r(e,s,t,a=!1){const[o]=(0,i.fp)(l.AG.user_base_info),r=o?.user_data?.editor_auto_save,d=(0,n.useRef)(r);d.current=r;const c=(0,n.useRef)(s);c.current=s;const h=(0,n.useRef)(t);h.current=t,(0,n.useEffect)(()=>{if(a)return;const s=d.current;if(!s?.enable||s.interval<=0||!s.editors?.includes(e))return;const t=setInterval(()=>{c.current()&&h.current(!0)},1e3*s.interval);return()=>clearInterval(t)},[r,e,a])}t.d(s,["d",0,o])},24659(e,s,t){var n=t(22022);t.d(s,["K",0,()=>{const{t:e}=(0,n.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([[3884],{72458(e,t,s){function n(e,t){let s=function(e){let t="\\";for(const s of e)if("/"===s||"\\"===s){t=s;break}return t}(e);if("."===t)return e;if(".."===t){if(e.length>1){let t=e[e.length-1]===s?1:0;for(let n=e.length-1-t;n>=0;n--)if(e[n]===s)return e.substring(0,n+1)}return e}return e.endsWith(s)&&t.startsWith(s)?e.slice(0,-1)+t:e.endsWith(s)||t.startsWith(s)?e+t:e+s+t}s.d(t,{Jn:()=>n,Z1:()=>i});function i(e){if("string"!=typeof e||0===e.length)return!1;return/^[a-zA-Z]:[\\\/]/.test(e)||/^\\\\[^\\/]+[\\/]/.test(e)||/^\//.test(e)}},47374(e,t,s){s.d(t,{e:()=>h});var n=s(96540),i=s(61973),a=s(64694),l=s(34289),o=s(61443),r=s(75725),c=s(22022),d=s(85997),_=s(74848);function h(e){let t=(0,i.zy)();const s=(0,i.Zp)(),[h,p]=(0,n.useState)([]),[m,u]=(0,n.useState)("/"),[f,x]=(0,n.useState)(void 0),{t:g,i18n:v}=(0,c.Bd)();n.useEffect(()=>{let t="",s=(0,l.vX)().split("/");s=s.filter(e=>e);const n=s.indexOf(e.baseRoute),i=[];if(-1!=n){t=(0,a.IO)(s.slice(0,n),e.baseRoute);const l=s.slice(n+1);for(let e=0;e<l.length;e++){const s=l[e];i.push({value:s,href:0===e?`${t}${s}/`:(0,a.IO)(i[e-1].href,s)})}u(t),p(i)}},[t]);const w=t=>{t.stopPropagation(),e.clickFun(t)},[j,y]=(0,n.useState)(0),k=(0,n.useRef)(null),b=(0,n.useRef)(null),A=()=>{const e=k.current,t=b.current;if(!e||!t)return;const s=[];for(const e of Array.from(t.children))s.push(e.getBoundingClientRect().width);const n=e.clientWidth;if(s.reduce((e,t)=>e+t,0)<=n||s.length<=2)return void y(e=>0===e?e:0);let i=s[0]+48,a=0;for(let e=s.length-1;e>=1&&!(i+s[e]>n);e--)i+=s[e],a++;const l=Math.max(s.length-1-a,0);y(e=>e===l?e:l)};(0,n.useEffect)(()=>{A();const e=new ResizeObserver(A);return k.current&&e.observe(k.current),()=>e.disconnect()},[h,m,t]),(0,n.useEffect)(()=>{const e=k.current;e&&0!==j&&e.scrollWidth>e.clientWidth&&j<h.length-1&&y(e=>e+1)});const G=j>0?1+j:1,N=j>0?h.slice(1,G):[],[C,S]=(0,n.useState)(null);return(0,n.useEffect)(()=>{S(null)},[t,j]),(0,_.jsxs)("div",{className:"breadcrumbs",ref:k,onClick:e=>{x(void 0!==f?void 0:"")},children:[(0,_.jsx)(n.Fragment,{children:void 0===f?(0,_.jsxs)(n.Fragment,{children:[(0,_.jsx)("span",{className:"chevron",children:(0,_.jsx)(i.N_,{to:m,onClick:w,children:(0,_.jsx)(d.In,{icon:"home"})})}),h.map((e,t)=>j>0&&t>=1&&t<G?1!==t?null:(0,_.jsxs)("span",{className:"chevron",children:[(0,_.jsx)(d.In,{icon:"keyboard_arrow_right"}),(0,_.jsx)("span",{className:"breadcrumbs-fold-dot",onClick:e=>{e.stopPropagation();const t=e.currentTarget.getBoundingClientRect();S({x:t.left,y:t.bottom})},children:"..."})]},"fold"):(0,_.jsxs)("span",{className:"chevron",children:[(0,_.jsx)(d.In,{icon:"keyboard_arrow_right"}),(0,_.jsx)(i.N_,{to:e.href,onClick:w,children:decodeURIComponent(e.value)})]},t)),(0,_.jsxs)("div",{className:"breadcrumbs-measure",ref:b,"aria-hidden":!0,children:[(0,_.jsx)("span",{className:"chevron",children:(0,_.jsx)(i.N_,{to:m,children:(0,_.jsx)(d.In,{icon:"home"})})}),h.map((e,t)=>(0,_.jsxs)("span",{className:"chevron",children:[(0,_.jsx)(d.In,{icon:"keyboard_arrow_right"}),(0,_.jsx)(i.N_,{to:e.href,children:decodeURIComponent(e.value)})]},t))]})]}):(0,_.jsx)(r.QM,{click:()=>{x(void 0)},children:(0,_.jsx)(o.Sm,{width:"100%",placeholder:g("输入跳转的目录"),handlerEnter:t=>{e.input_path_enter&&e.input_path_enter(t),x(void 0)}})})}),C&&(0,_.jsx)(r.rY,{click:()=>S(null),children:(0,_.jsx)(r.sw,{x:C.x,y:C.y,items:N.map(e=>({r:decodeURIComponent(e.value),v:e.href})),click:e=>{S(null),s(e)}})})]})}},13884(e,t,s){s.r(t),s.d(t,{default:()=>Q});var n=s(96540),i=s(47374),a=s(34843),l=s(52035),o=s(82893),r=s(14284),c=s(61973),d=s(4412),_=s(78150),h=s(34289),p=s(53459),m=s(99214),u=s(61443),f=s(47022),x=s(62042),g=s(22022),v=s(7523),w=s(78247),j=s(88815),y=s(6960),k=s(47071),b=s(14944),A=s(92275),G=s(23430),N=s(72458),C=s(34251),S=s(60096),I=s(87361),z=s(76559),E=s(85997),M=s(23496),$=s(74848);function P(e){const{t}=(0,g.Bd)(),[s,i]=(0,n.useState)([]),[a,l]=(0,n.useState)(!1),[o,c]=(0,n.useState)(""),[d,_]=(0,n.useState)(""),h=t=>{const s=e.base_path.endsWith("/")?e.base_path:e.base_path+"/",n=t.type===f.Iw.folder?s+t.name:t.path??s+t.name;return n.startsWith("/")?n:"/"+n};(0,n.useEffect)(()=>{(async()=>{if(a)return;l(!0);const t=await r.$M.post("file_get_page",{param_path:e.base_path,page_num:1,page_size:1e4});if(t?.code!==p.m.Success)return;const s=t.data.files??[],n=s.filter(e=>e.type===f.Iw.folder).sort((e,t)=>e.name.localeCompare(t.name)),o=s.filter(e=>e.type!==f.Iw.folder).sort((e,t)=>e.name.localeCompare(t.name));i([...n,...o])})()},[]);const m=(0,n.useMemo)(()=>{const e=o.trim().toLowerCase();return e?s.filter(t=>t.name.toLowerCase().includes(e)):s},[s,o]),x=()=>{const t=d.trim();t&&!e.ignore_names.includes(t)&&(e.on_change_names([...e.ignore_names,t]),_(""))};return(0,$.jsxs)("div",{className:"search-exclude",children:[(0,$.jsxs)("div",{className:"search-exclude__section",children:[(0,$.jsx)("div",{className:"search-exclude__title",children:t("排除当前目录下的项")}),(0,$.jsx)(u.$Z,{icon:"search",value:o,placeholder:t("过滤列表"),handleInputChange:e=>c(e),handleEnterPress:()=>{}}),(0,$.jsxs)("div",{className:"search-exclude__list",children:[0===m.length&&(0,$.jsx)("div",{className:"search-exclude__empty",children:t(a?"无匹配":"加载中")}),m.map(t=>{const s=h(t),n=e.exclude_paths.includes(s),i=t.type===f.Iw.folder;return(0,$.jsxs)("label",{className:"search-exclude__item",children:[(0,$.jsx)("input",{type:"checkbox",checked:n,onChange:()=>(t=>{const s=h(t),n=e.exclude_paths.includes(s);e.on_change_paths(n?e.exclude_paths.filter(e=>e!==s):[...e.exclude_paths,s])})(t)}),(0,$.jsx)("span",{className:"material-symbols-outlined"+(i?" search-exclude__icon--dir":""),children:i?"folder":"draft"}),(0,$.jsx)("span",{className:"search-exclude__item-name",title:t.name,children:t.name})]},s)})]}),e.exclude_paths.length>0&&(0,$.jsx)("div",{className:"search-exclude__chosen",children:e.exclude_paths.map(t=>(0,$.jsxs)("span",{className:"search-exclude__tag",children:[t.split("/").filter(Boolean).pop(),(0,$.jsx)("span",{className:"material-symbols-outlined",onClick:()=>e.on_change_paths(e.exclude_paths.filter(e=>e!==t)),children:"close"})]},t))})]}),(0,$.jsxs)("div",{className:"search-exclude__section search-exclude__section--ignore",children:[(0,$.jsx)("div",{className:"search-exclude__title",children:t("忽略名字")}),(0,$.jsx)("div",{className:"search-exclude__hint",children:t("按名字忽略")}),(0,$.jsxs)("div",{className:"search-exclude__chosen",children:[0===e.ignore_names.length&&(0,$.jsx)("span",{className:"search-exclude__hint",children:t("暂无")}),e.ignore_names.map(t=>(0,$.jsxs)("span",{className:"search-exclude__tag",children:[t,(0,$.jsx)("span",{className:"material-symbols-outlined",onClick:()=>(t=>{e.on_change_names(e.ignore_names.filter(e=>e!==t))})(t),children:"close"})]},t))]}),(0,$.jsxs)("div",{className:"search-exclude__add",children:[(0,$.jsx)(u.Sm,{value:d,placeholder:t("如 node_modules"),handleInputChange:e=>_(e),handlerEnter:x,width:"12em"}),(0,$.jsx)(E.rA,{icon:"add",title:t("添加"),onClick:x})]}),(0,$.jsxs)("div",{className:"div-row",children:[(0,$.jsx)(E.rA,{icon:"save",title:t("保存忽略名字"),onClick:async()=>{await r.wm.post(M.s.user_save_private_attr,{is_search_exclude:!0,search_exclude_names:e.ignore_names})}}),(0,$.jsx)(E.rA,{icon:"settings",title:t("忽略名字设置"),onClick:e.on_open_setting})]})]})]})}function F(e){const{t}=(0,g.Bd)(),{initUserInfo:s}=(0,n.useContext)(v.F),[i]=(0,a.fp)(o.AG.user_base_info),l=i?.user_data?.search_exclude_names,[c,d]=(0,n.useState)(Array.isArray(l)?[...l]:[]),[_,h]=(0,n.useState)(""),[m,f]=(0,n.useState)(!1),x=()=>{const e=_.trim();e&&!c.includes(e)&&(d([...c,e]),h(""))};return(0,$.jsxs)("div",{className:"search-ignore-setting",children:[(0,$.jsx)("div",{className:"search-ignore-setting__desc",children:t("按名字忽略说明")}),(0,$.jsxs)("div",{className:"search-ignore-setting__add",children:[(0,$.jsx)(u.Sm,{value:_,placeholder:t("如 node_modules"),handleInputChange:e=>h(e),handlerEnter:x,width:"20em"}),(0,$.jsx)(E.rA,{icon:"add",title:t("添加"),onClick:x})]}),(0,$.jsxs)("div",{className:"search-ignore-setting__list",children:[0===c.length&&(0,$.jsx)("div",{className:"search-ignore-setting__empty",children:t("暂无")}),c.map(e=>(0,$.jsxs)("div",{className:"search-ignore-setting__item",children:[(0,$.jsx)("span",{className:"material-symbols-outlined",children:"block"}),(0,$.jsx)("span",{className:"search-ignore-setting__item-name",children:e}),(0,$.jsx)(E.rA,{icon:"delete",title:t("删除"),onClick:()=>(e=>d(c.filter(t=>t!==e)))(e)})]},e))]}),(0,$.jsxs)("div",{className:"div-row div-row--end search-ignore-setting__footer",children:[(0,$.jsx)(E.rA,{icon:"arrow_back",title:t("返回"),onClick:e.on_back}),(0,$.jsx)(E.rA,{icon:"save",title:t("保存"),onClick:async()=>{if(m)return;f(!0);const t=await r.wm.post(M.s.user_save_private_attr,{is_search_exclude:!0,search_exclude_names:c});f(!1),t?.code===p.m.Success&&(await s(),e.on_back())}})]})]})}const R=500;function X(e){const{t}=(0,g.Bd)(),s=(0,c.Zp)(),[,i]=(0,a.fp)(o.AG.prompt_card),[l]=(0,a.fp)(o.AG.user_base_info),{click_file:r}=(0,m.kZ)(),[d,_]=(0,n.useState)(""),[h,p]=(0,n.useState)("name"),[f,x]=(0,n.useState)(!1),[v,w]=(0,n.useState)(!1),[j,y]=(0,n.useState)(!0),[k,b]=(0,n.useState)([]),[G,N]=(0,n.useState)([]),[C,S]=(0,n.useState)(!1),[M,X]=(0,n.useState)(!1),[D,L]=(0,n.useState)(!1),[K,U]=(0,n.useState)([]),[B,Z]=(0,n.useState)(0),[H,Y]=(0,n.useState)(!1),O=(0,n.useMemo)(()=>new z.I(window.location.host,"file_deep_search"),[]),W=(0,n.useRef)(!1),T=(0,n.useRef)(!1),q=decodeURIComponent(e.base_path),V=()=>i({open:!1}),J=()=>{const e=l?.user_data?.search_exclude_names;return Array.isArray(e)?e:[]};(0,n.useEffect)(()=>{N(J())},[l?.user_data?.search_exclude_names]),(0,n.useEffect)(()=>{let e=[],t=null;const s=()=>{if(t=null,W.current||T.current||!e.length)return;const s=e;e=[],Z(e=>e+s.length),U(e=>e.length>=R?e:[...e,...s].slice(0,R))},n=()=>{W.current||L(!1)};return O.addMsg(A.HK.file_deep_search_data,n=>{W.current||T.current||(e.push(...n.context??[]),null===t&&(t=setTimeout(s,100)))}),O.addMsg(A.HK.file_deep_search_end,()=>{W.current||T.current||(s(),L(!1))}),O.on_message("close",n),()=>{W.current=!0,clearTimeout(t),O.sendData(A.HK.file_deep_search_cancel,{}).catch(()=>{}),O.off_message("close",n),O.close()}},[]);const Q=()=>{const t=d.trim();if(!t||D)return;T.current=!1,U([]),Z(0),Y(!0),L(!0);const s={param_path:e.base_path,keyword:t,search_type:h,is_regex:f,ignore_case:v};"content"===h&&(s.show_match_line=j),k.length&&(s.exclude_paths=k),G.length&&(s.exclude_names=G),O.sendData(A.HK.file_deep_search,s).catch(()=>{})},ee=e=>{let t=e.is_dir?e.path:e.path.slice(0,e.path.lastIndexOf("/")+1);t.endsWith("/")||(t+="/"),V(),s(I.o.file+t.split("/").map(encodeURIComponent).join("/"))},te=async e=>{if(e.is_dir)return ee(e);const t=e.path.slice(0,e.path.lastIndexOf("/")+1)||"/";V(),s(I.o.file+t.split("/").map(encodeURIComponent).join("/")),await new Promise(e=>setTimeout(e,300)),await r({name:e.name,opt_shell:!0})},se="content"===h;return M?(0,$.jsx)(F,{on_back:()=>{X(!1),N(J())}}):(0,$.jsxs)("div",{className:"file-deep-search",children:[(0,$.jsxs)("div",{className:"file-deep-search__bar",children:[(0,$.jsx)(u.$Z,{icon:"search",value:d,placeholder:t(se?"搜文件内容":"搜文件名"),handleInputChange:e=>_(e),handleEnterPress:Q}),(0,$.jsx)("button",{className:"button button--flat",onClick:D?()=>{T.current=!0,O.sendData(A.HK.file_deep_search_cancel,{}).catch(()=>{}),L(!1)}:Q,children:t(D?"取消":"搜索")}),(0,$.jsx)(E.rA,{icon:"close",title:t("关闭"),onClick:V})]}),(0,$.jsxs)("div",{className:"file-deep-search__tabs",children:[(0,$.jsx)("button",{className:"file-deep-search__tab"+(se?"":" file-deep-search__tab--active"),onClick:()=>p("name"),children:t("文件名")}),(0,$.jsx)("button",{className:"file-deep-search__tab"+(se?" file-deep-search__tab--active":""),onClick:()=>p("content"),children:t("文件内容")})]}),(0,$.jsxs)("div",{className:"file-deep-search__options",children:[(0,$.jsx)(u.GL,{context:t("正则"),selected:f,onchange:()=>x(!f)}),(0,$.jsx)(u.GL,{context:t("忽略大小写"),selected:v,onchange:()=>w(!v)}),se&&(0,$.jsx)(u.GL,{context:t("显示匹配行"),selected:j,onchange:()=>y(!j)})]}),(0,$.jsxs)("div",{className:"file-deep-search__hint",children:[(0,$.jsxs)("span",{children:[t("范围"),":",q]}),(0,$.jsxs)("span",{className:"file-deep-search__hint-right",children:[(k.length>0||G.length>0)&&(0,$.jsxs)("span",{className:"file-deep-search__excluded",children:[t("已排除")," ",k.length+G.length]}),(0,$.jsxs)("button",{className:"file-deep-search__filter"+(C?" file-deep-search__filter--active":""),onClick:()=>S(!C),children:[(0,$.jsx)("span",{className:"material-symbols-outlined",children:"filter_alt"}),t("过滤")]}),B>0&&(0,$.jsx)("span",{className:"file-deep-search__count",children:B>R?`${t("已显示")} 500 / ${B}`:`${B}`})]})]}),C&&(0,$.jsx)(P,{base_path:e.base_path,exclude_paths:k,ignore_names:G,on_change_paths:b,on_change_names:N,on_open_setting:()=>X(!0)}),(0,$.jsxs)("div",{className:"file-deep-search__body"+(se&&j?" file-deep-search__body--line":""),children:[K.length>0&&(0,$.jsx)("div",{className:"file-deep-search__results",children:K.map(e=>{const s=e.path.slice(0,e.path.lastIndexOf("/")+1);return(0,$.jsxs)("div",{className:"file-deep-search__row",children:[(0,$.jsxs)("div",{className:"file-deep-search__name",children:[e.is_dir?(0,$.jsx)("span",{className:"file-deep-search__dir",children:e.name}):(0,$.jsx)("span",{className:"file-deep-search__file",title:e.name,children:e.name}),(0,$.jsx)("span",{className:"file-deep-search__path",children:s}),e.lines&&e.lines.length>0&&(0,$.jsx)("div",{className:"file-deep-search__lines",children:e.lines.map(t=>(0,$.jsxs)("div",{className:"file-deep-search__line",onClick:()=>te(e),children:[(0,$.jsx)("span",{className:"file-deep-search__line-no",children:t.line}),(0,$.jsx)("span",{className:"file-deep-search__line-text",children:t.text})]},t.line))})]}),(0,$.jsxs)("div",{className:"file-deep-search__actions",children:[(0,$.jsx)(E.rA,{icon:"open_in_new",title:e.is_dir?t("打开"):t("打开文件"),onClick:()=>te(e)}),(0,$.jsx)(E.rA,{icon:"folder_open",title:t("打开所在目录"),onClick:()=>ee(e)})]})]},e.path)})}),D&&(0,$.jsxs)("div",{className:"file-deep-search__empty",children:[(0,$.jsx)("span",{className:"chat-session-running",title:t("搜索中")}),t("搜索中")]}),!D&&B>R&&(0,$.jsx)("div",{className:"file-deep-search__more",children:t("结果过多")}),!D&&0===K.length&&(0,$.jsx)("div",{className:"file-deep-search__empty",children:t(H?"无匹配":se?"输入内容后搜":"输入后搜")})]})]})}var D=s(64694),L=s(12730),K=s(75725),U=s(70447),B=s(40505);let Z={};function H(){const{t:e}=(0,g.Bd)();let t=(0,c.zy)();const s=(0,c.Zp)(),{check_user_auth:i}=(0,w.MH)(),[l,d]=(0,a.fp)(o.AG.nowFileList),[p,u]=(0,a.fp)(o.AG.uploadFiles),[j,y]=(0,a.fp)(o.AG.showPrompt),[k,N]=(0,a.fp)(o.AG.selectedFileList),[S,z]=(0,a.fp)(o.AG.copyedFileList),[M,P]=(0,a.fp)(o.AG.cutedFileList),[F,R]=(0,a.fp)(o.AG.selectedFileList),[X,B]=(0,a.fp)(o.AG.clickFileList),[H,Y]=(0,a.fp)(o.AG.fileShellShow),O=(0,m.Cf)(),[W,T]=(0,a.fp)(o.AG.file_root_list),[q,V]=(0,a.fp)(o.AG.file_root_index),[J,Q]=(0,n.useState)(void 0),[ee,te]=(0,n.useState)(""),[se,ne]=(0,a.fp)(o.AG.workflow_show),[ie,ae]=(0,a.fp)(o.AG.workflow_realtime_show),[le,oe]=(0,a.fp)(o.AG.work_flow_show),{initUserInfo:re}=(0,n.useContext)(v.F),[ce,de]=(0,a.fp)(o.AG.user_base_info),{click_file:_e}=(0,m.kZ)(),[he,pe]=(0,a.fp)(o.AG.prompt_card),me=(0,n.useMemo)(()=>l.files.reduce((e,t)=>e+(t.type!==f.Iw.folder?1:0),0),[l]),ue=(0,n.useMemo)(()=>l.files.reduce((e,t)=>e+(t.type===f.Iw.folder?1:0),0)+(l.folders?.length??0),[l]);function fe(e){(0,x.SK)(e)}(0,n.useEffect)(()=>{Z={}},[t]),(0,n.useEffect)(()=>()=>{Y({show:!1,path:""})},[]);const xe=(0,m.Vs)(),ge=t=>{pe({open:!0,title:e("信息"),context_div:(0,$.jsxs)("div",{style:{maxWidth:"25rem"},children:[(0,$.jsx)(K.Yh,{left:e("挂载位置磁盘"),right:t?.total_size}),(0,$.jsx)(K.Yh,{left:`${e("磁盘剩余")}`,right:t?.left_size}),(0,$.jsx)(K.Yh,{left:`${e("文件系统")}`,right:t?.fs_type}),(0,$.jsx)(K.Yh,{left:`${e("文件夹数")}`,right:ue}),(0,$.jsx)(K.Yh,{left:`${e("文件数")}`,right:me}),(0,$.jsx)(K.Yh,{left:`${e("当前位置")}`,right:(0,$.jsx)(U.xP,{context:t?.now_absolute_path})})]}),cancel:()=>{b.ws.removeMsg(A.HK.file_info)}})};return(0,$.jsxs)(n.Fragment,{children:[k.length>0&&(0,$.jsx)(E.rA,{icon:"delete",title:e("删除"),onClick:()=>{y({show:!0,type:_.PromptEnum.FilesDelete,overlay:!0,data:{}})}}),k.length>0&&(0,$.jsx)(E.rA,{icon:"content_copy",title:e("复制"),onClick:function(){const e=(0,m.ib)(l,k);z(e.map(e=>(0,m.Ok)(e.name))),P([]),fe("已复制")}}),k.length>0&&(0,$.jsx)(E.rA,{icon:"content_cut",title:e("剪切"),onClick:function(){const e=(0,m.ib)(l,k);P(e.map(e=>(0,m.Ok)(e.name))),z([]),fe("已剪切")}}),(S.length>0||M.length>0)&&(0,$.jsx)(E.rA,{onClick:function(){y({show:!0,type:_.PromptEnum.Confirm,overlay:!0,data:{}})},icon:"content_paste",title:e("粘贴到此处"),tip:S.length+M.length}),k.length>0&&(0,$.jsx)(E.rA,{icon:"download",title:e("下载"),onClick:function(){const e=(0,m.ib)(l,k);for(let t=0;t<e.length;t++){const s=e[t];e[t]=encodeURIComponent((0,m.Ok)(s.name))}const t=r.$M.getDownloadUrl(e);window.open(t)}}),k.length>0&&(0,$.jsx)(E.rA,{icon:"compress",title:e("压缩"),onClick:function(){const t=(0,m.ib)(l,k);for(let e=0;e<t.length;e++){const s=t[e];t[e]=(0,m.Ok)(s.name)}t&&0!==t.length?y({show:!0,type:_.PromptEnum.Compress,overlay:!0,data:{files:t}}):(0,x.zN)(e("没有选中"))}}),1===k.length&&(0,$.jsx)(E.rA,{icon:"edit_attributes",title:e("重命名"),onClick:function(){y({show:!0,type:_.PromptEnum.FileRename,overlay:!0,data:{}})}}),le&&(0,$.jsx)(E.rA,{icon:"api",title:"workflow",onClick:()=>{ne(!se)}}),O.can_terminal&&(0,$.jsx)(E.rA,{icon:"terminal",title:"shell",onClick:function(){H.show?Y({show:!1,path:""}):Y({show:!0,path:(0,h.GG)("file",(0,h.vX)())})}}),i(G.oV.share_file)&&(0,$.jsx)(E.rA,{icon:"share",title:e("文件分享"),onClick:()=>{s(`${I.o.share_list_setting_page}`)}}),(0,$.jsx)(E.rA,{icon:"grid_view",title:e("切换样式"),onClick:xe}),(0,$.jsx)(E.rA,{icon:"create_new_folder",title:e("创建文件夹"),onClick:function(){y({show:!0,type:_.PromptEnum.DirNew,overlay:!0,data:{dir:(0,h.GG)("file",(0,h.vX)())}})}}),(0,$.jsx)(E.rA,{icon:"note_add",title:e("创建文本文件"),onClick:function(){y({show:!0,type:_.PromptEnum.FileNew,overlay:!0,data:{dir:(0,h.GG)("file",(0,h.vX)())}})}}),(0,$.jsx)(E.rA,{icon:"upload_file",title:e("上传"),onClick:()=>{y({show:!0,type:_.PromptEnum.UploadFile,overlay:!0,data:{call:e=>{let t=e.currentTarget?.files;if(!t)return;let s=!!t[0].webkitRelativePath;const n=[],i=new Set;for(let e=0;e<t.length;e++){const a=t[e],l=s?a.webkitRelativePath:`${a.webkitRelativePath}${a.name}`;a.fullPath=l,s&&i.add((0,L.S)(l)),n.push(a)}const a=[];if(s)for(const e of i)a.push({isDir:!0,fullPath:e,name:e});a.push(...n),u(a),y({show:!0,type:_.PromptEnum.FilesUpload,overlay:!1,data:{}})}}})}}),(0,$.jsx)(E.rA,{icon:"info",title:e("信息"),onClick:async()=>{let e;if(!Z.now_absolute_path){b.ws.addMsg(A.HK.file_info,t=>{const s=t.context;e&&(Z={...Z,...s},b.ws.removeMsg(A.HK.file_info),ge(Z))});const t=await b.ws.sendData(A.HK.file_info,{type:f.Iw.folder,path:(0,h.GG)("file",(0,h.vX)())});e=t.context,Z=e,ge(Z)}ge(Z)}}),(0,$.jsx)(E.rA,{icon:"more_vert",title:e("切换目录"),onClick:t=>{const n=new C.ik;n.x=t.clientX,n.y=t.clientY,n.type=f.Iw.directory,n.items=W,n.item_pre_value=q,n.textClick=async t=>{if(t.type===C.LU.add)return s(`${I.o.setting_private_env_setting}`),y({data:void 0,overlay:!1,type:"",show:!1}),void(0,x.N9)(e("请配置 文件夹路径"));y({data:void 0,overlay:!1,type:"",show:!1}),t.type!==C.LU.child?(async e=>{V(e),await r.$M.post("base_switch",{root_index:e}),await re(),s("/file/"),R([]),B([])})(t.index):s((0,D.IO)(I.o.file,t.rel))},y({show:!0,type:_.PromptEnum.FileMenu,overlay:!1,data:n})}})]})}var Y=s(2543),O=s(21499);const W=n.lazy(()=>Promise.all([s.e(7856),s.e(6349),s.e(3659)]).then(s.bind(s,63659))),T=n.lazy(()=>Promise.all([s.e(7856),s.e(1636)]).then(s.bind(s,81636))),q=n.lazy(()=>Promise.all([s.e(3277),s.e(9345)]).then(s.bind(s,49345)));let V,J="";function Q(){const[e,t]=(0,a.fp)(o.AG.editorSetting),[,s]=(0,a.fp)(o.AG.md_editor),[,x]=(0,a.fp)(o.AG.log_viewer),[,z]=(0,a.fp)(o.AG.image_editor),[,P]=(0,a.fp)(o.AG.markdown),[,F]=(0,a.fp)(o.AG.excalidraw_editor),[,R]=(0,a.fp)(o.AG.mind_editor),[,L]=(0,a.fp)(o.AG.timeline_editor),[,K]=(0,a.fp)(o.AG.excel_editor),[U,Z]=(0,a.fp)(o.AG.file_preview),{t:Q}=(0,g.Bd)();let ee=(0,c.zy)();const te=(0,c.Zp)(),[se,ne]=(0,a.fp)(o.AG.nowFileList),[ie]=(0,a.fp)(o.AG.file_list_refresh),[ae]=(0,a.fp)(o.AG.mount_enabled),[le,oe]=(0,a.fp)(o.AG.current_mount),[re,ce]=(0,a.fp)(o.AG.showPrompt),[de,_e]=(0,a.fp)(o.AG.selectedFileList),[he,pe]=(0,a.fp)(o.AG.clickFileList),[me,ue]=(0,a.fp)(o.AG.fileShellShow),[fe,xe]=(0,n.useState)(""),[ge,ve]=(0,a.fp)(o.AG.workflow_show),[we,je]=(0,a.fp)(o.AG.workflow_realtime_show),[ye,ke]=(0,a.fp)(o.AG.work_flow_show),{initUserInfo:be}=(0,n.useContext)(v.F),[Ae,Ge]=(0,a.fp)(o.AG.user_base_info),{check_user_auth:Ne}=(0,w.MH)(),{click_file:Ce}=(0,m.kZ)(),[Se]=(0,c.ok)(),Ie=(0,m._A)(),ze=n.useRef(null),[Ee,Me]=(0,a.fp)(o.AG.to_running_files),[$e,Pe]=(0,a.fp)(o.AG.file_page),[Fe]=(0,a.fp)(o.AG.blank_search_mode),[,Re]=(0,a.fp)(o.AG.prompt_card),[Xe,De]=(0,a.fp)(o.AG.blank_search_mode_for_temp),Le=(0,m.oT)(),Ke="1"===Se.get("chat_open"),Ue=Ne(G.oV.ai_agent_page),Be=(0,m.Cf)();(0,n.useEffect)(()=>{Ae?.user_data&&Ke&&!Ue&&Le("chat_open",null)},[Ke,Ue,Ae]);const[Ze,He]=(0,a.fp)(o.AG.studio_chat_width),Ye=n.useRef(null),[Oe,We]=(0,n.useState)(!1),[Te,qe]=(0,n.useState)(void 0),Ve=(0,m.dN)();(0,m.rJ)(Ve());const[Je,Qe]=(0,a.fp)(o.AG.ai_chat_session_by_cwd),et=function(){const e=(0,m.Cf)(),[t,s]=(0,a.fp)(o.AG.user_base_info),{t:i}=(0,g.Bd)(),{check_user_auth:l}=(0,w.MH)(),[d,p]=(0,a.fp)(o.AG.router_jump),u=(0,c.Zp)(),{initUserInfo:x}=(0,n.useContext)(v.F),[j,y]=(0,a.fp)(o.AG.nowFileList),[k,N]=(0,a.fp)(o.AG.showPrompt),[S,z]=(0,a.fp)(o.AG.fileShellShow),[E,P]=(0,a.fp)(o.AG.blank_search_mode);return s=>{s.preventDefault(),s.stopPropagation();const n=new C.ik;n.x=s.clientX,n.y=s.clientY,n.type=f.Iw.directory;const a=[{r:(0,$.jsx)("span",{style:(0,B.ok)(t.user_data.dir_show_type===G.t8.time_minx_max),children:i("时间逆序")}),v:G.t8.time_minx_max},{r:(0,$.jsx)("span",{style:(0,B.ok)(t.user_data.dir_show_type===G.t8.time_max_min),children:i("时间顺序")}),v:G.t8.time_max_min}],o=[{r:(0,$.jsx)("span",{style:(0,B.ok)(t.user_data.dir_show_type===G.t8.size_min_max),children:i("大小顺序")}),v:G.t8.size_min_max},{r:(0,$.jsx)("span",{style:(0,B.ok)(t.user_data.dir_show_type===G.t8.size_max_min),children:i("大小逆序")}),v:G.t8.size_max_min}],c=[{r:(0,$.jsx)("span",{style:(0,B.ok)(!t.user_data.file_list_pagination_mode||t.user_data.file_list_pagination_mode===G.yM.all),children:i("全部加载文件")}),v:G.yM.all},{r:(0,$.jsx)("span",{style:(0,B.ok)(t.user_data.file_list_pagination_mode===G.yM.pagination),children:i("scrll_l")}),v:G.yM.pagination}],d=[{r:(0,$.jsx)("span",{style:(0,B.ok)(!t.user_data.file_time_show_type||t.user_data.file_time_show_type===G.KD.current),children:i("最近时间")}),v:G.KD.current},{r:(0,$.jsx)("span",{style:(0,B.ok)(t.user_data.file_time_show_type===G.KD.time),children:i("准确时间")}),v:G.KD.time}],g=[{r:i("文件列表展示"),items:[{r:i("文件排序"),v:"",items:[{r:(0,$.jsx)("span",{style:(0,B.ok)(!t.user_data.dir_show_type),children:i("系统默认")}),v:G.t8.defualt},{r:(0,$.jsx)("span",{style:(0,B.ok)(t.user_data.dir_show_type===G.t8.name),children:i("名字")}),v:G.t8.name},{r:(0,$.jsx)("span",{style:(0,B.ok)(t.user_data.dir_show_type===G.t8.time_minx_max||t.user_data.dir_show_type===G.t8.time_max_min),children:i("修改时间")}),v:!1,items:a},{r:(0,$.jsx)("span",{style:(0,B.ok)(t.user_data.dir_show_type===G.t8.size_min_max||t.user_data.dir_show_type===G.t8.size_max_min),children:i("文件大小")}),v:!1,items:o}]},{r:i("文件加载方式"),v:"",items:c},{r:i("时间展示"),v:"",items:d},{r:i("缩放调整"),v:"zoom_adjust"},{r:(0,$.jsx)("span",{style:(0,B.ok)(E),children:i("srchbln")}),v:"blank_search_mode"}]}];e.git_available&&j?.folders?.find(e=>".git"===e.name)&&g.push({r:i("查看Git提交"),v:"git_page"}),l(G.oV.http_proxy)&&g.push({r:i("dl_here"),v:"http_resource"}),t?.user_data?.quick_cmd&&(0,m.LL)([...t.user_data.quick_cmd],g),n.items=g,n.textClick=async e=>{if(console.log(e),!1===e)return;const t={};if("gcfg_dir_config"===e){const e=(0,h.GG)("file",(0,h.vX)());return N({data:void 0,overlay:!1,type:"",show:!1}),void u(`${I.o.gcfg_page}/${encodeURIComponent(e)}`)}if("git_page"===e){const e=(0,h.GG)("file",(0,h.vX)());return N({data:void 0,overlay:!1,type:"",show:!1}),void u(`${I.o.git_page}/${encodeURIComponent(e)}`)}if("http_resource"===e){const e=await b.ws.sendData(A.HK.file_info,{path:(0,h.GG)("file",(0,h.vX)())});return p({http_download_map_path:e.context.now_absolute_path}),N({data:void 0,overlay:!1,type:"",show:!1}),void u("/proxy/http/")}if("zoom_adjust"===e)return N({data:void 0,overlay:!1,type:"",show:!1}),void setTimeout(()=>{N({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",z({show:!0,path:(0,h.GG)("file",(0,h.vX)()),cmd:t})))}else{if("blank_search_mode"===e)return P(!E),void N({data:void 0,overlay:!1,type:"",show:!1});if(e===G.yM.all||e===G.yM.pagination)t.is_pagination_mode=!0;else if(e===G.KD.current||e===G.KD.time)t.is_file_show_type=!0;else{if(e!==G.t8.defualt&&e!==G.t8.name&&e!==G.t8.size_max_min&&e!==G.t8.size_min_max&&e!==G.t8.time_max_min&&e!==G.t8.time_minx_max)return;t.is_dir_list_type=!0}}await r.wm.post(M.s.user_save_private_attr,{type:e,...t}),await x(),N({data:void 0,overlay:!1,type:"",show:!1}),u((0,h.vX)())},N({show:!0,type:_.PromptEnum.FileMenu,overlay:!1,data:n})}}(),tt=async e=>{let t=!1;for(const s of e.files??[])s.origin_size=s.size,s.size=(0,j.v7)(s.size),Ae.user_data.file_time_show_type===G.KD.time?s.show_mtime=s.mtime?(0,O.Yq)(s.mtime):"":s.show_mtime=s.mtime?(0,y.s)(s.mtime):"",s.name===k.SB&&(t=!0);for(const s of e.folders??[])Ae.user_data.file_time_show_type===G.KD.time?s.show_mtime=s.mtime?(0,O.Yq)(s.mtime):"":s.show_mtime=s.mtime?(0,y.s)(s.mtime):"",s.name===k.SB&&(t=!0);ke(t)},st=n.useRef(null),nt=async e=>{if(!0===ae){if(st.current!==e){st.current=e;try{const t=await r.$M.post("file/mount_info",{param_path:e});oe(t?.data??null),await b.ws.connect()}catch(e){oe(null)}}}else oe(null)};(0,n.useEffect)(()=>{ye&&(async()=>{const e=new k.Nd,t=(0,l.zp)().get(o.AG.current_mount);e.dir_path=(0,m.Zl)((0,h.GG)("file",(0,h.vX)()),t),b.ws.addMsg(A.HK.workflow_realtime,e=>{const t=e.context;if(e.context){for(const e of t.sucess_file_list)(0,m.Ys)(e);for(const e of t.failed_file_list)(0,m.V$)(e);Me(new Set(t.running_file_list))}}),await b.ws.sendData(A.HK.workflow_realtime,e)})()},[ye,le,ee]);const it=async()=>{const e=(0,h.GG)("file",(0,h.vX)());if(Fe||Xe)return;let t;if(nt(e),Ae.user_data.file_list_pagination_mode===G.yM.pagination){if(J!==e){if(J=e,1!==$e.page_num)return void Pe({page_size:$e.page_size,page_num:1})}else if($e.page_num<0)return;if(t=await r.$M.post("file_get_page",{param_path:e,page_num:$e.page_num,page_size:$e.page_size}),t.code!==p.m.Success)return;const s=t.data;return tt(s),s.files?.length?(ne(e=>{const t=(0,Y.cloneDeep)(1===$e.page_num?s.files:[...e?.files??[],...s.files]),n={...e,files:t};return(0,m.yC)(n,Ae.user_data.dir_show_type),n}),void(V=t.data)):void Pe({page_size:$e.page_size,page_num:-1})}if(t=await r.$M.get(e),t.code!==p.m.Success)return;const s=t.data;(0,m.yC)(s,Ae.user_data.dir_show_type),tt(t.data),ne(t.data),V=t.data};(0,n.useEffect)(()=>async()=>{Me(new Set)},[]);const at=()=>{ke(!1),(()=>{const e=Se.get("preview_file_name"),t=Se.get("preview_mode");if(!e||!t)return!1;const n=(0,h.GG)("file",(0,h.vX)());if(ze.current===n+e)return!0;ze.current=n+e;const i=()=>Ie(null);return"md"===t?(s({url:r.$M.getDownloadUrl(`${encodeURIComponent(n)}${e}`),path:`${n}${e}`,name:e,close:i}),!0):"log"===t?(x({show:!0,fileName:e,encoding:Se.get("preview_log_enc")??"utf8",wrap:Se.get("preview_log_wrap")??"wrap",close:i}),!0):"image_edit"===t?(z({path:(0,D.IO)((0,h.vX)(),e),name:e,close:i}),!0):(Ce({name:e,opt_shell:!0,..."text"===t?{model:"text"}:{},close:i}),!0)})()||(t({open:!1}),Z({open:!1}),s({}),x({show:!1}),z({}),P({}),F({}),R({}),L({}),K({}),it())};(0,n.useEffect)(()=>{at()},[ee,$e]),(0,n.useEffect)(()=>{ie>0&&it()},[ie]);const lt=n.useRef(!1);(0,n.useEffect)(()=>{if(null!==ae)return lt.current?void(!0===ae?nt((0,h.GG)("file",(0,h.vX)())):oe(null)):(lt.current=!0,void(!0===ae&&null===le&&nt((0,h.GG)("file",(0,h.vX)()))))},[ae]);const ot=()=>{const e=(0,h.GG)("file",(0,h.vX)());Re({open:!0,title:Q("深搜"),context_div:(0,$.jsx)(X,{base_path:e})})},rt=e=>{e.target===e.currentTarget&&(_e([]),pe([]))},ct=n.useCallback((0,Y.throttle)(e=>{const t=Ye.current;if(!t||!t.parentElement)return;const s=parseFloat(getComputedStyle(t).fontSize),n=t.parentElement.getBoundingClientRect(),i=n.right-e.clientX,a=Math.min(Math.max(i,320),.7*n.width);He(parseFloat((a/s).toFixed(2)))},32),[]),dt=()=>{We(!1),document.removeEventListener("pointermove",ct)},_t=(0,$.jsxs)("div",{className:"file-list-main",children:[(0,$.jsx)(i.e,{baseRoute:"file",clickFun:function(){if(_e([]),pe([]),Ae.user_data.file_list_pagination_mode===G.yM.pagination){const e=document.getElementById("listing");e&&(e.scrollTop=0),Pe({page_size:$e.page_size,page_num:1})}},input_path_enter:e=>{var t;_e([]),pe([]),ne({files:[],folders:[]}),(0,N.Z1)(e)?(e=e.replace(0===(t=Ae.user_data).folder_item_now||void 0===t.folder_item_now?t.cwd:t.folder_items[t.folder_item_now-1].path,""),te(e)):te((0,N.Jn)((0,h.vX)(),e))}}),le&&(0,$.jsxs)("div",{className:"mount-tip-bar",style:{borderLeftColor:le.color},children:[(0,$.jsx)("span",{className:"material-icons",style:{color:le.color},children:"cloud"}),(0,$.jsx)("span",{children:[{v:le.driver,t:Q("驱动")},{v:le.credential_note,t:Q("凭据")},{v:le.account_note,t:Q("账号")}].filter(e=>Boolean(e.v)).map(e=>`${e.v}(${e.t})`).join(" - ")}),le.readonly&&(0,$.jsx)("span",{className:"mount-readonly-tag",children:Q("只读")})]}),Ae.user_data.file_list_pagination_mode===G.yM.pagination?(0,$.jsx)(S.$J,{handleContextMenu:et,clickBlank:rt,list:se.files}):(0,$.jsx)(S.t$,{handleContextMenu:et,file_list:se.files,folder_list:se.folders,clickBlank:rt})]});return(0,$.jsxs)(n.Fragment,{children:[(0,$.jsxs)(d.aZ,{children:[(0,$.jsx)("div",{className:"mobile-deep-search-btn",children:(0,$.jsx)(E.rA,{icon:"search",title:Q("搜索"),onClick:ot})}),(0,$.jsx)(u.$Z,{handleEnterPress:async()=>{if(Fe||Xe){if(_e([]),pe([]),!fe||!fe.trim())return void ne({files:[],folders:[]});const e=(0,h.GG)("file",(0,h.vX)()),t=await r.$M.post("file_get_page",{param_path:e,page_num:1,page_size:1e4,search:fe.trim()});if(t.code!==p.m.Success)return;const s=t.data;return(0,m.yC)(s,Ae.user_data.dir_show_type),tt(s),ne(s),void(V=s)}if(!V)return;_e([]),pe([]);const e=[],t=[];for(const t of V.files??[])t.name.includes(fe)&&e.push(t);for(const e of V.folders??[])e.name.includes(fe)&&t.push(e);ne({files:e,folders:t})},placeholder:Q("搜索当前目录"),icon:"search",value:"",mobile_hidden:!0,handleIconClick:ot,handleInputChange:e=>{xe(e)},max_width:"25em"})]}),(0,$.jsxs)(d.aZ,{position:"right",children:[Ne(G.oV.ai_agent_page)&&Be.ai_chat_available&&(0,$.jsx)(E.rA,{icon:"smart_toy",title:Q("AI 聊天"),selected:Ke,onClick:()=>Le("chat_open",!Ke?"1":null)}),(0,$.jsx)("div",{className:"mobile-context-btn",children:(0,$.jsx)(E.rA,{icon:"more_horiz",title:Q("右键"),onClick:()=>{const e=de[de.length-1];if(void 0!==e){const t=[...se.folders??[],...se.files??[]][e];if(t){const s=document.querySelectorAll(".item")[e],n=s?s.getBoundingClientRect():{left:window.innerWidth/2,bottom:100},i={preventDefault:()=>{},stopPropagation:()=>{},clientX:n.left+10,clientY:n.bottom??100},a=new C.ik;a.path=(0,D.IO)((0,h.vX)(),t.name),a.filename=t.name,a.x=i.clientX,a.y=i.clientY,a.type=t.type===f.Iw.folder?f.Iw.folder:(0,C.uL)(t.name),a.size=t.origin_size,ce({show:!0,type:_.PromptEnum.FileMenu,overlay:!1,data:a})}}else{const e={preventDefault:()=>{},stopPropagation:()=>{},clientX:window.innerWidth/2,clientY:window.innerHeight/2};et(e)}}})}),(0,$.jsx)(H,{})]}),(0,$.jsxs)("div",{className:"file-list-split"+(Ke?" file-list-split--chat":""),children:[_t,Ke&&(0,$.jsxs)(n.Fragment,{children:[(0,$.jsx)("div",{className:"studio__divider studio__divider--chat",ref:Ye,onPointerDown:e=>{e.preventDefault(),We(!0),document.addEventListener("pointermove",ct),document.addEventListener("pointerup",dt,{once:!0})}}),(0,$.jsx)("div",{className:"studio-chat-panel",style:{width:`${Ze}em`},children:(0,$.jsx)(n.Suspense,{fallback:null,children:(0,$.jsx)(q,{inline_header:!0,sync_url:!1,file_cwd_path:Ve(),session_id:Te??(ht=Ve(),o.AG.get_ai_chat_session(Je,ht)),on_session_change:e=>{qe(e),((e,t)=>{Qe({...Je,[e]:t})})(Ve(),e)}})})})]})]}),Oe&&(0,$.jsx)("div",{className:"shell__overlay",onPointerUp:dt}),ge&&(0,$.jsx)(W,{}),we.open&&(0,$.jsx)(T,{})]});var ht}}}]);