filecat 7.27.0 → 7.27.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (25) hide show
  1. package/build/dist/{1317.6fd3354a8ea9df744438.js → 1317.88c4debdc07e0dc950c2.js} +1 -1
  2. package/build/dist/{1636.2be7829caf415f5ac3ef.js → 1636.72a76243c352d7b14b86.js} +1 -1
  3. package/build/dist/{2502.4a025e24ceade6fe41d2.js → 2502.c8f9f2c98369af4a1a3c.js} +1 -1
  4. package/build/dist/{259.c3d200599bc8d98f81bc.js → 259.a205a786acd6321cf443.js} +1 -1
  5. package/build/dist/{3659.068bbdd237be9cbcb260.js → 3659.6d636b2698d3b12a31b9.js} +1 -1
  6. package/build/dist/{3753.7cc36f8a982a052cbdc7.js → 3753.d78d7ec8d40588a28593.js} +1 -1
  7. package/build/dist/3884.9fbc20ef46caa60d805a.js +1 -0
  8. package/build/dist/5574.2f9e5b3f43901da83741.js +1 -0
  9. package/build/dist/{7133.cf2a4a51286b78a653af.js → 7133.867e3e82cd874862ec1f.js} +1 -1
  10. package/build/dist/{8603.f1cbcfd64cde885f9809.js → 8603.8fd3023b066ebaf71bfc.js} +1 -1
  11. package/build/dist/{8765.c91328121327a9359893.js → 8765.44f7008caa0a952f2c65.js} +1 -1
  12. package/build/dist/{9546.9692a1544a1c17aa0467.js → 9546.f1c334f1614f2cdcc91b.js} +1 -1
  13. package/build/dist/index.html +1 -1
  14. package/build/dist/main.f73b97bc561e0c3f5f91.js +2 -0
  15. package/build/main.js +1 -1
  16. package/package.json +7 -7
  17. package/shell/build.js +13 -24
  18. package/shell/config/webpack.exe.config.js +2 -2
  19. package/shell/config/webpack.npm.config.js +2 -2
  20. package/shell/dev.js +1 -1
  21. package/shell/filecat-watch +1 -1
  22. package/build/dist/1629.3d855a7e2ad5567924e4.js +0 -1
  23. package/build/dist/3884.bdde4e88356129e80bd1.js +0 -1
  24. package/build/dist/main.262952a5e81044442376.js +0 -2
  25. /package/build/dist/{main.262952a5e81044442376.js.LICENSE.txt → main.f73b97bc561e0c3f5f91.js.LICENSE.txt} +0 -0
@@ -1 +1 @@
1
- "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[259],{8694(e,t,a){a.d(t,{$K:()=>s,RB:()=>i,l5:()=>l,vo:()=>o,vr:()=>r});let n=function(e){return e[e.tcp=0]="tcp",e[e.udp=1]="udp",e}({});class s{open=!1;port;key="";async_ips=[]}class o{client_num_id;client_name;open=!1;ip;mask;serverIp;serverPort;key="";model=n.udp}let i=function(e){return e[e.row=1]="row",e[e.json=2]="json",e[e.form=3]="form",e}({});class r{body_type;header_type;url;method;headers;data;form_data_list;local_download_path}class l{enabled;ip;port;bypass;useForLocal;type}},75007(e,t,a){a.d(t,{h:()=>o});a(96540);var n=a(85997),s=a(74848);function o(e){return(0,s.jsxs)("h2",{className:"message",children:[(0,s.jsx)(n.In,{icon:"sentiment_dissatisfied"}),(0,s.jsx)("span",{children:e.context})]})}},47374(e,t,a){a.d(t,{e:()=>u});var n=a(96540),s=a(61973),o=a(64694),i=a(34289),r=a(61443),l=a(75725),c=a(22022),d=a(85997),p=a(74848);function u(e){let t=(0,s.zy)();const a=(0,s.Zp)(),[u,h]=(0,n.useState)([]),[m,f]=(0,n.useState)("/"),[y,_]=(0,n.useState)(void 0),{t:x,i18n:v}=(0,c.Bd)();n.useEffect(()=>{let t="",a=(0,i.vX)().split("/");a=a.filter(e=>e);const n=a.indexOf(e.baseRoute),s=[];if(-1!=n){t=(0,o.IO)(a.slice(0,n),e.baseRoute);const i=a.slice(n+1);for(let e=0;e<i.length;e++){const a=i[e];s.push({value:a,href:0===e?`${t}${a}/`:(0,o.IO)(s[e-1].href,a)})}f(t),h(s)}},[t]);const w=t=>{t.stopPropagation(),e.clickFun(t)},[g,j]=(0,n.useState)(0),k=(0,n.useRef)(null),b=(0,n.useRef)(null),N=()=>{const e=k.current,t=b.current;if(!e||!t)return;const a=[];for(const e of Array.from(t.children))a.push(e.getBoundingClientRect().width);const n=e.clientWidth;if(a.reduce((e,t)=>e+t,0)<=n||a.length<=2)return void j(e=>0===e?e:0);let s=a[0]+48,o=0;for(let e=a.length-1;e>=1&&!(s+a[e]>n);e--)s+=a[e],o++;const i=Math.max(a.length-1-o,0);j(e=>e===i?e:i)};(0,n.useEffect)(()=>{N();const e=new ResizeObserver(N);return k.current&&e.observe(k.current),()=>e.disconnect()},[u,m,t]),(0,n.useEffect)(()=>{const e=k.current;e&&0!==g&&e.scrollWidth>e.clientWidth&&g<u.length-1&&j(e=>e+1)});const K=g>0?1+g:1,S=g>0?u.slice(1,K):[],[C,A]=(0,n.useState)(null);return(0,n.useEffect)(()=>{A(null)},[t,g]),(0,p.jsxs)("div",{className:"breadcrumbs",ref:k,onClick:e=>{_(void 0!==y?void 0:"")},children:[(0,p.jsx)(n.Fragment,{children:void 0===y?(0,p.jsxs)(n.Fragment,{children:[(0,p.jsx)("span",{className:"chevron",children:(0,p.jsx)(s.N_,{to:m,onClick:w,children:(0,p.jsx)(d.In,{icon:"home"})})}),u.map((e,t)=>g>0&&t>=1&&t<K?1!==t?null:(0,p.jsxs)("span",{className:"chevron",children:[(0,p.jsx)(d.In,{icon:"keyboard_arrow_right"}),(0,p.jsx)("span",{className:"breadcrumbs-fold-dot",onClick:e=>{e.stopPropagation();const t=e.currentTarget.getBoundingClientRect();A({x:t.left,y:t.bottom})},children:"..."})]},"fold"):(0,p.jsxs)("span",{className:"chevron",children:[(0,p.jsx)(d.In,{icon:"keyboard_arrow_right"}),(0,p.jsx)(s.N_,{to:e.href,onClick:w,children:decodeURIComponent(e.value)})]},t)),(0,p.jsxs)("div",{className:"breadcrumbs-measure",ref:b,"aria-hidden":!0,children:[(0,p.jsx)("span",{className:"chevron",children:(0,p.jsx)(s.N_,{to:m,children:(0,p.jsx)(d.In,{icon:"home"})})}),u.map((e,t)=>(0,p.jsxs)("span",{className:"chevron",children:[(0,p.jsx)(d.In,{icon:"keyboard_arrow_right"}),(0,p.jsx)(s.N_,{to:e.href,children:decodeURIComponent(e.value)})]},t))]})]}):(0,p.jsx)(l.QM,{click:()=>{_(void 0)},children:(0,p.jsx)(r.Sm,{width:"100%",placeholder:x("输入跳转的目录"),handlerEnter:t=>{e.input_path_enter&&e.input_path_enter(t),_(void 0)}})})}),C&&(0,p.jsx)(l.rY,{click:()=>A(null),children:(0,p.jsx)(l.sw,{x:C.x,y:C.y,items:S.map(e=>({r:decodeURIComponent(e.value),v:e.href})),click:e=>{A(null),a(e)}})})]})}},77481(e,t,a){a.d(t,{S:()=>r,X:()=>i});var n=a(96540),s=a(61443),o=a(74848);function i(e){const[t,a]=n.useState([]),i=(0,n.useRef)(-1),[r,l]=(0,n.useState)(-1),[c,d]=(0,n.useState)(-1);(0,n.useEffect)(()=>{e.children?a(Array.isArray(e.children)?e.children:[e.children]):a(e.rows)},[e.rows,e.children]);const p=()=>{i.current=-1,l(-1),d(-1)};return(0,o.jsxs)("table",{children:[(0,o.jsx)("thead",{children:(0,o.jsx)("tr",{children:e.headers?.map((t,a)=>{const n=!!e.filter&&(e.filter.column??0)===a;let i=t;if(n){const a=e.filter,n=a.options.find(e=>e.value===a.value);null!=a.value&&n&&(i=`${t} (${n.label})`)}return(0,o.jsx)("th",{className:n?"table-filter-col":"",children:n?(0,o.jsx)(s.l6,{value:e.filter.value,options:e.filter.options,onChange:e.filter.onChange,bare:!0,trigger_label:i}):t},a)})})}),(0,o.jsx)("tbody",{children:t.map((t,a)=>{const n=!!e.onRowDrag;return(0,o.jsx)("tr",{className:n?(r===a?"row-dragging":"")+(c===a?" row-drop-target":""):"",draggable:n,onContextMenu:()=>{e.handleContextMenu&&e.handleContextMenu(t)},onDragStart:e=>{n&&(i.current=a,l(a),e.dataTransfer.effectAllowed="move")},onDragOver:e=>{!n||i.current<0||(e.preventDefault(),e.dataTransfer.dropEffect="move",d(a))},onDrop:t=>{n&&(t.preventDefault(),(()=>{const t=i.current,a=c;p(),t<0||a<0||t===a||e.onRowDrag?.(t,a)})())},onDragEnd:p,children:t.map((a,n)=>{const s=n===t.length-1?"small":"";return(0,o.jsx)("td",{className:s,style:{width:e.width??"auto"},children:a},n)})},a)})})]})}function r(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))})}},83029(e,t,a){a.d(t,{N:()=>x});var n=a(96540),s=a(34843),o=a(82893),i=a(74848);function r(e){const[t,a]=(0,s.fp)(o.AG.user_base_info);return(0,i.jsx)("div",{children:e.div?(0,i.jsx)("div",{className:"nav_list_a",style:{background:e.color},children:e.name}):e.clickItem||"dir"===e._type?(0,i.jsx)("div",{className:"nav_list_a",style:{background:e.color},onClick:()=>{"dir"!==e._type?e.clickItem&&e.clickItem(e):e.click_dir(e.item)},children:e.name}):(0,i.jsx)("a",{href:e.url,target:e.target,className:"nav_list_a",style:{background:e.color},children:e.name})})}var l=a(64694),c=a(61443),d=a(85997),p=a(61973),u=a(22022);const h=["#ffffff","#fefff8","#fcfdf1","#d3d2dc","#f8f9fd","#ebf4fe","#ebebeb","#e8f7eb","#eaf2f9"];let m,f,y=[];const _=[];function x(e){const[t,a]=(0,n.useState)([]),[x,v]=(0,n.useState)(-1),w=(0,p.zy)(),[g,j]=(0,n.useState)(!1),[k,b]=(0,n.useState)(!1),{t:N}=(0,u.Bd)(),[K,S]=(0,n.useState)([]),[C,A]=(0,s.fp)(o.AG.nav_index_add_item_by_now_list),F=e=>{-1!==x?_[x]._children=e:y=e};(0,n.useEffect)(()=>{(async()=>{if(!e.getItems)return;const t=await e.getItems();y=t,a(y)})()},[w]);(0,n.useEffect)(()=>{if(C){const e=[...t,{name:"",color:(0,l.Lr)(h),...C}];F(e),a(e),j(!0),A(void 0)}},[C]);const D=e=>{v(x+1),a(e._children),_.push(e)};return(0,i.jsxs)("div",{className:"nav_list_div scroll-div-y",children:[-1!==x&&(0,i.jsx)(d.rA,{title:"返回",icon:"arrow_back",onClick:()=>{a(0===x?y:_[x-1]._children),v(x-1),_.pop()}}),t.map((s,o)=>(0,i.jsxs)("div",{draggable:!0,onDragOver:e=>{e.preventDefault()},onDragStart:e=>((e,t)=>{m=t})(0,o),onDrop:e=>((e,n)=>{e.preventDefault();const s=t[m],o=t[n];if(o&&"dir"===o._type){const e=[...t];return e.splice(m,1),o._children||(o._children=[]),o._children.push(s),F(e),void a(e)}const i=[...t],r=i[m];i.splice(m,1),i.splice(n,0,r),F(i),a(i)})(e,o),style:{cursor:g?"move":"pointer"},children:[(0,i.jsx)(r,{name:s.name,item:s,...s,div:g,target:"_blank",click_dir:D,clickItem:e.clickItem}),g&&(void 0!==K.find(e=>e===o)||k)&&(0,i.jsxs)("div",{className:k?"":" site_edit ",children:["dir"===s._type?(0,i.jsxs)(n.Fragment,{children:[(0,i.jsx)(c.Sm,{value:s.name,handleInputChange:e=>{s.name=e},placeholder:N("输入类目名"),no_border:!0}),(0,i.jsx)(c.Sm,{value:s.color,type:"color",handleInputChange:e=>{s.color=e},placeholder:"color",no_border:!0})]}):e.items.map((e,t)=>(0,i.jsx)("div",{children:(0,i.jsx)(c.Sm,{value:s[e.key],type:"color"===e.key?"color":void 0,handleInputChange:t=>{s[e.key]=t},placeholder:e.preName,no_border:!0})},t)),!k&&(0,i.jsx)(d.C3,{text:N("折叠"),clickFun:()=>{S((0,l.P1)(K,o))}})]}),g&&(0,i.jsx)("div",{style:{display:"block"},children:(0,i.jsxs)("span",{className:"div-row ",children:[(0,i.jsx)(d.C3,{text:N("删除"),clickFun:()=>{(e=>{const n=[...t];n.splice(e,1),F(n),a(n)})(o)}}),(0,i.jsx)(d.C3,{text:N("编辑"),clickFun:()=>{void 0===K.find(e=>e===o)&&S([...K,o])}})]})})]},o)),g&&(0,i.jsxs)("div",{style:{display:"block"},children:[(0,i.jsx)(d.rA,{title:N("取消"),icon:"cancel",onClick:()=>{S([]),j(!1),f&&(a(f),F(f)),b(!1)}}),(0,i.jsx)(d.rA,{title:N("添加"),icon:"add",onClick:async()=>{const n=[...t,{name:"",color:(0,l.Lr)(h),...e.get_pre_add_item&&await e.get_pre_add_item()}];F(n),a(n)}}),(0,i.jsx)(d.rA,{title:N("添加类目"),icon:"add_box",onClick:()=>{const e=[...t,{name:"",_type:"dir",_children:[],color:"#c1edfb"}];F(e),a(e)}}),(0,i.jsx)(d.rA,{title:N("全部编辑"),icon:k?"unfold_less":"unfold_more",onClick:()=>{b(!k)}})]}),(void 0===e.have_auth_edit||!0===e.have_auth_edit)&&(0,i.jsx)(d.rA,{icon:g?"save":"edit",title:N(g?"保存":"编辑"),onClick:async()=>{g?e.save&&await e.save(y):f=t,j(!g)}})]})}},259(e,t,a){a.r(t),a.d(t,{default:()=>_e});var n=a(96540),s=a(70447),o=a(75725),i=a(61443),r=a(22022),l=a(34843),c=a(82893),d=a(85997),p=a(77481),u=a(14284),h=a(62042),m=a(40505),f=a(45907),y=a(23496),_=a(53459),x=a(78247),v=a(23430),w=a(74848);function g(){const{t:e}=(0,r.Bd)(),t=(0,f.y)(),{check_user_auth:a}=(0,x.MH)(),g=a(v.oV.browser_proxy_edit),[,j]=(0,l.fp)(c.AG.prompt_card),[k,b]=(0,n.useState)([]),[N,K]=(0,n.useState)(!1),[S,C]=(0,n.useState)(!1),[A,F]=(0,n.useState)(""),[D,L]=(0,n.useState)(""),[I,M]=(0,n.useState)(""),B=[e("状态"),e("备注"),e("目标"),e("端口"),e("访问地址"),e("操作")],P=async()=>{try{const e=await u.s2.get(y.s.browser_proxy_port_list);e.code===_.m.Success&&b(Array.isArray(e.data)?e.data:[])}catch(e){}};(0,n.useEffect)(()=>{P()},[]);const R=e=>{F(e?.id??""),L(e?`${e.proto}://${e.host}${e.root_path&&"/"!==e.root_path?e.root_path:""}`:""),M(e?.note??"")},E=()=>{K(!1),C(!1),R(void 0)},$=e=>`http://${window.location.hostname||"127.0.0.1"}:${e.port}/`,O=e=>{const t=localStorage.getItem("token")||"";return`${$(e)}${t?`?_t=${encodeURIComponent(t)}`:""}`};return(0,w.jsxs)(o.fI,{children:[(0,w.jsx)(o.VP,{widthPer:g?55:100,maxWidth:g?"90rem":void 0,children:(0,w.jsx)(o.xh,{children:(0,w.jsx)(s.uF,{self_title:(0,w.jsxs)("span",{className:" div-row ",children:[(0,w.jsx)("h2",{children:e("网页代理目标")}),(0,w.jsx)(d.rA,{icon:"info",title:e("信息"),onClick:()=>{j({open:!0,title:e("信息"),context_div:(0,w.jsx)("div",{children:(0,w.jsxs)("ul",{children:[(0,w.jsx)("li",{children:e("wbvpn_port_tip")}),(0,w.jsx)("li",{children:e("wbvpn_port_tip2")}),(0,w.jsx)("li",{children:e("wbvpn_port_tip3")})]})})})}})]}),rightTopCom:(0,w.jsx)("div",{children:g&&!S&&(0,w.jsx)(d.rA,{icon:"add",title:e("添加"),onClick:()=>{K(!0),C(!0),R(void 0)}})}),children:(0,w.jsx)(p.X,{headers:B,rows:k.map(a=>{const n=[(0,w.jsx)(d.Ay,{checked:!1!==a.enabled,disabled:!g,title:e("启用"),onChange:t=>(async(t,a)=>{try{await u.s2.post(y.s.browser_proxy_port_set_enabled,{id:t.id,enabled:a}),(0,h.SK)(e(a?"已启用":"已禁用")),await P()}catch(e){}})(a,t)}),(0,w.jsx)(s.xP,{children:a.note||"-"}),(0,w.jsx)(s.xP,{children:`${a.proto}://${a.host}`}),(0,w.jsx)(s.xP,{children:String(a.port)}),(0,w.jsx)(s.xP,{children:$(a)}),(0,w.jsxs)("div",{children:[(0,w.jsx)(d.rA,{icon:"open_in_new",title:e("新窗口打开"),onClick:()=>(e=>{window.open(O(e),"_blank","noopener,noreferrer")})(a)}),(0,w.jsx)(d.rA,{icon:"tab",title:e("当前窗口打开"),onClick:()=>(e=>{window.location.href=O(e)})(a)}),(0,w.jsx)(d.rA,{icon:"content_copy",title:e("复制"),onClick:()=>(async t=>{const a=$(t);(0,m.lW)(a)?(0,h.SK)(e("已复制")):(0,h.zN)(e("复制失败"))})(a)}),g&&(0,w.jsx)(d.rA,{icon:"edit",title:e("编辑"),onClick:()=>(e=>{K(!1),C(!0),R(e)})(a)}),g&&(0,w.jsx)(d.rA,{icon:"delete",title:e("删除"),onClick:()=>(a=>{t({title:e("确认删除"),sub_title:a.host,confirm_fun:async()=>{try{await u.s2.post(y.s.browser_proxy_port_remove,{id:a.id}),(0,h.SK)(e("已删除")),await P()}catch(e){}}})})(a)})]})];return n}),width:"10rem"})})})}),g&&S&&(0,w.jsx)(o.VP,{widthPer:45,maxWidth:"40rem",children:(0,w.jsx)(o.xh,{children:(0,w.jsxs)(s.Zp,{self_title:(0,w.jsx)("span",{className:" div-row ",children:(0,w.jsx)("h2",{children:e(""+(N?"添加":"编辑"))})}),rightBottomCom:(0,w.jsxs)("div",{children:[(0,w.jsx)(d.rA,{icon:"cancel",title:e("取消"),onClick:E}),(0,w.jsx)(d.rA,{icon:N?"add_circle":"save",title:e(N?"添加":"保存"),onClick:async()=>{if(D.trim())try{N?(await u.s2.post(y.s.browser_proxy_port_add,{address:D.trim(),note:I}),(0,h.SK)(e("添加成功"))):(await u.s2.post(y.s.browser_proxy_port_update,{id:A,address:D.trim(),note:I}),(0,h.SK)(e("修改成功"))),E(),await P()}catch(e){}else(0,h.zN)(e("目标地址不能为空"))}})]}),children:[(0,w.jsx)("label",{children:e("目标地址")}),(0,w.jsx)(i.Sm,{value:D,placeholder:e("目标地址例如"),handleInputChange:e=>L(e)}),(0,w.jsx)("label",{children:e("备注")}),(0,w.jsx)(i.Sm,{value:I,handleInputChange:e=>M(e)})]})})})]})}function j(e){return(0,w.jsx)(g,{})}var k=a(34289),b=a(4412),N=(a(75007),a(83029)),K=a(97856),S=a(92275),C=a(14944),A=a(64405);const F=n.lazy(()=>Promise.all([a.e(2543),a.e(5614)]).then(a.bind(a,85614)));function D(e){const[t,a]=(0,n.useState)(null),[s,o]=(0,l.fp)(c.AG.remoteShellShow),[i,r]=(0,n.useState)(!1),[d,p]=(0,l.fp)(c.AG.sshInfo),[u,h]=(0,l.fp)(c.AG.shellNowDir),[m,f]=(0,l.fp)(c.AG.user_base_info),y=m.user_data.theme?.includes("dark")?"#FFFFFF":"#000000",_=()=>{(async()=>{t&&(t.dispose(),a(null))})()};(0,n.useEffect)(()=>()=>{_()},[]),(0,n.useEffect)(()=>{s.show?t||((async()=>{const e=new K.Terminal({fontFamily:"Monaco, Menlo, Consolas, 'Courier New', monospace",theme:{background:"#FFFFFF",foreground:y,cursor:y,selectionBackground:"#a6d2ff"},cursorBlink:!0,cursorStyle:"bar",scrollback:1e3,scrollSensitivity:1,tabStopWidth:4});let t;const n=t=>{e.write(t)};t=a=>{e.clear(),e.write(a),t=n},C.ws.addMsg(S.HK.remote_shell_getting,e=>{t(e.context)}),e.onData(async e=>{const t=new A.x;t.key=d.key,t.cmd=e;const a=new S.hf(S.HK.remote_shell_send);a.context=t,await C.ws.send(a)}),a(e)})(),r(!0)):_()},[s]);return(0,w.jsx)(F,{show:s.show,terminal:t,init:(e,a)=>{t.writeln("open shell... ");const n=new S.hf(S.HK.remote_shell_open),o=new A.x;o.key=d.key,o.init_path=s.path,o.rows=e,o.cols=a,n.context=o,C.ws.send(n)}})}var L=a(47374),I=a(61973),M=a(99214),B=a(47022),P=a(88815),R=a(6960),E=a(79240),$=a(78150),O=a(12730);function G(e){const{t}=(0,r.Bd)();(0,I.zy)();(0,I.Zp)();const{check_user_auth:a}=(0,x.MH)(),[s,o]=(0,l.fp)(c.AG.nowFileList),[i,p]=(0,l.fp)(c.AG.uploadFiles),[u,m]=(0,l.fp)(c.AG.showPrompt),[f,y]=(0,l.fp)(c.AG.selectedFileList),[_,v]=(0,l.fp)(c.AG.enterKey),[g,j]=(0,l.fp)(c.AG.copyedFileList),[b,N]=(0,l.fp)(c.AG.cutedFileList),[K,S]=(0,l.fp)(c.AG.selectedFileList),[C,A]=(0,l.fp)(c.AG.clickFileList),[F,D]=(0,l.fp)(c.AG.remoteShellShow),[L,P]=(0,l.fp)(c.AG.sshInfo),R=(0,M.Vs)();function E(e){(0,h.SK)(e)}return(0,w.jsxs)(n.Fragment,{children:[f.length>0&&(0,w.jsx)(d.rA,{icon:"delete",title:t("删除"),onClick:()=>{m({show:!0,type:$.PromptEnum.SshDelete,overlay:!0,data:{}})}}),f.length>0&&(0,w.jsx)(d.rA,{icon:"content_copy",title:t("复制"),onClick:function(){const e=(0,M.ib)(s,f);j(e.map(e=>`/${(0,k.GG)("remoteShell",(0,k.vX)())}${e.name}`)),N([]),E("已复制")}}),f.length>0&&(0,w.jsx)(d.rA,{icon:"content_cut",title:t("剪切"),onClick:function(){const e=(0,M.ib)(s,f);N(e.map(e=>`/${(0,k.GG)("remoteShell",(0,k.vX)())}${e.name}`)),j([]),E("已剪切")}}),(g.length>0||b.length>0)&&(0,w.jsx)(d.rA,{onClick:function(){m({show:!0,type:$.PromptEnum.SshPaste,overlay:!0,data:{}})},icon:"content_paste",title:t("粘贴到此处"),tip:g.length+b.length}),1===f.length&&s.files.length>=1&&(0,M.ib)(s,f)[0].type!==B.Iw.folder&&(0,w.jsx)(d.rA,{icon:"download",title:t("下载"),onClick:function(){const e=(0,M.ib)(s,f),t=`/api/ssh/download?file=${`/${(0,k.GG)("remoteShell",(0,k.vX)())}${decodeURIComponent(e[0].name)}`}&key=${L.key}&token=${localStorage.getItem("token")}`;window.open(t)}}),1===f.length&&(0,w.jsx)(d.rA,{icon:"edit_attributes",title:t("重命名"),onClick:function(){m({show:!0,type:$.PromptEnum.SshReName,overlay:!0,data:{}})}}),(0,w.jsx)(d.rA,{icon:"terminal",title:"shell",onClick:function(){F.show?D({show:!1,path:""}):D({show:!0,path:`/${(0,k.GG)("remoteShell",(0,k.vX)())}`})}}),(0,w.jsx)(d.rA,{icon:"grid_view",title:t("切换样式"),onClick:R}),(0,w.jsx)(d.rA,{icon:"create_new_folder",title:t("创建文件夹"),onClick:function(){m({show:!0,type:$.PromptEnum.SshNewDir,overlay:!0,data:{}})}}),(0,w.jsx)(d.rA,{icon:"note_add",title:t("创建文本文件"),onClick:function(){m({show:!0,type:$.PromptEnum.SshNewFile,overlay:!0,data:{}})}}),(0,w.jsx)(d.rA,{icon:"upload_file",title:"上传",onClick:()=>{m({show:!0,type:$.PromptEnum.UploadFile,overlay:!0,data:{call:e=>{let t=e.currentTarget?.files;if(!t)return;let a=!!t[0].webkitRelativePath;const n=[],s=new Set;for(let e=0;e<t.length;e++){const o=t[e],i=a?o.webkitRelativePath:`${o.webkitRelativePath}${o.name}`;o.fullPath=i,a&&s.add((0,O.S)(i)),n.push(o)}const o=[];if(a)for(const e of Array.from(s))o.push({isDir:!0,fullPath:e,name:e});o.push(...n),p(o),m({show:!0,type:$.PromptEnum.SshUpload,overlay:!1,data:{}})}}})}}),(0,w.jsx)(d.rA,{icon:"close",title:t("关闭"),onClick:()=>{e.close()}})]})}var H=a(60096),T=a(21499);let z;function U(e){const{t}=(0,r.Bd)(),a=(0,I.zy)(),[s,o]=(0,l.fp)(c.AG.nowFileList),[d,p]=(0,l.fp)(c.AG.selectedFileList),[m,f]=(0,l.fp)(c.AG.clickFileList),[y,x]=(0,l.fp)(c.AG.sshInfo),[g,j]=(0,n.useState)(""),N=(0,I.Zp)(),[K,S]=(0,l.fp)(c.AG.user_base_info),C=async e=>{const a=new A.x;a.key=y.key,a.dir=e||`/${(0,k.GG)("remoteShell",(0,k.vX)())}`;const n=await u.Fg.post("get/dir",a);if(n.code!==_.m.Success)return void(0,h.zN)(t("连接失败"));const{folders:s,files:i}=n.data||{};for(const e of i??[])e.origin_size=e.size,e.size=(0,P.v7)(e.size),K.user_data.file_time_show_type===v.KD.time?e.show_mtime=e.mtime?(0,T.Yq)(e.mtime):"":e.show_mtime=e.mtime?(0,R.s)(e.mtime):"";for(const e of s??[])K.user_data.file_time_show_type===v.KD.time?e.show_mtime=e.mtime?(0,T.Yq)(e.mtime):"":e.show_mtime=e.mtime?(0,R.s)(e.mtime):"";const r={folders:s||[],files:i||[]};(0,M.yC)(r,K.user_data.dir_show_type),o(r),z=r};function F(){p([]),f([])}(0,n.useEffect)(()=>{F(),(async()=>{await C()})()},[a]);return(0,w.jsxs)(n.Fragment,{children:[(0,w.jsx)(b.aZ,{children:(0,w.jsx)(i.$Z,{handleEnterPress:()=>{if(!z)return;p([]),f([]);const e=[],t=[];for(const t of z.files??[])t.name.includes(g)&&e.push(t);for(const e of z.folders??[])e.name.includes(g)&&t.push(e);o({files:e,folders:t})},placeholder:t("搜索当前目录"),icon:"search",value:"",handleInputChange:e=>{j(e)},max_width:"25em"})}),(0,w.jsx)(b.aZ,{position:"right",children:(0,w.jsx)(G,{close:e.close})}),(0,w.jsx)(L.e,{baseRoute:"remoteShell",clickFun:F,input_path_enter:e=>{(0,E.Z1)(e)?C(e):N((0,E.Jn)((0,k.vX)(),e)),p([]),f([]),o({files:[],folders:[]})}}),(0,w.jsx)(H.Ic,{handleContextMenu:()=>{},clickBlank:e=>{e.target===e.currentTarget&&p([])},file_list:s.files,folder_list:s.folders,fileHandler:C}),(0,w.jsx)(D,{})]})}function V(e){const{t}=(0,r.Bd)(),a=(0,I.Zp)(),[s,o]=(0,n.useState)(""),[p,m]=(0,n.useState)(""),[f,y]=(0,n.useState)(""),[g,j]=(0,n.useState)(""),[k,K]=(0,n.useState)(void 0),[S,C]=(0,n.useState)(""),[F,D]=(0,l.fp)(c.AG.shellNowDir),[L,M]=(0,l.fp)(c.AG.sshInfo),{check_user_auth:B}=(0,x.MH)(),P=async e=>{const t=new A.x;if(t.password=e?e.password:p,t.domain=e?e.domain:g,t.port=e?e.port:k,t.username=e?e.username:s,t.private_path=e?e.private_path:f,t.dir=e?e.dir:S,!t.dir)return void(0,h.zN)("dir not found");if(!t.username)return void(0,h.zN)("username not found");if(!t.domain)return void(0,h.zN)("domain not found");if(!t.port)return void(0,h.zN)("port not found");if(!t.private_path&&!t.password)return void(0,h.zN)("private_path password not found");const n=await u.Fg.post("start",t);n&&n.code===_.m.Success&&(a((0,E.Jn)("/proxy/remoteShell",t.dir)),D([t.dir]),M(n.data))};return(0,w.jsxs)(n.Fragment,{children:[!L.key&&(0,w.jsxs)(b.aZ,{position:"right",children:[(0,w.jsx)(i.$Z,{placeholder:t("目录"),icon:"home",value:S,handleInputChange:e=>C(e),max_width:"15rem"}),(0,w.jsx)(i.$Z,{placeholder:t("账号"),icon:"verified_user",value:s,handleInputChange:e=>o(e),max_width:"15rem"}),(0,w.jsx)(i.$Z,{type:"password",placeholder:t("密码"),icon:"password",value:p,handleInputChange:e=>m(e),max_width:"15rem"}),(0,w.jsx)(i.$Z,{placeholder:t("私钥路径"),icon:"private_connectivity",value:f,handleInputChange:e=>y(e),max_width:"15rem"}),(0,w.jsx)(i.$Z,{placeholder:t("连接地址"),icon:"location_on",value:g,handleInputChange:e=>{j(e)},max_width:"15rem"}),(0,w.jsx)(i.$Z,{placeholder:t("端口"),icon:"outlet",value:k,handleInputChange:e=>{if(!e)return;/^\d+$/.test(e)||(0,h.zN)(t("不是数字")),K(parseInt(e))},max_width:"7rem"}),(0,w.jsx)(d.rA,{icon:"play_arrow",title:t("连接"),onClick:()=>{P()}})]}),L.key?(0,w.jsx)(U,{close:async()=>{const e=new A.x;e.key=L.key;await u.Fg.post("close",e);M({})},data:{port:k,password:p,username:s,domain:g,dir:S}}):(0,w.jsx)(N.N,{have_auth_edit:B(v.oV.ssh_proxy_tag_update),getItems:async()=>{const e=await u.Fg.get("tag");return e.code===_.m.Success?e.data:[]},save:async e=>{await u.Fg.post("tag/save",e)},clickItem:async e=>{j(e.domain),C(e.dir),K(e.port),o(e.username),m(e.password),y(e.private_path),await P(e)},items:[{key:"name",preName:t("名字")},{key:"domain",preName:t("地址")},{key:"port",preName:t("端口")},{key:"username",preName:t("账号")},{key:"password",preName:t("密码")},{key:"private_path",preName:t("私钥路径")},{key:"dir",preName:t("访问目录")},{key:"color",preName:"color"}]})]})}function Z(e){switch(e){case 0:return 1;case 2:return 2;default:return 0}}class J{constructor(e){this.canvas=e,this.render=new ee.Canvas.create(this.canvas),this.activeSession=!1,this.install()}close(){this.activeSession=!1}install(){var e=this;return this.canvas.addEventListener("mousemove",function(t){var a=ee.elementOffset(e.canvas);return C.ws.sendData(S.HK.mouse,{x:t.clientX-a.left,y:t.clientY-a.top,button:0,isPressed:!1}),t.preventDefault||e.activeSession(),!1}),this.canvas.addEventListener("mousedown",function(t){var a=ee.elementOffset(e.canvas);return C.ws.sendData(S.HK.mouse,{x:t.clientX-a.left,y:t.clientY-a.top,button:Z(t.button),isPressed:!0}),t.preventDefault(),!1}),this.canvas.addEventListener("mouseup",function(t){if(e.activeSession){var a=ee.elementOffset(e.canvas);return C.ws.sendData(S.HK.mouse,{x:t.clientX-a.left,y:t.clientY-a.top,button:Z(t.button),isPressed:!1}),t.preventDefault(),!1}}),this.canvas.addEventListener("contextmenu",function(t){if(e.activeSession){var a=ee.elementOffset(e.canvas);return C.ws.sendData(S.HK.mouse,{x:t.clientX-a.left,y:t.clientY-a.top,button:Z(t.button),isPressed:!1}),t.preventDefault(),!1}}),this.canvas.addEventListener("DOMMouseScroll",function(t){if(e.activeSession){var a=t.detail,n=Math.round(15*Math.abs(a)/8),s=ee.elementOffset(e.canvas);return C.ws.sendData(S.HK.wheel,{x:t.clientX-s.left,y:t.clientY-s.top,step:n,isNegative:a>0,isHorizontal:!1}),t.preventDefault(),!1}}),this.canvas.addEventListener("mousewheel",function(t){if(e.activeSession){var a=Math.abs(t.deltaX)>Math.abs(t.deltaY),n=a?t.deltaX:t.deltaY,s=Math.round(15*Math.abs(n)/8),o=ee.elementOffset(e.canvas);return C.ws.sendData(S.HK.wheel,{x:t.clientX-o.left,y:t.clientY-o.top,step:s,isNegative:n>0,isHorizontal:a}),t.preventDefault(),!1}}),window.addEventListener("keydown",function(t){if(e.activeSession)return C.ws.sendData(S.HK.scancode,{code:ee.scancode(t),isPressed:!0}),t.preventDefault(),!1}),window.addEventListener("keyup",function(t){if(e.activeSession)return C.ws.sendData(S.HK.scancode,{code:ee.scancode(t),isPressed:!1}),t.preventDefault(),!1}),this}connect(e,t,a,n,s,o){var i=this;C.ws.addMsg(S.HK.rdp_connect,e=>{console.log("[mstsc.js] connected"),i.activeSession=!0}),C.ws.addMsg(S.HK.rdp_bitmap,e=>{const t=e.context;t.data=e.bin_context,i.render.update(t)}),C.ws.addMsg(S.HK.rdp_close,e=>{o(null),console.log("[mstsc.js] close"),i.activeSession=!1}),C.ws.addMsg(S.HK.rdp_error,e=>{i.activeSession=!1});const r=new S.hf;r.cmdType=S.HK.infos,r.context={ip:e.indexOf(":")>-1?e.split(":")[0]:e,port:a,screen:{width:this.canvas.width,height:this.canvas.height},domain:t,username:n,password:s,locale:ee.locale()},C.ws.send(r)}}class X{constructor(e){this.canvas=e,this.ctx=e.getContext("2d")}update(e){var t=null;t=e.isCompress?function(e){var t=null;switch(e.bitsPerPixel){case 15:t="bitmap_decompress_15";break;case 16:t="bitmap_decompress_16";break;case 24:t="bitmap_decompress_24";break;case 32:t="bitmap_decompress_32";break;default:throw"invalid bitmap data format"}var a=new Uint8Array(e.data),n=Module._malloc(a.length),s=new Uint8Array(Module.HEAPU8.buffer,n,a.length);s.set(a);var o=e.destRight-e.destLeft+1,i=e.destBottom-e.destTop+1,r=o*i*4,l=Module._malloc(r),c=new Uint8Array(Module.HEAPU8.buffer,l,r),d=(Module.ccall(t,"number",["number","number","number","number","number","number","number","number"],[c.byteOffset,o,i,e.width,e.height,s.byteOffset,a.length]),new Uint8ClampedArray(c.buffer,c.byteOffset,r));return Module._free(n),Module._free(l),{width:o,height:i,data:d}}(e):function(e){return{width:e.width,height:e.height,data:new Uint8ClampedArray(e.data)}}(e);var a=this.ctx.createImageData(t.width,t.height);a.data.set(t.data),this.ctx.putImageData(a,e.destLeft,e.destTop)}}var Y={"":0,Escape:1,Digit1:2,Digit2:3,Digit3:4,Digit4:5,Digit5:6,Digit6:7,Digit7:8,Digit8:9,Digit9:10,Digit0:11,Minus:12,Equal:13,Backspace:14,Tab:15,KeyQ:16,KeyW:17,KeyE:18,KeyR:19,KeyT:20,KeyY:21,KeyU:22,KeyI:23,KeyO:24,KeyP:25,BracketLeft:26,BracketRight:27,Enter:28,ControlLeft:29,KeyA:30,KeyS:31,KeyD:32,KeyF:33,KeyG:34,KeyH:35,KeyJ:36,KeyK:37,KeyL:38,Semicolon:39,Quote:40,Backquote:41,ShiftLeft:42,Backslash:43,KeyZ:44,KeyX:45,KeyC:46,KeyV:47,KeyB:48,KeyN:49,KeyM:50,Comma:51,Period:52,Slash:53,ShiftRight:54,NumpadMultiply:55,AltLeft:56,Space:57,CapsLock:58,F1:59,F2:60,F3:61,F4:62,F5:63,F6:64,F7:65,F8:66,F9:67,F10:68,Pause:69,ScrollLock:70,Numpad7:71,Numpad8:72,Numpad9:73,NumpadSubtract:74,Numpad4:75,Numpad5:76,Numpad6:77,NumpadAdd:78,Numpad1:79,Numpad2:80,Numpad3:81,Numpad0:82,NumpadDecimal:83,PrintScreen:84,IntlBackslash:86,F11:87,F12:88,NumpadEqual:89,F13:100,F14:101,F15:102,F16:103,F17:104,F18:105,F19:106,F20:107,F21:108,F22:109,F23:110,KanaMode:112,Lang2:113,Lang1:114,IntlRo:115,F24:118,Convert:121,NonConvert:123,IntlYen:125,NumpadComma:126,MediaTrackPrevious:57360,MediaTrackNext:57369,NumpadEnter:57372,ControlRight:57373,VolumeMute:57376,LaunchApp2:57377,MediaPlayPause:57378,MediaStop:57380,VolumeDown:57390,VolumeUp:57392,BrowserHome:57394,NumpadDivide:57397,PrintScreen:57399,AltRight:57400,NumLock:57413,Pause:57414,Home:57415,ArrowUp:57416,PageUp:57417,ArrowLeft:57419,ArrowRight:57421,End:57423,ArrowDown:57424,PageDown:57425,Insert:57426,Delete:57427,OSLeft:57435,OSRight:57436,ContextMenu:57437,Power:57438,BrowserSearch:57445,BrowserFavorites:57446,BrowserRefresh:57447,BrowserStop:57448,BrowserForward:57449,BrowserBack:57450,LaunchApp1:57451,LaunchMail:57452,MediaSelect:57453},W={27:"Escape",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",192:"Backquote",49:"Digit1",50:"Digit2",51:"Digit3",52:"Digit4",53:"Digit5",54:"Digit6",55:"Digit7",56:"Digit8",57:"Digit9",48:"Digit0",173:"Minus",61:"Equal",8:"Backspace",9:"Tab",81:"KeyQ",87:"KeyW",69:"KeyE",82:"KeyR",84:"KeyT",89:"KeyY",85:"KeyU",73:"KeyI",79:"KeyO",80:"KeyP",219:"BracketLeft",221:"BracketRight",13:"Enter",20:"CapsLock",65:"KeyA",83:"KeyS",68:"KeyD",70:"KeyF",71:"KeyG",72:"KeyH",74:"KeyJ",75:"KeyK",76:"KeyL",59:"Semicolon",222:"Quote",220:"Backslash",16:"ShiftLeft",220:"IntlBackslash",90:"KeyZ",88:"KeyX",67:"KeyC",86:"KeyV",66:"KeyB",78:"KeyN",77:"KeyM",188:"Comma",190:"Period",191:"Slash",16:"ShiftRight",17:"ControlLeft",18:"AltLeft",91:"OSLeft",32:"Space",18:"AltRight",91:"OSRight",93:"ContextMenu",17:"ControlRight",37:"ArrowLeft",38:"ArrowUp",40:"ArrowDown",39:"ArrowRight",144:"NumLock",144:"NumLock",111:"NumpadDivide",106:"NumpadMultiply",109:"NumpadSubtract",103:"Numpad7",104:"Numpad8",105:"Numpad9",107:"NumpadAdd",100:"Numpad4",101:"Numpad5",102:"Numpad6",97:"Numpad1",98:"Numpad2",99:"Numpad3",13:"NumpadEnter",96:"Numpad0",110:"NumpadDecimal",17:"ControlLeft"},q={firefox:{fr:{27:"Escape",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",0:"Backquote",49:"Digit1",50:"Digit2",51:"Digit3",52:"Digit4",53:"Digit5",54:"Digit6",55:"Digit7",56:"Digit8",57:"Digit9",48:"Digit0",169:"Minus",61:"Equal",8:"Backspace",9:"Tab",65:"KeyQ",90:"KeyW",69:"KeyE",82:"KeyR",84:"KeyT",89:"KeyY",85:"KeyU",73:"KeyI",79:"KeyO",80:"KeyP",160:"BracketLeft",164:"BracketRight",13:"Enter",20:"CapsLock",20:"CapsLock",81:"KeyA",83:"KeyS",68:"KeyD",70:"KeyF",71:"KeyG",72:"KeyH",74:"KeyJ",75:"KeyK",76:"KeyL",77:"Semicolon",165:"Quote",170:"Backslash",16:"ShiftLeft",60:"IntlBackslash",87:"KeyZ",88:"KeyX",67:"KeyC",86:"KeyV",66:"KeyB",78:"KeyN",188:"KeyM",59:"Comma",58:"Period",161:"Slash",16:"ShiftRight",17:"ControlLeft",91:"OSLeft",18:"AltLeft",32:"Space",17:"ControlLeft",18:"AltRight",91:"OSRight",93:"ContextMenu",17:"ControlRight",37:"ArrowLeft",38:"ArrowUp",40:"ArrowDown",39:"ArrowRight",144:"NumLock",144:"NumLock",111:"NumpadDivide",106:"NumpadMultiply",109:"NumpadSubtract",103:"Numpad7",104:"Numpad8",105:"Numpad9",107:"NumpadAdd",100:"Numpad4",101:"Numpad5",102:"Numpad6",97:"Numpad1",98:"Numpad2",99:"Numpad3",96:"Numpad0",110:"NumpadDecimal",13:"NumpadEnter",17:"ControlLeft",67:"KeyC",17:"ControlLeft"},en:W},chrome:{fr:{27:"Escape",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",0:"Backquote",49:"Digit1",50:"Digit2",51:"Digit3",52:"Digit4",53:"Digit5",54:"Digit6",55:"Digit7",56:"Digit8",57:"Digit9",48:"Digit0",219:"Minus",187:"Equal",8:"Backspace",9:"Tab",65:"KeyQ",90:"KeyW",69:"KeyE",82:"KeyR",84:"KeyT",89:"KeyY",85:"KeyU",73:"KeyI",79:"KeyO",80:"KeyP",221:"BracketLeft",186:"BracketRight",13:"Enter",20:"CapsLock",20:"CapsLock",81:"KeyA",83:"KeyS",68:"KeyD",70:"KeyF",71:"KeyG",72:"KeyH",74:"KeyJ",75:"KeyK",76:"KeyL",77:"Semicolon",192:"Quote",220:"Backslash",16:"ShiftLeft",60:"IntlBackslash",87:"KeyZ",88:"KeyX",67:"KeyC",86:"KeyV",66:"KeyB",78:"KeyN",188:"KeyM",190:"Comma",191:"Period",223:"Slash",16:"ShiftRight",17:"ControlLeft",91:"OSLeft",18:"AltLeft",32:"Space",17:"ControlLeft",18:"AltRight",91:"OSRight",93:"ContextMenu",17:"ControlRight",37:"ArrowLeft",38:"ArrowUp",40:"ArrowDown",39:"ArrowRight",144:"NumLock",144:"NumLock",111:"NumpadDivide",106:"NumpadMultiply",109:"NumpadSubtract",103:"Numpad7",104:"Numpad8",105:"Numpad9",107:"NumpadAdd",100:"Numpad4",101:"Numpad5",102:"Numpad6",97:"Numpad1",98:"Numpad2",99:"Numpad3",96:"Numpad0",110:"NumpadDecimal",13:"NumpadEnter",17:"ControlLeft",67:"KeyC",17:"ControlLeft"},en:W}};function Q(){}Q.prototype={$:function(e){return document.getElementById(e)},elementOffset:function(e){for(var t=0,a=0;e&&!isNaN(e.offsetLeft)&&!isNaN(e.offsetTop);)t+=e.offsetLeft-e.scrollLeft,a+=e.offsetTop-e.scrollTop,e=e.offsetParent;return{top:a,left:t}},browser:function(){return"undefined"!=typeof InstallTrigger?"firefox":window.chrome?"chrome":document.docuemntMode?"ie":null},locale:function(){return window.navigator.userLanguage||window.navigator.language},client:{create:function(e){return new J(e)}},Canvas:{create:function(e){return new X(e)}},scancode(e){var t=Q.prototype.locale();return t=["fr","en"].indexOf(t)>0&&t||"en",Y[e.code||q[Q.prototype.browser()||"firefox"][t][e.keyCode]]}};let ee=new Q;var te=a(38240);let ae;function ne(){const{t:e}=(0,r.Bd)(),[t,a]=(0,l.fp)(c.AG.header_min),{check_user_auth:s}=(0,x.MH)(),[p,m]=(0,n.useState)(void 0),[f,y]=(0,n.useState)(3389),[g,j]=(0,n.useState)(void 0),[k,K]=(0,n.useState)(void 0),[A,F]=(0,n.useState)(!1),[D,L]=(0,n.useState)(!1);var I=null;(0,n.useEffect)(()=>(ae||(async()=>{try{await(0,te.J)("rle.js"),ae=!0}catch(t){return void(0,h.zN)(e("加载资源失败"))}})(),()=>{I&&(I.close(),I=null)}),[]);const M=t=>{L(!0),function(n,s,o,i){if(n=n||t.address,o=o||t.username,i=i||t.password,!n||!o)return(0,h.zN)(e("ip或者账号不允许为空")),void L(!1);!function(e){I||(I=ee.client.create(ee.$(e)))}("rdpwebview");var r=ee.$("rdpwebview");r.style.display="inline",r.width=window.innerWidth,r.height=window.innerHeight,F(!0),a(!0),I.connect(n,"",s,o,i,function(e){ee.$("rdpwebview").style.display="none",a(!1),L(!1),F(!1)})}(p,f,g,k)};return(0,w.jsxs)("div",{children:[(0,w.jsxs)(b.aZ,{position:"right",children:[(0,w.jsx)(i.$Z,{placeholder:e("地址"),icon:"network_ping",value:p,max_width:"15rem",handleInputChange:e=>m(e)}),(0,w.jsx)(i.$Z,{placeholder:e("端口"),icon:"outlet",value:f,max_width:"10rem",handleInputChange:e=>{e&&y(parseInt(e))}}),(0,w.jsx)(i.$Z,{placeholder:e("账号"),icon:"manage_accounts",value:g,max_width:"15rem",handleInputChange:e=>j(e)}),(0,w.jsx)(i.$Z,{placeholder:e("密码"),icon:"password",value:k,max_width:"15rem",handleInputChange:e=>K(e)}),!D&&(0,w.jsx)(d.rA,{icon:"play_arrow",title:e("连接"),onClick:M}),D&&(0,w.jsx)(d.rA,{icon:"close",title:e("关闭"),onClick:async()=>{F(!1),await C.ws.sendData(S.HK.rdp_disconnect,"");var e=ee.$("rdpwebview");e.getContext("2d").clearRect(0,0,e.width,e.height),ee.$("rdpwebview").style.display="none",L(!1),a(!1)}})]}),(0,w.jsxs)(o.jW,{isFull:A,children:[!D&&(0,w.jsx)(N.N,{have_auth_edit:s(v.oV.rdp_proxy_tag_update),getItems:async()=>{const e=await u.J0.get("tag");return e.code===_.m.Success?e.data:[]},save:async t=>{(await u.J0.post("tag/save",t)).code!==_.m.Success&&(0,h.zN)(e("网络错误"))},clickItem:async e=>{K(e.password),j(e.username),m(e.address),y(e.port),M(e)},items:[{key:"name",preName:e("名字")},{key:"address",preName:e("地址")},{key:"port",preName:e("端口")},{key:"username",preName:e("账号")},{key:"password",preName:e("密码")},{key:"color",preName:"color"}]}),(0,w.jsx)("canvas",{id:"rdpwebview",style:{display:"none"}})]})]})}var se=a(8694),oe=a(19324);const ie=(0,n.createContext)({activeKey:"",setActiveKey:()=>{}});function re(e){const{children:t,activeKey:a,defaultActiveKey:s,onChange:o,width:i}=e,[r,l]=(0,n.useState)(()=>a??s??"");(0,n.useEffect)(()=>{void 0!==a&&l(a)},[a]);const c=e=>{void 0===a&&l(e),o&&o(e)},d=[];return n.Children.forEach(t,e=>{n.isValidElement(e)&&e.type===le&&d.push({key:e.props.itemKey,tab:e.props.tab,disabled:e.props.disabled})}),(0,n.useEffect)(()=>{!r&&d.length>0&&l(d[0].key)},[d,r]),(0,w.jsx)(ie.Provider,{value:{activeKey:r,setActiveKey:c},children:(0,w.jsxs)("div",{className:"modern-tabs-container",style:{width:i||"100%"},children:[(0,w.jsx)("div",{className:"modern-tabs-nav",children:d.map(e=>{const t=["modern-tabs-tab",r===e.key?"active":"",e.disabled?"disabled":""].filter(Boolean).join(" ");return(0,w.jsx)("div",{className:t,onClick:()=>!e.disabled&&c(e.key),children:e.tab},e.key)})}),(0,w.jsx)("div",{className:"modern-tabs-content",children:t})]})})}function le(e){const{itemKey:t,children:a}=e,{activeKey:s}=(0,n.useContext)(ie),o=s===t;return(0,w.jsx)("div",{className:"modern-tab-panel "+(o?"active":""),children:a})}const ce=n.lazy(()=>Promise.all([a.e(122),a.e(4091)]).then(a.bind(a,84091)));let de,pe,ue,he;function me(){const{t:e}=(0,r.Bd)(),[t,a]=(0,l.fp)(c.AG.confirm),[f,y]=(0,l.fp)(c.AG.showPrompt),{check_user_auth:g}=(0,x.MH)(),[j,k]=(0,n.useState)(""),[b,K]=(0,l.fp)(c.AG.router_jump),[A,F]=(0,n.useState)("get"),[D,L]=(0,n.useState)(""),[I,M]=(0,n.useState)(void 0),[B,R]=(0,n.useState)([]),[E,O]=(0,n.useState)([]),[G,H]=(0,n.useState)("headers"),[z,U]=(0,n.useState)(String(se.RB.row)),[V,Z]=(0,n.useState)("body"),[J,X]=(0,n.useState)(),[Y,W]=(0,l.fp)(c.AG.nav_index_add_item_by_now_list),[q,Q]=(0,l.fp)(c.AG.prompt_card);x.xK.set_value_temp("{}",0),x.xK.set_value_temp("",1),(0,n.useEffect)(()=>(de={},pe="",ue="",he="",x.xK.get_editor(0).session.setMode("ace/mode/json"),b.http_download_map_path&&(M(b.http_download_map_path),K({})),C.ws.sendData(S.HK.http_download_water,void 0).then(()=>{C.ws.addMsg(S.HK.http_download_water,e=>{const t=e.context;O(t)})}),()=>{C.ws&&"function"==typeof C.ws.removeMsg&&C.ws.removeMsg(S.HK.http_download_water)}),[]);const ee=e=>{const t=new se.vr;t.url=D,t.method=A,t.header_type="headers"===G?1:2,"headers"===G&&(de=JSON.parse(x.xK.get_editor_value(0))),t.headers=de;const a=Number(z);if(t.body_type=a,a===se.RB.row)pe=x.xK.get_editor_value(1),t.data=pe;else if(a===se.RB.json)de["Content-Type"]="application/json",pe=x.xK.get_editor_value(1),t.data=pe;else if(a===se.RB.form){de["Content-Type"]="multipart/form-data",t.form_data_list=B;for(const t of B)t.key&&t.is_file&&e&&e.append(t.fullPath,t.file_object)}return t};return(0,w.jsx)("div",{children:(0,w.jsxs)(o.xh,{children:[(0,w.jsxs)(o.fI,{children:[(0,w.jsxs)(o.VP,{children:[0!==E.length&&(0,w.jsx)(s.Zp,{title:"正在下载",children:(0,w.jsx)("div",{children:E.map((t,a)=>(0,w.jsxs)("div",{children:[(0,w.jsxs)("div",{className:"div-row",children:[(0,w.jsx)(d.rA,{icon:"cancel",title:e("取消"),onClick:()=>{C.ws.sendData(S.HK.http_download_cancel,t.local_download_path)}}),(0,w.jsx)(s.xP,{context:t.filename,tip_context:t.local_download_path}),(0,w.jsx)("span",{style:{paddingLeft:".3rem",color:"green"},children:`${t.progresses??0}% ${t.loaded?(0,P.v7)(t.loaded):""}MB / ${t.seep??""}MB/s `})]}),(0,w.jsx)("div",{style:{width:t.progresses?`${t.progresses}%`:"0",backgroundColor:"#40c4ff",height:"5px",transition:"0.2s ease width",borderRadius:"10px"}})]},a))})}),(0,w.jsxs)(s.Zp,{title:"",rightBottomCom:Number(z)===se.RB.form&&"body"===G&&(0,w.jsx)(d.rA,{icon:"add",title:e("添加"),onClick:()=>{R([{},...B])}}),children:[(0,w.jsxs)("div",{className:"http_url",children:[(0,w.jsx)(i.l6,{width:"10rem",value:A,onChange:e=>{F(e)},options:[{value:"get",color:"#28a745"},{value:"post",color:"#007bff"},{value:"put",color:"#fd7e14"},{value:"delete",color:"#dc3545"},{value:"head",color:"#6f42c1"},{value:"options",color:"#17a2b8"},{value:"connect",color:"#666666"},{value:"trace",color:"#666666"},{value:"custom",color:"#e83e8c"}]}),(0,w.jsx)(i.Sm,{width:"50rem",placeholder:e("http url"),value:D,handleInputChange:e=>{L(e)}}),(0,w.jsx)(d.rA,{icon:"send",title:e("发送"),onClick:async()=>{if(!u._U.have_http_method(A))return void(0,h.zN)(e("不存在的http method"));if(!D)return void(0,h.zN)("url is empty");X(void 0),k("");const t=new FormData;t.append("data",JSON.stringify(ee(t)));let a="http/send";I&&(a+=`?local_download_path=${I}`),oe.A.post(u._U.getUrl(a),t,{headers:{"Content-Type":"multipart/form-data",Authorization:localStorage.getItem("token")}}).catch(e=>{(0,h.zN)(e.message)}).then(e=>{if(!e)return;let t={};try{if(e.headers.filecat_remote_raw_headers&&(t=JSON.parse(e.headers.filecat_remote_raw_headers),he=JSON.stringify(t,null,2)),e.headers.filecat_remote_code)try{const t=JSON.parse(e.headers.filecat_remote_code);X(200===t||201===t?(0,w.jsx)("span",{style:{color:"green"},children:"200"}):t)}catch(e){console.log(e)}}catch(t){he=String(e.headers.filecat_remote_raw_headers)}const a=(t["content-type"]||t["Content-Type"]||"").toLowerCase();ue="object"==typeof e.data?JSON.stringify(e.data,null,2):e.data;const n=x.xK.get_editor(2),s="body"===V?ue:he;if(n){if(a.includes("application/json")||a.includes("+json")){n.session.setMode("ace/mode/json");try{const e=JSON.parse(ue);ue=JSON.stringify(e,null,2)}catch(e){}}else a.includes("html")?n.session.setMode("ace/mode/html"):a.includes("xml")?n.session.setMode("ace/mode/xml"):a.includes("javascript")?n.session.setMode("ace/mode/javascript"):n.session.setMode("ace/mode/text");n.setValue("body"===V?ue:he,-1)}k(s)})}}),g(v.oV.http_proxy_tag_update)&&(0,w.jsx)(d.rA,{title:e("添加"),icon:"save_as",onClick:()=>{if(!g(v.oV.http_proxy_tag_update))return void(0,h.zN)("no permission");for(const t of B)if(t.is_file)return void(0,h.zN)(e("frm_lm"));let t;Q({open:!0,title:e("信息"),context_div:(0,w.jsxs)("div",{children:[(0,w.jsx)("div",{className:"card-content",children:(0,w.jsx)(i.Sm,{placeholderOut:e("输入标签名"),handleInputChange:e=>t=e})}),(0,w.jsx)("div",{className:"card-action",children:(0,w.jsx)("button",{className:"button button--flat",onClick:async()=>{const e=await ee();e.local_download_path=I,e.form_data_list=JSON.stringify(B),e.headers=JSON.stringify(e.headers),"object"==typeof e.data&&(e.data=JSON.stringify(e.data)),e.name=t,W(e),Q({open:!1})},children:e("确定")})})]})})}})]}),(0,w.jsxs)(re,{activeKey:G,onChange:e=>H(e),children:[(0,w.jsx)(le,{itemKey:"headers",tab:e("请求头")+"(json)",children:(0,w.jsxs)("div",{style:{marginTop:"10px"},children:[(0,w.jsx)("div",{style:{display:"flex",justifyContent:"flex-end",marginBottom:"4px"},children:(0,w.jsx)(d.rA,{title:e("格式化"),icon:"data_object",onClick:function(){x.xK.get_editor(0)?.formatCode?.()}})}),(0,w.jsx)("div",{className:"http_ace",children:(0,w.jsx)(ce,{name:"",editor_id:0})})]})}),(0,w.jsx)(le,{itemKey:"body",tab:e("请求体"),children:(0,w.jsxs)("div",{style:{marginTop:"10px"},children:[(0,w.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[(0,w.jsxs)(re,{activeKey:z,onChange:e=>{U(e);const t=Number(e);t===se.RB.row?x.xK.get_editor(1).session.setMode("ace/mode/text"):t===se.RB.json&&x.xK.get_editor(1).session.setMode("ace/mode/json")},children:[(0,w.jsx)(le,{itemKey:String(se.RB.row),tab:e("row")}),(0,w.jsx)(le,{itemKey:String(se.RB.json),tab:e("json")}),(0,w.jsx)(le,{itemKey:String(se.RB.form),tab:e("form")})]}),Number(z)!==se.RB.form&&(0,w.jsx)(d.rA,{title:e("格式化"),icon:"data_object",onClick:function(){x.xK.get_editor(1)?.formatCode?.()}})]}),Number(z)===se.RB.form&&(0,w.jsx)("div",{style:{marginTop:"10px"},children:(0,w.jsx)(p.X,{headers:["key",e("值")],rows:B.map((t,a)=>[(0,w.jsx)(i.Sm,{value:t.key,handleInputChange:e=>{t.key=e,R([...B])},no_border:!0}),(0,w.jsx)(i.Sm,{value:t.value,handleInputChange:e=>{t.value=e,t.is_file=!1,R([...B])},no_border:!0}),(0,w.jsxs)("div",{children:[(0,w.jsx)(d.rA,{icon:"file_upload",title:e("上传文件"),onClick:()=>(e=>{y({show:!0,type:$.PromptEnum.UploadFile,overlay:!0,data:{extra_data:{only_file:!0},call:t=>{let a=t.currentTarget?.files;if(!a)return;const n=a[0];n.fullPath=(0,T.hU)()+Date.now().toString(),B[e].value=`${n}(${n.name})`,B[e].is_file=!0,B[e].fileName=n.name,B[e].fullPath=n.fullPath,R([...B]),B[e].file_object=n,y({overlay:!1,type:"",show:!1,data:{}})}}})})(a)}),(0,w.jsx)(d.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{B.splice(e,1),R([...B])})(a)})]})]),width:"10rem"})}),(0,w.jsx)("div",{className:"http_ace",style:{marginTop:"10px",display:Number(z)!==se.RB.form?"block":"none"},children:(0,w.jsx)(ce,{name:"",editor_id:1})})]})})]}),(0,w.jsx)("div",{style:{paddingTop:"1rem"},children:void 0===I?(0,w.jsx)("span",{style:{cursor:"pointer",color:"#3b82f6"},onClick:()=>{M("")},children:e("下载到本地目录")}):(0,w.jsx)(i.Sm,{placeholder:e("本地地址"),value:I,handleInputChange:e=>{M(e)},handlerEnter:()=>{I||M(void 0)}})})]})]}),(0,w.jsx)(o.VP,{children:(0,w.jsxs)(s.Zp,{title:J,rightTopCom:(0,w.jsxs)("div",{style:{display:"flex",alignItems:"center"},children:[(0,w.jsx)(d.rA,{title:e("格式化"),icon:"data_object",onClick:()=>{x.xK.get_editor(2)?.formatCode?.()}}),(0,w.jsx)(d.rA,{title:e("复制"),icon:"copy_all",onClick:()=>{const t=x.xK.get_editor_value(2);t&&((0,m.lW)(t),(0,h.SK)(e("完成")))}})]}),children:[(0,w.jsxs)(re,{activeKey:V,onChange:e=>{Z(e);const t="body"===e?ue:he;k(t);const a=x.xK.get_editor(2);if(a){try{JSON.parse(t),a.session.setMode("ace/mode/json")}catch{a.session.setMode("ace/mode/text")}a.setValue(t,-1)}},children:[(0,w.jsx)(le,{itemKey:"body",tab:e("响应体")}),(0,w.jsx)(le,{itemKey:"headers",tab:e("响应头")})]}),(0,w.jsx)("div",{className:"http_ace",style:{marginTop:"10px",height:"21rem"},children:(0,w.jsx)(ce,{name:"",editor_id:2})})]})})]}),(0,w.jsx)(o.fI,{children:(0,w.jsx)(o.VP,{children:(0,w.jsx)(N.N,{getItems:async()=>{const e=await u._U.get("http/tag");return e.code===_.m.Success?e.data:[]},save:async t=>{(await u._U.post("http/tag/save",t)).code!==_.m.Success&&(0,h.zN)(e("网络错误"))},have_auth_edit:g(v.oV.http_proxy_tag_update),clickItem:async e=>{L(e.url),F(e.method),M(e.local_download_path),e.header_type&&H(1===e.header_type?"headers":"body"),e.headers&&(de=JSON.parse(e.headers),1===e.header_type&&(x.xK.get_editor(0).setValue(e.headers,-1),x.xK.get_editor(0).session.setMode("ace/mode/json"))),e.form_data_list&&R(JSON.parse(e.form_data_list)),e.data&&(pe=e.data),e.body_type&&(U(String(e.body_type)),e.body_type===se.RB.row?x.xK.get_editor(1).session.setMode("ace/mode/text"):e.body_type===se.RB.json&&x.xK.get_editor(1).session.setMode("ace/mode/json"),x.xK.get_editor(1).setValue(e.data,-1))},items:[{key:"name",preName:e("名字")},{key:"url",preName:"url"},{key:"method",preName:"method"},{key:"headers",preName:"headers"},{key:"data",preName:"data"},{key:"form_data_list",preName:"form_data_list"},{key:"local_download_path",preName:"local_download_path"},{key:"color",preName:"color"}]})})})]})})}var fe=a(87361);const ye=n.lazy(()=>Promise.all([a.e(8772),a.e(8257),a.e(7759)]).then(a.bind(a,45601)));function _e({}){const{check_user_auth:e}=(0,x.MH)(),{t}=(0,r.Bd)(),a=[];return e(v.oV.http_proxy)&&a.push({index:1,name:t("http代理"),rto:"http/",component:(0,w.jsx)(me,{})}),e(v.oV.ssh_proxy)&&a.push({index:1,name:`ssh${t("代理")}`,rto:"remoteShell/",component:(0,w.jsx)(V,{})}),e(v.oV.browser_proxy)&&a.push({index:1,name:`${t("浏览器")}${t("代理")}`,rto:"browserproxy/",component:(0,w.jsx)(j,{})}),e(v.oV.rdp_proxy)&&a.push({index:1,name:`rdp${t("代理")}`,rto:"rdp/",component:(0,w.jsx)(ne,{})}),e(v.oV.rtsp_proxy)&&a.push({index:1,name:t("rtsp播放器"),rto:"rtsp/",component:(0,w.jsx)(ye,{})}),(0,w.jsx)(o.W1,{optionList:a,father_route:fe.o.proxy})}}}]);
1
+ "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[259],{8694(e,t,a){a.d(t,{$K:()=>s,RB:()=>i,l5:()=>l,vo:()=>o,vr:()=>r});let n=function(e){return e[e.tcp=0]="tcp",e[e.udp=1]="udp",e}({});class s{open=!1;port;key="";async_ips=[]}class o{client_num_id;client_name;open=!1;ip;mask;serverIp;serverPort;key="";model=n.udp}let i=function(e){return e[e.row=1]="row",e[e.json=2]="json",e[e.form=3]="form",e}({});class r{body_type;header_type;url;method;headers;data;form_data_list;local_download_path}class l{enabled;ip;port;bypass;useForLocal;type}},75007(e,t,a){a.d(t,{h:()=>o});a(96540);var n=a(85997),s=a(74848);function o(e){return(0,s.jsxs)("h2",{className:"message",children:[(0,s.jsx)(n.In,{icon:"sentiment_dissatisfied"}),(0,s.jsx)("span",{children:e.context})]})}},47374(e,t,a){a.d(t,{e:()=>u});var n=a(96540),s=a(61973),o=a(64694),i=a(34289),r=a(61443),l=a(75725),c=a(22022),d=a(85997),p=a(74848);function u(e){let t=(0,s.zy)();const a=(0,s.Zp)(),[u,h]=(0,n.useState)([]),[m,f]=(0,n.useState)("/"),[y,_]=(0,n.useState)(void 0),{t:x,i18n:v}=(0,c.Bd)();n.useEffect(()=>{let t="",a=(0,i.vX)().split("/");a=a.filter(e=>e);const n=a.indexOf(e.baseRoute),s=[];if(-1!=n){t=(0,o.IO)(a.slice(0,n),e.baseRoute);const i=a.slice(n+1);for(let e=0;e<i.length;e++){const a=i[e];s.push({value:a,href:0===e?`${t}${a}/`:(0,o.IO)(s[e-1].href,a)})}f(t),h(s)}},[t]);const w=t=>{t.stopPropagation(),e.clickFun(t)},[g,j]=(0,n.useState)(0),k=(0,n.useRef)(null),b=(0,n.useRef)(null),N=()=>{const e=k.current,t=b.current;if(!e||!t)return;const a=[];for(const e of Array.from(t.children))a.push(e.getBoundingClientRect().width);const n=e.clientWidth;if(a.reduce((e,t)=>e+t,0)<=n||a.length<=2)return void j(e=>0===e?e:0);let s=a[0]+48,o=0;for(let e=a.length-1;e>=1&&!(s+a[e]>n);e--)s+=a[e],o++;const i=Math.max(a.length-1-o,0);j(e=>e===i?e:i)};(0,n.useEffect)(()=>{N();const e=new ResizeObserver(N);return k.current&&e.observe(k.current),()=>e.disconnect()},[u,m,t]),(0,n.useEffect)(()=>{const e=k.current;e&&0!==g&&e.scrollWidth>e.clientWidth&&g<u.length-1&&j(e=>e+1)});const K=g>0?1+g:1,S=g>0?u.slice(1,K):[],[C,A]=(0,n.useState)(null);return(0,n.useEffect)(()=>{A(null)},[t,g]),(0,p.jsxs)("div",{className:"breadcrumbs",ref:k,onClick:e=>{_(void 0!==y?void 0:"")},children:[(0,p.jsx)(n.Fragment,{children:void 0===y?(0,p.jsxs)(n.Fragment,{children:[(0,p.jsx)("span",{className:"chevron",children:(0,p.jsx)(s.N_,{to:m,onClick:w,children:(0,p.jsx)(d.In,{icon:"home"})})}),u.map((e,t)=>g>0&&t>=1&&t<K?1!==t?null:(0,p.jsxs)("span",{className:"chevron",children:[(0,p.jsx)(d.In,{icon:"keyboard_arrow_right"}),(0,p.jsx)("span",{className:"breadcrumbs-fold-dot",onClick:e=>{e.stopPropagation();const t=e.currentTarget.getBoundingClientRect();A({x:t.left,y:t.bottom})},children:"..."})]},"fold"):(0,p.jsxs)("span",{className:"chevron",children:[(0,p.jsx)(d.In,{icon:"keyboard_arrow_right"}),(0,p.jsx)(s.N_,{to:e.href,onClick:w,children:decodeURIComponent(e.value)})]},t)),(0,p.jsxs)("div",{className:"breadcrumbs-measure",ref:b,"aria-hidden":!0,children:[(0,p.jsx)("span",{className:"chevron",children:(0,p.jsx)(s.N_,{to:m,children:(0,p.jsx)(d.In,{icon:"home"})})}),u.map((e,t)=>(0,p.jsxs)("span",{className:"chevron",children:[(0,p.jsx)(d.In,{icon:"keyboard_arrow_right"}),(0,p.jsx)(s.N_,{to:e.href,children:decodeURIComponent(e.value)})]},t))]})]}):(0,p.jsx)(l.QM,{click:()=>{_(void 0)},children:(0,p.jsx)(r.Sm,{width:"100%",placeholder:x("输入跳转的目录"),handlerEnter:t=>{e.input_path_enter&&e.input_path_enter(t),_(void 0)}})})}),C&&(0,p.jsx)(l.rY,{click:()=>A(null),children:(0,p.jsx)(l.sw,{x:C.x,y:C.y,items:S.map(e=>({r:decodeURIComponent(e.value),v:e.href})),click:e=>{A(null),a(e)}})})]})}},77481(e,t,a){a.d(t,{S:()=>r,X:()=>i});var n=a(96540),s=a(61443),o=a(74848);function i(e){const[t,a]=n.useState([]),i=(0,n.useRef)(-1),[r,l]=(0,n.useState)(-1),[c,d]=(0,n.useState)(-1);(0,n.useEffect)(()=>{e.children?a(Array.isArray(e.children)?e.children:[e.children]):a(e.rows)},[e.rows,e.children]);const p=()=>{i.current=-1,l(-1),d(-1)};return(0,o.jsxs)("table",{children:[(0,o.jsx)("thead",{children:(0,o.jsx)("tr",{children:e.headers?.map((t,a)=>{const n=!!e.filter&&(e.filter.column??0)===a;let i=t;if(n){const a=e.filter,n=a.options.find(e=>e.value===a.value);null!=a.value&&n&&(i=`${t} (${n.label})`)}return(0,o.jsx)("th",{className:n?"table-filter-col":"",children:n?(0,o.jsx)(s.l6,{value:e.filter.value,options:e.filter.options,onChange:e.filter.onChange,bare:!0,trigger_label:i}):t},a)})})}),(0,o.jsx)("tbody",{children:t.map((t,a)=>{const n=!!e.onRowDrag;return(0,o.jsx)("tr",{className:n?(r===a?"row-dragging":"")+(c===a?" row-drop-target":""):"",draggable:n,onContextMenu:()=>{e.handleContextMenu&&e.handleContextMenu(t)},onDragStart:e=>{n&&(i.current=a,l(a),e.dataTransfer.effectAllowed="move")},onDragOver:e=>{!n||i.current<0||(e.preventDefault(),e.dataTransfer.dropEffect="move",d(a))},onDrop:t=>{n&&(t.preventDefault(),(()=>{const t=i.current,a=c;p(),t<0||a<0||t===a||e.onRowDrag?.(t,a)})())},onDragEnd:p,children:t.map((a,n)=>{const s=n===t.length-1?"small":"";return(0,o.jsx)("td",{className:s,style:{width:e.width??"auto"},children:a},n)})},a)})})]})}function r(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))})}},83029(e,t,a){a.d(t,{N:()=>x});var n=a(96540),s=a(34843),o=a(82893),i=a(74848);function r(e){const[t,a]=(0,s.fp)(o.AG.user_base_info);return(0,i.jsx)("div",{children:e.div?(0,i.jsx)("div",{className:"nav_list_a",style:{background:e.color},children:e.name}):e.clickItem||"dir"===e._type?(0,i.jsx)("div",{className:"nav_list_a",style:{background:e.color},onClick:()=>{"dir"!==e._type?e.clickItem&&e.clickItem(e):e.click_dir(e.item)},children:e.name}):(0,i.jsx)("a",{href:e.url,target:e.target,className:"nav_list_a",style:{background:e.color},children:e.name})})}var l=a(64694),c=a(61443),d=a(85997),p=a(61973),u=a(22022);const h=["#ffffff","#fefff8","#fcfdf1","#d3d2dc","#f8f9fd","#ebf4fe","#ebebeb","#e8f7eb","#eaf2f9"];let m,f,y=[];const _=[];function x(e){const[t,a]=(0,n.useState)([]),[x,v]=(0,n.useState)(-1),w=(0,p.zy)(),[g,j]=(0,n.useState)(!1),[k,b]=(0,n.useState)(!1),{t:N}=(0,u.Bd)(),[K,S]=(0,n.useState)([]),[C,A]=(0,s.fp)(o.AG.nav_index_add_item_by_now_list),F=e=>{-1!==x?_[x]._children=e:y=e};(0,n.useEffect)(()=>{(async()=>{if(!e.getItems)return;const t=await e.getItems();y=t,a(y)})()},[w]);(0,n.useEffect)(()=>{if(C){const e=[...t,{name:"",color:(0,l.Lr)(h),...C}];F(e),a(e),j(!0),A(void 0)}},[C]);const D=e=>{v(x+1),a(e._children),_.push(e)};return(0,i.jsxs)("div",{className:"nav_list_div scroll-div-y",children:[-1!==x&&(0,i.jsx)(d.rA,{title:"返回",icon:"arrow_back",onClick:()=>{a(0===x?y:_[x-1]._children),v(x-1),_.pop()}}),t.map((s,o)=>(0,i.jsxs)("div",{draggable:!0,onDragOver:e=>{e.preventDefault()},onDragStart:e=>((e,t)=>{m=t})(0,o),onDrop:e=>((e,n)=>{e.preventDefault();const s=t[m],o=t[n];if(o&&"dir"===o._type){const e=[...t];return e.splice(m,1),o._children||(o._children=[]),o._children.push(s),F(e),void a(e)}const i=[...t],r=i[m];i.splice(m,1),i.splice(n,0,r),F(i),a(i)})(e,o),style:{cursor:g?"move":"pointer"},children:[(0,i.jsx)(r,{name:s.name,item:s,...s,div:g,target:"_blank",click_dir:D,clickItem:e.clickItem}),g&&(void 0!==K.find(e=>e===o)||k)&&(0,i.jsxs)("div",{className:k?"":" site_edit ",children:["dir"===s._type?(0,i.jsxs)(n.Fragment,{children:[(0,i.jsx)(c.Sm,{value:s.name,handleInputChange:e=>{s.name=e},placeholder:N("输入类目名"),no_border:!0}),(0,i.jsx)(c.Sm,{value:s.color,type:"color",handleInputChange:e=>{s.color=e},placeholder:"color",no_border:!0})]}):e.items.map((e,t)=>(0,i.jsx)("div",{children:(0,i.jsx)(c.Sm,{value:s[e.key],type:"color"===e.key?"color":void 0,handleInputChange:t=>{s[e.key]=t},placeholder:e.preName,no_border:!0})},t)),!k&&(0,i.jsx)(d.C3,{text:N("折叠"),clickFun:()=>{S((0,l.P1)(K,o))}})]}),g&&(0,i.jsx)("div",{style:{display:"block"},children:(0,i.jsxs)("span",{className:"div-row ",children:[(0,i.jsx)(d.C3,{text:N("删除"),clickFun:()=>{(e=>{const n=[...t];n.splice(e,1),F(n),a(n)})(o)}}),(0,i.jsx)(d.C3,{text:N("编辑"),clickFun:()=>{void 0===K.find(e=>e===o)&&S([...K,o])}})]})})]},o)),g&&(0,i.jsxs)("div",{style:{display:"block"},children:[(0,i.jsx)(d.rA,{title:N("取消"),icon:"cancel",onClick:()=>{S([]),j(!1),f&&(a(f),F(f)),b(!1)}}),(0,i.jsx)(d.rA,{title:N("添加"),icon:"add",onClick:async()=>{const n=[...t,{name:"",color:(0,l.Lr)(h),...e.get_pre_add_item&&await e.get_pre_add_item()}];F(n),a(n)}}),(0,i.jsx)(d.rA,{title:N("添加类目"),icon:"add_box",onClick:()=>{const e=[...t,{name:"",_type:"dir",_children:[],color:"#c1edfb"}];F(e),a(e)}}),(0,i.jsx)(d.rA,{title:N("全部编辑"),icon:k?"unfold_less":"unfold_more",onClick:()=>{b(!k)}})]}),(void 0===e.have_auth_edit||!0===e.have_auth_edit)&&(0,i.jsx)(d.rA,{icon:g?"save":"edit",title:N(g?"保存":"编辑"),onClick:async()=>{g?e.save&&await e.save(y):f=t,j(!g)}})]})}},259(e,t,a){a.r(t),a.d(t,{default:()=>_e});var n=a(96540),s=a(70447),o=a(75725),i=a(61443),r=a(22022),l=a(34843),c=a(82893),d=a(85997),p=a(77481),u=a(14284),h=a(62042),m=a(40505),f=a(45907),y=a(23496),_=a(53459),x=a(78247),v=a(23430),w=a(74848);function g(){const{t:e}=(0,r.Bd)(),t=(0,f.y)(),{check_user_auth:a}=(0,x.MH)(),g=a(v.oV.browser_proxy_edit),[,j]=(0,l.fp)(c.AG.prompt_card),[k,b]=(0,n.useState)([]),[N,K]=(0,n.useState)(!1),[S,C]=(0,n.useState)(!1),[A,F]=(0,n.useState)(""),[D,L]=(0,n.useState)(""),[I,M]=(0,n.useState)(""),B=[e("状态"),e("备注"),e("目标"),e("端口"),e("访问地址"),e("操作")],P=async()=>{try{const e=await u.s2.get(y.s.browser_proxy_port_list);e.code===_.m.Success&&b(Array.isArray(e.data)?e.data:[])}catch(e){}};(0,n.useEffect)(()=>{P()},[]);const R=e=>{F(e?.id??""),L(e?`${e.proto}://${e.host}${e.root_path&&"/"!==e.root_path?e.root_path:""}`:""),M(e?.note??"")},E=()=>{K(!1),C(!1),R(void 0)},$=e=>`http://${window.location.hostname||"127.0.0.1"}:${e.port}/`,O=e=>{const t=localStorage.getItem("token")||"";return`${$(e)}${t?`?_t=${encodeURIComponent(t)}`:""}`};return(0,w.jsxs)(o.fI,{children:[(0,w.jsx)(o.VP,{widthPer:g?55:100,maxWidth:g?"90rem":void 0,children:(0,w.jsx)(o.xh,{children:(0,w.jsx)(s.uF,{self_title:(0,w.jsxs)("span",{className:" div-row ",children:[(0,w.jsx)("h2",{children:e("网页代理目标")}),(0,w.jsx)(d.rA,{icon:"info",title:e("信息"),onClick:()=>{j({open:!0,title:e("信息"),context_div:(0,w.jsx)("div",{children:(0,w.jsxs)("ul",{children:[(0,w.jsx)("li",{children:e("wbvpn_port_tip")}),(0,w.jsx)("li",{children:e("wbvpn_port_tip2")}),(0,w.jsx)("li",{children:e("wbvpn_port_tip3")})]})})})}})]}),rightTopCom:(0,w.jsx)("div",{children:g&&!S&&(0,w.jsx)(d.rA,{icon:"add",title:e("添加"),onClick:()=>{K(!0),C(!0),R(void 0)}})}),children:(0,w.jsx)(p.X,{headers:B,rows:k.map(a=>{const n=[(0,w.jsx)(d.Ay,{checked:!1!==a.enabled,disabled:!g,title:e("启用"),onChange:t=>(async(t,a)=>{try{await u.s2.post(y.s.browser_proxy_port_set_enabled,{id:t.id,enabled:a}),(0,h.SK)(e(a?"已启用":"已禁用")),await P()}catch(e){}})(a,t)}),(0,w.jsx)(s.xP,{children:a.note||"-"}),(0,w.jsx)(s.xP,{children:`${a.proto}://${a.host}`}),(0,w.jsx)(s.xP,{children:String(a.port)}),(0,w.jsx)(s.xP,{children:$(a)}),(0,w.jsxs)("div",{children:[(0,w.jsx)(d.rA,{icon:"open_in_new",title:e("新窗口打开"),onClick:()=>(e=>{window.open(O(e),"_blank","noopener,noreferrer")})(a)}),(0,w.jsx)(d.rA,{icon:"tab",title:e("当前窗口打开"),onClick:()=>(e=>{window.location.href=O(e)})(a)}),(0,w.jsx)(d.rA,{icon:"content_copy",title:e("复制"),onClick:()=>(async t=>{const a=$(t);(0,m.lW)(a)?(0,h.SK)(e("已复制")):(0,h.zN)(e("复制失败"))})(a)}),g&&(0,w.jsx)(d.rA,{icon:"edit",title:e("编辑"),onClick:()=>(e=>{K(!1),C(!0),R(e)})(a)}),g&&(0,w.jsx)(d.rA,{icon:"delete",title:e("删除"),onClick:()=>(a=>{t({title:e("确认删除"),sub_title:a.host,confirm_fun:async()=>{try{await u.s2.post(y.s.browser_proxy_port_remove,{id:a.id}),(0,h.SK)(e("已删除")),await P()}catch(e){}}})})(a)})]})];return n}),width:"10rem"})})})}),g&&S&&(0,w.jsx)(o.VP,{widthPer:45,maxWidth:"40rem",children:(0,w.jsx)(o.xh,{children:(0,w.jsxs)(s.Zp,{self_title:(0,w.jsx)("span",{className:" div-row ",children:(0,w.jsx)("h2",{children:e(""+(N?"添加":"编辑"))})}),rightBottomCom:(0,w.jsxs)("div",{children:[(0,w.jsx)(d.rA,{icon:"cancel",title:e("取消"),onClick:E}),(0,w.jsx)(d.rA,{icon:N?"add_circle":"save",title:e(N?"添加":"保存"),onClick:async()=>{if(D.trim())try{N?(await u.s2.post(y.s.browser_proxy_port_add,{address:D.trim(),note:I}),(0,h.SK)(e("添加成功"))):(await u.s2.post(y.s.browser_proxy_port_update,{id:A,address:D.trim(),note:I}),(0,h.SK)(e("修改成功"))),E(),await P()}catch(e){}else(0,h.zN)(e("目标地址不能为空"))}})]}),children:[(0,w.jsx)("label",{children:e("目标地址")}),(0,w.jsx)(i.Sm,{value:D,placeholder:e("目标地址例如"),handleInputChange:e=>L(e)}),(0,w.jsx)("label",{children:e("备注")}),(0,w.jsx)(i.Sm,{value:I,handleInputChange:e=>M(e)})]})})})]})}function j(e){return(0,w.jsx)(g,{})}var k=a(34289),b=a(4412),N=(a(75007),a(83029)),K=a(97856),S=a(92275),C=a(14944),A=a(64405);const F=n.lazy(()=>Promise.all([a.e(2543),a.e(5614)]).then(a.bind(a,85614)));function D(e){const[t,a]=(0,n.useState)(null),[s,o]=(0,l.fp)(c.AG.remoteShellShow),[i,r]=(0,n.useState)(!1),[d,p]=(0,l.fp)(c.AG.sshInfo),[u,h]=(0,l.fp)(c.AG.shellNowDir),[m,f]=(0,l.fp)(c.AG.user_base_info),y=m.user_data.theme?.includes("dark")?"#FFFFFF":"#000000",_=()=>{(async()=>{t&&(t.dispose(),a(null))})()};(0,n.useEffect)(()=>()=>{_()},[]),(0,n.useEffect)(()=>{s.show?t||((async()=>{const e=new K.Terminal({fontFamily:"Monaco, Menlo, Consolas, 'Courier New', monospace",theme:{background:"#FFFFFF",foreground:y,cursor:y,selectionBackground:"#a6d2ff"},cursorBlink:!0,cursorStyle:"bar",scrollback:1e3,scrollSensitivity:1,tabStopWidth:4});let t;const n=t=>{e.write(t)};t=a=>{e.clear(),e.write(a),t=n},C.ws.addMsg(S.HK.remote_shell_getting,e=>{t(e.context)}),e.onData(async e=>{const t=new A.x;t.key=d.key,t.cmd=e;const a=new S.hf(S.HK.remote_shell_send);a.context=t,await C.ws.send(a)}),a(e)})(),r(!0)):_()},[s]);return(0,w.jsx)(F,{show:s.show,terminal:t,init:(e,a)=>{t.writeln("open shell... ");const n=new S.hf(S.HK.remote_shell_open),o=new A.x;o.key=d.key,o.init_path=s.path,o.rows=e,o.cols=a,n.context=o,C.ws.send(n)}})}var L=a(47374),I=a(61973),M=a(99214),B=a(32768),P=a(88815),R=a(6960),E=a(79240),$=a(78150),O=a(12730);function G(e){const{t}=(0,r.Bd)();(0,I.zy)();(0,I.Zp)();const{check_user_auth:a}=(0,x.MH)(),[s,o]=(0,l.fp)(c.AG.nowFileList),[i,p]=(0,l.fp)(c.AG.uploadFiles),[u,m]=(0,l.fp)(c.AG.showPrompt),[f,y]=(0,l.fp)(c.AG.selectedFileList),[_,v]=(0,l.fp)(c.AG.enterKey),[g,j]=(0,l.fp)(c.AG.copyedFileList),[b,N]=(0,l.fp)(c.AG.cutedFileList),[K,S]=(0,l.fp)(c.AG.selectedFileList),[C,A]=(0,l.fp)(c.AG.clickFileList),[F,D]=(0,l.fp)(c.AG.remoteShellShow),[L,P]=(0,l.fp)(c.AG.sshInfo),R=(0,M.Vs)();function E(e){(0,h.SK)(e)}return(0,w.jsxs)(n.Fragment,{children:[f.length>0&&(0,w.jsx)(d.rA,{icon:"delete",title:t("删除"),onClick:()=>{m({show:!0,type:$.PromptEnum.SshDelete,overlay:!0,data:{}})}}),f.length>0&&(0,w.jsx)(d.rA,{icon:"content_copy",title:t("复制"),onClick:function(){const e=(0,M.ib)(s,f);j(e.map(e=>`/${(0,k.GG)("remoteShell",(0,k.vX)())}${e.name}`)),N([]),E("已复制")}}),f.length>0&&(0,w.jsx)(d.rA,{icon:"content_cut",title:t("剪切"),onClick:function(){const e=(0,M.ib)(s,f);N(e.map(e=>`/${(0,k.GG)("remoteShell",(0,k.vX)())}${e.name}`)),j([]),E("已剪切")}}),(g.length>0||b.length>0)&&(0,w.jsx)(d.rA,{onClick:function(){m({show:!0,type:$.PromptEnum.SshPaste,overlay:!0,data:{}})},icon:"content_paste",title:t("粘贴到此处"),tip:g.length+b.length}),1===f.length&&s.files.length>=1&&(0,M.ib)(s,f)[0].type!==B.Iw.folder&&(0,w.jsx)(d.rA,{icon:"download",title:t("下载"),onClick:function(){const e=(0,M.ib)(s,f),t=`/api/ssh/download?file=${`/${(0,k.GG)("remoteShell",(0,k.vX)())}${decodeURIComponent(e[0].name)}`}&key=${L.key}&token=${localStorage.getItem("token")}`;window.open(t)}}),1===f.length&&(0,w.jsx)(d.rA,{icon:"edit_attributes",title:t("重命名"),onClick:function(){m({show:!0,type:$.PromptEnum.SshReName,overlay:!0,data:{}})}}),(0,w.jsx)(d.rA,{icon:"terminal",title:"shell",onClick:function(){F.show?D({show:!1,path:""}):D({show:!0,path:`/${(0,k.GG)("remoteShell",(0,k.vX)())}`})}}),(0,w.jsx)(d.rA,{icon:"grid_view",title:t("切换样式"),onClick:R}),(0,w.jsx)(d.rA,{icon:"create_new_folder",title:t("创建文件夹"),onClick:function(){m({show:!0,type:$.PromptEnum.SshNewDir,overlay:!0,data:{}})}}),(0,w.jsx)(d.rA,{icon:"note_add",title:t("创建文本文件"),onClick:function(){m({show:!0,type:$.PromptEnum.SshNewFile,overlay:!0,data:{}})}}),(0,w.jsx)(d.rA,{icon:"upload_file",title:"上传",onClick:()=>{m({show:!0,type:$.PromptEnum.UploadFile,overlay:!0,data:{call:e=>{let t=e.currentTarget?.files;if(!t)return;let a=!!t[0].webkitRelativePath;const n=[],s=new Set;for(let e=0;e<t.length;e++){const o=t[e],i=a?o.webkitRelativePath:`${o.webkitRelativePath}${o.name}`;o.fullPath=i,a&&s.add((0,O.S)(i)),n.push(o)}const o=[];if(a)for(const e of Array.from(s))o.push({isDir:!0,fullPath:e,name:e});o.push(...n),p(o),m({show:!0,type:$.PromptEnum.SshUpload,overlay:!1,data:{}})}}})}}),(0,w.jsx)(d.rA,{icon:"close",title:t("关闭"),onClick:()=>{e.close()}})]})}var H=a(60096),T=a(21499);let z;function U(e){const{t}=(0,r.Bd)(),a=(0,I.zy)(),[s,o]=(0,l.fp)(c.AG.nowFileList),[d,p]=(0,l.fp)(c.AG.selectedFileList),[m,f]=(0,l.fp)(c.AG.clickFileList),[y,x]=(0,l.fp)(c.AG.sshInfo),[g,j]=(0,n.useState)(""),N=(0,I.Zp)(),[K,S]=(0,l.fp)(c.AG.user_base_info),C=async e=>{const a=new A.x;a.key=y.key,a.dir=e||`/${(0,k.GG)("remoteShell",(0,k.vX)())}`;const n=await u.Fg.post("get/dir",a);if(n.code!==_.m.Success)return void(0,h.zN)(t("连接失败"));const{folders:s,files:i}=n.data||{};for(const e of i??[])e.origin_size=e.size,e.size=(0,P.v7)(e.size),K.user_data.file_time_show_type===v.KD.time?e.show_mtime=e.mtime?(0,T.Yq)(e.mtime):"":e.show_mtime=e.mtime?(0,R.s)(e.mtime):"";for(const e of s??[])K.user_data.file_time_show_type===v.KD.time?e.show_mtime=e.mtime?(0,T.Yq)(e.mtime):"":e.show_mtime=e.mtime?(0,R.s)(e.mtime):"";const r={folders:s||[],files:i||[]};(0,M.yC)(r,K.user_data.dir_show_type),o(r),z=r};function F(){p([]),f([])}(0,n.useEffect)(()=>{F(),(async()=>{await C()})()},[a]);return(0,w.jsxs)(n.Fragment,{children:[(0,w.jsx)(b.aZ,{children:(0,w.jsx)(i.$Z,{handleEnterPress:()=>{if(!z)return;p([]),f([]);const e=[],t=[];for(const t of z.files??[])t.name.includes(g)&&e.push(t);for(const e of z.folders??[])e.name.includes(g)&&t.push(e);o({files:e,folders:t})},placeholder:t("搜索当前目录"),icon:"search",value:"",handleInputChange:e=>{j(e)},max_width:"25em"})}),(0,w.jsx)(b.aZ,{position:"right",children:(0,w.jsx)(G,{close:e.close})}),(0,w.jsx)(L.e,{baseRoute:"remoteShell",clickFun:F,input_path_enter:e=>{(0,E.Z1)(e)?C(e):N((0,E.Jn)((0,k.vX)(),e)),p([]),f([]),o({files:[],folders:[]})}}),(0,w.jsx)(H.Ic,{handleContextMenu:()=>{},clickBlank:e=>{e.target===e.currentTarget&&p([])},file_list:s.files,folder_list:s.folders,fileHandler:C}),(0,w.jsx)(D,{})]})}function V(e){const{t}=(0,r.Bd)(),a=(0,I.Zp)(),[s,o]=(0,n.useState)(""),[p,m]=(0,n.useState)(""),[f,y]=(0,n.useState)(""),[g,j]=(0,n.useState)(""),[k,K]=(0,n.useState)(void 0),[S,C]=(0,n.useState)(""),[F,D]=(0,l.fp)(c.AG.shellNowDir),[L,M]=(0,l.fp)(c.AG.sshInfo),{check_user_auth:B}=(0,x.MH)(),P=async e=>{const t=new A.x;if(t.password=e?e.password:p,t.domain=e?e.domain:g,t.port=e?e.port:k,t.username=e?e.username:s,t.private_path=e?e.private_path:f,t.dir=e?e.dir:S,!t.dir)return void(0,h.zN)("dir not found");if(!t.username)return void(0,h.zN)("username not found");if(!t.domain)return void(0,h.zN)("domain not found");if(!t.port)return void(0,h.zN)("port not found");if(!t.private_path&&!t.password)return void(0,h.zN)("private_path password not found");const n=await u.Fg.post("start",t);n&&n.code===_.m.Success&&(a((0,E.Jn)("/proxy/remoteShell",t.dir)),D([t.dir]),M(n.data))};return(0,w.jsxs)(n.Fragment,{children:[!L.key&&(0,w.jsxs)(b.aZ,{position:"right",children:[(0,w.jsx)(i.$Z,{placeholder:t("目录"),icon:"home",value:S,handleInputChange:e=>C(e),max_width:"15rem"}),(0,w.jsx)(i.$Z,{placeholder:t("账号"),icon:"verified_user",value:s,handleInputChange:e=>o(e),max_width:"15rem"}),(0,w.jsx)(i.$Z,{type:"password",placeholder:t("密码"),icon:"password",value:p,handleInputChange:e=>m(e),max_width:"15rem"}),(0,w.jsx)(i.$Z,{placeholder:t("私钥路径"),icon:"private_connectivity",value:f,handleInputChange:e=>y(e),max_width:"15rem"}),(0,w.jsx)(i.$Z,{placeholder:t("连接地址"),icon:"location_on",value:g,handleInputChange:e=>{j(e)},max_width:"15rem"}),(0,w.jsx)(i.$Z,{placeholder:t("端口"),icon:"outlet",value:k,handleInputChange:e=>{if(!e)return;/^\d+$/.test(e)||(0,h.zN)(t("不是数字")),K(parseInt(e))},max_width:"7rem"}),(0,w.jsx)(d.rA,{icon:"play_arrow",title:t("连接"),onClick:()=>{P()}})]}),L.key?(0,w.jsx)(U,{close:async()=>{const e=new A.x;e.key=L.key;await u.Fg.post("close",e);M({})},data:{port:k,password:p,username:s,domain:g,dir:S}}):(0,w.jsx)(N.N,{have_auth_edit:B(v.oV.ssh_proxy_tag_update),getItems:async()=>{const e=await u.Fg.get("tag");return e.code===_.m.Success?e.data:[]},save:async e=>{await u.Fg.post("tag/save",e)},clickItem:async e=>{j(e.domain),C(e.dir),K(e.port),o(e.username),m(e.password),y(e.private_path),await P(e)},items:[{key:"name",preName:t("名字")},{key:"domain",preName:t("地址")},{key:"port",preName:t("端口")},{key:"username",preName:t("账号")},{key:"password",preName:t("密码")},{key:"private_path",preName:t("私钥路径")},{key:"dir",preName:t("访问目录")},{key:"color",preName:"color"}]})]})}function Z(e){switch(e){case 0:return 1;case 2:return 2;default:return 0}}class J{constructor(e){this.canvas=e,this.render=new ee.Canvas.create(this.canvas),this.activeSession=!1,this.install()}close(){this.activeSession=!1}install(){var e=this;return this.canvas.addEventListener("mousemove",function(t){var a=ee.elementOffset(e.canvas);return C.ws.sendData(S.HK.mouse,{x:t.clientX-a.left,y:t.clientY-a.top,button:0,isPressed:!1}),t.preventDefault||e.activeSession(),!1}),this.canvas.addEventListener("mousedown",function(t){var a=ee.elementOffset(e.canvas);return C.ws.sendData(S.HK.mouse,{x:t.clientX-a.left,y:t.clientY-a.top,button:Z(t.button),isPressed:!0}),t.preventDefault(),!1}),this.canvas.addEventListener("mouseup",function(t){if(e.activeSession){var a=ee.elementOffset(e.canvas);return C.ws.sendData(S.HK.mouse,{x:t.clientX-a.left,y:t.clientY-a.top,button:Z(t.button),isPressed:!1}),t.preventDefault(),!1}}),this.canvas.addEventListener("contextmenu",function(t){if(e.activeSession){var a=ee.elementOffset(e.canvas);return C.ws.sendData(S.HK.mouse,{x:t.clientX-a.left,y:t.clientY-a.top,button:Z(t.button),isPressed:!1}),t.preventDefault(),!1}}),this.canvas.addEventListener("DOMMouseScroll",function(t){if(e.activeSession){var a=t.detail,n=Math.round(15*Math.abs(a)/8),s=ee.elementOffset(e.canvas);return C.ws.sendData(S.HK.wheel,{x:t.clientX-s.left,y:t.clientY-s.top,step:n,isNegative:a>0,isHorizontal:!1}),t.preventDefault(),!1}}),this.canvas.addEventListener("mousewheel",function(t){if(e.activeSession){var a=Math.abs(t.deltaX)>Math.abs(t.deltaY),n=a?t.deltaX:t.deltaY,s=Math.round(15*Math.abs(n)/8),o=ee.elementOffset(e.canvas);return C.ws.sendData(S.HK.wheel,{x:t.clientX-o.left,y:t.clientY-o.top,step:s,isNegative:n>0,isHorizontal:a}),t.preventDefault(),!1}}),window.addEventListener("keydown",function(t){if(e.activeSession)return C.ws.sendData(S.HK.scancode,{code:ee.scancode(t),isPressed:!0}),t.preventDefault(),!1}),window.addEventListener("keyup",function(t){if(e.activeSession)return C.ws.sendData(S.HK.scancode,{code:ee.scancode(t),isPressed:!1}),t.preventDefault(),!1}),this}connect(e,t,a,n,s,o){var i=this;C.ws.addMsg(S.HK.rdp_connect,e=>{console.log("[mstsc.js] connected"),i.activeSession=!0}),C.ws.addMsg(S.HK.rdp_bitmap,e=>{const t=e.context;t.data=e.bin_context,i.render.update(t)}),C.ws.addMsg(S.HK.rdp_close,e=>{o(null),console.log("[mstsc.js] close"),i.activeSession=!1}),C.ws.addMsg(S.HK.rdp_error,e=>{i.activeSession=!1});const r=new S.hf;r.cmdType=S.HK.infos,r.context={ip:e.indexOf(":")>-1?e.split(":")[0]:e,port:a,screen:{width:this.canvas.width,height:this.canvas.height},domain:t,username:n,password:s,locale:ee.locale()},C.ws.send(r)}}class X{constructor(e){this.canvas=e,this.ctx=e.getContext("2d")}update(e){var t=null;t=e.isCompress?function(e){var t=null;switch(e.bitsPerPixel){case 15:t="bitmap_decompress_15";break;case 16:t="bitmap_decompress_16";break;case 24:t="bitmap_decompress_24";break;case 32:t="bitmap_decompress_32";break;default:throw"invalid bitmap data format"}var a=new Uint8Array(e.data),n=Module._malloc(a.length),s=new Uint8Array(Module.HEAPU8.buffer,n,a.length);s.set(a);var o=e.destRight-e.destLeft+1,i=e.destBottom-e.destTop+1,r=o*i*4,l=Module._malloc(r),c=new Uint8Array(Module.HEAPU8.buffer,l,r),d=(Module.ccall(t,"number",["number","number","number","number","number","number","number","number"],[c.byteOffset,o,i,e.width,e.height,s.byteOffset,a.length]),new Uint8ClampedArray(c.buffer,c.byteOffset,r));return Module._free(n),Module._free(l),{width:o,height:i,data:d}}(e):function(e){return{width:e.width,height:e.height,data:new Uint8ClampedArray(e.data)}}(e);var a=this.ctx.createImageData(t.width,t.height);a.data.set(t.data),this.ctx.putImageData(a,e.destLeft,e.destTop)}}var Y={"":0,Escape:1,Digit1:2,Digit2:3,Digit3:4,Digit4:5,Digit5:6,Digit6:7,Digit7:8,Digit8:9,Digit9:10,Digit0:11,Minus:12,Equal:13,Backspace:14,Tab:15,KeyQ:16,KeyW:17,KeyE:18,KeyR:19,KeyT:20,KeyY:21,KeyU:22,KeyI:23,KeyO:24,KeyP:25,BracketLeft:26,BracketRight:27,Enter:28,ControlLeft:29,KeyA:30,KeyS:31,KeyD:32,KeyF:33,KeyG:34,KeyH:35,KeyJ:36,KeyK:37,KeyL:38,Semicolon:39,Quote:40,Backquote:41,ShiftLeft:42,Backslash:43,KeyZ:44,KeyX:45,KeyC:46,KeyV:47,KeyB:48,KeyN:49,KeyM:50,Comma:51,Period:52,Slash:53,ShiftRight:54,NumpadMultiply:55,AltLeft:56,Space:57,CapsLock:58,F1:59,F2:60,F3:61,F4:62,F5:63,F6:64,F7:65,F8:66,F9:67,F10:68,Pause:69,ScrollLock:70,Numpad7:71,Numpad8:72,Numpad9:73,NumpadSubtract:74,Numpad4:75,Numpad5:76,Numpad6:77,NumpadAdd:78,Numpad1:79,Numpad2:80,Numpad3:81,Numpad0:82,NumpadDecimal:83,PrintScreen:84,IntlBackslash:86,F11:87,F12:88,NumpadEqual:89,F13:100,F14:101,F15:102,F16:103,F17:104,F18:105,F19:106,F20:107,F21:108,F22:109,F23:110,KanaMode:112,Lang2:113,Lang1:114,IntlRo:115,F24:118,Convert:121,NonConvert:123,IntlYen:125,NumpadComma:126,MediaTrackPrevious:57360,MediaTrackNext:57369,NumpadEnter:57372,ControlRight:57373,VolumeMute:57376,LaunchApp2:57377,MediaPlayPause:57378,MediaStop:57380,VolumeDown:57390,VolumeUp:57392,BrowserHome:57394,NumpadDivide:57397,PrintScreen:57399,AltRight:57400,NumLock:57413,Pause:57414,Home:57415,ArrowUp:57416,PageUp:57417,ArrowLeft:57419,ArrowRight:57421,End:57423,ArrowDown:57424,PageDown:57425,Insert:57426,Delete:57427,OSLeft:57435,OSRight:57436,ContextMenu:57437,Power:57438,BrowserSearch:57445,BrowserFavorites:57446,BrowserRefresh:57447,BrowserStop:57448,BrowserForward:57449,BrowserBack:57450,LaunchApp1:57451,LaunchMail:57452,MediaSelect:57453},W={27:"Escape",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",192:"Backquote",49:"Digit1",50:"Digit2",51:"Digit3",52:"Digit4",53:"Digit5",54:"Digit6",55:"Digit7",56:"Digit8",57:"Digit9",48:"Digit0",173:"Minus",61:"Equal",8:"Backspace",9:"Tab",81:"KeyQ",87:"KeyW",69:"KeyE",82:"KeyR",84:"KeyT",89:"KeyY",85:"KeyU",73:"KeyI",79:"KeyO",80:"KeyP",219:"BracketLeft",221:"BracketRight",13:"Enter",20:"CapsLock",65:"KeyA",83:"KeyS",68:"KeyD",70:"KeyF",71:"KeyG",72:"KeyH",74:"KeyJ",75:"KeyK",76:"KeyL",59:"Semicolon",222:"Quote",220:"Backslash",16:"ShiftLeft",220:"IntlBackslash",90:"KeyZ",88:"KeyX",67:"KeyC",86:"KeyV",66:"KeyB",78:"KeyN",77:"KeyM",188:"Comma",190:"Period",191:"Slash",16:"ShiftRight",17:"ControlLeft",18:"AltLeft",91:"OSLeft",32:"Space",18:"AltRight",91:"OSRight",93:"ContextMenu",17:"ControlRight",37:"ArrowLeft",38:"ArrowUp",40:"ArrowDown",39:"ArrowRight",144:"NumLock",144:"NumLock",111:"NumpadDivide",106:"NumpadMultiply",109:"NumpadSubtract",103:"Numpad7",104:"Numpad8",105:"Numpad9",107:"NumpadAdd",100:"Numpad4",101:"Numpad5",102:"Numpad6",97:"Numpad1",98:"Numpad2",99:"Numpad3",13:"NumpadEnter",96:"Numpad0",110:"NumpadDecimal",17:"ControlLeft"},q={firefox:{fr:{27:"Escape",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",0:"Backquote",49:"Digit1",50:"Digit2",51:"Digit3",52:"Digit4",53:"Digit5",54:"Digit6",55:"Digit7",56:"Digit8",57:"Digit9",48:"Digit0",169:"Minus",61:"Equal",8:"Backspace",9:"Tab",65:"KeyQ",90:"KeyW",69:"KeyE",82:"KeyR",84:"KeyT",89:"KeyY",85:"KeyU",73:"KeyI",79:"KeyO",80:"KeyP",160:"BracketLeft",164:"BracketRight",13:"Enter",20:"CapsLock",20:"CapsLock",81:"KeyA",83:"KeyS",68:"KeyD",70:"KeyF",71:"KeyG",72:"KeyH",74:"KeyJ",75:"KeyK",76:"KeyL",77:"Semicolon",165:"Quote",170:"Backslash",16:"ShiftLeft",60:"IntlBackslash",87:"KeyZ",88:"KeyX",67:"KeyC",86:"KeyV",66:"KeyB",78:"KeyN",188:"KeyM",59:"Comma",58:"Period",161:"Slash",16:"ShiftRight",17:"ControlLeft",91:"OSLeft",18:"AltLeft",32:"Space",17:"ControlLeft",18:"AltRight",91:"OSRight",93:"ContextMenu",17:"ControlRight",37:"ArrowLeft",38:"ArrowUp",40:"ArrowDown",39:"ArrowRight",144:"NumLock",144:"NumLock",111:"NumpadDivide",106:"NumpadMultiply",109:"NumpadSubtract",103:"Numpad7",104:"Numpad8",105:"Numpad9",107:"NumpadAdd",100:"Numpad4",101:"Numpad5",102:"Numpad6",97:"Numpad1",98:"Numpad2",99:"Numpad3",96:"Numpad0",110:"NumpadDecimal",13:"NumpadEnter",17:"ControlLeft",67:"KeyC",17:"ControlLeft"},en:W},chrome:{fr:{27:"Escape",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",0:"Backquote",49:"Digit1",50:"Digit2",51:"Digit3",52:"Digit4",53:"Digit5",54:"Digit6",55:"Digit7",56:"Digit8",57:"Digit9",48:"Digit0",219:"Minus",187:"Equal",8:"Backspace",9:"Tab",65:"KeyQ",90:"KeyW",69:"KeyE",82:"KeyR",84:"KeyT",89:"KeyY",85:"KeyU",73:"KeyI",79:"KeyO",80:"KeyP",221:"BracketLeft",186:"BracketRight",13:"Enter",20:"CapsLock",20:"CapsLock",81:"KeyA",83:"KeyS",68:"KeyD",70:"KeyF",71:"KeyG",72:"KeyH",74:"KeyJ",75:"KeyK",76:"KeyL",77:"Semicolon",192:"Quote",220:"Backslash",16:"ShiftLeft",60:"IntlBackslash",87:"KeyZ",88:"KeyX",67:"KeyC",86:"KeyV",66:"KeyB",78:"KeyN",188:"KeyM",190:"Comma",191:"Period",223:"Slash",16:"ShiftRight",17:"ControlLeft",91:"OSLeft",18:"AltLeft",32:"Space",17:"ControlLeft",18:"AltRight",91:"OSRight",93:"ContextMenu",17:"ControlRight",37:"ArrowLeft",38:"ArrowUp",40:"ArrowDown",39:"ArrowRight",144:"NumLock",144:"NumLock",111:"NumpadDivide",106:"NumpadMultiply",109:"NumpadSubtract",103:"Numpad7",104:"Numpad8",105:"Numpad9",107:"NumpadAdd",100:"Numpad4",101:"Numpad5",102:"Numpad6",97:"Numpad1",98:"Numpad2",99:"Numpad3",96:"Numpad0",110:"NumpadDecimal",13:"NumpadEnter",17:"ControlLeft",67:"KeyC",17:"ControlLeft"},en:W}};function Q(){}Q.prototype={$:function(e){return document.getElementById(e)},elementOffset:function(e){for(var t=0,a=0;e&&!isNaN(e.offsetLeft)&&!isNaN(e.offsetTop);)t+=e.offsetLeft-e.scrollLeft,a+=e.offsetTop-e.scrollTop,e=e.offsetParent;return{top:a,left:t}},browser:function(){return"undefined"!=typeof InstallTrigger?"firefox":window.chrome?"chrome":document.docuemntMode?"ie":null},locale:function(){return window.navigator.userLanguage||window.navigator.language},client:{create:function(e){return new J(e)}},Canvas:{create:function(e){return new X(e)}},scancode(e){var t=Q.prototype.locale();return t=["fr","en"].indexOf(t)>0&&t||"en",Y[e.code||q[Q.prototype.browser()||"firefox"][t][e.keyCode]]}};let ee=new Q;var te=a(38240);let ae;function ne(){const{t:e}=(0,r.Bd)(),[t,a]=(0,l.fp)(c.AG.header_min),{check_user_auth:s}=(0,x.MH)(),[p,m]=(0,n.useState)(void 0),[f,y]=(0,n.useState)(3389),[g,j]=(0,n.useState)(void 0),[k,K]=(0,n.useState)(void 0),[A,F]=(0,n.useState)(!1),[D,L]=(0,n.useState)(!1);var I=null;(0,n.useEffect)(()=>(ae||(async()=>{try{await(0,te.J)("rle.js"),ae=!0}catch(t){return void(0,h.zN)(e("加载资源失败"))}})(),()=>{I&&(I.close(),I=null)}),[]);const M=t=>{L(!0),function(n,s,o,i){if(n=n||t.address,o=o||t.username,i=i||t.password,!n||!o)return(0,h.zN)(e("ip或者账号不允许为空")),void L(!1);!function(e){I||(I=ee.client.create(ee.$(e)))}("rdpwebview");var r=ee.$("rdpwebview");r.style.display="inline",r.width=window.innerWidth,r.height=window.innerHeight,F(!0),a(!0),I.connect(n,"",s,o,i,function(e){ee.$("rdpwebview").style.display="none",a(!1),L(!1),F(!1)})}(p,f,g,k)};return(0,w.jsxs)("div",{children:[(0,w.jsxs)(b.aZ,{position:"right",children:[(0,w.jsx)(i.$Z,{placeholder:e("地址"),icon:"network_ping",value:p,max_width:"15rem",handleInputChange:e=>m(e)}),(0,w.jsx)(i.$Z,{placeholder:e("端口"),icon:"outlet",value:f,max_width:"10rem",handleInputChange:e=>{e&&y(parseInt(e))}}),(0,w.jsx)(i.$Z,{placeholder:e("账号"),icon:"manage_accounts",value:g,max_width:"15rem",handleInputChange:e=>j(e)}),(0,w.jsx)(i.$Z,{placeholder:e("密码"),icon:"password",value:k,max_width:"15rem",handleInputChange:e=>K(e)}),!D&&(0,w.jsx)(d.rA,{icon:"play_arrow",title:e("连接"),onClick:M}),D&&(0,w.jsx)(d.rA,{icon:"close",title:e("关闭"),onClick:async()=>{F(!1),await C.ws.sendData(S.HK.rdp_disconnect,"");var e=ee.$("rdpwebview");e.getContext("2d").clearRect(0,0,e.width,e.height),ee.$("rdpwebview").style.display="none",L(!1),a(!1)}})]}),(0,w.jsxs)(o.jW,{isFull:A,children:[!D&&(0,w.jsx)(N.N,{have_auth_edit:s(v.oV.rdp_proxy_tag_update),getItems:async()=>{const e=await u.J0.get("tag");return e.code===_.m.Success?e.data:[]},save:async t=>{(await u.J0.post("tag/save",t)).code!==_.m.Success&&(0,h.zN)(e("网络错误"))},clickItem:async e=>{K(e.password),j(e.username),m(e.address),y(e.port),M(e)},items:[{key:"name",preName:e("名字")},{key:"address",preName:e("地址")},{key:"port",preName:e("端口")},{key:"username",preName:e("账号")},{key:"password",preName:e("密码")},{key:"color",preName:"color"}]}),(0,w.jsx)("canvas",{id:"rdpwebview",style:{display:"none"}})]})]})}var se=a(8694),oe=a(19324);const ie=(0,n.createContext)({activeKey:"",setActiveKey:()=>{}});function re(e){const{children:t,activeKey:a,defaultActiveKey:s,onChange:o,width:i}=e,[r,l]=(0,n.useState)(()=>a??s??"");(0,n.useEffect)(()=>{void 0!==a&&l(a)},[a]);const c=e=>{void 0===a&&l(e),o&&o(e)},d=[];return n.Children.forEach(t,e=>{n.isValidElement(e)&&e.type===le&&d.push({key:e.props.itemKey,tab:e.props.tab,disabled:e.props.disabled})}),(0,n.useEffect)(()=>{!r&&d.length>0&&l(d[0].key)},[d,r]),(0,w.jsx)(ie.Provider,{value:{activeKey:r,setActiveKey:c},children:(0,w.jsxs)("div",{className:"modern-tabs-container",style:{width:i||"100%"},children:[(0,w.jsx)("div",{className:"modern-tabs-nav",children:d.map(e=>{const t=["modern-tabs-tab",r===e.key?"active":"",e.disabled?"disabled":""].filter(Boolean).join(" ");return(0,w.jsx)("div",{className:t,onClick:()=>!e.disabled&&c(e.key),children:e.tab},e.key)})}),(0,w.jsx)("div",{className:"modern-tabs-content",children:t})]})})}function le(e){const{itemKey:t,children:a}=e,{activeKey:s}=(0,n.useContext)(ie),o=s===t;return(0,w.jsx)("div",{className:"modern-tab-panel "+(o?"active":""),children:a})}const ce=n.lazy(()=>Promise.all([a.e(122),a.e(4091)]).then(a.bind(a,84091)));let de,pe,ue,he;function me(){const{t:e}=(0,r.Bd)(),[t,a]=(0,l.fp)(c.AG.confirm),[f,y]=(0,l.fp)(c.AG.showPrompt),{check_user_auth:g}=(0,x.MH)(),[j,k]=(0,n.useState)(""),[b,K]=(0,l.fp)(c.AG.router_jump),[A,F]=(0,n.useState)("get"),[D,L]=(0,n.useState)(""),[I,M]=(0,n.useState)(void 0),[B,R]=(0,n.useState)([]),[E,O]=(0,n.useState)([]),[G,H]=(0,n.useState)("headers"),[z,U]=(0,n.useState)(String(se.RB.row)),[V,Z]=(0,n.useState)("body"),[J,X]=(0,n.useState)(),[Y,W]=(0,l.fp)(c.AG.nav_index_add_item_by_now_list),[q,Q]=(0,l.fp)(c.AG.prompt_card);x.xK.set_value_temp("{}",0),x.xK.set_value_temp("",1),(0,n.useEffect)(()=>(de={},pe="",ue="",he="",x.xK.get_editor(0).session.setMode("ace/mode/json"),b.http_download_map_path&&(M(b.http_download_map_path),K({})),C.ws.sendData(S.HK.http_download_water,void 0).then(()=>{C.ws.addMsg(S.HK.http_download_water,e=>{const t=e.context;O(t)})}),()=>{C.ws&&"function"==typeof C.ws.removeMsg&&C.ws.removeMsg(S.HK.http_download_water)}),[]);const ee=e=>{const t=new se.vr;t.url=D,t.method=A,t.header_type="headers"===G?1:2,"headers"===G&&(de=JSON.parse(x.xK.get_editor_value(0))),t.headers=de;const a=Number(z);if(t.body_type=a,a===se.RB.row)pe=x.xK.get_editor_value(1),t.data=pe;else if(a===se.RB.json)de["Content-Type"]="application/json",pe=x.xK.get_editor_value(1),t.data=pe;else if(a===se.RB.form){de["Content-Type"]="multipart/form-data",t.form_data_list=B;for(const t of B)t.key&&t.is_file&&e&&e.append(t.fullPath,t.file_object)}return t};return(0,w.jsx)("div",{children:(0,w.jsxs)(o.xh,{children:[(0,w.jsxs)(o.fI,{children:[(0,w.jsxs)(o.VP,{children:[0!==E.length&&(0,w.jsx)(s.Zp,{title:"正在下载",children:(0,w.jsx)("div",{children:E.map((t,a)=>(0,w.jsxs)("div",{children:[(0,w.jsxs)("div",{className:"div-row",children:[(0,w.jsx)(d.rA,{icon:"cancel",title:e("取消"),onClick:()=>{C.ws.sendData(S.HK.http_download_cancel,t.local_download_path)}}),(0,w.jsx)(s.xP,{context:t.filename,tip_context:t.local_download_path}),(0,w.jsx)("span",{style:{paddingLeft:".3rem",color:"green"},children:`${t.progresses??0}% ${t.loaded?(0,P.v7)(t.loaded):""}MB / ${t.seep??""}MB/s `})]}),(0,w.jsx)("div",{style:{width:t.progresses?`${t.progresses}%`:"0",backgroundColor:"#40c4ff",height:"5px",transition:"0.2s ease width",borderRadius:"10px"}})]},a))})}),(0,w.jsxs)(s.Zp,{title:"",rightBottomCom:Number(z)===se.RB.form&&"body"===G&&(0,w.jsx)(d.rA,{icon:"add",title:e("添加"),onClick:()=>{R([{},...B])}}),children:[(0,w.jsxs)("div",{className:"http_url",children:[(0,w.jsx)(i.l6,{width:"10rem",value:A,onChange:e=>{F(e)},options:[{value:"get",color:"#28a745"},{value:"post",color:"#007bff"},{value:"put",color:"#fd7e14"},{value:"delete",color:"#dc3545"},{value:"head",color:"#6f42c1"},{value:"options",color:"#17a2b8"},{value:"connect",color:"#666666"},{value:"trace",color:"#666666"},{value:"custom",color:"#e83e8c"}]}),(0,w.jsx)(i.Sm,{width:"50rem",placeholder:e("http url"),value:D,handleInputChange:e=>{L(e)}}),(0,w.jsx)(d.rA,{icon:"send",title:e("发送"),onClick:async()=>{if(!u._U.have_http_method(A))return void(0,h.zN)(e("不存在的http method"));if(!D)return void(0,h.zN)("url is empty");X(void 0),k("");const t=new FormData;t.append("data",JSON.stringify(ee(t)));let a="http/send";I&&(a+=`?local_download_path=${I}`),oe.A.post(u._U.getUrl(a),t,{headers:{"Content-Type":"multipart/form-data",Authorization:localStorage.getItem("token")}}).catch(e=>{(0,h.zN)(e.message)}).then(e=>{if(!e)return;let t={};try{if(e.headers.filecat_remote_raw_headers&&(t=JSON.parse(e.headers.filecat_remote_raw_headers),he=JSON.stringify(t,null,2)),e.headers.filecat_remote_code)try{const t=JSON.parse(e.headers.filecat_remote_code);X(200===t||201===t?(0,w.jsx)("span",{style:{color:"green"},children:"200"}):t)}catch(e){console.log(e)}}catch(t){he=String(e.headers.filecat_remote_raw_headers)}const a=(t["content-type"]||t["Content-Type"]||"").toLowerCase();ue="object"==typeof e.data?JSON.stringify(e.data,null,2):e.data;const n=x.xK.get_editor(2),s="body"===V?ue:he;if(n){if(a.includes("application/json")||a.includes("+json")){n.session.setMode("ace/mode/json");try{const e=JSON.parse(ue);ue=JSON.stringify(e,null,2)}catch(e){}}else a.includes("html")?n.session.setMode("ace/mode/html"):a.includes("xml")?n.session.setMode("ace/mode/xml"):a.includes("javascript")?n.session.setMode("ace/mode/javascript"):n.session.setMode("ace/mode/text");n.setValue("body"===V?ue:he,-1)}k(s)})}}),g(v.oV.http_proxy_tag_update)&&(0,w.jsx)(d.rA,{title:e("添加"),icon:"save_as",onClick:()=>{if(!g(v.oV.http_proxy_tag_update))return void(0,h.zN)("no permission");for(const t of B)if(t.is_file)return void(0,h.zN)(e("frm_lm"));let t;Q({open:!0,title:e("信息"),context_div:(0,w.jsxs)("div",{children:[(0,w.jsx)("div",{className:"card-content",children:(0,w.jsx)(i.Sm,{placeholderOut:e("输入标签名"),handleInputChange:e=>t=e})}),(0,w.jsx)("div",{className:"card-action",children:(0,w.jsx)("button",{className:"button button--flat",onClick:async()=>{const e=await ee();e.local_download_path=I,e.form_data_list=JSON.stringify(B),e.headers=JSON.stringify(e.headers),"object"==typeof e.data&&(e.data=JSON.stringify(e.data)),e.name=t,W(e),Q({open:!1})},children:e("确定")})})]})})}})]}),(0,w.jsxs)(re,{activeKey:G,onChange:e=>H(e),children:[(0,w.jsx)(le,{itemKey:"headers",tab:e("请求头")+"(json)",children:(0,w.jsxs)("div",{style:{marginTop:"10px"},children:[(0,w.jsx)("div",{style:{display:"flex",justifyContent:"flex-end",marginBottom:"4px"},children:(0,w.jsx)(d.rA,{title:e("格式化"),icon:"data_object",onClick:function(){x.xK.get_editor(0)?.formatCode?.()}})}),(0,w.jsx)("div",{className:"http_ace",children:(0,w.jsx)(ce,{name:"",editor_id:0})})]})}),(0,w.jsx)(le,{itemKey:"body",tab:e("请求体"),children:(0,w.jsxs)("div",{style:{marginTop:"10px"},children:[(0,w.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[(0,w.jsxs)(re,{activeKey:z,onChange:e=>{U(e);const t=Number(e);t===se.RB.row?x.xK.get_editor(1).session.setMode("ace/mode/text"):t===se.RB.json&&x.xK.get_editor(1).session.setMode("ace/mode/json")},children:[(0,w.jsx)(le,{itemKey:String(se.RB.row),tab:e("row")}),(0,w.jsx)(le,{itemKey:String(se.RB.json),tab:e("json")}),(0,w.jsx)(le,{itemKey:String(se.RB.form),tab:e("form")})]}),Number(z)!==se.RB.form&&(0,w.jsx)(d.rA,{title:e("格式化"),icon:"data_object",onClick:function(){x.xK.get_editor(1)?.formatCode?.()}})]}),Number(z)===se.RB.form&&(0,w.jsx)("div",{style:{marginTop:"10px"},children:(0,w.jsx)(p.X,{headers:["key",e("值")],rows:B.map((t,a)=>[(0,w.jsx)(i.Sm,{value:t.key,handleInputChange:e=>{t.key=e,R([...B])},no_border:!0}),(0,w.jsx)(i.Sm,{value:t.value,handleInputChange:e=>{t.value=e,t.is_file=!1,R([...B])},no_border:!0}),(0,w.jsxs)("div",{children:[(0,w.jsx)(d.rA,{icon:"file_upload",title:e("上传文件"),onClick:()=>(e=>{y({show:!0,type:$.PromptEnum.UploadFile,overlay:!0,data:{extra_data:{only_file:!0},call:t=>{let a=t.currentTarget?.files;if(!a)return;const n=a[0];n.fullPath=(0,T.hU)()+Date.now().toString(),B[e].value=`${n}(${n.name})`,B[e].is_file=!0,B[e].fileName=n.name,B[e].fullPath=n.fullPath,R([...B]),B[e].file_object=n,y({overlay:!1,type:"",show:!1,data:{}})}}})})(a)}),(0,w.jsx)(d.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{B.splice(e,1),R([...B])})(a)})]})]),width:"10rem"})}),(0,w.jsx)("div",{className:"http_ace",style:{marginTop:"10px",display:Number(z)!==se.RB.form?"block":"none"},children:(0,w.jsx)(ce,{name:"",editor_id:1})})]})})]}),(0,w.jsx)("div",{style:{paddingTop:"1rem"},children:void 0===I?(0,w.jsx)("span",{style:{cursor:"pointer",color:"#3b82f6"},onClick:()=>{M("")},children:e("下载到本地目录")}):(0,w.jsx)(i.Sm,{placeholder:e("本地地址"),value:I,handleInputChange:e=>{M(e)},handlerEnter:()=>{I||M(void 0)}})})]})]}),(0,w.jsx)(o.VP,{children:(0,w.jsxs)(s.Zp,{title:J,rightTopCom:(0,w.jsxs)("div",{style:{display:"flex",alignItems:"center"},children:[(0,w.jsx)(d.rA,{title:e("格式化"),icon:"data_object",onClick:()=>{x.xK.get_editor(2)?.formatCode?.()}}),(0,w.jsx)(d.rA,{title:e("复制"),icon:"copy_all",onClick:()=>{const t=x.xK.get_editor_value(2);t&&((0,m.lW)(t),(0,h.SK)(e("完成")))}})]}),children:[(0,w.jsxs)(re,{activeKey:V,onChange:e=>{Z(e);const t="body"===e?ue:he;k(t);const a=x.xK.get_editor(2);if(a){try{JSON.parse(t),a.session.setMode("ace/mode/json")}catch{a.session.setMode("ace/mode/text")}a.setValue(t,-1)}},children:[(0,w.jsx)(le,{itemKey:"body",tab:e("响应体")}),(0,w.jsx)(le,{itemKey:"headers",tab:e("响应头")})]}),(0,w.jsx)("div",{className:"http_ace",style:{marginTop:"10px",height:"21rem"},children:(0,w.jsx)(ce,{name:"",editor_id:2})})]})})]}),(0,w.jsx)(o.fI,{children:(0,w.jsx)(o.VP,{children:(0,w.jsx)(N.N,{getItems:async()=>{const e=await u._U.get("http/tag");return e.code===_.m.Success?e.data:[]},save:async t=>{(await u._U.post("http/tag/save",t)).code!==_.m.Success&&(0,h.zN)(e("网络错误"))},have_auth_edit:g(v.oV.http_proxy_tag_update),clickItem:async e=>{L(e.url),F(e.method),M(e.local_download_path),e.header_type&&H(1===e.header_type?"headers":"body"),e.headers&&(de=JSON.parse(e.headers),1===e.header_type&&(x.xK.get_editor(0).setValue(e.headers,-1),x.xK.get_editor(0).session.setMode("ace/mode/json"))),e.form_data_list&&R(JSON.parse(e.form_data_list)),e.data&&(pe=e.data),e.body_type&&(U(String(e.body_type)),e.body_type===se.RB.row?x.xK.get_editor(1).session.setMode("ace/mode/text"):e.body_type===se.RB.json&&x.xK.get_editor(1).session.setMode("ace/mode/json"),x.xK.get_editor(1).setValue(e.data,-1))},items:[{key:"name",preName:e("名字")},{key:"url",preName:"url"},{key:"method",preName:"method"},{key:"headers",preName:"headers"},{key:"data",preName:"data"},{key:"form_data_list",preName:"form_data_list"},{key:"local_download_path",preName:"local_download_path"},{key:"color",preName:"color"}]})})})]})})}var fe=a(87361);const ye=n.lazy(()=>Promise.all([a.e(8772),a.e(8257),a.e(7759)]).then(a.bind(a,45601)));function _e({}){const{check_user_auth:e}=(0,x.MH)(),{t}=(0,r.Bd)(),a=[];return e(v.oV.http_proxy)&&a.push({index:1,name:t("http代理"),rto:"http/",component:(0,w.jsx)(me,{})}),e(v.oV.ssh_proxy)&&a.push({index:1,name:`ssh${t("代理")}`,rto:"remoteShell/",component:(0,w.jsx)(V,{})}),e(v.oV.browser_proxy)&&a.push({index:1,name:`${t("浏览器")}${t("代理")}`,rto:"browserproxy/",component:(0,w.jsx)(j,{})}),e(v.oV.rdp_proxy)&&a.push({index:1,name:`rdp${t("代理")}`,rto:"rdp/",component:(0,w.jsx)(ne,{})}),e(v.oV.rtsp_proxy)&&a.push({index:1,name:t("rtsp播放器"),rto:"rtsp/",component:(0,w.jsx)(ye,{})}),(0,w.jsx)(o.W1,{optionList:a,father_route:fe.o.proxy})}}}]);
@@ -1 +1 @@
1
- "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[3659],{22081(e,n,t){var s=t(96540),r=t(16349),a=t(74848);const i=({percentage:e})=>{const n=(0,s.useRef)(null),[t,i]=(0,s.useState)(null);return(0,s.useEffect)(()=>{const t=n.current.getContext("2d"),s=new r.Ay(t,{type:"doughnut",data:{labels:["use","left"],datasets:[{data:[e,100-e],backgroundColor:["#007bff","#f0f0f0"],borderWidth:0}]},options:{plugins:{legend:{display:!1},tooltip:{enabled:!1}},elements:{arc:{borderWidth:0}}}});return i(s),()=>{s.destroy()}},[]),(0,s.useEffect)(()=>{t&&(t.data.datasets[0].data=[e,100-e],t.update())},[e]),(0,a.jsx)("div",{style:{width:"8rem",overflow:"hidden"},children:(0,a.jsx)("canvas",{ref:n})})};t.d(n,["A",0,i])},77481(e,n,t){t.d(n,{S:()=>o,X:()=>i});var s=t(96540),r=t(61443),a=t(74848);function i(e){const[n,t]=s.useState([]),i=(0,s.useRef)(-1),[o,l]=(0,s.useState)(-1),[d,c]=(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 u=()=>{i.current=-1,l(-1),c(-1)};return(0,a.jsxs)("table",{children:[(0,a.jsx)("thead",{children:(0,a.jsx)("tr",{children:e.headers?.map((n,t)=>{const s=!!e.filter&&(e.filter.column??0)===t;let i=n;if(s){const t=e.filter,s=t.options.find(e=>e.value===t.value);null!=t.value&&s&&(i=`${n} (${s.label})`)}return(0,a.jsx)("th",{className:s?"table-filter-col":"",children:s?(0,a.jsx)(r.l6,{value:e.filter.value,options:e.filter.options,onChange:e.filter.onChange,bare:!0,trigger_label:i}):n},t)})})}),(0,a.jsx)("tbody",{children:n.map((n,t)=>{const s=!!e.onRowDrag;return(0,a.jsx)("tr",{className:s?(o===t?"row-dragging":"")+(d===t?" row-drop-target":""):"",draggable:s,onContextMenu:()=>{e.handleContextMenu&&e.handleContextMenu(n)},onDragStart:e=>{s&&(i.current=t,l(t),e.dataTransfer.effectAllowed="move")},onDragOver:e=>{!s||i.current<0||(e.preventDefault(),e.dataTransfer.dropEffect="move",c(t))},onDrop:n=>{s&&(n.preventDefault(),(()=>{const n=i.current,t=d;u(),n<0||t<0||n===t||e.onRowDrag?.(n,t)})())},onDragEnd:u,children:n.map((t,s)=>{const r=s===n.length-1?"small":"";return(0,a.jsx)("td",{className:r,style:{width:e.width??"auto"},children:t},s)})},t)})})]})}function o(e){return(0,a.jsx)("div",{style:{display:e.isFlex?"flex":"block"},children:e.columns.map((e,n)=>(0,a.jsx)("div",{children:e},n))})}},88062(e,n,t){t(96540),t(47022);var s=t(74848);function r(e){return(0,s.jsx)("div",{className:"black-tip",onClick:()=>{e.click&&e.click(e)},onContextMenu:n=>{n.stopPropagation(),n.nativeEvent.stopImmediatePropagation(),e.onContextMenu&&e.onContextMenu(n,e)},children:e.name})}const a=e=>(0,s.jsxs)("li",{children:[e.click?(0,s.jsx)(r,{...e.node,name:e.render?e.render(e.node):e.node.name,click:e.click,onContextMenu:e.onContextMenu}):(0,s.jsx)("div",{children:e.render?e.render(e.node):e.node.name}),e.node.children&&e.node.children.length>0&&(0,s.jsx)("ul",{children:e.node.children.map((n,t)=>(0,s.jsx)(a,{node:n,click:e.click,onContextMenu:e.onContextMenu,render:e.render},t))})]}),i=e=>(0,s.jsx)("div",{className:"card-tree-view",children:(0,s.jsx)("ul",{children:e.list&&e.list.map((n,t)=>(0,s.jsx)(a,{node:n,click:e.click,onContextMenu:e.onContextMenu,render:e.render},t))})});t.d(n,["A",0,i])},63659(e,n,t){t.r(n),t.d(n,{default:()=>N});var s=t(22022),r=t(96540),a=t(34843),i=t(82893),o=t(92275),l=t(14944),d=(t(14284),t(70447)),c=t(85997),u=t(62042),x=t(4412),h=t(75725),p=(t(22081),t(77481)),f=t(61443),j=t(47071),m=t(99214),g=t(88062),v=t(97856),w=t(88815),_=t(15629),b=t(74848);const k=r.lazy(()=>t.e(3233).then(t.bind(t,85614)));let y,C,S=-1;function N(e){const{t:n}=(0,s.Bd)(),t=(0,m.Du)(),[N,M]=(0,a.fp)(i.AG.workflow_show),[A,D]=(0,r.useState)([]),[E,F]=(0,r.useState)([]),[W,$]=(0,r.useState)(!1),[P,q]=(0,r.useState)(void 0),[z,B]=(0,r.useState)([]),[I,J]=(0,r.useState)(-1),[O,R]=(0,r.useState)(10),[T,H]=(0,r.useState)(0),[K,X]=(0,r.useState)(0),[Z,V]=(0,r.useState)(""),[Y,G]=(0,r.useState)(!1),L=[n("序号"),n("运行名称"),n("状态"),n("运行时长"),n("日期"),n("操作")],Q=[n("名称"),n("状态"),n("cwd"),n("运行时长"),n("操作")],U=async e=>{const n=new j._;n.page_num=e??I,n.page_size=O,n.dir_path=t;const s=await l.ws.sendData(o.HK.workflow_get,n);if(!s)return;const r=s.context;r&&(D(r.list.map(e=>{const n="string"==typeof e.meta?JSON.parse(e.meta):e.meta;return n.index=e.index,n})),H(r.total),X((0,w.gw)(r.total,O)))};(0,r.useEffect)(()=>($(!1),y=void 0,C=void 0,S=-1,U(),async()=>{C&&(C.dispose(),C=null)}),[]);const ee=async e=>{const n=e.steps,t=[];(0,_.Y)(t,n??[]),B(t)},ne=async e=>{C||await new Promise(e=>{y=e,$(!0),(async()=>{const e=new v.Terminal({fontFamily:"Monaco, Menlo, Consolas, 'Courier New', monospace",theme:{background:"#FFFFFF",foreground:"#000000",cursor:"#000000",selectionBackground:"#a6d2ff"},cursorBlink:!0,cursorStyle:"bar",scrollback:1e3,scrollSensitivity:1,tabStopWidth:4,convertEol:!0});C=e,q(e)})()}),e&&(C.reset(),C.write(e))};return(0,b.jsxs)("div",{children:[(0,b.jsxs)(x.aZ,{position:"right",children:[P&&(0,b.jsx)(c.rA,{icon:"print",title:"打印日志",onClick:()=>{$(!W)}}),(0,b.jsx)(c.rA,{icon:"close",title:n("关闭"),onClick:()=>{M(!1)}})]}),(0,b.jsx)(h.jW,{isFull:!0,more:!0,children:(0,b.jsx)(h.NN,{children:(0,b.jsx)(h.xh,{children:(0,b.jsxs)(h.fI,{children:[(0,b.jsx)(h.VP,{children:(0,b.jsx)(d.uF,{self_title:(0,b.jsx)("span",{className:" div-row ",children:(0,b.jsx)("h2",{children:n("历史记录")})}),rightTopCom:(0,b.jsx)("div",{className:" div-row ",children:(0,b.jsx)(f.Sm,{disabled:Y,value:Z,placeholder:"搜索运行名称(支持正则)",handleInputChange:e=>{V(Z)},handlerEnter:e=>{(async e=>{const n=new j._;n.search_name=e,n.dir_path=t,G(!0);const s=await l.ws.sendData(o.HK.workflow_search_by_run_name,n);if(!s)return;const r=s.context;D(r.list.map(e=>{const n="string"==typeof e.meta?JSON.parse(e.meta):e.meta;return n.index=e.index,n})),H(r.total),X((0,w.gw)(r.total,O)),J(0),G(!1)})(e)}})}),rightBottomCom:(0,b.jsxs)("span",{className:" div-row ",children:[(0,b.jsxs)("span",{children:[Math.abs(I),"/",K]}),(0,b.jsx)(f.Sm,{placeholder:`max page ${K}`,handleInputChange:e=>{S=parseInt(e)},handlerEnter:()=>{if(S<1||S>K)return void(0,u.zN)("illegal page num");const e=0-S;J(e),U(e)}}),(0,b.jsx)(c.rA,{icon:"navigate_before",onClick:()=>{const e=I+1;e>-1?(0,u.zN)("max page num"):(J(e),U(e))},title:"上一页"}),(0,b.jsx)(c.rA,{icon:"navigate_next",onClick:()=>{const e=I-1;Math.abs(e)>K?(0,u.zN)("min page num"):(J(e),U(e))},title:"下一页"})]}),children:(0,b.jsx)(p.X,{headers:L,rows:A.map((e,s)=>{let r;r=e.is_running?(0,b.jsxs)("div",{children:[(0,b.jsx)(d.fq,{}),n("正在运行")]}):(0,b.jsxs)("div",{children:[(0,b.jsx)(d.fq,{success:e.is_success}),e.is_success?n("成功"):n("失败")]});const a=[(0,b.jsx)("p",{children:e.index}),(0,b.jsx)("p",{style:{wordWrap:"break-word"},children:e["run-name"]}),r,(0,b.jsx)("span",{children:e.duration}),(0,b.jsx)("span",{children:e.timestamp}),(0,b.jsx)("div",{children:(0,b.jsx)(c.rA,{icon:"details",title:n("详情"),onClick:()=>{(async e=>{if(e.is_running)return;B([]);const n=new j._;n.index=e.index,n.dir_path=t;const s=(await l.ws.sendData(o.HK.workflow_get,n)).context,r="string"==typeof s.one_data.data?JSON.parse(s.one_data.data):s.one_data.data;F(r.all_jobs)})(e)}})})];return a}),width:"10rem"})})}),(0,b.jsxs)(h.VP,{children:[(0,b.jsx)(d.Zp,{title:n("Job"),children:(0,b.jsx)(p.X,{headers:Q,rows:E.map((e,t)=>[(0,b.jsx)("p",{children:e.name}),(0,b.jsx)(_.W,{item:e}),(0,b.jsx)(d.xP,{children:String(e.cwd)}),(0,b.jsx)("span",{children:e.duration}),(0,b.jsxs)("div",{children:[(0,b.jsx)(c.rA,{icon:"details",title:n("详情"),onClick:()=>{ee(e)}}),!!e.message&&(0,b.jsx)(c.rA,{icon:"print",title:n("日志"),onClick:()=>{ne(e.message)}})]})]),width:"10rem"})}),(0,b.jsx)(d.Zp,{title:"Step",children:(0,b.jsx)(g.A,{list:z,click:e=>{(async e=>{if(e?.extra_data?.is_job)await ee(e.extra_data.job_data);else if(e?.extra_data?.context)ne(e.extra_data.context);else{if(!e?.extra_data.code)return;ne(e.extra_data.code??"")}})(e)}})})]})]})})})}),(0,b.jsx)("div",{style:{display:W?"":"none"},children:(0,b.jsx)(k,{show:!0,terminal:P,init:()=>{y&&(y(1),y=void 0)}})})]})}},15629(e,n,t){t.d(n,{W:()=>o});t(96540);var s=t(70447),r=t(47071),a=t(22022),i=t(74848);function o({item:e}){const{t:n}=(0,a.Bd)();let t,o;return null!=e.code?t=0===e.code:e.extra_data?.running_type===r.rl.running&&(o=!0),(0,i.jsxs)("div",{children:[(0,i.jsx)(s.fq,{success:t,running:o}),n(t?"成功":"失败")]})}const l=(e,n,t)=>{if(n)for(const t of n??[]){let n;const r=[];t["use-yml"]?(l(r,void 0,t.use_job_children_list),n=`${t["use-yml"]} ;${t.duration??-1}`):t.runs?n=JSON.stringify(t.runs):t.run?n=t.run:t["run-js"]?n=t["run-js"]:t.sleep&&(n=`sleep ${t.sleep}`),n=(0,i.jsxs)("div",{children:[(0,i.jsx)(s.fq,{success:void 0===t.code?void 0:0===t.code})," ",n+" ;"+(t.duration??"")]}),e.push({name:n,children:r,extra_data:{code:t.code,context:t.message}})}else if(t)for(const n of t??[]){const t=(0,i.jsxs)("div",{children:[(0,i.jsx)(s.fq,{success:void 0===n.code?void 0:0===n.code}),"$",n.name]});e.push({name:t,extra_data:{code:n.code,is_job:!0,job_data:n}})}};t.d(n,["Y",0,l])}}]);
1
+ "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[3659],{22081(e,n,t){var s=t(96540),r=t(16349),a=t(74848);const i=({percentage:e})=>{const n=(0,s.useRef)(null),[t,i]=(0,s.useState)(null);return(0,s.useEffect)(()=>{const t=n.current.getContext("2d"),s=new r.Ay(t,{type:"doughnut",data:{labels:["use","left"],datasets:[{data:[e,100-e],backgroundColor:["#007bff","#f0f0f0"],borderWidth:0}]},options:{plugins:{legend:{display:!1},tooltip:{enabled:!1}},elements:{arc:{borderWidth:0}}}});return i(s),()=>{s.destroy()}},[]),(0,s.useEffect)(()=>{t&&(t.data.datasets[0].data=[e,100-e],t.update())},[e]),(0,a.jsx)("div",{style:{width:"8rem",overflow:"hidden"},children:(0,a.jsx)("canvas",{ref:n})})};t.d(n,["A",0,i])},77481(e,n,t){t.d(n,{S:()=>o,X:()=>i});var s=t(96540),r=t(61443),a=t(74848);function i(e){const[n,t]=s.useState([]),i=(0,s.useRef)(-1),[o,l]=(0,s.useState)(-1),[d,c]=(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 u=()=>{i.current=-1,l(-1),c(-1)};return(0,a.jsxs)("table",{children:[(0,a.jsx)("thead",{children:(0,a.jsx)("tr",{children:e.headers?.map((n,t)=>{const s=!!e.filter&&(e.filter.column??0)===t;let i=n;if(s){const t=e.filter,s=t.options.find(e=>e.value===t.value);null!=t.value&&s&&(i=`${n} (${s.label})`)}return(0,a.jsx)("th",{className:s?"table-filter-col":"",children:s?(0,a.jsx)(r.l6,{value:e.filter.value,options:e.filter.options,onChange:e.filter.onChange,bare:!0,trigger_label:i}):n},t)})})}),(0,a.jsx)("tbody",{children:n.map((n,t)=>{const s=!!e.onRowDrag;return(0,a.jsx)("tr",{className:s?(o===t?"row-dragging":"")+(d===t?" row-drop-target":""):"",draggable:s,onContextMenu:()=>{e.handleContextMenu&&e.handleContextMenu(n)},onDragStart:e=>{s&&(i.current=t,l(t),e.dataTransfer.effectAllowed="move")},onDragOver:e=>{!s||i.current<0||(e.preventDefault(),e.dataTransfer.dropEffect="move",c(t))},onDrop:n=>{s&&(n.preventDefault(),(()=>{const n=i.current,t=d;u(),n<0||t<0||n===t||e.onRowDrag?.(n,t)})())},onDragEnd:u,children:n.map((t,s)=>{const r=s===n.length-1?"small":"";return(0,a.jsx)("td",{className:r,style:{width:e.width??"auto"},children:t},s)})},t)})})]})}function o(e){return(0,a.jsx)("div",{style:{display:e.isFlex?"flex":"block"},children:e.columns.map((e,n)=>(0,a.jsx)("div",{children:e},n))})}},88062(e,n,t){t(96540),t(32768);var s=t(74848);function r(e){return(0,s.jsx)("div",{className:"black-tip",onClick:()=>{e.click&&e.click(e)},onContextMenu:n=>{n.stopPropagation(),n.nativeEvent.stopImmediatePropagation(),e.onContextMenu&&e.onContextMenu(n,e)},children:e.name})}const a=e=>(0,s.jsxs)("li",{children:[e.click?(0,s.jsx)(r,{...e.node,name:e.render?e.render(e.node):e.node.name,click:e.click,onContextMenu:e.onContextMenu}):(0,s.jsx)("div",{children:e.render?e.render(e.node):e.node.name}),e.node.children&&e.node.children.length>0&&(0,s.jsx)("ul",{children:e.node.children.map((n,t)=>(0,s.jsx)(a,{node:n,click:e.click,onContextMenu:e.onContextMenu,render:e.render},t))})]}),i=e=>(0,s.jsx)("div",{className:"card-tree-view",children:(0,s.jsx)("ul",{children:e.list&&e.list.map((n,t)=>(0,s.jsx)(a,{node:n,click:e.click,onContextMenu:e.onContextMenu,render:e.render},t))})});t.d(n,["A",0,i])},63659(e,n,t){t.r(n),t.d(n,{default:()=>N});var s=t(22022),r=t(96540),a=t(34843),i=t(82893),o=t(92275),l=t(14944),d=(t(14284),t(70447)),c=t(85997),u=t(62042),x=t(4412),h=t(75725),p=(t(22081),t(77481)),f=t(61443),j=t(47071),m=t(99214),g=t(88062),v=t(97856),w=t(88815),_=t(15629),b=t(74848);const k=r.lazy(()=>t.e(3233).then(t.bind(t,85614)));let y,C,S=-1;function N(e){const{t:n}=(0,s.Bd)(),t=(0,m.Du)(),[N,M]=(0,a.fp)(i.AG.workflow_show),[A,D]=(0,r.useState)([]),[E,F]=(0,r.useState)([]),[W,$]=(0,r.useState)(!1),[P,q]=(0,r.useState)(void 0),[z,B]=(0,r.useState)([]),[I,J]=(0,r.useState)(-1),[O,R]=(0,r.useState)(10),[T,H]=(0,r.useState)(0),[K,X]=(0,r.useState)(0),[Z,V]=(0,r.useState)(""),[Y,G]=(0,r.useState)(!1),L=[n("序号"),n("运行名称"),n("状态"),n("运行时长"),n("日期"),n("操作")],Q=[n("名称"),n("状态"),n("cwd"),n("运行时长"),n("操作")],U=async e=>{const n=new j._;n.page_num=e??I,n.page_size=O,n.dir_path=t;const s=await l.ws.sendData(o.HK.workflow_get,n);if(!s)return;const r=s.context;r&&(D(r.list.map(e=>{const n="string"==typeof e.meta?JSON.parse(e.meta):e.meta;return n.index=e.index,n})),H(r.total),X((0,w.gw)(r.total,O)))};(0,r.useEffect)(()=>($(!1),y=void 0,C=void 0,S=-1,U(),async()=>{C&&(C.dispose(),C=null)}),[]);const ee=async e=>{const n=e.steps,t=[];(0,_.Y)(t,n??[]),B(t)},ne=async e=>{C||await new Promise(e=>{y=e,$(!0),(async()=>{const e=new v.Terminal({fontFamily:"Monaco, Menlo, Consolas, 'Courier New', monospace",theme:{background:"#FFFFFF",foreground:"#000000",cursor:"#000000",selectionBackground:"#a6d2ff"},cursorBlink:!0,cursorStyle:"bar",scrollback:1e3,scrollSensitivity:1,tabStopWidth:4,convertEol:!0});C=e,q(e)})()}),e&&(C.reset(),C.write(e))};return(0,b.jsxs)("div",{children:[(0,b.jsxs)(x.aZ,{position:"right",children:[P&&(0,b.jsx)(c.rA,{icon:"print",title:"打印日志",onClick:()=>{$(!W)}}),(0,b.jsx)(c.rA,{icon:"close",title:n("关闭"),onClick:()=>{M(!1)}})]}),(0,b.jsx)(h.jW,{isFull:!0,more:!0,children:(0,b.jsx)(h.NN,{children:(0,b.jsx)(h.xh,{children:(0,b.jsxs)(h.fI,{children:[(0,b.jsx)(h.VP,{children:(0,b.jsx)(d.uF,{self_title:(0,b.jsx)("span",{className:" div-row ",children:(0,b.jsx)("h2",{children:n("历史记录")})}),rightTopCom:(0,b.jsx)("div",{className:" div-row ",children:(0,b.jsx)(f.Sm,{disabled:Y,value:Z,placeholder:"搜索运行名称(支持正则)",handleInputChange:e=>{V(Z)},handlerEnter:e=>{(async e=>{const n=new j._;n.search_name=e,n.dir_path=t,G(!0);const s=await l.ws.sendData(o.HK.workflow_search_by_run_name,n);if(!s)return;const r=s.context;D(r.list.map(e=>{const n="string"==typeof e.meta?JSON.parse(e.meta):e.meta;return n.index=e.index,n})),H(r.total),X((0,w.gw)(r.total,O)),J(0),G(!1)})(e)}})}),rightBottomCom:(0,b.jsxs)("span",{className:" div-row ",children:[(0,b.jsxs)("span",{children:[Math.abs(I),"/",K]}),(0,b.jsx)(f.Sm,{placeholder:`max page ${K}`,handleInputChange:e=>{S=parseInt(e)},handlerEnter:()=>{if(S<1||S>K)return void(0,u.zN)("illegal page num");const e=0-S;J(e),U(e)}}),(0,b.jsx)(c.rA,{icon:"navigate_before",onClick:()=>{const e=I+1;e>-1?(0,u.zN)("max page num"):(J(e),U(e))},title:"上一页"}),(0,b.jsx)(c.rA,{icon:"navigate_next",onClick:()=>{const e=I-1;Math.abs(e)>K?(0,u.zN)("min page num"):(J(e),U(e))},title:"下一页"})]}),children:(0,b.jsx)(p.X,{headers:L,rows:A.map((e,s)=>{let r;r=e.is_running?(0,b.jsxs)("div",{children:[(0,b.jsx)(d.fq,{}),n("正在运行")]}):(0,b.jsxs)("div",{children:[(0,b.jsx)(d.fq,{success:e.is_success}),e.is_success?n("成功"):n("失败")]});const a=[(0,b.jsx)("p",{children:e.index}),(0,b.jsx)("p",{style:{wordWrap:"break-word"},children:e["run-name"]}),r,(0,b.jsx)("span",{children:e.duration}),(0,b.jsx)("span",{children:e.timestamp}),(0,b.jsx)("div",{children:(0,b.jsx)(c.rA,{icon:"details",title:n("详情"),onClick:()=>{(async e=>{if(e.is_running)return;B([]);const n=new j._;n.index=e.index,n.dir_path=t;const s=(await l.ws.sendData(o.HK.workflow_get,n)).context,r="string"==typeof s.one_data.data?JSON.parse(s.one_data.data):s.one_data.data;F(r.all_jobs)})(e)}})})];return a}),width:"10rem"})})}),(0,b.jsxs)(h.VP,{children:[(0,b.jsx)(d.Zp,{title:n("Job"),children:(0,b.jsx)(p.X,{headers:Q,rows:E.map((e,t)=>[(0,b.jsx)("p",{children:e.name}),(0,b.jsx)(_.W,{item:e}),(0,b.jsx)(d.xP,{children:String(e.cwd)}),(0,b.jsx)("span",{children:e.duration}),(0,b.jsxs)("div",{children:[(0,b.jsx)(c.rA,{icon:"details",title:n("详情"),onClick:()=>{ee(e)}}),!!e.message&&(0,b.jsx)(c.rA,{icon:"print",title:n("日志"),onClick:()=>{ne(e.message)}})]})]),width:"10rem"})}),(0,b.jsx)(d.Zp,{title:"Step",children:(0,b.jsx)(g.A,{list:z,click:e=>{(async e=>{if(e?.extra_data?.is_job)await ee(e.extra_data.job_data);else if(e?.extra_data?.context)ne(e.extra_data.context);else{if(!e?.extra_data.code)return;ne(e.extra_data.code??"")}})(e)}})})]})]})})})}),(0,b.jsx)("div",{style:{display:W?"":"none"},children:(0,b.jsx)(k,{show:!0,terminal:P,init:()=>{y&&(y(1),y=void 0)}})})]})}},15629(e,n,t){t.d(n,{W:()=>o});t(96540);var s=t(70447),r=t(47071),a=t(22022),i=t(74848);function o({item:e}){const{t:n}=(0,a.Bd)();let t,o;return null!=e.code?t=0===e.code:e.extra_data?.running_type===r.rl.running&&(o=!0),(0,i.jsxs)("div",{children:[(0,i.jsx)(s.fq,{success:t,running:o}),n(t?"成功":"失败")]})}const l=(e,n,t)=>{if(n)for(const t of n??[]){let n;const r=[];t["use-yml"]?(l(r,void 0,t.use_job_children_list),n=`${t["use-yml"]} ;${t.duration??-1}`):t.runs?n=JSON.stringify(t.runs):t.run?n=t.run:t["run-js"]?n=t["run-js"]:t.sleep&&(n=`sleep ${t.sleep}`),n=(0,i.jsxs)("div",{children:[(0,i.jsx)(s.fq,{success:void 0===t.code?void 0:0===t.code})," ",n+" ;"+(t.duration??"")]}),e.push({name:n,children:r,extra_data:{code:t.code,context:t.message}})}else if(t)for(const n of t??[]){const t=(0,i.jsxs)("div",{children:[(0,i.jsx)(s.fq,{success:void 0===n.code?void 0:0===n.code}),"$",n.name]});e.push({name:t,extra_data:{code:n.code,is_job:!0,job_data:n}})}};t.d(n,["Y",0,l])}}]);
@@ -1 +1 @@
1
- "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[3753],{72458(e,t,n){function s(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 s=e.length-1-t;s>=0;s--)if(e[s]===n)return e.substring(0,s+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}n.d(t,{Jn:()=>s,Z1:()=>i});function i(e){if("string"!=typeof e||0===e.length)return!1;return/^[a-zA-Z]:[\\\/]/.test(e)||/^\\\\[^\\/]+[\\/]/.test(e)||/^\//.test(e)}},53753(e,t,n){n.r(t),n.d(t,{default:()=>U});var s=n(96540),i=n(82893),o=n(34843),a=n(85997),l=n(57952),r=n(3198),c=n(14284),d=n(34289),u=n(53459),p=n(47022),h=n(78247),m=n(62042),f=n(2543),v=n(34251),_=n(78150),x=n(22022),y=n(88815),j=n(61973),w=n(23430),g=n(87361),k=n(99214),C=n(72458),S=n(74848);const b=s.lazy(()=>Promise.all([n.e(122),n.e(4091)]).then(n.bind(n,84091))),A=s.lazy(()=>Promise.all([n.e(1384),n.e(1075),n.e(1142)]).then(n.bind(n,71142))),R=s.lazy(()=>n.e(4877).then(n.bind(n,64877))),$=s.lazy(()=>Promise.all([n.e(3277),n.e(9345)]).then(n.bind(n,49345))),N=s.lazy(()=>Promise.all([n.e(8090),n.e(5744)]).then(n.bind(n,16575))),E=s.lazy(()=>Promise.all([n.e(8725),n.e(2728),n.e(2130),n.e(5602),n.e(8781),n.e(6404)]).then(n.bind(n,35304))),I=s.lazy(()=>Promise.resolve().then(n.bind(n,20892))),M=s.lazy(()=>Promise.all([n.e(1922),n.e(4935)]).then(n.bind(n,24935)));function P(e){return(0,v.uL)(e)===p.Iw.excel}function U(e){const[t,n]=(0,s.useState)([]),[U,z]=(0,s.useState)(""),[D,F]=(0,s.useState)(!1),[L,G]=(0,s.useState)({path:"",name:""}),[W,K]=(0,s.useState)(0),[B,J]=(0,s.useState)([]),[X,Z]=(0,s.useState)(""),[H,T]=(0,o.fp)(i.AG.confirm),[V,Y]=(0,s.useState)(!1),[q,O]=(0,o.fp)(i.AG.fileShellShow),[Q,ee]=(0,o.fp)(i.AG.file_shell_hidden),te=(0,k.Cf)(),ne=(0,s.useRef)(null),se=(0,s.useRef)(null),[ie,oe]=(0,s.useState)(!1),[ae,le]=(0,s.useState)(16),[re,ce]=(0,o.fp)(i.AG.showPrompt),{t:de}=(0,x.Bd)(),ue=(0,j.Zp)(),pe=(he=L.name,(0,v.uL)(he)===p.Iw.md);var he;const me=function(e){return(0,v.uL)(e)===p.Iw.excalidraw}(L.name),fe=function(e){return(0,v.uL)(e)===p.Iw.mind}(L.name),ve=function(e){return(0,v.uL)(e)===p.Iw.timeline}(L.name),_e=P(L.name),xe=(0,s.useRef)(null),ye=(0,s.useRef)(null),je=(0,s.useRef)(null),we=(0,s.useRef)(null),ge=(0,s.useRef)(null),ke=(0,s.useRef)(null),[Ce,Se]=(0,s.useState)([]),[be,Ae]=(0,s.useState)(-1),[Re,$e]=(0,s.useState)("folder"),[Ne,Ee]=(0,s.useState)(!0),[Ie,Me]=(0,s.useState)(!1),Pe=(0,k.oT)(),[Ue]=(0,j.ok)(),ze="1"===Ue.get("chat_open"),[De,Fe]=(0,o.fp)(i.AG.studio_chat_width),Le=(0,s.useRef)(null),[Ge,We]=(0,s.useState)(!1),[Ke,Be]=(0,s.useState)(void 0),[Je,Xe]=(0,o.fp)(i.AG.ai_chat_session_by_cwd),Ze=(0,j.zy)(),He=(()=>{const e=`${g.o.studio_page}/`,t=Ze.pathname.startsWith(e)?Ze.pathname.slice(e.length):"",n=(0,d.GG)("file",decodeURIComponent(t));return n.endsWith("/")?n:`${n}/`})(),{check_user_auth:Te}=(0,h.MH)(),[Ve]=(0,o.fp)(i.AG.user_base_info),Ye=Te(w.oV.ai_agent_page);(0,s.useEffect)(()=>{Ve?.user_data&&ze&&!Ye&&Pe("chat_open",null)},[ze,Ye,Ve]);const qe=(0,C.Jn)(w.nM.get_now_dir(Ve),He);(0,k.rJ)(qe);const Oe=async()=>{const e=He;z(e);const t=await c.$M.post("studio/get/item",{path:e});if(t.code===u.m.Success){const e=[],s=[];for(const n of t.data.list)"folder"===n.type?e.push(n):"file"===n.type&&s.push(n);n([...e,...s])}},Qe=(e,t)=>e===t||e.startsWith(t+"/");(0,s.useEffect)(()=>{Y(!1),G({path:"",name:""}),Z(""),h.xK.set_value_temp(""),J([]),Oe()},[Ze]);const et=async(e,t)=>{if(h.xK.set_value_temp(""),!P(e)){const e=await c.$M.get(`${encodeURIComponent(t)}`);h.xK.set_value_temp(e.data)}G({path:t,name:e}),Z(t),$e("folder"),Me(!1)},tt=(e,t)=>{e.size>y.o5?T({open:!0,handle:()=>{et(e.name,t),T({open:!1,handle:null}),Y(!1)},title:"超过20MB了还要打开吗?"}):et(e.name,t)};function nt(){ye.current?.save()}const st=e=>{if(e.ctrlKey&&"s"===e.key){if(e.preventDefault(),pe||me||fe||ve||_e)return;V&&nt()}};(0,s.useEffect)(()=>(document.addEventListener("keydown",st),()=>{document.removeEventListener("keydown",st)}),[V,pe,me,fe,ve,_e]);const it=(0,s.useCallback)(f.throttle(e=>{const t=parseFloat(getComputedStyle(se.current).fontSize),n=window.innerWidth/t-4,s=e.clientX/t,i=2.25+ne.current.offsetWidth/t;s<=n&&s>=i&&le(parseFloat(s.toFixed(2)))},32),[]),ot=()=>{oe(!1),se.current.removeEventListener("pointermove",it)},at=(0,s.useCallback)(f.throttle(e=>{const t=Le.current;if(!t)return;const n=parseFloat(getComputedStyle(t).fontSize),s=t.parentElement.getBoundingClientRect().right-e.clientX,i=.7*t.parentElement.getBoundingClientRect().width,o=Math.min(Math.max(s,320),i);Fe(parseFloat((o/n).toFixed(2)))},32),[]),lt=()=>{We(!1),document.removeEventListener("pointermove",at)},rt=[{r:de("创建文件"),v:"创建文件"},{r:de("创建目录"),v:"创建目录"},{r:de("重命名"),v:"重命名"},{r:de("删除"),v:"删除"}],ct=[{r:de("重命名"),v:"重命名"},{r:de("删除"),v:"删除"}],dt=(e,t,n,s,i)=>{e.preventDefault();const o=new v.ik;o.path=n,o.filename=t,o.x=e.clientX,o.y=e.clientY,o.items=s?rt:ct,i===Oe&&(o.items=o.items.slice(0,2)),o.type=s?p.Iw.studio_folder:p.Iw.studio_file;const a=e=>{i(e)};o.textClick=e=>{switch(e){case"创建文件":ce({show:!0,type:_.PromptEnum.FileNew,overlay:!0,data:{dir:n,call:a}});break;case"创建目录":ce({show:!0,type:_.PromptEnum.DirNew,overlay:!0,data:{dir:n,call:a}});break;case"删除":if(V&&(L.path===n||L.path.includes(n))){const e=()=>{a(s),Y(!1),G({}),h.xK.set_value_temp("")};ce({show:!0,type:_.PromptEnum.FilesDelete,overlay:!0,data:{path:n,call:e,filename:t}});break}ce({show:!0,type:_.PromptEnum.FilesDelete,overlay:!0,data:{path:n,filename:t,call:s?()=>{a(!0)}:a}});break;case"重命名":ce({show:!0,type:_.PromptEnum.FileRename,overlay:!0,data:{path:n,dir:(0,d.Yp)(n),call:(e,t)=>{((e,t)=>{if(X&&Qe(X,e)){const n=t+X.slice(e.length);Z(n),G({path:n,name:(0,d.mH)(n)})}const n=(0,d.oW)(He);if(Qe(n,e)){const s=t+n.slice(e.length);return void ue(`${g.o.studio_page}/${encodeURIComponent(`/file/${s}`)}`,{replace:!0})}K(e=>e+1),Oe()})(e,t)},filename:t}})}},ce({show:!0,type:_.PromptEnum.FileMenu,overlay:!1,data:o})};const ut=pe&&"outline"===Re;return(0,S.jsxs)("div",{className:"studio studio--file",children:[(0,S.jsxs)(l.A,{ignore_tags:!0,left_children:[(0,S.jsx)(a.rA,{title:"取消",icon:"close",onClick:()=>{O({show:!1,path:""}),ee(void 0),ue(-1)}},1),(0,S.jsx)("div",{children:L.name},2)],children:[(0,S.jsx)("title",{children:L.name}),(0,S.jsx)(a.rA,{title:"侧边栏",icon:"list",onClick:()=>Ee(e=>!e),selected:Ne}),pe&&[Ie?(0,S.jsx)(a.rA,{title:de("保存"),icon:"save",onClick:()=>xe.current?.save()},"save"):null,(0,S.jsx)(a.rA,{icon:"source"===xe.current?.mode()?"edit":"code",title:"source"===xe.current?.mode()?de("实时编辑模式"):de("源码模式"),onClick:()=>xe.current?.toggle_mode()},"mode"),(0,S.jsx)(a.rA,{title:de("导出PDF"),icon:"print",onClick:()=>xe.current?.export_pdf()},"pdf")],!pe&&(0,v.zr)(L.name)&&(0,S.jsx)(a.rA,{title:"格式化",icon:"data_object",onClick:function(){h.xK.get_editor()?.formatCode()}}),te.can_terminal&&(0,S.jsx)(a.rA,{icon:"terminal",title:"shell",onClick:function(){!0!==Q&&!1!==Q?q.show?O({show:!1,path:""}):(O({show:!0,path:He}),ee(!1)):ee(!Q)}}),Te(w.oV.ai_agent_page)&&te.ai_chat_available&&(0,S.jsx)(a.rA,{title:de("AI 聊天"),icon:"smart_toy",selected:ze,onClick:()=>Pe("chat_open",!ze?"1":null)}),pe?Ie?(0,S.jsx)(a.rA,{title:de("保存"),icon:"save",onClick:()=>xe.current?.save()}):null:me?(0,S.jsx)(a.rA,{title:de("保存"),icon:"save",onClick:()=>je.current?.save()}):fe?(0,S.jsx)(a.rA,{title:de("保存"),icon:"save",onClick:()=>we.current?.save()}):ve?(0,S.jsx)(a.rA,{title:de("保存"),icon:"save",onClick:()=>ge.current?.save()}):_e?(0,S.jsx)(a.rA,{title:de("保存"),icon:"save",onClick:()=>ke.current?.save()}):V?(0,S.jsx)(a.rA,{title:"保存",icon:"save",onClick:nt}):null]}),(0,S.jsxs)("div",{className:"studio-body",ref:se,children:[(0,S.jsxs)("div",{className:"studio-nav",style:{display:Ne?void 0:"none",width:ae-1+"em"},onContextMenu:e=>{dt(e,L.name,He,!0,Oe)},children:[(0,S.jsx)("div",{className:"studio-nav-outline",style:{display:ut?void 0:"none"},children:(0,S.jsx)(R,{items:Ce,active_pos:be,on_click:e=>xe.current?.goto_heading(e)})}),(0,S.jsx)("div",{className:"studio-nav-folder",style:{display:ut?"none":void 0},children:(0,S.jsx)(s.Fragment,{children:(0,S.jsx)(r.z,{pre_path:U,list:t,click:async(e,t,n)=>{if("folder"===e.type){J(e=>e.includes(n)?e:[...e,n]);const e=await c.$M.post("studio/get/item",{path:`${n}`});if(e.code===u.m.Success){const n=[],s=[];for(const t of e.data.list)"folder"===t.type?n.push(t):"file"===t.type&&s.push(t);t([...n,...s])}}else{if(V)return void T({open:!0,handle:()=>{T({open:!1,handle:null}),Y(!1),tt(e,n)},title:"确定不保存就切换吗?"});tt(e,n)}},active_path:X,expand_paths:B,handleContextMenu:dt,fatherNowToggleExpansion:Oe})},W)}),pe&&(0,S.jsx)("div",{className:"studio-nav-switch",children:(0,S.jsx)(a.rA,{icon:ut?"folder":"list",title:de(ut?"文件目录":"大纲"),onClick:()=>$e(ut?"folder":"outline")})})]}),Ne&&(0,S.jsx)("div",{className:"studio__divider",ref:ne,onPointerDown:()=>{oe(!0),se.current.addEventListener("pointermove",it)},onPointerUp:ot}),ie&&(0,S.jsx)("div",{className:"shell__overlay",onPointerUp:ot}),pe?(0,S.jsx)("div",{className:"studio-editor studio-editor--md",children:(0,S.jsx)(s.Suspense,{fallback:null,children:(0,S.jsx)(A,{pane:{path:X,url:c.$M.getDownloadUrl(encodeURIComponent(X)),name:L.name,on_dirty:Me,on_outline:(e,t)=>{Se(e),Ae(t)},register:e=>{xe.current=e}}})})},X):me?(0,S.jsx)("div",{className:"studio-editor studio-editor--draw",children:(0,S.jsx)(s.Suspense,{fallback:null,children:(0,S.jsx)(N,{reset_key:X,url:c.$M.getDownloadUrl(encodeURIComponent(X)),save_path:X,on_dirty:Y,on_saved:()=>Y(!1),register:e=>{je.current=e}})})},X):fe?(0,S.jsx)("div",{className:"studio-editor studio-editor--mind",children:(0,S.jsx)(s.Suspense,{fallback:null,children:(0,S.jsx)(E,{reset_key:X,url:c.$M.getDownloadUrl(encodeURIComponent(X)),on_dirty:Y,on_saved:()=>Y(!1),register:e=>{we.current=e},on_save:async e=>(await c.$M.post(`save/${encodeURIComponent(X)}`,{context:e})).code===u.m.Success})})},X):ve?(0,S.jsx)("div",{className:"studio-editor studio-editor--timeline",children:(0,S.jsx)(s.Suspense,{fallback:null,children:(0,S.jsx)(I,{reset_key:X,url:c.$M.getDownloadUrl(encodeURIComponent(X)),on_dirty:Y,register:e=>{ge.current=e},on_save:async e=>(await c.$M.post(`save/${encodeURIComponent(X)}`,{context:e})).code===u.m.Success})})},X):_e?(0,S.jsx)("div",{className:"studio-editor studio-editor--excel",children:(0,S.jsx)(s.Suspense,{fallback:null,children:(0,S.jsx)(M,{url:c.$M.getDownloadUrl(encodeURIComponent(X)),save_path:X,on_dirty:Y,bind_save:e=>{ke.current={save:e}}})})},X):(0,S.jsx)("div",{className:"studio-editor",children:L.name&&(0,S.jsx)(s.Suspense,{fallback:null,children:(0,S.jsx)(b,{name:L.name,on_dirty:Y,register:e=>{ye.current=e},save:async e=>{const t={context:h.xK.get_editor_value()},n=await c.$M.post(`save/${encodeURIComponent(X)}`,t);return n.code===u.m.Success||e||(0,m.zN)(de("保存失败")),n.code===u.m.Success}})})},X),ze&&(0,S.jsxs)(s.Fragment,{children:[(0,S.jsx)("div",{className:"studio__divider studio__divider--chat",ref:Le,onPointerDown:e=>{e.preventDefault(),We(!0),document.addEventListener("pointermove",at),document.addEventListener("pointerup",lt,{once:!0})}}),(0,S.jsx)("div",{className:"studio-chat-panel",style:{width:`${De}em`},children:(0,S.jsx)(s.Suspense,{fallback:null,children:(0,S.jsx)($,{inline_header:!0,sync_url:!1,file_cwd_path:qe,session_id:Ke??(pt=qe,i.AG.get_ai_chat_session(Je,pt)),on_session_change:e=>{Be(e),((e,t)=>{Xe({...Je,[e]:t})})(qe,e)}})})})]})]})]});var pt}}}]);
1
+ "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[3753],{72458(e,t,n){function s(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 s=e.length-1-t;s>=0;s--)if(e[s]===n)return e.substring(0,s+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}n.d(t,{Jn:()=>s,Z1:()=>i});function i(e){if("string"!=typeof e||0===e.length)return!1;return/^[a-zA-Z]:[\\\/]/.test(e)||/^\\\\[^\\/]+[\\/]/.test(e)||/^\//.test(e)}},53753(e,t,n){n.r(t),n.d(t,{default:()=>U});var s=n(96540),i=n(82893),o=n(34843),a=n(85997),l=n(57952),r=n(3198),c=n(14284),d=n(34289),u=n(53459),p=n(32768),h=n(78247),m=n(62042),f=n(2543),v=n(34251),_=n(78150),x=n(22022),y=n(88815),j=n(61973),w=n(23430),g=n(87361),k=n(99214),C=n(72458),S=n(74848);const b=s.lazy(()=>Promise.all([n.e(122),n.e(4091)]).then(n.bind(n,84091))),A=s.lazy(()=>Promise.all([n.e(1384),n.e(1075),n.e(1142)]).then(n.bind(n,71142))),R=s.lazy(()=>n.e(4877).then(n.bind(n,64877))),$=s.lazy(()=>Promise.all([n.e(3277),n.e(9345)]).then(n.bind(n,49345))),N=s.lazy(()=>Promise.all([n.e(8090),n.e(5744)]).then(n.bind(n,16575))),E=s.lazy(()=>Promise.all([n.e(8725),n.e(2728),n.e(2130),n.e(5602),n.e(8781),n.e(6404)]).then(n.bind(n,35304))),I=s.lazy(()=>Promise.resolve().then(n.bind(n,20892))),M=s.lazy(()=>Promise.all([n.e(1922),n.e(4935)]).then(n.bind(n,24935)));function P(e){return(0,v.uL)(e)===p.Iw.excel}function U(e){const[t,n]=(0,s.useState)([]),[U,z]=(0,s.useState)(""),[D,F]=(0,s.useState)(!1),[L,G]=(0,s.useState)({path:"",name:""}),[W,K]=(0,s.useState)(0),[B,J]=(0,s.useState)([]),[X,Z]=(0,s.useState)(""),[H,T]=(0,o.fp)(i.AG.confirm),[V,Y]=(0,s.useState)(!1),[q,O]=(0,o.fp)(i.AG.fileShellShow),[Q,ee]=(0,o.fp)(i.AG.file_shell_hidden),te=(0,k.Cf)(),ne=(0,s.useRef)(null),se=(0,s.useRef)(null),[ie,oe]=(0,s.useState)(!1),[ae,le]=(0,s.useState)(16),[re,ce]=(0,o.fp)(i.AG.showPrompt),{t:de}=(0,x.Bd)(),ue=(0,j.Zp)(),pe=(he=L.name,(0,v.uL)(he)===p.Iw.md);var he;const me=function(e){return(0,v.uL)(e)===p.Iw.excalidraw}(L.name),fe=function(e){return(0,v.uL)(e)===p.Iw.mind}(L.name),ve=function(e){return(0,v.uL)(e)===p.Iw.timeline}(L.name),_e=P(L.name),xe=(0,s.useRef)(null),ye=(0,s.useRef)(null),je=(0,s.useRef)(null),we=(0,s.useRef)(null),ge=(0,s.useRef)(null),ke=(0,s.useRef)(null),[Ce,Se]=(0,s.useState)([]),[be,Ae]=(0,s.useState)(-1),[Re,$e]=(0,s.useState)("folder"),[Ne,Ee]=(0,s.useState)(!0),[Ie,Me]=(0,s.useState)(!1),Pe=(0,k.oT)(),[Ue]=(0,j.ok)(),ze="1"===Ue.get("chat_open"),[De,Fe]=(0,o.fp)(i.AG.studio_chat_width),Le=(0,s.useRef)(null),[Ge,We]=(0,s.useState)(!1),[Ke,Be]=(0,s.useState)(void 0),[Je,Xe]=(0,o.fp)(i.AG.ai_chat_session_by_cwd),Ze=(0,j.zy)(),He=(()=>{const e=`${g.o.studio_page}/`,t=Ze.pathname.startsWith(e)?Ze.pathname.slice(e.length):"",n=(0,d.GG)("file",decodeURIComponent(t));return n.endsWith("/")?n:`${n}/`})(),{check_user_auth:Te}=(0,h.MH)(),[Ve]=(0,o.fp)(i.AG.user_base_info),Ye=Te(w.oV.ai_agent_page);(0,s.useEffect)(()=>{Ve?.user_data&&ze&&!Ye&&Pe("chat_open",null)},[ze,Ye,Ve]);const qe=(0,C.Jn)(w.nM.get_now_dir(Ve),He);(0,k.rJ)(qe);const Oe=async()=>{const e=He;z(e);const t=await c.$M.post("studio/get/item",{path:e});if(t.code===u.m.Success){const e=[],s=[];for(const n of t.data.list)"folder"===n.type?e.push(n):"file"===n.type&&s.push(n);n([...e,...s])}},Qe=(e,t)=>e===t||e.startsWith(t+"/");(0,s.useEffect)(()=>{Y(!1),G({path:"",name:""}),Z(""),h.xK.set_value_temp(""),J([]),Oe()},[Ze]);const et=async(e,t)=>{if(h.xK.set_value_temp(""),!P(e)){const e=await c.$M.get(`${encodeURIComponent(t)}`);h.xK.set_value_temp(e.data)}G({path:t,name:e}),Z(t),$e("folder"),Me(!1)},tt=(e,t)=>{e.size>y.o5?T({open:!0,handle:()=>{et(e.name,t),T({open:!1,handle:null}),Y(!1)},title:"超过20MB了还要打开吗?"}):et(e.name,t)};function nt(){ye.current?.save()}const st=e=>{if(e.ctrlKey&&"s"===e.key){if(e.preventDefault(),pe||me||fe||ve||_e)return;V&&nt()}};(0,s.useEffect)(()=>(document.addEventListener("keydown",st),()=>{document.removeEventListener("keydown",st)}),[V,pe,me,fe,ve,_e]);const it=(0,s.useCallback)(f.throttle(e=>{const t=parseFloat(getComputedStyle(se.current).fontSize),n=window.innerWidth/t-4,s=e.clientX/t,i=2.25+ne.current.offsetWidth/t;s<=n&&s>=i&&le(parseFloat(s.toFixed(2)))},32),[]),ot=()=>{oe(!1),se.current.removeEventListener("pointermove",it)},at=(0,s.useCallback)(f.throttle(e=>{const t=Le.current;if(!t)return;const n=parseFloat(getComputedStyle(t).fontSize),s=t.parentElement.getBoundingClientRect().right-e.clientX,i=.7*t.parentElement.getBoundingClientRect().width,o=Math.min(Math.max(s,320),i);Fe(parseFloat((o/n).toFixed(2)))},32),[]),lt=()=>{We(!1),document.removeEventListener("pointermove",at)},rt=[{r:de("创建文件"),v:"创建文件"},{r:de("创建目录"),v:"创建目录"},{r:de("重命名"),v:"重命名"},{r:de("删除"),v:"删除"}],ct=[{r:de("重命名"),v:"重命名"},{r:de("删除"),v:"删除"}],dt=(e,t,n,s,i)=>{e.preventDefault();const o=new v.ik;o.path=n,o.filename=t,o.x=e.clientX,o.y=e.clientY,o.items=s?rt:ct,i===Oe&&(o.items=o.items.slice(0,2)),o.type=s?p.Iw.studio_folder:p.Iw.studio_file;const a=e=>{i(e)};o.textClick=e=>{switch(e){case"创建文件":ce({show:!0,type:_.PromptEnum.FileNew,overlay:!0,data:{dir:n,call:a}});break;case"创建目录":ce({show:!0,type:_.PromptEnum.DirNew,overlay:!0,data:{dir:n,call:a}});break;case"删除":if(V&&(L.path===n||L.path.includes(n))){const e=()=>{a(s),Y(!1),G({}),h.xK.set_value_temp("")};ce({show:!0,type:_.PromptEnum.FilesDelete,overlay:!0,data:{path:n,call:e,filename:t}});break}ce({show:!0,type:_.PromptEnum.FilesDelete,overlay:!0,data:{path:n,filename:t,call:s?()=>{a(!0)}:a}});break;case"重命名":ce({show:!0,type:_.PromptEnum.FileRename,overlay:!0,data:{path:n,dir:(0,d.Yp)(n),call:(e,t)=>{((e,t)=>{if(X&&Qe(X,e)){const n=t+X.slice(e.length);Z(n),G({path:n,name:(0,d.mH)(n)})}const n=(0,d.oW)(He);if(Qe(n,e)){const s=t+n.slice(e.length);return void ue(`${g.o.studio_page}/${encodeURIComponent(`/file/${s}`)}`,{replace:!0})}K(e=>e+1),Oe()})(e,t)},filename:t}})}},ce({show:!0,type:_.PromptEnum.FileMenu,overlay:!1,data:o})};const ut=pe&&"outline"===Re;return(0,S.jsxs)("div",{className:"studio studio--file",children:[(0,S.jsxs)(l.A,{ignore_tags:!0,left_children:[(0,S.jsx)(a.rA,{title:"取消",icon:"close",onClick:()=>{O({show:!1,path:""}),ee(void 0),ue(-1)}},1),(0,S.jsx)("div",{children:L.name},2)],children:[(0,S.jsx)("title",{children:L.name}),(0,S.jsx)(a.rA,{title:"侧边栏",icon:"list",onClick:()=>Ee(e=>!e),selected:Ne}),pe&&[Ie?(0,S.jsx)(a.rA,{title:de("保存"),icon:"save",onClick:()=>xe.current?.save()},"save"):null,(0,S.jsx)(a.rA,{icon:"source"===xe.current?.mode()?"edit":"code",title:"source"===xe.current?.mode()?de("实时编辑模式"):de("源码模式"),onClick:()=>xe.current?.toggle_mode()},"mode"),(0,S.jsx)(a.rA,{title:de("导出PDF"),icon:"print",onClick:()=>xe.current?.export_pdf()},"pdf")],!pe&&(0,v.zr)(L.name)&&(0,S.jsx)(a.rA,{title:"格式化",icon:"data_object",onClick:function(){h.xK.get_editor()?.formatCode()}}),te.can_terminal&&(0,S.jsx)(a.rA,{icon:"terminal",title:"shell",onClick:function(){!0!==Q&&!1!==Q?q.show?O({show:!1,path:""}):(O({show:!0,path:He}),ee(!1)):ee(!Q)}}),Te(w.oV.ai_agent_page)&&te.ai_chat_available&&(0,S.jsx)(a.rA,{title:de("AI 聊天"),icon:"smart_toy",selected:ze,onClick:()=>Pe("chat_open",!ze?"1":null)}),pe?Ie?(0,S.jsx)(a.rA,{title:de("保存"),icon:"save",onClick:()=>xe.current?.save()}):null:me?(0,S.jsx)(a.rA,{title:de("保存"),icon:"save",onClick:()=>je.current?.save()}):fe?(0,S.jsx)(a.rA,{title:de("保存"),icon:"save",onClick:()=>we.current?.save()}):ve?(0,S.jsx)(a.rA,{title:de("保存"),icon:"save",onClick:()=>ge.current?.save()}):_e?(0,S.jsx)(a.rA,{title:de("保存"),icon:"save",onClick:()=>ke.current?.save()}):V?(0,S.jsx)(a.rA,{title:"保存",icon:"save",onClick:nt}):null]}),(0,S.jsxs)("div",{className:"studio-body",ref:se,children:[(0,S.jsxs)("div",{className:"studio-nav",style:{display:Ne?void 0:"none",width:ae-1+"em"},onContextMenu:e=>{dt(e,L.name,He,!0,Oe)},children:[(0,S.jsx)("div",{className:"studio-nav-outline",style:{display:ut?void 0:"none"},children:(0,S.jsx)(R,{items:Ce,active_pos:be,on_click:e=>xe.current?.goto_heading(e)})}),(0,S.jsx)("div",{className:"studio-nav-folder",style:{display:ut?"none":void 0},children:(0,S.jsx)(s.Fragment,{children:(0,S.jsx)(r.z,{pre_path:U,list:t,click:async(e,t,n)=>{if("folder"===e.type){J(e=>e.includes(n)?e:[...e,n]);const e=await c.$M.post("studio/get/item",{path:`${n}`});if(e.code===u.m.Success){const n=[],s=[];for(const t of e.data.list)"folder"===t.type?n.push(t):"file"===t.type&&s.push(t);t([...n,...s])}}else{if(V)return void T({open:!0,handle:()=>{T({open:!1,handle:null}),Y(!1),tt(e,n)},title:"确定不保存就切换吗?"});tt(e,n)}},active_path:X,expand_paths:B,handleContextMenu:dt,fatherNowToggleExpansion:Oe})},W)}),pe&&(0,S.jsx)("div",{className:"studio-nav-switch",children:(0,S.jsx)(a.rA,{icon:ut?"folder":"list",title:de(ut?"文件目录":"大纲"),onClick:()=>$e(ut?"folder":"outline")})})]}),Ne&&(0,S.jsx)("div",{className:"studio__divider",ref:ne,onPointerDown:()=>{oe(!0),se.current.addEventListener("pointermove",it)},onPointerUp:ot}),ie&&(0,S.jsx)("div",{className:"shell__overlay",onPointerUp:ot}),pe?(0,S.jsx)("div",{className:"studio-editor studio-editor--md",children:(0,S.jsx)(s.Suspense,{fallback:null,children:(0,S.jsx)(A,{pane:{path:X,url:c.$M.getDownloadUrl(encodeURIComponent(X)),name:L.name,on_dirty:Me,on_outline:(e,t)=>{Se(e),Ae(t)},register:e=>{xe.current=e}}})})},X):me?(0,S.jsx)("div",{className:"studio-editor studio-editor--draw",children:(0,S.jsx)(s.Suspense,{fallback:null,children:(0,S.jsx)(N,{reset_key:X,url:c.$M.getDownloadUrl(encodeURIComponent(X)),save_path:X,on_dirty:Y,on_saved:()=>Y(!1),register:e=>{je.current=e}})})},X):fe?(0,S.jsx)("div",{className:"studio-editor studio-editor--mind",children:(0,S.jsx)(s.Suspense,{fallback:null,children:(0,S.jsx)(E,{reset_key:X,url:c.$M.getDownloadUrl(encodeURIComponent(X)),on_dirty:Y,on_saved:()=>Y(!1),register:e=>{we.current=e},on_save:async e=>(await c.$M.post(`save/${encodeURIComponent(X)}`,{context:e})).code===u.m.Success})})},X):ve?(0,S.jsx)("div",{className:"studio-editor studio-editor--timeline",children:(0,S.jsx)(s.Suspense,{fallback:null,children:(0,S.jsx)(I,{reset_key:X,url:c.$M.getDownloadUrl(encodeURIComponent(X)),on_dirty:Y,register:e=>{ge.current=e},on_save:async e=>(await c.$M.post(`save/${encodeURIComponent(X)}`,{context:e})).code===u.m.Success})})},X):_e?(0,S.jsx)("div",{className:"studio-editor studio-editor--excel",children:(0,S.jsx)(s.Suspense,{fallback:null,children:(0,S.jsx)(M,{url:c.$M.getDownloadUrl(encodeURIComponent(X)),save_path:X,on_dirty:Y,bind_save:e=>{ke.current={save:e}}})})},X):(0,S.jsx)("div",{className:"studio-editor",children:L.name&&(0,S.jsx)(s.Suspense,{fallback:null,children:(0,S.jsx)(b,{name:L.name,on_dirty:Y,register:e=>{ye.current=e},save:async e=>{const t={context:h.xK.get_editor_value()},n=await c.$M.post(`save/${encodeURIComponent(X)}`,t);return n.code===u.m.Success||e||(0,m.zN)(de("保存失败")),n.code===u.m.Success}})})},X),ze&&(0,S.jsxs)(s.Fragment,{children:[(0,S.jsx)("div",{className:"studio__divider studio__divider--chat",ref:Le,onPointerDown:e=>{e.preventDefault(),We(!0),document.addEventListener("pointermove",at),document.addEventListener("pointerup",lt,{once:!0})}}),(0,S.jsx)("div",{className:"studio-chat-panel",style:{width:`${De}em`},children:(0,S.jsx)(s.Suspense,{fallback:null,children:(0,S.jsx)($,{inline_header:!0,sync_url:!1,file_cwd_path:qe,session_id:Ke??(pt=qe,i.AG.get_ai_chat_session(Je,pt)),on_session_change:e=>{Be(e),((e,t)=>{Xe({...Je,[e]:t})})(qe,e)}})})})]})]})]});var pt}}}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[3884],{72458(e,t,s){function n(e,t){let s=function(e){let t="\\";for(const s of e)if("/"===s||"\\"===s){t=s;break}return t}(e);if("."===t)return e;if(".."===t){if(e.length>1){let t=e[e.length-1]===s?1:0;for(let n=e.length-1-t;n>=0;n--)if(e[n]===s)return e.substring(0,n+1)}return e}return e.endsWith(s)&&t.startsWith(s)?e.slice(0,-1)+t:e.endsWith(s)||t.startsWith(s)?e+t:e+s+t}s.d(t,{Jn:()=>n,Z1:()=>i});function i(e){if("string"!=typeof e||0===e.length)return!1;return/^[a-zA-Z]:[\\\/]/.test(e)||/^\\\\[^\\/]+[\\/]/.test(e)||/^\//.test(e)}},47374(e,t,s){s.d(t,{e:()=>h});var n=s(96540),i=s(61973),a=s(64694),l=s(34289),o=s(61443),r=s(75725),c=s(22022),d=s(85997),_=s(74848);function h(e){let t=(0,i.zy)();const s=(0,i.Zp)(),[h,p]=(0,n.useState)([]),[m,f]=(0,n.useState)("/"),[u,x]=(0,n.useState)(void 0),{t:g,i18n:v}=(0,c.Bd)();n.useEffect(()=>{let t="",s=(0,l.vX)().split("/");s=s.filter(e=>e);const n=s.indexOf(e.baseRoute),i=[];if(-1!=n){t=(0,a.IO)(s.slice(0,n),e.baseRoute);const l=s.slice(n+1);for(let e=0;e<l.length;e++){const s=l[e];i.push({value:s,href:0===e?`${t}${s}/`:(0,a.IO)(i[e-1].href,s)})}f(t),p(i)}},[t]);const w=t=>{t.stopPropagation(),e.clickFun(t)},[j,y]=(0,n.useState)(0),k=(0,n.useRef)(null),b=(0,n.useRef)(null),A=()=>{const e=k.current,t=b.current;if(!e||!t)return;const s=[];for(const e of Array.from(t.children))s.push(e.getBoundingClientRect().width);const n=e.clientWidth;if(s.reduce((e,t)=>e+t,0)<=n||s.length<=2)return void y(e=>0===e?e:0);let i=s[0]+48,a=0;for(let e=s.length-1;e>=1&&!(i+s[e]>n);e--)i+=s[e],a++;const l=Math.max(s.length-1-a,0);y(e=>e===l?e:l)};(0,n.useEffect)(()=>{A();const e=new ResizeObserver(A);return k.current&&e.observe(k.current),()=>e.disconnect()},[h,m,t]),(0,n.useEffect)(()=>{const e=k.current;e&&0!==j&&e.scrollWidth>e.clientWidth&&j<h.length-1&&y(e=>e+1)});const N=j>0?1+j:1,C=j>0?h.slice(1,N):[],[G,S]=(0,n.useState)(null);return(0,n.useEffect)(()=>{S(null)},[t,j]),(0,_.jsxs)("div",{className:"breadcrumbs",ref:k,onClick:e=>{x(void 0!==u?void 0:"")},children:[(0,_.jsx)(n.Fragment,{children:void 0===u?(0,_.jsxs)(n.Fragment,{children:[(0,_.jsx)("span",{className:"chevron",children:(0,_.jsx)(i.N_,{to:m,onClick:w,children:(0,_.jsx)(d.In,{icon:"home"})})}),h.map((e,t)=>j>0&&t>=1&&t<N?1!==t?null:(0,_.jsxs)("span",{className:"chevron",children:[(0,_.jsx)(d.In,{icon:"keyboard_arrow_right"}),(0,_.jsx)("span",{className:"breadcrumbs-fold-dot",onClick:e=>{e.stopPropagation();const t=e.currentTarget.getBoundingClientRect();S({x:t.left,y:t.bottom})},children:"..."})]},"fold"):(0,_.jsxs)("span",{className:"chevron",children:[(0,_.jsx)(d.In,{icon:"keyboard_arrow_right"}),(0,_.jsx)(i.N_,{to:e.href,onClick:w,children:decodeURIComponent(e.value)})]},t)),(0,_.jsxs)("div",{className:"breadcrumbs-measure",ref:b,"aria-hidden":!0,children:[(0,_.jsx)("span",{className:"chevron",children:(0,_.jsx)(i.N_,{to:m,children:(0,_.jsx)(d.In,{icon:"home"})})}),h.map((e,t)=>(0,_.jsxs)("span",{className:"chevron",children:[(0,_.jsx)(d.In,{icon:"keyboard_arrow_right"}),(0,_.jsx)(i.N_,{to:e.href,children:decodeURIComponent(e.value)})]},t))]})]}):(0,_.jsx)(r.QM,{click:()=>{x(void 0)},children:(0,_.jsx)(o.Sm,{width:"100%",placeholder:g("输入跳转的目录"),handlerEnter:t=>{e.input_path_enter&&e.input_path_enter(t),x(void 0)}})})}),G&&(0,_.jsx)(r.rY,{click:()=>S(null),children:(0,_.jsx)(r.sw,{x:G.x,y:G.y,items:C.map(e=>({r:decodeURIComponent(e.value),v:e.href})),click:e=>{S(null),s(e)}})})]})}},13884(e,t,s){s.r(t),s.d(t,{default:()=>Q});var n=s(96540),i=s(47374),a=s(34843),l=s(52035),o=s(82893),r=s(14284),c=s(61973),d=s(4412),_=s(78150),h=s(34289),p=s(53459),m=s(99214),f=s(61443),u=s(32768),x=s(62042),g=s(22022),v=s(7523),w=s(78247),j=s(88815),y=s(6960),k=s(47071),b=s(14944),A=s(92275),N=s(23430),C=s(72458),G=s(34251),S=s(60096),I=s(87361),z=s(76559),E=s(85997),M=s(23496),$=s(74848);function P(e){const{t}=(0,g.Bd)(),[s,i]=(0,n.useState)([]),[a,l]=(0,n.useState)(!1),[o,c]=(0,n.useState)(""),[d,_]=(0,n.useState)(""),h=t=>{const s=e.base_path.endsWith("/")?e.base_path:e.base_path+"/",n=t.type===u.Iw.folder?s+t.name:t.path??s+t.name;return n.startsWith("/")?n:"/"+n};(0,n.useEffect)(()=>{(async()=>{if(a)return;l(!0);const t=await r.$M.post("file_get_page",{param_path:e.base_path,page_num:1,page_size:1e4});if(t?.code!==p.m.Success)return;const s=t.data.files??[],n=s.filter(e=>e.type===u.Iw.folder).sort((e,t)=>e.name.localeCompare(t.name)),o=s.filter(e=>e.type!==u.Iw.folder).sort((e,t)=>e.name.localeCompare(t.name));i([...n,...o])})()},[]);const m=(0,n.useMemo)(()=>{const e=o.trim().toLowerCase();return e?s.filter(t=>t.name.toLowerCase().includes(e)):s},[s,o]),x=()=>{const t=d.trim();t&&!e.ignore_names.includes(t)&&(e.on_change_names([...e.ignore_names,t]),_(""))};return(0,$.jsxs)("div",{className:"search-exclude",children:[(0,$.jsxs)("div",{className:"search-exclude__section",children:[(0,$.jsx)("div",{className:"search-exclude__title",children:t("排除当前目录下的项")}),(0,$.jsx)(f.$Z,{icon:"search",value:o,placeholder:t("过滤列表"),handleInputChange:e=>c(e),handleEnterPress:()=>{}}),(0,$.jsxs)("div",{className:"search-exclude__list",children:[0===m.length&&(0,$.jsx)("div",{className:"search-exclude__empty",children:t(a?"无匹配":"加载中")}),m.map(t=>{const s=h(t),n=e.exclude_paths.includes(s),i=t.type===u.Iw.folder;return(0,$.jsxs)("label",{className:"search-exclude__item",children:[(0,$.jsx)("input",{type:"checkbox",checked:n,onChange:()=>(t=>{const s=h(t),n=e.exclude_paths.includes(s);e.on_change_paths(n?e.exclude_paths.filter(e=>e!==s):[...e.exclude_paths,s])})(t)}),(0,$.jsx)("span",{className:"material-symbols-outlined"+(i?" search-exclude__icon--dir":""),children:i?"folder":"draft"}),(0,$.jsx)("span",{className:"search-exclude__item-name",title:t.name,children:t.name})]},s)})]}),e.exclude_paths.length>0&&(0,$.jsx)("div",{className:"search-exclude__chosen",children:e.exclude_paths.map(t=>(0,$.jsxs)("span",{className:"search-exclude__tag",children:[t.split("/").filter(Boolean).pop(),(0,$.jsx)("span",{className:"material-symbols-outlined",onClick:()=>e.on_change_paths(e.exclude_paths.filter(e=>e!==t)),children:"close"})]},t))})]}),(0,$.jsxs)("div",{className:"search-exclude__section search-exclude__section--ignore",children:[(0,$.jsx)("div",{className:"search-exclude__title",children:t("忽略名字")}),(0,$.jsx)("div",{className:"search-exclude__hint",children:t("按名字忽略")}),(0,$.jsxs)("div",{className:"search-exclude__chosen",children:[0===e.ignore_names.length&&(0,$.jsx)("span",{className:"search-exclude__hint",children:t("暂无")}),e.ignore_names.map(t=>(0,$.jsxs)("span",{className:"search-exclude__tag",children:[t,(0,$.jsx)("span",{className:"material-symbols-outlined",onClick:()=>(t=>{e.on_change_names(e.ignore_names.filter(e=>e!==t))})(t),children:"close"})]},t))]}),(0,$.jsxs)("div",{className:"search-exclude__add",children:[(0,$.jsx)(f.Sm,{value:d,placeholder:t("如 node_modules"),handleInputChange:e=>_(e),handlerEnter:x,width:"12em"}),(0,$.jsx)(E.rA,{icon:"add",title:t("添加"),onClick:x})]}),(0,$.jsxs)("div",{className:"div-row",children:[(0,$.jsx)(E.rA,{icon:"save",title:t("保存忽略名字"),onClick:async()=>{await r.wm.post(M.s.user_save_private_attr,{is_search_exclude:!0,search_exclude_names:e.ignore_names})}}),(0,$.jsx)(E.rA,{icon:"settings",title:t("忽略名字设置"),onClick:e.on_open_setting})]})]})]})}function F(e){const{t}=(0,g.Bd)(),{initUserInfo:s}=(0,n.useContext)(v.F),[i]=(0,a.fp)(o.AG.user_base_info),l=i?.user_data?.search_exclude_names,[c,d]=(0,n.useState)(Array.isArray(l)?[...l]:[]),[_,h]=(0,n.useState)(""),[m,u]=(0,n.useState)(!1),x=()=>{const e=_.trim();e&&!c.includes(e)&&(d([...c,e]),h(""))};return(0,$.jsxs)("div",{className:"search-ignore-setting",children:[(0,$.jsx)("div",{className:"search-ignore-setting__desc",children:t("按名字忽略说明")}),(0,$.jsxs)("div",{className:"search-ignore-setting__add",children:[(0,$.jsx)(f.Sm,{value:_,placeholder:t("如 node_modules"),handleInputChange:e=>h(e),handlerEnter:x,width:"20em"}),(0,$.jsx)(E.rA,{icon:"add",title:t("添加"),onClick:x})]}),(0,$.jsxs)("div",{className:"search-ignore-setting__list",children:[0===c.length&&(0,$.jsx)("div",{className:"search-ignore-setting__empty",children:t("暂无")}),c.map(e=>(0,$.jsxs)("div",{className:"search-ignore-setting__item",children:[(0,$.jsx)("span",{className:"material-symbols-outlined",children:"block"}),(0,$.jsx)("span",{className:"search-ignore-setting__item-name",children:e}),(0,$.jsx)(E.rA,{icon:"delete",title:t("删除"),onClick:()=>(e=>d(c.filter(t=>t!==e)))(e)})]},e))]}),(0,$.jsxs)("div",{className:"div-row div-row--end search-ignore-setting__footer",children:[(0,$.jsx)(E.rA,{icon:"arrow_back",title:t("返回"),onClick:e.on_back}),(0,$.jsx)(E.rA,{icon:"save",title:t("保存"),onClick:async()=>{if(m)return;u(!0);const t=await r.wm.post(M.s.user_save_private_attr,{is_search_exclude:!0,search_exclude_names:c});u(!1),t?.code===p.m.Success&&(await s(),e.on_back())}})]})]})}const R=500;function D(e){const{t}=(0,g.Bd)(),s=(0,c.Zp)(),[,i]=(0,a.fp)(o.AG.prompt_card),[l]=(0,a.fp)(o.AG.user_base_info),{click_file:r}=(0,m.kZ)(),[d,_]=(0,n.useState)(""),[h,p]=(0,n.useState)("name"),[u,x]=(0,n.useState)(!1),[v,w]=(0,n.useState)(!1),[j,y]=(0,n.useState)(!0),[k,b]=(0,n.useState)([]),[N,C]=(0,n.useState)([]),[G,S]=(0,n.useState)(!1),[M,D]=(0,n.useState)(!1),[L,X]=(0,n.useState)(!1),[K,U]=(0,n.useState)([]),[B,Z]=(0,n.useState)(0),[H,Y]=(0,n.useState)(!1),O=(0,n.useMemo)(()=>new z.I(window.location.host,"file_deep_search"),[]),W=(0,n.useRef)(!1),T=(0,n.useRef)(!1),q=decodeURIComponent(e.base_path),V=()=>i({open:!1}),J=()=>{const e=l?.user_data?.search_exclude_names;return Array.isArray(e)?e:[]};(0,n.useEffect)(()=>{C(J())},[l?.user_data?.search_exclude_names]),(0,n.useEffect)(()=>{let e=[],t=null;const s=()=>{if(t=null,W.current||T.current||!e.length)return;const s=e;e=[],Z(e=>e+s.length),U(e=>e.length>=R?e:[...e,...s].slice(0,R))},n=()=>{W.current||X(!1)};return O.addMsg(A.HK.file_deep_search_data,n=>{W.current||T.current||(e.push(...n.context??[]),null===t&&(t=setTimeout(s,100)))}),O.addMsg(A.HK.file_deep_search_end,()=>{W.current||T.current||(s(),X(!1))}),O.on_message("close",n),()=>{W.current=!0,clearTimeout(t),O.sendData(A.HK.file_deep_search_cancel,{}).catch(()=>{}),O.off_message("close",n),O.close()}},[]);const Q=()=>{const t=d.trim();if(!t||L)return;T.current=!1,U([]),Z(0),Y(!0),X(!0);const s={param_path:e.base_path,keyword:t,search_type:h,is_regex:u,ignore_case:v};"content"===h&&(s.show_match_line=j),k.length&&(s.exclude_paths=k),N.length&&(s.exclude_names=N),O.sendData(A.HK.file_deep_search,s).catch(()=>{})},ee=e=>{let t=e.is_dir?e.path:e.path.slice(0,e.path.lastIndexOf("/")+1);t.endsWith("/")||(t+="/"),V(),s(I.o.file+t.split("/").map(encodeURIComponent).join("/"))},te=async e=>{if(e.is_dir)return ee(e);const t=e.path.slice(0,e.path.lastIndexOf("/")+1)||"/";V(),s(I.o.file+t.split("/").map(encodeURIComponent).join("/")),await new Promise(e=>setTimeout(e,300)),await r({name:e.name,opt_shell:!0})},se="content"===h;return M?(0,$.jsx)(F,{on_back:()=>{D(!1),C(J())}}):(0,$.jsxs)("div",{className:"file-deep-search",children:[(0,$.jsxs)("div",{className:"file-deep-search__bar",children:[(0,$.jsx)(f.$Z,{icon:"search",value:d,placeholder:t(se?"搜文件内容":"搜文件名"),handleInputChange:e=>_(e),handleEnterPress:Q}),(0,$.jsx)("button",{className:"button button--flat",onClick:L?()=>{T.current=!0,O.sendData(A.HK.file_deep_search_cancel,{}).catch(()=>{}),X(!1)}:Q,children:t(L?"取消":"搜索")}),(0,$.jsx)(E.rA,{icon:"close",title:t("关闭"),onClick:V})]}),(0,$.jsxs)("div",{className:"file-deep-search__tabs",children:[(0,$.jsx)("button",{className:"file-deep-search__tab"+(se?"":" file-deep-search__tab--active"),onClick:()=>p("name"),children:t("文件名")}),(0,$.jsx)("button",{className:"file-deep-search__tab"+(se?" file-deep-search__tab--active":""),onClick:()=>p("content"),children:t("文件内容")})]}),(0,$.jsxs)("div",{className:"file-deep-search__options",children:[(0,$.jsx)(f.GL,{context:t("正则"),selected:u,onchange:()=>x(!u)}),(0,$.jsx)(f.GL,{context:t("忽略大小写"),selected:v,onchange:()=>w(!v)}),se&&(0,$.jsx)(f.GL,{context:t("显示匹配行"),selected:j,onchange:()=>y(!j)})]}),(0,$.jsxs)("div",{className:"file-deep-search__hint",children:[(0,$.jsxs)("span",{children:[t("范围"),":",q]}),(0,$.jsxs)("span",{className:"file-deep-search__hint-right",children:[(k.length>0||N.length>0)&&(0,$.jsxs)("span",{className:"file-deep-search__excluded",children:[t("已排除")," ",k.length+N.length]}),(0,$.jsxs)("button",{className:"file-deep-search__filter"+(G?" file-deep-search__filter--active":""),onClick:()=>S(!G),children:[(0,$.jsx)("span",{className:"material-symbols-outlined",children:"filter_alt"}),t("过滤")]}),B>0&&(0,$.jsx)("span",{className:"file-deep-search__count",children:B>R?`${t("已显示")} 500 / ${B}`:`${B}`})]})]}),G&&(0,$.jsx)(P,{base_path:e.base_path,exclude_paths:k,ignore_names:N,on_change_paths:b,on_change_names:C,on_open_setting:()=>D(!0)}),(0,$.jsxs)("div",{className:"file-deep-search__body"+(se&&j?" file-deep-search__body--line":""),children:[K.length>0&&(0,$.jsx)("div",{className:"file-deep-search__results",children:K.map(e=>{const s=e.path.slice(0,e.path.lastIndexOf("/")+1);return(0,$.jsxs)("div",{className:"file-deep-search__row",children:[(0,$.jsxs)("div",{className:"file-deep-search__name",children:[e.is_dir?(0,$.jsx)("span",{className:"file-deep-search__dir",children:e.name}):(0,$.jsx)("span",{className:"file-deep-search__file",title:e.name,children:e.name}),(0,$.jsx)("span",{className:"file-deep-search__path",children:s}),e.lines&&e.lines.length>0&&(0,$.jsx)("div",{className:"file-deep-search__lines",children:e.lines.map(t=>(0,$.jsxs)("div",{className:"file-deep-search__line",onClick:()=>te(e),children:[(0,$.jsx)("span",{className:"file-deep-search__line-no",children:t.line}),(0,$.jsx)("span",{className:"file-deep-search__line-text",children:t.text})]},t.line))})]}),(0,$.jsxs)("div",{className:"file-deep-search__actions",children:[(0,$.jsx)(E.rA,{icon:"open_in_new",title:e.is_dir?t("打开"):t("打开文件"),onClick:()=>te(e)}),(0,$.jsx)(E.rA,{icon:"folder_open",title:t("打开所在目录"),onClick:()=>ee(e)})]})]},e.path)})}),L&&(0,$.jsxs)("div",{className:"file-deep-search__empty",children:[(0,$.jsx)("span",{className:"chat-session-running",title:t("搜索中")}),t("搜索中")]}),!L&&B>R&&(0,$.jsx)("div",{className:"file-deep-search__more",children:t("结果过多")}),!L&&0===K.length&&(0,$.jsx)("div",{className:"file-deep-search__empty",children:t(H?"无匹配":se?"输入内容后搜":"输入后搜")})]})]})}var L=s(64694),X=s(12730),K=s(75725),U=s(70447),B=s(40505);let Z={};function H(){const{t:e}=(0,g.Bd)();let t=(0,c.zy)();const s=(0,c.Zp)(),{check_user_auth:i}=(0,w.MH)(),[l,d]=(0,a.fp)(o.AG.nowFileList),[p,f]=(0,a.fp)(o.AG.uploadFiles),[j,y]=(0,a.fp)(o.AG.showPrompt),[k,C]=(0,a.fp)(o.AG.selectedFileList),[S,z]=(0,a.fp)(o.AG.copyedFileList),[M,P]=(0,a.fp)(o.AG.cutedFileList),[F,R]=(0,a.fp)(o.AG.selectedFileList),[D,B]=(0,a.fp)(o.AG.clickFileList),[H,Y]=(0,a.fp)(o.AG.fileShellShow),O=(0,m.Cf)(),[W,T]=(0,a.fp)(o.AG.file_root_list),[q,V]=(0,a.fp)(o.AG.file_root_index),[J,Q]=(0,n.useState)(void 0),[ee,te]=(0,n.useState)(""),[se,ne]=(0,a.fp)(o.AG.workflow_show),[ie,ae]=(0,a.fp)(o.AG.workflow_realtime_show),[le,oe]=(0,a.fp)(o.AG.work_flow_show),{initUserInfo:re}=(0,n.useContext)(v.F),[ce,de]=(0,a.fp)(o.AG.user_base_info),{click_file:_e}=(0,m.kZ)(),[he,pe]=(0,a.fp)(o.AG.prompt_card),me=(0,n.useMemo)(()=>l.files.reduce((e,t)=>e+(t.type!==u.Iw.folder?1:0),0),[l]),fe=(0,n.useMemo)(()=>l.files.reduce((e,t)=>e+(t.type===u.Iw.folder?1:0),0)+(l.folders?.length??0),[l]);function ue(e){(0,x.SK)(e)}(0,n.useEffect)(()=>{Z={}},[t]),(0,n.useEffect)(()=>()=>{Y({show:!1,path:""})},[]);const xe=(0,m.Vs)(),ge=t=>{pe({open:!0,title:e("信息"),context_div:(0,$.jsxs)("div",{style:{maxWidth:"25rem"},children:[(0,$.jsx)(K.Yh,{left:e("挂载位置磁盘"),right:t?.total_size}),(0,$.jsx)(K.Yh,{left:`${e("磁盘剩余")}`,right:t?.left_size}),(0,$.jsx)(K.Yh,{left:`${e("文件系统")}`,right:t?.fs_type}),(0,$.jsx)(K.Yh,{left:`${e("文件夹数")}`,right:fe}),(0,$.jsx)(K.Yh,{left:`${e("文件数")}`,right:me}),(0,$.jsx)(K.Yh,{left:`${e("当前位置")}`,right:(0,$.jsx)(U.xP,{context:t?.now_absolute_path})})]}),cancel:()=>{b.ws.removeMsg(A.HK.file_info)}})};return(0,$.jsxs)(n.Fragment,{children:[k.length>0&&(0,$.jsx)(E.rA,{icon:"delete",title:e("删除"),onClick:()=>{y({show:!0,type:_.PromptEnum.FilesDelete,overlay:!0,data:{}})}}),k.length>0&&(0,$.jsx)(E.rA,{icon:"content_copy",title:e("复制"),onClick:function(){const e=(0,m.ib)(l,k);z(e.map(e=>(0,m.Ok)(e.name))),P([]),ue("已复制")}}),k.length>0&&(0,$.jsx)(E.rA,{icon:"content_cut",title:e("剪切"),onClick:function(){const e=(0,m.ib)(l,k);P(e.map(e=>(0,m.Ok)(e.name))),z([]),ue("已剪切")}}),(S.length>0||M.length>0)&&(0,$.jsx)(E.rA,{onClick:function(){y({show:!0,type:_.PromptEnum.Confirm,overlay:!0,data:{}})},icon:"content_paste",title:e("粘贴到此处"),tip:S.length+M.length}),k.length>0&&(0,$.jsx)(E.rA,{icon:"download",title:e("下载"),onClick:function(){const e=(0,m.ib)(l,k);for(let t=0;t<e.length;t++){const s=e[t];e[t]=encodeURIComponent((0,m.Ok)(s.name))}const t=r.$M.getDownloadUrl(e);window.open(t)}}),k.length>0&&(0,$.jsx)(E.rA,{icon:"compress",title:e("压缩"),onClick:function(){const t=(0,m.ib)(l,k);for(let e=0;e<t.length;e++){const s=t[e];t[e]=(0,m.Ok)(s.name)}t&&0!==t.length?y({show:!0,type:_.PromptEnum.Compress,overlay:!0,data:{files:t}}):(0,x.zN)(e("没有选中"))}}),1===k.length&&(0,$.jsx)(E.rA,{icon:"edit_attributes",title:e("重命名"),onClick:function(){y({show:!0,type:_.PromptEnum.FileRename,overlay:!0,data:{}})}}),le&&(0,$.jsx)(E.rA,{icon:"api",title:"workflow",onClick:()=>{ne(!se)}}),O.can_terminal&&(0,$.jsx)(E.rA,{icon:"terminal",title:"shell",onClick:function(){H.show?Y({show:!1,path:""}):Y({show:!0,path:(0,h.GG)("file",(0,h.vX)())})}}),i(N.oV.share_file)&&(0,$.jsx)(E.rA,{icon:"share",title:e("文件分享"),onClick:()=>{s(`${I.o.share_list_setting_page}`)}}),(0,$.jsx)(E.rA,{icon:"grid_view",title:e("切换样式"),onClick:xe}),(0,$.jsx)(E.rA,{icon:"create_new_folder",title:e("创建文件夹"),onClick:function(){y({show:!0,type:_.PromptEnum.DirNew,overlay:!0,data:{dir:(0,h.GG)("file",(0,h.vX)())}})}}),(0,$.jsx)(E.rA,{icon:"note_add",title:e("创建文本文件"),onClick:function(){y({show:!0,type:_.PromptEnum.FileNew,overlay:!0,data:{dir:(0,h.GG)("file",(0,h.vX)())}})}}),(0,$.jsx)(E.rA,{icon:"upload_file",title:e("上传"),onClick:()=>{y({show:!0,type:_.PromptEnum.UploadFile,overlay:!0,data:{call:e=>{let t=e.currentTarget?.files;if(!t)return;let s=!!t[0].webkitRelativePath;const n=[],i=new Set;for(let e=0;e<t.length;e++){const a=t[e],l=s?a.webkitRelativePath:`${a.webkitRelativePath}${a.name}`;a.fullPath=l,s&&i.add((0,X.S)(l)),n.push(a)}const a=[];if(s)for(const e of i)a.push({isDir:!0,fullPath:e,name:e});a.push(...n),f(a),y({show:!0,type:_.PromptEnum.FilesUpload,overlay:!1,data:{}})}}})}}),(0,$.jsx)(E.rA,{icon:"info",title:e("信息"),onClick:async()=>{let e;if(!Z.now_absolute_path){b.ws.addMsg(A.HK.file_info,t=>{const s=t.context;e&&(Z={...Z,...s},b.ws.removeMsg(A.HK.file_info),ge(Z))});const t=await b.ws.sendData(A.HK.file_info,{type:u.Iw.folder,path:(0,h.GG)("file",(0,h.vX)())});e=t.context,Z=e,ge(Z)}ge(Z)}}),(0,$.jsx)(E.rA,{icon:"more_vert",title:e("切换目录"),onClick:t=>{const n=new G.ik;n.x=t.clientX,n.y=t.clientY,n.type=u.Iw.directory,n.items=W,n.item_pre_value=q,n.textClick=async t=>{if(t.type===G.LU.add)return s(`${I.o.setting_private_env_setting}`),y({data:void 0,overlay:!1,type:"",show:!1}),void(0,x.N9)(e("请配置 文件夹路径"));y({data:void 0,overlay:!1,type:"",show:!1}),t.type!==G.LU.child?(async e=>{V(e),await r.$M.post("base_switch",{root_index:e}),await re(),s("/file/"),R([]),B([])})(t.index):s((0,L.IO)(I.o.file,t.rel))},y({show:!0,type:_.PromptEnum.FileMenu,overlay:!1,data:n})}})]})}var Y=s(2543),O=s(21499);const W=n.lazy(()=>Promise.all([s.e(7856),s.e(6349),s.e(3659)]).then(s.bind(s,63659))),T=n.lazy(()=>Promise.all([s.e(7856),s.e(1636)]).then(s.bind(s,81636))),q=n.lazy(()=>Promise.all([s.e(3277),s.e(9345)]).then(s.bind(s,49345)));let V,J="";function Q(){const[e,t]=(0,a.fp)(o.AG.editorSetting),[,s]=(0,a.fp)(o.AG.md_editor),[,x]=(0,a.fp)(o.AG.log_viewer),[,z]=(0,a.fp)(o.AG.image_editor),[,P]=(0,a.fp)(o.AG.markdown),[,F]=(0,a.fp)(o.AG.excalidraw_editor),[,R]=(0,a.fp)(o.AG.mind_editor),[,X]=(0,a.fp)(o.AG.timeline_editor),[,K]=(0,a.fp)(o.AG.excel_editor),[U,Z]=(0,a.fp)(o.AG.file_preview),{t:Q}=(0,g.Bd)();let ee=(0,c.zy)();const te=(0,c.Zp)(),[se,ne]=(0,a.fp)(o.AG.nowFileList),[ie]=(0,a.fp)(o.AG.file_list_refresh),[ae,le]=(0,a.fp)(o.AG.current_mount),[oe,re]=(0,a.fp)(o.AG.showPrompt),[ce,de]=(0,a.fp)(o.AG.selectedFileList),[_e,he]=(0,a.fp)(o.AG.clickFileList),[pe,me]=(0,a.fp)(o.AG.fileShellShow),[fe,ue]=(0,n.useState)(""),[xe,ge]=(0,a.fp)(o.AG.workflow_show),[ve,we]=(0,a.fp)(o.AG.workflow_realtime_show),[je,ye]=(0,a.fp)(o.AG.work_flow_show),{initUserInfo:ke}=(0,n.useContext)(v.F),[be,Ae]=(0,a.fp)(o.AG.user_base_info),{check_user_auth:Ne}=(0,w.MH)(),{click_file:Ce}=(0,m.kZ)(),[Ge]=(0,c.ok)(),Se=(0,m._A)(),Ie=n.useRef(null),[ze,Ee]=(0,a.fp)(o.AG.to_running_files),[Me,$e]=(0,a.fp)(o.AG.file_page),[Pe]=(0,a.fp)(o.AG.blank_search_mode),[,Fe]=(0,a.fp)(o.AG.prompt_card),[Re,De]=(0,a.fp)(o.AG.blank_search_mode_for_temp),Le=(0,m.oT)(),Xe="1"===Ge.get("chat_open"),Ke=Ne(N.oV.ai_agent_page),Ue=(0,m.Cf)();(0,n.useEffect)(()=>{be?.user_data&&Xe&&!Ke&&Le("chat_open",null)},[Xe,Ke,be]);const[Be,Ze]=(0,a.fp)(o.AG.studio_chat_width),He=n.useRef(null),[Ye,Oe]=(0,n.useState)(!1),[We,Te]=(0,n.useState)(void 0),qe=(0,m.dN)();(0,m.rJ)(qe());const[Ve,Je]=(0,a.fp)(o.AG.ai_chat_session_by_cwd),Qe=function(){const e=(0,m.Cf)(),[t,s]=(0,a.fp)(o.AG.user_base_info),{t:i}=(0,g.Bd)(),{check_user_auth:l}=(0,w.MH)(),[d,p]=(0,a.fp)(o.AG.router_jump),f=(0,c.Zp)(),{initUserInfo:x}=(0,n.useContext)(v.F),[j,y]=(0,a.fp)(o.AG.nowFileList),[k,C]=(0,a.fp)(o.AG.showPrompt),[S,z]=(0,a.fp)(o.AG.fileShellShow),[E,P]=(0,a.fp)(o.AG.blank_search_mode);return s=>{s.preventDefault(),s.stopPropagation();const n=new G.ik;n.x=s.clientX,n.y=s.clientY,n.type=u.Iw.directory;const a=[{r:(0,$.jsx)("span",{style:(0,B.ok)(t.user_data.dir_show_type===N.t8.time_minx_max),children:i("时间逆序")}),v:N.t8.time_minx_max},{r:(0,$.jsx)("span",{style:(0,B.ok)(t.user_data.dir_show_type===N.t8.time_max_min),children:i("时间顺序")}),v:N.t8.time_max_min}],o=[{r:(0,$.jsx)("span",{style:(0,B.ok)(t.user_data.dir_show_type===N.t8.size_min_max),children:i("大小顺序")}),v:N.t8.size_min_max},{r:(0,$.jsx)("span",{style:(0,B.ok)(t.user_data.dir_show_type===N.t8.size_max_min),children:i("大小逆序")}),v:N.t8.size_max_min}],c=[{r:(0,$.jsx)("span",{style:(0,B.ok)(!t.user_data.file_list_pagination_mode||t.user_data.file_list_pagination_mode===N.yM.all),children:i("全部加载文件")}),v:N.yM.all},{r:(0,$.jsx)("span",{style:(0,B.ok)(t.user_data.file_list_pagination_mode===N.yM.pagination),children:i("scrll_l")}),v:N.yM.pagination}],d=[{r:(0,$.jsx)("span",{style:(0,B.ok)(!t.user_data.file_time_show_type||t.user_data.file_time_show_type===N.KD.current),children:i("最近时间")}),v:N.KD.current},{r:(0,$.jsx)("span",{style:(0,B.ok)(t.user_data.file_time_show_type===N.KD.time),children:i("准确时间")}),v:N.KD.time}],g=[{r:i("文件列表展示"),items:[{r:i("文件排序"),v:"",items:[{r:(0,$.jsx)("span",{style:(0,B.ok)(!t.user_data.dir_show_type),children:i("系统默认")}),v:N.t8.defualt},{r:(0,$.jsx)("span",{style:(0,B.ok)(t.user_data.dir_show_type===N.t8.name),children:i("名字")}),v:N.t8.name},{r:(0,$.jsx)("span",{style:(0,B.ok)(t.user_data.dir_show_type===N.t8.time_minx_max||t.user_data.dir_show_type===N.t8.time_max_min),children:i("修改时间")}),v:!1,items:a},{r:(0,$.jsx)("span",{style:(0,B.ok)(t.user_data.dir_show_type===N.t8.size_min_max||t.user_data.dir_show_type===N.t8.size_max_min),children:i("文件大小")}),v:!1,items:o}]},{r:i("文件加载方式"),v:"",items:c},{r:i("时间展示"),v:"",items:d},{r:i("缩放调整"),v:"zoom_adjust"},{r:(0,$.jsx)("span",{style:(0,B.ok)(E),children:i("srchbln")}),v:"blank_search_mode"}]}];e.git_available&&j?.folders?.find(e=>".git"===e.name)&&g.push({r:i("查看Git提交"),v:"git_page"}),l(N.oV.http_proxy)&&g.push({r:i("dl_here"),v:"http_resource"}),t?.user_data?.quick_cmd&&(0,m.LL)([...t.user_data.quick_cmd],g),n.items=g,n.textClick=async e=>{if(console.log(e),!1===e)return;const t={};if("gcfg_dir_config"===e){const e=(0,h.GG)("file",(0,h.vX)());return C({data:void 0,overlay:!1,type:"",show:!1}),void f(`${I.o.gcfg_page}/${encodeURIComponent(e)}`)}if("git_page"===e){const e=(0,h.GG)("file",(0,h.vX)());return C({data:void 0,overlay:!1,type:"",show:!1}),void f(`${I.o.git_page}/${encodeURIComponent(e)}`)}if("http_resource"===e){const e=await b.ws.sendData(A.HK.file_info,{path:(0,h.GG)("file",(0,h.vX)())});return p({http_download_map_path:e.context.now_absolute_path}),C({data:void 0,overlay:!1,type:"",show:!1}),void f("/proxy/http/")}if("zoom_adjust"===e)return C({data:void 0,overlay:!1,type:"",show:!1}),void setTimeout(()=>{C({show:!0,type:_.PromptEnum.ZoomAdjust,overlay:!1,data:{}})},0);if("object"==typeof e&&"quick_cmd"===e.tag){let t=e.cmd;t&&(t.endsWith("\r")||(t+="\r",z({show:!0,path:(0,h.GG)("file",(0,h.vX)()),cmd:t})))}else{if("blank_search_mode"===e)return P(!E),void C({data:void 0,overlay:!1,type:"",show:!1});if(e===N.yM.all||e===N.yM.pagination)t.is_pagination_mode=!0;else if(e===N.KD.current||e===N.KD.time)t.is_file_show_type=!0;else{if(e!==N.t8.defualt&&e!==N.t8.name&&e!==N.t8.size_max_min&&e!==N.t8.size_min_max&&e!==N.t8.time_max_min&&e!==N.t8.time_minx_max)return;t.is_dir_list_type=!0}}await r.wm.post(M.s.user_save_private_attr,{type:e,...t}),await x(),C({data:void 0,overlay:!1,type:"",show:!1}),f((0,h.vX)())},C({show:!0,type:_.PromptEnum.FileMenu,overlay:!1,data:n})}}(),et=async e=>{let t=!1;for(const s of e.files??[])s.origin_size=s.size,s.size=(0,j.v7)(s.size),be.user_data.file_time_show_type===N.KD.time?s.show_mtime=s.mtime?(0,O.Yq)(s.mtime):"":s.show_mtime=s.mtime?(0,y.s)(s.mtime):"",s.name===k.SB&&(t=!0);for(const s of e.folders??[])be.user_data.file_time_show_type===N.KD.time?s.show_mtime=s.mtime?(0,O.Yq)(s.mtime):"":s.show_mtime=s.mtime?(0,y.s)(s.mtime):"",s.name===k.SB&&(t=!0);ye(t)},tt=async e=>{le(e??null)};(0,n.useEffect)(()=>{je&&(async()=>{const e=new k.Nd,t=(0,l.zp)().get(o.AG.current_mount);e.dir_path=(0,m.Zl)((0,h.GG)("file",(0,h.vX)()),t),b.ws.addMsg(A.HK.workflow_realtime,e=>{const t=e.context;if(e.context){for(const e of t.sucess_file_list)(0,m.Ys)(e);for(const e of t.failed_file_list)(0,m.V$)(e);Ee(new Set(t.running_file_list))}}),await b.ws.sendData(A.HK.workflow_realtime,e)})()},[je,ae,ee]);const st=async()=>{const e=(0,h.GG)("file",(0,h.vX)());if(Pe||Re)return;let t;if(be.user_data.file_list_pagination_mode===N.yM.pagination){if(J!==e){if(J=e,1!==Me.page_num)return void $e({page_size:Me.page_size,page_num:1})}else if(Me.page_num<0)return;if(t=await r.$M.post("file_get_page",{param_path:e,page_num:Me.page_num,page_size:Me.page_size}),t.code!==p.m.Success)return;const s=t.data;return et(s),tt(s.mount_info),s.files?.length?(ne(e=>{const t=(0,Y.cloneDeep)(1===Me.page_num?s.files:[...e?.files??[],...s.files]),n={...e,files:t};return(0,m.yC)(n,be.user_data.dir_show_type),n}),void(V=t.data)):void $e({page_size:Me.page_size,page_num:-1})}if(t=await r.$M.get(e),t.code!==p.m.Success)return;const s=t.data;(0,m.yC)(s,be.user_data.dir_show_type),et(t.data),tt(s.mount_info),ne(t.data),V=t.data};(0,n.useEffect)(()=>async()=>{Ee(new Set)},[]);const nt=()=>{ye(!1),(()=>{const e=Ge.get("preview_file_name"),t=Ge.get("preview_mode");if(!e||!t)return!1;const n=(0,h.GG)("file",(0,h.vX)());if(Ie.current===n+e)return!0;Ie.current=n+e;const i=()=>Se(null);return"md"===t?(s({url:r.$M.getDownloadUrl(`${encodeURIComponent(n)}${e}`),path:`${n}${e}`,name:e,close:i}),!0):"log"===t?(x({show:!0,fileName:e,encoding:Ge.get("preview_log_enc")??"utf8",wrap:Ge.get("preview_log_wrap")??"wrap",close:i}),!0):"image_edit"===t?(z({path:(0,L.IO)((0,h.vX)(),e),name:e,close:i}),!0):(Ce({name:e,opt_shell:!0,..."text"===t?{model:"text"}:{},close:i}),!0)})()||(t({open:!1}),Z({open:!1}),s({}),x({show:!1}),z({}),P({}),F({}),R({}),X({}),K({}),st())};(0,n.useEffect)(()=>{nt()},[ee,Me]),(0,n.useEffect)(()=>{ie>0&&st()},[ie]);n.useRef(!1);const it=()=>{const e=(0,h.GG)("file",(0,h.vX)());Fe({open:!0,title:Q("深搜"),context_div:(0,$.jsx)(D,{base_path:e})})},at=e=>{e.target===e.currentTarget&&(de([]),he([]))},lt=n.useCallback((0,Y.throttle)(e=>{const t=He.current;if(!t||!t.parentElement)return;const s=parseFloat(getComputedStyle(t).fontSize),n=t.parentElement.getBoundingClientRect(),i=n.right-e.clientX,a=Math.min(Math.max(i,320),.7*n.width);Ze(parseFloat((a/s).toFixed(2)))},32),[]),ot=()=>{Oe(!1),document.removeEventListener("pointermove",lt)},rt=(0,$.jsxs)("div",{className:"file-list-main",children:[(0,$.jsx)(i.e,{baseRoute:"file",clickFun:function(){if(de([]),he([]),be.user_data.file_list_pagination_mode===N.yM.pagination){const e=document.getElementById("listing");e&&(e.scrollTop=0),$e({page_size:Me.page_size,page_num:1})}},input_path_enter:e=>{var t;de([]),he([]),ne({files:[],folders:[]}),(0,C.Z1)(e)?(e=e.replace(0===(t=be.user_data).folder_item_now||void 0===t.folder_item_now?t.cwd:t.folder_items[t.folder_item_now-1].path,""),te(e)):te((0,C.Jn)((0,h.vX)(),e))}}),ae&&(0,$.jsxs)("div",{className:"mount-tip-bar",style:{borderLeftColor:ae.color},children:[(0,$.jsx)("span",{className:"material-icons",style:{color:ae.color},children:"cloud"}),(0,$.jsx)("span",{children:[{v:ae.driver,t:Q("驱动")},{v:ae.credential_note,t:Q("凭据")},{v:ae.account_note,t:Q("账号")}].filter(e=>Boolean(e.v)).map(e=>`${e.v}(${e.t})`).join(" - ")}),ae.readonly&&(0,$.jsx)("span",{className:"mount-readonly-tag",children:Q("只读")})]}),be.user_data.file_list_pagination_mode===N.yM.pagination?(0,$.jsx)(S.$J,{handleContextMenu:Qe,clickBlank:at,list:se.files}):(0,$.jsx)(S.t$,{handleContextMenu:Qe,file_list:se.files,folder_list:se.folders,clickBlank:at})]});return(0,$.jsxs)(n.Fragment,{children:[(0,$.jsxs)(d.aZ,{children:[(0,$.jsx)("div",{className:"mobile-deep-search-btn",children:(0,$.jsx)(E.rA,{icon:"search",title:Q("搜索"),onClick:it})}),(0,$.jsx)(f.$Z,{handleEnterPress:async()=>{if(Pe||Re){if(de([]),he([]),!fe||!fe.trim())return void ne({files:[],folders:[]});const e=(0,h.GG)("file",(0,h.vX)()),t=await r.$M.post("file_get_page",{param_path:e,page_num:1,page_size:1e4,search:fe.trim()});if(t.code!==p.m.Success)return;const s=t.data;return(0,m.yC)(s,be.user_data.dir_show_type),et(s),ne(s),void(V=s)}if(!V)return;de([]),he([]);const e=[],t=[];for(const t of V.files??[])t.name.includes(fe)&&e.push(t);for(const e of V.folders??[])e.name.includes(fe)&&t.push(e);ne({files:e,folders:t})},placeholder:Q("搜索当前目录"),icon:"search",value:"",mobile_hidden:!0,handleIconClick:it,handleInputChange:e=>{ue(e)},max_width:"25em"})]}),(0,$.jsxs)(d.aZ,{position:"right",children:[Ne(N.oV.ai_agent_page)&&Ue.ai_chat_available&&(0,$.jsx)(E.rA,{icon:"smart_toy",title:Q("AI 聊天"),selected:Xe,onClick:()=>Le("chat_open",!Xe?"1":null)}),(0,$.jsx)("div",{className:"mobile-context-btn",children:(0,$.jsx)(E.rA,{icon:"more_horiz",title:Q("右键"),onClick:()=>{const e=ce[ce.length-1];if(void 0!==e){const t=[...se.folders??[],...se.files??[]][e];if(t){const s=document.querySelectorAll(".item")[e],n=s?s.getBoundingClientRect():{left:window.innerWidth/2,bottom:100},i={preventDefault:()=>{},stopPropagation:()=>{},clientX:n.left+10,clientY:n.bottom??100},a=new G.ik;a.path=(0,L.IO)((0,h.vX)(),t.name),a.filename=t.name,a.x=i.clientX,a.y=i.clientY,a.type=t.type===u.Iw.folder?u.Iw.folder:(0,G.uL)(t.name),a.size=t.origin_size,re({show:!0,type:_.PromptEnum.FileMenu,overlay:!1,data:a})}}else{const e={preventDefault:()=>{},stopPropagation:()=>{},clientX:window.innerWidth/2,clientY:window.innerHeight/2};Qe(e)}}})}),(0,$.jsx)(H,{})]}),(0,$.jsxs)("div",{className:"file-list-split"+(Xe?" file-list-split--chat":""),children:[rt,Xe&&(0,$.jsxs)(n.Fragment,{children:[(0,$.jsx)("div",{className:"studio__divider studio__divider--chat",ref:He,onPointerDown:e=>{e.preventDefault(),Oe(!0),document.addEventListener("pointermove",lt),document.addEventListener("pointerup",ot,{once:!0})}}),(0,$.jsx)("div",{className:"studio-chat-panel",style:{width:`${Be}em`},children:(0,$.jsx)(n.Suspense,{fallback:null,children:(0,$.jsx)(q,{inline_header:!0,sync_url:!1,file_cwd_path:qe(),session_id:We??(ct=qe(),o.AG.get_ai_chat_session(Ve,ct)),on_session_change:e=>{Te(e),((e,t)=>{Je({...Ve,[e]:t})})(qe(),e)}})})})]})]}),Ye&&(0,$.jsx)("div",{className:"shell__overlay",onPointerUp:ot}),xe&&(0,$.jsx)(W,{}),ve.open&&(0,$.jsx)(T,{})]});var ct}}}]);