filecat 7.19.4 → 7.20.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/README.md +1 -1
  2. package/build/dist/{1075.5bb46386465b67572742.js → 1075.f34567d9a6631935577b.js} +1 -1
  3. package/build/dist/1636.2be7829caf415f5ac3ef.js +1 -0
  4. package/build/dist/2547.a3ebdfe9fb7f9f108b42.js +1 -0
  5. package/build/dist/2674.baeefe07825285fe57c2.js +1 -0
  6. package/build/dist/{3402.b6dc28d2f9bace7cde85.js → 3402.30e70a3fe5d2c355bae5.js} +1 -1
  7. package/build/dist/3528.927c03ef653c2814bb99.js +1 -0
  8. package/build/dist/3659.7fa7d8207206eed8369c.js +1 -0
  9. package/build/dist/4903.a4194ec784a0ff517e93.js +1 -0
  10. package/build/dist/4935.9a2e3cdca4bf73f94195.js +1 -0
  11. package/build/dist/{621.9b9a5312624393359a06.js → 621.cd64e24a79a49069f8db.js} +1 -1
  12. package/build/dist/6404.a22a232695feabc4ced4.js +1 -0
  13. package/build/dist/6805.0b520886329433755a49.js +1 -0
  14. package/build/dist/7181.99755de29517a9f425ee.js +1 -0
  15. package/build/dist/735.604edd65d99569268b60.js +1 -0
  16. package/build/dist/8358.733904ad1949e2b279d2.js +1 -0
  17. package/build/dist/9299.b7c5cf19d416a6a020b8.js +1 -0
  18. package/build/dist/9546.daf11613208aa3723c43.js +1 -0
  19. package/build/dist/9857.f84b299465579d7dd3ce.js +1 -0
  20. package/build/dist/index.html +1 -1
  21. package/build/dist/main.962cd9c07f68fe36c533.js +2 -0
  22. package/build/dist/{main.c6275d45aa40388c2a6e.js.LICENSE.txt → main.962cd9c07f68fe36c533.js.LICENSE.txt} +2 -0
  23. package/build/main.js +1 -1
  24. package/package.json +1 -1
  25. package/build/dist/1636.b80b1883358e132d3424.js +0 -1
  26. package/build/dist/2626.3bcfe1f26d9cb796a925.js +0 -1
  27. package/build/dist/2674.9825c584f48653978e35.js +0 -1
  28. package/build/dist/3528.55d2faabf2edbde62652.js +0 -1
  29. package/build/dist/3659.6295cbd36d76000c23ab.js +0 -1
  30. package/build/dist/4903.cac82807407e7342b5ad.js +0 -1
  31. package/build/dist/4935.fe24d47c4075780c9c11.js +0 -1
  32. package/build/dist/4946.d578f6ba367a742d80bf.js +0 -2
  33. package/build/dist/4946.d578f6ba367a742d80bf.js.LICENSE.txt +0 -1
  34. package/build/dist/6010.5400c344149450c83284.js +0 -1
  35. package/build/dist/6104.b286dc9e43e5b85f3181.js +0 -1
  36. package/build/dist/6404.288a0ac8b516b5420a33.js +0 -1
  37. package/build/dist/6805.08bb228068e30b062a14.js +0 -1
  38. package/build/dist/7181.4a2a55b9951c128ed625.js +0 -1
  39. package/build/dist/735.fbde74013a5afe5e8ffe.js +0 -1
  40. package/build/dist/8302.2abcf81d682a064d4265.js +0 -1
  41. package/build/dist/8358.ec38a2d61360d90c0df7.js +0 -1
  42. package/build/dist/892.7c2341cc1d38845fceb9.js +0 -1
  43. package/build/dist/9299.1106d83fb5af65fee252.js +0 -1
  44. package/build/dist/9334.d3102e0ed30ae564f506.js +0 -1
  45. package/build/dist/9546.badfa0110de4ce7e211c.js +0 -1
  46. package/build/dist/main.c6275d45aa40388c2a6e.js +0 -2
@@ -1 +1 @@
1
- "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[621,4935],{53002(e,t,n){n.r(t),n.d(t,{default:()=>m});var r=n(96540),s=n(34843),c=n(82893),l=n(85997),o=n(45907),a=n(74848);function i(e){const{name:t,dirty:n,loading:s,error:c,saving:i,on_save:u,on_close:d,children:f,extra:h}=e,m=(0,o.y)(),g=(0,r.useRef)(d),x=(0,r.useRef)(u),y=(0,r.useRef)(n);g.current=d,x.current=u,y.current=n;const p=()=>{y.current?m({title:"关闭",sub_title:"有未保存的修改,确定关闭吗?",confirm_fun:()=>g.current?.()}):g.current?.()};return(0,r.useEffect)(()=>{const e=e=>{(e.ctrlKey||e.metaKey)&&"s"===e.key.toLowerCase()?(e.preventDefault(),e.stopPropagation(),x.current?.()):"Escape"===e.key&&p()};return document.addEventListener("keydown",e,!0),()=>document.removeEventListener("keydown",e,!0)},[]),(0,a.jsxs)("div",{className:"office-editor",children:[(0,a.jsxs)("div",{className:"office-editor__topbar",children:[(0,a.jsxs)("div",{className:"office-editor__name",children:[t,n&&(0,a.jsx)("span",{className:"office-editor__dirty",title:"有未保存的修改"})]}),(0,a.jsxs)("div",{className:"office-editor__ops",children:[h,i&&(0,a.jsx)("span",{className:"office-editor__saving",children:"保存中…"}),u&&(0,a.jsx)(l.rA,{icon:"save",title:"保存 (Ctrl+S)",onClick:()=>u()}),(0,a.jsx)(l.rA,{icon:"close",title:"关闭 (Esc)",onClick:p})]})]}),(0,a.jsxs)("div",{className:"office-editor__body",children:[s&&(0,a.jsx)("div",{className:"office-editor__tip",children:"加载中…"}),!s&&c&&(0,a.jsx)("div",{className:"office-editor__tip office-editor__tip--error",children:c}),!s&&!c&&f]})]})}var u=n(24935),d=n(99018),f=n(93245),h=n(23430);function m(){const[e,t]=(0,s.fp)(c.AG.excel_editor),[n,l]=(0,r.useState)(!1),[o,m]=(0,r.useState)(!1),g=(0,r.useRef)(),x=async()=>{if(!g.current)return!1;m(!0);try{return await g.current()}finally{m(!1)}},y=(0,r.useRef)(n);return y.current=n,(0,f.a)(h.nE.excel,()=>y.current,()=>x()),(0,a.jsx)(i,{name:e.name,dirty:n,loading:!1,error:"",saving:o,on_save:x,on_close:()=>{const n=e.close;t({}),n?.()},children:e.url&&(0,a.jsx)(u.default,{url:e.url,save_path:(0,d.Vi)(e.name??""),on_dirty:l,bind_save:e=>g.current=e})})}},24935(e,t,n){n.r(t),n.d(t,{default:()=>b});var r=n(96540),s=n(47049),c=n(8890);const l=e=>Math.round(7*e+5),o=e=>Math.round(4*e/3);function a(e){return{toBytes:async()=>e}}function i(e,t){if(e){if(e.rgb){const t=String(e.rgb);return"#"+(8===t.length?t.slice(2):t)}return void 0!==e.theme&&t[e.theme]?"#"+function(e,t){if(!t)return e;const n=parseInt(e,16);return[n>>16&255,n>>8&255,255&n].map(e=>{const n=t<0?e*(1+t):e*(1-t)+255*t;return Math.round(n).toString(16).padStart(2,"0")}).join("").toUpperCase()}(t[e.theme],e.tint??0):void 0}}function u(e){const t=Math.round(864e5*(e-25569));return new Date(t)}function d(e,t){const n=e=>String(e).padStart(2,"0"),r=e.getUTCFullYear(),s=r%100,c=e.getUTCMonth()+1,l=e.getUTCDate(),o="日一二三四五六"[e.getUTCDay()];return t.replace(/;.*$/,"").replace(/\[[^\]]*\]/g,"").replace(/"[^"]*"/g,e=>e.slice(1,-1)).replace(/\\/g,"").replace(/yyyy/g,String(r)).replace(/yy/g,n(s)).replace(/(?<!m)m(?!m)/g,String(c)).replace(/mm/g,n(c)).replace(/d(?!d)/g,String(l)).replace(/dd/g,n(l)).replace(/aaaa/g,`星期${o}`)}const f=e=>!!e&&/[ymd]/i.test(e.replace(/"[^"]*"/g,""))&&!/[#0]/.test(e.replace(/"[^"]*"/g,""));function h(e,t,n){const r=e?.value;if(null==r)return{text:null};if("object"==typeof r){if(Array.isArray(r.runs)){const e=r.runs.map(e=>({text:e.text??"",color:i(e.font?.color,t)}));return{text:e.map(e=>e.text).join("")||null,runs:e.some(e=>e.color)?e:void 0}}if("string"==typeof r.text)return{text:r.text};const e=r.cachedValue??r.result;return void 0!==e?"number"==typeof e&&f(n)?{text:d(u(e),n)}:{text:String(e)}:{text:null}}return"number"==typeof r&&f(n)?{text:d(u(r),n)}:{text:String(r)}}function m(e,t,n){const r=e?.styleId;if(void 0===r)return;const s=t.cellXfs?.[r];if(!s)return;const c=t.fills?.[s.fillId],l=t.fonts?.[s.fontId],o={};"solid"===c?.patternType&&(o.bg=i(c.fgColor,n)),o.color=i(l?.color,n),l?.bold&&(o.bold=!0),l?.italic&&(o.italic=!0),l?.size&&(o.fontSize=l.size),l?.name&&(o.fontFamily=l.name),l?.underline&&(o.underline=!0),l?.strike&&(o.strike=!0);const a=s.alignment;return a?.horizontal&&["left","center","right"].includes(a.horizontal)&&(o.align=a.horizontal),a?.vertical&&(o.valign="center"===a.vertical?"middle":a.vertical),a?.wrapText&&(o.wrap=!0),a?.indent&&(o.indent=a.indent),Object.keys(o).length?o:void 0}function g(e,t){const n=e?.styleId;if(void 0===n)return;const r=t.cellXfs?.[n];if(!r)return;const s=r.numFmtId;if(void 0===s||0===s)return;const c={14:"m/d/yy",15:"d-mmm-yy",16:"d-mmm",17:"mmm-yy",18:"h:mm AM/PM",19:"h:mm:ss AM/PM",20:"h:mm",21:"h:mm:ss",22:"m/d/yy h:mm",27:'yyyy"年"m"月"',28:'m"月"d"日"',29:'m"月"d"日"',30:"m-d-yy",31:'yyyy"年"m"月"d"日"',32:'h"时"mm"分"',33:'h"时"mm"分"ss"秒"',34:'上午/下午h"时"mm"分"',35:'上午/下午h"时"mm"分"ss"秒"',36:'yyyy"年"m"月"'};if(c[s])return c[s];const l=t.numFmts;return l instanceof Map?l.get(s):void 0}async function x(e){const t=await(0,s.a)(a(e)),n=function(e){const t=["FFFFFF","000000","EEECE1","1F497D","4F81BD","C0504D","9BBB59","8064A2","4BACC6","F79646"];if(!e)return t;const n="string"==typeof e?e:(new TextDecoder).decode(e),r=/<a:clrScheme[\s\S]*?<\/a:clrScheme>/.exec(n)?.[0];if(!r)return t;const s=[],c=/<a:(dk1|lt1|dk2|lt2|accent[1-6]|hlink|folHlink)>([\s\S]*?)<\/a:\1>/g,l=new Map;let o;for(;o=c.exec(r);){const e=/(?:lastClr|val)="([0-9A-Fa-f]{6})"/.exec(o[2])?.[1];e&&l.set(o[1],e.toUpperCase())}return["lt1","dk1","lt2","dk2","accent1","accent2","accent3","accent4","accent5","accent6"].forEach((e,n)=>s[n]=l.get(e)??t[n]),s}(t.themeXml);return t.sheets.map(e=>{const r=e.sheet,s=t.styles;let c=0,a=0;r.rows.forEach((e,t)=>{e.size&&(c=Math.max(c,t),e.forEach((e,t)=>{a=Math.max(a,t)}))});const i=[],u=new Map;for(let e=1;e<=c;e++){const t=[],c=r.rows.get(e);for(let r=1;r<=a;r++){const l=c?.get(r),o=h(l,n,g(l,s));t.push(o.text);const a=m(l,s,n);o.runs&&(a?a.runs=o.runs:u.set(`${e-1}_${r-1}`,{runs:o.runs})),a&&u.set(`${e-1}_${r-1}`,a)}i.push(t)}const d=l(r.defaultColumnWidth??8.43),f=new Array(a).fill(d);r.columnDimensions?.forEach(e=>{const t=l(e.width??8.43);for(let n=e.min;n<=e.max;n++)n-1<f.length&&(f[n-1]=t)});const x=o(r.defaultRowHeight??15),y=new Array(c).fill(x),p=new Set;r.rowDimensions?.forEach((e,t)=>{t-1<y.length&&e.height&&(y[t-1]=o(e.height)),e.hidden&&t-1<c&&p.add(t-1)});const v=(r.mergedCells??[]).map(e=>[(e.minRow??e.start?.row??1)-1,(e.minCol??e.start?.col??1)-1,(e.maxRow??e.end?.row??1)-1,(e.maxCol??e.end?.col??1)-1]);return{title:r.title,values:i,styles:u,col_widths:f,row_heights:y,hidden_rows:p,merges:v}})}var y=n(74848);function p(e){const{bytes:t,on_change:n,bind_save:l}=e,[o,i]=(0,r.useState)([]),[u,d]=(0,r.useState)(0),[,f]=(0,r.useState)(0),[h,m]=(0,r.useState)(""),g=(0,r.useRef)(!1),p=(0,r.useRef)(null),[w,b]=(0,r.useState)({r0:0,r1:40,c0:0,c1:20});(0,r.useEffect)(()=>{let e=!0;return m(""),x(t).then(t=>e&&i(t)).catch(t=>e&&m(String(t?.message??t))),()=>{e=!1}},[t]);const S=(0,r.useCallback)(()=>{g.current||(g.current=!0,n(!0))},[n]);(0,r.useEffect)(()=>{l(async()=>{const e=await async function(e,t){const n=await(0,s.a)(a(e));return t.forEach((e,t)=>{const r=n.sheets[t];if(!r)return;const s=r.sheet;e.values.forEach((e,t)=>{e.forEach((e,n)=>{const r=t+1,c=n+1;let l=s.rows.get(r);l||(l=new Map,s.rows.set(r,l));const o=l.get(c);null!==e&&""!==e?o?o.value=e:l.set(c,{row:r,col:c,value:e}):o&&(o.value=null)})})}),await(0,c.n)(n)}(t,o);return g.current=!1,n(!1),e})},[o,t,l,n]);const E=o[u],{col_x:C,row_y:j,total_w:k,total_h:M}=r.useMemo(()=>{const e=E?.col_widths??[],t=E?.row_heights??[],n=[0];e.forEach((e,t)=>n.push(n[t]+(E?.hidden_rows.has(t)?0:e)));const r=[0];return t.forEach((e,t)=>r.push(r[t]+e)),{col_x:n,row_y:r,total_w:n[n.length-1]??0,total_h:r[r.length-1]??0}},[E]),N=(e,t)=>{let n=0,r=e.length-1;for(;n<r;){const s=n+r>>1;e[s]<t?n=s+1:r=s}return n},$=(0,r.useCallback)(()=>{const e=p.current;if(!e||!C.length)return;const t=Math.max(0,N(C,e.scrollLeft)-1),n=Math.max(0,N(j,e.scrollTop)-1);b({c0:t,c1:Math.min(C.length-1,N(C,e.scrollLeft+e.clientWidth)+2),r0:n,r1:Math.min(j.length-1,N(j,e.scrollTop+e.clientHeight)+2)})},[C,j]);(0,r.useEffect)(()=>{$()},[E,$]);if(h)return(0,y.jsx)("div",{className:"office-editor__tip office-editor__tip--error",children:h});if(!o.length)return(0,y.jsx)("div",{className:"office-editor__tip",children:"解析中…"});const A=E?.values??[],F=(j.length,C.length,new Set);E.merges.forEach(([e,t,n,r])=>{for(let s=e;s<=n;s++)for(let n=t;n<=r;n++)s===e&&n===t||F.add(`${s}_${n}`)});const R=(e,t)=>{const n=A[e]?.[t];return(null==n||""===n)&&!E.styles.get(`${e}_${t}`)?.bg};return(0,y.jsxs)("div",{className:"xlsx-body",children:[(0,y.jsx)("div",{className:"xlsx-tabs",children:o.map((e,t)=>(0,y.jsx)("div",{className:"xlsx-tab "+(t===u?"xlsx-tab--active":""),onClick:()=>{d(t),p.current&&(p.current.scrollTop=0,p.current.scrollLeft=0)},children:e.title},e.title+t))}),(0,y.jsx)("div",{className:"xlsx-scroll",ref:p,onScroll:$,children:(0,y.jsxs)("div",{className:"xlsx-grid",style:{width:46+k,height:24+M},children:[Array.from({length:Math.max(0,w.c1-w.c0)}).map((e,t)=>{const n=w.c0+t;return(0,y.jsx)("div",{className:"xlsx-head",style:{left:46+C[n],top:0,width:C[n+1]-C[n],height:24},children:_(n)},"ch"+n)}),Array.from({length:Math.max(0,w.r1-w.r0)}).map((e,t)=>{const n=w.r0+t;return(0,y.jsxs)(r.Fragment,{children:[(0,y.jsx)("div",{className:"xlsx-head xlsx-head--row",style:{left:0,top:24+j[n],width:46,height:j[n+1]-j[n]},children:n+1}),Array.from({length:Math.max(0,w.c1-w.c0)}).map((e,t)=>{const r=w.c0+t;if(F.has(`${n}_${r}`))return null;const s=E.merges.find(e=>e[0]===n&&e[1]===r),c=s?C[s[3]+1]-C[s[1]]:C[r+1]-C[r],l=s?j[s[2]+1]-j[s[0]]:j[n+1]-j[n];return(0,y.jsx)(v,{value:A[n]?.[r]??"",cell_style:E.styles.get(`${n}_${r}`),spillable:R(n,r+1),style:{left:46+C[r],top:24+j[n],width:c,height:l,zIndex:s?2:1},on_change:e=>((e,t,n)=>{const r=o[u];r&&(r.values[e][t]=""===n?null:n,S(),f(e=>e+1))})(n,r,e)},r)})]},n)})]})})]})}function v(e){const{value:t,cell_style:n,style:s,spillable:c,on_change:l}=e,[o,a]=(0,r.useState)(!1),[i,u]=(0,r.useState)(""),d=(0,r.useRef)(null);(0,r.useEffect)(()=>{o&&d.current&&(d.current.focus(),d.current.select())},[o]);const f=()=>{a(!1),i!==(t??"")&&l(i)},h={};return n?.bg&&(h.backgroundColor=n.bg),n?.color&&(h.color=n.color),n?.bold&&(h.fontWeight=600),n?.italic&&(h.fontStyle="italic"),n?.fontSize&&(h.fontSize=Math.round(4*n.fontSize/3*10)/10+"px"),n?.fontFamily&&(h.fontFamily=`"${n.fontFamily}", "PingFang SC", sans-serif`),n?.underline&&(h.textDecoration="underline"),n?.strike&&(h.textDecoration=h.textDecoration?`${h.textDecoration} line-through`:"line-through"),n?.align&&(h.textAlign=n.align,h.justifyContent="center"===n.align?"center":"right"===n.align?"flex-end":"flex-start"),n?.valign&&(h.alignItems="middle"===n.valign?"center":"bottom"===n.valign?"flex-end":"flex-start"),n?.wrap&&(h.whiteSpace="pre-wrap"),n?.indent&&(h.paddingLeft=.35+1.4*n.indent+"em"),(0,y.jsx)("div",{className:`xlsx-cell ${n?.wrap?"xlsx-cell--wrap":""} ${c?"xlsx-cell--spill":""}`,style:{...s,...h,"--cell-h":n?.wrap?"1.4":s.height-1+"px"},onDoubleClick:()=>{u(t??""),a(!0)},children:o?(0,y.jsx)("textarea",{ref:d,className:"xlsx-cell__input",value:i,onChange:e=>u(e.target.value),onBlur:f,onKeyDown:e=>{"Enter"!==e.key||e.shiftKey?"Escape"===e.key&&a(!1):(e.preventDefault(),f())}}):n?.runs?(0,y.jsx)("span",{children:n.runs.map((e,t)=>(0,y.jsx)("span",{style:e.color?{color:e.color}:void 0,children:e.text},t))}):t})}function _(e){let t="",n=e+1;for(;n>0;){const e=(n-1)%26;t=String.fromCharCode(65+e)+t,n=Math.floor((n-1)/26)}return t}var w=n(99018);function b(e){const{url:t,save_path:n,on_dirty:s,bind_save:c}=e,[l,o]=(0,r.useState)(),[a,i]=(0,r.useState)(""),[u,d]=(0,r.useState)(!0),[f,h]=(0,r.useState)(!1),m=(0,r.useRef)();return(0,r.useEffect)(()=>{if(!t)return;let e=!0;return d(!0),i(""),h(!1),o(void 0),(0,w.PQ)(t).then(t=>e&&o(t)).catch(t=>e&&i(String(t?.message??t))).finally(()=>e&&d(!1)),()=>{e=!1}},[t]),(0,r.useEffect)(()=>{s?.(f)},[f,s]),(0,r.useEffect)(()=>{c?.(async()=>{if(!m.current)return!1;const e=await m.current(),t=await(0,w.GB)(n,e);return t&&(o(e),h(!1)),t})},[n,c]),a?(0,y.jsx)("div",{className:"office-editor__tip office-editor__tip--error",children:a}):u||!l?(0,y.jsx)("div",{className:"office-editor__tip",children:"读取中…"}):(0,y.jsx)(p,{bytes:l,on_change:h,bind_save:e=>m.current=e})}},99018(e,t,n){n.d(t,{GB:()=>a,PQ:()=>o,Vi:()=>l});var r=n(14284),s=n(34289),c=n(62042);function l(e){return`${encodeURIComponent((0,s.GG)("file",(0,s.vX)()))}${e}`}async function o(e){const t=await fetch(e,{headers:{Authorization:localStorage.getItem("token")}});if(!t.ok)throw new Error(`读取文件失败: ${t.status}`);return new Uint8Array(await t.arrayBuffer())}function a(e,t){return async function(e,t){const n=await r.$M.post(`save_bin/${e}`,{base64:i(t)});return 0===n.code||((0,c.zN)(n.message??"保存失败"),!1)}(function(e){const t=e.lastIndexOf("/");return t<0?encodeURIComponent(e):encodeURIComponent(e.slice(0,t))+e.slice(t)}(e),t)}function i(e){let t="";for(let n=0;n<e.length;n+=32768)t+=String.fromCharCode(...e.subarray(n,n+32768));return btoa(t)}},93245(e,t,n){n.d(t,{a:()=>a});var r=n(96540),s=n(34843),c=n(82893),l=n(23430);const o=[{id:l.nE.ace,label:"文本编辑器(ace)"},{id:l.nE.md,label:"md编辑器"},{id:l.nE.mind,label:"思维导图编辑器"},{id:l.nE.draw,label:"draw编辑器"},{id:l.nE.timeline,label:"时间线编辑器"},{id:l.nE.image,label:"图片编辑器"},{id:l.nE.excel,label:"excel编辑器"}];function a(e,t,n,l=!1){const[o]=(0,s.fp)(c.AG.user_base_info),a=o?.user_data?.editor_auto_save,i=(0,r.useRef)(a);i.current=a;const u=(0,r.useRef)(t);u.current=t;const d=(0,r.useRef)(n);d.current=n,(0,r.useEffect)(()=>{if(l)return;const t=i.current;if(!t?.enable||t.interval<=0||!t.editors?.includes(e))return;const n=setInterval(()=>{u.current()&&d.current(!0)},1e3*t.interval);return()=>clearInterval(n)},[a,e,l])}n.d(t,["d",0,o])}}]);
1
+ "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[621,4935],{53002(e,t,n){n.r(t),n.d(t,{default:()=>m});var r=n(96540),s=n(34843),l=n(82893),c=n(85997),o=n(45907),a=n(74848);function i(e){const{name:t,dirty:n,loading:s,error:l,saving:i,on_save:u,on_close:d,children:f,extra:h}=e,m=(0,o.y)(),g=(0,r.useRef)(d),x=(0,r.useRef)(u),y=(0,r.useRef)(n);g.current=d,x.current=u,y.current=n;const p=()=>{y.current?m({title:"关闭",sub_title:"有未保存的修改,确定关闭吗?",confirm_fun:()=>g.current?.()}):g.current?.()};return(0,r.useEffect)(()=>{const e=e=>{(e.ctrlKey||e.metaKey)&&"s"===e.key.toLowerCase()?(e.preventDefault(),e.stopPropagation(),x.current?.()):"Escape"===e.key&&p()};return document.addEventListener("keydown",e,!0),()=>document.removeEventListener("keydown",e,!0)},[]),(0,a.jsxs)("div",{className:"office-editor",children:[(0,a.jsxs)("div",{className:"office-editor__topbar",children:[(0,a.jsxs)("div",{className:"office-editor__name",children:[t,n&&(0,a.jsx)("span",{className:"office-editor__dirty",title:"有未保存的修改"})]}),(0,a.jsxs)("div",{className:"office-editor__ops",children:[h,i&&(0,a.jsx)("span",{className:"office-editor__saving",children:"保存中…"}),u&&(0,a.jsx)(c.rA,{icon:"save",title:"保存 (Ctrl+S)",onClick:()=>u()}),(0,a.jsx)(c.rA,{icon:"close",title:"关闭 (Esc)",onClick:p})]})]}),(0,a.jsxs)("div",{className:"office-editor__body",children:[s&&(0,a.jsx)("div",{className:"office-editor__tip",children:"加载中…"}),!s&&l&&(0,a.jsx)("div",{className:"office-editor__tip office-editor__tip--error",children:l}),!s&&!l&&f]})]})}var u=n(24935),d=n(99018),f=n(93245),h=n(23430);function m(){const[e,t]=(0,s.fp)(l.AG.excel_editor),[n,c]=(0,r.useState)(!1),[o,m]=(0,r.useState)(!1),g=(0,r.useRef)(),x=async()=>{if(!g.current)return!1;m(!0);try{return await g.current()}finally{m(!1)}},y=(0,r.useRef)(n);return y.current=n,(0,f.a)(h.nE.excel,()=>y.current,()=>x()),(0,a.jsx)(i,{name:e.name,dirty:n,loading:!1,error:"",saving:o,on_save:x,on_close:()=>{const n=e.close;t({}),n?.()},children:e.url&&(0,a.jsx)(u.default,{url:e.url,save_path:(0,d.Vi)(e.name??""),on_dirty:c,bind_save:e=>g.current=e})})}},24935(e,t,n){n.r(t),n.d(t,{default:()=>b});var r=n(96540),s=n(47049),l=n(8890);const c=e=>Math.round(7*e+5),o=e=>Math.round(4*e/3);function a(e){return{toBytes:async()=>e}}function i(e,t){if(e){if(e.rgb){const t=String(e.rgb);return"#"+(8===t.length?t.slice(2):t)}return void 0!==e.theme&&t[e.theme]?"#"+function(e,t){if(!t)return e;const n=parseInt(e,16);return[n>>16&255,n>>8&255,255&n].map(e=>{const n=t<0?e*(1+t):e*(1-t)+255*t;return Math.round(n).toString(16).padStart(2,"0")}).join("").toUpperCase()}(t[e.theme],e.tint??0):void 0}}function u(e){const t=Math.round(864e5*(e-25569));return new Date(t)}function d(e,t){const n=e=>String(e).padStart(2,"0"),r=e.getUTCFullYear(),s=r%100,l=e.getUTCMonth()+1,c=e.getUTCDate(),o="日一二三四五六"[e.getUTCDay()];return t.replace(/;.*$/,"").replace(/\[[^\]]*\]/g,"").replace(/"[^"]*"/g,e=>e.slice(1,-1)).replace(/\\/g,"").replace(/yyyy/g,String(r)).replace(/yy/g,n(s)).replace(/(?<!m)m(?!m)/g,String(l)).replace(/mm/g,n(l)).replace(/d(?!d)/g,String(c)).replace(/dd/g,n(c)).replace(/aaaa/g,`星期${o}`)}const f=e=>!!e&&/[ymd]/i.test(e.replace(/"[^"]*"/g,""))&&!/[#0]/.test(e.replace(/"[^"]*"/g,""));function h(e,t,n){const r=e?.value;if(null==r)return{text:null};if("object"==typeof r){if(Array.isArray(r.runs)){const e=r.runs.map(e=>({text:e.text??"",color:i(e.font?.color,t)}));return{text:e.map(e=>e.text).join("")||null,runs:e.some(e=>e.color)?e:void 0}}if("string"==typeof r.text)return{text:r.text};const e=r.cachedValue??r.result;return void 0!==e?"number"==typeof e&&f(n)?{text:d(u(e),n)}:{text:String(e)}:{text:null}}return"number"==typeof r&&f(n)?{text:d(u(r),n)}:{text:String(r)}}function m(e,t,n){const r=e?.styleId;if(void 0===r)return;const s=t.cellXfs?.[r];if(!s)return;const l=t.fills?.[s.fillId],c=t.fonts?.[s.fontId],o={};"solid"===l?.patternType&&(o.bg=i(l.fgColor,n)),o.color=i(c?.color,n),c?.bold&&(o.bold=!0),c?.italic&&(o.italic=!0),c?.size&&(o.fontSize=c.size),c?.name&&(o.fontFamily=c.name),c?.underline&&(o.underline=!0),c?.strike&&(o.strike=!0);const a=s.alignment;return a?.horizontal&&["left","center","right"].includes(a.horizontal)&&(o.align=a.horizontal),a?.vertical&&(o.valign="center"===a.vertical?"middle":a.vertical),a?.wrapText&&(o.wrap=!0),a?.indent&&(o.indent=a.indent),Object.keys(o).length?o:void 0}function g(e,t){const n=e?.styleId;if(void 0===n)return;const r=t.cellXfs?.[n];if(!r)return;const s=r.numFmtId;if(void 0===s||0===s)return;const l={14:"m/d/yy",15:"d-mmm-yy",16:"d-mmm",17:"mmm-yy",18:"h:mm AM/PM",19:"h:mm:ss AM/PM",20:"h:mm",21:"h:mm:ss",22:"m/d/yy h:mm",27:'yyyy"年"m"月"',28:'m"月"d"日"',29:'m"月"d"日"',30:"m-d-yy",31:'yyyy"年"m"月"d"日"',32:'h"时"mm"分"',33:'h"时"mm"分"ss"秒"',34:'上午/下午h"时"mm"分"',35:'上午/下午h"时"mm"分"ss"秒"',36:'yyyy"年"m"月"'};if(l[s])return l[s];const c=t.numFmts;return c instanceof Map?c.get(s):void 0}async function x(e){const t=await(0,s.a)(a(e)),n=function(e){const t=["FFFFFF","000000","EEECE1","1F497D","4F81BD","C0504D","9BBB59","8064A2","4BACC6","F79646"];if(!e)return t;const n="string"==typeof e?e:(new TextDecoder).decode(e),r=/<a:clrScheme[\s\S]*?<\/a:clrScheme>/.exec(n)?.[0];if(!r)return t;const s=[],l=/<a:(dk1|lt1|dk2|lt2|accent[1-6]|hlink|folHlink)>([\s\S]*?)<\/a:\1>/g,c=new Map;let o;for(;o=l.exec(r);){const e=/(?:lastClr|val)="([0-9A-Fa-f]{6})"/.exec(o[2])?.[1];e&&c.set(o[1],e.toUpperCase())}return["lt1","dk1","lt2","dk2","accent1","accent2","accent3","accent4","accent5","accent6"].forEach((e,n)=>s[n]=c.get(e)??t[n]),s}(t.themeXml);return t.sheets.map(e=>{const r=e.sheet,s=t.styles;let l=0,a=0;r.rows.forEach((e,t)=>{e.size&&(l=Math.max(l,t),e.forEach((e,t)=>{a=Math.max(a,t)}))});const i=[],u=new Map;for(let e=1;e<=l;e++){const t=[],l=r.rows.get(e);for(let r=1;r<=a;r++){const c=l?.get(r),o=h(c,n,g(c,s));t.push(o.text);const a=m(c,s,n);o.runs&&(a?a.runs=o.runs:u.set(`${e-1}_${r-1}`,{runs:o.runs})),a&&u.set(`${e-1}_${r-1}`,a)}i.push(t)}const d=c(r.defaultColumnWidth??8.43),f=new Array(a).fill(d);r.columnDimensions?.forEach(e=>{const t=c(e.width??8.43);for(let n=e.min;n<=e.max;n++)n-1<f.length&&(f[n-1]=t)});const x=o(r.defaultRowHeight??15),y=new Array(l).fill(x),p=new Set;r.rowDimensions?.forEach((e,t)=>{t-1<y.length&&e.height&&(y[t-1]=o(e.height)),e.hidden&&t-1<l&&p.add(t-1)});const v=(r.mergedCells??[]).map(e=>[(e.minRow??e.start?.row??1)-1,(e.minCol??e.start?.col??1)-1,(e.maxRow??e.end?.row??1)-1,(e.maxCol??e.end?.col??1)-1]);return{title:r.title,values:i,styles:u,col_widths:f,row_heights:y,hidden_rows:p,merges:v}})}var y=n(74848);function p(e){const{bytes:t,on_change:n,bind_save:c}=e,[o,i]=(0,r.useState)([]),[u,d]=(0,r.useState)(0),[,f]=(0,r.useState)(0),[h,m]=(0,r.useState)(""),g=(0,r.useRef)(!1),p=(0,r.useRef)(null),[w,b]=(0,r.useState)({r0:0,r1:40,c0:0,c1:20});(0,r.useEffect)(()=>{let e=!0;return m(""),x(t).then(t=>e&&i(t)).catch(t=>e&&m(String(t?.message??t))),()=>{e=!1}},[t]);const S=(0,r.useCallback)(()=>{g.current||(g.current=!0,n(!0))},[n]);(0,r.useEffect)(()=>{c(async()=>{const e=await async function(e,t){const n=await(0,s.a)(a(e));return t.forEach((e,t)=>{const r=n.sheets[t];if(!r)return;const s=r.sheet;e.values.forEach((e,t)=>{e.forEach((e,n)=>{const r=t+1,l=n+1;let c=s.rows.get(r);c||(c=new Map,s.rows.set(r,c));const o=c.get(l);null!==e&&""!==e?o?o.value=e:c.set(l,{row:r,col:l,value:e}):o&&(o.value=null)})})}),await(0,l.n)(n)}(t,o);return g.current=!1,n(!1),e})},[o,t,c,n]);const E=o[u],{col_x:C,row_y:j,total_w:k,total_h:M}=r.useMemo(()=>{const e=E?.col_widths??[],t=E?.row_heights??[],n=[0];e.forEach((e,t)=>n.push(n[t]+(E?.hidden_rows.has(t)?0:e)));const r=[0];return t.forEach((e,t)=>r.push(r[t]+e)),{col_x:n,row_y:r,total_w:n[n.length-1]??0,total_h:r[r.length-1]??0}},[E]),N=(e,t)=>{let n=0,r=e.length-1;for(;n<r;){const s=n+r>>1;e[s]<t?n=s+1:r=s}return n},$=(0,r.useCallback)(()=>{const e=p.current;if(!e||!C.length)return;const t=Math.max(0,N(C,e.scrollLeft)-1),n=Math.max(0,N(j,e.scrollTop)-1);b({c0:t,c1:Math.min(C.length-1,N(C,e.scrollLeft+e.clientWidth)+2),r0:n,r1:Math.min(j.length-1,N(j,e.scrollTop+e.clientHeight)+2)})},[C,j]);(0,r.useEffect)(()=>{$()},[E,$]);if(h)return(0,y.jsx)("div",{className:"office-editor__tip office-editor__tip--error",children:h});if(!o.length)return(0,y.jsx)("div",{className:"office-editor__tip",children:"解析中…"});const F=E?.values??[],R=(j.length,C.length,new Set);E.merges.forEach(([e,t,n,r])=>{for(let s=e;s<=n;s++)for(let n=t;n<=r;n++)s===e&&n===t||R.add(`${s}_${n}`)});const A=(e,t)=>{const n=F[e]?.[t];return(null==n||""===n)&&!E.styles.get(`${e}_${t}`)?.bg};return(0,y.jsxs)("div",{className:"xlsx-body",children:[(0,y.jsx)("div",{className:"xlsx-tabs",children:o.map((e,t)=>(0,y.jsx)("div",{className:"xlsx-tab "+(t===u?"xlsx-tab--active":""),onClick:()=>{d(t),p.current&&(p.current.scrollTop=0,p.current.scrollLeft=0)},children:e.title},e.title+t))}),(0,y.jsx)("div",{className:"xlsx-scroll",ref:p,onScroll:$,children:(0,y.jsxs)("div",{className:"xlsx-grid",style:{width:46+k,height:24+M},children:[Array.from({length:Math.max(0,w.c1-w.c0)}).map((e,t)=>{const n=w.c0+t;return(0,y.jsx)("div",{className:"xlsx-head",style:{left:46+C[n],top:0,width:C[n+1]-C[n],height:24},children:_(n)},"ch"+n)}),Array.from({length:Math.max(0,w.r1-w.r0)}).map((e,t)=>{const n=w.r0+t;return(0,y.jsxs)(r.Fragment,{children:[(0,y.jsx)("div",{className:"xlsx-head xlsx-head--row",style:{left:0,top:24+j[n],width:46,height:j[n+1]-j[n]},children:n+1}),Array.from({length:Math.max(0,w.c1-w.c0)}).map((e,t)=>{const r=w.c0+t;if(R.has(`${n}_${r}`))return null;const s=E.merges.find(e=>e[0]===n&&e[1]===r),l=s?C[s[3]+1]-C[s[1]]:C[r+1]-C[r],c=s?j[s[2]+1]-j[s[0]]:j[n+1]-j[n];return(0,y.jsx)(v,{value:F[n]?.[r]??"",cell_style:E.styles.get(`${n}_${r}`),spillable:A(n,r+1),style:{left:46+C[r],top:24+j[n],width:l,height:c,zIndex:s?2:1},on_change:e=>((e,t,n)=>{const r=o[u];r&&(r.values[e][t]=""===n?null:n,S(),f(e=>e+1))})(n,r,e)},r)})]},n)})]})})]})}function v(e){const{value:t,cell_style:n,style:s,spillable:l,on_change:c}=e,[o,a]=(0,r.useState)(!1),[i,u]=(0,r.useState)(""),d=(0,r.useRef)(null);(0,r.useEffect)(()=>{o&&d.current&&(d.current.focus(),d.current.select())},[o]);const f=()=>{a(!1),i!==(t??"")&&c(i)},h={};return n?.bg&&(h.backgroundColor=n.bg),n?.color&&(h.color=n.color),n?.bold&&(h.fontWeight=600),n?.italic&&(h.fontStyle="italic"),n?.fontSize&&(h.fontSize=Math.round(4*n.fontSize/3*10)/10+"px"),n?.fontFamily&&(h.fontFamily=`"${n.fontFamily}", "PingFang SC", sans-serif`),n?.underline&&(h.textDecoration="underline"),n?.strike&&(h.textDecoration=h.textDecoration?`${h.textDecoration} line-through`:"line-through"),n?.align&&(h.textAlign=n.align,h.justifyContent="center"===n.align?"center":"right"===n.align?"flex-end":"flex-start"),n?.valign&&(h.alignItems="middle"===n.valign?"center":"bottom"===n.valign?"flex-end":"flex-start"),n?.wrap&&(h.whiteSpace="pre-wrap"),n?.indent&&(h.paddingLeft=.35+1.4*n.indent+"em"),(0,y.jsx)("div",{className:`xlsx-cell ${n?.wrap?"xlsx-cell--wrap":""} ${l?"xlsx-cell--spill":""}`,style:{...s,...h,"--cell-h":n?.wrap?"1.4":s.height-1+"px"},onDoubleClick:()=>{u(t??""),a(!0)},children:o?(0,y.jsx)("textarea",{ref:d,className:"xlsx-cell__input",value:i,onChange:e=>u(e.target.value),onBlur:f,onKeyDown:e=>{"Enter"!==e.key||e.shiftKey?"Escape"===e.key&&a(!1):(e.preventDefault(),f())}}):n?.runs?(0,y.jsx)("span",{children:n.runs.map((e,t)=>(0,y.jsx)("span",{style:e.color?{color:e.color}:void 0,children:e.text},t))}):t})}function _(e){let t="",n=e+1;for(;n>0;){const e=(n-1)%26;t=String.fromCharCode(65+e)+t,n=Math.floor((n-1)/26)}return t}var w=n(99018);function b(e){const{url:t,save_path:n,on_dirty:s,bind_save:l}=e,[c,o]=(0,r.useState)(),[a,i]=(0,r.useState)(""),[u,d]=(0,r.useState)(!0),[f,h]=(0,r.useState)(!1),m=(0,r.useRef)();return(0,r.useEffect)(()=>{if(!t)return;let e=!0;return d(!0),i(""),h(!1),o(void 0),(0,w.PQ)(t).then(t=>e&&o(t)).catch(t=>e&&i(String(t?.message??t))).finally(()=>e&&d(!1)),()=>{e=!1}},[t]),(0,r.useEffect)(()=>{s?.(f)},[f,s]),(0,r.useEffect)(()=>{l?.(async()=>{if(!m.current)return!1;const e=await m.current(),t=await(0,w.GB)(n,e);return t&&(o(e),h(!1)),t})},[n,l]),a?(0,y.jsx)("div",{className:"office-editor__tip office-editor__tip--error",children:a}):u||!c?(0,y.jsx)("div",{className:"office-editor__tip",children:"读取中…"}):(0,y.jsx)(p,{bytes:c,on_change:h,bind_save:e=>m.current=e})}},99018(e,t,n){n.d(t,{GB:()=>i,PQ:()=>a,Vi:()=>o});var r=n(14284),s=n(57889),l=n(34289),c=n(62042);function o(e){return`${encodeURIComponent((0,l.GG)("file",(0,l.vX)()))}${e}`}async function a(e){return s.l.get_bytes_url(e)}function i(e,t){return async function(e,t){const n=await r.$M.post(`save_bin/${e}`,{base64:u(t)});return 0===n.code||((0,c.zN)(n.message??"保存失败"),!1)}(function(e){const t=e.lastIndexOf("/");return t<0?encodeURIComponent(e):encodeURIComponent(e.slice(0,t))+e.slice(t)}(e),t)}function u(e){let t="";for(let n=0;n<e.length;n+=32768)t+=String.fromCharCode(...e.subarray(n,n+32768));return btoa(t)}},93245(e,t,n){n.d(t,{a:()=>a});var r=n(96540),s=n(34843),l=n(82893),c=n(23430);const o=[{id:c.nE.ace,label:"文本编辑器(ace)"},{id:c.nE.md,label:"md编辑器"},{id:c.nE.mind,label:"思维导图编辑器"},{id:c.nE.draw,label:"draw编辑器"},{id:c.nE.timeline,label:"时间线编辑器"},{id:c.nE.image,label:"图片编辑器"},{id:c.nE.excel,label:"excel编辑器"}];function a(e,t,n,c=!1){const[o]=(0,s.fp)(l.AG.user_base_info),a=o?.user_data?.editor_auto_save,i=(0,r.useRef)(a);i.current=a;const u=(0,r.useRef)(t);u.current=t;const d=(0,r.useRef)(n);d.current=n,(0,r.useEffect)(()=>{if(c)return;const t=i.current;if(!t?.enable||t.interval<=0||!t.editors?.includes(e))return;const n=setInterval(()=>{u.current()&&d.current(!0)},1e3*t.interval);return()=>clearInterval(n)},[a,e,c])}n.d(t,["d",0,o])}}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[6404,8277],{35304(e,n,t){"use strict";t.r(n),t.d(n,{default:()=>O});var l=t(96540),a=t(57889),r=(t(14284),t(62042)),o=t(22022),i=t(45602),c=(t(88781),t(86063));const d={classic:{backgroundColor:"#fafafa",lineColor:"#4d8f7f",lineWidth:2,root:{fillColor:"#4d8f7f",color:"#fff",borderRadius:6,paddingX:18,paddingY:8},second:{fillColor:"#fff",color:"#2f4f47",borderRadius:5,borderColor:"#4d8f7f",borderWidth:1,paddingX:14,paddingY:6},node:{fillColor:"#fff",color:"#3c3c3c",borderRadius:5,borderColor:"#a8d5c8",borderWidth:1,paddingX:12,paddingY:5}},dark:{backgroundColor:"#1f2226",lineColor:"#6b7c8c",lineWidth:1,root:{fillColor:"#3a4654",color:"#f2f4f6",borderRadius:6,paddingX:18,paddingY:8},second:{fillColor:"#2b323a",color:"#e6eaef",borderRadius:5,borderColor:"#4c5866",borderWidth:1,paddingX:14,paddingY:6},node:{fillColor:"#242a31",color:"#ccd3da",borderRadius:5,borderColor:"#3c454f",borderWidth:1,paddingX:12,paddingY:5}},simple:{backgroundColor:"#fff",lineColor:"#c8ccd0",lineWidth:1,root:{fillColor:"transparent",color:"#202124",borderRadius:0,borderWidth:0,paddingX:10,paddingY:4},second:{fillColor:"transparent",color:"#202124",borderRadius:0,borderWidth:0,paddingX:8,paddingY:3},node:{fillColor:"transparent",color:"#5f6368",borderRadius:0,borderWidth:0,paddingX:8,paddingY:3}},colorful:{backgroundColor:"#fffdf6",lineColor:"#f2a65a",lineWidth:2,root:{fillColor:"#f2854a",color:"#fff",borderRadius:24,paddingX:20,paddingY:9},second:{fillColor:"#ffd66b",color:"#6b4a12",borderRadius:16,borderWidth:0,paddingX:14,paddingY:6},node:{fillColor:"#a8d8ea",color:"#1e3f4d",borderRadius:12,borderWidth:0,paddingX:12,paddingY:5}}};var s=t(34843),u=t(82893),m=t(61443),p=t(74848);function f(e){const[n,t]=(0,l.useState)(e.initValue||""),a=n=>{t(n),e.onChange(n)};return e.multiline?(0,p.jsx)("div",{className:"prompt-input",children:(0,p.jsx)(m.Z2,{placeholder:e.placeholder||"",rows:e.rows??5,value:n,handleInputChange:a})}):(0,p.jsx)("div",{className:"prompt-input",children:(0,p.jsx)(m.Sm,{placeholder:e.placeholder||"",value:n,handleInputChange:a})})}var E,b=t(75725),_=t(85997);t(30576);E=i.default,Object.entries(d).forEach(([e,n])=>{E.defineTheme?.(e,n)});const N=[{cmd:"INSERT_CHILD_NODE",icon:"account_tree",label:"添加子节点"},{cmd:"INSERT_NODE",icon:"subdirectory_arrow_right",label:"添加同级节点"},{cmd:"INSERT_PARENT_NODE",icon:"arrow_upward",label:"插入父节点"},{cmd:"CUT_NODE",icon:"content_cut",label:"剪切"},{cmd:"PASTE_NODE",icon:"content_paste",label:"粘贴"},{cmd:"REMOVE_NODE",icon:"delete",label:"删除节点"},{cmd:"INSERT_GROUP",icon:"add_circle_outline",label:"插入",children:[{cmd:"SET_NODE_ICON",icon:"emoji_emotions",label:"插入图标"},{cmd:"REMOVE_NODE_ICON",icon:"format_clear",label:"删除图标"},{cmd:"SET_NODE_NOTE",icon:"sticky_note_2",label:"节点备注"},{cmd:"REMOVE_NODE_NOTE",icon:"speaker_notes_off",label:"删除备注"},{cmd:"SET_NODE_TAG",icon:"sell",label:"节点标签"},{cmd:"REMOVE_NODE_TAG",icon:"label_off",label:"删除标签"},{cmd:"SET_NODE_HYPERLINK",icon:"link",label:"插入超链接"},{cmd:"REMOVE_NODE_HYPERLINK",icon:"link_off",label:"删除超链接"}]},{cmd:"ADD_GENERALIZATION",icon:"call_merge",label:"添加概要"},{cmd:"REMOVE_GENERALIZATION",icon:"call_split",label:"删除概要"}],h=[{value:"logicalStructure",label:"逻辑结构图"},{value:"mindMap",label:"思维导图"},{value:"organizationStructure",label:"组织结构图"},{value:"catalogOrganization",label:"目录组织图"},{value:"timeline",label:"时间轴(左)"},{value:"timeline2",label:"时间轴(下)"},{value:"timeline3",label:"时间轴(上)"},{value:"verticalTimeline",label:"时间轴(竖)"},{value:"fishbone",label:"鱼骨图"},{value:"rightFishbone",label:"鱼骨图(右)"}],v=[{value:"curve",label:"曲线"},{value:"straight",label:"直线"},{value:"direct",label:"直连"}],g=[{value:"default",label:"默认主题"},{value:"classic",label:"经典"},{value:"dark",label:"暗色"},{value:"simple",label:"极简"},{value:"colorful",label:"缤纷"}],C=i.default.iconList||[];function O(e){const{t:n}=(0,o.Bd)(),[t,d]=(0,l.useState)(!0),[m,E]=(0,l.useState)(""),[O,T]=(0,l.useState)(100),[D,R]=(0,l.useState)("default"),[,j]=(0,s.fp)(u.AG.prompt_card),[y,w]=(0,l.useState)("mindMap"),[S,k]=(0,l.useState)(null),I=(0,l.useRef)(null),L=(0,l.useRef)(null),A=(0,l.useRef)(null),M=(0,l.useRef)(!1),Y=(0,l.useRef)({props:e});Y.current={props:e};const W=()=>{M.current||(M.current=!0,Y.current.props.on_dirty?.(!0))},V=async(e=!1)=>{if(!A.current)return e||(0,r.zN)(n("编辑器尚未就绪")),!1;const t=await Y.current.props.on_save((()=>{const e=A.current;return e?JSON.stringify(e.getData(!0)):""})(),e);return t&&(M.current=!1,Y.current.props.on_dirty?.(!1),Y.current.props.on_saved?.()),t};(0,l.useEffect)(()=>{e.register?.({save:V,is_dirty:()=>M.current})},[e.register]),(0,l.useEffect)(()=>{if(!I.current)return;if(!e.url&&void 0===e.data)return;let t=!1;const l=[];A.current?.destroy?.(),A.current=null,M.current=!1,d(!0),E("");const o=async e=>{if(t||!I.current)return;const a=e&&e.root?e:null,r=a?a.root:e??{data:{text:n("中心主题")}},o=new i.default({el:I.current,data:r,fit:!0,enableDblclickBackToRootNode:!0,enableShortcutOnlyWhenMouseInSvg:!0,autoMoveWhenMouseInEdgeOnDrag:!0,...c.k$});A.current=o,a&&o.setFullData(a),d(!1),R(o.getTheme?.()||"default"),w(o.getLayout?.()||"mindMap");window.requestAnimationFrame(()=>{t||(()=>{let e=!1;const n=window.setTimeout(()=>{t||(e=!0)},400);l.push(n),o.on("data_change",()=>{e&&(W(),T(x(o)))}),o.on("view_data_change",()=>{T(x(o))}),o.on("error",(e,n)=>{console.error("[mind]",e,n)}),T(x(o))})()})};return(async()=>{try{let n=null;if(void 0!==e.data)n=e.data;else{const l=await a.l.get(e.url);if(t)return;n=l}let l=null;if("string"==typeof n&&n.trim())try{l=JSON.parse(n)}catch{l=null}else n&&"object"==typeof n&&(l=n);l=(0,c.tW)(l),await o(l)}catch(e){t||(d(!1),E(n("加载思维导图失败")),(0,r.zN)(n("加载思维导图失败")))}})(),()=>{t=!0,l.forEach(e=>window.clearTimeout(e)),A.current?.destroy?.(),A.current=null}},[e.url,e.data]),(0,l.useEffect)(()=>{const e=e=>{(e.ctrlKey||e.metaKey)&&("s"===e.key||"S"===e.key||83===e.keyCode)&&(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),V())};return window.addEventListener("keydown",e,!0),document.addEventListener("keydown",e,!0),()=>{window.removeEventListener("keydown",e,!0),document.removeEventListener("keydown",e,!0)}},[]);const G=e=>{const n=A.current;if(!n)return;const t=Math.min(4,Math.max(.25,e));n.view.setScale(t),T(Math.round(100*t))},P={SET_NODE_NOTE:{title:"节点备注",placeholder:"请输入节点备注",get:e=>e.getData("note")||""},SET_NODE_TAG:{title:"节点标签",placeholder:"请输入节点标签,多个用逗号分隔",get:e=>(e.getData("tag")||[]).join(",")},SET_NODE_HYPERLINK:{title:"插入超链接",placeholder:"请输入链接地址",get:e=>e.getData("hyperlink")||""}};(0,l.useEffect)(()=>{if(!S)return;const e=()=>k(null),n=window.setTimeout(()=>{window.addEventListener("click",e),window.addEventListener("blur",e)},0);return()=>{window.clearTimeout(n),window.removeEventListener("click",e),window.removeEventListener("blur",e)}},[S]),(0,l.useEffect)(()=>{const e=L.current;if(!e)return;const n=e=>{const n=A.current?.renderer?.activeNodeList?.[0];n&&(e.preventDefault(),e.stopPropagation(),k({x:e.clientX,y:e.clientY,node:n}))};return e.addEventListener("contextmenu",n,!0),()=>e.removeEventListener("contextmenu",n,!0)},[]);const X=e=>e.map(e=>({v:e.cmd,r:(0,p.jsxs)("div",{className:"common-tag-center mind-menu-row",children:[(0,p.jsx)(_.In,{icon:e.icon,not_use_icon_style:!0}),(0,p.jsx)("span",{children:n(e.label)})]}),items:e.children?X(e.children):void 0})),H=e=>{const t=A.current,l=S;if(t&&l){if(k(null),"ADD_GENERALIZATION"===e||"REMOVE_GENERALIZATION"===e)return t.execCommand(e),void W();"SET_NODE_NOTE"!==e&&"SET_NODE_TAG"!==e&&"SET_NODE_HYPERLINK"!==e?"SET_NODE_ICON"!==e?e.startsWith("REMOVE_NODE_")?((e,n)=>{e&&("REMOVE_NODE_ICON"===n?A.current.execCommand("SET_NODE_ICON",e,[]):"REMOVE_NODE_NOTE"===n?A.current.execCommand("SET_NODE_NOTE",e,""):"REMOVE_NODE_TAG"===n?A.current.execCommand("SET_NODE_TAG",e,[]):"REMOVE_NODE_HYPERLINK"===n&&A.current.execCommand("SET_NODE_HYPERLINK",e,"",""),W())})(l.node,e):(t.execCommand(e,l.node),W()):(e=>{if(!e)return;const t=Array.isArray(e.getData("icon"))?e.getData("icon"):[];j({open:!0,title:n("插入图标"),context_div:(0,p.jsx)("div",{className:"prompt-icon-list",children:C.flatMap(n=>(n.list||[]).map((l,a)=>(0,p.jsx)("button",{type:"button",className:"prompt-icon-list__item",title:l.name,dangerouslySetInnerHTML:{__html:l.icon},onClick:()=>{A.current.execCommand("SET_NODE_ICON",e,[...t,`${n.type}_${l.name}`]),j({open:!1}),W()}},n.type+a)))}),cancel:()=>j({open:!1})})})(l.node):((e,t)=>{if(!e)return;const l=P[t],a=l.get(e);let r=a;j({open:!0,title:n(l.title),context_div:(0,p.jsx)(f,{initValue:a,placeholder:n(l.placeholder),multiline:!0,onChange:e=>r=e}),confirm:()=>{const n=r.trim();"SET_NODE_TAG"===t?A.current.execCommand(t,e,n.split(/[,,]/).map(e=>e.trim()).filter(Boolean)):"SET_NODE_HYPERLINK"===t?A.current.execCommand(t,e,n,n):A.current.execCommand(t,e,n),j({open:!1}),W()},cancel:()=>j({open:!1})})})(l.node,e)}};return(0,p.jsxs)("div",{className:"mind-wrap"+(e.fullscreen?" mind-wrap--full":""),children:[e.header,(0,p.jsxs)("div",{className:"mind-toolbar",children:[(0,p.jsx)("button",{type:"button",className:"mind-btn",title:n("添加子节点")+" (Tab)",onClick:()=>A.current?.execCommand?.("INSERT_CHILD_NODE"),children:(0,p.jsx)("span",{className:"material-icons",children:"account_tree"})}),(0,p.jsx)("button",{type:"button",className:"mind-btn",title:n("添加同级节点")+" (Enter)",onClick:()=>A.current?.execCommand?.("INSERT_NODE"),children:(0,p.jsx)("span",{className:"material-icons",children:"subdirectory_arrow_right"})}),(0,p.jsx)("button",{type:"button",className:"mind-btn",title:n("删除节点")+" (Delete)",onClick:()=>A.current?.execCommand?.("REMOVE_NODE"),children:(0,p.jsx)("span",{className:"material-icons",children:"delete"})}),(0,p.jsx)("span",{className:"mind-toolbar__sep"}),(0,p.jsx)("button",{type:"button",className:"mind-btn",title:n("撤销")+" (Ctrl+Z)",onClick:()=>A.current?.execCommand?.("BACK"),children:(0,p.jsx)("span",{className:"material-icons",children:"undo"})}),(0,p.jsx)("button",{type:"button",className:"mind-btn",title:n("重做")+" (Ctrl+Y)",onClick:()=>A.current?.execCommand?.("FORWARD"),children:(0,p.jsx)("span",{className:"material-icons",children:"redo"})}),(0,p.jsx)("span",{className:"mind-toolbar__sep"}),(0,p.jsxs)("span",{className:"mind-toolbar__zoom",children:[O,"%"]}),(0,p.jsx)("button",{type:"button",className:"mind-btn",title:n("缩小"),onClick:()=>G(x(A.current)/100-.2),children:(0,p.jsx)("span",{className:"material-icons",children:"remove"})}),(0,p.jsx)("button",{type:"button",className:"mind-btn",title:n("放大"),onClick:()=>G(x(A.current)/100+.2),children:(0,p.jsx)("span",{className:"material-icons",children:"add"})}),(0,p.jsx)("button",{type:"button",className:"mind-btn",title:n("适应窗口"),onClick:()=>{A.current?.view?.fit?.(),T(x(A.current))},children:(0,p.jsx)("span",{className:"material-icons",children:"fit_screen"})})]}),(0,p.jsxs)("div",{className:"mind-toolbar mind-toolbar--sub",children:[(0,p.jsx)("select",{className:"mind-select",title:n("结构"),value:y,onChange:e=>{const n=e.target.value;A.current?.setLayout?.(n),w(n),W()},children:h.map(e=>(0,p.jsx)("option",{value:e.value,children:n(e.label)},e.value))}),(0,p.jsxs)("select",{className:"mind-select",title:n("连线风格"),defaultValue:"",onChange:e=>{const n=e.target.value;if(n){const e=A.current?.getCustomThemeConfig?.()||{};A.current?.setThemeConfig?.({...e,lineStyle:n}),W()}e.target.value=""},children:[(0,p.jsx)("option",{value:"",children:n("连线风格")}),v.map(e=>(0,p.jsx)("option",{value:e.value,children:n(e.label)},e.value))]}),(0,p.jsx)("select",{className:"mind-select",title:n("主题"),value:D,onChange:e=>{const n=e.target.value;R(n),A.current?.setTheme?.(n),W()},children:g.map(e=>(0,p.jsx)("option",{value:e.value,children:n(e.label)},e.value))}),(0,p.jsx)("span",{className:"mind-toolbar__gap"})]}),(0,p.jsxs)("div",{className:"mind-canvas",ref:L,children:[(0,p.jsx)("div",{className:"mind-mount",ref:I}),t&&(0,p.jsx)("div",{className:"mind-mask",children:"Loading..."}),m&&(0,p.jsx)("div",{className:"mind-mask",children:m}),S&&(0,p.jsx)(b.rY,{click:()=>k(null),children:(0,p.jsx)(b.sw,{x:S.x,y:S.y,items:X(N),click:e=>H(e)})})]})]})}function x(e){const n=e?.view?.getTransformData?.()?.state?.scale;return"number"==typeof n&&n>0?Math.round(100*n):100}},28277(){}}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[6805],{47996(e,n,t){t.d(n,{d:()=>i});t(96540);var s=t(74848);function i(e){return(0,s.jsxs)("div",{className:"instance-item",children:[(0,s.jsxs)("div",{className:"instance-item__toolbar",children:[(0,s.jsx)("span",{className:"instance-item__label",children:e.title}),e.toolbar]}),e.children]})}},77481(e,n,t){t.d(n,{S:()=>c,X:()=>r});var s=t(96540),i=t(61443),l=t(74848);function r(e){const[n,t]=s.useState([]),r=(0,s.useRef)(-1),[c,a]=(0,s.useState)(-1),[o,d]=(0,s.useState)(-1);(0,s.useEffect)(()=>{e.children?t(Array.isArray(e.children)?e.children:[e.children]):t(e.rows)},[e.rows,e.children]);const _=()=>{r.current=-1,a(-1),d(-1)};return(0,l.jsxs)("table",{children:[(0,l.jsx)("thead",{children:(0,l.jsx)("tr",{children:e.headers?.map((n,t)=>{const s=!!e.filter&&(e.filter.column??0)===t;let r=n;if(s){const t=e.filter,s=t.options.find(e=>e.value===t.value);null!=t.value&&s&&(r=`${n} (${s.label})`)}return(0,l.jsx)("th",{className:s?"table-filter-col":"",children:s?(0,l.jsx)(i.l6,{value:e.filter.value,options:e.filter.options,onChange:e.filter.onChange,bare:!0,trigger_label:r}):n},t)})})}),(0,l.jsx)("tbody",{children:n.map((n,t)=>{const s=!!e.onRowDrag;return(0,l.jsx)("tr",{className:s?(c===t?"row-dragging":"")+(o===t?" row-drop-target":""):"",draggable:s,onContextMenu:()=>{e.handleContextMenu&&e.handleContextMenu(n)},onDragStart:e=>{s&&(r.current=t,a(t),e.dataTransfer.effectAllowed="move")},onDragOver:e=>{!s||r.current<0||(e.preventDefault(),e.dataTransfer.dropEffect="move",d(t))},onDrop:n=>{s&&(n.preventDefault(),(()=>{const n=r.current,t=o;_(),n<0||t<0||n===t||e.onRowDrag?.(n,t)})())},onDragEnd:_,children:n.map((t,s)=>{const i=s===n.length-1?"small":"";return(0,l.jsx)("td",{className:i,style:{width:e.width??"auto"},children:t},s)})},t)})})]})}function c(e){return(0,l.jsx)("div",{style:{display:e.isFlex?"flex":"block"},children:e.columns.map((e,n)=>(0,l.jsx)("div",{children:e},n))})}},36805(e,n,t){t.r(n),t.d(n,{default:()=>B});var s=t(96540),i=t(75725),l=t(22022),r=t(70447),c=t(85997),a=t(77481),o=t(61443),d=t(14284),_=t(53459),x=t(7523),h=t(34843),u=t(82893),p=t(62042),m=(t(23430),t(64694)),j=(t(21499),t(14944)),v=t(92275),f=t(6960),g=t(40505),w=t(4412),y=t(24659),S=t(74848);let C={};function b(){const{t:e,i18n:n}=(0,l.Bd)(),{initUserInfo:t,reloadUserInfo:b}=(0,s.useContext)(x.F),[k,I]=(0,h.fp)(u.AG.user_base_info),[A,P]=(0,s.useState)([]),$=(0,s.useRef)([]),[N,F]=(0,h.fp)(u.AG.prompt_card),K=(0,y.K)(),[B,U]=(0,s.useState)(),[D,E]=(0,s.useState)(void 0),[G,V]=(0,s.useState)(null),[q,M]=(0,s.useState)([]),[X,Z]=(0,s.useState)([]),z=[e("序号"),e("名称"),e("在线状态"),e("时间"),e("备注")],T=[e("序号"),e("服务端口"),e("转发ip"),e("转发端口"),e("开启"),e("备注")],W=[e("序号"),e("服务端口"),e("fwd_nm"),e("转发ip"),e("转发端口"),e("开启"),e("备注")],O=e=>null==e?"":(0,f.s)(e),H=async e=>{const n=await d.s9.post("server_bridge_get_one_fig",{server_client_num_id:e});if(n.code===_.m.Success){const e=n.data;for(const n of e)n.client_name=C?.[n.client_num_id]?.client_name??"";Z(e)}},R=async e=>{const n=void 0===e?G:e,t=await d.s9.get("server_client_get");if(t.code===_.m.Success){const e=t.data,s=[],i=[];C={},$.current=e.map(e=>e.client_num_id);for(const t of e)null!==n&&!!t.status!==n||(D?`${t.index}${t.client_name}${t.note}`.includes(D)&&s.push(t):s.push(t),i.push({label:t.client_name,value:t.client_num_id}),C[t.client_num_id]=t);P(s),M(i)}};(0,s.useEffect)(()=>{j.ws.addMsg(v.HK.tcp_forward_server_load,e=>{R()}),R()},[]);return(0,S.jsxs)(s.Fragment,{children:[(0,S.jsx)(w.aZ,{position:"right",children:B&&(0,S.jsx)("span",{children:`${B.client_name}${B.note?`(${B.note})`:""}`})}),(0,S.jsxs)(i.fI,{children:[(0,S.jsx)(i.VP,{widthPer:50,children:(0,S.jsx)(i.xh,{children:(0,S.jsx)(r.uF,{self_title:(0,S.jsx)("span",{className:" div-row ",children:(0,S.jsx)("h2",{children:e("客户端列表")})}),rightTopCom:(0,S.jsx)(o.Sm,{placeholder:e("过滤"),value:D,handleInputChange:e=>{E(e)},handlerEnter:()=>{R()}}),children:(0,S.jsx)(a.X,{headers:z,filter:{title:e("在线状态"),column:2,value:G,options:[{label:e("全部"),value:null},{label:e("在线"),value:!0},{label:e("离线"),value:!1}],onChange:e=>{V(e),R(e)}},rows:A.map((n,t)=>[(0,S.jsx)("p",{children:t}),(0,S.jsx)(r.xP,{children:n.client_name}),(0,S.jsx)(r.fq,{ok:n.status}),(0,S.jsx)(r.xP,{children:O(n.status?n.online_start_time:n.offline_time)}),(0,S.jsx)(r.xP,{children:n.note}),(0,S.jsxs)("div",{children:[(0,S.jsx)(c.rA,{icon:"edit",title:e("编辑"),onClick:()=>{U({...n}),H(n.client_num_id)}}),(0,S.jsx)(c.rA,{icon:"delete",title:e("删除"),onClick:()=>{F({open:!0,title:"share file",confirm:async()=>{F({open:!1}),await(async e=>{(await d.s9.post("server_client_del",{client_num_id:e})).code===_.m.Success&&((0,p.SK)("成功"),R())})(n.client_num_id)},context_div:(0,S.jsx)("div",{className:"card-content",children:e("确定删除这个吗客户端吗?")})})}})]})]),width:"10rem",onRowDrag:(e,n)=>{const t=(0,m.TI)(A,e,n);P(t);const s=A[e],i=A[n];if(!s||!i)return;const l=$.current,r=l.indexOf(s.client_num_id),c=l.indexOf(i.client_num_id);if(r<0||c<0)return;const a=[...l];a.splice(r,1),a.splice(c,0,s.client_num_id),$.current=a,d.s9.post("server_client_sort",{ids:a})}})})})}),(0,S.jsx)(i.VP,{widthPer:50,children:B?(0,S.jsxs)(i.xh,{children:[(0,S.jsxs)(r.Zp,{self_title:(0,S.jsxs)("span",{className:" div-row ",children:[(0,S.jsx)("h2",{children:`服务器 ${e("代理配置")}`})," "]}),rightBottomCom:(0,S.jsx)("div",{children:(0,S.jsx)(c.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await d.s9.post("server_client_save",B)).code===_.m.Success&&(0,p.SK)("成功")}})}),children:[(0,S.jsx)(i.Yh,{left:e("远程地址"),center:B?.client_remote_address??""}),(0,S.jsx)(i.Yh,{left:e(B?.status?"在线时间":"离线时间"),center:O(B?.status?B?.online_start_time:B?.offline_time)}),(0,S.jsx)(o.Sm,{placeholder:"名称",value:B.client_name,handleInputChange:e=>{B.client_name=e,U({...B})}}),(0,S.jsxs)("form",{children:[e("fc_pxy"),":",(0,S.jsx)(a.S,{isFlex:!0,columns:[(0,S.jsx)(o.U6,{value:1,context:e("开启"),selected:B.open_filecat,onchange:()=>{B.open_filecat=!B.open_filecat,U({...B})}}),(0,S.jsx)(o.U6,{value:1,context:e("关闭"),selected:!B.open_filecat,onchange:()=>{B.open_filecat=!B.open_filecat,U({...B})}})]})]}),B.open_filecat&&(0,S.jsxs)(s.Fragment,{children:[(0,S.jsxs)("form",{children:[e("fc_pxyw"),":",(0,S.jsx)(a.S,{isFlex:!0,columns:[(0,S.jsx)(o.U6,{value:1,context:e("开启"),selected:B.filecat_use_local_page,onchange:()=>{B.filecat_use_local_page=!B.filecat_use_local_page,U({...B})}}),(0,S.jsx)(o.U6,{value:1,context:e("关闭"),selected:!B.filecat_use_local_page,onchange:()=>{B.filecat_use_local_page=!B.filecat_use_local_page,U({...B})}})]})]}),(0,S.jsx)(o.Sm,{placeholderOut:e("fc_pxyr"),placeholder:"127.0.0.1:5567",value:B.filecat_proxy_host_port,handleInputChange:e=>{B.filecat_proxy_host_port=e,U({...B})}}),(0,S.jsx)(c.rA,{icon:"content_copy",title:e("fc_pxyc"),onClick:()=>{const e=`${window.location.origin}?tcp_client_num_id=${B.client_num_id}`;(0,g.lW)(e),(0,p.SK)(e)}}),(0,S.jsx)(c.rA,{icon:"open_in_new",title:e("fc_pxyo"),onClick:()=>{const e=`${window.location.origin}?tcp_client_num_id=${B.client_num_id}`;window.open(e,"_blank")}})]}),(0,S.jsx)(o.Sm,{placeholder:"备注",value:B.note,handleInputChange:e=>{B.note=e,U({...B})}}),(0,S.jsx)(c.rA,{icon:"add",onClick:()=>{B.proxy_fig_list.push({open:!1}),U({...B})},title:e("添加")}),e("代理"),(0,S.jsx)(a.X,{headers:T,rows:B.proxy_fig_list.map((n,t)=>[(0,S.jsx)("p",{children:t}),(0,S.jsx)(o.Sm,{value:n.server_port,handleInputChange:e=>{n.server_port=parseInt(e)},no_border:!0}),(0,S.jsx)(o.Sm,{value:n.proxy_host,handleInputChange:e=>{n.proxy_host=e},no_border:!0}),(0,S.jsx)(o.Sm,{value:n.proxy_port,handleInputChange:e=>{n.proxy_port=parseInt(e)},no_border:!0}),(0,S.jsx)(o.l6,{value:!!n.open,onChange:e=>{n.open=e,U({...B})},options:K,no_border:!0}),(0,S.jsx)(o.Sm,{value:n.note,handleInputChange:e=>{n.note=e},no_border:!0}),(0,S.jsx)("div",{children:(0,S.jsx)(c.rA,{icon:"delete",title:e("删除"),onClick:()=>{const e=[];for(let n=0;n<(B.proxy_fig_list.length??0);n++)n!==t&&e.push(B.proxy_fig_list[n]);B.proxy_fig_list=e,U({...B})}})})]),width:"10rem"})]}),(0,S.jsxs)(r.Zp,{self_title:(0,S.jsxs)("span",{className:" div-row ",children:[(0,S.jsx)("h2",{children:`${e("客户端")} ${e("桥接配置")}`}),(0,S.jsx)(c.rA,{title:"info",icon:"info",onClick:()=>{F({open:!0,title:"Info",confirm:async()=>{F({open:!1})},context_div:(0,S.jsx)("div",{className:"card-content",children:e("在客户端设置一个端口,访问这个端口把流量转发到另一个客户端所在网络环境内的第一个地址")})})}})]}),children:[(0,S.jsx)(c.rA,{icon:"add",onClick:()=>{X.push({open:!1,server_client_num_id:B.client_num_id}),Z([...X])},title:e("添加")}),e("代理"),(0,S.jsx)(a.X,{headers:W,rows:X.map((n,t)=>[(0,S.jsx)("p",{children:t}),(0,S.jsx)(o.Sm,{value:n.server_port,handleInputChange:e=>{n.server_port=parseInt(e)},no_border:!0}),(0,S.jsx)(o.Sm,{value:n.client_name,options:q,handleInputChange:e=>{const t=(e=>q.find(n=>String(n.value)===String(e)))(e);n.client_num_id=parseInt(String(t.value)),n.client_name=t.label,Z([...X])},no_border:!0}),(0,S.jsx)(o.Sm,{value:n.client_proxy_host,handleInputChange:e=>{n.client_proxy_host=e},no_border:!0}),(0,S.jsx)(o.Sm,{value:n.client_proxy_port,handleInputChange:e=>{n.client_proxy_port=parseInt(e)},no_border:!0}),(0,S.jsx)(o.l6,{value:!!n.open,onChange:e=>{n.open=e,Z([...X])},options:K,no_border:!0}),(0,S.jsx)(o.Sm,{value:n.note,handleInputChange:e=>{n.note=e},no_border:!0}),(0,S.jsxs)("div",{children:[(0,S.jsx)(c.rA,{icon:"delete",title:e("删除"),onClick:async()=>{if(null==n.id){const e=[];for(let n=0;n<(X.length??0);n++)n!==t&&e.push(X[n]);Z([...e])}else await(async(e,n)=>{(await d.s9.post("server_bridge_del_fig",{id:e})).code===_.m.Success&&((0,p.SK)("成功"),H(n))})(n.id,n.server_client_num_id)}}),null==n.id?(0,S.jsx)(c.rA,{icon:"add",title:e("添加"),onClick:async()=>{await(async e=>{if(null==e.client_num_id)return void(0,p.zN)("未选择转发送 client");(await d.s9.post("server_bridge_add_fig",e)).code===_.m.Success&&((0,p.SK)("成功"),H(e.server_client_num_id))})(n)}}):(0,S.jsx)(c.rA,{icon:"save",title:e("保存"),onClick:async()=>{await(async e=>{if(null==e.client_num_id)return void(0,p.zN)("未选择转发送 client");(await d.s9.post("server_bridge_edit_fig",e)).code===_.m.Success&&((0,p.SK)("成功"),H(e.server_client_num_id))})(n)}})]})]),width:"10rem"})]})]}):(0,S.jsx)(i.xh,{})})]})]})}var k=t(18840),I=t(7463);function A(e){const{t:n}=(0,l.Bd)(),[t,x]=(0,s.useState)([]),[h,u]=(0,s.useState)([]),[m,f]=(0,s.useState)([]),[g,w]=(0,s.useState)([]),C=[n("序号"),n("服务端口"),n("转发客户端名称")],b=[n("序号"),n("原客户端"),n("目标客户端"),n("待同步文件数量")],A=[n("序号"),n("port"),n("host"),n("名称"),n("key"),n("在线"),n("开启"),n("备注")],P=(0,y.K)(),$=async()=>{const e=await d.s9.get("client_get");if(e.code===_.m.Success){const n=e.data;x(n.list)}const n=await d.s9.get("client_bridge_get_all_fig");n.code===_.m.Success&&f(n.data);const t=await d.s9.get("client_sync_task_get");t.code===_.m.Success&&w(t.data)};(0,s.useEffect)(()=>($(),j.ws.sendData(v.HK.tcp_proxy_client_status,{}).then(()=>{const e=(0,I.s)(()=>$(),500);j.ws.addMsg(v.HK.tcp_proxy_client_status,e)}),()=>{j.ws.removeMsg(v.HK.tcp_proxy_client_status)}),[]);const N=async e=>{const n=new k.gE;n.index=e.index,n.key=e.key,n.serverIp=e.serverIp,n.serverPort=e.serverPort,n.open=e.open,n.client_name=e.client_name,n.client_num_id=e.client_num_id;(await d.s9.post("client_save",n)).code===_.m.Success?(0,p.SK)("保存成功"):(0,p.zN)("网络错误")};return(0,S.jsxs)("div",{children:[(0,S.jsxs)(i.fI,{children:[(0,S.jsx)(i.VP,{widthPer:33,maxWidth:"30rem",children:(0,S.jsxs)(r.Zp,{title:"",rightBottomCom:(0,S.jsx)(c.C3,{text:n("保存"),clickFun:()=>{t[0].index=0,N(t[0])}}),rightTopCom:(0,S.jsxs)("div",{children:[n("连接状态"),(0,S.jsx)(r.fq,{ok:!!t[0]?.status})]}),children:[(0,S.jsx)(o.Sm,{placeholder:`${n("服务器")} ip`,value:t[0]?.serverIp,handleInputChange:e=>{t[0].serverIp=e}}),(0,S.jsx)(o.Sm,{type:"number",placeholder:`${n("服务器")} port`,value:t[0]?.serverPort,handleInputChange:e=>{const n=parseInt(e);!isNaN(n)&&n>=0&&n<=65535&&(t[0].serverPort=n)}}),(0,S.jsx)(o.Sm,{placeholder:n("名称"),value:t[0]?.client_name,handleInputChange:e=>{t[0].client_name=e}}),(0,S.jsx)(o.Sm,{type:"password",placeholder:"key ",value:t[0]?.key,handleInputChange:e=>{t[0].key=e}}),(0,S.jsxs)("form",{children:[n("状态"),(0,S.jsx)(a.S,{isFlex:!0,columns:[(0,S.jsx)(o.U6,{value:1,context:n("开启"),selected:t[0]?.open,onchange:()=>{t[0].open=!t[0].open,x([...t])}}),(0,S.jsx)(o.U6,{value:1,context:n("关闭"),selected:!t[0]?.open,onchange:()=>{t[0].open=!t[0].open,x([...t])}})]})]})]})}),(0,S.jsx)(i.VP,{widthPer:60,maxWidth:"90rem",children:(0,S.jsxs)(r.Zp,{self_title:(0,S.jsxs)("span",{className:" div-row ",children:[(0,S.jsx)("h2",{children:n("更多服务器")})," "]}),children:[(0,S.jsx)(c.rA,{icon:"add",onClick:()=>{t.push({open:!1,is_new:!0}),x([...t])},title:n("添加")}),n("代理"),(0,S.jsx)(a.X,{headers:A,rows:t.slice(1).map((e,s)=>[(0,S.jsx)("p",{children:s}),(0,S.jsx)(o.Sm,{type:"number",value:e.serverPort,handleInputChange:n=>{const t=parseInt(n);!isNaN(t)&&t>=0&&t<=65535&&(e.serverPort=t)},no_border:!0}),(0,S.jsx)(o.Sm,{value:e.serverIp,handleInputChange:n=>{e.serverIp=n},no_border:!0}),(0,S.jsx)(o.Sm,{value:e.client_name,handleInputChange:n=>{e.client_name=n},no_border:!0}),(0,S.jsx)(o.Sm,{value:e.key,handleInputChange:n=>{e.key=n},no_border:!0}),(0,S.jsx)(r.fq,{ok:!!e.status}),(0,S.jsx)(o.l6,{value:!!e.open,onChange:n=>{e.open=n,x([...t])},options:P,no_border:!0}),(0,S.jsx)(o.Sm,{value:e.note,handleInputChange:n=>{e.note=n},no_border:!0}),(0,S.jsxs)("div",{children:[(0,S.jsx)(c.rA,{icon:"delete",title:n("删除"),onClick:async()=>{if(e.is_new){const e=[];for(let n=0;n<(t.length??0);n++)n!==s&&e.push(t[n]);x([...e])}else await(async e=>{(await d.s9.post("client_del",{index:e})).code===_.m.Success?((0,p.SK)("保存成功"),$()):(0,p.zN)("网络错误")})(s+1)}}),e.is_new?(0,S.jsx)(c.rA,{icon:"add",title:n("添加"),onClick:async()=>{e.index=s+1,await N(e)}}):(0,S.jsx)(c.rA,{icon:"save",title:n("保存"),onClick:async()=>{e.index=s+1,await N(e)}})]})]),width:"10rem"})]})})]}),(0,S.jsxs)(i.fI,{children:[!!m?.length&&(0,S.jsx)(i.VP,{widthPer:40,maxWidth:"40rem",children:(0,S.jsx)(r.Zp,{title:n("br_port"),children:(0,S.jsx)(a.X,{headers:C,rows:m.map((e,n)=>[(0,S.jsx)("p",{children:n}),(0,S.jsx)(r.xP,{children:e.server_port}),(0,S.jsx)(r.xP,{children:e.client_name})]),width:"10rem"})})}),!!g?.length&&(0,S.jsx)(i.VP,{widthPer:40,maxWidth:"40rem",children:(0,S.jsx)(r.Zp,{title:n("文件同步列表"),children:(0,S.jsx)(a.X,{headers:b,rows:g.map((e,n)=>[(0,S.jsx)("p",{children:n}),(0,S.jsx)(r.xP,{children:e.source_client_name}),(0,S.jsx)(r.xP,{children:e.target_client_name}),(0,S.jsx)(r.xP,{children:e.running_num})]),width:"10rem"})})})]})]})}function P(){const{t:e,i18n:n}=(0,l.Bd)(),{initUserInfo:t,reloadUserInfo:m}=(0,s.useContext)(x.F),[f,g]=(0,h.fp)(u.AG.user_base_info),[w,y]=(0,h.fp)(u.AG.prompt_card),[C,b]=(0,s.useState)(!1),[I,A]=(0,s.useState)([]),[P,$]=(0,s.useState)(null),[N,F]=(0,s.useState)([]),[K,B]=(0,s.useState)(void 0),[U,D]=(0,s.useState)(void 0),E=(0,s.useMemo)(()=>{const e=[...I];return null!=P?(e.sort((e,n)=>P?e.server_port-n.server_port:n.server_port-e.server_port),e):e},[I,P]),G=async()=>{const e=await d.s9.get("get_all_open_server_client_proxy_fig");if(e.code===_.m.Success){const n=[];for(const t of e.data)U?`${t.server_port}${t.client_name}${t.proxy_host}${t.server_port}${t.server_port_note}`.includes(U)&&n.push(t):n.push(t);A(n)}},V=async()=>{const e=await d.s9.get("server_get");e.code===_.m.Success&&(B(e.data.port),b(!!e.data.open),F(e.data.option_keys??[])),G()};(0,s.useEffect)(()=>{j.ws.addMsg(v.HK.tcp_forward_server_load,e=>{V()}),V()},[]);const q=async e=>{const n=new k.I;n.port=K,n.open=C,n.option_keys=N;(await d.s9.post("server_save",{fig:n,notice_client:e})).code===_.m.Success&&(0,p.SK)("成功")};return(0,S.jsxs)(i.fI,{children:[(0,S.jsx)(i.VP,{widthPer:33,children:(0,S.jsx)(i.xh,{children:(0,S.jsxs)(r.Zp,{title:e("服务器配置"),rightBottomCom:(0,S.jsxs)("div",{children:[(0,S.jsx)(c.C3,{text:e("sv_ntf"),clickFun:()=>{q(!0)}}),(0,S.jsx)(c.C3,{text:e("保存"),clickFun:()=>{q(!1)}})]}),children:[(0,S.jsx)(o.Sm,{placeholder:"port",value:K,handleInputChange:e=>{B(e)}}),(0,S.jsxs)("label",{children:[(0,S.jsx)(c.rA,{icon:"add",onClick:()=>{F([...N,""])},title:e("添加")}),e("key")]}),(N??[]).map((n,t)=>(0,S.jsxs)("div",{style:{display:"flex"},children:[(0,S.jsx)("div",{style:{width:"90%"},children:(0,S.jsx)(o.Sm,{type:"password",value:n,handleInputChange:e=>{N[t]=e,F([...N])}})}),(0,S.jsx)(c.rA,{icon:"delete",onClick:()=>{N.splice(t,1),F([...N])},title:e("删除")})]},t)),(0,S.jsxs)("form",{children:[e("状态"),":",(0,S.jsx)(a.S,{isFlex:!0,columns:[(0,S.jsx)(o.U6,{value:1,context:e("开启"),selected:C,onchange:()=>{b(!C)}}),(0,S.jsx)(o.U6,{value:1,context:e("关闭"),selected:!C,onchange:()=>{b(!C)}})]})]})]})})}),(0,S.jsx)(i.VP,{widthPer:50,children:(0,S.jsx)(i.xh,{children:(0,S.jsx)(r.uF,{self_title:(0,S.jsx)("span",{className:" div-row ",children:(0,S.jsx)("h2",{children:e("服务器")+e("端口映射")})}),rightTopCom:(0,S.jsx)(o.Sm,{placeholder:e("过滤"),value:U,handleInputChange:e=>{D(e)},handlerEnter:()=>{G()}}),children:(0,S.jsx)(a.X,{headers:[e("序号"),(0,S.jsx)(c.rA,{title:e("服务端口"),onClick:()=>{$(e=>!e)}}),e("转发ip"),e("转发端口"),"client "+e("名称"),e("开启"),e("备注")],rows:E.map((e,n)=>[(0,S.jsx)("p",{children:n}),(0,S.jsx)(r.xP,{children:e.server_port}),(0,S.jsx)(r.xP,{children:e.proxy_host}),(0,S.jsx)(r.xP,{children:e.proxy_port}),(0,S.jsx)(r.xP,{children:e.client_name}),(0,S.jsx)(r.fq,{ok:!!e.open_success}),(0,S.jsx)(r.xP,{children:e.server_port_note})]),width:"10rem"})})})})]})}var $=t(47996),N=t(78247);function F(){const{t:e,i18n:n}=(0,l.Bd)(),{initUserInfo:t,reloadUserInfo:m}=(0,s.useContext)(x.F),[j,v]=(0,h.fp)(u.AG.user_base_info),[f,g]=(0,h.fp)(u.AG.prompt_card),[,w]=(0,h.fp)(u.AG.confirm),[y,C]=(0,h.fp)(u.AG.editorSetting),[b,I]=(0,s.useState)([]),[A,P]=(0,s.useState)([]),F=[e("编号"),e("原客户端"),e("开启"),e("备注"),e("操作")],[K,B]=(0,s.useState)(null);(0,s.useEffect)(()=>{(async()=>{const e=await d.s9.get("server_client_get");if(e.code===_.m.Success){const n=e.data,t=[];for(const e of n)t.push({label:e.client_name,value:e.client_num_id});P(t),await U()}})()},[]);const U=async()=>{const e=await d.s9.get("sync_task_get");e.code===_.m.Success&&I(e.data)},D=e=>A.find(n=>String(n.value)===String(e))?.label??"",E=e=>A.find(n=>String(n.value)===String(e)),G=(e,n,t)=>{K?.targets&&(K.targets[e]={...K.targets[e],[n]:t},B({...K,targets:[...K.targets]}))},V=async e=>{(await d.s9.post("sync_task_save",e)).code===_.m.Success&&await U()};return(0,S.jsxs)(i.fI,{children:[(0,S.jsx)(i.VP,{widthPer:50,maxWidth:"40rem",children:(0,S.jsx)(i.xh,{children:(0,S.jsx)(r.uF,{self_title:(0,S.jsxs)("span",{className:" div-row ",children:[(0,S.jsx)("h2",{children:e("客户端文件同步")}),(0,S.jsx)(c.rA,{icon:"info",onClick:()=>{g({open:!0,title:"信息",context_div:(0,S.jsx)("div",{children:(0,S.jsxs)("ul",{children:[(0,S.jsx)("li",{children:e("sy_tp1")}),(0,S.jsx)("li",{children:e("sy_tp2")}),(0,S.jsx)("li",{children:e("sy_tp3")})]})})})},title:e("信息")})]}),rightTopCom:(0,S.jsx)("div",{children:(0,S.jsx)(c.rA,{icon:"add",title:e("添加"),onClick:()=>{B({open:!1,source_client_num_id:void 0,source_dir:"",targets:[],delete_missing:!0,is_new:!0})}})}),children:(0,S.jsx)(a.X,{headers:F,rows:b.map((n,t)=>[(0,S.jsx)("p",{children:t}),(0,S.jsx)(r.xP,{children:n.source_client_name}),(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(r.fq,{ok:!!n.open}),n.open?e("开启"):e("关闭")]}),(0,S.jsx)(r.xP,{children:n.note}),(0,S.jsxs)("div",{children:[(0,S.jsx)(c.rA,{icon:"edit",title:e("编辑"),onClick:()=>(e=>{B(JSON.parse(JSON.stringify(e)))})(n)}),(0,S.jsx)(c.rA,{icon:"sync",title:e("立即同步"),onClick:()=>(async n=>{if(!n.id||!n.open)return void(0,p.zN)(e("tsk_off"));const t=await d.s9.post("sync_task_rescan",{id:n.id});t.code===_.m.Success?(0,p.SK)(e("已触发同步")):(0,p.zN)(t.message??e("操作失败"))})(n)}),(0,S.jsx)(c.rA,{icon:"delete",title:e("删除"),onClick:()=>{w({open:!0,title:e("确定删除吗"),handle:async()=>{await(async n=>{(await d.s9.post("sync_task_del",{id:n})).code===_.m.Success&&((0,p.SK)(e("成功")),K?.id===n&&B(null),await U())})(n.id),w({open:!1,handle:null})}})}})]})]),width:"10rem"})})})}),(0,S.jsx)(i.VP,{widthPer:50,children:K&&(0,S.jsx)(i.xh,{children:(0,S.jsxs)(r.Zp,{self_title:(0,S.jsx)("span",{className:" div-row ",children:(0,S.jsx)("h2",{children:e(""+(K.is_new?"添加":"编辑"))})}),rightBottomCom:(0,S.jsxs)("div",{children:[(0,S.jsx)(c.rA,{icon:"cancel",title:e("取消"),onClick:()=>B(null)}),(0,S.jsx)(c.rA,{icon:"save",title:e("保存"),onClick:async()=>{if(!K)return;const n=K,t=await d.s9.post("sync_task_save",n);t.code===_.m.Success?((0,p.SK)(e("成功")),B(null),await U()):(0,p.zN)(t.message??e("操作失败"))}})]}),children:[(0,S.jsx)(o.BC,{label:e("开启"),label_width:"6rem",children:(0,S.jsx)(o.GL,{selected:!!K.open,onchange:()=>{B({...K,open:!K.open})}})}),(0,S.jsx)(o.BC,{label:e("备注"),label_width:"6rem",children:(0,S.jsx)(o.Sm,{value:K.note,handleInputChange:e=>{B({...K,note:e})}})}),(0,S.jsx)(o.BC,{label:e("原客户端"),label_width:"6rem",required:!0,children:(0,S.jsx)(o.Sm,{value:D(K.source_client_num_id),options:A,handleInputChange:e=>{const n=E(e);n&&B({...K,source_client_num_id:parseInt(String(n.value))})}})}),(0,S.jsx)(o.BC,{label:e("原目录"),label_width:"6rem",required:!0,children:(0,S.jsx)(o.Sm,{value:K.source_dir,placeholder:e("被同步的源目录"),handleInputChange:e=>{B({...K,source_dir:e})}})}),(0,S.jsx)("label",{children:e("目标列表")}),(K.targets??[]).map((n,t)=>(0,S.jsxs)($.d,{title:`${e("目标")}${t+1}`,toolbar:(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(o.BC,{label:e("全量同步"),label_width:"6rem",children:(0,S.jsx)(o.GL,{selected:!!n.full_sync,onchange:()=>G(t,"full_sync",!n.full_sync)})}),(0,S.jsx)(c.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{if(!K?.targets)return;const n=[...K.targets];n.splice(e,1),B({...K,targets:n})})(t)})]}),children:[(0,S.jsx)(o.BC,{label:e("客户端"),label_width:"6rem",required:!0,children:(0,S.jsx)(o.Sm,{value:D(n.client_num_id),options:A,handleInputChange:e=>{const n=E(e);n&&G(t,"client_num_id",parseInt(String(n.value)))}})}),(0,S.jsx)(o.BC,{label:e("目标目录"),label_width:"6rem",required:!0,children:(0,S.jsx)(o.Sm,{value:n.dir,handleInputChange:e=>G(t,"dir",e)})})]},t)),(0,S.jsxs)("div",{className:"div-row",children:[(0,S.jsx)(c.rA,{icon:"add",title:e("添加"),onClick:()=>{if(!K)return;const e=[...K.targets??[],{client_num_id:void 0,dir:"",full_sync:!1}];B({...K,targets:e})}}),(0,S.jsx)(c.rA,{icon:"edit",title:e("忽略目录"),onClick:()=>{var e;e=K,N.xK.set_value_temp(e.ignore_text??k.mo),C({model:"ace/mode/gitignore",open:!0,fileName:"",save:async n=>{e.ignore_text=n,B({...e}),N.xK.set_value_temp(""),await V(e)}})}})]})]})})})]})}var K=t(87361);function B(){const{t:e}=(0,l.Bd)(),n=[{index:1,name:e("客户端"),rto:"tcp_proxy_client/",component:(0,S.jsx)(A,{})},{index:2,name:e("服务端"),rto:"tcp_proxy_server_info/",component:(0,S.jsx)(P,{})},{index:3,name:`${e("客户端列表")}(${e("服务端")})`,rto:"tcp_proxy_server_client/",component:(0,S.jsx)(b,{})},{index:4,name:`${e("客户端功能")}(${e("服务端")})`,rto:"tcp_proxy_server_client_setting/",component:(0,S.jsx)(F,{})}];return(0,S.jsx)(i.W1,{optionList:n,father_route:K.o.net_proxy})}},6960(e,n,t){t.d(n,{s:()=>r});var s=t(72635);const i=1440,l=525600;function r(e){e=e>1e12?e:1e3*e;const n=Date.now(),t=Math.abs(n-e)/6e4;return t<1?s.Ay.t("小于一分钟"):t<60?`${t.toFixed(0)} ${s.Ay.t("分钟前")}`:t<i?`${(t/60).toFixed(0)} ${s.Ay.t("小时前")}`:t<43200?`${(t/i).toFixed(0)} ${s.Ay.t("天前")}`:t<l?`${(t/43200).toFixed(0)} ${s.Ay.t("月前")}`:`${(t/l).toFixed(0)} ${s.Ay.t("年前")}`}},24659(e,n,t){var s=t(22022);t.d(n,["K",0,()=>{const{t:e}=(0,s.Bd)();return[{title:e("是"),value:!0,color:"#28a745"},{title:e("否"),value:!1,color:"#666666"}]}])}}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[4091,7181],{48890(e,t,n){n.d(t,{Kw:()=>r,Tt:()=>i});var r=n(80952),i=(n(82327),n(1766),n(24854),n(90008),n(90846),n(40975),n(44286),n(30766),n(14973),n(69687),n(1234),n(47507),n(87268),n(34678),n(24522));const c=`https://gcore.jsdelivr.net/npm/ace-builds@${r.version}/src-min-noconflict/`;r.config.set("basePath",c),r.config.set("modePath",c),r.config.set("themePath",c),r.config.set("workerPath",c)},84091(e,t,n){n.r(t),n.d(t,{default:()=>d});var r=n(96540),i=(n(80952),n(48890)),c=n(34843),s=n(82893),a=n(78247),o=n(93245),l=n(23430),u=n(74848);function d(e){const t=(0,r.useRef)(null),[n,d]=(0,c.fp)(s.AG.user_base_info),[f,_]=(0,r.useState)(!1),m=(0,r.useRef)(f);m.current=f;const h=(0,r.useRef)(e.save);h.current=e.save;const v=(0,r.useRef)(e.on_dirty);v.current=e.on_dirty,(0,r.useEffect)(()=>{v.current?.(f)},[f]);const p=async e=>{if(!h.current||!m.current)return;!1!==await h.current(e)&&_(!1)},g=(0,r.useRef)(p);g.current=p;const x=(0,r.useRef)(e.register);x.current=e.register,(0,r.useEffect)(()=>{x.current?.({save:e=>g.current(e)})},[]),(0,o.a)(l.nE.ace,()=>!!h.current&&m.current,p);const w=n.user_data.theme?.includes("dark")?"cloud_editor_dark":"cloud9_day";return(0,r.useEffect)(()=>{const n=i.Kw.edit(t.current,{value:a.xK.get_value_temp(e.editor_id),showPrintMargin:!1,theme:`ace/theme/${w}`,mode:e.model??i.Tt.getModeForPath(e.name??"").mode,wrap:!1,highlightActiveLine:!1,fontSize:14,...e.options});return n.setOptions({}),n.container.addEventListener("wheel",function(e){e.preventDefault()}),n.focus(),n.on("change",function(t){_(!0),e.on_change&&e.on_change()}),t.current=n,n.formatCode=()=>{const e=i.Kw.require("ace/ext/beautify"),n=t.current;n&&e.beautify(n.session)},a.xK.set_editor_temp(n,e.editor_id),()=>{a.xK.delete_editor_temp(e.editor_id),n.destroy()}},[]),(0,u.jsx)("div",{ref:t,style:{height:"100%",width:"100%"}})}},57181(e,t,n){n.r(t),n.d(t,{default:()=>v});var r=n(96540),i=n(85997),c=n(57952),s=n(34843),a=n(82893),o=n(78247),l=(n(62042),n(84091)),u=n(34289),d=n(34251),f=n(99214),_=n(93245),m=n(23430),h=n(74848);function v(){const[e,t]=(0,s.fp)(a.AG.editorSetting),[n,v]=(0,r.useState)(!1),p=(0,r.useRef)(n);p.current=n;const[g,x]=(0,s.fp)(a.AG.fileShellShow),[w,E]=(0,s.fp)(a.AG.file_shell_hidden),b=(0,f.Cf)();async function k(){e.save&&n&&(await e.save(o.xK.get_editor_value()),o.xK.set_value_temp(""),v(!1))}const y=t=>{(t.ctrlKey||t.metaKey)&&"s"===t.key&&(t.preventDefault(),e.save&&n&&k())};return(0,r.useEffect)(()=>()=>{v(!1)},[e]),(0,r.useEffect)(()=>(document.addEventListener("keydown",y),()=>{document.removeEventListener("keydown",y)}),[n,e]),(0,_.a)(m.nE.ace,()=>!!e.save&&p.current,()=>k(),e.not_auto_save),e.open&&(0,h.jsxs)("div",{id:"editor-container",children:[(0,h.jsxs)(c.A,{ignore_tags:!0,left_children:[(0,h.jsx)(i.rA,{title:"取消",icon:"close",onClick:function(){o.xK.set_value_temp(""),t({open:!1,model:"",fileName:"",save:null}),e?.close?.()}},1),(0,h.jsx)("div",{children:e.fileName},2)],children:[e.menu_list&&e.menu_list,(e.can_format||(0,d.zr)(e.fileName))&&(0,h.jsx)(i.rA,{title:"格式化",icon:"data_object",onClick:function(){o.xK.get_editor()?.formatCode()}}),e.opt_shell&&b.can_terminal&&(0,h.jsx)(i.rA,{icon:"terminal",title:"shell",onClick:function(){g.show?E(!w):x({show:!0,path:(0,u.GG)("file",(0,u.vX)())})}}),n&&(0,h.jsx)(i.rA,{title:"保存",icon:"save",onClick:k}),(0,h.jsx)("title",{children:e.fileName})]}),(0,h.jsx)(l.default,{name:e.fileName,model:e.model,on_change:function(){n||v(!0)}})]})}},93245(e,t,n){n.d(t,{a:()=>o});var r=n(96540),i=n(34843),c=n(82893),s=n(23430);const a=[{id:s.nE.ace,label:"文本编辑器(ace)"},{id:s.nE.md,label:"md编辑器"},{id:s.nE.mind,label:"思维导图编辑器"},{id:s.nE.draw,label:"draw编辑器"},{id:s.nE.timeline,label:"时间线编辑器"},{id:s.nE.image,label:"图片编辑器"},{id:s.nE.excel,label:"excel编辑器"}];function o(e,t,n,s=!1){const[a]=(0,i.fp)(c.AG.user_base_info),o=a?.user_data?.editor_auto_save,l=(0,r.useRef)(o);l.current=o;const u=(0,r.useRef)(t);u.current=t;const d=(0,r.useRef)(n);d.current=n,(0,r.useEffect)(()=>{if(s)return;const t=l.current;if(!t?.enable||t.interval<=0||!t.editors?.includes(e))return;const n=setInterval(()=>{u.current()&&d.current(!0)},1e3*t.interval);return()=>clearInterval(n)},[o,e,s])}n.d(t,["d",0,a])}}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[735,6404,8277],{87943(e,n,t){"use strict";t.r(n),t.d(n,{default:()=>b});var a=t(96540),r=t(34843),l=t(82893),o=t(14284),i=t(62042),c=t(53459),s=t(34289),d=t(22022),u=t(35304),m=t(93245),f=t(23430),p=t(45907),_=t(74848);function b(){const[e,n]=(0,r.fp)(l.AG.mind_editor),[t,b]=(0,a.useState)(!1),{t:E}=(0,d.Bd)(),N=(0,p.y)(),v=(0,a.useRef)(null),h=void 0!==e.code_source,x=()=>{n({}),e?.close?.()},g=()=>{t?N({sub_title:E("有未保存的修改,确定要关闭吗?"),confirm_fun:x}):x()},C=async(e=!1)=>{await(v.current?.save(e))},O=(0,a.useRef)(t);return O.current=t,(0,m.a)(f.nE.mind,()=>!h&&O.current,e=>C(e),h),(0,a.useEffect)(()=>{if(void 0===e.url&&void 0===e.code_source)return;const n=e=>{"Escape"===e.key&&(e.stopPropagation(),g())};return document.addEventListener("keydown",n),()=>document.removeEventListener("keydown",n)},[e.url,e.code_source,t]),void 0!==e.url||h?(0,_.jsx)("div",{id:"mind-container",className:h?"mind-container--over":void 0,children:(0,_.jsx)("div",{className:"mind-context",children:(0,_.jsx)(u.default,{fullscreen:!0,reset_key:e.url??e.name,url:h?void 0:e.url,data:h?e.code_source:void 0,on_dirty:b,register:e=>{v.current=e},header:(0,_.jsxs)("div",{className:"mind-topbar",children:[(0,_.jsx)("span",{className:"material-icons mind-topbar__icon",children:"account_tree"}),(0,_.jsx)("span",{className:"mind-topbar__name",children:e.name}),(0,_.jsx)("span",{style:{flex:1}}),(0,_.jsx)("button",{type:"button",className:"mind-btn",title:E("保存")+" (Ctrl+S)",onClick:C,children:(0,_.jsx)("span",{className:"material-icons",children:"save"})}),(0,_.jsx)("button",{type:"button",className:"mind-btn",title:E("关闭"),onClick:g,children:(0,_.jsx)("span",{className:"material-icons",children:"close"})})]}),on_save:async(t,a)=>{if(h)return e.on_save_code?.(t),a||(0,i.SK)(E("保存成功")),n({}),!0;return(await o.$M.post(`save/${encodeURIComponent((0,s.GG)("file",(0,s.vX)()))}${e.name}`,{context:t})).code===c.m.Success&&(a||(0,i.SK)(E("保存成功")),!0)}})})}):null}},35304(e,n,t){"use strict";t.r(n),t.d(n,{default:()=>C});var a=t(96540),r=t(57889),l=(t(14284),t(62042)),o=t(22022),i=t(45602),c=(t(88781),t(86063));const s={classic:{backgroundColor:"#fafafa",lineColor:"#4d8f7f",lineWidth:2,root:{fillColor:"#4d8f7f",color:"#fff",borderRadius:6,paddingX:18,paddingY:8},second:{fillColor:"#fff",color:"#2f4f47",borderRadius:5,borderColor:"#4d8f7f",borderWidth:1,paddingX:14,paddingY:6},node:{fillColor:"#fff",color:"#3c3c3c",borderRadius:5,borderColor:"#a8d5c8",borderWidth:1,paddingX:12,paddingY:5}},dark:{backgroundColor:"#1f2226",lineColor:"#6b7c8c",lineWidth:1,root:{fillColor:"#3a4654",color:"#f2f4f6",borderRadius:6,paddingX:18,paddingY:8},second:{fillColor:"#2b323a",color:"#e6eaef",borderRadius:5,borderColor:"#4c5866",borderWidth:1,paddingX:14,paddingY:6},node:{fillColor:"#242a31",color:"#ccd3da",borderRadius:5,borderColor:"#3c454f",borderWidth:1,paddingX:12,paddingY:5}},simple:{backgroundColor:"#fff",lineColor:"#c8ccd0",lineWidth:1,root:{fillColor:"transparent",color:"#202124",borderRadius:0,borderWidth:0,paddingX:10,paddingY:4},second:{fillColor:"transparent",color:"#202124",borderRadius:0,borderWidth:0,paddingX:8,paddingY:3},node:{fillColor:"transparent",color:"#5f6368",borderRadius:0,borderWidth:0,paddingX:8,paddingY:3}},colorful:{backgroundColor:"#fffdf6",lineColor:"#f2a65a",lineWidth:2,root:{fillColor:"#f2854a",color:"#fff",borderRadius:24,paddingX:20,paddingY:9},second:{fillColor:"#ffd66b",color:"#6b4a12",borderRadius:16,borderWidth:0,paddingX:14,paddingY:6},node:{fillColor:"#a8d8ea",color:"#1e3f4d",borderRadius:12,borderWidth:0,paddingX:12,paddingY:5}}};var d=t(34843),u=t(82893),m=t(61443),f=t(74848);function p(e){const[n,t]=(0,a.useState)(e.initValue||""),r=n=>{t(n),e.onChange(n)};return e.multiline?(0,f.jsx)("div",{className:"prompt-input",children:(0,f.jsx)(m.Z2,{placeholder:e.placeholder||"",rows:e.rows??5,value:n,handleInputChange:r})}):(0,f.jsx)("div",{className:"prompt-input",children:(0,f.jsx)(m.Sm,{placeholder:e.placeholder||"",value:n,handleInputChange:r})})}var _,b=t(75725),E=t(85997);t(30576);_=i.default,Object.entries(s).forEach(([e,n])=>{_.defineTheme?.(e,n)});const N=[{cmd:"INSERT_CHILD_NODE",icon:"account_tree",label:"添加子节点"},{cmd:"INSERT_NODE",icon:"subdirectory_arrow_right",label:"添加同级节点"},{cmd:"INSERT_PARENT_NODE",icon:"arrow_upward",label:"插入父节点"},{cmd:"CUT_NODE",icon:"content_cut",label:"剪切"},{cmd:"PASTE_NODE",icon:"content_paste",label:"粘贴"},{cmd:"REMOVE_NODE",icon:"delete",label:"删除节点"},{cmd:"INSERT_GROUP",icon:"add_circle_outline",label:"插入",children:[{cmd:"SET_NODE_ICON",icon:"emoji_emotions",label:"插入图标"},{cmd:"REMOVE_NODE_ICON",icon:"format_clear",label:"删除图标"},{cmd:"SET_NODE_NOTE",icon:"sticky_note_2",label:"节点备注"},{cmd:"REMOVE_NODE_NOTE",icon:"speaker_notes_off",label:"删除备注"},{cmd:"SET_NODE_TAG",icon:"sell",label:"节点标签"},{cmd:"REMOVE_NODE_TAG",icon:"label_off",label:"删除标签"},{cmd:"SET_NODE_HYPERLINK",icon:"link",label:"插入超链接"},{cmd:"REMOVE_NODE_HYPERLINK",icon:"link_off",label:"删除超链接"}]},{cmd:"ADD_GENERALIZATION",icon:"call_merge",label:"添加概要"},{cmd:"REMOVE_GENERALIZATION",icon:"call_split",label:"删除概要"}],v=[{value:"logicalStructure",label:"逻辑结构图"},{value:"mindMap",label:"思维导图"},{value:"organizationStructure",label:"组织结构图"},{value:"catalogOrganization",label:"目录组织图"},{value:"timeline",label:"时间轴(左)"},{value:"timeline2",label:"时间轴(下)"},{value:"timeline3",label:"时间轴(上)"},{value:"verticalTimeline",label:"时间轴(竖)"},{value:"fishbone",label:"鱼骨图"},{value:"rightFishbone",label:"鱼骨图(右)"}],h=[{value:"curve",label:"曲线"},{value:"straight",label:"直线"},{value:"direct",label:"直连"}],x=[{value:"default",label:"默认主题"},{value:"classic",label:"经典"},{value:"dark",label:"暗色"},{value:"simple",label:"极简"},{value:"colorful",label:"缤纷"}],g=i.default.iconList||[];function C(e){const{t:n}=(0,o.Bd)(),[t,s]=(0,a.useState)(!0),[m,_]=(0,a.useState)(""),[C,j]=(0,a.useState)(100),[y,R]=(0,a.useState)("default"),[,T]=(0,d.fp)(u.AG.prompt_card),[D,w]=(0,a.useState)("mindMap"),[S,k]=(0,a.useState)(null),I=(0,a.useRef)(null),L=(0,a.useRef)(null),A=(0,a.useRef)(null),M=(0,a.useRef)(!1),Y=(0,a.useRef)({props:e});Y.current={props:e};const W=()=>{M.current||(M.current=!0,Y.current.props.on_dirty?.(!0))},G=async(e=!1)=>{if(!A.current)return e||(0,l.zN)(n("编辑器尚未就绪")),!1;const t=await Y.current.props.on_save((()=>{const e=A.current;return e?JSON.stringify(e.getData(!0)):""})(),e);return t&&(M.current=!1,Y.current.props.on_dirty?.(!1),Y.current.props.on_saved?.()),t};(0,a.useEffect)(()=>{e.register?.({save:G,is_dirty:()=>M.current})},[e.register]),(0,a.useEffect)(()=>{if(!I.current)return;if(!e.url&&void 0===e.data)return;let t=!1;const a=[];A.current?.destroy?.(),A.current=null,M.current=!1,s(!0),_("");const o=async e=>{if(t||!I.current)return;const r=e&&e.root?e:null,l=r?r.root:e??{data:{text:n("中心主题")}},o=new i.default({el:I.current,data:l,fit:!0,enableDblclickBackToRootNode:!0,enableShortcutOnlyWhenMouseInSvg:!0,autoMoveWhenMouseInEdgeOnDrag:!0,...c.k$});A.current=o,r&&o.setFullData(r),s(!1),R(o.getTheme?.()||"default"),w(o.getLayout?.()||"mindMap");window.requestAnimationFrame(()=>{t||(()=>{let e=!1;const n=window.setTimeout(()=>{t||(e=!0)},400);a.push(n),o.on("data_change",()=>{e&&(W(),j(O(o)))}),o.on("view_data_change",()=>{j(O(o))}),o.on("error",(e,n)=>{console.error("[mind]",e,n)}),j(O(o))})()})};return(async()=>{try{let n=null;if(void 0!==e.data)n=e.data;else{const a=await r.l.get(e.url);if(t)return;n=a}let a=null;if("string"==typeof n&&n.trim())try{a=JSON.parse(n)}catch{a=null}else n&&"object"==typeof n&&(a=n);a=(0,c.tW)(a),await o(a)}catch(e){t||(s(!1),_(n("加载思维导图失败")),(0,l.zN)(n("加载思维导图失败")))}})(),()=>{t=!0,a.forEach(e=>window.clearTimeout(e)),A.current?.destroy?.(),A.current=null}},[e.url,e.data]),(0,a.useEffect)(()=>{const e=e=>{(e.ctrlKey||e.metaKey)&&("s"===e.key||"S"===e.key||83===e.keyCode)&&(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),G())};return window.addEventListener("keydown",e,!0),document.addEventListener("keydown",e,!0),()=>{window.removeEventListener("keydown",e,!0),document.removeEventListener("keydown",e,!0)}},[]);const V=e=>{const n=A.current;if(!n)return;const t=Math.min(4,Math.max(.25,e));n.view.setScale(t),j(Math.round(100*t))},P={SET_NODE_NOTE:{title:"节点备注",placeholder:"请输入节点备注",get:e=>e.getData("note")||""},SET_NODE_TAG:{title:"节点标签",placeholder:"请输入节点标签,多个用逗号分隔",get:e=>(e.getData("tag")||[]).join(",")},SET_NODE_HYPERLINK:{title:"插入超链接",placeholder:"请输入链接地址",get:e=>e.getData("hyperlink")||""}};(0,a.useEffect)(()=>{if(!S)return;const e=()=>k(null),n=window.setTimeout(()=>{window.addEventListener("click",e),window.addEventListener("blur",e)},0);return()=>{window.clearTimeout(n),window.removeEventListener("click",e),window.removeEventListener("blur",e)}},[S]),(0,a.useEffect)(()=>{const e=L.current;if(!e)return;const n=e=>{const n=A.current?.renderer?.activeNodeList?.[0];n&&(e.preventDefault(),e.stopPropagation(),k({x:e.clientX,y:e.clientY,node:n}))};return e.addEventListener("contextmenu",n,!0),()=>e.removeEventListener("contextmenu",n,!0)},[]);const X=e=>e.map(e=>({v:e.cmd,r:(0,f.jsxs)("div",{className:"common-tag-center mind-menu-row",children:[(0,f.jsx)(E.In,{icon:e.icon,not_use_icon_style:!0}),(0,f.jsx)("span",{children:n(e.label)})]}),items:e.children?X(e.children):void 0})),K=e=>{const t=A.current,a=S;if(t&&a){if(k(null),"ADD_GENERALIZATION"===e||"REMOVE_GENERALIZATION"===e)return t.execCommand(e),void W();"SET_NODE_NOTE"!==e&&"SET_NODE_TAG"!==e&&"SET_NODE_HYPERLINK"!==e?"SET_NODE_ICON"!==e?e.startsWith("REMOVE_NODE_")?((e,n)=>{e&&("REMOVE_NODE_ICON"===n?A.current.execCommand("SET_NODE_ICON",e,[]):"REMOVE_NODE_NOTE"===n?A.current.execCommand("SET_NODE_NOTE",e,""):"REMOVE_NODE_TAG"===n?A.current.execCommand("SET_NODE_TAG",e,[]):"REMOVE_NODE_HYPERLINK"===n&&A.current.execCommand("SET_NODE_HYPERLINK",e,"",""),W())})(a.node,e):(t.execCommand(e,a.node),W()):(e=>{if(!e)return;const t=Array.isArray(e.getData("icon"))?e.getData("icon"):[];T({open:!0,title:n("插入图标"),context_div:(0,f.jsx)("div",{className:"prompt-icon-list",children:g.flatMap(n=>(n.list||[]).map((a,r)=>(0,f.jsx)("button",{type:"button",className:"prompt-icon-list__item",title:a.name,dangerouslySetInnerHTML:{__html:a.icon},onClick:()=>{A.current.execCommand("SET_NODE_ICON",e,[...t,`${n.type}_${a.name}`]),T({open:!1}),W()}},n.type+r)))}),cancel:()=>T({open:!1})})})(a.node):((e,t)=>{if(!e)return;const a=P[t],r=a.get(e);let l=r;T({open:!0,title:n(a.title),context_div:(0,f.jsx)(p,{initValue:r,placeholder:n(a.placeholder),multiline:!0,onChange:e=>l=e}),confirm:()=>{const n=l.trim();"SET_NODE_TAG"===t?A.current.execCommand(t,e,n.split(/[,,]/).map(e=>e.trim()).filter(Boolean)):"SET_NODE_HYPERLINK"===t?A.current.execCommand(t,e,n,n):A.current.execCommand(t,e,n),T({open:!1}),W()},cancel:()=>T({open:!1})})})(a.node,e)}};return(0,f.jsxs)("div",{className:"mind-wrap"+(e.fullscreen?" mind-wrap--full":""),children:[e.header,(0,f.jsxs)("div",{className:"mind-toolbar",children:[(0,f.jsx)("button",{type:"button",className:"mind-btn",title:n("添加子节点")+" (Tab)",onClick:()=>A.current?.execCommand?.("INSERT_CHILD_NODE"),children:(0,f.jsx)("span",{className:"material-icons",children:"account_tree"})}),(0,f.jsx)("button",{type:"button",className:"mind-btn",title:n("添加同级节点")+" (Enter)",onClick:()=>A.current?.execCommand?.("INSERT_NODE"),children:(0,f.jsx)("span",{className:"material-icons",children:"subdirectory_arrow_right"})}),(0,f.jsx)("button",{type:"button",className:"mind-btn",title:n("删除节点")+" (Delete)",onClick:()=>A.current?.execCommand?.("REMOVE_NODE"),children:(0,f.jsx)("span",{className:"material-icons",children:"delete"})}),(0,f.jsx)("span",{className:"mind-toolbar__sep"}),(0,f.jsx)("button",{type:"button",className:"mind-btn",title:n("撤销")+" (Ctrl+Z)",onClick:()=>A.current?.execCommand?.("BACK"),children:(0,f.jsx)("span",{className:"material-icons",children:"undo"})}),(0,f.jsx)("button",{type:"button",className:"mind-btn",title:n("重做")+" (Ctrl+Y)",onClick:()=>A.current?.execCommand?.("FORWARD"),children:(0,f.jsx)("span",{className:"material-icons",children:"redo"})}),(0,f.jsx)("span",{className:"mind-toolbar__sep"}),(0,f.jsxs)("span",{className:"mind-toolbar__zoom",children:[C,"%"]}),(0,f.jsx)("button",{type:"button",className:"mind-btn",title:n("缩小"),onClick:()=>V(O(A.current)/100-.2),children:(0,f.jsx)("span",{className:"material-icons",children:"remove"})}),(0,f.jsx)("button",{type:"button",className:"mind-btn",title:n("放大"),onClick:()=>V(O(A.current)/100+.2),children:(0,f.jsx)("span",{className:"material-icons",children:"add"})}),(0,f.jsx)("button",{type:"button",className:"mind-btn",title:n("适应窗口"),onClick:()=>{A.current?.view?.fit?.(),j(O(A.current))},children:(0,f.jsx)("span",{className:"material-icons",children:"fit_screen"})})]}),(0,f.jsxs)("div",{className:"mind-toolbar mind-toolbar--sub",children:[(0,f.jsx)("select",{className:"mind-select",title:n("结构"),value:D,onChange:e=>{const n=e.target.value;A.current?.setLayout?.(n),w(n),W()},children:v.map(e=>(0,f.jsx)("option",{value:e.value,children:n(e.label)},e.value))}),(0,f.jsxs)("select",{className:"mind-select",title:n("连线风格"),defaultValue:"",onChange:e=>{const n=e.target.value;if(n){const e=A.current?.getCustomThemeConfig?.()||{};A.current?.setThemeConfig?.({...e,lineStyle:n}),W()}e.target.value=""},children:[(0,f.jsx)("option",{value:"",children:n("连线风格")}),h.map(e=>(0,f.jsx)("option",{value:e.value,children:n(e.label)},e.value))]}),(0,f.jsx)("select",{className:"mind-select",title:n("主题"),value:y,onChange:e=>{const n=e.target.value;R(n),A.current?.setTheme?.(n),W()},children:x.map(e=>(0,f.jsx)("option",{value:e.value,children:n(e.label)},e.value))}),(0,f.jsx)("span",{className:"mind-toolbar__gap"})]}),(0,f.jsxs)("div",{className:"mind-canvas",ref:L,children:[(0,f.jsx)("div",{className:"mind-mount",ref:I}),t&&(0,f.jsx)("div",{className:"mind-mask",children:"Loading..."}),m&&(0,f.jsx)("div",{className:"mind-mask",children:m}),S&&(0,f.jsx)(b.rY,{click:()=>k(null),children:(0,f.jsx)(b.sw,{x:S.x,y:S.y,items:X(N),click:e=>K(e)})})]})]})}function O(e){const n=e?.view?.getTransformData?.()?.state?.scale;return"number"==typeof n&&n>0?Math.round(100*n):100}},93245(e,n,t){"use strict";t.d(n,{a:()=>c});var a=t(96540),r=t(34843),l=t(82893),o=t(23430);const i=[{id:o.nE.ace,label:"文本编辑器(ace)"},{id:o.nE.md,label:"md编辑器"},{id:o.nE.mind,label:"思维导图编辑器"},{id:o.nE.draw,label:"draw编辑器"},{id:o.nE.timeline,label:"时间线编辑器"},{id:o.nE.image,label:"图片编辑器"},{id:o.nE.excel,label:"excel编辑器"}];function c(e,n,t,o=!1){const[i]=(0,r.fp)(l.AG.user_base_info),c=i?.user_data?.editor_auto_save,s=(0,a.useRef)(c);s.current=c;const d=(0,a.useRef)(n);d.current=n;const u=(0,a.useRef)(t);u.current=t,(0,a.useEffect)(()=>{if(o)return;const n=s.current;if(!n?.enable||n.interval<=0||!n.editors?.includes(e))return;const t=setInterval(()=>{d.current()&&u.current(!0)},1e3*n.interval);return()=>clearInterval(t)},[c,e,o])}t.d(n,["d",0,i])},28277(){}}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[8358],{77481(e,t,s){s.d(t,{S:()=>l,X:()=>o});var n=s(96540),i=s(61443),a=s(74848);function o(e){const[t,s]=n.useState([]),o=(0,n.useRef)(-1),[l,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 u=()=>{o.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 o=t;if(n){const s=e.filter,n=s.options.find(e=>e.value===s.value);null!=s.value&&n&&(o=`${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:o}):t},s)})})}),(0,a.jsx)("tbody",{children:t.map((t,s)=>{const n=!!e.onRowDrag;return(0,a.jsx)("tr",{className:n?(l===s?"row-dragging":"")+(c===s?" row-drop-target":""):"",draggable:n,onContextMenu:()=>{e.handleContextMenu&&e.handleContextMenu(t)},onDragStart:e=>{n&&(o.current=s,r(s),e.dataTransfer.effectAllowed="move")},onDragOver:e=>{!n||o.current<0||(e.preventDefault(),e.dataTransfer.dropEffect="move",d(s))},onDrop:t=>{n&&(t.preventDefault(),(()=>{const t=o.current,s=c;u(),t<0||s<0||t===s||e.onRowDrag?.(t,s)})())},onDragEnd:u,children:t.map((s,n)=>{const i=n===t.length-1?"small":"";return(0,a.jsx)("td",{className:i,style:{width:e.width??"auto"},children:s},n)})},s)})})]})}function l(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))})}},88358(e,t,s){s.r(t),s.d(t,{default:()=>xe});var n=s(96540),i=s(75725),a=s(23430),o=s(70447),l=s(85997),r=s(61443),c=s(14284),d=s(53459),u=s(77481),h=s(22022),p=s(82893),m=s(40505),_=s(62042),x=s(21499),j=s(21469),v=s(64694),f=s(74848);function g(e){const{t}=(0,h.Bd)(),[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)(o.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e.title}),e.info_click&&(0,f.jsx)(l.rA,{icon:"info",onClick:()=>{e.info_click()},title:"信息"})]}),rightTopCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(l.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)(l.rA,{icon:"save",title:t("保存"),onClick:async()=>{e.save&&await e.save(s)}})]}),children:(0,f.jsx)(u.X,{headers:e.headers,rows:s.map((n,i)=>{const o=[];for(let t=0;t<e.headers.length;t++)o.push((0,f.jsx)(r.Sm,{value:n[t],handleInputChange:e=>{n[t]=e,a([...s])},no_border:!0}));return o.push((0,f.jsxs)("div",{children:[(0,f.jsx)(l.rA,{icon:"delete",title:t("删除"),onClick:()=>(e=>{s.splice(e,1),a([...s])})(i)}),n[0]&&(0,f.jsx)(l.rA,{icon:"content_copy",title:t("复制地址"),onClick:()=>{const e=(0,x.bi)(`${window.location.origin}${j.m.base_url}`,n[0]);(0,m.lW)(e),(0,_.SK)(e)}}),n[0]&&e.need_copy&&(0,f.jsx)(l.rA,{icon:"open_in_new",title:t("打开新页面"),onClick:()=>{const e=(0,x.bi)(`${window.location.origin}${j.m.base_url}`,n[0]);window.open(e)}})]})),o}),width:"10rem",onRowDrag:(e,t)=>{a((0,v.TI)(s,e,t))}})})})}var y=s(34843),w=s(78247),b=s(24659);function S(){const{t:e}=(0,h.Bd)(),[t,s]=(0,y.fp)(p.AG.prompt_card),a=(0,b.K)(),g=[e("路由"),e("auth"),e("备注")],[S,C]=(0,y.fp)(p.AG.editorSetting),[k,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)(o.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("api_rt")})," ",(0,f.jsx)(l.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:"信息"})]}),rightTopCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(l.rA,{icon:"add",title:e("添加"),onClick:()=>{A([{note:"",needAuth:!1,router:""},...k])}}),(0,f.jsx)(l.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await c.XO.post("api/customer_router/save",k)).code===d.m.Success&&(0,_.SK)("保存成功")}})]}),children:(0,f.jsx)(u.X,{headers:g,rows:k.map((t,s)=>{const n=[(0,f.jsx)(r.Sm,{value:t.router,handleInputChange:e=>{t.router=e,A([...k])},no_border:!0}),(0,f.jsx)(r.l6,{defaultValue:t.needAuth,onChange:e=>{t.needAuth=e,A([...k])},options:a,no_border:!0}),(0,f.jsx)(r.Sm,{value:t.note,handleInputChange:e=>{t.note=e,A([...k])},no_border:!0}),(0,f.jsxs)("div",{children:[(0,f.jsx)(l.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{k.splice(e,1),A([...k])})(s)}),(0,f.jsx)(l.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)}`);C({model:"ace/mode/javascript",open:!0,fileName:e.router,save:async t=>{const s={context:t,router:e.router};(await c.XO.post("jscode/save",s)).code===d.m.Success&&(w.xK.set_value_temp(""),C({open:!1,model:"",fileName:"",save:null}),(0,_.SK)("成功"))}}),w.xK.set_value_temp(t.data)})(t)}),t.router&&(0,f.jsx)(l.rA,{icon:"content_copy",title:e("复制地址"),onClick:()=>{(0,m.lW)((0,x.bi)(window.location.origin+j.m.base_url,t.router)),(0,_.SK)(e("已复制"))}})]})];return n}),width:"10rem",onRowDrag:(e,t)=>{A((0,v.TI)(k,e,t))}})})})}var C=s(23496),k=s(4412);function A(){const{t:e}=(0,h.Bd)(),[t,s]=(0,y.fp)(p.AG.prompt_card),[a,o]=(0,y.fp)(p.AG.router_jump),l=[e("路由"),e("路径"),e("过期时间(s)"),e("备注")],r=[e("路由"),e("文件路径"),"token","user id",e("备注")];return(0,f.jsxs)(n.Fragment,{children:[(0,f.jsx)(k.aZ,{position:"right"}),(0,f.jsxs)(i.fI,{children:[(0,f.jsxs)(i.VP,{maxWidth:"50rem",children:[(0,f.jsx)(g,{title:e("页面资源路由"),headers:l,getItems:async()=>{const e=await c.XO.get(C.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],o({})}return e.data}return[]},save:async e=>{(await c.XO.post(C.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(C.s.setting_customer_workflow_router);return e.code===d.m.Success?e.data:[]},save:async e=>{(await c.XO.post(C.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)(S,{})})]})]})}var I=s(74777),N=s(18840),V=s(6960),$=s(7523);function X(){const{t:e}=(0,h.Bd)(),{check_user_auth:t}=(0,w.MH)(),[s,i]=(0,n.useState)(!1),[u,m]=(0,n.useState)("https://registry.npmjs.org"),[x,j]=(0,n.useState)(""),[v,g]=(0,n.useState)(180),[b,S]=(0,n.useState)(!1),[C,k]=(0,y.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),m(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)(o.Zp,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("自动升级")}),(0,f.jsx)(l.rA,{icon:"info",onClick:()=>{k({open:!0,title:e("信息"),context_div:(0,f.jsx)("div",{children:e("自动升级在 windows 下目前可能不稳定")})})},title:e("信息")})]}),rightBottomCom:(0,f.jsx)(l.C3,{text:e("保存"),clickFun:async()=>{if(!u)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=u,t.exe_download_url=x,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:u,handleInputChange:e=>{m(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)(l.C3,{text:e(b?"升级检测中...":"立即升级"),clickFun:async()=>{S(!0);try{(await c.XO.post("auto_upgrade_setting/upgrade_now",{})).code===d.m.Success&&(0,_.SK)(e("已触发升级检测,请查看服务端日志"))}catch(t){(0,_.zN)(e("触发升级失败"))}finally{S(!1)}}})})]})]}):null}function F(){const{t:e}=(0,h.Bd)(),[,t]=(0,y.fp)(p.AG.prompt_card),[s,i]=(0,n.useState)(""),[a,m]=(0,n.useState)(5610),[x,j]=(0,n.useState)(5710);(0,n.useEffect)(()=>{(async()=>{const e=await c.XO.get("sys_option/status");if(e.code===d.m.Success){const t=e.data?.sys_env;i((t?.browser_proxy_allow||[]).join("\n")),m(t?.browser_proxy_port_start||5610),j(t?.browser_proxy_port_end||5710)}})()},[]);return(0,f.jsxs)(o.Zp,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("网页代理")}),(0,f.jsx)(l.rA,{icon:"info",title:e("信息"),onClick:()=>{t({open:!0,title:e("信息"),context_div:(0,f.jsx)("div",{children:(0,f.jsx)("div",{children:e("wbvpn_tip")})})})}})]}),rightBottomCom:(0,f.jsx)(l.C3,{text:e("确定修改"),clickFun:async()=>{const t=s.split("\n").map(e=>e.trim()).filter(e=>!!e);(await c.XO.post(C.s.setting_sys_option_status_save,{type:I.Mu.sys_env,value:{browser_proxy_allow:t,browser_proxy_port_start:Number(a)||5610,browser_proxy_port_end:Number(x)||5710}})).code===d.m.Success&&(0,_.SK)(e("修改成功"))}}),children:[(0,f.jsx)("div",{children:e("wbvpn_allow")}),(0,f.jsx)(r.Z2,{style:{minHeight:"5rem",resize:"vertical"},placeholder:e("wbvpn_allow_ph"),value:s,onChange:e=>{i(e.target.value)}}),(0,f.jsx)("div",{children:e("wbvpn_port_range")}),(0,f.jsx)(u.S,{isFlex:!0,columns:[(0,f.jsx)(r.Sm,{placeholder:"5610",value:a,handleInputChange:e=>m(e)}),(0,f.jsx)("span",{style:{padding:"0 6px"},children:"-"}),(0,f.jsx)(r.Sm,{placeholder:"5710",value:x,handleInputChange:e=>j(e)})]})]})}function K(){const[e,t]=(0,n.useState)(""),[s,a]=(0,n.useState)(""),[m,x]=(0,n.useState)(!1),[j,v]=(0,n.useState)(""),[g,b]=(0,n.useState)(!1),[S,A]=(0,n.useState)(""),[K,z]=(0,y.fp)(p.AG.prompt_card),[,B]=(0,y.fp)(p.AG.editorSetting),[O,P]=(0,n.useState)(I.aM.close),[T,E]=(0,n.useState)(!1),[M,D]=(0,n.useState)(void 0),[G,q]=(0,n.useState)(""),{t:R,i18n:W}=(0,h.Bd)(),[Z,U]=(0,y.fp)(p.AG.user_base_info),{check_user_auth:H}=(0,w.MH)(),{initUserInfo:J}=(0,n.useContext)($.F),Q=async()=>{const e=await c.XO.get("sys_option/status");if(e.code===d.m.Success){b(e.data.recycle_open),A(e.data.recycle_dir);const s=e.data.sys_env;t(s?.web_site_title),a(s?.logo||""),x(s?.show_login_user_info),v(s?.http_proxy||""),q(s?.control_env_str||N.CU)}const s=await c.XO.get("token");if(s.code===d.m.Success){const e=s.data;if(!e)return;e.length&&D(e.length),e.mode&&P(e.mode),void 0!==e.persist&&E(e.persist)}};(0,n.useEffect)(()=>{Q()},[]);return(0,f.jsxs)("div",{children:[(0,f.jsx)(k.aZ,{children:(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)("span",{className:"credits",children:[R("系统运行于"),": ",(0,V.s)(Z.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.20.3",null!=Z.latest_version&&"7.20.3"!==Z.latest_version?` -> ${Z.latest_version}`:""]})}),(0,f.jsx)("span",{className:"credits",children:(0,f.jsx)("a",{href:R("官网地址"),target:"_blank",children:`filecat ${R("功能文档")}`})}),(0,f.jsxs)("span",{className:"credits",children:[R("安装方式")," :",Z.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)(o.Zp,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:R("通用设置")})," ",(0,f.jsx)(l.rA,{icon:"info",onClick:()=>{z({open:!0,title:R("信息"),context_div:(0,f.jsx)("div",{children:(0,f.jsx)("div",{children:R("pxy_tip")})})})},title:R("信息")})]}),rightBottomCom:(0,f.jsx)(l.C3,{text:R("确定修改"),clickFun:async()=>{(await c.XO.post(C.s.setting_sys_option_status_save,{type:I.Mu.sys_env,value:{web_site_title:e,show_login_user_info:m,http_proxy:j,logo:s}})).code===d.m.Success&&((0,_.SK)("修改成功"),J())}}),rightTopCom:(0,f.jsx)(l.rA,{icon:"tune",title:R("环境控制"),onClick:()=>{w.xK.set_value_temp(G||N.CU),B({model:"ace/mode/yaml",open:!0,fileName:"",not_auto_save:!0,save:async e=>{const t=await c.XO.post(C.s.setting_sys_option_status_save,{type:I.Mu.sys_env,value:{control_env_str:e}});t.code===d.m.Success?(q(e),(0,_.SK)(R("修改成功")),Q()):(0,_.zN)(`${t.message??R("保存失败")}`)}})}}),children:[R("网站标题"),(0,f.jsx)(r.Sm,{value:e,handleInputChange:e=>{t(e)}}),R("网站 Logo"),(0,f.jsx)(r.Sm,{placeholder:R("lclorur"),value:s,handleInputChange:e=>{a(e)}}),(0,f.jsx)("div",{children:R("pxy_url")}),(0,f.jsx)(r.Sm,{placeholder:"http://127.0.0.1:7890",value:j,handleInputChange:e=>{v(e)}}),R("lgn_usr"),(0,f.jsx)("input",{type:"checkbox",checked:m,onChange:()=>{x(!m)}})]}),(0,f.jsx)(X,{}),(0,f.jsx)(F,{})]}),(0,f.jsxs)(i.VP,{widthPer:33,children:[(0,f.jsxs)(o.Zp,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:R("文件回收站")})," ",(0,f.jsx)(l.rA,{icon:"info",onClick:()=>{z({open:!0,title:R("信息"),context_div:(0,f.jsx)("div",{children:R("格式:[被删除的文件所在父目录] 回收站目录 [; ...]")})})},title:R("信息")})]}),rightBottomCom:(0,f.jsx)(l.C3,{text:R("确定修改"),clickFun:async()=>{if(g&&!S)return void(0,_.zN)("目录不能为空");(await c.XO.post(C.s.setting_sys_option_status_save,{type:I.Mu.cyc,value:S,open:g})).code===d.m.Success&&(0,_.SK)("修改成功")}}),children:[(0,f.jsx)(r.Sm,{placeholder:R("目录"),value:S,handleInputChange:e=>{A(e)}}),(0,f.jsx)(r.l6,{value:g,onChange:e=>{b(e)},options:[{title:R("开启"),value:!0},{title:R("关闭"),value:!1}]})]}),(0,f.jsxs)(o.Zp,{title:R("tk_exp"),rightBottomCom:(0,f.jsx)(u.S,{isFlex:!0,columns:[(0,f.jsx)(l.C3,{text:R("清空token"),clickFun:async()=>{(await c.XO.get("token/clear")).code===d.m.Success&&(0,_.SK)("清理完成,重新登录")}}),(0,f.jsx)(l.C3,{text:R("保存"),clickFun:async()=>{const e=new I.Gd;e.mode=O,e.persist=T,I.aM.length!==e.mode||M||(0,_.zN)("秒数不能为空"),e.length=parseInt(M);(await c.XO.post("token/save",e)).code===d.m.Success&&(0,_.SK)("保存成功")}})]}),children:[(0,f.jsx)(u.S,{isFlex:!0,columns:[(0,f.jsx)(r.U6,{value:1,context:R("关闭"),selected:O===I.aM.close,onchange:()=>{P(I.aM.close)}}),(0,f.jsx)(r.U6,{value:1,context:R("指定时间"),selected:O===I.aM.length,onchange:()=>{P(I.aM.length)}}),(0,f.jsx)(r.U6,{value:1,context:R("永不过期"),selected:O===I.aM.forver,onchange:()=>{P(I.aM.forver)}})]}),O===I.aM.length&&(0,f.jsx)(r.Sm,{placeholder:R("秒"),value:M,handleInputChange:e=>{D(e)}}),(0,f.jsxs)("label",{style:{display:"flex",alignItems:"center",gap:6,marginTop:8,whiteSpace:"nowrap"},children:[(0,f.jsx)("input",{type:"checkbox",checked:T,onChange:()=>E(!T)}),R("持久化")]})]})]})]})})]})}var z=s(92350),B=s(69675),O=s(32361);const P=[{key:"second",min:0,max:59,label:"秒"},{key:"minute",min:0,max:59,label:"分"},{key:"hour",min:0,max:23,label:"时"},{key:"day",min:1,max:31,label:"日"},{key:"month",min:1,max:12,label:"月"},{key:"week",min:0,max:7,label:"星期"}];function T(e){switch(e.mode){case"step":return`*/${e.step??1}`;case"range":return`${e.from??0}-${e.to??0}`;case"list":return(e.values??[]).join(",");default:return"*"}}function E(e){return[T(e.second),T(e.minute),T(e.hour),T(e.day),T(e.month),T(e.week)].join(" ")}function M(e,t,s){const n=(e??"").trim();if(!n)return null;if("*"===n)return{mode:"every"};if(n.startsWith("*/")){const e=Number(n.slice(2));return!Number.isInteger(e)||e<=0?null:{mode:"step",step:e}}if(n.includes("-")&&!n.includes(",")){const[e,i]=n.split("-").map(Number);return Number.isInteger(e)&&Number.isInteger(i)?e<t||i>s||e>i?null:{mode:"range",from:e,to:i}:null}const i=n.split(","),a=[];for(const e of i){const n=Number(e.trim());if(!Number.isInteger(n)||n<t||n>s)return null;a.push(n)}return 0===a.length?null:{mode:"list",values:a}}function D(e){const t=(e??"").trim().split(/\s+/);if(6!==t.length)return null;const s={};for(let e=0;e<6;e++){const n=P[e],i=M(t[e],n.min,n.max);if(!i)return null;s[n.key]=i}return s}function G(e){return e<10?`0${e}`:`${e}`}function q(e,t,s){switch(e.mode){case"step":return`每 ${e.step} ${t}`;case"range":return`${e.from} 到 ${e.to} ${t}`;case"list":return`${(e.values??[]).slice().sort((e,t)=>e-t).join("、")} ${t}`;default:return null}}function R(e){const{second:t,minute:s,hour:n,day:i,month:a,week:o}=e,l=(e,t)=>"list"===e.mode&&1===(e.values??[]).length&&e.values[0]===t,r=[];if("list"===n.mode&&"list"===s.mode&&l(t,0)){const e=(n.values??[]).slice().sort((e,t)=>e-t),t=(s.values??[]).slice().sort((e,t)=>e-t);e.length===t.length&&e.length>1&&t.length>1?r.push(e.map((e,s)=>`${G(e)}:${G(t[s])}`).join("、")):1===e.length&&1===t.length?r.push(`${G(e[0])}:${G(t[0])}`):r.push(`${e.map(G).join("、")} 时 ${t.join("、")} 分`)}else if("list"===n.mode&&"step"===s.mode&&l(t,0))r.push(`${(n.values??[]).map(G).join("、")} 时内每 ${s.step} 分钟`);else if("every"===n.mode&&"list"===s.mode&&l(t,0))r.push(`每小时的 ${(s.values??[]).join("、")} 分`);else if("every"===n.mode&&"step"===s.mode&&l(t,0))r.push(`每 ${s.step} 分钟`);else if("every"===n.mode&&"every"===s.mode&&l(t,0))r.push("每分钟");else if("every"===n.mode&&"every"===s.mode&&"step"===t.mode)r.push(`每 ${t.step} 秒`);else if("every"===n.mode&&"every"===s.mode&&"every"===t.mode)r.push("每秒");else if("every"===n.mode&&"every"===s.mode&&"list"===t.mode)r.push(`每分钟的第 ${(t.values??[]).join("、")} 秒`);else{const e=[],i=q(n,"时"),a=q(s,"分"),o=l(t,0)?null:q(t,"秒");i&&e.push(i),a&&e.push(a),o&&e.push(o),e.length>0&&r.push(e.join(" "))}const c="list"===i.mode&&1===(i.values??[]).length?i.values[0]:null,d="list"===a.mode&&1===(a.values??[]).length?a.values[0]:null,u="list"===o.mode&&1===(o.values??[]).length?o.values[0]:null;let h="";if(null!==d&&null!==c)h=`每年 ${d} 月 ${c} 号`;else if(null!==d)h=`每年 ${d} 月`;else if(null!==c)h=`每月 ${c} 号`;else if(null!==u)h=`每${["周日","周一","周二","周三","周四","周五","周六","周日"][u]??`星期 ${u}`}`;else{const e=[];"every"!==a.mode&&e.push(q(a,"月")),"every"!==i.mode&&e.push(q(i,"号")),"every"!==o.mode&&e.push(`星期 ${q(o,"")}`),e.length&&(h=e.join(" "))}h||(h="每天");const p=r.join(",");return/^(每|每天)/.test(p)?`${p}${"每天"===h?"":","+h} 执行`:`${h} ${p} 执行`}const W=[{label:"任意 (*)",value:"every"},{label:"每隔 (*/n)",value:"step"},{label:"区间 (a-b)",value:"range"},{label:"指定 (a,b)",value:"list"}];function Z(e,t,s=!1){const n=[];for(let i=e;i<=t;i++)n.push({label:s?String(i).padStart(2,"0"):String(i),value:i});return n}const U=({label:e,field:t,min:s,max:i,pad:a,week_label:o,onChange:l})=>{const c=(0,n.useMemo)(()=>Z(s,i,a),[s,i,a]),d=(0,n.useMemo)(()=>{if(!o)return c;const e=["周日","周一","周二","周三","周四","周五","周六","周日"];return c.map(t=>({value:t.value,label:`${t.value} (${e[t.value]})`}))},[c,o]);return(0,f.jsxs)("div",{className:"cron-field",children:[(0,f.jsx)("span",{className:"cron-field__label",children:e}),(0,f.jsx)(r.l6,{value:t.mode,onChange:e=>{l("every"===e?{mode:"every"}:"step"===e?{mode:"step",step:t.step??1}:"range"===e?{mode:"range",from:t.from??s,to:t.to??i}:{mode:"list",values:t.values??[s]})},options:W,no_border:!0,width:"7.5rem"}),"step"===t.mode&&(0,f.jsxs)("div",{className:"cron-field__param",children:[(0,f.jsx)("span",{children:"每"}),(0,f.jsx)(r.l6,{value:t.step??1,onChange:e=>l({mode:"step",step:e}),options:Z(1,i),no_border:!0,width:"4.5rem"}),(0,f.jsx)("span",{children:e})]}),"range"===t.mode&&(0,f.jsxs)("div",{className:"cron-field__param",children:[(0,f.jsx)(r.l6,{value:t.from??s,onChange:e=>l({mode:"range",from:e,to:t.to??i}),options:d,no_border:!0,width:"6.5rem"}),(0,f.jsx)("span",{children:"到"}),(0,f.jsx)(r.l6,{value:t.to??i,onChange:e=>l({mode:"range",from:t.from??s,to:e}),options:d,no_border:!0,width:"6.5rem"})]}),"list"===t.mode&&(0,f.jsxs)("div",{className:"cron-field__param cron-field__param--list",children:[(t.values??[]).map((e,s)=>(0,f.jsxs)("span",{className:"cron-tag",children:[(0,f.jsx)(r.l6,{value:e,onChange:e=>((e,s)=>{const n=[...t.values??[]];n[e]=s,l({mode:"list",values:n})})(s,e),options:d,no_border:!0,width:"6.5rem"}),(0,f.jsx)("i",{className:"material-icons cron-tag__del",onClick:()=>(e=>{const s=(t.values??[]).filter((t,s)=>s!==e);l(s.length?{mode:"list",values:s}:{mode:"every"})})(s),children:"close"})]},s)),(0,f.jsx)("i",{className:"material-icons cron-tag__add",onClick:()=>{const e=[...t.values??[]],n=new Set(e);let a=s;for(;n.has(a)&&a<i;)a++;l({mode:"list",values:[...e,a]})},children:"add"})]})]})};const H=[{label:"每分钟",make:()=>({second:{mode:"every"},minute:{mode:"every"},hour:{mode:"every"},day:{mode:"every"},month:{mode:"every"},week:{mode:"every"},second:{mode:"list",values:[0]}})},{label:"每 5 分钟",make:()=>({second:{mode:"every"},minute:{mode:"every"},hour:{mode:"every"},day:{mode:"every"},month:{mode:"every"},week:{mode:"every"},minute:{mode:"step",step:5},second:{mode:"list",values:[0]}})},{label:"每小时",make:()=>({second:{mode:"every"},minute:{mode:"every"},hour:{mode:"every"},day:{mode:"every"},month:{mode:"every"},week:{mode:"every"},minute:{mode:"list",values:[0]},second:{mode:"list",values:[0]}})},{label:"每天 0 点",make:()=>({second:{mode:"every"},minute:{mode:"every"},hour:{mode:"every"},day:{mode:"every"},month:{mode:"every"},week:{mode:"every"},hour:{mode:"list",values:[0]},minute:{mode:"list",values:[0]},second:{mode:"list",values:[0]}})},{label:"每天 8 点",make:()=>({second:{mode:"every"},minute:{mode:"every"},hour:{mode:"every"},day:{mode:"every"},month:{mode:"every"},week:{mode:"every"},hour:{mode:"list",values:[8]},minute:{mode:"list",values:[0]},second:{mode:"list",values:[0]}})},{label:"每周一 0 点",make:()=>({second:{mode:"every"},minute:{mode:"every"},hour:{mode:"every"},day:{mode:"every"},month:{mode:"every"},week:{mode:"every"},hour:{mode:"list",values:[0]},minute:{mode:"list",values:[0]},second:{mode:"list",values:[0]},week:{mode:"list",values:[1]}})},{label:"每月 1 号 0 点",make:()=>({second:{mode:"every"},minute:{mode:"every"},hour:{mode:"every"},day:{mode:"every"},month:{mode:"every"},week:{mode:"every"},hour:{mode:"list",values:[0]},minute:{mode:"list",values:[0]},second:{mode:"list",values:[0]},day:{mode:"list",values:[1]}})}],J=({value:e,onChange:t,no_border:s})=>{const[i,a]=(0,n.useState)(!1),o=(0,n.useRef)(null),l=(0,n.useRef)(null),r=(0,n.useMemo)(()=>D(e??"")??{second:{mode:"every"},minute:{mode:"every"},hour:{mode:"every"},day:{mode:"every"},month:{mode:"every"},week:{mode:"every"}},[e]),c=!!e&&!D(e??""),d=(0,O.r)({active:i,trigger_ref:o,floating_ref:l,width:384,max_height:26});(0,B.$)(i,[o,l],()=>a(!1));const u=e=>{t(E(e))};return(0,f.jsxs)("div",{className:"cron-input "+(i?"cron-input--open":""),children:[(0,f.jsxs)("div",{ref:o,className:"cron-input__display "+(s?"cron-input__display--no-border":""),title:c?"表达式格式不正确":`${e||""} ${R(r)}`.trim(),onClick:()=>a(!i),children:[(0,f.jsx)("span",{className:"cron-input__expr "+(c?"cron-input__expr--invalid":""),children:e||"(未设置)"}),!s&&(0,f.jsx)("span",{className:"cron-input__desc",children:c?"表达式格式不正确":R(r)}),(0,f.jsx)("i",{className:"material-icons cron-input__arrow",children:"arrow_drop_down"})]}),i&&(0,f.jsxs)("div",{ref:l,className:"cron-editor",style:{left:d.left,top:d.top,...d.css_vars,visibility:d.ready?"visible":"hidden"},children:[(0,f.jsxs)("div",{className:"cron-editor__scroll",children:[(0,f.jsxs)("div",{className:"cron-editor__row",children:[(0,f.jsx)("span",{className:"cron-editor__title",children:"常用"}),(0,f.jsx)("div",{className:"cron-editor__presets",children:H.map(e=>(0,f.jsx)("button",{className:"cron-preset",onClick:()=>u(e.make()),children:e.label},e.label))})]}),(0,f.jsx)("div",{className:"cron-editor__fields",children:P.map(e=>(0,f.jsx)(U,{label:e.label,field:r[e.key],min:e.min,max:e.max,pad:"day"!==e.key&&"month"!==e.key&&"week"!==e.key,week_label:"week"===e.key,onChange:t=>{return s=e.key,n=t,void u({...r,[s]:n});var s,n}},e.key))})]}),(0,f.jsxs)("div",{className:"cron-editor__footer",children:[(0,f.jsx)("span",{className:"cron-editor__preview",children:E(r)}),(0,f.jsx)("button",{className:"cron-editor__done",onClick:()=>a(!1),children:"完成"})]})]})]})};function Q(){const{t:e,i18n:t}=(0,h.Bd)(),{initUserInfo:s,reloadUserInfo:a}=(0,n.useContext)($.F),[m,x]=(0,n.useState)([]),[j,g]=(0,n.useState)([]),[S,C]=(0,y.fp)(p.AG.prompt_card),[,k]=(0,y.fp)(p.AG.editorSetting),[A,I]=(0,n.useState)([]),[N,V]=(0,n.useState)([]),[X,F]=(0,n.useState)([]),[K,B]=(0,n.useState)([]),[O,P]=(0,n.useState)(""),[T,E]=(0,n.useState)([]),M=(0,b.K)(),D=[e("软件"),e("是否安装"),e("路径")],G=[e("编号"),e("路径"),e("备注")],q=[e("编号"),e("路径"),e("是否开启"),e("备注")],R=[e("编号"),e("文件路径"),e("是否开启"),e("系统启动执行"),e("cron表达式"),e("用户id"),e("备注")],W=[e("编号"),e("路径"),e("单用户并发数量"),e("系统并发数量"),e("big_res"),e("big_sz"),e("大文件并发数量"),e("big_ck"),e("备注")],Z=[e("编号"),e("名称"),e("路径"),e("是否开启"),e("params"),e("备注")],{check_user_auth:U}=(0,w.MH)(),H=async()=>{const e=await c.XO.get("env/path/get");e.code===d.m.Success&&F(e.data)},Q=async()=>{const e=await c.XO.get("workflow_setting_get");e.code===d.m.Success&&B(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&&P(t.data),H(),Q();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&&V(n.data??[]);const i=await c.XO.get("plugin/list");i.code===d.m.Success&&E(i.data??[])})()},[]);const L=(0,z.Q)(),Y=async()=>{await c.XO.post("plugin/list/save",T)};return(0,f.jsxs)(n.Fragment,{children:[(0,f.jsx)(i.J,{widthPer:100,maxWidth:"100rem",children:(0,f.jsx)(o.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("up_conc")})," ",(0,f.jsx)(l.rA,{icon:"info",onClick:()=>{L("文件上传")},title:e("信息")})]}),rightTopCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(l.rA,{icon:"add",title:e("添加"),onClick:()=>{V([...N,{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)(l.rA,{icon:"save",title:e("保存"),onClick:async()=>{for(const e of N)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)(N,e=>e.index??0);(await c.XO.post("dir_upload_max_num/save",N)).code===d.m.Success&&((0,_.SK)("保存成功"),a())}})]}),children:(0,f.jsx)(u.X,{headers:W,rows:N.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,V([...N])},options:M,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)(l.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{N.splice(e,1),V([...N])})(s)})];return n}),width:"10rem",onRowDrag:(e,t)=>{V((0,v.TI)(N,e,t))}})})}),(0,f.jsx)(i.J,{widthPer:100,maxWidth:"100rem",children:(0,f.jsx)(o.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("Workflow Job")}),(0,f.jsx)(l.rA,{icon:"info",onClick:()=>{L("Workflow")},title:e("信息")})]}),rightTopCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(l.rA,{icon:"add",title:e("添加"),onClick:()=>{B([...K,{open:!1}])}}),(0,f.jsx)(l.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await c.XO.post("workflow_setting_save",K)).code===d.m.Success&&((0,_.SK)("ok"),Q())}})]}),children:(0,f.jsx)(u.X,{headers:R,rows:K.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,B([...K])},options:M,no_border:!0}),(0,f.jsx)(r.l6,{value:!!t.sys_power_on,onChange:e=>{t.sys_power_on=e,B([...K])},options:M,no_border:!0}),(0,f.jsx)(J,{value:t.cron_str,onChange:e=>{t.cron_str=e,B([...K])},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)(l.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{K.splice(e,1),B([...K])})(s)})];return n}),width:"10rem",onRowDrag:(e,t)=>{B((0,v.TI)(K,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)(o.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("PATH")}),(0,f.jsx)(l.rA,{icon:"info",onClick:()=>{L("环境路径")},title:e("信息")})]}),rightTopCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(l.rA,{icon:"list",title:e("查看"),onClick:async()=>{const t=await c.XO.get("env/process/view");t.code===d.m.Success?C({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)(l.rA,{icon:"edit",title:e("编辑"),onClick:async()=>{const t=await c.XO.get("env/process/get");t.code===d.m.Success?(w.xK.set_value_temp(t.data??""),k({model:"ace/mode/ini",open:!0,fileName:"",save:async e=>{await c.XO.post("env/process/save",{text:e})}})):(0,_.zN)(e("获取失败"))}}),(0,f.jsx)(l.rA,{icon:"add",title:e("添加"),onClick:()=>{F([...X,{path:"",note:""}])}}),(0,f.jsx)(l.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)(u.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:M,no_border:!0}),(0,f.jsx)(r.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,f.jsx)(l.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)(o.Zp,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("PTY CMD")}),(0,f.jsx)(l.rA,{icon:"info",onClick:()=>{L("pty")},title:e("信息")})]}),rightBottomCom:(0,f.jsx)(l.C3,{text:e("更新"),clickFun:async()=>{(await c.XO.post("pty_cmd/save",{str:O})).code===d.m.Success&&((0,_.SK)("保存成功"),a())}}),children:(0,f.jsx)(r.Sm,{placeholder:e("cmd need pty env"),value:O,handleInputChange:e=>{P(e)}})}),(0,f.jsx)(o.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("插件配置")}),(0,f.jsx)(l.rA,{icon:"info",onClick:()=>{L("插件配置")},title:e("信息")})]}),rightTopCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(l.rA,{icon:"add",title:e("添加"),onClick:()=>{E([...T,{name:"",path:"",note:"",open:!1}])}}),(0,f.jsx)(l.rA,{icon:"save",title:e("保存"),onClick:Y})]}),children:(0,f.jsx)(u.X,{headers:Z,rows:T.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,E([...T])},options:M,no_border:!0}),(0,f.jsx)(l.mu,{icon:"edit",value:t.params,save:async e=>{t.params=e,await Y()},title:""}),(0,f.jsx)(r.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,f.jsx)(l.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{T.splice(e,1),E([...T])})(s)})];return n}),width:"10rem",onRowDrag:(e,t)=>{E((0,v.TI)(T,e,t))}})})]})}),(0,f.jsx)(i.VP,{widthPer:50,maxWidth:"50rem",children:(0,f.jsxs)(i.xh,{children:[(0,f.jsx)(o.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("系统保护路径")})," ",(0,f.jsx)(l.rA,{icon:"info",onClick:()=>{L("保护目录")},title:e("信息")})]}),rightTopCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(l.rA,{icon:"add",title:e("添加"),onClick:()=>{I([...A,{path:"",note:""}])}}),(0,f.jsx)(l.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)(u.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)(l.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)(o.uF,{title:e("外部软件"),rightTopCom:(0,f.jsx)(l.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)(u.X,{headers:D,rows:j.map((t,s)=>[(0,f.jsx)("div",{children:t.id}),(0,f.jsx)(o.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)(l.rA,{icon:"info",onClick:()=>{L(t.id)},title:e("信息")})]),width:"10rem"})})]})})]})]})}function L(e){const{t,i18n:s}=(0,h.Bd)(),[i,o]=(0,y.fp)(p.AG.user_base_info),l=[{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("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("浏览器代理编辑"),permission:a.oV.browser_proxy_edit},{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:l.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 Y=new Map;function ee(){const{t:e,i18n:t}=(0,h.Bd)(),{initUserInfo:s,reloadUserInfo:m}=(0,n.useContext)($.F),[j,g]=(0,y.fp)(p.AG.user_base_info),[w,b]=(0,n.useState)([]),[S,C]=(0,y.fp)(p.AG.prompt_card),[k,A]=(0,n.useState)(!1),[I,N]=(0,n.useState)(!1),[V,X]=(0,y.fp)(p.AG.confirm),[F,K]=(0,n.useState)(""),[B,O]=(0,n.useState)(""),[P,T]=(0,n.useState)(""),[E,M]=(0,n.useState)([]),[D,G]=(0,n.useState)([]),[q,R]=(0,n.useState)([]),[W,Z]=(0,n.useState)(""),[U,H]=(0,n.useState)(""),[J,Q]=(0,n.useState)("en"),[ee,te]=(0,n.useState)(""),[se,ne]=(0,n.useState)([]),[ie,ae]=(0,n.useState)(""),[oe,le]=(0,n.useState)(!1),[re,ce]=(0,n.useState)(""),[de,ue]=(0,n.useState)(""),[he,pe]=(0,n.useState)({}),me=(0,z.o)(),[_e,xe]=(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);b(e)}else b(t)}const t=await c.wm.get("all_roles");if(t.code===d.m.Success){xe(t.data),Y.clear();for(const e of t.data)Y.set(e.role_id,e)}},ye=e=>{K(e?.username??""),O(e?.password??""),T(e?.cwd??""),M(e?.access_dirs??[]),G(e?.not_access_dirs??[]),R(e?.only_read_dirs??[]),Z(e?.access_cmd??""),H(e?.not_access_cmd??""),Q(e?.language??""),te(e?.theme??""),ne(e?.auth_list??[]),ae(e?.note??""),le(e?.is_root??!1),ce(e?.id??""),e?.bind_role_id?we(e.bind_role_id,e.auth_list??[]):(ue(""),pe({}))};(0,n.useEffect)(()=>{ge()},[]);const we=(e,t=[])=>{if(!e)return ue(""),void pe({});const s=Y.get(e);if(s){if(s.cwd&&T(s.cwd),s.access_dirs&&s.access_dirs.length>0&&M(s.access_dirs),s.not_access_dirs&&s.not_access_dirs.length>0&&G(s.not_access_dirs),s.only_read_dirs&&s.only_read_dirs.length>0&&R(s.only_read_dirs),s.access_cmd&&Z(s.access_cmd),s.not_access_cmd&&H(s.not_access_cmd),s.language&&Q(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))}ue(e),pe(s)}},be=()=>{if(!F)return void(0,_.zN)("username not empty");if((0,x.CB)(F))return void(0,_.zN)("username not empty char");if(!P)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=D,e.only_read_dirs=q,e.cwd=P,e.note=ie,e.access_cmd=W,e.not_access_cmd=U,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)(o.uF,{self_title:(0,f.jsx)("span",{className:" div-row ",children:(0,f.jsx)("h2",{children:e("用户")})}),rightTopCom:(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)(l.rA,{icon:"add",title:e("添加"),onClick:()=>{A(!0),N(!1),ye(void 0)}})]}),children:(0,f.jsx)(u.X,{headers:fe,rows:w.map((t,s)=>{const n=[(0,f.jsx)("p",{children:t.id}),(0,f.jsx)(o.xP,{children:t.username}),(0,f.jsx)(o.xP,{children:t.cwd}),(0,f.jsx)(o.xP,{children:t.note}),(0,f.jsxs)("div",{children:[(0,f.jsx)(l.rA,{icon:"edit",title:e("编辑"),onClick:()=>(e=>{A(!1),N(!0),ye(e)})(t)}),!t.is_root&&(0,f.jsx)(l.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:(k||I)&&(0,f.jsx)(i.xh,{children:(0,f.jsxs)(o.Zp,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e(""+(k?"添加":"编辑"))})," "]}),rightBottomCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(l.rA,{icon:"cancel",title:e("取消"),onClick:()=>{A(!1),N(!1),ye(void 0)}}),k&&(0,f.jsx)(l.rA,{icon:"add_circle",title:e("添加"),onClick:async()=>{if(!B)return void(0,_.zN)("password not empty");if((0,x.CB)(B))return void(0,_.zN)("username not empty char");const e=be(),t=await c.wm.post("create_user",e);ge(),t.code===d.m.Success&&((0,_.SK)("创建完成"),ge(),A(!1),N(!1),ye(void 0))}}),I&&(0,f.jsx)(l.rA,{icon:"save",title:e("保存"),onClick:async()=>{const e=be();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=>K(e)}),(0,f.jsx)("label",{children:e("密码")}),(0,f.jsx)(r.Sm,{type:"password",value:B,handleInputChange:e=>O(e)}),(0,f.jsxs)("label",{children:[!he?.access_dirs?.length&&(0,f.jsx)(l.rA,{icon:"add",onClick:()=>{M([...E,""])},title:"添加"}),e("目录范围")]}),(0,f.jsx)(r.Sm,{disabled:""!==he.cwd&&void 0!==he.cwd,value:P,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!==he?.access_dirs?.length&&void 0!==he?.access_dirs?.length,value:t,handleInputChange:e=>{E[s]=e,M([...E])}})}),0===he?.access_dirs?.length||void 0===he?.access_dirs?.length&&(0,f.jsx)(l.rA,{icon:"delete",onClick:()=>{E.splice(s,1),M([...E])},title:e("删除")})]},s)),(0,f.jsxs)("label",{children:[!he?.not_access_dirs?.length&&(0,f.jsx)(l.rA,{icon:"add",onClick:()=>{G([...D,""])},title:e("添加")}),e("禁止目录范围")]}),(D??[]).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!==he?.not_access_dirs?.length&&void 0!==he?.not_access_dirs?.length,value:t,handleInputChange:e=>{D[s]=e,G([...D])}})}),0===he?.not_access_dirs?.length||void 0===he?.not_access_dirs?.length&&(0,f.jsx)(l.rA,{icon:"delete",onClick:()=>{D.splice(s,1),G([...D])},title:e("删除")})]},s)),(0,f.jsxs)("label",{children:[!he?.only_read_dirs?.length&&(0,f.jsx)(l.rA,{icon:"add",onClick:()=>{R([...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!==he?.only_read_dirs?.length&&void 0!==he?.only_read_dirs?.length,value:t,handleInputChange:e=>{q[s]=e,R([...q])}})}),0===he?.only_read_dirs?.length||void 0===he?.only_read_dirs?.length&&(0,f.jsx)(l.rA,{icon:"delete",onClick:()=>{q.splice(s,1),R([...q])},title:e("删除")})]},s)),(0,f.jsx)("label",{children:e("可执行的命令")}),(0,f.jsx)(r.Sm,{disabled:""!==he.access_cmd&&void 0!==he.access_cmd,value:W,placeholder:"use blank split",handleInputChange:e=>Z(e)}),(0,f.jsx)("label",{children:e("禁止执行的命令")}),(0,f.jsx)(r.Sm,{disabled:""!==he.not_access_cmd&&void 0!==he.not_access_cmd,value:U,placeholder:"use blank split",handleInputChange:e=>H(e)}),!oe&&(0,f.jsxs)(n.Fragment,{children:[(0,f.jsx)("label",{children:e("角色")}),(0,f.jsx)(r.l6,{value:de,onChange:e=>{we(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:""!==he.language&&void 0!==he.language,value:J,onChange:e=>{Q(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:""!==he.theme&&void 0!==he.theme,value:ee,onChange:e=>{te(e)},options:me}),(0,f.jsx)(L,{is_disable:e=>{if(!0===oe)return!0;if(de){const t=Y.get(de);if(t)return(t.auth_list??[]).includes(e)}return!1},is_selected:(e,t)=>!t&&!0===oe||void 0!==se?.find(t=>t===e),select_auth:e=>{se?se.includes(e)?((0,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 te(){const{t:e,i18n:t}=(0,h.Bd)(),{initUserInfo:s}=(0,n.useContext)($.F),[m,x]=(0,n.useState)([]),[j,g]=(0,y.fp)(p.AG.prompt_card),[w,b]=(0,n.useState)(!1),[S,C]=(0,n.useState)(!1),[k,A]=(0,y.fp)(p.AG.confirm),[I,N]=(0,n.useState)(""),[V,X]=(0,n.useState)(""),[F,K]=(0,n.useState)([]),[B,O]=(0,n.useState)([]),[P,T]=(0,n.useState)([]),[E,M]=(0,n.useState)(""),[D,G]=(0,n.useState)(""),[q,R]=(0,n.useState)(""),[W,Z]=(0,n.useState)(""),[U,H]=(0,n.useState)([]),[J,Q]=(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&&x(e.data)},ie=e=>{N(e?.role_name??""),X(e?.cwd??""),K(e?.access_dirs??[]),O(e?.not_access_dirs??[]),T(e?.only_read_dirs??[]),M(e?.access_cmd??""),G(e?.not_access_cmd??""),R(e?.language??""),Z(e?.theme??""),H(e?.auth_list??[]),Q(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=q,e.theme=W,e.access_dirs=F,e.role_name=I,e.not_access_dirs=B,e.only_read_dirs=P,e.cwd=V,e.access_cmd=E,e.not_access_cmd=D,e.auth_list=U,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)(o.uF,{self_title:(0,f.jsx)("span",{className:" div-row ",children:(0,f.jsx)("h2",{children:e("角色")})}),rightTopCom:(0,f.jsx)("div",{children:(0,f.jsx)(l.rA,{icon:"add",title:e("添加"),onClick:()=>{b(!0),C(!1),ie(void 0)}})}),children:(0,f.jsx)(u.X,{headers:se,rows:m.map((t,s)=>{const n=[(0,f.jsx)("p",{children:t.role_id}),(0,f.jsx)(o.xP,{children:t.role_name}),(0,f.jsx)(o.xP,{children:t.role_note}),(0,f.jsxs)("div",{children:[(0,f.jsx)(l.rA,{icon:"edit",title:e("编辑"),onClick:()=>(e=>{b(!1),C(!0),ie(e)})(t)}),!t.is_root&&(0,f.jsx)(l.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:(w||S)&&(0,f.jsx)(i.xh,{children:(0,f.jsxs)(o.Zp,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e(""+(w?"添加":"编辑"))})," "]}),rightBottomCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(l.rA,{icon:"cancel",title:e("取消"),onClick:()=>{b(!1),C(!1),ie(void 0)}}),w&&(0,f.jsx)(l.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(),b(!1),C(!1),ie(void 0))}}),S&&(0,f.jsx)(l.rA,{icon:"save",title:e("保存"),onClick:async()=>{const e=ae();if(!e)return;e.role_id=J;(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=>N(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)(l.rA,{icon:"add",onClick:()=>{K([...F,""])},title:"添加"}),e("目录范围")]}),(0,f.jsx)(r.Sm,{value:V,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,K([...F])}})}),(0,f.jsx)(l.rA,{icon:"delete",onClick:()=>{F.splice(t,1),K([...F])},title:"删除"})]},t)),(0,f.jsxs)("label",{children:[(0,f.jsx)(l.rA,{icon:"add",onClick:()=>{O([...B,""])},title:"添加"}),e("禁止目录范围")]}),(B??[]).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=>{B[s]=e,O([...B])}})}),(0,f.jsx)(l.rA,{icon:"delete",onClick:()=>{B.splice(s,1),O([...B])},title:e("删除")})]},s)),(0,f.jsxs)("label",{children:[(0,f.jsx)(l.rA,{icon:"add",onClick:()=>{T([...P,""])},title:e("添加")}),e("只读目录范围")]}),(P??[]).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=>{P[t]=e,T([...P])}})}),(0,f.jsx)(l.rA,{icon:"delete",onClick:()=>{P.splice(t,1),T([...P])},title:"删除"})]},t)),(0,f.jsx)("label",{children:e("可执行的命令")}),(0,f.jsx)(r.Sm,{value:E,placeholder:"use blank split",handleInputChange:e=>M(e)}),(0,f.jsx)("label",{children:e("禁止执行的命令")}),(0,f.jsx)(r.Sm,{value:D,placeholder:"use blank split",handleInputChange:e=>G(e)}),(0,f.jsx)("label",{children:e("语言")}),(0,f.jsx)(r.l6,{value:q,onChange:e=>{R(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:W,onChange:e=>{Z(e)},options:te}),(0,f.jsx)(L,{is_disable:()=>!1,is_selected:(e,t)=>void 0!==U?.find(t=>t===e),select_auth:e=>{U?(U.find(t=>t==e)?(0,v.I)(U,t=>t===e):U.push(e),H([...U])):H([e])}})]})})})]})}var se=s(93245);function ne(e){const{t}=(0,h.Bd)(),[s,i]=(0,n.useState)((e.children_list??[]).map(e=>({path:e.path,note:e.note}))),a=[t("编号"),t("目录"),t("备注")],c=()=>{i([...s,{path:"",note:""}])};(0,n.useEffect)(()=>{s?.length||c()});return(0,f.jsx)(o.uF,{self_title:(0,f.jsx)("span",{className:" div-row ",children:(0,f.jsx)("h2",{children:t("sub_dir")})}),rightTopCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(l.rA,{icon:"add",title:t("添加"),onClick:c}),(0,f.jsx)(l.rA,{icon:"save",title:t("保存"),onClick:()=>{e.on_confirm(s.filter(e=>e.path))}}),(0,f.jsx)(l.rA,{icon:"close",title:t("取消"),onClick:e.on_cancel})]}),children:(0,f.jsx)(u.X,{headers:a,rows:s.map((e,n)=>[(0,f.jsx)("span",{children:n}),(0,f.jsx)(r.Sm,{value:e.path,handleInputChange:t=>{e.path=t},no_border:!0}),(0,f.jsx)(r.Sm,{value:e.note,handleInputChange:t=>{e.note=t},no_border:!0}),(0,f.jsx)("div",{children:(0,f.jsx)(l.rA,{icon:"delete",title:t("删除"),onClick:()=>{i(s.filter((e,t)=>t!==n))}})})]),width:"10rem"})})}function ie(){const{t:e,i18n:t}=(0,h.Bd)(),{initUserInfo:s,reloadUserInfo:m}=(0,n.useContext)($.F),[x,j]=(0,n.useState)([]),[g,w]=(0,y.fp)(p.AG.prompt_card),[S,k]=(0,n.useState)([]),[A,N]=(0,n.useState)([]),[V,X]=(0,n.useState)([]),[F,K]=(0,y.fp)(p.AG.user_base_info),B=(0,b.K)(),O=(0,z.o)(),P=[e("编号"),e("路径"),e("是否默认"),e("备注"),e("sub_dir")],T=[e("编号"),e("路径"),e("备注")],E=[e("编号"),e("命令"),e("父编号"),e("备注")],M=[e("文件后缀"),e("命令"),e("其他参数"),e("备注")],[D,G]=(0,n.useState)(""),[q,R]=(0,n.useState)(""),[W,Z]=(0,n.useState)(""),[U,H]=(0,n.useState)(!1),[J,Q]=(0,n.useState)(""),[L,Y]=(0,n.useState)(""),[ee,te]=(0,n.useState)(""),[ie,ae]=(0,n.useState)(!1),[oe,le]=(0,n.useState)(""),[re,ce]=(0,n.useState)([]);(0,n.useEffect)(()=>{(async()=>{const e=await c.XO.get("filesSetting");e.code===d.m.Success&&(j(e.data.dirs),N(e.data.quick_cmd),X(e.data.file_quick_cmd));const t=await c.XO.get("protection_dir");t.code===d.m.Success&&k(t.data??[])})(),Q(F?.user_data?.language),Y(F?.user_data?.theme),te(F?.user_data?.upload_file_ignore);const e=F?.user_data?.editor_auto_save;ae(!!e?.enable),le(null!=e?.interval?String(e.interval):""),ce(e?.editors??[])},[]);const de=(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)(o.Zp,{title:e("修改密码"),rightBottomCom:(0,f.jsx)(l.C3,{text:e("确定修改"),clickFun:async()=>{if(!D||!q)return void(0,_.zN)("账号密码不能为空");if(q!==W)return void(0,_.zN)("两次密码不一样");const e=new a.tl;e.username=D,e.password=q,e.confirm_password=W,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:D,handleInputChange:e=>{G(e)}}),(0,f.jsx)(r.cA,{placeholder:e("新密码"),handleInputChange:e=>{R(e)}}),(0,f.jsx)(r.cA,{placeholder:e("确认密码"),handleInputChange:e=>{Z(e)}})]})}),(0,f.jsx)(i.xh,{children:(0,f.jsxs)(o.Zp,{title:e("个性化设置"),rightBottomCom:(0,f.jsx)(l.C3,{text:e("确定修改"),clickFun:async()=>{(await c.XO.post(C.s.setting_sys_option_status_save,{type:I.Mu.private_sys_env,value:{language:J,theme:L,upload_file_ignore:ee}})).code===d.m.Success&&((0,_.SK)("修改成功"),s())}}),children:[e("语言"),(0,f.jsx)(r.l6,{value:J,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:L,onChange:e=>{Y(e)},options:O}),(0,f.jsx)(r.Sm,{value:ee,handleInputChange:e=>{te(e)},placeholderOut:e("拖拽文件上传忽略列表"),placeholder:"node_modules *.js",no_border:!0})]})}),(0,f.jsx)(i.xh,{children:(0,f.jsxs)(o.Zp,{title:e("编辑器自动保存"),rightBottomCom:(0,f.jsx)(l.C3,{text:e("确定修改"),clickFun:async()=>{const t=parseInt(String(oe),10);if(isNaN(t)||t<1)return void(0,_.zN)(e("请输入不小于 1 的整数(秒)"));(await c.wm.post(C.s.user_save_private_attr,{is_editor_auto_save:!0,editor_auto_save:{enable:ie,interval:t,editors:re}})).code===d.m.Success&&((0,_.SK)("修改成功"),s())}}),children:[(0,f.jsx)(r.BC,{label:e("开启"),children:(0,f.jsx)(r.l6,{value:ie,onChange:e=>{ae(e)},options:B,no_border:!0})}),(0,f.jsx)(r.BC,{label:e("自动保存间隔(秒)"),children:(0,f.jsx)(r.Sm,{type:"number",value:oe,handleInputChange:e=>{le(e)},placeholder:"30",no_border:!0})}),(0,f.jsx)("h3",{children:e("编辑器")}),se.d.map(t=>(0,f.jsxs)("div",{children:[(0,f.jsx)("input",{type:"checkbox",checked:re.includes(t.id),onChange:e=>{const s=e.target.checked;ce(s?[...re,t.id]:re.filter(e=>e!==t.id))}}),e(t.label)]},t.id))]})})]}),(0,f.jsxs)(i.VP,{children:[(0,f.jsxs)(i.xh,{children:[(0,f.jsx)(o.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("文件夹路径")})," ",(0,f.jsx)(l.rA,{icon:"info",onClick:()=>{de("文件夹路径")},title:e("信息")})]}),rightTopCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(l.rA,{icon:"add",title:e("添加"),onClick:()=>{j([...x,{note:"",default:!1,path:""}])}}),(0,f.jsx)(l.rA,{icon:"save",title:e("保存"),onClick:async()=>{for(let e=0;e<x.length;e++)x[e].index=e;(await c.XO.post("filesSetting/save",{dirs:x})).code===d.m.Success&&((0,_.SK)("保存成功"),m(),s())}})]}),children:(0,f.jsx)(u.X,{headers:P,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.default,onChange:e=>{((e,t,s)=>{const n=[];for(let e=0;e<x.length;e++)x[e].default=e===s&&t,n.push(x[e]);j(n)})(0,e,s)},options:B,no_border:!0}),(0,f.jsx)(r.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,f.jsxs)("div",{className:"div-row",children:[(0,f.jsx)("span",{children:t.children?.length??0}),0!==s&&(0,f.jsx)(l.rA,{icon:"folder_open",title:e("sub_dir"),onClick:()=>(e=>{w({open:!0,main_context_div:(0,f.jsx)(ne,{children_list:e.children,on_cancel:()=>{w({open:!1})},on_confirm:t=>{e.children=t,j([...x]),w({open:!1})}})})})(t)})]}),(0,f.jsx)("div",{children:0!==s&&(0,f.jsx)(l.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{x.splice(e,1),j([...x])})(s)})})];return n}),width:"10rem",onRowDrag:(e,t)=>{0!==e&&0!==t&&j((0,v.TI)(x,e,t))}})}),(0,f.jsx)(o.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("个人保护路径")})," ",(0,f.jsx)(l.rA,{icon:"info",onClick:()=>{de("保护目录")},title:e("信息")})]}),rightTopCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(l.rA,{icon:"add",title:e("添加"),onClick:()=>{k([...S,{path:"",note:""}])}}),(0,f.jsx)(l.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await c.XO.post("protection_dir/save",S)).code===d.m.Success&&((0,_.SK)("保存成功"),m())}})]}),children:(0,f.jsx)(u.X,{headers:T,rows:S.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)(l.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{S.splice(e,1),k([...S])})(s)})];return n}),width:"10rem",onRowDrag:(e,t)=>{k((0,v.TI)(S,e,t))}})})]}),(0,f.jsxs)(i.xh,{children:[(0,f.jsx)(o.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("目录快捷命令")}),(0,f.jsx)(l.rA,{icon:"info",onClick:()=>{de("目录快捷命令")},title:"info"})]}),rightTopCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(l.rA,{icon:"add",title:e("添加"),onClick:()=>{N([...A,{cmd:"",note:""}])}}),(0,f.jsx)(l.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)(u.X,{headers:E,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)(l.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{A.splice(e,1),N([...A])})(s)})];return n}),width:"10rem",onRowDrag:(e,t)=>{N((0,v.TI)(A,e,t))}})}),(0,f.jsx)(o.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("文件快捷命令")}),(0,f.jsx)(l.rA,{icon:"info",onClick:()=>{de("文件快捷命令")},title:"info"})]}),rightTopCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(l.rA,{icon:"add",title:e("添加"),onClick:()=>{X([...V,{cmd:"",note:"",file_suffix:"",params:""}])}}),(0,f.jsx)(l.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await c.XO.post("filesSetting/save",{file_quick_cmd:V})).code===d.m.Success&&((0,_.SK)("保存成功"),s())}})]}),children:(0,f.jsx)(u.X,{headers:M,rows:V.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)(l.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{V.splice(e,1),X([...V])})(s)})];return n}),width:"10rem",onRowDrag:(e,t)=>{X((0,v.TI)(V,e,t))}})})]})]})]})})}var ae=s(45907),oe=s(17903);const le=["password","private_key","secret_key"],re="webdav",ce="@authorize",de="@tcp_account",ue={smb:[{keys:["server","username","password"],on_next:"load_shares"},{keys:["share"]}],baidu:[{keys:["app_id","app_key","secret_key"],on_next:"save_app"},{keys:[ce]}],tcp_proxy:[{keys:["client_num_id"],on_next:"save_app"},{keys:[de]}]};function he(){const{t:e}=(0,h.Bd)(),t=(0,ae.y)(),[,s]=(0,y.fp)(p.AG.prompt_card),[i,a]=(0,n.useState)([]),[d,m]=(0,n.useState)([]),[x,j]=(0,n.useState)(!1),[v,g]=(0,n.useState)(""),[w,b]=(0,n.useState)(re),[S,C]=(0,n.useState)(""),[k,A]=(0,n.useState)({}),[I,N]=(0,n.useState)(1),[V,$]=(0,n.useState)([]),[X,F]=(0,n.useState)({}),[K,z]=(0,n.useState)("oob"),[B,O]=(0,n.useState)(""),[P,T]=(0,n.useState)(null),[E,M]=(0,n.useState)(!0),D=async()=>{try{const[e,t]=await Promise.all([c.I2.post("credential/list",{}),c.I2.post("credential/meta",{})]);a(Array.isArray(e?.data)?e.data:[]),m(Array.isArray(t?.data)?t.data:[])}catch(e){}};(0,n.useEffect)(()=>{D()},[]);const G=d.find(e=>e.type===w)?.fields??[],q=ue[w],R=q?.length??1,W=()=>{j(!1),g(""),b(re),C(""),A({}),N(1),$([]),O(""),M(!0)},Z=async e=>{const t=Array.from(new Set(e.map(e=>e.options_source).filter(e=>Boolean(e)))),s={};for(const e of t){const t=await c.I2.post("credential/options",{source:e});s[e]=(t?.data??[]).map(e=>({label:e.label,value:e.value}))}F(s)},U=t=>{if(!S.trim())return e("请填写备注");for(const s of G){if(!1===t.includes(s.key))continue;const n=String(k[s.key]??"").trim()||v&&le.includes(s.key);if(s.required&&!n)return e(s.label)}},H=async()=>{try{const e=await c.I2.post("baidu/authorize_url",{id:v,mode:K});e?.data&&window.open(e.data,"_blank","noopener,noreferrer")}catch(e){}},J=async()=>{if(B.trim())try{const t=await c.I2.post("baidu/exchange",{id:v,code:B.trim(),mode:K});(0,_.SK)(`${e("授权成功")}:${t?.data?.baidu_name??""}`),O(""),await D()}catch(e){}else(0,_.zN)(e("请填写授权码"))},Q=async()=>{if(P)if(P.account_name.trim())try{await c.I2.post("credential/account_save",{credential_id:v,account_id:P.id,note:P.note,account_name:P.account_name,password:P.password}),(0,_.SK)(e("已保存")),T(null),await D()}catch(e){}else(0,_.zN)(e("请填写对端账号"))},L=q?.[I-1]?.keys??G.map(e=>e.key),Y=L.includes(ce),ee=L.includes(de),te=I===R,se=R>1;return(0,f.jsxs)(o.Zp,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("凭证管理")}),(0,f.jsx)(l.rA,{icon:"info",title:e("信息"),onClick:()=>{s({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("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")]}),(0,f.jsxs)("li",{children:[(0,f.jsx)("b",{children:"SMB"}),":",e("prt_smb")]}),(0,f.jsxs)("li",{children:[(0,f.jsx)("b",{children:"百度网盘"}),":",e("prt_bd")]}),(0,f.jsxs)("li",{children:[(0,f.jsx)("b",{children:e("本地目录")}),":",e("prt_local")]})]})]})})}})]}),rightBottomCom:(0,f.jsxs)("div",{children:[!x&&(0,f.jsx)(l.rA,{icon:"add",title:e("添加"),onClick:()=>{W(),j(!0)}}),x&&(0,f.jsxs)(f.Fragment,{children:[se&&I>1&&(0,f.jsx)(l.rA,{icon:"arrow_back",title:e("上一步"),onClick:()=>N(I-1)}),se&&!te&&(0,f.jsx)(l.rA,{icon:"arrow_forward",title:e("下一步"),onClick:async()=>{const t=U(q?.[I-1]?.keys??[]);if(t)return void(0,_.zN)(`${e("请填写")}${t}`);const s=q?.[I-1]?.on_next;try{if("load_shares"===s&&!await(async()=>{const t=await c.I2.post("share/list",{driver:w,id:v||void 0,config:{server:k.server,username:k.username,password:k.password}}),s=t?.data??[];return s.length?($(s.map(e=>({label:e.name,value:e.name}))),!0):((0,_.zN)(e("没有找到共享")),!1)})())return;if("save_app"===s&&!await(async()=>{try{const e=await c.I2.post(v?"credential/update":"credential/add",{id:v||void 0,type:w,note:S,config:k,enabled:E});return!v&&e?.data?.id&&g(e.data.id),!0}catch(e){return!1}})())return;N(I+1)}catch(e){}}}),(!se||te)&&(0,f.jsx)(l.rA,{icon:"save",title:e("保存"),onClick:async()=>{const t=U(G.map(e=>e.key));if(t)(0,_.zN)(`${e("请填写")}${t}`);else try{await c.I2.post(v?"credential/update":"credential/add",{id:v||void 0,type:w,note:S,config:k,enabled:E}),(0,_.SK)(e("保存成功")),W(),await D()}catch(e){}}}),(0,f.jsx)(l.rA,{icon:"cancel",title:e("取消"),onClick:W})]})]}),children:[x&&(0,f.jsxs)(n.Fragment,{children:[(0,f.jsx)(r.Sm,{placeholder:e("备注"),value:S,handleInputChange:C}),(0,f.jsx)(r.l6,{value:w,options:d.map(e=>({title:e.name,value:e.type})),onChange:e=>{b(e),A({}),$([]),F({}),N(1),O("");const t=d.find(t=>t.type===e)?.fields??[];t.some(e=>e.options_source)&&Z(t)}}),Y?(()=>{const s=i.find(e=>e.id===v)?.accounts??[];return(0,f.jsxs)(n.Fragment,{children:[(0,f.jsx)(r.BC,{label:e("授权方式"),label_width:"6rem",children:(0,f.jsxs)("div",{className:"div-row",children:[(0,f.jsx)(r.U6,{name:"baidu_auth_mode",value:"one_click",context:e("一键授权"),selected:"one_click"===K,onchange:()=>z("one_click")}),(0,f.jsx)(r.U6,{name:"baidu_auth_mode",value:"oob",context:e("outh_ob"),selected:"oob"===K,onchange:()=>z("oob")})]})}),"oob"===K&&(0,f.jsx)(r.BC,{label:e("授权码"),label_width:"6rem",children:(0,f.jsx)(r.Sm,{placeholder:e("粘贴授权码 code"),value:B,handleInputChange:O})}),(0,f.jsxs)("div",{className:"div-row",children:[(0,f.jsx)(l.rA,{icon:"open_in_new",title:e("去授权"),onClick:H}),"oob"===K&&(0,f.jsx)(l.rA,{icon:"check",title:e("完成授权"),onClick:J})]}),s.length>0&&(0,f.jsx)(u.X,{headers:[e("账号名"),e("百度账号"),e("授权状态"),e("使用"),e("授权时间"),e("操作")],rows:s.map(s=>[(0,f.jsx)(o.xP,{context:s.note||s.account_name||s.id}),(0,f.jsx)(o.xP,{context:s.account_name||s.id}),(0,f.jsx)(o.xP,{context:s.authorized?e("已授权"):e("未授权")}),(0,f.jsx)(o.xP,{context:!1===s.enabled?e("停用"):e("启用")}),(0,f.jsx)("p",{children:s.obtained_at?(0,oe.eK)(s.obtained_at):"-"}),(0,f.jsxs)("div",{children:[(0,f.jsx)(l.rA,{icon:"network_check",title:e("授权检测"),onClick:()=>(async(t,s)=>{try{const n=await c.I2.post("baidu/verify",{id:t,account_id:s}),i=n?.data??{};i.valid?(0,_.SK)(e("账号可用")):(0,_.zN)(`${e("账号不可用")}:${i.error??""}`),await D()}catch(e){}})(v,s.id)}),(0,f.jsx)(l.rA,{icon:"delete",title:e("删除"),onClick:()=>((s,n)=>{t({title:e("确认删除"),sub_title:n.note||n.account_name||n.id,confirm_fun:async()=>{try{await c.I2.post("baidu/deauthorize",{id:s,account_id:n.id}),(0,_.SK)(e("已删除")),await D()}catch(e){}}})})(v,s)})]})])})]},ce)})():ee?(()=>{const s=i.find(e=>e.id===v)?.accounts??[];return(0,f.jsxs)(n.Fragment,{children:[(0,f.jsx)("div",{className:"div-row",children:(0,f.jsx)(r.BC,{label:e("备注"),label_width:"6rem",children:(0,f.jsx)(r.Sm,{placeholder:e("便于辨认的名字"),value:P?.note??"",handleInputChange:e=>T({...P??{note:"",account_name:"",password:""},note:e})})})}),(0,f.jsxs)("div",{className:"div-row",children:[(0,f.jsx)(r.BC,{label:e("对端账号"),label_width:"6rem",children:(0,f.jsx)(r.Sm,{placeholder:e("对端 FileCat 登录名"),value:P?.account_name??"",handleInputChange:e=>T({...P??{note:"",account_name:"",password:""},account_name:e})})}),(0,f.jsx)(r.BC,{label:e("对端密码"),label_width:"6rem",children:(0,f.jsx)(r.Sm,{placeholder:e("留空表示不修改"),value:P?.password??"",handleInputChange:e=>T({...P??{note:"",account_name:"",password:""},password:e})})})]}),(0,f.jsxs)("div",{className:"div-row",children:[(0,f.jsx)(l.rA,{icon:"save",title:e("保存账号"),onClick:Q}),P&&(0,f.jsx)(l.rA,{icon:"close",title:e("取消"),onClick:()=>T(null)})]}),s.length>0&&(0,f.jsx)(u.X,{headers:[e("备注"),e("对端账号"),e("密码"),e("操作")],rows:s.map(s=>[(0,f.jsx)(o.xP,{context:s.note||s.account_name||s.id}),(0,f.jsx)(o.xP,{context:s.account_name||s.id}),(0,f.jsx)(o.xP,{context:s.has_password?e("已设置"):e("未设置")}),(0,f.jsxs)("div",{className:"div-row",children:[(0,f.jsx)(l.rA,{icon:"network_check",title:e("验证登录"),onClick:()=>(async t=>{const s=P?.id===t.id;try{const n=await c.I2.post("credential/account_verify",{credential_id:v,account_id:t.id,account_name:s?P.account_name:t.account_name,password:s?P.password:void 0}),i=n?.data??{};i.ok?(0,_.SK)(e("账号可用")):(0,_.zN)(`${e("账号不可用")}:${i.error??""}`)}catch(e){}})(s)}),(0,f.jsx)(l.rA,{icon:"edit",title:e("编辑"),onClick:()=>T({id:s.id,note:s.note??"",account_name:s.account_name??"",password:""})}),(0,f.jsx)(l.rA,{icon:"delete",title:e("删除"),onClick:()=>(s=>{t({title:e("确认删除"),sub_title:s.note||s.account_name||s.id,confirm_fun:async()=>{try{await c.I2.post("credential/account_remove",{credential_id:v,account_id:s.id}),(0,_.SK)(e("已删除")),await D()}catch(e){}}})})(s)})]})])})]},de)})():G.filter(e=>L.includes(e.key)).map(t=>{if(t.options_source)return(0,f.jsx)(r.BC,{label:e(t.label),label_width:"6rem",children:(0,f.jsx)(r.l6,{value:k[t.key]??"",options:X[t.options_source]??[],onChange:e=>A({...k,[t.key]:e})})},t.key);if("share"===t.key&&"smb"===w)return(0,f.jsx)(r.BC,{label:e(t.label),label_width:"6rem",children:(0,f.jsx)(r.l6,{value:k[t.key]??"",options:V,onChange:e=>A({...k,[t.key]:e})})},t.key);const s="password"===t.type;return(0,f.jsx)(n.Fragment,{children:(0,f.jsx)(r.Sm,{type:s?"password":"text",placeholder:t.label,value:k[t.key]??"",handleInputChange:e=>A({...k,[t.key]:e})})},t.key)})]}),!x&&(0,f.jsx)(u.X,{headers:[e("备注"),e("类型"),e("操作")],rows:i.map(s=>{return[(0,f.jsx)(o.xP,{context:s.note}),(0,f.jsx)(o.xP,{context:(n=s.type,d.find(e=>e.type===n)?.name??n)}),(0,f.jsxs)("div",{children:[(0,f.jsx)(l.rA,{icon:"edit",title:e("编辑"),onClick:()=>(e=>{j(!0),g(e.id),b(e.type),C(e.note??""),A({...e.config??{}}),O(""),M(!1!==e.enabled),N(ue[e.type]?.length??1),"smb"===e.type&&c.I2.post("share/list",{driver:"smb",id:e.id,config:e.config??{}}).then(e=>{$((e?.data??[]).map(e=>({label:e.name,value:e.name})))}).catch(()=>{});const t=d.find(t=>t.type===e.type)?.fields??[];t.some(e=>e.options_source)&&Z(t).catch(()=>{})})(s)}),(0,f.jsx)(l.rA,{icon:"delete",title:e("删除"),onClick:()=>(async s=>{t({title:e("确认删除"),sub_title:s.note,confirm_fun:async()=>{try{await c.I2.post("credential/delete",{id:s.id}),(0,_.SK)(e("已删除")),await D()}catch(e){}}})})(s)})]})];var n})})]})}function pe(){const{t:e}=(0,h.Bd)(),t=(0,ae.y)(),[s,i]=(0,n.useState)([]),[a,d]=(0,n.useState)([]),[p,m]=(0,n.useState)([]),[x,j]=(0,n.useState)(!1),[v,g]=(0,n.useState)(""),[y,w]=(0,n.useState)("webdav"),[b,S]=(0,n.useState)(""),[C,k]=(0,n.useState)(""),[A,I]=(0,n.useState)(""),[N,V]=(0,n.useState)(""),[$,X]=(0,n.useState)(""),[F,K]=(0,n.useState)(!1),z=async()=>{try{const[e,t,s]=await Promise.all([c.I2.post("list",{}),c.I2.post("credential/list",{}),c.I2.post("driver/list",{})]);i(Array.isArray(e?.data)?e.data:[]),d(Array.isArray(t?.data)?t.data:[]),m(Array.isArray(s?.data)?s.data:[])}catch(e){}};(0,n.useEffect)(()=>{z()},[]);const B=(0,oe.p_)(C,a),O=B.length>0,P=()=>{j(!1),g(""),w("webdav"),S(""),k(""),I(""),V(""),X(""),K(!1)};return(0,f.jsxs)(o.Zp,{self_title:(0,f.jsx)("span",{className:" div-row ",children:(0,f.jsx)("h2",{children:e("挂载列表")})}),rightBottomCom:(0,f.jsxs)("div",{children:[!x&&(0,f.jsx)(l.rA,{icon:"add",title:e("添加"),onClick:()=>{P(),j(!0)}}),x&&(0,f.jsx)(l.rA,{icon:"network_check",title:e("测试连接"),onClick:async()=>{if(C)try{const t=await c.I2.post("test",{id:v||void 0,driver:y,credential_id:C,account_id:A,root_dir:N}),s=t?.data;s?.ok?(0,_.SK)(`${e("连接成功")}(${s.count??0})`):(0,_.zN)(`${e("连接失败")}:${s?.error??""}`)}catch(e){}else(0,_.zN)(e("请选择凭据"))}}),x&&(0,f.jsx)(l.rA,{icon:"save",title:e("保存"),onClick:async()=>{if(C)if(!O||A)if(b.trim())try{await c.I2.post(v?"update":"add",{id:v||void 0,driver:y,mount_path:b,credential_id:C,account_id:O?A:void 0,root_dir:N,note:$,color:oe.OT,readonly:!1,enabled:!0,forward_to_remote:F}),(0,_.SK)(e("保存成功")),P(),await z()}catch(e){}else(0,_.zN)(e("munt_rq"));else(0,_.zN)(e("请选择账号"));else(0,_.zN)(e("请选择凭据"))}}),x&&(0,f.jsx)(l.rA,{icon:"cancel",title:e("取消"),onClick:P})]}),children:[x&&(0,f.jsxs)(n.Fragment,{children:[(0,f.jsx)(r.BC,{label:e("挂载类型"),label_width:"6rem",children:(0,f.jsx)(r.l6,{value:y,options:p.map(e=>({title:e.name,value:e.type})),onChange:e=>{w(e),k(""),I("")}})}),(0,f.jsx)(r.BC,{label:e("凭据"),label_width:"6rem",required:!0,children:(0,f.jsx)(r.l6,{value:C,options:(T=y,(0,oe.XT)(T,a)),onChange:e=>{k(e),I("")}})}),O&&(0,f.jsx)(r.BC,{label:e("账号"),label_width:"6rem",required:!0,children:(0,f.jsx)(r.l6,{value:A,options:B,onChange:I})}),(0,f.jsx)(r.BC,{label:e("本地目录"),label_width:"6rem",required:!0,children:(0,f.jsx)(r.Sm,{placeholder:e("被挂载的本地绝对路径"),value:b,handleInputChange:S})}),(0,f.jsx)(r.BC,{label:e("strtdrt"),label_width:"6rem",children:(0,f.jsx)(r.Sm,{placeholder:e("远端目录"),value:N,handleInputChange:V})}),(0,f.jsx)(r.BC,{label:e("备注"),label_width:"6rem",children:(0,f.jsx)(r.Sm,{placeholder:e("列表显示的名称"),value:$,handleInputChange:X})}),"tcp_proxy"===y&&(0,f.jsx)(r.BC,{label:e("ftr2rmt"),label_width:"6rem",children:(0,f.jsx)(l.Ay,{checked:F,onChange:K,title:e("ftr2rmt_tip")})})]}),!x&&(0,f.jsx)(u.X,{headers:[e("备注"),e("挂载类型"),e("凭据"),e("账号"),e("操作")],rows:s.map(s=>{const n=a.find(e=>e.id===s.credential_id),i=(n?.accounts??[]).find(e=>e.id===s.account_id);return[(0,f.jsx)("p",{children:s.note}),(0,f.jsx)("p",{children:(o=s.driver,p.find(e=>e.type===o)?.name??o)}),(0,f.jsx)("p",{children:n?n.note:e("凭据已丢失")}),(0,f.jsx)("p",{children:s.account_id?i?i.note||i.account_name||i.nickname||i.id:e("账号已丢失"):"-"}),(0,f.jsxs)("div",{children:[(0,f.jsx)(l.rA,{icon:"edit",title:e("编辑"),onClick:()=>(e=>{j(!0),g(e.id),w(e.driver),S(e.mount_path??""),k(e.credential_id??""),I(e.account_id??""),V(e.root_dir??""),X(e.note??""),K(Boolean(e.forward_to_remote))})(s)}),(0,f.jsx)(l.rA,{icon:"delete",title:e("删除"),onClick:()=>(async s=>{t({title:e("确认删除"),sub_title:s.mount_path,confirm_fun:async()=>{try{await c.I2.post("delete",{id:s.id}),(0,_.SK)(e("已删除")),await z()}catch(e){}}})})(s)})]})];var o})})]});var T}function me(){const{t:e}=(0,h.Bd)(),{check_user_auth:t}=(0,w.MH)(),s=t(a.oV.file_mount),[r,d]=(0,y.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)(k.aZ,{position:"right",children:[(0,f.jsx)("span",{className:"header-label",children:e("总开关")}),(0,f.jsx)(l.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.jsx)(i.xh,{children:(0,f.jsxs)(i.fI,{children:[(0,f.jsx)(i.VP,{widthPer:50,maxWidth:"60rem",children:(0,f.jsx)(he,{})}),(0,f.jsx)(i.VP,{widthPer:50,maxWidth:"60rem",children:(0,f.jsx)(pe,{})})]})})]}):(0,f.jsx)(i.fI,{children:(0,f.jsx)(i.VP,{children:(0,f.jsx)(o.Zp,{self_title:(0,f.jsx)("h2",{children:e("网盘挂载")}),children:(0,f.jsx)("p",{children:e("nmuntpr")})})})})}var _e=s(87361);function xe(){const{t:e}=(0,h.Bd)(),{check_user_auth:t}=(0,w.MH)(),s=[{index:2,name:`${e("个人环境")}`,rto:"private_env_setting",component:(0,f.jsx)(ie,{})}];return t(a.oV.sys_setting_page)&&s.unshift({index:1,name:e("系统"),rto:"password",component:(0,f.jsx)(K,{})}),t(a.oV.sys_env_page)&&s.push({index:3,name:`${e("系统环境")}`,rto:"env_setting/",component:(0,f.jsx)(Q,{})}),t(a.oV.auth_router_page)&&s.push({index:4,name:e("自定义路由"),rto:"customer_router/",component:(0,f.jsx)(A,{})}),t(a.oV.file_mount)&&s.push({index:5,name:e("网盘挂载"),rto:"mount_setting/",component:(0,f.jsx)(me,{})}),t(a.oV.user_manage)&&s.push({index:6,name:e("用户管理"),rto:"user_manager/",component:(0,f.jsx)(ee,{})}),t(a.oV.role_manage)&&s.push({index:7,name:e("角色管理"),rto:"role_manager/",component:(0,f.jsx)(te,{})}),(0,f.jsx)(i.W1,{optionList:s,father_route:_e.o.setting})}},92350(e,t,s){s.d(t,{Q:()=>u,o:()=>p});var n=s(34843),i=s(82893),a=s(74777),o=s(96540),l=s(22022),r=s(23430),c=s(14284),d=s(74848);function u(){const[e,t]=(0,n.fp)(i.AG.prompt_card),{t:s,i18n:o}=(0,l.Bd)();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 h=r.Ky;function p(){const[e,t]=(0,o.useState)([]);return(0,o.useEffect)(()=>{(async()=>{try{const e=await c.XO.get("themes");if(0===e.code){const s=e.data||[];h=[...r.Ky,...s],t(h)}else console.warn("获取主题列表失败,使用默认列表"),t(h)}catch(e){t(h)}})()},[]),e}},6960(e,t,s){s.d(t,{s:()=>o});var n=s(72635);const i=1440,a=525600;function o(e){e=e>1e12?e:1e3*e;const t=Date.now(),s=Math.abs(t-e)/6e4;return s<1?n.Ay.t("小于一分钟"):s<60?`${s.toFixed(0)} ${n.Ay.t("分钟前")}`:s<i?`${(s/60).toFixed(0)} ${n.Ay.t("小时前")}`:s<43200?`${(s/i).toFixed(0)} ${n.Ay.t("天前")}`:s<a?`${(s/43200).toFixed(0)} ${n.Ay.t("月前")}`:`${(s/a).toFixed(0)} ${n.Ay.t("年前")}`}},93245(e,t,s){s.d(t,{a:()=>r});var n=s(96540),i=s(34843),a=s(82893),o=s(23430);const l=[{id:o.nE.ace,label:"文本编辑器(ace)"},{id:o.nE.md,label:"md编辑器"},{id:o.nE.mind,label:"思维导图编辑器"},{id:o.nE.draw,label:"draw编辑器"},{id:o.nE.timeline,label:"时间线编辑器"},{id:o.nE.image,label:"图片编辑器"},{id:o.nE.excel,label:"excel编辑器"}];function r(e,t,s,o=!1){const[l]=(0,i.fp)(a.AG.user_base_info),r=l?.user_data?.editor_auto_save,c=(0,n.useRef)(r);c.current=r;const d=(0,n.useRef)(t);d.current=t;const u=(0,n.useRef)(s);u.current=s,(0,n.useEffect)(()=>{if(o)return;const t=c.current;if(!t?.enable||t.interval<=0||!t.editors?.includes(e))return;const s=setInterval(()=>{d.current()&&u.current(!0)},1e3*t.interval);return()=>clearInterval(s)},[r,e,o])}s.d(t,["d",0,l])},24659(e,t,s){var n=s(22022);s.d(t,["K",0,()=>{const{t:e}=(0,n.Bd)();return[{title:e("是"),value:!0,color:"#28a745"},{title:e("否"),value:!1,color:"#666666"}]}])}}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[9299],{47374(e,t,n){n.d(t,{e:()=>p});var i=n(96540),s=n(61973),o=n(64694),a=n(34289),l=n(61443),r=n(75725),c=n(22022),d=n(85997),_=n(74848);function p(e){let t=(0,s.zy)();const[n,p]=(0,i.useState)([]),[f,h]=(0,i.useState)("/"),[u,m]=(0,i.useState)(void 0),{t:w,i18n:v}=(0,c.Bd)();i.useEffect(()=>{let t="",n=(0,a.vX)().split("/");n=n.filter(e=>e);const i=n.indexOf(e.baseRoute),s=[];if(-1!=i){t=(0,o.IO)(n.slice(0,i),e.baseRoute);const a=n.slice(i+1);for(let e=0;e<a.length;e++){const n=a[e];s.push({value:n,href:0===e?`${t}${n}/`:(0,o.IO)(s[e-1].href,n)})}h(t),p(s)}},[t]);const g=t=>{t.stopPropagation(),e.clickFun(t)};return(0,_.jsx)("div",{className:"breadcrumbs",onClick:e=>{m(void 0!==u?void 0:"")},children:(0,_.jsx)(i.Fragment,{children:void 0===u?(0,_.jsxs)(i.Fragment,{children:[(0,_.jsx)("span",{className:"chevron",children:(0,_.jsx)(s.N_,{to:f,onClick:g,children:(0,_.jsx)(d.In,{icon:"home"})})}),n.map((e,t)=>(0,_.jsxs)("span",{className:"chevron",children:[(0,_.jsx)(d.In,{icon:"keyboard_arrow_right"}),(0,_.jsx)(s.N_,{to:e.href,onClick:g,children:decodeURIComponent(e.value)})]},t))]}):(0,_.jsx)(r.QM,{click:()=>{m(void 0)},children:(0,_.jsx)(l.Sm,{width:"100%",placeholder:w("输入跳转的目录"),handlerEnter:t=>{e.input_path_enter&&e.input_path_enter(t),m(void 0)}})})})})}},77481(e,t,n){n.d(t,{S:()=>l,X:()=>a});var i=n(96540),s=n(61443),o=n(74848);function a(e){const[t,n]=i.useState([]),a=(0,i.useRef)(-1),[l,r]=(0,i.useState)(-1),[c,d]=(0,i.useState)(-1);(0,i.useEffect)(()=>{e.children?n(Array.isArray(e.children)?e.children:[e.children]):n(e.rows)},[e.rows,e.children]);const _=()=>{a.current=-1,r(-1),d(-1)};return(0,o.jsxs)("table",{children:[(0,o.jsx)("thead",{children:(0,o.jsx)("tr",{children:e.headers?.map((t,n)=>{const i=!!e.filter&&(e.filter.column??0)===n;let a=t;if(i){const n=e.filter,i=n.options.find(e=>e.value===n.value);null!=n.value&&i&&(a=`${t} (${i.label})`)}return(0,o.jsx)("th",{className:i?"table-filter-col":"",children:i?(0,o.jsx)(s.l6,{value:e.filter.value,options:e.filter.options,onChange:e.filter.onChange,bare:!0,trigger_label:a}):t},n)})})}),(0,o.jsx)("tbody",{children:t.map((t,n)=>{const i=!!e.onRowDrag;return(0,o.jsx)("tr",{className:i?(l===n?"row-dragging":"")+(c===n?" row-drop-target":""):"",draggable:i,onContextMenu:()=>{e.handleContextMenu&&e.handleContextMenu(t)},onDragStart:e=>{i&&(a.current=n,r(n),e.dataTransfer.effectAllowed="move")},onDragOver:e=>{!i||a.current<0||(e.preventDefault(),e.dataTransfer.dropEffect="move",d(n))},onDrop:t=>{i&&(t.preventDefault(),(()=>{const t=a.current,n=c;_(),t<0||n<0||t===n||e.onRowDrag?.(t,n)})())},onDragEnd:_,children:t.map((n,i)=>{const s=i===t.length-1?"small":"";return(0,o.jsx)("td",{className:s,style:{width:e.width??"auto"},children:n},i)})},n)})})]})}function l(e){return(0,o.jsx)("div",{style:{display:e.isFlex?"flex":"block"},children:e.columns.map((e,t)=>(0,o.jsx)("div",{children:e},t))})}},19299(e,t,n){n.r(t),n.d(t,{default:()=>J});var i=n(96540),s=n(47374),o=n(34843),a=n(52035),l=n(82893),r=n(14284),c=n(61973),d=n(4412),_=n(89824),p=n(34289),f=n(53459),h=n(99214),u=n(61443),m=n(47022),w=n(62042),v=n(22022),g=n(7523),x=n(78247),y=n(88815),j=n(6960),k=n(47071),G=n(14944),A=n(92275),b=n(23430);var C=n(34251),S=n(60096),M=n(87361),z=n(76559),$=n(85997),D=n(77481),N=n(70447),E=n(74848);const F=500;function I(e){const{t}=(0,v.Bd)(),n=(0,c.Zp)(),[,s]=(0,o.fp)(l.AG.prompt_card),[a,r]=(0,i.useState)(""),[d,_]=(0,i.useState)(!1),[p,f]=(0,i.useState)([]),[h,m]=(0,i.useState)(0),[w,g]=(0,i.useState)(!1),x=(0,i.useMemo)(()=>new z.I(window.location.host,"file_deep_search"),[]),y=(0,i.useRef)(!1),j=decodeURIComponent(e.base_path);(0,i.useEffect)(()=>{let e=[],t=null;const n=()=>{if(t=null,y.current||!e.length)return;const n=e;e=[],m(e=>e+n.length),f(e=>e.length>=F?e:[...e,...n].slice(0,F))},i=()=>{y.current||_(!1)};return x.addMsg(A.HK.file_deep_search_data,i=>{y.current||(e.push(...i.context??[]),null===t&&(t=setTimeout(n,100)))}),x.addMsg(A.HK.file_deep_search_end,()=>{y.current||(n(),_(!1))}),x.on_message("close",i),()=>{y.current=!0,clearTimeout(t),x.sendData(A.HK.file_deep_search_cancel,{}).catch(()=>{}),x.off_message("close",i),x.close()}},[]);const k=()=>{const t=a.trim();if(!t||d)return;f([]),m(0),g(!0),_(!0);const n={param_path:e.base_path,keyword:t};x.sendData(A.HK.file_deep_search,n).catch(()=>{})},G=e=>{let t=e.is_dir?e.path:e.path.slice(0,e.path.lastIndexOf("/")+1);t.endsWith("/")||(t+="/"),s({open:!1}),n(M.o.file+t.split("/").map(encodeURIComponent).join("/"))};return(0,E.jsxs)("div",{className:"file-deep-search",children:[(0,E.jsxs)("div",{className:"file-deep-search__bar",children:[(0,E.jsx)(u.$Z,{icon:"search",value:a,placeholder:t("搜文件名"),handleInputChange:e=>r(e),handleEnterPress:k}),(0,E.jsx)("button",{className:"button button--flat",onClick:d?()=>{x.sendData(A.HK.file_deep_search_cancel,{}).catch(()=>{}),_(!1)}:k,children:t(d?"取消":"搜索")})]}),(0,E.jsxs)("div",{className:"file-deep-search__hint",children:[(0,E.jsxs)("span",{children:[t("范围"),":",j]}),h>0&&(0,E.jsx)("span",{className:"file-deep-search__count",children:h>F?`${t("已显示")} 500 / ${h}`:`${h}`})]}),(0,E.jsxs)("div",{className:"file-deep-search__body",children:[p.length>0&&(0,E.jsx)(D.X,{headers:[t("名称"),t("路径"),""],rows:p.map(e=>{const n=e.path.slice(0,e.path.lastIndexOf("/")+1);return[e.is_dir?(0,E.jsx)("span",{className:"file-deep-search__dir",children:e.name}):e.name,(0,E.jsx)(N.xP,{context:n}),(0,E.jsx)($.rA,{icon:"folder_open",title:t("打开所在目录"),onClick:()=>G(e)})]})}),d&&(0,E.jsxs)("div",{className:"file-deep-search__empty",children:[(0,E.jsx)("span",{className:"chat-session-running",title:t("搜索中")}),t("搜索中")]}),!d&&h>F&&(0,E.jsx)("div",{className:"file-deep-search__more",children:t("结果过多")}),!d&&0===p.length&&(0,E.jsx)("div",{className:"file-deep-search__empty",children:t(w?"无匹配":"输入后搜")})]})]})}var P=n(64694),X=n(23496),R=n(12730),K=n(75725),L=n(40505);let H={};function U(){const{t:e}=(0,v.Bd)();let t=(0,c.zy)();const n=(0,c.Zp)(),{check_user_auth:s}=(0,x.MH)(),[a,d]=(0,o.fp)(l.AG.nowFileList),[f,u]=(0,o.fp)(l.AG.uploadFiles),[y,j]=(0,o.fp)(l.AG.showPrompt),[k,S]=(0,o.fp)(l.AG.selectedFileList),[z,D]=(0,o.fp)(l.AG.copyedFileList),[F,I]=(0,o.fp)(l.AG.cutedFileList),[X,L]=(0,o.fp)(l.AG.selectedFileList),[U,Y]=(0,o.fp)(l.AG.clickFileList),[B,O]=(0,o.fp)(l.AG.fileShellShow),Z=(0,h.Cf)(),[W,T]=(0,o.fp)(l.AG.file_root_list),[V,q]=(0,o.fp)(l.AG.file_root_index),[J,Q]=(0,i.useState)(void 0),[ee,te]=(0,i.useState)(""),[ne,ie]=(0,o.fp)(l.AG.workflow_show),[se,oe]=(0,o.fp)(l.AG.workflow_realtime_show),[ae,le]=(0,o.fp)(l.AG.work_flow_show),{initUserInfo:re}=(0,i.useContext)(g.F),[ce,de]=(0,o.fp)(l.AG.user_base_info),{click_file:_e}=(0,h.kZ)(),[pe,fe]=(0,o.fp)(l.AG.prompt_card),he=(0,i.useMemo)(()=>a.files.reduce((e,t)=>e+(t.type!==m.Iw.folder?1:0),0),[a]),ue=(0,i.useMemo)(()=>a.files.reduce((e,t)=>e+(t.type===m.Iw.folder?1:0),0)+(a.folders?.length??0),[a]);function me(e){(0,w.SK)(e)}(0,i.useEffect)(()=>{H={}},[t]),(0,i.useEffect)(()=>()=>{O({show:!1,path:""})},[]);const we=(0,h.Vs)(),ve=t=>{fe({open:!0,title:e("信息"),context_div:(0,E.jsxs)("div",{style:{maxWidth:"25rem"},children:[(0,E.jsx)(K.Yh,{left:e("挂载位置磁盘"),right:t?.total_size}),(0,E.jsx)(K.Yh,{left:`${e("磁盘剩余")}`,right:t?.left_size}),(0,E.jsx)(K.Yh,{left:`${e("文件系统")}`,right:t?.fs_type}),(0,E.jsx)(K.Yh,{left:`${e("文件夹数")}`,right:ue}),(0,E.jsx)(K.Yh,{left:`${e("文件数")}`,right:he}),(0,E.jsx)(K.Yh,{left:`${e("当前位置")}`,right:(0,E.jsx)(N.xP,{context:t?.now_absolute_path})})]}),cancel:()=>{G.ws.removeMsg(A.HK.file_info)}})};return(0,E.jsxs)(i.Fragment,{children:[k.length>0&&(0,E.jsx)($.rA,{icon:"delete",title:e("删除"),onClick:()=>{j({show:!0,type:_.PromptEnum.FilesDelete,overlay:!0,data:{}})}}),k.length>0&&(0,E.jsx)($.rA,{icon:"content_copy",title:e("复制"),onClick:function(){const e=(0,h.ib)(a,k);D(e.map(e=>(0,h.Ok)(e.name))),I([]),me("已复制")}}),k.length>0&&(0,E.jsx)($.rA,{icon:"content_cut",title:e("剪切"),onClick:function(){const e=(0,h.ib)(a,k);I(e.map(e=>(0,h.Ok)(e.name))),D([]),me("已剪切")}}),(z.length>0||F.length>0)&&(0,E.jsx)($.rA,{onClick:function(){j({show:!0,type:_.PromptEnum.Confirm,overlay:!0,data:{}})},icon:"content_paste",title:e("粘贴到此处"),tip:z.length+F.length}),k.length>0&&(0,E.jsx)($.rA,{icon:"download",title:e("下载"),onClick:function(){const e=(0,h.ib)(a,k);for(let t=0;t<e.length;t++){const n=e[t];e[t]=encodeURIComponent((0,h.Ok)(n.name))}const t=r.$M.getDownloadUrl(e);window.open(t)}}),k.length>0&&(0,E.jsx)($.rA,{icon:"compress",title:e("压缩"),onClick:function(){const e=(0,h.ib)(a,k);for(let t=0;t<e.length;t++){const n=e[t];e[t]=(0,h.Ok)(n.name)}e&&0!==e.length?j({show:!0,type:_.PromptEnum.Compress,overlay:!0,data:{files:e}}):(0,w.zN)("没有选中")}}),1===k.length&&(0,E.jsx)($.rA,{icon:"edit_attributes",title:e("重命名"),onClick:function(){j({show:!0,type:_.PromptEnum.FileRename,overlay:!0,data:{}})}}),ae&&(0,E.jsx)($.rA,{icon:"api",title:"workflow",onClick:()=>{ie(!ne)}}),Z.can_terminal&&(0,E.jsx)($.rA,{icon:"terminal",title:"shell",onClick:function(){B.show?O({show:!1,path:""}):O({show:!0,path:(0,p.GG)("file",(0,p.vX)())})}}),s(b.oV.share_file)&&(0,E.jsx)($.rA,{icon:"share",title:e("文件分享"),onClick:()=>{n(`${M.o.share_list_setting_page}`)}}),(0,E.jsx)($.rA,{icon:"grid_view",title:e("切换样式"),onClick:we}),(0,E.jsx)($.rA,{icon:"create_new_folder",title:e("创建文件夹"),onClick:function(){j({show:!0,type:_.PromptEnum.DirNew,overlay:!0,data:{dir:(0,p.GG)("file",(0,p.vX)())}})}}),(0,E.jsx)($.rA,{icon:"note_add",title:e("创建文本文件"),onClick:function(){j({show:!0,type:_.PromptEnum.FileNew,overlay:!0,data:{dir:(0,p.GG)("file",(0,p.vX)())}})}}),(0,E.jsx)($.rA,{icon:"upload_file",title:e("上传"),onClick:()=>{j({show:!0,type:_.PromptEnum.UploadFile,overlay:!0,data:{call:e=>{let t=e.currentTarget?.files;if(!t)return;let n=!!t[0].webkitRelativePath;const i=[],s=new Set;for(let e=0;e<t.length;e++){const o=t[e],a=n?o.webkitRelativePath:`${o.webkitRelativePath}${o.name}`;o.fullPath=a,n&&s.add((0,R.S)(a)),i.push(o)}const o=[];if(n)for(const e of s)o.push({isDir:!0,fullPath:e,name:e});o.push(...i),u(o),j({show:!0,type:_.PromptEnum.FilesUpload,overlay:!1,data:{}})}}})}}),(0,E.jsx)($.rA,{icon:"info",title:e("信息"),onClick:async()=>{let e;if(!H.now_absolute_path){G.ws.addMsg(A.HK.file_info,t=>{const n=t.context;e&&(H={...H,...n},G.ws.removeMsg(A.HK.file_info),ve(H))});const t=await G.ws.sendData(A.HK.file_info,{type:m.Iw.folder,path:(0,p.GG)("file",(0,p.vX)())});e=t.context,H=e,ve(H)}ve(H)}}),(0,E.jsx)($.rA,{icon:"more_vert",title:e("切换目录"),onClick:t=>{const i=new C.ik;i.x=t.clientX,i.y=t.clientY,i.type=m.Iw.directory,i.items=W,i.item_pre_value=V,i.textClick=async t=>{if(t.type===C.LU.add)return n(`${M.o.setting_private_env_setting}`),j({data:void 0,overlay:!1,type:"",show:!1}),void(0,w.N9)(e("请配置 文件夹路径"));j({data:void 0,overlay:!1,type:"",show:!1}),t.type!==C.LU.child?(async e=>{q(e),await r.$M.post("base_switch",{root_index:e}),await re(),n("/file/"),L([]),Y([])})(t.index):n((0,P.IO)(M.o.file,t.rel))},j({show:!0,type:_.PromptEnum.FileMenu,overlay:!1,data:i})}})]})}var Y=n(2543),B=n(21499),O=n(17903);const Z=i.lazy(()=>Promise.all([n.e(7856),n.e(6349),n.e(3659)]).then(n.bind(n,63659))),W=i.lazy(()=>Promise.all([n.e(7856),n.e(1636)]).then(n.bind(n,81636))),T=i.lazy(()=>n.e(9857).then(n.bind(n,69857)));let V,q="";function J(){const[e,t]=(0,o.fp)(l.AG.editorSetting),[,n]=(0,o.fp)(l.AG.md_editor),[,w]=(0,o.fp)(l.AG.log_viewer),[,z]=(0,o.fp)(l.AG.image_editor),[,D]=(0,o.fp)(l.AG.markdown),[,N]=(0,o.fp)(l.AG.excalidraw_editor),[,F]=(0,o.fp)(l.AG.mind_editor),[,R]=(0,o.fp)(l.AG.timeline_editor),[,K]=(0,o.fp)(l.AG.excel_editor),[H,J]=(0,o.fp)(l.AG.file_preview),{t:Q}=(0,v.Bd)();let ee=(0,c.zy)();const te=(0,c.Zp)(),[ne,ie]=(0,o.fp)(l.AG.nowFileList),[se]=(0,o.fp)(l.AG.file_list_refresh),[oe]=(0,o.fp)(l.AG.mount_enabled),[ae,le]=(0,o.fp)(l.AG.current_mount),[re,ce]=(0,o.fp)(l.AG.showPrompt),[de,_e]=(0,o.fp)(l.AG.selectedFileList),[pe,fe]=(0,o.fp)(l.AG.clickFileList),[he,ue]=(0,o.fp)(l.AG.fileShellShow),[me,we]=(0,i.useState)(""),[ve,ge]=(0,o.fp)(l.AG.workflow_show),[xe,ye]=(0,o.fp)(l.AG.workflow_realtime_show),[je,ke]=(0,o.fp)(l.AG.work_flow_show),{initUserInfo:Ge}=(0,i.useContext)(g.F),[Ae,be]=(0,o.fp)(l.AG.user_base_info),{check_user_auth:Ce}=(0,x.MH)(),{click_file:Se}=(0,h.kZ)(),[Me]=(0,c.ok)(),ze=(0,h._A)(),$e=i.useRef(null),[De,Ne]=(0,o.fp)(l.AG.to_running_files),[Ee,Fe]=(0,o.fp)(l.AG.file_page),[Ie]=(0,o.fp)(l.AG.blank_search_mode),[,Pe]=(0,o.fp)(l.AG.prompt_card),[Xe,Re]=(0,o.fp)(l.AG.blank_search_mode_for_temp),Ke=(0,h.oT)(),Le="1"===Me.get("chat_open"),He=Ce(b.oV.ai_agent_page);(0,i.useEffect)(()=>{Ae?.user_data&&Le&&!He&&Ke("chat_open",null)},[Le,He,Ae]);const[Ue,Ye]=(0,o.fp)(l.AG.studio_chat_width),Be=i.useRef(null),[Oe,Ze]=(0,i.useState)(!1),[We,Te]=(0,i.useState)(void 0),Ve=(0,h.dN)(),[qe,Je]=(0,o.fp)(l.AG.ai_chat_session_by_cwd),Qe=function(){const[e,t]=(0,o.fp)(l.AG.user_base_info),{t:n}=(0,v.Bd)(),{check_user_auth:s}=(0,x.MH)(),[a,d]=(0,o.fp)(l.AG.router_jump),f=(0,c.Zp)(),{initUserInfo:u}=(0,i.useContext)(g.F),[w,y]=(0,o.fp)(l.AG.nowFileList),[j,k]=(0,o.fp)(l.AG.showPrompt),[S,z]=(0,o.fp)(l.AG.fileShellShow),[$,D]=(0,o.fp)(l.AG.blank_search_mode);return t=>{t.preventDefault(),t.stopPropagation();const i=new C.ik;i.x=t.clientX,i.y=t.clientY,i.type=m.Iw.directory;const o=[{r:(0,E.jsx)("span",{style:(0,L.ok)(e.user_data.dir_show_type===b.t8.time_minx_max),children:n("时间逆序")}),v:b.t8.time_minx_max},{r:(0,E.jsx)("span",{style:(0,L.ok)(e.user_data.dir_show_type===b.t8.time_max_min),children:n("时间顺序")}),v:b.t8.time_max_min}],a=[{r:(0,E.jsx)("span",{style:(0,L.ok)(e.user_data.dir_show_type===b.t8.size_min_max),children:n("大小顺序")}),v:b.t8.size_min_max},{r:(0,E.jsx)("span",{style:(0,L.ok)(e.user_data.dir_show_type===b.t8.size_max_min),children:n("大小逆序")}),v:b.t8.size_max_min}],l=[{r:(0,E.jsx)("span",{style:(0,L.ok)(!e.user_data.file_list_pagination_mode||e.user_data.file_list_pagination_mode===b.yM.all),children:n("全部加载文件")}),v:b.yM.all},{r:(0,E.jsx)("span",{style:(0,L.ok)(e.user_data.file_list_pagination_mode===b.yM.pagination),children:n("scrll_l")}),v:b.yM.pagination}],c=[{r:(0,E.jsx)("span",{style:(0,L.ok)(!e.user_data.file_time_show_type||e.user_data.file_time_show_type===b.KD.current),children:n("最近时间")}),v:b.KD.current},{r:(0,E.jsx)("span",{style:(0,L.ok)(e.user_data.file_time_show_type===b.KD.time),children:n("准确时间")}),v:b.KD.time}],v=[{r:n("文件列表展示"),items:[{r:n("文件排序"),v:"",items:[{r:(0,E.jsx)("span",{style:(0,L.ok)(!e.user_data.dir_show_type),children:n("系统默认")}),v:b.t8.defualt},{r:(0,E.jsx)("span",{style:(0,L.ok)(e.user_data.dir_show_type===b.t8.name),children:n("名字")}),v:b.t8.name},{r:(0,E.jsx)("span",{style:(0,L.ok)(e.user_data.dir_show_type===b.t8.time_minx_max||e.user_data.dir_show_type===b.t8.time_max_min),children:n("修改时间")}),v:!1,items:o},{r:(0,E.jsx)("span",{style:(0,L.ok)(e.user_data.dir_show_type===b.t8.size_min_max||e.user_data.dir_show_type===b.t8.size_max_min),children:n("文件大小")}),v:!1,items:a}]},{r:n("文件加载方式"),v:"",items:l},{r:n("时间展示"),v:"",items:c},{r:n("缩放调整"),v:"zoom_adjust"},{r:(0,E.jsx)("span",{style:(0,L.ok)($),children:n("srchbln")}),v:"blank_search_mode"}]}];w?.folders?.find(e=>".git"===e.name)&&v.push({r:n("查看Git提交"),v:"git_page"}),s(b.oV.code_resource)&&v.push({r:n("add_rot"),v:"code_resource"}),s(b.oV.http_proxy)&&v.push({r:n("dl_here"),v:"http_resource"}),e?.user_data?.quick_cmd&&(0,h.LL)([...e.user_data.quick_cmd],v),i.items=v,i.textClick=async e=>{if(console.log(e),!1===e)return;const t={};if("gcfg_dir_config"===e){const e=(0,p.GG)("file",(0,p.vX)());return k({data:void 0,overlay:!1,type:"",show:!1}),void f(`${M.o.gcfg_page}/${encodeURIComponent(e)}`)}if("git_page"===e){const e=(0,p.GG)("file",(0,p.vX)());return k({data:void 0,overlay:!1,type:"",show:!1}),void f(`${M.o.git_page}/${encodeURIComponent(e)}`)}if("code_resource"===e){const e=await G.ws.sendData(A.HK.file_info,{path:(0,p.GG)("file",(0,p.vX)())});return d({page_self_router_api_data:[`/api/${Date.now()}`,e.context.now_absolute_path]}),k({data:void 0,overlay:!1,type:"",show:!1}),void f("/setting/customer_router/")}if("http_resource"===e){const e=await G.ws.sendData(A.HK.file_info,{path:(0,p.GG)("file",(0,p.vX)())});return d({http_download_map_path:e.context.now_absolute_path}),k({data:void 0,overlay:!1,type:"",show:!1}),void f("/proxy/http/")}if("zoom_adjust"===e)return k({data:void 0,overlay:!1,type:"",show:!1}),void setTimeout(()=>{k({show:!0,type:_.PromptEnum.ZoomAdjust,overlay:!1,data:{}})},0);if("object"==typeof e&&"quick_cmd"===e.tag){let t=e.cmd;t&&(t.endsWith("\r")||(t+="\r",z({show:!0,path:(0,p.GG)("file",(0,p.vX)()),cmd:t})))}else{if("blank_search_mode"===e)return D(!$),void k({data:void 0,overlay:!1,type:"",show:!1});if(e===b.yM.all||e===b.yM.pagination)t.is_pagination_mode=!0;else if(e===b.KD.current||e===b.KD.time)t.is_file_show_type=!0;else{if(e!==b.t8.defualt&&e!==b.t8.name&&e!==b.t8.size_max_min&&e!==b.t8.size_min_max&&e!==b.t8.time_max_min&&e!==b.t8.time_minx_max)return;t.is_dir_list_type=!0}}await r.wm.post(X.s.user_save_private_attr,{type:e,...t}),await u(),k({data:void 0,overlay:!1,type:"",show:!1}),f((0,p.vX)())},k({show:!0,type:_.PromptEnum.FileMenu,overlay:!1,data:i})}}(),et=async e=>{let t=!1;for(const n of e.files??[])n.origin_size=n.size,n.size=(0,y.v7)(n.size),Ae.user_data.file_time_show_type===b.KD.time?n.show_mtime=n.mtime?(0,B.Yq)(n.mtime):"":n.show_mtime=n.mtime?(0,j.s)(n.mtime):"",t||!n.name.endsWith(".workflow.yml")&&!n.name.endsWith(".act")||(t=!0),n.name===k.SB&&(t=!0);for(const n of e.folders??[])Ae.user_data.file_time_show_type===b.KD.time?n.show_mtime=n.mtime?(0,B.Yq)(n.mtime):"":n.show_mtime=n.mtime?(0,j.s)(n.mtime):"",n.name===k.SB&&(t=!0);ke(t)},tt=i.useRef(null),nt=async e=>{if(!0===oe){if(tt.current!==e){tt.current=e;try{const t=await r.$M.post("file/mount_info",{param_path:e});le(t?.data??null),await G.ws.connect()}catch(e){le(null)}}}else le(null)};(0,i.useEffect)(()=>{je&&(async()=>{const e=new k.Nd,t=(0,a.zp)().get(l.AG.current_mount);e.dir_path=(0,h.Zl)((0,p.GG)("file",(0,p.vX)()),t),G.ws.addMsg(A.HK.workflow_realtime,e=>{const t=e.context;if(e.context){for(const e of t.sucess_file_list)(0,h.Ys)(e);for(const e of t.failed_file_list)(0,h.V$)(e);Ne(new Set(t.running_file_list))}}),await G.ws.sendData(A.HK.workflow_realtime,e)})()},[je,ae,ee]);const it=async()=>{const e=(0,p.GG)("file",(0,p.vX)());if(Ie||Xe)return;let t;if(nt(e),Ae.user_data.file_list_pagination_mode===b.yM.pagination){if(q!==e){if(q=e,1!==Ee.page_num)return void Fe({page_size:Ee.page_size,page_num:1})}else if(Ee.page_num<0)return;if(t=await r.$M.post("file_get_page",{param_path:e,page_num:Ee.page_num,page_size:Ee.page_size}),t.code!==f.m.Success)return;const n=t.data;return et(n),n.files?.length?(ie(e=>{const t=(0,Y.cloneDeep)(1===Ee.page_num?n.files:[...e?.files??[],...n.files]),i={...e,files:t};return(0,h.yC)(i,Ae.user_data.dir_show_type),i}),void(V=t.data)):void Fe({page_size:Ee.page_size,page_num:-1})}if(t=await r.$M.get(e),t.code!==f.m.Success)return;const n=t.data;(0,h.yC)(n,Ae.user_data.dir_show_type),et(t.data),ie(t.data),V=t.data};(0,i.useEffect)(()=>async()=>{Ne(new Set)},[]);const st=()=>{ke(!1),(()=>{const e=Me.get("preview_file_name"),t=Me.get("preview_mode");if(!e||!t)return!1;const i=(0,p.GG)("file",(0,p.vX)());if($e.current===i+e)return!0;$e.current=i+e;const s=()=>ze(null);return"md"===t?(n({url:r.$M.getDownloadUrl(`${encodeURIComponent(i)}${e}`),path:`${i}${e}`,name:e,close:s}),!0):"log"===t?(w({show:!0,fileName:e,encoding:Me.get("preview_log_enc")??"utf8",wrap:Me.get("preview_log_wrap")??"wrap",close:s}),!0):"image_edit"===t?(z({path:(0,P.IO)((0,p.vX)(),e),name:e,close:s}),!0):(Se({name:e,opt_shell:!0,..."text"===t?{model:"text"}:{},close:s}),!0)})()||(t({open:!1}),J({open:!1}),n({}),w({show:!1}),z({}),D({}),N({}),F({}),R({}),K({}),it())};(0,i.useEffect)(()=>{st()},[ee,Ee]),(0,i.useEffect)(()=>{se>0&&it()},[se]);const ot=i.useRef(!1);(0,i.useEffect)(()=>{if(null!==oe)return ot.current?void(!0===oe?nt((0,p.GG)("file",(0,p.vX)())):le(null)):(ot.current=!0,void(!0===oe&&null===ae&&nt((0,p.GG)("file",(0,p.vX)()))))},[oe]);const at=e=>{e.target===e.currentTarget&&(_e([]),fe([]))},lt=i.useCallback((0,Y.throttle)(e=>{const t=Be.current;if(!t||!t.parentElement)return;const n=parseFloat(getComputedStyle(t).fontSize),i=t.parentElement.getBoundingClientRect(),s=i.right-e.clientX,o=Math.min(Math.max(s,320),.7*i.width);Ye(parseFloat((o/n).toFixed(2)))},32),[]),rt=()=>{Ze(!1),document.removeEventListener("pointermove",lt)},ct=(0,E.jsxs)("div",{className:"file-list-main",children:[(0,E.jsx)(s.e,{baseRoute:"file",clickFun:function(){if(_e([]),fe([]),Ae.user_data.file_list_pagination_mode===b.yM.pagination){const e=document.getElementById("listing");e&&(e.scrollTop=0),Fe({page_size:Ee.page_size,page_num:1})}},input_path_enter:e=>{var t;_e([]),fe([]),ie({files:[],folders:[]}),!function(e){return"string"==typeof e&&0!==e.length&&(/^[a-zA-Z]:[\\\/]/.test(e)||/^\\\\[^\\/]+[\\/]/.test(e)||/^\//.test(e))}(e)?te(function(e,t){let n=function(e){let t="\\";for(const n of e)if("/"===n||"\\"===n){t=n;break}return t}(e);if("."===t)return e;if(".."===t){if(e.length>1){let t=e[e.length-1]===n?1:0;for(let i=e.length-1-t;i>=0;i--)if(e[i]===n)return e.substring(0,i+1)}return e}return e.endsWith(n)&&t.startsWith(n)?e.slice(0,-1)+t:e.endsWith(n)||t.startsWith(n)?e+t:e+n+t}((0,p.vX)(),e)):(e=e.replace(0===(t=Ae.user_data).folder_item_now||void 0===t.folder_item_now?t.cwd:t.folder_items[t.folder_item_now-1].path,""),te(e))}}),ae&&(0,E.jsxs)("div",{className:"mount-tip-bar",style:{borderLeftColor:ae.color},children:[(0,E.jsx)("span",{className:"material-icons",style:{color:ae.color},children:"cloud"}),(0,E.jsx)("span",{children:[ae.credential_note,ae.account_note||(O.C1.find(e=>e.value===ae.driver)?.title??ae.driver),ae.name].filter(Boolean).join(" - ")}),ae.readonly&&(0,E.jsx)("span",{className:"mount-readonly-tag",children:Q("只读")})]}),Ae.user_data.file_list_pagination_mode===b.yM.pagination?(0,E.jsx)(S.$J,{handleContextMenu:Qe,clickBlank:at,list:ne.files}):(0,E.jsx)(S.t$,{handleContextMenu:Qe,file_list:ne.files,folder_list:ne.folders,clickBlank:at})]});return(0,E.jsxs)(i.Fragment,{children:[(0,E.jsx)(d.aZ,{children:(0,E.jsx)(u.$Z,{handleEnterPress:async()=>{if(Ie||Xe){if(_e([]),fe([]),!me||!me.trim())return void ie({files:[],folders:[]});const e=(0,p.GG)("file",(0,p.vX)()),t=await r.$M.post("file_get_page",{param_path:e,page_num:1,page_size:1e4,search:me.trim()});if(t.code!==f.m.Success)return;const n=t.data;return(0,h.yC)(n,Ae.user_data.dir_show_type),et(n),ie(n),void(V=n)}if(!V)return;_e([]),fe([]);const e=[],t=[];for(const t of V.files??[])t.name.includes(me)&&e.push(t);for(const e of V.folders??[])e.name.includes(me)&&t.push(e);ie({files:e,folders:t})},placeholder:Q("搜索当前目录"),icon:"search",value:"",mobile_hidden:!0,handleIconClick:()=>{const e=(0,p.GG)("file",(0,p.vX)());Pe({open:!0,title:Q("深搜"),context_div:(0,E.jsx)(I,{base_path:e})})},handleInputChange:e=>{we(e)},max_width:"25em"})}),(0,E.jsxs)(d.aZ,{position:"right",children:[Ce(b.oV.ai_agent_page)&&(0,E.jsx)($.rA,{icon:"smart_toy",title:Q("AI 聊天"),selected:Le,onClick:()=>Ke("chat_open",!Le?"1":null)}),(0,E.jsx)("div",{className:"mobile-context-btn",children:(0,E.jsx)($.rA,{icon:"more_horiz",title:Q("右键"),onClick:()=>{const e=de[de.length-1];if(void 0!==e){const t=[...ne.folders??[],...ne.files??[]][e];if(t){const n=document.querySelectorAll(".item")[e],i=n?n.getBoundingClientRect():{left:window.innerWidth/2,bottom:100},s={preventDefault:()=>{},stopPropagation:()=>{},clientX:i.left+10,clientY:i.bottom??100},o=new C.ik;o.path=(0,P.IO)((0,p.vX)(),t.name),o.filename=t.name,o.x=s.clientX,o.y=s.clientY,o.type=t.type===m.Iw.folder?m.Iw.folder:(0,C.uL)(t.name),o.size=t.origin_size,ce({show:!0,type:_.PromptEnum.FileMenu,overlay:!1,data:o})}}else{const e={preventDefault:()=>{},stopPropagation:()=>{},clientX:window.innerWidth/2,clientY:window.innerHeight/2};Qe(e)}}})}),(0,E.jsx)(U,{})]}),(0,E.jsxs)("div",{className:"file-list-split"+(Le?" file-list-split--chat":""),children:[ct,Le&&(0,E.jsxs)(i.Fragment,{children:[(0,E.jsx)("div",{className:"studio__divider studio__divider--chat",ref:Be,onPointerDown:e=>{e.preventDefault(),Ze(!0),document.addEventListener("pointermove",lt),document.addEventListener("pointerup",rt,{once:!0})}}),(0,E.jsx)("div",{className:"studio-chat-panel",style:{width:`${Ue}em`},children:(0,E.jsx)(i.Suspense,{fallback:null,children:(0,E.jsx)(T,{inline_header:!0,sync_url:!1,file_cwd_path:Ve(),session_id:We??(dt=Ve(),l.AG.get_ai_chat_session(qe,dt)),on_session_change:e=>{Te(e),((e,t)=>{Je({...qe,[e]:t})})(Ve(),e)}})})})]})]}),Oe&&(0,E.jsx)("div",{className:"shell__overlay",onPointerUp:rt}),ve&&(0,E.jsx)(Z,{}),xe.open&&(0,E.jsx)(W,{})]});var dt}}}]);