filecat 7.32.2 → 7.34.0

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.

Potentially problematic release.


This version of filecat might be problematic. Click here for more details.

Files changed (43) hide show
  1. package/README.md +1 -1
  2. package/build/dist/1246.2504cc1737e1f6c1b7df.js +1 -0
  3. package/build/dist/1793.388505f01a0f2cfa51ee.js +1 -0
  4. package/build/dist/{1852.16cec79aa004d7d496ee.js → 1852.7968547974ff6e5027b7.js} +1 -1
  5. package/build/dist/{2136.20ea58a65c7fb22d5e43.js → 2136.bfc7af4db34b53764354.js} +1 -1
  6. package/build/dist/2539.4a8af43f286966a85f50.js +1 -0
  7. package/build/dist/2698.e88f57b81b7c2df01c62.js +1 -0
  8. package/build/dist/3187.0552ae51ab59bb661bc7.js +1 -0
  9. package/build/dist/3266.22923890ecd8f170b711.js +1 -0
  10. package/build/dist/3322.11cb2fb4604b71145f15.js +1 -0
  11. package/build/dist/{3355.fe615f78b2015ec080c2.js → 3355.ec9e7ac17d54afa75113.js} +1 -1
  12. package/build/dist/4350.f823a100b94e8f3b556f.js +1 -0
  13. package/build/dist/{4598.7f2b7c8ee1751b912cc6.js → 4598.9349c8620d667bd9abb8.js} +1 -1
  14. package/build/dist/{47.d5cc6abee0da2951a189.js → 47.a469f0a19c1a8a0adac1.js} +1 -1
  15. package/build/dist/526.bff76b57b88c2d4ffa93.js +1 -0
  16. package/build/dist/5599.3106e89134ff993bc90b.js +1 -0
  17. package/build/dist/{6097.fa01bd2ab412cdcb52df.js → 6097.225a48b1e7af976240b7.js} +1 -1
  18. package/build/dist/6439.3da5245841fe3c7cfbb8.js +1 -0
  19. package/build/dist/6471.c5f6de5c28d0ce0ece0e.js +1 -0
  20. package/build/dist/676.99d4464783ff2247e856.js +1 -0
  21. package/build/dist/6930.155cf4ed8fff0398c4b1.js +1 -0
  22. package/build/dist/6952.a3f54cf363c348c5ad16.js +1 -0
  23. package/build/dist/7518.39a7d163fd064dd730ea.js +1 -0
  24. package/build/dist/7576.98b973979d4ac9fd75d3.js +1 -0
  25. package/build/dist/{7678.954622f85bb32a50ad25.js → 7678.a2531207b9df0432c027.js} +1 -1
  26. package/build/dist/8891.bdc07e7b0fdb9b33cb83.js +1 -0
  27. package/build/dist/{9260.fd785c5b4418123dd54f.js → 9260.6e08158f53a391e6a8ad.js} +1 -1
  28. package/build/dist/9636.0a859e32ef66bfaa176d.js +1 -0
  29. package/build/dist/9724.e50b15571a3aed321e10.js +1 -0
  30. package/build/dist/{9765.046a87c8c6ed9427eb45.js → 9765.0a471505df15990bc7bc.js} +1 -1
  31. package/build/dist/9984.ab2ec08866b8f1eca3ca.js +1 -0
  32. package/build/dist/index.html +1 -1
  33. package/build/dist/main.e2009e388b74bf656c39.js +2 -0
  34. package/build/main.js +1 -1
  35. package/package.json +2 -1
  36. package/build/dist/3187.03c9284e30214b476487.js +0 -1
  37. package/build/dist/3322.36f73d119334675d9bc4.js +0 -1
  38. package/build/dist/4350.7412b41befe12857677f.js +0 -1
  39. package/build/dist/6439.e984788ff732b4eeaed8.js +0 -1
  40. package/build/dist/676.82cbafd4308ac08d1e69.js +0 -1
  41. package/build/dist/7133.867e3e82cd874862ec1f.js +0 -1
  42. package/build/dist/main.89376a85f16c77177628.js +0 -2
  43. /package/build/dist/{main.89376a85f16c77177628.js.LICENSE.txt → main.e2009e388b74bf656c39.js.LICENSE.txt} +0 -0
package/README.md CHANGED
@@ -52,7 +52,7 @@ FileCat是采用[filebrowser](https://github.com/filebrowser/filebrowser)的ui
52
52
  | 类别 | 功能 |
53
53
  |------|------|
54
54
  | 文件管理 | 浏览、上传、下载、重命名、移动、复制、压缩解压,支持拖拽上传与分页滚动加载 |
55
- | 文件预览 | 图片、视频、音频、PDF、Office 文档、Markdown、代码、日志等格式在线预览 |
55
+ | 文件预览 | 图片、视频、音频、PDF、Office 文档、epub小说、Markdown、代码、日志等格式在线预览 |
56
56
  | Office 编辑器 | 在线编辑 Word(docx)、Excel(xlsx)、PowerPoint(pptx),无需本地安装 Office |
57
57
  | Markdown 所见即所得 | 类 Typora 的实时预览编辑,内置 7 套主题,支持 Mermaid / SVG 绘图与 KaTeX 公式 |
58
58
  | 代码编辑器 | 内置 Ace 编辑器,支持语法高亮、多语言识别与 Studio 分栏代码模式 |
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[1246],{61246(e,t,n){n.d(t,{searchMatcher:()=>i});const s=e=>e.replace(/\s+/g," "),a=(e,{startIndex:t,startOffset:n,endIndex:a,endOffset:r})=>{const i=e[t],l=e[a],o=i===l?i.slice(n,r):i.slice(n)+e.slice(i+1,l).join("")+l.slice(0,r),c=s(i.slice(0,n)).trimStart(),g=s(l.slice(r)).trimEnd(),f=c.length<50?"":"…",d=g.length<50?"":"…";return{pre:`${f}${c.slice(-50)}`,match:o,post:`${g.slice(0,50)}${d}`}},r=(e,t,n)=>{const{granularity:s="grapheme",sensitivity:r="base"}=n;return Intl?.Segmenter&&("grapheme"!==s||"variant"!==r&&"accent"!==r)?function*(e,t,n={}){const{locales:s="en",granularity:r="word",sensitivity:i="base"}=n;let l,o;try{l=new Intl.Segmenter(s,{usage:"search",granularity:r}),o=new Intl.Collator(s,{sensitivity:i})}catch(e){console.warn(e),l=new Intl.Segmenter("en",{usage:"search",granularity:r}),o=new Intl.Collator("en",{sensitivity:i})}const c=Array.from(l.segment(t)).length,g=[];let f=0,d=l.segment(e[f])[Symbol.iterator]();e:for(;f<e.length;){for(;g.length<c;){const{done:t,value:n}=d.next();if(t){if(f++,f<e.length){d=l.segment(e[f])[Symbol.iterator]();continue}break e}const{index:s,segment:a}=n;/[^\p{Format}]/u.test(a)&&(/\s/u.test(a)?/\s/u.test(g[g.length-1]?.segment)||g.push({strIndex:f,index:s,segment:" "}):(n.strIndex=f,g.push(n)))}const n=g.map(e=>e.segment).join("");if(0===o.compare(t,n)){const t=f,n=g[g.length-1],s=n.index+n.segment.length,r={startIndex:g[0].strIndex,startOffset:g[0].index,endIndex:t,endOffset:s};yield{range:r,excerpt:a(e,r)}}g.shift()}}(e,t,n):function*(e,t,n={}){const{locales:s="en",sensitivity:r}=n,i="variant"===r,l=e.join(""),o=i?l:l.toLocaleLowerCase(s),c=i?t:t.toLocaleLowerCase(s),g=c.length;let f=-1,d=-1,h=0;do{if(f=o.indexOf(c,f+1),f>-1){for(;h<=f;)h+=e[++d].length;const t=d,n=f-(h-e[d].length),s=f+g;for(;h<=s;)h+=e[++d].length;const r={startIndex:t,startOffset:n,endIndex:d,endOffset:s-(h-e[d].length)};yield{range:r,excerpt:a(e,r)}}}while(f>-1)}(e,t,n)},i=(e,t)=>{const{defaultLocale:n,matchCase:s,matchDiacritics:a,matchWholeWords:i}=t;return function*(t,l){const o=e(t,function*(e,o){for(const c of r(e,l,{locales:t.body.lang||t.documentElement.lang||n||"en",granularity:i?"word":"grapheme",sensitivity:a&&s?"variant":a&&!s?"accent":!a&&s?"case":"base"})){const{startIndex:e,startOffset:t,endIndex:n,endOffset:s}=c.range;c.range=o(e,t,n,s),yield c}});for(const e of o)yield e}}}}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[1793],{93742(){!function(){"use strict";if("undefined"!=typeof document&&!("adoptedStyleSheets"in document)){var e="ShadyCSS"in window&&!ShadyCSS.nativeShadow,t=document.implementation.createHTMLDocument(""),n=new WeakMap,i="object"==typeof DOMException?Error:DOMException,r=Object.defineProperty,o=Array.prototype.forEach,s=/@import.+?;?$/gm,a=CSSStyleSheet.prototype;a.replace=function(){return Promise.reject(new i("Can't call replace on non-constructed CSSStyleSheets."))},a.replaceSync=function(){throw new i("Failed to execute 'replaceSync' on 'CSSStyleSheet': Can't call replaceSync on non-constructed CSSStyleSheets.")};var c=new WeakMap,h=new WeakMap,l=new WeakMap,d=new WeakMap,u=M.prototype;u.replace=function(e){try{return this.replaceSync(e),Promise.resolve(this)}catch(e){return Promise.reject(e)}},u.replaceSync=function(e){if(O(this),"string"==typeof e){var t=this;c.get(t).textContent=function(e){var t=e.replace(s,"");return t!==e&&console.warn("@import rules are not allowed here. See https://github.com/WICG/construct-stylesheets/issues/119#issuecomment-588352418"),t.trim()}(e),d.set(t,[]),h.get(t).forEach(function(e){e.isConnected()&&k(t,C(t,e))})}},r(u,"cssRules",{configurable:!0,enumerable:!0,get:function(){return O(this),c.get(this).sheet.cssRules}}),r(u,"media",{configurable:!0,enumerable:!0,get:function(){return O(this),c.get(this).sheet.media}}),["addRule","deleteRule","insertRule","removeRule"].forEach(function(e){u[e]=function(){var t=this;O(t);var n=arguments;d.get(t).push({method:e,args:n}),h.get(t).forEach(function(i){if(i.isConnected()){var r=C(t,i).sheet;r[e].apply(r,n)}});var i=c.get(t).sheet;return i[e].apply(i,n)}}),r(M,Symbol.hasInstance,{configurable:!0,value:x});var f={childList:!0,subtree:!0},p=new WeakMap,g=new WeakMap,m=new WeakMap,y=new WeakMap;if(W.prototype={isConnected:function(){var e=g.get(this);return e instanceof Document?"loading"!==e.readyState:function(e){return"isConnected"in e?e.isConnected:document.contains(e)}(e.host)},connect:function(){var e=T(this);y.get(this).observe(e,f),m.get(this).length>0&&A(this),R(e,function(e){F(e).connect()})},disconnect:function(){y.get(this).disconnect()},update:function(e){var t=this,n=g.get(t)===document?"Document":"ShadowRoot";if(!Array.isArray(e))throw new TypeError("Failed to set the 'adoptedStyleSheets' property on "+n+": Iterator getter is not callable.");if(!e.every(x))throw new TypeError("Failed to set the 'adoptedStyleSheets' property on "+n+": Failed to convert value to 'CSSStyleSheet'");if(e.some(E))throw new TypeError("Failed to set the 'adoptedStyleSheets' property on "+n+": Can't adopt non-constructed stylesheets");t.sheets=e;var i,r,o=m.get(t),s=(i=e).filter(function(e,t){return i.indexOf(e)===t});(r=s,o.filter(function(e){return-1===r.indexOf(e)})).forEach(function(e){var n;(n=C(e,t)).parentNode.removeChild(n),function(e,t){l.get(e).delete(t),h.set(e,h.get(e).filter(function(e){return e!==t}))}(e,t)}),m.set(t,s),t.isConnected()&&s.length>0&&A(t)}},window.CSSStyleSheet=M,L(Document),"ShadowRoot"in window){L(ShadowRoot);var w=Element.prototype,S=w.attachShadow;w.attachShadow=function(e){var t=S.call(this,e);return"closed"===e.mode&&n.set(this,t),t}}var v=F(document);v.isConnected()?v.connect():document.addEventListener("DOMContentLoaded",v.connect.bind(v))}function b(e){return e.shadowRoot||n.get(e)}function x(e){return"object"==typeof e&&(u.isPrototypeOf(e)||a.isPrototypeOf(e))}function E(e){return"object"==typeof e&&a.isPrototypeOf(e)}function C(e,t){return l.get(e).get(t)}function k(e,t){requestAnimationFrame(function(){t.textContent=c.get(e).textContent,d.get(e).forEach(function(e){return t.sheet[e.method].apply(t.sheet,e.args)})})}function O(e){if(!c.has(e))throw new TypeError("Illegal invocation")}function M(){var e=this,n=document.createElement("style");t.body.appendChild(n),c.set(e,n),h.set(e,[]),l.set(e,new WeakMap),d.set(e,[])}function F(e){var t=p.get(e);return t||(t=new W(e),p.set(e,t)),t}function L(e){r(e.prototype,"adoptedStyleSheets",{configurable:!0,enumerable:!0,get:function(){return F(this).sheets},set:function(e){F(this).update(e)}})}function R(e,t){for(var n=document.createNodeIterator(e,NodeFilter.SHOW_ELEMENT,function(e){return b(e)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT},null,!1),i=void 0;i=n.nextNode();)t(b(i))}function T(e){var t=g.get(e);return t instanceof Document?t.body:t}function A(e){var t=document.createDocumentFragment(),n=m.get(e),i=y.get(e),r=T(e);i.disconnect(),n.forEach(function(n){t.appendChild(C(n,e)||function(e,t){var n=document.createElement("style");return l.get(e).set(t,n),h.get(e).push(t),n}(n,e))}),r.insertBefore(t,null),i.observe(r,f),n.forEach(function(t){k(t,C(t,e))})}function W(t){var n=this;n.sheets=[],g.set(n,t),m.set(n,[]),y.set(n,new MutationObserver(function(t,i){document?t.forEach(function(t){e||o.call(t.addedNodes,function(e){e instanceof Element&&R(e,function(e){F(e).connect()})}),o.call(t.removedNodes,function(t){t instanceof Element&&(function(e,t){return t instanceof HTMLStyleElement&&m.get(e).some(function(t){return C(t,e)})}(n,t)&&A(n),e||R(t,function(e){F(e).disconnect()}))})}):i.disconnect()}))}}()},51793(e,t,n){"use strict";n.r(t),n.d(t,{FixedLayout:()=>r});n(93742);const i=e=>e?.split(/[,;\s]/)?.filter(e=>e)?.map(e=>e.split("=").map(e=>e.trim()));class r extends HTMLElement{static observedAttributes=["zoom"];#e=this.attachShadow({mode:"closed"});#t=new ResizeObserver(()=>this.#n());#i;#r=-1;defaultViewport;spread;#o=!1;#s;#a;#c;#h;#l;constructor(){super();const e=new CSSStyleSheet;this.#e.adoptedStyleSheets=[e],e.replaceSync(":host {\n width: 100%;\n height: 100%;\n display: flex;\n justify-content: center;\n align-items: center;\n overflow: auto;\n }"),this.#t.observe(this)}attributeChangedCallback(e,t,n){if("zoom"===e)this.#l="fit-width"!==n&&"fit-page"!==n?parseFloat(n):n,this.#n()}async#d({index:e,src:t}){const n="string"==typeof t,r=n?t:t?.src,o=n?null:t?.onZoom,s=document.createElement("div"),a=document.createElement("iframe");return s.append(a),Object.assign(a.style,{border:"0",display:"none",overflow:"hidden"}),a.setAttribute("sandbox","allow-same-origin allow-scripts"),a.setAttribute("scrolling","no"),a.setAttribute("part","filter"),this.#e.append(s),r?new Promise(t=>{a.addEventListener("load",()=>{const n=a.contentDocument;this.dispatchEvent(new CustomEvent("load",{detail:{doc:n,index:e}}));const{width:r,height:c}=((e,t)=>{if("svg"===e.documentElement.localName){const[,,t,n]=e.documentElement.getAttribute("viewBox")?.split(/\s/)??[];return{width:t,height:n}}const n=i(e.querySelector('meta[name="viewport"]')?.getAttribute("content"));if(n)return Object.fromEntries(n);if("string"==typeof t)return i(t);if(t)return t;const r=e.querySelector("img");return r?{width:r.naturalWidth,height:r.naturalHeight}:(console.warn(new Error("Missing viewport properties")),{width:1e3,height:2e3})})(n,this.defaultViewport);t({element:s,iframe:a,width:parseFloat(r),height:parseFloat(c),onZoom:o})},{once:!0}),a.src=r}):{blank:!0,element:s,iframe:a}}#n(e=this.#h){if(!e)return;const t=this.#s??{},n=this.#c??this.#a,i="left"===e?t:n,{width:r,height:o}=this.getBoundingClientRect(),s="both"!==this.spread&&"portrait"!==this.spread&&o>r;this.#o=s;const a=t.width??n.width,c=t.height??n.height,h="number"!=typeof this.#l||isNaN(this.#l)?"fit-width"===this.#l?s||this.#c?r/(i.width??a):r/((t.width??a)+(n.width??a)):s||this.#c?Math.min(r/(i.width??a),o/(i.height??c)):Math.min(r/((t.width??a)+(n.width??a)),o/Math.max(t.height??c,n.height??c)):this.#l,l=e=>{let{element:t,iframe:n,width:r,height:o,blank:l,onZoom:d}=e;d&&d({doc:e.iframe.contentDocument,scale:h});const u=d?h:1;Object.assign(n.style,{width:r*u+"px",height:o*u+"px",transform:d?"none":`scale(${h})`,transformOrigin:"top left",display:l?"none":"block"}),Object.assign(t.style,{width:(r??a)*h+"px",height:(o??c)*h+"px",overflow:"hidden",display:"block",flexShrink:"0",marginBlock:"auto"}),s&&e!==i&&(t.style.display="none")};this.#c?l(this.#c):(l(t),l(n))}async#u({left:e,right:t,center:n,side:i}){this.#e.replaceChildren(),this.#s=null,this.#a=null,this.#c=null,n?(this.#c=await this.#d(n),this.#h="center",this.#n()):(this.#s=await this.#d(e),this.#a=await this.#d(t),this.#h=this.#s.blank?"right":this.#a.blank?"left":i,this.#n())}#f(){if(!this.#c&&!this.#s?.blank)return this.#o&&"none"===this.#s?.element?.style?.display?(this.#a.element.style.display="none",this.#s.element.style.display="block",this.#h="left",!0):void 0}#p(){if(!this.#c&&!this.#a?.blank)return this.#o&&"none"===this.#a?.element?.style?.display?(this.#s.element.style.display="none",this.#a.element.style.display="block",this.#h="right",!0):void 0}open(e){this.book=e;const{rendition:t}=e;this.spread=t?.spread,this.defaultViewport=t?.viewport;const n="rtl"===e.dir,i=!n;this.rtl=n,this.#i="none"===t?.spread?e.sections.map(e=>({center:e})):e.sections.reduce((e,t,r)=>{const o=e[e.length-1],{pageSpread:s}=t,a=()=>{const t={};return e.push(t),t};if("center"===s){(o.left||o.right?a():o).center=t}else if("left"===s){(o.center||o.left||i&&r?a():o).left=t}else if("right"===s){(o.center||o.right||n&&r?a():o).right=t}else i?o.center||o.right?a().left=t:o.left||!r?o.right=t:o.left=t:o.center||o.left?a().right=t:o.right||!r?o.left=t:o.right=t;return e},[{}])}get index(){const e=this.#i[this.#r],t=e?.center??("left"===this.side?e.left??e.right:e.right??e.left);return this.book.sections.indexOf(t)}#g(e){this.dispatchEvent(new CustomEvent("relocate",{detail:{reason:e,range:null,index:this.index,fraction:0,size:1}}))}getSpreadOf(e){const t=this.#i;for(let n=0;n<t.length;n++){const{left:i,right:r,center:o}=t[n];if(i===e)return{index:n,side:"left"};if(r===e)return{index:n,side:"right"};if(o===e)return{index:n,side:"center"}}}async goToSpread(e,t,n){if(e<0||e>this.#i.length-1)return;if(e===this.#r)return void this.#n(t);this.#r=e;const i=this.#i[e];if(i.center){const e=this.book.sections.indexOf(i.center),t=await(i.center?.load?.());await this.#u({center:{index:e,src:t}})}else{const e=this.book.sections.indexOf(i.left),n=this.book.sections.indexOf(i.right),r={index:e,src:await(i.left?.load?.())},o={index:n,src:await(i.right?.load?.())};await this.#u({left:r,right:o,side:t})}this.#g(n)}async select(e){await this.goTo(e)}async goTo(e){const{book:t}=this,n=await e,i=t.sections[n.index];if(!i)return;const{index:r,side:o}=this.getSpreadOf(i);await this.goToSpread(r,o)}async next(){if(!(this.rtl?this.#f():this.#p()))return this.goToSpread(this.#r+1,this.rtl?"right":"left","page");this.#g("page")}async prev(){if(!(this.rtl?this.#p():this.#f()))return this.goToSpread(this.#r-1,this.rtl?"left":"right","page");this.#g("page")}getContents(){return Array.from(this.#e.querySelectorAll("iframe"),e=>({doc:e.contentDocument}))}destroy(){this.#t.unobserve(this)}}customElements.define("foliate-fxl",r)}}]);
@@ -1 +1 @@
1
- "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[26,1852],{21852(e,t,n){n.r(t),n.d(t,{default:()=>h});var o=n(96540),r=n(34843),c=n(82893),i=n(42562),s=n(26),a=n(99018),l=n(93245),d=n(23430),u=n(22022),f=n(74848);function h(){const{t:e}=(0,u.Bd)(),[t,n]=(0,r.fp)(c.AG.docx_editor),[h,p]=(0,o.useState)(!1),[m,g]=(0,o.useState)(!1),v=(0,o.useRef)(),b=async(t=!1)=>{if(!v.current)return!1;g(!0);try{return await v.current(t?"":e("保存成功"))}finally{g(!1)}},y=(0,o.useRef)(h);return y.current=h,(0,l.a)(d.nE.docx,()=>y.current,()=>b(!0)),(0,f.jsx)(i.A,{name:t.name,dirty:h,loading:!1,error:"",saving:m,on_save:b,on_close:()=>{const e=t.close;n({}),e?.()},children:t.url&&(0,f.jsx)(s.default,{url:t.url,save_path:(0,a.Vi)(t.name??""),on_dirty:p,bind_save:e=>v.current=e})})}},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 d(e){const{model:t,on_change:n,bind_save:d}=e,u=(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=u.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]),v=(0,o.useCallback)((e=!1)=>{const n=u.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 d=h.current,{heights:m,lines:g}=b(a.length,d),v=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,d);y(n,v,d)},[t]),b=(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)(()=>{v(!0);const e=t.subscribe(()=>{const e=u.current,t=window.getSelection(),o=!!(e&&t&&t.anchorNode&&e.contains(t.anchorNode));v(!1),o&&g(),n?.(!0)});return()=>{e()}},[t,v,g,n]),(0,o.useEffect)(()=>{d?.(()=>function(e){return(0,c.FoA)(e.document)}(t))},[t,d]);const x=(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]),_=(0,o.useCallback)((e,n)=>{x(),(0,r.d1)(t,l(e),n)},[t,x]),k=(0,o.useCallback)(()=>{(0,r.d1)(t,l("structure.insertText"),{text:""})},[t]),N=(0,o.useCallback)(e=>{if(!x())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 k();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,d={block:o.block,para:o.para,cell:o.cell,inline:o.inline};t.setSelection({anchor:(0,r.zf)({...d,offset:s}).anchor,focus:(0,r.zf)({...d,offset:a}).anchor}),k()},[t,x,k]),w=(0,o.useCallback)(e=>{x(),(0,r.d1)(t,l("structure.insertText"),{text:e})},[t,x]);return(0,o.useEffect)(()=>{const e=u.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 _("b"===e?"text.bold":"i"===e?"text.italic":"text.underline"))}return"Enter"===n.key?(n.preventDefault(),void _("structure.insertParagraph")):"Backspace"===n.key?(n.preventDefault(),void N(!0)):"Delete"===n.key?(n.preventDefault(),void N(!1)):void(1!==n.key.length||n.altKey||(n.preventDefault(),w(n.key)))}},o=t=>{const n=window.getSelection();n&&n.anchorNode&&e.contains(n.anchorNode)&&t.data&&w(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&&w(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,_,N,w]),(0,a.jsx)("div",{className:"docx-body",children:(0,a.jsx)("div",{className:"docx-pages",ref:u})})}var u=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,v]=(0,o.useState)(!1),b=(0,o.useRef)();return(0,o.useEffect)(()=>{if(!t)return;let e=!0;return m(!0),h(""),v(!1),l(void 0),(0,u.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(!b.current)return!1;const t=await(0,u.GB)(n,b.current(),e);return t&&v(!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)(d,{model:s,on_change:v,bind_save:e=>b.current=e})}},42562(e,t,n){n.d(t,{A:()=>s});var o=n(96540),r=n(85997),c=n(45907),i=n(74848);function s(e){const{name:t,dirty:n,loading:s,error:a,saving:l,on_save:d,on_close:u,children:f,extra:h}=e,p=(0,c.y)(),m=(0,o.useRef)(u),g=(0,o.useRef)(d),v=(0,o.useRef)(n);m.current=u,g.current=d,v.current=n;const b=()=>{v.current?p({title:"关闭",sub_title:"有未保存的修改,确定关闭吗?",confirm_fun:()=>m.current?.()}):m.current?.()};return(0,o.useEffect)(()=>{const e=e=>{(e.ctrlKey||e.metaKey)&&"s"===e.key.toLowerCase()?(e.preventDefault(),e.stopPropagation(),g.current?.(!1)):"Escape"===e.key&&b()};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,n&&(0,i.jsx)("span",{className:"office-editor__dirty",title:"有未保存的修改"})]}),(0,i.jsxs)("div",{className:"office-editor__ops",children:[h,l&&(0,i.jsx)("span",{className:"office-editor__saving",children:"保存中…"}),d&&(0,i.jsx)(r.rA,{icon:"save",title:"保存 (Ctrl+S)",onClick:()=>d()}),(0,i.jsx)(r.rA,{icon:"close",title:"关闭 (Esc)",onClick:b})]})]}),(0,i.jsxs)("div",{className:"office-editor__body",children:[s&&(0,i.jsx)("div",{className:"office-editor__tip",children:"加载中…"}),!s&&a&&(0,i.jsx)("div",{className:"office-editor__tip office-editor__tip--error",children:a}),!s&&!a&&f]})]})}},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:d(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 d(e){let t="";for(let n=0;n<e.length;n+=32768)t+=String.fromCharCode(...e.subarray(n,n+32768));return btoa(t)}}}]);
1
+ "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[26,1852],{21852(e,t,n){n.r(t),n.d(t,{default:()=>h});var o=n(96540),r=n(34843),c=n(82893),i=n(42562),s=n(26),a=n(99018),l=n(93245),d=n(23430),u=n(22022),f=n(74848);function h(){const{t:e}=(0,u.Bd)(),[t,n]=(0,r.fp)(c.AG.docx_editor),[h,p]=(0,o.useState)(!1),[m,g]=(0,o.useState)(!1),v=(0,o.useRef)(),b=async(t=!1)=>{if(!v.current)return!1;g(!0);try{return await v.current(t?"":e("保存成功"))}finally{g(!1)}},y=(0,o.useRef)(h);return y.current=h,(0,l.a)(d.nE.docx,()=>y.current,()=>b(!0)),(0,f.jsx)(i.A,{name:t.name,dirty:h,loading:!1,error:"",saving:m,on_save:b,on_close:()=>{const e=t.close;n({}),e?.()},children:t.url&&(0,f.jsx)(s.default,{url:t.url,save_path:(0,a.Vi)(t.name??""),on_dirty:p,bind_save:e=>v.current=e})})}},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 d(e){const{model:t,on_change:n,bind_save:d}=e,u=(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=u.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]),v=(0,o.useCallback)((e=!1)=>{const n=u.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 d=h.current,{heights:m,lines:g}=b(a.length,d),v=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,d);y(n,v,d)},[t]),b=(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)(()=>{v(!0);const e=t.subscribe(()=>{const e=u.current,t=window.getSelection(),o=!!(e&&t&&t.anchorNode&&e.contains(t.anchorNode));v(!1),o&&g(),n?.(!0)});return()=>{e()}},[t,v,g,n]),(0,o.useEffect)(()=>{d?.(()=>function(e){return(0,c.FoA)(e.document)}(t))},[t,d]);const x=(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]),k=(0,o.useCallback)((e,n)=>{x(),(0,r.d1)(t,l(e),n)},[t,x]),_=(0,o.useCallback)(()=>{(0,r.d1)(t,l("structure.insertText"),{text:""})},[t]),N=(0,o.useCallback)(e=>{if(!x())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 _();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,d={block:o.block,para:o.para,cell:o.cell,inline:o.inline};t.setSelection({anchor:(0,r.zf)({...d,offset:s}).anchor,focus:(0,r.zf)({...d,offset:a}).anchor}),_()},[t,x,_]),w=(0,o.useCallback)(e=>{x(),(0,r.d1)(t,l("structure.insertText"),{text:e})},[t,x]);return(0,o.useEffect)(()=>{const e=u.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 k("b"===e?"text.bold":"i"===e?"text.italic":"text.underline"))}return"Enter"===n.key?(n.preventDefault(),void k("structure.insertParagraph")):"Backspace"===n.key?(n.preventDefault(),void N(!0)):"Delete"===n.key?(n.preventDefault(),void N(!1)):void(1!==n.key.length||n.altKey||(n.preventDefault(),w(n.key)))}},o=t=>{const n=window.getSelection();n&&n.anchorNode&&e.contains(n.anchorNode)&&t.data&&w(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&&w(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,k,N,w]),(0,a.jsx)("div",{className:"docx-body",children:(0,a.jsx)("div",{className:"docx-pages",ref:u})})}var u=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,v]=(0,o.useState)(!1),b=(0,o.useRef)();return(0,o.useEffect)(()=>{if(!t)return;let e=!0;return m(!0),h(""),v(!1),l(void 0),(0,u.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(!b.current)return!1;const t=await(0,u.GB)(n,b.current(),e);return t&&v(!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)(d,{model:s,on_change:v,bind_save:e=>b.current=e})}},42562(e,t,n){n.d(t,{A:()=>s});var o=n(96540),r=n(85997),c=n(45907),i=n(74848);function s(e){const{name:t,dirty:n,loading:s,error:a,saving:l,on_save:d,on_close:u,children:f,extra:h}=e,p=(0,c.y)(),m=(0,o.useRef)(u),g=(0,o.useRef)(d),v=(0,o.useRef)(n);m.current=u,g.current=d,v.current=n;const b=()=>{v.current?p({title:"关闭",sub_title:"有未保存的修改,确定关闭吗?",confirm_fun:()=>m.current?.()}):m.current?.()};return(0,o.useEffect)(()=>{const e=e=>{(e.ctrlKey||e.metaKey)&&"s"===e.key.toLowerCase()?(e.preventDefault(),e.stopPropagation(),g.current?.(!1)):"Escape"===e.key&&b()};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,n&&(0,i.jsx)("span",{className:"office-editor__dirty",title:"有未保存的修改"})]}),(0,i.jsxs)("div",{className:"office-editor__ops",children:[h,d&&n&&(0,i.jsx)(r.rA,{icon:"save",title:"保存 (Ctrl+S)",onClick:()=>d()}),(0,i.jsx)(r.rA,{icon:"close",title:"关闭 (Esc)",onClick:b})]})]}),(0,i.jsxs)("div",{className:"office-editor__body",children:[!s&&a&&(0,i.jsx)("div",{className:"office-editor__tip office-editor__tip--error",children:a}),!s&&!a&&f]})]})}},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:d(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 d(e){let t="";for(let n=0;n<e.length;n+=32768)t+=String.fromCharCode(...e.subarray(n,n+32768));return btoa(t)}}}]);
@@ -1 +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}}}]);
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]=(0,a.fp)(o.AG.ebook_reader),[,te]=(0,a.fp)(o.AG.plain_editor),[se,ne]=(0,a.fp)(o.AG.file_preview),{t:ie}=(0,g.Bd)();let ae=(0,c.zy)();const le=(0,c.Zp)(),[oe,re]=(0,a.fp)(o.AG.nowFileList),[ce]=(0,a.fp)(o.AG.file_list_refresh),[de,_e]=(0,a.fp)(o.AG.current_mount),[he,pe]=(0,a.fp)(o.AG.showPrompt),[me,fe]=(0,a.fp)(o.AG.selectedFileList),[ue,xe]=(0,a.fp)(o.AG.clickFileList),[ge,ve]=(0,a.fp)(o.AG.fileShellShow),[we,je]=(0,n.useState)(""),[ye,ke]=(0,a.fp)(o.AG.workflow_show),[Ae,be]=(0,a.fp)(o.AG.workflow_realtime_show),[Ge,Ne]=(0,a.fp)(o.AG.work_flow_show),[Ce,Se]=(0,n.useState)(!1),{initUserInfo:Ie}=(0,n.useContext)(v.F),[Me,$e]=(0,a.fp)(o.AG.user_base_info),{check_user_auth:ze}=(0,w.MH)(),{click_file:Ee}=(0,m.kZ)(),[Pe]=(0,c.ok)(),Fe=(0,m._A)(),Re=n.useRef(null),[Xe,Ke]=(0,a.fp)(o.AG.to_running_files),[Le,De]=(0,a.fp)(o.AG.file_page),[Ue]=(0,a.fp)(o.AG.blank_search_mode),[,He]=(0,a.fp)(o.AG.prompt_card),[Be,Ze]=(0,a.fp)(o.AG.blank_search_mode_for_temp),Ye=(0,m.oT)(),Oe="1"===Pe.get("chat_open"),We=ze(G.oV.ai_agent_page),Te=(0,m.Cf)();(0,n.useEffect)(()=>{Me?.user_data&&Oe&&!We&&Ye("chat_open",null)},[Oe,We,Me]);const[qe,Ve]=(0,a.fp)(o.AG.studio_chat_width),Je=n.useRef(null),[Qe,et]=(0,n.useState)(!1),[tt,st]=(0,n.useState)(void 0),nt=(0,m.dN)();(0,m.rJ)(nt());const[it,at]=(0,a.fp)(o.AG.ai_chat_session_by_cwd),lt=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})}}(),ot=async e=>{let t=!1;for(const s of e.files??[])s.origin_size=s.size,s.size=(0,j.v7)(s.size),Me.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")||Se(!0),s.name===k.SB&&(t=!0);for(const s of e.folders??[])Me.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);Ne(t)},rt=async e=>{_e(e??null)};(0,n.useEffect)(()=>{Ce&&(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);Ke(new Set(t.running_file_list))}}),await A.ws.sendData(b.HK.workflow_realtime,e)})()},[Ge,Ce,de,ae]);const ct=async()=>{const e=(0,h.GG)("file",(0,h.vX)());if(Ue||Be)return;let t;if(Me.user_data.file_list_pagination_mode===G.yM.pagination){if(Q!==e){if(Q=e,1!==Le.page_num)return void De({page_size:Le.page_size,page_num:1})}else if(Le.page_num<0)return;if(t=await r.$M.post("file_get_page",{param_path:e,page_num:Le.page_num,page_size:Le.page_size}),t.code!==p.m.Success)return;const s=t.data;return ot(s),rt(s.mount_info),s.files?.length?(re(e=>{const t=(0,O.cloneDeep)(1===Le.page_num?s.files:[...e?.files??[],...s.files]),n={...e,files:t};return(0,m.yC)(n,Me.user_data.dir_show_type),n}),void(J=t.data)):void De({page_size:Le.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,Me.user_data.dir_show_type),ot(t.data),rt(s.mount_info),re(t.data),J=t.data};(0,n.useEffect)(()=>async()=>{Ke(new Set),de&&await A.ws.close()},[]);const dt=()=>{Ne(!1),(()=>{const e=Pe.get("preview_file_name"),t=Pe.get("preview_mode");if(!e||!t)return!1;const n=(0,h.GG)("file",(0,h.vX)());if(Re.current===n+e)return!0;Re.current=n+e;const i=()=>Fe(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:Pe.get("preview_log_enc")??"utf8",wrap:Pe.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):(Ee({name:e,opt_shell:!0,mode:t,..."text"===t?{model:"text"}:{},close:i}),!0)})()||(t({open:!1}),ne({open:!1}),s({}),x({show:!1}),M({}),P({}),F({}),R({}),L({}),D({}),U({}),B({}),ee({}),te({}),ct())};(0,n.useEffect)(()=>{dt()},[ae,Le]),(0,n.useEffect)(()=>{ce>0&&ct()},[ce]);n.useRef(!1);const _t=()=>{const e=(0,h.GG)("file",(0,h.vX)());He({open:!0,title:ie("深搜"),context_div:(0,E.jsx)(X,{base_path:e})})},ht=e=>{e.target===e.currentTarget&&(fe([]),xe([]))},pt=n.useCallback((0,O.throttle)(e=>{const t=Je.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);Ve(parseFloat((a/s).toFixed(2)))},32),[]),mt=()=>{et(!1),document.removeEventListener("pointermove",pt)},ft=(0,E.jsxs)("div",{className:"file-list-main",children:[(0,E.jsx)(i.e,{baseRoute:"file",clickFun:function(){if(fe([]),xe([]),Me.user_data.file_list_pagination_mode===G.yM.pagination){const e=document.getElementById("listing");e&&(e.scrollTop=0),De({page_size:Le.page_size,page_num:1})}},input_path_enter:e=>{fe([]),xe([]),re({files:[],folders:[]}),(0,N.Z1)(e)?(e=e.replace((0,Y.m)(Me.user_data),""),le(e)):le((0,N.Jn)((0,h.vX)(),e))}}),de&&(0,E.jsxs)("div",{className:"mount-tip-bar",style:{borderLeftColor:de.color},children:[(0,E.jsx)("span",{className:"material-icons",style:{color:de.color},children:"cloud"}),(0,E.jsx)("span",{children:[{v:de.driver,t:ie("驱动")},{v:de.credential_note,t:ie("凭据")},{v:de.account_note,t:ie("账号")}].filter(e=>Boolean(e.v)).map(e=>`${e.v}(${e.t})`).join(" - ")}),de.readonly&&(0,E.jsx)("span",{className:"mount-readonly-tag",children:ie("只读")})]}),Me.user_data.file_list_pagination_mode===G.yM.pagination?(0,E.jsx)(S.$J,{handleContextMenu:lt,clickBlank:ht,list:oe.files}):(0,E.jsx)(S.t$,{handleContextMenu:lt,file_list:oe.files,folder_list:oe.folders,clickBlank:ht})]});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:ie("搜索"),onClick:_t})}),(0,E.jsx)(f.$Z,{handleEnterPress:async()=>{if(Ue||Be){if(fe([]),xe([]),!we||!we.trim())return void re({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:we.trim()});if(t.code!==p.m.Success)return;const s=t.data;return(0,m.yC)(s,Me.user_data.dir_show_type),ot(s),re(s),void(J=s)}if(!J)return;fe([]),xe([]);const e=[],t=[];for(const t of J.files??[])t.name.includes(we)&&e.push(t);for(const e of J.folders??[])e.name.includes(we)&&t.push(e);re({files:e,folders:t})},placeholder:ie("搜索当前目录"),icon:"search",value:"",mobile_hidden:!0,handleIconClick:_t,handleInputChange:e=>{je(e)},max_width:"25em"})]}),(0,E.jsxs)(d.aZ,{position:"right",children:[ze(G.oV.ai_agent_page)&&Te.ai_chat_available&&(0,E.jsx)($.rA,{icon:"smart_toy",title:ie("AI 聊天"),selected:Oe,onClick:()=>Ye("chat_open",!Oe?"1":null)}),(0,E.jsx)("div",{className:"mobile-context-btn",children:(0,E.jsx)($.rA,{icon:"more_horiz",title:ie("右键"),onClick:()=>{const e=me[me.length-1];if(void 0!==e){const t=[...oe.folders??[],...oe.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,pe({show:!0,type:_.PromptEnum.FileMenu,overlay:!1,data:a})}}else{const e={preventDefault:()=>{},stopPropagation:()=>{},clientX:window.innerWidth/2,clientY:window.innerHeight/2};lt(e)}}})}),(0,E.jsx)(Z,{})]}),(0,E.jsxs)("div",{className:"file-list-split"+(Oe?" file-list-split--chat":""),children:[ft,Oe&&(0,E.jsxs)(n.Fragment,{children:[(0,E.jsx)("div",{className:"studio__divider studio__divider--chat",ref:Je,onPointerDown:e=>{e.preventDefault(),et(!0),document.addEventListener("pointermove",pt),document.addEventListener("pointerup",mt,{once:!0})}}),(0,E.jsx)("div",{className:"studio-chat-panel",style:{width:`${qe}em`},children:(0,E.jsx)(n.Suspense,{fallback:null,children:(0,E.jsx)(V,{inline_header:!0,sync_url:!1,file_cwd_path:nt(),session_id:tt??(ut=nt(),o.AG.get_ai_chat_session(it,ut)),on_session_change:e=>{st(e),((e,t)=>{at({...it,[e]:t})})(nt(),e)}})})})]})]}),Qe&&(0,E.jsx)("div",{className:"shell__overlay",onPointerUp:mt}),ye&&(0,E.jsx)(T,{}),Ae.open&&(0,E.jsx)(q,{})]});var ut}}}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[2539],{2539(e,t,a){a.d(t,{makeComicBook:()=>n});const n=async({entries:e,loadBlob:t,getSize:a,getComment:n},o)=>{const i=new Map,r=new Map,s=[".jpg",".jpeg",".png",".gif",".bmp",".webp",".svg",".jxl",".avif"],l=e.map(e=>e.filename).filter(e=>s.some(t=>e.endsWith(t))).sort();if(!l.length)throw new Error("No supported image files in archive");const c={};try{const e=JSON.parse(await n()||"")["ComicBookInfo/1.0"];if(e){const t=e.publicationYear,a=e.publicationMonth,n=a&&a>=1&&a<=12?String(a).padStart(2,"0"):null;c.metadata={title:e.title||o.name,publisher:e.publisher,language:e.language||e.lang,author:e.credits?e.credits.map(e=>`${e.person} (${e.role})`).join(", "):"",published:t&&a?`${t}-${n}`:void 0}}else c.metadata={title:o.name}}catch{c.metadata={title:o.name}}return c.getCover=()=>t(l[0]),c.sections=l.map(e=>({id:e,load:()=>(async e=>{if(i.has(e))return i.get(e);const a=URL.createObjectURL(await t(e)),n=URL.createObjectURL(new Blob([`<body style="margin: 0"><img src="${a}">`],{type:"text/html"}));return r.set(e,[a,n]),i.set(e,n),n})(e),unload:()=>(e=>{r.get(e)?.forEach?.(e=>URL.revokeObjectURL(e)),r.delete(e),i.delete(e)})(e),size:a(e)})),c.toc=l.map(e=>({label:e,href:e})),c.rendition={layout:"pre-paginated"},c.resolveHref=e=>({index:c.sections.findIndex(t=>t.id===e)}),c.splitTOCHref=e=>[e,null],c.getTOCFragment=e=>e.documentElement,c.destroy=()=>{for(const e of r.values())for(const t of e)URL.revokeObjectURL(t)},c}}}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[2698],{92188(e,s,i){i.d(s,{v:()=>c});var a=i(96540),t=i(74848);function c(e){const s=(0,a.useRef)(null),i=(0,a.useRef)(null);return(0,t.jsx)("div",{className:"image-ex-container",ref:s,style:{height:"100%"},children:(0,t.jsx)("img",{className:"image-ex-img image-ex-img-center",ref:i,src:e.path,alt:""})})}},82698(e,s,i){i.r(s),i.d(s,{default:()=>d});var a=i(96540),t=i(85997),c=i(57952),l=i(34843),n=i(82893),r=i(32768),o=i(92188),p=i(22022),u=i(74848);const f=a.lazy(()=>Promise.all([i.e(8772),i.e(6100)]).then(i.bind(i,69160)));function d(e){const{t:s}=(0,p.Bd)(),[i,a]=(0,l.fp)(n.AG.file_preview);if(!i.open)return;let d;switch(i.type){case r.Iw.video:d=(0,u.jsx)(f,{source:i.url,options:{autoplay:!1}});break;case r.Iw.image:d=(0,u.jsx)(o.v,{path:i.url});break;case r.Iw.pdf:d=(0,u.jsx)("object",{className:"pdf",data:i.url+"&show=1",type:"application/pdf"})}const h=(0,u.jsxs)("div",{id:"previewer",children:[(0,u.jsx)(c.A,{ignore_tags:!0,left_children:[(0,u.jsx)(t.rA,{title:s("取消"),icon:"close",onClick:function(){a({open:!1}),i?.close?.()}},1)]}),(0,u.jsx)("div",{className:"preview",children:d})]});return i.open&&h}}}]);
@@ -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),y=(0,r.useRef)(n);g.current=f,x.current=u,y.current=n;const p=()=>{y.current?m({title:"关闭",sub_title:"有未保存的修改,确定关闭吗?",confirm_fun:()=>g.current?.()}):g.current?.()};return(0,r.useEffect)(()=>{const e=e=>{(e.ctrlKey||e.metaKey)&&"s"===e.key.toLowerCase()?(e.preventDefault(),e.stopPropagation(),x.current?.(!1)):"Escape"===e.key&&p()};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,u&&n&&(0,o.jsx)(s.rA,{icon:"save",title:"保存 (Ctrl+S)",onClick:()=>u()}),(0,o.jsx)(s.rA,{icon:"close",title:"关闭 (Esc)",onClick:p})]})]}),(0,o.jsxs)("div",{className:"office-editor__body",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),y=(0,r.useRef)(),p=async(t=!1)=>{if(!y.current)return!1;x(!0);try{return await y.current(t?"":e("保存成功"))}finally{x(!1)}},_=(0,r.useRef)(h);return _.current=h,(0,i.a)(u.nE.excel,()=>_.current,()=>p(!0)),(0,d.jsx)(o.A,{name:t.name,dirty:h,loading:!1,error:"",saving:g,on_save:p,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=>y.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),y=new Array(l).fill(x),p=new Set;r.rowDimensions?.forEach((e,t)=>{t-1<y.length&&e.height&&(y[t-1]=c(e.height)),e.hidden&&t-1<l&&p.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:y,hidden_rows:p,merges:_}})}var y=n(74848);function p(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),p=(0,r.useRef)(null),[w,b]=(0,r.useState)({r0:0,r1:40,c0:0,c1:20});(0,r.useEffect)(()=>{let e=!0;return m(""),x(t).then(t=>e&&i(t)).catch(t=>e&&m(String(t?.message??t))),()=>{e=!1}},[t]);const S=(0,r.useCallback)(()=>{g.current||(g.current=!0,n(!0))},[n]);(0,r.useEffect)(()=>{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:p.current?.scrollLeft??0,scroll_top:p.current?.scrollTop??0}),set_state:e=>{"number"==typeof e.sheet&&e.sheet>=0&&e.sheet<c.length&&f(e.sheet);const t=p.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]),$=(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},N=(0,r.useCallback)(()=>{const e=p.current;if(!e||!j.length)return;const t=Math.max(0,$(j,e.scrollLeft)-1),n=Math.max(0,$(E,e.scrollTop)-1);b({c0:t,c1:Math.min(j.length-1,$(j,e.scrollLeft+e.clientWidth)+2),r0:n,r1:Math.min(E.length-1,$(E,e.scrollTop+e.clientHeight)+2)})},[j,E]);(0,r.useEffect)(()=>{N()},[C,N]);if(h)return(0,y.jsx)("div",{className:"office-editor__tip office-editor__tip--error",children:h});if(!c.length)return(0,y.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,y.jsxs)("div",{className:"xlsx-body",children:[(0,y.jsx)("div",{className:"xlsx-tabs",children:c.map((e,t)=>(0,y.jsx)("div",{className:"xlsx-tab "+(t===u?"xlsx-tab--active":""),onClick:()=>{f(t),p.current&&(p.current.scrollTop=0,p.current.scrollLeft=0)},children:e.title},e.title+t))}),(0,y.jsx)("div",{className:"xlsx-scroll",ref:p,onScroll:N,children:(0,y.jsxs)("div",{className:"xlsx-grid",style:{width:46+k,height:24+M},children:[Array.from({length:Math.max(0,w.c1-w.c0)}).map((e,t)=>{const n=w.c0+t;return(0,y.jsx)("div",{className:"xlsx-head",style:{left:46+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,y.jsxs)(r.Fragment,{children:[(0,y.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,y.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,y.jsx)("div",{className:`xlsx-cell ${n?.wrap?"xlsx-cell--wrap":""} ${l?"xlsx-cell--spill":""}`,style:{...s,...h,"--cell-h":n?.wrap?"1.4":s.height-1+"px"},onDoubleClick:()=>{u(t??""),a(!0)},children:c?(0,y.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,y.jsx)("span",{children:n.runs.map((e,t)=>(0,y.jsx)("span",{style:e.color?{color:e.color}:void 0,children:e.text},t))}):t})}function 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,y.jsx)("div",{className:"office-editor__tip office-editor__tip--error",children:a}):u||!o?(0,y.jsx)("div",{className:"office-editor__tip",children:"读取中…"}):(0,y.jsx)(p,{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([[3266],{23266(e,n,t){t.r(n),t.d(n,{default:()=>c});t(96540);var o=t(34843),r=t(82893),i=t(42562),a=t(94280),s=t(74848);function c(){const[e,n]=(0,o.fp)(r.AG.ebook_reader);return(0,s.jsx)(i.A,{name:e.name,on_close:()=>{const t=e.close;n({}),t?.()},children:(0,s.jsx)(a.A,{url:e.url,name:e.name})})}},94280(e,n,t){t.d(n,{A:()=>_});var o=t(96540),r=t(22022),i=t(57889),a=t(85997),s=t(85072),c=t.n(s),l=t(97825),d=t.n(l),f=t(77659),u=t.n(f),p=t(55056),m=t.n(p),v=t(10540),b=t.n(v),h=t(41113),k=t.n(h),g=t(41494),y={};y.styleTagTransform=k(),y.setAttributes=m(),y.insert=u().bind(null,"head"),y.domAPI=d(),y.insertStyleElement=b();c()(g.A,y);g.A&&g.A.locals&&g.A.locals;var w=t(74848);const x={epub:"application/epub+zip",mobi:"application/x-mobipocket-ebook",azw:"application/vnd.amazon.ebook",azw3:"application/vnd.amazon.ebook",fb2:"application/x-fictionbook+xml",fbz:"application/x-zip-compressed-fb2",cbz:"application/vnd.comicbook+zip"};function _(e){const{url:n,name:s}=e,{t:c}=(0,r.Bd)(),l=(0,o.useRef)(),d=(0,o.useRef)(null),[f,u]=(0,o.useState)(!0),[p,m]=(0,o.useState)(""),[v,b]=(0,o.useState)([]),[h,k]=(0,o.useState)(!1),[g,y]=(0,o.useState)(0),_=()=>{const e=l.current;if(e){l.current=void 0;try{e.close()}catch(e){}e.remove()}},j=e=>{let n=0;"ArrowLeft"===e.key||"ArrowUp"===e.key?n=-1:"ArrowRight"!==e.key&&"ArrowDown"!==e.key||(n=1),!n||e.ctrlKey||e.metaKey||e.altKey||(e.preventDefault(),e.stopPropagation(),n<0?l.current?.goLeft():l.current?.goRight())};return(0,o.useLayoutEffect)(()=>()=>{_()},[]),(0,o.useEffect)(()=>{if(!n)return;let e=!0;return _(),u(!0),m(""),b([]),y(0),(async()=>{await t.e(6930).then(t.bind(t,86930));const o=()=>{const e=customElements.get("foliate-paginator");if(!e||e.__render_patched)return;const n=e.prototype.render,t=new WeakMap;e.prototype.render=function(...e){const o=t.get(this);o&&cancelAnimationFrame(o),t.set(this,requestAnimationFrame(()=>{t.delete(this),n.apply(this,e)}))},e.__render_patched=!0};o();const r=await i.l.get_bytes_url(n),a=s??"book.epub",c=a.slice(a.lastIndexOf(".")+1).toLowerCase(),f=new File([r],a,{type:x[c]??"application/octet-stream"});if(!e||!d.current)return;const p=document.createElement("foliate-view");d.current.appendChild(p),l.current=p,p.addEventListener("relocate",e=>{const n=e.detail;"number"==typeof n?.fraction&&y(Math.round(100*n.fraction))}),p.addEventListener("load",e=>{const n=e.detail?.doc;n?.addEventListener("keydown",j,!0)}),await p.open(f),e&&(o(),await p.init({showTextStart:!0}),e&&(b(function(e){const n=[],t=(e,o)=>{for(const r of e)n.push({label:String(r.label??"").trim(),href:r.href,depth:o}),r.subitems?.length&&t(r.subitems,o+1)};return e?.length&&t(e,0),n}(p.book?.toc)),u(!1)))})().catch(n=>{e&&(m(String(n?.message??n)),u(!1))}),()=>{e=!1}},[n]),(0,o.useEffect)(()=>(document.addEventListener("keydown",j,!0),()=>{document.removeEventListener("keydown",j,!0)}),[]),(0,o.useEffect)(()=>{const e=e=>e.includes("ResizeObserver loop"),n=n=>{e(String(n.message??""))&&(n.stopImmediatePropagation(),n.preventDefault())},t=n=>{e(String(n.reason?.message??n.reason??""))&&(n.stopImmediatePropagation(),n.preventDefault())};return window.addEventListener("error",n,!0),window.addEventListener("unhandledrejection",t,!0),()=>{window.removeEventListener("error",n,!0),window.removeEventListener("unhandledrejection",t,!0)}},[]),(0,w.jsxs)("div",{className:"ebook-body",children:[(0,w.jsxs)("div",{className:"ebook-bar",children:[e.extra_left,(0,w.jsx)(a.rA,{icon:"toc",title:c("目录"),onClick:()=>k(!h)}),(0,w.jsx)(a.rA,{icon:"chevron_left",title:c("上一页"),onClick:()=>l.current?.goLeft()}),(0,w.jsxs)("span",{className:"ebook-progress",children:[g,"%"]}),(0,w.jsx)(a.rA,{icon:"chevron_right",title:c("下一页"),onClick:()=>l.current?.goRight()})]}),(0,w.jsx)("div",{className:"ebook-view",ref:d}),f&&(0,w.jsx)("div",{className:"ebook-loading",children:c("加载中")}),p&&(0,w.jsx)("div",{className:"ebook-loading",children:p}),h&&(0,w.jsx)("div",{className:"ebook-toc",children:v.map((e,n)=>(0,w.jsx)("div",{className:"ebook-toc__item",style:{paddingLeft:.5+.9*e.depth+"rem"},onClick:()=>{l.current?.goTo(e.href),k(!1)},children:e.label},n))})]})}},42562(e,n,t){t.d(n,{A:()=>s});var o=t(96540),r=t(85997),i=t(45907),a=t(74848);function s(e){const{name:n,dirty:t,loading:s,error:c,saving:l,on_save:d,on_close:f,children:u,extra:p}=e,m=(0,i.y)(),v=(0,o.useRef)(f),b=(0,o.useRef)(d),h=(0,o.useRef)(t);v.current=f,b.current=d,h.current=t;const k=()=>{h.current?m({title:"关闭",sub_title:"有未保存的修改,确定关闭吗?",confirm_fun:()=>v.current?.()}):v.current?.()};return(0,o.useEffect)(()=>{const e=e=>{(e.ctrlKey||e.metaKey)&&"s"===e.key.toLowerCase()?(e.preventDefault(),e.stopPropagation(),b.current?.(!1)):"Escape"===e.key&&k()};return document.addEventListener("keydown",e,!0),()=>document.removeEventListener("keydown",e,!0)},[]),(0,a.jsxs)("div",{className:"office-editor",children:[(0,a.jsxs)("div",{className:"office-editor__topbar",children:[(0,a.jsxs)("div",{className:"office-editor__name",children:[n,t&&(0,a.jsx)("span",{className:"office-editor__dirty",title:"有未保存的修改"})]}),(0,a.jsxs)("div",{className:"office-editor__ops",children:[p,d&&t&&(0,a.jsx)(r.rA,{icon:"save",title:"保存 (Ctrl+S)",onClick:()=>d()}),(0,a.jsx)(r.rA,{icon:"close",title:"关闭 (Esc)",onClick:k})]})]}),(0,a.jsxs)("div",{className:"office-editor__body",children:[!s&&c&&(0,a.jsx)("div",{className:"office-editor__tip office-editor__tip--error",children:c}),!s&&!c&&u]})]})}},41494(e,n,t){t.d(n,{A:()=>s});var o=t(31601),r=t.n(o),i=t(76314),a=t.n(i)()(r());a.push([e.id,"/* 电子书阅读器 */\n\n.ebook-body {\n /* 父级 .office-editor__body 是 block 布局,flex:1 不生效,必须给确定高度 */\n height: 100%;\n display: flex;\n position: relative;\n background: var(--background);\n}\n\n/* 操作条:浮在阅读区上方,不参与水位计算 */\n.ebook-bar {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n z-index: 2;\n display: flex;\n align-items: center;\n justify-content: flex-end;\n gap: .2rem;\n padding: .2rem .5rem;\n}\n\n.ebook-view {\n flex: 1;\n min-width: 0;\n height: 100%;\n display: flex;\n /* foliate-view 是自定义元素,给了类名才拿得到尺寸 */\n overflow: hidden;\n}\n\n.ebook-view foliate-view {\n display: block;\n width: 100%;\n height: 100%;\n flex: 1;\n /* layout 隔离:内部重排不外溢,避免 foliate 在 ResizeObserver 回调里\n 重排导致容器尺寸变化再触发通知,形成 loop 告警 */\n contain: layout;\n}\n\n.ebook-progress {\n font-size: .8em;\n color: var(--textSecondary);\n min-width: 2.6rem;\n text-align: center;\n}\n\n/* 加载遮罩:盖在阅读区上,不参与布局,避免遮住 foliate-view 导致 open() 拿不到尺寸 */\n.ebook-loading {\n position: absolute;\n inset: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n color: var(--textSecondary);\n background: var(--background);\n}\n\n.ebook-toc {\n width: 16rem;\n flex-shrink: 0;\n overflow-y: auto;\n border-left: 1px solid var(--divider);\n background: var(--surfacePrimary);\n padding: .5rem 0;\n}\n\n.ebook-toc__item {\n padding: .35rem .5rem;\n font-size: .85em;\n cursor: pointer;\n color: var(--textPrimary);\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n.ebook-toc__item:hover {\n background: var(--hover);\n}\n",""]);const s=a}}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[2515,3322],{42562(e,t,r){r.d(t,{A:()=>o});var n=r(96540),s=r(85997),c=r(45907),i=r(74848);function o(e){const{name:t,dirty:r,loading:o,error:a,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:[_,d&&r&&(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:[!o&&a&&(0,i.jsx)("div",{className:"office-editor__tip office-editor__tip--error",children:a}),!o&&!a&&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),o=r(72515),a=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)(o.default,{url:t.url,file_name:t.name??"",save_path:(0,a.Vi)(t.name??""),on_dirty:p,bind_save:e=>y.current=e})})}},72515(e,t,r){r.r(t),r.d(t,{default:()=>o});var n=r(96540),s=r(50610),c=r(99018),i=r(74848);function o(e){const{url:t,save_path:r,file_name:o,on_dirty:a,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:o,onSave:async e=>{const t=await(0,c.GB)(r,e,l.current);return t&&a?.(!1),t},autoSave:!1,compact:!0}),f.current=n,n.on("dirtychange",e=>{a?.(e.dirty)}))}).catch(e=>{i&&p(String(e?.message??e))}).finally(()=>i&&v(!1)),()=>{i=!1,n?.destroy(),f.current=void 0}},[t,o,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:()=>a,Vi:()=>o});var n=r(14284),s=r(57889),c=r(34289),i=r(62042);function o(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 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)}}}]);