filecat 7.31.0 → 7.31.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "filecat",
3
- "version": "7.31.0",
3
+ "version": "7.31.1",
4
4
  "description": "A self-hosted Web File browser and lightweight server management tool.",
5
5
  "author": "xiaobaidadada",
6
6
  "repository": {
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[1142],{71142(e,t,r){r.r(t),r.d(t,{default:()=>ue});var n=r(96540),s=r(7523),o=r(34843),c=r(82893),i=r(78247),l=r(23430),u=r(85997),a=r(57952),d=r(62042),m=r(53459),f=r(14284),_=r(57889),v=r(23496),h=r(22022),p=r(76118),g=r(67951),w=r(74848);function x(e){const{t}=(0,h.Bd)(),r=(0,n.useRef)(null),[s,o]=(0,n.useState)({marks:[],block:{name:"paragraph"}}),[c,i]=(0,n.useState)(null),l=(0,n.useCallback)(()=>{const t=e.get_view();if(!t)return;const r=t.state.selection,n=t.state.storedMarks??r.$from.marks();if(o({marks:n.map(e=>e.type.name),block:k(r.$from)}),r.empty)return void i(null);const s=t.coordsAtPos(r.from),c=t.coordsAtPos(r.to),l=(Math.min(s.left,c.left)+Math.max(s.right,c.right))/2,u=Math.min(s.top,c.top),a=Math.max(s.bottom,c.bottom);i({top:u,bottom:a,left:l})},[e.get_view]);(0,n.useEffect)(()=>{l();const t=e.get_view();if(!t)return;const r=()=>l();t.dom.addEventListener("keyup",r),t.dom.addEventListener("mouseup",r),document.addEventListener("selectionchange",r);const n=t.dom.closest(".md-editor-context");return n?.addEventListener("scroll",r,{passive:!0}),window.addEventListener("resize",r),()=>{t.dom.removeEventListener("keyup",r),t.dom.removeEventListener("mouseup",r),document.removeEventListener("selectionchange",r),n?.removeEventListener("scroll",r),window.removeEventListener("resize",r)}},[l,e.get_view,e.refresh_key]);const u=t=>{const r=e.get_view();r&&(t(r.state,r.dispatch),r.focus(),l())},a=e=>s.marks.includes(e),d=e=>"heading"===s.block.name&&s.block.level===e,[m,f]=(0,n.useState)({w:0,h:36});if((0,n.useLayoutEffect)(()=>{if(!c||!r.current)return;const e=r.current.offsetWidth,t=r.current.offsetHeight;f(r=>r.w===e&&r.h===t?r:{w:e,h:t})},[c,e.refresh_key]),!c)return null;const _=(e,r,n,s,o=!1)=>(0,w.jsx)("button",{className:"mdtb__btn"+(o?" mdtb__btn--on":""),title:t(n),onMouseDown:e=>e.preventDefault(),onClick:s,children:r},e),v=m.w/2,p=v+4,x=Math.max(p,window.innerWidth-v-4),y=document.querySelector(".header")?.getBoundingClientRect().bottom??0,b=c.top-m.h-8,E=b<y+4,j={top:E?Math.min(c.bottom+8,window.innerHeight-m.h-4):b,left:Math.min(x,Math.max(p,c.left))};return(0,w.jsxs)("div",{className:"mdtb mdtb--floating"+(E?" mdtb--below":""),ref:r,style:j,children:[_("h1","H1","一级标题",()=>u((0,g.uf)("heading",{level:1})),d(1)),_("h2","H2","二级标题",()=>u((0,g.uf)("heading",{level:2})),d(2)),_("h3","H3","三级标题",()=>u((0,g.uf)("heading",{level:3})),d(3)),(0,w.jsx)("span",{className:"mdtb__sep"}),_("b","B","加粗",()=>u((0,g.NH)("strong")),a("strong")),_("i","I","斜体",()=>u((0,g.NH)("em")),a("em")),_("s","S","删除线",()=>u((0,g.NH)("strike")),a("strike")),_("code","</>","行内代码",()=>u((0,g.NH)("code")),a("code")),(0,w.jsx)("span",{className:"mdtb__sep"}),_("ul","≔","无序列表",()=>u(g.fK)),_("ol","1.","有序列表",()=>u(g.oB)),_("quote","❝","引用",()=>u(g.Vu))]})}function k(e){for(let t=e.depth;t>0;t--){const r=e.node(t).type.name;if("heading"===r)return{name:"heading",level:e.node(t).attrs.level};if("paragraph"===r)return{name:"paragraph"}}return{name:"paragraph"}}var y=r(75725),b=r(86059);const E="cut",j="copy",S="paste",C="strong",N="em",L="strike",R="code",A="h1",H="h2",M="h3",G="paragraph",z="bullet",B="ordered",$="quote",F="code_block",D="clean",K="row_before",P="row_after",T="row_delete",U="col_before",W="col_after",Y="col_delete",X="header_toggle",q="cell_merge",I="cell_split",V="table_delete",J="table_insert",O="select_all";function Z(e){const{t}=(0,h.Bd)(),[r,s]=(0,n.useState)(null),o=(0,n.useRef)(e.get_view);o.current=e.get_view,(0,n.useEffect)(()=>{const e=e=>{const t=o.current();if(!t)return;const r=e.target;if(!r||!r.closest(".md-filecat-content"))return;e.preventDefault();const n=t.posAtCoords({left:e.clientX,top:e.clientY});if(n){const e=t.state.selection;if(n.pos<e.from||n.pos>e.to){const{TextSelection:e}=t.state.selection.constructor;try{t.dispatch(t.state.tr.setSelection(e.near(t.state.doc.resolve(n.pos))))}catch{}}}const c=!!r.closest("td, th");s({x:e.clientX,y:e.clientY,in_table:c||(0,b.aH)(t.state)})};return document.addEventListener("contextmenu",e,!0),()=>document.removeEventListener("contextmenu",e,!0)},[]);const c=()=>s(null),i=(0,n.useCallback)(e=>{const t=o.current();t&&(e(t.state,t.dispatch),t.focus(),c())},[]),l=e=>{const t=o.current();t?.focus(),document.execCommand(e),c()};if(!r)return null;const u=r.in_table?[{r:t("上方插入行"),v:K},{r:t("下方插入行"),v:P},{r:t("左侧插入列"),v:U},{r:t("右侧插入列"),v:W},{r:t("删除行"),v:T},{r:t("删除列"),v:Y},{r:t("切换表头行"),v:X},{r:t("合并单元格"),v:q},{r:t("拆分单元格"),v:I},{r:t("删除表格"),v:V}]:[],a=[{r:t("剪切"),v:E},{r:t("复制"),v:j},{r:t("粘贴"),v:S},{r:t("格式"),v:"format",items:[{r:t("加粗"),v:C},{r:t("斜体"),v:N},{r:t("删除线"),v:L},{r:t("行内代码"),v:R}]},{r:t("段落"),v:"block",items:[{r:t("一级标题"),v:A},{r:t("二级标题"),v:H},{r:t("三级标题"),v:M},{r:t("正文"),v:G}]},{r:t("插入"),v:"insert",items:[{r:t("无序列表"),v:z},{r:t("有序列表"),v:B},{r:t("引用"),v:$},{r:t("代码块"),v:F},{r:t("插入表格"),v:J}]},...u.length?[{r:t("表格"),v:"table",items:u}]:[],{r:t("清除格式"),v:D},{r:t("全选"),v:O}];return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(y.rY,{click:c}),(0,w.jsx)(y.sw,{x:r.x,y:r.y,items:a,click:t=>{switch(t){case E:return l("cut");case j:return l("copy");case S:return l("paste");case C:return i((0,g.NH)("strong"));case N:return i((0,g.NH)("em"));case L:return i((0,g.NH)("strike"));case R:return i((0,g.NH)("code"));case A:return i((0,g.uf)("heading",{level:1}));case H:return i((0,g.uf)("heading",{level:2}));case M:return i((0,g.uf)("heading",{level:3}));case G:return i((0,g.uf)("paragraph"));case z:return i(g.fK);case B:return i(g.oB);case $:return i(g.Vu);case F:return i((0,g.uf)("code_block"));case J:return c(),void e.on_insert_table?.();case K:return i(b.JD);case P:return i(b.gC);case U:return i(b.RC);case W:return i(b.GU);case T:return i(b.aR);case Y:return i(b.gR);case X:return i(b.uC);case q:return i(b.w7);case I:return i(b.L0);case V:return i(b.kG);case D:return i((e,t)=>{const{from:r,to:n}=e.selection;let s=e.tr;return e.doc.nodesBetween(r,n,(e,t)=>{if(e.isText)for(const r of e.marks)s=s.removeMark(t,t+e.nodeSize,r.type)}),t?.(s),!0});case O:return i((e,t)=>{const{TextSelection:r}=e.selection.constructor;return t?.(e.tr.setSelection(r.create(e.doc,0,e.doc.content.size))),!0})}}})]})}var Q=r(64877);function ee(e){const t=[];if(!e)return t;const r=e.split(/(\n)/);let n=null,s=0;for(let e=0;e<r.length;e+=2){const o=r[e],c=s;s+=o.length+(r[e+1]?.length??0);const i=o.endsWith("\r")?o.slice(0,-1):o,l=i.trimStart(),u=/^(`{3,}|~{3,})/.exec(l);if(u){const e=u[1][0];null===n?n=e:n===e&&(n=null);continue}if(null!==n)continue;const a=/^ {0,3}(#{1,6})\s+(.*)$/.exec(i);if(!a)continue;const d=a[1].length,m=a[2].replace(/\s+#+\s*$/,"").trim();t.push({level:d,text:m,pos:c})}return t}var te=r(69918),re=r(96763),ne=r(40505);function se(e){const{t}=(0,h.Bd)(),[r,s]=(0,n.useState)(!1),[i,l]=(0,n.useState)({x:0,y:0}),[a,d]=(0,n.useState)([]),[m]=(0,o.fp)(c.AG.user_base_info);(0,n.useEffect)(()=>{if(!r)return;let e=!1;return(0,re.Kz)().then(t=>{e||d(t)}),()=>{e=!0}},[r]);const f=(e,t)=>(0,w.jsx)("div",{style:{...(0,ne.ok)(t===m?.user_data?.md_editor_theme)},children:e});return(0,w.jsxs)(n.Fragment,{children:[(0,w.jsx)(u.rA,{icon:"palette",title:t("主题"),onClick:e=>{l({x:e.clientX,y:e.clientY}),s(!0)}}),r&&(0,w.jsx)(y.rY,{click:()=>s(!1),children:(0,w.jsx)(y.sw,{x:i.x,y:i.y,items:[{r:f(t("follow_sys"),""),v:""},...a.map(e=>({r:f(e.id,e.id),v:e.id}))],click:t=>{s(!1),e.on_change(t)}})})]})}var oe=r(2543),ce=r(52671),ie=r(87361),le=r(93245);function ue(e){const t=e.pane,{t:r}=(0,h.Bd)(),g=(0,ce.Zp)(),{check_user_auth:k}=(0,i.MH)(),y=k(l.oV.md_editor_setting),[b,E]=(0,o.fp)(c.AG.md_editor),j=t??b,S=(0,o.fp)(c.AG.md_editor_last_context)[1],C=(0,n.useRef)(null),[N,L]=(0,n.useState)(null),[R,A]=(0,n.useState)(!1),[H,M]=(0,n.useState)(!1),[G,z]=(0,n.useState)(0),B=(0,n.useRef)(null),[$,F]=(0,n.useState)([]),[D,K]=(0,n.useState)(-1),[P,T]=(0,n.useState)(15),[U,W]=(0,n.useState)(!1),Y=(0,n.useRef)(null),X=(0,n.useRef)(null),[q,I]=(0,o.fp)(c.AG.md_editor_show_outline),[V,J]=(0,o.fp)(c.AG.md_editor_mode),O=(0,n.useCallback)(()=>{const e="wysiwyg"===V?"source":"wysiwyg",t=B.current;t&&("source"===e?t.enter_source_mode():t.exit_source_mode(),J(e))},[V]),[ne]=(0,o.fp)(c.AG.md_editor_setting),[ue,ae]=(0,o.fp)(c.AG.md_theme_css),[de]=(0,o.fp)(c.AG.user_base_info),{initUserInfo:me}=(0,n.useContext)(s.F),fe=(0,n.useRef)(null),_e=(0,n.useRef)(null);(0,n.useEffect)(()=>{_e.current},[de]),(0,n.useEffect)(()=>{(0,te.Ce)(Y.current,ne)},[ne]);(0,n.useEffect)(()=>{(0,re.bN)("editor",ue)},[ue]),(0,n.useEffect)(()=>{const e=()=>{(0,re.sO)().then(ae)};return window.addEventListener(re.o3,e),()=>window.removeEventListener(re.o3,e)},[]);const ve=(0,n.useRef)([]),he=(0,n.useCallback)(()=>{const e=B.current;if(!e)return;const t=e.is_source_mode()?ee(e.get_markdown()):e.get_headings();ve.current=t,F(t)},[]);(0,n.useEffect)(()=>{t?.on_outline?.($,D)},[$,D]);const pe=(0,n.useCallback)(()=>{const e=B.current,t=e?.get_view();if(!e||!t)return;const r=e.is_source_mode()?t.state.selection.from-1:t.state.selection.from;let n=-1;for(const e of ve.current){if(!(e.pos<=r))break;n=e.pos}K(n)},[]);(0,n.useEffect)(()=>{let e=!1;if(j?.url)return M(!1),A(!0),_.l.get(j.url).then(t=>{if(e)return;L(t??"")}).catch(()=>{e||((0,d.zN)(r("打开失败")),L(""))}).finally(()=>{e||A(!1)}),()=>{e=!0};L(null)},[j?.url]),(0,n.useEffect)(()=>{const e=()=>z(e=>e+1);return document.addEventListener("selectionchange",e),()=>document.removeEventListener("selectionchange",e)},[]);const ge=(0,n.useRef)(O);ge.current=O,(0,n.useEffect)(()=>{const e=e=>{(e.ctrlKey||e.metaKey)&&"/"===e.key&&(e.preventDefault(),e.stopPropagation(),ge.current())};return document.addEventListener("keydown",e,!0),()=>document.removeEventListener("keydown",e,!0)},[]),(0,n.useEffect)(()=>{he(),pe()},[G,V,he,pe]);const we=(0,n.useCallback)(oe.throttle(e=>{if(!Y.current||!X.current)return;const t=parseFloat(getComputedStyle(Y.current).fontSize),r=e.clientX/t,n=window.innerWidth/t-4,s=2.25+X.current.offsetWidth/t;r<=n&&r>=s&&T(parseFloat(r.toFixed(2)))},32),[]),xe=()=>{W(!1),Y.current?.removeEventListener("pointermove",we)},ke=e=>{const t=B.current;t&&(t.scroll_to_pos(t.is_source_mode()?e.pos+1:e.pos),K(e.pos))},ye=async(e=!1)=>{if(!j?.name||!j?.path)return;const t=B.current?.get_markdown();if(void 0===t)return;const n=j.path.slice(0,j.path.length-j.name.length),s=`${encodeURIComponent(n)}${j.name}`;(await f.$M.post(`save/${s}`,{context:t})).code===m.m.Success?(M(!1),e||(0,d.SK)(r("保存成功"))):(0,d.zN)(r("保存失败"))},be=(0,n.useRef)(ye);be.current=ye;const Ee=(0,n.useRef)(H),je=(0,n.useRef)(null);Ee.current=H,(0,le.a)(l.nE.md,()=>Ee.current,e=>ye(e),j.readonly);const Se=()=>{window.print()},Ce=(0,n.useRef)(V);Ce.current=V;const Ne=(0,n.useRef)(ke);Ne.current=ke;const Le=(0,n.useRef)(Se);Le.current=Se,(0,n.useEffect)(()=>{t?.on_dirty?.(H)},[H]),(0,n.useEffect)(()=>{t?.register?.({save:e=>be.current(e),export_pdf:()=>Le.current(),toggle_mode:()=>ge.current(),mode:()=>Ce.current,goto_heading:e=>Ne.current(e),dirty:()=>Ee.current,get_scroll:()=>je.current?.scrollTop??0,set_scroll:e=>{const t=je.current;t&&(t.scrollTop=e)}})},[]);const Re=()=>{E({}),M(!1),L(null),B.current=null,b?.close?.()},Ae=(0,n.useMemo)(()=>j?.url??"md_editor",[j?.url]);if(!j?.name)return null;const He=!!t,Me=(0,w.jsxs)("div",{className:"md-editor-context",ref:Y,children:[R&&(0,w.jsxs)("div",{className:"common-box common-box-center",children:[r("加载中"),"..."]}),!R&&null!==N&&(0,w.jsxs)(n.Fragment,{children:[!He&&q&&(0,w.jsx)("div",{className:"md-outline-panel",style:{width:`${P}em`},children:(0,w.jsx)(Q.default,{items:$,active_pos:D,on_click:ke})}),!He&&q&&(0,w.jsx)("div",{className:"md-editor-divider",ref:X,onPointerDown:()=>{W(!0),Y.current?.addEventListener("pointermove",we)},onPointerUp:xe}),!He&&U&&(0,w.jsx)("div",{className:"md-editor-drag-overlay",onPointerUp:xe}),(0,w.jsx)("div",{className:"md-editor-scroll",ref:je,children:(0,w.jsxs)("div",{className:"md-editor-sheet",children:["wysiwyg"===V&&(0,w.jsx)(x,{get_view:()=>B.current?.get_view()??null,refresh_key:G}),(0,w.jsx)(p.A,{value:N,ref:B,initial_source_mode:"source"===V,doc_path:j?.path,on_ready:e=>{const t=e.is_source_mode()?ee(e.get_markdown()):e.get_headings();ve.current=t,F(t),K(-1)},on_change:()=>{H||M(!0),C.current&&clearTimeout(C.current),C.current=setTimeout(()=>{const e=B.current?.get_markdown()??"";e&&S(e)},800)},on_save:()=>be.current(),on_selection_change:()=>z(e=>e+1),on_source_mode_change:e=>{J(e?"source":"wysiwyg"),z(e=>e+1)}},Ae),"wysiwyg"===V&&(0,w.jsx)(Z,{get_view:()=>B.current?.get_view()??null,on_insert_table:()=>{B.current?.insert_table(3,3),M(!0)}})]})})]})]});return He?Me:(0,w.jsxs)("div",{id:"md-editor-container",ref:fe,children:[(0,w.jsx)(a.A,{ignore_tags:!0,left_children:[(0,w.jsx)(u.rA,{title:r("关闭"),icon:"close",onClick:Re},1),(0,w.jsx)("div",{className:"md-editor-title",children:j.name},3),...H&&!j.readonly?[(0,w.jsx)(u.rA,{title:r("保存"),icon:"save",onClick:ye},2)]:[],(0,w.jsx)(u.rA,{title:r("大纲"),icon:"list",onClick:()=>I(e=>!e),selected:q},4),...j.readonly?[]:[(0,w.jsx)(u.rA,{title:r("wysiwyg"===V?"源码模式":"实时编辑模式"),icon:"wysiwyg"===V?"code":"edit",onClick:O},5)],...j.readonly?[]:[(0,w.jsx)(se,{on_change:async e=>{const t=await f.wm.post(v.s.user_save_private_attr,{is_md_theme:!0,md_editor_theme:e});t?.code===m.m.Success?(_e.current=e,await me(),(0,d.SK)(r("保存成功"))):(0,d.zN)(r("保存失败"))}},8)],(0,w.jsx)(u.rA,{title:r("导出PDF"),icon:"print",onClick:Se},7),...y&&!j.readonly?[(0,w.jsx)(u.rA,{title:r("编辑器设置"),icon:"settings",onClick:()=>{Re(),g(ie.o.md_editor_setting_page)}},6)]:[]]}),Me]})}}}]);
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[2136],{47374(e,t,s){s.d(t,{e:()=>h});var n=s(96540),i=s(52671),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)}})})]})}},22136(e,t,s){s.r(t),s.d(t,{default:()=>ee});var n=s(96540),i=s(47374),a=s(34843),l=s(52035),o=s(82893),r=s(14284),c=s(52671),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),M=s(59096),z=s(85997),E=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)(z.rA,{icon:"add",title:t("添加"),onClick:x})]}),(0,$.jsxs)("div",{className:"div-row",children:[(0,$.jsx)(z.rA,{icon:"save",title:t("保存忽略名字"),onClick:async()=>{await r.wm.post(E.s.user_save_private_attr,{is_search_exclude:!0,search_exclude_names:e.ignore_names})}}),(0,$.jsx)(z.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)(z.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)(z.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)(z.rA,{icon:"arrow_back",title:t("返回"),onClick:e.on_back}),(0,$.jsx)(z.rA,{icon:"save",title:t("保存"),onClick:async()=>{if(m)return;u(!0);const t=await r.wm.post(E.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 K(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,N]=(0,n.useState)([]),[C,G]=(0,n.useState)([]),[S,E]=(0,n.useState)(!1),[K,L]=(0,n.useState)(!1),[X,D]=(0,n.useState)(!1),[U,H]=(0,n.useState)([]),[B,Z]=(0,n.useState)(0),[Y,O]=(0,n.useState)(!1),W=(0,n.useRef)(!1),T=(0,n.useMemo)(()=>new M.I((0,b.s)(),"file_deep_search"),[]),q=(0,n.useRef)(!1),V=(0,n.useRef)(!1),J=decodeURIComponent(e.base_path),Q=()=>i({open:!1}),ee=()=>{const e=l?.user_data?.search_exclude_names;return Array.isArray(e)?e:[]};(0,n.useEffect)(()=>{G(ee())},[l?.user_data?.search_exclude_names]),(0,n.useEffect)(()=>{let e=[],t=null;const s=()=>{if(t=null,q.current||V.current||!e.length)return;const s=e;e=[],Z(e=>e+s.length),H(e=>e.length>=R?e:[...e,...s].slice(0,R))},n=()=>{q.current||D(!1)};return T.addMsg(A.HK.file_deep_search_data,n=>{q.current||V.current||(e.push(...n.context??[]),null===t&&(t=setTimeout(s,100)))}),T.addMsg(A.HK.file_deep_search_end,()=>{q.current||V.current||(s(),D(!1))}),T.on_message("close",n),()=>{q.current=!0,clearTimeout(t),W.current&&T.sendNotify(A.HK.file_deep_search_cancel,{}).catch(()=>{}).finally(()=>T.close()),T.removeMsg(A.HK.file_deep_search_data),T.removeMsg(A.HK.file_deep_search_end),T.off_message("close",n)}},[]);const te=()=>{const t=d.trim();if(!t||X)return;V.current=!1,H([]),Z(0),O(!0),W.current=!0,D(!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),C.length&&(s.exclude_names=C),T.sendData(A.HK.file_deep_search,s).catch(()=>{})},se=e=>{let t=e.is_dir?e.path:e.path.slice(0,e.path.lastIndexOf("/")+1);t.endsWith("/")||(t+="/"),Q(),s(I.o.file+t.split("/").map(encodeURIComponent).join("/"))},ne=async e=>{if(e.is_dir)return se(e);const t=e.path.slice(0,e.path.lastIndexOf("/")+1)||"/";Q(),s(I.o.file+t.split("/").map(encodeURIComponent).join("/")),await new Promise(e=>setTimeout(e,300)),await r({name:e.name,opt_shell:!0})},ie="content"===h;return K?(0,$.jsx)(F,{on_back:()=>{L(!1),G(ee())}}):(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(ie?"搜文件内容":"搜文件名"),handleInputChange:e=>_(e),handleEnterPress:te}),(0,$.jsx)("button",{className:"button button--flat",onClick:X?()=>{V.current=!0,T.sendNotify(A.HK.file_deep_search_cancel,{}).catch(()=>{}),D(!1)}:te,children:t(X?"取消":"搜索")}),(0,$.jsx)(z.rA,{icon:"close",title:t("关闭"),onClick:Q})]}),(0,$.jsxs)("div",{className:"file-deep-search__tabs",children:[(0,$.jsx)("button",{className:"file-deep-search__tab"+(ie?"":" file-deep-search__tab--active"),onClick:()=>p("name"),children:t("文件名")}),(0,$.jsx)("button",{className:"file-deep-search__tab"+(ie?" 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)}),ie&&(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("范围"),":",J]}),(0,$.jsxs)("span",{className:"file-deep-search__hint-right",children:[(k.length>0||C.length>0)&&(0,$.jsxs)("span",{className:"file-deep-search__excluded",children:[t("已排除")," ",k.length+C.length]}),(0,$.jsxs)("button",{className:"file-deep-search__filter"+(S?" file-deep-search__filter--active":""),onClick:()=>E(!S),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}`})]})]}),S&&(0,$.jsx)(P,{base_path:e.base_path,exclude_paths:k,ignore_names:C,on_change_paths:N,on_change_names:G,on_open_setting:()=>L(!0)}),(0,$.jsxs)("div",{className:"file-deep-search__body"+(ie&&j?" file-deep-search__body--line":""),children:[U.length>0&&(0,$.jsx)("div",{className:"file-deep-search__results",children:U.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:()=>ne(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)(z.rA,{icon:"open_in_new",title:e.is_dir?t("打开"):t("打开文件"),onClick:()=>ne(e)}),(0,$.jsx)(z.rA,{icon:"folder_open",title:t("打开所在目录"),onClick:()=>se(e)})]})]},e.path)})}),X&&(0,$.jsxs)("div",{className:"file-deep-search__empty",children:[(0,$.jsx)("span",{className:"chat-session-running",title:t("搜索中")}),t("搜索中")]}),!X&&B>R&&(0,$.jsx)("div",{className:"file-deep-search__more",children:t("结果过多")}),!X&&0===U.length&&(0,$.jsx)("div",{className:"file-deep-search__empty",children:t(Y?"无匹配":ie?"输入内容后搜":"输入后搜")})]})]})}var L=s(64694),X=s(12730),D=s(75725),U=s(7572),H=s(40505);let B={};function Z(){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,M]=(0,a.fp)(o.AG.copyedFileList),[E,P]=(0,a.fp)(o.AG.cutedFileList),[F,R]=(0,a.fp)(o.AG.selectedFileList),[K,H]=(0,a.fp)(o.AG.clickFileList),[Z,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)(()=>{B={}},[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)(D.Yh,{left:e("挂载位置磁盘"),right:t?.total_size}),(0,$.jsx)(D.Yh,{left:`${e("磁盘剩余")}`,right:t?.left_size}),(0,$.jsx)(D.Yh,{left:`${e("文件系统")}`,right:t?.fs_type}),(0,$.jsx)(D.Yh,{left:`${e("文件夹数")}`,right:fe}),(0,$.jsx)(D.Yh,{left:`${e("文件数")}`,right:me}),(0,$.jsx)(D.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)(z.rA,{icon:"delete",title:e("删除"),onClick:()=>{y({show:!0,type:_.PromptEnum.FilesDelete,overlay:!0,data:{}})}}),k.length>0&&(0,$.jsx)(z.rA,{icon:"content_copy",title:e("复制"),onClick:function(){const e=(0,m.ib)(l,k);M(e.map(e=>(0,m.Ok)(e.name))),P([]),ue("已复制")}}),k.length>0&&(0,$.jsx)(z.rA,{icon:"content_cut",title:e("剪切"),onClick:function(){const e=(0,m.ib)(l,k);P(e.map(e=>(0,m.Ok)(e.name))),M([]),ue("已剪切")}}),(S.length>0||E.length>0)&&(0,$.jsx)(z.rA,{onClick:function(){y({show:!0,type:_.PromptEnum.Confirm,overlay:!0,data:{}})},icon:"content_paste",title:e("粘贴到此处"),tip:S.length+E.length}),k.length>0&&(0,$.jsx)(z.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)(z.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)(z.rA,{icon:"edit_attributes",title:e("重命名"),onClick:function(){y({show:!0,type:_.PromptEnum.FileRename,overlay:!0,data:{}})}}),le&&(0,$.jsx)(z.rA,{icon:"api",title:"workflow",onClick:()=>{ne(!se)}}),O.can_terminal&&(0,$.jsx)(z.rA,{icon:"terminal",title:"shell",onClick:function(){Z.show?Y({show:!1,path:""}):Y({show:!0,path:(0,h.GG)("file",(0,h.vX)())})}}),i(N.oV.share_file)&&(0,$.jsx)(z.rA,{icon:"share",title:e("文件分享"),onClick:()=>{s(`${I.o.share_list_setting_page}`)}}),(0,$.jsx)(z.rA,{icon:"grid_view",title:e("切换样式"),onClick:xe}),(0,$.jsx)(z.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)(z.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)(z.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)(z.rA,{icon:"info",title:e("信息"),onClick:async()=>{let e;if(!B.now_absolute_path){b.ws.addMsg(A.HK.file_info,t=>{const s=t.context;e&&(B={...B,...s},b.ws.removeMsg(A.HK.file_info),ge(B))});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,B=e,ge(B)}ge(B)}}),(0,$.jsx)(z.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([]),H([])})(t.index):s((0,L.IO)(I.o.file,t.rel))},y({show:!0,type:_.PromptEnum.FileMenu,overlay:!1,data:n})}})]})}var Y=s(32918),O=s(2543),W=s(21499);const T=n.lazy(()=>Promise.all([s.e(7856),s.e(6349),s.e(3659)]).then(s.bind(s,63659))),q=n.lazy(()=>Promise.all([s.e(7856),s.e(1636)]).then(s.bind(s,81636))),V=n.lazy(()=>Promise.all([s.e(3277),s.e(9345)]).then(s.bind(s,49345)));let J,Q="";function ee(){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),[,M]=(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),[,D]=(0,a.fp)(o.AG.excel_editor),[U,B]=(0,a.fp)(o.AG.file_preview),{t:ee}=(0,g.Bd)();let te=(0,c.zy)();const se=(0,c.Zp)(),[ne,ie]=(0,a.fp)(o.AG.nowFileList),[ae]=(0,a.fp)(o.AG.file_list_refresh),[le,oe]=(0,a.fp)(o.AG.current_mount),[re,ce]=(0,a.fp)(o.AG.showPrompt),[de,_e]=(0,a.fp)(o.AG.selectedFileList),[he,pe]=(0,a.fp)(o.AG.clickFileList),[me,fe]=(0,a.fp)(o.AG.fileShellShow),[ue,xe]=(0,n.useState)(""),[ge,ve]=(0,a.fp)(o.AG.workflow_show),[we,je]=(0,a.fp)(o.AG.workflow_realtime_show),[ye,ke]=(0,a.fp)(o.AG.work_flow_show),[be,Ae]=(0,n.useState)(!1),{initUserInfo:Ne}=(0,n.useContext)(v.F),[Ce,Ge]=(0,a.fp)(o.AG.user_base_info),{check_user_auth:Se}=(0,w.MH)(),{click_file:Ie}=(0,m.kZ)(),[Me]=(0,c.ok)(),ze=(0,m._A)(),Ee=n.useRef(null),[$e,Pe]=(0,a.fp)(o.AG.to_running_files),[Fe,Re]=(0,a.fp)(o.AG.file_page),[Ke]=(0,a.fp)(o.AG.blank_search_mode),[,Le]=(0,a.fp)(o.AG.prompt_card),[Xe,De]=(0,a.fp)(o.AG.blank_search_mode_for_temp),Ue=(0,m.oT)(),He="1"===Me.get("chat_open"),Be=Se(N.oV.ai_agent_page),Ze=(0,m.Cf)();(0,n.useEffect)(()=>{Ce?.user_data&&He&&!Be&&Ue("chat_open",null)},[He,Be,Ce]);const[Ye,Oe]=(0,a.fp)(o.AG.studio_chat_width),We=n.useRef(null),[Te,qe]=(0,n.useState)(!1),[Ve,Je]=(0,n.useState)(void 0),Qe=(0,m.dN)();(0,m.rJ)(Qe());const[et,tt]=(0,a.fp)(o.AG.ai_chat_session_by_cwd),st=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,M]=(0,a.fp)(o.AG.fileShellShow),[z,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,H.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,H.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,H.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,H.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,H.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,H.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,H.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,H.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,H.ok)(!t.user_data.dir_show_type),children:i("系统默认")}),v:N.t8.defualt},{r:(0,$.jsx)("span",{style:(0,H.ok)(t.user_data.dir_show_type===N.t8.name),children:i("名字")}),v:N.t8.name},{r:(0,$.jsx)("span",{style:(0,H.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,H.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,H.ok)(z),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",M({show:!0,path:(0,h.GG)("file",(0,h.vX)()),cmd:t})))}else{if("blank_search_mode"===e)return P(!z),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(E.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})}}(),nt=async e=>{let t=!1;for(const s of e.files??[])s.origin_size=s.size,s.size=(0,j.v7)(s.size),Ce.user_data.file_time_show_type===N.KD.time?s.show_mtime=s.mtime?(0,W.Yq)(s.mtime):"":s.show_mtime=s.mtime?(0,y.s)(s.mtime):"",t||!s.name.endsWith(".workflow.yml")&&!s.name.endsWith(".act")||Ae(!0),s.name===k.SB&&(t=!0);for(const s of e.folders??[])Ce.user_data.file_time_show_type===N.KD.time?s.show_mtime=s.mtime?(0,W.Yq)(s.mtime):"":s.show_mtime=s.mtime?(0,y.s)(s.mtime):"",s.name===k.SB&&(t=!0);ke(t)},it=async e=>{oe(e??null)};(0,n.useEffect)(()=>{be&&(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.removeMsg(A.HK.workflow_realtime),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);Pe(new Set(t.running_file_list))}}),await b.ws.sendData(A.HK.workflow_realtime,e)})()},[ye,be,le,te]);const at=async()=>{const e=(0,h.GG)("file",(0,h.vX)());if(Ke||Xe)return;let t;if(Ce.user_data.file_list_pagination_mode===N.yM.pagination){if(Q!==e){if(Q=e,1!==Fe.page_num)return void Re({page_size:Fe.page_size,page_num:1})}else if(Fe.page_num<0)return;if(t=await r.$M.post("file_get_page",{param_path:e,page_num:Fe.page_num,page_size:Fe.page_size}),t.code!==p.m.Success)return;const s=t.data;return nt(s),it(s.mount_info),s.files?.length?(ie(e=>{const t=(0,O.cloneDeep)(1===Fe.page_num?s.files:[...e?.files??[],...s.files]),n={...e,files:t};return(0,m.yC)(n,Ce.user_data.dir_show_type),n}),void(J=t.data)):void Re({page_size:Fe.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,Ce.user_data.dir_show_type),nt(t.data),it(s.mount_info),ie(t.data),J=t.data};(0,n.useEffect)(()=>async()=>{Pe(new Set),le&&await b.ws.close()},[]);const lt=()=>{ke(!1),(()=>{const e=Me.get("preview_file_name"),t=Me.get("preview_mode");if(!e||!t)return!1;const n=(0,h.GG)("file",(0,h.vX)());if(Ee.current===n+e)return!0;Ee.current=n+e;const i=()=>ze(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:Me.get("preview_log_enc")??"utf8",wrap:Me.get("preview_log_wrap")??"wrap",close:i}),!0):"image_edit"===t?(M({path:(0,L.IO)((0,h.vX)(),e),name:e,close:i}),!0):(Ie({name:e,opt_shell:!0,..."text"===t?{model:"text"}:{},close:i}),!0)})()||(t({open:!1}),B({open:!1}),s({}),x({show:!1}),M({}),P({}),F({}),R({}),X({}),D({}),at())};(0,n.useEffect)(()=>{lt()},[te,Fe]),(0,n.useEffect)(()=>{ae>0&&at()},[ae]);n.useRef(!1);const ot=()=>{const e=(0,h.GG)("file",(0,h.vX)());Le({open:!0,title:ee("深搜"),context_div:(0,$.jsx)(K,{base_path:e})})},rt=e=>{e.target===e.currentTarget&&(_e([]),pe([]))},ct=n.useCallback((0,O.throttle)(e=>{const t=We.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,0),n.width);Oe(parseFloat((a/s).toFixed(2)))},32),[]),dt=()=>{qe(!1),document.removeEventListener("pointermove",ct)},_t=(0,$.jsxs)("div",{className:"file-list-main",children:[(0,$.jsx)(i.e,{baseRoute:"file",clickFun:function(){if(_e([]),pe([]),Ce.user_data.file_list_pagination_mode===N.yM.pagination){const e=document.getElementById("listing");e&&(e.scrollTop=0),Re({page_size:Fe.page_size,page_num:1})}},input_path_enter:e=>{_e([]),pe([]),ie({files:[],folders:[]}),(0,C.Z1)(e)?(e=e.replace((0,Y.m)(Ce.user_data),""),se(e)):se((0,C.Jn)((0,h.vX)(),e))}}),le&&(0,$.jsxs)("div",{className:"mount-tip-bar",style:{borderLeftColor:le.color},children:[(0,$.jsx)("span",{className:"material-icons",style:{color:le.color},children:"cloud"}),(0,$.jsx)("span",{children:[{v:le.driver,t:ee("驱动")},{v:le.credential_note,t:ee("凭据")},{v:le.account_note,t:ee("账号")}].filter(e=>Boolean(e.v)).map(e=>`${e.v}(${e.t})`).join(" - ")}),le.readonly&&(0,$.jsx)("span",{className:"mount-readonly-tag",children:ee("只读")})]}),Ce.user_data.file_list_pagination_mode===N.yM.pagination?(0,$.jsx)(S.$J,{handleContextMenu:st,clickBlank:rt,list:ne.files}):(0,$.jsx)(S.t$,{handleContextMenu:st,file_list:ne.files,folder_list:ne.folders,clickBlank:rt})]});return(0,$.jsxs)(n.Fragment,{children:[(0,$.jsxs)(d.aZ,{children:[(0,$.jsx)("div",{className:"mobile-deep-search-btn",children:(0,$.jsx)(z.rA,{icon:"search",title:ee("搜索"),onClick:ot})}),(0,$.jsx)(f.$Z,{handleEnterPress:async()=>{if(Ke||Xe){if(_e([]),pe([]),!ue||!ue.trim())return void ie({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:ue.trim()});if(t.code!==p.m.Success)return;const s=t.data;return(0,m.yC)(s,Ce.user_data.dir_show_type),nt(s),ie(s),void(J=s)}if(!J)return;_e([]),pe([]);const e=[],t=[];for(const t of J.files??[])t.name.includes(ue)&&e.push(t);for(const e of J.folders??[])e.name.includes(ue)&&t.push(e);ie({files:e,folders:t})},placeholder:ee("搜索当前目录"),icon:"search",value:"",mobile_hidden:!0,handleIconClick:ot,handleInputChange:e=>{xe(e)},max_width:"25em"})]}),(0,$.jsxs)(d.aZ,{position:"right",children:[Se(N.oV.ai_agent_page)&&Ze.ai_chat_available&&(0,$.jsx)(z.rA,{icon:"smart_toy",title:ee("AI 聊天"),selected:He,onClick:()=>Ue("chat_open",!He?"1":null)}),(0,$.jsx)("div",{className:"mobile-context-btn",children:(0,$.jsx)(z.rA,{icon:"more_horiz",title:ee("右键"),onClick:()=>{const e=de[de.length-1];if(void 0!==e){const t=[...ne.folders??[],...ne.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,ce({show:!0,type:_.PromptEnum.FileMenu,overlay:!1,data:a})}}else{const e={preventDefault:()=>{},stopPropagation:()=>{},clientX:window.innerWidth/2,clientY:window.innerHeight/2};st(e)}}})}),(0,$.jsx)(Z,{})]}),(0,$.jsxs)("div",{className:"file-list-split"+(He?" file-list-split--chat":""),children:[_t,He&&(0,$.jsxs)(n.Fragment,{children:[(0,$.jsx)("div",{className:"studio__divider studio__divider--chat",ref:We,onPointerDown:e=>{e.preventDefault(),qe(!0),document.addEventListener("pointermove",ct),document.addEventListener("pointerup",dt,{once:!0})}}),(0,$.jsx)("div",{className:"studio-chat-panel",style:{width:`${Ye}em`},children:(0,$.jsx)(n.Suspense,{fallback:null,children:(0,$.jsx)(V,{inline_header:!0,sync_url:!1,file_cwd_path:Qe(),session_id:Ve??(ht=Qe(),o.AG.get_ai_chat_session(et,ht)),on_session_change:e=>{Je(e),((e,t)=>{tt({...et,[e]:t})})(Qe(),e)}})})})]})]}),Te&&(0,$.jsx)("div",{className:"shell__overlay",onPointerUp:dt}),ge&&(0,$.jsx)(T,{}),we.open&&(0,$.jsx)(q,{})]});var ht}}}]);