filecat 7.31.1 → 7.32.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/README.md +21 -18
- package/build/dist/1448.ec0a69fe6ffca6c8df19.js +1 -0
- package/build/dist/1852.16cec79aa004d7d496ee.js +1 -0
- package/build/dist/1922.87a099397741d80df6ad.js +2 -0
- package/build/dist/2136.20ea58a65c7fb22d5e43.js +1 -0
- package/build/dist/2515.df3393e66df975984e10.js +1 -0
- package/build/dist/26.63fd77a3075a6e071bc8.js +1 -0
- package/build/dist/3187.03c9284e30214b476487.js +1 -0
- package/build/dist/3322.36f73d119334675d9bc4.js +1 -0
- package/build/dist/{3355.fde87101c5a125b8b35f.js → 3355.80b3ed1fdc66b35bd95a.js} +1 -1
- package/build/dist/4350.7412b41befe12857677f.js +1 -0
- package/build/dist/{4598.0a8c8a04d718951d6692.js → 4598.4d016ea700f650cd1023.js} +1 -1
- package/build/dist/{47.1990e4d7ad6e60650aa0.js → 47.8c46e919a7977a77bc14.js} +1 -1
- package/build/dist/{4935.d07d9ef7e03632dcb51c.js → 4935.72f92a4a0e80fd72c68d.js} +1 -1
- package/build/dist/{6097.9ec647296d88d8025198.js → 6097.da228e297f45f3ec882d.js} +1 -1
- package/build/dist/610.9b08d7248340d26dead2.js +1 -0
- package/build/dist/6439.b1b588626009af7ba7cb.js +1 -0
- package/build/dist/{7678.7ad7da19e968caed935a.js → 7678.926d8c2225731a655537.js} +1 -1
- package/build/dist/7759.14e1e0dbbcfc86f3e4f1.js +1 -0
- package/build/dist/914.bb6f2b6d8ca806f9366a.js +1 -0
- package/build/dist/{9260.da294480ffc3c674bde0.js → 9260.7fbe354ea4e6bee93817.js} +1 -1
- package/build/dist/9290.6fd29c7dd03124235217.js +1 -0
- package/build/dist/9345.9342b70ddc66397cafce.js +1 -0
- package/build/dist/9546.fde8cbe4ebe2dafb6c27.js +1 -0
- package/build/dist/{9765.7f8eaa343038f1f21810.js → 9765.7f02ad22213339511811.js} +1 -1
- package/build/dist/9861.f266cc5eabb83fc5fa4b.js +1 -0
- package/build/dist/index.html +1 -1
- package/build/dist/main.6e543784024f3ed07f70.js +2 -0
- package/build/main.js +1 -1
- package/package.json +6 -1
- package/build/dist/1448.2340fca4e068db687c5c.js +0 -1
- package/build/dist/1922.c114fe6ee22d708a2a57.js +0 -2
- package/build/dist/2136.60e61c9c37b92af2c0d5.js +0 -1
- package/build/dist/4350.c743128b55202fecc4d7.js +0 -1
- package/build/dist/621.965609c72555c936154d.js +0 -1
- package/build/dist/6439.3747e3eab0dfe59ae24b.js +0 -1
- package/build/dist/7759.0860534bbc24ba31f42c.js +0 -1
- package/build/dist/9345.1dbe1ec2d934dc5ca747.js +0 -1
- package/build/dist/9546.827d973d735209b0b43e.js +0 -1
- package/build/dist/main.4d786381d17f4a7df3dd.js +0 -2
- /package/build/dist/{1922.c114fe6ee22d708a2a57.js.LICENSE.txt → 1922.87a099397741d80df6ad.js.LICENSE.txt} +0 -0
- /package/build/dist/{main.4d786381d17f4a7df3dd.js.LICENSE.txt → main.6e543784024f3ed07f70.js.LICENSE.txt} +0 -0
|
@@ -0,0 +1 @@
|
|
|
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),A=(0,n.useRef)(null),b=()=>{const e=k.current,t=A.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)(()=>{b();const e=new ResizeObserver(b);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 G=j>0?1+j:1,N=j>0?h.slice(1,G):[],[C,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<G?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:A,"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)}})})}),C&&(0,_.jsx)(r.rY,{click:()=>S(null),children:(0,_.jsx)(r.sw,{x:C.x,y:C.y,items:N.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),A=s(14944),b=s(92275),G=s(23430),N=s(72458),C=s(34251),S=s(60096),I=s(87361),M=s(59096),$=s(85997),z=s(23496),E=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,E.jsxs)("div",{className:"search-exclude",children:[(0,E.jsxs)("div",{className:"search-exclude__section",children:[(0,E.jsx)("div",{className:"search-exclude__title",children:t("排除当前目录下的项")}),(0,E.jsx)(f.$Z,{icon:"search",value:o,placeholder:t("过滤列表"),handleInputChange:e=>c(e),handleEnterPress:()=>{}}),(0,E.jsxs)("div",{className:"search-exclude__list",children:[0===m.length&&(0,E.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,E.jsxs)("label",{className:"search-exclude__item",children:[(0,E.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,E.jsx)("span",{className:"material-symbols-outlined"+(i?" search-exclude__icon--dir":""),children:i?"folder":"draft"}),(0,E.jsx)("span",{className:"search-exclude__item-name",title:t.name,children:t.name})]},s)})]}),e.exclude_paths.length>0&&(0,E.jsx)("div",{className:"search-exclude__chosen",children:e.exclude_paths.map(t=>(0,E.jsxs)("span",{className:"search-exclude__tag",children:[t.split("/").filter(Boolean).pop(),(0,E.jsx)("span",{className:"material-symbols-outlined",onClick:()=>e.on_change_paths(e.exclude_paths.filter(e=>e!==t)),children:"close"})]},t))})]}),(0,E.jsxs)("div",{className:"search-exclude__section search-exclude__section--ignore",children:[(0,E.jsx)("div",{className:"search-exclude__title",children:t("忽略名字")}),(0,E.jsx)("div",{className:"search-exclude__hint",children:t("按名字忽略")}),(0,E.jsxs)("div",{className:"search-exclude__chosen",children:[0===e.ignore_names.length&&(0,E.jsx)("span",{className:"search-exclude__hint",children:t("暂无")}),e.ignore_names.map(t=>(0,E.jsxs)("span",{className:"search-exclude__tag",children:[t,(0,E.jsx)("span",{className:"material-symbols-outlined",onClick:()=>(t=>{e.on_change_names(e.ignore_names.filter(e=>e!==t))})(t),children:"close"})]},t))]}),(0,E.jsxs)("div",{className:"search-exclude__add",children:[(0,E.jsx)(f.Sm,{value:d,placeholder:t("如 node_modules"),handleInputChange:e=>_(e),handlerEnter:x,width:"12em"}),(0,E.jsx)($.rA,{icon:"add",title:t("添加"),onClick:x})]}),(0,E.jsxs)("div",{className:"div-row",children:[(0,E.jsx)($.rA,{icon:"save",title:t("保存忽略名字"),onClick:async()=>{await r.wm.post(z.s.user_save_private_attr,{is_search_exclude:!0,search_exclude_names:e.ignore_names})}}),(0,E.jsx)($.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,E.jsxs)("div",{className:"search-ignore-setting",children:[(0,E.jsx)("div",{className:"search-ignore-setting__desc",children:t("按名字忽略说明")}),(0,E.jsxs)("div",{className:"search-ignore-setting__add",children:[(0,E.jsx)(f.Sm,{value:_,placeholder:t("如 node_modules"),handleInputChange:e=>h(e),handlerEnter:x,width:"20em"}),(0,E.jsx)($.rA,{icon:"add",title:t("添加"),onClick:x})]}),(0,E.jsxs)("div",{className:"search-ignore-setting__list",children:[0===c.length&&(0,E.jsx)("div",{className:"search-ignore-setting__empty",children:t("暂无")}),c.map(e=>(0,E.jsxs)("div",{className:"search-ignore-setting__item",children:[(0,E.jsx)("span",{className:"material-symbols-outlined",children:"block"}),(0,E.jsx)("span",{className:"search-ignore-setting__item-name",children:e}),(0,E.jsx)($.rA,{icon:"delete",title:t("删除"),onClick:()=>(e=>d(c.filter(t=>t!==e)))(e)})]},e))]}),(0,E.jsxs)("div",{className:"div-row div-row--end search-ignore-setting__footer",children:[(0,E.jsx)($.rA,{icon:"arrow_back",title:t("返回"),onClick:e.on_back}),(0,E.jsx)($.rA,{icon:"save",title:t("保存"),onClick:async()=>{if(m)return;u(!0);const t=await r.wm.post(z.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 X(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,G]=(0,n.useState)([]),[N,C]=(0,n.useState)([]),[S,z]=(0,n.useState)(!1),[X,K]=(0,n.useState)(!1),[L,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,A.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)(()=>{C(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(b.HK.file_deep_search_data,n=>{q.current||V.current||(e.push(...n.context??[]),null===t&&(t=setTimeout(s,100)))}),T.addMsg(b.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(b.HK.file_deep_search_cancel,{}).catch(()=>{}).finally(()=>T.close()),T.removeMsg(b.HK.file_deep_search_data),T.removeMsg(b.HK.file_deep_search_end),T.off_message("close",n)}},[]);const te=()=>{const t=d.trim();if(!t||L)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),N.length&&(s.exclude_names=N),T.sendData(b.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 X?(0,E.jsx)(F,{on_back:()=>{K(!1),C(ee())}}):(0,E.jsxs)("div",{className:"file-deep-search",children:[(0,E.jsxs)("div",{className:"file-deep-search__bar",children:[(0,E.jsx)(f.$Z,{icon:"search",value:d,placeholder:t(ie?"搜文件内容":"搜文件名"),handleInputChange:e=>_(e),handleEnterPress:te}),(0,E.jsx)("button",{className:"button button--flat",onClick:L?()=>{V.current=!0,T.sendNotify(b.HK.file_deep_search_cancel,{}).catch(()=>{}),D(!1)}:te,children:t(L?"取消":"搜索")}),(0,E.jsx)($.rA,{icon:"close",title:t("关闭"),onClick:Q})]}),(0,E.jsxs)("div",{className:"file-deep-search__tabs",children:[(0,E.jsx)("button",{className:"file-deep-search__tab"+(ie?"":" file-deep-search__tab--active"),onClick:()=>p("name"),children:t("文件名")}),(0,E.jsx)("button",{className:"file-deep-search__tab"+(ie?" file-deep-search__tab--active":""),onClick:()=>p("content"),children:t("文件内容")})]}),(0,E.jsxs)("div",{className:"file-deep-search__options",children:[(0,E.jsx)(f.GL,{context:t("正则"),selected:u,onchange:()=>x(!u)}),(0,E.jsx)(f.GL,{context:t("忽略大小写"),selected:v,onchange:()=>w(!v)}),ie&&(0,E.jsx)(f.GL,{context:t("显示匹配行"),selected:j,onchange:()=>y(!j)})]}),(0,E.jsxs)("div",{className:"file-deep-search__hint",children:[(0,E.jsxs)("span",{children:[t("范围"),":",J]}),(0,E.jsxs)("span",{className:"file-deep-search__hint-right",children:[(k.length>0||N.length>0)&&(0,E.jsxs)("span",{className:"file-deep-search__excluded",children:[t("已排除")," ",k.length+N.length]}),(0,E.jsxs)("button",{className:"file-deep-search__filter"+(S?" file-deep-search__filter--active":""),onClick:()=>z(!S),children:[(0,E.jsx)("span",{className:"material-symbols-outlined",children:"filter_alt"}),t("过滤")]}),B>0&&(0,E.jsx)("span",{className:"file-deep-search__count",children:B>R?`${t("已显示")} 500 / ${B}`:`${B}`})]})]}),S&&(0,E.jsx)(P,{base_path:e.base_path,exclude_paths:k,ignore_names:N,on_change_paths:G,on_change_names:C,on_open_setting:()=>K(!0)}),(0,E.jsxs)("div",{className:"file-deep-search__body"+(ie&&j?" file-deep-search__body--line":""),children:[U.length>0&&(0,E.jsx)("div",{className:"file-deep-search__results",children:U.map(e=>{const s=e.path.slice(0,e.path.lastIndexOf("/")+1);return(0,E.jsxs)("div",{className:"file-deep-search__row",children:[(0,E.jsxs)("div",{className:"file-deep-search__name",children:[e.is_dir?(0,E.jsx)("span",{className:"file-deep-search__dir",children:e.name}):(0,E.jsx)("span",{className:"file-deep-search__file",title:e.name,children:e.name}),(0,E.jsx)("span",{className:"file-deep-search__path",children:s}),e.lines&&e.lines.length>0&&(0,E.jsx)("div",{className:"file-deep-search__lines",children:e.lines.map(t=>(0,E.jsxs)("div",{className:"file-deep-search__line",onClick:()=>ne(e),children:[(0,E.jsx)("span",{className:"file-deep-search__line-no",children:t.line}),(0,E.jsx)("span",{className:"file-deep-search__line-text",children:t.text})]},t.line))})]}),(0,E.jsxs)("div",{className:"file-deep-search__actions",children:[(0,E.jsx)($.rA,{icon:"open_in_new",title:e.is_dir?t("打开"):t("打开文件"),onClick:()=>ne(e)}),(0,E.jsx)($.rA,{icon:"folder_open",title:t("打开所在目录"),onClick:()=>se(e)})]})]},e.path)})}),L&&(0,E.jsxs)("div",{className:"file-deep-search__empty",children:[(0,E.jsx)("span",{className:"chat-session-running",title:t("搜索中")}),t("搜索中")]}),!L&&B>R&&(0,E.jsx)("div",{className:"file-deep-search__more",children:t("结果过多")}),!L&&0===U.length&&(0,E.jsx)("div",{className:"file-deep-search__empty",children:t(Y?"无匹配":ie?"输入内容后搜":"输入后搜")})]})]})}var K=s(64694),L=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,N]=(0,a.fp)(o.AG.selectedFileList),[S,M]=(0,a.fp)(o.AG.copyedFileList),[z,P]=(0,a.fp)(o.AG.cutedFileList),[F,R]=(0,a.fp)(o.AG.selectedFileList),[X,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,E.jsxs)("div",{style:{maxWidth:"25rem"},children:[(0,E.jsx)(D.Yh,{left:e("挂载位置磁盘"),right:t?.total_size}),(0,E.jsx)(D.Yh,{left:`${e("磁盘剩余")}`,right:t?.left_size}),(0,E.jsx)(D.Yh,{left:`${e("文件系统")}`,right:t?.fs_type}),(0,E.jsx)(D.Yh,{left:`${e("文件夹数")}`,right:fe}),(0,E.jsx)(D.Yh,{left:`${e("文件数")}`,right:me}),(0,E.jsx)(D.Yh,{left:`${e("当前位置")}`,right:(0,E.jsx)(U.xP,{context:t?.now_absolute_path})})]}),cancel:()=>{A.ws.removeMsg(b.HK.file_info)}})};return(0,E.jsxs)(n.Fragment,{children:[k.length>0&&(0,E.jsx)($.rA,{icon:"delete",title:e("删除"),onClick:()=>{y({show:!0,type:_.PromptEnum.FilesDelete,overlay:!0,data:{}})}}),k.length>0&&(0,E.jsx)($.rA,{icon:"content_copy",title:e("复制"),onClick:function(){const e=(0,m.ib)(l,k);M(e.map(e=>(0,m.Ok)(e.name))),P([]),ue("已复制")}}),k.length>0&&(0,E.jsx)($.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||z.length>0)&&(0,E.jsx)($.rA,{onClick:function(){y({show:!0,type:_.PromptEnum.Confirm,overlay:!0,data:{}})},icon:"content_paste",title:e("粘贴到此处"),tip:S.length+z.length}),k.length>0&&(0,E.jsx)($.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,E.jsx)($.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,E.jsx)($.rA,{icon:"edit_attributes",title:e("重命名"),onClick:function(){y({show:!0,type:_.PromptEnum.FileRename,overlay:!0,data:{}})}}),le&&(0,E.jsx)($.rA,{icon:"api",title:"workflow",onClick:()=>{ne(!se)}}),O.can_terminal&&(0,E.jsx)($.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(G.oV.share_file)&&(0,E.jsx)($.rA,{icon:"share",title:e("文件分享"),onClick:()=>{s(`${I.o.share_list_setting_page}`)}}),(0,E.jsx)($.rA,{icon:"grid_view",title:e("切换样式"),onClick:xe}),(0,E.jsx)($.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,E.jsx)($.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,E.jsx)($.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,L.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,E.jsx)($.rA,{icon:"info",title:e("信息"),onClick:async()=>{let e;if(!B.now_absolute_path){A.ws.addMsg(b.HK.file_info,t=>{const s=t.context;e&&(B={...B,...s},A.ws.removeMsg(b.HK.file_info),ge(B))});const t=await A.ws.sendData(b.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,E.jsx)($.rA,{icon:"more_vert",title:e("切换目录"),onClick:t=>{const n=new C.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===C.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!==C.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,K.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),[,L]=(0,a.fp)(o.AG.timeline_editor),[,D]=(0,a.fp)(o.AG.excel_editor),[,U]=(0,a.fp)(o.AG.docx_editor),[,B]=(0,a.fp)(o.AG.pptx_editor),[ee,te]=(0,a.fp)(o.AG.file_preview),{t:se}=(0,g.Bd)();let ne=(0,c.zy)();const ie=(0,c.Zp)(),[ae,le]=(0,a.fp)(o.AG.nowFileList),[oe]=(0,a.fp)(o.AG.file_list_refresh),[re,ce]=(0,a.fp)(o.AG.current_mount),[de,_e]=(0,a.fp)(o.AG.showPrompt),[he,pe]=(0,a.fp)(o.AG.selectedFileList),[me,fe]=(0,a.fp)(o.AG.clickFileList),[ue,xe]=(0,a.fp)(o.AG.fileShellShow),[ge,ve]=(0,n.useState)(""),[we,je]=(0,a.fp)(o.AG.workflow_show),[ye,ke]=(0,a.fp)(o.AG.workflow_realtime_show),[Ae,be]=(0,a.fp)(o.AG.work_flow_show),[Ge,Ne]=(0,n.useState)(!1),{initUserInfo:Ce}=(0,n.useContext)(v.F),[Se,Ie]=(0,a.fp)(o.AG.user_base_info),{check_user_auth:Me}=(0,w.MH)(),{click_file:$e}=(0,m.kZ)(),[ze]=(0,c.ok)(),Ee=(0,m._A)(),Pe=n.useRef(null),[Fe,Re]=(0,a.fp)(o.AG.to_running_files),[Xe,Ke]=(0,a.fp)(o.AG.file_page),[Le]=(0,a.fp)(o.AG.blank_search_mode),[,De]=(0,a.fp)(o.AG.prompt_card),[Ue,He]=(0,a.fp)(o.AG.blank_search_mode_for_temp),Be=(0,m.oT)(),Ze="1"===ze.get("chat_open"),Ye=Me(G.oV.ai_agent_page),Oe=(0,m.Cf)();(0,n.useEffect)(()=>{Se?.user_data&&Ze&&!Ye&&Be("chat_open",null)},[Ze,Ye,Se]);const[We,Te]=(0,a.fp)(o.AG.studio_chat_width),qe=n.useRef(null),[Ve,Je]=(0,n.useState)(!1),[Qe,et]=(0,n.useState)(void 0),tt=(0,m.dN)();(0,m.rJ)(tt());const[st,nt]=(0,a.fp)(o.AG.ai_chat_session_by_cwd),it=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,N]=(0,a.fp)(o.AG.showPrompt),[S,M]=(0,a.fp)(o.AG.fileShellShow),[$,P]=(0,a.fp)(o.AG.blank_search_mode);return s=>{s.preventDefault(),s.stopPropagation();const n=new C.ik;n.x=s.clientX,n.y=s.clientY,n.type=u.Iw.directory;const a=[{r:(0,E.jsx)("span",{style:(0,H.ok)(t.user_data.dir_show_type===G.t8.time_minx_max),children:i("时间逆序")}),v:G.t8.time_minx_max},{r:(0,E.jsx)("span",{style:(0,H.ok)(t.user_data.dir_show_type===G.t8.time_max_min),children:i("时间顺序")}),v:G.t8.time_max_min}],o=[{r:(0,E.jsx)("span",{style:(0,H.ok)(t.user_data.dir_show_type===G.t8.size_min_max),children:i("大小顺序")}),v:G.t8.size_min_max},{r:(0,E.jsx)("span",{style:(0,H.ok)(t.user_data.dir_show_type===G.t8.size_max_min),children:i("大小逆序")}),v:G.t8.size_max_min}],c=[{r:(0,E.jsx)("span",{style:(0,H.ok)(!t.user_data.file_list_pagination_mode||t.user_data.file_list_pagination_mode===G.yM.all),children:i("全部加载文件")}),v:G.yM.all},{r:(0,E.jsx)("span",{style:(0,H.ok)(t.user_data.file_list_pagination_mode===G.yM.pagination),children:i("scrll_l")}),v:G.yM.pagination}],d=[{r:(0,E.jsx)("span",{style:(0,H.ok)(!t.user_data.file_time_show_type||t.user_data.file_time_show_type===G.KD.current),children:i("最近时间")}),v:G.KD.current},{r:(0,E.jsx)("span",{style:(0,H.ok)(t.user_data.file_time_show_type===G.KD.time),children:i("准确时间")}),v:G.KD.time}],g=[{r:i("文件列表展示"),items:[{r:i("文件排序"),v:"",items:[{r:(0,E.jsx)("span",{style:(0,H.ok)(!t.user_data.dir_show_type),children:i("系统默认")}),v:G.t8.defualt},{r:(0,E.jsx)("span",{style:(0,H.ok)(t.user_data.dir_show_type===G.t8.name),children:i("名字")}),v:G.t8.name},{r:(0,E.jsx)("span",{style:(0,H.ok)(t.user_data.dir_show_type===G.t8.time_minx_max||t.user_data.dir_show_type===G.t8.time_max_min),children:i("修改时间")}),v:!1,items:a},{r:(0,E.jsx)("span",{style:(0,H.ok)(t.user_data.dir_show_type===G.t8.size_min_max||t.user_data.dir_show_type===G.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,E.jsx)("span",{style:(0,H.ok)($),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"}),g.push({r:i("o_stdo"),v:"studio_page"}),l(G.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 N({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 N({data:void 0,overlay:!1,type:"",show:!1}),void f(`${I.o.git_page}/${encodeURIComponent(e)}`)}if("studio_page"===e){const e=(0,h.GG)("file",(0,h.vX)());return N({data:void 0,overlay:!1,type:"",show:!1}),void f(`${I.o.studio_page}/${encodeURIComponent(`/file/${e}`)}`)}if("http_resource"===e){const e=await A.ws.sendData(b.HK.file_info,{path:(0,h.GG)("file",(0,h.vX)())});return p({http_download_map_path:e.context.now_absolute_path}),N({data:void 0,overlay:!1,type:"",show:!1}),void f("/proxy/http/")}if("zoom_adjust"===e)return N({data:void 0,overlay:!1,type:"",show:!1}),void setTimeout(()=>{N({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(!$),void N({data:void 0,overlay:!1,type:"",show:!1});if(e===G.yM.all||e===G.yM.pagination)t.is_pagination_mode=!0;else if(e===G.KD.current||e===G.KD.time)t.is_file_show_type=!0;else{if(e!==G.t8.defualt&&e!==G.t8.name&&e!==G.t8.size_max_min&&e!==G.t8.size_min_max&&e!==G.t8.time_max_min&&e!==G.t8.time_minx_max)return;t.is_dir_list_type=!0}}await r.wm.post(z.s.user_save_private_attr,{type:e,...t}),await x(),N({data:void 0,overlay:!1,type:"",show:!1}),f((0,h.vX)())},N({show:!0,type:_.PromptEnum.FileMenu,overlay:!1,data:n})}}(),at=async e=>{let t=!1;for(const s of e.files??[])s.origin_size=s.size,s.size=(0,j.v7)(s.size),Se.user_data.file_time_show_type===G.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")||Ne(!0),s.name===k.SB&&(t=!0);for(const s of e.folders??[])Se.user_data.file_time_show_type===G.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);be(t)},lt=async e=>{ce(e??null)};(0,n.useEffect)(()=>{Ge&&(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),A.ws.removeMsg(b.HK.workflow_realtime),A.ws.addMsg(b.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);Re(new Set(t.running_file_list))}}),await A.ws.sendData(b.HK.workflow_realtime,e)})()},[Ae,Ge,re,ne]);const ot=async()=>{const e=(0,h.GG)("file",(0,h.vX)());if(Le||Ue)return;let t;if(Se.user_data.file_list_pagination_mode===G.yM.pagination){if(Q!==e){if(Q=e,1!==Xe.page_num)return void Ke({page_size:Xe.page_size,page_num:1})}else if(Xe.page_num<0)return;if(t=await r.$M.post("file_get_page",{param_path:e,page_num:Xe.page_num,page_size:Xe.page_size}),t.code!==p.m.Success)return;const s=t.data;return at(s),lt(s.mount_info),s.files?.length?(le(e=>{const t=(0,O.cloneDeep)(1===Xe.page_num?s.files:[...e?.files??[],...s.files]),n={...e,files:t};return(0,m.yC)(n,Se.user_data.dir_show_type),n}),void(J=t.data)):void Ke({page_size:Xe.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,Se.user_data.dir_show_type),at(t.data),lt(s.mount_info),le(t.data),J=t.data};(0,n.useEffect)(()=>async()=>{Re(new Set),re&&await A.ws.close()},[]);const rt=()=>{be(!1),(()=>{const e=ze.get("preview_file_name"),t=ze.get("preview_mode");if(!e||!t)return!1;const n=(0,h.GG)("file",(0,h.vX)());if(Pe.current===n+e)return!0;Pe.current=n+e;const i=()=>Ee(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:ze.get("preview_log_enc")??"utf8",wrap:ze.get("preview_log_wrap")??"wrap",close:i}),!0):"image_edit"===t?(M({path:(0,K.IO)((0,h.vX)(),e),name:e,close:i}),!0):($e({name:e,opt_shell:!0,..."text"===t?{model:"text"}:{},close:i}),!0)})()||(t({open:!1}),te({open:!1}),s({}),x({show:!1}),M({}),P({}),F({}),R({}),L({}),D({}),U({}),B({}),ot())};(0,n.useEffect)(()=>{rt()},[ne,Xe]),(0,n.useEffect)(()=>{oe>0&&ot()},[oe]);n.useRef(!1);const ct=()=>{const e=(0,h.GG)("file",(0,h.vX)());De({open:!0,title:se("深搜"),context_div:(0,E.jsx)(X,{base_path:e})})},dt=e=>{e.target===e.currentTarget&&(pe([]),fe([]))},_t=n.useCallback((0,O.throttle)(e=>{const t=qe.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);Te(parseFloat((a/s).toFixed(2)))},32),[]),ht=()=>{Je(!1),document.removeEventListener("pointermove",_t)},pt=(0,E.jsxs)("div",{className:"file-list-main",children:[(0,E.jsx)(i.e,{baseRoute:"file",clickFun:function(){if(pe([]),fe([]),Se.user_data.file_list_pagination_mode===G.yM.pagination){const e=document.getElementById("listing");e&&(e.scrollTop=0),Ke({page_size:Xe.page_size,page_num:1})}},input_path_enter:e=>{pe([]),fe([]),le({files:[],folders:[]}),(0,N.Z1)(e)?(e=e.replace((0,Y.m)(Se.user_data),""),ie(e)):ie((0,N.Jn)((0,h.vX)(),e))}}),re&&(0,E.jsxs)("div",{className:"mount-tip-bar",style:{borderLeftColor:re.color},children:[(0,E.jsx)("span",{className:"material-icons",style:{color:re.color},children:"cloud"}),(0,E.jsx)("span",{children:[{v:re.driver,t:se("驱动")},{v:re.credential_note,t:se("凭据")},{v:re.account_note,t:se("账号")}].filter(e=>Boolean(e.v)).map(e=>`${e.v}(${e.t})`).join(" - ")}),re.readonly&&(0,E.jsx)("span",{className:"mount-readonly-tag",children:se("只读")})]}),Se.user_data.file_list_pagination_mode===G.yM.pagination?(0,E.jsx)(S.$J,{handleContextMenu:it,clickBlank:dt,list:ae.files}):(0,E.jsx)(S.t$,{handleContextMenu:it,file_list:ae.files,folder_list:ae.folders,clickBlank:dt})]});return(0,E.jsxs)(n.Fragment,{children:[(0,E.jsxs)(d.aZ,{children:[(0,E.jsx)("div",{className:"mobile-deep-search-btn",children:(0,E.jsx)($.rA,{icon:"search",title:se("搜索"),onClick:ct})}),(0,E.jsx)(f.$Z,{handleEnterPress:async()=>{if(Le||Ue){if(pe([]),fe([]),!ge||!ge.trim())return void le({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:ge.trim()});if(t.code!==p.m.Success)return;const s=t.data;return(0,m.yC)(s,Se.user_data.dir_show_type),at(s),le(s),void(J=s)}if(!J)return;pe([]),fe([]);const e=[],t=[];for(const t of J.files??[])t.name.includes(ge)&&e.push(t);for(const e of J.folders??[])e.name.includes(ge)&&t.push(e);le({files:e,folders:t})},placeholder:se("搜索当前目录"),icon:"search",value:"",mobile_hidden:!0,handleIconClick:ct,handleInputChange:e=>{ve(e)},max_width:"25em"})]}),(0,E.jsxs)(d.aZ,{position:"right",children:[Me(G.oV.ai_agent_page)&&Oe.ai_chat_available&&(0,E.jsx)($.rA,{icon:"smart_toy",title:se("AI 聊天"),selected:Ze,onClick:()=>Be("chat_open",!Ze?"1":null)}),(0,E.jsx)("div",{className:"mobile-context-btn",children:(0,E.jsx)($.rA,{icon:"more_horiz",title:se("右键"),onClick:()=>{const e=he[he.length-1];if(void 0!==e){const t=[...ae.folders??[],...ae.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 C.ik;a.path=(0,K.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,C.uL)(t.name),a.size=t.origin_size,_e({show:!0,type:_.PromptEnum.FileMenu,overlay:!1,data:a})}}else{const e={preventDefault:()=>{},stopPropagation:()=>{},clientX:window.innerWidth/2,clientY:window.innerHeight/2};it(e)}}})}),(0,E.jsx)(Z,{})]}),(0,E.jsxs)("div",{className:"file-list-split"+(Ze?" file-list-split--chat":""),children:[pt,Ze&&(0,E.jsxs)(n.Fragment,{children:[(0,E.jsx)("div",{className:"studio__divider studio__divider--chat",ref:qe,onPointerDown:e=>{e.preventDefault(),Je(!0),document.addEventListener("pointermove",_t),document.addEventListener("pointerup",ht,{once:!0})}}),(0,E.jsx)("div",{className:"studio-chat-panel",style:{width:`${We}em`},children:(0,E.jsx)(n.Suspense,{fallback:null,children:(0,E.jsx)(V,{inline_header:!0,sync_url:!1,file_cwd_path:tt(),session_id:Qe??(mt=tt(),o.AG.get_ai_chat_session(st,mt)),on_session_change:e=>{et(e),((e,t)=>{nt({...st,[e]:t})})(tt(),e)}})})})]})]}),Ve&&(0,E.jsx)("div",{className:"shell__overlay",onPointerUp:ht}),we&&(0,E.jsx)(T,{}),ye.open&&(0,E.jsx)(q,{})]});var mt}}}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[2515],{72515(e,t,n){n.r(t),n.d(t,{default:()=>i});var r=n(96540),c=n(50610),s=n(99018),a=n(74848);function i(e){const{url:t,save_path:n,file_name:i,on_dirty:o,bind_save:u}=e,f=(0,r.useRef)(null),l=(0,r.useRef)(),d=(0,r.useRef)(""),[p,h]=(0,r.useState)(""),[_,m]=(0,r.useState)(!0);return(0,r.useEffect)(()=>{if(!t)return;const e=f.current;if(!e)return;let r,a=!0;return m(!0),h(""),(0,s.PQ)(t).then(t=>{a&&(r=(0,c.t)(e,{source:t,fileName:i,onSave:async e=>{const t=await(0,s.GB)(n,e,d.current);return t&&o?.(!1),t},autoSave:!1,compact:!0}),l.current=r,r.on("dirtychange",e=>{o?.(e.dirty)}))}).catch(e=>{a&&h(String(e?.message??e))}).finally(()=>a&&m(!1)),()=>{a=!1,r?.destroy(),l.current=void 0}},[t,i,n]),(0,r.useEffect)(()=>{u?.(async e=>{const t=l.current;return!!t&&(d.current=e,await t.save(),d.current="",!t.dirty)})},[u]),(0,a.jsxs)("div",{className:"pptx-pane",children:[p&&(0,a.jsx)("div",{className:"office-editor__tip office-editor__tip--error",children:p}),_&&!p&&(0,a.jsx)("div",{className:"office-editor__tip",children:"读取中…"}),(0,a.jsx)("div",{className:"pptx-pane__host",ref:f})]})}},99018(e,t,n){n.d(t,{GB:()=>u,PQ:()=>o,Vi:()=>i});var r=n(14284),c=n(57889),s=n(34289),a=n(62042);function i(e){return`${encodeURIComponent(function(){const e=(0,s.GG)("file",(0,s.vX)());let t;try{t=decodeURIComponent(e)}catch{t=e}return t.endsWith("/")?t:`${t}/`}())}${e}`}async function o(e){return c.l.get_bytes_url(e)}function u(e,t,n){return async function(e,t,n){const c=await r.$M.post(`save_bin/${e}`,{base64:f(t)});return 0!==c.code?((0,a.zN)(c.message??"保存失败"),!1):(n&&(0,a.SK)(n),!0)}(function(e){const t=e.lastIndexOf("/");return t<0?encodeURIComponent(e):encodeURIComponent(e.slice(0,t))+e.slice(t)}(e),t,n)}function f(e){let t="";for(let n=0;n<e.length;n+=32768)t+=String.fromCharCode(...e.subarray(n,n+32768));return btoa(t)}}}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[26],{26(e,t,n){n.r(t),n.d(t,{default:()=>f});var o=n(96540),r=n(39290),c=n(33036);const i=15;function s(e){const t=e.getBoundingClientRect().top,n=[],o=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);let r=null;for(;o.nextNode();){const e=o.currentNode,c=e.textContent??"";if(!c.trim())continue;const i=document.createRange();for(let o=0;o<c.length;o++){i.setStart(e,o),i.setEnd(e,o+1);const c=i.getBoundingClientRect();0!==c.height&&((null===r||Math.abs(c.top-r)>1)&&(null!==r&&n.push(c.top-t),r=c.top))}}return null!==r&&n.push(e.offsetHeight),0===n.length&&n.push(e.offsetHeight),n}var a=n(74848);function l(e){const t=(0,r.OE)(e);if(!t)throw new Error(`docx 命令不存在: ${e}`);return t}function u(e){const{model:t,on_change:n,bind_save:u}=e,d=(0,o.useRef)(null),f=(0,o.useRef)([]),h=(0,o.useRef)(),p=(0,o.useRef)(new Map),m=(0,o.useRef)(""),g=(0,o.useCallback)(()=>{const e=d.current,n=t.selection?.focus;if(!e||!n)return;const o=e.querySelector(`[data-wk-block="${n.block}"]`);if(!o)return;let r=o;if(void 0!==n.inline){const e=o.querySelector(`[data-wk-inline="${n.inline}"]`);e&&(r=e)}const c=r.firstChild;if(!c)return;const i=document.createRange(),s=Math.min(n.offset??0,c.textContent?.length??0);i.setStart(c,s),i.collapse(!0);const a=window.getSelection();a?.removeAllRanges(),a?.addRange(i)},[t]),b=(0,o.useCallback)((e=!1)=>{const n=d.current;if(!n)return;let o=-1;const c=window.getSelection();if(c&&c.anchorNode&&n.contains(c.anchorNode)){const e=1===c.anchorNode.nodeType?c.anchorNode:c.anchorNode.parentElement,t=e?.closest("[data-wk-block]");t&&(o=Number(t.getAttribute("data-wk-block")))}const s=document.createElement("div");s.innerHTML=(0,r.j7)(t.document);const a=Array.from(s.children).map(e=>e.outerHTML),l=f.current;if(e||l.length!==a.length)n.innerHTML=s.innerHTML,p.current.clear(),Array.from(n.children).forEach(e=>{const t=e,n=Number(t.getAttribute("data-wk-block"));Number.isNaN(n)||p.current.set(n,t)});else for(let e=0;e<a.length;e++){if(l[e]===a[e])continue;const t=p.current.get(e);t&&(t.innerHTML=s.children[e].innerHTML)}f.current=a,h.current??=function(e){const t=(0,r.yj)(e);return{width:t.width/i,height:t.height/i,top:t.top/i,right:t.right/i,bottom:t.bottom/i,left:t.left/i,body_height:(t.height-t.top-t.bottom)/i}}(t.document);const u=h.current,{heights:m,lines:g}=v(a.length,u),b=function(e,t,n,o){const c=(0,r.Bv)(e),i=(0,r.w$)(e),s=c.map((e,o)=>{const r=t[o]??0;return{height:r,section:0,lines:()=>n[o]??[r]}}),a=i.map(()=>({start:"continuous",columns:1,titlePage:!1,vAlign:"top",bodyHeight:()=>o.body_height}));return(0,r.En)(s,a,{evenAndOddHeaders:!1,noteSeparatorHeight:0}).map(e=>{const n=[];for(const o of e.regions)for(const e of o.columns)for(const o of e.fragments)"block"===o.kind?n.push({block:o.block,from:0,to:t[o.block]??o.height}):"slice"===o.kind&&n.push({block:o.block,from:o.from,to:o.to});return{fragments:n,number:e.number}})}(t.document,m,g,u);y(n,b,u)},[t]),v=(0,o.useCallback)((e,t)=>{const n=document.createElement("div");n.className="docx-page",n.style.cssText=[`width:${t.width}px`,`padding:${t.top}px ${t.right}px ${t.bottom}px ${t.left}px`,"position:absolute","left:-99999px","top:0","visibility:hidden","pointer-events:none"].join(";");const o=document.createElement("div");o.className="docx-page__body",n.appendChild(o),document.body.appendChild(n);const r=[];for(let t=0;t<e;t++){const e=p.current.get(t);if(!e){const e=document.createElement("div");o.appendChild(e),r.push(e);continue}o.appendChild(e),r.push(e)}const c=[],i=[],a=o.scrollHeight;for(let e=0;e<r.length;e++){const t=r[e],n=t.offsetTop,o=e+1<r.length?r[e+1].offsetTop:a;let l=Math.max(0,o-n);e===r.length-1&&(l+=parseFloat(getComputedStyle(t).marginBottom)||0),c[e]=l,i[e]=s(t)}return n.remove(),{heights:c,lines:i}},[]),y=(0,o.useCallback)((e,t,n)=>{const o=t.map(e=>e.fragments.map(e=>e.block).join(",")).join("|");m.current=o,e.innerHTML="";for(const o of t){const t=document.createElement("div");t.className="docx-page",t.style.width=`${n.width}px`,t.style.height=`${n.height}px`,t.style.padding=`${n.top}px ${n.right}px ${n.bottom}px ${n.left}px`;const r=document.createElement("div");r.className="docx-page__body",t.appendChild(r);const c=document.createElement("div");c.className="docx-page__number",c.textContent=String(o.number),t.appendChild(c);for(const e of o.fragments){const t=p.current.get(e.block);if(!t)continue;if(0===e.from&&e.to>=t.offsetHeight-1){r.appendChild(t);continue}const n=document.createElement("div");n.className="docx-page__slice",n.style.height=e.to-e.from+"px",n.style.overflow="hidden";const o=t.cloneNode(!0);o.style.marginTop=-e.from+"px",n.appendChild(o),r.appendChild(n)}e.appendChild(t)}e.querySelectorAll(".docx-page__body").forEach(e=>{e.setAttribute("contenteditable","true"),e.setAttribute("suppresscontenteditablewarning","true")})},[]);(0,o.useEffect)(()=>{b(!0);const e=t.subscribe(()=>{const e=d.current,t=window.getSelection(),o=!!(e&&t&&t.anchorNode&&e.contains(t.anchorNode));b(!1),o&&g(),n?.(!0)});return()=>{e()}},[t,b,g,n]),(0,o.useEffect)(()=>{u?.(()=>function(e){return(0,c.FoA)(e.document)}(t))},[t,u]);const k=(0,o.useCallback)(()=>{const e=(0,r.Ff)(document);if(!e)return!1;const n=t.selection;return n&&JSON.stringify(n.anchor)===JSON.stringify(e.anchor)&&JSON.stringify(n.focus)===JSON.stringify(e.focus)||t.setSelection(e),!0},[t]),x=(0,o.useCallback)((e,n)=>{k(),(0,r.d1)(t,l(e),n)},[t,k]),N=(0,o.useCallback)(()=>{(0,r.d1)(t,l("structure.insertText"),{text:""})},[t]),w=(0,o.useCallback)(e=>{if(!k())return;const n=t.selection;if(!n)return;const{anchor:o,focus:c}=n;if(o.block!==c.block||o.inline!==c.inline||o.offset!==c.offset)return void N();const i=o.offset;if(e&&i<=0)return void(0,r.d1)(t,l("structure.mergeBack"),void 0);const s=e?i-1:i,a=e?i:i+1,u={block:o.block,para:o.para,cell:o.cell,inline:o.inline};t.setSelection({anchor:(0,r.zf)({...u,offset:s}).anchor,focus:(0,r.zf)({...u,offset:a}).anchor}),N()},[t,k,N]),C=(0,o.useCallback)(e=>{k(),(0,r.d1)(t,l("structure.insertText"),{text:e})},[t,k]);return(0,o.useEffect)(()=>{const e=d.current;if(!e)return;const n=n=>{const o=window.getSelection();if(o&&o.anchorNode&&e.contains(o.anchorNode)){if(n.ctrlKey||n.metaKey){const e=n.key.toLowerCase();return n.shiftKey||"b"!==e&&"i"!==e&&"u"!==e?"z"===e?(n.preventDefault(),void((n.shiftKey?t.canRedo():t.canUndo())&&(n.shiftKey?t.redo():t.undo()))):void 0:(n.preventDefault(),void x("b"===e?"text.bold":"i"===e?"text.italic":"text.underline"))}return"Enter"===n.key?(n.preventDefault(),void x("structure.insertParagraph")):"Backspace"===n.key?(n.preventDefault(),void w(!0)):"Delete"===n.key?(n.preventDefault(),void w(!1)):void(1!==n.key.length||n.altKey||(n.preventDefault(),C(n.key)))}},o=t=>{const n=window.getSelection();n&&n.anchorNode&&e.contains(n.anchorNode)&&t.data&&C(t.data)},r=t=>{const n=window.getSelection();if(!n||!n.anchorNode||!e.contains(n.anchorNode))return;t.preventDefault();const o=t.clipboardData?.getData("text/plain");o&&C(o)};return e.addEventListener("keydown",n),e.addEventListener("compositionend",o),e.addEventListener("paste",r),()=>{e.removeEventListener("keydown",n),e.removeEventListener("compositionend",o),e.removeEventListener("paste",r)}},[t,x,w,C]),(0,a.jsx)("div",{className:"docx-body",children:(0,a.jsx)("div",{className:"docx-pages",ref:d})})}var d=n(99018);function f(e){const{url:t,save_path:n,on_dirty:c,bind_save:i}=e,[s,l]=(0,o.useState)(),[f,h]=(0,o.useState)(""),[p,m]=(0,o.useState)(!0),[g,b]=(0,o.useState)(!1),v=(0,o.useRef)();return(0,o.useEffect)(()=>{if(!t)return;let e=!0;return m(!0),h(""),b(!1),l(void 0),(0,d.PQ)(t).then(t=>{e&&l(function(e){return(0,r.k3)(e)}(t))}).catch(t=>e&&h(String(t?.message??t))).finally(()=>e&&m(!1)),()=>{e=!1}},[t]),(0,o.useEffect)(()=>{c?.(g)},[g,c]),(0,o.useEffect)(()=>{i?.(async e=>{if(!v.current)return!1;const t=await(0,d.GB)(n,v.current(),e);return t&&b(!1),t})},[n,i]),f?(0,a.jsx)("div",{className:"office-editor__tip office-editor__tip--error",children:f}):p||!s?(0,a.jsx)("div",{className:"office-editor__tip",children:"读取中…"}):(0,a.jsx)(u,{model:s,on_change:b,bind_save:e=>v.current=e})}},99018(e,t,n){n.d(t,{GB:()=>l,PQ:()=>a,Vi:()=>s});var o=n(14284),r=n(57889),c=n(34289),i=n(62042);function s(e){return`${encodeURIComponent(function(){const e=(0,c.GG)("file",(0,c.vX)());let t;try{t=decodeURIComponent(e)}catch{t=e}return t.endsWith("/")?t:`${t}/`}())}${e}`}async function a(e){return r.l.get_bytes_url(e)}function l(e,t,n){return async function(e,t,n){const r=await o.$M.post(`save_bin/${e}`,{base64:u(t)});return 0!==r.code?((0,i.zN)(r.message??"保存失败"),!1):(n&&(0,i.SK)(n),!0)}(function(e){const t=e.lastIndexOf("/");return t<0?encodeURIComponent(e):encodeURIComponent(e.slice(0,t))+e.slice(t)}(e),t,n)}function u(e){let t="";for(let n=0;n<e.length;n+=32768)t+=String.fromCharCode(...e.subarray(n,n+32768));return btoa(t)}}}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[3187,4935],{42562(e,t,n){n.d(t,{A:()=>c});var r=n(96540),s=n(85997),l=n(45907),o=n(74848);function c(e){const{name:t,dirty:n,loading:c,error:a,saving:i,on_save:u,on_close:f,children:d,extra:h}=e,m=(0,l.y)(),g=(0,r.useRef)(f),x=(0,r.useRef)(u),p=(0,r.useRef)(n);g.current=f,x.current=u,p.current=n;const y=()=>{p.current?m({title:"关闭",sub_title:"有未保存的修改,确定关闭吗?",confirm_fun:()=>g.current?.()}):g.current?.()};return(0,r.useEffect)(()=>{const e=e=>{(e.ctrlKey||e.metaKey)&&"s"===e.key.toLowerCase()?(e.preventDefault(),e.stopPropagation(),x.current?.(!1)):"Escape"===e.key&&y()};return document.addEventListener("keydown",e,!0),()=>document.removeEventListener("keydown",e,!0)},[]),(0,o.jsxs)("div",{className:"office-editor",children:[(0,o.jsxs)("div",{className:"office-editor__topbar",children:[(0,o.jsxs)("div",{className:"office-editor__name",children:[t,n&&(0,o.jsx)("span",{className:"office-editor__dirty",title:"有未保存的修改"})]}),(0,o.jsxs)("div",{className:"office-editor__ops",children:[h,i&&(0,o.jsx)("span",{className:"office-editor__saving",children:"保存中…"}),u&&(0,o.jsx)(s.rA,{icon:"save",title:"保存 (Ctrl+S)",onClick:()=>u()}),(0,o.jsx)(s.rA,{icon:"close",title:"关闭 (Esc)",onClick:y})]})]}),(0,o.jsxs)("div",{className:"office-editor__body",children:[c&&(0,o.jsx)("div",{className:"office-editor__tip",children:"加载中…"}),!c&&a&&(0,o.jsx)("div",{className:"office-editor__tip office-editor__tip--error",children:a}),!c&&!a&&d]})]})}},43187(e,t,n){n.r(t),n.d(t,{default:()=>h});var r=n(96540),s=n(34843),l=n(82893),o=n(42562),c=n(24935),a=n(99018),i=n(93245),u=n(23430),f=n(22022),d=n(74848);function h(){const{t:e}=(0,f.Bd)(),[t,n]=(0,s.fp)(l.AG.excel_editor),[h,m]=(0,r.useState)(!1),[g,x]=(0,r.useState)(!1),p=(0,r.useRef)(),y=async(t=!1)=>{if(!p.current)return!1;x(!0);try{return await p.current(t?"":e("保存成功"))}finally{x(!1)}},_=(0,r.useRef)(h);return _.current=h,(0,i.a)(u.nE.excel,()=>_.current,()=>y(!0)),(0,d.jsx)(o.A,{name:t.name,dirty:h,loading:!1,error:"",saving:g,on_save:y,on_close:()=>{const e=t.close;n({}),e?.()},children:t.url&&(0,d.jsx)(c.default,{url:t.url,save_path:(0,a.Vi)(t.name??""),on_dirty:m,bind_save:e=>p.current=e})})}},24935(e,t,n){n.r(t),n.d(t,{default:()=>b});var r=n(96540),s=n(47049),l=n(8890);const o=e=>Math.round(7*e+5),c=e=>Math.round(4*e/3);function a(e){return{toBytes:async()=>e}}function i(e,t){if(e){if(e.rgb){const t=String(e.rgb);return"#"+(8===t.length?t.slice(2):t)}return void 0!==e.theme&&t[e.theme]?"#"+function(e,t){if(!t)return e;const n=parseInt(e,16);return[n>>16&255,n>>8&255,255&n].map(e=>{const n=t<0?e*(1+t):e*(1-t)+255*t;return Math.round(n).toString(16).padStart(2,"0")}).join("").toUpperCase()}(t[e.theme],e.tint??0):void 0}}function u(e){const t=Math.round(864e5*(e-25569));return new Date(t)}function f(e,t){const n=e=>String(e).padStart(2,"0"),r=e.getUTCFullYear(),s=r%100,l=e.getUTCMonth()+1,o=e.getUTCDate(),c="日一二三四五六"[e.getUTCDay()];return t.replace(/;.*$/,"").replace(/\[[^\]]*\]/g,"").replace(/"[^"]*"/g,e=>e.slice(1,-1)).replace(/\\/g,"").replace(/yyyy/g,String(r)).replace(/yy/g,n(s)).replace(/(?<!m)m(?!m)/g,String(l)).replace(/mm/g,n(l)).replace(/d(?!d)/g,String(o)).replace(/dd/g,n(o)).replace(/aaaa/g,`星期${c}`)}const d=e=>!!e&&/[ymd]/i.test(e.replace(/"[^"]*"/g,""))&&!/[#0]/.test(e.replace(/"[^"]*"/g,""));function h(e,t,n){const r=e?.value;if(null==r)return{text:null};if("object"==typeof r){if(Array.isArray(r.runs)){const e=r.runs.map(e=>({text:e.text??"",color:i(e.font?.color,t)}));return{text:e.map(e=>e.text).join("")||null,runs:e.some(e=>e.color)?e:void 0}}if("string"==typeof r.text)return{text:r.text};const e=r.cachedValue??r.result;return void 0!==e?"number"==typeof e&&d(n)?{text:f(u(e),n)}:{text:String(e)}:{text:null}}return"number"==typeof r&&d(n)?{text:f(u(r),n)}:{text:String(r)}}function m(e,t,n){const r=e?.styleId;if(void 0===r)return;const s=t.cellXfs?.[r];if(!s)return;const l=t.fills?.[s.fillId],o=t.fonts?.[s.fontId],c={};"solid"===l?.patternType&&(c.bg=i(l.fgColor,n)),c.color=i(o?.color,n),o?.bold&&(c.bold=!0),o?.italic&&(c.italic=!0),o?.size&&(c.fontSize=o.size),o?.name&&(c.fontFamily=o.name),o?.underline&&(c.underline=!0),o?.strike&&(c.strike=!0);const a=s.alignment;return a?.horizontal&&["left","center","right"].includes(a.horizontal)&&(c.align=a.horizontal),a?.vertical&&(c.valign="center"===a.vertical?"middle":a.vertical),a?.wrapText&&(c.wrap=!0),a?.indent&&(c.indent=a.indent),Object.keys(c).length?c:void 0}function g(e,t){const n=e?.styleId;if(void 0===n)return;const r=t.cellXfs?.[n];if(!r)return;const s=r.numFmtId;if(void 0===s||0===s)return;const l={14:"m/d/yy",15:"d-mmm-yy",16:"d-mmm",17:"mmm-yy",18:"h:mm AM/PM",19:"h:mm:ss AM/PM",20:"h:mm",21:"h:mm:ss",22:"m/d/yy h:mm",27:'yyyy"年"m"月"',28:'m"月"d"日"',29:'m"月"d"日"',30:"m-d-yy",31:'yyyy"年"m"月"d"日"',32:'h"时"mm"分"',33:'h"时"mm"分"ss"秒"',34:'上午/下午h"时"mm"分"',35:'上午/下午h"时"mm"分"ss"秒"',36:'yyyy"年"m"月"'};if(l[s])return l[s];const o=t.numFmts;return o instanceof Map?o.get(s):void 0}async function x(e){const t=await(0,s.a)(a(e)),n=function(e){const t=["FFFFFF","000000","EEECE1","1F497D","4F81BD","C0504D","9BBB59","8064A2","4BACC6","F79646"];if(!e)return t;const n="string"==typeof e?e:(new TextDecoder).decode(e),r=/<a:clrScheme[\s\S]*?<\/a:clrScheme>/.exec(n)?.[0];if(!r)return t;const s=[],l=/<a:(dk1|lt1|dk2|lt2|accent[1-6]|hlink|folHlink)>([\s\S]*?)<\/a:\1>/g,o=new Map;let c;for(;c=l.exec(r);){const e=/(?:lastClr|val)="([0-9A-Fa-f]{6})"/.exec(c[2])?.[1];e&&o.set(c[1],e.toUpperCase())}return["lt1","dk1","lt2","dk2","accent1","accent2","accent3","accent4","accent5","accent6"].forEach((e,n)=>s[n]=o.get(e)??t[n]),s}(t.themeXml);return t.sheets.map(e=>{const r=e.sheet,s=t.styles;let l=0,a=0;r.rows.forEach((e,t)=>{e.size&&(l=Math.max(l,t),e.forEach((e,t)=>{a=Math.max(a,t)}))});const i=[],u=new Map;for(let e=1;e<=l;e++){const t=[],l=r.rows.get(e);for(let r=1;r<=a;r++){const o=l?.get(r),c=h(o,n,g(o,s));t.push(c.text);const a=m(o,s,n);c.runs&&(a?a.runs=c.runs:u.set(`${e-1}_${r-1}`,{runs:c.runs})),a&&u.set(`${e-1}_${r-1}`,a)}i.push(t)}const f=o(r.defaultColumnWidth??8.43),d=new Array(a).fill(f);r.columnDimensions?.forEach(e=>{const t=o(e.width??8.43);for(let n=e.min;n<=e.max;n++)n-1<d.length&&(d[n-1]=t)});const x=c(r.defaultRowHeight??15),p=new Array(l).fill(x),y=new Set;r.rowDimensions?.forEach((e,t)=>{t-1<p.length&&e.height&&(p[t-1]=c(e.height)),e.hidden&&t-1<l&&y.add(t-1)});const _=(r.mergedCells??[]).map(e=>[(e.minRow??e.start?.row??1)-1,(e.minCol??e.start?.col??1)-1,(e.maxRow??e.end?.row??1)-1,(e.maxCol??e.end?.col??1)-1]);return{title:r.title,values:i,styles:u,col_widths:d,row_heights:p,hidden_rows:y,merges:_}})}var p=n(74848);function y(e){const{bytes:t,on_change:n,bind_save:o}=e,[c,i]=(0,r.useState)([]),[u,f]=(0,r.useState)(0),[,d]=(0,r.useState)(0),[h,m]=(0,r.useState)(""),g=(0,r.useRef)(!1),y=(0,r.useRef)(null),[w,b]=(0,r.useState)({r0:0,r1:40,c0:0,c1:20});(0,r.useEffect)(()=>{let e=!0;return m(""),x(t).then(t=>e&&i(t)).catch(t=>e&&m(String(t?.message??t))),()=>{e=!1}},[t]);const S=(0,r.useCallback)(()=>{g.current||(g.current=!0,n(!0))},[n]);(0,r.useEffect)(()=>{o(async()=>{const e=await async function(e,t){const n=await(0,s.a)(a(e));return t.forEach((e,t)=>{const r=n.sheets[t];if(!r)return;const s=r.sheet;e.values.forEach((e,t)=>{e.forEach((e,n)=>{const r=t+1,l=n+1;let o=s.rows.get(r);o||(o=new Map,s.rows.set(r,o));const c=o.get(l);null!==e&&""!==e?c?c.value=e:o.set(l,{row:r,col:l,value:e}):c&&(c.value=null)})})}),await(0,l.n)(n)}(t,c);return g.current=!1,n(!1),e})},[c,t,o,n]),(0,r.useEffect)(()=>{e.bind_view?.({get_state:()=>({sheet:u,scroll_left:y.current?.scrollLeft??0,scroll_top:y.current?.scrollTop??0}),set_state:e=>{"number"==typeof e.sheet&&e.sheet>=0&&e.sheet<c.length&&f(e.sheet);const t=y.current;t&&(t.scrollLeft=e.scroll_left??0,t.scrollTop=e.scroll_top??0)}})},[u,c.length,e.bind_view]);const C=c[u],{col_x:j,row_y:E,total_w:k,total_h:M}=r.useMemo(()=>{const e=C?.col_widths??[],t=C?.row_heights??[],n=[0];e.forEach((e,t)=>n.push(n[t]+(C?.hidden_rows.has(t)?0:e)));const r=[0];return t.forEach((e,t)=>r.push(r[t]+e)),{col_x:n,row_y:r,total_w:n[n.length-1]??0,total_h:r[r.length-1]??0}},[C]),N=(e,t)=>{let n=0,r=e.length-1;for(;n<r;){const s=n+r>>1;e[s]<t?n=s+1:r=s}return n},$=(0,r.useCallback)(()=>{const e=y.current;if(!e||!j.length)return;const t=Math.max(0,N(j,e.scrollLeft)-1),n=Math.max(0,N(E,e.scrollTop)-1);b({c0:t,c1:Math.min(j.length-1,N(j,e.scrollLeft+e.clientWidth)+2),r0:n,r1:Math.min(E.length-1,N(E,e.scrollTop+e.clientHeight)+2)})},[j,E]);(0,r.useEffect)(()=>{$()},[C,$]);if(h)return(0,p.jsx)("div",{className:"office-editor__tip office-editor__tip--error",children:h});if(!c.length)return(0,p.jsx)("div",{className:"office-editor__tip",children:"解析中…"});const F=C?.values??[],A=(E.length,j.length,new Set);C.merges.forEach(([e,t,n,r])=>{for(let s=e;s<=n;s++)for(let n=t;n<=r;n++)s===e&&n===t||A.add(`${s}_${n}`)});const D=(e,t)=>{const n=F[e]?.[t];return(null==n||""===n)&&!C.styles.get(`${e}_${t}`)?.bg};return(0,p.jsxs)("div",{className:"xlsx-body",children:[(0,p.jsx)("div",{className:"xlsx-tabs",children:c.map((e,t)=>(0,p.jsx)("div",{className:"xlsx-tab "+(t===u?"xlsx-tab--active":""),onClick:()=>{f(t),y.current&&(y.current.scrollTop=0,y.current.scrollLeft=0)},children:e.title},e.title+t))}),(0,p.jsx)("div",{className:"xlsx-scroll",ref:y,onScroll:$,children:(0,p.jsxs)("div",{className:"xlsx-grid",style:{width:46+k,height:24+M},children:[Array.from({length:Math.max(0,w.c1-w.c0)}).map((e,t)=>{const n=w.c0+t;return(0,p.jsx)("div",{className:"xlsx-head",style:{left:46+j[n],top:0,width:j[n+1]-j[n],height:24},children:v(n)},"ch"+n)}),Array.from({length:Math.max(0,w.r1-w.r0)}).map((e,t)=>{const n=w.r0+t;return(0,p.jsxs)(r.Fragment,{children:[(0,p.jsx)("div",{className:"xlsx-head xlsx-head--row",style:{left:0,top:24+E[n],width:46,height:E[n+1]-E[n]},children:n+1}),Array.from({length:Math.max(0,w.c1-w.c0)}).map((e,t)=>{const r=w.c0+t;if(A.has(`${n}_${r}`))return null;const s=C.merges.find(e=>e[0]===n&&e[1]===r),l=s?j[s[3]+1]-j[s[1]]:j[r+1]-j[r],o=s?E[s[2]+1]-E[s[0]]:E[n+1]-E[n];return(0,p.jsx)(_,{value:F[n]?.[r]??"",cell_style:C.styles.get(`${n}_${r}`),spillable:D(n,r+1),style:{left:46+j[r],top:24+E[n],width:l,height:o,zIndex:s?2:1},on_change:e=>((e,t,n)=>{const r=c[u];r&&(r.values[e][t]=""===n?null:n,S(),d(e=>e+1))})(n,r,e)},r)})]},n)})]})})]})}function _(e){const{value:t,cell_style:n,style:s,spillable:l,on_change:o}=e,[c,a]=(0,r.useState)(!1),[i,u]=(0,r.useState)(""),f=(0,r.useRef)(null);(0,r.useEffect)(()=>{c&&f.current&&(f.current.focus(),f.current.select())},[c]);const d=()=>{a(!1),i!==(t??"")&&o(i)},h={};return n?.bg&&(h.backgroundColor=n.bg),n?.color&&(h.color=n.color),n?.bold&&(h.fontWeight=600),n?.italic&&(h.fontStyle="italic"),n?.fontSize&&(h.fontSize=Math.round(4*n.fontSize/3*10)/10+"px"),n?.fontFamily&&(h.fontFamily=`"${n.fontFamily}", "PingFang SC", sans-serif`),n?.underline&&(h.textDecoration="underline"),n?.strike&&(h.textDecoration=h.textDecoration?`${h.textDecoration} line-through`:"line-through"),n?.align&&(h.textAlign=n.align,h.justifyContent="center"===n.align?"center":"right"===n.align?"flex-end":"flex-start"),n?.valign&&(h.alignItems="middle"===n.valign?"center":"bottom"===n.valign?"flex-end":"flex-start"),n?.wrap&&(h.whiteSpace="pre-wrap"),n?.indent&&(h.paddingLeft=.35+1.4*n.indent+"em"),(0,p.jsx)("div",{className:`xlsx-cell ${n?.wrap?"xlsx-cell--wrap":""} ${l?"xlsx-cell--spill":""}`,style:{...s,...h,"--cell-h":n?.wrap?"1.4":s.height-1+"px"},onDoubleClick:()=>{u(t??""),a(!0)},children:c?(0,p.jsx)("textarea",{ref:f,className:"xlsx-cell__input",value:i,onChange:e=>u(e.target.value),onBlur:d,onKeyDown:e=>{"Enter"!==e.key||e.shiftKey?"Escape"===e.key&&a(!1):(e.preventDefault(),d())}}):n?.runs?(0,p.jsx)("span",{children:n.runs.map((e,t)=>(0,p.jsx)("span",{style:e.color?{color:e.color}:void 0,children:e.text},t))}):t})}function v(e){let t="",n=e+1;for(;n>0;){const e=(n-1)%26;t=String.fromCharCode(65+e)+t,n=Math.floor((n-1)/26)}return t}var w=n(99018);function b(e){const{url:t,save_path:n,on_dirty:s,bind_save:l}=e,[o,c]=(0,r.useState)(),[a,i]=(0,r.useState)(""),[u,f]=(0,r.useState)(!0),[d,h]=(0,r.useState)(!1),m=(0,r.useRef)();return(0,r.useEffect)(()=>{if(!t)return;let e=!0;return f(!0),i(""),h(!1),c(void 0),(0,w.PQ)(t).then(t=>e&&c(t)).catch(t=>e&&i(String(t?.message??t))).finally(()=>e&&f(!1)),()=>{e=!1}},[t]),(0,r.useEffect)(()=>{s?.(d)},[d,s]),(0,r.useEffect)(()=>{l?.(async e=>{if(!m.current)return!1;const t=await m.current(),r=await(0,w.GB)(n,t,e);return r&&(c(t),h(!1)),r})},[n,l]),a?(0,p.jsx)("div",{className:"office-editor__tip office-editor__tip--error",children:a}):u||!o?(0,p.jsx)("div",{className:"office-editor__tip",children:"读取中…"}):(0,p.jsx)(y,{bytes:o,on_change:h,bind_save:e=>m.current=e,bind_view:e.bind_view})}},99018(e,t,n){n.d(t,{GB:()=>i,PQ:()=>a,Vi:()=>c});var r=n(14284),s=n(57889),l=n(34289),o=n(62042);function c(e){return`${encodeURIComponent(function(){const e=(0,l.GG)("file",(0,l.vX)());let t;try{t=decodeURIComponent(e)}catch{t=e}return t.endsWith("/")?t:`${t}/`}())}${e}`}async function a(e){return s.l.get_bytes_url(e)}function i(e,t,n){return async function(e,t,n){const s=await r.$M.post(`save_bin/${e}`,{base64:u(t)});return 0!==s.code?((0,o.zN)(s.message??"保存失败"),!1):(n&&(0,o.SK)(n),!0)}(function(e){const t=e.lastIndexOf("/");return t<0?encodeURIComponent(e):encodeURIComponent(e.slice(0,t))+e.slice(t)}(e),t,n)}function u(e){let t="";for(let n=0;n<e.length;n+=32768)t+=String.fromCharCode(...e.subarray(n,n+32768));return btoa(t)}}}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[2515,3322],{42562(e,t,r){r.d(t,{A:()=>a});var n=r(96540),s=r(85997),c=r(45907),i=r(74848);function a(e){const{name:t,dirty:r,loading:a,error:o,saving:u,on_save:d,on_close:f,children:l,extra:_}=e,p=(0,c.y)(),m=(0,n.useRef)(f),v=(0,n.useRef)(d),y=(0,n.useRef)(r);m.current=f,v.current=d,y.current=r;const h=()=>{y.current?p({title:"关闭",sub_title:"有未保存的修改,确定关闭吗?",confirm_fun:()=>m.current?.()}):m.current?.()};return(0,n.useEffect)(()=>{const e=e=>{(e.ctrlKey||e.metaKey)&&"s"===e.key.toLowerCase()?(e.preventDefault(),e.stopPropagation(),v.current?.(!1)):"Escape"===e.key&&h()};return document.addEventListener("keydown",e,!0),()=>document.removeEventListener("keydown",e,!0)},[]),(0,i.jsxs)("div",{className:"office-editor",children:[(0,i.jsxs)("div",{className:"office-editor__topbar",children:[(0,i.jsxs)("div",{className:"office-editor__name",children:[t,r&&(0,i.jsx)("span",{className:"office-editor__dirty",title:"有未保存的修改"})]}),(0,i.jsxs)("div",{className:"office-editor__ops",children:[_,u&&(0,i.jsx)("span",{className:"office-editor__saving",children:"保存中…"}),d&&(0,i.jsx)(s.rA,{icon:"save",title:"保存 (Ctrl+S)",onClick:()=>d()}),(0,i.jsx)(s.rA,{icon:"close",title:"关闭 (Esc)",onClick:h})]})]}),(0,i.jsxs)("div",{className:"office-editor__body",children:[a&&(0,i.jsx)("div",{className:"office-editor__tip",children:"加载中…"}),!a&&o&&(0,i.jsx)("div",{className:"office-editor__tip office-editor__tip--error",children:o}),!a&&!o&&l]})]})}},13322(e,t,r){r.r(t),r.d(t,{default:()=>_});var n=r(96540),s=r(34843),c=r(82893),i=r(42562),a=r(72515),o=r(99018),u=r(93245),d=r(23430),f=r(22022),l=r(74848);function _(){const{t:e}=(0,f.Bd)(),[t,r]=(0,s.fp)(c.AG.pptx_editor),[_,p]=(0,n.useState)(!1),[m,v]=(0,n.useState)(!1),y=(0,n.useRef)(),h=async(t=!1)=>{if(!y.current)return!1;v(!0);try{return await y.current(t?"":e("保存成功"))}finally{v(!1)}},x=(0,n.useRef)(_);return x.current=_,(0,u.a)(d.nE.pptx,()=>x.current,()=>h(!0)),(0,l.jsx)(i.A,{name:t.name,dirty:_,loading:!1,error:"",saving:m,on_save:h,on_close:()=>{const e=t.close;r({}),e?.()},children:t.url&&(0,l.jsx)(a.default,{url:t.url,file_name:t.name??"",save_path:(0,o.Vi)(t.name??""),on_dirty:p,bind_save:e=>y.current=e})})}},72515(e,t,r){r.r(t),r.d(t,{default:()=>a});var n=r(96540),s=r(50610),c=r(99018),i=r(74848);function a(e){const{url:t,save_path:r,file_name:a,on_dirty:o,bind_save:u}=e,d=(0,n.useRef)(null),f=(0,n.useRef)(),l=(0,n.useRef)(""),[_,p]=(0,n.useState)(""),[m,v]=(0,n.useState)(!0);return(0,n.useEffect)(()=>{if(!t)return;const e=d.current;if(!e)return;let n,i=!0;return v(!0),p(""),(0,c.PQ)(t).then(t=>{i&&(n=(0,s.t)(e,{source:t,fileName:a,onSave:async e=>{const t=await(0,c.GB)(r,e,l.current);return t&&o?.(!1),t},autoSave:!1,compact:!0}),f.current=n,n.on("dirtychange",e=>{o?.(e.dirty)}))}).catch(e=>{i&&p(String(e?.message??e))}).finally(()=>i&&v(!1)),()=>{i=!1,n?.destroy(),f.current=void 0}},[t,a,r]),(0,n.useEffect)(()=>{u?.(async e=>{const t=f.current;return!!t&&(l.current=e,await t.save(),l.current="",!t.dirty)})},[u]),(0,i.jsxs)("div",{className:"pptx-pane",children:[_&&(0,i.jsx)("div",{className:"office-editor__tip office-editor__tip--error",children:_}),m&&!_&&(0,i.jsx)("div",{className:"office-editor__tip",children:"读取中…"}),(0,i.jsx)("div",{className:"pptx-pane__host",ref:d})]})}},99018(e,t,r){r.d(t,{GB:()=>u,PQ:()=>o,Vi:()=>a});var n=r(14284),s=r(57889),c=r(34289),i=r(62042);function a(e){return`${encodeURIComponent(function(){const e=(0,c.GG)("file",(0,c.vX)());let t;try{t=decodeURIComponent(e)}catch{t=e}return t.endsWith("/")?t:`${t}/`}())}${e}`}async function o(e){return s.l.get_bytes_url(e)}function u(e,t,r){return async function(e,t,r){const s=await n.$M.post(`save_bin/${e}`,{base64:d(t)});return 0!==s.code?((0,i.zN)(s.message??"保存失败"),!1):(r&&(0,i.SK)(r),!0)}(function(e){const t=e.lastIndexOf("/");return t<0?encodeURIComponent(e):encodeURIComponent(e.slice(0,t))+e.slice(t)}(e),t,r)}function d(e){let t="";for(let r=0;r<e.length;r+=32768)t+=String.fromCharCode(...e.subarray(r,r+32768));return btoa(t)}}}]);
|