filecat 6.65.1 → 6.67.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/dist/1384.3138b56fd880b4ef6b5a.js +1 -0
- package/build/dist/1458.4b7f874b4895f047f85d.js +1 -0
- package/build/dist/1472.26eae5dfbe640bd95007.js +1 -0
- package/build/dist/{5525.de31026d71adb2710e2d.js → 1911.5aa26af472734c5f1eeb.js} +1 -1
- package/build/dist/2091.5bc71c19b26140f00a48.js +1 -0
- package/build/dist/2851.6570385ed3b21d196648.js +1 -0
- package/build/dist/3659.f0dbf1eed0113cfeb0d2.js +1 -0
- package/build/dist/4273.136e9e07974f8cf908fb.js +1 -0
- package/build/dist/4903.462bc1f01c560e64bdf7.js +1 -0
- package/build/dist/5877.2a6d9ae0adf051f7629c.js +1 -0
- package/build/dist/5937.979de5c0672a08eb3b95.js +1 -0
- package/build/dist/6247.b49e239cf64a04aa3d19.js +1 -0
- package/build/dist/676.59a6aae24e044a731ead.js +1 -0
- package/build/dist/8302.e0f4d085e33b3b95b7a3.js +1 -0
- package/build/dist/8319.128f3b2f957ae19a6bf0.js +1 -0
- package/build/dist/9546.6347224c95e4ea71ca9e.js +1 -0
- package/build/dist/index.html +1 -1
- package/build/dist/main.0e7ed35ca4d77c86e560.js +2 -0
- package/build/main.js +1 -1
- package/package.json +13 -1
- package/build/dist/1472.7d429a0e8931548d4c65.js +0 -1
- package/build/dist/2851.c01bf2e1b109ff793f26.js +0 -1
- package/build/dist/3659.ff38a32734bc4b554f75.js +0 -1
- package/build/dist/4273.7a89027ccab7190e4bb3.js +0 -1
- package/build/dist/4903.5b155e7515c60da8e838.js +0 -1
- package/build/dist/5877.c3b8656d543de13651a0.js +0 -1
- package/build/dist/5937.cb255300ad4ecacbf26a.js +0 -1
- package/build/dist/6247.1924073703e9a1ac779e.js +0 -1
- package/build/dist/676.7db44f7b39bd0a3be5a6.js +0 -1
- package/build/dist/8302.905f1799092f205f27a6.js +0 -1
- package/build/dist/8319.bb6c2314a1e97312bfc4.js +0 -1
- package/build/dist/9546.44f31dcf58d9b3761677.js +0 -1
- package/build/dist/main.1af9587a0d6db4cebacf.js +0 -2
- /package/build/dist/{main.1af9587a0d6db4cebacf.js.LICENSE.txt → main.0e7ed35ca4d77c86e560.js.LICENSE.txt} +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[6010,8302],{83277(e,t,n){n.d(t,{$j:()=>i,Lv:()=>s});class s{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 n of t)if(n.value===e)return n.label;return e}static have_label_by_v(e,t){if(!e||!t?.length)return!1;for(const n of t)if(n.value===e)return!0;return!1}}const o=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"):""}n.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,o])},77481(e,t,n){n.d(t,{S:()=>l,X:()=>a});var s=n(96540),o=n(61443),i=n(74848);function a(e){const[t,n]=s.useState([]),a=(0,s.useRef)(-1),[l,r]=(0,s.useState)(-1),[c,d]=(0,s.useState)(-1);(0,s.useEffect)(()=>{e.children?n(Array.isArray(e.children)?e.children:[e.children]):n(e.rows)},[e.rows,e.children]);const p=()=>{a.current=-1,r(-1),d(-1)};return(0,i.jsxs)("table",{children:[(0,i.jsx)("thead",{children:(0,i.jsx)("tr",{children:e.headers?.map((t,n)=>(0,i.jsx)("th",{children:e.filter&&(e.filter.column??0)===n?(0,i.jsxs)("div",{className:"table-th-filter",children:[(0,i.jsx)("span",{children:t}),(0,i.jsx)(o.l6,{value:e.filter.value,options:e.filter.options,onChange:e.filter.onChange,width:"auto",no_border:!0})]}):t},n))})}),(0,i.jsx)("tbody",{children:t.map((t,n)=>{const s=!!e.onRowDrag;return(0,i.jsx)("tr",{className:s?(l===n?"row-dragging":"")+(c===n?" row-drop-target":""):"",draggable:s,onContextMenu:()=>{e.handleContextMenu&&e.handleContextMenu(t)},onDragStart:e=>{s&&(a.current=n,r(n),e.dataTransfer.effectAllowed="move")},onDragOver:e=>{!s||a.current<0||(e.preventDefault(),e.dataTransfer.dropEffect="move",d(n))},onDrop:t=>{s&&(t.preventDefault(),(()=>{const t=a.current,n=c;p(),t<0||n<0||t===n||e.onRowDrag?.(t,n)})())},onDragEnd:p,children:t.map((n,s)=>{const o=s===t.length-1?"small":"";return(0,i.jsx)("td",{className:o,style:{width:e.width??"auto"},children:n},s)})},n)})})]})}function l(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))})}},29591(e,t,n){n.r(t),n.d(t,{default:()=>L});var s=n(86149),o=n(96540),i=n(85997),a=n(4412),l=n(34843),r=n(82893),c=n(75725),d=n(77481),p=n(61443),m=n(70447),u=n(34299),h=n(74848);var _=n(14284),x=n(53459),g=n(62042),v=n(7523),j=n(78247),f=n(23430),y=n(86090),w=n(14944),b=n(92275),C=n(88815),k=n(45907),A=n(12721),S=n(24659),I=n(83277);function L(){const{t:e}=(0,s.B)(),{initUserInfo:t}=(0,o.useContext)(v.F),n=[e("编号"),e("url"),e("是否开启"),e("key"),"model",e("更多属性"),e("备注")],L=[e("编号"),e("本地目录"),e("自动加载"),e("备注")],[$,K]=(0,o.useState)([]),[N,M]=(0,o.useState)([]),[O,P]=(0,o.useState)([]),[X,D]=(0,o.useState)(null),F=(0,o.useRef)(),V=(0,o.useRef)(!1),T=(0,o.useRef)(!1),[H,Y]=(0,o.useState)([]),[q,R]=(0,o.useState)(!1),[E,G]=(0,l.fp)(r.AG.prompt_card),[B,J]=(0,l.fp)(r.AG.user_base_info),[z,W]=(0,o.useState)(!1),Z=O.filter(e=>"http"!==(e.transport??"stdio")),U=O.filter(e=>"http"===e.transport),Q=[e("编号"),e("名称"),e("是否开启"),"command","args","cwd",e("tools|env"),e("备注")],ee=[e("编号"),e("名称"),e("是否开启"),e("endpoint"),e("tools|headers"),e("备注")],te=[e("编号"),e("提示词"),e("LLM编辑开关"),e("LLM编辑提示词"),e("编辑规则"),e("备注")],[ne,se]=(0,o.useState)([]),[oe,ie]=(0,o.useState)(!1),ae=function(){const[e,t]=(0,l.fp)(r.AG.prompt_card);return e=>{t({open:!0,title:"信息",context_div:(0,h.jsx)("div",{children:(0,h.jsx)(u.default,{context:e})})})}}(),{check_user_auth:le}=(0,j.MH)(),[re,ce]=(0,l.fp)(r.AG.editorSetting),de=(0,y.Zp)(),pe=(0,k.y)(),me=(0,S.K)(),ue=async()=>{const e=await _.jV.get("docs_on_get");e.code===x.m.Success&&W(e.data)};(0,o.useEffect)(()=>{(async()=>{const e=await _.XO.get("ai_agent_setting");e.code===x.m.Success&&K(e.data.models),await w.ws.addMsg(b.HK.ai_load_info,e=>{D(e.context)});const t=await w.ws.sendData(b.HK.ai_load_info,{});t?.context&&D(t.context);const n=await _.XO.get("ai_docs_setting");n.code===x.m.Success&&(F.current=n.data.param,n.data.list?.length&&M(n.data.list));const s=await _.XO.get("ai_mcp_setting");s.code===x.m.Success&&P(s.data.list??[]),await je(),ue();const o=await _.XO.get("ai_system_prompts");o.code===x.m.Success&&se(o.data??[]);const i=await _.XO.get("ai_long_term_memory_setting");i.code===x.m.Success&&ie(i.data?.open??!1)})()},[]);const he=(e="stdio")=>{const t="http"===e?{name:"",open:!1,note:"",transport:"http",endpoint:"",headers:"",stream:!1,timeout_ms:1e4}:{name:"",open:!1,command:"",args:"",cwd:"",env:"",note:"",transport:"stdio",timeout_ms:1e4};P([...O,t]),V.current=!0},_e=e=>{const t=O.indexOf(e);t<0||(O.splice(t,1),P([...O]),V.current=!0)},xe=e=>{P([...O,{...e,open:!1}]),V.current=!0},ge=async e=>{for(let e=0;e<$.length;e++)$[e].index=e;(await _.XO.post("ai_agent_setting/save",{models:e??$})).code===x.m.Success&&(0,g.SK)("保存成功")},ve=async e=>{for(let e=0;e<O.length;e++)O[e].index=e;(await _.XO.post("ai_mcp_setting/save",{list:e??O})).code===x.m.Success&&((0,g.SK)("保存成功"),V.current=!1,await je())},je=async()=>{const e=await _.XO.get("ai_mcp_tools");return e.code===x.m.Success?(Y(e.data??[]),e.data??[]):[]},fe=async e=>{R(!0);try{const t=await _.XO.post("ai_mcp_tools/reload",{index:e});if(t.code===x.m.Success)return await je(),(0,g.SK)("MCP工具加载成功"),t.data??null}finally{R(!1)}return null},ye=async(t,n,s,o)=>{const i=o??H.find(e=>e.index===n)??{index:n,key:`${n}`,name:t.name??"",note:t.note,transport:t.transport??"stdio",open:!!t.open,loaded:!1,tool_count:0,tools:[]},a=(i.tools??[]).map(t=>({id:t.runtime_name,title:t.tool_name,subtitle:t.description||e("无描述"),detail:t.display_name,meta:t.runtime_name}));G({open:!0,title:`${t.name||t.note||n} MCP工具`,context_div:(0,h.jsx)(A.O,{title:`${t.name||t.note||n} MCP工具`,subtitle:`${i.transport??"stdio"} | ${i.open?e("是"):e("否")} | ${i.loaded?"loaded":"idle"} | ${i.tool_count} tools`,pages:a,initialPageId:s,onRefresh:async()=>{const e=await fe(n);e&&await ye(t,n,s,e)},renderPage:t=>{if(!t)return(0,h.jsx)("div",{className:"prompt-switch-page__empty",children:e("暂无工具")});const n=i.tools?.find(e=>e.runtime_name===t.id);return n?(0,h.jsxs)("div",{className:"prompt-switch-page__detail",children:[(0,h.jsx)("div",{className:"prompt-switch-page__detail-title",children:n.display_name}),(0,h.jsx)("div",{className:"prompt-switch-page__detail-desc",children:n.description||e("无描述")}),(0,h.jsxs)("div",{className:"prompt-switch-page__detail-row",children:[(0,h.jsx)("strong",{children:"runtime:"})," ",n.runtime_name]}),(0,h.jsxs)("div",{children:[(0,h.jsx)("strong",{children:"schema:"}),(0,h.jsx)("pre",{className:"prompt-switch-page__schema",children:JSON.stringify(n.input_schema??{},null,2)})]})]}):(0,h.jsx)("div",{className:"prompt-switch-page__empty",children:e("暂无工具")})}}),cancel:()=>G({open:!1})})},we=async e=>{for(let e=0;e<$.length;e++)$[e].index=e;let t={list:N,docs_update_tag:T.current};null!=e&&(t={param:e}),T.current=!1;(await _.XO.post("ai_docs_setting_save",t)).code===x.m.Success&&(0,g.SK)("保存成功")},be=async()=>{for(let e=0;e<ne.length;e++)ne[e].index=e;(await _.XO.post("ai_system_prompts/save",{list:ne})).code===x.m.Success&&(0,g.SK)("保存成功")};return(0,h.jsxs)("div",{children:[(0,h.jsx)(a.aZ,{position:"right",children:le(f.oV.ai_agent_setting)&&(0,h.jsx)(i.rA,{icon:"arrow_back",title:e("上一页"),onClick:()=>{de(-1)}})}),(0,h.jsx)(c.jW,{isFull:!0,more:!0,children:(0,h.jsx)(c.NN,{children:(0,h.jsxs)(c.xh,{children:[(0,h.jsx)(c.fI,{children:(0,h.jsx)(c.VP,{widthPer:100,children:(0,h.jsx)(m.uF,{self_title:(0,h.jsxs)("span",{className:" div-row ",children:[(0,h.jsx)("h2",{children:e("Model")+" "+e("设置")})," ",(0,h.jsx)(i.rA,{icon:"info",onClick:()=>{ae('\n1. Only OpenAI-style AI APIs are supported. Fill in the FULL endpoint path (not just the domain), e.g. https://ark.cn-beijing.volces.com/api/v3/chat/completions\n2. The longer the conversation history, the more expensive the LLM token cost. Currently, there is no long-term memory simplification capability. You can set the system prompt to make the AI answer more concisely to save tokens\n3. When writing the model request parameter JSON, you can only write JSON in it, to configure the attributes supported by OpenAI-style AI, such as temperature, thinking (Doubao\'s deep thinking toggle), etc.\n4. You can enable "stream": true in the model request parameters to improve response speed.\n5. Deep thinking currently affects output speed. It is recommended to set { "thinking" : { "type":"disabled" } } to disable it (Doubao example).\n6. To use the AI feature to query server information, the AI needs to be able to know some commands. You need to first set command permissions for the user in user settings. It is recommended to set * to allow all commands, and then set the dangerous commands that are not allowed to be executed in the settings\n7. The model type and Become Tool are now both configured in "More Attributes → Extra Parameter Settings" using request_type / tool_mode (comments are already provided in the editor).\n8. After becoming a tool, the model will be loaded as a tool, enabling different models to serve as different roles; please do not set both it and "Enabled" to true at the same time.\n')},title:"信息"})]}),titleCom:(0,h.jsxs)("div",{children:[(0,h.jsx)(i.rA,{icon:"add",title:e("添加"),onClick:()=>{K([...$,{note:"",open:!1,path:"",dotenv:I.CP,json_params:I.cL}])}}),(0,h.jsx)(i.rA,{icon:"save",title:e("保存"),onClick:async()=>{await ge()}})]}),children:(0,h.jsx)(d.X,{headers:n,rows:$.map((t,n)=>{const s=[(0,h.jsx)("div",{children:n}),(0,h.jsx)(p.Sm,{value:I.Lv.get_label_by_v(t.url,t.show_options?.options_agent_url_list),options:t.show_options?.options_agent_url_list,handleInputChange:e=>{t.url=e},no_border:!0}),(0,h.jsx)(p.l6,{value:t.open,onChange:e=>{((e,t,n)=>{const s=[];for(let e=0;e<$.length;e++)$[e].open=e===n&&t,s.push($[e]);K(s)})(0,e,n)},options:me,no_border:!0}),(0,h.jsx)(p.Sm,{type:I.Lv.have_label_by_v(t.token,t.show_options?.options_agent_key_list)?null:"password",value:I.Lv.get_label_by_v(t.token,t.show_options?.options_agent_key_list),options:t.show_options?.options_agent_key_list,handleInputChange:e=>{t.token=e},no_border:!0}),(0,h.jsx)(p.Sm,{value:I.Lv.get_label_by_v(t.model,t.show_options?.options_agent_model_list),options:t.show_options?.options_agent_model_list,handleInputChange:e=>{t.model=e},no_border:!0}),(0,h.jsxs)("div",{children:[(0,h.jsx)(i.rA,{icon:"short_text",title:"prompt",onClick:()=>{j.xK.set_value_temp($[n].sys_prompt??""),ce({model:"ace/mode/text",open:!0,fileName:"",save:async e=>{$[n].sys_prompt=e,K($),j.xK.set_value_temp(""),ge($)}})}}),(0,h.jsx)(i.rA,{icon:"edit_attributes",title:"model请求参数json编写",onClick:()=>{j.xK.set_value_temp($[n].json_params),ce({model:"ace/mode/json",open:!0,fileName:"",save:async e=>{$[n].json_params=e,K($),j.xK.set_value_temp(""),ge($)},can_format:!0})}}),(0,h.jsx)(i.rA,{icon:"settings",title:"额外参数设置",onClick:()=>{j.xK.set_value_temp($[n].dotenv),ce({model:"ace/mode/ini",open:!0,fileName:"",save:async e=>{$[n].dotenv=e,K($),j.xK.set_value_temp(""),ge($)}})}})]}),(0,h.jsx)(p.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,h.jsxs)("div",{children:[(0,h.jsx)(i.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{$.splice(e,1),K([...$])})(n)}),(0,h.jsx)(i.rA,{icon:"copy_all",title:e("复制"),onClick:()=>(e=>{K([...$,{...$[e],open:!1}])})(n)})]})];return s}),width:"10rem"})})})}),(0,h.jsx)(c.fI,{children:(0,h.jsx)(c.VP,{widthPer:70,children:(0,h.jsx)(m.uF,{self_title:(0,h.jsxs)("span",{className:" div-row ",children:[(0,h.jsxs)("h2",{children:[e("MCP")+" "+e("设置")," - stdio"]})," ",(0,h.jsx)(i.rA,{icon:"info",onClick:()=>{ae("\n1. 这里配置的是 MCP Client 启动参数,当前实现的是 stdio 模式,也就是通过 command + args 启动本地 MCP Server\n2. 例如可以填 npx / uvx / python 等命令,再配合对应的 MCP server 包参数\n3. 保存后会自动重新加载 MCP 工具,agent 聊天时会把这些工具一起带给模型\n4. 建议把 cwd 配到具体项目目录,避免 server 在错误目录里运行\n")},title:"信息"})]}),titleCom:(0,h.jsxs)("div",{children:[(0,h.jsx)(i.rA,{icon:"add",title:e("添加"),onClick:()=>he("stdio")}),(0,h.jsx)(i.rA,{icon:"save",title:e("保存"),onClick:()=>{ve()}})]}),children:(0,h.jsx)(d.X,{headers:Q,rows:Z.map((t,n)=>{const s=O.indexOf(t);return[(0,h.jsx)("div",{children:n}),(0,h.jsx)(p.Sm,{value:t.name,handleInputChange:e=>{t.name=e,V.current=!0},no_border:!0}),(0,h.jsx)(p.l6,{value:t.open,onChange:e=>{t.open=e,P([...O]),V.current=!0},options:me,no_border:!0}),(0,h.jsx)(p.Sm,{value:t.command,handleInputChange:e=>{t.command=e,V.current=!0},no_border:!0}),(0,h.jsx)(p.Sm,{value:t.args,handleInputChange:e=>{t.args=e,V.current=!0},no_border:!0}),(0,h.jsx)(p.Sm,{value:t.cwd,handleInputChange:e=>{t.cwd=e,V.current=!0},no_border:!0}),(0,h.jsxs)("div",{children:[(0,h.jsx)(i.rA,{icon:"visibility",title:"查看工具",onClick:()=>{ye(t,s)}}),(0,h.jsx)(i.rA,{icon:"settings",title:"env",onClick:()=>{j.xK.set_value_temp(t.env??""),ce({model:"ace/mode/ini",open:!0,fileName:"",save:async e=>{t.env=e,P([...O]),j.xK.set_value_temp(""),V.current=!0,ve()}})}})]}),(0,h.jsx)(p.Sm,{value:t.note,handleInputChange:e=>{t.note=e,V.current=!0},no_border:!0}),(0,h.jsxs)("div",{children:[(0,h.jsx)(i.rA,{icon:"delete",title:e("删除"),onClick:()=>_e(t)}),(0,h.jsx)(i.rA,{icon:"copy_all",title:e("复制"),onClick:()=>xe(t)})]})]}),width:"10rem"})})})}),(0,h.jsx)(c.fI,{children:(0,h.jsxs)(c.VP,{widthPer:70,children:[(0,h.jsx)(m.uF,{self_title:(0,h.jsxs)("span",{className:" div-row ",children:[(0,h.jsxs)("h2",{children:[e("MCP")+" "+e("设置")," - HTTP"]})," "]}),titleCom:(0,h.jsxs)("div",{children:[(0,h.jsx)(i.rA,{icon:"add",title:e("添加"),onClick:()=>he("http")}),(0,h.jsx)(i.rA,{icon:"save",title:e("保存"),onClick:()=>{ve()}})]}),children:(0,h.jsx)(d.X,{headers:ee,rows:U.map((t,n)=>{const s=O.indexOf(t);return[(0,h.jsx)("div",{children:n}),(0,h.jsx)(p.Sm,{value:t.name,handleInputChange:e=>{t.name=e,V.current=!0},no_border:!0}),(0,h.jsx)(p.l6,{value:t.open,onChange:e=>{t.open=e,P([...O]),V.current=!0},options:me,no_border:!0}),(0,h.jsx)(p.Sm,{value:t.endpoint,handleInputChange:e=>{t.endpoint=e,V.current=!0},no_border:!0}),(0,h.jsxs)("div",{children:[(0,h.jsx)(i.rA,{icon:"visibility",title:"查看工具",onClick:()=>{ye(t,s)}}),(0,h.jsx)(i.rA,{icon:"settings",title:"headers",onClick:()=>{j.xK.set_value_temp(t.headers??""),ce({model:"ace/mode/ini",open:!0,fileName:"",save:async e=>{t.headers=e,P([...O]),j.xK.set_value_temp(""),V.current=!0,ve()}})}})]}),(0,h.jsx)(p.Sm,{value:t.note,handleInputChange:e=>{t.note=e,V.current=!0},no_border:!0}),(0,h.jsxs)("div",{children:[(0,h.jsx)(i.rA,{icon:"delete",title:e("删除"),onClick:()=>_e(t)}),(0,h.jsx)(i.rA,{icon:"copy_all",title:e("复制"),onClick:()=>xe(t)})]})]}),width:"10rem"})}),(0,h.jsx)(m.uF,{self_title:(0,h.jsxs)("span",{className:" div-row ",children:[(0,h.jsx)("h2",{children:e("系统会话提示词")})," ",(0,h.jsx)(i.rA,{icon:"info",onClick:()=>{ae('\n1. 系统会话提示词,在 AI 聊天页创建会话时可以选择,选中的提示词会自动填入聊天框作为第一条系统消息\n2. 适用于预先设定常用的会话场景模板,如"代码审查"、"翻译助手"、"运维诊断"等\n3. "LLM编辑开关":开启后,当用户选择了该系统提示词发起对话时,AI 将会获得一个"更新会话提示词"工具,允许 AI 在对话中对当前会话进行总结,并写入到本提示词的"LLM编辑提示词"字段(全局保存,供之后的新会话沿用),使 AI 能自我维护长期上下文。\n4. "LLM编辑提示词":可选。AI 编辑后写回的内容(可预填初始方向)。仅在"LLM编辑开关"开启时生效。\n5. "编辑规则":可选。给 LLM 的编辑要求,例如"总结时不要超过 300 token"、"用简洁的项目要点记录"等。仅在"LLM编辑开关"开启时生效。\n')},title:"信息"})]}),titleCom:(0,h.jsxs)("div",{children:[(0,h.jsx)(i.rA,{icon:"add",title:e("添加"),onClick:()=>{se([...ne,{prompt:"",note:"",llm_prompt_enable:!1}])}}),(0,h.jsx)(i.rA,{icon:"save",title:e("保存"),onClick:()=>{be()}})]}),children:(0,h.jsx)(d.X,{headers:te,rows:ne.map((t,n)=>{const s=[(0,h.jsx)("div",{children:n}),(0,h.jsx)("div",{children:(0,h.jsx)(i.rA,{icon:"short_text",title:e("提示词"),onClick:()=>{j.xK.set_value_temp(t.prompt??""),ce({model:"ace/mode/text",open:!0,fileName:"",save:async e=>{t.prompt=e,se([...ne]),j.xK.set_value_temp(""),be()}})}})}),(0,h.jsx)(i.Ay,{checked:!!t.llm_prompt_enable,onChange:e=>{t.llm_prompt_enable=e,se([...ne])},title:e("LLM编辑开关")}),(0,h.jsx)("div",{children:(0,h.jsx)(i.rA,{icon:"edit_note",title:e("LLM编辑提示词"),onClick:()=>{j.xK.set_value_temp(t.llm_prompt??""),ce({model:"ace/mode/text",open:!0,fileName:"",save:async e=>{t.llm_prompt=e,se([...ne]),j.xK.set_value_temp(""),be()}})}})}),(0,h.jsx)("div",{children:(0,h.jsx)(i.rA,{icon:"rule",title:e("编辑规则"),onClick:()=>{j.xK.set_value_temp(t.llm_prompt_tip??""),ce({model:"ace/mode/text",open:!0,fileName:"",save:async e=>{t.llm_prompt_tip=e,se([...ne]),j.xK.set_value_temp(""),be()}})}})}),(0,h.jsx)(p.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,h.jsx)("div",{children:(0,h.jsx)(i.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{ne.splice(e,1),se([...ne])})(n)})})];return s}),width:"10rem"})}),(0,h.jsx)(m.uF,{self_title:(0,h.jsxs)("span",{className:" div-row ",children:[(0,h.jsx)("h2",{children:e("长期记忆")})," ",(0,h.jsx)(i.rA,{icon:"info",onClick:()=>{ae(e("开启后跨会话保存记忆。四个固定文件:周/月/年/永久。每周结束自动压缩周→月,每月结束自动压缩月→年,每年结束自动压缩年→永久。编辑按钮可手动查看和修改。"))},title:"信息"})]}),titleCom:(0,h.jsx)("div",{children:(0,h.jsx)(i.Ay,{checked:oe,onChange:async t=>{ie(t),await _.XO.post("ai_long_term_memory_setting/save",{open:t}),(0,g.SK)(e("长期记忆设置已保存"))},title:e("开关")})}),children:(0,h.jsx)("div",{style:{display:"flex",gap:"0.5rem",padding:"0.5rem 0",flexWrap:"wrap"},children:[{type:"week",label:e("周记忆"),tip:e("上限3000字")},{type:"month",label:e("月记忆"),tip:e("上限6000字")},{type:"year",label:e("年记忆"),tip:e("上限9000字")},{type:"forever",label:e("永久记忆"),tip:e("上限12000字")}].map(({type:t,label:n,tip:s})=>(0,h.jsx)(i.rA,{icon:"edit",title:`${e("编辑")} ${n} (${s})`,onClick:async()=>{const s=await _.XO.get(`ai_long_term_memory_bucket/${t}`),o=s.code===x.m.Success?s.data??"":"";j.xK.set_value_temp(o),ce({model:"ace/mode/text",open:!0,fileName:`long_term_memory_${t}.txt`,save:async s=>{await _.XO.post(`ai_long_term_memory_bucket/${t}/save`,{data:s}),j.xK.set_value_temp(""),(0,g.SK)(`${n} ${e("已保存")}`)}})}},t))})})]})}),(0,h.jsxs)(c.fI,{children:[(0,h.jsx)(c.VP,{widthPer:50,children:(0,h.jsx)(m.uF,{self_title:(0,h.jsxs)("span",{className:" div-row ",children:[(0,h.jsx)("h2",{children:e("本地知识库")})," ",(0,h.jsx)(i.rA,{icon:"info",onClick:()=>{ae("\n1. 本地知识库用于为AI增强理解能力,或者分析本地文件,原理读取本地的文件,对文件在内存中建立全文索引,为AI提供额外数据(需要有模型开启才能使用)\n2. 该功能只能用于小型知识库,作为本地小型或者公司内部资料使用还是没有问题的\n3. 每次保存都会重新加载知识库中的文件,不会全部重新加载,而是检测哪些文件有变更\n")},title:"信息"})]}),titleCom:(0,h.jsxs)("div",{children:[(0,h.jsx)(i.Ay,{checked:z,onChange:async e=>{await _.jV.post("docs_on_set",{status:e}),ue(),t()},title:e("知识库开关")}),(0,h.jsx)(i.rA,{icon:"settings",title:"额外参数设置",onClick:()=>{j.xK.set_value_temp(F.current),ce({model:"ace/mode/ini",open:!0,fileName:"",save:async e=>{F.current=e,j.xK.set_value_temp(""),we(F.current)}})}}),(0,h.jsx)(i.rA,{icon:"add",title:e("添加"),onClick:()=>{M([...N,{note:"",auto_load:!1,dir:""}]),T.current=!0}}),(0,h.jsx)(i.rA,{icon:"save",title:e("保存"),onClick:()=>{we()}})]}),children:(0,h.jsx)(d.X,{headers:L,rows:N.map((t,n)=>{const s=[(0,h.jsx)("div",{children:n}),(0,h.jsx)(p.Sm,{value:t.dir,handleInputChange:e=>{t.dir=e,T.current=!0},no_border:!0}),(0,h.jsx)(p.l6,{value:t.auto_load,onChange:e=>{t.auto_load=e,M([...N]),T.current=!0},options:me,no_border:!0}),(0,h.jsx)(p.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,h.jsxs)("div",{children:[(0,h.jsx)(i.rA,{icon:"delete",title:e("删除记录"),onClick:()=>(e=>{N.splice(e,1),M([...N]),T.current=!0})(n)}),(0,h.jsx)(i.rA,{icon:"restore",title:e("手动加载"),onClick:()=>{pe({sub_title:"手动加载",confirm_fun:()=>{_.jV.post("ai_load_one_file",{param_path:t.dir}),(0,g.SK)("ok")}})}}),(0,h.jsx)(i.rA,{icon:"delete_forever",title:e("从索引删除"),onClick:()=>{pe({sub_title:"从索引删除",confirm_fun:()=>{_.jV.post("ai_del",{param_path:t.dir}),(0,g.SK)("ok")}})}})]})];return s}),width:"10rem"})})}),X&&(0,h.jsx)(c.VP,{widthPer:50,children:(0,h.jsxs)(m.Zp,{title:e("知识库加载信息"),children:[(0,h.jsx)(c.Yh,{left:e("最近一次加载")+","+e("加载进度"),right:X?.progress}),(0,h.jsx)(c.Yh,{left:`${e("最近一次加载")},${e("总文件数量")}`,right:X?.num}),(0,h.jsx)(c.Yh,{left:`${e("最近一次加载")},${e("总文件字符数量")}`,right:X?.char_num}),(0,h.jsx)(c.Yh,{left:`${e("最近一次加载")},${e("总文件大小")}`,right:(0,C.v7)(X?.size)}),(0,h.jsx)(c.Yh,{left:`${e("最近一次加载")},${e("总耗时")}`,right:(0,C.a3)(X?.consume_time_ms_len)}),(0,h.jsx)(c.Yh,{left:`${e("总文件数量")}`,right:X?.total_num})]})})]})]})})})]})}},34299(e,t,n){n.r(t),n.d(t,{default:()=>_});n(96540);var s=n(22091),o=n(53995),i=n(18569),a=n(77979),l=n(8263),r=n(69428),c=n.n(r),d=(n(3775),n(21499)),p=n(99214),m=n(19878),u=(n(72411),n(74848));const h=new s.A({html:!0,highlight:function(e,t){if(t&&m.A.getLanguage(t))try{return`<pre class="hljs code-block-with-copy"><code class="hljs language-${t}">${m.A.highlight(e,{language:t}).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>${h.utils.escapeHtml(e)}</code></pre>`}});function _(e){return(0,p.VD)(),(0,u.jsx)("div",{dangerouslySetInnerHTML:{__html:h.render(e.context)}})}h.use(o.A).use(i.A).use(a.A).use(l.A).use(c()).use(e=>{e.renderer.rules.fence;e.renderer.rules.fence=(t,n,s,o,i)=>{const a=t[n],l=a.content.trim(),r=a.info.trim();let c="";if(r&&m.A.getLanguage(r))try{c=m.A.highlight(l,{language:r}).value}catch(t){c=e.utils.escapeHtml(l)}else try{c=m.A.highlightAuto(l).value}catch(t){c=e.utils.escapeHtml(l)}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(l)}">复制</button>\n </div>\n <pre><code class="hljs ${r?`language-${r}`:""}">${c}</code></pre>\n </div>`}}).use(e=>{const t=e.renderer.rules.link_open||function(e,t,n,s,o){return o.renderToken(e,t,n)};e.renderer.rules.link_open=(e,n,s,o,i)=>{const a=e[n],l=a.attrIndex("href");if(l>=0){const e=a.attrs[l][1];a.attrs[l][1]=(0,d.bi)(window.location.href,e)}return t(e,n,s,o,i)}})},45907(e,t,n){n.d(t,{y:()=>i});var s=n(34843),o=n(82893);function i(){const[e,t]=(0,s.fp)(o.AG.confirm);return({sub_title:e,confirm_fun:n,title:s,context_div:o})=>{t({open:!0,sub_title:e,handle:()=>{n(),t({open:!1,handle:null})},title:s,context_div:o})}}},24659(e,t,n){var s=n(86149);n.d(t,["K",0,()=>{const{t:e}=(0,s.B)();return[{title:e("是"),value:!0,color:"#28a745"},{title:e("否"),value:!1,color:"#666666"}]}])},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>"}}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[8319],{77481(e,t,n){n.d(t,{S:()=>a,X:()=>i});var s=n(96540),r=n(61443),l=n(74848);function i(e){const[t,n]=s.useState([]),i=(0,s.useRef)(-1),[a,c]=(0,s.useState)(-1),[o,d]=(0,s.useState)(-1);(0,s.useEffect)(()=>{e.children?n(Array.isArray(e.children)?e.children:[e.children]):n(e.rows)},[e.rows,e.children]);const h=()=>{i.current=-1,c(-1),d(-1)};return(0,l.jsxs)("table",{children:[(0,l.jsx)("thead",{children:(0,l.jsx)("tr",{children:e.headers?.map((t,n)=>(0,l.jsx)("th",{children:e.filter&&(e.filter.column??0)===n?(0,l.jsxs)("div",{className:"table-th-filter",children:[(0,l.jsx)("span",{children:t}),(0,l.jsx)(r.l6,{value:e.filter.value,options:e.filter.options,onChange:e.filter.onChange,width:"auto",no_border:!0})]}):t},n))})}),(0,l.jsx)("tbody",{children:t.map((t,n)=>{const s=!!e.onRowDrag;return(0,l.jsx)("tr",{className:s?(a===n?"row-dragging":"")+(o===n?" row-drop-target":""):"",draggable:s,onContextMenu:()=>{e.handleContextMenu&&e.handleContextMenu(t)},onDragStart:e=>{s&&(i.current=n,c(n),e.dataTransfer.effectAllowed="move")},onDragOver:e=>{!s||i.current<0||(e.preventDefault(),e.dataTransfer.dropEffect="move",d(n))},onDrop:t=>{s&&(t.preventDefault(),(()=>{const t=i.current,n=o;h(),t<0||n<0||t===n||e.onRowDrag?.(t,n)})())},onDragEnd:h,children:t.map((n,s)=>{const r=s===t.length-1?"small":"";return(0,l.jsx)("td",{className:r,style:{width:e.width??"auto"},children:n},s)})},n)})})]})}function a(e){return(0,l.jsx)("div",{style:{display:e.isFlex?"flex":"block"},children:e.columns.map((e,t)=>(0,l.jsx)("div",{children:e},t))})}},28319(e,t,n){n.r(t),n.d(t,{default:()=>C,defaultSqlPreset:()=>w});var s=n(96540),r=n(86149),l=n(4412),i=n(85997),a=n(75725),c=n(77481),o=n(70447),d=n(61443),h=n(34843),u=n(82893),x=n(14284),f=n(23496),p=n(53459),j=n(62042),v=n(7523),m=n(78247),_=n(86090),g=n(74848);function w(e){return{index:0,note:e("查询全部表"),sql:"SELECT name, type FROM sqlite_master WHERE type='table';"}}const S='# 可选:设置 SQL 中的"替换词"(在查询页选中该预设后,会显示输入框)\n# 例子:SQL 为 SELECT * FROM t WHERE id = 123456 ,请填写下面的 find=123456\n# 这样查询页输入新值即可把 SQL 中的 123456 替换掉后再查询\nfind=';function C(){const{t:e}=(0,r.B)(),{initUserInfo:t}=(0,s.useContext)(v.F),[,n]=(0,h.fp)(u.AG.editorSetting),[C]=(0,h.fp)(u.AG.user_base_info),b=(0,_.Zp)(),q=s.useRef(-1),[E,k]=(0,s.useState)([]);(0,s.useEffect)(()=>{const t=C?.user_data?.sql_preset_list;k(t?.length?[...t]:[w(e)])},[e,C?.user_data?.sql_preset_list]);const y=async()=>{const n=E.map((e,t)=>({...e,index:t})),s=await x.wm.post(f.s.user_save_private_attr,{is_sql_preset:!0,sql_preset_list:n});s?.code===p.m.Success&&(await t(),(0,j.SK)(e("保存成功")))},A=(e,t)=>{q.current=e;const s=E[e][t]??"";m.xK.set_value_temp(s),n({model:"sql"===t?"ace/mode/sql":"ace/mode/ini",open:!0,fileName:"",save:async e=>{E[q.current][t]=e,k([...E]),m.xK.set_value_temp(""),y()}})},D=[e("编号"),e("备注"),e("SQL代码"),e("env编辑"),e("操作")];return(0,g.jsxs)("div",{children:[(0,g.jsx)(l.aZ,{position:"right",children:(0,g.jsx)(i.rA,{icon:"arrow_back",title:e("返回"),onClick:()=>b(-1)})}),(0,g.jsx)(a.jW,{isFull:!0,more:!0,children:(0,g.jsx)(a.NN,{children:(0,g.jsx)(a.xh,{children:(0,g.jsx)(a.fI,{children:(0,g.jsx)(a.VP,{widthPer:60,children:(0,g.jsx)(o.uF,{self_title:(0,g.jsx)("span",{className:"div-row",children:(0,g.jsx)("h2",{children:e("SQL 预设")})}),titleCom:(0,g.jsxs)("div",{className:"db-query-setting__toolbar",children:[(0,g.jsx)(i.rA,{icon:"add",title:e("添加"),onClick:()=>k([...E,{note:"",sql:"",env:S}])}),(0,g.jsx)(i.rA,{icon:"save",title:e("保存"),onClick:()=>y()})]}),children:(0,g.jsx)(c.X,{headers:D,rows:E.map((t,n)=>[(0,g.jsx)("div",{children:n+1}),(0,g.jsx)(d.Sm,{value:t.note,no_border:!0,placeholder:e("备注"),handleInputChange:e=>{t.note=e,k([...E])}}),(0,g.jsx)("div",{children:(0,g.jsx)(i.rA,{icon:"short_text",title:e("编辑SQL"),onClick:()=>A(n,"sql")})}),(0,g.jsx)("div",{children:(0,g.jsx)(i.rA,{icon:"settings",title:e("env编辑"),onClick:()=>A(n,"env")})}),(0,g.jsx)("div",{children:(0,g.jsx)(i.rA,{icon:"delete",title:e("删除"),onClick:()=>{E.splice(n,1),k([...E])}})})]),width:"8rem"})})})})})})})]})}n.d(t,["sqlEnvDefault",0,S])}}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[9546],{75007(e,t,s){s.d(t,{h:()=>r});s(96540);var n=s(85997),i=s(74848);function r(e){return(0,i.jsxs)("h2",{className:"message",children:[(0,i.jsx)(n.In,{icon:"sentiment_dissatisfied"}),(0,i.jsx)("span",{children:e.context})]})}},22081(e,t,s){var n=s(96540),i=s(16349),r=s(74848);const o=({percentage:e})=>{const t=(0,n.useRef)(null),[s,o]=(0,n.useState)(null);return(0,n.useEffect)(()=>{const s=t.current.getContext("2d"),n=new i.Ay(s,{type:"doughnut",data:{labels:["use","left"],datasets:[{data:[e,100-e],backgroundColor:["#007bff","#f0f0f0"],borderWidth:0}]},options:{plugins:{legend:{display:!1},tooltip:{enabled:!1}},elements:{arc:{borderWidth:0}}}});return o(n),()=>{n.destroy()}},[]),(0,n.useEffect)(()=>{s&&(s.data.datasets[0].data=[e,100-e],s.update())},[e]),(0,r.jsx)("div",{style:{width:"8rem",overflow:"hidden"},children:(0,r.jsx)("canvas",{ref:t})})};s.d(t,["A",0,o])},77481(e,t,s){s.d(t,{S:()=>c,X:()=>o});var n=s(96540),i=s(61443),r=s(74848);function o(e){const[t,s]=n.useState([]),o=(0,n.useRef)(-1),[c,l]=(0,n.useState)(-1),[a,d]=(0,n.useState)(-1);(0,n.useEffect)(()=>{e.children?s(Array.isArray(e.children)?e.children:[e.children]):s(e.rows)},[e.rows,e.children]);const u=()=>{o.current=-1,l(-1),d(-1)};return(0,r.jsxs)("table",{children:[(0,r.jsx)("thead",{children:(0,r.jsx)("tr",{children:e.headers?.map((t,s)=>(0,r.jsx)("th",{children:e.filter&&(e.filter.column??0)===s?(0,r.jsxs)("div",{className:"table-th-filter",children:[(0,r.jsx)("span",{children:t}),(0,r.jsx)(i.l6,{value:e.filter.value,options:e.filter.options,onChange:e.filter.onChange,width:"auto",no_border:!0})]}):t},s))})}),(0,r.jsx)("tbody",{children:t.map((t,s)=>{const n=!!e.onRowDrag;return(0,r.jsx)("tr",{className:n?(c===s?"row-dragging":"")+(a===s?" row-drop-target":""):"",draggable:n,onContextMenu:()=>{e.handleContextMenu&&e.handleContextMenu(t)},onDragStart:e=>{n&&(o.current=s,l(s),e.dataTransfer.effectAllowed="move")},onDragOver:e=>{!n||o.current<0||(e.preventDefault(),e.dataTransfer.dropEffect="move",d(s))},onDrop:t=>{n&&(t.preventDefault(),(()=>{const t=o.current,s=a;u(),t<0||s<0||t===s||e.onRowDrag?.(t,s)})())},onDragEnd:u,children:t.map((s,n)=>{const i=n===t.length-1?"small":"";return(0,r.jsx)("td",{className:i,style:{width:e.width??"auto"},children:s},n)})},s)})})]})}function c(e){return(0,r.jsx)("div",{style:{display:e.isFlex?"flex":"block"},children:e.columns.map((e,t)=>(0,r.jsx)("div",{children:e},t))})}},88062(e,t,s){s(96540),s(47022);var n=s(74848);function i(e){return(0,n.jsx)("div",{className:"black-tip",onClick:()=>{e.click&&e.click(e)},onContextMenu:t=>{t.stopPropagation(),t.nativeEvent.stopImmediatePropagation(),e.onContextMenu&&e.onContextMenu(t,e)},children:e.name})}const r=e=>(0,n.jsxs)("li",{children:[e.click?(0,n.jsx)(i,{...e.node,name:e.render?e.render(e.node):e.node.name,click:e.click,onContextMenu:e.onContextMenu}):(0,n.jsx)("div",{children:e.render?e.render(e.node):e.node.name}),e.node.children&&e.node.children.length>0&&(0,n.jsx)("ul",{children:e.node.children.map((t,s)=>(0,n.jsx)(r,{node:t,click:e.click,onContextMenu:e.onContextMenu,render:e.render},s))})]}),o=e=>(0,n.jsx)("div",{className:"card-tree-view",children:(0,n.jsx)("ul",{children:e.list&&e.list.map((t,s)=>(0,n.jsx)(r,{node:t,click:e.click,onContextMenu:e.onContextMenu,render:e.render},s))})});s.d(t,["A",0,o])},59546(e,t,s){s.r(t),s.d(t,{default:()=>ce});var n=s(96540),i=s(75725),r=s(70447),o=s(22081),c=s(92275),l=s(14944),a=s(14284),d=s(4412),u=s(85997),h=s(77481),x=s(53459),p=s(86149),m=s(34843),j=s(82893),f=s(74777),_=s(62042),g=s(61443),w=s(74848);function y(e){const{t}=(0,p.B)(),[s,o]=(0,m.fp)(j.AG.disk),[c,l]=(0,n.useState)({}),[f,_]=(0,n.useState)([]),g=[t("名字"),t("当前值"),t("历史最低"),t("临界值")];return(0,n.useEffect)(()=>{(async()=>{const s=await a.Yu.post("sys/disk/info",{name:e.name});if(s.code===x.m.Success){const e=[];for(const n of s.data.ata_smart_attributes??[]){let s;n[1]>=n[2]?s="var(--icon-green)":n[1]<=n[3]&&(s="var(--icon-red)"),n[0]=(0,w.jsx)("span",{style:{color:s},children:t(n[0])}),e.push(n)}_(s.data.ata_smart_attributes),l(s.data)}})()},[]),(0,w.jsxs)("div",{children:[(0,w.jsx)(d.aZ,{position:"right",children:(0,w.jsx)(u.rA,{icon:"close",title:t("关闭"),onClick:()=>{o({})}})}),(0,w.jsx)(i.jW,{isFull:!0,more:!0,children:(0,w.jsx)(i.NN,{children:(0,w.jsxs)(i.fI,{children:[(0,w.jsxs)(i.VP,{widthPer:30,children:[(0,w.jsx)(i.xh,{children:(0,w.jsxs)(r.Zp,{title:t("基本信息"),children:[(0,w.jsx)(i.Yh,{left:t("名字"),right:e.name}),(0,w.jsx)(i.Yh,{left:t("厂商名称"),right:e.typeName}),(0,w.jsx)(i.Yh,{left:t("类型"),right:e.type}),(0,w.jsx)(i.Yh,{left:t("容量"),right:e.total})]})}),(0,w.jsx)(i.xh,{children:(0,w.jsxs)(r.Zp,{title:t("物理信息"),children:[(0,w.jsx)(i.Yh,{left:t("是否健康"),right:!0===c.smart_status?"是":"否"}),(0,w.jsx)(i.Yh,{left:t("设备型号"),right:c.model_name}),(0,w.jsx)(i.Yh,{left:t("序列号"),right:c.serial_number}),(0,w.jsx)(i.Yh,{left:t("固件版本"),right:c.firmware_version}),(0,w.jsx)(i.Yh,{left:t("转速(每分钟)"),right:c.rotation_rate}),(0,w.jsx)(i.Yh,{left:t("通电时长(小时)"),right:c.power_on_time_hours}),(0,w.jsx)(i.Yh,{left:t("通电次数"),right:c.power_cycle_count}),(0,w.jsx)(i.Yh,{left:t("温度(°C)"),right:c.temperature}),(0,w.jsx)(i.Yh,{left:t("通信协议"),right:c.device_protocol})]})})]}),(0,w.jsx)(i.VP,{widthPer:50,children:(0,w.jsxs)(i.xh,{children:[f?.length?(0,w.jsx)(r.uF,{title:t("ATA/SATA详细信息"),children:(0,w.jsx)(h.X,{headers:g,rows:f,width:"10rem"})}):(0,w.jsx)(w.Fragment,{}),c.nvme_smart?(0,w.jsxs)(r.Zp,{title:t("NVME详细信息"),children:[(0,w.jsx)(i.Yh,{left:t("NVMe 可用备用块(%)"),right:c.nvme_smart.available_spare}),(0,w.jsx)(i.Yh,{left:t("NVMe 已使用寿命(%)"),right:c.nvme_smart.percentage_used}),(0,w.jsx)(i.Yh,{left:t("NVMe 读取量"),right:c.nvme_smart.data_units_read}),(0,w.jsx)(i.Yh,{left:t("NVMe 写入量"),right:c.nvme_smart.data_units_written}),(0,w.jsx)(i.Yh,{left:t("NVMe 通电次数"),right:c.nvme_smart.power_cycles}),(0,w.jsx)(i.Yh,{left:t("NVMe 通电时长(小时)"),right:c.nvme_smart.power_on_hours}),(0,w.jsx)(i.Yh,{left:t("NVMe 非正常关机"),right:c.nvme_smart.unsafe_shutdowns}),(0,w.jsx)(i.Yh,{left:t("NVMe 媒体错误"),right:c.nvme_smart.media_errors}),(0,w.jsx)(i.Yh,{left:t("NVMe 错误日志数"),right:c.nvme_smart.num_err_log_entries})]}):(0,w.jsx)(w.Fragment,{})]})})]})})})]})}let v=function(e){return e[e.mount=0]="mount",e}({});var k=s(88062),S=s(78247),b=s(23430);const C=e=>(0,w.jsxs)("div",{style:{border:"2px solid black",padding:"10px",width:"300px",height:"300px",position:"relative"},children:[e.name,e.lvms.map((e,t)=>(0,w.jsx)("div",{style:{margin:"5px",height:"40px",display:"flex",alignItems:"center",justifyContent:"center",border:"1px solid "},children:e.name},t))]});function A(){return(0,w.jsx)("div",{style:{position:"relative",height:"300px",margin:"10px",width:"30px",display:"flex",alignItems:"center",justifyContent:"center"},children:(0,w.jsx)("div",{style:{width:0,height:0,borderTop:"10px solid transparent",borderBottom:"10px solid transparent",borderLeft:"10px solid black"}})})}function P(){const{t:e}=(0,p.B)(),[t,s]=(0,m.fp)(j.AG.disk),[o,c]=(0,n.useState)({}),[l,f]=(0,n.useState)([]),[g,y]=(0,n.useState)([]),[P,V]=(0,m.fp)(j.AG.showPrompt),{check_user_auth:Y}=(0,S.MH)(),[F,$]=(0,n.useState)([]),{click_file:I}=(0,S.kZ)(),[M,N]=(0,m.fp)(j.AG.prompt_card),E=[e("挂载点"),"uuid",e("类型"),e("文件系统类型"),e("文件系统容量"),e("卷容量"),e("设备路径"),e("分区表类型")],K=async()=>{const e=await a.Yu.get("disk/blk");return e.code===x.m.Success&&f(e.data),e.code};(0,n.useEffect)(()=>{(async()=>{K()})()},[]);const B=[(0,w.jsx)(u.rA,{icon:"info",title:e("提示"),onClick:async()=>{N({open:!0,title:"信息",context_div:(0,w.jsx)("div",{children:(0,w.jsxs)("ul",{children:[(0,w.jsxs)("li",{children:["通用格式:","<文件系统> <挂载点> <类型> <挂载选项> <dump> <fsck> "]}),(0,w.jsxs)("li",{children:["文件系统,有多种格式",(0,w.jsxs)("ul",{children:[(0,w.jsx)("li",{children:"1(usb口默认名称)./dev/sda1"}),(0,w.jsx)("li",{children:"2(唯一Id).UUID=123e4567-e89b-12d3-a456-426614174000"}),(0,w.jsx)("li",{children:"3.LABEL=DATA"})]})]}),(0,w.jsx)("li",{children:"挂载点,就是文件路径,例如 /mnt/data ,这个目录要提前创建,且为空"}),(0,w.jsx)("li",{children:"类型,就是文件系统类型,对于系统不支持的类型,例如ntfs需要额外前提安装ntfs-3g(linux 5.15内核以后自带 ntfs)"}),(0,w.jsxs)("li",{children:['挂载选项的值只能是以下这些,可以用 "," 同时使用多个选项',(0,w.jsxs)("ul",{children:[(0,w.jsx)("li",{children:"defaults:使用默认挂载选项"}),(0,w.jsx)("li",{children:"noatime:不更新访问时间,提高性能"}),(0,w.jsx)("li",{children:"auto:系统启动时自动挂载"}),(0,w.jsx)("li",{children:"rw:以读写方式挂载"}),(0,w.jsx)("li",{children:"nofail:防止启动阻塞,挂载失败系统继续执行"}),(0,w.jsx)("li",{children:"...等"})]})]}),(0,w.jsx)("li",{children:"dump 0是需要备份 1是不需要备份"}),(0,w.jsx)("li",{children:"Fsck 整数值0是不检查,文件系统检查顺序越小越先检查"}),(0,w.jsx)("li",{children:"提示:只有含有文件系统的逻辑卷,或者分区才可以进行挂载。"})]})})})}}),(0,w.jsx)(u.rA,{icon:"update",title:e("更新挂载"),onClick:async()=>{(await a.Yu.post("cmd/exe",{type:v.mount})).code===x.m.Success&&(0,_.SK)("挂载文件已生效")}},1)],H=async()=>(await a.Yu.get("get_fstab")).data,Z=async e=>{await a.Yu.post("save_fstab",{content:e})};return(0,w.jsxs)("div",{children:[(0,w.jsx)(d.aZ,{position:"right",children:(0,w.jsx)(u.rA,{icon:"close",title:e("关闭"),onClick:()=>{s({})}})}),(0,w.jsx)(i.jW,{isFull:!0,more:!0,children:(0,w.jsx)(i.NN,{children:(0,w.jsxs)(i.fI,{children:[(0,w.jsx)(i.VP,{widthPer:40,children:(0,w.jsxs)(r.Zp,{title:e("物理块(硬盘)设备、逻辑卷、物理卷"),titleCom:(0,w.jsxs)("div",{children:[Y(b.oV.sys_disk_mount)&&(0,w.jsx)(u.rA,{icon:"file_open",title:e("打开挂载文件"),onClick:async()=>{I({name:"fstab(谨慎修改,内容错误会导致系统无法启动)",model:"text",get_file_fun:H,save_file_fun:Z,menu_list:B})}}),(0,w.jsx)(u.rA,{icon:"update",title:e("刷新"),onClick:async()=>{await K()===x.m.Success&&(0,_.SK)("刷新成功")}})]}),children:[(0,w.jsx)(h.X,{headers:E,rows:g,width:"10rem"}),(0,w.jsx)(k.A,{list:l,render:e=>{let t=e.name;return e.label&&(t+=`(${e.label})`),e.mountpoint?(0,w.jsxs)("span",{children:[t,(0,w.jsx)("span",{style:{color:"green"},children:"(已挂载)"})]}):t},onContextMenu:(e,t)=>{e.preventDefault()},click:t=>{let s="";if(t.mountpoint)for(let e=0;e<t.mountpoints.length;e++)s+=t.mountpoints[e]+";";y([[(0,w.jsx)(r.xP,{children:s}),(0,w.jsx)(r.xP,{children:t.uuid}),e(t.type),e(t.fstype),t.fssize,t.size,(0,w.jsx)(r.xP,{children:t.path}),t.pttype]])}})]})}),(0,w.jsx)(i.VP,{widthPer:60,children:F.map((t,s)=>{const n=[];for(const e of t.pv_list)n.push({name:`${e.name}---(${e.size})---(${e.free_size})`});const o=[];for(const e of t.lv_list)o.push({name:`${e.name}---(${e.size})`});return(0,w.jsx)(r.Zp,{children:(0,w.jsxs)(i.n5,{children:[(0,w.jsx)(C,{name:e("物理卷"),lvms:n}),(0,w.jsx)(A,{}),(0,w.jsx)(C,{name:`${e("逻辑卷")}---(${t.name})---size(${t.size})`,lvms:[]}),(0,w.jsx)(A,{}),(0,w.jsx)(C,{name:e("逻辑卷"),lvms:o})]})},s)})})]})})})]})}var V=s(88815);let Y=!0;function F(e){const{t}=(0,p.B)(),s=[t("名字"),t("厂商名称"),t("类型"),t("容量")],g=[t("名字"),t("物理硬盘"),t("文件系统类型"),t("挂载位置"),t("总容量"),t("剩余容量")],[v,k]=(0,m.fp)(j.AG.user_base_info),[S,C]=(0,n.useState)(0),[A,F]=(0,n.useState)(0),[$,I]=(0,n.useState)(0),[M,N]=(0,n.useState)(0),[E,K]=(0,n.useState)(0),[B,H]=(0,n.useState)({}),[Z,D]=(0,n.useState)(!1),[G,z]=(0,n.useState)(!1),[W,T]=(0,n.useState)(!1),[X,U]=(0,n.useState)(Y),[q,L]=(0,n.useState)(null),[R,O]=(0,n.useState)([]),[J,Q]=(0,n.useState)([]),[ee,te]=(0,m.fp)(j.AG.user_base_info),[se,ne]=(0,m.fp)(j.AG.disk),ie=async()=>{if(!Y)return;const e=new c.hf(c.HK.sys_get);await l.ws.send(e),l.ws.addMsg(c.HK.sys_getting,e=>{N(e.context?.cpu_currentLoad);const t=e.context?.memLeft,s=e.context?.memTotal;F(t),I(s),C((s-t)/s*100),L(e.context?.node_memory_usage),K(e.context?.node_cpu_usage)})};return(0,n.useEffect)(()=>((async()=>{await ie()})(),()=>{l.ws.sendData(c.HK.sys_cancel,{})}),[]),(0,w.jsxs)("div",{children:[(0,w.jsxs)(d.aZ,{position:"right",children:[v.sys===b.XM.linux&&(0,w.jsx)(u.rA,{icon:"sd_card",title:"硬盘挂载",onClick:()=>{ne({type:"mount"})}}),(0,w.jsx)(u.Z$,{defaultStatus:!1,text:t("基本信息"),clickFun:e=>{D(e),e&&(async()=>{const e=await a.Yu.get("base");if(e.code===x.m.Success){const t=e.data;H(t)}})()}}),(0,w.jsx)(u.Z$,{defaultStatus:!1,text:t("物理硬盘"),clickFun:e=>{z(e),e&&(async()=>{const e=await a.Yu.get("disk");if(e.code===x.m.Success){const s=e.data,n=[];let i=!0;ee.sysSoftWare&&ee.sysSoftWare[f.jk.smartmontools]&&ee.sysSoftWare[f.jk.smartmontools].installed||(i=!1);for(const e of s??[])n.push([(0,w.jsx)(r.xP,{context:e.name}),e.typeName,e.type,e.total,(0,w.jsx)(u.rA,{icon:"health_and_safety",title:t("查看健康信息"),onClick:()=>{i?ne({type:"check",data:e}):(0,_.zN)("没有安装smartmontools")}})]);O(n)}})()}}),(0,w.jsx)(u.Z$,{defaultStatus:!1,text:t("文件硬盘"),clickFun:e=>{T(e),e&&(async()=>{const e=await a.Yu.get("filedisk");if(e.code===x.m.Success){const t=e.data,s=[];for(const e of t??[])s.push([(0,w.jsx)(r.xP,{context:e.name}),(0,w.jsx)(r.xP,{context:e.device_name}),e.fsType,(0,w.jsx)(r.xP,{context:e.mount}),e.total,e.available]);Q(s)}})()}}),(0,w.jsx)(u.Z$,{defaultStatus:X,text:t("实时信息"),clickFun:e=>{U(e),Y=e,ie()}})]}),(0,w.jsxs)(i.xh,{children:[X&&(0,w.jsxs)(i.fI,{children:[(0,w.jsx)(i.VP,{widthPer:33,maxWidth:"30rem",children:(0,w.jsx)(r.Zp,{title:"Sys "+t("内存"),children:(0,w.jsxs)(i.fI,{children:[(0,w.jsx)(i.VP,{children:(0,w.jsx)(o.A,{percentage:S})}),(0,w.jsx)(i.VP,{children:(0,w.jsxs)(i.fI,{children:[(0,w.jsx)(i.VP,{widthPer:100,children:(0,w.jsx)("div",{children:(0,w.jsx)(i.Yh,{left:t("总容量"),center:`${$}G`})})}),(0,w.jsx)(i.VP,{widthPer:100,children:(0,w.jsx)(i.Yh,{left:t("剩余"),center:`${A}G`})})]})})]})})}),(0,w.jsx)(i.VP,{widthPer:33,maxWidth:"30rem",children:(0,w.jsx)(r.Zp,{title:"Sys cpu",children:(0,w.jsxs)(i.fI,{children:[(0,w.jsx)(i.VP,{children:(0,w.jsx)(o.A,{percentage:M})}),(0,w.jsx)(i.VP,{children:(0,w.jsx)(i.fI,{children:(0,w.jsx)(i.Yh,{left:t("使用率"),center:M})})})]})})}),(0,w.jsx)(i.VP,{widthPer:33,maxWidth:"30rem",children:(0,w.jsx)(r.Zp,{title:"FileCat",children:(0,w.jsxs)(i.fI,{children:[(0,w.jsxs)(i.VP,{children:[(0,w.jsx)(i.qV,{content:t("内存")}),(0,w.jsx)(i.qV,{content:"total: "+(0,V.v7)(q?.rss)}),(0,w.jsx)(i.qV,{content:"object: "+(0,V.v7)(q?.heapTotal)}),(0,w.jsx)(i.qV,{content:"obj-use: "+(0,V.v7)(q?.heapUsed)}),(0,w.jsx)(i.qV,{content:"external: "+(0,V.v7)(q?.external)}),(0,w.jsx)(i.qV,{content:"buffer: "+(0,V.v7)(q?.arrayBuffers)})]}),(0,w.jsx)(i.VP,{children:(0,w.jsx)(i.qV,{content:"cpu growth rate: "+E})})]})})})]}),(0,w.jsxs)(i.fI,{children:[Z&&(0,w.jsx)(i.VP,{children:(0,w.jsxs)(r.Zp,{title:t("基本信息"),children:[(0,w.jsx)(i.Yh,{left:t("总内存"),right:B.mem_total}),(0,w.jsx)(i.Yh,{left:`cpu ${t("制造商")}`,right:B.cpu_manufacturer}),(0,w.jsx)(i.Yh,{left:`cpu ${t("品牌")}`,right:B.cpu_brand}),(0,w.jsx)(i.Yh,{left:`cpu ${t("逻辑核心")}`,right:B.cpu_core_num}),(0,w.jsx)(i.Yh,{left:`cpu ${t("物理核心")}`,right:B.cpu_phy_core_num}),(0,w.jsx)(i.Yh,{left:`cpu ${t("最大")}hz`,right:B.cpu_speed_hz}),(0,w.jsx)(i.Yh,{left:`${t("当前系统")}:pid;ppid`,right:B.pid_ppid}),(0,w.jsx)(i.Yh,{left:t("运行用户"),right:B.user})]})}),G&&(0,w.jsx)(i.VP,{children:(0,w.jsx)(r.uF,{title:t("物理硬盘"),children:(0,w.jsx)(h.X,{headers:s,rows:R,width:"10rem"})})}),W&&(0,w.jsx)(i.VP,{children:(0,w.jsx)(r.uF,{title:t("文件硬盘"),children:(0,w.jsx)(h.X,{headers:g,rows:J,width:"10rem"})})})]})]}),se&&"check"===se.type&&(0,w.jsx)(y,{...se.data}),se&&"mount"===se.type&&(0,w.jsx)(P,{})]})}var $=s(75007),I=s(97856),M=s(64405);const N=n.lazy(()=>Promise.all([s.e(2543),s.e(5614)]).then(()=>s(85614)));function E(e){const[t,s]=(0,n.useState)(null),[i,r]=(0,m.fp)(j.AG.dockerShellShow),[o,a]=(0,m.fp)(j.AG.user_base_info),d=o.user_data.theme?.includes("dark")?"#FFFFFF":"#000000",u=()=>{(async()=>{t&&(t.writeln("[38;2;29;153;243mclose![0m "),t.dispose(),s(null))})()};(0,n.useEffect)(()=>{i.show?(async()=>{const e=new I.Terminal({fontFamily:"Monaco, Menlo, Consolas, 'Courier New', monospace",theme:{background:"#FFFFFF",foreground:d,cursor:d,selectionBackground:"#a6d2ff"},cursorBlink:!0,cursorStyle:"bar",scrollback:1e3,scrollSensitivity:1,tabStopWidth:4,convertEol:!0});let t;l.ws.subscribeUnconnect(u);const n=t=>{e.write(t)};t=s=>{e.clear(),e.write(s),t=n},l.ws.addMsg("logs"===i.type?c.HK.docker_shell_logs_getting:c.HK.docker_shell_exec_getting,e=>{"error"===e.context&&u(),t(e.context)}),"exec"===i.type&&e.onData(async e=>{const t=new c.hf(c.HK.docker_shell_exec);t.context=e,await l.ws.send(t)}),s(e)})():u()},[i]),(0,n.useEffect)(()=>()=>{u()},[]);return(0,w.jsx)(N,{show:i.show,terminal:t,init:(e,s)=>{t.writeln("[38;2;29;153;243mconnect...[0m ");const n=new M.n;let r;n.rows=e,n.cols=s,n.dockerId=i.dockerId,r="logs"===i.type?new c.hf(c.HK.docker_shell_logs):new c.hf(c.HK.docker_shell_exec_open),r.context=n,l.ws.send(r)}})}var K=s(18538),B=s(86090),H=s(87361);let Z="",D=[],G=!1;function z(e){const{t}=(0,p.B)(),s=(0,B.Zp)(),[o]=(0,m.fp)(j.AG.user_base_info),[f,y]=(0,n.useState)({}),[v,k]=(0,n.useState)([]),[C,A]=(0,n.useState)([]),{check_user_auth:P}=(0,S.MH)(),[V,Y]=(0,m.fp)(j.AG.dockerShellShow),[F,I]=(0,m.fp)(j.AG.showPrompt),[M,N]=(0,m.fp)(j.AG.confirm),[z,W]=(0,n.useState)(Z),[T,X]=(0,n.useState)(["id",t("名字"),t("镜像"),t("命令"),t("状态"),t("内存"),"cpu%",t("选择")]),[U,q]=(0,n.useState)([]),[L,R]=(0,n.useState)(void 0),[O,J]=(0,n.useState)(!1),Q=["id",t("name"),t("create时间"),t("大小"),(0,w.jsxs)("span",{children:["选中",(0,w.jsx)(u.rA,{icon:"check_box",title:"全选",onClick:()=>{G=!G;const e={};for(let t=0;t<C.length&&G;t++)e[C[t][0].props.context]=1;y(e)}})]})],ee=async()=>{k([]),q([]);const e=new c.hf(c.HK.docker_get);await l.ws.send(e),l.ws.addMsg(c.HK.docker_getting,e=>{const t=[];if(Z){for(const s of e.context)for(const e of s)if(`${e}`.includes(Z)){t.push(s);break}}else t.push(...e.context);k(t.map(e=>{const t=e.map(e=>(0,w.jsx)(r.xP,{context:e}));return t.push((0,w.jsx)(u.rA,{icon:"place",title:"选中",onClick:()=>{q(t)}})),t}))})};(0,n.useEffect)(()=>(W(Z),ee(),()=>{(async()=>{Y({show:!1,type:"",dockerId:""})})()}),[]),(0,n.useEffect)(()=>{Z=z},[z]);const te=()=>{const e=new c.hf("logs"===V.type?c.HK.docker_shell_logs_cancel:c.HK.docker_shell_exec_cancel);e.context="",l.ws.send(e)},se=e=>{const t=new c.hf(c.HK.docker_switch);t.context={type:e,dockerId:U[0].props.context},q([]),l.ws.send(t)},ne=async()=>{const e=await a.Yu.get("docker/images");if(e.code===x.m.Success){const t=e.data??[],s=[];for(let e=0;e<t.length;e++){const n=t[e],i=[(0,w.jsx)(r.xP,{context:n[0]}),(0,w.jsx)(r.xP,{context:n[1]}),n[2],n[3],""];s.push(i)}D=s,A(s)}};return(0,w.jsxs)("div",{children:[(0,w.jsx)(d.aZ,{children:(0,w.jsx)(u.Z$,{defaultStatus:!1,text:t("docker镜像"),clickFun:e=>{J(e),e?(ne(),q([])):(ee(),A([]),y({}))}})}),(0,w.jsxs)(d.aZ,{position:"right",children:[o.sys===b.XM.linux&&(0,w.jsx)(u.rA,{icon:"settings",title:t("Docker 配置"),onClick:()=>s(H.o.docker_setting_page)}),Object.keys(f).length>0&&(0,w.jsx)(u.rA,{icon:"delete",title:t("删除镜像"),onClick:async()=>{N({open:!0,title:t("确定删除选中的镜像吗"),handle:async()=>{const e=Object.keys(f),t=await a.Yu.post("docker/check/delete",{ids:e});if(t.code===x.m.Success)if(0===t.data.length){(await a.Yu.post("docker/delete",{ids:e})).code===x.m.Success&&((0,_.SK)("删除完成"),ne(),N({open:!1,handle:null}))}else(0,_.N9)(`有镜像正在运行${JSON.stringify(t.data)}`)}})}}),U.length>0&&(0,w.jsx)("div",{children:U[1].props.context}),U.length>0&&(0,w.jsxs)("div",{children:[P(b.oV.docker_container_update)&&(0,w.jsx)(u.rA,{icon:"delete",title:t("删除容器"),onClick:()=>{I({show:!0,overlay:!0,type:K.PromptEnum.DockerDel,data:{dockerId:U[0].props.context,name:U[1].props.context}})}}),(0,w.jsx)(u.rA,{icon:"print",title:t("打印日志"),onClick:()=>{V.show?(Y({show:!1,type:"",dockerId:""}),te()):Y({show:!0,dockerId:U[0].props.context,type:"logs"})}}),P(b.oV.docker_container_update)&&(0,w.jsx)(u.rA,{icon:"personal_video",title:t("执行命令"),onClick:()=>{V.show?(Y({show:!1,type:"",dockerId:""}),te()):Y({show:!0,dockerId:U[0].props.context,type:"exec"})}}),P(b.oV.docker_container_update)&&U[4].props.context.includes("Up")&&(0,w.jsx)(u.rA,{icon:"stop",title:t("停止"),onClick:()=>se("stop")}),P(b.oV.docker_container_update)&&!U[4].props.context.includes("Up")&&(0,w.jsx)(u.rA,{icon:"play_arrow",title:t("开启"),onClick:()=>{se("start")}})]}),(0!==v.length||z)&&!O&&(0,w.jsx)(u.rA,{icon:"refresh",title:t("列表更新"),onClick:async()=>{const e=new c.hf(c.HK.docker_get);await l.ws.send(e)}})]}),(0,w.jsxs)(i.xh,{children:[O&&(0,w.jsx)(i.fI,{children:(0,w.jsx)(i.VP,{widthPer:80,children:(0,w.jsx)(r.uF,{title:`${t("镜像")} (${C.length})`,titleCom:(0,w.jsx)(g.Sm,{placeholder:t("过滤镜像"),value:L,handleInputChange:e=>{R(e)},handlerEnter:()=>{const e=[];if(L){for(const t of C)(t[0].props.context.includes(L)||t[1].props.context.includes(L))&&e.push(t);A(e)}else A(D)}}),children:(0,w.jsx)(h.X,{headers:Q,rows:C.map((e,s)=>(e[4]=(0,w.jsx)(g.GL,{context:t(""),selected:f[e[0].props.context],onchange:()=>{(e=>{const t={};Object.assign(t,f),t[e]?delete t[e]:t[e]=1,y(t)})(e[0].props.context)}}),e)),width:"10rem"})})})}),0===v.length&&!z&&!O&&(0,w.jsx)($.h,{context:t("检测不到docker,主机可能没有安装docker or 容器为空")}),(0!==v.length||z)&&!O&&(0,w.jsx)(i.fI,{children:(0,w.jsx)(i.VP,{widthPer:80,children:(0,w.jsx)(r.uF,{title:`${t("容器")} (${v.length})`,titleCom:(0,w.jsx)(g.Sm,{placeholder:t("过滤"),value:z,handleInputChange:e=>{W(e)}}),children:(0,w.jsx)(h.X,{headers:T,rows:v,width:"10rem"})})})})]}),(0,w.jsx)(E,{})]})}var W=s(64694);let T="",X=!1,U=!1;function q(e){const{t}=(0,p.B)(),[s,o]=(0,n.useState)([]),[a,x]=(0,n.useState)([]),[m,j]=(0,n.useState)(0),[f,_]=(0,n.useState)(""),[y,v]=(0,n.useState)(["pid",t("名字"),t("创建用户"),(0,w.jsxs)("span",{children:[t("内存"),(0,w.jsx)(u.rA,{icon:"sort",title:t("升序"),onClick:()=>{X=!X}})]}),(0,w.jsxs)("span",{children:["cpu%",(0,w.jsx)(u.rA,{icon:"sort",title:t("升序"),onClick:()=>{U=!U}})]}),t("选择")]),{check_user_auth:k}=(0,S.MH)();(0,n.useEffect)(()=>{_(T),(async()=>{o([]),j(0),x([]);const e=new c.hf(c.HK.process_get);await l.ws.send(e),l.ws.addMsg(c.HK.process_getting,e=>{const s=[];if(T){for(const t of e.context)for(const e of t)if(`${e}`.includes(T)){s.push(t);break}}else s.push(...e.context);X&&(0,W.di)(s,e=>e[3],!1),U&&(0,W.di)(s,e=>e[4],!1);const n=s.map(e=>{const s=e.map((e,t)=>(0,w.jsx)(r.xP,{context:3===t?(0,V.v7)(e):e}));return s.push((0,w.jsx)(u.rA,{icon:"place",title:t("选中"),onClick:()=>{x(s)}})),s});j(s.length),o(n)})})()},[]),(0,n.useEffect)(()=>{T=f},[f]);return(0,w.jsxs)("div",{children:[(0,w.jsxs)(d.aZ,{position:"right",children:[a.length>0&&(0,w.jsx)("div",{children:a[1].props.context}),a.length>0&&k(b.oV.sys_process_close)&&(0,w.jsx)("div",{children:(0,w.jsx)(u.rA,{icon:"stop",title:t("停止"),onClick:()=>{const e=new c.hf(c.HK.process_close);e.context={pid:a[0].props.context},x([]),l.ws.send(e)}})})]}),(0,w.jsx)(i.xh,{children:0!==s.length||T?(0,w.jsx)(i.fI,{children:(0,w.jsx)(i.VP,{widthPer:80,children:(0,w.jsx)(r.uF,{title:`${t("进程")} (${m})`,titleCom:(0,w.jsx)(g.Sm,{placeholder:t("过滤"),value:f,handleInputChange:e=>{_(e)}}),children:(0,w.jsx)(h.X,{headers:y,rows:s,width:"10rem"})})})}):(0,w.jsx)($.h,{context:t("加载中请等待...")})})]})}const L=n.lazy(()=>Promise.all([s.e(2543),s.e(5614)]).then(()=>s(85614)));function R(e){const[t,s]=(0,n.useState)(null),[i,r]=(0,m.fp)(j.AG.systemd_shell_show),[o,a]=(0,m.fp)(j.AG.user_base_info),d=o.user_data.theme?.includes("dark")?"#FFFFFF":"#000000",u=()=>{(async()=>{t&&(t.writeln("[38;2;29;153;243mclose![0m "),t.dispose(),s(null))})()};(0,n.useEffect)(()=>{if(!i.show)return void u();(async()=>{const e=new I.Terminal({fontFamily:"Monaco, Menlo, Consolas, 'Courier New', monospace",theme:{background:"#FFFFFF",foreground:d,cursor:d,selectionBackground:"#a6d2ff"},cursorBlink:!0,cursorStyle:"bar",scrollback:1e3,scrollSensitivity:1,tabStopWidth:4,convertEol:!0});l.ws.subscribeUnconnect(u),l.ws.addMsg(c.HK.systemd_logs_getting,t=>{"error"===t.context&&u(),e.write(t.context)}),s(e)})();const e=e=>{};return document.addEventListener("cancel_systemd_logs",e),()=>{document.removeEventListener("cancel_systemd_logs",e)}},[i]),(0,n.useEffect)(()=>()=>{u()},[]);return(0,w.jsx)(L,{show:i.show,terminal:t,init:(e,s)=>{t.writeln("[38;2;29;153;243mconnect...[0m ");const n={unit_name:i.unit_name},r=new c.hf(c.HK.systemd_logs_get);r.context=n,l.ws.send(r)}})}const O=[{title:"no(不自动重启)",value:"no"},{title:"always(总是重启)",value:"always"},{title:"on-failure(失败才重启)",value:"on-failure"},{title:"on-abnormal(异常才重启)",value:"on-abnormal"}],J=[{title:"simple",value:"simple"},{title:"forking",value:"forking"},{title:"oneshot",value:"oneshot"},{title:"notify",value:"notify"}],Q=[{title:"multi-user.target",value:"multi-user.target"},{title:"network.target",value:"network.target"}];function ee(e,t){const s=[];return s.push("[Unit]"),t.description.trim()?s.push(`Description=${t.description.trim()}`):s.push(`Description=${e}`),s.push(""),s.push("[Service]"),s.push(`Type=${t.type.trim()||"simple"}`),t.exec_start.trim()&&s.push(`ExecStart=${t.exec_start.trim()}`),t.working_dir.trim()&&s.push(`WorkingDirectory=${t.working_dir.trim()}`),t.user_.trim()&&s.push(`User=${t.user_.trim()}`),t.restart&&"no"!==t.restart&&s.push(`Restart=${t.restart.trim()}`),s.push(""),s.push("[Install]"),s.push(`WantedBy=${t.wanted.trim()||"multi-user.target"}`),s.push(""),s.join("\n")}function te(e){const t={description:"",type:"simple",exec_start:"",working_dir:"",user_:"root",restart:"no",wanted:"multi-user.target"},s=(t,s)=>{const n=e.split(/\r?\n/);let i=!1;for(const e of n){const n=e.trim(),r=n.match(/^\[(.*)\]$/);if(r){i=(r[1]||"").trim()===t;continue}if(!i)continue;const o=n.match(new RegExp(`^${s}\\s*=\\s*(.*)$`,"i"));if(o)return o[1].trim()}return""};return t.description=s("Unit","Description"),t.type=s("Service","Type")||"simple",t.exec_start=s("Service","ExecStart"),t.working_dir=s("Service","WorkingDirectory"),t.user_=s("Service","User"),t.restart=s("Service","Restart")||"no",t.wanted=s("Install","WantedBy")||"multi-user.target",t}function se(e){const{t}=(0,p.B)(),[s,i]=(0,n.useState)("form"),[r,o]=(0,n.useState)(()=>(e.unit_name||"").replace(/\.service$/i,"")),[c,l]=(0,n.useState)({description:"",type:"simple",exec_start:"",working_dir:"",user_:"root",restart:"no",wanted:"multi-user.target"}),[d,u]=(0,n.useState)(""),[h,m]=(0,n.useState)(""),[j,f]=(0,n.useState)(!1);(0,n.useEffect)(()=>{"edit"===e.mode&&e.unit_name&&(async()=>{f(!0);try{const t=await a.Yu.post("systemd/get/context",{unit_name:e.unit_name});if(t.code!==x.m.Success)return;const s=t.data.context??"",n=t.data.path??"";m(n),u(s),l(te(s))}finally{f(!1)}})()},[e.mode,e.unit_name]);const y=e=>{e!==s&&("text"===e?u(ee(r,c)):l(te(d)),i(e))},v=e=>t=>{l(s=>({...s,[e]:t}))};return(0,w.jsxs)("div",{children:[(0,w.jsxs)("div",{style:{display:"flex",gap:"0.4rem",marginBottom:"0.6rem"},children:[(0,w.jsx)("button",{className:"button button--flat "+("form"===s?"":"button--grey"),onClick:()=>y("form"),children:t("表单")}),(0,w.jsx)("button",{className:"button button--flat "+("text"===s?"":"button--grey"),onClick:()=>y("text"),children:t("文本")})]}),j?(0,w.jsx)("div",{children:t("加载中...")}):"form"===s?(0,w.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:"0.6rem"},children:[(0,w.jsx)(g.BC,{label:t("服务名称"),children:(0,w.jsx)(g.Sm,{placeholder:t("服务名称"),value:r,disabled:"edit"===e.mode,handleInputChange:e=>o(e),width:"100%"})}),(0,w.jsx)(g.BC,{label:t("服务描述"),children:(0,w.jsx)(g.Sm,{placeholder:t("服务描述"),value:c.description,handleInputChange:v("description"),width:"100%"})}),(0,w.jsx)(g.BC,{label:t("启动命令"),required:!0,children:(0,w.jsx)(g.Sm,{placeholder:t("ExecStart 启动命令,必填"),value:c.exec_start,handleInputChange:v("exec_start"),width:"100%"})}),(0,w.jsx)(g.BC,{label:t("运行类型"),children:(0,w.jsx)(g.l6,{options:J,value:c.type,onChange:v("type")})}),(0,w.jsx)(g.BC,{label:t("工作目录"),children:(0,w.jsx)(g.Sm,{placeholder:t("工作目录(可选)"),value:c.working_dir,handleInputChange:v("working_dir"),width:"100%"})}),(0,w.jsx)(g.BC,{label:t("运行用户"),children:(0,w.jsx)(g.Sm,{placeholder:t("运行用户(可选)"),value:c.user_,handleInputChange:v("user_"),width:"100%"})}),(0,w.jsx)(g.BC,{label:t("重启策略"),children:(0,w.jsx)(g.l6,{options:O,value:c.restart,onChange:v("restart")})}),(0,w.jsx)(g.BC,{label:t("安装目标"),children:(0,w.jsx)(g.l6,{options:Q,value:c.wanted,onChange:v("wanted")})})]}):(0,w.jsx)("textarea",{className:"input--textarea input--no_border",style:{width:"100%",minHeight:"16rem",fontFamily:"monospace",fontSize:"0.85rem",boxSizing:"border-box"},value:d,onChange:e=>u(e.target.value),spellCheck:!1}),(0,w.jsxs)("div",{style:{display:"flex",justifyContent:"flex-end",gap:"0.4rem",marginTop:"0.6rem"},children:[(0,w.jsx)("button",{className:"button button--flat button--grey",disabled:j,onClick:e.onClose,children:t("取消")}),(0,w.jsx)("button",{className:"button button--flat",disabled:j,onClick:async()=>{if(!r.trim())return void(0,_.zN)(t("请填写服务名称"));const n=(i=r).trim().endsWith(".service")?i.trim():`${i.trim()}.service`;var i;const o="text"===s?d:ee(n,c);if(o.includes("ExecStart=")){f(!0);try{if("create"===e.mode){const e=`/etc/systemd/system/${n}`;await a.Yu.post("systemd/sys/save",{unit_name:n,path:e,context:o}),await a.Yu.post("systemd/sys/enable",{unit_name:n}),await a.Yu.post("systemd/add",{unit_name:n}),(0,_.SK)(t("添加成功"))}else await a.Yu.post("systemd/sys/save",{unit_name:n,path:h,context:o}),(0,_.SK)(t("保存成功"));e.onClose(),e.onDone?.()}catch(e){console.error("systemd 保存失败",e)}finally{f(!1)}}else(0,_.zN)(t("请至少填写 ExecStart 启动命令"))},children:t("保存")})]})]})}let ne,ie="";function re(e){const{t}=(0,p.B)(),{check_user_auth:s}=(0,S.MH)(),[o,f]=(0,m.fp)(j.AG.systemd_shell_show),[y,v]=(0,m.fp)(j.AG.confirm),[k,C]=(0,n.useState)(["pid","name","process",t("创建用户"),t("内存"),t("cpu%"),t("active状态"),t("选择")]),[A,P]=(0,n.useState)(["单元名字","加载状态",t("active(sub)状态"),t("描述"),t("选择")]),[Y,F]=(0,n.useState)([]),[I,M]=(0,n.useState)([]),[N,E]=(0,n.useState)([]),[K,B]=(0,n.useState)(!1),[H,Z]=(0,n.useState)([]),[D,G]=(0,n.useState)(""),[z,W]=(0,n.useState)(""),[T,X]=(0,n.useState)(new Set),[U,q]=(0,m.fp)(j.AG.editorSetting),[L,O]=(0,m.fp)(j.AG.prompt_card);(0,n.useEffect)(()=>{W(ie),(async()=>{F([]),E([]);const e=new c.hf(c.HK.systemd_inside_get);await l.ws.send(e),l.ws.addMsg(c.HK.systemd_inside_getting,e=>{const t=[];if(ie){for(const s of e.context)for(const e of s)if(`${e}`.includes(ie)){t.push(s);break}}else t.push(...e.context);F(t.map(e=>{const t=e.map((e,t)=>(0,w.jsx)(r.xP,{context:4===t?(0,V.v7)(e):e}));return t.push((0,w.jsx)(u.rA,{icon:"place",title:"选中",onClick:()=>{E(t)}})),t}))})})()},[]),(0,n.useEffect)(()=>{ie=z},[z]);const J=e=>{if(o.show){f({show:!1,unit_name:""});const e=new CustomEvent("cancel_systemd_logs",{detail:{}});document.dispatchEvent(e)}else f({show:!0,unit_name:e})},Q=async()=>{M([]),Z([]);const e=await a.Yu.get("systemd/inside/all");if(e.code!==x.m.Success)return;X(new Set(e.data));const t=await a.Yu.get("systemd/allget");if(t.code===x.m.Success){const e=t.data,s=[];for(const t of e??[]){const e=[(0,w.jsx)(r.xP,{context:t.unit}),t.load,`${t.active}(${t.sub})`,(0,w.jsx)(r.xP,{context:t.description})];s.push([...e,(0,w.jsx)(u.rA,{icon:"place",title:"添加",onClick:()=>{Z([...e])}})])}ne=s,M(s)}},ee=(e,s)=>{O({open:!0,title:t("create"===e?"新建 systemd 服务":"编辑 systemd 服务"),context_div:(0,w.jsx)(se,{mode:e,unit_name:s,onClose:()=>O({open:!1}),onDone:()=>{O({open:!1}),l.ws.send(new c.hf(c.HK.systemd_inside_get)),K&&Q(),E([]),Z([])}})})};return(0,w.jsxs)("div",{children:[(0,w.jsx)(d.aZ,{children:(0,w.jsx)(u.Z$,{defaultStatus:!1,text:t("系统systemd单元"),clickFun:e=>{B(e),e?(Q(),E([])):Z([])}})}),(0,w.jsxs)(d.aZ,{position:"right",children:[s(b.oV.systemd)&&(0,w.jsx)("div",{children:(0,w.jsx)(u.rA,{icon:"add_circle",title:t("添加 systemd"),onClick:()=>{ee("create")}})}),N.length>0&&(0,w.jsx)("div",{children:N[1].props.context}),H.length>0&&(0,w.jsx)("div",{children:H[0].props.context}),N.length>0&&(0,w.jsxs)("div",{children:[s(b.oV.systemd)&&(0,w.jsx)(u.rA,{icon:"remove",title:"从实时监控删除",onClick:()=>{(async e=>{v({open:!0,handle:async()=>{(await a.Yu.post("systemd/delete",{unit_name:e})).code===x.m.Success&&((0,_.SK)("删除成功"),v({open:!1,handle:null}))}})})(N[1].props.context)}}),s(b.oV.systemd)&&(0,w.jsx)(u.rA,{icon:"edit",title:"可视化编辑",onClick:()=>{ee("edit",N[1].props.context)}}),(0,w.jsx)(u.rA,{icon:"print",title:"打印日志",onClick:()=>{J(N[1].props.context)}})]}),H.length>0&&(0,w.jsxs)("div",{children:[s(b.oV.systemd)&&(0,w.jsx)(u.rA,{icon:"delete",title:"删除系统上的sytemd",onClick:()=>{(async e=>{v({open:!0,handle:async()=>{(await a.Yu.post("systemd/sys/delete",{unit_name:e})).code===x.m.Success&&((0,_.SK)("删除成功"),v({open:!1,handle:null}))}})})(H[0].props.context)}}),(0,w.jsx)(u.rA,{icon:"print",title:"打印日志",onClick:()=>{J(H[0].props.context)}}),s(b.oV.systemd)&&(0,w.jsx)(u.rA,{icon:"text_fields",title:"sytemd文件内容",onClick:()=>{(async t=>{const s=await a.Yu.post("systemd/get/context",{unit_name:t});s.code===x.m.Success&&(q({model:"text",open:!0,fileName:e.name,save:async e=>{const n={unit_name:t,path:s.data.path,context:e};(await a.Yu.post("systemd/sys/save",n)).code===x.m.Success&&(S.xK.set_value_temp(""),q({open:!1,model:"",fileName:"",save:null}))}}),S.xK.set_value_temp(s.data.context))})(H[0].props.context)}}),s(b.oV.systemd)&&!T.has(H[0].props.context)&&(0,w.jsx)(u.rA,{icon:"plus_one",title:"添加到管理",onClick:()=>(async e=>{const t=await a.Yu.post("systemd/add",{unit_name:e});t.code===x.m.Success&&(X(new Set(t.data)),(0,_.SK)("添加成功"))})(H[0].props.context)})]})]}),(0,w.jsxs)(i.xh,{children:[K&&(0,w.jsx)(i.fI,{children:(0,w.jsx)(i.VP,{widthPer:80,children:(0,w.jsx)(r.uF,{title:`systemd系统单元(${I.length})`,titleCom:(0,w.jsx)(g.Sm,{placeholder:"过滤单元",value:D,handleInputChange:e=>{G(e)},handlerEnter:()=>{const e=[];if(D){for(const t of ne)(t[0].props.context.includes(D)||t[3].props.context.includes(D))&&e.push(t);M(e)}else M(ne)}}),children:(0,w.jsx)(h.X,{headers:A,rows:I,width:"10rem"})})})}),0===Y.length&&!K&&(0,w.jsx)($.h,{context:"没有管理的单元 or 加载中请等待..."}),0!==Y.length&&!K&&(0,w.jsx)(i.fI,{children:(0,w.jsx)(i.VP,{widthPer:80,children:(0,w.jsx)(r.uF,{title:`filecat监控单元(${Y.length})`,titleCom:(0,w.jsx)(g.Sm,{placeholder:"过滤单元",value:z,handleInputChange:e=>{W(e)}}),children:(0,w.jsx)(h.X,{headers:k,rows:Y,width:"10rem"})})})})]}),(0,w.jsx)(R,{})]})}function oe(){const{t:e}=(0,p.B)(),t=[{title:e("放行"),value:"allow"},{title:e("拒绝"),value:"deny"},{title:e("限速"),value:"limit"},{title:e("拒绝响应"),value:"reject"}],s=[{title:e("入站"),value:"in"},{title:e("出站"),value:"out"}],[o,c]=(0,n.useState)(null),[l,f]=(0,n.useState)("allow"),[y,v]=(0,n.useState)("in"),[k,S]=(0,n.useState)("tcp"),[b,C]=(0,n.useState)(""),[A,P]=(0,n.useState)(""),[V,Y]=(0,n.useState)("list"),[F,I]=(0,n.useState)([]),[M,N]=(0,n.useState)(""),[E,K]=(0,n.useState)(!1),[B,H]=(0,m.fp)(j.AG.confirm),Z=async()=>{try{const e=await a.V_.get("status");e.code===x.m.Success&&c(e.data)}catch(e){}},D=async()=>{K(!0);try{const e=await a.V_.get("rules");if(e.code===x.m.Success){const t=e.data;I(t?.rules??[]),N(t?.raw??"")}}catch(e){I([]),N("")}finally{K(!1)}};(0,n.useEffect)(()=>{Z(),D()},[]);const G=!0===o?.installed,z=!0===o?.active;return(0,w.jsxs)("div",{children:[(0,w.jsxs)(d.aZ,{position:"right",children:[(0,w.jsxs)("div",{children:[e("已安装"),": ",G?(0,w.jsx)("span",{style:{color:"green"},children:"✓"}):(0,w.jsx)("span",{style:{color:"red"},children:"✗"})]}),(0,w.jsxs)("div",{children:[e("已启用"),": ",z?(0,w.jsx)("span",{style:{color:"green"},children:"✓"}):(0,w.jsx)("span",{style:{color:"gray"},children:"✗"})]}),G&&(0,w.jsx)(u.rA,{icon:"power_settings_new",title:e(z?"停用":"启用"),onClick:()=>(async t=>{try{const s=await a.V_.post("enable",{enabled:t});if(s.code!==x.m.Success)return void(0,_.zN)(s.message||e("操作失败"));(0,_.SK)(s.data||e(t?"已启用":"已停用")),Z(),D()}catch(e){}})(!z)}),(0,w.jsx)(u.rA,{icon:"refresh",title:e("刷新规则"),onClick:D})]}),(0,w.jsxs)(i.xh,{children:[(0,w.jsx)(i.fI,{children:(0,w.jsx)(i.VP,{widthPer:35,children:(0,w.jsxs)(r.uF,{title:e("添加ufw规则"),titleCom:(0,w.jsx)(u.rA,{icon:"add",title:e("添加"),onClick:async()=>{if(b.trim())try{const t=await a.V_.post("rule/add",{action:l,direction:y,proto:k,port:b.trim(),from:"in"===y&&A.trim()||void 0});if(t.code!==x.m.Success)return void(0,_.zN)(t.message||e("操作失败"));(0,_.SK)(t.data||e("已添加")),D()}catch(e){}else(0,_.zN)(e("请填写端口号"))}}),children:[(0,w.jsx)(g.BC,{label:e("动作"),label_width:"4rem",input_max_width:"8rem",children:(0,w.jsx)(g.l6,{options:t,value:l,onChange:e=>f(e),defaultValue:"allow"})}),(0,w.jsx)(g.BC,{label:e("方向"),label_width:"4rem",input_max_width:"8rem",children:(0,w.jsx)(g.l6,{options:s,value:y,onChange:e=>v(e),defaultValue:"in"})}),(0,w.jsx)(g.BC,{label:e("协议"),label_width:"4rem",input_max_width:"8rem",children:(0,w.jsx)(g.l6,{options:[{title:"tcp",value:"tcp"},{title:"udp",value:"udp"}],value:k,onChange:e=>S(e),defaultValue:"tcp"})}),(0,w.jsx)(g.BC,{label:e("端口"),label_width:"4rem",required:!0,children:(0,w.jsx)(g.Sm,{maxWidth:"20rem",placeholder:e("可填范围如 1000:2000"),value:b,handleInputChange:e=>C(e)})}),"in"===y&&(0,w.jsx)(g.BC,{label:e("来源"),label_width:"4rem",children:(0,w.jsx)(g.Sm,{maxWidth:"20rem",placeholder:e("IP/网段,可选"),value:A,handleInputChange:e=>P(e)})})]})})}),(0,w.jsx)(i.fI,{children:(0,w.jsx)(i.VP,{widthPer:80,children:(0,w.jsxs)(r.uF,{title:e("规则列表"),titleCom:(0,w.jsxs)("div",{style:{display:"flex",gap:"0.4rem"},children:[(0,w.jsx)(u.C3,{text:e("名单视图"),clickFun:()=>Y("list")}),(0,w.jsx)(u.C3,{text:e("文本视图"),clickFun:()=>Y("text")})]}),children:[E&&(0,w.jsx)($.h,{context:e("加载中...")}),!E&&"list"===V&&(0===F.length?(0,w.jsx)($.h,{context:e("暂无规则")}):(0,w.jsx)(h.X,{headers:[e("编号"),e("目标(To)"),e("动作"),e("来源(From)"),e("备注"),e("操作")],rows:F.map(t=>[t.number,(0,w.jsx)(r.xP,{context:t.to,tip_context:t.to}),t.action,t.from?(0,w.jsx)(r.xP,{context:t.from,tip_context:t.from}):"",t.description||"",(0,w.jsx)(u.rA,{icon:"delete",title:e("删除规则"),onClick:()=>(async(t,s,n)=>{H({open:!0,title:e("确定删除吗?"),sub_title:e(`${s} ${n}`),handle:async()=>{try{const s=await a.V_.post("ufw/rule/del",{number:t});if(s.code!==x.m.Success)return void(0,_.zN)(s.message||e("操作失败"));(0,_.SK)(s.data||e("规则已删除")),H({open:!1,handle:null}),D()}catch(e){}}})})(t.number,t.to,t.from)})]),width:"8rem"})),!E&&"text"===V&&(M?(0,w.jsx)("pre",{style:{whiteSpace:"pre-wrap",wordBreak:"break-all",fontSize:"0.85rem",margin:0},children:M}):(0,w.jsx)($.h,{context:e("暂无规则")}))]})})})]})]})}function ce(e){const{t}=(0,p.B)(),[s,n]=(0,m.fp)(j.AG.user_base_info),r=[{index:1,name:t("系统性能"),rto:"sys/",component:(0,w.jsx)(F,{})},{index:2,name:t("系统进程"),rto:"process/",component:(0,w.jsx)(q,{})},{index:3,name:t("docker容器"),rto:"docker/",component:(0,w.jsx)(z,{})}];if(s.sys===b.XM.linux){(s.user_data?.is_root||(s.user_data?.auth_list??[]).includes(b.oV.systemd))&&r.push({index:4,name:t("systemd"),rto:"systemd/",component:(0,w.jsx)(re,{})});(s.user_data?.is_root||(s.user_data?.auth_list??[]).includes(b.oV.firewall))&&s.sysSoftWare?.[f.jk.ufw]?.installed&&r.push({index:5,name:t("防火墙"),rto:"firewall/",component:(0,w.jsx)(oe,{})})}return(0,w.jsx)(i.W1,{optionList:r,father_route:H.o.info})}}}]);
|