filecat 7.20.5 → 7.21.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "filecat",
3
- "version": "7.20.5",
3
+ "version": "7.21.1",
4
4
  "description": "A self-hosted Web File browser and lightweight server management tool.",
5
5
  "author": "xiaobaidadada",
6
6
  "repository": {
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[1075,4877],{69918(t,e,n){n.d(e,{Ce:()=>i,FG:()=>r.FG,fy:()=>c,gC:()=>a});var r=n(18840),o=n(14284),s=n(53459);async function a(){try{const t=await o.XO.get("md_editor_setting/get");return{...r.FG,...t?.data??{}}}catch(t){return{...r.FG}}}async function c(t){const e=await o.XO.post("md_editor_setting/save",t);return e?.code!==s.m.Success?null:{...r.FG,...e.data??t}}function i(t,e){t&&(t.style.setProperty("--md-editor-max-width",e.content_max_width),t.style.setProperty("--md-editor-padding",e.content_padding),t.style.setProperty("--md-editor-font-size",e.font_size),t.style.setProperty("--md-editor-line-height",e.line_height))}},64877(t,e,n){n.r(e),n.d(e,{default:()=>a});var r=n(96540),o=n(22022),s=n(74848);function a(t){const{t:e}=(0,o.Bd)(),[n,a]=(0,r.useState)(new Set),c=(0,r.useMemo)(()=>function(t){const e=[],n=[];for(const r of t){const t={...r,children:[]};for(;n.length>0&&n[n.length-1].level>=t.level;)n.pop();0===n.length?e.push(t):n[n.length-1].children.push(t),n.push(t)}return e}(t.items),[t.items]),i=(r,o)=>r.map(r=>{const c=r.children.length>0,l=n.has(r.pos),d=r.pos===t.active_pos;return(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:`md-outline-item md-outline-item--h${r.level}${d?" md-outline-item--active":""}`,style:{paddingLeft:.4+.75*o+"em"},title:r.text,onClick:()=>t.on_click(r),children:[(0,s.jsx)("i",{className:"material-icons md-outline-arrow"+(c?"":" md-outline-arrow--empty"),onClick:c?t=>{return e=r.pos,t.stopPropagation(),void a(t=>{const n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n});var e}:void 0,children:c?l?"arrow_right":"arrow_drop_down":""}),(0,s.jsx)("span",{className:"md-outline-text",children:r.text||e("未命名标题")})]}),c&&!l&&i(r.children,o+1)]},r.pos)});return 0===t.items.length?(0,s.jsx)("div",{className:"md-outline md-outline--empty",children:(0,s.jsx)("div",{className:"md-outline-tip",children:e("no_head")})}):(0,s.jsx)("div",{className:"md-outline",children:(0,s.jsx)("div",{className:"md-outline-list",children:i(c,0)})})}},76118(t,e,n){n.d(e,{A:()=>mt});var r=n(96540),o=n(22022),s=n(34843),a=n(82893),c=n(42845),i=n(1575),l=n(58903),d=n(89781),u=n(61396),h=n(46762),m=n(73337),p=n(89552),f=n(86059),g=n(5091),_=n(23802),b=n(41105),k=n(99724);const y=new _.A({html:!0,linkify:!0,breaks:!1,typographer:!1});function v(t){return t.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}y.renderer.rules.html_block=(t,e)=>`<div data-html-block="${(0,b.pC)(t[e].content)}"></div>`,y.renderer.rules.html_inline=(t,e)=>`<span data-html-inline="${(0,b.pC)(t[e].content)}"></span>`,y.renderer.rules.fence=(t,e)=>{const n=t[e],r=n.info?n.info.trim().split(/\s+/)[0]:"",o=n.content.replace(/\n$/,""),s=y.utils.escapeHtml(o),a=r?` class="language-${v(r)}"`:"";return`<pre${r?` data-language="${v(r)}"`:""}><code${a}>${s}</code></pre>\n`},y.inline.ruler.before("escape","math_inline",function(t,e){const n=t.pos,r=t.src,o=[{open:"\\(",close:"\\)"},{open:"$",close:"$"}];if(r.startsWith("$$",n))return!1;for(const s of o){if(!r.startsWith(s.open,n))continue;const o=n+s.open.length,a=r.indexOf(s.close,o);if(a<0)continue;const c=r.slice(o,a);if(c.trim()){if("$"===s.open){const t=r[a+1];if(void 0!==t&&/\d/.test(t))continue}if(!e){const e=t.push("math_inline","span",0);e.content=c,e.markup=s.open,e.meta={raw:r.slice(n,a+s.close.length)}}return t.pos=a+s.close.length,!0}}return!1}),y.block.ruler.before("fence","math_block",function(t,e,n,r){const o=t.bMarks[e]+t.tShift[e],s=t.eMarks[e],a=t.src.slice(o,s).trim(),c=[{open:"\\[",close:"\\]"},{open:"$$",close:"$$"}];for(const s of c){if(!a.startsWith(s.open))continue;if(a.endsWith(s.close)&&a.length>s.open.length+s.close.length){if(r)return!0;const n=a.slice(s.open.length,a.length-s.close.length),o=t.push("math_block","div",0);return o.content=n,o.markup=s.open,o.meta={raw:a},o.map=[e,e+1],t.line=e+1,!0}const c=a.slice(s.open.length);for(let a=e+1;a<n;a++){const n=t.bMarks[a]+t.tShift[a],i=t.eMarks[a],l=t.src.slice(n,i);if(!l.trimEnd().endsWith(s.close))continue;if(r)return!0;const d=[c,...t.getLines(e+1,a,t.tShift[e],!1).split("\n")].filter((t,e)=>!(0===e&&!t.trim())),u=l.trimEnd().slice(0,-s.close.length);d.push(u);const h=t.push("math_block","div",0);return h.content=d.join("\n").trim(),h.markup=s.open,h.map=[e,a+1],h.meta={raw:t.src.slice(o,t.eMarks[a]).trimEnd()},t.line=a+1,!0}}return!1},{alt:["paragraph","reference","blockquote","list"]}),y.renderer.rules.math_inline=(t,e)=>`<span data-math-inline="${(0,b.pC)(t[e].meta.raw)}"></span>`,y.renderer.rules.math_block=(t,e)=>`<div data-math-block="${(0,b.pC)(t[e].meta.raw)}"></div>`;const w=y.renderer.rules.fence;function $(t){const e=y.render(t??""),n=(new DOMParser).parseFromString(e,"text/html");return l.S4.fromSchema(g.Y).parse(n.body)}function M(t){let e="";return t.forEach(t=>{if(t.isText){let n=t.marks.some(t=>"code"===t.type.name)?t.text??"":function(t){return t.replace(/([\\`*_<>])/g,"\\$1")}(t.text??"");for(const e of t.marks)switch(e.type.name){case"code":n=`\`${t.text??""}\``;break;case"strong":n=`**${n}**`;break;case"em":n=`*${n}*`;break;case"strike":n=`~~${n}~~`;break;case"link":n=`[${n}](${e.attrs.href}${e.attrs.title?` "${e.attrs.title}"`:""})`}e+=n}else if("image"===t.type.name){const{src:n,alt:r,title:o}=t.attrs;e+=`![${r??""}](${n}${o?` "${o}"`:""})`}else"hard_break"===t.type.name?e+=" \n":"html_inline"===t.type.name?e+=t.attrs.value:"math_inline"===t.type.name&&(e+=t.attrs.raw)}),e}function x(t){const e=[];if(t.forEach(t=>{const n=[],r=[];t.forEach(t=>{var e;n.push((e=t.textContent,e.replace(/\|/g,"\\|").replace(/\n/g," ")).trim()),r.push("table_header"===t.type.name)}),e.push({cells:n,header_flags:r})}),0===e.length)return"";const n=Math.max(...e.map(t=>t.cells.length)),r=e[0].header_flags.some(t=>t),o=Array.from({length:n},(t,n)=>Math.max(3,...e.map(t=>A(t.cells[n]??"")))),s=t=>`| ${Array.from({length:n},(e,n)=>{return r=t[n]??"",s=o[n],r+" ".repeat(Math.max(0,s-A(r)));var r,s}).join(" | ")} |`,a=[];if(r){a.push(s(e[0].cells)),a.push(`| ${o.map(t=>"-".repeat(t)).join(" | ")} |`);for(let t=1;t<e.length;t++)a.push(s(e[t].cells))}else{a.push(s(new Array(n).fill(""))),a.push(`| ${o.map(t=>"-".repeat(t)).join(" | ")} |`);for(const t of e)a.push(s(t.cells))}return a.join("\n")}function A(t){let e=0;for(const n of t){const t=n.codePointAt(0)??0;e+=t>=4352&&t<=4447||t>=11904&&t<=42191||t>=44032&&t<=55203||t>=63744&&t<=64255||t>=65072&&t<=65135||t>=65280&&t<=65376||t>=65504&&t<=65510?2:1}return e}function E(t,e=""){switch(t.type.name){case"paragraph":default:return e+M(t);case"heading":return`${e}${"#".repeat(t.attrs.level)} ${M(t)}`;case"blockquote":return O(t,"").split("\n").map(t=>`${e}> ${t}`).join("\n");case"code_block":{const n=t.attrs.language??"",r=t.textContent;let o=3;for(const t of r.match(/`+/g)??[])o=Math.max(o,t.length+1);const s="`".repeat(o),a=r.split("\n").map(t=>e+t).join("\n");return`${e}${s}${n}\n${a}\n${e}${s}`}case"horizontal_rule":return`${e}---`;case"html_block":return t.attrs.value.replace(/\n+$/,"").split("\n").map(t=>e+t).join("\n");case"math_block":return t.attrs.raw.replace(/\n+$/,"").split("\n").map(t=>e+t).join("\n");case"bullet_list":{const n=[];return t.forEach((t,r,o)=>{n.push(S(t,e,`${e}- `,`${e} `,o))}),n.join("\n")}case"ordered_list":{const n=[],r=t.attrs.order??1;return t.forEach((t,o,s)=>{n.push(S(t,e,`${e}${r+s}. `,`${e} `,s))}),n.join("\n")}case"table":return x(t).split("\n").map(t=>e+t).join("\n")}}function S(t,e,n,r,o){const s=t.attrs.checked,a=null===s?"":s?"[x] ":"[ ] ",c=[];t.forEach((t,e,n)=>{c.push(E(t,0===n?"":r))});const i=c.join("\n").split("\n");return n+a+i[0]+(i.length>1?"\n"+i.slice(1).join("\n"):"")}function O(t,e=""){const n=[];return t.forEach(t=>{n.push(E(t,e))}),n.join("\n\n")}function D(t){return O(t).trim()+"\n"}function C(t){const e=[];if(t.content.forEach(t=>e.push(t)),1===e.length&&"code_block"===e[0].type.name&&"markdown"===e[0].attrs.language)return e[0].textContent;const n=t.openStart??0,r=t.openEnd??0;return 1===e.length&&1===n&&1===r?N(t.content):O(t.content)}function N(t){const e=[];t.forEach(t=>{["ordered_list","bullet_list","list_item","blockquote"].includes(t.type.name)?e.push(N(t)):e.push(E(t,""))});const n=t.type&&("ordered_list"===t.type.name||"bullet_list"===t.type.name);return e.join(n?"\n":"\n\n")}y.renderer.rules.fence=(t,e,n,r,o)=>{const s=t[e],a=s.info.trim().toLowerCase();return(0,k.lG)(a)?`<div data-math-block="${(0,b.pC)(`$$\n${s.content.trim()}\n$$`)}"></div>`:w(t,e,n,r,o)};n(64877);var L=n(19878);const z=new c.hs("md_source_highlight");function j(t,e,n){let r=e;for(const e of t){if("string"==typeof e){r+=e.length;continue}const t=r;Array.isArray(e.children)&&(r=j(e.children,r,n)),e.scope&&n.push({from:t,to:r,cls:`hljs-${e.scope}`})}return r}function T(t,e){const n=t.textContent;if(!n)return[];const r=t.attrs.language??"";if(!r||!L.A.getLanguage(r))return[];let o;try{o=L.A.highlight(n,{language:r,ignoreIllegals:!0})}catch{return[]}const s=[],a=o._emitter?.rootNode;a?.children&&j(a.children,0,s);const c=e+1,l=[];for(const t of s){const e=Math.min(t.from,n.length),r=Math.min(t.to,n.length);e>=r||l.push(i.NZ.inline(c+e,c+r,{class:t.cls}))}return l}function R(){return new c.k_({key:z,props:{decorations(t){const e=function(t){const e=[];return t.descendants((t,n)=>"code_block"!==t.type.name||(e.push(...T(t,n)),!1)),i.zF.create(t,e)}(t.doc);return e.find().length?e:null}}})}var V=n(89117),P=n(86063),G=n(89871);const I=new c.hs("md-graph"),q=new Map,F=new Map,W=new Map,H=new Map;function B(t,e){return`${t}\0${e}`}function K(t,e,n){return(r,o)=>{const s=B(r,o),a=t.get(s);if(a)return Promise.resolve(a);let c=e.get(s);return c||(c=n(r,o).then(n=>(t.set(s,n),e.delete(s),n)),e.set(s,c)),c}}const U=K(q,F,(t,e)=>(0,V.U6)(t,e)),J=K(W,H,(t,e)=>(0,P.Hn)(e));function X(t,e){const n=document.createElement("button");return n.className="md-graph__edit",n.type="button",n.textContent=G.Ay.t("clk_edt"),n.addEventListener("click",n=>{n.stopPropagation(),function(t,e){if(!t)return;const n=Math.min(e+1,t.state.doc.content.size);t.dispatch(t.state.tr.setSelection(c.U3.near(t.state.doc.resolve(n),1))),t.focus()}(t(),e)}),n}function Y(t,e){if(e.error)return t.className="md-graph__body",void(t.textContent=e.error);t.className="md-graph__body",t.innerHTML=e.svg}function Z(t,e,n,r){const o=document.createElement("div");o.className="md-graph",o.setAttribute("contenteditable","false");const s=document.createElement("div");s.className="md-graph__body",s.addEventListener("click",()=>{const n=q.get(B(e,t));n&&!n.error&&n.svg&&function(t){const e=document.createElement("div");e.className="md-graph-zoom";const n=document.createElement("div");let r;n.className="md-graph-zoom__body";const o=document.createElement("button");o.className="md-graph-zoom__close",o.type="button",o.title=G.Ay.t("取消"),o.innerHTML='<i class="material-icons">close</i>';const s=t=>{"Escape"===t.key&&a()};function a(){"function"==typeof r&&r(),document.removeEventListener("keydown",s),e.remove()}e.addEventListener("click",t=>{t.target===e&&a()}),o.addEventListener("click",a),document.addEventListener("keydown",s),e.append(n,o),document.body.appendChild(e),r=t(n)}(t=>{t.innerHTML=n.svg})}),o.append(s,X(r,n));const a=q.get(B(e,t));return a?(a.error&&o.classList.add("md-graph--error"),Y(s,a),o):(o.classList.add("md-graph--loading"),s.textContent=G.Ay.t("rendering"),U(e,t).then(t=>{o.isConnected&&(o.classList.remove("md-graph--loading"),t.error&&o.classList.add("md-graph--error"),Y(s,t))}),o)}function Q(t,e,n){const r=[],{from:o,to:s}=t.selection;return t.doc.descendants((t,a)=>{if("code_block"!==t.type.name)return;const c=t.attrs.language,l=(0,V.Hm)(c),d=(0,P.hj)(c);if(!l&&!d)return;const u=a,h=a+t.nodeSize;if(function(t,e,n,r){return t<=r&&e>=n}(o,s,u,h))return;const m=t.textContent;if(!m.trim())return;r.push(i.NZ.node(u,h,{class:"md-graph-hidden"}));const p=`graph-${c}-${u}-${m}`;d?r.push(i.NZ.widget(h,()=>function(t,e,n,r,o){const s=document.createElement("div");s.className="md-graph md-graph--mind",s.setAttribute("contenteditable","false"),s.textContent=G.Ay.t("rendering");const a=X(r,n);let c=null;return s.__unmount=()=>{c?.destroy(),c=null},J(e,t).then(t=>{s.isConnected&&(s.textContent="",s.append(a),t.mount(s).then(t=>{s.isConnected?c=t:t.destroy()}).catch(t=>{console.error("[mind] mount failed",t)}))}),s.addEventListener("click",()=>{o?.(t,e=>function(t,e,n,r){if(!t||r===n)return;const o=t.state.doc;let s=null;const a=o.nodeAt(e);if(a&&"code_block"===a.type.name&&a.textContent===n?s={from:e+1,to:e+a.nodeSize-1}:o.descendants((t,e)=>!(s||"code_block"===t.type.name&&"smm-mind"===t.attrs.language&&t.textContent===n&&(s={from:e+1,to:e+t.nodeSize-1},1))),!s)return;const c=t.state.tr.replaceWith(s.from,s.to,t.state.schema.text(r));t.dispatch(c)}(r(),n,t,e))}),s}(m,c,u,e,n),{side:-1,ignoreSelection:!0,key:p,destroy:t=>t.__unmount?.()})):r.push(i.NZ.widget(h,()=>Z(m,c,u,e),{side:-1,ignoreSelection:!0,key:p}))}),i.zF.create(t.doc,r)}function tt(t){let e=null;return new c.k_({key:I,props:{decorations(n){const r=Q(n,()=>e,t);return r.find().length?r:null}},view:t=>(e=t,{destroy(){e=null}})})}const et=new Map;class nt{dom;node;view;get_pos;render_box;source_input;editing=!1;draft=null;painted_raw="";constructor(t,e,n){this.node=t,this.view=e,this.get_pos=n;const r="math_block"===t.type.name;this.dom=document.createElement(r?"div":"span"),this.dom.className=r?"md-math md-math--block":"md-math md-math--inline",this.dom.setAttribute("contenteditable","false"),this.render_box=document.createElement("span"),this.render_box.className="md-math__render",this.source_input=document.createElement("textarea"),this.source_input.className="md-math__source",this.source_input.setAttribute("spellcheck","false"),this.source_input.setAttribute("wrap","off"),this.source_input.setAttribute("rows","1"),this.dom.append(this.render_box,this.source_input),function(t,e){et.set(t,e)}(n(),this),this.source_input.addEventListener("input",()=>{this.draft=this.source_input.value,this.auto_size()}),this.source_input.addEventListener("blur",()=>this.commit()),this.source_input.addEventListener("keydown",t=>{t.stopPropagation(),"Escape"===t.key&&(t.preventDefault(),this.draft=null,this.set_editing(!1))});for(const t of["beforeinput","paste","input","keyup","keypress"])this.source_input.addEventListener(t,t=>t.stopPropagation());this.render_box.addEventListener("mousedown",t=>{t.preventDefault(),t.stopPropagation(),this.focus_source()}),this.paint(t)}paint(t){const e=t.attrs.raw;if(this.editing)return this.dom.setAttribute("data-mode","source"),null===this.draft&&(this.source_input.value=e),void this.auto_size();if(this.dom.setAttribute("data-mode","preview"),this.painted_raw===e)return;this.painted_raw=e;const n=this.render_box;n.classList.add("md-math--loading"),n.textContent="",n.textContent=e,(0,k.z$)(n,t.attrs.tex,"math_block"===t.type.name?"block":"inline",e)}auto_size(){const t=this.source_input;t.style.height="0px",t.style.height=`${t.scrollHeight}px`}focus_source(){this.editing||(this.set_editing(!0),this.source_input.focus(),this.source_input.setSelectionRange(this.source_input.value.length,this.source_input.value.length))}set_editing(t){this.editing!==t&&(this.editing=t,this.paint(this.node))}set_selected(t){t?this.focus_source():this.editing&&(this.commit(),this.set_editing(!1))}commit(){if(null===this.draft)return;const t=this.draft;if(this.draft=null,t===this.node.attrs.raw)return;const e=this.get_pos(),n=this.view.state.doc.nodeAt(e);if(!n)return;const r=(0,k.V)(t),o=r?.tex??t;this.view.dispatch(this.view.state.tr.setNodeMarkup(e,void 0,{...n.attrs,raw:t,tex:o})),this.painted_raw=""}update(t){if(t.type!==this.node.type)return!1;const e=t.attrs.raw!==this.node.attrs.raw;return this.node=t,e&&(this.draft=null,this.painted_raw=""),this.paint(t),!0}stopEvent(t){return this.dom.contains(t.target)}ignoreMutation(){return!0}destroy(){this.draft=null,function(t){for(const[e,n]of et)if(n===t)return void et.delete(e)}(this)}}function rt(t){const e=t.state.selection,n=e.from,r=e.to;for(const[t,e]of et){const o=r>t&&n<=t+1;e.set_selected(o)}}var ot=n(67951),st=(n(41631),n(50576),n(70432),n(74848));function at(t){return 0===t?(0,ot.uf)("paragraph"):(0,ot.uf)("heading",{level:t})}function ct(t){return!(!t.ctrlKey&&!t.metaKey)}function it(t,e){let n=null;try{const r=t.domAtPos(e).node,o=1===r.nodeType?r:r.parentElement;n=o?o.closest(".md-filecat-content > *")??o:null}catch{}if(!n)return;const r=n.closest(".md-editor-scroll");if(!r)return;const o=parseFloat(getComputedStyle(n).scrollMarginTop)||0,s=r.scrollTop+n.getBoundingClientRect().top-r.getBoundingClientRect().top-o,a=r.scrollHeight-r.clientHeight;!function(t,e){const n=t.scrollTop,r=e-n;if(Math.abs(r)<1)return;const o=performance.now(),s=e=>{const a=Math.min(1,(e-o)/500);t.scrollTop=n+r*(1-Math.pow(1-a,3)),a<1&&requestAnimationFrame(s)};requestAnimationFrame(s)}(r,Math.max(0,Math.min(s,a)))}function lt(t,e){return(0,f.D8)(1)(t,e)}const dt=r.forwardRef(function(t,e){const{t:n}=(0,o.Bd)(),_=(0,r.useRef)(null),k=(0,r.useRef)(null),[,y]=(0,s.fp)(a.AG.mind_editor),v=(0,r.useRef)(t.on_change),w=(0,r.useRef)(t.on_save),M=(0,r.useRef)(t.on_selection_change),x=(0,r.useRef)(t.on_source_mode_change),A=(0,r.useRef)();return A.current=(t,e)=>{y({name:n("思维导图"),code_source:t,on_save_code:t=>e(t)})},(0,r.useEffect)(()=>{v.current=t.on_change,w.current=t.on_save,M.current=t.on_selection_change,x.current=t.on_source_mode_change}),(0,r.useEffect)(()=>{if(!_.current)return;g.Y;(0,b.sL)(t.doc_path?t.doc_path.replace(/[^/]*$/,""):"");const n=c.$t.create({doc:$(t.value??""),plugins:[(0,d.b6)(),R(),tt((t,e)=>A.current?.(t,e)),new c.k_({view:t=>(rt(t),{update:(t,e)=>{t.state.selection===e.selection&&t.state.doc===e.doc||rt(t)}})}),(0,ot.k5)(),(0,u.w)({"Mod-a":ot.Rx,"Mod-z":d.tN,"Mod-y":d.ZS,"Mod-Shift-z":d.ZS,"Mod-b":(0,ot.NH)("strong"),"Mod-i":(0,ot.NH)("em"),"Mod-Shift-x":(0,ot.NH)("strike"),"Mod-`":(0,ot.NH)("code"),"Mod-1":(t,e)=>at(1)(t,e),"Mod-2":(t,e)=>at(2)(t,e),"Mod-3":(t,e)=>at(3)(t,e),"Mod-0":(t,e)=>at(0)(t,e),"Mod-Shift-8":ot.fK,"Mod-Shift-9":ot.oB,"Mod-Shift-.":ot.Vu,Tab:ot.G8.sink,"Shift-Tab":ot.G8.lift,"Mod-Enter":lt,"Mod-s":()=>(w.current?.(),!0)}),(0,f.LF)({allowTableNodeSelection:!0}),(0,f.AL)(),(0,m.A)({color:"var(--primary, #1a73e8)",width:2}),(0,p.z)(),(0,u.w)({Enter:(0,h.st)(ot.x0,h.pC,ot.G8.split,h.Z1,h.iz,h.aw),"Shift-Enter":(t,e)=>{const{hard_break:n}=t.schema.nodes;return e&&e(t.tr.replaceSelectionWith(n.create()).scrollIntoView()),!0},"Mod-Enter":h.I$}),(0,u.w)(h.RV)]}),r=t=>t.setAttribute("data-img-error",""),o=t=>"IMG"===t.tagName&&!t.classList.contains("ProseMirror-separator"),s=t=>{const e=t.target;"IMG"===e?.tagName&&o(e)&&r(e)},a=t=>{const e=t.target;"IMG"===e?.tagName&&o(e)&&(t=>{t.removeAttribute("data-img-error")})(e)},y=_.current;y.addEventListener("error",s,!0),y.addEventListener("load",a,!0);const E=()=>{y.querySelectorAll("img").forEach(t=>{if(!o(t))return;const e=t;e.dataset.imgSeen||(e.dataset.imgSeen="1",e.complete?0===e.naturalWidth&&r(e):r(e))})},S=new MutationObserver(()=>{requestAnimationFrame(E)});S.observe(y,{childList:!0,subtree:!0}),E();let O=null;if(O=new i.Lz(_.current,{state:n,editable:()=>!1!==t.editable,nodeViews:{...(0,b.op)(),math_block:(t,e,n)=>new nt(t,e,n),math_inline:(t,e,n)=>new nt(t,e,n)},handleClickOn(t,e,n,r,o){if(!ct(o))return!1;const s=function(t){if(!(t instanceof Element))return null;const e=t.closest("a[href]"),n=e?.getAttribute("href");return n||null}(o.target)??function(t,e){const n=t.doc.content.size,r=Math.max(0,Math.min(e,n));let o;try{o=t.doc.resolve(r)}catch{return null}for(const e of[1,-1]){const o=1===e?r:r-1;if(!(o<0||o>=n))try{const e=t.doc.resolve(o).marks().find(t=>"link"===t.type.name);if(e?.attrs?.href)return e.attrs.href}catch{}}try{const t=o.parent.marks.find(t=>"link"===t.type.name);if(t?.attrs?.href)return t.attrs.href}catch{}return null}(t.state,e);return!!s&&(window.open(s,"_blank","noopener,noreferrer"),!0)},clipboardTextSerializer:t=>C(t),handlePaste(t,e){const n=e.clipboardData?.getData("text/plain");if(!n)return!1;const{from:r,to:o}=t.state.selection;if(ht(t.state.doc,r)&&ht(t.state.doc,o))return t.dispatch(t.state.tr.insertText(n.replace(/\r\n?/g,"\n"),r,o).scrollIntoView()),!0;const s=e.clipboardData?.getData("text/html");if(s&&function(t){if(!t)return!1;try{const e=(new DOMParser).parseFromString(t,"text/html"),n=Array.from(e.body.children);return 1===n.length&&"PRE"===n[0].tagName}catch{return!1}}(s)){const e=$(n);return t.dispatch(t.state.tr.replaceSelection(new l.Ji(e.content,0,0)).scrollIntoView()),!0}return!1},handleDOMEvents:{keydown:(t,e)=>{if(ct(e)&&t.dom.classList.add("md-ctrl-down"),ut(t.state.doc)&&"Enter"===e.key&&!e.ctrlKey&&!e.metaKey&&!e.altKey){e.preventDefault();const{from:n,to:r}=t.state.selection;return t.dispatch(t.state.tr.insertText("\n",n,r).scrollIntoView()),!0}return!1},keyup:(t,e)=>(ct(e)||t.dom.classList.remove("md-ctrl-down"),!1),blur:t=>(t.dom.classList.remove("md-ctrl-down"),!1),beforeinput:(t,e)=>{if(!ut(t.state.doc))return!1;const n=e;if("insertText"!==n.inputType)return!1;const r=n.data;if(null==r)return!1;n.preventDefault();const{from:o,to:s}=t.state.selection;return t.dispatch(t.state.tr.insertText(r.replace(/\r\n?/g,"\n"),o,s).scrollIntoView()),!0}},dispatchTransaction(t){const e=O.state.apply(t);O.updateState(e);const n=ut(e.doc);n?O.dom.classList.add("md-source-mode"):O.dom.classList.remove("md-source-mode"),n!==ut(t.before)&&x.current?.(n),t.docChanged&&v.current?.(n?e.doc.textContent:D(e.doc)),(t.selectionSet||t.docChanged)&&M.current?.()},attributes:{class:"md-filecat-content",spellcheck:"false"}}),k.current=O,t.initial_source_mode&&!ut(O.state.doc)){const t=D(O.state.doc),e=O.state.schema.nodes.code_block.create({language:"markdown"},t?O.state.schema.text(t):null),n=O.state.tr;n.replaceWith(0,O.state.doc.content.size,e),n.setMeta("addToHistory",!1),O.dispatch(n)}const N={get_markdown:()=>ut(O.state.doc)?O.state.doc.textContent:D(O.state.doc),set_markdown:t=>{const e=$(t);O.dispatch(O.state.tr.replaceWith(0,O.state.doc.content.size,e.content))},focus:()=>O.focus(),get_view:()=>k.current,in_table:()=>function(t){const{$from:e}=t.selection;for(let t=e.depth;t>0;t--){if("table"===e.node(t).type.name)return!0}return!1}(O.state),active_marks:()=>(O.state.storedMarks??O.state.selection.$from.marks()).map(t=>t.type.name),active_block:()=>{const{$from:t}=O.state.selection;for(let e=t.depth;e>0;e--){const n=t.node(e);if("heading"===n.type.name)return{name:"heading",level:n.attrs.level};if("paragraph"===n.type.name)return{name:"paragraph"}}return{name:"paragraph"}},insert_table:(t=3,e=3)=>{const n=function(t,e,n){const r=(0,f.e)(t),o=r.table,s=r.row,a=r.cell,c=r.header_cell??r.cell;if(!o||!s||!a)return null;const i=t=>s.create(null,Array.from({length:e},()=>t.createAndFill())),l=i(c),d=Array.from({length:n},()=>i(a));return o.create(null,[l,...d])}(O.state.schema,t,e);if(!n)return;const{from:r}=O.state.selection,o=O.state.doc.resolve(r);let s=r;for(let t=o.depth;t>0;t--)if("table"===o.node(t).type.name){s=o.after(t);break}const a=O.state.tr;s===r?a.replaceSelectionWith(n):a.insert(s,n),O.dispatch(a.scrollIntoView());const c=O.state.doc.resolve(Math.min(s+3,O.state.doc.content.size));try{O.dispatch(O.state.tr.setSelection(O.state.selection.constructor.near(c)))}catch{}},get_headings:()=>function(t){const e=[];return t.doc.descendants((t,n)=>("heading"!==t.type.name||e.push({level:t.attrs.level,text:t.textContent,pos:n}),!0)),e}(O.state),scroll_to_pos:t=>{const e=O.state.doc.content.size,n=Math.max(0,Math.min(t,e)),r=O.state.doc.nodeAt(n);let o;try{o=r?c.U3.near(O.state.doc.resolve(n+1),1):c.U3.near(O.state.doc.resolve(n),1)}catch{o=c.U3.near(O.state.doc.resolve(0),1)}O.dispatch(O.state.tr.setSelection(o)),it(O,o.from),O.focus()},is_source_mode:()=>ut(O.state.doc),enter_source_mode:()=>{if(ut(O.state.doc))return;const t=D(O.state.doc),e=O.state.schema.nodes.code_block.create({language:"markdown"},t?O.state.schema.text(t):null),n=O.state.tr;n.replaceWith(0,O.state.doc.content.size,e),O.dispatch(n),O.dom.classList.add("md-source-mode")},exit_source_mode:()=>{if(!ut(O.state.doc))return;const t=$(O.state.doc.textContent),e=O.state.tr;e.replaceWith(0,O.state.doc.content.size,t.content),O.dispatch(e),O.dom.classList.remove("md-source-mode")}};return"function"==typeof e?e(N):e&&(e.current=N),t.on_ready?.(N),()=>{S.disconnect(),y.removeEventListener("error",s,!0),y.removeEventListener("load",a,!0),O.destroy(),k.current=null}},[]),(0,st.jsx)("div",{className:"md-filecat",ref:_})});function ut(t){if(1!==t.childCount)return!1;const e=t.firstChild;return!!e&&"code_block"===e.type.name&&"markdown"===e.attrs.language}function ht(t,e){const n=t.resolve(e);for(let t=n.depth;t>0;t--)if("code_block"===n.node(t).type.name)return!0;return!1}const mt=dt},67951(t,e,n){n.d(e,{NH:()=>d,k5:()=>l,uf:()=>u});var r=n(38341),o=n(5091),s=n(42845),a=n(46762),c=n(3772);function i(t,e){return new r.fV(t,(t,n,r,o)=>{const s=t.schema.marks[e],a=n[1];if(!s||!a)return null;const c=n[0].indexOf(a);if(c<0)return null;const i=r+c,l=i+a.length,d=t.tr;return d.delete(l,o),d.delete(r,i),d.addMark(r,r+a.length,s.create()),d.removeStoredMark(s),d})}function l(){const t=o.Y;return(0,r.sM)({rules:[(0,r.JJ)(/^(#{1,6})\s$/,t.nodes.heading,t=>({level:t[1].length})),(0,r.JJ)(/^#([1-6])\s$/,t.nodes.heading,t=>({level:Number(t[1])})),(0,r.JJ)(/^```([\w-]*)\s$/,t.nodes.code_block,t=>({language:t[1]??""})),(0,r.tG)(/^\s*>\s$/,t.nodes.blockquote),(0,r.tG)(/^\s*([-+*])\s$/,t.nodes.bullet_list),(0,r.tG)(/^(\d+)\.\s$/,t.nodes.ordered_list,t=>({order:Number(t[1])})),i(/(?:\*\*)([^*]+)(?:\*\*)$/,"strong"),i(/(?:__)([^_]+)(?:__)$/,"strong"),i(/(?<![*])\*([^*]+)\*$/,"em"),i(/(?<![_])_([^_]+)_$/,"em"),i(/(?:~~)([^~]+)(?:~~)$/,"strike"),i(/(?:`)([^`]+)(?:`)$/,"code"),new r.fV(/!\[([^\]]*)\]\(([^)\s]+)\)$/,(t,e,n,r)=>{const o=e[1]??"",s=e[2];return s?t.tr.replaceWith(n,r,t.schema.nodes.image.create({src:s,alt:o})):null}),...r.Fr,r.gO]})}function d(t){return(e,n)=>{const r=e.schema.marks[t];return!!r&&(0,a.wh)(r)(e,n)}}function u(t,e={}){return(n,r)=>{const o=n.schema.nodes[t];if(!o)return!1;const{$from:s,$to:a}=n.selection,c=s.blockRange(a);if(!c)return!1;const i=s.parent,l=i.type===o&&Object.entries(e).every(([t,e])=>i.attrs[t]===e),d=l?n.schema.nodes.paragraph:o,u=l?{}:e;return r&&r(n.tr.setBlockType(c.start,c.end,d,u)),!0}}const h=(t,e)=>(0,c.Sd)(t.schema.nodes.bullet_list)(t,e),m=(t,e)=>(0,c.Sd)(t.schema.nodes.ordered_list)(t,e),p={sink:(0,c.$B)(o.Y.nodes.list_item),lift:(0,c.T2)(o.Y.nodes.list_item),split:(0,c.wn)(o.Y.nodes.list_item),wrap_bullet:h,wrap_ordered:m};n.d(e,["G8",0,p,"Rx",0,(t,e)=>{const{$from:n}=t.selection;return"code_block"===n.parent.type.name&&(e&&e(t.tr.setSelection(s.U3.create(t.doc,n.start(),n.end())).scrollIntoView()),!0)},"Vu",0,(t,e)=>{const{blockquote:n}=t.schema.nodes,{$from:r,$to:o}=t.selection,s=r.blockRange(o);if(!s)return!1;if(s.parent.type===n&&s.depth>0){const n=r.before(s.depth),o=t.tr.doc.nodeAt(n);if(o&&1===o.childCount)return e&&e(t.tr.replaceWith(n,n+o.nodeSize,o.child(0)).scrollIntoView()),!0;if(e){const n=t.tr,o=r.parent,a=r.after(s.depth);n.delete(s.start,s.end),n.insert(a,o),e(n.scrollIntoView())}return!0}return e&&e(t.tr.wrap(s,[{type:n}]).scrollIntoView()),!0},"fK",0,h,"oB",0,m,"x0",0,(t,e)=>{const{$from:n,empty:r}=t.selection;if(!r||"paragraph"!==n.parent.type.name)return!1;const o=n.parent.textContent;if(!o.trim())return!1;const a=function(t){const e=t.trim(),n=/^#([1-6])$/.exec(e);if(n)return{type:"heading",attrs:{level:Number(n[1])}};const r=/^(#{1,6})$/.exec(e);if(r)return{type:"heading",attrs:{level:r[1].length}};const o=/^```([\w-]*)$/.exec(e);return o?{type:"code_block",attrs:{language:o[1]??""}}:/^(?:-{3,}|\*{3,}|_{3,})$/.test(e.replace(/\s+/g,""))?{type:"horizontal_rule"}:/^>\s*$/.test(e)?{type:"blockquote"}:/^[-+*]\s*$/.test(e)?{type:"bullet_list"}:/^\d+[.)]$/.test(e)?{type:"ordered_list"}:null}(o);if(!a)return!1;if("blockquote"===a.type&&n.depth>1)return!1;const c=t.schema.nodes[a.type];if(!c)return!1;const i=n.before(n.depth),l=n.after(n.depth);if(e){const n=t.tr,r=c.createAndFill(a.attrs)??c.create(a.attrs);n.replaceWith(i,l,r);const o=Math.min(i+1,n.doc.content.size);try{n.setSelection(s.U3.near(n.doc.resolve(o),1))}catch{}n.scrollIntoView(),e(n)}return!0}])},96763(t,e,n){n.d(e,{Kz:()=>a,P7:()=>l,_8:()=>h,_D:()=>u,bN:()=>s,sO:()=>d});var r=n(14284),o=n(53459);function s(t,e){const n="md-theme-style-"+t,r=document.getElementById(n);if(!e)return void r?.remove();let o=r;o||(o=document.createElement("style"),o.id=n,document.head.appendChild(o)),o.textContent=e}async function a(){try{const t=await r.XO.get("md_theme/list");return t?.code===o.m.Success?t.data??[]:[]}catch(t){return[]}}const c="md-theme-change";function i(){window.dispatchEvent(new Event(c))}async function l(t){try{const e=await r.XO.get(`md_theme/get?id=${encodeURIComponent(t)}`);return e?.code===o.m.Success?e.data??"":""}catch(t){return""}}async function d(){try{const t=await r.XO.get("md_theme/active");return t?.code===o.m.Success?t.data??"":""}catch(t){return""}}async function u(t){const e=await r.XO.post("md_theme/save",t);return e?.code!==o.m.Success?null:(i(),e.data)}async function h(t){const e=await r.XO.post("md_theme/del",{id:t});return e?.code===o.m.Success&&(i(),!0)}n.d(e,["o3",0,c])},5091(t,e,n){var r=n(58903),o=n(86059),s=n(41105),a=n(99724);const c=(0,o.of)({tableGroup:"block",cellContent:"block+",cellAttributes:{}}),i={align:{default:null}},l={doc:{content:"block+"},paragraph:{content:"inline*",group:"block",attrs:i,parseDOM:[{tag:"p"}],toDOM:t=>["p",t.attrs.align?{style:`text-align:${t.attrs.align}`}:{},0]},heading:{content:"inline*",group:"block",attrs:{level:{default:1},...i},defining:!0,parseDOM:[1,2,3,4,5,6].map(t=>({tag:`h${t}`,attrs:{level:t}})),toDOM(t){const e=t.attrs.align?{style:`text-align:${t.attrs.align}`}:{};return[`h${t.attrs.level}`,e,0]}},bullet_list:{group:"block",content:"list_item+",parseDOM:[{tag:"ul"}],toDOM:()=>["ul",0]},ordered_list:{group:"block",content:"list_item+",attrs:{order:{default:1}},parseDOM:[{tag:"ol",getAttrs:t=>({order:Number(t.getAttribute("start")??1)})}],toDOM:t=>1===t.attrs.order?["ol",0]:["ol",{start:t.attrs.order},0]},list_item:{content:"paragraph block*",defining:!0,attrs:{checked:{default:null}},parseDOM:[{tag:"li",getAttrs:t=>{const e=t,n=e.querySelector("input[type=checkbox]");if(n)return{checked:n.checked};const r=e.getAttribute("data-checked");return{checked:null===r?null:"true"===r}}}],toDOM:t=>null!==t.attrs.checked?["li",{"data-checked":String(t.attrs.checked)},0]:["li",0]},blockquote:{content:"block+",group:"block",defining:!0,parseDOM:[{tag:"blockquote"}],toDOM:()=>["blockquote",0]},code_block:{content:"text*",group:"block",marks:"",defining:!0,code:!0,attrs:{language:{default:""}},parseDOM:[{tag:"pre",preserveWhitespace:"full",getAttrs:t=>{const e=t.querySelector("code"),n=/language-([\w-]+)/.exec(e?.className??"");return{language:n?n[1]:""}}}],toDOM:t=>["pre",{"data-language":t.attrs.language},["code",0]]},horizontal_rule:{group:"block",parseDOM:[{tag:"hr"}],toDOM:()=>["hr"]},html_block:{group:"block",atom:!0,code:!0,attrs:{value:{default:""}},parseDOM:[{tag:"div[data-html-block]",getAttrs:t=>({value:(0,s.Ne)(t.getAttribute("data-html-block")??"")})}],toDOM:t=>["div",{"data-html-block":t.attrs.value}]},html_inline:{inline:!0,group:"inline",atom:!0,code:!0,attrs:{value:{default:""}},parseDOM:[{tag:"span[data-html-inline]",getAttrs:t=>({value:(0,s.Ne)(t.getAttribute("data-html-inline")??"")})}],toDOM:t=>["span",{"data-html-inline":t.attrs.value}]},math_inline:{inline:!0,group:"inline",atom:!0,attrs:{raw:{default:""},tex:{default:""}},parseDOM:[{tag:"span[data-math-inline]",getAttrs:t=>{const e=t,n=(0,s.Ne)(e.getAttribute("data-math-inline")??"");return{raw:n,tex:(0,a.V)(n)?.tex??""}}}],toDOM:t=>["span",{"data-math-inline":t.attrs.raw}]},math_block:{group:"block",atom:!0,code:!0,attrs:{raw:{default:""},tex:{default:""}},parseDOM:[{tag:"div[data-math-block]",getAttrs:t=>{const e=t,n=(0,s.Ne)(e.getAttribute("data-math-block")??"");return{raw:n,tex:(0,a.V)(n)?.tex??""}}}],toDOM:t=>["div",{"data-math-block":t.attrs.raw}]},hard_break:{inline:!0,group:"inline",selectable:!1,parseDOM:[{tag:"br"}],toDOM:()=>["br"]},image:{inline:!0,group:"inline",draggable:!0,attrs:{src:{},alt:{default:null},title:{default:null}},parseDOM:[{tag:"img[src]",getAttrs:t=>{const e=t;return{src:e.getAttribute("src"),alt:e.getAttribute("alt"),title:e.getAttribute("title")}}}],toDOM(t){const{src:e,alt:n,title:r}=t.attrs,o={src:(0,s.KR)(e)};return n&&(o.alt=n),r&&(o.title=r),["img",o]}},text:{group:"inline"},...c},d={strong:{parseDOM:[{tag:"strong"},{tag:"b"},{style:"font-weight=bold"}],toDOM:()=>["strong",0]},em:{parseDOM:[{tag:"i"},{tag:"em"},{style:"font-style=italic"}],toDOM:()=>["em",0]},strike:{parseDOM:[{tag:"s"},{tag:"del"},{tag:"strike"}],toDOM:()=>["s",0]},code:{parseDOM:[{tag:"code",getAttrs:t=>"PRE"!==t.parentElement?.tagName&&null}],toDOM:()=>["code",0]},link:{attrs:{href:{},title:{default:null}},inclusive:!1,parseDOM:[{tag:"a[href]",getAttrs:t=>{const e=t;return{href:e.getAttribute("href"),title:e.getAttribute("title")}}}],toDOM(t){const{href:e,title:n}=t.attrs;return["a",{href:e,title:n,rel:"noopener noreferrer",target:"_blank"},0]}}},u=new r.Sj({nodes:l,marks:d});n.d(e,["Y",0,u])}}]);
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[2674],{92674(e,t,n){n.r(t),n.d(t,{default:()=>P});var a=n(96540),i=n(82893),s=n(34843),o=n(85997),l=n(57952),r=n(47022),c=n(34251),d=n(74848);function u(e){{const[t,n]=(0,a.useState)(!1),[i,s]=(0,a.useState)([]),l=e=>{s(e)},p=async()=>{"folder"===e.type?(t||!e.click||i||await e.click(e,l,e.pre_path),n(!t)):e.click&&await e.click(e,l,e.pre_path)},h=async(t=!1)=>{"folder"!==e.type||t?e.fatherNowToggleExpansion&&e.fatherNowToggleExpansion():await e.click(e,l,e.pre_path)};return(0,a.useEffect)(()=>{s(e.children)},[e.children]),(0,d.jsxs)("div",{className:"studio-item",children:[(0,d.jsxs)("div",{onClick:p,onContextMenu:t=>{t.stopPropagation(),t.nativeEvent.stopImmediatePropagation(),e.handleContextMenu&&e.handleContextMenu(t,e.name,e.pre_path,e.type===r.Iw.folder,h)},className:"studio-item-title"+(e.active_path===e.pre_path?" studio-item-title--active":""),children:[(0,d.jsx)("i",{className:"material-icons studio-item-title-tag","data-icon":t?"arrow_drop_down":"arrow_right",children:"file"==e.type?"":t?"arrow_drop_down":"arrow_right"}),(0,d.jsx)("span",{className:"file-icons",children:(0,d.jsx)("span",{"data-type":(0,c.uL)(e.name),"data-dir":"folder"===e.type,"aria-label":e.name,children:(0,d.jsx)(o.In,{icon:"",aria_label:e.name})})}),(0,d.jsx)("span",{className:"studio-item-name",children:e.name})]}),t&&i&&(0,d.jsx)("div",{style:{marginLeft:20},children:i.map((t,n)=>(0,d.jsx)(a.Fragment,{children:(0,d.jsx)(u,{type:t.type,size:t.size,click:e.click,name:t.name,children:t.children,pre_path:`${e.pre_path}${t.name}${t.type===r.Iw.folder?"/":""}`,handleContextMenu:e.handleContextMenu,active_path:e.active_path,fatherNowToggleExpansion:h},n)},n))})]})}}n(61443);function p(e){return(0,d.jsx)("div",{children:e.list.map((t,n)=>(0,d.jsx)(u,{pre_path:`${e.pre_path}${t.name}${t.type===r.Iw.folder?"/":""}`,name:t.name,type:t.type,handleContextMenu:e.handleContextMenu,fatherNowToggleExpansion:e.fatherNowToggleExpansion,active_path:e.active_path,children:t.children,click:e.click,size:t.size},n))})}var h=n(14284),m=n(34289),f=n(53459),v=n(78247),_=n(62042),x=n(2543),y=n(89824),w=n(22022),j=n(88815),g=n(61973),k=n(23430),C=n(99214);const S=a.lazy(()=>Promise.all([n.e(2543),n.e(4091)]).then(n.bind(n,84091))),b=a.lazy(()=>Promise.all([n.e(1384),n.e(1075),n.e(1142)]).then(n.bind(n,71142))),N=a.lazy(()=>n.e(4877).then(n.bind(n,64877))),E=a.lazy(()=>n.e(9857).then(n.bind(n,69857))),A=a.lazy(()=>Promise.all([n.e(8090),n.e(5744)]).then(n.bind(n,16575))),M=a.lazy(()=>Promise.all([n.e(8725),n.e(2728),n.e(2130),n.e(5602),n.e(8781),n.e(6404)]).then(n.bind(n,35304))),I=a.lazy(()=>Promise.resolve().then(n.bind(n,20892))),$=a.lazy(()=>Promise.all([n.e(1922),n.e(4935)]).then(n.bind(n,24935)));function R(e){return(0,c.uL)(e)===r.Iw.excel}function P(e){const[t,n]=(0,a.useState)([]),[u,P]=(0,a.useState)(""),[z,G]=(0,a.useState)(""),[U,D]=(0,a.useState)(!1),[F,L]=(0,a.useState)({path:"",name:""}),[T,B]=(0,a.useState)(""),[K,W]=(0,s.fp)(i.AG.confirm),[H,X]=(0,a.useState)(!1),[V,Y]=(0,s.fp)(i.AG.fileShellShow),[Z,q]=(0,s.fp)(i.AG.file_shell_hidden),J=(0,C.Cf)(),O=(0,a.useRef)(null),Q=(0,a.useRef)(null),[ee,te]=(0,a.useState)(!1),[ne,ae]=(0,a.useState)(16),[ie,se]=(0,s.fp)(i.AG.showPrompt),{t:oe}=(0,w.Bd)(),le=(0,g.Zp)(),re=(ce=F.name,(0,c.uL)(ce)===r.Iw.md);var ce;const de=function(e){return(0,c.uL)(e)===r.Iw.excalidraw}(F.name),ue=function(e){return(0,c.uL)(e)===r.Iw.mind}(F.name),pe=function(e){return(0,c.uL)(e)===r.Iw.timeline}(F.name),he=R(F.name),me=(0,a.useRef)(null),fe=(0,a.useRef)(null),ve=(0,a.useRef)(null),_e=(0,a.useRef)(null),xe=(0,a.useRef)(null),ye=(0,a.useRef)(null),[we,je]=(0,a.useState)([]),[ge,ke]=(0,a.useState)(-1),[Ce,Se]=(0,a.useState)("folder"),[be,Ne]=(0,a.useState)(!0),[Ee,Ae]=(0,a.useState)(!1),Me=(0,C.oT)(),[Ie]=(0,g.ok)(),$e="1"===Ie.get("chat_open"),[Re,Pe]=(0,s.fp)(i.AG.studio_chat_width),ze=(0,a.useRef)(null),[Ge,Ue]=(0,a.useState)(!1),[De,Fe]=(0,a.useState)(void 0),[Le,Te]=(0,s.fp)(i.AG.ai_chat_session_by_cwd),Be=(0,g.zy)();let Ke=Be.pathname.split("/").filter(Boolean).pop();Ke=decodeURIComponent(Ke);const{check_user_auth:We}=(0,v.MH)(),[He]=(0,s.fp)(i.AG.user_base_info),Xe=We(k.oV.ai_agent_page);(0,a.useEffect)(()=>{He?.user_data&&$e&&!Xe&&Me("chat_open",null)},[$e,Xe,He]);const Ve=(0,m.GG)("file",Ke);const Ye=async()=>{const e=(0,m.GG)("file",Ke);P(e),L({path:e,name:(0,m.mH)(e)});const t=await h.$M.post("studio/get/item",{path:e});if(t.code===f.m.Success){const e=[],a=[];for(const n of t.data.list)"folder"===n.type?e.push(n):"file"===n.type&&a.push(n);n([...e,...a])}},Ze=(e,t)=>e===t||e.startsWith(t+"/");(0,a.useEffect)(()=>{G(""),X(!1),Ye()},[Be]);const qe=async(e,t)=>{if(!R(e)){const e=await h.$M.get(`${encodeURIComponent(t)}`);G(e.data),v.xK.set_value_temp(e.data)}L({path:t,name:e}),B(t),Se("folder"),Ae(!1)},Je=(e,t)=>{e.size>j.o5?W({open:!0,handle:()=>{qe(e.name,t),W({open:!1,handle:null}),X(!1)},title:"超过20MB了还要打开吗?"}):qe(e.name,t)};function Oe(){fe.current?.save()}const Qe=e=>{if(e.ctrlKey&&"s"===e.key){if(e.preventDefault(),re||de||ue||pe||he)return;H&&Oe()}};(0,a.useEffect)(()=>(document.addEventListener("keydown",Qe),()=>{document.removeEventListener("keydown",Qe)}),[H,re,de,ue,pe,he]);const et=(0,a.useCallback)(x.throttle(e=>{const t=parseFloat(getComputedStyle(Q.current).fontSize),n=window.innerWidth/t-4,a=e.clientX/t,i=2.25+O.current.offsetWidth/t;a<=n&&a>=i&&ae(parseFloat(a.toFixed(2)))},32),[]),tt=()=>{te(!1),Q.current.removeEventListener("pointermove",et)},nt=(0,a.useCallback)(x.throttle(e=>{const t=ze.current;if(!t)return;const n=parseFloat(getComputedStyle(t).fontSize),a=t.parentElement.getBoundingClientRect().right-e.clientX,i=.7*t.parentElement.getBoundingClientRect().width,s=Math.min(Math.max(a,320),i);Pe(parseFloat((s/n).toFixed(2)))},32),[]),at=()=>{Ue(!1),document.removeEventListener("pointermove",nt)},it=[{r:oe("创建文件"),v:"创建文件"},{r:oe("创建目录"),v:"创建目录"},{r:oe("重命名"),v:"重命名"},{r:oe("删除"),v:"删除"}],st=[{r:oe("重命名"),v:"重命名"},{r:oe("删除"),v:"删除"}],ot=(e,t,n,a,i)=>{e.preventDefault();const s=new c.ik;s.path=n,s.filename=t,s.x=e.clientX,s.y=e.clientY,s.items=a?it:st,i===Ye&&(s.items=s.items.slice(0,2)),s.type=a?r.Iw.studio_folder:r.Iw.studio_file;const o=e=>{i(e)};s.textClick=e=>{switch(e){case"创建文件":se({show:!0,type:y.PromptEnum.FileNew,overlay:!0,data:{dir:n,call:o}});break;case"创建目录":se({show:!0,type:y.PromptEnum.DirNew,overlay:!0,data:{dir:n,call:o}});break;case"删除":if(H&&(F.path===n||F.path.includes(n))){const e=()=>{o(a),X(!1),L({}),G(""),v.xK.set_value_temp("")};se({show:!0,type:y.PromptEnum.FilesDelete,overlay:!0,data:{path:n,call:e,filename:t}});break}se({show:!0,type:y.PromptEnum.FilesDelete,overlay:!0,data:{path:n,filename:t,call:a?()=>{o(!0)}:o}});break;case"重命名":se({show:!0,type:y.PromptEnum.FileRename,overlay:!0,data:{path:n,dir:(0,m.Yp)(n),call:(e,t)=>{((e,t)=>{if(T&&Ze(T,e)){const n=t+T.slice(e.length);B(n),L({path:n,name:(0,m.mH)(n)})}const n=(0,m.oW)((0,m.GG)("file",Ke));if(Ze(n,e)){const a=t+n.slice(e.length);return void le(`/file/${encodeURIComponent(a)}`,{replace:!0})}Ye()})(e,t)},filename:t}})}},se({show:!0,type:y.PromptEnum.FileMenu,overlay:!1,data:s})};const lt=re&&"outline"===Ce;return(0,d.jsxs)("div",{className:"studio studio--file",children:[(0,d.jsxs)(l.A,{ignore_tags:!0,left_children:[(0,d.jsx)(o.rA,{title:"取消",icon:"close",onClick:()=>{Y({show:!1,path:""}),q(void 0),le(-1)}},1),(0,d.jsx)("div",{children:F.name},2)],children:[(0,d.jsx)("title",{children:F.name}),(0,d.jsx)(o.rA,{title:"侧边栏",icon:"list",onClick:()=>Ne(e=>!e),selected:be}),re&&[Ee?(0,d.jsx)(o.rA,{title:oe("保存"),icon:"save",onClick:()=>me.current?.save()},"save"):null,(0,d.jsx)(o.rA,{icon:"source"===me.current?.mode()?"edit":"code",title:"source"===me.current?.mode()?oe("实时编辑模式"):oe("源码模式"),onClick:()=>me.current?.toggle_mode()},"mode"),(0,d.jsx)(o.rA,{title:oe("导出PDF"),icon:"print",onClick:()=>me.current?.export_pdf()},"pdf")],!re&&(0,c.zr)(F.name)&&(0,d.jsx)(o.rA,{title:"格式化",icon:"data_object",onClick:function(){v.xK.get_editor()?.formatCode()}}),J.can_terminal&&(0,d.jsx)(o.rA,{icon:"terminal",title:"shell",onClick:function(){!0!==Z&&!1!==Z?V.show?Y({show:!1,path:""}):(Y({show:!0,path:(0,m.GG)("file",Ke)}),q(!1)):q(!Z)}}),We(k.oV.ai_agent_page)&&(0,d.jsx)(o.rA,{title:oe("AI 聊天"),icon:"smart_toy",selected:$e,onClick:()=>Me("chat_open",!$e?"1":null)}),re?Ee?(0,d.jsx)(o.rA,{title:oe("保存"),icon:"save",onClick:()=>me.current?.save()}):null:de?(0,d.jsx)(o.rA,{title:oe("保存"),icon:"save",onClick:()=>ve.current?.save()}):ue?(0,d.jsx)(o.rA,{title:oe("保存"),icon:"save",onClick:()=>_e.current?.save()}):pe?(0,d.jsx)(o.rA,{title:oe("保存"),icon:"save",onClick:()=>xe.current?.save()}):he?(0,d.jsx)(o.rA,{title:oe("保存"),icon:"save",onClick:()=>ye.current?.save()}):H?(0,d.jsx)(o.rA,{title:"保存",icon:"save",onClick:Oe}):null]}),(0,d.jsxs)("div",{className:"studio-body",ref:Q,children:[(0,d.jsxs)("div",{className:"studio-nav",style:{display:be?void 0:"none",width:ne-1+"em"},onContextMenu:e=>{ot(e,F.name,(0,m.GG)("file",Ke),!0,Ye)},children:[(0,d.jsx)("div",{className:"studio-nav-outline",style:{display:lt?void 0:"none"},children:(0,d.jsx)(N,{items:we,active_pos:ge,on_click:e=>me.current?.goto_heading(e)})}),(0,d.jsx)("div",{className:"studio-nav-folder",style:{display:lt?"none":void 0},children:(0,d.jsx)(p,{pre_path:u,list:t,click:async(e,t,n)=>{if("folder"===e.type){const e=await h.$M.post("studio/get/item",{path:`${n}`});if(e.code===f.m.Success){const n=[],a=[];for(const t of e.data.list)"folder"===t.type?n.push(t):"file"===t.type&&a.push(t);t([...n,...a])}}else{if(H)return void W({open:!0,handle:()=>{W({open:!1,handle:null}),X(!1),Je(e,n)},title:"确定不保存就切换吗?"});Je(e,n)}},active_path:T,handleContextMenu:ot,fatherNowToggleExpansion:Ye})}),re&&(0,d.jsx)("div",{className:"studio-nav-switch",children:(0,d.jsx)(o.rA,{icon:lt?"folder":"list",title:oe(lt?"文件目录":"大纲"),onClick:()=>Se(lt?"folder":"outline")})})]}),be&&(0,d.jsx)("div",{className:"studio__divider",ref:O,onPointerDown:()=>{te(!0),Q.current.addEventListener("pointermove",et)},onPointerUp:tt}),ee&&(0,d.jsx)("div",{className:"shell__overlay",onPointerUp:tt}),re?(0,d.jsx)("div",{className:"studio-editor studio-editor--md",children:(0,d.jsx)(a.Suspense,{fallback:null,children:(0,d.jsx)(b,{pane:{path:T,url:h.$M.getDownloadUrl(encodeURIComponent(T)),name:F.name,on_dirty:Ae,on_outline:(e,t)=>{je(e),ke(t)},register:e=>{me.current=e}}})})},T):de?(0,d.jsx)("div",{className:"studio-editor studio-editor--draw",children:(0,d.jsx)(a.Suspense,{fallback:null,children:(0,d.jsx)(A,{reset_key:T,url:h.$M.getDownloadUrl(encodeURIComponent(T)),save_path:T,on_dirty:X,on_saved:()=>X(!1),register:e=>{ve.current=e}})})},T):ue?(0,d.jsx)("div",{className:"studio-editor studio-editor--mind",children:(0,d.jsx)(a.Suspense,{fallback:null,children:(0,d.jsx)(M,{reset_key:T,url:h.$M.getDownloadUrl(encodeURIComponent(T)),on_dirty:X,on_saved:()=>X(!1),register:e=>{_e.current=e},on_save:async e=>(await h.$M.post(`save/${encodeURIComponent(T)}`,{context:e})).code===f.m.Success})})},T):pe?(0,d.jsx)("div",{className:"studio-editor studio-editor--timeline",children:(0,d.jsx)(a.Suspense,{fallback:null,children:(0,d.jsx)(I,{reset_key:T,url:h.$M.getDownloadUrl(encodeURIComponent(T)),on_dirty:X,register:e=>{xe.current=e},on_save:async e=>(await h.$M.post(`save/${encodeURIComponent(T)}`,{context:e})).code===f.m.Success})})},T):he?(0,d.jsx)("div",{className:"studio-editor studio-editor--excel",children:(0,d.jsx)(a.Suspense,{fallback:null,children:(0,d.jsx)($,{url:h.$M.getDownloadUrl(encodeURIComponent(T)),save_path:T,on_dirty:X,bind_save:e=>{ye.current={save:e}}})})},T):(0,d.jsx)("div",{className:"studio-editor",children:F.name&&(0,d.jsx)(a.Suspense,{fallback:null,children:(0,d.jsx)(S,{name:F.name,on_dirty:X,register:e=>{fe.current=e},save:async e=>{const t={context:v.xK.get_editor_value()},n=await h.$M.post(`save/${encodeURIComponent(T)}`,t);return n.code===f.m.Success||e||(0,_.zN)(oe("保存失败")),n.code===f.m.Success}})})},T),$e&&(0,d.jsxs)(a.Fragment,{children:[(0,d.jsx)("div",{className:"studio__divider studio__divider--chat",ref:ze,onPointerDown:e=>{e.preventDefault(),Ue(!0),document.addEventListener("pointermove",nt),document.addEventListener("pointerup",at,{once:!0})}}),(0,d.jsx)("div",{className:"studio-chat-panel",style:{width:`${Re}em`},children:(0,d.jsx)(a.Suspense,{fallback:null,children:(0,d.jsx)(E,{inline_header:!0,sync_url:!1,file_cwd_path:Ve,session_id:De??(rt=Ve,i.AG.get_ai_chat_session(Le,rt)),on_session_change:e=>{Fe(e),((e,t)=>{Te({...Le,[e]:t})})(Ve,e)}})})})]})]})]});var rt}}}]);
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[8765],{60096(e,i,t){t.d(i,{QW:()=>z,Ic:()=>b,t$:()=>F,$J:()=>$});var n=t(96540),l=t(47022),s=t(34843),o=t(82893),a=t(61973),r=t(64694),d=t(14284),c=t(34289),m=t(23430),f=t(62042),h=t(99214),p=t(85997),u=t(22022),_=t(74848);function x(e){const[i,t]=(0,s.fp)(o.AG.selectedFileList),[n,a]=(0,s.fp)(o.AG.nowFileList),[c,x]=(0,s.fp)(o.AG.confirm),[g,y]=(0,s.fp)(o.AG.user_base_info),{t:w}=(0,u.Bd)();return(0,_.jsxs)("div",{...e.extraAttr,onClick:()=>{!async function(i){e.click&&e.click(i,e.name)}(e.index)},className:e.mount?"item mount-item":"item",role:"button","data-type":e.isLink?"invalid_link":e.type,"data-dir":!e.type||e.type===l.Iw.folder,"data-mount":e.mount?"true":void 0,"aria-selected":null!==(0,r.kW)(i,e.index),"aria-label":e.name,style:{"--filewidth":e.itemWidth??"33%"},onDragStart:n=>{return l=e.index,void(i.find(e=>e===l)||t([...i,l]));var l},onDrop:t=>((t,s)=>{const o=t.dataTransfer;let a,r=!1;for(let e=0;e<o.items.length;e++)if("file"===o.items[e].kind){r=!0;break}if(r)return;if(g?.user_data?.file_list_pagination_mode===m.yM.pagination){if(a=n.files[s],n.files[s]?.type!==l.Iw.folder)return}else if(a=n.folders[s],n.folders.length<=s)return;(0,h.ib)(n,i).some(e=>e?.name===a?.name)?(0,f.zN)(w("mv_self")):x({open:!0,title:`确定将文件移动并覆盖到${a?.name}吗?`,handle:async()=>{await e.draggable_handle(a?.name)}})})(t,e.index),draggable:void 0!==e.draggable_handle,children:[void 0===e.icon&&(0,_.jsx)("div",{children:e.type!==l.Iw.image||null==e.path||g?.user_data?.not_pre_show_image?(0,_.jsx)(p.In,{icon:""}):(0,_.jsx)("img",{loading:"lazy",src:d.$M.getDownloadUrl(e.path,{mtime:e.mtime,cache:1}),alt:e.name})}),void 0!==e.icon&&(0,_.jsx)("div",{className:"rotating-div",children:(0,_.jsx)("span",{className:"material-icons",children:e.icon})}),(0,_.jsxs)("div",{children:[(0,_.jsxs)("p",{className:"name",children:[(0,_.jsx)("span",{children:e.name}),e.mount_readonly&&(0,_.jsx)("span",{className:"mount-readonly-tag",children:w("只读")})]}),e.size?(0,_.jsx)("p",{children:e.size}):(0,_.jsx)("p",{children:"—"}),(0,_.jsx)("p",{children:e.show_mtime})]}),e.children]})}var g=t(89824),y=t(34251);function w(e){const[i,t]=(0,s.fp)(o.AG.selectedFileList),[n,m]=(0,s.fp)(o.AG.nowFileList),[f,p]=(0,s.fp)(o.AG.confirm),[w,k]=(0,s.fp)(o.AG.file_page),[v,j]=(0,s.fp)(o.AG.enterKey),{click_file:A}=(0,h.kZ)(),G=(0,h._A)(),{t:z}=(0,u.Bd)(),b=(0,a.Zp)();(0,a.zy)();const F=(0,h.A9)(),{clickDouble:$}=(0,h.xI)(),[C,I]=(0,s.fp)(o.AG.showPrompt);return(0,_.jsx)(x,{extraAttr:{onContextMenu:t=>{((t,n,s,o)=>{t.preventDefault(),t.stopPropagation();const a=new y.ik;a.path=(0,r.IO)((0,c.vX)(),n),a.filename=n,a.x=t.clientX,a.y=t.clientY,a.type=s?l.Iw.folder:(0,y.uL)(n),a.size=o,a.useSelectedList=i.includes(e.index),I({show:!0,type:g.PromptEnum.FileMenu,overlay:!1,data:a})})(t,e.name,e.type===l.Iw.folder,e.origin_size)}},draggable_handle:async e=>{const l=(0,h.ib)(n,i).map(e=>(0,h.Ok)(e.name));await d.$M.post("cut",{files:l,to:`${(0,c.GG)("file",(0,c.vX)())}/${e}`});t([]),p({open:!1,handle:null}),b((0,c.vX)())},name:e.name,index:e.index,mtime:e.mtime,size:e.size,type:e.type,isLink:e.isLink,path:e.path,icon:e.icon,show_mtime:e.show_mtime,mount:e.mount,mount_driver:e.mount_driver,mount_color:e.mount_color,mount_readonly:e.mount_readonly,click:(n,s)=>{if($(n,async()=>{if(e.type===l.Iw.folder)F(s);else{await A({name:s,size:e.origin_size,opt_shell:!0,mtime:e.mtime,close:()=>G(null)})&&G({name:s,mode:(0,h.Pc)(e.type)})}}))return;if(null!==(0,r.kW)(i,n))t((0,r.P1)(i,n));else if("ctrl"===v)t([...i,n]);else if("shift"===v){const{max:e,min:l}=(0,r.a7)(i),s=[];if(n>=e)for(let i=e;i<=n;i++)s.push(i);else for(let e=l;e>=n;e--)s.push(e);t(s)}else t([n])},itemWidth:e.itemWidth})}var k=t(78247),v=(t(38240),t(64405)),j=t(88815);function A(e){const[i,t]=(0,s.fp)(o.AG.selectedFileList),[n,m]=(0,s.fp)(o.AG.editorSetting),[f,p]=(0,s.fp)(o.AG.shellNowDir),[g,y]=(0,s.fp)(o.AG.sshInfo),[w,A]=(0,s.fp)(o.AG.nowFileList),[G,z]=(0,s.fp)(o.AG.enterKey),[b,F]=(0,s.fp)(o.AG.confirm),$=(0,a.Zp)(),{t:C}=(0,u.Bd)(),{clickDouble:I}=(0,h.xI)();return(0,_.jsx)(x,{draggable_handle:async n=>{const l=new v.x;Object.assign(l,g),l.target=(0,r.HS)(...f,n);const s=(0,h.ib)(w,i).map(e=>(0,r.HS)(...f,e.name));for(const e of s)if(l.source=e,!await d.Fg.post("move",l))return!1;t([]),F({open:!1,handle:null}),await e.fileHandler()},name:e.name,index:e.index,mtime:e.mtime,size:e.size,type:e.type,itemWidth:e.itemWidth,show_mtime:e.show_mtime,click:(n,s)=>{if(I(n,()=>{if(e.type===l.Iw.folder){const e=new v.x;return e.key=g.key,e.dir=`/${(0,c.GG)("remoteShell",(0,c.vX)())}${s}`,$((0,r.IO)((0,c.vX)(),s)),t([]),void A({files:[],folders:[]})}const i=async()=>{const i=new v.x;i.key=g.key,i.file=`/${(0,c.GG)("remoteShell",(0,c.vX)())}${s}`;const t=await d.Fg.post("get/file/text",i);let n;s.endsWith(l.Iw.workflow_act)?n="ace/mode/yaml":(s.endsWith(l.Iw.draw)||s.endsWith(l.Iw.excalidraw))&&(n="ace/mode/json"),m({model:n,open:!0,fileName:e.name,save:async e=>{i.context=e;0===(await d.Fg.post("update/file/text",i)).code&&k.xK.set_value_temp("")}}),k.xK.set_value_temp(t.data)};"number"==typeof e.origin_size&&e.origin_size>j.o5?F({open:!0,title:C("提示"),sub_title:"文件超过20MB了确定要打开吗?",handle:async()=>{F({open:!1,handle:null}),await i()}}):i()}))return;if(null!==(0,r.kW)(i,n))t((0,r.P1)(i,n));else if("ctrl"===G)t([...i,n]);else if("shift"===G){const{max:e,min:l}=(0,r.a7)(i),s=[];if(n>=e)for(let i=e;i<=n;i++)s.push(i);else for(let e=l;e>=n;e--)s.push(e);t(s)}else t([n])}})}function G(e){const[i,t]=(0,s.fp)(o.AG.selectedFileList),[n,a]=(0,s.fp)(o.AG.enterKey),{click_file:c}=(0,h.kZ)(),[m,f]=(0,s.fp)(o.AG.nowFileList),{t:p}=(0,u.Bd)(),[w,k]=(0,s.fp)(o.AG.showPrompt),v=((0,h.oT)(),(0,h.xp)()),{clickDouble:j}=(0,h.xI)();return(0,_.jsx)(x,{extraAttr:{onContextMenu:i=>{((i,t,n,s)=>{i.preventDefault(),i.stopPropagation();const o=new y.ik,a=e.item_list;for(const e of a)if(e.name===t){o.path=e.path;break}o.is_share=!0,o.filename=t,o.x=i.clientX,o.y=i.clientY,o.type=n?l.Iw.folder:(0,y.uL)(t),o.size=s,o.share_token=e.share.share_token,o.share_id=e.share.share_id,k({show:!0,type:g.PromptEnum.FileMenu,overlay:!1,data:o})})(i,e.name,e.type===l.Iw.folder,e.origin_size)}},name:e.name,index:e.index,mtime:e.mtime,size:e.size,type:e.type,itemWidth:e.itemWidth,show_mtime:e.show_mtime,click:(s,o)=>{if(j(s,()=>{e.type!==l.Iw.folder&&(v(o)||c({file_path:e.item_list[s].path,file_url:d.$M.getDownloadUrlV2(e.item_list[s].path,"share_download",{share_id:e.share.share_id,share_token:e.share.share_token}),name:o,size:e.origin_size,opt_shell:!0,mtime:e.mtime,not_type_tip:p("未知类型,请下载查看")}))}))return;if(null!==(0,r.kW)(i,s))t((0,r.P1)(i,s));else if("ctrl"===n)t([...i,s]);else if("shift"===n){const{max:e,min:n}=(0,r.a7)(i),l=[];if(s>=e)for(let i=e;i<=s;i++)l.push(i);else for(let e=n;e>=s;e--)l.push(e);t(l)}else t([s])}})}function z({handleContextMenu:e,file_list:i,clickBlank:t,share:l}){const[a,r]=(0,s.fp)(o.AG.user_base_info),d=(0,n.useRef)(null),{t:c}=(0,u.Bd)(),m=(0,h.OJ)(),{file_is_running:f}=(0,k.hg)();return(0,h.UK)(i,[],d),(0,_.jsx)("div",{onContextMenu:e,id:"listing",style:{paddingBottom:"10rem"},className:`mosaic file-icons ${a?.user_data?.file_list_show_type??""}`,ref:d,children:(0,_.jsx)("div",{onClick:t,children:i.map((e,t)=>(0,_.jsx)(n.Fragment,{children:(0,_.jsx)(G,{share:l,item_list:i,icon:f(e.name)?"refresh":void 0,itemWidth:m,index:t+0,...e})},t+0))})})}function b({handleContextMenu:e,file_list:i,folder_list:t,clickBlank:l,fileHandler:a}){const[r,d]=(0,s.fp)(o.AG.user_base_info),c=(0,n.useRef)(null),{t:m}=(0,u.Bd)(),f=(0,h.OJ)(),{file_is_running:p}=(0,k.hg)(),[x,y]=(0,s.fp)(o.AG.fileShellShow),w=(0,n.useMemo)(()=>t?.length??0,[t]);return(0,h.ei)(c,g.PromptEnum.SshUpload),(0,h.UK)(i,t,c),(0,n.useEffect)(()=>()=>{x.show&&y({show:!1,path:""})},[]),(0,_.jsxs)("div",{onContextMenu:e,id:"listing",style:{paddingBottom:"10rem"},className:`mosaic file-icons ${r?.user_data?.file_list_show_type??""}`,ref:c,children:[t&&t.length>0&&(0,_.jsx)("h2",{children:m("文件夹")}),t&&(0,_.jsx)("div",{onClick:l,children:t.map((e,i)=>(0,_.jsx)(n.Fragment,{children:(0,_.jsx)(A,{fileHandler:a,itemWidth:f,index:i,...e})},i))}),i&&i.length>0&&(0,_.jsx)("h2",{onClick:l,children:m("文件")}),i&&(0,_.jsx)("div",{onClick:l,children:i.map((e,i)=>(0,_.jsx)(n.Fragment,{children:(0,_.jsx)(A,{fileHandler:a,icon:p(e.name)?"refresh":void 0,itemWidth:f,index:i+w,...e})},i+w))})]})}function F({handleContextMenu:e,file_list:i,folder_list:t,clickBlank:l}){const[a,r]=(0,s.fp)(o.AG.user_base_info),d=(0,n.useRef)(null),{t:c}=(0,u.Bd)(),[m]=(0,s.fp)(o.AG.zoom_style_by_percent),f=(0,h.OJ)(),{file_is_running:p}=(0,k.hg)(),[x,y]=(0,s.fp)(o.AG.fileShellShow),v=(0,n.useMemo)(()=>t?.length??0,[t]),j=(0,h.pi)(m);return(0,h.ei)(d,g.PromptEnum.FilesUpload),(0,h.UK)(i,t,d),(0,n.useEffect)(()=>()=>{x.show&&y({show:!1,path:""})},[]),(0,_.jsxs)("div",{onContextMenu:e,id:"listing",style:{paddingBottom:"10rem",fontSize:j.fontSize},className:`mosaic file-icons ${a?.user_data?.file_list_show_type??""}`,ref:d,children:[t&&t.length>0&&(0,_.jsx)("h2",{children:c("文件夹")}),t&&(0,_.jsx)("div",{onClick:l,children:t.map((e,i)=>(0,_.jsx)(n.Fragment,{children:(0,_.jsx)(w,{itemWidth:f,index:i,...e})},i))}),i&&i.length>0&&(0,_.jsx)("h2",{onClick:l,children:c("文件")}),i&&(0,_.jsx)("div",{onClick:l,children:i.map((e,i)=>(0,_.jsx)(n.Fragment,{children:(0,_.jsx)(w,{icon:p(e.name)?"refresh":void 0,itemWidth:f,index:i+v,...e})},i+v))})]})}function $({handleContextMenu:e,list:i,clickBlank:t}){const[l,a]=(0,s.fp)(o.AG.user_base_info),r=(0,n.useRef)(null),{t:d}=(0,u.Bd)(),[c]=(0,s.fp)(o.AG.zoom_style_by_percent),m=(0,h.OJ)(),{file_is_running:f}=(0,k.hg)(),[p,x]=(0,s.fp)(o.AG.fileShellShow),[y,v]=(0,s.fp)(o.AG.enterKey),[j,A]=(0,s.fp)(o.AG.selectedFileList),[G,z]=(0,s.fp)(o.AG.file_page),b=(0,h.pi)(c);return(0,h.UK)(i,[],r),(0,h.ei)(r,g.PromptEnum.FilesUpload),(0,h.SQ)(r,()=>{z(e=>e.page_num<0?e:{page_size:e.page_size,page_num:e.page_num+1})},()=>{}),(0,n.useEffect)(()=>()=>{p.show&&x({show:!1,path:""})},[]),(0,_.jsx)("div",{onContextMenu:e,id:"listing",style:{paddingBottom:"10rem",fontSize:b.fontSize},className:`mosaic file-icons ${l?.user_data?.file_list_show_type??""}`,ref:r,children:i&&(0,_.jsx)("div",{onClick:t,children:i.map((e,i)=>(0,_.jsx)(n.Fragment,{children:(0,_.jsx)(w,{icon:f(e.name)?"refresh":void 0,itemWidth:m,index:i,...e})},i))})})}},6960(e,i,t){t.d(i,{s:()=>o});var n=t(72635);const l=1440,s=525600;function o(e){e=e>1e12?e:1e3*e;const i=Date.now(),t=Math.abs(i-e)/6e4;return t<1?n.Ay.t("小于一分钟"):t<60?`${t.toFixed(0)} ${n.Ay.t("分钟前")}`:t<l?`${(t/60).toFixed(0)} ${n.Ay.t("小时前")}`:t<43200?`${(t/l).toFixed(0)} ${n.Ay.t("天前")}`:t<s?`${(t/43200).toFixed(0)} ${n.Ay.t("月前")}`:`${(t/s).toFixed(0)} ${n.Ay.t("年前")}`}}}]);
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[9299],{47374(e,t,i){i.d(t,{e:()=>p});var n=i(96540),s=i(61973),o=i(64694),a=i(34289),l=i(61443),r=i(75725),c=i(22022),d=i(85997),_=i(74848);function p(e){let t=(0,s.zy)();const[i,p]=(0,n.useState)([]),[f,h]=(0,n.useState)("/"),[u,m]=(0,n.useState)(void 0),{t:w,i18n:v}=(0,c.Bd)();n.useEffect(()=>{let t="",i=(0,a.vX)().split("/");i=i.filter(e=>e);const n=i.indexOf(e.baseRoute),s=[];if(-1!=n){t=(0,o.IO)(i.slice(0,n),e.baseRoute);const a=i.slice(n+1);for(let e=0;e<a.length;e++){const i=a[e];s.push({value:i,href:0===e?`${t}${i}/`:(0,o.IO)(s[e-1].href,i)})}h(t),p(s)}},[t]);const g=t=>{t.stopPropagation(),e.clickFun(t)};return(0,_.jsx)("div",{className:"breadcrumbs",onClick:e=>{m(void 0!==u?void 0:"")},children:(0,_.jsx)(n.Fragment,{children:void 0===u?(0,_.jsxs)(n.Fragment,{children:[(0,_.jsx)("span",{className:"chevron",children:(0,_.jsx)(s.N_,{to:f,onClick:g,children:(0,_.jsx)(d.In,{icon:"home"})})}),i.map((e,t)=>(0,_.jsxs)("span",{className:"chevron",children:[(0,_.jsx)(d.In,{icon:"keyboard_arrow_right"}),(0,_.jsx)(s.N_,{to:e.href,onClick:g,children:decodeURIComponent(e.value)})]},t))]}):(0,_.jsx)(r.QM,{click:()=>{m(void 0)},children:(0,_.jsx)(l.Sm,{width:"100%",placeholder:w("输入跳转的目录"),handlerEnter:t=>{e.input_path_enter&&e.input_path_enter(t),m(void 0)}})})})})}},77481(e,t,i){i.d(t,{S:()=>l,X:()=>a});var n=i(96540),s=i(61443),o=i(74848);function a(e){const[t,i]=n.useState([]),a=(0,n.useRef)(-1),[l,r]=(0,n.useState)(-1),[c,d]=(0,n.useState)(-1);(0,n.useEffect)(()=>{e.children?i(Array.isArray(e.children)?e.children:[e.children]):i(e.rows)},[e.rows,e.children]);const _=()=>{a.current=-1,r(-1),d(-1)};return(0,o.jsxs)("table",{children:[(0,o.jsx)("thead",{children:(0,o.jsx)("tr",{children:e.headers?.map((t,i)=>{const n=!!e.filter&&(e.filter.column??0)===i;let a=t;if(n){const i=e.filter,n=i.options.find(e=>e.value===i.value);null!=i.value&&n&&(a=`${t} (${n.label})`)}return(0,o.jsx)("th",{className:n?"table-filter-col":"",children:n?(0,o.jsx)(s.l6,{value:e.filter.value,options:e.filter.options,onChange:e.filter.onChange,bare:!0,trigger_label:a}):t},i)})})}),(0,o.jsx)("tbody",{children:t.map((t,i)=>{const n=!!e.onRowDrag;return(0,o.jsx)("tr",{className:n?(l===i?"row-dragging":"")+(c===i?" row-drop-target":""):"",draggable:n,onContextMenu:()=>{e.handleContextMenu&&e.handleContextMenu(t)},onDragStart:e=>{n&&(a.current=i,r(i),e.dataTransfer.effectAllowed="move")},onDragOver:e=>{!n||a.current<0||(e.preventDefault(),e.dataTransfer.dropEffect="move",d(i))},onDrop:t=>{n&&(t.preventDefault(),(()=>{const t=a.current,i=c;_(),t<0||i<0||t===i||e.onRowDrag?.(t,i)})())},onDragEnd:_,children:t.map((i,n)=>{const s=n===t.length-1?"small":"";return(0,o.jsx)("td",{className:s,style:{width:e.width??"auto"},children:i},n)})},i)})})]})}function l(e){return(0,o.jsx)("div",{style:{display:e.isFlex?"flex":"block"},children:e.columns.map((e,t)=>(0,o.jsx)("div",{children:e},t))})}},19299(e,t,i){i.r(t),i.d(t,{default:()=>J});var n=i(96540),s=i(47374),o=i(34843),a=i(52035),l=i(82893),r=i(14284),c=i(61973),d=i(4412),_=i(89824),p=i(34289),f=i(53459),h=i(99214),u=i(61443),m=i(47022),w=i(62042),v=i(22022),g=i(7523),x=i(78247),y=i(88815),j=i(6960),k=i(47071),G=i(14944),A=i(92275),b=i(23430);var C=i(34251),S=i(60096),M=i(87361),z=i(76559),$=i(85997),D=i(77481),N=i(70447),E=i(74848);const F=500;function I(e){const{t}=(0,v.Bd)(),i=(0,c.Zp)(),[,s]=(0,o.fp)(l.AG.prompt_card),[a,r]=(0,n.useState)(""),[d,_]=(0,n.useState)(!1),[p,f]=(0,n.useState)([]),[h,m]=(0,n.useState)(0),[w,g]=(0,n.useState)(!1),x=(0,n.useMemo)(()=>new z.I(window.location.host,"file_deep_search"),[]),y=(0,n.useRef)(!1),j=decodeURIComponent(e.base_path);(0,n.useEffect)(()=>{let e=[],t=null;const i=()=>{if(t=null,y.current||!e.length)return;const i=e;e=[],m(e=>e+i.length),f(e=>e.length>=F?e:[...e,...i].slice(0,F))},n=()=>{y.current||_(!1)};return x.addMsg(A.HK.file_deep_search_data,n=>{y.current||(e.push(...n.context??[]),null===t&&(t=setTimeout(i,100)))}),x.addMsg(A.HK.file_deep_search_end,()=>{y.current||(i(),_(!1))}),x.on_message("close",n),()=>{y.current=!0,clearTimeout(t),x.sendData(A.HK.file_deep_search_cancel,{}).catch(()=>{}),x.off_message("close",n),x.close()}},[]);const k=()=>{const t=a.trim();if(!t||d)return;f([]),m(0),g(!0),_(!0);const i={param_path:e.base_path,keyword:t};x.sendData(A.HK.file_deep_search,i).catch(()=>{})},G=e=>{let t=e.is_dir?e.path:e.path.slice(0,e.path.lastIndexOf("/")+1);t.endsWith("/")||(t+="/"),s({open:!1}),i(M.o.file+t.split("/").map(encodeURIComponent).join("/"))};return(0,E.jsxs)("div",{className:"file-deep-search",children:[(0,E.jsxs)("div",{className:"file-deep-search__bar",children:[(0,E.jsx)(u.$Z,{icon:"search",value:a,placeholder:t("搜文件名"),handleInputChange:e=>r(e),handleEnterPress:k}),(0,E.jsx)("button",{className:"button button--flat",onClick:d?()=>{x.sendData(A.HK.file_deep_search_cancel,{}).catch(()=>{}),_(!1)}:k,children:t(d?"取消":"搜索")})]}),(0,E.jsxs)("div",{className:"file-deep-search__hint",children:[(0,E.jsxs)("span",{children:[t("范围"),":",j]}),h>0&&(0,E.jsx)("span",{className:"file-deep-search__count",children:h>F?`${t("已显示")} 500 / ${h}`:`${h}`})]}),(0,E.jsxs)("div",{className:"file-deep-search__body",children:[p.length>0&&(0,E.jsx)(D.X,{headers:[t("名称"),t("路径"),""],rows:p.map(e=>{const i=e.path.slice(0,e.path.lastIndexOf("/")+1);return[e.is_dir?(0,E.jsx)("span",{className:"file-deep-search__dir",children:e.name}):e.name,(0,E.jsx)(N.xP,{context:i}),(0,E.jsx)($.rA,{icon:"folder_open",title:t("打开所在目录"),onClick:()=>G(e)})]})}),d&&(0,E.jsxs)("div",{className:"file-deep-search__empty",children:[(0,E.jsx)("span",{className:"chat-session-running",title:t("搜索中")}),t("搜索中")]}),!d&&h>F&&(0,E.jsx)("div",{className:"file-deep-search__more",children:t("结果过多")}),!d&&0===p.length&&(0,E.jsx)("div",{className:"file-deep-search__empty",children:t(w?"无匹配":"输入后搜")})]})]})}var P=i(64694),X=i(23496),R=i(12730),K=i(75725),L=i(40505);let H={};function U(){const{t:e}=(0,v.Bd)();let t=(0,c.zy)();const i=(0,c.Zp)(),{check_user_auth:s}=(0,x.MH)(),[a,d]=(0,o.fp)(l.AG.nowFileList),[f,u]=(0,o.fp)(l.AG.uploadFiles),[y,j]=(0,o.fp)(l.AG.showPrompt),[k,S]=(0,o.fp)(l.AG.selectedFileList),[z,D]=(0,o.fp)(l.AG.copyedFileList),[F,I]=(0,o.fp)(l.AG.cutedFileList),[X,L]=(0,o.fp)(l.AG.selectedFileList),[U,Y]=(0,o.fp)(l.AG.clickFileList),[B,O]=(0,o.fp)(l.AG.fileShellShow),Z=(0,h.Cf)(),[W,T]=(0,o.fp)(l.AG.file_root_list),[V,q]=(0,o.fp)(l.AG.file_root_index),[J,Q]=(0,n.useState)(void 0),[ee,te]=(0,n.useState)(""),[ie,ne]=(0,o.fp)(l.AG.workflow_show),[se,oe]=(0,o.fp)(l.AG.workflow_realtime_show),[ae,le]=(0,o.fp)(l.AG.work_flow_show),{initUserInfo:re}=(0,n.useContext)(g.F),[ce,de]=(0,o.fp)(l.AG.user_base_info),{click_file:_e}=(0,h.kZ)(),[pe,fe]=(0,o.fp)(l.AG.prompt_card),he=(0,n.useMemo)(()=>a.files.reduce((e,t)=>e+(t.type!==m.Iw.folder?1:0),0),[a]),ue=(0,n.useMemo)(()=>a.files.reduce((e,t)=>e+(t.type===m.Iw.folder?1:0),0)+(a.folders?.length??0),[a]);function me(e){(0,w.SK)(e)}(0,n.useEffect)(()=>{H={}},[t]),(0,n.useEffect)(()=>()=>{O({show:!1,path:""})},[]);const we=(0,h.Vs)(),ve=t=>{fe({open:!0,title:e("信息"),context_div:(0,E.jsxs)("div",{style:{maxWidth:"25rem"},children:[(0,E.jsx)(K.Yh,{left:e("挂载位置磁盘"),right:t?.total_size}),(0,E.jsx)(K.Yh,{left:`${e("磁盘剩余")}`,right:t?.left_size}),(0,E.jsx)(K.Yh,{left:`${e("文件系统")}`,right:t?.fs_type}),(0,E.jsx)(K.Yh,{left:`${e("文件夹数")}`,right:ue}),(0,E.jsx)(K.Yh,{left:`${e("文件数")}`,right:he}),(0,E.jsx)(K.Yh,{left:`${e("当前位置")}`,right:(0,E.jsx)(N.xP,{context:t?.now_absolute_path})})]}),cancel:()=>{G.ws.removeMsg(A.HK.file_info)}})};return(0,E.jsxs)(n.Fragment,{children:[k.length>0&&(0,E.jsx)($.rA,{icon:"delete",title:e("删除"),onClick:()=>{j({show:!0,type:_.PromptEnum.FilesDelete,overlay:!0,data:{}})}}),k.length>0&&(0,E.jsx)($.rA,{icon:"content_copy",title:e("复制"),onClick:function(){const e=(0,h.ib)(a,k);D(e.map(e=>(0,h.Ok)(e.name))),I([]),me("已复制")}}),k.length>0&&(0,E.jsx)($.rA,{icon:"content_cut",title:e("剪切"),onClick:function(){const e=(0,h.ib)(a,k);I(e.map(e=>(0,h.Ok)(e.name))),D([]),me("已剪切")}}),(z.length>0||F.length>0)&&(0,E.jsx)($.rA,{onClick:function(){j({show:!0,type:_.PromptEnum.Confirm,overlay:!0,data:{}})},icon:"content_paste",title:e("粘贴到此处"),tip:z.length+F.length}),k.length>0&&(0,E.jsx)($.rA,{icon:"download",title:e("下载"),onClick:function(){const e=(0,h.ib)(a,k);for(let t=0;t<e.length;t++){const i=e[t];e[t]=encodeURIComponent((0,h.Ok)(i.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,h.ib)(a,k);for(let e=0;e<t.length;e++){const i=t[e];t[e]=(0,h.Ok)(i.name)}t&&0!==t.length?j({show:!0,type:_.PromptEnum.Compress,overlay:!0,data:{files:t}}):(0,w.zN)(e("没有选中"))}}),1===k.length&&(0,E.jsx)($.rA,{icon:"edit_attributes",title:e("重命名"),onClick:function(){j({show:!0,type:_.PromptEnum.FileRename,overlay:!0,data:{}})}}),ae&&(0,E.jsx)($.rA,{icon:"api",title:"workflow",onClick:()=>{ne(!ie)}}),Z.can_terminal&&(0,E.jsx)($.rA,{icon:"terminal",title:"shell",onClick:function(){B.show?O({show:!1,path:""}):O({show:!0,path:(0,p.GG)("file",(0,p.vX)())})}}),s(b.oV.share_file)&&(0,E.jsx)($.rA,{icon:"share",title:e("文件分享"),onClick:()=>{i(`${M.o.share_list_setting_page}`)}}),(0,E.jsx)($.rA,{icon:"grid_view",title:e("切换样式"),onClick:we}),(0,E.jsx)($.rA,{icon:"create_new_folder",title:e("创建文件夹"),onClick:function(){j({show:!0,type:_.PromptEnum.DirNew,overlay:!0,data:{dir:(0,p.GG)("file",(0,p.vX)())}})}}),(0,E.jsx)($.rA,{icon:"note_add",title:e("创建文本文件"),onClick:function(){j({show:!0,type:_.PromptEnum.FileNew,overlay:!0,data:{dir:(0,p.GG)("file",(0,p.vX)())}})}}),(0,E.jsx)($.rA,{icon:"upload_file",title:e("上传"),onClick:()=>{j({show:!0,type:_.PromptEnum.UploadFile,overlay:!0,data:{call:e=>{let t=e.currentTarget?.files;if(!t)return;let i=!!t[0].webkitRelativePath;const n=[],s=new Set;for(let e=0;e<t.length;e++){const o=t[e],a=i?o.webkitRelativePath:`${o.webkitRelativePath}${o.name}`;o.fullPath=a,i&&s.add((0,R.S)(a)),n.push(o)}const o=[];if(i)for(const e of s)o.push({isDir:!0,fullPath:e,name:e});o.push(...n),u(o),j({show:!0,type:_.PromptEnum.FilesUpload,overlay:!1,data:{}})}}})}}),(0,E.jsx)($.rA,{icon:"info",title:e("信息"),onClick:async()=>{let e;if(!H.now_absolute_path){G.ws.addMsg(A.HK.file_info,t=>{const i=t.context;e&&(H={...H,...i},G.ws.removeMsg(A.HK.file_info),ve(H))});const t=await G.ws.sendData(A.HK.file_info,{type:m.Iw.folder,path:(0,p.GG)("file",(0,p.vX)())});e=t.context,H=e,ve(H)}ve(H)}}),(0,E.jsx)($.rA,{icon:"more_vert",title:e("切换目录"),onClick:t=>{const n=new C.ik;n.x=t.clientX,n.y=t.clientY,n.type=m.Iw.directory,n.items=W,n.item_pre_value=V,n.textClick=async t=>{if(t.type===C.LU.add)return i(`${M.o.setting_private_env_setting}`),j({data:void 0,overlay:!1,type:"",show:!1}),void(0,w.N9)(e("请配置 文件夹路径"));j({data:void 0,overlay:!1,type:"",show:!1}),t.type!==C.LU.child?(async e=>{q(e),await r.$M.post("base_switch",{root_index:e}),await re(),i("/file/"),L([]),Y([])})(t.index):i((0,P.IO)(M.o.file,t.rel))},j({show:!0,type:_.PromptEnum.FileMenu,overlay:!1,data:n})}})]})}var Y=i(2543),B=i(21499),O=i(17903);const Z=n.lazy(()=>Promise.all([i.e(7856),i.e(6349),i.e(3659)]).then(i.bind(i,63659))),W=n.lazy(()=>Promise.all([i.e(7856),i.e(1636)]).then(i.bind(i,81636))),T=n.lazy(()=>i.e(9857).then(i.bind(i,69857)));let V,q="";function J(){const[e,t]=(0,o.fp)(l.AG.editorSetting),[,i]=(0,o.fp)(l.AG.md_editor),[,w]=(0,o.fp)(l.AG.log_viewer),[,z]=(0,o.fp)(l.AG.image_editor),[,D]=(0,o.fp)(l.AG.markdown),[,N]=(0,o.fp)(l.AG.excalidraw_editor),[,F]=(0,o.fp)(l.AG.mind_editor),[,R]=(0,o.fp)(l.AG.timeline_editor),[,K]=(0,o.fp)(l.AG.excel_editor),[H,J]=(0,o.fp)(l.AG.file_preview),{t:Q}=(0,v.Bd)();let ee=(0,c.zy)();const te=(0,c.Zp)(),[ie,ne]=(0,o.fp)(l.AG.nowFileList),[se]=(0,o.fp)(l.AG.file_list_refresh),[oe]=(0,o.fp)(l.AG.mount_enabled),[ae,le]=(0,o.fp)(l.AG.current_mount),[re,ce]=(0,o.fp)(l.AG.showPrompt),[de,_e]=(0,o.fp)(l.AG.selectedFileList),[pe,fe]=(0,o.fp)(l.AG.clickFileList),[he,ue]=(0,o.fp)(l.AG.fileShellShow),[me,we]=(0,n.useState)(""),[ve,ge]=(0,o.fp)(l.AG.workflow_show),[xe,ye]=(0,o.fp)(l.AG.workflow_realtime_show),[je,ke]=(0,o.fp)(l.AG.work_flow_show),{initUserInfo:Ge}=(0,n.useContext)(g.F),[Ae,be]=(0,o.fp)(l.AG.user_base_info),{check_user_auth:Ce}=(0,x.MH)(),{click_file:Se}=(0,h.kZ)(),[Me]=(0,c.ok)(),ze=(0,h._A)(),$e=n.useRef(null),[De,Ne]=(0,o.fp)(l.AG.to_running_files),[Ee,Fe]=(0,o.fp)(l.AG.file_page),[Ie]=(0,o.fp)(l.AG.blank_search_mode),[,Pe]=(0,o.fp)(l.AG.prompt_card),[Xe,Re]=(0,o.fp)(l.AG.blank_search_mode_for_temp),Ke=(0,h.oT)(),Le="1"===Me.get("chat_open"),He=Ce(b.oV.ai_agent_page);(0,n.useEffect)(()=>{Ae?.user_data&&Le&&!He&&Ke("chat_open",null)},[Le,He,Ae]);const[Ue,Ye]=(0,o.fp)(l.AG.studio_chat_width),Be=n.useRef(null),[Oe,Ze]=(0,n.useState)(!1),[We,Te]=(0,n.useState)(void 0),Ve=(0,h.dN)(),[qe,Je]=(0,o.fp)(l.AG.ai_chat_session_by_cwd),Qe=function(){const e=(0,h.Cf)(),[t,i]=(0,o.fp)(l.AG.user_base_info),{t:s}=(0,v.Bd)(),{check_user_auth:a}=(0,x.MH)(),[d,f]=(0,o.fp)(l.AG.router_jump),u=(0,c.Zp)(),{initUserInfo:w}=(0,n.useContext)(g.F),[y,j]=(0,o.fp)(l.AG.nowFileList),[k,S]=(0,o.fp)(l.AG.showPrompt),[z,$]=(0,o.fp)(l.AG.fileShellShow),[D,N]=(0,o.fp)(l.AG.blank_search_mode);return i=>{i.preventDefault(),i.stopPropagation();const n=new C.ik;n.x=i.clientX,n.y=i.clientY,n.type=m.Iw.directory;const o=[{r:(0,E.jsx)("span",{style:(0,L.ok)(t.user_data.dir_show_type===b.t8.time_minx_max),children:s("时间逆序")}),v:b.t8.time_minx_max},{r:(0,E.jsx)("span",{style:(0,L.ok)(t.user_data.dir_show_type===b.t8.time_max_min),children:s("时间顺序")}),v:b.t8.time_max_min}],l=[{r:(0,E.jsx)("span",{style:(0,L.ok)(t.user_data.dir_show_type===b.t8.size_min_max),children:s("大小顺序")}),v:b.t8.size_min_max},{r:(0,E.jsx)("span",{style:(0,L.ok)(t.user_data.dir_show_type===b.t8.size_max_min),children:s("大小逆序")}),v:b.t8.size_max_min}],c=[{r:(0,E.jsx)("span",{style:(0,L.ok)(!t.user_data.file_list_pagination_mode||t.user_data.file_list_pagination_mode===b.yM.all),children:s("全部加载文件")}),v:b.yM.all},{r:(0,E.jsx)("span",{style:(0,L.ok)(t.user_data.file_list_pagination_mode===b.yM.pagination),children:s("scrll_l")}),v:b.yM.pagination}],d=[{r:(0,E.jsx)("span",{style:(0,L.ok)(!t.user_data.file_time_show_type||t.user_data.file_time_show_type===b.KD.current),children:s("最近时间")}),v:b.KD.current},{r:(0,E.jsx)("span",{style:(0,L.ok)(t.user_data.file_time_show_type===b.KD.time),children:s("准确时间")}),v:b.KD.time}],v=[{r:s("文件列表展示"),items:[{r:s("文件排序"),v:"",items:[{r:(0,E.jsx)("span",{style:(0,L.ok)(!t.user_data.dir_show_type),children:s("系统默认")}),v:b.t8.defualt},{r:(0,E.jsx)("span",{style:(0,L.ok)(t.user_data.dir_show_type===b.t8.name),children:s("名字")}),v:b.t8.name},{r:(0,E.jsx)("span",{style:(0,L.ok)(t.user_data.dir_show_type===b.t8.time_minx_max||t.user_data.dir_show_type===b.t8.time_max_min),children:s("修改时间")}),v:!1,items:o},{r:(0,E.jsx)("span",{style:(0,L.ok)(t.user_data.dir_show_type===b.t8.size_min_max||t.user_data.dir_show_type===b.t8.size_max_min),children:s("文件大小")}),v:!1,items:l}]},{r:s("文件加载方式"),v:"",items:c},{r:s("时间展示"),v:"",items:d},{r:s("缩放调整"),v:"zoom_adjust"},{r:(0,E.jsx)("span",{style:(0,L.ok)(D),children:s("srchbln")}),v:"blank_search_mode"}]}];e.git_available&&y?.folders?.find(e=>".git"===e.name)&&v.push({r:s("查看Git提交"),v:"git_page"}),a(b.oV.code_resource)&&v.push({r:s("add_rot"),v:"code_resource"}),a(b.oV.http_proxy)&&v.push({r:s("dl_here"),v:"http_resource"}),t?.user_data?.quick_cmd&&(0,h.LL)([...t.user_data.quick_cmd],v),n.items=v,n.textClick=async e=>{if(console.log(e),!1===e)return;const t={};if("gcfg_dir_config"===e){const e=(0,p.GG)("file",(0,p.vX)());return S({data:void 0,overlay:!1,type:"",show:!1}),void u(`${M.o.gcfg_page}/${encodeURIComponent(e)}`)}if("git_page"===e){const e=(0,p.GG)("file",(0,p.vX)());return S({data:void 0,overlay:!1,type:"",show:!1}),void u(`${M.o.git_page}/${encodeURIComponent(e)}`)}if("code_resource"===e){const e=await G.ws.sendData(A.HK.file_info,{path:(0,p.GG)("file",(0,p.vX)())});return f({page_self_router_api_data:[`/api/${Date.now()}`,e.context.now_absolute_path]}),S({data:void 0,overlay:!1,type:"",show:!1}),void u("/setting/customer_router/")}if("http_resource"===e){const e=await G.ws.sendData(A.HK.file_info,{path:(0,p.GG)("file",(0,p.vX)())});return f({http_download_map_path:e.context.now_absolute_path}),S({data:void 0,overlay:!1,type:"",show:!1}),void u("/proxy/http/")}if("zoom_adjust"===e)return S({data:void 0,overlay:!1,type:"",show:!1}),void setTimeout(()=>{S({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",$({show:!0,path:(0,p.GG)("file",(0,p.vX)()),cmd:t})))}else{if("blank_search_mode"===e)return N(!D),void S({data:void 0,overlay:!1,type:"",show:!1});if(e===b.yM.all||e===b.yM.pagination)t.is_pagination_mode=!0;else if(e===b.KD.current||e===b.KD.time)t.is_file_show_type=!0;else{if(e!==b.t8.defualt&&e!==b.t8.name&&e!==b.t8.size_max_min&&e!==b.t8.size_min_max&&e!==b.t8.time_max_min&&e!==b.t8.time_minx_max)return;t.is_dir_list_type=!0}}await r.wm.post(X.s.user_save_private_attr,{type:e,...t}),await w(),S({data:void 0,overlay:!1,type:"",show:!1}),u((0,p.vX)())},S({show:!0,type:_.PromptEnum.FileMenu,overlay:!1,data:n})}}(),et=async e=>{let t=!1;for(const i of e.files??[])i.origin_size=i.size,i.size=(0,y.v7)(i.size),Ae.user_data.file_time_show_type===b.KD.time?i.show_mtime=i.mtime?(0,B.Yq)(i.mtime):"":i.show_mtime=i.mtime?(0,j.s)(i.mtime):"",t||!i.name.endsWith(".workflow.yml")&&!i.name.endsWith(".act")||(t=!0),i.name===k.SB&&(t=!0);for(const i of e.folders??[])Ae.user_data.file_time_show_type===b.KD.time?i.show_mtime=i.mtime?(0,B.Yq)(i.mtime):"":i.show_mtime=i.mtime?(0,j.s)(i.mtime):"",i.name===k.SB&&(t=!0);ke(t)},tt=n.useRef(null),it=async e=>{if(!0===oe){if(tt.current!==e){tt.current=e;try{const t=await r.$M.post("file/mount_info",{param_path:e});le(t?.data??null),await G.ws.connect()}catch(e){le(null)}}}else le(null)};(0,n.useEffect)(()=>{je&&(async()=>{const e=new k.Nd,t=(0,a.zp)().get(l.AG.current_mount);e.dir_path=(0,h.Zl)((0,p.GG)("file",(0,p.vX)()),t),G.ws.addMsg(A.HK.workflow_realtime,e=>{const t=e.context;if(e.context){for(const e of t.sucess_file_list)(0,h.Ys)(e);for(const e of t.failed_file_list)(0,h.V$)(e);Ne(new Set(t.running_file_list))}}),await G.ws.sendData(A.HK.workflow_realtime,e)})()},[je,ae,ee]);const nt=async()=>{const e=(0,p.GG)("file",(0,p.vX)());if(Ie||Xe)return;let t;if(it(e),Ae.user_data.file_list_pagination_mode===b.yM.pagination){if(q!==e){if(q=e,1!==Ee.page_num)return void Fe({page_size:Ee.page_size,page_num:1})}else if(Ee.page_num<0)return;if(t=await r.$M.post("file_get_page",{param_path:e,page_num:Ee.page_num,page_size:Ee.page_size}),t.code!==f.m.Success)return;const i=t.data;return et(i),i.files?.length?(ne(e=>{const t=(0,Y.cloneDeep)(1===Ee.page_num?i.files:[...e?.files??[],...i.files]),n={...e,files:t};return(0,h.yC)(n,Ae.user_data.dir_show_type),n}),void(V=t.data)):void Fe({page_size:Ee.page_size,page_num:-1})}if(t=await r.$M.get(e),t.code!==f.m.Success)return;const i=t.data;(0,h.yC)(i,Ae.user_data.dir_show_type),et(t.data),ne(t.data),V=t.data};(0,n.useEffect)(()=>async()=>{Ne(new Set)},[]);const st=()=>{ke(!1),(()=>{const e=Me.get("preview_file_name"),t=Me.get("preview_mode");if(!e||!t)return!1;const n=(0,p.GG)("file",(0,p.vX)());if($e.current===n+e)return!0;$e.current=n+e;const s=()=>ze(null);return"md"===t?(i({url:r.$M.getDownloadUrl(`${encodeURIComponent(n)}${e}`),path:`${n}${e}`,name:e,close:s}),!0):"log"===t?(w({show:!0,fileName:e,encoding:Me.get("preview_log_enc")??"utf8",wrap:Me.get("preview_log_wrap")??"wrap",close:s}),!0):"image_edit"===t?(z({path:(0,P.IO)((0,p.vX)(),e),name:e,close:s}),!0):(Se({name:e,opt_shell:!0,..."text"===t?{model:"text"}:{},close:s}),!0)})()||(t({open:!1}),J({open:!1}),i({}),w({show:!1}),z({}),D({}),N({}),F({}),R({}),K({}),nt())};(0,n.useEffect)(()=>{st()},[ee,Ee]),(0,n.useEffect)(()=>{se>0&&nt()},[se]);const ot=n.useRef(!1);(0,n.useEffect)(()=>{if(null!==oe)return ot.current?void(!0===oe?it((0,p.GG)("file",(0,p.vX)())):le(null)):(ot.current=!0,void(!0===oe&&null===ae&&it((0,p.GG)("file",(0,p.vX)()))))},[oe]);const at=e=>{e.target===e.currentTarget&&(_e([]),fe([]))},lt=n.useCallback((0,Y.throttle)(e=>{const t=Be.current;if(!t||!t.parentElement)return;const i=parseFloat(getComputedStyle(t).fontSize),n=t.parentElement.getBoundingClientRect(),s=n.right-e.clientX,o=Math.min(Math.max(s,320),.7*n.width);Ye(parseFloat((o/i).toFixed(2)))},32),[]),rt=()=>{Ze(!1),document.removeEventListener("pointermove",lt)},ct=(0,E.jsxs)("div",{className:"file-list-main",children:[(0,E.jsx)(s.e,{baseRoute:"file",clickFun:function(){if(_e([]),fe([]),Ae.user_data.file_list_pagination_mode===b.yM.pagination){const e=document.getElementById("listing");e&&(e.scrollTop=0),Fe({page_size:Ee.page_size,page_num:1})}},input_path_enter:e=>{var t;_e([]),fe([]),ne({files:[],folders:[]}),!function(e){return"string"==typeof e&&0!==e.length&&(/^[a-zA-Z]:[\\\/]/.test(e)||/^\\\\[^\\/]+[\\/]/.test(e)||/^\//.test(e))}(e)?te(function(e,t){let i=function(e){let t="\\";for(const i of e)if("/"===i||"\\"===i){t=i;break}return t}(e);if("."===t)return e;if(".."===t){if(e.length>1){let t=e[e.length-1]===i?1:0;for(let n=e.length-1-t;n>=0;n--)if(e[n]===i)return e.substring(0,n+1)}return e}return e.endsWith(i)&&t.startsWith(i)?e.slice(0,-1)+t:e.endsWith(i)||t.startsWith(i)?e+t:e+i+t}((0,p.vX)(),e)):(e=e.replace(0===(t=Ae.user_data).folder_item_now||void 0===t.folder_item_now?t.cwd:t.folder_items[t.folder_item_now-1].path,""),te(e))}}),ae&&(0,E.jsxs)("div",{className:"mount-tip-bar",style:{borderLeftColor:ae.color},children:[(0,E.jsx)("span",{className:"material-icons",style:{color:ae.color},children:"cloud"}),(0,E.jsx)("span",{children:[ae.credential_note,ae.account_note||(O.C1.find(e=>e.value===ae.driver)?.title??ae.driver),ae.name].filter(Boolean).join(" - ")}),ae.readonly&&(0,E.jsx)("span",{className:"mount-readonly-tag",children:Q("只读")})]}),Ae.user_data.file_list_pagination_mode===b.yM.pagination?(0,E.jsx)(S.$J,{handleContextMenu:Qe,clickBlank:at,list:ie.files}):(0,E.jsx)(S.t$,{handleContextMenu:Qe,file_list:ie.files,folder_list:ie.folders,clickBlank:at})]});return(0,E.jsxs)(n.Fragment,{children:[(0,E.jsx)(d.aZ,{children:(0,E.jsx)(u.$Z,{handleEnterPress:async()=>{if(Ie||Xe){if(_e([]),fe([]),!me||!me.trim())return void ne({files:[],folders:[]});const e=(0,p.GG)("file",(0,p.vX)()),t=await r.$M.post("file_get_page",{param_path:e,page_num:1,page_size:1e4,search:me.trim()});if(t.code!==f.m.Success)return;const i=t.data;return(0,h.yC)(i,Ae.user_data.dir_show_type),et(i),ne(i),void(V=i)}if(!V)return;_e([]),fe([]);const e=[],t=[];for(const t of V.files??[])t.name.includes(me)&&e.push(t);for(const e of V.folders??[])e.name.includes(me)&&t.push(e);ne({files:e,folders:t})},placeholder:Q("搜索当前目录"),icon:"search",value:"",mobile_hidden:!0,handleIconClick:()=>{const e=(0,p.GG)("file",(0,p.vX)());Pe({open:!0,title:Q("深搜"),context_div:(0,E.jsx)(I,{base_path:e})})},handleInputChange:e=>{we(e)},max_width:"25em"})}),(0,E.jsxs)(d.aZ,{position:"right",children:[Ce(b.oV.ai_agent_page)&&(0,E.jsx)($.rA,{icon:"smart_toy",title:Q("AI 聊天"),selected:Le,onClick:()=>Ke("chat_open",!Le?"1":null)}),(0,E.jsx)("div",{className:"mobile-context-btn",children:(0,E.jsx)($.rA,{icon:"more_horiz",title:Q("右键"),onClick:()=>{const e=de[de.length-1];if(void 0!==e){const t=[...ie.folders??[],...ie.files??[]][e];if(t){const i=document.querySelectorAll(".item")[e],n=i?i.getBoundingClientRect():{left:window.innerWidth/2,bottom:100},s={preventDefault:()=>{},stopPropagation:()=>{},clientX:n.left+10,clientY:n.bottom??100},o=new C.ik;o.path=(0,P.IO)((0,p.vX)(),t.name),o.filename=t.name,o.x=s.clientX,o.y=s.clientY,o.type=t.type===m.Iw.folder?m.Iw.folder:(0,C.uL)(t.name),o.size=t.origin_size,ce({show:!0,type:_.PromptEnum.FileMenu,overlay:!1,data:o})}}else{const e={preventDefault:()=>{},stopPropagation:()=>{},clientX:window.innerWidth/2,clientY:window.innerHeight/2};Qe(e)}}})}),(0,E.jsx)(U,{})]}),(0,E.jsxs)("div",{className:"file-list-split"+(Le?" file-list-split--chat":""),children:[ct,Le&&(0,E.jsxs)(n.Fragment,{children:[(0,E.jsx)("div",{className:"studio__divider studio__divider--chat",ref:Be,onPointerDown:e=>{e.preventDefault(),Ze(!0),document.addEventListener("pointermove",lt),document.addEventListener("pointerup",rt,{once:!0})}}),(0,E.jsx)("div",{className:"studio-chat-panel",style:{width:`${Ue}em`},children:(0,E.jsx)(n.Suspense,{fallback:null,children:(0,E.jsx)(T,{inline_header:!0,sync_url:!1,file_cwd_path:Ve(),session_id:We??(dt=Ve(),l.AG.get_ai_chat_session(qe,dt)),on_session_change:e=>{Te(e),((e,t)=>{Je({...qe,[e]:t})})(Ve(),e)}})})})]})]}),Oe&&(0,E.jsx)("div",{className:"shell__overlay",onPointerUp:rt}),ve&&(0,E.jsx)(Z,{}),xe.open&&(0,E.jsx)(W,{})]});var dt}}}]);