filecat 7.3.3 → 7.3.4
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/{1142.2a57e7124b6e3720c759.js → 1142.ff1f4e075b061d70b2b6.js} +1 -1
- package/build/dist/{3328.9122f8c52f44f844bc20.js → 3328.5c4a535864d93c9f4ca7.js} +1 -1
- package/build/dist/8603.b4bc403e5d032e15b996.js +1 -0
- package/build/dist/9877.71cc8792bc3fe5abefcc.js +1 -0
- package/build/dist/index.html +1 -1
- package/build/dist/main.01456be775c50cf697fc.js +2 -0
- package/build/main.js +1 -1
- package/package.json +1 -1
- package/build/dist/8603.d7eea8d253cff5aef62c.js +0 -1
- package/build/dist/9877.5bed2ede178cba58843b.js +0 -1
- package/build/dist/main.62150e46f9d1c96fa5bf.js +0 -2
- /package/build/dist/{main.62150e46f9d1c96fa5bf.js.LICENSE.txt → main.01456be775c50cf697fc.js.LICENSE.txt} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[1142],{71142(e,t,n){n.r(t),n.d(t,{default:()=>ae});var r=n(96540),s=n(7523),o=n(34843),c=n(82893),i=n(78247),a=n(23430),l=n(85997),u=n(57952),d=n(62042),m=n(53459),f=n(14284),v=n(57889),_=n(23496),h=n(86149),p=n(86504),g=n(67951),w=n(74848);function x(e){const{t}=(0,h.B)(),n=(0,r.useRef)(null),[s,o]=(0,r.useState)({marks:[],block:{name:"paragraph"}}),[c,i]=(0,r.useState)(null),a=(0,r.useCallback)(()=>{const t=e.get_view();if(!t)return;const n=t.state.selection,r=t.state.storedMarks??n.$from.marks();if(o({marks:r.map(e=>e.type.name),block:k(n.$from)}),n.empty)return void i(null);const s=t.coordsAtPos(n.from),c=t.coordsAtPos(n.to),a=(Math.min(s.left,c.left)+Math.max(s.right,c.right))/2,l=Math.min(s.top,c.top),u=Math.max(s.bottom,c.bottom);i({top:l,bottom:u,left:a})},[e.get_view]);(0,r.useEffect)(()=>{a();const t=e.get_view();if(!t)return;const n=()=>a();t.dom.addEventListener("keyup",n),t.dom.addEventListener("mouseup",n),document.addEventListener("selectionchange",n);const r=t.dom.closest(".md-editor-context");return r?.addEventListener("scroll",n,{passive:!0}),window.addEventListener("resize",n),()=>{t.dom.removeEventListener("keyup",n),t.dom.removeEventListener("mouseup",n),document.removeEventListener("selectionchange",n),r?.removeEventListener("scroll",n),window.removeEventListener("resize",n)}},[a,e.get_view,e.refresh_key]);const l=t=>{const n=e.get_view();n&&(t(n.state,n.dispatch),n.focus(),a())},u=e=>s.marks.includes(e),d=e=>"heading"===s.block.name&&s.block.level===e,[m,f]=(0,r.useState)({w:0,h:36});if((0,r.useLayoutEffect)(()=>{if(!c||!n.current)return;const e=n.current.offsetWidth,t=n.current.offsetHeight;f(n=>n.w===e&&n.h===t?n:{w:e,h:t})},[c,e.refresh_key]),!c)return null;const v=(e,n,r,s,o=!1)=>(0,w.jsx)("button",{className:"mdtb__btn"+(o?" mdtb__btn--on":""),title:t(r),onMouseDown:e=>e.preventDefault(),onClick:s,children:n},e),_=m.w/2,p=_+4,x=Math.max(p,window.innerWidth-_-4),y=document.querySelector(".header")?.getBoundingClientRect().bottom??0,b=c.top-m.h-8,j=b<y+4,E={top:j?Math.min(c.bottom+8,window.innerHeight-m.h-4):b,left:Math.min(x,Math.max(p,c.left))};return(0,w.jsxs)("div",{className:"mdtb mdtb--floating"+(j?" mdtb--below":""),ref:n,style:E,children:[v("h1","H1","一级标题",()=>l((0,g.uf)("heading",{level:1})),d(1)),v("h2","H2","二级标题",()=>l((0,g.uf)("heading",{level:2})),d(2)),v("h3","H3","三级标题",()=>l((0,g.uf)("heading",{level:3})),d(3)),(0,w.jsx)("span",{className:"mdtb__sep"}),v("b","B","加粗",()=>l((0,g.NH)("strong")),u("strong")),v("i","I","斜体",()=>l((0,g.NH)("em")),u("em")),v("s","S","删除线",()=>l((0,g.NH)("strike")),u("strike")),v("code","</>","行内代码",()=>l((0,g.NH)("code")),u("code")),(0,w.jsx)("span",{className:"mdtb__sep"}),v("ul","≔","无序列表",()=>l(g.fK)),v("ol","1.","有序列表",()=>l(g.oB)),v("quote","❝","引用",()=>l(g.Vu))]})}function k(e){for(let t=e.depth;t>0;t--){const n=e.node(t).type.name;if("heading"===n)return{name:"heading",level:e.node(t).attrs.level};if("paragraph"===n)return{name:"paragraph"}}return{name:"paragraph"}}var y=n(75725),b=n(86059);const j="cut",E="copy",S="paste",C="strong",N="em",L="strike",A="code",R="h1",H="h2",M="h3",G="paragraph",z="bullet",B="ordered",P="quote",$="code_block",F="clean",D="row_before",K="row_after",I="row_delete",T="col_before",U="col_after",W="col_delete",Y="header_toggle",X="cell_merge",q="cell_split",V="table_delete",J="table_insert",O="select_all";function Z(e){const{t}=(0,h.B)(),[n,s]=(0,r.useState)(null),o=(0,r.useRef)(e.get_view);o.current=e.get_view,(0,r.useEffect)(()=>{const e=e=>{const t=o.current();if(!t)return;const n=e.target;if(!n||!n.closest(".md-filecat-content"))return;e.preventDefault();const r=t.posAtCoords({left:e.clientX,top:e.clientY});if(r){const e=t.state.selection;if(r.pos<e.from||r.pos>e.to){const{TextSelection:e}=t.state.selection.constructor;try{t.dispatch(t.state.tr.setSelection(e.near(t.state.doc.resolve(r.pos))))}catch{}}}const c=!!n.closest("td, th");s({x:e.clientX,y:e.clientY,in_table:c||(0,b.aH)(t.state)})};return document.addEventListener("contextmenu",e,!0),()=>document.removeEventListener("contextmenu",e,!0)},[]);const c=()=>s(null),i=(0,r.useCallback)(e=>{const t=o.current();t&&(e(t.state,t.dispatch),t.focus(),c())},[]),a=e=>{const t=o.current();t?.focus(),document.execCommand(e),c()};if(!n)return null;const l=n.in_table?[{r:t("上方插入行"),v:D},{r:t("下方插入行"),v:K},{r:t("左侧插入列"),v:T},{r:t("右侧插入列"),v:U},{r:t("删除行"),v:I},{r:t("删除列"),v:W},{r:t("切换表头行"),v:Y},{r:t("合并单元格"),v:X},{r:t("拆分单元格"),v:q},{r:t("删除表格"),v:V}]:[],u=[{r:t("剪切"),v:j},{r:t("复制"),v:E},{r:t("粘贴"),v:S},{r:t("格式"),v:"format",items:[{r:t("加粗"),v:C},{r:t("斜体"),v:N},{r:t("删除线"),v:L},{r:t("行内代码"),v:A}]},{r:t("段落"),v:"block",items:[{r:t("一级标题"),v:R},{r:t("二级标题"),v:H},{r:t("三级标题"),v:M},{r:t("正文"),v:G}]},{r:t("插入"),v:"insert",items:[{r:t("无序列表"),v:z},{r:t("有序列表"),v:B},{r:t("引用"),v:P},{r:t("代码块"),v:$},{r:t("插入表格"),v:J}]},...l.length?[{r:t("表格"),v:"table",items:l}]:[],{r:t("清除格式"),v:F},{r:t("全选"),v:O}];return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(y.rY,{click:c}),(0,w.jsx)(y.Pu,{x:n.x,y:n.y,items:u,click:t=>{switch(t){case j:return a("cut");case E:return a("copy");case S:return a("paste");case C:return i((0,g.NH)("strong"));case N:return i((0,g.NH)("em"));case L:return i((0,g.NH)("strike"));case A:return i((0,g.NH)("code"));case R:return i((0,g.uf)("heading",{level:1}));case H:return i((0,g.uf)("heading",{level:2}));case M:return i((0,g.uf)("heading",{level:3}));case G:return i((0,g.uf)("paragraph"));case z:return i(g.fK);case B:return i(g.oB);case P:return i(g.Vu);case $:return i((0,g.uf)("code_block"));case J:return c(),void e.on_insert_table?.();case D:return i(b.JD);case K:return i(b.gC);case T:return i(b.RC);case U:return i(b.GU);case I:return i(b.aR);case W:return i(b.gR);case Y:return i(b.uC);case X:return i(b.w7);case q:return i(b.L0);case V:return i(b.kG);case F:return i((e,t)=>{const{from:n,to:r}=e.selection;let s=e.tr;return e.doc.nodesBetween(n,r,(e,t)=>{if(e.isText)for(const n of e.marks)s=s.removeMark(t,t+e.nodeSize,n.type)}),t?.(s),!0});case O:return i((e,t)=>{const{TextSelection:n}=e.selection.constructor;return t?.(e.tr.setSelection(n.create(e.doc,0,e.doc.content.size))),!0})}}})]})}var Q=n(64877);function ee(e){const t=[];if(!e)return t;const n=e.split(/(\n)/);let r=null,s=0;for(let e=0;e<n.length;e+=2){const o=n[e],c=s;s+=o.length+(n[e+1]?.length??0);const i=o.endsWith("\r")?o.slice(0,-1):o,a=i.trimStart(),l=/^(`{3,}|~{3,})/.exec(a);if(l){const e=l[1][0];null===r?r=e:r===e&&(r=null);continue}if(null!==r)continue;const u=/^ {0,3}(#{1,6})\s+(.*)$/.exec(i);if(!u)continue;const d=u[1].length,m=u[2].replace(/\s+#+\s*$/,"").trim();t.push({level:d,text:m,pos:c})}return t}var te=n(69918),ne=n(96763),re=n(40505);function se(e){const{t}=(0,h.B)(),[n,s]=(0,r.useState)(!1),[i,a]=(0,r.useState)({x:0,y:0}),[u,d]=(0,r.useState)([]),[m]=(0,o.fp)(c.AG.user_base_info);(0,r.useEffect)(()=>{if(!n)return;let e=!1;return(0,ne.Kz)().then(t=>{e||d(t)}),()=>{e=!0}},[n]);const f=(e,t)=>(0,w.jsx)("div",{style:{...(0,re.ok)(t===m?.user_data?.md_editor_theme)},children:e});return(0,w.jsxs)(r.Fragment,{children:[(0,w.jsx)(l.rA,{icon:"palette",title:t("主题"),onClick:e=>{a({x:e.clientX,y:e.clientY}),s(!0)}}),n&&(0,w.jsx)(y.rY,{click:()=>s(!1),children:(0,w.jsx)(y.Pu,{x:i.x,y:i.y,items:[{r:f(t("follow_sys"),""),v:""},...u.map(e=>({r:f(e.id,e.id),v:e.id}))],click:t=>{s(!1),e.on_change(t)}})})]})}var oe=n(2543),ce=n(86090),ie=n(87361);function ae(){const{t:e}=(0,h.B)(),t=(0,ce.Zp)(),{check_user_auth:n}=(0,i.MH)(),g=n(a.oV.md_editor_setting),[k,y]=(0,o.fp)(c.AG.md_editor),b=(0,o.fp)(c.AG.md_editor_last_context)[1],j=(0,r.useRef)(null),[E,S]=(0,r.useState)(null),[C,N]=(0,r.useState)(!1),[L,A]=(0,r.useState)(!1),[R,H]=(0,r.useState)(0),M=(0,r.useRef)(null),[G,z]=(0,r.useState)([]),[B,P]=(0,r.useState)(-1),[$,F]=(0,r.useState)(15),[D,K]=(0,r.useState)(!1),I=(0,r.useRef)(null),T=(0,r.useRef)(null),[U,W]=(0,o.fp)(c.AG.md_editor_show_outline),[Y,X]=(0,o.fp)(c.AG.md_editor_mode),q=(0,r.useCallback)(()=>{const e="wysiwyg"===Y?"source":"wysiwyg",t=M.current;t&&("source"===e?t.enter_source_mode():t.exit_source_mode(),X(e))},[Y]),[V]=(0,o.fp)(c.AG.md_editor_setting),[J,O]=(0,o.fp)(c.AG.md_theme_css),[re]=(0,o.fp)(c.AG.user_base_info),{initUserInfo:ae}=(0,r.useContext)(s.F),le=(0,r.useRef)(null),ue=(0,r.useRef)(null);(0,r.useEffect)(()=>{ue.current},[re]),(0,r.useEffect)(()=>{(0,te.Ce)(le.current,V)},[V]);(0,r.useEffect)(()=>{(0,ne.bN)("editor",J)},[J]),(0,r.useEffect)(()=>{const e=()=>{(0,ne.sO)().then(O)};return window.addEventListener(ne.o3,e),()=>window.removeEventListener(ne.o3,e)},[]);const de=(0,r.useRef)([]),me=(0,r.useCallback)(()=>{const e=M.current;if(!e)return;const t=e.is_source_mode()?ee(e.get_markdown()):e.get_headings();de.current=t,z(t)},[]),fe=(0,r.useCallback)(()=>{const e=M.current,t=e?.get_view();if(!e||!t)return;const n=e.is_source_mode()?t.state.selection.from-1:t.state.selection.from;let r=-1;for(const e of de.current){if(!(e.pos<=n))break;r=e.pos}P(r)},[]);(0,r.useEffect)(()=>{let t=!1;if(k?.url)return A(!1),N(!0),v.l.get(k.url).then(e=>{if(t)return;S(e??"")}).catch(()=>{t||((0,d.zN)(e("打开失败")),S(""))}).finally(()=>{t||N(!1)}),()=>{t=!0};S(null)},[k?.url]),(0,r.useEffect)(()=>{const e=()=>H(e=>e+1);return document.addEventListener("selectionchange",e),()=>document.removeEventListener("selectionchange",e)},[]);const ve=(0,r.useRef)(q);ve.current=q,(0,r.useEffect)(()=>{const e=e=>{(e.ctrlKey||e.metaKey)&&"/"===e.key&&(e.preventDefault(),e.stopPropagation(),ve.current())};return document.addEventListener("keydown",e,!0),()=>document.removeEventListener("keydown",e,!0)},[]),(0,r.useEffect)(()=>{me(),fe()},[R,Y,me,fe]);const _e=(0,r.useCallback)(oe.throttle(e=>{if(!I.current||!T.current)return;const t=parseFloat(getComputedStyle(I.current).fontSize),n=e.clientX/t,r=window.innerWidth/t-4,s=2.25+T.current.offsetWidth/t;n<=r&&n>=s&&F(parseFloat(n.toFixed(2)))},32),[]),he=()=>{K(!1),I.current?.removeEventListener("pointermove",_e)},pe=async(t=!1)=>{if(!k?.name||!k?.path)return;const n=M.current?.get_markdown();if(void 0===n)return;const r=k.path.slice(0,k.path.length-k.name.length),s=`${encodeURIComponent(r)}${k.name}`;(await f.$M.post(`save/${s}`,{context:n})).code===m.m.Success?(A(!1),t||(0,d.SK)(e("保存成功"))):(0,d.zN)(e("保存失败"))},ge=(0,r.useRef)(pe);ge.current=pe;const we=(0,r.useRef)(L);we.current=L;const xe=V?.auto_save_interval??0;(0,r.useEffect)(()=>{if(xe<=0)return;const e=setInterval(()=>{we.current&&ge.current(!0)},1e3*xe);return()=>clearInterval(e)},[xe]);const ke=()=>{y({}),A(!1),S(null),M.current=null,k?.close?.()},ye=(0,r.useMemo)(()=>k?.url??"md_editor",[k?.url]);return k?.name?(0,w.jsxs)("div",{id:"md-editor-container",ref:le,children:[(0,w.jsx)(u.A,{ignore_tags:!0,left_children:[(0,w.jsx)(l.rA,{title:e("关闭"),icon:"close",onClick:ke},1),(0,w.jsx)("div",{className:"md-editor-title",children:k.name},3),...L?[(0,w.jsx)(l.rA,{title:e("保存"),icon:"save",onClick:pe},2)]:[],(0,w.jsx)(l.rA,{title:e("大纲"),icon:"list",onClick:()=>W(e=>!e),selected:U},4),(0,w.jsx)(l.rA,{title:e("wysiwyg"===Y?"源码模式":"实时编辑模式"),icon:"wysiwyg"===Y?"code":"edit",onClick:q},5),(0,w.jsx)(se,{on_change:async t=>{const n=await f.wm.post(_.s.user_save_private_attr,{is_md_theme:!0,md_editor_theme:t});n?.code===m.m.Success?(ue.current=t,await ae(),(0,d.SK)(e("保存成功"))):(0,d.zN)(e("保存失败"))}},8),(0,w.jsx)(l.rA,{title:e("导出PDF"),icon:"print",onClick:()=>{window.print()}},7),...g?[(0,w.jsx)(l.rA,{title:e("编辑器设置"),icon:"settings",onClick:()=>{ke(),t(ie.o.md_editor_setting_page)}},6)]:[]]}),(0,w.jsxs)("div",{className:"md-editor-context",ref:I,children:[C&&(0,w.jsxs)("div",{className:"common-box common-box-center",children:[e("加载中"),"..."]}),!C&&null!==E&&(0,w.jsxs)(r.Fragment,{children:[U&&(0,w.jsx)("div",{className:"md-outline-panel",style:{width:`${$}em`},children:(0,w.jsx)(Q.A,{items:G,active_pos:B,on_click:e=>{const t=M.current;t&&(t.scroll_to_pos(t.is_source_mode()?e.pos+1:e.pos),P(e.pos))}})}),U&&(0,w.jsx)("div",{className:"md-editor-divider",ref:T,onPointerDown:()=>{K(!0),I.current?.addEventListener("pointermove",_e)},onPointerUp:he}),D&&(0,w.jsx)("div",{className:"md-editor-drag-overlay",onPointerUp:he}),(0,w.jsx)("div",{className:"md-editor-scroll",children:(0,w.jsxs)("div",{className:"md-editor-sheet",children:["wysiwyg"===Y&&(0,w.jsx)(x,{get_view:()=>M.current?.get_view()??null,refresh_key:R}),(0,w.jsx)(p.A,{value:E,ref:M,initial_source_mode:"source"===Y,on_ready:e=>{const t=e.is_source_mode()?ee(e.get_markdown()):e.get_headings();de.current=t,z(t),P(-1)},on_change:()=>{L||A(!0),j.current&&clearTimeout(j.current),j.current=setTimeout(()=>{const e=M.current?.get_markdown()??"";e&&b(e)},800)},on_save:()=>ge.current(),on_selection_change:()=>H(e=>e+1),on_source_mode_change:e=>{X(e?"source":"wysiwyg"),H(e=>e+1)}},ye),"wysiwyg"===Y&&(0,w.jsx)(Z,{get_view:()=>M.current?.get_view()??null,on_insert_table:()=>{M.current?.insert_table(3,3),A(!0)}})]})})]})]})]}):null}}}]);
|
|
1
|
+
"use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[1142],{71142(e,t,n){n.r(t),n.d(t,{default:()=>ae});var r=n(96540),s=n(7523),o=n(34843),c=n(82893),i=n(78247),a=n(23430),l=n(85997),u=n(57952),d=n(62042),m=n(53459),f=n(14284),v=n(57889),_=n(23496),h=n(86149),p=n(86504),g=n(67951),w=n(74848);function x(e){const{t}=(0,h.B)(),n=(0,r.useRef)(null),[s,o]=(0,r.useState)({marks:[],block:{name:"paragraph"}}),[c,i]=(0,r.useState)(null),a=(0,r.useCallback)(()=>{const t=e.get_view();if(!t)return;const n=t.state.selection,r=t.state.storedMarks??n.$from.marks();if(o({marks:r.map(e=>e.type.name),block:k(n.$from)}),n.empty)return void i(null);const s=t.coordsAtPos(n.from),c=t.coordsAtPos(n.to),a=(Math.min(s.left,c.left)+Math.max(s.right,c.right))/2,l=Math.min(s.top,c.top),u=Math.max(s.bottom,c.bottom);i({top:l,bottom:u,left:a})},[e.get_view]);(0,r.useEffect)(()=>{a();const t=e.get_view();if(!t)return;const n=()=>a();t.dom.addEventListener("keyup",n),t.dom.addEventListener("mouseup",n),document.addEventListener("selectionchange",n);const r=t.dom.closest(".md-editor-context");return r?.addEventListener("scroll",n,{passive:!0}),window.addEventListener("resize",n),()=>{t.dom.removeEventListener("keyup",n),t.dom.removeEventListener("mouseup",n),document.removeEventListener("selectionchange",n),r?.removeEventListener("scroll",n),window.removeEventListener("resize",n)}},[a,e.get_view,e.refresh_key]);const l=t=>{const n=e.get_view();n&&(t(n.state,n.dispatch),n.focus(),a())},u=e=>s.marks.includes(e),d=e=>"heading"===s.block.name&&s.block.level===e,[m,f]=(0,r.useState)({w:0,h:36});if((0,r.useLayoutEffect)(()=>{if(!c||!n.current)return;const e=n.current.offsetWidth,t=n.current.offsetHeight;f(n=>n.w===e&&n.h===t?n:{w:e,h:t})},[c,e.refresh_key]),!c)return null;const v=(e,n,r,s,o=!1)=>(0,w.jsx)("button",{className:"mdtb__btn"+(o?" mdtb__btn--on":""),title:t(r),onMouseDown:e=>e.preventDefault(),onClick:s,children:n},e),_=m.w/2,p=_+4,x=Math.max(p,window.innerWidth-_-4),y=document.querySelector(".header")?.getBoundingClientRect().bottom??0,b=c.top-m.h-8,j=b<y+4,E={top:j?Math.min(c.bottom+8,window.innerHeight-m.h-4):b,left:Math.min(x,Math.max(p,c.left))};return(0,w.jsxs)("div",{className:"mdtb mdtb--floating"+(j?" mdtb--below":""),ref:n,style:E,children:[v("h1","H1","一级标题",()=>l((0,g.uf)("heading",{level:1})),d(1)),v("h2","H2","二级标题",()=>l((0,g.uf)("heading",{level:2})),d(2)),v("h3","H3","三级标题",()=>l((0,g.uf)("heading",{level:3})),d(3)),(0,w.jsx)("span",{className:"mdtb__sep"}),v("b","B","加粗",()=>l((0,g.NH)("strong")),u("strong")),v("i","I","斜体",()=>l((0,g.NH)("em")),u("em")),v("s","S","删除线",()=>l((0,g.NH)("strike")),u("strike")),v("code","</>","行内代码",()=>l((0,g.NH)("code")),u("code")),(0,w.jsx)("span",{className:"mdtb__sep"}),v("ul","≔","无序列表",()=>l(g.fK)),v("ol","1.","有序列表",()=>l(g.oB)),v("quote","❝","引用",()=>l(g.Vu))]})}function k(e){for(let t=e.depth;t>0;t--){const n=e.node(t).type.name;if("heading"===n)return{name:"heading",level:e.node(t).attrs.level};if("paragraph"===n)return{name:"paragraph"}}return{name:"paragraph"}}var y=n(75725),b=n(86059);const j="cut",E="copy",S="paste",C="strong",N="em",L="strike",A="code",R="h1",H="h2",M="h3",G="paragraph",z="bullet",B="ordered",P="quote",$="code_block",F="clean",D="row_before",K="row_after",I="row_delete",T="col_before",U="col_after",W="col_delete",Y="header_toggle",X="cell_merge",q="cell_split",V="table_delete",J="table_insert",O="select_all";function Z(e){const{t}=(0,h.B)(),[n,s]=(0,r.useState)(null),o=(0,r.useRef)(e.get_view);o.current=e.get_view,(0,r.useEffect)(()=>{const e=e=>{const t=o.current();if(!t)return;const n=e.target;if(!n||!n.closest(".md-filecat-content"))return;e.preventDefault();const r=t.posAtCoords({left:e.clientX,top:e.clientY});if(r){const e=t.state.selection;if(r.pos<e.from||r.pos>e.to){const{TextSelection:e}=t.state.selection.constructor;try{t.dispatch(t.state.tr.setSelection(e.near(t.state.doc.resolve(r.pos))))}catch{}}}const c=!!n.closest("td, th");s({x:e.clientX,y:e.clientY,in_table:c||(0,b.aH)(t.state)})};return document.addEventListener("contextmenu",e,!0),()=>document.removeEventListener("contextmenu",e,!0)},[]);const c=()=>s(null),i=(0,r.useCallback)(e=>{const t=o.current();t&&(e(t.state,t.dispatch),t.focus(),c())},[]),a=e=>{const t=o.current();t?.focus(),document.execCommand(e),c()};if(!n)return null;const l=n.in_table?[{r:t("上方插入行"),v:D},{r:t("下方插入行"),v:K},{r:t("左侧插入列"),v:T},{r:t("右侧插入列"),v:U},{r:t("删除行"),v:I},{r:t("删除列"),v:W},{r:t("切换表头行"),v:Y},{r:t("合并单元格"),v:X},{r:t("拆分单元格"),v:q},{r:t("删除表格"),v:V}]:[],u=[{r:t("剪切"),v:j},{r:t("复制"),v:E},{r:t("粘贴"),v:S},{r:t("格式"),v:"format",items:[{r:t("加粗"),v:C},{r:t("斜体"),v:N},{r:t("删除线"),v:L},{r:t("行内代码"),v:A}]},{r:t("段落"),v:"block",items:[{r:t("一级标题"),v:R},{r:t("二级标题"),v:H},{r:t("三级标题"),v:M},{r:t("正文"),v:G}]},{r:t("插入"),v:"insert",items:[{r:t("无序列表"),v:z},{r:t("有序列表"),v:B},{r:t("引用"),v:P},{r:t("代码块"),v:$},{r:t("插入表格"),v:J}]},...l.length?[{r:t("表格"),v:"table",items:l}]:[],{r:t("清除格式"),v:F},{r:t("全选"),v:O}];return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(y.rY,{click:c}),(0,w.jsx)(y.Pu,{x:n.x,y:n.y,items:u,click:t=>{switch(t){case j:return a("cut");case E:return a("copy");case S:return a("paste");case C:return i((0,g.NH)("strong"));case N:return i((0,g.NH)("em"));case L:return i((0,g.NH)("strike"));case A:return i((0,g.NH)("code"));case R:return i((0,g.uf)("heading",{level:1}));case H:return i((0,g.uf)("heading",{level:2}));case M:return i((0,g.uf)("heading",{level:3}));case G:return i((0,g.uf)("paragraph"));case z:return i(g.fK);case B:return i(g.oB);case P:return i(g.Vu);case $:return i((0,g.uf)("code_block"));case J:return c(),void e.on_insert_table?.();case D:return i(b.JD);case K:return i(b.gC);case T:return i(b.RC);case U:return i(b.GU);case I:return i(b.aR);case W:return i(b.gR);case Y:return i(b.uC);case X:return i(b.w7);case q:return i(b.L0);case V:return i(b.kG);case F:return i((e,t)=>{const{from:n,to:r}=e.selection;let s=e.tr;return e.doc.nodesBetween(n,r,(e,t)=>{if(e.isText)for(const n of e.marks)s=s.removeMark(t,t+e.nodeSize,n.type)}),t?.(s),!0});case O:return i((e,t)=>{const{TextSelection:n}=e.selection.constructor;return t?.(e.tr.setSelection(n.create(e.doc,0,e.doc.content.size))),!0})}}})]})}var Q=n(64877);function ee(e){const t=[];if(!e)return t;const n=e.split(/(\n)/);let r=null,s=0;for(let e=0;e<n.length;e+=2){const o=n[e],c=s;s+=o.length+(n[e+1]?.length??0);const i=o.endsWith("\r")?o.slice(0,-1):o,a=i.trimStart(),l=/^(`{3,}|~{3,})/.exec(a);if(l){const e=l[1][0];null===r?r=e:r===e&&(r=null);continue}if(null!==r)continue;const u=/^ {0,3}(#{1,6})\s+(.*)$/.exec(i);if(!u)continue;const d=u[1].length,m=u[2].replace(/\s+#+\s*$/,"").trim();t.push({level:d,text:m,pos:c})}return t}var te=n(69918),ne=n(96763),re=n(40505);function se(e){const{t}=(0,h.B)(),[n,s]=(0,r.useState)(!1),[i,a]=(0,r.useState)({x:0,y:0}),[u,d]=(0,r.useState)([]),[m]=(0,o.fp)(c.AG.user_base_info);(0,r.useEffect)(()=>{if(!n)return;let e=!1;return(0,ne.Kz)().then(t=>{e||d(t)}),()=>{e=!0}},[n]);const f=(e,t)=>(0,w.jsx)("div",{style:{...(0,re.ok)(t===m?.user_data?.md_editor_theme)},children:e});return(0,w.jsxs)(r.Fragment,{children:[(0,w.jsx)(l.rA,{icon:"palette",title:t("主题"),onClick:e=>{a({x:e.clientX,y:e.clientY}),s(!0)}}),n&&(0,w.jsx)(y.rY,{click:()=>s(!1),children:(0,w.jsx)(y.Pu,{x:i.x,y:i.y,items:[{r:f(t("follow_sys"),""),v:""},...u.map(e=>({r:f(e.id,e.id),v:e.id}))],click:t=>{s(!1),e.on_change(t)}})})]})}var oe=n(2543),ce=n(86090),ie=n(87361);function ae(){const{t:e}=(0,h.B)(),t=(0,ce.Zp)(),{check_user_auth:n}=(0,i.MH)(),g=n(a.oV.md_editor_setting),[k,y]=(0,o.fp)(c.AG.md_editor),b=(0,o.fp)(c.AG.md_editor_last_context)[1],j=(0,r.useRef)(null),[E,S]=(0,r.useState)(null),[C,N]=(0,r.useState)(!1),[L,A]=(0,r.useState)(!1),[R,H]=(0,r.useState)(0),M=(0,r.useRef)(null),[G,z]=(0,r.useState)([]),[B,P]=(0,r.useState)(-1),[$,F]=(0,r.useState)(15),[D,K]=(0,r.useState)(!1),I=(0,r.useRef)(null),T=(0,r.useRef)(null),[U,W]=(0,o.fp)(c.AG.md_editor_show_outline),[Y,X]=(0,o.fp)(c.AG.md_editor_mode),q=(0,r.useCallback)(()=>{const e="wysiwyg"===Y?"source":"wysiwyg",t=M.current;t&&("source"===e?t.enter_source_mode():t.exit_source_mode(),X(e))},[Y]),[V]=(0,o.fp)(c.AG.md_editor_setting),[J,O]=(0,o.fp)(c.AG.md_theme_css),[re]=(0,o.fp)(c.AG.user_base_info),{initUserInfo:ae}=(0,r.useContext)(s.F),le=(0,r.useRef)(null),ue=(0,r.useRef)(null);(0,r.useEffect)(()=>{ue.current},[re]),(0,r.useEffect)(()=>{(0,te.Ce)(le.current,V)},[V]);(0,r.useEffect)(()=>{(0,ne.bN)("editor",J)},[J]),(0,r.useEffect)(()=>{const e=()=>{(0,ne.sO)().then(O)};return window.addEventListener(ne.o3,e),()=>window.removeEventListener(ne.o3,e)},[]);const de=(0,r.useRef)([]),me=(0,r.useCallback)(()=>{const e=M.current;if(!e)return;const t=e.is_source_mode()?ee(e.get_markdown()):e.get_headings();de.current=t,z(t)},[]),fe=(0,r.useCallback)(()=>{const e=M.current,t=e?.get_view();if(!e||!t)return;const n=e.is_source_mode()?t.state.selection.from-1:t.state.selection.from;let r=-1;for(const e of de.current){if(!(e.pos<=n))break;r=e.pos}P(r)},[]);(0,r.useEffect)(()=>{let t=!1;if(k?.url)return A(!1),N(!0),v.l.get(k.url).then(e=>{if(t)return;S(e??"")}).catch(()=>{t||((0,d.zN)(e("打开失败")),S(""))}).finally(()=>{t||N(!1)}),()=>{t=!0};S(null)},[k?.url]),(0,r.useEffect)(()=>{const e=()=>H(e=>e+1);return document.addEventListener("selectionchange",e),()=>document.removeEventListener("selectionchange",e)},[]);const ve=(0,r.useRef)(q);ve.current=q,(0,r.useEffect)(()=>{const e=e=>{(e.ctrlKey||e.metaKey)&&"/"===e.key&&(e.preventDefault(),e.stopPropagation(),ve.current())};return document.addEventListener("keydown",e,!0),()=>document.removeEventListener("keydown",e,!0)},[]),(0,r.useEffect)(()=>{me(),fe()},[R,Y,me,fe]);const _e=(0,r.useCallback)(oe.throttle(e=>{if(!I.current||!T.current)return;const t=parseFloat(getComputedStyle(I.current).fontSize),n=e.clientX/t,r=window.innerWidth/t-4,s=2.25+T.current.offsetWidth/t;n<=r&&n>=s&&F(parseFloat(n.toFixed(2)))},32),[]),he=()=>{K(!1),I.current?.removeEventListener("pointermove",_e)},pe=async(t=!1)=>{if(!k?.name||!k?.path)return;const n=M.current?.get_markdown();if(void 0===n)return;const r=k.path.slice(0,k.path.length-k.name.length),s=`${encodeURIComponent(r)}${k.name}`;(await f.$M.post(`save/${s}`,{context:n})).code===m.m.Success?(A(!1),t||(0,d.SK)(e("保存成功"))):(0,d.zN)(e("保存失败"))},ge=(0,r.useRef)(pe);ge.current=pe;const we=(0,r.useRef)(L);we.current=L;const xe=V?.auto_save_interval??0;(0,r.useEffect)(()=>{if(k.readonly||xe<=0)return;const e=setInterval(()=>{we.current&&ge.current(!0)},1e3*xe);return()=>clearInterval(e)},[xe,k.readonly]);const ke=()=>{y({}),A(!1),S(null),M.current=null,k?.close?.()},ye=(0,r.useMemo)(()=>k?.url??"md_editor",[k?.url]);return k?.name?(0,w.jsxs)("div",{id:"md-editor-container",ref:le,children:[(0,w.jsx)(u.A,{ignore_tags:!0,left_children:[(0,w.jsx)(l.rA,{title:e("关闭"),icon:"close",onClick:ke},1),(0,w.jsx)("div",{className:"md-editor-title",children:k.name},3),...L&&!k.readonly?[(0,w.jsx)(l.rA,{title:e("保存"),icon:"save",onClick:pe},2)]:[],(0,w.jsx)(l.rA,{title:e("大纲"),icon:"list",onClick:()=>W(e=>!e),selected:U},4),...k.readonly?[]:[(0,w.jsx)(l.rA,{title:e("wysiwyg"===Y?"源码模式":"实时编辑模式"),icon:"wysiwyg"===Y?"code":"edit",onClick:q},5)],...k.readonly?[]:[(0,w.jsx)(se,{on_change:async t=>{const n=await f.wm.post(_.s.user_save_private_attr,{is_md_theme:!0,md_editor_theme:t});n?.code===m.m.Success?(ue.current=t,await ae(),(0,d.SK)(e("保存成功"))):(0,d.zN)(e("保存失败"))}},8)],(0,w.jsx)(l.rA,{title:e("导出PDF"),icon:"print",onClick:()=>{window.print()}},7),...g&&!k.readonly?[(0,w.jsx)(l.rA,{title:e("编辑器设置"),icon:"settings",onClick:()=>{ke(),t(ie.o.md_editor_setting_page)}},6)]:[]]}),(0,w.jsxs)("div",{className:"md-editor-context",ref:I,children:[C&&(0,w.jsxs)("div",{className:"common-box common-box-center",children:[e("加载中"),"..."]}),!C&&null!==E&&(0,w.jsxs)(r.Fragment,{children:[U&&(0,w.jsx)("div",{className:"md-outline-panel",style:{width:`${$}em`},children:(0,w.jsx)(Q.A,{items:G,active_pos:B,on_click:e=>{const t=M.current;t&&(t.scroll_to_pos(t.is_source_mode()?e.pos+1:e.pos),P(e.pos))}})}),U&&(0,w.jsx)("div",{className:"md-editor-divider",ref:T,onPointerDown:()=>{K(!0),I.current?.addEventListener("pointermove",_e)},onPointerUp:he}),D&&(0,w.jsx)("div",{className:"md-editor-drag-overlay",onPointerUp:he}),(0,w.jsx)("div",{className:"md-editor-scroll",children:(0,w.jsxs)("div",{className:"md-editor-sheet",children:["wysiwyg"===Y&&(0,w.jsx)(x,{get_view:()=>M.current?.get_view()??null,refresh_key:R}),(0,w.jsx)(p.A,{value:E,ref:M,initial_source_mode:"source"===Y,on_ready:e=>{const t=e.is_source_mode()?ee(e.get_markdown()):e.get_headings();de.current=t,z(t),P(-1)},on_change:()=>{L||A(!0),j.current&&clearTimeout(j.current),j.current=setTimeout(()=>{const e=M.current?.get_markdown()??"";e&&b(e)},800)},on_save:()=>ge.current(),on_selection_change:()=>H(e=>e+1),on_source_mode_change:e=>{X(e?"source":"wysiwyg"),H(e=>e+1)}},ye),"wysiwyg"===Y&&(0,w.jsx)(Z,{get_view:()=>M.current?.get_view()??null,on_insert_table:()=>{M.current?.insert_table(3,3),A(!0)}})]})})]})]})]}):null}}}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[3328],{77481(e,t,s){s.d(t,{S:()=>o,X:()=>l});var n=s(96540),i=s(61443),a=s(74848);function l(e){const[t,s]=n.useState([]),l=(0,n.useRef)(-1),[o,r]=(0,n.useState)(-1),[c,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 h=()=>{l.current=-1,r(-1),d(-1)};return(0,a.jsxs)("table",{children:[(0,a.jsx)("thead",{children:(0,a.jsx)("tr",{children:e.headers?.map((t,s)=>{const n=!!e.filter&&(e.filter.column??0)===s;let l=t;if(n){const s=e.filter,n=s.options.find(e=>e.value===s.value);null!=s.value&&n&&(l=`${t} (${n.label})`)}return(0,a.jsx)("th",{className:n?"table-filter-col":"",children:n?(0,a.jsx)(i.l6,{value:e.filter.value,options:e.filter.options,onChange:e.filter.onChange,bare:!0,trigger_label:l}):t},s)})})}),(0,a.jsx)("tbody",{children:t.map((t,s)=>{const n=!!e.onRowDrag;return(0,a.jsx)("tr",{className:n?(o===s?"row-dragging":"")+(c===s?" row-drop-target":""):"",draggable:n,onContextMenu:()=>{e.handleContextMenu&&e.handleContextMenu(t)},onDragStart:e=>{n&&(l.current=s,r(s),e.dataTransfer.effectAllowed="move")},onDragOver:e=>{!n||l.current<0||(e.preventDefault(),e.dataTransfer.dropEffect="move",d(s))},onDrop:t=>{n&&(t.preventDefault(),(()=>{const t=l.current,s=c;h(),t<0||s<0||t===s||e.onRowDrag?.(t,s)})())},onDragEnd:h,children:t.map((s,n)=>{const i=n===t.length-1?"small":"";return(0,a.jsx)("td",{className:i,style:{width:e.width??"auto"},children:s},n)})},s)})})]})}function o(e){return(0,a.jsx)("div",{style:{display:e.isFlex?"flex":"block"},children:e.columns.map((e,t)=>(0,a.jsx)("div",{children:e},t))})}},53328(e,t,s){s.r(t),s.d(t,{default:()=>U});var n=s(96540),i=s(75725),a=s(23430),l=s(70447),o=s(85997),r=s(61443),c=s(14284),d=s(53459),h=s(77481),u=s(86149),p=s(82893),x=s(40505),_=s(62042),m=s(21499),j=s(21469),v=s(64694),f=s(74848);function g(e){const{t}=(0,u.B)(),[s,a]=(0,n.useState)([]);(0,n.useEffect)(()=>{(async()=>{if(e.getItems){const t=await e.getItems();a(t)}})()},[]);return(0,f.jsx)(i.xh,{children:(0,f.jsx)(l.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e.title}),e.info_click&&(0,f.jsx)(o.rA,{icon:"info",onClick:()=>{e.info_click()},title:"信息"})]}),titleCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(o.rA,{icon:"add",title:t("添加"),onClick:()=>{const t=[];for(let s=0;s<e.headers.length-1;s++)t.push("");a([t,...s])}}),(0,f.jsx)(o.rA,{icon:"save",title:t("保存"),onClick:async()=>{e.save&&await e.save(s)}})]}),children:(0,f.jsx)(h.X,{headers:e.headers,rows:s.map((n,i)=>{const l=[];for(let t=0;t<e.headers.length;t++)l.push((0,f.jsx)(r.Sm,{value:n[t],handleInputChange:e=>{n[t]=e,a([...s])},no_border:!0}));return l.push((0,f.jsxs)("div",{children:[(0,f.jsx)(o.rA,{icon:"delete",title:t("删除"),onClick:()=>(e=>{s.splice(e,1),a([...s])})(i)}),n[0]&&(0,f.jsx)(o.rA,{icon:"content_copy",title:t("复制地址"),onClick:()=>{const e=(0,m.bi)(`${window.location.origin}${j.m.base_url}`,n[0]);(0,x.lW)(e),(0,_.SK)(e)}}),n[0]&&e.need_copy&&(0,f.jsx)(o.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)}})]})),l}),width:"10rem",onRowDrag:(e,t)=>{a((0,v.TI)(s,e,t))}})})})}var w=s(34843),S=s(78247),y=s(24659);function C(){const{t:e}=(0,u.B)(),[t,s]=(0,w.fp)(p.AG.prompt_card),a=(0,y.K)(),g=[e("路由"),e("auth"),e("备注")],[C,k]=(0,w.fp)(p.AG.editorSetting),[b,A]=(0,n.useState)([]);(0,n.useEffect)(()=>{(async()=>{const e=await c.XO.get("api/customer_router");e.code===d.m.Success&&A(e.data)})()},[]);return(0,f.jsx)(i.xh,{children:(0,f.jsx)(l.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("api_rt")})," ",(0,f.jsx)(o.rA,{icon:"info",onClick:()=>{(()=>{let e=(0,f.jsx)("div",{children:'默认需要以 "/api" 开头的路由。'});s({open:!0,title:"信息",context_div:(0,f.jsx)("div",{children:e})})})()},title:"信息"})]}),titleCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{A([{note:"",needAuth:!1,router:""},...b])}}),(0,f.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await c.XO.post("api/customer_router/save",b)).code===d.m.Success&&(0,_.SK)("保存成功")}})]}),children:(0,f.jsx)(h.X,{headers:g,rows:b.map((t,s)=>{const n=[(0,f.jsx)(r.Sm,{value:t.router,handleInputChange:e=>{t.router=e,A([...b])},no_border:!0}),(0,f.jsx)(r.l6,{defaultValue:t.needAuth,onChange:e=>{t.needAuth=e,A([...b])},options:a,no_border:!0}),(0,f.jsx)(r.Sm,{value:t.note,handleInputChange:e=>{t.note=e,A([...b])},no_border:!0}),(0,f.jsxs)("div",{children:[(0,f.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{b.splice(e,1),A([...b])})(s)}),(0,f.jsx)(o.rA,{icon:"edit",title:e("编辑"),onClick:()=>(async e=>{if(!e.router)return void(0,_.zN)("路由不能为空");const t=await c.XO.get(`jscode/${encodeURIComponent(e.router)}`);k({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&&(S.xK.set_value_temp(""),k({open:!1,model:"",fileName:"",save:null}),(0,_.SK)("成功"))}}),S.xK.set_value_temp(t.data)})(t)}),t.router&&(0,f.jsx)(o.rA,{icon:"content_copy",title:e("复制地址"),onClick:()=>{(0,x.lW)((0,m.bi)(window.location.origin+j.m.base_url,t.router)),(0,_.SK)(e("已复制"))}})]})];return n}),width:"10rem",onRowDrag:(e,t)=>{A((0,v.TI)(b,e,t))}})})})}var k=s(23496),b=s(4412);function A(){const{t:e}=(0,u.B)(),[t,s]=(0,w.fp)(p.AG.prompt_card),[a,l]=(0,w.fp)(p.AG.router_jump),o=[e("路由"),e("路径"),e("过期时间(s)"),e("备注")],r=[e("路由"),e("文件路径"),"token","user id",e("备注")];return(0,f.jsxs)(n.Fragment,{children:[(0,f.jsx)(b.aZ,{position:"right"}),(0,f.jsxs)(i.fI,{children:[(0,f.jsxs)(i.VP,{maxWidth:"50rem",children:[(0,f.jsx)(g,{title:e("页面资源路由"),headers:o,getItems:async()=>{const e=await c.XO.get(k.s.setting_customer_router);if(e.code===d.m.Success){if(a?.page_self_router_api_data){for(const t of e.data)t[1]===a?.page_self_router_api_data[1]&&(0,_.N9)("已经存在的页面资源路由配置目录设置");const t={};Object.assign(t,a?.page_self_router_api_data),e.data=[t,...e.data],l({})}return e.data}return[]},save:async e=>{(await c.XO.post(k.s.setting_customer_router_save,e)).code===d.m.Success&&(0,_.SK)("success")},info_click:()=>{let e=(0,f.jsx)("div",{children:'默认需要以 "/api" 开头的路由,会自动识别地址,将页面转到对应结果。路径支持文件路径(如果是文件夹路径的最后最后一个名字将会成为资源实际地址,整个目录将会变成一个http目录),http地址。'});s({open:!0,title:"信息",context_div:(0,f.jsx)("div",{children:e})})},need_copy:!0}),(0,f.jsx)(g,{title:e("wf_rt"),headers:r,getItems:async()=>{const e=await c.XO.get(k.s.setting_customer_workflow_router);return e.code===d.m.Success?e.data:[]},save:async e=>{(await c.XO.post(k.s.setting_customer_workflow_router_save,e)).code===d.m.Success&&(0,_.SK)("保存成功")},info_click:()=>{let e=(0,f.jsx)("div",{children:'默认需要以 "/api" 开头的路由,文件路径是有效的workflow路径。token也可以是文件绝对路径,请求的时候请设置同样的authorization请求头字段。'});s({open:!0,title:"信息",context_div:(0,f.jsx)("div",{children:e})})}})]}),(0,f.jsx)(i.VP,{maxWidth:"50rem",children:(0,f.jsx)(C,{})})]})]})}var I=s(74777),V=s(6960),N=s(7523);function K(){const{t:e}=(0,u.B)(),{check_user_auth:t}=(0,S.MH)(),[s,i]=(0,n.useState)(!1),[h,x]=(0,n.useState)("https://registry.npmjs.org"),[m,j]=(0,n.useState)(""),[v,g]=(0,n.useState)(180),[y,C]=(0,n.useState)(!1),[k,b]=(0,w.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),x(t.version_check_url||"https://registry.npmjs.org"),j(t.exe_download_url||""),g(t.check_interval_seconds||180)}})()},[]);return t(a.oV.sys_setting_page)?(0,f.jsxs)(l.Zp,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("自动升级")}),(0,f.jsx)(o.rA,{icon:"info",onClick:()=>{b({open:!0,title:e("信息"),context_div:(0,f.jsx)("div",{children:e("自动升级在 windows 下目前可能不稳定")})})},title:e("信息")})]}),rightBottomCom:(0,f.jsx)(o.C3,{text:e("保存"),clickFun:async()=>{if(!h)return void(0,_.zN)(e("ver_req"));if(s&&(!v||v<10))return void(0,_.zN)(e("chk_10s"));const t=new I.Mm;t.open=s,t.version_check_url=h,t.exe_download_url=m,t.check_interval_seconds=v;(await c.XO.post("auto_upgrade_setting/save",t)).code===d.m.Success&&(0,_.SK)(e("保存成功"))}}),children:[(0,f.jsx)("div",{children:e("ver_url")}),(0,f.jsx)(r.Sm,{placeholder:"https://registry.npmjs.org",value:h,handleInputChange:e=>{x(e)}}),(0,f.jsx)(r.l6,{value:s,onChange:e=>{i(e)},options:[{title:e("开启"),value:!0},{title:e("关闭"),value:!1}]}),s&&(0,f.jsxs)(f.Fragment,{children:[!1,(0,f.jsx)("div",{children:e("检测频率(秒)")}),(0,f.jsx)(r.Sm,{placeholder:e("def_180"),value:v,handleInputChange:e=>{g(Number(e)||180)}}),(0,f.jsx)("div",{style:{marginTop:"12px"},children:(0,f.jsx)(o.C3,{text:e(y?"升级检测中...":"立即升级"),clickFun:async()=>{C(!0);try{(await c.XO.post("auto_upgrade_setting/upgrade_now",{})).code===d.m.Success&&(0,_.SK)(e("已触发升级检测,请查看服务端日志"))}catch(t){(0,_.zN)(e("触发升级失败"))}finally{C(!1)}}})})]})]}):null}function X(){const[e,t]=(0,n.useState)(""),[s,a]=(0,n.useState)(""),[x,m]=(0,n.useState)(!1),[j,v]=(0,n.useState)(""),[g,y]=(0,n.useState)(!1),[C,A]=(0,n.useState)(""),[X,z]=(0,w.fp)(p.AG.prompt_card),[F,O]=(0,n.useState)(!1),[P,$]=(0,n.useState)(""),[B,D]=(0,n.useState)(""),[M,T]=(0,n.useState)(I.aM.close),[E,G]=(0,n.useState)(!1),[q,W]=(0,n.useState)(void 0),{t:Z,i18n:R}=(0,u.B)(),[U,H]=(0,w.fp)(p.AG.user_base_info),{check_user_auth:L}=(0,S.MH)(),{initUserInfo:Q}=(0,n.useContext)(N.F);(0,n.useEffect)(()=>{(async()=>{const e=await c.XO.get("sys_option/status");if(e.code===d.m.Success){y(e.data.recycle_open),A(e.data.recycle_dir);const s=e.data.sys_env;t(s?.web_site_title),a(s?.logo||""),m(s?.show_login_user_info),v(s?.http_proxy||"");const n=e.data.https_setting;n&&(O(n.open),$(n.cert_path||""),D(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&&W(e.length),e.mode&&T(e.mode),void 0!==e.persist&&G(e.persist)}})()},[]);return(0,f.jsxs)("div",{children:[(0,f.jsx)(b.aZ,{children:(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)("span",{className:"credits",children:[Z("系统运行于"),": ",(0,V.s)(U.runing_time_length)]}),(0,f.jsx)("span",{className:"credits",children:(0,f.jsxs)("a",{href:"https://github.com/xiaobaidadada/filecat",target:"_blank",children:["version:7.3.3",null!=U.latest_version&&"7.3.3"!==U.latest_version?` -> ${U.latest_version}`:""]})}),(0,f.jsx)("span",{className:"credits",children:(0,f.jsx)("a",{href:Z("官网地址"),target:"_blank",children:`filecat ${Z("功能文档")}`})}),(0,f.jsxs)("span",{className:"credits",children:[Z("安装方式")," :",U.process_env_run_env]})]})}),(0,f.jsx)(i.xh,{children:(0,f.jsxs)(i.fI,{children:[(0,f.jsxs)(i.VP,{widthPer:33,children:[(0,f.jsxs)(l.Zp,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:Z("通用设置")})," ",(0,f.jsx)(o.rA,{icon:"info",onClick:()=>{z({open:!0,title:Z("信息"),context_div:(0,f.jsx)("div",{children:Z("pxy_tip")})})},title:Z("信息")})]}),rightBottomCom:(0,f.jsx)(o.C3,{text:Z("确定修改"),clickFun:async()=>{(await c.XO.post(k.s.setting_sys_option_status_save,{type:I.Mu.sys_env,value:{web_site_title:e,show_login_user_info:x,http_proxy:j,logo:s}})).code===d.m.Success&&((0,_.SK)("修改成功"),Q())}}),children:[Z("网站标题"),(0,f.jsx)(r.Sm,{value:e,handleInputChange:e=>{t(e)}}),Z("网站 Logo"),(0,f.jsx)(r.Sm,{placeholder:Z("lclorur"),value:s,handleInputChange:e=>{a(e)}}),(0,f.jsx)("div",{children:Z("pxy_url")}),(0,f.jsx)(r.Sm,{placeholder:"http://127.0.0.1:7890",value:j,handleInputChange:e=>{v(e)}}),Z("lgn_usr"),(0,f.jsx)("input",{type:"checkbox",checked:x,onChange:()=>{m(!x)}})]}),(0,f.jsxs)(l.Zp,{title:Z("https_s"),rightBottomCom:(0,f.jsx)(o.C3,{text:Z("确定修改"),clickFun:async()=>{if(F){if(!P)return void(0,_.zN)("证书路径不能为空");if(!B)return void(0,_.zN)("私钥路径不能为空")}const e=new I.CH;e.open=F,e.cert_path=P,e.key_path=B;(await c.XO.post(k.s.setting_sys_option_status_save,{type:I.Mu.https,value:e,open:F})).code===d.m.Success&&(0,_.SK)("HTTPS 设置已保存,需重启服务器才能生效")}}),children:[(0,f.jsx)(r.l6,{value:F,onChange:e=>{O(e)},options:[{title:Z("开启"),value:!0},{title:Z("关闭"),value:!1}]}),F&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)("div",{children:Z("ssl_crt")}),(0,f.jsx)(r.Sm,{placeholder:Z("crt_pth"),value:P,handleInputChange:e=>{$(e)}}),(0,f.jsx)("div",{children:Z("ssl_key")}),(0,f.jsx)(r.Sm,{placeholder:Z("ky_pth"),value:B,handleInputChange:e=>{D(e)}})]})]}),(0,f.jsx)(K,{})]}),(0,f.jsxs)(i.VP,{widthPer:33,children:[(0,f.jsxs)(l.Zp,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:Z("文件回收站")})," ",(0,f.jsx)(o.rA,{icon:"info",onClick:()=>{z({open:!0,title:Z("信息"),context_div:(0,f.jsx)("div",{children:Z("格式:[被删除的文件所在父目录] 回收站目录 [; ...]")})})},title:Z("信息")})]}),rightBottomCom:(0,f.jsx)(o.C3,{text:Z("确定修改"),clickFun:async()=>{if(g&&!C)return void(0,_.zN)("目录不能为空");(await c.XO.post(k.s.setting_sys_option_status_save,{type:I.Mu.cyc,value:C,open:g})).code===d.m.Success&&(0,_.SK)("修改成功")}}),children:[(0,f.jsx)(r.Sm,{placeholder:Z("目录"),value:C,handleInputChange:e=>{A(e)}}),(0,f.jsx)(r.l6,{value:g,onChange:e=>{y(e)},options:[{title:Z("开启"),value:!0},{title:Z("关闭"),value:!1}]})]}),(0,f.jsxs)(l.Zp,{title:Z("tk_exp"),rightBottomCom:(0,f.jsx)(h.S,{isFlex:!0,columns:[(0,f.jsx)(o.C3,{text:Z("清空token"),clickFun:async()=>{(await c.XO.get("token/clear")).code===d.m.Success&&(0,_.SK)("清理完成,重新登录")}}),(0,f.jsx)(o.C3,{text:Z("保存"),clickFun:async()=>{const e=new I.Gd;e.mode=M,e.persist=E,I.aM.length!==e.mode||q||(0,_.zN)("秒数不能为空"),e.length=parseInt(q);(await c.XO.post("token/save",e)).code===d.m.Success&&(0,_.SK)("保存成功")}})]}),children:[(0,f.jsx)(h.S,{isFlex:!0,columns:[(0,f.jsx)(r.U6,{value:1,context:Z("关闭"),selected:M===I.aM.close,onchange:()=>{T(I.aM.close)}}),(0,f.jsx)(r.U6,{value:1,context:Z("指定时间"),selected:M===I.aM.length,onchange:()=>{T(I.aM.length)}}),(0,f.jsx)(r.U6,{value:1,context:Z("永不过期"),selected:M===I.aM.forver,onchange:()=>{T(I.aM.forver)}})]}),M===I.aM.length&&(0,f.jsx)(r.Sm,{placeholder:Z("秒"),value:q,handleInputChange:e=>{W(e)}}),(0,f.jsxs)("label",{style:{display:"flex",alignItems:"center",gap:6,marginTop:8,whiteSpace:"nowrap"},children:[(0,f.jsx)("input",{type:"checkbox",checked:E,onChange:()=>G(!E)}),Z("持久化")]})]})]})]})})]})}var z=s(92350);function F(){const{t:e,i18n:t}=(0,u.B)(),{initUserInfo:s,reloadUserInfo:a}=(0,n.useContext)(N.F),[x,m]=(0,n.useState)([]),[j,g]=(0,n.useState)([]),[C,k]=(0,w.fp)(p.AG.prompt_card),[,b]=(0,w.fp)(p.AG.editorSetting),[A,I]=(0,n.useState)([]),[V,K]=(0,n.useState)([]),[X,F]=(0,n.useState)([]),[O,P]=(0,n.useState)([]),[$,B]=(0,n.useState)(""),[D,M]=(0,n.useState)([]),T=(0,y.K)(),E=[e("软件"),e("是否安装"),e("路径")],G=[e("编号"),e("路径"),e("备注")],q=[e("编号"),e("路径"),e("是否开启"),e("备注")],W=[e("编号"),e("文件路径"),e("是否开启"),e("系统启动执行"),e("corn表达式"),e("用户id"),e("备注")],Z=[e("编号"),e("路径"),e("单用户并发数量"),e("系统并发数量"),e("big_res"),e("big_sz"),e("大文件并发数量"),e("big_ck"),e("备注")],R=[e("编号"),e("名称"),e("路径"),e("是否开启"),e("params"),e("备注")],{check_user_auth:U}=(0,S.MH)(),H=async()=>{const e=await c.XO.get("env/path/get");e.code===d.m.Success&&F(e.data)},L=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&&g(e.data);const t=await c.XO.get("pty_cmd");t.code===d.m.Success&&B(t.data),H(),L();const s=await c.XO.get("protection_dir/sys");s.code===d.m.Success&&I(s.data??[]);const n=await c.XO.get("dir_upload_max_num");n.code===d.m.Success&&K(n.data??[]);const i=await c.XO.get("plugin/list");i.code===d.m.Success&&M(i.data??[])})()},[]);const Q=(0,z.Q)(),J=async()=>{(await c.XO.post("plugin/list/save",D)).code===d.m.Success&&(0,_.SK)(e("保存成功"))};return(0,f.jsxs)(n.Fragment,{children:[(0,f.jsx)(i.J,{widthPer:100,maxWidth:"100rem",children:(0,f.jsx)(l.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("up_conc")})," ",(0,f.jsx)(o.rA,{icon:"info",onClick:()=>{Q("文件上传")},title:e("信息")})]}),titleCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{K([...V,{path:"",note:"",user_upload_num:2,sys_upload_num:6,ws_file_standard_size:52428800,ws_file_parallel_num:2,ws_file_block_mb_size:524288}])}}),(0,f.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{for(const e of V)if(e.open_ws_file){if("number"!=typeof e.ws_file_block_mb_size)return void(0,_.zN)(`编号:${e.index??""} 文件块的大小设置有问题`);if("number"!=typeof e.ws_file_parallel_num)return void(0,_.zN)(`编号:${e.index??""} 并发数量设置有问题`);if("number"!=typeof e.ws_file_standard_size)return void(0,_.zN)(`编号:${e.index??""} 大文件size设置有问题`)}(0,v.di)(V,e=>e.index??0);(await c.XO.post("dir_upload_max_num/save",V)).code===d.m.Success&&((0,_.SK)("保存成功"),a())}})]}),children:(0,f.jsx)(h.X,{headers:Z,rows:V.map((t,s)=>{const n=[(0,f.jsx)(r.Sm,{value:t.index,placeholder:s,handleInputChange:e=>{t.index=parseInt(e)},no_border:!0}),(0,f.jsx)(r.Sm,{value:t.path,handleInputChange:e=>{t.path=e},no_border:!0}),(0,f.jsx)(r.Sm,{value:t.user_upload_num,handleInputChange:e=>{t.user_upload_num=parseInt(e)},no_border:!0}),(0,f.jsx)(r.Sm,{value:t.sys_upload_num,handleInputChange:e=>{t.sys_upload_num=parseInt(e)},no_border:!0}),(0,f.jsx)(r.l6,{value:!0===t.open_ws_file,onChange:e=>{t.open_ws_file=e,K([...V])},options:T,no_border:!0}),(0,f.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,f.jsx)(r.Sm,{value:t.ws_file_parallel_num,handleInputChange:e=>{t.ws_file_parallel_num=parseInt(e)},no_border:!0}),(0,f.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,f.jsx)(r.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,f.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{V.splice(e,1),K([...V])})(s)})];return n}),width:"10rem",onRowDrag:(e,t)=>{K((0,v.TI)(V,e,t))}})})}),(0,f.jsxs)(i.fI,{children:[(0,f.jsx)(i.VP,{widthPer:50,maxWidth:"50rem",children:(0,f.jsxs)(i.xh,{children:[(0,f.jsx)(l.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("PATH")}),(0,f.jsx)(o.rA,{icon:"info",onClick:()=>{Q("环境路径")},title:e("信息")})]}),titleCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(o.rA,{icon:"list",title:e("查看"),onClick:async()=>{const t=await c.XO.get("env/process/view");t.code===d.m.Success?k({open:!0,title:e("进程环境变量"),context_div:(0,f.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,_.zN)(e("获取失败"))}}),(0,f.jsx)(o.rA,{icon:"edit",title:e("编辑"),onClick:async()=>{const t=await c.XO.get("env/process/get");t.code===d.m.Success?(S.xK.set_value_temp(t.data??""),b({model:"ace/mode/ini",open:!0,fileName:"",save:async t=>{(await c.XO.post("env/process/save",{text:t})).code===d.m.Success?(0,_.SK)(e("保存成功")):(0,_.zN)(e("保存失败")),S.xK.set_value_temp("")}})):(0,_.zN)(e("获取失败"))}}),(0,f.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{F([...X,{path:"",note:""}])}}),(0,f.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await c.XO.post("env/path/save",{paths:X})).code===d.m.Success&&((0,_.SK)("保存成功"),H(),s())}})]}),children:(0,f.jsx)(h.X,{headers:q,rows:X.map((t,s)=>{const n=[(0,f.jsx)("div",{children:s}),(0,f.jsx)(r.Sm,{value:t.path,handleInputChange:e=>{t.path=e},no_border:!0}),(0,f.jsx)(r.l6,{value:!!t.open,onChange:e=>{t.open=e,F([...X])},options:T,no_border:!0}),(0,f.jsx)(r.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,f.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{X.splice(e,1),F([...X])})(s)})];return n}),width:"10rem",onRowDrag:(e,t)=>{F((0,v.TI)(X,e,t))}})}),(0,f.jsx)(l.Zp,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("PTY CMD")}),(0,f.jsx)(o.rA,{icon:"info",onClick:()=>{Q("pty")},title:e("信息")})]}),rightBottomCom:(0,f.jsx)(o.C3,{text:e("更新"),clickFun:async()=>{(await c.XO.post("pty_cmd/save",{str:$})).code===d.m.Success&&((0,_.SK)("保存成功"),a())}}),children:(0,f.jsx)(r.Sm,{placeholder:e("cmd need pty env"),value:$,handleInputChange:e=>{B(e)}})}),(0,f.jsx)(l.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("Workflow Job")}),(0,f.jsx)(o.rA,{icon:"info",onClick:()=>{Q("Workflow")},title:e("信息")})]}),titleCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{P([...O,{open:!1}])}}),(0,f.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await c.XO.post("workflow_setting_save",O)).code===d.m.Success&&((0,_.SK)("ok"),L())}})]}),children:(0,f.jsx)(h.X,{headers:W,rows:O.map((t,s)=>{const n=[(0,f.jsx)("div",{children:s}),(0,f.jsx)(r.Sm,{value:t.file_path,handleInputChange:e=>{t.file_path=e},no_border:!0}),(0,f.jsx)(r.l6,{value:!!t.open,onChange:e=>{t.open=e,P([...O])},options:T,no_border:!0}),(0,f.jsx)(r.l6,{value:!!t.sys_power_on,onChange:e=>{t.sys_power_on=e,P([...O])},options:T,no_border:!0}),(0,f.jsx)(r.Sm,{value:t.cron_str,handleInputChange:e=>{t.cron_str=e},no_border:!0}),(0,f.jsx)(r.Sm,{value:t.user_id,handleInputChange:e=>{t.user_id=e},no_border:!0}),(0,f.jsx)(r.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,f.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{O.splice(e,1),P([...O])})(s)})];return n}),width:"10rem",onRowDrag:(e,t)=>{P((0,v.TI)(O,e,t))}})}),(0,f.jsx)(l.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("插件配置")}),(0,f.jsx)(o.rA,{icon:"info",onClick:()=>{Q("插件配置")},title:e("信息")})]}),titleCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{M([...D,{name:"",path:"",note:"",open:!1}])}}),(0,f.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:J})]}),children:(0,f.jsx)(h.X,{headers:R,rows:D.map((t,s)=>{const n=[s,(0,f.jsx)(r.Sm,{value:t.name,handleInputChange:e=>{t.name=e},no_border:!0}),(0,f.jsx)(r.Sm,{value:t.path,handleInputChange:e=>{t.path=e},no_border:!0}),(0,f.jsx)(r.l6,{value:!!t.open,onChange:e=>{t.open=e,M([...D])},options:T,no_border:!0}),(0,f.jsx)(o.mu,{icon:"edit",save:async e=>{t.params=e,await J()},title:""}),(0,f.jsx)(r.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,f.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{D.splice(e,1),M([...D])})(s)})];return n}),width:"10rem",onRowDrag:(e,t)=>{M((0,v.TI)(D,e,t))}})})]})}),(0,f.jsx)(i.VP,{widthPer:50,maxWidth:"50rem",children:(0,f.jsxs)(i.xh,{children:[(0,f.jsx)(l.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("系统保护路径")})," ",(0,f.jsx)(o.rA,{icon:"info",onClick:()=>{Q("保护目录")},title:e("信息")})]}),titleCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{I([...A,{path:"",note:""}])}}),(0,f.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await c.XO.post("protection_dir/sys/save",A)).code===d.m.Success&&((0,_.SK)("保存成功"),a())}})]}),children:(0,f.jsx)(h.X,{headers:G,rows:A.map((t,s)=>{const n=[(0,f.jsx)("div",{children:s}),(0,f.jsx)(r.Sm,{value:t.path,handleInputChange:e=>{t.path=e},no_border:!0}),(0,f.jsx)(r.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,f.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{A.splice(e,1),I([...A])})(s)})];return n}),width:"10rem",onRowDrag:(e,t)=>{I((0,v.TI)(A,e,t))}})}),(0,f.jsx)(l.uF,{title:e("外部软件"),titleCom:(0,f.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await c.XO.post("outside/software/save",j)).code===d.m.Success&&((0,_.SK)("保存成功"),s())}}),children:(0,f.jsx)(h.X,{headers:E,rows:j.map((t,s)=>[(0,f.jsx)("div",{children:t.id}),(0,f.jsx)(l.fq,{ok:t.installed}),(0,f.jsx)(r.Sm,{value:t.path,handleInputChange:e=>{t.path=e},no_border:!0,placeholder:e("use_env")}),(0,f.jsx)(o.rA,{icon:"info",onClick:()=>{Q(t.id)},title:e("信息")})]),width:"10rem"})})]})})]})]})}function O(e){const{t,i18n:s}=(0,u.B)(),[i,l]=(0,w.fp)(p.AG.user_base_info),o=[{title:t("用户权限"),list:[{title:t("用户管理"),permission:a.oV.user_manage},{title:t("角色管理"),permission:a.oV.role_manage}]},{title:t("系统管理权限"),list:[{title:t("系统信息"),permission:a.oV.all_sys},{title:t("系统进程关闭"),permission:a.oV.sys_process_close},{title:t("dc_ctdl"),permission:a.oV.docker_container_update},{title:t("dc_idl"),permission:a.oV.docker_images_delete},{title:t("systemd管理"),permission:a.oV.systemd},{title:t("防火墙管理"),permission:a.oV.firewall}]},{title:t("网络功能权限"),list:[{title:t("系统网络"),permission:a.oV.vir_net},{title:t("内网穿透"),permission:a.oV.tcp_proxy},{title:"ddns",permission:a.oV.ddns}]},{title:t("Ai 设置权限"),list:[{title:t("Ai 配置"),permission:a.oV.ai_agent_setting},{title:t("ai_page"),permission:a.oV.ai_agent_page},{title:t("sw_mdl"),permission:a.oV.ai_model_switch}]},{title:t("文件权限"),list:[{title:t("log_del"),permission:a.oV.filecat_file_delete_cut_rename},{title:t("log_wr"),permission:a.oV.filecat_file_context_update_upload_created_copy_decompression},{title:t("内容更新"),permission:a.oV.filecat_file_context_update},{title:t("文件回收站修改"),permission:a.oV.recycle_file_save},{title:t("文件分享"),permission:a.oV.share_file}]},{title:t("系统设置权限"),list:[{title:t("系统页面"),permission:a.oV.sys_setting_page},{title:t("htts"),permission:a.oV.https_file},{title:t("tk_time"),permission:a.oV.token_update},{title:t("修改密码"),permission:a.oV.update_password},{title:t("磁盘挂载"),permission:a.oV.sys_disk_mount},{title:t("通用设置"),permission:a.oV.sys_env_setting_key},{title:t("md_set"),permission:a.oV.md_editor_setting},{title:t("目录挂载"),permission:a.oV.file_mount}]},{title:t("系统环境设置"),list:[{title:t("sys_env"),permission:a.oV.sys_env_page},{title:t("up_lim"),permission:a.oV.dir_upload_max_num},{title:t("path_md"),permission:a.oV.env_path_update},{title:"pty cmd "+t("更新"),permission:a.oV.pty_cmd_update},{title:"workflow job",permission:a.oV.workflow_job},{title:t("path_up"),permission:a.oV.sys_protection_dir},{title:t("外部软件路径"),permission:a.oV.outside_software_path}]},{title:t("个人环境设置"),list:[{title:t("个性化设置"),permission:a.oV.private_sys_env}]},{title:t("自定义路由"),list:[{title:t("自定义路由页面"),permission:a.oV.auth_router_page},{title:t("wf_api"),permission:a.oV.workflow_api},{title:t("自定义资源路由"),permission:a.oV.code_resource},{title:t("api_rt"),permission:a.oV.code_api}]},{title:t("标签编辑权限"),list:[{title:t("ssh代理"),permission:a.oV.ssh_proxy_tag_update},{title:t("http代理"),permission:a.oV.http_proxy_tag_update},{title:t("浏览器代理"),permission:a.oV.browser_proxy_tag_update},{title:t("rdp代理"),permission:a.oV.rdp_proxy_tag_update},{title:t("网络唤醒"),permission:a.oV.wol_proxy_tag_update},{title:t("rtsp播放器"),permission:a.oV.rtsp_proxy_tag_update}]},{title:t("代理功能"),list:[{title:t("ssh代理"),permission:a.oV.ssh_proxy},{title:t("http代理"),permission:a.oV.http_proxy},{title:t("pxy_off"),permission:a.oV.http_proxy_download_cancel},{title:t("浏览器代理"),permission:a.oV.browser_proxy},{title:t("rdp代理"),permission:a.oV.rdp_proxy}]},{title:t("其他功能"),list:[{title:t("wf_run"),permission:a.oV.workflow_exe},{title:t("wf_user"),permission:a.oV.workflow_exe_user,noDisable:!0},{title:t("网络唤醒"),permission:a.oV.wol_proxy},{title:t("端口扫描"),permission:a.oV.port_scan},{title:t("rtsp播放器"),permission:a.oV.rtsp_proxy},{title:t("ssh_sv"),permission:a.oV.crypto_ssh_file},{title:t("cmd_rst"),permission:a.oV.shell_cmd_filecat_restart},{title:t("cmd_upg"),permission:a.oV.shell_cmd_filecat_upgrade},{title:t("cmd_dwn"),permission:a.oV.shell_cmd_filecat_kill_self},{title:t("cmd_ai"),permission:a.oV.ai_chat_cmd}]}];return(0,f.jsx)(n.Fragment,{children:o.map((t,s)=>(0,f.jsxs)("div",{children:[(0,f.jsx)("h3",{children:t.title}),t.list.map((t,s)=>(0,f.jsxs)("div",{children:[(0,f.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 $(){const{t:e,i18n:t}=(0,u.B)(),{initUserInfo:s,reloadUserInfo:x}=(0,n.useContext)(N.F),[j,g]=(0,w.fp)(p.AG.user_base_info),[S,y]=(0,n.useState)([]),[C,k]=(0,w.fp)(p.AG.prompt_card),[b,A]=(0,n.useState)(!1),[I,V]=(0,n.useState)(!1),[K,X]=(0,w.fp)(p.AG.confirm),[F,$]=(0,n.useState)(""),[B,D]=(0,n.useState)(""),[M,T]=(0,n.useState)(""),[E,G]=(0,n.useState)([]),[q,W]=(0,n.useState)([]),[Z,R]=(0,n.useState)([]),[U,H]=(0,n.useState)(""),[L,Q]=(0,n.useState)(""),[J,Y]=(0,n.useState)("en"),[ee,te]=(0,n.useState)(""),[se,ne]=(0,n.useState)([]),[ie,ae]=(0,n.useState)(""),[le,oe]=(0,n.useState)(!1),[re,ce]=(0,n.useState)(""),[de,he]=(0,n.useState)(""),[ue,pe]=(0,n.useState)({}),xe=(0,z.o)(),[_e,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);y(e)}else y(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=>{$(e?.username??""),D(e?.password??""),T(e?.cwd??""),G(e?.access_dirs??[]),W(e?.not_access_dirs??[]),R(e?.only_read_dirs??[]),H(e?.access_cmd??""),Q(e?.not_access_cmd??""),Y(e?.language??""),te(e?.theme??""),ne(e?.auth_list??[]),ae(e?.note??""),oe(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&&T(s.cwd),s.access_dirs&&s.access_dirs.length>0&&G(s.access_dirs),s.not_access_dirs&&s.not_access_dirs.length>0&&W(s.not_access_dirs),s.only_read_dirs&&s.only_read_dirs.length>0&&R(s.only_read_dirs),s.access_cmd&&H(s.access_cmd),s.not_access_cmd&&Q(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)}},ye=()=>{if(!F)return void(0,_.zN)("username not empty");if((0,m.CB)(F))return void(0,_.zN)("username not empty char");if(!M)return void(0,_.zN)("cwd not empty");const e=new a.E0;return e.language=J,e.theme=ee,e.access_dirs=E,e.username=F,e.password=B,e.not_access_dirs=q,e.only_read_dirs=Z,e.cwd=M,e.note=ie,e.access_cmd=U,e.not_access_cmd=L,e.auth_list=se,e.bind_role_id=de,e};return(0,f.jsxs)(i.fI,{children:[(0,f.jsx)(i.VP,{widthPer:50,maxWidth:"40rem",children:(0,f.jsx)(i.xh,{children:(0,f.jsx)(l.uF,{self_title:(0,f.jsx)("span",{className:" div-row ",children:(0,f.jsx)("h2",{children:e("用户")})}),titleCom:(0,f.jsxs)("div",{className:"div-row",style:{gap:"0.5rem"},children:[(0,f.jsx)(r.Sm,{placeholder:e("过滤"),value:je,handleInputChange:e=>{ve(e)},handlerEnter:()=>{ge()}}),(0,f.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{A(!0),V(!1),we(void 0)}})]}),children:(0,f.jsx)(h.X,{headers:fe,rows:S.map((t,s)=>{const n=[(0,f.jsx)("p",{children:t.id}),(0,f.jsx)(l.xP,{children:t.username}),(0,f.jsx)(l.xP,{children:t.cwd}),(0,f.jsx)(l.xP,{children:t.note}),(0,f.jsxs)("div",{children:[(0,f.jsx)(o.rA,{icon:"edit",title:e("编辑"),onClick:()=>(e=>{A(!1),V(!0),we(e)})(t)}),!t.is_root&&(0,f.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(async t=>{X({open:!0,title:e("确定删除吗"),handle:async()=>{const e=new a.E0;e.username=t,(await c.wm.post("delete_user",e)).code===d.m.Success&&((0,_.SK)("删除完成"),ge(),X({open:!1,handle:null}))}})})(t.username)})]})];return n}),width:"10rem"})})})}),(0,f.jsx)(i.VP,{widthPer:50,maxWidth:"40rem",children:(b||I)&&(0,f.jsx)(i.xh,{children:(0,f.jsxs)(l.Zp,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e(""+(b?"添加":"编辑"))})," "]}),rightBottomCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(o.rA,{icon:"cancel",title:e("取消"),onClick:()=>{A(!1),V(!1),we(void 0)}}),b&&(0,f.jsx)(o.rA,{icon:"add_circle",title:e("添加"),onClick:async()=>{if(!B)return void(0,_.zN)("password not empty");if((0,m.CB)(B))return void(0,_.zN)("username not empty char");const e=ye(),t=await c.wm.post("create_user",e);ge(),t.code===d.m.Success&&((0,_.SK)("创建完成"),ge(),A(!1),V(!1),we(void 0))}}),I&&(0,f.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{const e=ye();if(!e)return;e.id=re;(await c.wm.post("save_user",e)).code===d.m.Success&&((0,_.SK)("保存完成"),ge())}})]}),children:[(0,f.jsx)("label",{children:e("用户名")}),(0,f.jsx)(r.Sm,{value:F,handleInputChange:e=>$(e)}),(0,f.jsx)("label",{children:e("密码")}),(0,f.jsx)(r.Sm,{type:"password",value:B,handleInputChange:e=>D(e)}),(0,f.jsxs)("label",{children:[!ue?.access_dirs?.length&&(0,f.jsx)(o.rA,{icon:"add",onClick:()=>{G([...E,""])},title:"添加"}),e("目录范围")]}),(0,f.jsx)(r.Sm,{disabled:""!==ue.cwd&&void 0!==ue.cwd,value:M,handleInputChange:e=>T(e)}),(E??[]).map((t,s)=>(0,f.jsxs)("div",{style:{display:"flex"},children:[(0,f.jsx)("div",{style:{width:"90%"},children:(0,f.jsx)(r.Sm,{disabled:0!==ue?.access_dirs?.length&&void 0!==ue?.access_dirs?.length,value:t,handleInputChange:e=>{E[s]=e,G([...E])}})}),0===ue?.access_dirs?.length||void 0===ue?.access_dirs?.length&&(0,f.jsx)(o.rA,{icon:"delete",onClick:()=>{E.splice(s,1),G([...E])},title:e("删除")})]},s)),(0,f.jsxs)("label",{children:[!ue?.not_access_dirs?.length&&(0,f.jsx)(o.rA,{icon:"add",onClick:()=>{W([...q,""])},title:e("添加")}),e("禁止目录范围")]}),(q??[]).map((t,s)=>(0,f.jsxs)("div",{style:{display:"flex"},children:[(0,f.jsx)("div",{style:{width:"90%"},children:(0,f.jsx)(r.Sm,{disabled:0!==ue?.not_access_dirs?.length&&void 0!==ue?.not_access_dirs?.length,value:t,handleInputChange:e=>{q[s]=e,W([...q])}})}),0===ue?.not_access_dirs?.length||void 0===ue?.not_access_dirs?.length&&(0,f.jsx)(o.rA,{icon:"delete",onClick:()=>{q.splice(s,1),W([...q])},title:e("删除")})]},s)),(0,f.jsxs)("label",{children:[!ue?.only_read_dirs?.length&&(0,f.jsx)(o.rA,{icon:"add",onClick:()=>{R([...Z,""])},title:e("添加")}),e("只读目录范围")]}),(Z??[]).map((t,s)=>(0,f.jsxs)("div",{style:{display:"flex"},children:[(0,f.jsx)("div",{style:{width:"90%"},children:(0,f.jsx)(r.Sm,{disabled:0!==ue?.only_read_dirs?.length&&void 0!==ue?.only_read_dirs?.length,value:t,handleInputChange:e=>{Z[s]=e,R([...Z])}})}),0===ue?.only_read_dirs?.length||void 0===ue?.only_read_dirs?.length&&(0,f.jsx)(o.rA,{icon:"delete",onClick:()=>{Z.splice(s,1),R([...Z])},title:e("删除")})]},s)),(0,f.jsx)("label",{children:e("可执行的命令")}),(0,f.jsx)(r.Sm,{disabled:""!==ue.access_cmd&&void 0!==ue.access_cmd,value:U,placeholder:"use blank split",handleInputChange:e=>H(e)}),(0,f.jsx)("label",{children:e("禁止执行的命令")}),(0,f.jsx)(r.Sm,{disabled:""!==ue.not_access_cmd&&void 0!==ue.not_access_cmd,value:L,placeholder:"use blank split",handleInputChange:e=>Q(e)}),!le&&(0,f.jsxs)(n.Fragment,{children:[(0,f.jsx)("label",{children:e("角色")}),(0,f.jsx)(r.l6,{value:de,onChange:e=>{Se(e)},options:(()=>{const e=[];e.push({title:"NOT",value:""});for(let t of _e)e.push({title:t.role_name,value:t.role_id});return e})()})]}),(0,f.jsx)("label",{children:e("语言")}),(0,f.jsx)(r.l6,{disabled:""!==ue.language&&void 0!==ue.language,value:J,onChange:e=>{Y(e)},options:[{title:e("跟随系统"),value:"sys"},{title:"English",value:"en"},{title:"中文",value:"zh"}]}),(0,f.jsx)("label",{children:e("主题")}),(0,f.jsx)(r.l6,{disabled:""!==ue.theme&&void 0!==ue.theme,value:ee,onChange:e=>{te(e)},options:xe}),(0,f.jsx)(O,{is_disable:e=>{if(!0===le)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===le||void 0!==se?.find(t=>t===e),select_auth:e=>{se?se.includes(e)?((0,v.I)(se,t=>t===e),ne([...se])):ne([...se,e]):ne([e])}}),(0,f.jsx)("label",{children:e("备注")}),(0,f.jsx)(r.Sm,{value:ie,handleInputChange:e=>ae(e)})]})})})]})}function B(){const{t:e,i18n:t}=(0,u.B)(),{initUserInfo:s}=(0,n.useContext)(N.F),[x,m]=(0,n.useState)([]),[j,g]=(0,w.fp)(p.AG.prompt_card),[S,y]=(0,n.useState)(!1),[C,k]=(0,n.useState)(!1),[b,A]=(0,w.fp)(p.AG.confirm),[I,V]=(0,n.useState)(""),[K,X]=(0,n.useState)(""),[F,P]=(0,n.useState)([]),[$,B]=(0,n.useState)([]),[D,M]=(0,n.useState)([]),[T,E]=(0,n.useState)(""),[G,q]=(0,n.useState)(""),[W,Z]=(0,n.useState)(""),[R,U]=(0,n.useState)(""),[H,L]=(0,n.useState)([]),[Q,J]=(0,n.useState)(""),[Y,ee]=(0,n.useState)(""),te=(0,z.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=>{V(e?.role_name??""),X(e?.cwd??""),P(e?.access_dirs??[]),B(e?.not_access_dirs??[]),M(e?.only_read_dirs??[]),E(e?.access_cmd??""),q(e?.not_access_cmd??""),Z(e?.language??""),U(e?.theme??""),L(e?.auth_list??[]),J(e?.role_id??""),ee(e?.role_note??"")};(0,n.useEffect)(()=>{ne()},[]);const ae=()=>{if(!I)return void(0,_.zN)("role_name not empty");const e=new a.E0;return e.language=W,e.theme=R,e.access_dirs=F,e.role_name=I,e.not_access_dirs=$,e.only_read_dirs=D,e.cwd=K,e.access_cmd=T,e.not_access_cmd=G,e.auth_list=H,e.role_note=Y,e};return(0,f.jsxs)(i.fI,{children:[(0,f.jsx)(i.VP,{widthPer:50,maxWidth:"40rem",children:(0,f.jsx)(i.xh,{children:(0,f.jsx)(l.uF,{self_title:(0,f.jsx)("span",{className:" div-row ",children:(0,f.jsx)("h2",{children:e("角色")})}),titleCom:(0,f.jsx)("div",{children:(0,f.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{y(!0),k(!1),ie(void 0)}})}),children:(0,f.jsx)(h.X,{headers:se,rows:x.map((t,s)=>{const n=[(0,f.jsx)("p",{children:t.role_id}),(0,f.jsx)(l.xP,{children:t.role_name}),(0,f.jsx)(l.xP,{children:t.role_note}),(0,f.jsxs)("div",{children:[(0,f.jsx)(o.rA,{icon:"edit",title:e("编辑"),onClick:()=>(e=>{y(!1),k(!0),ie(e)})(t)}),!t.is_root&&(0,f.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(async t=>{A({open:!0,title:e("确定删除吗"),handle:async()=>{const e=new a.E0;e.role_id=t,(await c.wm.post("delete_role",e)).code===d.m.Success&&((0,_.SK)("删除完成"),ne(),A({open:!1,handle:null}))}})})(t.role_id)})]})];return n}),width:"10rem"})})})}),(0,f.jsx)(i.VP,{widthPer:50,maxWidth:"40rem",children:(S||C)&&(0,f.jsx)(i.xh,{children:(0,f.jsxs)(l.Zp,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e(""+(S?"添加":"编辑"))})," "]}),rightBottomCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(o.rA,{icon:"cancel",title:e("取消"),onClick:()=>{y(!1),k(!1),ie(void 0)}}),S&&(0,f.jsx)(o.rA,{icon:"add_circle",title:e("添加"),onClick:async()=>{const e=ae();if(!e)return;const t=await c.wm.post("create_role",e);ne(),t.code===d.m.Success&&((0,_.SK)("创建完成"),ne(),y(!1),k(!1),ie(void 0))}}),C&&(0,f.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{const e=ae();if(!e)return;e.role_id=Q;(await c.wm.post("save_role",e)).code===d.m.Success&&((0,_.SK)("保存完成"),ne())}})]}),children:[(0,f.jsx)("label",{children:e("角色名")}),(0,f.jsx)(r.Sm,{value:I,handleInputChange:e=>V(e)}),(0,f.jsx)("label",{children:e("角色备注")}),(0,f.jsx)(r.Sm,{value:Y,handleInputChange:e=>ee(e)}),(0,f.jsxs)("label",{children:[(0,f.jsx)(o.rA,{icon:"add",onClick:()=>{P([...F,""])},title:"添加"}),e("目录范围")]}),(0,f.jsx)(r.Sm,{value:K,handleInputChange:e=>X(e)}),(F??[]).map((e,t)=>(0,f.jsxs)("div",{style:{display:"flex"},children:[(0,f.jsx)("div",{style:{width:"90%"},children:(0,f.jsx)(r.Sm,{value:e,handleInputChange:e=>{F[t]=e,P([...F])}})}),(0,f.jsx)(o.rA,{icon:"delete",onClick:()=>{F.splice(t,1),P([...F])},title:"删除"})]},t)),(0,f.jsxs)("label",{children:[(0,f.jsx)(o.rA,{icon:"add",onClick:()=>{B([...$,""])},title:"添加"}),e("禁止目录范围")]}),($??[]).map((t,s)=>(0,f.jsxs)("div",{style:{display:"flex"},children:[(0,f.jsx)("div",{style:{width:"90%"},children:(0,f.jsx)(r.Sm,{value:t,handleInputChange:e=>{$[s]=e,B([...$])}})}),(0,f.jsx)(o.rA,{icon:"delete",onClick:()=>{$.splice(s,1),B([...$])},title:e("删除")})]},s)),(0,f.jsxs)("label",{children:[(0,f.jsx)(o.rA,{icon:"add",onClick:()=>{M([...D,""])},title:e("添加")}),e("只读目录范围")]}),(D??[]).map((e,t)=>(0,f.jsxs)("div",{style:{display:"flex"},children:[(0,f.jsx)("div",{style:{width:"90%"},children:(0,f.jsx)(r.Sm,{value:e,handleInputChange:e=>{D[t]=e,M([...D])}})}),(0,f.jsx)(o.rA,{icon:"delete",onClick:()=>{D.splice(t,1),M([...D])},title:"删除"})]},t)),(0,f.jsx)("label",{children:e("可执行的命令")}),(0,f.jsx)(r.Sm,{value:T,placeholder:"use blank split",handleInputChange:e=>E(e)}),(0,f.jsx)("label",{children:e("禁止执行的命令")}),(0,f.jsx)(r.Sm,{value:G,placeholder:"use blank split",handleInputChange:e=>q(e)}),(0,f.jsx)("label",{children:e("语言")}),(0,f.jsx)(r.l6,{value:W,onChange:e=>{Z(e)},options:[{title:e("跟随系统"),value:"sys"},{title:"NOT",value:""},{title:"English",value:"en"},{title:"中文",value:"zh"}]}),(0,f.jsx)("label",{children:e("主题")}),(0,f.jsx)(r.l6,{value:R,onChange:e=>{U(e)},options:te}),(0,f.jsx)(O,{is_disable:()=>!1,is_selected:(e,t)=>void 0!==H?.find(t=>t===e),select_auth:e=>{H?(H.find(t=>t==e)?(0,v.I)(H,t=>t===e):H.push(e),L([...H])):L([e])}})]})})})]})}function D(){const{t:e,i18n:t}=(0,u.B)(),{initUserInfo:s,reloadUserInfo:x}=(0,n.useContext)(N.F),[m,j]=(0,n.useState)([]),[g,S]=(0,w.fp)(p.AG.prompt_card),[C,b]=(0,n.useState)([]),[A,V]=(0,n.useState)([]),[K,X]=(0,n.useState)([]),[F,O]=(0,w.fp)(p.AG.user_base_info),P=(0,y.K)(),$=(0,z.o)(),B=[e("编号"),e("路径"),e("是否默认"),e("备注")],D=[e("编号"),e("路径"),e("备注")],M=[e("编号"),e("命令"),e("父编号"),e("备注")],T=[e("文件后缀"),e("命令"),e("其他参数"),e("备注")],[E,G]=(0,n.useState)(""),[q,W]=(0,n.useState)(""),[Z,R]=(0,n.useState)(""),[U,H]=(0,n.useState)(!1),[L,Q]=(0,n.useState)(""),[J,Y]=(0,n.useState)(""),[ee,te]=(0,n.useState)("");(0,n.useEffect)(()=>{(async()=>{const e=await c.XO.get("filesSetting");e.code===d.m.Success&&(j(e.data.dirs),V(e.data.quick_cmd),X(e.data.file_quick_cmd));const t=await c.XO.get("protection_dir");t.code===d.m.Success&&b(t.data??[])})(),Q(F?.user_data?.language),Y(F?.user_data?.theme),te(F?.user_data?.upload_file_ignore)},[]);const se=(0,z.Q)();return(0,f.jsx)(n.Fragment,{children:(0,f.jsxs)(i.fI,{children:[(0,f.jsxs)(i.VP,{widthPer:33,children:[(0,f.jsx)(i.xh,{children:(0,f.jsxs)(l.Zp,{title:e("修改密码"),rightBottomCom:(0,f.jsx)(o.C3,{text:e("确定修改"),clickFun:async()=>{if(!E||!q)return void(0,_.zN)("账号密码不能为空");if(q!==Z)return void(0,_.zN)("两次密码不一样");const e=new a.tl;e.username=E,e.password=q,e.confirm_password=Z,e.user_id=F.user_data.id;(await c.wm.post("updatePassword",e)).code===d.m.Success&&(0,_.SK)("修改成功")}}),children:[(0,f.jsx)(r.Sm,{placeholder:e("新账号"),value:E,handleInputChange:e=>{G(e)}}),(0,f.jsx)(r.cA,{placeholder:e("新密码"),handleInputChange:e=>{W(e)}}),(0,f.jsx)(r.cA,{placeholder:e("确认密码"),handleInputChange:e=>{R(e)}})]})}),(0,f.jsx)(i.xh,{children:(0,f.jsxs)(l.Zp,{title:e("个性化设置"),rightBottomCom:(0,f.jsx)(o.C3,{text:e("确定修改"),clickFun:async()=>{(await c.XO.post(k.s.setting_sys_option_status_save,{type:I.Mu.private_sys_env,value:{language:L,theme:J,upload_file_ignore:ee}})).code===d.m.Success&&((0,_.SK)("修改成功"),s())}}),children:[e("语言"),(0,f.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,f.jsx)(r.l6,{value:J,onChange:e=>{Y(e)},options:$}),(0,f.jsx)(r.Sm,{value:ee,handleInputChange:e=>{te(e)},placeholderOut:e("拖拽文件上传忽略列表"),placeholder:"node_modules *.js",no_border:!0})]})})]}),(0,f.jsxs)(i.VP,{children:[(0,f.jsxs)(i.xh,{children:[(0,f.jsx)(l.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("文件夹路径")})," ",(0,f.jsx)(o.rA,{icon:"info",onClick:()=>{se("文件夹路径")},title:e("信息")})]}),titleCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{j([...m,{note:"",default:!1,path:""}])}}),(0,f.jsx)(o.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,_.SK)("保存成功"),x(),s())}})]}),children:(0,f.jsx)(h.X,{headers:B,rows:m.map((t,s)=>{const n=[(0,f.jsx)("div",{children:s}),(0,f.jsx)(r.Sm,{value:t.path,handleInputChange:e=>{t.path=e},no_border:!0}),(0,f.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:P,no_border:!0}),(0,f.jsx)(r.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,f.jsx)("div",{children:0!==s&&(0,f.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{m.splice(e,1),j([...m])})(s)})})];return n}),width:"10rem",onRowDrag:(e,t)=>{0!==e&&0!==t&&j((0,v.TI)(m,e,t))}})}),(0,f.jsx)(l.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("个人保护路径")})," ",(0,f.jsx)(o.rA,{icon:"info",onClick:()=>{se("保护目录")},title:e("信息")})]}),titleCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{b([...C,{path:"",note:""}])}}),(0,f.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await c.XO.post("protection_dir/save",C)).code===d.m.Success&&((0,_.SK)("保存成功"),x())}})]}),children:(0,f.jsx)(h.X,{headers:D,rows:C.map((t,s)=>{const n=[(0,f.jsx)("div",{children:s}),(0,f.jsx)(r.Sm,{value:t.path,handleInputChange:e=>{t.path=e},no_border:!0}),(0,f.jsx)(r.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,f.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{C.splice(e,1),b([...C])})(s)})];return n}),width:"10rem",onRowDrag:(e,t)=>{b((0,v.TI)(C,e,t))}})})]}),(0,f.jsxs)(i.xh,{children:[(0,f.jsx)(l.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("目录快捷命令")}),(0,f.jsx)(o.rA,{icon:"info",onClick:()=>{se("目录快捷命令")},title:"info"})]}),titleCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{V([...A,{cmd:"",note:""}])}}),(0,f.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await c.XO.post("filesSetting/save",{quick_cmd:A})).code===d.m.Success&&((0,_.SK)("保存成功"),s())}})]}),children:(0,f.jsx)(h.X,{headers:M,rows:A.map((t,s)=>{const n=[(0,f.jsx)(r.Sm,{value:t.index,handleInputChange:e=>{t.index=e},no_border:!0}),(0,f.jsx)(r.Sm,{value:t.cmd,handleInputChange:e=>{t.cmd=e},no_border:!0}),(0,f.jsx)(r.Sm,{value:t.father_index,handleInputChange:e=>{t.father_index=e},no_border:!0}),(0,f.jsx)(r.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,f.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{A.splice(e,1),V([...A])})(s)})];return n}),width:"10rem",onRowDrag:(e,t)=>{V((0,v.TI)(A,e,t))}})}),(0,f.jsx)(l.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("文件快捷命令")}),(0,f.jsx)(o.rA,{icon:"info",onClick:()=>{se("文件快捷命令")},title:"info"})]}),titleCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{X([...K,{cmd:"",note:"",file_suffix:"",params:""}])}}),(0,f.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await c.XO.post("filesSetting/save",{file_quick_cmd:K})).code===d.m.Success&&((0,_.SK)("保存成功"),s())}})]}),children:(0,f.jsx)(h.X,{headers:T,rows:K.map((t,s)=>{const n=[(0,f.jsx)(r.Sm,{value:t.file_suffix,handleInputChange:e=>{t.file_suffix=e},no_border:!0}),(0,f.jsx)(r.Sm,{value:t.cmd,handleInputChange:e=>{t.cmd=e},no_border:!0}),(0,f.jsx)(r.Sm,{value:t.params,handleInputChange:e=>{t.params=e},no_border:!0}),(0,f.jsx)(r.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,f.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{K.splice(e,1),X([...K])})(s)})];return n}),width:"10rem",onRowDrag:(e,t)=>{X((0,v.TI)(K,e,t))}})})]})]})]})})}const M=["password","private_key","secret_key"],T="webdav";function E(){const{t:e}=(0,u.B)(),[,t]=(0,w.fp)(p.AG.prompt_card),[s,i]=(0,n.useState)([]),[a,d]=(0,n.useState)([]),[x,m]=(0,n.useState)(!1),[j,v]=(0,n.useState)(""),[g,S]=(0,n.useState)(T),[y,C]=(0,n.useState)(""),[k,b]=(0,n.useState)({}),[A,I]=(0,n.useState)(!1),V=async()=>{try{const[e,t]=await Promise.all([c.I2.post("credential/list",{}),c.I2.post("credential/meta",{})]);i(Array.isArray(e?.data)?e.data:[]),d(Array.isArray(t?.data)?t.data:[])}catch(e){}};(0,n.useEffect)(()=>{V()},[]);const N=a.find(e=>e.type===g)?.fields??[],K=()=>{m(!1),v(""),S(T),C(""),b({}),I(!1)};return(0,f.jsxs)(l.Zp,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("普通凭据管理")}),(0,f.jsx)(o.rA,{icon:"info",title:e("信息"),onClick:()=>{t({open:!0,title:e("信息"),context_div:(0,f.jsxs)("div",{children:[(0,f.jsxs)("ul",{children:[(0,f.jsx)("li",{children:e("crd_tp")}),(0,f.jsx)("li",{children:e("bidacct")}),(0,f.jsx)("li",{children:e("pwdkept")}),(0,f.jsx)("li",{children:e("tstbfrs")})]}),(0,f.jsxs)("ul",{children:[(0,f.jsxs)("li",{children:[(0,f.jsx)("b",{children:"WebDAV"}),":",e("prtwbdv")]}),(0,f.jsxs)("li",{children:[(0,f.jsx)("b",{children:"SSH / SFTP"}),":",e("prtsftp")]}),(0,f.jsxs)("li",{children:[(0,f.jsx)("b",{children:"S3 兼容对象存储"}),":",e("prt_s3")]})]})]})})}})]}),rightBottomCom:(0,f.jsxs)("div",{children:[!x&&(0,f.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{K(),m(!0)}}),x&&(0,f.jsx)(o.rA,{icon:"network_check",title:e("测试连接"),onClick:async()=>{try{const t=await c.I2.post("credential/test",{id:j||void 0,type:g,config:k}),s=t?.data;s?.ok?(0,_.SK)(`${e("连接成功")}(${s.count??0})`):(0,_.zN)(`${e("连接失败")}:${s?.error??""}`)}catch(e){}}}),x&&(0,f.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{if(y.trim()){for(const t of N){const s=String(k[t.key]??"").trim()||j&&M.includes(t.key);if(t.required&&!s)return void(0,_.zN)(`${e("请填写")}${e(t.label)}`)}try{await c.I2.post(j?"credential/update":"credential/add",{id:j||void 0,type:g,name:y,config:k,enabled:!0}),(0,_.SK)(e("保存成功")),K(),await V()}catch(e){}}else(0,_.zN)(e("请填写名称"))}}),x&&(0,f.jsx)(o.rA,{icon:"cancel",title:e("取消"),onClick:K})]}),children:[x&&(0,f.jsxs)(n.Fragment,{children:[(0,f.jsx)(r.Sm,{placeholder:e("名称"),value:y,handleInputChange:C}),(0,f.jsx)(r.l6,{value:g,options:a.map(e=>({title:e.name,value:e.type})),onChange:e=>{S(e),b({})}}),N.map(t=>(0,f.jsx)(n.Fragment,{children:(0,f.jsx)(r.Sm,{type:M.includes(t.key)?"password":"text",placeholder:M.includes(t.key)&&A?e("留空表示不修改"):t.label,value:k[t.key]??"",handleInputChange:e=>b({...k,[t.key]:e})})},t.key))]}),!x&&(0,f.jsx)(h.X,{headers:[e("名称"),e("类型"),e("操作")],rows:s.map(t=>{return[(0,f.jsx)(l.xP,{context:t.name}),(0,f.jsx)(l.xP,{context:(s=t.type,a.find(e=>e.type===s)?.name??s)}),(0,f.jsxs)("div",{children:[(0,f.jsx)(o.rA,{icon:"edit",title:e("编辑"),onClick:()=>(e=>{m(!0),v(e.id),S(e.type),C(e.name??""),b({...e.config??{}}),I(Boolean(e.has_password))})(t)}),(0,f.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(async t=>{try{await c.I2.post("credential/delete",{id:t.id}),(0,_.SK)(e("已删除")),await V()}catch(e){}})(t)})]})];var s})})]})}var G=s(17903);function q(){const{t:e}=(0,u.B)(),[t,s]=(0,n.useState)([]),[i,a]=(0,n.useState)([]),[d,p]=(0,n.useState)([]),[x,m]=(0,n.useState)([]),[j,v]=(0,n.useState)(!1),[g,w]=(0,n.useState)(""),[S,y]=(0,n.useState)("webdav"),[C,k]=(0,n.useState)(""),[b,A]=(0,n.useState)(""),[I,V]=(0,n.useState)(""),[N,K]=(0,n.useState)(""),X=async()=>{try{const[e,t,n,i]=await Promise.all([c.I2.post("list",{}),c.I2.post("credential/list",{}),c.I2.post("driver/list",{}),c.I2.post("baidu/app/get",{})]);s(Array.isArray(e?.data)?e.data:[]),a(Array.isArray(t?.data)?t.data:[]),p(Array.isArray(n?.data)?n.data:[]),m(Array.isArray(i?.data?.accounts)?i.data.accounts:[])}catch(e){}};(0,n.useEffect)(()=>{X()},[]);const z=()=>{v(!1),w(""),y("webdav"),k(""),A(""),V(""),K("")};return(0,f.jsxs)(l.Zp,{self_title:(0,f.jsx)("span",{className:" div-row ",children:(0,f.jsx)("h2",{children:e("挂载列表")})}),rightBottomCom:(0,f.jsxs)("div",{children:[!j&&(0,f.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{z(),v(!0)}}),j&&(0,f.jsx)(o.rA,{icon:"network_check",title:e("测试连接"),onClick:async()=>{if(b)try{const t=await c.I2.post("test",{id:g||void 0,driver:S,credential_id:b,root_dir:I}),s=t?.data;s?.ok?(0,_.SK)(`${e("连接成功")}(${s.count??0})`):(0,_.zN)(`${e("连接失败")}:${s?.error??""}`)}catch(e){}else(0,_.zN)(e("请选择凭据"))}}),j&&(0,f.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{if(b)if(C.trim())try{await c.I2.post(g?"update":"add",{id:g||void 0,driver:S,mount_path:C,credential_id:b,root_dir:I,name:N,color:G.OT,readonly:!1,enabled:!0}),(0,_.SK)(e("保存成功")),z(),await X()}catch(e){}else(0,_.zN)(e("munt_rq"));else(0,_.zN)(e("请选择凭据"))}}),j&&(0,f.jsx)(o.rA,{icon:"cancel",title:e("取消"),onClick:z})]}),children:[j&&(0,f.jsxs)(n.Fragment,{children:[(0,f.jsx)(r.BC,{label:e("挂载类型"),label_width:"6rem",children:(0,f.jsx)(r.l6,{value:S,options:d.map(e=>({title:e.name,value:e.type})),onChange:e=>{y(e),A("")}})}),(0,f.jsx)(r.BC,{label:e("凭据"),label_width:"6rem",required:!0,children:(0,f.jsx)(r.l6,{value:b,options:(e=>{if("baidu"===e)return x.map(e=>({title:e.name||e.baidu_name||String(e.uk),value:String(e.uk)}));const t=G.UW[e];return i.filter(e=>!t||e.type===t).map(e=>({title:e.name,value:e.id}))})(S),onChange:A})}),(0,f.jsx)(r.BC,{label:e("本地目录"),label_width:"6rem",required:!0,children:(0,f.jsx)(r.Sm,{placeholder:e("被挂载的本地绝对路径"),value:C,handleInputChange:k})}),(0,f.jsx)(r.BC,{label:e("strtdrt"),label_width:"6rem",children:(0,f.jsx)(r.Sm,{placeholder:e("远端目录"),value:I,handleInputChange:V})}),(0,f.jsx)(r.BC,{label:e("dspnmtp"),label_width:"6rem",children:(0,f.jsx)(r.Sm,{placeholder:e("列表显示的名称"),value:N,handleInputChange:K})})]}),!j&&(0,f.jsx)(h.X,{headers:[e("名称"),e("挂载类型"),e("凭据"),e("操作")],rows:t.map(t=>{const s=i.find(e=>e.id===t.credential_id),n="baidu"===t.driver?x.find(e=>String(e.uk)===String(t.credential_id)):void 0;return[(0,f.jsx)("p",{children:t.name}),(0,f.jsx)("p",{children:(a=t.driver,d.find(e=>e.type===a)?.name??a)}),(0,f.jsx)("p",{children:n?n.name||n.baidu_name||String(n.uk):s?s.name:e("凭据已丢失")}),(0,f.jsxs)("div",{children:[(0,f.jsx)(o.rA,{icon:"edit",title:e("编辑"),onClick:()=>(e=>{v(!0),w(e.id),y(e.driver),k(e.mount_path??""),A(e.credential_id??""),V(e.root_dir??""),K(e.name??"")})(t)}),(0,f.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(async t=>{try{await c.I2.post("delete",{id:t.id}),(0,_.SK)(e("已删除")),await X()}catch(e){}})(t)})]})];var a})})]})}function W({on_credential_change:e}){const{t}=(0,u.B)(),[,s]=(0,w.fp)(p.AG.prompt_card),[i,a]=(0,n.useState)(null),[d,x]=(0,n.useState)([]),[m,j]=(0,n.useState)("百度网盘"),[v,g]=(0,n.useState)(""),[S,y]=(0,n.useState)(""),[C,k]=(0,n.useState)(""),[b,A]=(0,n.useState)("oob"),[I,V]=(0,n.useState)(!0),[N,K]=(0,n.useState)(!0),X="oob"===b,[z,F]=(0,n.useState)(!1),[O,P]=(0,n.useState)(!1),[$,B]=(0,n.useState)(""),D=async()=>{try{const e=await c.I2.post("baidu/app/get",{}),t=e?.data?.app??null;a(t),x(e?.data?.accounts??[]),j(t?.name??"百度网盘"),g(t?.app_id??""),y(t?.app_key??""),A("one_click"===t?.auth_mode?"one_click":"oob"),V(!1!==t?.enabled),K(!1!==t?.auto_refresh)}catch(e){}};(0,n.useEffect)(()=>{D();const s=new URLSearchParams(window.location.search),n=s.get("baidu_auth");"success"===n?((0,_.SK)(`${t("授权成功")}:${s.get("name")??""}`),e()):"failed"===n&&(0,_.zN)(`${t("授权失败")}:${s.get("reason")??""}`),n&&window.history.replaceState({},"",window.location.pathname)},[]);return(0,f.jsxs)(l.Zp,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:t("百度网盘")}),(0,f.jsx)(o.rA,{icon:"info",title:t("信息"),onClick:()=>{s({open:!0,title:t("信息"),context_div:(0,f.jsxs)("ul",{children:[(0,f.jsx)("li",{children:t("atathtp")}),(0,f.jsx)("li",{children:t("atathnt")}),(0,f.jsx)("li",{children:t("pstatht")})]})})}})]}),rightBottomCom:(0,f.jsxs)("div",{children:[!z&&(0,f.jsx)(o.rA,{icon:"apps",title:t("应用配置"),onClick:()=>F(!0)}),z&&(0,f.jsx)(o.rA,{icon:"save",title:t("保存应用配置"),onClick:async()=>{if(S.trim())if(i?.configured||C.trim())try{await c.I2.post("baidu/app/save",{name:m,app_id:v,app_key:S,secret_key:C,auth_mode:b,remark:i?.remark??"",enabled:I,auto_refresh:N}),(0,_.SK)(t("保存成功")),k(""),F(!1),await D()}catch(e){}else(0,_.zN)(t("rq_scrt"));else(0,_.zN)(t("rqappky"))}}),z&&(0,f.jsx)(o.rA,{icon:"cancel",title:t("取消"),onClick:()=>F(!1)}),!z&&(0,f.jsx)(o.rA,{icon:"key",title:t("授权"),onClick:()=>P(!0)}),(0,f.jsx)(o.rA,{icon:"refresh",title:t("授权检测/刷新"),onClick:async()=>{try{await c.I2.post("baidu/verify/all",{}),(0,_.SK)(t("检测完成")),await D()}catch(e){}}})]}),children:[z&&(0,f.jsxs)(n.Fragment,{children:[(0,f.jsx)(r.Sm,{placeholder:t("名称"),value:m,handleInputChange:j}),(0,f.jsx)(r.Sm,{placeholder:"AppID",value:v,handleInputChange:g}),(0,f.jsx)(r.Sm,{placeholder:"AppKey",value:S,handleInputChange:y}),(0,f.jsx)(r.Sm,{type:"password",placeholder:i?.configured?t("scrtkep"):"SecretKey",value:C,handleInputChange:k}),(0,f.jsx)(r.BC,{label:t("授权方式"),label_width:"6rem",children:(0,f.jsx)(r.l6,{value:b,options:(0,G.K1)(t),onChange:e=>A("one_click"===e?"one_click":"oob")})}),(0,f.jsx)(r.BC,{label:t("网盘使用"),label_width:"6rem",children:(0,f.jsx)(r.l6,{value:I,options:(0,G.Dd)(t),onChange:V})}),(0,f.jsx)(r.BC,{label:t("atrfrsh"),label_width:"6rem",children:(0,f.jsx)(r.l6,{value:N,options:(0,G.Dd)(t),onChange:K})})]}),O&&(0,f.jsxs)(n.Fragment,{children:[(0,f.jsx)(r.BC,{label:t("授权方式"),label_width:"6rem",children:(0,f.jsxs)("div",{className:"div-row",children:[(0,f.jsx)(r.U6,{value:"one_click",context:t("一键授权"),name:"baidu_auth_mode",selected:"one_click"===b,onchange:()=>A("one_click")}),(0,f.jsx)(r.U6,{value:"oob",context:t("outh_ob"),name:"baidu_auth_mode",selected:"oob"===b,onchange:()=>A("oob")})]})}),X&&(0,f.jsx)(r.Sm,{placeholder:t("pst_cd"),value:$,handleInputChange:B}),(0,f.jsxs)("div",{className:"div-row mount-actions",children:[(0,f.jsx)(o.C3,{text:t(X?"去授权(手动)":"去授权(一键)"),clickFun:async()=>{if(i?.configured)try{const e=await c.I2.post("baidu/authorize_url",{mode:b});e?.data&&window.open(e.data,"_blank","noopener,noreferrer")}catch(e){}else(0,_.zN)(t("svappfr"))}}),X&&(0,f.jsx)(o.C3,{text:t("完成授权"),clickFun:async()=>{if($.trim())try{const s=await c.I2.post("baidu/exchange",{code:$.trim(),mode:b});(0,_.SK)(`${t("授权成功")}:${s?.data?.baidu_name??""}`),B(""),P(!1),await D(),e()}catch(e){}else(0,_.zN)(t("请填写授权码"))}}),(0,f.jsx)(o.C3,{text:t("取消"),clickFun:()=>P(!1)})]})]}),!z&&!O&&(0,f.jsx)(h.X,{headers:[t("账号名"),t("百度账号"),t("授权状态"),t("使用"),t("授权时间"),t("操作")],rows:d.map(s=>{return[(0,f.jsx)(r.Sm,{value:s.name,no_border:!0,handleInputChange:t=>(async(t,s)=>{try{await c.I2.post("baidu/account/update",{uk:t.uk,name:s}),e()}catch(e){}})(s,t)}),(0,f.jsx)(l.xP,{context:s.baidu_name||"-"}),(0,f.jsx)(l.xP,{context:(n=s,n.authorized?n.expired?t("已过期"):t("已授权"):t("未授权"))}),(0,f.jsx)(r.l6,{value:s.enabled,no_border:!0,options:(0,G.Dd)(t),onChange:()=>(async t=>{try{await c.I2.post("baidu/account/update",{uk:t.uk,enabled:!t.enabled}),await D(),e()}catch(e){}})(s)}),(0,f.jsx)("p",{children:(0,G.eK)(s.created_at)}),(0,f.jsxs)("div",{children:[(0,f.jsx)(o.rA,{icon:"network_check",title:t("授权检测"),onClick:()=>(async e=>{try{const s=await c.I2.post("baidu/verify",{uk:e.uk});s?.data?.valid?(0,_.SK)(t("账号可用")):(0,_.zN)(`${t("账号不可用")}:${s?.data?.error??""}`),await D()}catch(e){}})(s)}),(0,f.jsx)(o.rA,{icon:"link_off",title:t("取消授权"),onClick:()=>(async e=>{try{await c.I2.post("baidu/deauthorize",{uk:e.uk}),(0,_.SK)(t("已取消授权")),await D()}catch(e){}})(s)}),(0,f.jsx)(o.rA,{icon:"delete",title:t("删除"),onClick:()=>(async s=>{try{await c.I2.post("baidu/delete",{uk:s.uk}),(0,_.SK)(t("已删除")),await D(),e()}catch(e){}})(s)})]})];var n})})]})}function Z(){const{t:e}=(0,u.B)(),{check_user_auth:t}=(0,S.MH)(),s=t(a.oV.file_mount),[r,d]=(0,w.fp)(p.AG.mount_enabled);(0,n.useEffect)(()=>{s&&(async()=>{try{const e=await c.I2.post("enabled/get",{});d(!0===e?.data)}catch(e){d(!1)}})()},[s]);return s?(0,f.jsxs)(n.Fragment,{children:[(0,f.jsxs)(b.aZ,{position:"right",children:[(0,f.jsx)("span",{className:"header-label",children:e("总开关")}),(0,f.jsx)(o.rA,{icon:!0===r?"cloud_done":"cloud_off",title:e(!0===r?"muntont":"muntoff"),selected:!0===r,onClick:async()=>{const t=!r;try{const s=await c.I2.post("enabled/set",{enabled:t}),n=!0===s?.data;d(n),(0,_.SK)(e(n?"挂载已启用":"挂载已停用"))}catch(e){}}})]}),(0,f.jsxs)(i.xh,{children:[(0,f.jsxs)(i.fI,{children:[(0,f.jsx)(i.VP,{widthPer:33,maxWidth:"30rem",children:(0,f.jsx)(E,{})}),(0,f.jsx)(i.VP,{widthPer:60,maxWidth:"60rem",children:(0,f.jsx)(W,{on_credential_change:()=>window.location.reload()})})]}),(0,f.jsx)(i.fI,{children:(0,f.jsx)(i.VP,{widthPer:50,maxWidth:"60rem",children:(0,f.jsx)(q,{})})})]})]}):(0,f.jsx)(i.fI,{children:(0,f.jsx)(i.VP,{children:(0,f.jsx)(l.Zp,{self_title:(0,f.jsx)("h2",{children:e("网盘挂载")}),children:(0,f.jsx)("p",{children:e("nmuntpr")})})})})}var R=s(87361);function U(){const{t:e}=(0,u.B)(),{check_user_auth:t}=(0,S.MH)(),s=[{index:1,name:`${e("个人环境")}`,rto:"private_env_setting",component:(0,f.jsx)(D,{})}];return t(a.oV.sys_setting_page)&&s.unshift({index:1,name:e("系统"),rto:"password",component:(0,f.jsx)(X,{})}),t(a.oV.sys_env_page)&&s.push({index:1,name:`${e("系统环境")}`,rto:"env_setting/",component:(0,f.jsx)(F,{})}),t(a.oV.auth_router_page)&&s.push({index:1,name:e("自定义路由"),rto:"customer_router/",component:(0,f.jsx)(A,{})}),t(a.oV.user_manage)&&s.push({index:1,name:e("用户管理"),rto:"user_manager/",component:(0,f.jsx)($,{})}),t(a.oV.role_manage)&&s.push({index:1,name:e("角色管理"),rto:"role_manager/",component:(0,f.jsx)(B,{})}),t(a.oV.file_mount)&&s.push({index:1,name:e("网盘挂载"),rto:"mount_setting/",component:(0,f.jsx)(Z,{})}),(0,f.jsx)(i.W1,{optionList:s,father_route:R.o.setting})}},92350(e,t,s){s.d(t,{Q:()=>h,o:()=>p});var n=s(34843),i=s(82893),a=s(74777),l=s(96540),o=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:l}=(0,o.B)();return e=>{let n;e===a.jk.ffmpeg?n=(0,d.jsx)("div",{children:"视频转换,rtsp播放器等媒体功能都需要这个软件。linux下你可以使用apt或者yum来安装,或者直接输入软件的位置"}):e===a.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,l.useState)([]);return(0,l.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:()=>l});var n=s(72635);const i=1440,a=525600;function l(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<a?`${(s/43200).toFixed(0)} ${n.Ay.t("月前")}`:`${(s/a).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"}]}])}}]);
|
|
1
|
+
"use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[3328],{77481(e,t,s){s.d(t,{S:()=>o,X:()=>l});var n=s(96540),i=s(61443),a=s(74848);function l(e){const[t,s]=n.useState([]),l=(0,n.useRef)(-1),[o,r]=(0,n.useState)(-1),[c,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 h=()=>{l.current=-1,r(-1),d(-1)};return(0,a.jsxs)("table",{children:[(0,a.jsx)("thead",{children:(0,a.jsx)("tr",{children:e.headers?.map((t,s)=>{const n=!!e.filter&&(e.filter.column??0)===s;let l=t;if(n){const s=e.filter,n=s.options.find(e=>e.value===s.value);null!=s.value&&n&&(l=`${t} (${n.label})`)}return(0,a.jsx)("th",{className:n?"table-filter-col":"",children:n?(0,a.jsx)(i.l6,{value:e.filter.value,options:e.filter.options,onChange:e.filter.onChange,bare:!0,trigger_label:l}):t},s)})})}),(0,a.jsx)("tbody",{children:t.map((t,s)=>{const n=!!e.onRowDrag;return(0,a.jsx)("tr",{className:n?(o===s?"row-dragging":"")+(c===s?" row-drop-target":""):"",draggable:n,onContextMenu:()=>{e.handleContextMenu&&e.handleContextMenu(t)},onDragStart:e=>{n&&(l.current=s,r(s),e.dataTransfer.effectAllowed="move")},onDragOver:e=>{!n||l.current<0||(e.preventDefault(),e.dataTransfer.dropEffect="move",d(s))},onDrop:t=>{n&&(t.preventDefault(),(()=>{const t=l.current,s=c;h(),t<0||s<0||t===s||e.onRowDrag?.(t,s)})())},onDragEnd:h,children:t.map((s,n)=>{const i=n===t.length-1?"small":"";return(0,a.jsx)("td",{className:i,style:{width:e.width??"auto"},children:s},n)})},s)})})]})}function o(e){return(0,a.jsx)("div",{style:{display:e.isFlex?"flex":"block"},children:e.columns.map((e,t)=>(0,a.jsx)("div",{children:e},t))})}},53328(e,t,s){s.r(t),s.d(t,{default:()=>U});var n=s(96540),i=s(75725),a=s(23430),l=s(70447),o=s(85997),r=s(61443),c=s(14284),d=s(53459),h=s(77481),u=s(86149),p=s(82893),x=s(40505),_=s(62042),m=s(21499),j=s(21469),v=s(64694),f=s(74848);function g(e){const{t}=(0,u.B)(),[s,a]=(0,n.useState)([]);(0,n.useEffect)(()=>{(async()=>{if(e.getItems){const t=await e.getItems();a(t)}})()},[]);return(0,f.jsx)(i.xh,{children:(0,f.jsx)(l.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e.title}),e.info_click&&(0,f.jsx)(o.rA,{icon:"info",onClick:()=>{e.info_click()},title:"信息"})]}),titleCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(o.rA,{icon:"add",title:t("添加"),onClick:()=>{const t=[];for(let s=0;s<e.headers.length-1;s++)t.push("");a([t,...s])}}),(0,f.jsx)(o.rA,{icon:"save",title:t("保存"),onClick:async()=>{e.save&&await e.save(s)}})]}),children:(0,f.jsx)(h.X,{headers:e.headers,rows:s.map((n,i)=>{const l=[];for(let t=0;t<e.headers.length;t++)l.push((0,f.jsx)(r.Sm,{value:n[t],handleInputChange:e=>{n[t]=e,a([...s])},no_border:!0}));return l.push((0,f.jsxs)("div",{children:[(0,f.jsx)(o.rA,{icon:"delete",title:t("删除"),onClick:()=>(e=>{s.splice(e,1),a([...s])})(i)}),n[0]&&(0,f.jsx)(o.rA,{icon:"content_copy",title:t("复制地址"),onClick:()=>{const e=(0,m.bi)(`${window.location.origin}${j.m.base_url}`,n[0]);(0,x.lW)(e),(0,_.SK)(e)}}),n[0]&&e.need_copy&&(0,f.jsx)(o.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)}})]})),l}),width:"10rem",onRowDrag:(e,t)=>{a((0,v.TI)(s,e,t))}})})})}var w=s(34843),S=s(78247),y=s(24659);function C(){const{t:e}=(0,u.B)(),[t,s]=(0,w.fp)(p.AG.prompt_card),a=(0,y.K)(),g=[e("路由"),e("auth"),e("备注")],[C,k]=(0,w.fp)(p.AG.editorSetting),[b,A]=(0,n.useState)([]);(0,n.useEffect)(()=>{(async()=>{const e=await c.XO.get("api/customer_router");e.code===d.m.Success&&A(e.data)})()},[]);return(0,f.jsx)(i.xh,{children:(0,f.jsx)(l.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("api_rt")})," ",(0,f.jsx)(o.rA,{icon:"info",onClick:()=>{(()=>{let e=(0,f.jsx)("div",{children:'默认需要以 "/api" 开头的路由。'});s({open:!0,title:"信息",context_div:(0,f.jsx)("div",{children:e})})})()},title:"信息"})]}),titleCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{A([{note:"",needAuth:!1,router:""},...b])}}),(0,f.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await c.XO.post("api/customer_router/save",b)).code===d.m.Success&&(0,_.SK)("保存成功")}})]}),children:(0,f.jsx)(h.X,{headers:g,rows:b.map((t,s)=>{const n=[(0,f.jsx)(r.Sm,{value:t.router,handleInputChange:e=>{t.router=e,A([...b])},no_border:!0}),(0,f.jsx)(r.l6,{defaultValue:t.needAuth,onChange:e=>{t.needAuth=e,A([...b])},options:a,no_border:!0}),(0,f.jsx)(r.Sm,{value:t.note,handleInputChange:e=>{t.note=e,A([...b])},no_border:!0}),(0,f.jsxs)("div",{children:[(0,f.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{b.splice(e,1),A([...b])})(s)}),(0,f.jsx)(o.rA,{icon:"edit",title:e("编辑"),onClick:()=>(async e=>{if(!e.router)return void(0,_.zN)("路由不能为空");const t=await c.XO.get(`jscode/${encodeURIComponent(e.router)}`);k({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&&(S.xK.set_value_temp(""),k({open:!1,model:"",fileName:"",save:null}),(0,_.SK)("成功"))}}),S.xK.set_value_temp(t.data)})(t)}),t.router&&(0,f.jsx)(o.rA,{icon:"content_copy",title:e("复制地址"),onClick:()=>{(0,x.lW)((0,m.bi)(window.location.origin+j.m.base_url,t.router)),(0,_.SK)(e("已复制"))}})]})];return n}),width:"10rem",onRowDrag:(e,t)=>{A((0,v.TI)(b,e,t))}})})})}var k=s(23496),b=s(4412);function A(){const{t:e}=(0,u.B)(),[t,s]=(0,w.fp)(p.AG.prompt_card),[a,l]=(0,w.fp)(p.AG.router_jump),o=[e("路由"),e("路径"),e("过期时间(s)"),e("备注")],r=[e("路由"),e("文件路径"),"token","user id",e("备注")];return(0,f.jsxs)(n.Fragment,{children:[(0,f.jsx)(b.aZ,{position:"right"}),(0,f.jsxs)(i.fI,{children:[(0,f.jsxs)(i.VP,{maxWidth:"50rem",children:[(0,f.jsx)(g,{title:e("页面资源路由"),headers:o,getItems:async()=>{const e=await c.XO.get(k.s.setting_customer_router);if(e.code===d.m.Success){if(a?.page_self_router_api_data){for(const t of e.data)t[1]===a?.page_self_router_api_data[1]&&(0,_.N9)("已经存在的页面资源路由配置目录设置");const t={};Object.assign(t,a?.page_self_router_api_data),e.data=[t,...e.data],l({})}return e.data}return[]},save:async e=>{(await c.XO.post(k.s.setting_customer_router_save,e)).code===d.m.Success&&(0,_.SK)("success")},info_click:()=>{let e=(0,f.jsx)("div",{children:'默认需要以 "/api" 开头的路由,会自动识别地址,将页面转到对应结果。路径支持文件路径(如果是文件夹路径的最后最后一个名字将会成为资源实际地址,整个目录将会变成一个http目录),http地址。'});s({open:!0,title:"信息",context_div:(0,f.jsx)("div",{children:e})})},need_copy:!0}),(0,f.jsx)(g,{title:e("wf_rt"),headers:r,getItems:async()=>{const e=await c.XO.get(k.s.setting_customer_workflow_router);return e.code===d.m.Success?e.data:[]},save:async e=>{(await c.XO.post(k.s.setting_customer_workflow_router_save,e)).code===d.m.Success&&(0,_.SK)("保存成功")},info_click:()=>{let e=(0,f.jsx)("div",{children:'默认需要以 "/api" 开头的路由,文件路径是有效的workflow路径。token也可以是文件绝对路径,请求的时候请设置同样的authorization请求头字段。'});s({open:!0,title:"信息",context_div:(0,f.jsx)("div",{children:e})})}})]}),(0,f.jsx)(i.VP,{maxWidth:"50rem",children:(0,f.jsx)(C,{})})]})]})}var I=s(74777),V=s(6960),N=s(7523);function K(){const{t:e}=(0,u.B)(),{check_user_auth:t}=(0,S.MH)(),[s,i]=(0,n.useState)(!1),[h,x]=(0,n.useState)("https://registry.npmjs.org"),[m,j]=(0,n.useState)(""),[v,g]=(0,n.useState)(180),[y,C]=(0,n.useState)(!1),[k,b]=(0,w.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),x(t.version_check_url||"https://registry.npmjs.org"),j(t.exe_download_url||""),g(t.check_interval_seconds||180)}})()},[]);return t(a.oV.sys_setting_page)?(0,f.jsxs)(l.Zp,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("自动升级")}),(0,f.jsx)(o.rA,{icon:"info",onClick:()=>{b({open:!0,title:e("信息"),context_div:(0,f.jsx)("div",{children:e("自动升级在 windows 下目前可能不稳定")})})},title:e("信息")})]}),rightBottomCom:(0,f.jsx)(o.C3,{text:e("保存"),clickFun:async()=>{if(!h)return void(0,_.zN)(e("ver_req"));if(s&&(!v||v<10))return void(0,_.zN)(e("chk_10s"));const t=new I.Mm;t.open=s,t.version_check_url=h,t.exe_download_url=m,t.check_interval_seconds=v;(await c.XO.post("auto_upgrade_setting/save",t)).code===d.m.Success&&(0,_.SK)(e("保存成功"))}}),children:[(0,f.jsx)("div",{children:e("ver_url")}),(0,f.jsx)(r.Sm,{placeholder:"https://registry.npmjs.org",value:h,handleInputChange:e=>{x(e)}}),(0,f.jsx)(r.l6,{value:s,onChange:e=>{i(e)},options:[{title:e("开启"),value:!0},{title:e("关闭"),value:!1}]}),s&&(0,f.jsxs)(f.Fragment,{children:[!1,(0,f.jsx)("div",{children:e("检测频率(秒)")}),(0,f.jsx)(r.Sm,{placeholder:e("def_180"),value:v,handleInputChange:e=>{g(Number(e)||180)}}),(0,f.jsx)("div",{style:{marginTop:"12px"},children:(0,f.jsx)(o.C3,{text:e(y?"升级检测中...":"立即升级"),clickFun:async()=>{C(!0);try{(await c.XO.post("auto_upgrade_setting/upgrade_now",{})).code===d.m.Success&&(0,_.SK)(e("已触发升级检测,请查看服务端日志"))}catch(t){(0,_.zN)(e("触发升级失败"))}finally{C(!1)}}})})]})]}):null}function X(){const[e,t]=(0,n.useState)(""),[s,a]=(0,n.useState)(""),[x,m]=(0,n.useState)(!1),[j,v]=(0,n.useState)(""),[g,y]=(0,n.useState)(!1),[C,A]=(0,n.useState)(""),[X,z]=(0,w.fp)(p.AG.prompt_card),[F,O]=(0,n.useState)(!1),[P,$]=(0,n.useState)(""),[B,D]=(0,n.useState)(""),[M,T]=(0,n.useState)(I.aM.close),[E,G]=(0,n.useState)(!1),[q,W]=(0,n.useState)(void 0),{t:Z,i18n:R}=(0,u.B)(),[U,H]=(0,w.fp)(p.AG.user_base_info),{check_user_auth:L}=(0,S.MH)(),{initUserInfo:Q}=(0,n.useContext)(N.F);(0,n.useEffect)(()=>{(async()=>{const e=await c.XO.get("sys_option/status");if(e.code===d.m.Success){y(e.data.recycle_open),A(e.data.recycle_dir);const s=e.data.sys_env;t(s?.web_site_title),a(s?.logo||""),m(s?.show_login_user_info),v(s?.http_proxy||"");const n=e.data.https_setting;n&&(O(n.open),$(n.cert_path||""),D(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&&W(e.length),e.mode&&T(e.mode),void 0!==e.persist&&G(e.persist)}})()},[]);return(0,f.jsxs)("div",{children:[(0,f.jsx)(b.aZ,{children:(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)("span",{className:"credits",children:[Z("系统运行于"),": ",(0,V.s)(U.runing_time_length)]}),(0,f.jsx)("span",{className:"credits",children:(0,f.jsxs)("a",{href:"https://github.com/xiaobaidadada/filecat",target:"_blank",children:["version:7.3.4",null!=U.latest_version&&"7.3.4"!==U.latest_version?` -> ${U.latest_version}`:""]})}),(0,f.jsx)("span",{className:"credits",children:(0,f.jsx)("a",{href:Z("官网地址"),target:"_blank",children:`filecat ${Z("功能文档")}`})}),(0,f.jsxs)("span",{className:"credits",children:[Z("安装方式")," :",U.process_env_run_env]})]})}),(0,f.jsx)(i.xh,{children:(0,f.jsxs)(i.fI,{children:[(0,f.jsxs)(i.VP,{widthPer:33,children:[(0,f.jsxs)(l.Zp,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:Z("通用设置")})," ",(0,f.jsx)(o.rA,{icon:"info",onClick:()=>{z({open:!0,title:Z("信息"),context_div:(0,f.jsx)("div",{children:Z("pxy_tip")})})},title:Z("信息")})]}),rightBottomCom:(0,f.jsx)(o.C3,{text:Z("确定修改"),clickFun:async()=>{(await c.XO.post(k.s.setting_sys_option_status_save,{type:I.Mu.sys_env,value:{web_site_title:e,show_login_user_info:x,http_proxy:j,logo:s}})).code===d.m.Success&&((0,_.SK)("修改成功"),Q())}}),children:[Z("网站标题"),(0,f.jsx)(r.Sm,{value:e,handleInputChange:e=>{t(e)}}),Z("网站 Logo"),(0,f.jsx)(r.Sm,{placeholder:Z("lclorur"),value:s,handleInputChange:e=>{a(e)}}),(0,f.jsx)("div",{children:Z("pxy_url")}),(0,f.jsx)(r.Sm,{placeholder:"http://127.0.0.1:7890",value:j,handleInputChange:e=>{v(e)}}),Z("lgn_usr"),(0,f.jsx)("input",{type:"checkbox",checked:x,onChange:()=>{m(!x)}})]}),(0,f.jsxs)(l.Zp,{title:Z("https_s"),rightBottomCom:(0,f.jsx)(o.C3,{text:Z("确定修改"),clickFun:async()=>{if(F){if(!P)return void(0,_.zN)("证书路径不能为空");if(!B)return void(0,_.zN)("私钥路径不能为空")}const e=new I.CH;e.open=F,e.cert_path=P,e.key_path=B;(await c.XO.post(k.s.setting_sys_option_status_save,{type:I.Mu.https,value:e,open:F})).code===d.m.Success&&(0,_.SK)("HTTPS 设置已保存,需重启服务器才能生效")}}),children:[(0,f.jsx)(r.l6,{value:F,onChange:e=>{O(e)},options:[{title:Z("开启"),value:!0},{title:Z("关闭"),value:!1}]}),F&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)("div",{children:Z("ssl_crt")}),(0,f.jsx)(r.Sm,{placeholder:Z("crt_pth"),value:P,handleInputChange:e=>{$(e)}}),(0,f.jsx)("div",{children:Z("ssl_key")}),(0,f.jsx)(r.Sm,{placeholder:Z("ky_pth"),value:B,handleInputChange:e=>{D(e)}})]})]}),(0,f.jsx)(K,{})]}),(0,f.jsxs)(i.VP,{widthPer:33,children:[(0,f.jsxs)(l.Zp,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:Z("文件回收站")})," ",(0,f.jsx)(o.rA,{icon:"info",onClick:()=>{z({open:!0,title:Z("信息"),context_div:(0,f.jsx)("div",{children:Z("格式:[被删除的文件所在父目录] 回收站目录 [; ...]")})})},title:Z("信息")})]}),rightBottomCom:(0,f.jsx)(o.C3,{text:Z("确定修改"),clickFun:async()=>{if(g&&!C)return void(0,_.zN)("目录不能为空");(await c.XO.post(k.s.setting_sys_option_status_save,{type:I.Mu.cyc,value:C,open:g})).code===d.m.Success&&(0,_.SK)("修改成功")}}),children:[(0,f.jsx)(r.Sm,{placeholder:Z("目录"),value:C,handleInputChange:e=>{A(e)}}),(0,f.jsx)(r.l6,{value:g,onChange:e=>{y(e)},options:[{title:Z("开启"),value:!0},{title:Z("关闭"),value:!1}]})]}),(0,f.jsxs)(l.Zp,{title:Z("tk_exp"),rightBottomCom:(0,f.jsx)(h.S,{isFlex:!0,columns:[(0,f.jsx)(o.C3,{text:Z("清空token"),clickFun:async()=>{(await c.XO.get("token/clear")).code===d.m.Success&&(0,_.SK)("清理完成,重新登录")}}),(0,f.jsx)(o.C3,{text:Z("保存"),clickFun:async()=>{const e=new I.Gd;e.mode=M,e.persist=E,I.aM.length!==e.mode||q||(0,_.zN)("秒数不能为空"),e.length=parseInt(q);(await c.XO.post("token/save",e)).code===d.m.Success&&(0,_.SK)("保存成功")}})]}),children:[(0,f.jsx)(h.S,{isFlex:!0,columns:[(0,f.jsx)(r.U6,{value:1,context:Z("关闭"),selected:M===I.aM.close,onchange:()=>{T(I.aM.close)}}),(0,f.jsx)(r.U6,{value:1,context:Z("指定时间"),selected:M===I.aM.length,onchange:()=>{T(I.aM.length)}}),(0,f.jsx)(r.U6,{value:1,context:Z("永不过期"),selected:M===I.aM.forver,onchange:()=>{T(I.aM.forver)}})]}),M===I.aM.length&&(0,f.jsx)(r.Sm,{placeholder:Z("秒"),value:q,handleInputChange:e=>{W(e)}}),(0,f.jsxs)("label",{style:{display:"flex",alignItems:"center",gap:6,marginTop:8,whiteSpace:"nowrap"},children:[(0,f.jsx)("input",{type:"checkbox",checked:E,onChange:()=>G(!E)}),Z("持久化")]})]})]})]})})]})}var z=s(92350);function F(){const{t:e,i18n:t}=(0,u.B)(),{initUserInfo:s,reloadUserInfo:a}=(0,n.useContext)(N.F),[x,m]=(0,n.useState)([]),[j,g]=(0,n.useState)([]),[C,k]=(0,w.fp)(p.AG.prompt_card),[,b]=(0,w.fp)(p.AG.editorSetting),[A,I]=(0,n.useState)([]),[V,K]=(0,n.useState)([]),[X,F]=(0,n.useState)([]),[O,P]=(0,n.useState)([]),[$,B]=(0,n.useState)(""),[D,M]=(0,n.useState)([]),T=(0,y.K)(),E=[e("软件"),e("是否安装"),e("路径")],G=[e("编号"),e("路径"),e("备注")],q=[e("编号"),e("路径"),e("是否开启"),e("备注")],W=[e("编号"),e("文件路径"),e("是否开启"),e("系统启动执行"),e("corn表达式"),e("用户id"),e("备注")],Z=[e("编号"),e("路径"),e("单用户并发数量"),e("系统并发数量"),e("big_res"),e("big_sz"),e("大文件并发数量"),e("big_ck"),e("备注")],R=[e("编号"),e("名称"),e("路径"),e("是否开启"),e("params"),e("备注")],{check_user_auth:U}=(0,S.MH)(),H=async()=>{const e=await c.XO.get("env/path/get");e.code===d.m.Success&&F(e.data)},L=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&&g(e.data);const t=await c.XO.get("pty_cmd");t.code===d.m.Success&&B(t.data),H(),L();const s=await c.XO.get("protection_dir/sys");s.code===d.m.Success&&I(s.data??[]);const n=await c.XO.get("dir_upload_max_num");n.code===d.m.Success&&K(n.data??[]);const i=await c.XO.get("plugin/list");i.code===d.m.Success&&M(i.data??[])})()},[]);const Q=(0,z.Q)(),J=async()=>{(await c.XO.post("plugin/list/save",D)).code===d.m.Success&&(0,_.SK)(e("保存成功"))};return(0,f.jsxs)(n.Fragment,{children:[(0,f.jsx)(i.J,{widthPer:100,maxWidth:"100rem",children:(0,f.jsx)(l.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("up_conc")})," ",(0,f.jsx)(o.rA,{icon:"info",onClick:()=>{Q("文件上传")},title:e("信息")})]}),titleCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{K([...V,{path:"",note:"",user_upload_num:2,sys_upload_num:6,ws_file_standard_size:52428800,ws_file_parallel_num:2,ws_file_block_mb_size:524288}])}}),(0,f.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{for(const e of V)if(e.open_ws_file){if("number"!=typeof e.ws_file_block_mb_size)return void(0,_.zN)(`编号:${e.index??""} 文件块的大小设置有问题`);if("number"!=typeof e.ws_file_parallel_num)return void(0,_.zN)(`编号:${e.index??""} 并发数量设置有问题`);if("number"!=typeof e.ws_file_standard_size)return void(0,_.zN)(`编号:${e.index??""} 大文件size设置有问题`)}(0,v.di)(V,e=>e.index??0);(await c.XO.post("dir_upload_max_num/save",V)).code===d.m.Success&&((0,_.SK)("保存成功"),a())}})]}),children:(0,f.jsx)(h.X,{headers:Z,rows:V.map((t,s)=>{const n=[(0,f.jsx)(r.Sm,{value:t.index,placeholder:s,handleInputChange:e=>{t.index=parseInt(e)},no_border:!0}),(0,f.jsx)(r.Sm,{value:t.path,handleInputChange:e=>{t.path=e},no_border:!0}),(0,f.jsx)(r.Sm,{value:t.user_upload_num,handleInputChange:e=>{t.user_upload_num=parseInt(e)},no_border:!0}),(0,f.jsx)(r.Sm,{value:t.sys_upload_num,handleInputChange:e=>{t.sys_upload_num=parseInt(e)},no_border:!0}),(0,f.jsx)(r.l6,{value:!0===t.open_ws_file,onChange:e=>{t.open_ws_file=e,K([...V])},options:T,no_border:!0}),(0,f.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,f.jsx)(r.Sm,{value:t.ws_file_parallel_num,handleInputChange:e=>{t.ws_file_parallel_num=parseInt(e)},no_border:!0}),(0,f.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,f.jsx)(r.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,f.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{V.splice(e,1),K([...V])})(s)})];return n}),width:"10rem",onRowDrag:(e,t)=>{K((0,v.TI)(V,e,t))}})})}),(0,f.jsxs)(i.fI,{children:[(0,f.jsx)(i.VP,{widthPer:50,maxWidth:"50rem",children:(0,f.jsxs)(i.xh,{children:[(0,f.jsx)(l.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("PATH")}),(0,f.jsx)(o.rA,{icon:"info",onClick:()=>{Q("环境路径")},title:e("信息")})]}),titleCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(o.rA,{icon:"list",title:e("查看"),onClick:async()=>{const t=await c.XO.get("env/process/view");t.code===d.m.Success?k({open:!0,title:e("进程环境变量"),context_div:(0,f.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,_.zN)(e("获取失败"))}}),(0,f.jsx)(o.rA,{icon:"edit",title:e("编辑"),onClick:async()=>{const t=await c.XO.get("env/process/get");t.code===d.m.Success?(S.xK.set_value_temp(t.data??""),b({model:"ace/mode/ini",open:!0,fileName:"",save:async t=>{(await c.XO.post("env/process/save",{text:t})).code===d.m.Success?(0,_.SK)(e("保存成功")):(0,_.zN)(e("保存失败")),S.xK.set_value_temp("")}})):(0,_.zN)(e("获取失败"))}}),(0,f.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{F([...X,{path:"",note:""}])}}),(0,f.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await c.XO.post("env/path/save",{paths:X})).code===d.m.Success&&((0,_.SK)("保存成功"),H(),s())}})]}),children:(0,f.jsx)(h.X,{headers:q,rows:X.map((t,s)=>{const n=[(0,f.jsx)("div",{children:s}),(0,f.jsx)(r.Sm,{value:t.path,handleInputChange:e=>{t.path=e},no_border:!0}),(0,f.jsx)(r.l6,{value:!!t.open,onChange:e=>{t.open=e,F([...X])},options:T,no_border:!0}),(0,f.jsx)(r.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,f.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{X.splice(e,1),F([...X])})(s)})];return n}),width:"10rem",onRowDrag:(e,t)=>{F((0,v.TI)(X,e,t))}})}),(0,f.jsx)(l.Zp,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("PTY CMD")}),(0,f.jsx)(o.rA,{icon:"info",onClick:()=>{Q("pty")},title:e("信息")})]}),rightBottomCom:(0,f.jsx)(o.C3,{text:e("更新"),clickFun:async()=>{(await c.XO.post("pty_cmd/save",{str:$})).code===d.m.Success&&((0,_.SK)("保存成功"),a())}}),children:(0,f.jsx)(r.Sm,{placeholder:e("cmd need pty env"),value:$,handleInputChange:e=>{B(e)}})}),(0,f.jsx)(l.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("Workflow Job")}),(0,f.jsx)(o.rA,{icon:"info",onClick:()=>{Q("Workflow")},title:e("信息")})]}),titleCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{P([...O,{open:!1}])}}),(0,f.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await c.XO.post("workflow_setting_save",O)).code===d.m.Success&&((0,_.SK)("ok"),L())}})]}),children:(0,f.jsx)(h.X,{headers:W,rows:O.map((t,s)=>{const n=[(0,f.jsx)("div",{children:s}),(0,f.jsx)(r.Sm,{value:t.file_path,handleInputChange:e=>{t.file_path=e},no_border:!0}),(0,f.jsx)(r.l6,{value:!!t.open,onChange:e=>{t.open=e,P([...O])},options:T,no_border:!0}),(0,f.jsx)(r.l6,{value:!!t.sys_power_on,onChange:e=>{t.sys_power_on=e,P([...O])},options:T,no_border:!0}),(0,f.jsx)(r.Sm,{value:t.cron_str,handleInputChange:e=>{t.cron_str=e},no_border:!0}),(0,f.jsx)(r.Sm,{value:t.user_id,handleInputChange:e=>{t.user_id=e},no_border:!0}),(0,f.jsx)(r.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,f.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{O.splice(e,1),P([...O])})(s)})];return n}),width:"10rem",onRowDrag:(e,t)=>{P((0,v.TI)(O,e,t))}})}),(0,f.jsx)(l.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("插件配置")}),(0,f.jsx)(o.rA,{icon:"info",onClick:()=>{Q("插件配置")},title:e("信息")})]}),titleCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{M([...D,{name:"",path:"",note:"",open:!1}])}}),(0,f.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:J})]}),children:(0,f.jsx)(h.X,{headers:R,rows:D.map((t,s)=>{const n=[s,(0,f.jsx)(r.Sm,{value:t.name,handleInputChange:e=>{t.name=e},no_border:!0}),(0,f.jsx)(r.Sm,{value:t.path,handleInputChange:e=>{t.path=e},no_border:!0}),(0,f.jsx)(r.l6,{value:!!t.open,onChange:e=>{t.open=e,M([...D])},options:T,no_border:!0}),(0,f.jsx)(o.mu,{icon:"edit",save:async e=>{t.params=e,await J()},title:""}),(0,f.jsx)(r.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,f.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{D.splice(e,1),M([...D])})(s)})];return n}),width:"10rem",onRowDrag:(e,t)=>{M((0,v.TI)(D,e,t))}})})]})}),(0,f.jsx)(i.VP,{widthPer:50,maxWidth:"50rem",children:(0,f.jsxs)(i.xh,{children:[(0,f.jsx)(l.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("系统保护路径")})," ",(0,f.jsx)(o.rA,{icon:"info",onClick:()=>{Q("保护目录")},title:e("信息")})]}),titleCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{I([...A,{path:"",note:""}])}}),(0,f.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await c.XO.post("protection_dir/sys/save",A)).code===d.m.Success&&((0,_.SK)("保存成功"),a())}})]}),children:(0,f.jsx)(h.X,{headers:G,rows:A.map((t,s)=>{const n=[(0,f.jsx)("div",{children:s}),(0,f.jsx)(r.Sm,{value:t.path,handleInputChange:e=>{t.path=e},no_border:!0}),(0,f.jsx)(r.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,f.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{A.splice(e,1),I([...A])})(s)})];return n}),width:"10rem",onRowDrag:(e,t)=>{I((0,v.TI)(A,e,t))}})}),(0,f.jsx)(l.uF,{title:e("外部软件"),titleCom:(0,f.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await c.XO.post("outside/software/save",j)).code===d.m.Success&&((0,_.SK)("保存成功"),s())}}),children:(0,f.jsx)(h.X,{headers:E,rows:j.map((t,s)=>[(0,f.jsx)("div",{children:t.id}),(0,f.jsx)(l.fq,{ok:t.installed}),(0,f.jsx)(r.Sm,{value:t.path,handleInputChange:e=>{t.path=e},no_border:!0,placeholder:e("use_env")}),(0,f.jsx)(o.rA,{icon:"info",onClick:()=>{Q(t.id)},title:e("信息")})]),width:"10rem"})})]})})]})]})}function O(e){const{t,i18n:s}=(0,u.B)(),[i,l]=(0,w.fp)(p.AG.user_base_info),o=[{title:t("用户权限"),list:[{title:t("用户管理"),permission:a.oV.user_manage},{title:t("角色管理"),permission:a.oV.role_manage}]},{title:t("系统管理权限"),list:[{title:t("系统信息"),permission:a.oV.all_sys},{title:t("系统进程关闭"),permission:a.oV.sys_process_close},{title:t("dc_ctdl"),permission:a.oV.docker_container_update},{title:t("dc_idl"),permission:a.oV.docker_images_delete},{title:t("systemd管理"),permission:a.oV.systemd},{title:t("防火墙管理"),permission:a.oV.firewall}]},{title:t("网络功能权限"),list:[{title:t("系统网络"),permission:a.oV.vir_net},{title:t("内网穿透"),permission:a.oV.tcp_proxy},{title:"ddns",permission:a.oV.ddns}]},{title:t("Ai 设置权限"),list:[{title:t("Ai 配置"),permission:a.oV.ai_agent_setting},{title:t("ai_page"),permission:a.oV.ai_agent_page},{title:t("sw_mdl"),permission:a.oV.ai_model_switch}]},{title:t("文件权限"),list:[{title:t("log_del"),permission:a.oV.filecat_file_delete_cut_rename},{title:t("log_wr"),permission:a.oV.filecat_file_context_update_upload_created_copy_decompression},{title:t("内容更新"),permission:a.oV.filecat_file_context_update},{title:t("文件回收站修改"),permission:a.oV.recycle_file_save},{title:t("文件分享"),permission:a.oV.share_file}]},{title:t("系统设置权限"),list:[{title:t("系统页面"),permission:a.oV.sys_setting_page},{title:t("htts"),permission:a.oV.https_file},{title:t("tk_time"),permission:a.oV.token_update},{title:t("修改密码"),permission:a.oV.update_password},{title:t("磁盘挂载"),permission:a.oV.sys_disk_mount},{title:t("通用设置"),permission:a.oV.sys_env_setting_key},{title:t("md_set"),permission:a.oV.md_editor_setting},{title:t("目录挂载"),permission:a.oV.file_mount}]},{title:t("系统环境设置"),list:[{title:t("sys_env"),permission:a.oV.sys_env_page},{title:t("up_lim"),permission:a.oV.dir_upload_max_num},{title:t("path_md"),permission:a.oV.env_path_update},{title:"pty cmd "+t("更新"),permission:a.oV.pty_cmd_update},{title:"workflow job",permission:a.oV.workflow_job},{title:t("path_up"),permission:a.oV.sys_protection_dir},{title:t("外部软件路径"),permission:a.oV.outside_software_path}]},{title:t("个人环境设置"),list:[{title:t("个性化设置"),permission:a.oV.private_sys_env}]},{title:t("自定义路由"),list:[{title:t("自定义路由页面"),permission:a.oV.auth_router_page},{title:t("wf_api"),permission:a.oV.workflow_api},{title:t("自定义资源路由"),permission:a.oV.code_resource},{title:t("api_rt"),permission:a.oV.code_api}]},{title:t("标签编辑权限"),list:[{title:t("ssh代理"),permission:a.oV.ssh_proxy_tag_update},{title:t("http代理"),permission:a.oV.http_proxy_tag_update},{title:t("浏览器代理"),permission:a.oV.browser_proxy_tag_update},{title:t("rdp代理"),permission:a.oV.rdp_proxy_tag_update},{title:t("网络唤醒"),permission:a.oV.wol_proxy_tag_update},{title:t("rtsp播放器"),permission:a.oV.rtsp_proxy_tag_update}]},{title:t("代理功能"),list:[{title:t("ssh代理"),permission:a.oV.ssh_proxy},{title:t("http代理"),permission:a.oV.http_proxy},{title:t("pxy_off"),permission:a.oV.http_proxy_download_cancel},{title:t("浏览器代理"),permission:a.oV.browser_proxy},{title:t("rdp代理"),permission:a.oV.rdp_proxy}]},{title:t("其他功能"),list:[{title:t("wf_run"),permission:a.oV.workflow_exe},{title:t("wf_user"),permission:a.oV.workflow_exe_user,noDisable:!0},{title:t("网络唤醒"),permission:a.oV.wol_proxy},{title:t("端口扫描"),permission:a.oV.port_scan},{title:t("rtsp播放器"),permission:a.oV.rtsp_proxy},{title:t("ssh_sv"),permission:a.oV.crypto_ssh_file},{title:t("cmd_rst"),permission:a.oV.shell_cmd_filecat_restart},{title:t("cmd_upg"),permission:a.oV.shell_cmd_filecat_upgrade},{title:t("cmd_dwn"),permission:a.oV.shell_cmd_filecat_kill_self},{title:t("cmd_ai"),permission:a.oV.ai_chat_cmd}]}];return(0,f.jsx)(n.Fragment,{children:o.map((t,s)=>(0,f.jsxs)("div",{children:[(0,f.jsx)("h3",{children:t.title}),t.list.map((t,s)=>(0,f.jsxs)("div",{children:[(0,f.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 $(){const{t:e,i18n:t}=(0,u.B)(),{initUserInfo:s,reloadUserInfo:x}=(0,n.useContext)(N.F),[j,g]=(0,w.fp)(p.AG.user_base_info),[S,y]=(0,n.useState)([]),[C,k]=(0,w.fp)(p.AG.prompt_card),[b,A]=(0,n.useState)(!1),[I,V]=(0,n.useState)(!1),[K,X]=(0,w.fp)(p.AG.confirm),[F,$]=(0,n.useState)(""),[B,D]=(0,n.useState)(""),[M,T]=(0,n.useState)(""),[E,G]=(0,n.useState)([]),[q,W]=(0,n.useState)([]),[Z,R]=(0,n.useState)([]),[U,H]=(0,n.useState)(""),[L,Q]=(0,n.useState)(""),[J,Y]=(0,n.useState)("en"),[ee,te]=(0,n.useState)(""),[se,ne]=(0,n.useState)([]),[ie,ae]=(0,n.useState)(""),[le,oe]=(0,n.useState)(!1),[re,ce]=(0,n.useState)(""),[de,he]=(0,n.useState)(""),[ue,pe]=(0,n.useState)({}),xe=(0,z.o)(),[_e,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);y(e)}else y(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=>{$(e?.username??""),D(e?.password??""),T(e?.cwd??""),G(e?.access_dirs??[]),W(e?.not_access_dirs??[]),R(e?.only_read_dirs??[]),H(e?.access_cmd??""),Q(e?.not_access_cmd??""),Y(e?.language??""),te(e?.theme??""),ne(e?.auth_list??[]),ae(e?.note??""),oe(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&&T(s.cwd),s.access_dirs&&s.access_dirs.length>0&&G(s.access_dirs),s.not_access_dirs&&s.not_access_dirs.length>0&&W(s.not_access_dirs),s.only_read_dirs&&s.only_read_dirs.length>0&&R(s.only_read_dirs),s.access_cmd&&H(s.access_cmd),s.not_access_cmd&&Q(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)}},ye=()=>{if(!F)return void(0,_.zN)("username not empty");if((0,m.CB)(F))return void(0,_.zN)("username not empty char");if(!M)return void(0,_.zN)("cwd not empty");const e=new a.E0;return e.language=J,e.theme=ee,e.access_dirs=E,e.username=F,e.password=B,e.not_access_dirs=q,e.only_read_dirs=Z,e.cwd=M,e.note=ie,e.access_cmd=U,e.not_access_cmd=L,e.auth_list=se,e.bind_role_id=de,e};return(0,f.jsxs)(i.fI,{children:[(0,f.jsx)(i.VP,{widthPer:50,maxWidth:"40rem",children:(0,f.jsx)(i.xh,{children:(0,f.jsx)(l.uF,{self_title:(0,f.jsx)("span",{className:" div-row ",children:(0,f.jsx)("h2",{children:e("用户")})}),titleCom:(0,f.jsxs)("div",{className:"div-row",style:{gap:"0.5rem"},children:[(0,f.jsx)(r.Sm,{placeholder:e("过滤"),value:je,handleInputChange:e=>{ve(e)},handlerEnter:()=>{ge()}}),(0,f.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{A(!0),V(!1),we(void 0)}})]}),children:(0,f.jsx)(h.X,{headers:fe,rows:S.map((t,s)=>{const n=[(0,f.jsx)("p",{children:t.id}),(0,f.jsx)(l.xP,{children:t.username}),(0,f.jsx)(l.xP,{children:t.cwd}),(0,f.jsx)(l.xP,{children:t.note}),(0,f.jsxs)("div",{children:[(0,f.jsx)(o.rA,{icon:"edit",title:e("编辑"),onClick:()=>(e=>{A(!1),V(!0),we(e)})(t)}),!t.is_root&&(0,f.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(async t=>{X({open:!0,title:e("确定删除吗"),handle:async()=>{const e=new a.E0;e.username=t,(await c.wm.post("delete_user",e)).code===d.m.Success&&((0,_.SK)("删除完成"),ge(),X({open:!1,handle:null}))}})})(t.username)})]})];return n}),width:"10rem"})})})}),(0,f.jsx)(i.VP,{widthPer:50,maxWidth:"40rem",children:(b||I)&&(0,f.jsx)(i.xh,{children:(0,f.jsxs)(l.Zp,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e(""+(b?"添加":"编辑"))})," "]}),rightBottomCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(o.rA,{icon:"cancel",title:e("取消"),onClick:()=>{A(!1),V(!1),we(void 0)}}),b&&(0,f.jsx)(o.rA,{icon:"add_circle",title:e("添加"),onClick:async()=>{if(!B)return void(0,_.zN)("password not empty");if((0,m.CB)(B))return void(0,_.zN)("username not empty char");const e=ye(),t=await c.wm.post("create_user",e);ge(),t.code===d.m.Success&&((0,_.SK)("创建完成"),ge(),A(!1),V(!1),we(void 0))}}),I&&(0,f.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{const e=ye();if(!e)return;e.id=re;(await c.wm.post("save_user",e)).code===d.m.Success&&((0,_.SK)("保存完成"),ge())}})]}),children:[(0,f.jsx)("label",{children:e("用户名")}),(0,f.jsx)(r.Sm,{value:F,handleInputChange:e=>$(e)}),(0,f.jsx)("label",{children:e("密码")}),(0,f.jsx)(r.Sm,{type:"password",value:B,handleInputChange:e=>D(e)}),(0,f.jsxs)("label",{children:[!ue?.access_dirs?.length&&(0,f.jsx)(o.rA,{icon:"add",onClick:()=>{G([...E,""])},title:"添加"}),e("目录范围")]}),(0,f.jsx)(r.Sm,{disabled:""!==ue.cwd&&void 0!==ue.cwd,value:M,handleInputChange:e=>T(e)}),(E??[]).map((t,s)=>(0,f.jsxs)("div",{style:{display:"flex"},children:[(0,f.jsx)("div",{style:{width:"90%"},children:(0,f.jsx)(r.Sm,{disabled:0!==ue?.access_dirs?.length&&void 0!==ue?.access_dirs?.length,value:t,handleInputChange:e=>{E[s]=e,G([...E])}})}),0===ue?.access_dirs?.length||void 0===ue?.access_dirs?.length&&(0,f.jsx)(o.rA,{icon:"delete",onClick:()=>{E.splice(s,1),G([...E])},title:e("删除")})]},s)),(0,f.jsxs)("label",{children:[!ue?.not_access_dirs?.length&&(0,f.jsx)(o.rA,{icon:"add",onClick:()=>{W([...q,""])},title:e("添加")}),e("禁止目录范围")]}),(q??[]).map((t,s)=>(0,f.jsxs)("div",{style:{display:"flex"},children:[(0,f.jsx)("div",{style:{width:"90%"},children:(0,f.jsx)(r.Sm,{disabled:0!==ue?.not_access_dirs?.length&&void 0!==ue?.not_access_dirs?.length,value:t,handleInputChange:e=>{q[s]=e,W([...q])}})}),0===ue?.not_access_dirs?.length||void 0===ue?.not_access_dirs?.length&&(0,f.jsx)(o.rA,{icon:"delete",onClick:()=>{q.splice(s,1),W([...q])},title:e("删除")})]},s)),(0,f.jsxs)("label",{children:[!ue?.only_read_dirs?.length&&(0,f.jsx)(o.rA,{icon:"add",onClick:()=>{R([...Z,""])},title:e("添加")}),e("只读目录范围")]}),(Z??[]).map((t,s)=>(0,f.jsxs)("div",{style:{display:"flex"},children:[(0,f.jsx)("div",{style:{width:"90%"},children:(0,f.jsx)(r.Sm,{disabled:0!==ue?.only_read_dirs?.length&&void 0!==ue?.only_read_dirs?.length,value:t,handleInputChange:e=>{Z[s]=e,R([...Z])}})}),0===ue?.only_read_dirs?.length||void 0===ue?.only_read_dirs?.length&&(0,f.jsx)(o.rA,{icon:"delete",onClick:()=>{Z.splice(s,1),R([...Z])},title:e("删除")})]},s)),(0,f.jsx)("label",{children:e("可执行的命令")}),(0,f.jsx)(r.Sm,{disabled:""!==ue.access_cmd&&void 0!==ue.access_cmd,value:U,placeholder:"use blank split",handleInputChange:e=>H(e)}),(0,f.jsx)("label",{children:e("禁止执行的命令")}),(0,f.jsx)(r.Sm,{disabled:""!==ue.not_access_cmd&&void 0!==ue.not_access_cmd,value:L,placeholder:"use blank split",handleInputChange:e=>Q(e)}),!le&&(0,f.jsxs)(n.Fragment,{children:[(0,f.jsx)("label",{children:e("角色")}),(0,f.jsx)(r.l6,{value:de,onChange:e=>{Se(e)},options:(()=>{const e=[];e.push({title:"NOT",value:""});for(let t of _e)e.push({title:t.role_name,value:t.role_id});return e})()})]}),(0,f.jsx)("label",{children:e("语言")}),(0,f.jsx)(r.l6,{disabled:""!==ue.language&&void 0!==ue.language,value:J,onChange:e=>{Y(e)},options:[{title:e("跟随系统"),value:"sys"},{title:"English",value:"en"},{title:"中文",value:"zh"}]}),(0,f.jsx)("label",{children:e("主题")}),(0,f.jsx)(r.l6,{disabled:""!==ue.theme&&void 0!==ue.theme,value:ee,onChange:e=>{te(e)},options:xe}),(0,f.jsx)(O,{is_disable:e=>{if(!0===le)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===le||void 0!==se?.find(t=>t===e),select_auth:e=>{se?se.includes(e)?((0,v.I)(se,t=>t===e),ne([...se])):ne([...se,e]):ne([e])}}),(0,f.jsx)("label",{children:e("备注")}),(0,f.jsx)(r.Sm,{value:ie,handleInputChange:e=>ae(e)})]})})})]})}function B(){const{t:e,i18n:t}=(0,u.B)(),{initUserInfo:s}=(0,n.useContext)(N.F),[x,m]=(0,n.useState)([]),[j,g]=(0,w.fp)(p.AG.prompt_card),[S,y]=(0,n.useState)(!1),[C,k]=(0,n.useState)(!1),[b,A]=(0,w.fp)(p.AG.confirm),[I,V]=(0,n.useState)(""),[K,X]=(0,n.useState)(""),[F,P]=(0,n.useState)([]),[$,B]=(0,n.useState)([]),[D,M]=(0,n.useState)([]),[T,E]=(0,n.useState)(""),[G,q]=(0,n.useState)(""),[W,Z]=(0,n.useState)(""),[R,U]=(0,n.useState)(""),[H,L]=(0,n.useState)([]),[Q,J]=(0,n.useState)(""),[Y,ee]=(0,n.useState)(""),te=(0,z.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=>{V(e?.role_name??""),X(e?.cwd??""),P(e?.access_dirs??[]),B(e?.not_access_dirs??[]),M(e?.only_read_dirs??[]),E(e?.access_cmd??""),q(e?.not_access_cmd??""),Z(e?.language??""),U(e?.theme??""),L(e?.auth_list??[]),J(e?.role_id??""),ee(e?.role_note??"")};(0,n.useEffect)(()=>{ne()},[]);const ae=()=>{if(!I)return void(0,_.zN)("role_name not empty");const e=new a.E0;return e.language=W,e.theme=R,e.access_dirs=F,e.role_name=I,e.not_access_dirs=$,e.only_read_dirs=D,e.cwd=K,e.access_cmd=T,e.not_access_cmd=G,e.auth_list=H,e.role_note=Y,e};return(0,f.jsxs)(i.fI,{children:[(0,f.jsx)(i.VP,{widthPer:50,maxWidth:"40rem",children:(0,f.jsx)(i.xh,{children:(0,f.jsx)(l.uF,{self_title:(0,f.jsx)("span",{className:" div-row ",children:(0,f.jsx)("h2",{children:e("角色")})}),titleCom:(0,f.jsx)("div",{children:(0,f.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{y(!0),k(!1),ie(void 0)}})}),children:(0,f.jsx)(h.X,{headers:se,rows:x.map((t,s)=>{const n=[(0,f.jsx)("p",{children:t.role_id}),(0,f.jsx)(l.xP,{children:t.role_name}),(0,f.jsx)(l.xP,{children:t.role_note}),(0,f.jsxs)("div",{children:[(0,f.jsx)(o.rA,{icon:"edit",title:e("编辑"),onClick:()=>(e=>{y(!1),k(!0),ie(e)})(t)}),!t.is_root&&(0,f.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(async t=>{A({open:!0,title:e("确定删除吗"),handle:async()=>{const e=new a.E0;e.role_id=t,(await c.wm.post("delete_role",e)).code===d.m.Success&&((0,_.SK)("删除完成"),ne(),A({open:!1,handle:null}))}})})(t.role_id)})]})];return n}),width:"10rem"})})})}),(0,f.jsx)(i.VP,{widthPer:50,maxWidth:"40rem",children:(S||C)&&(0,f.jsx)(i.xh,{children:(0,f.jsxs)(l.Zp,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e(""+(S?"添加":"编辑"))})," "]}),rightBottomCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(o.rA,{icon:"cancel",title:e("取消"),onClick:()=>{y(!1),k(!1),ie(void 0)}}),S&&(0,f.jsx)(o.rA,{icon:"add_circle",title:e("添加"),onClick:async()=>{const e=ae();if(!e)return;const t=await c.wm.post("create_role",e);ne(),t.code===d.m.Success&&((0,_.SK)("创建完成"),ne(),y(!1),k(!1),ie(void 0))}}),C&&(0,f.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{const e=ae();if(!e)return;e.role_id=Q;(await c.wm.post("save_role",e)).code===d.m.Success&&((0,_.SK)("保存完成"),ne())}})]}),children:[(0,f.jsx)("label",{children:e("角色名")}),(0,f.jsx)(r.Sm,{value:I,handleInputChange:e=>V(e)}),(0,f.jsx)("label",{children:e("角色备注")}),(0,f.jsx)(r.Sm,{value:Y,handleInputChange:e=>ee(e)}),(0,f.jsxs)("label",{children:[(0,f.jsx)(o.rA,{icon:"add",onClick:()=>{P([...F,""])},title:"添加"}),e("目录范围")]}),(0,f.jsx)(r.Sm,{value:K,handleInputChange:e=>X(e)}),(F??[]).map((e,t)=>(0,f.jsxs)("div",{style:{display:"flex"},children:[(0,f.jsx)("div",{style:{width:"90%"},children:(0,f.jsx)(r.Sm,{value:e,handleInputChange:e=>{F[t]=e,P([...F])}})}),(0,f.jsx)(o.rA,{icon:"delete",onClick:()=>{F.splice(t,1),P([...F])},title:"删除"})]},t)),(0,f.jsxs)("label",{children:[(0,f.jsx)(o.rA,{icon:"add",onClick:()=>{B([...$,""])},title:"添加"}),e("禁止目录范围")]}),($??[]).map((t,s)=>(0,f.jsxs)("div",{style:{display:"flex"},children:[(0,f.jsx)("div",{style:{width:"90%"},children:(0,f.jsx)(r.Sm,{value:t,handleInputChange:e=>{$[s]=e,B([...$])}})}),(0,f.jsx)(o.rA,{icon:"delete",onClick:()=>{$.splice(s,1),B([...$])},title:e("删除")})]},s)),(0,f.jsxs)("label",{children:[(0,f.jsx)(o.rA,{icon:"add",onClick:()=>{M([...D,""])},title:e("添加")}),e("只读目录范围")]}),(D??[]).map((e,t)=>(0,f.jsxs)("div",{style:{display:"flex"},children:[(0,f.jsx)("div",{style:{width:"90%"},children:(0,f.jsx)(r.Sm,{value:e,handleInputChange:e=>{D[t]=e,M([...D])}})}),(0,f.jsx)(o.rA,{icon:"delete",onClick:()=>{D.splice(t,1),M([...D])},title:"删除"})]},t)),(0,f.jsx)("label",{children:e("可执行的命令")}),(0,f.jsx)(r.Sm,{value:T,placeholder:"use blank split",handleInputChange:e=>E(e)}),(0,f.jsx)("label",{children:e("禁止执行的命令")}),(0,f.jsx)(r.Sm,{value:G,placeholder:"use blank split",handleInputChange:e=>q(e)}),(0,f.jsx)("label",{children:e("语言")}),(0,f.jsx)(r.l6,{value:W,onChange:e=>{Z(e)},options:[{title:e("跟随系统"),value:"sys"},{title:"NOT",value:""},{title:"English",value:"en"},{title:"中文",value:"zh"}]}),(0,f.jsx)("label",{children:e("主题")}),(0,f.jsx)(r.l6,{value:R,onChange:e=>{U(e)},options:te}),(0,f.jsx)(O,{is_disable:()=>!1,is_selected:(e,t)=>void 0!==H?.find(t=>t===e),select_auth:e=>{H?(H.find(t=>t==e)?(0,v.I)(H,t=>t===e):H.push(e),L([...H])):L([e])}})]})})})]})}function D(){const{t:e,i18n:t}=(0,u.B)(),{initUserInfo:s,reloadUserInfo:x}=(0,n.useContext)(N.F),[m,j]=(0,n.useState)([]),[g,S]=(0,w.fp)(p.AG.prompt_card),[C,b]=(0,n.useState)([]),[A,V]=(0,n.useState)([]),[K,X]=(0,n.useState)([]),[F,O]=(0,w.fp)(p.AG.user_base_info),P=(0,y.K)(),$=(0,z.o)(),B=[e("编号"),e("路径"),e("是否默认"),e("备注")],D=[e("编号"),e("路径"),e("备注")],M=[e("编号"),e("命令"),e("父编号"),e("备注")],T=[e("文件后缀"),e("命令"),e("其他参数"),e("备注")],[E,G]=(0,n.useState)(""),[q,W]=(0,n.useState)(""),[Z,R]=(0,n.useState)(""),[U,H]=(0,n.useState)(!1),[L,Q]=(0,n.useState)(""),[J,Y]=(0,n.useState)(""),[ee,te]=(0,n.useState)("");(0,n.useEffect)(()=>{(async()=>{const e=await c.XO.get("filesSetting");e.code===d.m.Success&&(j(e.data.dirs),V(e.data.quick_cmd),X(e.data.file_quick_cmd));const t=await c.XO.get("protection_dir");t.code===d.m.Success&&b(t.data??[])})(),Q(F?.user_data?.language),Y(F?.user_data?.theme),te(F?.user_data?.upload_file_ignore)},[]);const se=(0,z.Q)();return(0,f.jsx)(n.Fragment,{children:(0,f.jsxs)(i.fI,{children:[(0,f.jsxs)(i.VP,{widthPer:33,children:[(0,f.jsx)(i.xh,{children:(0,f.jsxs)(l.Zp,{title:e("修改密码"),rightBottomCom:(0,f.jsx)(o.C3,{text:e("确定修改"),clickFun:async()=>{if(!E||!q)return void(0,_.zN)("账号密码不能为空");if(q!==Z)return void(0,_.zN)("两次密码不一样");const e=new a.tl;e.username=E,e.password=q,e.confirm_password=Z,e.user_id=F.user_data.id;(await c.wm.post("updatePassword",e)).code===d.m.Success&&(0,_.SK)("修改成功")}}),children:[(0,f.jsx)(r.Sm,{placeholder:e("新账号"),value:E,handleInputChange:e=>{G(e)}}),(0,f.jsx)(r.cA,{placeholder:e("新密码"),handleInputChange:e=>{W(e)}}),(0,f.jsx)(r.cA,{placeholder:e("确认密码"),handleInputChange:e=>{R(e)}})]})}),(0,f.jsx)(i.xh,{children:(0,f.jsxs)(l.Zp,{title:e("个性化设置"),rightBottomCom:(0,f.jsx)(o.C3,{text:e("确定修改"),clickFun:async()=>{(await c.XO.post(k.s.setting_sys_option_status_save,{type:I.Mu.private_sys_env,value:{language:L,theme:J,upload_file_ignore:ee}})).code===d.m.Success&&((0,_.SK)("修改成功"),s())}}),children:[e("语言"),(0,f.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,f.jsx)(r.l6,{value:J,onChange:e=>{Y(e)},options:$}),(0,f.jsx)(r.Sm,{value:ee,handleInputChange:e=>{te(e)},placeholderOut:e("拖拽文件上传忽略列表"),placeholder:"node_modules *.js",no_border:!0})]})})]}),(0,f.jsxs)(i.VP,{children:[(0,f.jsxs)(i.xh,{children:[(0,f.jsx)(l.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("文件夹路径")})," ",(0,f.jsx)(o.rA,{icon:"info",onClick:()=>{se("文件夹路径")},title:e("信息")})]}),titleCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{j([...m,{note:"",default:!1,path:""}])}}),(0,f.jsx)(o.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,_.SK)("保存成功"),x(),s())}})]}),children:(0,f.jsx)(h.X,{headers:B,rows:m.map((t,s)=>{const n=[(0,f.jsx)("div",{children:s}),(0,f.jsx)(r.Sm,{value:t.path,handleInputChange:e=>{t.path=e},no_border:!0}),(0,f.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:P,no_border:!0}),(0,f.jsx)(r.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,f.jsx)("div",{children:0!==s&&(0,f.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{m.splice(e,1),j([...m])})(s)})})];return n}),width:"10rem",onRowDrag:(e,t)=>{0!==e&&0!==t&&j((0,v.TI)(m,e,t))}})}),(0,f.jsx)(l.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("个人保护路径")})," ",(0,f.jsx)(o.rA,{icon:"info",onClick:()=>{se("保护目录")},title:e("信息")})]}),titleCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{b([...C,{path:"",note:""}])}}),(0,f.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await c.XO.post("protection_dir/save",C)).code===d.m.Success&&((0,_.SK)("保存成功"),x())}})]}),children:(0,f.jsx)(h.X,{headers:D,rows:C.map((t,s)=>{const n=[(0,f.jsx)("div",{children:s}),(0,f.jsx)(r.Sm,{value:t.path,handleInputChange:e=>{t.path=e},no_border:!0}),(0,f.jsx)(r.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,f.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{C.splice(e,1),b([...C])})(s)})];return n}),width:"10rem",onRowDrag:(e,t)=>{b((0,v.TI)(C,e,t))}})})]}),(0,f.jsxs)(i.xh,{children:[(0,f.jsx)(l.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("目录快捷命令")}),(0,f.jsx)(o.rA,{icon:"info",onClick:()=>{se("目录快捷命令")},title:"info"})]}),titleCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{V([...A,{cmd:"",note:""}])}}),(0,f.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await c.XO.post("filesSetting/save",{quick_cmd:A})).code===d.m.Success&&((0,_.SK)("保存成功"),s())}})]}),children:(0,f.jsx)(h.X,{headers:M,rows:A.map((t,s)=>{const n=[(0,f.jsx)(r.Sm,{value:t.index,handleInputChange:e=>{t.index=e},no_border:!0}),(0,f.jsx)(r.Sm,{value:t.cmd,handleInputChange:e=>{t.cmd=e},no_border:!0}),(0,f.jsx)(r.Sm,{value:t.father_index,handleInputChange:e=>{t.father_index=e},no_border:!0}),(0,f.jsx)(r.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,f.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{A.splice(e,1),V([...A])})(s)})];return n}),width:"10rem",onRowDrag:(e,t)=>{V((0,v.TI)(A,e,t))}})}),(0,f.jsx)(l.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("文件快捷命令")}),(0,f.jsx)(o.rA,{icon:"info",onClick:()=>{se("文件快捷命令")},title:"info"})]}),titleCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{X([...K,{cmd:"",note:"",file_suffix:"",params:""}])}}),(0,f.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await c.XO.post("filesSetting/save",{file_quick_cmd:K})).code===d.m.Success&&((0,_.SK)("保存成功"),s())}})]}),children:(0,f.jsx)(h.X,{headers:T,rows:K.map((t,s)=>{const n=[(0,f.jsx)(r.Sm,{value:t.file_suffix,handleInputChange:e=>{t.file_suffix=e},no_border:!0}),(0,f.jsx)(r.Sm,{value:t.cmd,handleInputChange:e=>{t.cmd=e},no_border:!0}),(0,f.jsx)(r.Sm,{value:t.params,handleInputChange:e=>{t.params=e},no_border:!0}),(0,f.jsx)(r.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,f.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{K.splice(e,1),X([...K])})(s)})];return n}),width:"10rem",onRowDrag:(e,t)=>{X((0,v.TI)(K,e,t))}})})]})]})]})})}const M=["password","private_key","secret_key"],T="webdav";function E(){const{t:e}=(0,u.B)(),[,t]=(0,w.fp)(p.AG.prompt_card),[s,i]=(0,n.useState)([]),[a,d]=(0,n.useState)([]),[x,m]=(0,n.useState)(!1),[j,v]=(0,n.useState)(""),[g,S]=(0,n.useState)(T),[y,C]=(0,n.useState)(""),[k,b]=(0,n.useState)({}),[A,I]=(0,n.useState)(!1),V=async()=>{try{const[e,t]=await Promise.all([c.I2.post("credential/list",{}),c.I2.post("credential/meta",{})]);i(Array.isArray(e?.data)?e.data:[]),d(Array.isArray(t?.data)?t.data:[])}catch(e){}};(0,n.useEffect)(()=>{V()},[]);const N=a.find(e=>e.type===g)?.fields??[],K=()=>{m(!1),v(""),S(T),C(""),b({}),I(!1)};return(0,f.jsxs)(l.Zp,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("普通凭据管理")}),(0,f.jsx)(o.rA,{icon:"info",title:e("信息"),onClick:()=>{t({open:!0,title:e("信息"),context_div:(0,f.jsxs)("div",{children:[(0,f.jsxs)("ul",{children:[(0,f.jsx)("li",{children:e("crd_tp")}),(0,f.jsx)("li",{children:e("bidacct")}),(0,f.jsx)("li",{children:e("pwdkept")}),(0,f.jsx)("li",{children:e("tstbfrs")})]}),(0,f.jsxs)("ul",{children:[(0,f.jsxs)("li",{children:[(0,f.jsx)("b",{children:"WebDAV"}),":",e("prtwbdv")]}),(0,f.jsxs)("li",{children:[(0,f.jsx)("b",{children:"SSH / SFTP"}),":",e("prtsftp")]}),(0,f.jsxs)("li",{children:[(0,f.jsx)("b",{children:"S3 兼容对象存储"}),":",e("prt_s3")]})]})]})})}})]}),rightBottomCom:(0,f.jsxs)("div",{children:[!x&&(0,f.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{K(),m(!0)}}),x&&(0,f.jsx)(o.rA,{icon:"network_check",title:e("测试连接"),onClick:async()=>{try{const t=await c.I2.post("credential/test",{id:j||void 0,type:g,config:k}),s=t?.data;s?.ok?(0,_.SK)(`${e("连接成功")}(${s.count??0})`):(0,_.zN)(`${e("连接失败")}:${s?.error??""}`)}catch(e){}}}),x&&(0,f.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{if(y.trim()){for(const t of N){const s=String(k[t.key]??"").trim()||j&&M.includes(t.key);if(t.required&&!s)return void(0,_.zN)(`${e("请填写")}${e(t.label)}`)}try{await c.I2.post(j?"credential/update":"credential/add",{id:j||void 0,type:g,name:y,config:k,enabled:!0}),(0,_.SK)(e("保存成功")),K(),await V()}catch(e){}}else(0,_.zN)(e("请填写名称"))}}),x&&(0,f.jsx)(o.rA,{icon:"cancel",title:e("取消"),onClick:K})]}),children:[x&&(0,f.jsxs)(n.Fragment,{children:[(0,f.jsx)(r.Sm,{placeholder:e("名称"),value:y,handleInputChange:C}),(0,f.jsx)(r.l6,{value:g,options:a.map(e=>({title:e.name,value:e.type})),onChange:e=>{S(e),b({})}}),N.map(t=>(0,f.jsx)(n.Fragment,{children:(0,f.jsx)(r.Sm,{type:M.includes(t.key)?"password":"text",placeholder:M.includes(t.key)&&A?e("留空表示不修改"):t.label,value:k[t.key]??"",handleInputChange:e=>b({...k,[t.key]:e})})},t.key))]}),!x&&(0,f.jsx)(h.X,{headers:[e("名称"),e("类型"),e("操作")],rows:s.map(t=>{return[(0,f.jsx)(l.xP,{context:t.name}),(0,f.jsx)(l.xP,{context:(s=t.type,a.find(e=>e.type===s)?.name??s)}),(0,f.jsxs)("div",{children:[(0,f.jsx)(o.rA,{icon:"edit",title:e("编辑"),onClick:()=>(e=>{m(!0),v(e.id),S(e.type),C(e.name??""),b({...e.config??{}}),I(Boolean(e.has_password))})(t)}),(0,f.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(async t=>{try{await c.I2.post("credential/delete",{id:t.id}),(0,_.SK)(e("已删除")),await V()}catch(e){}})(t)})]})];var s})})]})}var G=s(17903);function q(){const{t:e}=(0,u.B)(),[t,s]=(0,n.useState)([]),[i,a]=(0,n.useState)([]),[d,p]=(0,n.useState)([]),[x,m]=(0,n.useState)([]),[j,v]=(0,n.useState)(!1),[g,w]=(0,n.useState)(""),[S,y]=(0,n.useState)("webdav"),[C,k]=(0,n.useState)(""),[b,A]=(0,n.useState)(""),[I,V]=(0,n.useState)(""),[N,K]=(0,n.useState)(""),X=async()=>{try{const[e,t,n,i]=await Promise.all([c.I2.post("list",{}),c.I2.post("credential/list",{}),c.I2.post("driver/list",{}),c.I2.post("baidu/app/get",{})]);s(Array.isArray(e?.data)?e.data:[]),a(Array.isArray(t?.data)?t.data:[]),p(Array.isArray(n?.data)?n.data:[]),m(Array.isArray(i?.data?.accounts)?i.data.accounts:[])}catch(e){}};(0,n.useEffect)(()=>{X()},[]);const z=()=>{v(!1),w(""),y("webdav"),k(""),A(""),V(""),K("")};return(0,f.jsxs)(l.Zp,{self_title:(0,f.jsx)("span",{className:" div-row ",children:(0,f.jsx)("h2",{children:e("挂载列表")})}),rightBottomCom:(0,f.jsxs)("div",{children:[!j&&(0,f.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{z(),v(!0)}}),j&&(0,f.jsx)(o.rA,{icon:"network_check",title:e("测试连接"),onClick:async()=>{if(b)try{const t=await c.I2.post("test",{id:g||void 0,driver:S,credential_id:b,root_dir:I}),s=t?.data;s?.ok?(0,_.SK)(`${e("连接成功")}(${s.count??0})`):(0,_.zN)(`${e("连接失败")}:${s?.error??""}`)}catch(e){}else(0,_.zN)(e("请选择凭据"))}}),j&&(0,f.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{if(b)if(C.trim())try{await c.I2.post(g?"update":"add",{id:g||void 0,driver:S,mount_path:C,credential_id:b,root_dir:I,name:N,color:G.OT,readonly:!1,enabled:!0}),(0,_.SK)(e("保存成功")),z(),await X()}catch(e){}else(0,_.zN)(e("munt_rq"));else(0,_.zN)(e("请选择凭据"))}}),j&&(0,f.jsx)(o.rA,{icon:"cancel",title:e("取消"),onClick:z})]}),children:[j&&(0,f.jsxs)(n.Fragment,{children:[(0,f.jsx)(r.BC,{label:e("挂载类型"),label_width:"6rem",children:(0,f.jsx)(r.l6,{value:S,options:d.map(e=>({title:e.name,value:e.type})),onChange:e=>{y(e),A("")}})}),(0,f.jsx)(r.BC,{label:e("凭据"),label_width:"6rem",required:!0,children:(0,f.jsx)(r.l6,{value:b,options:(e=>{if("baidu"===e)return x.map(e=>({title:e.name||e.baidu_name||String(e.uk),value:String(e.uk)}));const t=G.UW[e];return i.filter(e=>!t||e.type===t).map(e=>({title:e.name,value:e.id}))})(S),onChange:A})}),(0,f.jsx)(r.BC,{label:e("本地目录"),label_width:"6rem",required:!0,children:(0,f.jsx)(r.Sm,{placeholder:e("被挂载的本地绝对路径"),value:C,handleInputChange:k})}),(0,f.jsx)(r.BC,{label:e("strtdrt"),label_width:"6rem",children:(0,f.jsx)(r.Sm,{placeholder:e("远端目录"),value:I,handleInputChange:V})}),(0,f.jsx)(r.BC,{label:e("dspnmtp"),label_width:"6rem",children:(0,f.jsx)(r.Sm,{placeholder:e("列表显示的名称"),value:N,handleInputChange:K})})]}),!j&&(0,f.jsx)(h.X,{headers:[e("名称"),e("挂载类型"),e("凭据"),e("操作")],rows:t.map(t=>{const s=i.find(e=>e.id===t.credential_id),n="baidu"===t.driver?x.find(e=>String(e.uk)===String(t.credential_id)):void 0;return[(0,f.jsx)("p",{children:t.name}),(0,f.jsx)("p",{children:(a=t.driver,d.find(e=>e.type===a)?.name??a)}),(0,f.jsx)("p",{children:n?n.name||n.baidu_name||String(n.uk):s?s.name:e("凭据已丢失")}),(0,f.jsxs)("div",{children:[(0,f.jsx)(o.rA,{icon:"edit",title:e("编辑"),onClick:()=>(e=>{v(!0),w(e.id),y(e.driver),k(e.mount_path??""),A(e.credential_id??""),V(e.root_dir??""),K(e.name??"")})(t)}),(0,f.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(async t=>{try{await c.I2.post("delete",{id:t.id}),(0,_.SK)(e("已删除")),await X()}catch(e){}})(t)})]})];var a})})]})}function W({on_credential_change:e}){const{t}=(0,u.B)(),[,s]=(0,w.fp)(p.AG.prompt_card),[i,a]=(0,n.useState)(null),[d,x]=(0,n.useState)([]),[m,j]=(0,n.useState)("百度网盘"),[v,g]=(0,n.useState)(""),[S,y]=(0,n.useState)(""),[C,k]=(0,n.useState)(""),[b,A]=(0,n.useState)("oob"),[I,V]=(0,n.useState)(!0),[N,K]=(0,n.useState)(!0),X="oob"===b,[z,F]=(0,n.useState)(!1),[O,P]=(0,n.useState)(!1),[$,B]=(0,n.useState)(""),D=async()=>{try{const e=await c.I2.post("baidu/app/get",{}),t=e?.data?.app??null;a(t),x(e?.data?.accounts??[]),j(t?.name??"百度网盘"),g(t?.app_id??""),y(t?.app_key??""),A("one_click"===t?.auth_mode?"one_click":"oob"),V(!1!==t?.enabled),K(!1!==t?.auto_refresh)}catch(e){}};(0,n.useEffect)(()=>{D();const s=new URLSearchParams(window.location.search),n=s.get("baidu_auth");"success"===n?((0,_.SK)(`${t("授权成功")}:${s.get("name")??""}`),e()):"failed"===n&&(0,_.zN)(`${t("授权失败")}:${s.get("reason")??""}`),n&&window.history.replaceState({},"",window.location.pathname)},[]);return(0,f.jsxs)(l.Zp,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:t("百度网盘")}),(0,f.jsx)(o.rA,{icon:"info",title:t("信息"),onClick:()=>{s({open:!0,title:t("信息"),context_div:(0,f.jsxs)("ul",{children:[(0,f.jsx)("li",{children:t("atathtp")}),(0,f.jsx)("li",{children:t("atathnt")}),(0,f.jsx)("li",{children:t("pstatht")})]})})}})]}),rightBottomCom:(0,f.jsxs)("div",{children:[!z&&(0,f.jsx)(o.rA,{icon:"apps",title:t("应用配置"),onClick:()=>F(!0)}),z&&(0,f.jsx)(o.rA,{icon:"save",title:t("保存应用配置"),onClick:async()=>{if(S.trim())if(i?.configured||C.trim())try{await c.I2.post("baidu/app/save",{name:m,app_id:v,app_key:S,secret_key:C,auth_mode:b,remark:i?.remark??"",enabled:I,auto_refresh:N}),(0,_.SK)(t("保存成功")),k(""),F(!1),await D()}catch(e){}else(0,_.zN)(t("rq_scrt"));else(0,_.zN)(t("rqappky"))}}),z&&(0,f.jsx)(o.rA,{icon:"cancel",title:t("取消"),onClick:()=>F(!1)}),!z&&(0,f.jsx)(o.rA,{icon:"key",title:t("授权"),onClick:()=>P(!0)}),(0,f.jsx)(o.rA,{icon:"refresh",title:t("授权检测/刷新"),onClick:async()=>{try{await c.I2.post("baidu/verify/all",{}),(0,_.SK)(t("检测完成")),await D()}catch(e){}}})]}),children:[z&&(0,f.jsxs)(n.Fragment,{children:[(0,f.jsx)(r.Sm,{placeholder:t("名称"),value:m,handleInputChange:j}),(0,f.jsx)(r.Sm,{placeholder:"AppID",value:v,handleInputChange:g}),(0,f.jsx)(r.Sm,{placeholder:"AppKey",value:S,handleInputChange:y}),(0,f.jsx)(r.Sm,{type:"password",placeholder:i?.configured?t("scrtkep"):"SecretKey",value:C,handleInputChange:k}),(0,f.jsx)(r.BC,{label:t("授权方式"),label_width:"6rem",children:(0,f.jsx)(r.l6,{value:b,options:(0,G.K1)(t),onChange:e=>A("one_click"===e?"one_click":"oob")})}),(0,f.jsx)(r.BC,{label:t("网盘使用"),label_width:"6rem",children:(0,f.jsx)(r.l6,{value:I,options:(0,G.Dd)(t),onChange:V})}),(0,f.jsx)(r.BC,{label:t("atrfrsh"),label_width:"6rem",children:(0,f.jsx)(r.l6,{value:N,options:(0,G.Dd)(t),onChange:K})})]}),O&&(0,f.jsxs)(n.Fragment,{children:[(0,f.jsx)(r.BC,{label:t("授权方式"),label_width:"6rem",children:(0,f.jsxs)("div",{className:"div-row",children:[(0,f.jsx)(r.U6,{value:"one_click",context:t("一键授权"),name:"baidu_auth_mode",selected:"one_click"===b,onchange:()=>A("one_click")}),(0,f.jsx)(r.U6,{value:"oob",context:t("outh_ob"),name:"baidu_auth_mode",selected:"oob"===b,onchange:()=>A("oob")})]})}),X&&(0,f.jsx)(r.Sm,{placeholder:t("pst_cd"),value:$,handleInputChange:B}),(0,f.jsxs)("div",{className:"div-row mount-actions",children:[(0,f.jsx)(o.C3,{text:t(X?"去授权(手动)":"去授权(一键)"),clickFun:async()=>{if(i?.configured)try{const e=await c.I2.post("baidu/authorize_url",{mode:b});e?.data&&window.open(e.data,"_blank","noopener,noreferrer")}catch(e){}else(0,_.zN)(t("svappfr"))}}),X&&(0,f.jsx)(o.C3,{text:t("完成授权"),clickFun:async()=>{if($.trim())try{const s=await c.I2.post("baidu/exchange",{code:$.trim(),mode:b});(0,_.SK)(`${t("授权成功")}:${s?.data?.baidu_name??""}`),B(""),P(!1),await D(),e()}catch(e){}else(0,_.zN)(t("请填写授权码"))}}),(0,f.jsx)(o.C3,{text:t("取消"),clickFun:()=>P(!1)})]})]}),!z&&!O&&(0,f.jsx)(h.X,{headers:[t("账号名"),t("百度账号"),t("授权状态"),t("使用"),t("授权时间"),t("操作")],rows:d.map(s=>{return[(0,f.jsx)(r.Sm,{value:s.name,no_border:!0,handleInputChange:t=>(async(t,s)=>{try{await c.I2.post("baidu/account/update",{uk:t.uk,name:s}),e()}catch(e){}})(s,t)}),(0,f.jsx)(l.xP,{context:s.baidu_name||"-"}),(0,f.jsx)(l.xP,{context:(n=s,n.authorized?n.expired?t("已过期"):t("已授权"):t("未授权"))}),(0,f.jsx)(r.l6,{value:s.enabled,no_border:!0,options:(0,G.Dd)(t),onChange:()=>(async t=>{try{await c.I2.post("baidu/account/update",{uk:t.uk,enabled:!t.enabled}),await D(),e()}catch(e){}})(s)}),(0,f.jsx)("p",{children:(0,G.eK)(s.created_at)}),(0,f.jsxs)("div",{children:[(0,f.jsx)(o.rA,{icon:"network_check",title:t("授权检测"),onClick:()=>(async e=>{try{const s=await c.I2.post("baidu/verify",{uk:e.uk});s?.data?.valid?(0,_.SK)(t("账号可用")):(0,_.zN)(`${t("账号不可用")}:${s?.data?.error??""}`),await D()}catch(e){}})(s)}),(0,f.jsx)(o.rA,{icon:"link_off",title:t("取消授权"),onClick:()=>(async e=>{try{await c.I2.post("baidu/deauthorize",{uk:e.uk}),(0,_.SK)(t("已取消授权")),await D()}catch(e){}})(s)}),(0,f.jsx)(o.rA,{icon:"delete",title:t("删除"),onClick:()=>(async s=>{try{await c.I2.post("baidu/delete",{uk:s.uk}),(0,_.SK)(t("已删除")),await D(),e()}catch(e){}})(s)})]})];var n})})]})}function Z(){const{t:e}=(0,u.B)(),{check_user_auth:t}=(0,S.MH)(),s=t(a.oV.file_mount),[r,d]=(0,w.fp)(p.AG.mount_enabled);(0,n.useEffect)(()=>{s&&(async()=>{try{const e=await c.I2.post("enabled/get",{});d(!0===e?.data)}catch(e){d(!1)}})()},[s]);return s?(0,f.jsxs)(n.Fragment,{children:[(0,f.jsxs)(b.aZ,{position:"right",children:[(0,f.jsx)("span",{className:"header-label",children:e("总开关")}),(0,f.jsx)(o.rA,{icon:!0===r?"cloud_done":"cloud_off",title:e(!0===r?"muntont":"muntoff"),selected:!0===r,onClick:async()=>{const t=!r;try{const s=await c.I2.post("enabled/set",{enabled:t}),n=!0===s?.data;d(n),(0,_.SK)(e(n?"挂载已启用":"挂载已停用"))}catch(e){}}})]}),(0,f.jsxs)(i.xh,{children:[(0,f.jsxs)(i.fI,{children:[(0,f.jsx)(i.VP,{widthPer:33,maxWidth:"30rem",children:(0,f.jsx)(E,{})}),(0,f.jsx)(i.VP,{widthPer:60,maxWidth:"60rem",children:(0,f.jsx)(W,{on_credential_change:()=>window.location.reload()})})]}),(0,f.jsx)(i.fI,{children:(0,f.jsx)(i.VP,{widthPer:50,maxWidth:"60rem",children:(0,f.jsx)(q,{})})})]})]}):(0,f.jsx)(i.fI,{children:(0,f.jsx)(i.VP,{children:(0,f.jsx)(l.Zp,{self_title:(0,f.jsx)("h2",{children:e("网盘挂载")}),children:(0,f.jsx)("p",{children:e("nmuntpr")})})})})}var R=s(87361);function U(){const{t:e}=(0,u.B)(),{check_user_auth:t}=(0,S.MH)(),s=[{index:1,name:`${e("个人环境")}`,rto:"private_env_setting",component:(0,f.jsx)(D,{})}];return t(a.oV.sys_setting_page)&&s.unshift({index:1,name:e("系统"),rto:"password",component:(0,f.jsx)(X,{})}),t(a.oV.sys_env_page)&&s.push({index:1,name:`${e("系统环境")}`,rto:"env_setting/",component:(0,f.jsx)(F,{})}),t(a.oV.auth_router_page)&&s.push({index:1,name:e("自定义路由"),rto:"customer_router/",component:(0,f.jsx)(A,{})}),t(a.oV.user_manage)&&s.push({index:1,name:e("用户管理"),rto:"user_manager/",component:(0,f.jsx)($,{})}),t(a.oV.role_manage)&&s.push({index:1,name:e("角色管理"),rto:"role_manager/",component:(0,f.jsx)(B,{})}),t(a.oV.file_mount)&&s.push({index:1,name:e("网盘挂载"),rto:"mount_setting/",component:(0,f.jsx)(Z,{})}),(0,f.jsx)(i.W1,{optionList:s,father_route:R.o.setting})}},92350(e,t,s){s.d(t,{Q:()=>h,o:()=>p});var n=s(34843),i=s(82893),a=s(74777),l=s(96540),o=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:l}=(0,o.B)();return e=>{let n;e===a.jk.ffmpeg?n=(0,d.jsx)("div",{children:"视频转换,rtsp播放器等媒体功能都需要这个软件。linux下你可以使用apt或者yum来安装,或者直接输入软件的位置"}):e===a.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,l.useState)([]);return(0,l.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:()=>l});var n=s(72635);const i=1440,a=525600;function l(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<a?`${(s/43200).toFixed(0)} ${n.Ay.t("月前")}`:`${(s/a).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([[8603],{58603(e,t,i){i.r(t),i.d(t,{default:()=>N});var n=i(96540),s=i(75725),r=i(70447),a=i(34843),o=i(82893),l=i(60096),c=i(85997),d=i(34251),m=i(34289),h=i(87361),_=i(14284),u=i(53459),x=i(61443),f=i(86149),p=i(62042),j=(i(47022),i(4412)),k=i(99214),g=i(6960),w=i(88815),v=i(40505),z=i(23430),F=i(64694),b=i(86090),C=i(74848);function N(){const[e,t]=(0,n.useState)(null),i=(0,n.useRef)(""),N=(0,n.useRef)(""),[y,$]=(0,a.fp)(o.AG.prompt_card),[S,M]=(0,a.fp)(o.AG.share_sort_type),{t:A}=(0,f.B)(),[G,I]=(0,a.fp)(o.AG.selectedFileList),[U,V]=(0,a.fp)(o.AG.clickFileList),{click_file:W}=(0,k.kZ)(),[D]=(0,b.ok)(),L=(0,k.oT)(),R=(0,k.xp)(),Z=(0,k.Vs)(!0),B=(0,n.useMemo)(()=>{const t=[...e?.items??[]],i=e=>Number(e.mtime??0);return S===z.t8.time_minx_max?t.sort((e,t)=>i(e)-i(t)):S===z.t8.time_max_min&&t.sort((e,t)=>i(t)-i(e)),t},[e?.items,S]),H=async()=>{const e=await _.$M.post("share",{id:i.current,token:N.current});if(e.code===u.m.Success){const n={is_dir:e.data.is_dir};n.items=e.data.files??[];for(const e of n.items)e.origin_size=e.size,e.show_mtime=e.mtime?(0,g.s)(e.mtime):"",e.size=(0,w.v7)(e.size);if(!n.is_dir){const t=e.data.files[0];n.name=t.name,n.size=t.size,n.show_mtime=t.show_mtime}localStorage.setItem(`file_share_token_${i.current}`,N.current);const s=D.get("share_preview_file_name");if(s)try{const t=e.data.files.find(e=>e.name===s);W({file_path:t.path,file_url:_.$M.getDownloadUrlV2(t.path,"share_download",{share_id:i.current,share_token:N.current}),name:t.name,size:t.origin_size,opt_shell:!0,mtime:t.mtime,not_type_tip:A("未知类型,请下载查看"),readonly:!0,close:()=>{L("share_preview_file_name",null)}})}catch(e){(0,p.zN)(e?.message||e)}else t(n)}else e.code===u.m.need_token_share&&(localStorage.removeItem(`file_share_token_${i.current}`),(0,p.zN)("需要正确的访问token"),$({open:!0,title:"share file",confirm:()=>{$({open:!1}),H()},context_div:(0,C.jsx)("div",{className:"card-content",children:(0,C.jsx)(x.Sm,{placeholderOut:A("请输入访问token"),value:"",handleInputChange:e=>{N.current=e}})})}))};if((0,n.useEffect)(()=>{const e=(0,m.oW)(`${(0,m.GG)(h.o.share,(0,m.vX)())}`);i.current=e,N.current=localStorage.getItem(`file_share_token_${e}`),H()},[D]),!e)return(0,C.jsx)(s.jW,{isFull:!0,children:(0,C.jsx)("div",{className:"common-box common-box-center",children:"Loading..."})});return(0,C.jsxs)(n.Fragment,{children:[(0,C.jsx)(j.aZ,{children:(0,C.jsx)(C.Fragment,{children:(0,C.jsxs)("h2",{children:["Share ",e.is_dir?"Folder":"File"]})})}),(0,C.jsxs)(j.aZ,{position:"right",children:[G.length>0&&(0,C.jsx)(c.rA,{icon:"download",title:A("下载"),onClick:function(){const e=[];for(let t=0;t<G.length;t++){const i=B[G[t]];e.push(encodeURIComponent(i.path))}const t=_.$M.getDownloadUrlV2(e,"share_download",{share_id:i.current,share_token:N.current});window.open(t)}}),e.is_dir&&(0,C.jsx)(c.rA,{icon:"grid_view",title:A("切换样式"),onClick:Z}),e.is_dir&&(0,C.jsx)(c.rA,{icon:"schedule",title:S===z.t8.time_minx_max?A("时间逆序"):A("时间顺序"),onClick:()=>{const e=(0,F.jH)([z.t8.time_max_min,z.t8.time_minx_max,z.t8.defualt],S);M(e),I([]),V([])}})]}),(0,C.jsx)(s.xh,{children:(0,C.jsx)(s.jW,{isFull:!0,children:(0,C.jsx)("div",{className:"common-box ",children:e.is_dir?(0,C.jsx)(l.QW,{share:{share_id:i.current,share_token:N.current},handleContextMenu:()=>{},file_list:B,clickBlank:e=>{e.target===e.currentTarget&&(I([]),V([]))}}):(0,C.jsx)(r.uF,{children:(0,C.jsxs)("div",{style:{height:"25rem"},className:"common-box common-box-center",children:[(0,C.jsx)("div",{className:"file-icons",children:(0,C.jsx)("div",{"data-type":(0,d.uL)(e.name),"data-dir":e.is_dir,"aria-label":e.name,children:(0,C.jsx)(c.In,{icon:"",style:{fontSize:"10rem",display:"inline-block",lineHeight:1},aria_label:e.name})})}),(0,C.jsx)("div",{className:"",children:e.name}),(0,C.jsx)("div",{className:"",children:e.size}),(0,C.jsx)("div",{className:"",children:e.show_mtime}),(0,C.jsx)(c.C3,{text:"download",clickFun:()=>{const e=B[0],t=_.$M.getDownloadUrlV2(e.path,"share_download",{share_id:i.current,share_token:N.current});window.open(t)}}),(0,C.jsx)(c.C3,{text:"copy url",clickFun:()=>{const e=B[0],t=_.$M.getDownloadUrlV2(e.path,"share_download",{share_id:i.current,share_token:N.current}),n=_.$M.get_full_url(t);(0,v.lW)(n),(0,p.SK)(n)}}),(0,C.jsx)(c.C3,{text:"preview",clickFun:()=>{const e=B[0];R(e.name)}})]})})})})})]})}}}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[9877],{69918(t,e,n){n.d(e,{Ce:()=>l,FG:()=>r.FG,fy:()=>c,gC:()=>a});var r=n(18840),o=n(14284),s=n(53459);async function a(){try{const t=await o.XO.get("md_editor_setting/get");return{...r.FG,...t?.data??{}}}catch(t){return{...r.FG}}}async function c(t){const e=await o.XO.post("md_editor_setting/save",t);return e?.code!==s.m.Success?null:{...r.FG,...e.data??t}}function l(t,e){t&&(t.style.setProperty("--md-editor-max-width",e.content_max_width),t.style.setProperty("--md-editor-padding",e.content_padding),t.style.setProperty("--md-editor-font-size",e.font_size),t.style.setProperty("--md-editor-line-height",e.line_height))}},64877(t,e,n){n.d(e,{A:()=>a});var r=n(96540),o=n(86149),s=n(74848);function a(t){const{t:e}=(0,o.B)(),[n,a]=(0,r.useState)(new Set),c=(0,r.useMemo)(()=>function(t){const e=[],n=[];for(const r of t){const t={...r,children:[]};for(;n.length>0&&n[n.length-1].level>=t.level;)n.pop();0===n.length?e.push(t):n[n.length-1].children.push(t),n.push(t)}return e}(t.items),[t.items]),l=(r,o)=>r.map(r=>{const c=r.children.length>0,i=n.has(r.pos),d=r.pos===t.active_pos;return(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:`md-outline-item md-outline-item--h${r.level}${d?" md-outline-item--active":""}`,style:{paddingLeft:.4+.75*o+"em"},title:r.text,onClick:()=>t.on_click(r),children:[(0,s.jsx)("i",{className:"material-icons md-outline-arrow"+(c?"":" md-outline-arrow--empty"),onClick:c?t=>{return e=r.pos,t.stopPropagation(),void a(t=>{const n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n});var e}:void 0,children:c?i?"arrow_right":"arrow_drop_down":""}),(0,s.jsx)("span",{className:"md-outline-text",children:r.text||e("未命名标题")})]}),c&&!i&&l(r.children,o+1)]},r.pos)});return 0===t.items.length?(0,s.jsx)("div",{className:"md-outline md-outline--empty",children:(0,s.jsx)("div",{className:"md-outline-tip",children:e("no_head")})}):(0,s.jsx)("div",{className:"md-outline",children:(0,s.jsx)("div",{className:"md-outline-list",children:l(c,0)})})}},86504(t,e,n){n.d(e,{A:()=>T});var r=n(96540),o=n(42845),s=n(1575),a=n(89781),c=n(61396),l=n(46762),i=n(73337),d=n(89552),u=n(86059),h=n(5091),p=n(22091),m=n(58903);const f=new p.A({html:!0,linkify:!0,breaks:!1,typographer:!1});function g(t){const e=f.render(t??""),n=document.createElement("div");return n.innerHTML=e,m.S4.fromSchema(h.Y).parse(n)}function _(t){let e="";return t.forEach(t=>{if(t.isText){let n=t.marks.some(t=>"code"===t.type.name)?t.text??"":function(t){return t.replace(/([\\`*_[\]<>])/g,"\\$1")}(t.text??"");for(const e of t.marks)switch(e.type.name){case"code":n=`\`${t.text??""}\``;break;case"strong":n=`**${n}**`;break;case"em":n=`*${n}*`;break;case"strike":n=`~~${n}~~`;break;case"link":n=`[${n}](${e.attrs.href}${e.attrs.title?` "${e.attrs.title}"`:""})`}e+=n}else if("image"===t.type.name){const{src:n,alt:r,title:o}=t.attrs;e+=``}else"hard_break"===t.type.name&&(e+=" \n")}),e}function y(t){const e=[];if(t.forEach(t=>{const n=[],r=[];t.forEach(t=>{var e;n.push((e=t.textContent,e.replace(/\|/g,"\\|").replace(/\n/g," ")).trim()),r.push("table_header"===t.type.name)}),e.push({cells:n,header_flags:r})}),0===e.length)return"";const n=Math.max(...e.map(t=>t.cells.length)),r=e[0].header_flags.some(t=>t),o=Array.from({length:n},(t,n)=>Math.max(3,...e.map(t=>k(t.cells[n]??"")))),s=t=>`| ${Array.from({length:n},(e,n)=>{return r=t[n]??"",s=o[n],r+" ".repeat(Math.max(0,s-k(r)));var r,s}).join(" | ")} |`,a=[];if(r){a.push(s(e[0].cells)),a.push(`| ${o.map(t=>"-".repeat(t)).join(" | ")} |`);for(let t=1;t<e.length;t++)a.push(s(e[t].cells))}else{a.push(s(new Array(n).fill(""))),a.push(`| ${o.map(t=>"-".repeat(t)).join(" | ")} |`);for(const t of e)a.push(s(t.cells))}return a.join("\n")}function k(t){let e=0;for(const n of t){const t=n.codePointAt(0)??0;e+=t>=4352&&t<=4447||t>=11904&&t<=42191||t>=44032&&t<=55203||t>=63744&&t<=64255||t>=65072&&t<=65135||t>=65280&&t<=65376||t>=65504&&t<=65510?2:1}return e}function b(t,e=""){switch(t.type.name){case"paragraph":default:return e+_(t);case"heading":return`${e}${"#".repeat(t.attrs.level)} ${_(t)}`;case"blockquote":return w(t,"").split("\n").map(t=>`${e}> ${t}`).join("\n");case"code_block":{const n=t.attrs.language??"";return`${e}\`\`\`${n}\n${t.textContent}\n${e}\`\`\``}case"horizontal_rule":return`${e}---`;case"bullet_list":{const n=[];return t.forEach((t,r,o)=>{n.push(v(t,e,`${e}- `,`${e} `,o))}),n.join("\n")}case"ordered_list":{const n=[],r=t.attrs.order??1;return t.forEach((t,o,s)=>{n.push(v(t,e,`${e}${r+s}. `,`${e} `,s))}),n.join("\n")}case"table":return y(t).split("\n").map(t=>e+t).join("\n")}}function v(t,e,n,r,o){const s=t.attrs.checked,a=null===s?"":s?"[x] ":"[ ] ",c=[];t.forEach((t,e,n)=>{c.push(b(t,0===n?"":r))});const l=c.join("\n").split("\n");return n+a+l[0]+(l.length>1?"\n"+l.slice(1).join("\n"):"")}function w(t,e=""){const n=[];return t.forEach(t=>{n.push(b(t,e))}),n.join("\n\n")}function $(t){return w(t).trim()+"\n"}n(64877);var M=n(19878);const x=new o.hs("md_source_highlight");let O=!1;function S(t){O=t}function D(t,e,n){let r=e;for(const e of t){if("string"==typeof e){r+=e.length;continue}const t=r;Array.isArray(e.children)&&(r=D(e.children,r,n)),e.scope&&n.push({from:t,to:r,cls:`hljs-${e.scope}`})}return r}function A(t,e){const n=t.textContent;if(!n)return[];let r;try{r=M.A.highlight(n,{language:"markdown",ignoreIllegals:!0})}catch{return[]}const o=[],a=r._emitter?.rootNode;a?.children&&D(a.children,0,o);const c=e+1,l=[];for(const t of o){const e=Math.min(t.from,n.length),r=Math.min(t.to,n.length);e>=r||l.push(s.NZ.inline(c+e,c+r,{class:t.cls}))}return l}function C(t){const e=[];return t.descendants((t,n)=>"code_block"!==t.type.name||(e.push(...A(t,n)),!1)),s.zF.create(t,e)}var N=n(67951),j=(n(41631),n(50576),n(70432),n(74848));function z(t){return 0===t?(0,N.uf)("paragraph"):(0,N.uf)("heading",{level:t})}function E(t){return!(!t.ctrlKey&&!t.metaKey)}function F(t,e){return(0,u.D8)(1)(t,e)}const G=r.forwardRef(function(t,e){const n=(0,r.useRef)(null),p=(0,r.useRef)(null),m=(0,r.useRef)(t.on_change),f=(0,r.useRef)(t.on_save),_=(0,r.useRef)(t.on_selection_change),y=(0,r.useRef)(t.on_source_mode_change);return(0,r.useEffect)(()=>{m.current=t.on_change,f.current=t.on_save,_.current=t.on_selection_change,y.current=t.on_source_mode_change}),(0,r.useEffect)(()=>{if(!n.current)return;h.Y;const r=o.$t.create({doc:g(t.value??""),plugins:[(0,a.b6)(),new o.k_({key:x,state:{init:(t,e)=>s.zF.empty,apply:(t,e,n,r)=>O?t.docChanged?C(r.doc):x.getState(r)??s.zF.empty:s.zF.empty},props:{decorations(t){if(!O)return null;const e=x.getState(t);return e&&e.find().length?e:C(t.doc)}}}),(0,N.k5)(),(0,c.w)({"Mod-z":a.tN,"Mod-y":a.ZS,"Mod-Shift-z":a.ZS,"Mod-b":(0,N.NH)("strong"),"Mod-i":(0,N.NH)("em"),"Mod-Shift-x":(0,N.NH)("strike"),"Mod-`":(0,N.NH)("code"),"Mod-1":(t,e)=>z(1)(t,e),"Mod-2":(t,e)=>z(2)(t,e),"Mod-3":(t,e)=>z(3)(t,e),"Mod-0":(t,e)=>z(0)(t,e),"Mod-Shift-8":N.fK,"Mod-Shift-9":N.oB,"Mod-Shift-.":N.Vu,Tab:N.G8.sink,"Shift-Tab":N.G8.lift,"Mod-Enter":F,"Mod-s":()=>(f.current?.(),!0)}),(0,u.LF)({allowTableNodeSelection:!0}),(0,u.AL)(),(0,i.A)({color:"var(--primary, #1a73e8)",width:2}),(0,d.z)(),(0,c.w)({Enter:(0,l.st)(N.x0,l.pC,N.G8.split,l.Z1,l.iz,l.aw),"Shift-Enter":(t,e)=>{const{hard_break:n}=t.schema.nodes;return e&&e(t.tr.replaceSelectionWith(n.create()).scrollIntoView()),!0},"Mod-Enter":l.I$}),(0,c.w)(l.RV)]}),k=new s.Lz(n.current,{state:r,editable:()=>!1!==t.editable,handleClickOn(t,e,n,r,o){if(!E(o))return!1;const s=function(t){if(!(t instanceof Element))return null;const e=t.closest("a[href]"),n=e?.getAttribute("href");return n||null}(o.target)??function(t,e){const n=t.doc.content.size,r=Math.max(0,Math.min(e,n));let o;try{o=t.doc.resolve(r)}catch{return null}for(const e of[1,-1]){const o=1===e?r:r-1;if(!(o<0||o>=n))try{const e=t.doc.resolve(o).marks().find(t=>"link"===t.type.name);if(e?.attrs?.href)return e.attrs.href}catch{}}try{const t=o.parent.marks.find(t=>"link"===t.type.name);if(t?.attrs?.href)return t.attrs.href}catch{}return null}(t.state,e);return!!s&&(window.open(s,"_blank","noopener,noreferrer"),!0)},handleDOMEvents:{keydown:(t,e)=>{if(E(e)&&t.dom.classList.add("md-ctrl-down"),I(t.state.doc)&&"Enter"===e.key&&!e.ctrlKey&&!e.metaKey&&!e.altKey){e.preventDefault();const{from:n,to:r}=t.state.selection;return t.dispatch(t.state.tr.insertText("\n",n,r).scrollIntoView()),!0}return!1},keyup:(t,e)=>(E(e)||t.dom.classList.remove("md-ctrl-down"),!1),blur:t=>(t.dom.classList.remove("md-ctrl-down"),!1),beforeinput:(t,e)=>{if(!I(t.state.doc))return!1;const n=e;if("insertText"!==n.inputType)return!1;const r=n.data;if(null==r)return!1;n.preventDefault();const{from:o,to:s}=t.state.selection;return t.dispatch(t.state.tr.insertText(r.replace(/\r\n?/g,"\n"),o,s).scrollIntoView()),!0}},dispatchTransaction(t){const e=k.state.apply(t);k.updateState(e);const n=I(e.doc);S(n),n?k.dom.classList.add("md-source-mode"):k.dom.classList.remove("md-source-mode"),n!==I(t.before)&&y.current?.(n),t.docChanged&&m.current?.(n?e.doc.textContent:$(e.doc)),(t.selectionSet||t.docChanged)&&_.current?.()},attributes:{class:"md-filecat-content",spellcheck:"false"}});if(p.current=k,t.initial_source_mode&&!I(k.state.doc)){const t=$(k.state.doc),e=k.state.schema.nodes.code_block.create({language:"markdown"},t?k.state.schema.text(t):null),n=k.state.tr;n.replaceWith(0,k.state.doc.content.size,e),n.setMeta("addToHistory",!1),k.dispatch(n)}const b={get_markdown:()=>I(k.state.doc)?k.state.doc.textContent:$(k.state.doc),set_markdown:t=>{const e=g(t);k.dispatch(k.state.tr.replaceWith(0,k.state.doc.content.size,e.content))},focus:()=>k.focus(),get_view:()=>p.current,in_table:()=>function(t){const{$from:e}=t.selection;for(let t=e.depth;t>0;t--){if("table"===e.node(t).type.name)return!0}return!1}(k.state),active_marks:()=>(k.state.storedMarks??k.state.selection.$from.marks()).map(t=>t.type.name),active_block:()=>{const{$from:t}=k.state.selection;for(let e=t.depth;e>0;e--){const n=t.node(e);if("heading"===n.type.name)return{name:"heading",level:n.attrs.level};if("paragraph"===n.type.name)return{name:"paragraph"}}return{name:"paragraph"}},insert_table:(t=3,e=3)=>{const n=function(t,e,n){const r=(0,u.e)(t),o=r.table,s=r.row,a=r.cell,c=r.header_cell??r.cell;if(!o||!s||!a)return null;const l=t=>s.create(null,Array.from({length:e},()=>t.createAndFill())),i=l(c),d=Array.from({length:n},()=>l(a));return o.create(null,[i,...d])}(k.state.schema,t,e);if(!n)return;const{from:r}=k.state.selection,o=k.state.doc.resolve(r);let s=r;for(let t=o.depth;t>0;t--)if("table"===o.node(t).type.name){s=o.after(t);break}const a=k.state.tr;s===r?a.replaceSelectionWith(n):a.insert(s,n),k.dispatch(a.scrollIntoView());const c=k.state.doc.resolve(Math.min(s+3,k.state.doc.content.size));try{k.dispatch(k.state.tr.setSelection(k.state.selection.constructor.near(c)))}catch{}},get_headings:()=>function(t){const e=[];return t.doc.descendants((t,n)=>("heading"!==t.type.name||e.push({level:t.attrs.level,text:t.textContent,pos:n}),!0)),e}(k.state),scroll_to_pos:t=>{const e=k.state.doc.content.size,n=Math.max(0,Math.min(t,e)),r=k.state.doc.nodeAt(n);let s;try{s=r?o.U3.near(k.state.doc.resolve(n+1),1):o.U3.near(k.state.doc.resolve(n),1)}catch{s=o.U3.near(k.state.doc.resolve(0),1)}k.dispatch(k.state.tr.setSelection(s).scrollIntoView()),k.focus()},is_source_mode:()=>I(k.state.doc),enter_source_mode:()=>{if(I(k.state.doc))return;const t=$(k.state.doc),e=k.state.schema.nodes.code_block.create({language:"markdown"},t?k.state.schema.text(t):null),n=k.state.tr;n.replaceWith(0,k.state.doc.content.size,e),S(!0),k.dispatch(n),k.dom.classList.add("md-source-mode")},exit_source_mode:()=>{if(!I(k.state.doc))return;const t=g(k.state.doc.textContent),e=k.state.tr;e.replaceWith(0,k.state.doc.content.size,t.content),S(!1),k.dispatch(e),k.dom.classList.remove("md-source-mode")}};return"function"==typeof e?e(b):e&&(e.current=b),t.on_ready?.(b),()=>{k.destroy(),p.current=null}},[]),(0,j.jsx)("div",{className:"md-filecat",ref:n})});function I(t){if(1!==t.childCount)return!1;const e=t.firstChild;return!!e&&"code_block"===e.type.name&&"markdown"===e.attrs.language}const T=G},67951(t,e,n){n.d(e,{NH:()=>i,k5:()=>l,uf:()=>d});var r=n(38341),o=n(5091),s=n(46762),a=n(3772);function c(t,e){return new r.fV(t,(t,n,r,o)=>{const s=t.schema.marks[e],a=n[1];if(!s||!a)return null;const c=n[0].indexOf(a);if(c<0)return null;const l=r+c,i=l+a.length,d=t.tr;return d.delete(i,o),d.delete(r,l),d.addMark(r,r+a.length,s.create()),d.removeStoredMark(s),d})}function l(){const t=o.Y;return(0,r.sM)({rules:[(0,r.JJ)(/^(#{1,6})\s$/,t.nodes.heading,t=>({level:t[1].length})),(0,r.JJ)(/^#([1-6])\s$/,t.nodes.heading,t=>({level:Number(t[1])})),(0,r.JJ)(/^```([\w-]*)\s$/,t.nodes.code_block,t=>({language:t[1]??""})),(0,r.tG)(/^\s*>\s$/,t.nodes.blockquote),(0,r.tG)(/^\s*([-+*])\s$/,t.nodes.bullet_list),(0,r.tG)(/^(\d+)\.\s$/,t.nodes.ordered_list,t=>({order:Number(t[1])})),c(/(?:\*\*)([^*]+)(?:\*\*)$/,"strong"),c(/(?:__)([^_]+)(?:__)$/,"strong"),c(/(?<![*])\*([^*]+)\*$/,"em"),c(/(?<![_])_([^_]+)_$/,"em"),c(/(?:~~)([^~]+)(?:~~)$/,"strike"),c(/(?:`)([^`]+)(?:`)$/,"code"),...r.Fr,r.gO]})}function i(t){return(e,n)=>{const r=e.schema.marks[t];return!!r&&(0,s.wh)(r)(e,n)}}function d(t,e={}){return(n,r)=>{const o=n.schema.nodes[t];if(!o)return!1;const{$from:s,$to:a}=n.selection,c=s.blockRange(a);if(!c)return!1;const l=s.parent,i=l.type===o&&Object.entries(e).every(([t,e])=>l.attrs[t]===e),d=i?n.schema.nodes.paragraph:o,u=i?{}:e;return r&&r(n.tr.setBlockType(c.start,c.end,d,u)),!0}}const u=(t,e)=>(0,a.Sd)(t.schema.nodes.bullet_list)(t,e),h=(t,e)=>(0,a.Sd)(t.schema.nodes.ordered_list)(t,e),p={sink:(0,a.$B)(o.Y.nodes.list_item),lift:(0,a.T2)(o.Y.nodes.list_item),split:(0,a.wn)(o.Y.nodes.list_item),wrap_bullet:u,wrap_ordered:h};n.d(e,["G8",0,p,"Vu",0,(t,e)=>{const{blockquote:n}=t.schema.nodes,{$from:r,$to:o}=t.selection,s=r.blockRange(o);if(!s)return!1;if(s.parent.type===n&&s.depth>0){const n=r.before(s.depth),o=t.tr.doc.nodeAt(n);if(o&&1===o.childCount)return e&&e(t.tr.replaceWith(n,n+o.nodeSize,o.child(0)).scrollIntoView()),!0;if(e){const n=t.tr,o=r.parent,a=r.after(s.depth);n.delete(s.start,s.end),n.insert(a,o),e(n.scrollIntoView())}return!0}return e&&e(t.tr.wrap(s,[{type:n}]).scrollIntoView()),!0},"fK",0,u,"oB",0,h,"x0",0,(t,e)=>{const{$from:n,empty:r}=t.selection;if(!r||"paragraph"!==n.parent.type.name)return!1;const o=n.parent.textContent;if(!o.trim())return!1;const s=function(t){const e=t.trim(),n=/^#([1-6])$/.exec(e);if(n)return{type:"heading",attrs:{level:Number(n[1])}};const r=/^(#{1,6})$/.exec(e);if(r)return{type:"heading",attrs:{level:r[1].length}};const o=/^```([\w-]*)$/.exec(e);return o?{type:"code_block",attrs:{language:o[1]??""}}:/^(?:-{3,}|\*{3,}|_{3,})$/.test(e.replace(/\s+/g,""))?{type:"horizontal_rule"}:/^>\s*$/.test(e)?{type:"blockquote"}:/^[-+*]\s*$/.test(e)?{type:"bullet_list"}:/^\d+[.)]?$/.test(e)?{type:"ordered_list"}:null}(o);if(!s)return!1;if("blockquote"===s.type&&n.depth>1)return!1;const a=t.schema.nodes[s.type];if(!a)return!1;const c=n.before(n.depth),l=n.after(n.depth);if(e){const n=t.tr,r=a.createAndFill(s.attrs)??a.create(s.attrs);n.replaceWith(c,l,r),n.scrollIntoView(),e(n)}return!0}])},96763(t,e,n){n.d(e,{Kz:()=>a,P7:()=>i,_8:()=>h,_D:()=>u,bN:()=>s,sO:()=>d});var r=n(14284),o=n(53459);function s(t,e){const n="md-theme-style-"+t,r=document.getElementById(n);if(!e)return void r?.remove();let o=r;o||(o=document.createElement("style"),o.id=n,document.head.appendChild(o)),o.textContent=e}async function a(){try{const t=await r.XO.get("md_theme/list");return t?.code===o.m.Success?t.data??[]:[]}catch(t){return[]}}const c="md-theme-change";function l(){window.dispatchEvent(new Event(c))}async function i(t){try{const e=await r.XO.get(`md_theme/get?id=${encodeURIComponent(t)}`);return e?.code===o.m.Success?e.data??"":""}catch(t){return""}}async function d(){try{const t=await r.XO.get("md_theme/active");return t?.code===o.m.Success?t.data??"":""}catch(t){return""}}async function u(t){const e=await r.XO.post("md_theme/save",t);return e?.code!==o.m.Success?null:(l(),e.data)}async function h(t){const e=await r.XO.post("md_theme/del",{id:t});return e?.code===o.m.Success&&(l(),!0)}n.d(e,["o3",0,c])},5091(t,e,n){var r=n(58903);const o=(0,n(86059).of)({tableGroup:"block",cellContent:"block+",cellAttributes:{}}),s={align:{default:null}},a={doc:{content:"block+"},paragraph:{content:"inline*",group:"block",attrs:s,parseDOM:[{tag:"p"}],toDOM:t=>["p",t.attrs.align?{style:`text-align:${t.attrs.align}`}:{},0]},heading:{content:"inline*",group:"block",attrs:{level:{default:1},...s},defining:!0,parseDOM:[1,2,3,4,5,6].map(t=>({tag:`h${t}`,attrs:{level:t}})),toDOM(t){const e=t.attrs.align?{style:`text-align:${t.attrs.align}`}:{};return[`h${t.attrs.level}`,e,0]}},bullet_list:{group:"block",content:"list_item+",parseDOM:[{tag:"ul"}],toDOM:()=>["ul",0]},ordered_list:{group:"block",content:"list_item+",attrs:{order:{default:1}},parseDOM:[{tag:"ol",getAttrs:t=>({order:Number(t.getAttribute("start")??1)})}],toDOM:t=>1===t.attrs.order?["ol",0]:["ol",{start:t.attrs.order},0]},list_item:{content:"paragraph block*",defining:!0,attrs:{checked:{default:null}},parseDOM:[{tag:"li",getAttrs:t=>{const e=t,n=e.querySelector("input[type=checkbox]");if(n)return{checked:n.checked};const r=e.getAttribute("data-checked");return{checked:null===r?null:"true"===r}}}],toDOM:t=>null!==t.attrs.checked?["li",{"data-checked":String(t.attrs.checked)},0]:["li",0]},blockquote:{content:"block+",group:"block",defining:!0,parseDOM:[{tag:"blockquote"}],toDOM:()=>["blockquote",0]},code_block:{content:"text*",group:"block",marks:"",defining:!0,attrs:{language:{default:""}},parseDOM:[{tag:"pre",preserveWhitespace:"full",getAttrs:t=>{const e=t.querySelector("code"),n=/language-([\w-]+)/.exec(e?.className??"");return{language:n?n[1]:""}}}],toDOM:t=>["pre",{"data-language":t.attrs.language},["code",0]]},horizontal_rule:{group:"block",parseDOM:[{tag:"hr"}],toDOM:()=>["hr"]},hard_break:{inline:!0,group:"inline",selectable:!1,parseDOM:[{tag:"br"}],toDOM:()=>["br"]},image:{inline:!0,group:"inline",draggable:!0,attrs:{src:{},alt:{default:null},title:{default:null}},parseDOM:[{tag:"img[src]",getAttrs:t=>{const e=t;return{src:e.getAttribute("src"),alt:e.getAttribute("alt"),title:e.getAttribute("title")}}}],toDOM(t){const{src:e,alt:n,title:r}=t.attrs,o={src:e};return n&&(o.alt=n),r&&(o.title=r),["img",o]}},text:{group:"inline"},...o},c={strong:{parseDOM:[{tag:"strong"},{tag:"b"},{style:"font-weight=bold"}],toDOM:()=>["strong",0]},em:{parseDOM:[{tag:"i"},{tag:"em"},{style:"font-style=italic"}],toDOM:()=>["em",0]},strike:{parseDOM:[{tag:"s"},{tag:"del"},{tag:"strike"}],toDOM:()=>["s",0]},code:{parseDOM:[{tag:"code",getAttrs:t=>"PRE"!==t.parentElement?.tagName&&null}],toDOM:()=>["code",0]},link:{attrs:{href:{},title:{default:null}},inclusive:!1,parseDOM:[{tag:"a[href]",getAttrs:t=>{const e=t;return{href:e.getAttribute("href"),title:e.getAttribute("title")}}}],toDOM(t){const{href:e,title:n}=t.attrs;return["a",{href:e,title:n,rel:"noopener noreferrer",target:"_blank"},0]}}},l=new r.Sj({nodes:a,marks:c});n.d(e,["Y",0,l])}}]);
|
package/build/dist/index.html
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
<!doctype html><html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>{{{web_site_title}}}</title><link rel="icon" href="{{{logo_favicon}}}"/><script defer="defer" src="main.
|
|
1
|
+
<!doctype html><html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>{{{web_site_title}}}</title><link rel="icon" href="{{{logo_favicon}}}"/><script defer="defer" src="main.01456be775c50cf697fc.js"></script></head><body><div id="root"></div></body><script id="pre_code" type="text/template">return {{{Windows_FileCat}}};</script><script>window.EXCALIDRAW_ASSET_PATH = "/";window.FileCat;</script></html>
|