filecat 6.63.1 → 6.64.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/build/dist/1448.232c15e7a54d5fd63ecf.js +1 -0
  2. package/build/dist/1472.5db284b3632a44705cde.js +1 -0
  3. package/build/dist/1893.4caf367bf06a83c09adf.js +1 -0
  4. package/build/dist/2542.98a0391ad37c342ef5d0.js +1 -0
  5. package/build/dist/2674.4822fb467f3da4255c10.js +1 -0
  6. package/build/dist/{2851.feefe2fc4a39ad506719.js → 2851.baea584c36417d65ded8.js} +1 -1
  7. package/build/dist/{3215.aed023089c03fa4b3c40.js → 3215.1d29fa4eb2be01d77fea.js} +2 -2
  8. package/build/dist/4273.9d196861ce7907a19e13.js +1 -0
  9. package/build/dist/5308.78bd4ed591fdfdcd82e7.js +1 -0
  10. package/build/dist/5516.14b0319983e46a1880ca.js +1 -0
  11. package/build/dist/5877.803d7b1a9f6d6e1264e9.js +1 -0
  12. package/build/dist/5937.2505cb3d3bcf2393e063.js +1 -0
  13. package/build/dist/6247.f337a0766a216e034bde.js +1 -0
  14. package/build/dist/6505.f37ff577812fccac9b45.js +1 -0
  15. package/build/dist/676.98b607bbe65d44bc5df1.js +1 -0
  16. package/build/dist/6919.a65dcb5e95df23edd818.js +1 -0
  17. package/build/dist/8302.53fffbe4b9ecef206405.js +1 -0
  18. package/build/dist/8319.307ec20219e2828c9a47.js +1 -0
  19. package/build/dist/8603.72dcd1e8f1337a1b72bb.js +1 -0
  20. package/build/dist/8714.859f6f455bef5c6af36c.js +1 -0
  21. package/build/dist/8765.afede4d25bab0100d561.js +1 -0
  22. package/build/dist/8947.8b6aa577603dd4cf3d2d.js +2 -0
  23. package/build/dist/8947.8b6aa577603dd4cf3d2d.js.LICENSE.txt +3 -0
  24. package/build/dist/9546.bd518f38fcce8f30331d.js +1 -0
  25. package/build/dist/index.html +1 -1
  26. package/build/dist/main.e83a6beb323ff107165d.js +2 -0
  27. package/build/dist/{main.f074592fdc7851278bc0.js.LICENSE.txt → main.e83a6beb323ff107165d.js.LICENSE.txt} +1 -1
  28. package/build/main.js +1 -1
  29. package/build/threads.work.filecat.js +1 -1
  30. package/package.json +1 -1
  31. package/build/dist/1448.bec31a359f572e75c1ff.js +0 -1
  32. package/build/dist/1472.895b811ec7f9765b8afc.js +0 -1
  33. package/build/dist/1893.f2725744511511fde713.js +0 -1
  34. package/build/dist/2542.78f4821c3f796775f225.js +0 -1
  35. package/build/dist/2674.42bc8edcb369615417fd.js +0 -1
  36. package/build/dist/4273.2b31ae7645819802cf52.js +0 -1
  37. package/build/dist/5308.8059b2d04eb5de133d15.js +0 -1
  38. package/build/dist/5516.f96b5a3874804392788c.js +0 -1
  39. package/build/dist/5877.49ca6d4e542f022dbb0d.js +0 -1
  40. package/build/dist/5937.8d7e5116bbc7d2b4e478.js +0 -1
  41. package/build/dist/6247.9bbd3852fd64eadebd20.js +0 -1
  42. package/build/dist/6505.ac89deebae8c008595a1.js +0 -1
  43. package/build/dist/676.2854877784f5c96f2f52.js +0 -1
  44. package/build/dist/6892.bd3adea0ce83f685bfa5.js +0 -1
  45. package/build/dist/6919.c7510e6ed23cff35cd52.js +0 -1
  46. package/build/dist/8302.ac3c41dd08d3109cf766.js +0 -1
  47. package/build/dist/8319.fc897106bf47394f677c.js +0 -1
  48. package/build/dist/8603.8819e88398056f0e0562.js +0 -1
  49. package/build/dist/8714.76bcf304b61c484f32df.js +0 -1
  50. package/build/dist/8765.8f7b9458371b88887661.js +0 -1
  51. package/build/dist/8947.23e0d2bbb7604e1e0063.js +0 -2
  52. package/build/dist/8947.23e0d2bbb7604e1e0063.js.LICENSE.txt +0 -1
  53. package/build/dist/9546.fa400fbfc3c4ae7850ad.js +0 -1
  54. package/build/dist/main.f074592fdc7851278bc0.js +0 -2
  55. /package/build/dist/{3215.aed023089c03fa4b3c40.js.LICENSE.txt → 3215.1d29fa4eb2be01d77fea.js.LICENSE.txt} +0 -0
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[1448],{83277(e,t,l){l.d(t,{$j:()=>s,Lv:()=>n});class n{token;open=!1;note;index;url;model;request_type;json_params;sys_prompt;dotenv="";tool_mode=!1;show_options;static get_label_by_v(e,t){if(!e||!t?.length)return e;for(const l of t)if(l.value===e)return l.label;return e}static have_label_by_v(e,t){if(!e||!t?.length)return!1;for(const l of t)if(l.value===e)return!0;return!1}}const i=JSON.stringify({stream:!0,thinking:{type:"disabled"}});function s(e){return"string"==typeof e?e:Array.isArray(e)?e.map(e=>"text"===e.type?e.text:"[图片]").join("\n"):""}l.d(t,["CP",0,'\n\n\n\n# 聊天循环最大次数\ntool_call_max=500\n# 是否允许AI直接执行命令而不需要用户确认,默认为false,需要用户手动确认,如果使用 workflow 这里等价于为 true\nallow_exec_cmd_directly=false\n\n# 可选的代理 url,如果指定了所有访问大模型的请求将会走代理\n#proxy_url=\n\n# 可选的多个url 以数组分割\n# options_agent_url_list=[{"value":"http://..","label":"openai"}]\n\n# 可选的多个 key\n# options_agent_key_list=[{"value":"sh-aaa","label":"option1"}]\n\n# 可选的多个 model\n# options_agent_model_list=[{"value":"gpt-5.5","label":"gpt"}]\n\n# 存放本地的 prompt 文件 用于每次聊天的时候自动读取并加载\n# options_local_file_path_prompt_list=["/prompt/a.txt"]\n\n# 开启切换模型 ,开启以后,你可以自己写 prompt 提供多个模型让 ai 自己根据每次聊天切换下一步调用其他模型的次数\n# open_pick_model=false\n\n# 压缩后仍然完整保留的最近消息数\nmax_recent_messages=12\n# 当单个会话累计消息条数超过该值时,触发历史消息裁剪\ncompress_message_count=16\n# 历史消息中 tool 输出的最大字符数,只保留调用形式让 AI 知道调用了就行\nmax_tool_content_chars=200\n\n# ===== 模型类型(request_type)=====\n# 必填项,不同类型的 model 接口格式不同,默认 completions。\n# 可选值:\n# completions 标准对话/聊天补全 (chat/completions)\n# images 图片生成 (images/generations)\n# audio_speech 文本转语音 (audio/speech)\n# audio_transcription 语音转文字 (audio/transcriptions)\n# audio_translation 语音翻译 (audio/translations)\n# embeddings 向量嵌入 (embeddings)\n#request_type=completions\n\n# ===== 成为 tool(tool_mode)=====\n# 开启后该模型会作为一个工具被加载,可实现不同模型担任不同角色/能力,供 AI agent 在对话中动态调用。\n# 注意:不能与「是否开启」(open) 同时为 true。\n#tool_mode=false\n',"cL",0,i])},11448(e,t,l){l.r(t),l.d(t,{RebotCardContainer:()=>f,default:()=>v});var n=l(86149),i=l(96540),s=l(85997),a=l(57952),o=l(75725),r=l(61443),c=l(70447),d=l(14284),p=l(53459),h=l(62042),_=l(78247),m=l(23430),x=l(86090),u=(l(83277),l(92350)),j=l(74848);const b={qq:{key:"qq",label:"QQ 机器人",icon:"QQ",color:"#12B7F5",fields:[{key:"appId",label:"AppId",type:"text",placeholder:"请输入机器人 AppId",required:!0},{key:"clientSecret",label:"密钥",type:"password",placeholder:"请输入机器人密钥",required:!0}]},dingtalk:{key:"dingtalk",label:"钉钉机器人",icon:"钉钉",color:"#0089FF",fields:[{key:"appId",label:"ClientId (AppKey)",type:"text",placeholder:"请输入应用 ClientId",required:!0},{key:"clientSecret",label:"ClientSecret (AppSecret)",type:"password",placeholder:"请输入应用 ClientSecret",required:!0}]},wecom:{key:"wecom",label:"企业微信机器人",icon:"企业微信",color:"#07C160",fields:[{key:"appId",label:"botId",type:"text",placeholder:"请输入机器人 botId",required:!0},{key:"clientSecret",label:"Secret",type:"password",placeholder:"请输入机器人 Secret",required:!0}]},lark:{key:"lark",label:"飞书机器人",icon:"飞书",color:"#3370FF",fields:[{key:"appId",label:"App ID",type:"text",placeholder:"请输入应用 App ID",required:!0},{key:"clientSecret",label:"App Secret",type:"password",placeholder:"请输入应用 App Secret",required:!0}]}},g=Object.entries(b).map(([e,t])=>({value:e,title:t.label,color:t.color}));function f(e){const{t}=(0,n.B)(),[l,a]=(0,i.useState)(!1),[o,c]=(0,i.useState)(!1),d=(t,l)=>{const n=[...e.items];n[t]={...n[t],...l},e.setItems(n)},p=t=>{const l=[...e.items];l.splice(t,1),e.setItems(l)},h=t=>{e.setItems([...e.items,{...e.items[t],open:!1,name:(e.items[t].name||"")+" (副本)"}])};return(0,j.jsxs)(i.Fragment,{children:[(0,j.jsx)("div",{className:"airebot-setting__toolbar",children:!1!==e.have_auth_edit&&(0,j.jsxs)(j.Fragment,{children:[l?(0,j.jsxs)("div",{className:"airebot-setting__add-select",children:[(0,j.jsx)(r.l6,{options:g,defaultValue:"qq",onChange:t=>{return l=t,e.setItems([...e.items,{platform:l,name:"",open:!1,appId:"",clientSecret:"",note:""}]),void a(!1);var l},width:"180px"}),(0,j.jsx)(s.rA,{icon:"cancel",title:t("取消"),onClick:()=>a(!1)})]}):(0,j.jsx)(s.rA,{icon:"add",title:t("添加机器人"),onClick:()=>a(!0)}),(0,j.jsx)(s.rA,{icon:"save",title:t(o?"保存中...":"保存"),onClick:()=>{o||(async()=>{c(!0),await e.save(),c(!1)})()}})]})}),0===e.items.length?(0,j.jsxs)("div",{className:"airebot-setting__empty",children:[(0,j.jsx)("span",{className:"material-symbols-outlined airebot-setting__empty-icon",children:"smart_toy"}),(0,j.jsx)("p",{children:t("还没有配置任何机器人")}),(0,j.jsx)("p",{className:"airebot-setting__empty-hint",children:t("点击上方「添加机器人」按钮来开始配置")})]}):(0,j.jsx)("div",{className:"airebot-setting__grid",children:e.items.map((e,t)=>(0,j.jsx)(y,{item:e,index:t,onChange:d,onDelete:p,onCopy:h},t))})]})}const y=({item:e,index:t,onChange:l,onDelete:i,onCopy:a})=>{const{t:o}=(0,n.B)(),d=b[e.platform]??b.qq,p=e._status||"disconnected";e.open;return(0,j.jsx)(c.Zp,{self_title:(0,j.jsx)("div",{className:"airebot-setting__card-header",children:(0,j.jsx)("span",{className:"material-symbols-outlined airebot-setting__card-icon",style:{color:d.color},children:d.icon})}),titleCom:(0,j.jsxs)("div",{className:"airebot-setting__card-actions",children:[(0,j.jsx)(s.Ay,{checked:!!e.open,onChange:e=>l(t,{open:e})}),(0,j.jsx)(s.rA,{icon:"content_copy",title:o("复制"),onClick:()=>a(t)}),(0,j.jsx)(s.rA,{icon:"delete",title:o("删除"),onClick:()=>i(t)})]}),children:(0,j.jsxs)("div",{className:"airebot-setting__card-fields",children:[(0,j.jsxs)("div",{className:"airebot-setting__field",children:[(0,j.jsx)("label",{className:"airebot-setting__field-label",children:o("平台")}),(0,j.jsx)(r.l6,{options:g,value:e.platform,onChange:e=>l(t,{platform:e}),width:"100%"})]}),(0,j.jsxs)("div",{className:"airebot-setting__field",children:[(0,j.jsx)("label",{className:"airebot-setting__field-label",children:o("名称")}),(0,j.jsx)(r.Sm,{value:e.name||"",handleInputChange:e=>l(t,{name:e}),placeholder:o("给机器人起个名字")})]}),d.fields.map(n=>{const i=e[n.key]??"";return(0,j.jsxs)("div",{className:"airebot-setting__field",children:[(0,j.jsxs)("label",{className:"airebot-setting__field-label",children:[n.label,n.required&&(0,j.jsx)("span",{className:"airebot-setting__field-required",children:"*"})]}),(0,j.jsx)(r.Sm,{type:n.type,value:i,handleInputChange:e=>l(t,{[n.key]:e}),placeholder:n.placeholder})]},n.key)}),(0,j.jsxs)("div",{className:"airebot-setting__field ",children:[(0,j.jsx)("label",{className:"airebot-setting__field-label",children:o("模型编号")}),(0,j.jsx)(r.Sm,{value:e.model_index,handleInputChange:e=>l(t,{model_index:e}),placeholder:o("使用指定模型(可选)")})]}),(0,j.jsxs)("div",{className:"airebot-setting__field ",children:[(0,j.jsx)("label",{className:"airebot-setting__field-label",children:o("用户id")}),(0,j.jsx)(r.Sm,{value:e.user_id||"",handleInputChange:e=>l(t,{user_id:e}),placeholder:o("默认使用root账户(继承权限,可选)")})]}),(0,j.jsxs)("div",{className:"airebot-setting__field airebot-setting__field-full",children:[(0,j.jsx)("label",{className:"airebot-setting__field-label",children:o("备注")}),(0,j.jsx)(r.Sm,{value:e.note||"",handleInputChange:e=>l(t,{note:e}),placeholder:o("备注信息(可选)")})]})]})})};function v(){const{t:e}=(0,n.B)(),t=(0,x.Zp)(),{check_user_auth:l}=(0,_.MH)(),[r,c]=(0,i.useState)([]),b=(0,u.Q)(),g=async()=>{const e=await d.XO.get("ai_rebot_setting");e.code===p.m.Success&&c(e.data?.list??[])};(0,i.useEffect)(()=>{g()},[]);return(0,j.jsxs)("div",{className:"airebot-setting",children:[(0,j.jsx)(a.A,{children:l(m.oV.ai_agent_setting)&&(0,j.jsx)(s.rA,{icon:"arrow_back",title:e("上一页"),onClick:()=>t(-1)})}),(0,j.jsx)(o.fI,{children:(0,j.jsxs)(o.VP,{widthPer:100,children:[(0,j.jsxs)("div",{className:"airebot-setting__page-title",children:[(0,j.jsx)("h2",{children:e("机器人配置")}),(0,j.jsx)(s.rA,{icon:"info",onClick:()=>{b("机器人配置")},title:"信息"})]}),(0,j.jsx)(f,{items:r,setItems:c,save:async()=>{const t={list:r.map((e,t)=>({...e,index:t}))};(await d.XO.post("ai_rebot_setting/save",t)).code===p.m.Success&&((0,h.SK)(e("保存成功")),await g())},have_auth_edit:l(m.oV.ai_agent_setting)})]})})]})}l.d(t,["PLATFORM_META",0,b,"RebotCard",0,y])},92350(e,t,l){l.d(t,{Q:()=>p,o:()=>_});var n=l(34843),i=l(82893),s=l(74777),a=l(96540),o=l(86149),r=l(23430),c=l(14284),d=l(74848);function p(){const[e,t]=(0,n.fp)(i.AG.prompt_card),{t:l,i18n:a}=(0,o.B)();return e=>{let n;e===s.jk.ffmpeg?n=(0,d.jsx)("div",{children:"视频转换,rtsp播放器等媒体功能都需要这个软件。linux下你可以使用apt或者yum来安装,或者直接输入软件的位置"}):e===s.jk.smartmontools?n=(0,d.jsx)("div",{children:"磁盘检查需要这个软件。linux下你可以使用apt或者yum来安装,或者直接输入软件的位置。"}):"保护目录"===e?n=(0,d.jsxs)("div",{children:["在删除的时候保护目录会拒绝删除。",(0,d.jsxs)("ul",{children:[(0,d.jsx)("li",{children:"可以使用 /* 来表达该目录下所有文件都禁止删除"}),(0,d.jsx)("li",{children:"可以使用 /** 来表达该目录下所有子目录文件都禁止删除"})]})]}):"文件夹路径"===e?n=(0,d.jsx)("div",{children:"用于在文件夹下切换根目录"}):"环境路径"===e?n=(0,d.jsx)("div",{children:"当在不同用户环境下运行的时候由于没有执行终端去加载PATH,这里可以添加额外的PATH路径,点击这里的保存还会更新系统上的path路径"}):"pty"===e?n=(0,d.jsx)("div",{children:"一些需要Pty环境的命令"}):"文件上传"===e?n=(0,d.jsx)("div",{children:(0,d.jsxs)("ul",{children:[(0,d.jsx)("li",{children:"对于不同的目录(包括所有子目录),可能是机械或者固态硬盘,机械硬盘在处理多个小文件的时候会做随机i/o,由于一般只有一个盘头所以会影响整体效率,特别是写操作,这里提供了上传时候的最大数量限制,对于下载数量目前不做限制."}),(0,d.jsx)("li",{children:"大文件支持断点和分块并发传输,建议并发数量设置为2,分块大小设置为10MB,大文件判断为500MB,设置过大的话会上传的时候会占据较大内存"})]})}):"目录快捷命令"===e?n=(0,d.jsx)("div",{children:"右键文件夹空白处用于,打开终端快捷执行命令"}):"文件快捷命令"===e?n=(0,d.jsx)("div",{children:"用于右键特定后缀的文件,执行一些快捷命令,文件后缀可以是多个,用空格分割"}):"Workflow"===e?n=(0,d.jsx)("div",{children:(0,d.jsxs)("ul",{children:[(0,d.jsx)("li",{children:"在特定的时间启动系统中的workflow任务"}),(0,d.jsx)("li",{children:"cron表达式是定时器 格式为: 秒 分 时 日 月 星期"}),(0,d.jsxs)("li",{children:[(0,d.jsx)("li",{children:'1. "*"(通配符,所有值)'}),(0,d.jsx)("li",{children:'2. "," 是枚举: 0 0 1,15 * * *'}),(0,d.jsx)("li",{children:'3. "-" 是范围: 0 0 1-5 * * *'}),(0,d.jsx)("li",{children:'4. "/" 是步长,标识每隔n执行 */3 * * * * * 每隔三秒,必须配合 * 使用 ,/ 只能写一次 ,有了/就成了定时器,而不是指定时间执行'})]})]})}):"插件配置"===e?n=(0,d.jsx)("div",{children:l("路径可以是一个 js 文件也可以是一个node 项目目录")}):"机器人配置"===e&&(n=(0,d.jsxs)("div",{children:[(0,d.jsx)("dv",{children:"机器人功能用于开通各种第三方支持的机器人,让第三方机器人接入本地的 AI 模型。"}),(0,d.jsxs)("ul",{children:[(0,d.jsx)("li",{children:" 1. qq 机器人需要先在手机 app 中添加,然后在https://q.qq.com/qqbot/ 登录机器人配置页面,在开发管理中复制机器人的 appId,appSecret 到这里就完成了配置了。目前 qq 机器人不稳定,且创建后无法删除(2026.07.05)"}),(0,d.jsx)("li",{children:" 2. https://opensource.dingtalk.com/developerpedia/docs/explore/tutorials/stream/bot/nodejs/create-bot 这个是钉钉机器人开通教程,注意复制钉钉的 clientId 的是时候不要复制成appId 了。"}),(0,d.jsx)("li",{children:" 3. 企业微信机器人的开通甚至不需要 pc 操作,在通讯录中点击智能机器人,选择 api 模式,就创建完成了,手机上直接复制 id 和密钥。"}),(0,d.jsx)("li",{children:" 4. 飞书https://open.feishu.cn/document/develop-an-echo-bot/introduction?from=banner 登录这个开发者后台,按照这个地址教程创建机器人,使用的时候这个机器人是作为一个应用,可以在工作台内搜索你的这个机器人的名字。"})]})]})),t({open:!0,title:"信息",context_div:(0,d.jsx)("div",{children:n})})}}let h=r.Ky;function _(){const[e,t]=(0,a.useState)([]);return(0,a.useEffect)(()=>{(async()=>{try{const e=await c.XO.get("themes");if(0===e.code){const l=e.data||[];h=[...r.Ky,...l],t(h)}else console.warn("获取主题列表失败,使用默认列表"),t(h)}catch(e){t(h)}})()},[]),e}}}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[1472],{77481(e,t,s){s.d(t,{S:()=>o,X:()=>l});var n=s(96540),i=s(74848);function l(e){const[t,s]=n.useState([]);return(0,n.useEffect)(()=>{e.children?s(Array.isArray(e.children)?e.children:[e.children]):s(e.rows)},[e.rows,e.children]),(0,i.jsxs)("table",{children:[(0,i.jsx)("thead",{children:(0,i.jsx)("tr",{children:e.headers?.map((e,t)=>(0,i.jsx)("th",{children:e},t))})}),(0,i.jsx)("tbody",{children:t.map((t,s)=>(0,i.jsx)("tr",{onContextMenu:()=>{e.handleContextMenu&&e.handleContextMenu(t)},children:t.map((s,n)=>(0,i.jsx)("td",{style:{width:e.width??"auto"},className:n===t.length-1?"small":"",children:s},n))},s))})]})}function o(e){return(0,i.jsx)("div",{style:{display:e.isFlex?"flex":"block"},children:e.columns.map((e,t)=>(0,i.jsx)("div",{children:e},t))})}},61472(e,t,s){s.r(t),s.d(t,{default:()=>E});var n=s(96540),i=s(75725),l=s(23430),o=s(70447),a=s(85997),r=s(61443),c=s(14284),d=s(53459),h=s(77481),u=s(86149),p=s(82893),_=s(40505),x=s(62042),m=s(21499),j=s(21469),v=s(74848);function f(e){const{t}=(0,u.B)(),[s,l]=(0,n.useState)([]);(0,n.useEffect)(()=>{(async()=>{if(e.getItems){const t=await e.getItems();l(t)}})()},[]);return(0,v.jsx)(i.xh,{children:(0,v.jsx)(o.uF,{self_title:(0,v.jsxs)("span",{className:" div-row ",children:[(0,v.jsx)("h2",{children:e.title}),e.info_click&&(0,v.jsx)(a.rA,{icon:"info",onClick:()=>{e.info_click()},title:"信息"})]}),titleCom:(0,v.jsxs)("div",{children:[(0,v.jsx)(a.rA,{icon:"add",title:t("添加"),onClick:()=>{const t=[];for(let s=0;s<e.headers.length-1;s++)t.push("");l([t,...s])}}),(0,v.jsx)(a.rA,{icon:"save",title:t("保存"),onClick:async()=>{e.save&&await e.save(s)}})]}),children:(0,v.jsx)(h.X,{headers:e.headers,rows:s.map((n,i)=>{const o=[];for(let t=0;t<e.headers.length;t++)o.push((0,v.jsx)(r.Sm,{value:n[t],handleInputChange:e=>{n[t]=e,l([...s])},no_border:!0}));return o.push((0,v.jsxs)("div",{children:[(0,v.jsx)(a.rA,{icon:"delete",title:t("删除"),onClick:()=>(e=>{s.splice(e,1),l([...s])})(i)}),n[0]&&(0,v.jsx)(a.rA,{icon:"content_copy",title:t("复制地址"),onClick:()=>{const e=(0,m.bi)(`${window.location.origin}${j.m.base_url}`,n[0]);(0,_.lW)(e),(0,x.SK)(e)}}),n[0]&&e.need_copy&&(0,v.jsx)(a.rA,{icon:"open_in_new",title:t("打开新页面"),onClick:()=>{const e=(0,m.bi)(`${window.location.origin}${j.m.base_url}`,n[0]);window.open(e)}})]})),o}),width:"10rem"})})})}var g=s(34843),w=s(78247),S=s(24659);function C(){const{t:e}=(0,u.B)(),[t,s]=(0,g.fp)(p.AG.prompt_card),l=(0,S.K)(),f=[e("路由"),e("auth"),e("备注")],[C,y]=(0,g.fp)(p.AG.editorSetting),[k,b]=(0,n.useState)([]);(0,n.useEffect)(()=>{(async()=>{const e=await c.XO.get("api/customer_router");e.code===d.m.Success&&b(e.data)})()},[]);return(0,v.jsx)(i.xh,{children:(0,v.jsx)(o.uF,{self_title:(0,v.jsxs)("span",{className:" div-row ",children:[(0,v.jsx)("h2",{children:e("自定义api路由")})," ",(0,v.jsx)(a.rA,{icon:"info",onClick:()=>{(()=>{let e=(0,v.jsx)("div",{children:'默认需要以 "/api" 开头的路由。'});s({open:!0,title:"信息",context_div:(0,v.jsx)("div",{children:e})})})()},title:"信息"})]}),titleCom:(0,v.jsxs)("div",{children:[(0,v.jsx)(a.rA,{icon:"add",title:e("添加"),onClick:()=>{b([{note:"",needAuth:!1,router:""},...k])}}),(0,v.jsx)(a.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await c.XO.post("api/customer_router/save",k)).code===d.m.Success&&(0,x.SK)("保存成功")}})]}),children:(0,v.jsx)(h.X,{headers:f,rows:k.map((t,s)=>{const n=[(0,v.jsx)(r.Sm,{value:t.router,handleInputChange:e=>{t.router=e,b([...k])},no_border:!0}),(0,v.jsx)(r.l6,{defaultValue:t.needAuth,onChange:e=>{t.needAuth=e,b([...k])},options:l,no_border:!0}),(0,v.jsx)(r.Sm,{value:t.note,handleInputChange:e=>{t.note=e,b([...k])},no_border:!0}),(0,v.jsxs)("div",{children:[(0,v.jsx)(a.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{k.splice(e,1),b([...k])})(s)}),(0,v.jsx)(a.rA,{icon:"edit",title:e("编辑"),onClick:()=>(async e=>{if(!e.router)return void(0,x.zN)("路由不能为空");const t=await c.XO.get(`jscode/${encodeURIComponent(e.router)}`);y({model:"ace/mode/javascript",open:!0,fileName:e.router,save:async t=>{const s={context:t,router:e.router};(await c.XO.post("jscode/save",s)).code===d.m.Success&&(w.xK.set_value_temp(""),y({open:!1,model:"",fileName:"",save:null}),(0,x.SK)("成功"))}}),w.xK.set_value_temp(t.data)})(t)}),t.router&&(0,v.jsx)(a.rA,{icon:"content_copy",title:e("复制地址"),onClick:()=>{(0,_.lW)((0,m.bi)(window.location.origin+j.m.base_url,t.router)),(0,x.SK)(e("已复制"))}})]})];return n}),width:"10rem"})})})}var y=s(23496),k=s(57952);function b(){const{t:e}=(0,u.B)(),[t,s]=(0,g.fp)(p.AG.prompt_card),[l,o]=(0,g.fp)(p.AG.router_jump),a=[e("路由"),e("路径"),e("过期时间(s)"),e("备注")],r=[e("路由"),e("文件路径"),"token","user id",e("备注")];return(0,v.jsxs)(n.Fragment,{children:[(0,v.jsx)(k.A,{}),(0,v.jsxs)(i.fI,{children:[(0,v.jsxs)(i.VP,{children:[(0,v.jsx)(f,{title:e("页面资源路由"),headers:a,getItems:async()=>{const e=await c.XO.get(y.s.setting_customer_router);if(e.code===d.m.Success){if(l?.page_self_router_api_data){for(const t of e.data)t[1]===l?.page_self_router_api_data[1]&&(0,x.N9)("已经存在的页面资源路由配置目录设置");const t={};Object.assign(t,l?.page_self_router_api_data),e.data=[t,...e.data],o({})}return e.data}return[]},save:async e=>{(await c.XO.post(y.s.setting_customer_router_save,e)).code===d.m.Success&&(0,x.SK)("success")},info_click:()=>{let e=(0,v.jsx)("div",{children:'默认需要以 "/api" 开头的路由,会自动识别地址,将页面转到对应结果。路径支持文件路径(如果是文件夹路径的最后最后一个名字将会成为资源实际地址,整个目录将会变成一个http目录),http地址。'});s({open:!0,title:"信息",context_div:(0,v.jsx)("div",{children:e})})},need_copy:!0}),(0,v.jsx)(f,{title:e("workflow触发路由"),headers:r,getItems:async()=>{const e=await c.XO.get(y.s.setting_customer_workflow_router);return e.code===d.m.Success?e.data:[]},save:async e=>{(await c.XO.post(y.s.setting_customer_workflow_router_save,e)).code===d.m.Success&&(0,x.SK)("保存成功")},info_click:()=>{let e=(0,v.jsx)("div",{children:'默认需要以 "/api" 开头的路由,文件路径是有效的workflow路径。token也可以是文件绝对路径,请求的时候请设置同样的authorization请求头字段。'});s({open:!0,title:"信息",context_div:(0,v.jsx)("div",{children:e})})}})]}),(0,v.jsx)(i.VP,{children:(0,v.jsx)(C,{})})]})]})}var A=s(74777),I=s(6960),V=s(7523);function X(){const{t:e}=(0,u.B)(),{check_user_auth:t}=(0,w.MH)(),[s,i]=(0,n.useState)(!1),[h,_]=(0,n.useState)("https://registry.npmjs.org"),[m,j]=(0,n.useState)(""),[f,S]=(0,n.useState)(180),[C,y]=(0,n.useState)(!1),[k,b]=(0,g.fp)(p.AG.prompt_card);(0,n.useEffect)(()=>{(async()=>{const e=await c.XO.get("auto_upgrade_setting");if(e.code===d.m.Success){const t=e.data;i(t.open||!1),_(t.version_check_url||"https://registry.npmjs.org"),j(t.exe_download_url||""),S(t.check_interval_seconds||180)}})()},[]);return t(l.oV.sys_setting_page)?(0,v.jsxs)(o.Zp,{self_title:(0,v.jsxs)("span",{className:" div-row ",children:[(0,v.jsx)("h2",{children:e("自动升级")}),(0,v.jsx)(a.rA,{icon:"info",onClick:()=>{b({open:!0,title:e("信息"),context_div:(0,v.jsx)("div",{children:e("自动升级在 windows 下目前可能不稳定")})})},title:e("信息")})]}),rightBottomCom:(0,v.jsx)(a.C3,{text:e("保存"),clickFun:async()=>{if(!h)return void(0,x.zN)(e("版本检测地址不能为空"));if(s&&(!f||f<10))return void(0,x.zN)(e("检测间隔不能小于10秒"));const t=new A.Mm;t.open=s,t.version_check_url=h,t.exe_download_url=m,t.check_interval_seconds=f;(await c.XO.post("auto_upgrade_setting/save",t)).code===d.m.Success&&(0,x.SK)(e("保存成功"))}}),children:[(0,v.jsx)("div",{children:e("系统版本检测地址")}),(0,v.jsx)(r.Sm,{placeholder:"https://registry.npmjs.org",value:h,handleInputChange:e=>{_(e)}}),(0,v.jsx)(r.l6,{value:s,onChange:e=>{i(e)},options:[{title:e("开启"),value:!0},{title:e("关闭"),value:!1}]}),s&&(0,v.jsxs)(v.Fragment,{children:[!1,(0,v.jsx)("div",{children:e("检测频率(秒)")}),(0,v.jsx)(r.Sm,{placeholder:e("默认180秒(3分钟)"),value:f,handleInputChange:e=>{S(Number(e)||180)}}),(0,v.jsx)("div",{style:{marginTop:"12px"},children:(0,v.jsx)(a.C3,{text:e(C?"升级检测中...":"立即升级"),clickFun:async()=>{y(!0);try{(await c.XO.post("auto_upgrade_setting/upgrade_now",{})).code===d.m.Success&&(0,x.SK)(e("已触发升级检测,请查看服务端日志"))}catch(t){(0,x.zN)(e("触发升级失败"))}finally{y(!1)}}})})]})]}):null}function N(){const[e,t]=(0,n.useState)(""),[s,l]=(0,n.useState)(""),[_,m]=(0,n.useState)(!1),[j,f]=(0,n.useState)(""),[S,C]=(0,n.useState)(!1),[b,N]=(0,n.useState)(""),[O,F]=(0,g.fp)(p.AG.prompt_card),[K,z]=(0,n.useState)(!1),[P,B]=(0,n.useState)(""),[M,$]=(0,n.useState)(""),[G,E]=(0,n.useState)(A.aM.close),[T,H]=(0,n.useState)(!1),[q,U]=(0,n.useState)(void 0),{t:Z,i18n:D}=(0,u.B)(),[W,L]=(0,g.fp)(p.AG.user_base_info),{check_user_auth:Q}=(0,w.MH)(),{initUserInfo:J}=(0,n.useContext)(V.F);(0,n.useEffect)(()=>{(async()=>{const e=await c.XO.get("sys_option/status");if(e.code===d.m.Success){C(e.data.recycle_open),N(e.data.recycle_dir);const s=e.data.sys_env;t(s?.web_site_title),l(s?.logo||""),m(s?.show_login_user_info),f(s?.http_proxy||"");const n=e.data.https_setting;n&&(z(n.open),B(n.cert_path||""),$(n.key_path||""))}const s=await c.XO.get("token");if(s.code===d.m.Success){const e=s.data;if(!e)return;e.length&&U(e.length),e.mode&&E(e.mode),void 0!==e.persist&&H(e.persist)}})()},[]);return(0,v.jsxs)("div",{children:[(0,v.jsx)(k.A,{left_children:(0,v.jsxs)(v.Fragment,{children:[(0,v.jsxs)("span",{className:"credits",children:[Z("系统运行于"),": ",(0,I.s)(W.runing_time_length)]}),(0,v.jsx)("span",{className:"credits",children:(0,v.jsxs)("a",{href:"https://github.com/xiaobaidadada/filecat",target:"_blank",children:["version:6.64.1",null!=W.latest_version&&"6.64.1"!==W.latest_version?` -> ${W.latest_version}`:""]})}),(0,v.jsx)("span",{className:"credits",children:(0,v.jsx)("a",{href:Z("官网地址"),target:"_blank",children:`filecat ${Z("功能文档")}`})}),(0,v.jsxs)("span",{className:"credits",children:[Z("安装方式")," :",W.process_env_run_env]})]})}),(0,v.jsx)(i.xh,{children:(0,v.jsxs)(i.fI,{children:[(0,v.jsxs)(i.VP,{widthPer:33,children:[(0,v.jsxs)(o.Zp,{self_title:(0,v.jsxs)("span",{className:" div-row ",children:[(0,v.jsx)("h2",{children:Z("通用设置")})," ",(0,v.jsx)(a.rA,{icon:"info",onClick:()=>{F({open:!0,title:Z("信息"),context_div:(0,v.jsx)("div",{children:Z("HTTP 代理说明")})})},title:Z("信息")})]}),rightBottomCom:(0,v.jsx)(a.C3,{text:Z("确定修改"),clickFun:async()=>{(await c.XO.post(y.s.setting_sys_option_status_save,{type:A.Mu.sys_env,value:{web_site_title:e,show_login_user_info:_,http_proxy:j,logo:s}})).code===d.m.Success&&((0,x.SK)("修改成功"),J())}}),children:[Z("网站标题"),(0,v.jsx)(r.Sm,{value:e,handleInputChange:e=>{t(e)}}),Z("网站 Logo"),(0,v.jsx)(r.Sm,{placeholder:Z("本地文件路径或 http(s) 图片地址"),value:s,handleInputChange:e=>{l(e)}}),(0,v.jsx)("div",{children:Z("HTTP 代理地址")}),(0,v.jsx)(r.Sm,{placeholder:"http://127.0.0.1:7890",value:j,handleInputChange:e=>{f(e)}}),Z("登陆展示用户信息"),(0,v.jsx)("input",{type:"checkbox",checked:_,onChange:()=>{m(!_)}})]}),(0,v.jsxs)(o.Zp,{title:Z("HTTPS 设置"),rightBottomCom:(0,v.jsx)(a.C3,{text:Z("确定修改"),clickFun:async()=>{if(K){if(!P)return void(0,x.zN)("证书路径不能为空");if(!M)return void(0,x.zN)("私钥路径不能为空")}const e=new A.CH;e.open=K,e.cert_path=P,e.key_path=M;(await c.XO.post(y.s.setting_sys_option_status_save,{type:A.Mu.https,value:e,open:K})).code===d.m.Success&&(0,x.SK)("HTTPS 设置已保存,需重启服务器才能生效")}}),children:[(0,v.jsx)(r.l6,{value:K,onChange:e=>{z(e)},options:[{title:Z("开启"),value:!0},{title:Z("关闭"),value:!1}]}),K&&(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)("div",{children:Z("SSL 证书路径")}),(0,v.jsx)(r.Sm,{placeholder:Z("证书文件路径(cert.pem/fullchain.pem)"),value:P,handleInputChange:e=>{B(e)}}),(0,v.jsx)("div",{children:Z("SSL 私钥路径")}),(0,v.jsx)(r.Sm,{placeholder:Z("私钥文件路径(privkey.pem)"),value:M,handleInputChange:e=>{$(e)}})]})]}),(0,v.jsx)(X,{})]}),(0,v.jsxs)(i.VP,{widthPer:33,children:[(0,v.jsxs)(o.Zp,{self_title:(0,v.jsxs)("span",{className:" div-row ",children:[(0,v.jsx)("h2",{children:Z("文件回收站")})," ",(0,v.jsx)(a.rA,{icon:"info",onClick:()=>{F({open:!0,title:Z("信息"),context_div:(0,v.jsx)("div",{children:Z("格式:[被删除的文件所在父目录] 回收站目录 [; ...]")})})},title:Z("信息")})]}),rightBottomCom:(0,v.jsx)(a.C3,{text:Z("确定修改"),clickFun:async()=>{if(S&&!b)return void(0,x.zN)("目录不能为空");(await c.XO.post(y.s.setting_sys_option_status_save,{type:A.Mu.cyc,value:b,open:S})).code===d.m.Success&&(0,x.SK)("修改成功")}}),children:[(0,v.jsx)(r.Sm,{placeholder:Z("目录"),value:b,handleInputChange:e=>{N(e)}}),(0,v.jsx)(r.l6,{value:S,onChange:e=>{C(e)},options:[{title:Z("开启"),value:!0},{title:Z("关闭"),value:!1}]})]}),(0,v.jsxs)(o.Zp,{title:Z("token过期时间"),rightBottomCom:(0,v.jsx)(h.S,{isFlex:!0,columns:[(0,v.jsx)(a.C3,{text:Z("清空token"),clickFun:async()=>{(await c.XO.get("token/clear")).code===d.m.Success&&(0,x.SK)("清理完成,重新登录")}}),(0,v.jsx)(a.C3,{text:Z("保存"),clickFun:async()=>{const e=new A.Gd;e.mode=G,e.persist=T,A.aM.length!==e.mode||q||(0,x.zN)("秒数不能为空"),e.length=parseInt(q);(await c.XO.post("token/save",e)).code===d.m.Success&&(0,x.SK)("保存成功")}})]}),children:[(0,v.jsx)(h.S,{isFlex:!0,columns:[(0,v.jsx)(r.U6,{value:1,context:Z("关闭"),selected:G===A.aM.close,onchange:()=>{E(A.aM.close)}}),(0,v.jsx)(r.U6,{value:1,context:Z("指定时间"),selected:G===A.aM.length,onchange:()=>{E(A.aM.length)}}),(0,v.jsx)(r.U6,{value:1,context:Z("永不过期"),selected:G===A.aM.forver,onchange:()=>{E(A.aM.forver)}})]}),G===A.aM.length&&(0,v.jsx)(r.Sm,{placeholder:Z("秒"),value:q,handleInputChange:e=>{U(e)}}),(0,v.jsxs)("label",{style:{display:"flex",alignItems:"center",gap:6,marginTop:8,whiteSpace:"nowrap"},children:[(0,v.jsx)("input",{type:"checkbox",checked:T,onChange:()=>H(!T)}),Z("持久化")]})]})]})]})})]})}var O=s(64694),F=s(92350);function K(){const{t:e,i18n:t}=(0,u.B)(),{initUserInfo:s,reloadUserInfo:l}=(0,n.useContext)(V.F),[_,m]=(0,n.useState)([]),[j,f]=(0,n.useState)([]),[C,y]=(0,g.fp)(p.AG.prompt_card),[,k]=(0,g.fp)(p.AG.editorSetting),[b,A]=(0,n.useState)([]),[I,X]=(0,n.useState)([]),[N,K]=(0,n.useState)([]),[z,P]=(0,n.useState)([]),[B,M]=(0,n.useState)(""),[$,G]=(0,n.useState)([]),E=(0,S.K)(),T=[e("软件"),e("是否安装"),e("路径")],H=[e("编号"),e("路径"),e("备注")],q=[e("编号"),e("路径"),e("是否开启"),e("备注")],U=[e("编号"),e("文件路径"),e("是否开启"),e("系统启动执行"),e("corn表达式"),e("用户id"),e("备注")],Z=[e("编号"),e("路径"),e("单用户并发数量"),e("系统并发数量"),e("是否开启大文件断点"),e("大文件判断大小MB"),e("大文件并发数量"),e("大文件分块大小MB"),e("备注")],D=[e("编号"),e("名称"),e("路径"),e("是否开启"),e("params"),e("备注")],{check_user_auth:W}=(0,w.MH)(),L=async()=>{const e=await c.XO.get("env/path/get");e.code===d.m.Success&&K(e.data)},Q=async()=>{const e=await c.XO.get("workflow_setting_get");e.code===d.m.Success&&P(e.data)};(0,n.useEffect)(()=>{(async()=>{const e=await c.XO.get("outside/software/get");e.code===d.m.Success&&f(e.data);const t=await c.XO.get("pty_cmd");t.code===d.m.Success&&M(t.data),L(),Q();const s=await c.XO.get("protection_dir/sys");s.code===d.m.Success&&A(s.data??[]);const n=await c.XO.get("dir_upload_max_num");n.code===d.m.Success&&X(n.data??[]);const i=await c.XO.get("plugin/list");i.code===d.m.Success&&G(i.data??[])})()},[]);const J=(0,F.Q)(),R=async()=>{(await c.XO.post("plugin/list/save",$)).code===d.m.Success&&(0,x.SK)(e("保存成功"))};return(0,v.jsxs)(n.Fragment,{children:[(0,v.jsx)(i.J,{widthPer:100,children:(0,v.jsx)(o.uF,{self_title:(0,v.jsxs)("span",{className:" div-row ",children:[(0,v.jsx)("h2",{children:e("文件上传最大并发限制")})," ",(0,v.jsx)(a.rA,{icon:"info",onClick:()=>{J("文件上传")},title:e("信息")})]}),titleCom:(0,v.jsxs)("div",{children:[(0,v.jsx)(a.rA,{icon:"add",title:e("添加"),onClick:()=>{X([...I,{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,v.jsx)(a.rA,{icon:"save",title:e("保存"),onClick:async()=>{for(const e of I)if(e.open_ws_file){if("number"!=typeof e.ws_file_block_mb_size)return void(0,x.zN)(`编号:${e.index??""} 文件块的大小设置有问题`);if("number"!=typeof e.ws_file_parallel_num)return void(0,x.zN)(`编号:${e.index??""} 并发数量设置有问题`);if("number"!=typeof e.ws_file_standard_size)return void(0,x.zN)(`编号:${e.index??""} 大文件size设置有问题`)}(0,O.di)(I,e=>e.index);(await c.XO.post("dir_upload_max_num/save",I)).code===d.m.Success&&((0,x.SK)("保存成功"),l())}})]}),children:(0,v.jsx)(h.X,{headers:Z,rows:I.map((t,s)=>{const n=[(0,v.jsx)(r.Sm,{value:t.index,placeholder:s,handleInputChange:e=>{t.index=parseInt(e)},no_border:!0}),(0,v.jsx)(r.Sm,{value:t.path,handleInputChange:e=>{t.path=e},no_border:!0}),(0,v.jsx)(r.Sm,{value:t.user_upload_num,handleInputChange:e=>{t.user_upload_num=parseInt(e)},no_border:!0}),(0,v.jsx)(r.Sm,{value:t.sys_upload_num,handleInputChange:e=>{t.sys_upload_num=parseInt(e)},no_border:!0}),(0,v.jsx)(r.l6,{value:!0===t.open_ws_file,onChange:e=>{t.open_ws_file=e,X([...I])},options:E,no_border:!0}),(0,v.jsx)(r.Sm,{value:"number"==typeof t.ws_file_standard_size?t.ws_file_standard_size/1024/1024:void 0,handleInputChange:e=>{t.ws_file_standard_size=1024*parseInt(e)*1024},no_border:!0}),(0,v.jsx)(r.Sm,{value:t.ws_file_parallel_num,handleInputChange:e=>{t.ws_file_parallel_num=parseInt(e)},no_border:!0}),(0,v.jsx)(r.Sm,{value:"number"==typeof t.ws_file_block_mb_size?t.ws_file_block_mb_size/1024/1024:void 0,handleInputChange:e=>{t.ws_file_block_mb_size=1024*parseInt(e)*1024},no_border:!0}),(0,v.jsx)(r.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,v.jsx)(a.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{I.splice(e,1),X([...I])})(s)})];return n}),width:"10rem"})})}),(0,v.jsxs)(i.fI,{children:[(0,v.jsx)(i.VP,{widthPer:50,children:(0,v.jsxs)(i.xh,{children:[(0,v.jsx)(o.uF,{self_title:(0,v.jsxs)("span",{className:" div-row ",children:[(0,v.jsx)("h2",{children:e("PATH")}),(0,v.jsx)(a.rA,{icon:"info",onClick:()=>{J("环境路径")},title:e("信息")})]}),titleCom:(0,v.jsxs)("div",{children:[(0,v.jsx)(a.rA,{icon:"list",title:e("查看"),onClick:async()=>{const t=await c.XO.get("env/process/view");t.code===d.m.Success?y({open:!0,title:e("进程环境变量"),context_div:(0,v.jsx)("pre",{style:{whiteSpace:"pre-wrap",wordBreak:"break-all",maxHeight:"60vh",overflow:"auto",margin:0,fontSize:"0.85rem",lineHeight:"1.5"},children:t.data})}):(0,x.zN)(e("获取失败"))}}),(0,v.jsx)(a.rA,{icon:"edit",title:e("编辑"),onClick:async()=>{const t=await c.XO.get("env/process/get");t.code===d.m.Success?(w.xK.set_value_temp(t.data??""),k({model:"ace/mode/ini",open:!0,fileName:"",save:async t=>{(await c.XO.post("env/process/save",{text:t})).code===d.m.Success?(0,x.SK)(e("保存成功")):(0,x.zN)(e("保存失败")),w.xK.set_value_temp("")}})):(0,x.zN)(e("获取失败"))}}),(0,v.jsx)(a.rA,{icon:"add",title:e("添加"),onClick:()=>{K([...N,{path:"",note:""}])}}),(0,v.jsx)(a.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await c.XO.post("env/path/save",{paths:N})).code===d.m.Success&&((0,x.SK)("保存成功"),L(),s())}})]}),children:(0,v.jsx)(h.X,{headers:q,rows:N.map((t,s)=>{const n=[(0,v.jsx)("div",{children:s}),(0,v.jsx)(r.Sm,{value:t.path,handleInputChange:e=>{t.path=e},no_border:!0}),(0,v.jsx)(r.l6,{value:!!t.open,onChange:e=>{t.open=e,K([...N])},options:E,no_border:!0}),(0,v.jsx)(r.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,v.jsx)(a.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{N.splice(e,1),K([...N])})(s)})];return n}),width:"10rem"})}),(0,v.jsx)(o.Zp,{self_title:(0,v.jsxs)("span",{className:" div-row ",children:[(0,v.jsx)("h2",{children:e("PTY CMD")}),(0,v.jsx)(a.rA,{icon:"info",onClick:()=>{J("pty")},title:e("信息")})]}),rightBottomCom:(0,v.jsx)(a.C3,{text:e("更新"),clickFun:async()=>{(await c.XO.post("pty_cmd/save",{str:B})).code===d.m.Success&&((0,x.SK)("保存成功"),l())}}),children:(0,v.jsx)(r.Sm,{placeholder:e("cmd need pty env"),value:B,handleInputChange:e=>{M(e)}})}),(0,v.jsx)(o.uF,{self_title:(0,v.jsxs)("span",{className:" div-row ",children:[(0,v.jsx)("h2",{children:e("Workflow Job")}),(0,v.jsx)(a.rA,{icon:"info",onClick:()=>{J("Workflow")},title:e("信息")})]}),titleCom:(0,v.jsxs)("div",{children:[(0,v.jsx)(a.rA,{icon:"add",title:e("添加"),onClick:()=>{P([...z,{open:!1}])}}),(0,v.jsx)(a.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await c.XO.post("workflow_setting_save",z)).code===d.m.Success&&((0,x.SK)("ok"),Q())}})]}),children:(0,v.jsx)(h.X,{headers:U,rows:z.map((t,s)=>{const n=[(0,v.jsx)("div",{children:s}),(0,v.jsx)(r.Sm,{value:t.file_path,handleInputChange:e=>{t.file_path=e},no_border:!0}),(0,v.jsx)(r.l6,{value:!!t.open,onChange:e=>{t.open=e,P([...z])},options:E,no_border:!0}),(0,v.jsx)(r.l6,{value:!!t.sys_power_on,onChange:e=>{t.sys_power_on=e,P([...z])},options:E,no_border:!0}),(0,v.jsx)(r.Sm,{value:t.cron_str,handleInputChange:e=>{t.cron_str=e},no_border:!0}),(0,v.jsx)(r.Sm,{value:t.user_id,handleInputChange:e=>{t.user_id=e},no_border:!0}),(0,v.jsx)(r.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,v.jsx)(a.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{z.splice(e,1),P([...z])})(s)})];return n}),width:"10rem"})}),(0,v.jsx)(o.uF,{self_title:(0,v.jsxs)("span",{className:" div-row ",children:[(0,v.jsx)("h2",{children:e("插件配置")}),(0,v.jsx)(a.rA,{icon:"info",onClick:()=>{J("插件配置")},title:e("信息")})]}),titleCom:(0,v.jsxs)("div",{children:[(0,v.jsx)(a.rA,{icon:"add",title:e("添加"),onClick:()=>{G([...$,{name:"",path:"",note:"",open:!1}])}}),(0,v.jsx)(a.rA,{icon:"save",title:e("保存"),onClick:R})]}),children:(0,v.jsx)(h.X,{headers:D,rows:$.map((t,s)=>{const n=[s,(0,v.jsx)(r.Sm,{value:t.name,handleInputChange:e=>{t.name=e},no_border:!0}),(0,v.jsx)(r.Sm,{value:t.path,handleInputChange:e=>{t.path=e},no_border:!0}),(0,v.jsx)(r.l6,{value:!!t.open,onChange:e=>{t.open=e,G([...$])},options:E,no_border:!0}),(0,v.jsx)(a.mu,{icon:"edit",save:async e=>{t.params=e,await R()},title:""}),(0,v.jsx)(r.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,v.jsx)(a.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{$.splice(e,1),G([...$])})(s)})];return n}),width:"10rem"})})]})}),(0,v.jsx)(i.VP,{children:(0,v.jsxs)(i.xh,{children:[(0,v.jsx)(o.uF,{self_title:(0,v.jsxs)("span",{className:" div-row ",children:[(0,v.jsx)("h2",{children:e("系统保护路径")})," ",(0,v.jsx)(a.rA,{icon:"info",onClick:()=>{J("保护目录")},title:e("信息")})]}),titleCom:(0,v.jsxs)("div",{children:[(0,v.jsx)(a.rA,{icon:"add",title:e("添加"),onClick:()=>{A([...b,{path:"",note:""}])}}),(0,v.jsx)(a.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await c.XO.post("protection_dir/sys/save",b)).code===d.m.Success&&((0,x.SK)("保存成功"),l())}})]}),children:(0,v.jsx)(h.X,{headers:H,rows:b.map((t,s)=>{const n=[(0,v.jsx)("div",{children:s}),(0,v.jsx)(r.Sm,{value:t.path,handleInputChange:e=>{t.path=e},no_border:!0}),(0,v.jsx)(r.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,v.jsx)(a.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{b.splice(e,1),A([...b])})(s)})];return n}),width:"10rem"})}),(0,v.jsx)(o.uF,{title:e("外部软件"),titleCom:(0,v.jsx)(a.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await c.XO.post("outside/software/save",j)).code===d.m.Success&&((0,x.SK)("保存成功"),s())}}),children:(0,v.jsx)(h.X,{headers:T,rows:j.map((t,s)=>[(0,v.jsx)("div",{children:t.id}),(0,v.jsx)(o.fq,{ok:t.installed}),(0,v.jsx)(r.Sm,{value:t.path,handleInputChange:e=>{t.path=e},no_border:!0,placeholder:e("默认使用环境变量")}),(0,v.jsx)(a.rA,{icon:"info",onClick:()=>{J(t.id)},title:e("信息")})]),width:"10rem"})})]})})]})]})}function z(e){const{t,i18n:s}=(0,u.B)(),[i,o]=(0,g.fp)(p.AG.user_base_info),a=[{title:t("用户权限"),list:[{title:t("用户管理"),permission:l.oV.user_manage},{title:t("角色管理"),permission:l.oV.role_manage}]},{title:t("系统管理权限"),list:[{title:t("系统信息"),permission:l.oV.all_sys},{title:t("系统进程关闭"),permission:l.oV.sys_process_close},{title:t("docker容器停止、删除"),permission:l.oV.docker_container_update},{title:t("docker镜像删除"),permission:l.oV.docker_images_delete},{title:t("systemd管理"),permission:l.oV.systemd},{title:t("防火墙管理"),permission:l.oV.firewall}]},{title:t("网络功能权限"),list:[{title:t("系统网络"),permission:l.oV.vir_net},{title:t("内网穿透"),permission:l.oV.tcp_proxy},{title:"ddns",permission:l.oV.ddns}]},{title:t("Ai 设置权限"),list:[{title:t("Ai 配置"),permission:l.oV.ai_agent_setting},{title:t("Ai Chat Page"),permission:l.oV.ai_agent_page},{title:t("允许切换 AI 模型"),permission:l.oV.ai_model_switch}]},{title:t("文件权限"),list:[{title:t("文件删除、剪切、重命名"),permission:l.oV.filecat_file_delete_cut_rename},{title:t("文件创建、上传、内容更新、解压缩"),permission:l.oV.filecat_file_context_update_upload_created_copy_decompression},{title:t("内容更新"),permission:l.oV.filecat_file_context_update},{title:t("文件回收站修改"),permission:l.oV.recycle_file_save},{title:t("文件分享"),permission:l.oV.share_file}]},{title:t("系统设置权限"),list:[{title:t("系统页面"),permission:l.oV.sys_setting_page},{title:t("htts"),permission:l.oV.https_file},{title:t("token时间修改"),permission:l.oV.token_update},{title:t("修改密码"),permission:l.oV.update_password},{title:t("磁盘挂载"),permission:l.oV.sys_disk_mount},{title:t("通用设置"),permission:l.oV.sys_env_setting_key}]},{title:t("系统环境设置"),list:[{title:t("系统环境设置页面"),permission:l.oV.sys_env_page},{title:t("目录文件上传数量限制修改"),permission:l.oV.dir_upload_max_num},{title:t("PATH路径修改"),permission:l.oV.env_path_update},{title:"pty cmd "+t("更新"),permission:l.oV.pty_cmd_update},{title:"workflow job",permission:l.oV.workflow_job},{title:t("系统保护路径更新"),permission:l.oV.sys_protection_dir},{title:t("外部软件路径"),permission:l.oV.outside_software_path}]},{title:t("个人环境设置"),list:[{title:t("个性化设置"),permission:l.oV.private_sys_env}]},{title:t("自定义路由"),list:[{title:t("自定义路由页面"),permission:l.oV.auth_router_page},{title:t("workflow触发api 修改"),permission:l.oV.workflow_api},{title:t("自定义资源路由"),permission:l.oV.code_resource},{title:t("自定义api路由"),permission:l.oV.code_api}]},{title:t("标签编辑权限"),list:[{title:t("ssh代理"),permission:l.oV.ssh_proxy_tag_update},{title:t("http代理"),permission:l.oV.http_proxy_tag_update},{title:t("浏览器代理"),permission:l.oV.browser_proxy_tag_update},{title:t("rdp代理"),permission:l.oV.rdp_proxy_tag_update},{title:t("网络唤醒"),permission:l.oV.wol_proxy_tag_update},{title:t("rtsp播放器"),permission:l.oV.rtsp_proxy_tag_update}]},{title:t("代理功能"),list:[{title:t("ssh代理"),permission:l.oV.ssh_proxy},{title:t("http代理"),permission:l.oV.http_proxy},{title:t("http代理下载关闭"),permission:l.oV.http_proxy_download_cancel},{title:t("浏览器代理"),permission:l.oV.browser_proxy},{title:t("rdp代理"),permission:l.oV.rdp_proxy}]},{title:t("其他功能"),list:[{title:t("workflow 执行"),permission:l.oV.workflow_exe},{title:t("workflow 执行用户"),permission:l.oV.workflow_exe_user,noDisable:!0},{title:t("网络唤醒"),permission:l.oV.wol_proxy},{title:t("端口扫描"),permission:l.oV.port_scan},{title:t("rtsp播放器"),permission:l.oV.rtsp_proxy},{title:t("ssh密钥保存到磁盘"),permission:l.oV.crypto_ssh_file},{title:t("filecat-restart重启命令"),permission:l.oV.shell_cmd_filecat_restart},{title:t("filecat-upgrade升级命令"),permission:l.oV.shell_cmd_filecat_upgrade},{title:t("filecat-down关闭主进程命令"),permission:l.oV.shell_cmd_filecat_kill_self},{title:t("ai 命令(Ai 聊天)"),permission:l.oV.ai_chat_cmd}]}];return(0,v.jsx)(n.Fragment,{children:a.map((t,s)=>(0,v.jsxs)("div",{children:[(0,v.jsx)("h3",{children:t.title}),t.list.map((t,s)=>(0,v.jsxs)("div",{children:[(0,v.jsx)("input",{type:"checkbox",disabled:!t.noDisable&&e.is_disable(t.permission),checked:e.is_selected(t.permission,t.noDisable),onChange:()=>{e.select_auth(t.permission)}}),t.title]},s))]},s))})}const P=new Map;function B(){const{t:e,i18n:t}=(0,u.B)(),{initUserInfo:s,reloadUserInfo:_}=(0,n.useContext)(V.F),[j,f]=(0,g.fp)(p.AG.user_base_info),[w,S]=(0,n.useState)([]),[C,y]=(0,g.fp)(p.AG.prompt_card),[k,b]=(0,n.useState)(!1),[A,I]=(0,n.useState)(!1),[X,N]=(0,g.fp)(p.AG.confirm),[K,B]=(0,n.useState)(""),[M,$]=(0,n.useState)(""),[G,E]=(0,n.useState)(""),[T,H]=(0,n.useState)([]),[q,U]=(0,n.useState)([]),[Z,D]=(0,n.useState)([]),[W,L]=(0,n.useState)(""),[Q,J]=(0,n.useState)(""),[R,Y]=(0,n.useState)("en"),[ee,te]=(0,n.useState)(""),[se,ne]=(0,n.useState)([]),[ie,le]=(0,n.useState)(""),[oe,ae]=(0,n.useState)(!1),[re,ce]=(0,n.useState)(""),[de,he]=(0,n.useState)(""),[ue,pe]=(0,n.useState)({}),_e=(0,F.o)(),[xe,me]=(0,n.useState)([]),[je,ve]=(0,n.useState)(void 0),fe=[e("用户id"),e("用户名"),e("目录范围"),e("备注")],ge=async()=>{const e=await c.wm.get("all_users");if(e.code===d.m.Success){const t=e.data??[];if(je){const e=[];for(const s of t)`${s.id}${s.username}${s.cwd}${s.note}`.includes(je)&&e.push(s);S(e)}else S(t)}const t=await c.wm.get("all_roles");if(t.code===d.m.Success){me(t.data),P.clear();for(const e of t.data)P.set(e.role_id,e)}},we=e=>{B(e?.username??""),$(e?.password??""),E(e?.cwd??""),H(e?.access_dirs??[]),U(e?.not_access_dirs??[]),D(e?.only_read_dirs??[]),L(e?.access_cmd??""),J(e?.not_access_cmd??""),Y(e?.language??""),te(e?.theme??""),ne(e?.auth_list??[]),le(e?.note??""),ae(e?.is_root??!1),ce(e?.id??""),e?.bind_role_id?Se(e.bind_role_id,e.auth_list??[]):(he(""),pe({}))};(0,n.useEffect)(()=>{ge()},[]);const Se=(e,t=[])=>{if(!e)return he(""),void pe({});const s=P.get(e);if(s){if(s.cwd&&E(s.cwd),s.access_dirs&&s.access_dirs.length>0&&H(s.access_dirs),s.not_access_dirs&&s.not_access_dirs.length>0&&U(s.not_access_dirs),s.only_read_dirs&&s.only_read_dirs.length>0&&D(s.only_read_dirs),s.access_cmd&&L(s.access_cmd),s.not_access_cmd&&J(s.not_access_cmd),s.language&&Y(s.language),s.theme&&te(s.theme),s.auth_list&&s.auth_list.length>0){const e=new Set(s.auth_list);for(const s of t)e.add(s);ne(Array.from(e))}he(e),pe(s)}},Ce=()=>{if(!K)return void(0,x.zN)("username not empty");if((0,m.CB)(K))return void(0,x.zN)("username not empty char");if(!G)return void(0,x.zN)("cwd not empty");const e=new l.E0;return e.language=R,e.theme=ee,e.access_dirs=T,e.username=K,e.password=M,e.not_access_dirs=q,e.only_read_dirs=Z,e.cwd=G,e.note=ie,e.access_cmd=W,e.not_access_cmd=Q,e.auth_list=se,e.bind_role_id=de,e};return(0,v.jsxs)(i.fI,{children:[(0,v.jsx)(i.VP,{widthPer:50,children:(0,v.jsx)(i.xh,{children:(0,v.jsx)(o.uF,{self_title:(0,v.jsx)("span",{className:" div-row ",children:(0,v.jsx)("h2",{children:e("用户")})}),titleCom:(0,v.jsxs)("div",{className:"div-row",style:{gap:"0.5rem"},children:[(0,v.jsx)(r.Sm,{placeholder:e("过滤"),value:je,handleInputChange:e=>{ve(e)},handlerEnter:()=>{ge()}}),(0,v.jsx)(a.rA,{icon:"add",title:e("添加"),onClick:()=>{b(!0),I(!1),we(void 0)}})]}),children:(0,v.jsx)(h.X,{headers:fe,rows:w.map((t,s)=>{const n=[(0,v.jsx)("p",{children:t.id}),(0,v.jsx)(o.xP,{children:t.username}),(0,v.jsx)(o.xP,{children:t.cwd}),(0,v.jsx)(o.xP,{children:t.note}),(0,v.jsxs)("div",{children:[(0,v.jsx)(a.rA,{icon:"edit",title:e("编辑"),onClick:()=>(e=>{b(!1),I(!0),we(e)})(t)}),!t.is_root&&(0,v.jsx)(a.rA,{icon:"delete",title:e("删除"),onClick:()=>(async t=>{N({open:!0,title:e("确定删除吗"),handle:async()=>{const e=new l.E0;e.username=t,(await c.wm.post("delete_user",e)).code===d.m.Success&&((0,x.SK)("删除完成"),ge(),N({open:!1,handle:null}))}})})(t.username)})]})];return n}),width:"10rem"})})})}),(0,v.jsx)(i.VP,{widthPer:50,children:(k||A)&&(0,v.jsx)(i.xh,{children:(0,v.jsxs)(o.Zp,{self_title:(0,v.jsxs)("span",{className:" div-row ",children:[(0,v.jsx)("h2",{children:e(""+(k?"添加":"编辑"))})," "]}),rightBottomCom:(0,v.jsxs)("div",{children:[(0,v.jsx)(a.rA,{icon:"cancel",title:e("取消"),onClick:()=>{b(!1),I(!1),we(void 0)}}),k&&(0,v.jsx)(a.rA,{icon:"add_circle",title:e("添加"),onClick:async()=>{if(!M)return void(0,x.zN)("password not empty");if((0,m.CB)(M))return void(0,x.zN)("username not empty char");const e=Ce(),t=await c.wm.post("create_user",e);ge(),t.code===d.m.Success&&((0,x.SK)("创建完成"),ge(),b(!1),I(!1),we(void 0))}}),A&&(0,v.jsx)(a.rA,{icon:"save",title:e("保存"),onClick:async()=>{const e=Ce();if(!e)return;e.id=re;(await c.wm.post("save_user",e)).code===d.m.Success&&((0,x.SK)("保存完成"),ge())}})]}),children:[(0,v.jsx)("label",{children:e("用户名")}),(0,v.jsx)(r.Sm,{value:K,handleInputChange:e=>B(e)}),(0,v.jsx)("label",{children:e("密码")}),(0,v.jsx)(r.Sm,{type:"password",value:M,handleInputChange:e=>$(e)}),(0,v.jsxs)("label",{children:[!ue?.access_dirs?.length&&(0,v.jsx)(a.rA,{icon:"add",onClick:()=>{H([...T,""])},title:"添加"}),e("目录范围")]}),(0,v.jsx)(r.Sm,{disabled:""!==ue.cwd&&void 0!==ue.cwd,value:G,handleInputChange:e=>E(e)}),(T??[]).map((t,s)=>(0,v.jsxs)("div",{style:{display:"flex"},children:[(0,v.jsx)("div",{style:{width:"90%"},children:(0,v.jsx)(r.Sm,{disabled:0!==ue?.access_dirs?.length&&void 0!==ue?.access_dirs?.length,value:t,handleInputChange:e=>{T[s]=e,H([...T])}})}),0===ue?.access_dirs?.length||void 0===ue?.access_dirs?.length&&(0,v.jsx)(a.rA,{icon:"delete",onClick:()=>{T.splice(s,1),H([...T])},title:e("删除")})]},s)),(0,v.jsxs)("label",{children:[!ue?.not_access_dirs?.length&&(0,v.jsx)(a.rA,{icon:"add",onClick:()=>{U([...q,""])},title:e("添加")}),e("禁止目录范围")]}),(q??[]).map((t,s)=>(0,v.jsxs)("div",{style:{display:"flex"},children:[(0,v.jsx)("div",{style:{width:"90%"},children:(0,v.jsx)(r.Sm,{disabled:0!==ue?.not_access_dirs?.length&&void 0!==ue?.not_access_dirs?.length,value:t,handleInputChange:e=>{q[s]=e,U([...q])}})}),0===ue?.not_access_dirs?.length||void 0===ue?.not_access_dirs?.length&&(0,v.jsx)(a.rA,{icon:"delete",onClick:()=>{q.splice(s,1),U([...q])},title:e("删除")})]},s)),(0,v.jsxs)("label",{children:[!ue?.only_read_dirs?.length&&(0,v.jsx)(a.rA,{icon:"add",onClick:()=>{D([...Z,""])},title:e("添加")}),e("只读目录范围")]}),(Z??[]).map((t,s)=>(0,v.jsxs)("div",{style:{display:"flex"},children:[(0,v.jsx)("div",{style:{width:"90%"},children:(0,v.jsx)(r.Sm,{disabled:0!==ue?.only_read_dirs?.length&&void 0!==ue?.only_read_dirs?.length,value:t,handleInputChange:e=>{Z[s]=e,D([...Z])}})}),0===ue?.only_read_dirs?.length||void 0===ue?.only_read_dirs?.length&&(0,v.jsx)(a.rA,{icon:"delete",onClick:()=>{Z.splice(s,1),D([...Z])},title:e("删除")})]},s)),(0,v.jsx)("label",{children:e("可执行的命令")}),(0,v.jsx)(r.Sm,{disabled:""!==ue.access_cmd&&void 0!==ue.access_cmd,value:W,placeholder:"use blank split",handleInputChange:e=>L(e)}),(0,v.jsx)("label",{children:e("禁止执行的命令")}),(0,v.jsx)(r.Sm,{disabled:""!==ue.not_access_cmd&&void 0!==ue.not_access_cmd,value:Q,placeholder:"use blank split",handleInputChange:e=>J(e)}),!oe&&(0,v.jsxs)(n.Fragment,{children:[(0,v.jsx)("label",{children:e("角色")}),(0,v.jsx)(r.l6,{value:de,onChange:e=>{Se(e)},options:(()=>{const e=[];e.push({title:"NOT",value:""});for(let t of xe)e.push({title:t.role_name,value:t.role_id});return e})()})]}),(0,v.jsx)("label",{children:e("语言")}),(0,v.jsx)(r.l6,{disabled:""!==ue.language&&void 0!==ue.language,value:R,onChange:e=>{Y(e)},options:[{title:e("跟随系统"),value:"sys"},{title:"English",value:"en"},{title:"中文",value:"zh"}]}),(0,v.jsx)("label",{children:e("主题")}),(0,v.jsx)(r.l6,{disabled:""!==ue.theme&&void 0!==ue.theme,value:ee,onChange:e=>{te(e)},options:_e}),(0,v.jsx)(z,{is_disable:e=>{if(!0===oe)return!0;if(de){const t=P.get(de);if(t)return(t.auth_list??[]).includes(e)}return!1},is_selected:(e,t)=>!t&&!0===oe||void 0!==se?.find(t=>t===e),select_auth:e=>{se?se.includes(e)?((0,O.I)(se,t=>t===e),ne([...se])):ne([...se,e]):ne([e])}}),(0,v.jsx)("label",{children:e("备注")}),(0,v.jsx)(r.Sm,{value:ie,handleInputChange:e=>le(e)})]})})})]})}function M(){const{t:e,i18n:t}=(0,u.B)(),{initUserInfo:s}=(0,n.useContext)(V.F),[_,m]=(0,n.useState)([]),[j,f]=(0,g.fp)(p.AG.prompt_card),[w,S]=(0,n.useState)(!1),[C,y]=(0,n.useState)(!1),[k,b]=(0,g.fp)(p.AG.confirm),[A,I]=(0,n.useState)(""),[X,N]=(0,n.useState)(""),[K,P]=(0,n.useState)([]),[B,M]=(0,n.useState)([]),[$,G]=(0,n.useState)([]),[E,T]=(0,n.useState)(""),[H,q]=(0,n.useState)(""),[U,Z]=(0,n.useState)(""),[D,W]=(0,n.useState)(""),[L,Q]=(0,n.useState)([]),[J,R]=(0,n.useState)(""),[Y,ee]=(0,n.useState)(""),te=(0,F.o)(),se=[e("角色id"),e("角色名"),e("备注")],ne=async()=>{const e=await c.wm.get("all_roles");e.code===d.m.Success&&m(e.data)},ie=e=>{I(e?.role_name??""),N(e?.cwd??""),P(e?.access_dirs??[]),M(e?.not_access_dirs??[]),G(e?.only_read_dirs??[]),T(e?.access_cmd??""),q(e?.not_access_cmd??""),Z(e?.language??""),W(e?.theme??""),Q(e?.auth_list??[]),R(e?.role_id??""),ee(e?.role_note??"")};(0,n.useEffect)(()=>{ne()},[]);const le=()=>{if(!A)return void(0,x.zN)("role_name not empty");const e=new l.E0;return e.language=U,e.theme=D,e.access_dirs=K,e.role_name=A,e.not_access_dirs=B,e.only_read_dirs=$,e.cwd=X,e.access_cmd=E,e.not_access_cmd=H,e.auth_list=L,e.role_note=Y,e};return(0,v.jsxs)(i.fI,{children:[(0,v.jsx)(i.VP,{widthPer:50,children:(0,v.jsx)(i.xh,{children:(0,v.jsx)(o.uF,{self_title:(0,v.jsx)("span",{className:" div-row ",children:(0,v.jsx)("h2",{children:e("角色")})}),titleCom:(0,v.jsx)("div",{children:(0,v.jsx)(a.rA,{icon:"add",title:e("添加"),onClick:()=>{S(!0),y(!1),ie(void 0)}})}),children:(0,v.jsx)(h.X,{headers:se,rows:_.map((t,s)=>{const n=[(0,v.jsx)("p",{children:t.role_id}),(0,v.jsx)(o.xP,{children:t.role_name}),(0,v.jsx)(o.xP,{children:t.role_note}),(0,v.jsxs)("div",{children:[(0,v.jsx)(a.rA,{icon:"edit",title:e("编辑"),onClick:()=>(e=>{S(!1),y(!0),ie(e)})(t)}),!t.is_root&&(0,v.jsx)(a.rA,{icon:"delete",title:e("删除"),onClick:()=>(async t=>{b({open:!0,title:e("确定删除吗"),handle:async()=>{const e=new l.E0;e.role_id=t,(await c.wm.post("delete_role",e)).code===d.m.Success&&((0,x.SK)("删除完成"),ne(),b({open:!1,handle:null}))}})})(t.role_id)})]})];return n}),width:"10rem"})})})}),(0,v.jsx)(i.VP,{widthPer:50,children:(w||C)&&(0,v.jsx)(i.xh,{children:(0,v.jsxs)(o.Zp,{self_title:(0,v.jsxs)("span",{className:" div-row ",children:[(0,v.jsx)("h2",{children:e(""+(w?"添加":"编辑"))})," "]}),rightBottomCom:(0,v.jsxs)("div",{children:[(0,v.jsx)(a.rA,{icon:"cancel",title:e("取消"),onClick:()=>{S(!1),y(!1),ie(void 0)}}),w&&(0,v.jsx)(a.rA,{icon:"add_circle",title:e("添加"),onClick:async()=>{const e=le();if(!e)return;const t=await c.wm.post("create_role",e);ne(),t.code===d.m.Success&&((0,x.SK)("创建完成"),ne(),S(!1),y(!1),ie(void 0))}}),C&&(0,v.jsx)(a.rA,{icon:"save",title:e("保存"),onClick:async()=>{const e=le();if(!e)return;e.role_id=J;(await c.wm.post("save_role",e)).code===d.m.Success&&((0,x.SK)("保存完成"),ne())}})]}),children:[(0,v.jsx)("label",{children:e("角色名")}),(0,v.jsx)(r.Sm,{value:A,handleInputChange:e=>I(e)}),(0,v.jsx)("label",{children:e("角色备注")}),(0,v.jsx)(r.Sm,{value:Y,handleInputChange:e=>ee(e)}),(0,v.jsxs)("label",{children:[(0,v.jsx)(a.rA,{icon:"add",onClick:()=>{P([...K,""])},title:"添加"}),e("目录范围")]}),(0,v.jsx)(r.Sm,{value:X,handleInputChange:e=>N(e)}),(K??[]).map((e,t)=>(0,v.jsxs)("div",{style:{display:"flex"},children:[(0,v.jsx)("div",{style:{width:"90%"},children:(0,v.jsx)(r.Sm,{value:e,handleInputChange:e=>{K[t]=e,P([...K])}})}),(0,v.jsx)(a.rA,{icon:"delete",onClick:()=>{K.splice(t,1),P([...K])},title:"删除"})]},t)),(0,v.jsxs)("label",{children:[(0,v.jsx)(a.rA,{icon:"add",onClick:()=>{M([...B,""])},title:"添加"}),e("禁止目录范围")]}),(B??[]).map((t,s)=>(0,v.jsxs)("div",{style:{display:"flex"},children:[(0,v.jsx)("div",{style:{width:"90%"},children:(0,v.jsx)(r.Sm,{value:t,handleInputChange:e=>{B[s]=e,M([...B])}})}),(0,v.jsx)(a.rA,{icon:"delete",onClick:()=>{B.splice(s,1),M([...B])},title:e("删除")})]},s)),(0,v.jsxs)("label",{children:[(0,v.jsx)(a.rA,{icon:"add",onClick:()=>{G([...$,""])},title:e("添加")}),e("只读目录范围")]}),($??[]).map((e,t)=>(0,v.jsxs)("div",{style:{display:"flex"},children:[(0,v.jsx)("div",{style:{width:"90%"},children:(0,v.jsx)(r.Sm,{value:e,handleInputChange:e=>{$[t]=e,G([...$])}})}),(0,v.jsx)(a.rA,{icon:"delete",onClick:()=>{$.splice(t,1),G([...$])},title:"删除"})]},t)),(0,v.jsx)("label",{children:e("可执行的命令")}),(0,v.jsx)(r.Sm,{value:E,placeholder:"use blank split",handleInputChange:e=>T(e)}),(0,v.jsx)("label",{children:e("禁止执行的命令")}),(0,v.jsx)(r.Sm,{value:H,placeholder:"use blank split",handleInputChange:e=>q(e)}),(0,v.jsx)("label",{children:e("语言")}),(0,v.jsx)(r.l6,{value:U,onChange:e=>{Z(e)},options:[{title:e("跟随系统"),value:"sys"},{title:"NOT",value:""},{title:"English",value:"en"},{title:"中文",value:"zh"}]}),(0,v.jsx)("label",{children:e("主题")}),(0,v.jsx)(r.l6,{value:D,onChange:e=>{W(e)},options:te}),(0,v.jsx)(z,{is_disable:()=>!1,is_selected:(e,t)=>void 0!==L?.find(t=>t===e),select_auth:e=>{L?(L.find(t=>t==e)?(0,O.I)(L,t=>t===e):L.push(e),Q([...L])):Q([e])}})]})})})]})}function $(){const{t:e,i18n:t}=(0,u.B)(),{initUserInfo:s,reloadUserInfo:_}=(0,n.useContext)(V.F),[m,j]=(0,n.useState)([]),[f,w]=(0,g.fp)(p.AG.prompt_card),[C,k]=(0,n.useState)([]),[b,I]=(0,n.useState)([]),[X,N]=(0,n.useState)([]),[O,K]=(0,g.fp)(p.AG.user_base_info),z=(0,S.K)(),P=(0,F.o)(),B=[e("编号"),e("路径"),e("是否默认"),e("备注")],M=[e("编号"),e("路径"),e("备注")],$=[e("编号"),e("命令"),e("父编号"),e("备注")],G=[e("文件后缀"),e("命令"),e("其他参数"),e("备注")],[E,T]=(0,n.useState)(""),[H,q]=(0,n.useState)(""),[U,Z]=(0,n.useState)(""),[D,W]=(0,n.useState)(!1),[L,Q]=(0,n.useState)(""),[J,R]=(0,n.useState)(""),[Y,ee]=(0,n.useState)("");(0,n.useEffect)(()=>{(async()=>{const e=await c.XO.get("filesSetting");e.code===d.m.Success&&(j(e.data.dirs),I(e.data.quick_cmd),N(e.data.file_quick_cmd));const t=await c.XO.get("protection_dir");t.code===d.m.Success&&k(t.data??[])})(),Q(O?.user_data?.language),R(O?.user_data?.theme),ee(O?.user_data?.upload_file_ignore)},[]);const te=(0,F.Q)();return(0,v.jsx)(n.Fragment,{children:(0,v.jsxs)(i.fI,{children:[(0,v.jsxs)(i.VP,{widthPer:33,children:[(0,v.jsx)(i.xh,{children:(0,v.jsxs)(o.Zp,{title:e("修改密码"),rightBottomCom:(0,v.jsx)(a.C3,{text:e("确定修改"),clickFun:async()=>{if(!E||!H)return void(0,x.zN)("账号密码不能为空");if(H!==U)return void(0,x.zN)("两次密码不一样");const e=new l.tl;e.username=E,e.password=H,e.confirm_password=U,e.user_id=O.user_data.id;(await c.wm.post("updatePassword",e)).code===d.m.Success&&(0,x.SK)("修改成功")}}),children:[(0,v.jsx)(r.Sm,{placeholder:e("新账号"),value:E,handleInputChange:e=>{T(e)}}),(0,v.jsx)(r.cA,{placeholder:e("新密码"),handleInputChange:e=>{q(e)}}),(0,v.jsx)(r.cA,{placeholder:e("确认密码"),handleInputChange:e=>{Z(e)}})]})}),(0,v.jsx)(i.xh,{children:(0,v.jsxs)(o.Zp,{title:e("个性化设置"),rightBottomCom:(0,v.jsx)(a.C3,{text:e("确定修改"),clickFun:async()=>{(await c.XO.post(y.s.setting_sys_option_status_save,{type:A.Mu.private_sys_env,value:{language:L,theme:J,upload_file_ignore:Y}})).code===d.m.Success&&((0,x.SK)("修改成功"),s())}}),children:[e("语言"),(0,v.jsx)(r.l6,{value:L,onChange:e=>{Q(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,v.jsx)(r.l6,{value:J,onChange:e=>{R(e)},options:P}),(0,v.jsx)(r.Sm,{value:Y,handleInputChange:e=>{ee(e)},placeholderOut:e("拖拽文件上传忽略列表"),placeholder:"node_modules *.js",no_border:!0})]})})]}),(0,v.jsxs)(i.VP,{children:[(0,v.jsxs)(i.xh,{children:[(0,v.jsx)(o.uF,{self_title:(0,v.jsxs)("span",{className:" div-row ",children:[(0,v.jsx)("h2",{children:e("文件夹路径")})," ",(0,v.jsx)(a.rA,{icon:"info",onClick:()=>{te("文件夹路径")},title:e("信息")})]}),titleCom:(0,v.jsxs)("div",{children:[(0,v.jsx)(a.rA,{icon:"add",title:e("添加"),onClick:()=>{j([...m,{note:"",default:!1,path:""}])}}),(0,v.jsx)(a.rA,{icon:"save",title:e("保存"),onClick:async()=>{for(let e=0;e<m.length;e++)m[e].index=e;(await c.XO.post("filesSetting/save",{dirs:m})).code===d.m.Success&&((0,x.SK)("保存成功"),_(),s())}})]}),children:(0,v.jsx)(h.X,{headers:B,rows:m.map((t,s)=>{const n=[(0,v.jsx)("div",{children:s}),(0,v.jsx)(r.Sm,{value:t.path,handleInputChange:e=>{t.path=e},no_border:!0}),(0,v.jsx)(r.l6,{value:t.default,onChange:e=>{((e,t,s)=>{const n=[];for(let e=0;e<m.length;e++)m[e].default=e===s&&t,n.push(m[e]);j(n)})(0,e,s)},options:z,no_border:!0}),(0,v.jsx)(r.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,v.jsx)("div",{children:0!==s&&(0,v.jsx)(a.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{m.splice(e,1),j([...m])})(s)})})];return n}),width:"10rem"})}),(0,v.jsx)(o.uF,{self_title:(0,v.jsxs)("span",{className:" div-row ",children:[(0,v.jsx)("h2",{children:e("个人保护路径")})," ",(0,v.jsx)(a.rA,{icon:"info",onClick:()=>{te("保护目录")},title:e("信息")})]}),titleCom:(0,v.jsxs)("div",{children:[(0,v.jsx)(a.rA,{icon:"add",title:e("添加"),onClick:()=>{k([...C,{path:"",note:""}])}}),(0,v.jsx)(a.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await c.XO.post("protection_dir/save",C)).code===d.m.Success&&((0,x.SK)("保存成功"),_())}})]}),children:(0,v.jsx)(h.X,{headers:M,rows:C.map((t,s)=>{const n=[(0,v.jsx)("div",{children:s}),(0,v.jsx)(r.Sm,{value:t.path,handleInputChange:e=>{t.path=e},no_border:!0}),(0,v.jsx)(r.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,v.jsx)(a.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{C.splice(e,1),k([...C])})(s)})];return n}),width:"10rem"})})]}),(0,v.jsxs)(i.xh,{children:[(0,v.jsx)(o.uF,{self_title:(0,v.jsxs)("span",{className:" div-row ",children:[(0,v.jsx)("h2",{children:e("目录快捷命令")}),(0,v.jsx)(a.rA,{icon:"info",onClick:()=>{te("目录快捷命令")},title:"info"})]}),titleCom:(0,v.jsxs)("div",{children:[(0,v.jsx)(a.rA,{icon:"add",title:e("添加"),onClick:()=>{I([...b,{cmd:"",note:""}])}}),(0,v.jsx)(a.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await c.XO.post("filesSetting/save",{quick_cmd:b})).code===d.m.Success&&((0,x.SK)("保存成功"),s())}})]}),children:(0,v.jsx)(h.X,{headers:$,rows:b.map((t,s)=>{const n=[(0,v.jsx)(r.Sm,{value:t.index,handleInputChange:e=>{t.index=e},no_border:!0}),(0,v.jsx)(r.Sm,{value:t.cmd,handleInputChange:e=>{t.cmd=e},no_border:!0}),(0,v.jsx)(r.Sm,{value:t.father_index,handleInputChange:e=>{t.father_index=e},no_border:!0}),(0,v.jsx)(r.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,v.jsx)(a.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{b.splice(e,1),I([...b])})(s)})];return n}),width:"10rem"})}),(0,v.jsx)(o.uF,{self_title:(0,v.jsxs)("span",{className:" div-row ",children:[(0,v.jsx)("h2",{children:e("文件快捷命令")}),(0,v.jsx)(a.rA,{icon:"info",onClick:()=>{te("文件快捷命令")},title:"info"})]}),titleCom:(0,v.jsxs)("div",{children:[(0,v.jsx)(a.rA,{icon:"add",title:e("添加"),onClick:()=>{N([...X,{cmd:"",note:"",file_suffix:"",params:""}])}}),(0,v.jsx)(a.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await c.XO.post("filesSetting/save",{file_quick_cmd:X})).code===d.m.Success&&((0,x.SK)("保存成功"),s())}})]}),children:(0,v.jsx)(h.X,{headers:G,rows:X.map((t,s)=>{const n=[(0,v.jsx)(r.Sm,{value:t.file_suffix,handleInputChange:e=>{t.file_suffix=e},no_border:!0}),(0,v.jsx)(r.Sm,{value:t.cmd,handleInputChange:e=>{t.cmd=e},no_border:!0}),(0,v.jsx)(r.Sm,{value:t.params,handleInputChange:e=>{t.params=e},no_border:!0}),(0,v.jsx)(r.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,v.jsx)(a.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{X.splice(e,1),N([...X])})(s)})];return n}),width:"10rem"})})]})]})]})})}var G=s(87361);function E(){const{t:e}=(0,u.B)(),{check_user_auth:t}=(0,w.MH)(),s=[{index:1,name:`${e("个人环境")}`,rto:"private_env_setting",component:(0,v.jsx)($,{})}];return t(l.oV.sys_setting_page)&&s.unshift({index:1,name:e("系统"),rto:"password",component:(0,v.jsx)(N,{})}),t(l.oV.sys_env_page)&&s.push({index:1,name:`${e("系统环境")}`,rto:"env_setting/",component:(0,v.jsx)(K,{})}),t(l.oV.auth_router_page)&&s.push({index:1,name:e("自定义路由"),rto:"customer_router/",component:(0,v.jsx)(b,{})}),t(l.oV.user_manage)&&s.push({index:1,name:e("用户管理"),rto:"user_manager/",component:(0,v.jsx)(B,{})}),t(l.oV.role_manage)&&s.push({index:1,name:e("角色管理"),rto:"role_manager/",component:(0,v.jsx)(M,{})}),(0,v.jsx)(i.W1,{optionList:s,father_route:G.o.setting})}},92350(e,t,s){s.d(t,{Q:()=>h,o:()=>p});var n=s(34843),i=s(82893),l=s(74777),o=s(96540),a=s(86149),r=s(23430),c=s(14284),d=s(74848);function h(){const[e,t]=(0,n.fp)(i.AG.prompt_card),{t:s,i18n:o}=(0,a.B)();return e=>{let n;e===l.jk.ffmpeg?n=(0,d.jsx)("div",{children:"视频转换,rtsp播放器等媒体功能都需要这个软件。linux下你可以使用apt或者yum来安装,或者直接输入软件的位置"}):e===l.jk.smartmontools?n=(0,d.jsx)("div",{children:"磁盘检查需要这个软件。linux下你可以使用apt或者yum来安装,或者直接输入软件的位置。"}):"保护目录"===e?n=(0,d.jsxs)("div",{children:["在删除的时候保护目录会拒绝删除。",(0,d.jsxs)("ul",{children:[(0,d.jsx)("li",{children:"可以使用 /* 来表达该目录下所有文件都禁止删除"}),(0,d.jsx)("li",{children:"可以使用 /** 来表达该目录下所有子目录文件都禁止删除"})]})]}):"文件夹路径"===e?n=(0,d.jsx)("div",{children:"用于在文件夹下切换根目录"}):"环境路径"===e?n=(0,d.jsx)("div",{children:"当在不同用户环境下运行的时候由于没有执行终端去加载PATH,这里可以添加额外的PATH路径,点击这里的保存还会更新系统上的path路径"}):"pty"===e?n=(0,d.jsx)("div",{children:"一些需要Pty环境的命令"}):"文件上传"===e?n=(0,d.jsx)("div",{children:(0,d.jsxs)("ul",{children:[(0,d.jsx)("li",{children:"对于不同的目录(包括所有子目录),可能是机械或者固态硬盘,机械硬盘在处理多个小文件的时候会做随机i/o,由于一般只有一个盘头所以会影响整体效率,特别是写操作,这里提供了上传时候的最大数量限制,对于下载数量目前不做限制."}),(0,d.jsx)("li",{children:"大文件支持断点和分块并发传输,建议并发数量设置为2,分块大小设置为10MB,大文件判断为500MB,设置过大的话会上传的时候会占据较大内存"})]})}):"目录快捷命令"===e?n=(0,d.jsx)("div",{children:"右键文件夹空白处用于,打开终端快捷执行命令"}):"文件快捷命令"===e?n=(0,d.jsx)("div",{children:"用于右键特定后缀的文件,执行一些快捷命令,文件后缀可以是多个,用空格分割"}):"Workflow"===e?n=(0,d.jsx)("div",{children:(0,d.jsxs)("ul",{children:[(0,d.jsx)("li",{children:"在特定的时间启动系统中的workflow任务"}),(0,d.jsx)("li",{children:"cron表达式是定时器 格式为: 秒 分 时 日 月 星期"}),(0,d.jsxs)("li",{children:[(0,d.jsx)("li",{children:'1. "*"(通配符,所有值)'}),(0,d.jsx)("li",{children:'2. "," 是枚举: 0 0 1,15 * * *'}),(0,d.jsx)("li",{children:'3. "-" 是范围: 0 0 1-5 * * *'}),(0,d.jsx)("li",{children:'4. "/" 是步长,标识每隔n执行 */3 * * * * * 每隔三秒,必须配合 * 使用 ,/ 只能写一次 ,有了/就成了定时器,而不是指定时间执行'})]})]})}):"插件配置"===e?n=(0,d.jsx)("div",{children:s("路径可以是一个 js 文件也可以是一个node 项目目录")}):"机器人配置"===e&&(n=(0,d.jsxs)("div",{children:[(0,d.jsx)("dv",{children:"机器人功能用于开通各种第三方支持的机器人,让第三方机器人接入本地的 AI 模型。"}),(0,d.jsxs)("ul",{children:[(0,d.jsx)("li",{children:" 1. qq 机器人需要先在手机 app 中添加,然后在https://q.qq.com/qqbot/ 登录机器人配置页面,在开发管理中复制机器人的 appId,appSecret 到这里就完成了配置了。目前 qq 机器人不稳定,且创建后无法删除(2026.07.05)"}),(0,d.jsx)("li",{children:" 2. https://opensource.dingtalk.com/developerpedia/docs/explore/tutorials/stream/bot/nodejs/create-bot 这个是钉钉机器人开通教程,注意复制钉钉的 clientId 的是时候不要复制成appId 了。"}),(0,d.jsx)("li",{children:" 3. 企业微信机器人的开通甚至不需要 pc 操作,在通讯录中点击智能机器人,选择 api 模式,就创建完成了,手机上直接复制 id 和密钥。"}),(0,d.jsx)("li",{children:" 4. 飞书https://open.feishu.cn/document/develop-an-echo-bot/introduction?from=banner 登录这个开发者后台,按照这个地址教程创建机器人,使用的时候这个机器人是作为一个应用,可以在工作台内搜索你的这个机器人的名字。"})]})]})),t({open:!0,title:"信息",context_div:(0,d.jsx)("div",{children:n})})}}let u=r.Ky;function p(){const[e,t]=(0,o.useState)([]);return(0,o.useEffect)(()=>{(async()=>{try{const e=await c.XO.get("themes");if(0===e.code){const s=e.data||[];u=[...r.Ky,...s],t(u)}else console.warn("获取主题列表失败,使用默认列表"),t(u)}catch(e){t(u)}})()},[]),e}},6960(e,t,s){s.d(t,{s:()=>o});var n=s(72635);const i=1440,l=525600;function o(e){e=e>1e12?e:1e3*e;const t=Date.now(),s=Math.abs(t-e)/6e4;return s<1?n.Ay.t("小于一分钟"):s<60?`${s.toFixed(0)} ${n.Ay.t("分钟前")}`:s<i?`${(s/60).toFixed(0)} ${n.Ay.t("小时前")}`:s<43200?`${(s/i).toFixed(0)} ${n.Ay.t("天前")}`:s<l?`${(s/43200).toFixed(0)} ${n.Ay.t("月前")}`:`${(s/l).toFixed(0)} ${n.Ay.t("年前")}`}},24659(e,t,s){var n=s(86149);s.d(t,["K",0,()=>{const{t:e}=(0,n.B)();return[{title:e("是"),value:!0,color:"#28a745"},{title:e("否"),value:!1,color:"#666666"}]}])}}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[1893,6010],{83277(e,s,t){t.d(s,{$j:()=>i,Lv:()=>n});class n{token;open=!1;note;index;url;model;request_type;json_params;sys_prompt;dotenv="";tool_mode=!1;show_options;static get_label_by_v(e,s){if(!e||!s?.length)return e;for(const t of s)if(t.value===e)return t.label;return e}static have_label_by_v(e,s){if(!e||!s?.length)return!1;for(const t of s)if(t.value===e)return!0;return!1}}const a=JSON.stringify({stream:!0,thinking:{type:"disabled"}});function i(e){return"string"==typeof e?e:Array.isArray(e)?e.map(e=>"text"===e.type?e.text:"[图片]").join("\n"):""}t.d(s,["CP",0,'\n\n\n\n# 聊天循环最大次数\ntool_call_max=500\n# 是否允许AI直接执行命令而不需要用户确认,默认为false,需要用户手动确认,如果使用 workflow 这里等价于为 true\nallow_exec_cmd_directly=false\n\n# 可选的代理 url,如果指定了所有访问大模型的请求将会走代理\n#proxy_url=\n\n# 可选的多个url 以数组分割\n# options_agent_url_list=[{"value":"http://..","label":"openai"}]\n\n# 可选的多个 key\n# options_agent_key_list=[{"value":"sh-aaa","label":"option1"}]\n\n# 可选的多个 model\n# options_agent_model_list=[{"value":"gpt-5.5","label":"gpt"}]\n\n# 存放本地的 prompt 文件 用于每次聊天的时候自动读取并加载\n# options_local_file_path_prompt_list=["/prompt/a.txt"]\n\n# 开启切换模型 ,开启以后,你可以自己写 prompt 提供多个模型让 ai 自己根据每次聊天切换下一步调用其他模型的次数\n# open_pick_model=false\n\n# 压缩后仍然完整保留的最近消息数\nmax_recent_messages=12\n# 当单个会话累计消息条数超过该值时,触发历史消息裁剪\ncompress_message_count=16\n# 历史消息中 tool 输出的最大字符数,只保留调用形式让 AI 知道调用了就行\nmax_tool_content_chars=200\n\n# ===== 模型类型(request_type)=====\n# 必填项,不同类型的 model 接口格式不同,默认 completions。\n# 可选值:\n# completions 标准对话/聊天补全 (chat/completions)\n# images 图片生成 (images/generations)\n# audio_speech 文本转语音 (audio/speech)\n# audio_transcription 语音转文字 (audio/transcriptions)\n# audio_translation 语音翻译 (audio/translations)\n# embeddings 向量嵌入 (embeddings)\n#request_type=completions\n\n# ===== 成为 tool(tool_mode)=====\n# 开启后该模型会作为一个工具被加载,可实现不同模型担任不同角色/能力,供 AI agent 在对话中动态调用。\n# 注意:不能与「是否开启」(open) 同时为 true。\n#tool_mode=false\n',"cL",0,a])},12810(e,s,t){t.r(s),t.d(s,{default:()=>X});var n=t(96540),a=t(34843),i=t(86149),c=t(86090),o=t(92275),r=t(14284),l=t(7463),d=t(78247),u=t(40505),m=t(62042),h=t(45907),g=t(53459),p=t(72693),x=t(82893),_=t(61443),f=t(83277);function j(e){return null==e||e<0?"0":e.toLocaleString()}function v(e){const s=(0,f.$j)(e.content);if(s)return s;const t=e.content_list??[];return t.length?t.map(e=>(0,f.$j)(e.content)).filter(Boolean).join("\n\n"):""}function b(e=[]){return e.filter(e=>"user"===e.role||"assistant"===e.role).map((e,s)=>({id:Date.now()+s,sender:"assistant"===e.role?"bot":"user",text:v(e),attachments:e.attachments??[],content_list:e.content_list,images:e.images,audio:e.audio,embeddings:e.embeddings}))}const y=/\.(md|txt|json|js|jsx|ts|tsx|css|html?|xml|ya?ml|py|java|go|rs|c|cpp|h|hpp|sh|bat|cmd|ini|toml|csv|log|sql|env|gitignore|dockerfile)$/i;function w(e){return e.type?.startsWith("image/")?"image":e.type?.startsWith("text/")||y.test(e.name)?"text":"binary"}function S(e){return e.text()}function N(e){return new Promise((s,t)=>{const n=new FileReader;n.onload=()=>s(n.result),n.onerror=t,n.readAsDataURL(e)})}async function k(e){const s=[];for(const t of e){const e=w(t);let n="";if("text"===e)try{const e=await S(t),s=12e4;n=e.length>s?`${e.slice(0,s)}\n\n[内容已截断,原始长度 ${e.length} 字符]`:e}catch{n="[文本读取失败]"}else if("image"===e)try{n=await N(t)}catch{n=`[图片文件: ${t.name}]`}else n=`[二进制文件: ${t.name}]`;s.push({name:t.name,mime_type:t.type,size:t.size,kind:e,content:n})}return s}var C=t(14944);var A=t(85997),$=t(34299),I=t(74848);function M(e){const s=e.attachments&&e.attachments.length>0?(0,I.jsx)("div",{className:"chat-message-attachments",children:e.attachments.map((e,s)=>(0,I.jsxs)("div",{className:"chat-message-attachment",children:[(0,I.jsx)(A.In,{icon:"attach_file"}),(0,I.jsx)("span",{children:e.name}),(0,I.jsxs)("small",{children:[e.size," B"]})]},`${e.name}_${s}`))}):null,t=[];e.images&&"bot"===e.sender&&t.push((0,I.jsx)(n.Fragment,{children:(0,I.jsx)(R,{images:e.images,text:e.text})},"images")),e.audio&&"bot"===e.sender&&t.push((0,I.jsx)(n.Fragment,{children:(0,I.jsx)(H,{audio:e.audio,text:e.text})},"audio")),e.embeddings&&"bot"===e.sender&&t.push((0,I.jsx)(n.Fragment,{children:(0,I.jsx)(V,{embeddings:e.embeddings,text:e.text})},"embeddings"));const a=function(e){if("bot"!==e.sender||!e.content_list?.length)return e.text?(0,I.jsx)($.default,{context:e.text}):null;return(0,I.jsxs)(I.Fragment,{children:[e.content_list.map((e,s)=>{const t=[],a=(0,f.$j)(e.content);return a&&t.push((0,I.jsx)(n.Fragment,{children:(0,I.jsx)($.default,{context:a})},`content-${s}`)),e.tool_call_ends?.length&&t.push((0,I.jsx)(n.Fragment,{children:(0,I.jsx)(D,{callList:e.tool_call_ends})},`tool-${s}`)),(0,I.jsx)(n.Fragment,{children:t},`part-${s}`)}),!e.content_list.some(e=>e.content)&&e.text?(0,I.jsx)($.default,{context:e.text}):null]})}(e);return 0===t.length?(0,I.jsxs)(I.Fragment,{children:[s,a]}):(0,I.jsxs)(I.Fragment,{children:[t,s,a]})}function D({callList:e}){const[s,t]=n.useState(!1);if(!e?.length)return null;e.filter(e=>e.success).length;const a=e.filter(e=>!e.success).length;return(0,I.jsxs)("div",{className:"chat-message-call-list",children:[(0,I.jsxs)("div",{className:"call-list-header",onClick:()=>t(!s),children:[(0,I.jsx)(A.In,{icon:s?"expand_less":"expand_more"}),(0,I.jsxs)("span",{className:"call-list-summary",children:["工具调用 (",e.length,")",a>0&&(0,I.jsx)("span",{className:"call-list-fail",children:" 失败 "})]})]}),s&&(0,I.jsx)("div",{className:"call-list-body",children:e.map((e,s)=>(0,I.jsxs)("div",{className:"call-list-item "+(e.success?"call-success":"call-fail"),children:[(0,I.jsxs)("div",{className:"call-list-item-header",children:[(0,I.jsx)(A.In,{icon:e.success?"check_circle":"error"}),(0,I.jsx)("span",{className:"call-list-tool-name",children:e.tool_display_name||e.tool_name}),(0,I.jsxs)("span",{className:"call-list-duration",children:[e.duration_ms,"ms"]})]}),e.tool_args&&(0,I.jsxs)("details",{className:"call-list-details",children:[(0,I.jsx)("summary",{children:"参数"}),(0,I.jsx)("pre",{className:"call-list-pre",children:JSON.stringify(e.tool_args,null,2)})]}),!e.success&&e.error&&(0,I.jsxs)("details",{className:"call-list-details",children:[(0,I.jsx)("summary",{children:"错误"}),(0,I.jsx)("pre",{className:"call-list-pre call-list-error-text",children:e.error})]}),e.success&&e.tool_result&&(0,I.jsxs)("details",{className:"call-list-details",children:[(0,I.jsx)("summary",{children:"结果"}),(0,I.jsx)("pre",{className:"call-list-pre",children:e.tool_result.length>500?e.tool_result.slice(0,500)+"...":e.tool_result})]})]},s))})]})}function R({images:e,text:s}){let t=e||[];if(!t.length&&s)try{t=JSON.parse(s).data||[]}catch{}return t.length?(0,I.jsxs)("div",{className:"image-generation-result",children:[t.map((e,s)=>(0,I.jsxs)("div",{className:"image-generation-item",children:[e.url&&(0,I.jsx)("div",{className:"image-generation-image-wrapper",children:(0,I.jsx)("img",{src:e.url,alt:e.revised_prompt||`生成的图片 ${s+1}`,loading:"lazy"})}),e.b64_json&&(0,I.jsx)("div",{className:"image-generation-image-wrapper",children:(0,I.jsx)("img",{src:`data:image/png;base64,${e.b64_json}`,alt:`生成的图片 ${s+1}`})}),e.revised_prompt&&(0,I.jsx)("p",{className:"image-generation-prompt",children:(0,I.jsx)("small",{children:e.revised_prompt})})]},s)),s&&!e&&(0,I.jsx)($.default,{context:s})]}):(0,I.jsx)($.default,{context:s||""})}function H({audio:e,text:s}){if(e){if(e.url)return(0,I.jsx)("div",{className:"audio-result",children:(0,I.jsx)("audio",{controls:!0,src:e.url,children:"您的浏览器不支持音频播放"})});if(e.data){const s=e.mime_type||"audio/mpeg";return(0,I.jsx)("div",{className:"audio-result",children:(0,I.jsx)("audio",{controls:!0,src:`data:${s};base64,${e.data}`,children:"您的浏览器不支持音频播放"})})}}const t=s||"";if(t.startsWith("http://")||t.startsWith("https://"))return(0,I.jsx)("div",{className:"audio-result",children:(0,I.jsx)("audio",{controls:!0,src:t,children:"您的浏览器不支持音频播放"})});try{const e=JSON.parse(t);if(e?.data||e?.audio_data){const s=e.data||e.audio_data;return(0,I.jsx)("div",{className:"audio-result",children:(0,I.jsx)("audio",{controls:!0,src:`data:audio/mpeg;base64,${s}`,children:"您的浏览器不支持音频播放"})})}}catch{}return(0,I.jsx)($.default,{context:t})}function T({content:e,label:s}){const[t,a]=n.useState(!1);return(0,I.jsxs)("button",{className:"embeddings-copy-btn",onClick:()=>{(0,u.lW)(e),a(!0),setTimeout(()=>a(!1),1500)},children:[(0,I.jsx)(A.In,{icon:t?"check":"content_copy"}),t?"已复制":s||"复制"]})}function V({embeddings:e,text:s}){let t=e||null;if(!t&&s)try{t=JSON.parse(s)}catch{return(0,I.jsx)($.default,{context:s})}if(!t)return(0,I.jsx)($.default,{context:s||""});const n=t?.data||[],a=t?.usage,i=JSON.stringify(t,null,2);return(0,I.jsxs)("div",{className:"embeddings-result",children:[(0,I.jsxs)("div",{className:"embeddings-summary",children:[(0,I.jsx)("strong",{children:"向量嵌入结果"}),(0,I.jsxs)("span",{children:["维度: ",n[0]?.embedding?.length??"N/A"]}),(0,I.jsxs)("span",{children:["数量: ",n.length]}),a&&(0,I.jsxs)("span",{children:["使用 tokens: ",a.total_tokens??"N/A"]})]}),(0,I.jsxs)("div",{className:"embeddings-toolbar",children:[(0,I.jsx)(T,{content:i,label:"复制全部结果"}),n.length>0&&n[0]?.embedding&&(0,I.jsx)(T,{content:JSON.stringify(n[0].embedding,null,2),label:"复制第一条向量"}),n.length>0&&(0,I.jsx)(T,{content:JSON.stringify(n.map(e=>e.embedding),null,2),label:"复制所有向量数据"})]}),n.length>0&&n[0]?.embedding&&(0,I.jsx)("div",{className:"embeddings-preview",children:(0,I.jsxs)("span",{children:["向量预览: [",n[0].embedding.slice(0,5).join(", "),n[0].embedding.length>5?", ...":"","]"]})}),n.length>0&&(0,I.jsxs)("details",{children:[(0,I.jsx)("summary",{children:"查看详细数据"}),(0,I.jsx)("pre",{className:"embeddings-raw",children:i})]})]})}async function E(e,s,t,n){try{switch(e){case"images":{const e=await async function(e,s){const t={prompt:e,session_id:s},n=await r.jV.post("images/generations",t);if(0!==n.code)throw new Error(n.message||"图片生成失败");const a=n.data||{},i=(a.data||[]).map(e=>({url:e.url,b64_json:e.b64_json,revised_prompt:e.revised_prompt})),c=i.map((e,s)=>`![生成图片${s+1}](${e.url||`data:image/png;base64,${e.b64_json}`})${e.revised_prompt?`\n> ${e.revised_prompt}`:""}`).join("\n\n");return{session_id:a.session_id||s,images:i,text:c||`生成了 ${i.length} 张图片`}}(s,t);return e&&n(e.text,{images:e.images}),!0}case"audio_speech":{const e=await async function(e,s){const t={input:e,session_id:s};try{const e=localStorage.getItem("ai_audio_extra_params");if(e){const s=JSON.parse(e);s.voice&&(t.voice=s.voice),s.speed&&(t.speed=parseFloat(s.speed))}}catch{}const n=localStorage.getItem("token")||"",a=await fetch("/api/ai_agent/audio/speech",{method:"POST",headers:{"Content-Type":"application/json",Authorization:n},body:JSON.stringify(t)});if(!a.ok)throw new Error(`语音合成失败: ${a.statusText}`);const i=a.headers.get("X-Session-Id")||s,c=await a.arrayBuffer();return{session_id:i,audio:{data:btoa(String.fromCharCode(...Array.from(new Uint8Array(c)))),mime_type:a.headers.get("content-type")||"audio/mpeg"},text:`[音频文件: ${e.slice(0,50)}...]`}}(s,t);return e&&n(e.text,{audio:e.audio}),!0}case"embeddings":{const e=await async function(e,s){const t=await r.jV.post("embeddings",{input:e,session_id:s});if(0!==t.code)throw new Error(t.message||"Embeddings 请求失败");const n=t.data||{},a=n?.data??[],i=`向量维度: ${a[0]?.embedding?.length??0}, 数量: ${a.length}`;return{session_id:n.session_id||s,embeddings:n,text:`✅ Embeddings 结果 - ${i}\n\`\`\`json\n${JSON.stringify(n,null,2).slice(0,2e3)}\n\`\`\``}}(s,t);return e&&n(e.text,{embeddings:e.embeddings}),!0}default:return!1}}catch(e){return n(`请求失败: ${e?.message||JSON.stringify(e)}`),!0}}var K=t(57952),P=t(23430),B=t(87361);const F=({currentModelName:e,setCurrentModelName:s,modelGroups:t,onModelChanged:n,sysPromptList:o,batchMode:l,selectedMsgCount:u,onToggleSessionPanel:h,onCreateSession:p,onToggleBatchMode:f,onBatchDeleteMessages:j,bgProcessVisible:v,bgProcessCount:b,onToggleBgProcess:y,selectedSysPromptId:w,setSelectedSysPromptId:S})=>{const{t:N}=(0,i.B)(),k=(0,c.Zp)(),{check_user_auth:C}=(0,d.MH)(),[,$]=(0,a.fp)(x.AG.ai_session_collapsed),M=C(P.oV.ai_model_switch)||C(P.oV.ai_agent_setting),D=[];for(const e of t)for(const s of e.models)D.push({title:s.label||s.value,value:`${e.index}::${s.value}`,group:e.note});const R=t.find(e=>e.active),H=R?`${R.index}::${e}`:"";return(0,I.jsxs)(K.A,{children:[(0,I.jsx)(A.rA,{icon:"menu",title:N("会话"),onClick:h}),(0,I.jsx)(A.rA,{icon:"add",title:N("新会话"),onClick:()=>p()}),o.length>0&&(0,I.jsx)(_.l6,{value:w,options:[{title:N("选择系统提示词"),value:""},...o.map(e=>({title:e.note||e.prompt.slice(0,30),value:String(e.index)}))],onChange:e=>{S(e)},no_border:!0,width:"auto"}),M&&D.length>0&&(0,I.jsx)(_.l6,{value:H,options:[{title:N("选择模型"),value:""},...D],margin:"0 0 0 1em",onChange:e=>{const t=String(e??"");if(!t.includes("::"))return;const[a,...i]=t.split("::"),c=i.join("::");c&&(s(c),r.jV.post("set_active_model",{index:Number(a),model_name:c}).then(e=>{e?.code===g.m.Success?((0,m.SK)("success"),n()):(0,m.zN)(e?.message||"fail")}).catch(console.error))},no_border:!0,width:"auto"}),l&&u>0&&(0,I.jsx)(A.rA,{icon:"delete",title:N("删除选中消息"),onClick:j}),(0,I.jsx)(A.rA,{icon:"terminal",title:N("后台进程"),onClick:y,selected:v,tip:b||null}),C(P.oV.ai_agent_setting)&&(0,I.jsx)(A.rA,{icon:"smart_toy",title:"机器人配置",onClick:()=>{k(B.o.ai_rebot_setting_page)}}),C(P.oV.ai_agent_setting)&&(0,I.jsx)(A.rA,{icon:"settings",title:"ai setting",onClick:()=>{k(B.o.ai_agent_setting_page)}})]})};var L=t(18538);function O({sessions:e,activeSessionId:s,onSelectSession:t,onRenameSession:c,onDeleteSession:o,onToggleCmdAuto:r,onShowUsageStats:l,batchMode:d,selectedSessionIds:u,onToggleSessionSelect:m,onToggleBatchMode:h,onBatchDeleteSessions:g,onClearAllSessions:p}){const{t:_}=(0,i.B)(),[f,j]=(0,a.fp)(x.AG.ai_session_collapsed),[v,b]=(0,n.useState)(""),y=v.trim()?e.filter(e=>(e.title||"").toLowerCase().includes(v.toLowerCase())||(e.summary||"").toLowerCase().includes(v.toLowerCase())||(e.long_term_memory||"").toLowerCase().includes(v.toLowerCase())):e;return(0,I.jsxs)("aside",{className:`chat-session-list ${f?"active":""} ${f?"collapsed":""}`,children:[(0,I.jsx)("div",{className:"chat-session-search",children:(0,I.jsx)("input",{type:"text",className:"chat-session-search-input",placeholder:_("搜索会话"),value:v,onChange:e=>b(e.target.value)})}),(0,I.jsx)("div",{className:"chat-session-items-wrap",children:y.map(e=>{return(0,I.jsx)("div",{children:(0,I.jsxs)("button",{className:`chat-session-item ${s===e.id?"active":""} ${d?"batch-mode":""} ${e.running?"is-running":""}`,onClick:()=>{d&&m?m(e.id):t(e.id)},title:e.summary||e.long_term_memory||e.title,children:[d&&(0,I.jsx)("input",{type:"checkbox",className:"chat-session-checkbox",checked:u?.has(e.id)??!1,onChange:()=>m?.(e.id),onClick:e=>e.stopPropagation()}),(0,I.jsx)("span",{children:(n=e.title,n||"新会话")}),e.running&&(0,I.jsx)("span",{className:"chat-session-running",title:_("正在执行中")}),(0,I.jsx)("small",{children:e.message_count}),"web"!==e.source&&(0,I.jsx)("em",{className:"chat-session-source",children:e.source}),!d&&(0,I.jsx)(L.MenuSelect,{list:[{name:_("重命名"),click:()=>c(e.id,e.title)},{name:e.cmd_auto_allow?_("命令检测关闭"):_("命令检测开启"),click:()=>r?.(e.id,!e.cmd_auto_allow)},{name:_("字符消耗统计"),click:()=>l(e.id)},{name:_("删除"),click:()=>o(e.id)}],children:(0,I.jsx)(A.In,{icon:"more_horiz"})})]})},e.id);var n})}),(0,I.jsxs)("div",{className:"chat-session-actions",children:[(0,I.jsx)(A.rA,{icon:d?"check_circle":"checklist",title:_(d?"取消批量选择":"批量选择"),onClick:h}),d&&(u?.size??0)>0&&(0,I.jsx)(A.rA,{icon:"delete",title:_("删除选中会话"),onClick:g}),!d&&(0,I.jsx)(A.rA,{icon:"delete_sweep",title:_("删除全部会话"),onClick:p})]})]})}function q(e){const s=(e.text||"").split("\n").map(e=>e.trim()).find(Boolean)||"";return s.length>80?s.slice(0,80)+"…":s}const z=({messages:e,batchMode:s,selectedMsgIds:t,sending:a,chatContainerRef:i,messagesEndRef:c,onToggleMsgSelect:o,onDelete:r,onCopy:l,onToggleBatchMode:d,t:u})=>{const[m,h]=(0,n.useState)(new Set),g=(0,n.useMemo)(()=>e.filter(e=>!e.is_loading).map(e=>e.id),[e]),p=e=>{h(s=>{const t=new Set(s);return t.has(e)?t.delete(e):t.add(e),t})},x=()=>{h(e=>e.size>0&&g.every(s=>e.has(s))?new Set:new Set(g))};return(0,I.jsxs)("div",{className:"chat-messages",ref:i,"data-sending":a?"true":"false",children:[e.map(e=>{const n=m.has(e.id);return(0,I.jsxs)("div",{className:`chat-message ${e.sender} ${s?"batch-mode":""} ${e.is_loading?"is-loading":""} ${n?"collapsed":""}`,children:[s&&(0,I.jsx)("input",{type:"checkbox",className:"chat-message-checkbox",checked:t.has(e.id),onChange:()=>o(e.id)}),e.is_loading?(0,I.jsxs)("div",{className:"ai-loading-bubble",children:[(0,I.jsxs)("div",{className:"ai-loading-dots",children:[(0,I.jsx)("span",{className:"ai-loading-dot"}),(0,I.jsx)("span",{className:"ai-loading-dot"}),(0,I.jsx)("span",{className:"ai-loading-dot"})]}),(0,I.jsx)("span",{className:"ai-loading-text",children:e.text})]}):(0,I.jsxs)(I.Fragment,{children:[n?(0,I.jsxs)("div",{className:"chat-message-summary",title:e.text,onClick:()=>p(e.id),children:[(0,I.jsx)("span",{className:"chat-message-summary-icon",children:"▸"}),(0,I.jsx)("span",{className:"chat-message-summary-text",children:q(e)||u("(无内容)")})]}):(0,I.jsx)("div",{className:"chat-message-body",children:M(e)}),(0,I.jsxs)("div",{className:"message-collapse-bar",children:[(0,I.jsx)("button",{onClick:()=>p(e.id),children:u(n?"展开":"折叠")}),(0,I.jsx)("button",{onClick:x,children:u("全部折叠")})]}),(0,I.jsx)("div",{className:"message-actions",children:s?(0,I.jsx)("button",{onClick:()=>o(e.id),children:t.has(e.id)?u("取消选择"):u("选择")}):(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)("button",{onClick:()=>r(e.id),children:u("删除")}),(0,I.jsx)("button",{onClick:()=>l(e.text),children:u("复制")}),(0,I.jsx)("button",{onClick:d,children:u("多选")})]})})]})]},e.id)}),(0,I.jsx)("div",{ref:c})]})},G=(0,n.forwardRef)(function({placeholder:e="",disabled:s=!1,className:t,style:a,onEnter:i,onPaste:c,onChange:o},r){const l=(0,n.useRef)(null),[d,u]=(0,n.useState)(!0),[m,h]=(0,n.useState)(!1),g=(0,n.useCallback)(()=>{const e=l.current;return e?(e.textContent??"").replace(/\u00A0/g," ").trimEnd():""},[]);(0,n.useImperativeHandle)(r,()=>({getValue:()=>g(),setValue:e=>{const s=l.current;if(!s)return;s.textContent=e,u(!e);const t=document.createRange();t.selectNodeContents(s),t.collapse(!1);const n=window.getSelection();n?.removeAllRanges(),n?.addRange(t)},clear:()=>{const e=l.current;e&&(e.textContent="",u(!0))},focus:()=>l.current?.focus()})),(0,n.useEffect)(()=>{const e=l.current;if(!e)return;const s=()=>u(!e.textContent);return e.addEventListener("input",s),()=>e.removeEventListener("input",s)},[]);return(0,I.jsx)("div",{ref:l,contentEditable:!s,suppressContentEditableWarning:!0,className:"rich-textarea"+(t?" "+t:""),style:a,onKeyDown:e=>{m||"Enter"!==e.key||e.shiftKey||e.ctrlKey||e.metaKey||e.altKey||(e.preventDefault(),i?.())},onPaste:c,onInput:()=>o?.(g()),onCompositionStart:()=>h(!0),onCompositionEnd:()=>h(!1),"data-placeholder":d?e:void 0})});function J({pendingAttachments:e,onRemove:s}){return 0===e.length?null:(0,I.jsx)("div",{className:"chat-attachment-strip",children:e.map((e,t)=>(0,I.jsxs)("div",{className:"chat-attachment-chip",children:[(0,I.jsx)(A.In,{icon:"attach_file"}),(0,I.jsx)("span",{title:e.name,children:e.name}),(0,I.jsx)("button",{type:"button",onClick:()=>s(t),children:(0,I.jsx)(A.In,{icon:"close"})})]},`${e.name}_${t}`))})}const W=(0,n.forwardRef)(({onSend:e,sending:s,onAbort:t,pendingAttachments:c,onRemoveAttachment:o,onOpenFilePicker:r,onAddFiles:l,onDrop:d,onDragOver:u,fileInputRef:m},h)=>{const{t:g}=(0,i.B)(),p=(0,n.useRef)(null),[_,f]=(0,n.useState)(!1),j=(0,n.useRef)(null),[v,b]=(0,a.fp)(x.AG.ai_chat_input_height);(0,n.useImperativeHandle)(h,()=>({getValue:()=>p.current?.getValue()??"",setValue:e=>p.current?.setValue(e),clear:()=>p.current?.clear()}));const y=(0,n.useCallback)(e=>{const s=j.current;if(!s)return;const t=s.getBoundingClientRect().bottom-e.clientY;let n=Math.round(t/21.375);n=Math.max(2,Math.min(20,n)),b(n)},[b]),w=(0,n.useCallback)(()=>f(!0),[]),S=(0,n.useCallback)(()=>f(!1),[]);(0,n.useEffect)(()=>{if(!_)return;const e=y;return window.addEventListener("pointermove",e),window.addEventListener("pointerup",S),()=>{window.removeEventListener("pointermove",e),window.removeEventListener("pointerup",S)}},[_,y,S]);const N={minHeight:`${v}em`,maxHeight:`${v}em`};return(0,I.jsxs)("div",{ref:j,className:"chat-input-area",onDrop:d,onDragOver:u,children:[(0,I.jsx)("div",{className:"chat-input-resize-handle"+(_?" dragging":""),onPointerDown:w}),(0,I.jsx)("input",{ref:m,type:"file",multiple:!0,style:{display:"none"},onChange:e=>{e.target.files?.length&&(l(e.target.files),e.currentTarget.value="")}}),(0,I.jsxs)("div",{className:"chat-input-shell",style:N,children:[(0,I.jsx)(J,{pendingAttachments:c,onRemove:o}),(0,I.jsx)(G,{ref:p,placeholder:g("输入消息"),onEnter:()=>e(),onPaste:e=>{const s=e.clipboardData?.files;s&&s.length>0&&(e.preventDefault(),l(s))},className:"chat-input",style:N})]}),(0,I.jsx)(A.rA,{title:g("添加文件"),icon:"attach_file",onClick:r}),s?(0,I.jsx)(A.Vi,{color:"var( --icon-red)",text:g("暂停"),clickFun:t}):(0,I.jsx)(A.Vi,{text:g("发送"),clickFun:e}),_&&(0,I.jsx)("div",{className:"chat-input-overlay",onPointerUp:S})]})}),Q={},U=function(){const{t:e}=(0,i.B)(),[s,t]=(0,n.useState)([]),[c,r]=(0,n.useState)(!1),[l,d]=(0,n.useState)(null),[u,h]=(0,n.useState)(null),[g,p]=(0,n.useState)(!1),[_,f]=(0,a.fp)(x.AG.ai_bg_expanded),[,j]=(0,a.fp)(x.AG.ai_session_collapsed),v=()=>{f(!1)},b=(0,n.useCallback)(async()=>{r(!0);try{const e=new o.hf(o.HK.ai_bg_process_list_req);e.context={};const s=await C.ws.send(e);s?.context?.processes&&(t(s.context.processes),Q.onCountChange?.(s.context.processes.length))}catch(e){console.error("获取后台进程列表失败",e)}finally{r(!1)}},[]);Q.refresh=b;const y=(0,n.useCallback)(async e=>{p(!0),d(e);try{const s=new o.hf(o.HK.ai_bg_process_output_req);s.context={pid:e};const t=await C.ws.send(s);h(t.context)}catch(e){console.error("获取进程输出失败",e),(0,m.zN)("获取进程输出失败")}finally{p(!1)}},[]),w=(0,n.useCallback)(async e=>{try{const s=new o.hf(o.HK.ai_bg_process_kill_req);s.context={pid:e};const t=await C.ws.send(s);t?.context?.success?((0,m.SK)("进程已终止"),b(),l===e&&(d(null),h(null))):(0,m.zN)(t?.context?.message||"终止失败")}catch(e){console.error("终止进程失败",e),(0,m.zN)("终止进程失败")}},[b,l]);(0,n.useEffect)(()=>{b();const e=setInterval(b,5e3);return()=>clearInterval(e)},[b]);const S=s.filter(e=>e.running),N=s.filter(e=>!e.running);return(0,I.jsxs)(I.Fragment,{children:[_&&(0,I.jsx)("div",{className:"chat-session-overlay",onClick:v}),(0,I.jsxs)("aside",{className:"chat-bg-process-panel "+(_?"expanded":""),children:[(0,I.jsxs)("div",{className:"chat-bg-process-header",children:[(0,I.jsx)("span",{className:"chat-bg-process-title",children:e("后台进程")}),(0,I.jsx)(A.rA,{icon:"close",title:e("关闭"),onClick:v})]}),(0,I.jsxs)("div",{className:"chat-bg-process-toolbar",children:[(0,I.jsx)(A.rA,{icon:"refresh",title:e("刷新"),onClick:b}),(0,I.jsxs)("span",{className:"chat-bg-process-count",children:[S.length," ",e("个运行中"),N.length>0&&` / ${N.length} ${e("个已退出")}`]})]}),(0,I.jsxs)("div",{className:"chat-bg-process-list",children:[c&&0===s.length&&(0,I.jsx)("div",{className:"chat-bg-process-empty",children:e("加载中...")}),!c&&0===s.length&&(0,I.jsx)("div",{className:"chat-bg-process-empty",children:e("暂无后台进程")}),S.map(s=>(0,I.jsxs)("div",{className:`chat-bg-process-item ${l===s.pid?"active":""} running`,children:[(0,I.jsxs)("div",{className:"chat-bg-process-item-main",onClick:()=>y(s.pid),children:[(0,I.jsxs)("span",{className:"chat-bg-process-pid",children:["PID: ",s.pid]}),(0,I.jsx)("span",{className:"chat-bg-process-cmd",title:s.cmd,children:s.cmd.length>40?s.cmd.slice(0,40)+"...":s.cmd}),(0,I.jsx)("span",{className:"chat-bg-process-time",children:new Date(s.start_time).toLocaleTimeString()}),(0,I.jsx)("span",{className:"chat-bg-process-status running-dot",title:e("运行中"),children:"●"})]}),(0,I.jsxs)("div",{className:"chat-bg-process-item-actions",children:[(0,I.jsx)(A.rA,{icon:"terminal",title:e("查看输出"),onClick:()=>y(s.pid)}),(0,I.jsx)(A.rA,{icon:"stop",title:e("终止进程"),onClick:()=>w(s.pid)})]})]},s.pid)),N.map(e=>(0,I.jsx)("div",{className:`chat-bg-process-item ${l===e.pid?"active":""} finished`,children:(0,I.jsxs)("div",{className:"chat-bg-process-item-main",onClick:()=>y(e.pid),children:[(0,I.jsxs)("span",{className:"chat-bg-process-pid",children:["PID: ",e.pid]}),(0,I.jsx)("span",{className:"chat-bg-process-cmd",title:e.cmd,children:e.cmd.length>30?e.cmd.slice(0,30)+"...":e.cmd}),(0,I.jsx)("span",{className:"chat-bg-process-time",children:new Date(e.start_time).toLocaleTimeString()}),(0,I.jsxs)("span",{className:"chat-bg-process-exit-code",children:["exit: ",e.exit_code]})]})},e.pid))]}),null!==l&&(0,I.jsxs)("div",{className:"chat-bg-process-output",children:[(0,I.jsxs)("div",{className:"chat-bg-process-output-header",children:[(0,I.jsxs)("span",{children:["PID: ",l," ",e("输出")]}),(0,I.jsx)(A.rA,{icon:"close",title:e("关闭"),onClick:()=>{d(null),h(null)}})]}),(0,I.jsx)("div",{className:"chat-bg-process-output-content",children:g?(0,I.jsx)("div",{className:"chat-bg-process-empty",children:e("加载中...")}):u?(0,I.jsx)("pre",{className:"chat-bg-process-output-pre",children:u.output||e("(无输出)")}):null})]})]})]})};function X(){const{t:e}=(0,i.B)(),s=((0,c.Zp)(),(0,h.y)()),{check_user_auth:t}=(0,d.MH)();(0,p.w)();const[f,v]=(0,n.useState)([]),[y,w]=(0,n.useState)([]),[S,N]=(0,n.useState)(""),[A,$]=(0,n.useState)(null),[M,D]=(0,n.useState)(!1),R=(0,n.useRef)(null),[H,T]=(0,n.useState)([]),[V,K]=(0,a.fp)(x.AG.ai_session_collapsed),[P,B]=(0,a.fp)(x.AG.ai_bg_expanded),[L,q]=(0,a.fp)(x.AG.prompt_card),[G,J]=(0,n.useState)(!1),[X,Z]=(0,n.useState)(new Set),[Y,ee]=(0,n.useState)(new Set),[se,te]=(0,n.useState)(""),ne=(0,n.useRef)(null),ae=(0,n.useRef)(null),ie=(0,n.useRef)(null),ce=(0,n.useRef)(!0),oe=(0,n.useRef)(null),re=(0,n.useRef)(0),le=(0,n.useRef)(null),de=(0,n.useRef)(S),ue=(0,n.useRef)(A);(0,n.useEffect)(()=>{de.current=S},[S]),(0,n.useEffect)(()=>{ue.current=A},[A]);const me=(0,n.useRef)({}),[he,ge]=(0,n.useState)([]),[pe,xe]=(0,n.useState)(""),[_e,fe]=(0,n.useState)([]),je=async()=>{try{const e=await r.jV.get("public_models");e.code===g.m.Success&&fe(e.data?.groups??[])}catch{fe([])}},ve=e=>{xe(e?.ai_config?.model??"")},[be,ye]=(0,n.useState)(0),we=(0,n.useRef)((0,l.sg)(e=>{v(e),ce.current&&Se(!1)},50)).current,Se=(e=!1)=>{const s=ie.current;s&&s.scrollTo({top:s.scrollHeight,behavior:e?"smooth":"auto"})},Ne=async()=>{const e=await r.jV.get("sessions");e.code===g.m.Success&&w(e.data??[])},ke=function(e){const{getMessages:s,setMessages:t,setMessagesDebounced:a,setSending:i,getActiveSessionId:c,setActiveSessionId:r,refreshSessions:l,scrollToBottom:d,buildRequestMessages:u,getSelectedSysPromptId:m}=e,h=(0,n.useRef)([]),g=(0,n.useRef)(null),p=(e,n,r)=>{const h=[...s(),n];t(h),i(e),g.current={abort:()=>{}};const p={id:n.id+1,sender:"bot",text:"AI思考中...",is_loading:!0};h.push(p),t([...h]);const x=new Map;let _=!0,f=p;const j=s=>{const t=s.context||{},n=t.text||"",i=t.tool_call_ends,o=t.chunk_index??0;if("[DONE]"!==n)if(_)_=!1,f.text=n,i&&(f.content_list=[{tool_call_ends:i,content:f.text,role:"assistant"}]),f.is_loading=!1,f.chunk_index=o,x.set(o,f),c()===e&&a([...h]);else{const s=x.get(o);if(s)s.text+=n,i&&(s.content_list=[{tool_call_ends:i,content:s.text,role:"assistant"}]),c()===e&&a([...h]);else{const s={id:Date.now()+Math.random(),sender:"bot",text:n,chunk_index:o};i&&(s.content_list=[{tool_call_ends:i,content:s.text,role:"assistant"}]),h.push(s),x.set(o,s),c()===e&&a([...h])}}},v=s=>{y(),g.current=null,i(s=>s===e?null:s),f.is_loading=!1,l(),d(!0),r()},b=s=>{y(),g.current=null,i(s=>s===e?null:s);const n=s.context||{};f.text="AI请求出错: "+(n.message||"未知错误"),f.is_loading=!1,c()===e&&t([...h]),r()},y=()=>{C.ws.off_message(`message_${o.HK.ai_chat_msg}`,j),C.ws.off_message(`message_${o.HK.ai_chat_end}`,v),C.ws.off_message(`message_${o.HK.ai_chat_error}`,b)};C.ws.addMsg(o.HK.ai_chat_msg,j),C.ws.addMsg(o.HK.ai_chat_end,v),C.ws.addMsg(o.HK.ai_chat_error,b),C.ws.sendData(o.HK.ai_chat_req,{messages:u(n),session_id:e,sys_prompt_id:m()})},x=()=>{const e=h.current;if(0===e.length)return;const s=e.shift();if(!s)return;t(e=>e.map(e=>"user"===e.sender&&e.text.includes("⏳(排队中...)")?{...e,text:e.text.replace(" ⏳(排队中...)","")}:e));const n={id:Date.now(),sender:"user",text:s.text,attachments:s.attachments};p(c(),n,x)};return{startChatStream:p,processPendingQueue:x,enqueueMessage:(e,s)=>{h.current.push({text:e,attachments:s})},getQueueLength:()=>h.current.length,abort:()=>{const e=c();e&&(C.ws.sendData(o.HK.ai_chat_abort,{session_id:e}),g.current&&(g.current=null,i(s=>s===e?null:s)))}}}({getMessages:()=>f,setMessages:v,setMessagesDebounced:we,setSending:$,getActiveSessionId:()=>de.current,setActiveSessionId:N,refreshSessions:Ne,scrollToBottom:Se,buildRequestMessages:e=>{const s=(e.attachments??[]).filter(e=>"image"===e.kind);if(s.length>0){const t=[];e.text&&t.push({type:"text",text:e.text});for(const e of s)t.push({type:"image_url",image_url:{url:e.content}});return[{content:t,role:"user",attachments:e.attachments??[]}]}return[{content:e.text,role:"bot"===e.sender?"assistant":"user",attachments:e.attachments??[]}]},getSelectedSysPromptId:()=>se}),Ce=async e=>{const s=await r.jV.get("sessions");if(s.code!==g.m.Success)return;const t=s.data??[];w(t);const n=null===e?t[0]?.id??"":e||S||t[0]?.id||"";n?await Ae(n):(v([]),N(""))},Ae=async(e,s=!1)=>{const t=await r.jV.post("session/get",{session_id:e});if(t.code!==g.m.Success||!t.data)return;const n=t.data;N(n.id),D(!!n.running),le.current&&le.current!==n.id&&C.ws.sendData(o.HK.ai_chat_subscribe,{session_id:le.current,subscribe:!1}),le.current=n.running?n.id:null,le.current&&C.ws.sendData(o.HK.ai_chat_subscribe,{session_id:le.current,subscribe:!0});const a=b(n.messages);n.running&&n.live_messages?.length?v([...a,...b(n.live_messages)]):v(a),te(n.sys_prompt_id??""),s&&K(!1),Q.refresh?.(),requestAnimationFrame(()=>Se(!1))},$e=e=>{const s=Array.from(e??[]).filter(Boolean);s.length&&T(e=>[...e,...s])},Ie=()=>{G&&(Z(new Set),ee(new Set)),J(e=>!e)};(0,n.useEffect)(()=>((async()=>{const e=await r.XO.get("ai_agent_setting/env");e.code===g.m.Success&&(me.current=e.data,ve(e.data)),await je(),await Ce();const s=await r.jV.get("system_prompts");s.code===g.m.Success&&ge(s.data??[])})(),requestAnimationFrame(()=>Se(!1)),Q.onCountChange=ye,Q.refresh?.(),C.ws.addMsg(o.HK.ai_bg_process_count_notify,e=>{const s=e?.context?.count;"number"==typeof s&&ye(s)}),()=>{C.ws.removeMsg(o.HK.ai_bg_process_count_notify)}),[]),(0,n.useEffect)(()=>{const e=ie.current;if(!e)return;const s=()=>{ce.current=((e,s=120)=>{const{scrollTop:t,scrollHeight:n,clientHeight:a}=e;return n-(t+a)<s})(e)};return e.addEventListener("scroll",s),()=>e.removeEventListener("scroll",s)},[]),(0,n.useEffect)(()=>{const e=()=>de.current,s=()=>ue.current,t=(t,n)=>{if(e()&&e()===t){if(oe.current=null,D(!1),le.current===t&&(C.ws.sendData(o.HK.ai_chat_subscribe,{session_id:t,subscribe:!1}),le.current=null),s()===t)return;n?.length?v(e=>{const s=b(n),t=e[e.length-1];return"bot"===t?.sender?[...e.slice(0,-1),...s]:[...e,...s]}):Ae(t).catch(()=>{}),Ne()}},n=t=>{const n=t?.context||{};if(!n.session_id)return;var a,i,c;a=n.session_id,i=n.text||"",c=n.tool_call_ends,e()&&e()===a&&s()!==a&&v(e=>{const s=e[e.length-1];if(s&&"bot"===s.sender){const t=[...e],n={...s};return n.text+=i,c&&(n.content_list=[{tool_call_ends:c,content:n.text,role:"assistant"}]),t[t.length-1]=n,oe.current=n.id,ce.current&&requestAnimationFrame(()=>Se(!1)),t}const t={id:Date.now()+Math.random(),sender:"bot",text:i};return c&&(t.content_list=[{tool_call_ends:c,content:i,role:"assistant"}]),oe.current=t.id,ce.current&&requestAnimationFrame(()=>Se(!1)),[...e,t]});const o=Date.now();o-re.current>1500&&(re.current=o,Ne())},a=e=>{const s=e?.context||{};s.session_id&&t(s.session_id,s.once_messages_list)},i=e=>{const s=e?.context||{};s.session_id&&t(s.session_id)};return C.ws.addMsg(o.HK.ai_chat_msg,n),C.ws.addMsg(o.HK.ai_chat_end,a),C.ws.addMsg(o.HK.ai_chat_error,i),()=>{C.ws.off_message(`message_${o.HK.ai_chat_msg}`,n),C.ws.off_message(`message_${o.HK.ai_chat_end}`,a),C.ws.off_message(`message_${o.HK.ai_chat_error}`,i),le.current&&(C.ws.sendData(o.HK.ai_chat_subscribe,{session_id:le.current,subscribe:!1}),le.current=null)}},[]),(0,n.useLayoutEffect)(()=>{ce.current&&Se(!1)},[f]);return(0,I.jsxs)(n.Fragment,{children:[(0,I.jsx)(F,{currentModelName:pe,setCurrentModelName:xe,modelGroups:_e,onModelChanged:async()=>{await je();const e=await r.XO.get("ai_agent_setting/env");e.code===g.m.Success&&(me.current=e.data,ve(e.data))},sysPromptList:he,batchMode:G,selectedMsgCount:X.size,onToggleSessionPanel:()=>{K(e=>!e)},onCreateSession:async e=>{const s=void 0!==e?e:se,t=await r.jV.post("session",{title:"新会话",sys_prompt_id:s||void 0});if(t.code!==g.m.Success)return;const n=t.data;N(n.id),v([]),te(n.sys_prompt_id??""),K(!1),await Ce(n.id),requestAnimationFrame(()=>{const e=document.querySelector(".chat-input");e&&(e.style.height="auto",e.style.height=Math.min(e.scrollHeight,200)+"px")})},onBatchDeleteMessages:()=>{0!==X.size&&s({sub_title:e("确认删除选中的聊天消息吗?"),confirm_fun:async()=>{const e=[];f.forEach((s,t)=>{X.has(s.id)&&e.push(t)}),v(f.filter(e=>!X.has(e.id))),Z(new Set),J(!1),S&&e.length>0&&r.jV.post("session/message/delete",{session_id:S,indices:e}).catch(console.error)}})},bgProcessVisible:P,bgProcessCount:be,onToggleBgProcess:()=>B(e=>!e),selectedSysPromptId:se,setSelectedSysPromptId:e=>{te(e),S&&r.jV.post("session/sys_prompt",{session_id:S,sys_prompt_id:e||void 0}).catch(console.error)}}),(0,I.jsxs)("div",{className:"chat-page chat-page-with-sessions",children:[V&&(0,I.jsx)("div",{className:"chat-session-overlay",onClick:()=>K(!1)}),(0,I.jsx)(O,{sessions:y,activeSessionId:S,onSelectSession:e=>Ae(e,!1),onRenameSession:(e,t)=>{let n=t;s({confirm_fun:async()=>{await r.jV.post("sessions/update/meta",{id:e,title:n}),await Ce(S)},context_div:(0,I.jsx)("div",{className:"card-content",children:(0,I.jsx)(_.Sm,{value:n,handleInputChange:e=>{n=e}})})})},onDeleteSession:e=>{s({sub_title:"确认删除这个会话吗?",confirm_fun:async()=>{await r.jV.post("session/delete",{session_id:e}),S===e?(N(""),await Ce(null)):await Ce(S)}})},onToggleCmdAuto:async(s,t)=>{await r.jV.post("session/cmd_auto_allow",{session_id:s,allow:t}),(0,m.SK)(e(t?"命令检测已开启":"命令检测已关闭")),await Ce(S)},onShowUsageStats:async s=>{q({open:!0,title:e("Token消耗统计"),context_div:(0,I.jsx)("div",{className:"usage-stats-loading",children:e("加载中...")}),cancel:()=>q({open:!1})});try{const t=await r.jV.post("session/usage_stats",{session_id:s});if(t.code===g.m.Success&&t.data){const s=t.data;q({open:!0,title:e("Token消耗统计"),context_div:(0,I.jsxs)("div",{className:"usage-stats-panel",children:[[{l:e("对话轮次"),v:(s.turns??0).toString()},{l:e("AI输入Token"),v:j(s.input_tokens)},{l:e("AI输出Token"),v:j(s.output_tokens)},{l:e("AI输入Token(最近一轮)"),v:j(s.recent_input_tokens)},{l:e("AI输出Token(最近一轮)"),v:j(s.recent_output_tokens)}].map((e,s)=>(0,I.jsxs)("div",{className:"usage-stats-row",children:[(0,I.jsx)("span",{className:"usage-stats-label",children:e.l}),(0,I.jsx)("span",{className:"usage-stats-value",children:e.v})]},s)),(0,I.jsxs)("div",{className:"usage-stats-row usage-stats-total",children:[(0,I.jsx)("span",{className:"usage-stats-label",children:e("AI Token总计消耗")}),(0,I.jsx)("span",{className:"usage-stats-value",children:j((s.input_tokens||0)+(s.output_tokens||0))})]})]}),cancel:()=>q({open:!1})})}else q({open:!0,title:e("Token消耗统计"),context_div:(0,I.jsx)("div",{className:"usage-stats-empty",children:e("暂无统计数据")}),cancel:()=>q({open:!1})})}catch{q({open:!0,title:e("Token消耗统计"),context_div:(0,I.jsx)("div",{className:"usage-stats-empty",children:e("暂无统计数据")}),cancel:()=>q({open:!1})})}},batchMode:G,selectedSessionIds:Y,onToggleSessionSelect:e=>{ee(s=>{const t=new Set(s);return t.has(e)?t.delete(e):t.add(e),t})},onToggleBatchMode:Ie,onBatchDeleteSessions:()=>{0!==Y.size&&s({sub_title:e("确认删除选中的会话吗?"),confirm_fun:async()=>{for(const e of Y)await r.jV.post("session/delete",{session_id:e});ee(new Set),J(!1),Y.has(S)?(N(""),await Ce(null)):await Ce(S)}})},onClearAllSessions:()=>{s({sub_title:e("确认删除全部聊天会话吗?"),confirm_fun:async()=>{await r.jV.post("sessions/clear",{}),N(""),v([]),await Ce(null)}})}}),(0,I.jsx)(U,{}),(0,I.jsxs)("section",{className:"chat-main",children:[0===f?.length&&(0,I.jsx)("div",{className:"chat-header",children:(0,I.jsx)("div",{children:e("询问服务器的一切")})}),(0,I.jsx)(z,{messages:f,batchMode:G,selectedMsgIds:X,sending:A===S||M,chatContainerRef:ie,messagesEndRef:ae,onToggleMsgSelect:e=>{Z(s=>{const t=new Set(s);return t.has(e)?t.delete(e):t.add(e),t})},onDelete:t=>{s({sub_title:e("确认删除这条消息吗?"),confirm_fun:async()=>{const e=f.findIndex(e=>e.id===t);if(e<0)return;const s=f.filter(e=>e.id!==t);v(s),S&&r.jV.post("session/message/delete",{session_id:S,indices:[e]}).catch(console.error)}})},onCopy:async e=>{(0,u.lW)(e),(0,m.SK)("复制成功")},onToggleBatchMode:Ie,t:e}),(0,I.jsx)(W,{ref:R,onSend:async()=>{const e=(R.current?.getValue()??"").trim();if(!e&&0===H.length)return;if(A===S){const s=await k(H);ke.enqueueMessage(e,s),R.current?.clear(),T([]);const t={id:Date.now(),sender:"user",text:e+(ke.getQueueLength()>1?" ⏳(排队中...)":""),attachments:s};return void v(e=>[...e,t])}let s=S;if(!s){const t=await r.jV.post("session",{title:(e||H[0]?.name||"新会话").slice(0,28),sys_prompt_id:se||void 0});if(t.code!==g.m.Success)return;s=t.data.id,N(s),await Ce(s)}const t=await k(H),n={id:Date.now(),sender:"user",text:e,attachments:t};R.current?.clear(),T([]);const a=me?.current?.ai_config?.request_type||"completions";if("completions"!==a){const t={id:n.id+1,sender:"bot",text:"处理中...",is_loading:!0},i=[...f,n,t];v(i),$(s);return void(await E(a,e,s,async(e,s)=>{t.text=e,t.is_loading=!1,s?.images&&(t.images=s.images),s?.audio&&(t.audio=s.audio),s?.embeddings&&(t.embeddings=s.embeddings),v([...i]),$(null),Ne(),Se(!0),ke.processPendingQueue()})||(t.text=`请求类型 "${a}" 的专用处理器尚未实现,请使用 completions 类型。`,t.is_loading=!1,v([...i]),$(null),ke.processPendingQueue()))}ke.startChatStream(s,n,()=>ke.processPendingQueue())},sending:A===S||M,onAbort:ke.abort,pendingAttachments:H,onRemoveAttachment:e=>{T(s=>s.filter((s,t)=>t!==e))},onOpenFilePicker:()=>{ne.current?.click()},onAddFiles:$e,onDrop:e=>{const s=e.dataTransfer?.files;s&&s.length>0&&(e.preventDefault(),$e(s))},onDragOver:e=>{e.dataTransfer?.types?.includes("Files")&&e.preventDefault()},fileInputRef:ne})]})]})]})}},72693(e,s,t){t.d(s,{w:()=>h});var n=t(96540),a=t(86149),i=t(14944),c=t(92275),o=t(34843),r=t(82893),l=t(85997),d=t(14284),u=t(74848);function m(e){const{t:s}=(0,a.B)(),[t,i]=(0,n.useState)(!1),c=!!e.sessionId;return(0,u.jsxs)("div",{children:[(0,u.jsx)("div",{style:{maxHeight:"60vh",overflow:"auto",whiteSpace:"pre-wrap",wordBreak:"break-all",background:"var(--surfaceSecondary)",padding:"0.75em",borderRadius:"0.5em",marginBottom:"0.75em",fontFamily:"monospace",fontSize:"0.9em",lineHeight:"1.5"},children:e.cmd}),c&&(0,u.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"0.5em",marginBottom:"0.75em",color:t?"var(--icon-blue)":"var(--textSecondary)"},children:[(0,u.jsx)(l.Ay,{checked:t,onChange:s=>{i(s),s&&e.onAutoAllow()},title:s("此会话不再询问")}),(0,u.jsx)("span",{children:s("此会话不再询问")})]}),(0,u.jsxs)("div",{style:{display:"flex",gap:"0.5em",justifyContent:"flex-end"},children:[(0,u.jsx)(l.$n,{text:s("拒绝"),color:"var(--red)",clickFun:e.onDeny}),(0,u.jsx)(l.$n,{text:s("允许"),clickFun:e.onAllow})]})]})}function h(){const[e,s]=(0,o.fp)(r.AG.prompt_card),{t}=(0,a.B)(),l=(0,n.useRef)([]),h=(0,n.useRef)(!1),g=(0,n.useRef)(null),p=(0,n.useRef)(void 0),x=(0,n.useRef)(()=>{}),_=(0,n.useCallback)(e=>{s({open:!1}),h.current=!1,g.current&&(i.ws.sendData(c.HK.ai_confirm_cmd,{askId:g.current,approved:e}),g.current=null),x.current()},[s]),f=(0,n.useCallback)(()=>{if(h.current)return;if(0===l.current.length)return h.current=!1,void s({open:!1});h.current=!0;const e=l.current.shift();e?(g.current=e.askId,p.current=e.session_id,s({open:!0,title:t("命令确认"),cancel:()=>_(!1),context_div:(0,u.jsx)(m,{cmd:e.cmd,sessionId:e.session_id,onDeny:()=>_(!1),onAllow:()=>_(!0),onAutoAllow:async()=>{if(p.current)try{await d.jV.post("session/cmd_auto_allow",{session_id:p.current,allow:!0})}catch(e){console.error("设置会话命令免确认失败",e)}_(!0)}})})):h.current=!1},[t,_,s]);x.current=f;const j=(0,n.useCallback)(e=>{l.current.push(e),f()},[f]);(0,n.useEffect)(()=>(i.ws.addMsg(c.HK.ai_confirm_cmd,e=>{const t=e.context||{};if(t.dismiss&&t.askId)return l.current=l.current.filter(e=>e.askId!==t.askId),void(h.current&&g.current===t.askId&&(g.current=null,h.current=!1,s({open:!1}),f()));t.askId&&t.cmd&&j({askId:t.askId,cmd:t.cmd,session_id:t.session_id})}),()=>{i.ws.removeMsg(c.HK.ai_confirm_cmd)}),[j]),(0,n.useEffect)(()=>()=>{l.current=[],h.current=!1,g.current=null},[])}},34299(e,s,t){t.r(s),t.d(s,{default:()=>p});t(96540);var n=t(22091),a=t(53995),i=t(18569),c=t(77979),o=t(8263),r=t(69428),l=t.n(r),d=(t(3775),t(21499)),u=t(99214),m=t(19878),h=(t(72411),t(74848));const g=new n.A({html:!0,highlight:function(e,s){if(s&&m.A.getLanguage(s))try{return`<pre class="hljs code-block-with-copy"><code class="hljs language-${s}">${m.A.highlight(e,{language:s}).value}</code></pre>`}catch(e){}try{return`<pre class="hljs code-block-with-copy"><code class="hljs">${m.A.highlightAuto(e).value}</code></pre>`}catch(e){}return`<pre class="hljs code-block-with-copy"><code>${g.utils.escapeHtml(e)}</code></pre>`}});function p(e){return(0,u.VD)(),(0,h.jsx)("div",{dangerouslySetInnerHTML:{__html:g.render(e.context)}})}g.use(a.A).use(i.A).use(c.A).use(o.A).use(l()).use(e=>{e.renderer.rules.fence;e.renderer.rules.fence=(s,t,n,a,i)=>{const c=s[t],o=c.content.trim(),r=c.info.trim();let l="";if(r&&m.A.getLanguage(r))try{l=m.A.highlight(o,{language:r}).value}catch(s){l=e.utils.escapeHtml(o)}else try{l=m.A.highlightAuto(o).value}catch(s){l=e.utils.escapeHtml(o)}return`\n <div class="code-block-with-copy">\n <div class="code-header">\n <span class="code-language">${r||"code"}</span>\n <button class="copy-btn" data-code="${e.utils.escapeHtml(o)}">复制</button>\n </div>\n <pre><code class="hljs ${r?`language-${r}`:""}">${l}</code></pre>\n </div>`}}).use(e=>{const s=e.renderer.rules.link_open||function(e,s,t,n,a){return a.renderToken(e,s,t)};e.renderer.rules.link_open=(e,t,n,a,i)=>{const c=e[t],o=c.attrIndex("href");if(o>=0){const e=c.attrs[o][1];c.attrs[o][1]=(0,d.bi)(window.location.href,e)}return s(e,t,n,a,i)}})},45907(e,s,t){t.d(s,{y:()=>i});var n=t(34843),a=t(82893);function i(){const[e,s]=(0,n.fp)(a.AG.confirm);return({sub_title:e,confirm_fun:t,title:n,context_div:a})=>{s({open:!0,sub_title:e,handle:()=>{t(),s({open:!1,handle:null})},title:n,context_div:a})}}},60840(e){e.exports="data:image/svg+xml,<svg xmlns=%27http://www.w3.org/2000/svg%27 viewBox=%270 0 16 16%27 version=%271.1%27 aria-hidden=%27true%27><path fill-rule=%27evenodd%27 d=%27M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z%27></path></svg>"}}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[2542],{72542(e,t,n){n.r(t);var s=n(1728),c=n(96540),a=n(34843),l=n(61443),i=n(85997),o=n(86090),u=n(14284),d=(n(23430),n(82893)),r=n(75725),f=n(86149),h=n(7523),p=n(62042),_=n(21469),m=n(74848);_.m.init();const x=function(){const e=(0,o.Zp)(),[t,n]=(0,c.useState)(""),[x,w]=(0,c.useState)(""),{initUserInfo:k}=(0,c.useContext)(h.F),[g,j]=(0,a.fp)(d.AG.custom_fun_opt),{t:C}=(0,f.B)();async function I(){const n={username:t,password:x},s=await u.wm.post("login",n,!1);0===s.code?(localStorage.setItem("token",s.data),k(),j(""),e("/file")):(0,p.zN)(s.message)}return(0,c.useEffect)(()=>{localStorage.getItem("token")&&e("/file")},[]),(0,m.jsxs)(r.Y5,{children:[(0,m.jsx)("h1",{children:_.m.web_site_title??"FileCat"}),(0,m.jsxs)("div",{className:"self_win_center_content",children:[(0,m.jsx)(l.Sm,{placeholder:C("账号"),handleInputChange:e=>{n(e)}}),(0,m.jsx)(l.cA,{placeholder:C("密码"),handleInputChange:e=>{w(e)},handleEnterPress:I}),(0,m.jsx)(i.$n,{text:C("登录"),clickFun:I}),s.A.has("tcp_client_num_id")&&(0,m.jsx)(i.$n,{text:C("代理退出"),clickFun:()=>{s.A.delete("tcp_client_num_id"),window.location.reload()}})]})]})};n.d(t,["default",0,x])}}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[2674],{92674(e,t,a){a.r(t),a.d(t,{default:()=>j});var n=a(96540),i=a(82893),o=a(34843),s=a(85997),l=a(57952),r=a(47022),c=a(34251),d=a(74848);function p(e){{const[t,a]=(0,n.useState)(!1),[i,o]=(0,n.useState)([]),l=e=>{o(e)},h=async()=>{"folder"===e.type?(t||!e.click||i||await e.click(e,l,e.pre_path),a(!t)):e.click&&await e.click(e,l,e.pre_path)},m=async(t=!1)=>{"folder"!==e.type||t?e.fatherNowToggleExpansion&&e.fatherNowToggleExpansion():await e.click(e,l,e.pre_path)};return(0,n.useEffect)(()=>{o(e.children)},[e.children]),(0,d.jsxs)("div",{className:"studio-item",children:[(0,d.jsxs)("div",{onClick:h,onContextMenu:t=>{t.stopPropagation(),t.nativeEvent.stopImmediatePropagation(),e.handleContextMenu&&e.handleContextMenu(t,e.name,e.pre_path,e.type===r.Iw.folder,m)},className:"studio-item-title",children:[(0,d.jsx)("i",{className:"material-icons studio-item-title-tag","data-icon":t?"arrow_drop_down":"arrow_right",children:"file"==e.type?"":t?"arrow_drop_down":"arrow_right"}),(0,d.jsx)("span",{className:"file-icons",children:(0,d.jsx)("span",{"data-type":(0,c.uL)(e.name),"data-dir":"folder"===e.type,"aria-label":e.name,children:(0,d.jsx)(s.In,{icon:"",aria_label:e.name})})}),(0,d.jsx)("span",{className:"studio-item-name",children:e.name})]}),t&&i&&(0,d.jsx)("div",{style:{marginLeft:20},children:i.map((t,a)=>(0,d.jsx)(n.Fragment,{children:(0,d.jsx)(p,{type:t.type,size:t.size,click:e.click,name:t.name,children:t.children,pre_path:`${e.pre_path}${t.name}${t.type===r.Iw.folder?"/":""}`,handleContextMenu:e.handleContextMenu,fatherNowToggleExpansion:m},a)},a))})]})}}a(61443);function h(e){return(0,d.jsx)("div",{children:e.list.map((t,a)=>(0,d.jsx)(p,{pre_path:`${e.pre_path}${t.name}${t.type===r.Iw.folder?"/":""}`,name:t.name,type:t.type,handleContextMenu:e.handleContextMenu,fatherNowToggleExpansion:e.fatherNowToggleExpansion,children:t.children,click:e.click,size:t.size},a))})}var m=a(14284),u=a(34289),f=a(53459),x=a(78247),w=(a(62042),a(2543)),y=a(18538),v=a(86149),_=a(88815),k=a(86090);const g=n.lazy(()=>Promise.all([a.e(5880),a.e(4091)]).then(()=>a(84091)));function j(e){const[t,a]=(0,n.useState)([]),[p,j]=(0,n.useState)(""),[C,E]=(0,n.useState)(""),[N,S]=(0,n.useState)(!1),[M,P]=(0,n.useState)({path:"",name:""}),[$,b]=(0,n.useState)(""),[G,I]=(0,o.fp)(i.AG.confirm),[z,A]=(0,n.useState)(!1),[F,D]=(0,o.fp)(i.AG.fileShellShow),[L,R]=(0,o.fp)(i.AG.file_shell_hidden),T=(0,n.useRef)(null),K=(0,n.useRef)(null),[U,B]=(0,n.useState)(!1),[W,X]=(0,n.useState)(16),[Y,H]=(0,o.fp)(i.AG.showPrompt),{t:Z}=(0,v.B)(),q=(0,k.Zp)();let J=(0,k.zy)().pathname.split("/").filter(Boolean).pop();J=decodeURIComponent(J);const O=async()=>{const e=(0,u.GG)("file",J);j(e),P({path:e,name:(0,u.mH)(e)});const t=await m.$M.post("studio/get/item",{path:e});if(t.code===f.m.Success){const e=[],n=[];for(const a of t.data.list)"folder"===a.type?e.push(a):"file"===a.type&&n.push(a);a([...e,...n])}};(0,n.useEffect)(()=>{E(""),A(!1),O()},[]);const Q=async(e,t)=>{const a=await m.$M.get(`${encodeURIComponent(t)}`);E(a.data),x.xK.set_value_temp(a.data),P({path:t,name:e}),b(t)},V=(e,t)=>{e.size>_.o5?I({open:!0,handle:()=>{Q(e.name,t),I({open:!1,handle:null}),A(!1)},title:"超过20MB了还要打开吗?"}):Q(e.name,t)};async function ee(){if(!z)return;const e={context:x.xK.get_editor_value()};0===(await m.$M.post(`save/${encodeURIComponent($)}`,e)).code&&A(!1)}const te=e=>{e.ctrlKey&&"s"===e.key&&(e.preventDefault(),z&&ee())};(0,n.useEffect)(()=>(document.addEventListener("keydown",te),()=>{document.removeEventListener("keydown",te)}),[z]);const ae=(0,n.useCallback)(w.throttle(e=>{const t=parseFloat(getComputedStyle(K.current).fontSize),a=window.innerWidth/t-4,n=e.clientX/t,i=2.25+T.current.offsetWidth/t;n<=a&&n>=i&&X(parseFloat(n.toFixed(2)))},32),[]),ne=()=>{B(!1),K.current.removeEventListener("pointermove",ae)},ie=[{r:Z("创建文件"),v:"创建文件"},{r:Z("创建目录"),v:"创建目录"},{r:Z("重命名"),v:"重命名"},{r:Z("删除"),v:"删除"}],oe=[{r:Z("重命名"),v:"重命名"},{r:Z("删除"),v:"删除"}],se=(e,t,a,n,i)=>{e.preventDefault();const o=new c.ik;o.path=a,o.filename=t,o.x=e.clientX,o.y=e.clientY,o.items=n?ie:oe,i===O&&(o.items=o.items.slice(0,2)),o.type=n?r.Iw.studio_folder:r.Iw.studio_file;const s=e=>{i(e)};o.textClick=e=>{switch(e){case"创建文件":H({show:!0,type:y.PromptEnum.FileNew,overlay:!0,data:{dir:a,call:s}});break;case"创建目录":H({show:!0,type:y.PromptEnum.DirNew,overlay:!0,data:{dir:a,call:s}});break;case"删除":if(z&&(M.path===a||M.path.includes(a))){const e=()=>{s(n),A(!1),P({}),E(""),x.xK.set_value_temp("")};H({show:!0,type:y.PromptEnum.FilesDelete,overlay:!0,data:{path:a,call:e,filename:t}});break}H({show:!0,type:y.PromptEnum.FilesDelete,overlay:!0,data:{path:a,filename:t,call:n?()=>{s(!0)}:s}});break;case"重命名":H({show:!0,type:y.PromptEnum.FileRename,overlay:!0,data:{path:a,dir:(0,u.Yp)(a),call:()=>{s(!0)},filename:t}})}},H({show:!0,type:y.PromptEnum.FileMenu,overlay:!1,data:o})};return(0,d.jsxs)("div",{className:"studio",children:[(0,d.jsxs)(l.A,{ignore_tags:!0,left_children:[(0,d.jsx)(s.rA,{title:"取消",icon:"close",onClick:()=>{D({show:!1,path:""}),R(void 0),q(-1)}},1),(0,d.jsx)("div",{children:M.name},2)],children:[(0,d.jsx)("title",{children:M.name}),(0,c.zr)(M.name)&&(0,d.jsx)(s.rA,{title:"格式化",icon:"data_object",onClick:function(){x.xK.get_editor()?.formatCode()}}),(0,d.jsx)(s.rA,{icon:"terminal",title:"shell",onClick:function(){!0!==L&&!1!==L?F.show?D({show:!1,path:""}):(D({show:!0,path:(0,u.GG)("file",J)}),R(!1)):R(!L)}}),z&&(0,d.jsx)(s.rA,{title:"保存",icon:"save",onClick:ee})]}),(0,d.jsxs)("div",{className:"studio-body",ref:K,children:[(0,d.jsx)("div",{className:"studio-nav",style:{width:W-1+"em"},onContextMenu:e=>{se(e,M.name,(0,u.GG)("file",J),!0,O)},children:(0,d.jsx)(h,{pre_path:p,list:t,click:async(e,t,a)=>{if("folder"===e.type){const e=await m.$M.post("studio/get/item",{path:`${a}`});if(e.code===f.m.Success){const a=[],n=[];for(const t of e.data.list)"folder"===t.type?a.push(t):"file"===t.type&&n.push(t);t([...a,...n])}}else{if(z)return void I({open:!0,handle:()=>{I({open:!1,handle:null}),A(!1),V(e,a)},title:"确定不保存就切换吗?"});V(e,a)}},handleContextMenu:se,fatherNowToggleExpansion:O})}),(0,d.jsx)("div",{className:"studio__divider",ref:T,onPointerDown:()=>{B(!0),K.current.addEventListener("pointermove",ae)},onPointerUp:ne}),U&&(0,d.jsx)("div",{className:"shell__overlay",onPointerUp:ne}),(0,d.jsx)("div",{className:"studio-editor",children:M.name&&(0,d.jsx)(g,{name:M.name,on_change:()=>{z||A(!0)}})},M.path)]})]})}}}]);
@@ -1 +1 @@
1
- "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[2851],{8694(e,t,s){s.d(t,{$K:()=>a,RB:()=>l,l5:()=>i,qB:()=>n,vo:()=>c,vr:()=>r});class n{targetProxyUrl;proxyPort;sysProxyPort}let o=function(e){return e[e.tcp=0]="tcp",e[e.udp=1]="udp",e}({});class a{open=!1;port;key="";async_ips=[]}class c{client_num_id;client_name;open=!1;ip;mask;serverIp;serverPort;key="";model=o.udp}let l=function(e){return e[e.row=1]="row",e[e.json=2]="json",e[e.form=3]="form",e}({});class r{body_type;header_type;url;method;headers;data;form_data_list;local_download_path}class i{enabled;ip;port;bypass;useForLocal;type}},77481(e,t,s){s.d(t,{S:()=>c,X:()=>a});var n=s(96540),o=s(74848);function a(e){const[t,s]=n.useState([]);return(0,n.useEffect)(()=>{e.children?s(Array.isArray(e.children)?e.children:[e.children]):s(e.rows)},[e.rows,e.children]),(0,o.jsxs)("table",{children:[(0,o.jsx)("thead",{children:(0,o.jsx)("tr",{children:e.headers?.map((e,t)=>(0,o.jsx)("th",{children:e},t))})}),(0,o.jsx)("tbody",{children:t.map((t,s)=>(0,o.jsx)("tr",{onContextMenu:()=>{e.handleContextMenu&&e.handleContextMenu(t)},children:t.map((s,n)=>(0,o.jsx)("td",{style:{width:e.width??"auto"},className:n===t.length-1?"small":"",children:s},n))},s))})]})}function c(e){return(0,o.jsx)("div",{style:{display:e.isFlex?"flex":"block"},children:e.columns.map((e,t)=>(0,o.jsx)("div",{children:e},t))})}},42851(e,t,s){s.r(t),s.d(t,{default:()=>F});var n=s(96540),o=s(75725),a=s(14284),c=s(62042),l=s(53459),r=s(70447),i=s(61443),d=s(85997),p=s(77481),h=s(8694),x=s(14944),u=s(92275),j=s(86149),m=s(57952),v=s(74848);function y(e){const{t}=(0,j.B)(),[s,y]=(0,n.useState)(void 0),[g,_]=(0,n.useState)(!1),[S,f]=(0,n.useState)(""),[w,C]=(0,n.useState)([t(`${t("名称")}`),t(`${t("虚拟")}ip`),`${t("物理")}`,t("在线状态"),t("选择")]),[k,I]=(0,n.useState)([]),[b,A]=(0,n.useState)({}),[P,U]=(0,n.useState)(!1);(0,n.useEffect)(()=>{(async()=>{const e=new u.hf(u.HK.vir_net_serverIno_get);x.ws.addMsg(u.HK.vir_net_serverIno_get,e=>{(e=>{for(const s of e){const e=s[s.length-1];s[s.length-1]=(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(r.fq,{ok:e}),t(e?"在线":"离线")]}),s[0]=(0,v.jsx)(r.xP,{context:s[0],tip_context:s[0]}),s[2]=(0,v.jsx)(r.xP,{context:s[2],tip_context:s[2]})}})(e.context),I(e.context)}),await x.ws.send(e)})();return(async()=>{const e=await a._U.get("vir/server/get");if(e.code!==l.m.Success)return;const t=e.data;y(t.port),f(t.key),_(t.open)})(),()=>{}},[]);return(0,v.jsxs)("div",{children:[(0,v.jsxs)(m.A,{children:[!!Object.keys(b).length&&b[0],!!Object.keys(b).length&&(0,v.jsx)(d.rA,{icon:"delete",title:"删除",onClick:async()=>{await a._U.post("vir/server/delete/client",{ips:Object.keys(b)}),A({})}})]}),(0,v.jsx)(o.fI,{children:(0,v.jsxs)(o.VP,{children:[(0,v.jsxs)(r.Zp,{title:"",rightBottomCom:(0,v.jsx)(d.C3,{text:t("保存"),clickFun:async()=>{const e=new h.$K;e.open=g,e.key=S,P&&(e.async_ips=Object.keys(b)),s&&(e.port=parseInt(s));(await a._U.post("vir/server/save",e)).code===l.m.Success?((0,c.SK)("保存成功"),U(!1)):(0,c.zN)("网络错误")}}),children:[(0,v.jsx)(i.Sm,{placeholder:"port",value:s,handleInputChange:e=>{y(e)}}),(0,v.jsx)(i.Sm,{type:"password",placeholder:"key ",value:S,handleInputChange:e=>{f(e)}}),(0,v.jsxs)("form",{children:[t("状态"),":",(0,v.jsx)(p.S,{isFlex:!0,columns:[(0,v.jsx)(i.U6,{value:1,context:t("开启"),selected:g,onchange:()=>{_(!g)}}),(0,v.jsx)(i.U6,{value:1,context:t("关闭"),selected:!g,onchange:()=>{_(!g)}})]})]}),!!Object.keys(b).length&&(0,v.jsx)(i.GL,{context:t("同步信息给选中服务器"),selected:P,onchange:()=>{U(!P)}})]}),(0,v.jsx)(r.Zp,{title:"",children:(0,v.jsx)(p.X,{headers:w,rows:k.map(e=>[...e,(0,v.jsx)(i.GL,{context:t(""),selected:b[e[1]],onchange:()=>{const t={...b};t[e[1]]?delete t[e[1]]:t[e[1]]=e,A(t)}})]),width:"10rem"})})]})})]})}function g(e){const{t}=(0,j.B)(),[s,m]=(0,n.useState)(""),[y,g]=(0,n.useState)(void 0),[_,S]=(0,n.useState)(""),[f,w]=(0,n.useState)(""),[C,k]=(0,n.useState)(void 0),[I,b]=(0,n.useState)(!1),[A,P]=(0,n.useState)(""),[U,K]=(0,n.useState)(!1);(0,n.useEffect)(()=>{(async()=>{const e=await a._U.get("vir/client/get");if(e.code!==l.m.Success)return;const t=e.data;if(k(t.serverPort),S(t.serverIp),m(t.ip),g(t.mask),P(t.key),b(t.open),w(t.client_name),t.open){const e=new u.hf(u.HK.vir_net_client_get),t=(await x.ws.send(e)).context.state;K(t),x.ws.addMsg(u.HK.vir_net_client_get,e=>{K(e.context.state)})}})()},[]);return(0,v.jsx)("div",{children:(0,v.jsx)(o.fI,{children:(0,v.jsxs)(o.VP,{children:[(0,v.jsxs)(r.Zp,{title:"",rightBottomCom:(0,v.jsx)(d.C3,{text:t("保存"),clickFun:async()=>{const e=new h.vo;e.ip=s,e.mask=parseInt(y),e.key=A,e.serverIp=_,e.serverPort=parseInt(C),e.open=I,e.client_name=f;(await a._U.post("vir/client/save",e)).code===l.m.Success?(0,c.SK)("保存成功"):(0,c.zN)("网络错误")}}),titleCom:(0,v.jsxs)("div",{children:[t("连接状态"),(0,v.jsx)(r.fq,{ok:U})]}),children:[(0,v.jsx)(i.Sm,{placeholder:"ip ",value:s,handleInputChange:e=>{m(e)}}),(0,v.jsx)(i.Sm,{placeholder:"mask",value:y,handleInputChange:e=>{g(e)}}),(0,v.jsx)(i.Sm,{placeholder:`${t("服务器")} ip`,value:_,handleInputChange:e=>{S(e)}}),(0,v.jsx)(i.Sm,{placeholder:`${t("服务器")} part`,value:C,handleInputChange:e=>{k(e)}}),(0,v.jsx)(i.Sm,{placeholder:"名称 ",value:f,handleInputChange:e=>{w(e)}}),(0,v.jsx)(i.Sm,{type:"password",placeholder:"key ",value:A,handleInputChange:e=>{P(e)}}),(0,v.jsxs)("form",{children:[t("状态"),(0,v.jsx)(p.S,{isFlex:!0,columns:[(0,v.jsx)(i.U6,{value:1,context:t("开启"),selected:I,onchange:()=>{b(!I)}}),(0,v.jsx)(i.U6,{value:1,context:t("关闭"),selected:!I,onchange:()=>{b(!I)}})]})]})]}),(0,v.jsxs)(r.Zp,{title:"",children:[(0,v.jsx)("div",{children:"ip: 虚拟ip, “10.0.0.0 - 10.255.255.255”和“172.16.0.0 - 172.31.255.255”和“192.168.0.0 - 192.168.255.255”这三个网段属于内网ip"}),(0,v.jsx)("div",{children:"mask: 一些常见的子网掩码网段/8:255.0.0.0;/16:255.255.0.0 ;/24:255.255.255.0"}),(0,v.jsx)("div",{children:"key:用于验证身份信息并加密的和服务器设置的一样"})]})]})})})}var _=s(34843),S=s(82893),f=s(23430),w=s(78247),C=s(21499),k=s(24659);function I(e){const{t}=(0,j.B)(),[s,x]=(0,n.useState)(""),[u,m]=(0,n.useState)(""),[y,g]=(0,n.useState)(""),[I,b]=(0,n.useState)(!1),[A,P]=(0,n.useState)(!1),[U,K]=(0,n.useState)({list:[]}),[F,H]=(0,_.fp)(S.AG.editorSetting),[$,N]=(0,_.fp)(S.AG.user_base_info),B=[t("端口"),t("目标地址"),t("目标端口"),t("开启"),t("备注"),t("删除")],[O,Z]=(0,n.useState)([]),z=[t("port"),t("ip"),t("type"),t("开启")],[E,V]=(0,n.useState)([]),M=[t("编辑"),t("开启"),t("备注"),t("删除")],X=(0,k.K)(),G=async()=>{const e=[a._U.post("vir/client/tcp_proxy/get"),a._U.post("http/proxy/server/get")];let t;$.sys===f.XM.mac?t=(async()=>{const e=await a._U.post("http/proxy/get/mac");if(e.code!==l.m.Success)return;const t=[],s=[];for(const n of e.data)"Wi-Fi"===n.name?t.push(n):s.push(n);V([...t,...s])})():$.sys===f.XM.win&&(t=(async()=>{const e=await a._U.post("http/proxy/get/win");if(e.code===l.m.Success){const t=e.data;x(t.ip),m(t.port),b(t.enabled),g(t.bypass),P(t.useForLocal)}})()),t&&e.push(t);const[s,n]=await Promise.all(e);s.code===l.m.Success&&Z(s.data),n.code===l.m.Success&&K(n.data)};(0,n.useEffect)(()=>{G()},[]);return(0,v.jsx)("div",{children:(0,v.jsxs)(o.fI,{children:[$.sys===f.XM.win&&(0,v.jsx)(o.VP,{widthPer:33,children:(0,v.jsxs)(r.Zp,{title:"Http Proxy",rightBottomCom:(0,v.jsx)(d.C3,{text:t("保存"),clickFun:async()=>{const e=new h.l5;e.port=parseInt(u),e.enabled=I,e.useForLocal=A,e.ip=s,e.bypass=y;(await a._U.post("http/proxy/set/win",e)).code===l.m.Success&&(G(),(0,c.SK)("保存成功"))}}),children:[(0,v.jsx)(i.Sm,{placeholder:"ip (default localhost) ",value:s,handleInputChange:e=>{x(e)}}),(0,v.jsx)(i.Sm,{placeholder:"port ",value:u,handleInputChange:e=>{m(e)}}),(0,v.jsx)(i.Sm,{placeholder:t("忽略ip"),value:y,handleInputChange:e=>{g(e)}}),(0,v.jsxs)("form",{children:[t("请勿将代理服务器用于本地(Intranet)地址"),(0,v.jsx)(p.S,{isFlex:!0,columns:[(0,v.jsx)(i.U6,{value:1,context:t("开启"),selected:A,onchange:()=>{P(!A)}}),(0,v.jsx)(i.U6,{value:1,context:t("关闭"),selected:!A,onchange:()=>{P(!A)}})]})]}),(0,v.jsxs)("form",{children:[t("状态"),(0,v.jsx)(p.S,{isFlex:!0,columns:[(0,v.jsx)(i.U6,{value:1,context:t("开启"),selected:I,onchange:()=>{b(!I)}}),(0,v.jsx)(i.U6,{value:1,context:t("关闭"),selected:!I,onchange:()=>{b(!I)}})]})]})]})}),$.sys===f.XM.mac&&(0,v.jsx)(o.VP,{children:E.map((e,s)=>(0,v.jsxs)(r.uF,{self_title:(0,v.jsxs)("span",{className:" div-row ",children:[(0,v.jsx)("h2",{children:e.name})," "]}),titleCom:(0,v.jsx)("div",{children:(0,v.jsx)(d.rA,{icon:"save",title:t("保存"),onClick:()=>{(async e=>{const t=E[e];(await a._U.post("http/proxy/set/mac",[t])).code===l.m.Success&&(G(),(0,c.SK)("保存成功"))})(s)}})}),children:[(0,v.jsx)(p.X,{headers:z,rows:e.proxies.map((e,t)=>{const n=[(0,v.jsx)(i.Sm,{value:e.port,handleInputChange:t=>{e.port=parseInt(t)},no_border:!0}),(0,v.jsx)(i.Sm,{value:e.ip,handleInputChange:t=>{e.ip=t},no_border:!0}),(0,v.jsx)("div",{children:1===e.type?"http":"https"}),(0,v.jsx)(i.l6,{value:e.enabled,onChange:e=>{((e,t,s)=>{const n=[...E];n[e].proxies[t].enabled=s,V(n)})(s,t,e)},options:X,no_border:!0})];return n}),width:"10rem"}),"ignore ips",(0,v.jsx)(i.Sm,{value:e.bypass,handleInputChange:e=>{E[s].bypass=e},no_border:!0})]},s))}),(0,v.jsxs)(o.VP,{children:[(0,v.jsx)(r.uF,{self_title:(0,v.jsxs)("span",{className:" div-row ",children:[(0,v.jsx)("h2",{children:t("Tcp Proxy")})," "]}),titleCom:(0,v.jsxs)("div",{children:[(0,v.jsx)(d.rA,{icon:"add",title:t("添加"),onClick:()=>{Z([...O,{note:"",open:!1,port:0,target_port:0,target_ip:""}])}}),(0,v.jsx)(d.rA,{icon:"save",title:t("保存"),onClick:async()=>{const e=[];for(let t=0;t<O.length;t++)O[t].index=t,e.push(O[t]);(await a._U.post("vir/client/tcp_proxy/save",e)).code===l.m.Success&&((0,c.SK)("保存成功"),G())}})]}),children:(0,v.jsx)(p.X,{headers:B,rows:O.map((e,s)=>{const n=[(0,v.jsx)(i.Sm,{value:e.port,handleInputChange:t=>{e.port=parseInt(t)},no_border:!0}),(0,v.jsx)(i.Sm,{value:e.target_ip,handleInputChange:t=>{e.target_ip=t},no_border:!0}),(0,v.jsx)(i.Sm,{value:e.target_port,handleInputChange:t=>{e.target_port=parseInt(t)},no_border:!0}),(0,v.jsx)(i.l6,{value:e.open,onChange:e=>{O[s].open=e,Z([...O])},options:X,no_border:!0}),(0,v.jsx)(i.Sm,{value:e.note,handleInputChange:t=>{e.note=t},no_border:!0}),(0,v.jsx)("div",{children:(0,v.jsx)(d.rA,{icon:"delete",title:t("删除"),onClick:()=>(e=>{O.splice(e,1),Z([...O])})(s)})})];return n}),width:"10rem"})}),(0,v.jsx)(r.uF,{self_title:(0,v.jsxs)("span",{className:" div-row ",children:[(0,v.jsx)("h2",{children:t("Http Proxy Server")})," "]}),titleCom:(0,v.jsxs)("div",{children:[(0,v.jsx)(d.rA,{icon:"add",title:t("添加端口实例"),onClick:()=>{U.list.push({open:!1,port:0,note:"",list:[]}),K({...U})}}),(0,v.jsx)(d.rA,{icon:"save",title:t("保存"),onClick:async()=>{(await a._U.post("http/proxy/server/save",U)).code===l.m.Success&&(0,c.SK)("保存成功")}})]}),children:U.list.map((e,s)=>(0,v.jsxs)("div",{className:"net-proxy-instance",children:[(0,v.jsxs)("div",{className:"net-proxy-instance__toolbar",children:[(0,v.jsxs)("span",{className:"net-proxy-instance__label",children:[t("端口实例")," #",s+1]}),(0,v.jsx)("span",{children:t("状态")}),(0,v.jsx)(i.l6,{value:e.open,width:"15%",onChange:t=>{e.open=t,K({...U})},options:X,no_border:!0}),(0,v.jsx)("span",{children:t("端口")}),(0,v.jsx)(i.Sm,{value:e.port||"",handleInputChange:t=>{e.port=t?parseInt(t):0,K({...U})},no_border:!0,width:"80px"}),(0,v.jsx)(d.rA,{icon:"add",title:t("添加规则"),onClick:()=>{e.list.push({note:"",open:!1}),K({...U})}}),(0,v.jsx)(d.rA,{icon:"delete",title:t("删除端口实例"),onClick:()=>{U.list.splice(s,1),K({...U})}}),(0,v.jsx)(i.Sm,{placeholder:t("备注"),width:"100%",value:e.note,handleInputChange:t=>{e.note=t,K({...U})},no_border:!0})]}),(0,v.jsx)(p.X,{headers:M,rows:e.list.map((n,o)=>{const c=[(0,v.jsx)("div",{children:(0,v.jsx)(d.rA,{icon:"edit",title:t("编辑"),onClick:()=>{(async(e,t)=>{const s=U.list[e];if(!s)return;const n=s.list[t];if(!n)return;n.random_key||(n.random_key=(0,C.hU)(),K({...U}));const o=await a._U.post("http/proxy/server/code/get",{key:n.random_key,name:n.random_key});H({model:"ace/mode/javascript",open:!0,fileName:"",can_format:!0,save:async e=>{0===(await a._U.post("http/proxy/server/code/save",{context:e,key:n.random_key})).code&&(w.xK.set_value_temp(""),H({open:!1,model:"",fileName:"",save:null}))}}),w.xK.set_value_temp(o.data)})(s,o)}})}),(0,v.jsx)(i.l6,{value:n.open,onChange:t=>{e.list[o].open=t,K({...U})},options:X,no_border:!0}),(0,v.jsx)(i.Sm,{value:n.note,handleInputChange:e=>{n.note=e},no_border:!0}),(0,v.jsx)("div",{children:(0,v.jsx)(d.rA,{icon:"delete",title:t("删除"),onClick:()=>{e.list.splice(o,1),K({...U})}})})];return c}),width:"10rem"})]},s))})]})]})})}var b=s(87361),A=s(82726),P=s(27690);function U(e){const{t}=(0,j.B)(),[s,h]=(0,n.useState)([]),[x,u]=(0,n.useState)([]),[y,g]=(0,n.useState)(""),[f,w]=(0,n.useState)(""),[C,k]=(0,n.useState)(!1),[I,b]=(0,_.fp)(S.AG.showPrompt),[U,K]=(0,_.fp)(S.AG.confirm);(0,n.useEffect)(()=>{(async()=>{const e=await a.ez.get("ips/dnspod");if(e.code!==l.m.Success)return;const t=e.data,s=[],n=[];for(const e of t.ips)e.isIPv4?s.push(e):n.push(e);h(s),u(n),t.account&&(g(t.account.id),w(t.account.token)),k(t.isOpen)})()},[]);const F=async e=>{K({open:!0,handle:async()=>{0===(await a.ez.post("http/del",e)).code&&(0,c.SK)("删除成功,稍后请刷新"),K({open:!1,handle:null})},title:t("确定删除吗")})};return(0,v.jsxs)("div",{children:[(0,v.jsx)(m.A,{children:(0,v.jsx)(d.rA,{icon:"add",title:t("添加http获取ip"),onClick:()=>{b({show:!0,type:P.PromptEnum.DdnsAddHttp,overlay:!0,data:{}})}})}),(0,v.jsxs)(o.fI,{children:[(0,v.jsxs)(o.VP,{children:[(0,v.jsx)(r.Zp,{title:"ipv4",children:s.length>0&&s.map((e,s)=>(0,v.jsxs)("div",{children:[`${e.ifaceOrWww}(${e.ip})`,(0,v.jsx)(i.Sm,{right_placeholder:(0,v.jsx)("div",{children:e.source_type===A.tC.http_get&&(0,v.jsx)(d.rA,{icon:"delete",title:t("删除"),onClick:()=>{F(e)}})}),placeholder:"a.abc.com b.abc.com ...",value:e.ddnsHost,handleInputChange:t=>{e.ddnsHost=t}})]},s))}),(0,v.jsx)(r.Zp,{title:"ipv6",children:x.length>0&&x.map((e,s)=>(0,v.jsxs)("div",{children:[`${e.ifaceOrWww}(${e.ip})`,(0,v.jsx)(i.Sm,{right_placeholder:(0,v.jsx)("div",{children:e.source_type===A.tC.http_get&&(0,v.jsx)(d.rA,{icon:"delete",title:t("删除"),onClick:()=>{F(e)}})}),placeholder:"a.abc.com b.abc.com ...",value:e.ddnsHost,handleInputChange:t=>{e.ddnsHost=t}})]},s))})]}),(0,v.jsxs)(o.VP,{children:[(0,v.jsxs)(r.Zp,{title:t("账号设置"),rightBottomCom:(0,v.jsx)(d.C3,{text:t("保存"),clickFun:async()=>{if(C&&(!y||!f))return void(0,c.zN)("id和token都不能为空");const e=new A.yL,t=[];for(const e of[...s,...x])e.ddnsHost&&t.push(e);e.ips=t,e.account={id:y,token:f},e.isOpen=C,e.ddnsType=A.E2.dnspod;(await a.ez.post("save",e)).code===l.m.DdnsAuthFail?(0,c.zN)("鉴权失败"):(0,c.SK)("success")}}),children:[(0,v.jsx)(i.Sm,{placeholder:"ID",value:y,handleInputChange:e=>{g(e)}}),(0,v.jsx)(i.cA,{placeholder:"TOKEN",value:f,handleInputChange:e=>{w(e)}}),(0,v.jsx)(p.S,{isFlex:!0,columns:[(0,v.jsx)(i.U6,{value:1,context:t("开启"),selected:C,onchange:()=>{k(!C)}}),(0,v.jsx)(i.U6,{value:1,context:t("关闭"),selected:!C,onchange:()=>{k(!C)}})]})]}),(0,v.jsx)(r.Zp,{title:t("说明"),children:"域名如果不存在会自动创建,空子域名是@,ip6和ipv4可以互相切换。"})]})]})]})}function K(e){const{t}=(0,j.B)(),[s,h]=(0,n.useState)([]),[x,u]=(0,n.useState)([]),[y,g]=(0,n.useState)(""),[f,w]=(0,n.useState)(""),[C,k]=(0,n.useState)(!1),[I,b]=(0,_.fp)(S.AG.showPrompt),[U,K]=(0,_.fp)(S.AG.confirm);(0,n.useEffect)(()=>{(async()=>{const e=await a.ez.get("ips/tx");if(e.code!==l.m.Success)return;const t=e.data,s=[],n=[];for(const e of t.ips)e.isIPv4?s.push(e):n.push(e);h(s),u(n),t.account&&(g(t.account.secretid),w(t.account.secretkey)),k(t.isOpen)})()},[]);const F=async e=>{K({open:!0,handle:async()=>{0===(await a.ez.post("http/del",e)).code&&(0,c.SK)("删除成功,稍后请刷新"),K({open:!1,handle:null})},title:t("确定删除吗")})};return(0,v.jsxs)("div",{children:[(0,v.jsx)(m.A,{children:(0,v.jsx)(d.rA,{icon:"add",title:t("添加http获取ip"),onClick:()=>{b({show:!0,type:P.PromptEnum.DdnsAddHttp,overlay:!0,data:{}})}})}),(0,v.jsxs)(o.fI,{children:[(0,v.jsxs)(o.VP,{children:[(0,v.jsx)(r.Zp,{title:"ipv4",children:s.length>0&&s.map((e,s)=>(0,v.jsxs)("div",{children:[`${e.ifaceOrWww}(${e.ip})`,(0,v.jsx)(i.Sm,{right_placeholder:(0,v.jsx)("div",{children:e.source_type===A.tC.http_get&&(0,v.jsx)(d.rA,{icon:"delete",title:t("删除"),onClick:()=>{F(e)}})}),placeholder:"a.abc.com b.abc.com ...",value:e.ddnsHost,handleInputChange:t=>{e.ddnsHost=t}})]},s))}),(0,v.jsx)(r.Zp,{title:"ipv6",children:x.length>0&&x.map((e,s)=>(0,v.jsxs)("div",{children:[`${e.ifaceOrWww}(${e.ip})`,(0,v.jsx)(i.Sm,{right_placeholder:(0,v.jsx)("div",{children:e.source_type===A.tC.http_get&&(0,v.jsx)(d.rA,{icon:"delete",title:t("删除"),onClick:()=>{F(e)}})}),placeholder:"a.abc.com b.abc.com ...",value:e.ddnsHost,handleInputChange:t=>{e.ddnsHost=t}})]},s))})]}),(0,v.jsxs)(o.VP,{children:[(0,v.jsxs)(r.Zp,{title:t("账号设置"),rightBottomCom:(0,v.jsx)(d.C3,{text:t("保存"),clickFun:async()=>{if(C&&(!y||!f))return void(0,c.zN)("SecretId和SecretKey都不能为空");const e=new A.yL,t=[];for(const e of[...s,...x])e.ddnsHost&&t.push(e);e.ips=t,e.account={secretid:y,secretkey:f},e.isOpen=C,e.ddnsType=A.E2.tengxun;(await a.ez.post("save",e)).code===l.m.DdnsAuthFail?(0,c.zN)("鉴权失败"):(0,c.SK)("成功")}}),children:[(0,v.jsx)(i.Sm,{placeholder:"SecretId",value:y,handleInputChange:e=>{g(e)}}),(0,v.jsx)(i.cA,{placeholder:"SecretKey",value:f,handleInputChange:e=>{w(e)}}),(0,v.jsx)(p.S,{isFlex:!0,columns:[(0,v.jsx)(i.U6,{value:1,context:t("开启"),selected:C,onchange:()=>{k(!C)}}),(0,v.jsx)(i.U6,{value:1,context:t("关闭"),selected:!C,onchange:()=>{k(!C)}})]})]}),(0,v.jsx)(r.Zp,{title:t("说明"),children:"域名如果不存在会自动创建,空子域名是@,ip6和ipv4可以互相切换。"})]})]})]})}function F(){const{t:e}=(0,j.B)(),{check_user_auth:t}=(0,w.MH)(),s=[];return t(f.oV.vir_net)&&s.push({index:1,name:e("系统代理"),rto:"proxy_sys/",component:(0,v.jsx)(I,{})},{index:2,name:"Tun proxy "+e("客户端"),rto:"client/",component:(0,v.jsx)(g,{})},{index:3,name:"Tun proxy "+e("服务端"),rto:"server/",component:(0,v.jsx)(y,{})}),t(f.oV.ddns)&&s.push({index:4,name:`ddns-dnspod(${e("腾讯")})`,rto:"dnspod/",component:(0,v.jsx)(U,{})},{index:5,name:`ddns-${e("腾讯")}${e("云")}`,rto:"tengxun/",component:(0,v.jsx)(K,{})}),(0,v.jsx)(o.W1,{optionList:s,father_route:b.o.net})}},24659(e,t,s){var n=s(86149);s.d(t,["K",0,()=>{const{t:e}=(0,n.B)();return[{title:e("是"),value:!0,color:"#28a745"},{title:e("否"),value:!1,color:"#666666"}]}])}}]);
1
+ "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[2851],{8694(e,t,s){s.d(t,{$K:()=>a,RB:()=>l,l5:()=>i,qB:()=>n,vo:()=>c,vr:()=>r});class n{targetProxyUrl;proxyPort;sysProxyPort}let o=function(e){return e[e.tcp=0]="tcp",e[e.udp=1]="udp",e}({});class a{open=!1;port;key="";async_ips=[]}class c{client_num_id;client_name;open=!1;ip;mask;serverIp;serverPort;key="";model=o.udp}let l=function(e){return e[e.row=1]="row",e[e.json=2]="json",e[e.form=3]="form",e}({});class r{body_type;header_type;url;method;headers;data;form_data_list;local_download_path}class i{enabled;ip;port;bypass;useForLocal;type}},77481(e,t,s){s.d(t,{S:()=>c,X:()=>a});var n=s(96540),o=s(74848);function a(e){const[t,s]=n.useState([]);return(0,n.useEffect)(()=>{e.children?s(Array.isArray(e.children)?e.children:[e.children]):s(e.rows)},[e.rows,e.children]),(0,o.jsxs)("table",{children:[(0,o.jsx)("thead",{children:(0,o.jsx)("tr",{children:e.headers?.map((e,t)=>(0,o.jsx)("th",{children:e},t))})}),(0,o.jsx)("tbody",{children:t.map((t,s)=>(0,o.jsx)("tr",{onContextMenu:()=>{e.handleContextMenu&&e.handleContextMenu(t)},children:t.map((s,n)=>(0,o.jsx)("td",{style:{width:e.width??"auto"},className:n===t.length-1?"small":"",children:s},n))},s))})]})}function c(e){return(0,o.jsx)("div",{style:{display:e.isFlex?"flex":"block"},children:e.columns.map((e,t)=>(0,o.jsx)("div",{children:e},t))})}},42851(e,t,s){s.r(t),s.d(t,{default:()=>F});var n=s(96540),o=s(75725),a=s(14284),c=s(62042),l=s(53459),r=s(70447),i=s(61443),d=s(85997),p=s(77481),h=s(8694),x=s(14944),u=s(92275),j=s(86149),m=s(57952),v=s(74848);function y(e){const{t}=(0,j.B)(),[s,y]=(0,n.useState)(void 0),[g,_]=(0,n.useState)(!1),[S,f]=(0,n.useState)(""),[w,C]=(0,n.useState)([t(`${t("名称")}`),t(`${t("虚拟")}ip`),`${t("物理")}`,t("在线状态"),t("选择")]),[k,I]=(0,n.useState)([]),[b,A]=(0,n.useState)({}),[P,U]=(0,n.useState)(!1);(0,n.useEffect)(()=>{(async()=>{const e=new u.hf(u.HK.vir_net_serverIno_get);x.ws.addMsg(u.HK.vir_net_serverIno_get,e=>{(e=>{for(const s of e){const e=s[s.length-1];s[s.length-1]=(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(r.fq,{ok:e}),t(e?"在线":"离线")]}),s[0]=(0,v.jsx)(r.xP,{context:s[0],tip_context:s[0]}),s[2]=(0,v.jsx)(r.xP,{context:s[2],tip_context:s[2]})}})(e.context),I(e.context)}),await x.ws.send(e)})();return(async()=>{const e=await a._U.get("vir/server/get");if(e.code!==l.m.Success)return;const t=e.data;y(t.port),f(t.key),_(t.open)})(),()=>{}},[]);return(0,v.jsxs)("div",{children:[(0,v.jsxs)(m.A,{children:[!!Object.keys(b).length&&b[0],!!Object.keys(b).length&&(0,v.jsx)(d.rA,{icon:"delete",title:"删除",onClick:async()=>{await a._U.post("vir/server/delete/client",{ips:Object.keys(b)}),A({})}})]}),(0,v.jsx)(o.fI,{children:(0,v.jsxs)(o.VP,{children:[(0,v.jsxs)(r.Zp,{title:"",rightBottomCom:(0,v.jsx)(d.C3,{text:t("保存"),clickFun:async()=>{const e=new h.$K;e.open=g,e.key=S,P&&(e.async_ips=Object.keys(b)),s&&(e.port=parseInt(s));(await a._U.post("vir/server/save",e)).code===l.m.Success?((0,c.SK)("保存成功"),U(!1)):(0,c.zN)("网络错误")}}),children:[(0,v.jsx)(i.Sm,{placeholder:"port",value:s,handleInputChange:e=>{y(e)}}),(0,v.jsx)(i.Sm,{type:"password",placeholder:"key ",value:S,handleInputChange:e=>{f(e)}}),(0,v.jsxs)("form",{children:[t("状态"),":",(0,v.jsx)(p.S,{isFlex:!0,columns:[(0,v.jsx)(i.U6,{value:1,context:t("开启"),selected:g,onchange:()=>{_(!g)}}),(0,v.jsx)(i.U6,{value:1,context:t("关闭"),selected:!g,onchange:()=>{_(!g)}})]})]}),!!Object.keys(b).length&&(0,v.jsx)(i.GL,{context:t("同步信息给选中服务器"),selected:P,onchange:()=>{U(!P)}})]}),(0,v.jsx)(r.Zp,{title:"",children:(0,v.jsx)(p.X,{headers:w,rows:k.map(e=>[...e,(0,v.jsx)(i.GL,{context:t(""),selected:b[e[1]],onchange:()=>{const t={...b};t[e[1]]?delete t[e[1]]:t[e[1]]=e,A(t)}})]),width:"10rem"})})]})})]})}function g(e){const{t}=(0,j.B)(),[s,m]=(0,n.useState)(""),[y,g]=(0,n.useState)(void 0),[_,S]=(0,n.useState)(""),[f,w]=(0,n.useState)(""),[C,k]=(0,n.useState)(void 0),[I,b]=(0,n.useState)(!1),[A,P]=(0,n.useState)(""),[U,K]=(0,n.useState)(!1);(0,n.useEffect)(()=>{(async()=>{const e=await a._U.get("vir/client/get");if(e.code!==l.m.Success)return;const t=e.data;if(k(t.serverPort),S(t.serverIp),m(t.ip),g(t.mask),P(t.key),b(t.open),w(t.client_name),t.open){const e=new u.hf(u.HK.vir_net_client_get),t=(await x.ws.send(e)).context.state;K(t),x.ws.addMsg(u.HK.vir_net_client_get,e=>{K(e.context.state)})}})()},[]);return(0,v.jsx)("div",{children:(0,v.jsx)(o.fI,{children:(0,v.jsxs)(o.VP,{children:[(0,v.jsxs)(r.Zp,{title:"",rightBottomCom:(0,v.jsx)(d.C3,{text:t("保存"),clickFun:async()=>{const e=new h.vo;e.ip=s,e.mask=parseInt(y),e.key=A,e.serverIp=_,e.serverPort=parseInt(C),e.open=I,e.client_name=f;(await a._U.post("vir/client/save",e)).code===l.m.Success?(0,c.SK)("保存成功"):(0,c.zN)("网络错误")}}),titleCom:(0,v.jsxs)("div",{children:[t("连接状态"),(0,v.jsx)(r.fq,{ok:U})]}),children:[(0,v.jsx)(i.Sm,{placeholder:"ip ",value:s,handleInputChange:e=>{m(e)}}),(0,v.jsx)(i.Sm,{placeholder:"mask",value:y,handleInputChange:e=>{g(e)}}),(0,v.jsx)(i.Sm,{placeholder:`${t("服务器")} ip`,value:_,handleInputChange:e=>{S(e)}}),(0,v.jsx)(i.Sm,{placeholder:`${t("服务器")} part`,value:C,handleInputChange:e=>{k(e)}}),(0,v.jsx)(i.Sm,{placeholder:"名称 ",value:f,handleInputChange:e=>{w(e)}}),(0,v.jsx)(i.Sm,{type:"password",placeholder:"key ",value:A,handleInputChange:e=>{P(e)}}),(0,v.jsxs)("form",{children:[t("状态"),(0,v.jsx)(p.S,{isFlex:!0,columns:[(0,v.jsx)(i.U6,{value:1,context:t("开启"),selected:I,onchange:()=>{b(!I)}}),(0,v.jsx)(i.U6,{value:1,context:t("关闭"),selected:!I,onchange:()=>{b(!I)}})]})]})]}),(0,v.jsxs)(r.Zp,{title:"",children:[(0,v.jsx)("div",{children:"ip: 虚拟ip, “10.0.0.0 - 10.255.255.255”和“172.16.0.0 - 172.31.255.255”和“192.168.0.0 - 192.168.255.255”这三个网段属于内网ip"}),(0,v.jsx)("div",{children:"mask: 一些常见的子网掩码网段/8:255.0.0.0;/16:255.255.0.0 ;/24:255.255.255.0"}),(0,v.jsx)("div",{children:"key:用于验证身份信息并加密的和服务器设置的一样"})]})]})})})}var _=s(34843),S=s(82893),f=s(23430),w=s(78247),C=s(21499),k=s(24659);function I(e){const{t}=(0,j.B)(),[s,x]=(0,n.useState)(""),[u,m]=(0,n.useState)(""),[y,g]=(0,n.useState)(""),[I,b]=(0,n.useState)(!1),[A,P]=(0,n.useState)(!1),[U,K]=(0,n.useState)({list:[]}),[F,H]=(0,_.fp)(S.AG.editorSetting),[$,N]=(0,_.fp)(S.AG.user_base_info),B=[t("端口"),t("目标地址"),t("目标端口"),t("开启"),t("备注"),t("删除")],[O,Z]=(0,n.useState)([]),z=[t("port"),t("ip"),t("type"),t("开启")],[E,V]=(0,n.useState)([]),M=[t("编辑"),t("开启"),t("备注"),t("删除")],X=(0,k.K)(),G=async()=>{const e=[a._U.post("vir/client/tcp_proxy/get"),a._U.post("http/proxy/server/get")];let t;$.sys===f.XM.mac?t=(async()=>{const e=await a._U.post("http/proxy/get/mac");if(e.code!==l.m.Success)return;const t=[],s=[];for(const n of e.data)"Wi-Fi"===n.name?t.push(n):s.push(n);V([...t,...s])})():$.sys===f.XM.win&&(t=(async()=>{const e=await a._U.post("http/proxy/get/win");if(e.code===l.m.Success){const t=e.data;x(t.ip),m(t.port),b(t.enabled),g(t.bypass),P(t.useForLocal)}})()),t&&e.push(t);const[s,n]=await Promise.all(e);s.code===l.m.Success&&Z(s.data),n.code===l.m.Success&&K(n.data)};(0,n.useEffect)(()=>{G()},[]);return(0,v.jsx)("div",{children:(0,v.jsxs)(o.fI,{children:[$.sys===f.XM.win&&(0,v.jsx)(o.VP,{widthPer:33,children:(0,v.jsxs)(r.Zp,{title:"Http Proxy",rightBottomCom:(0,v.jsx)(d.C3,{text:t("保存"),clickFun:async()=>{const e=new h.l5;e.port=parseInt(u),e.enabled=I,e.useForLocal=A,e.ip=s,e.bypass=y;(await a._U.post("http/proxy/set/win",e)).code===l.m.Success&&(G(),(0,c.SK)("保存成功"))}}),children:[(0,v.jsx)(i.Sm,{placeholder:"ip (default localhost) ",value:s,handleInputChange:e=>{x(e)}}),(0,v.jsx)(i.Sm,{placeholder:"port ",value:u,handleInputChange:e=>{m(e)}}),(0,v.jsx)(i.Sm,{placeholder:t("忽略ip"),value:y,handleInputChange:e=>{g(e)}}),(0,v.jsxs)("form",{children:[t("请勿将代理服务器用于本地(Intranet)地址"),(0,v.jsx)(p.S,{isFlex:!0,columns:[(0,v.jsx)(i.U6,{value:1,context:t("开启"),selected:A,onchange:()=>{P(!A)}}),(0,v.jsx)(i.U6,{value:1,context:t("关闭"),selected:!A,onchange:()=>{P(!A)}})]})]}),(0,v.jsxs)("form",{children:[t("状态"),(0,v.jsx)(p.S,{isFlex:!0,columns:[(0,v.jsx)(i.U6,{value:1,context:t("开启"),selected:I,onchange:()=>{b(!I)}}),(0,v.jsx)(i.U6,{value:1,context:t("关闭"),selected:!I,onchange:()=>{b(!I)}})]})]})]})}),$.sys===f.XM.mac&&(0,v.jsx)(o.VP,{children:E.map((e,s)=>(0,v.jsxs)(r.uF,{self_title:(0,v.jsxs)("span",{className:" div-row ",children:[(0,v.jsx)("h2",{children:e.name})," "]}),titleCom:(0,v.jsx)("div",{children:(0,v.jsx)(d.rA,{icon:"save",title:t("保存"),onClick:()=>{(async e=>{const t=E[e];(await a._U.post("http/proxy/set/mac",[t])).code===l.m.Success&&(G(),(0,c.SK)("保存成功"))})(s)}})}),children:[(0,v.jsx)(p.X,{headers:z,rows:e.proxies.map((e,t)=>{const n=[(0,v.jsx)(i.Sm,{value:e.port,handleInputChange:t=>{e.port=parseInt(t)},no_border:!0}),(0,v.jsx)(i.Sm,{value:e.ip,handleInputChange:t=>{e.ip=t},no_border:!0}),(0,v.jsx)("div",{children:1===e.type?"http":"https"}),(0,v.jsx)(i.l6,{value:e.enabled,onChange:e=>{((e,t,s)=>{const n=[...E];n[e].proxies[t].enabled=s,V(n)})(s,t,e)},options:X,no_border:!0})];return n}),width:"10rem"}),"ignore ips",(0,v.jsx)(i.Sm,{value:e.bypass,handleInputChange:e=>{E[s].bypass=e},no_border:!0})]},s))}),(0,v.jsxs)(o.VP,{children:[(0,v.jsx)(r.uF,{self_title:(0,v.jsxs)("span",{className:" div-row ",children:[(0,v.jsx)("h2",{children:t("Tcp Proxy")})," "]}),titleCom:(0,v.jsxs)("div",{children:[(0,v.jsx)(d.rA,{icon:"add",title:t("添加"),onClick:()=>{Z([...O,{note:"",open:!1,port:0,target_port:0,target_ip:""}])}}),(0,v.jsx)(d.rA,{icon:"save",title:t("保存"),onClick:async()=>{const e=[];for(let t=0;t<O.length;t++)O[t].index=t,e.push(O[t]);(await a._U.post("vir/client/tcp_proxy/save",e)).code===l.m.Success&&((0,c.SK)("保存成功"),G())}})]}),children:(0,v.jsx)(p.X,{headers:B,rows:O.map((e,s)=>{const n=[(0,v.jsx)(i.Sm,{value:e.port,handleInputChange:t=>{e.port=parseInt(t)},no_border:!0}),(0,v.jsx)(i.Sm,{value:e.target_ip,handleInputChange:t=>{e.target_ip=t},no_border:!0}),(0,v.jsx)(i.Sm,{value:e.target_port,handleInputChange:t=>{e.target_port=parseInt(t)},no_border:!0}),(0,v.jsx)(i.l6,{value:e.open,onChange:e=>{O[s].open=e,Z([...O])},options:X,no_border:!0}),(0,v.jsx)(i.Sm,{value:e.note,handleInputChange:t=>{e.note=t},no_border:!0}),(0,v.jsx)("div",{children:(0,v.jsx)(d.rA,{icon:"delete",title:t("删除"),onClick:()=>(e=>{O.splice(e,1),Z([...O])})(s)})})];return n}),width:"10rem"})}),(0,v.jsx)(r.uF,{self_title:(0,v.jsxs)("span",{className:" div-row ",children:[(0,v.jsx)("h2",{children:t("Http Proxy Server")})," "]}),titleCom:(0,v.jsxs)("div",{children:[(0,v.jsx)(d.rA,{icon:"add",title:t("添加端口实例"),onClick:()=>{U.list.push({open:!1,port:0,note:"",list:[]}),K({...U})}}),(0,v.jsx)(d.rA,{icon:"save",title:t("保存"),onClick:async()=>{(await a._U.post("http/proxy/server/save",U)).code===l.m.Success&&(0,c.SK)("保存成功")}})]}),children:U.list.map((e,s)=>(0,v.jsxs)("div",{className:"net-proxy-instance",children:[(0,v.jsxs)("div",{className:"net-proxy-instance__toolbar",children:[(0,v.jsxs)("span",{className:"net-proxy-instance__label",children:[t("端口实例")," #",s+1]}),(0,v.jsx)("span",{children:t("状态")}),(0,v.jsx)(i.l6,{value:e.open,width:"15%",onChange:t=>{e.open=t,K({...U})},options:X,no_border:!0}),(0,v.jsx)("span",{children:t("端口")}),(0,v.jsx)(i.Sm,{value:e.port||"",handleInputChange:t=>{e.port=t?parseInt(t):0,K({...U})},no_border:!0,width:"80px"}),(0,v.jsx)(d.rA,{icon:"add",title:t("添加规则"),onClick:()=>{e.list.push({note:"",open:!1}),K({...U})}}),(0,v.jsx)(d.rA,{icon:"delete",title:t("删除端口实例"),onClick:()=>{U.list.splice(s,1),K({...U})}}),(0,v.jsx)(i.Sm,{placeholder:t("备注"),width:"100%",value:e.note,handleInputChange:t=>{e.note=t,K({...U})},no_border:!0})]}),(0,v.jsx)(p.X,{headers:M,rows:e.list.map((n,o)=>{const c=[(0,v.jsx)("div",{children:(0,v.jsx)(d.rA,{icon:"edit",title:t("编辑"),onClick:()=>{(async(e,t)=>{const s=U.list[e];if(!s)return;const n=s.list[t];if(!n)return;n.random_key||(n.random_key=(0,C.hU)(),K({...U}));const o=await a._U.post("http/proxy/server/code/get",{key:n.random_key,name:n.random_key});H({model:"ace/mode/javascript",open:!0,fileName:"",can_format:!0,save:async e=>{0===(await a._U.post("http/proxy/server/code/save",{context:e,key:n.random_key})).code&&(w.xK.set_value_temp(""),H({open:!1,model:"",fileName:"",save:null}))}}),w.xK.set_value_temp(o.data)})(s,o)}})}),(0,v.jsx)(i.l6,{value:n.open,onChange:t=>{e.list[o].open=t,K({...U})},options:X,no_border:!0}),(0,v.jsx)(i.Sm,{value:n.note,handleInputChange:e=>{n.note=e},no_border:!0}),(0,v.jsx)("div",{children:(0,v.jsx)(d.rA,{icon:"delete",title:t("删除"),onClick:()=>{e.list.splice(o,1),K({...U})}})})];return c}),width:"10rem"})]},s))})]})]})})}var b=s(87361),A=s(82726),P=s(18538);function U(e){const{t}=(0,j.B)(),[s,h]=(0,n.useState)([]),[x,u]=(0,n.useState)([]),[y,g]=(0,n.useState)(""),[f,w]=(0,n.useState)(""),[C,k]=(0,n.useState)(!1),[I,b]=(0,_.fp)(S.AG.showPrompt),[U,K]=(0,_.fp)(S.AG.confirm);(0,n.useEffect)(()=>{(async()=>{const e=await a.ez.get("ips/dnspod");if(e.code!==l.m.Success)return;const t=e.data,s=[],n=[];for(const e of t.ips)e.isIPv4?s.push(e):n.push(e);h(s),u(n),t.account&&(g(t.account.id),w(t.account.token)),k(t.isOpen)})()},[]);const F=async e=>{K({open:!0,handle:async()=>{0===(await a.ez.post("http/del",e)).code&&(0,c.SK)("删除成功,稍后请刷新"),K({open:!1,handle:null})},title:t("确定删除吗")})};return(0,v.jsxs)("div",{children:[(0,v.jsx)(m.A,{children:(0,v.jsx)(d.rA,{icon:"add",title:t("添加http获取ip"),onClick:()=>{b({show:!0,type:P.PromptEnum.DdnsAddHttp,overlay:!0,data:{}})}})}),(0,v.jsxs)(o.fI,{children:[(0,v.jsxs)(o.VP,{children:[(0,v.jsx)(r.Zp,{title:"ipv4",children:s.length>0&&s.map((e,s)=>(0,v.jsxs)("div",{children:[`${e.ifaceOrWww}(${e.ip})`,(0,v.jsx)(i.Sm,{right_placeholder:(0,v.jsx)("div",{children:e.source_type===A.tC.http_get&&(0,v.jsx)(d.rA,{icon:"delete",title:t("删除"),onClick:()=>{F(e)}})}),placeholder:"a.abc.com b.abc.com ...",value:e.ddnsHost,handleInputChange:t=>{e.ddnsHost=t}})]},s))}),(0,v.jsx)(r.Zp,{title:"ipv6",children:x.length>0&&x.map((e,s)=>(0,v.jsxs)("div",{children:[`${e.ifaceOrWww}(${e.ip})`,(0,v.jsx)(i.Sm,{right_placeholder:(0,v.jsx)("div",{children:e.source_type===A.tC.http_get&&(0,v.jsx)(d.rA,{icon:"delete",title:t("删除"),onClick:()=>{F(e)}})}),placeholder:"a.abc.com b.abc.com ...",value:e.ddnsHost,handleInputChange:t=>{e.ddnsHost=t}})]},s))})]}),(0,v.jsxs)(o.VP,{children:[(0,v.jsxs)(r.Zp,{title:t("账号设置"),rightBottomCom:(0,v.jsx)(d.C3,{text:t("保存"),clickFun:async()=>{if(C&&(!y||!f))return void(0,c.zN)("id和token都不能为空");const e=new A.yL,t=[];for(const e of[...s,...x])e.ddnsHost&&t.push(e);e.ips=t,e.account={id:y,token:f},e.isOpen=C,e.ddnsType=A.E2.dnspod;(await a.ez.post("save",e)).code===l.m.DdnsAuthFail?(0,c.zN)("鉴权失败"):(0,c.SK)("success")}}),children:[(0,v.jsx)(i.Sm,{placeholder:"ID",value:y,handleInputChange:e=>{g(e)}}),(0,v.jsx)(i.cA,{placeholder:"TOKEN",value:f,handleInputChange:e=>{w(e)}}),(0,v.jsx)(p.S,{isFlex:!0,columns:[(0,v.jsx)(i.U6,{value:1,context:t("开启"),selected:C,onchange:()=>{k(!C)}}),(0,v.jsx)(i.U6,{value:1,context:t("关闭"),selected:!C,onchange:()=>{k(!C)}})]})]}),(0,v.jsx)(r.Zp,{title:t("说明"),children:"域名如果不存在会自动创建,空子域名是@,ip6和ipv4可以互相切换。"})]})]})]})}function K(e){const{t}=(0,j.B)(),[s,h]=(0,n.useState)([]),[x,u]=(0,n.useState)([]),[y,g]=(0,n.useState)(""),[f,w]=(0,n.useState)(""),[C,k]=(0,n.useState)(!1),[I,b]=(0,_.fp)(S.AG.showPrompt),[U,K]=(0,_.fp)(S.AG.confirm);(0,n.useEffect)(()=>{(async()=>{const e=await a.ez.get("ips/tx");if(e.code!==l.m.Success)return;const t=e.data,s=[],n=[];for(const e of t.ips)e.isIPv4?s.push(e):n.push(e);h(s),u(n),t.account&&(g(t.account.secretid),w(t.account.secretkey)),k(t.isOpen)})()},[]);const F=async e=>{K({open:!0,handle:async()=>{0===(await a.ez.post("http/del",e)).code&&(0,c.SK)("删除成功,稍后请刷新"),K({open:!1,handle:null})},title:t("确定删除吗")})};return(0,v.jsxs)("div",{children:[(0,v.jsx)(m.A,{children:(0,v.jsx)(d.rA,{icon:"add",title:t("添加http获取ip"),onClick:()=>{b({show:!0,type:P.PromptEnum.DdnsAddHttp,overlay:!0,data:{}})}})}),(0,v.jsxs)(o.fI,{children:[(0,v.jsxs)(o.VP,{children:[(0,v.jsx)(r.Zp,{title:"ipv4",children:s.length>0&&s.map((e,s)=>(0,v.jsxs)("div",{children:[`${e.ifaceOrWww}(${e.ip})`,(0,v.jsx)(i.Sm,{right_placeholder:(0,v.jsx)("div",{children:e.source_type===A.tC.http_get&&(0,v.jsx)(d.rA,{icon:"delete",title:t("删除"),onClick:()=>{F(e)}})}),placeholder:"a.abc.com b.abc.com ...",value:e.ddnsHost,handleInputChange:t=>{e.ddnsHost=t}})]},s))}),(0,v.jsx)(r.Zp,{title:"ipv6",children:x.length>0&&x.map((e,s)=>(0,v.jsxs)("div",{children:[`${e.ifaceOrWww}(${e.ip})`,(0,v.jsx)(i.Sm,{right_placeholder:(0,v.jsx)("div",{children:e.source_type===A.tC.http_get&&(0,v.jsx)(d.rA,{icon:"delete",title:t("删除"),onClick:()=>{F(e)}})}),placeholder:"a.abc.com b.abc.com ...",value:e.ddnsHost,handleInputChange:t=>{e.ddnsHost=t}})]},s))})]}),(0,v.jsxs)(o.VP,{children:[(0,v.jsxs)(r.Zp,{title:t("账号设置"),rightBottomCom:(0,v.jsx)(d.C3,{text:t("保存"),clickFun:async()=>{if(C&&(!y||!f))return void(0,c.zN)("SecretId和SecretKey都不能为空");const e=new A.yL,t=[];for(const e of[...s,...x])e.ddnsHost&&t.push(e);e.ips=t,e.account={secretid:y,secretkey:f},e.isOpen=C,e.ddnsType=A.E2.tengxun;(await a.ez.post("save",e)).code===l.m.DdnsAuthFail?(0,c.zN)("鉴权失败"):(0,c.SK)("成功")}}),children:[(0,v.jsx)(i.Sm,{placeholder:"SecretId",value:y,handleInputChange:e=>{g(e)}}),(0,v.jsx)(i.cA,{placeholder:"SecretKey",value:f,handleInputChange:e=>{w(e)}}),(0,v.jsx)(p.S,{isFlex:!0,columns:[(0,v.jsx)(i.U6,{value:1,context:t("开启"),selected:C,onchange:()=>{k(!C)}}),(0,v.jsx)(i.U6,{value:1,context:t("关闭"),selected:!C,onchange:()=>{k(!C)}})]})]}),(0,v.jsx)(r.Zp,{title:t("说明"),children:"域名如果不存在会自动创建,空子域名是@,ip6和ipv4可以互相切换。"})]})]})]})}function F(){const{t:e}=(0,j.B)(),{check_user_auth:t}=(0,w.MH)(),s=[];return t(f.oV.vir_net)&&s.push({index:1,name:e("系统代理"),rto:"proxy_sys/",component:(0,v.jsx)(I,{})},{index:2,name:"Tun proxy "+e("客户端"),rto:"client/",component:(0,v.jsx)(g,{})},{index:3,name:"Tun proxy "+e("服务端"),rto:"server/",component:(0,v.jsx)(y,{})}),t(f.oV.ddns)&&s.push({index:4,name:`ddns-dnspod(${e("腾讯")})`,rto:"dnspod/",component:(0,v.jsx)(U,{})},{index:5,name:`ddns-${e("腾讯")}${e("云")}`,rto:"tengxun/",component:(0,v.jsx)(K,{})}),(0,v.jsx)(o.W1,{optionList:s,father_route:b.o.net})}},24659(e,t,s){var n=s(86149);s.d(t,["K",0,()=>{const{t:e}=(0,n.B)();return[{title:e("是"),value:!0,color:"#28a745"},{title:e("否"),value:!1,color:"#666666"}]}])}}]);