filecat 7.19.4 → 7.20.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/README.md +1 -1
  2. package/build/dist/{1075.5bb46386465b67572742.js → 1075.f34567d9a6631935577b.js} +1 -1
  3. package/build/dist/1636.2be7829caf415f5ac3ef.js +1 -0
  4. package/build/dist/2547.a3ebdfe9fb7f9f108b42.js +1 -0
  5. package/build/dist/2674.baeefe07825285fe57c2.js +1 -0
  6. package/build/dist/{3402.b6dc28d2f9bace7cde85.js → 3402.30e70a3fe5d2c355bae5.js} +1 -1
  7. package/build/dist/3528.927c03ef653c2814bb99.js +1 -0
  8. package/build/dist/3659.7fa7d8207206eed8369c.js +1 -0
  9. package/build/dist/4903.a4194ec784a0ff517e93.js +1 -0
  10. package/build/dist/4935.9a2e3cdca4bf73f94195.js +1 -0
  11. package/build/dist/{621.9b9a5312624393359a06.js → 621.cd64e24a79a49069f8db.js} +1 -1
  12. package/build/dist/6404.a22a232695feabc4ced4.js +1 -0
  13. package/build/dist/6805.0b520886329433755a49.js +1 -0
  14. package/build/dist/7181.99755de29517a9f425ee.js +1 -0
  15. package/build/dist/735.604edd65d99569268b60.js +1 -0
  16. package/build/dist/8358.733904ad1949e2b279d2.js +1 -0
  17. package/build/dist/9299.b7c5cf19d416a6a020b8.js +1 -0
  18. package/build/dist/9546.daf11613208aa3723c43.js +1 -0
  19. package/build/dist/9857.f84b299465579d7dd3ce.js +1 -0
  20. package/build/dist/index.html +1 -1
  21. package/build/dist/main.962cd9c07f68fe36c533.js +2 -0
  22. package/build/dist/{main.c6275d45aa40388c2a6e.js.LICENSE.txt → main.962cd9c07f68fe36c533.js.LICENSE.txt} +2 -0
  23. package/build/main.js +1 -1
  24. package/package.json +1 -1
  25. package/build/dist/1636.b80b1883358e132d3424.js +0 -1
  26. package/build/dist/2626.3bcfe1f26d9cb796a925.js +0 -1
  27. package/build/dist/2674.9825c584f48653978e35.js +0 -1
  28. package/build/dist/3528.55d2faabf2edbde62652.js +0 -1
  29. package/build/dist/3659.6295cbd36d76000c23ab.js +0 -1
  30. package/build/dist/4903.cac82807407e7342b5ad.js +0 -1
  31. package/build/dist/4935.fe24d47c4075780c9c11.js +0 -1
  32. package/build/dist/4946.d578f6ba367a742d80bf.js +0 -2
  33. package/build/dist/4946.d578f6ba367a742d80bf.js.LICENSE.txt +0 -1
  34. package/build/dist/6010.5400c344149450c83284.js +0 -1
  35. package/build/dist/6104.b286dc9e43e5b85f3181.js +0 -1
  36. package/build/dist/6404.288a0ac8b516b5420a33.js +0 -1
  37. package/build/dist/6805.08bb228068e30b062a14.js +0 -1
  38. package/build/dist/7181.4a2a55b9951c128ed625.js +0 -1
  39. package/build/dist/735.fbde74013a5afe5e8ffe.js +0 -1
  40. package/build/dist/8302.2abcf81d682a064d4265.js +0 -1
  41. package/build/dist/8358.ec38a2d61360d90c0df7.js +0 -1
  42. package/build/dist/892.7c2341cc1d38845fceb9.js +0 -1
  43. package/build/dist/9299.1106d83fb5af65fee252.js +0 -1
  44. package/build/dist/9334.d3102e0ed30ae564f506.js +0 -1
  45. package/build/dist/9546.badfa0110de4ce7e211c.js +0 -1
  46. package/build/dist/main.c6275d45aa40388c2a6e.js +0 -2
package/README.md CHANGED
@@ -55,7 +55,7 @@ FileCat是采用[filebrowser](https://github.com/filebrowser/filebrowser)的ui
55
55
  | 网盘与协议挂载 | 将百度网盘、SSH(SFTP)、S3、WebDAV 、SMB 挂载为本地目录,与本地文件使用同一套操作 |
56
56
  | Markdown 所见即所得 | 类 Typora 的 Markdown 编辑体验,所见即所得 |
57
57
  | AI Agent | 集成大语言模型,智能辅助运维和文件处理(需自行配置 API),支持接入 QQ, 企业微信 ,飞书 ,钉钉 第三方平台机器人 |
58
- | 内网穿透 | 将内网暴露到公网,或者多个内网之间互相通信 |
58
+ | 内网穿透 | 将内网暴露到公网,或者多个内网之间互相通信 ,基于此功能可以实现各个客户端无缝的文件操作体验,像CI/CD这样的需求,就可以在多个机器上部署一个成为客户端,进跨机器的CI/CD自动化构建 |
59
59
  | SSH 终端 | 浏览器内置 Web 终端,随时连接服务器 |
60
60
  | Windows 远程桌面 | 浏览器中直接操作远程 Windows 桌面(RDP) |
61
61
  | 系统信息看板 | 实时 CPU、内存、磁盘、网络等系统监控 |
@@ -1 +1 @@
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(89334);const v=new _.A({html:!0,linkify:!0,breaks:!1,typographer:!1});function y(t){return t.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}v.renderer.rules.html_block=(t,e)=>`<div data-html-block="${(0,b.pC)(t[e].content)}"></div>`,v.renderer.rules.html_inline=(t,e)=>`<span data-html-inline="${(0,b.pC)(t[e].content)}"></span>`,v.renderer.rules.fence=(t,e)=>{const n=t[e],r=n.info?n.info.trim().split(/\s+/)[0]:"",o=n.content.replace(/\n$/,""),s=v.utils.escapeHtml(o),a=r?` class="language-${y(r)}"`:"";return`<pre${r?` data-language="${y(r)}"`:""}><code${a}>${s}</code></pre>\n`},v.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}),v.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"]}),v.renderer.rules.math_inline=(t,e)=>`<span data-math-inline="${(0,b.pC)(t[e].meta.raw)}"></span>`,v.renderer.rules.math_block=(t,e)=>`<div data-math-block="${(0,b.pC)(t[e].meta.raw)}"></div>`;const w=v.renderer.rules.fence;function $(t){const e=v.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")}v.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(52388);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.A.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.A.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.A.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.A.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),[,v]=(0,s.fp)(a.AG.mind_editor),y=(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)=>{v({name:n("思维导图"),code_source:t,on_save_code:t=>e(t)})},(0,r.useEffect)(()=>{y.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)},v=_.current;v.addEventListener("error",s,!0),v.addEventListener("load",a,!0);const E=()=>{v.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(v,{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&&y.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(),v.removeEventListener("error",s,!0),v.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(89334);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
+ "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 v=new _.A({html:!0,linkify:!0,breaks:!1,typographer:!1});function y(t){return t.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}v.renderer.rules.html_block=(t,e)=>`<div data-html-block="${(0,b.pC)(t[e].content)}"></div>`,v.renderer.rules.html_inline=(t,e)=>`<span data-html-inline="${(0,b.pC)(t[e].content)}"></span>`,v.renderer.rules.fence=(t,e)=>{const n=t[e],r=n.info?n.info.trim().split(/\s+/)[0]:"",o=n.content.replace(/\n$/,""),s=v.utils.escapeHtml(o),a=r?` class="language-${y(r)}"`:"";return`<pre${r?` data-language="${y(r)}"`:""}><code${a}>${s}</code></pre>\n`},v.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}),v.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"]}),v.renderer.rules.math_inline=(t,e)=>`<span data-math-inline="${(0,b.pC)(t[e].meta.raw)}"></span>`,v.renderer.rules.math_block=(t,e)=>`<div data-math-block="${(0,b.pC)(t[e].meta.raw)}"></div>`;const w=v.renderer.rules.fence;function $(t){const e=v.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")}v.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(52388);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.A.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.A.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.A.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.A.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),[,v]=(0,s.fp)(a.AG.mind_editor),y=(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)=>{v({name:n("思维导图"),code_source:t,on_save_code:t=>e(t)})},(0,r.useEffect)(()=>{y.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)},v=_.current;v.addEventListener("error",s,!0),v.addEventListener("load",a,!0);const E=()=>{v.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(v,{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&&y.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(),v.removeEventListener("error",s,!0),v.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])}}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[1636],{88062(e,n,o){o(96540),o(47022);var s=o(74848);function t(e){return(0,s.jsx)("div",{className:"black-tip",onClick:()=>{e.click&&e.click(e)},onContextMenu:n=>{n.stopPropagation(),n.nativeEvent.stopImmediatePropagation(),e.onContextMenu&&e.onContextMenu(n,e)},children:e.name})}const i=e=>(0,s.jsxs)("li",{children:[e.click?(0,s.jsx)(t,{...e.node,name:e.render?e.render(e.node):e.node.name,click:e.click,onContextMenu:e.onContextMenu}):(0,s.jsx)("div",{children:e.render?e.render(e.node):e.node.name}),e.node.children&&e.node.children.length>0&&(0,s.jsx)("ul",{children:e.node.children.map((n,o)=>(0,s.jsx)(i,{node:n,click:e.click,onContextMenu:e.onContextMenu,render:e.render},o))})]}),c=e=>(0,s.jsx)("div",{className:"card-tree-view",children:(0,s.jsx)("ul",{children:e.list&&e.list.map((n,o)=>(0,s.jsx)(i,{node:n,click:e.click,onContextMenu:e.onContextMenu,render:e.render},o))})});o.d(n,["A",0,c])},81636(e,n,o){o.r(n),o.d(n,{default:()=>g});var s=o(22022),t=o(96540),i=o(34843),c=o(82893),r=o(92275),l=o(14944),d=o(70447),a=o(85997),u=o(4412),x=o(75725),f=o(47071),h=o(34289),m=o(88062),j=o(97856),v=(o(62042),o(15629),o(99214)),p=o(74848);const k=t.lazy(()=>o.e(3233).then(o.bind(o,85614)));let _,w;function g(e){const{t:n}=(0,s.Bd)(),[o,g]=(0,i.fp)(c.AG.workflow_realtime_show),[C]=(0,i.fp)(c.AG.current_mount),[y,M]=(0,t.useState)([]),[b,q]=(0,t.useState)([]),[S,F]=(0,t.useState)(!1),[A,N]=(0,t.useState)(void 0),[$,B]=(0,t.useState)([]),G=e=>{for(const n of e){if(null==n.code&&n?.extra_data?.running_type===f.rl.running)n.name=(0,p.jsxs)("div",{children:[(0,p.jsx)(d.fq,{running:!0}),n.name]});else if(0===n.code)n.name=(0,p.jsxs)("div",{children:[(0,p.jsx)(d.fq,{success:!0}),n.name]});else{if(!(n.code<1)){delete n.children;continue}n.name=(0,p.jsxs)("div",{children:[(0,p.jsx)(d.fq,{success:!1}),n.name]})}n.children&&G(n.children)}};(0,t.useEffect)(()=>(F(!1),_=void 0,w=void 0,(async()=>{const e=new f.v3;e.filename_path=`${(0,v.Zl)((0,h.GG)("file",(0,h.vX)()),C)}${o.filename}`,l.ws.addMsg(r.HK.workflow_realtime_one_rsq,e=>{if(e.context.list&&e.context.list.length>0){const n=e.context.list;G(n),B(n)}e.context.new_log&&E(e.context.new_log)}),l.ws.sendData(r.HK.workflow_realtime_one_req,e)})(),async()=>{l.ws.removeMsg(r.HK.workflow_realtime_one_rsq),w&&(w.dispose(),w=null)}),[]);const E=async e=>{w||await new Promise(e=>{_=e,F(!0),(async()=>{const e=new j.Terminal({fontFamily:"Monaco, Menlo, Consolas, 'Courier New', monospace",theme:{background:"#FFFFFF",foreground:"#000000",cursor:"#000000",selectionBackground:"#a6d2ff"},cursorBlink:!0,cursorStyle:"bar",scrollback:1e3,scrollSensitivity:1,tabStopWidth:4,convertEol:!0});w=e,N(e)})()}),e&&w.write(e)};return(0,p.jsxs)("div",{children:[(0,p.jsxs)(u.aZ,{position:"right",children:[A&&(0,p.jsx)(a.rA,{icon:"print",title:"打印日志",onClick:()=>{F(!S)}}),(0,p.jsx)(a.rA,{icon:"close",title:n("关闭"),onClick:()=>{g({open:!1})}})]}),(0,p.jsx)(x.jW,{isFull:!0,more:!0,children:(0,p.jsx)(x.NN,{children:(0,p.jsx)(m.A,{list:$,click:e=>{}})})}),(0,p.jsx)("div",{style:{display:S?"":"none"},children:(0,p.jsx)(k,{show:!0,terminal:A,init:()=>{_&&(_(1),_=void 0)}})})]})}},15629(e,n,o){o.d(n,{W:()=>r});o(96540);var s=o(70447),t=o(47071),i=o(22022),c=o(74848);function r({item:e}){const{t:n}=(0,i.Bd)();let o,r;return null!=e.code?o=0===e.code:e.extra_data?.running_type===t.rl.running&&(r=!0),(0,c.jsxs)("div",{children:[(0,c.jsx)(s.fq,{success:o,running:r}),n(o?"成功":"失败")]})}const l=(e,n,o)=>{if(n)for(const o of n??[]){let n;const t=[];o["use-yml"]?(l(t,void 0,o.use_job_children_list),n=`${o["use-yml"]} ;${o.duration??-1}`):o.runs?n=JSON.stringify(o.runs):o.run?n=o.run:o["run-js"]?n=o["run-js"]:o.sleep&&(n=`sleep ${o.sleep}`),n=(0,c.jsxs)("div",{children:[(0,c.jsx)(s.fq,{success:void 0===o.code?void 0:0===o.code})," ",n+" ;"+(o.duration??"")]}),e.push({name:n,children:t,extra_data:{code:o.code,context:o.message}})}else if(o)for(const n of o??[]){const o=(0,c.jsxs)("div",{children:[(0,c.jsx)(s.fq,{success:void 0===n.code?void 0:0===n.code}),"$",n.name]});e.push({name:o,extra_data:{code:n.code,is_job:!0,job_data:n}})}};o.d(n,["Y",0,l])}}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[2547],{83277(e,t,n){n.d(t,{$j:()=>a,Lv:()=>s});class s{token;open=!1;note;index;url;model;request_type;json_params;sys_prompt;dotenv="";yaml_env="";tool_mode=!1;show_options;static get_label_by_v(e,t){if(!e||!t?.length)return e;for(const n of t)if(n.value===e)return n.label;return e}static have_label_by_v(e,t){if(!e||!t?.length)return!1;for(const n of t)if(n.value===e)return!0;return!1}}const o=JSON.stringify({stream:!0,thinking:{type:"disabled"}});function a(e){return"string"==typeof e?e:Array.isArray(e)?e.map(e=>"text"===e.type?e.text:"[图片]").join("\n"):""}n.d(t,["CP",0,"\n# 聊天循环最大次数\ntool_call_max: 500\n\n# 是否允许AI直接执行命令而不需要用户确认。\n# 默认为 false,需要用户手动确认;使用 workflow 时等价于 true。\nallow_exec_cmd_directly: false\n\n# 可选的大模型请求代理地址\n# proxy_url: http://127.0.0.1:7890\n\n# 可选的多个 url\n# options_agent_url_list:\n# - value: http://...\n# label: openai\n\n# 可选的多个 key\n# options_agent_key_list:\n# - value: sk-aaa\n# label: option1\n\n# 可选的多个 model\n# options_agent_model_list:\n# - value: gpt-5.5\n# label: gpt\n\n# 本地 prompt 文件列表,每次聊天时自动读取并加载\n# options_local_file_path_prompt_list:\n# - /prompt/a.txt\n\n# 开启切换模型,AI 可以根据 prompt 自己决定下一步调用哪个模型\n# open_pick_model: false\n\n# 历史消息裁剪相关\nmax_recent_messages: 12\ncompress_message_count: 16\nmax_tool_content_chars: 200\n\n# ===== 模型类型(request_type)=====\n# 默认 completions,可选值:\n# completions 标准对话/聊天补全 (chat/completions)\n# images 图片生成 (images/generations)\n# audio_speech 文本转语音 (audio/speech)\n# audio_transcription 语音转文字 (audio/transcriptions)\n# audio_translation 语音翻译 (audio/translations)\n# embeddings 向量嵌入 (embeddings)\n# request_type: completions\n\n# ===== 成为 tool(tool_mode)=====\n# 开启后该模型会作为一个工具被加载,供 AI agent 动态调用。\n# 注意:不能与「是否开启」(open) 同时为 true。\n# tool_mode: false\n\n# ===== 图片理解(image_understanding)=====\n# 开启后注册 read_image 工具,工具读到的图片会以 image_url 多模态格式随消息发给模型。\nimage_understanding: true\n\n# ===== 命令环境变量(command_env)=====\n# AI 调用内置命令工具(exec_cmd / exec_cmd_background)执行命令时,\n# 这里配置的变量会覆盖到子进程的环境变量上。\n# command_env:\n# NODE_ENV: production\n# HTTP_PROXY: http://127.0.0.1:7890\n\n# 是否允许 AI 通过 set_command_env 工具修改上面的 command_env\ncommand_env_tool: false\n","cL",0,o])},77481(e,t,n){n.d(t,{S:()=>r,X:()=>i});var s=n(96540),o=n(61443),a=n(74848);function i(e){const[t,n]=s.useState([]),i=(0,s.useRef)(-1),[r,l]=(0,s.useState)(-1),[c,d]=(0,s.useState)(-1);(0,s.useEffect)(()=>{e.children?n(Array.isArray(e.children)?e.children:[e.children]):n(e.rows)},[e.rows,e.children]);const m=()=>{i.current=-1,l(-1),d(-1)};return(0,a.jsxs)("table",{children:[(0,a.jsx)("thead",{children:(0,a.jsx)("tr",{children:e.headers?.map((t,n)=>{const s=!!e.filter&&(e.filter.column??0)===n;let i=t;if(s){const n=e.filter,s=n.options.find(e=>e.value===n.value);null!=n.value&&s&&(i=`${t} (${s.label})`)}return(0,a.jsx)("th",{className:s?"table-filter-col":"",children:s?(0,a.jsx)(o.l6,{value:e.filter.value,options:e.filter.options,onChange:e.filter.onChange,bare:!0,trigger_label:i}):t},n)})})}),(0,a.jsx)("tbody",{children:t.map((t,n)=>{const s=!!e.onRowDrag;return(0,a.jsx)("tr",{className:s?(r===n?"row-dragging":"")+(c===n?" row-drop-target":""):"",draggable:s,onContextMenu:()=>{e.handleContextMenu&&e.handleContextMenu(t)},onDragStart:e=>{s&&(i.current=n,l(n),e.dataTransfer.effectAllowed="move")},onDragOver:e=>{!s||i.current<0||(e.preventDefault(),e.dataTransfer.dropEffect="move",d(n))},onDrop:t=>{s&&(t.preventDefault(),(()=>{const t=i.current,n=c;m(),t<0||n<0||t===n||e.onRowDrag?.(t,n)})())},onDragEnd:m,children:t.map((n,s)=>{const o=s===t.length-1?"small":"";return(0,a.jsx)("td",{className:o,style:{width:e.width??"auto"},children:n},s)})},n)})})]})}function r(e){return(0,a.jsx)("div",{style:{display:e.isFlex?"flex":"block"},children:e.columns.map((e,t)=>(0,a.jsx)("div",{children:e},t))})}},52547(e,t,n){n.r(t),n.d(t,{default:()=>N});var s=n(22022),o=n(96540),a=n(85997),i=n(4412),r=n(34843),l=n(82893),c=n(75725),d=n(77481),m=n(61443),p=n(70447),_=n(64484),u=n(14284),h=n(53459),x=n(62042),g=n(7523),v=n(78247),j=n(23430),f=n(61973),y=n(14944),w=n(92275),b=n(88815),C=n(64694),k=n(45907),A=n(12721),S=n(24659),I=n(83277),K=n(74848);function N(){const{t:e}=(0,s.Bd)(),{initUserInfo:t}=(0,o.useContext)(g.F),n=[e("编号"),e("url"),e("是否开启"),e("key"),e("默认model"),e("更多属性"),e("备注")],N=[e("编号"),e("本地目录"),e("自动加载"),e("备注")],[O,P]=(0,o.useState)([]),[L,$]=(0,o.useState)({}),[M,X]=(0,o.useState)([]),[T,D]=(0,o.useState)([]),[R,q]=(0,o.useState)(null),F=(0,o.useRef)(),V=(0,o.useRef)(!1),Y=(0,o.useRef)(!1),[E,W]=(0,o.useState)([]),[H,J]=(0,o.useState)(!1),[B,G]=(0,o.useState)({}),[Z,U]=(0,r.fp)(l.AG.prompt_card),[z,Q]=(0,r.fp)(l.AG.user_base_info),[ee,te]=(0,o.useState)(!1),ne=T.filter(e=>"http"!==(e.transport??"stdio")),se=T.filter(e=>"http"===e.transport),oe=[e("编号"),e("名称"),e("是否开启"),e("状态"),"command","args","cwd",e("tools|env"),e("备注")],ae=[e("编号"),e("名称"),e("是否开启"),e("状态"),e("endpoint"),e("tools|headers"),e("备注")],ie=[e("编号"),e("提示词"),e("LLM编辑开关"),e("llm_pmt"),e("编辑规则"),e("备注")],[re,le]=(0,o.useState)([]),[ce,de]=(0,o.useState)(!1),me=(0,_.T)(),{check_user_auth:pe}=(0,v.MH)(),[_e,ue]=(0,r.fp)(l.AG.editorSetting),he=(0,f.Zp)(),xe=(0,k.y)(),ge=(0,S.K)(),ve=async()=>{const e=await u.jV.get("docs_on_get");e.code===h.m.Success&&te(e.data)};(0,o.useEffect)(()=>{(async()=>{const e=await u.XO.get("ai_agent_setting");e.code===h.m.Success&&P(e.data.models);const t=await u.XO.get("ai_agent_global_setting");t.code===h.m.Success&&$(t.data??{}),await y.ws.addMsg(w.HK.ai_load_info,e=>{q(e.context)});const n=await y.ws.sendData(w.HK.ai_load_info,{});n?.context&&q(n.context);const s=await u.XO.get("ai_docs_setting");s.code===h.m.Success&&(F.current=s.data.param,s.data.list?.length&&X(s.data.list));const o=await u.XO.get("ai_mcp_setting");o.code===h.m.Success&&D(o.data.list??[]),await ke(),ve();const a=await u.XO.get("ai_system_prompts");a.code===h.m.Success&&le(a.data??[]);const i=await u.XO.get("ai_long_term_memory_setting");i.code===h.m.Success&&de(i.data?.open??!1)})()},[]),(0,o.useEffect)(()=>{y.ws.addMsg(w.HK.mcp_status,e=>{const t=e.context??{},n={};for(const e of t.status??[])n[e.index]={state:e.state,error:e.error,tool_count:e.tool_count};G(n),t.done&&ke()})},[]);const je=(e="stdio")=>{const t="http"===e?{name:"",open:!1,note:"",transport:"http",endpoint:"",headers:"",stream:!1,timeout_ms:1e4}:{name:"",open:!1,command:"",args:"",cwd:"",env:"",note:"",transport:"stdio",timeout_ms:1e4};D([...T,t]),V.current=!0},fe=e=>{const t=T.indexOf(e);t<0||(T.splice(t,1),D([...T]),V.current=!0)},ye=e=>{D([...T,{...e,open:!1}]),V.current=!0},we=async e=>{for(let e=0;e<O.length;e++)O[e].index=e;(await u.XO.post("ai_agent_setting/save",{models:e??O})).code===h.m.Success&&(0,x.SK)("保存成功")},be=async e=>{(await u.XO.post("ai_agent_global_setting/save",e??L)).code===h.m.Success&&(0,x.SK)("保存成功")},Ce=async e=>{for(let e=0;e<T.length;e++)T[e].index=e;(await u.XO.post("ai_mcp_setting/save",{list:e??T})).code===h.m.Success&&((0,x.SK)("保存成功"),V.current=!1,y.ws.sendData(w.HK.mcp_reload,{}))},ke=async()=>{const e=await u.XO.get("ai_mcp_tools");return e.code===h.m.Success?(W(e.data??[]),e.data??[]):[]},Ae=async e=>{J(!0);try{const t=await u.XO.post("ai_mcp_tools/reload",{index:e});if(t.code===h.m.Success)return await ke(),(0,x.SK)("MCP工具加载成功"),t.data??null}finally{J(!1)}return null},Se=async(t,n,s,o)=>{const a=o??E.find(e=>e.index===n)??{index:n,key:`${n}`,name:t.name??"",note:t.note,transport:t.transport??"stdio",open:!!t.open,loaded:!1,tool_count:0,tools:[]},i=(a.tools??[]).map(t=>({id:t.runtime_name,title:t.tool_name,subtitle:t.description||e("无描述"),detail:t.display_name,meta:t.runtime_name}));U({open:!0,title:`${t.name||t.note||n} MCP工具`,context_div:(0,K.jsx)(A.O,{title:`${t.name||t.note||n} MCP工具`,subtitle:`${a.transport??"stdio"} | ${a.open?e("是"):e("否")} | ${a.loaded?"loaded":"idle"} | ${a.tool_count} tools`,pages:i,initialPageId:s,onRefresh:async()=>{const e=await Ae(n);e&&await Se(t,n,s,e)},renderPage:t=>{if(!t)return(0,K.jsx)("div",{className:"prompt-switch-page__empty",children:e("暂无工具")});const n=a.tools?.find(e=>e.runtime_name===t.id);return n?(0,K.jsxs)("div",{className:"prompt-switch-page__detail",children:[(0,K.jsx)("div",{className:"prompt-switch-page__detail-title",children:n.display_name}),(0,K.jsx)("div",{className:"prompt-switch-page__detail-desc",children:n.description||e("无描述")}),(0,K.jsxs)("div",{className:"prompt-switch-page__detail-row",children:[(0,K.jsx)("strong",{children:"runtime:"})," ",n.runtime_name]}),(0,K.jsxs)("div",{children:[(0,K.jsx)("strong",{children:"schema:"}),(0,K.jsx)("pre",{className:"prompt-switch-page__schema",children:JSON.stringify(n.input_schema??{},null,2)})]})]}):(0,K.jsx)("div",{className:"prompt-switch-page__empty",children:e("暂无工具")})}}),cancel:()=>U({open:!1})})},Ie=t=>{const n=B[t];let s=n?.state,o=n?.error,a=n?.tool_count;if(!s){const e=E.find(e=>e.index===t);s=e?.state,o=e?.error,a=e?.tool_count}switch(s){case"loading":return(0,K.jsx)(p.fq,{loading:!0,text:e("加载中")});case"success":return(0,K.jsx)(p.fq,{success:!0,text:`${a??0} ${e("个工具")}`});case"failed":return(0,K.jsx)("span",{title:o??e("加载失败"),children:(0,K.jsx)(p.fq,{success:!1,text:e("加载失败")})});default:return(0,K.jsx)(p.fq,{text:e("未加载")})}},Ke=async e=>{for(let e=0;e<O.length;e++)O[e].index=e;let t={list:M,docs_update_tag:Y.current};null!=e&&(t={param:e}),Y.current=!1;(await u.XO.post("ai_docs_setting_save",t)).code===h.m.Success&&(0,x.SK)("保存成功")},Ne=async()=>{for(let e=0;e<re.length;e++)re[e].index=e;(await u.XO.post("ai_system_prompts/save",{list:re})).code===h.m.Success&&(0,x.SK)("保存成功")};return(0,K.jsxs)("div",{children:[(0,K.jsx)(i.aZ,{position:"right",children:pe(j.oV.ai_agent_setting)&&(0,K.jsx)(a.rA,{icon:"arrow_back",title:e("上一页"),onClick:()=>{he(-1)}})}),(0,K.jsx)(c.jW,{isFull:!0,more:!0,children:(0,K.jsx)(c.NN,{children:(0,K.jsxs)(c.xh,{children:[(0,K.jsx)(c.fI,{children:(0,K.jsx)(c.VP,{widthPer:100,maxWidth:"130rem",children:(0,K.jsx)(p.uF,{self_title:(0,K.jsxs)("span",{className:" div-row ",children:[(0,K.jsx)("h2",{children:e("供应商设置")})," ",(0,K.jsx)(a.rA,{icon:"info",onClick:()=>{me('\n1. Only OpenAI-style AI APIs are supported. Fill in the FULL endpoint path (not just the domain), e.g. https://ark.cn-beijing.volces.com/api/v3/chat/completions\n2. The longer the conversation history, the more expensive the LLM token cost. Currently, there is no long-term memory simplification capability. You can set the system prompt to make the AI answer more concisely to save tokens\n3. When writing the model request parameter JSON, you can only write JSON in it, to configure the attributes supported by OpenAI-style AI, such as temperature, thinking (Doubao\'s deep thinking toggle), etc.\n4. You can enable "stream": true in the model request parameters to improve response speed.\n5. Deep thinking currently affects output speed. It is recommended to set { "thinking" : { "type":"disabled" } } to disable it (Doubao example).\n6. To use the AI feature to query server information, the AI needs to be able to know some commands. You need to first set command permissions for the user in user settings. It is recommended to set * to allow all commands, and then set the dangerous commands that are not allowed to be executed in the settings\n7. The model type and Become Tool are now both configured in "More Attributes → Extra Parameter Settings" using request_type / tool_mode (comments are already provided in the editor).\n8. After becoming a tool, the model will be loaded as a tool, enabling different models to serve as different roles; please do not set both it and "Enabled" to true at the same time.\n')},title:"信息"})]}),rightTopCom:(0,K.jsxs)("div",{children:[(0,K.jsx)(a.rA,{icon:"short_text",title:e("全局prompt"),onClick:()=>{ue({model:"ace/mode/text",open:!0,fileName:"",save:async e=>{L.sys_prompt=e,$({...L}),v.xK.set_value_temp(""),await be({...L,sys_prompt:e})}}),v.xK.set_value_temp(L.sys_prompt??"")}}),(0,K.jsx)(a.rA,{icon:"edit_attributes",title:e("全局")+" "+e("model请求参数json编写"),onClick:()=>{ue({model:"ace/mode/json",open:!0,fileName:"",save:async e=>{L.json_params=e,$({...L}),v.xK.set_value_temp(""),await be({...L,json_params:e})},can_format:!0}),v.xK.set_value_temp(L.json_params??"")}}),(0,K.jsx)(a.rA,{icon:"settings",title:e("全局")+" "+e("额外参数设置"),onClick:()=>{ue({model:"ace/mode/yaml",open:!0,fileName:"",save:async e=>{L.yaml_env=e,$({...L}),v.xK.set_value_temp(""),await be({...L,yaml_env:e})}}),v.xK.set_value_temp(L.yaml_env??"")}}),(0,K.jsx)(a.rA,{icon:"add",title:e("添加"),onClick:()=>{P([...O,{note:"",open:!1,path:"",yaml_env:I.CP,json_params:I.cL}])}}),(0,K.jsx)(a.rA,{icon:"save",title:e("保存"),onClick:async()=>{await we()}})]}),children:(0,K.jsx)(d.X,{headers:n,onRowDrag:(e,t)=>{P((0,C.TI)(O,e,t))},rows:O.map((t,n)=>{const s=[(0,K.jsx)("div",{children:n}),(0,K.jsx)(m.Sm,{value:I.Lv.get_label_by_v(t.url,t.show_options?.options_agent_url_list),options:t.show_options?.options_agent_url_list,handleInputChange:e=>{t.url=e},no_border:!0}),(0,K.jsx)(m.l6,{value:t.open,onChange:e=>{((e,t,n)=>{const s=[];for(let e=0;e<O.length;e++)O[e].open=e===n&&t,s.push(O[e]);P(s)})(0,e,n)},options:ge,no_border:!0}),(0,K.jsx)(m.Sm,{type:I.Lv.have_label_by_v(t.token,t.show_options?.options_agent_key_list)?null:"password",value:I.Lv.get_label_by_v(t.token,t.show_options?.options_agent_key_list),options:t.show_options?.options_agent_key_list,handleInputChange:e=>{t.token=e},no_border:!0}),(0,K.jsx)(m.Sm,{value:I.Lv.get_label_by_v(t.model,t.show_options?.options_agent_model_list),options:t.show_options?.options_agent_model_list,handleInputChange:e=>{t.model=e},no_border:!0}),(0,K.jsxs)("div",{children:[(0,K.jsx)(a.rA,{icon:"short_text",title:"prompt",onClick:()=>{v.xK.set_value_temp(O[n].sys_prompt??""),ue({model:"ace/mode/text",open:!0,fileName:"",save:async e=>{O[n].sys_prompt=e,P(O),v.xK.set_value_temp(""),we(O)}})}}),(0,K.jsx)(a.rA,{icon:"edit_attributes",title:"model请求参数json编写",onClick:()=>{v.xK.set_value_temp(O[n].json_params),ue({model:"ace/mode/json",open:!0,fileName:"",save:async e=>{O[n].json_params=e,P(O),v.xK.set_value_temp(""),we(O)},can_format:!0})}}),(0,K.jsx)(a.rA,{icon:"settings",title:"额外参数设置",onClick:()=>{v.xK.set_value_temp(O[n].yaml_env),ue({model:"ace/mode/yaml",open:!0,fileName:"",save:async e=>{O[n].yaml_env=e,P(O),v.xK.set_value_temp(""),we(O)}})}})]}),(0,K.jsx)(m.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,K.jsxs)("div",{children:[(0,K.jsx)(a.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{O.splice(e,1),P([...O])})(n)}),(0,K.jsx)(a.rA,{icon:"copy_all",title:e("复制"),onClick:()=>(e=>{P([...O,{...O[e],open:!1}])})(n)})]})];return s}),width:"10rem"})})})}),(0,K.jsx)(c.fI,{children:(0,K.jsx)(c.VP,{widthPer:70,maxWidth:"100rem",children:(0,K.jsx)(p.uF,{self_title:(0,K.jsxs)("span",{className:" div-row ",children:[(0,K.jsxs)("h2",{children:[e("MCP")+" "+e("设置")," - stdio"]})," ",(0,K.jsx)(a.rA,{icon:"info",onClick:()=>{me("\n1. 这里配置的是 MCP Client 启动参数,当前实现的是 stdio 模式,也就是通过 command + args 启动本地 MCP Server\n2. 例如可以填 npx / uvx / python 等命令,再配合对应的 MCP server 包参数\n3. 保存后会自动重新加载 MCP 工具,agent 聊天时会把这些工具一起带给模型\n4. 建议把 cwd 配到具体项目目录,避免 server 在错误目录里运行\n")},title:"信息"})]}),rightTopCom:(0,K.jsxs)("div",{children:[(0,K.jsx)(a.rA,{icon:"add",title:e("添加"),onClick:()=>je("stdio")}),(0,K.jsx)(a.rA,{icon:"save",title:e("保存"),onClick:()=>{Ce()}})]}),children:(0,K.jsx)(d.X,{headers:oe,onRowDrag:(e,t)=>{D((0,C.TI)(T,T.indexOf(ne[e]),T.indexOf(ne[t]))),V.current=!0},rows:ne.map((t,n)=>{const s=T.indexOf(t);return[(0,K.jsx)("div",{children:n}),(0,K.jsx)(m.Sm,{value:t.name,handleInputChange:e=>{t.name=e,V.current=!0},no_border:!0}),(0,K.jsx)(m.l6,{value:t.open,onChange:e=>{t.open=e,D([...T]),V.current=!0},options:ge,no_border:!0}),Ie(T.indexOf(t)),(0,K.jsx)(m.Sm,{value:t.command,handleInputChange:e=>{t.command=e,V.current=!0},no_border:!0}),(0,K.jsx)(m.Sm,{value:t.args,handleInputChange:e=>{t.args=e,V.current=!0},no_border:!0}),(0,K.jsx)(m.Sm,{value:t.cwd,handleInputChange:e=>{t.cwd=e,V.current=!0},no_border:!0}),(0,K.jsxs)("div",{children:[(0,K.jsx)(a.rA,{icon:"visibility",title:"查看工具",onClick:()=>{Se(t,s)}}),(0,K.jsx)(a.rA,{icon:"settings",title:"env",onClick:()=>{v.xK.set_value_temp(t.env??""),ue({model:"ace/mode/yaml",open:!0,fileName:"",save:async e=>{t.env=e,D([...T]),v.xK.set_value_temp(""),V.current=!0,Ce()}})}})]}),(0,K.jsx)(m.Sm,{value:t.note,handleInputChange:e=>{t.note=e,V.current=!0},no_border:!0}),(0,K.jsxs)("div",{children:[(0,K.jsx)(a.rA,{icon:"delete",title:e("删除"),onClick:()=>fe(t)}),(0,K.jsx)(a.rA,{icon:"copy_all",title:e("复制"),onClick:()=>ye(t)})]})]}),width:"10rem"})})})}),(0,K.jsx)(c.fI,{children:(0,K.jsxs)(c.VP,{widthPer:70,maxWidth:"100rem",children:[(0,K.jsx)(p.uF,{self_title:(0,K.jsxs)("span",{className:" div-row ",children:[(0,K.jsxs)("h2",{children:[e("MCP")+" "+e("设置")," - HTTP"]})," "]}),rightTopCom:(0,K.jsxs)("div",{children:[(0,K.jsx)(a.rA,{icon:"add",title:e("添加"),onClick:()=>je("http")}),(0,K.jsx)(a.rA,{icon:"save",title:e("保存"),onClick:()=>{Ce()}})]}),children:(0,K.jsx)(d.X,{headers:ae,onRowDrag:(e,t)=>{D((0,C.TI)(T,T.indexOf(se[e]),T.indexOf(se[t]))),V.current=!0},rows:se.map((t,n)=>{const s=T.indexOf(t);return[(0,K.jsx)("div",{children:n}),(0,K.jsx)(m.Sm,{value:t.name,handleInputChange:e=>{t.name=e,V.current=!0},no_border:!0}),(0,K.jsx)(m.l6,{value:t.open,onChange:e=>{t.open=e,D([...T]),V.current=!0},options:ge,no_border:!0}),Ie(T.indexOf(t)),(0,K.jsx)(m.Sm,{value:t.endpoint,handleInputChange:e=>{t.endpoint=e,V.current=!0},no_border:!0}),(0,K.jsxs)("div",{children:[(0,K.jsx)(a.rA,{icon:"visibility",title:"查看工具",onClick:()=>{Se(t,s)}}),(0,K.jsx)(a.rA,{icon:"settings",title:"headers",onClick:()=>{v.xK.set_value_temp(t.headers??""),ue({model:"ace/mode/yaml",open:!0,fileName:"",save:async e=>{t.headers=e,D([...T]),v.xK.set_value_temp(""),V.current=!0,Ce()}})}})]}),(0,K.jsx)(m.Sm,{value:t.note,handleInputChange:e=>{t.note=e,V.current=!0},no_border:!0}),(0,K.jsxs)("div",{children:[(0,K.jsx)(a.rA,{icon:"delete",title:e("删除"),onClick:()=>fe(t)}),(0,K.jsx)(a.rA,{icon:"copy_all",title:e("复制"),onClick:()=>ye(t)})]})]}),width:"10rem"})}),(0,K.jsx)(p.uF,{self_title:(0,K.jsxs)("span",{className:" div-row ",children:[(0,K.jsx)("h2",{children:e("系统会话提示词")})," ",(0,K.jsx)(a.rA,{icon:"info",onClick:()=>{me('\n1. 系统会话提示词,在 AI 聊天页创建会话时可以选择,选中的提示词会自动填入聊天框作为第一条系统消息\n2. 适用于预先设定常用的会话场景模板,如"代码审查"、"翻译助手"、"运维诊断"等\n3. "LLM编辑开关":开启后,当用户选择了该系统提示词发起对话时,AI 将会获得一个"更新会话提示词"工具,允许 AI 在对话中对当前会话进行总结,并写入到本提示词的"LLM编辑提示词"字段(全局保存,供之后的新会话沿用),使 AI 能自我维护长期上下文。\n4. "LLM编辑提示词":可选。AI 编辑后写回的内容(可预填初始方向)。仅在"LLM编辑开关"开启时生效。\n5. "编辑规则":可选。给 LLM 的编辑要求,例如"总结时不要超过 300 token"、"用简洁的项目要点记录"等。仅在"LLM编辑开关"开启时生效。\n')},title:"信息"})]}),rightTopCom:(0,K.jsxs)("div",{children:[(0,K.jsx)(a.rA,{icon:"add",title:e("添加"),onClick:()=>{le([...re,{prompt:"",note:"",llm_prompt_enable:!1}])}}),(0,K.jsx)(a.rA,{icon:"save",title:e("保存"),onClick:()=>{Ne()}})]}),children:(0,K.jsx)(d.X,{headers:ie,onRowDrag:(e,t)=>{le((0,C.TI)(re,e,t))},rows:re.map((t,n)=>{const s=[(0,K.jsx)("div",{children:n}),(0,K.jsx)("div",{children:(0,K.jsx)(a.rA,{icon:"short_text",title:e("提示词"),onClick:()=>{v.xK.set_value_temp(t.prompt??""),ue({model:"ace/mode/text",open:!0,fileName:"",save:async e=>{t.prompt=e,le([...re]),v.xK.set_value_temp(""),Ne()}})}})}),(0,K.jsx)(a.Ay,{checked:!!t.llm_prompt_enable,onChange:e=>{t.llm_prompt_enable=e,le([...re])},title:e("LLM编辑开关")}),(0,K.jsx)("div",{children:(0,K.jsx)(a.rA,{icon:"edit_note",title:e("llm_pmt"),onClick:()=>{v.xK.set_value_temp(t.llm_prompt??""),ue({model:"ace/mode/text",open:!0,fileName:"",save:async e=>{t.llm_prompt=e,le([...re]),v.xK.set_value_temp(""),Ne()}})}})}),(0,K.jsx)("div",{children:(0,K.jsx)(a.rA,{icon:"rule",title:e("编辑规则"),onClick:()=>{v.xK.set_value_temp(t.llm_prompt_tip??""),ue({model:"ace/mode/text",open:!0,fileName:"",save:async e=>{t.llm_prompt_tip=e,le([...re]),v.xK.set_value_temp(""),Ne()}})}})}),(0,K.jsx)(m.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,K.jsx)("div",{children:(0,K.jsx)(a.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{re.splice(e,1),le([...re])})(n)})})];return s}),width:"10rem"})}),(0,K.jsx)(p.uF,{self_title:(0,K.jsxs)("span",{className:" div-row ",children:[(0,K.jsx)("h2",{children:e("长期记忆")})," ",(0,K.jsx)(a.rA,{icon:"info",onClick:()=>{me(e("开启后跨会话保存记忆。四个固定文件:周/月/年/永久。每周结束自动压缩周→月,每月结束自动压缩月→年,每年结束自动压缩年→永久。编辑按钮可手动查看和修改。"))},title:"信息"})]}),rightTopCom:(0,K.jsx)("div",{children:(0,K.jsx)(a.Ay,{checked:ce,onChange:async t=>{de(t),await u.XO.post("ai_long_term_memory_setting/save",{open:t}),(0,x.SK)(e("长期记忆设置已保存"))},title:e("开关")})}),children:(0,K.jsx)("div",{style:{display:"flex",gap:"0.5rem",padding:"0.5rem 0",flexWrap:"wrap"},children:[{type:"week",label:e("周记忆"),tip:e("上限3000字")},{type:"month",label:e("月记忆"),tip:e("上限6000字")},{type:"year",label:e("年记忆"),tip:e("上限9000字")},{type:"forever",label:e("永久记忆"),tip:e("上限12000字")}].map(({type:t,label:n,tip:s})=>(0,K.jsx)(a.rA,{icon:"edit",title:`${e("编辑")} ${n} (${s})`,onClick:async()=>{const e=await u.XO.get(`ai_long_term_memory_bucket/${t}`),n=e.code===h.m.Success?e.data??"":"";v.xK.set_value_temp(n),ue({model:"ace/mode/text",open:!0,fileName:`long_term_memory_${t}.txt`,save:async e=>{await u.XO.post(`ai_long_term_memory_bucket/${t}/save`,{data:e}),v.xK.set_value_temp("")}})}},t))})})]})}),(0,K.jsxs)(c.fI,{children:[(0,K.jsx)(c.VP,{widthPer:50,maxWidth:"80rem",children:(0,K.jsx)(p.uF,{self_title:(0,K.jsxs)("span",{className:" div-row ",children:[(0,K.jsx)("h2",{children:e("本地知识库")})," ",(0,K.jsx)(a.rA,{icon:"info",onClick:()=>{me("\n1. 本地知识库用于为AI增强理解能力,或者分析本地文件,原理读取本地的文件,对文件在内存中建立全文索引,为AI提供额外数据(需要有模型开启才能使用)\n2. 该功能只能用于小型知识库,作为本地小型或者公司内部资料使用还是没有问题的\n3. 每次保存都会重新加载知识库中的文件,不会全部重新加载,而是检测哪些文件有变更\n")},title:"信息"})]}),rightTopCom:(0,K.jsxs)("div",{children:[(0,K.jsx)(a.Ay,{checked:ee,onChange:async e=>{await u.jV.post("docs_on_set",{status:e}),ve(),t()},title:e("知识库开关")}),(0,K.jsx)(a.rA,{icon:"settings",title:"额外参数设置",onClick:()=>{v.xK.set_value_temp(F.current),ue({model:"ace/mode/yaml",open:!0,fileName:"",save:async e=>{F.current=e,v.xK.set_value_temp(""),Ke(F.current)}})}}),(0,K.jsx)(a.rA,{icon:"add",title:e("添加"),onClick:()=>{X([...M,{note:"",auto_load:!1,dir:""}]),Y.current=!0}}),(0,K.jsx)(a.rA,{icon:"save",title:e("保存"),onClick:()=>{Ke()}})]}),children:(0,K.jsx)(d.X,{headers:N,onRowDrag:(e,t)=>{X((0,C.TI)(M,e,t)),Y.current=!0},rows:M.map((t,n)=>{const s=[(0,K.jsx)("div",{children:n}),(0,K.jsx)(m.Sm,{value:t.dir,handleInputChange:e=>{t.dir=e,Y.current=!0},no_border:!0}),(0,K.jsx)(m.l6,{value:t.auto_load,onChange:e=>{t.auto_load=e,X([...M]),Y.current=!0},options:ge,no_border:!0}),(0,K.jsx)(m.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,K.jsxs)("div",{children:[(0,K.jsx)(a.rA,{icon:"delete",title:e("删除记录"),onClick:()=>(e=>{M.splice(e,1),X([...M]),Y.current=!0})(n)}),(0,K.jsx)(a.rA,{icon:"restore",title:e("手动加载"),onClick:()=>{xe({sub_title:"手动加载",confirm_fun:()=>{u.jV.post("docs_load_file",{param_path:t.dir}),(0,x.SK)("ok")}})}}),(0,K.jsx)(a.rA,{icon:"delete_forever",title:e("从索引删除"),onClick:()=>{xe({sub_title:"从索引删除",confirm_fun:()=>{u.jV.post("docs_del",{param_path:t.dir}),(0,x.SK)("ok")}})}})]})];return s}),width:"10rem"})})}),R&&(0,K.jsx)(c.VP,{widthPer:50,maxWidth:"80rem",children:(0,K.jsxs)(p.Zp,{title:e("知识库加载信息"),children:[(0,K.jsx)(c.Yh,{left:e("最近一次加载")+","+e("加载进度"),right:R?.progress}),(0,K.jsx)(c.Yh,{left:`${e("最近一次加载")},${e("总文件数量")}`,right:R?.num}),(0,K.jsx)(c.Yh,{left:`${e("最近一次加载")},${e("总文件字符数量")}`,right:R?.char_num}),(0,K.jsx)(c.Yh,{left:`${e("最近一次加载")},${e("总文件大小")}`,right:(0,b.v7)(R?.size)}),(0,K.jsx)(c.Yh,{left:`${e("最近一次加载")},${e("总耗时")}`,right:(0,b.a3)(R?.consume_time_ms_len)}),(0,K.jsx)(c.Yh,{left:`${e("总文件数量")}`,right:R?.total_num})]})})]})]})})})]})}},24659(e,t,n){var s=n(22022);n.d(t,["K",0,()=>{const{t:e}=(0,s.Bd)();return[{title:e("是"),value:!0,color:"#28a745"},{title:e("否"),value:!1,color:"#666666"}]}])}}]);
@@ -0,0 +1 @@
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 +1 @@
1
- "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[3402],{72693(e,n,s){s.d(n,{w:()=>m});var t=s(96540),r=s(22022),c=s(14944),o=s(92275),l=s(34843),a=s(82893),i=s(85997),d=s(14284),u=s(74848);function f(e){const{t:n}=(0,r.Bd)(),[s,c]=(0,t.useState)(!1),o=!!e.sessionId;return(0,u.jsxs)("div",{children:[(0,u.jsx)("div",{style:{maxHeight:"60vh",overflow:"auto",whiteSpace:"pre-wrap",wordBreak:"break-all",background:"var(--surfaceSecondary)",padding:"0.75em",borderRadius:"0.5em",marginBottom:"0.75em",fontFamily:"monospace",fontSize:"0.9em",lineHeight:"1.5"},children:e.cmd}),o&&(0,u.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"0.5em",marginBottom:"0.75em",color:s?"var(--icon-blue)":"var(--textSecondary)"},children:[(0,u.jsx)(i.Ay,{checked:s,onChange:n=>{c(n),n&&e.onAutoAllow()},title:n("此会话不再询问")}),(0,u.jsx)("span",{children:n("此会话不再询问")})]}),(0,u.jsxs)("div",{style:{display:"flex",gap:"0.5em",justifyContent:"flex-end"},children:[(0,u.jsx)(i.$n,{text:n("拒绝"),color:"var(--red)",clickFun:e.onDeny}),(0,u.jsx)(i.$n,{text:n("允许"),clickFun:e.onAllow})]})]})}function m(){const[e,n]=(0,l.fp)(a.AG.prompt_card),{t:s}=(0,r.Bd)(),i=(0,t.useRef)([]),m=(0,t.useRef)(!1),h=(0,t.useRef)(null),w=(0,t.useRef)(void 0),p=(0,t.useRef)(()=>{}),_=(0,t.useCallback)(e=>{n({open:!1}),m.current=!1,h.current&&(c.ws.sendData(o.HK.ai_confirm_cmd,{askId:h.current,approved:e}),h.current=null),p.current()},[n]),k=(0,t.useCallback)(()=>{if(m.current)return;if(0===i.current.length)return m.current=!1,void n({open:!1});m.current=!0;const e=i.current.shift();e?(h.current=e.askId,w.current=e.session_id,n({open:!0,title:s("命令确认"),cancel:()=>_(!1),context_div:(0,u.jsx)(f,{cmd:e.cmd,sessionId:e.session_id,onDeny:()=>_(!1),onAllow:()=>_(!0),onAutoAllow:async()=>{if(w.current)try{await d.jV.post("session/cmd_auto_allow",{session_id:w.current,allow:!0})}catch(e){console.error("设置会话命令免确认失败",e)}_(!0)}})})):m.current=!1},[s,_,n]);p.current=k;const x=(0,t.useCallback)(e=>{i.current.push(e),k()},[k]);(0,t.useEffect)(()=>{const e=e=>{const s=e.context||{};if(s.dismiss&&s.askId)return i.current=i.current.filter(e=>e.askId!==s.askId),void(m.current&&h.current===s.askId&&(h.current=null,m.current=!1,n({open:!1}),k()));s.askId&&s.cmd&&x({askId:s.askId,cmd:s.cmd,session_id:s.session_id})};return c.ws.addMsg(o.HK.ai_confirm_cmd,e),()=>{c.ws.off_message(`message_${o.HK.ai_confirm_cmd}`,e)}},[x]),(0,t.useEffect)(()=>()=>{i.current=[],m.current=!1,h.current=null},[])}},63402(e,n,s){s.r(n),s.d(n,{default:()=>h});var t=s(96540),r=s(97856),c=s(92275),o=s(14944),l=s(34843),a=s(82893),i=s(64405),d=s(40505),u=s(72693),f=s(74848);const m=t.lazy(()=>Promise.all([s.e(4924),s.e(5614)]).then(s.bind(s,85614)));function h(e){const[n,s]=(0,t.useState)(null),[h,w]=(0,l.fp)(a.AG.fileShellShow),[p,_]=(0,l.fp)(a.AG.file_shell_hidden),[k,x]=(0,l.fp)(a.AG.user_base_info),g=k.user_data.theme?.includes("dark")?"#FFFFFF":"#000000";(0,u.w)();const y=()=>{n?.dispose(),s(null)};(0,t.useEffect)(()=>()=>{y()},[]),(0,t.useEffect)(()=>{h.show?n?h.cmd&&o.ws.sendData(c.HK.shell_send,h.cmd):(async()=>{const e=new r.Terminal({fontFamily:"Monaco, Menlo, Consolas, 'Courier New', monospace",theme:{background:"#FFFFFF",foreground:g,cursor:g,selectionBackground:"#a6d2ff"},cursorBlink:!0,cursorStyle:"bar",scrollback:1e3,scrollSensitivity:1,tabStopWidth:4});let n;const t=n=>{e.write(n)};n=s=>{e.clear(),e.write(s),n=t},await o.ws.addMsg(c.HK.shell_getting,e=>{n(e.context)}),await o.ws.addMsg(c.HK.shell_copy,n=>{n.context&&(0,d.lW)(n.context),e.focus()}),e.onData(async e=>{const n=new c.hf(c.HK.shell_send);n.context=e,await o.ws.send(n)}),s(e)})():y()},[h]);return(0,f.jsx)(m,{show:h.show,file_shell_hidden:p,terminal:n,init:(e,s)=>{n.writeln("open shell... ");const t=new c.hf(c.HK.shell_open),r=new i.n;r.init_path=h.path,r.rows=e,r.cols=s,r.http_token=localStorage.getItem("token"),t.context=r,o.ws.send(t),h.cmd&&o.ws.sendData(c.HK.shell_send,h.cmd)}})}}}]);
1
+ "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[3402],{72693(e,n,s){s.d(n,{w:()=>m});var t=s(96540),r=s(22022),c=s(14944),o=s(92275),l=s(34843),a=s(82893),i=s(85997),d=s(14284),u=s(74848);function f(e){const{t:n}=(0,r.Bd)(),[s,c]=(0,t.useState)(!1),o=!!e.sessionId;return(0,u.jsxs)("div",{children:[(0,u.jsx)("div",{style:{maxHeight:"60vh",overflow:"auto",whiteSpace:"pre-wrap",wordBreak:"break-all",background:"var(--surfaceSecondary)",padding:"0.75em",borderRadius:"0.5em",marginBottom:"0.75em",fontFamily:"monospace",fontSize:"0.9em",lineHeight:"1.5"},children:e.cmd}),o&&(0,u.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"0.5em",marginBottom:"0.75em",color:s?"var(--icon-blue)":"var(--textSecondary)"},children:[(0,u.jsx)(i.Ay,{checked:s,onChange:n=>{c(n),n&&e.onAutoAllow()},title:n("此会话不再询问")}),(0,u.jsx)("span",{children:n("此会话不再询问")})]}),(0,u.jsxs)("div",{style:{display:"flex",gap:"0.5em",justifyContent:"flex-end"},children:[(0,u.jsx)(i.$n,{text:n("拒绝"),color:"var(--red)",clickFun:e.onDeny}),(0,u.jsx)(i.$n,{text:n("允许"),clickFun:e.onAllow})]})]})}function m(){const[e,n]=(0,l.fp)(a.AG.prompt_card),{t:s}=(0,r.Bd)(),i=(0,t.useRef)([]),m=(0,t.useRef)(!1),h=(0,t.useRef)(null),w=(0,t.useRef)(void 0),p=(0,t.useRef)(()=>{}),_=(0,t.useCallback)(e=>{n({open:!1}),m.current=!1,h.current&&(c.ws.sendData(o.HK.ai_confirm_cmd,{askId:h.current,approved:e}),h.current=null),p.current()},[n]),k=(0,t.useCallback)(()=>{if(m.current)return;if(0===i.current.length)return m.current=!1,void n({open:!1});m.current=!0;const e=i.current.shift();e?(h.current=e.askId,w.current=e.session_id,n({open:!0,title:s("命令确认"),cancel:()=>_(!1),context_div:(0,u.jsx)(f,{cmd:e.cmd,sessionId:e.session_id,onDeny:()=>_(!1),onAllow:()=>_(!0),onAutoAllow:async()=>{if(w.current)try{await d.jV.post("session/cmd_auto_allow",{session_id:w.current,allow:!0})}catch(e){console.error("设置会话命令免确认失败",e)}_(!0)}})})):m.current=!1},[s,_,n]);p.current=k;const x=(0,t.useCallback)(e=>{i.current.push(e),k()},[k]);(0,t.useEffect)(()=>{const e=e=>{const s=e.context||{};if(s.dismiss&&s.askId)return i.current=i.current.filter(e=>e.askId!==s.askId),void(m.current&&h.current===s.askId&&(h.current=null,m.current=!1,n({open:!1}),k()));s.askId&&s.cmd&&x({askId:s.askId,cmd:s.cmd,session_id:s.session_id})};return c.ws.addMsg(o.HK.ai_confirm_cmd,e),()=>{c.ws.off_message(`message_${o.HK.ai_confirm_cmd}`,e)}},[x]),(0,t.useEffect)(()=>()=>{i.current=[],m.current=!1,h.current=null},[])}},63402(e,n,s){s.r(n),s.d(n,{default:()=>w});var t=s(96540),r=s(97856),c=s(92275),o=s(14944),l=s(34843),a=s(82893),i=s(64405),d=s(40505),u=s(72693),f=s(99214),m=s(74848);const h=t.lazy(()=>Promise.all([s.e(4924),s.e(5614)]).then(s.bind(s,85614)));function w(e){const[n,s]=(0,t.useState)(null),[w,p]=(0,l.fp)(a.AG.fileShellShow),[_]=(0,l.fp)(a.AG.current_mount),[k,x]=(0,l.fp)(a.AG.file_shell_hidden),[g,y]=(0,l.fp)(a.AG.user_base_info),v=g.user_data.theme?.includes("dark")?"#FFFFFF":"#000000";(0,u.w)();const F=()=>{n?.dispose(),s(null)};(0,t.useEffect)(()=>()=>{F()},[]),(0,t.useEffect)(()=>{w.show?n?w.cmd&&o.ws.sendData(c.HK.shell_send,w.cmd):(async()=>{const e=new r.Terminal({fontFamily:"Monaco, Menlo, Consolas, 'Courier New', monospace",theme:{background:"#FFFFFF",foreground:v,cursor:v,selectionBackground:"#a6d2ff"},cursorBlink:!0,cursorStyle:"bar",scrollback:1e3,scrollSensitivity:1,tabStopWidth:4});let n;const t=n=>{e.write(n)};n=s=>{e.clear(),e.write(s),n=t},await o.ws.addMsg(c.HK.shell_getting,e=>{n(e.context)}),await o.ws.addMsg(c.HK.shell_copy,n=>{n.context&&(0,d.lW)(n.context),e.focus()}),e.onData(async e=>{const n=new c.hf(c.HK.shell_send);n.context=e,await o.ws.send(n)}),s(e)})():F()},[w]);return(0,m.jsx)(h,{show:w.show,file_shell_hidden:k,terminal:n,init:(e,s)=>{n.writeln("open shell... ");const t=new c.hf(c.HK.shell_open),r=new i.n;r.init_path=(0,f.Zl)(w.path,_),r.rows=e,r.cols=s,r.http_token=localStorage.getItem("token"),t.context=r,o.ws.send(t),w.cmd&&o.ws.sendData(c.HK.shell_send,w.cmd)}})}}}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[3528],{48890(e,t,s){s.d(t,{Kw:()=>a,Tt:()=>i});var a=s(80952),i=(s(82327),s(1766),s(24854),s(90008),s(90846),s(40975),s(44286),s(30766),s(14973),s(69687),s(1234),s(47507),s(87268),s(34678),s(24522));const n=`https://gcore.jsdelivr.net/npm/ace-builds@${a.version}/src-min-noconflict/`;a.config.set("basePath",n),a.config.set("modePath",n),a.config.set("themePath",n),a.config.set("workerPath",n)},53528(e,t,s){s.r(t),s.d(t,{default:()=>q});var a=s(96540),i=s(14284),n=s(62042),c=s(22022),l=s(85997),o=s(61443),r=s(57952),d=s(61973),h=s(34289),m=s(87361),_=s(2543),g=s(34251),p=s(47022),u=s(74848);const f={M:{label:"M",cls:"mod"},A:{label:"A",cls:"add"},D:{label:"D",cls:"del"},R:{label:"R",cls:"ren"},C:{label:"C",cls:"ren"},U:{label:"U",cls:"conf"},"?":{label:"?",cls:"untracked"}};function x(e){const t=e.lastIndexOf("/");return-1===t?e:e.substring(t+1)}function j(e){const t={type:"folder",name:"",full_path:"",children:[]};for(const s of e){const e=s.path.split("/").filter(Boolean);let a=t;for(let t=0;t<e.length;t++){const i=e[t],n=t===e.length-1;let c=a.children.find(e=>e.name===i);c||(c={type:n?"file":"folder",name:i,full_path:a.full_path?`${a.full_path}/${i}`:i,children:[]},a.children.push(c)),n&&(c.data=s.data),a=c}}const s=e=>{e.sort((e,t)=>e.type!==t.type?"folder"===e.type?-1:1:e.name.localeCompare(t.name));for(const t of e)t.children.length&&s(t.children)};return s(t.children),t.children}function N(e){const{t}=(0,c.Bd)(),{file:s,staged:a,status:i,selected:n,active:o,leaf:r}=e,d=f[i]??{label:i,cls:"mod"},h=r?s.path.substring(0,s.path.lastIndexOf("/")):"";return(0,u.jsxs)("div",{className:"git-file"+(o?" git-file--active":""),children:[(0,u.jsx)("input",{type:"checkbox",checked:n.has(s.path),onChange:()=>e.on_toggle(s.path),onClick:e=>e.stopPropagation()}),(0,u.jsx)("span",{className:"file-icons",children:(0,u.jsx)("span",{"data-type":(0,g.uL)(s.path),"data-dir":!1,"aria-label":s.path,children:(0,u.jsx)(l.In,{icon:"",aria_label:s.path})})}),(0,u.jsx)("span",{className:"git-file__name",title:s.oldPath?`${s.oldPath} → ${s.path}`:s.path,onClick:()=>e.on_view_diff(s,a),children:r?x(s.path):s.path}),(0,u.jsx)("span",{className:`git-file__badge git-file__badge--${d.cls}`,children:d.label}),h&&(0,u.jsx)("span",{className:"git-file__dir",title:h,children:h}),(0,u.jsxs)("span",{className:"git-file__ops",children:[(0,u.jsx)(l.rA,{icon:"format_list_numbered",title:t("逐行归属"),onClick:()=>e.on_view_blame(s)}),(0,u.jsx)(l.rA,{icon:a?"remove":"add",title:t(a?"取消暂存":"暂存"),onClick:()=>e.on_stage_one(s,a)}),(0,u.jsx)(l.rA,{icon:"undo",title:t("discard"),onClick:()=>e.on_discard_one(s,a)})]})]})}function v(e){const{node:t,staged:s,file_map:i,prefix:n}=e,[c,o]=(0,a.useState)(!0),r=n?`${n}/${t.name}`:t.name;if("file"===t.type){const t=i.get(r);if(!t)return null;const a=s?t.conflicted?"U":t.index:t.untracked?"?":t.conflicted?"U":t.worktree;return(0,u.jsx)(N,{file:t,staged:s,status:a,selected:e.selected,active:e.active_path===t.path,leaf:!0,on_toggle:e.on_toggle,on_view_diff:e.on_view_diff,on_stage_one:e.on_stage_one,on_view_blame:e.on_view_blame,on_discard_one:e.on_discard_one})}return(0,u.jsxs)("div",{className:"git-tree__folder",children:[(0,u.jsxs)("div",{className:"git-tree__dir",onClick:()=>o(!c),children:[(0,u.jsx)("i",{className:"material-icons git-tree__arrow","data-icon":c?"arrow_drop_down":"arrow_right",children:c?"arrow_drop_down":"arrow_right"}),(0,u.jsx)("span",{className:"file-icons",children:(0,u.jsx)("span",{"data-type":p.Iw.folder,"data-dir":!0,"aria-label":t.name,children:(0,u.jsx)(l.In,{icon:"",aria_label:t.name})})}),(0,u.jsx)("span",{className:"git-tree__dir-name",children:t.name})]}),c&&(0,u.jsx)("div",{className:"git-tree__children",children:t.children?.map((t,a)=>(0,u.jsx)(v,{node:t,staged:s,file_map:i,prefix:r,selected:e.selected,active_path:e.active_path,on_toggle:e.on_toggle,on_view_diff:e.on_view_diff,on_stage_one:e.on_stage_one,on_view_blame:e.on_view_blame,on_discard_one:e.on_discard_one},a))})]})}function y(e){const{t}=(0,c.Bd)(),{title:s,files:i,staged:n,selected:l}=e,o=(0,a.useMemo)(()=>i.map(e=>e.path),[i]),r=o.filter(e=>l.has(e)).length,d=i.length>0&&r===i.length,h=r>0&&!d,m=(0,a.useMemo)(()=>{const e=new Map;for(const t of i)e.set(t.path,t);return e},[i]),_=(0,a.useMemo)(()=>e.tree_mode?function(e){const t=j(e.map(e=>({path:e.path,data:e}))),s=e=>({type:e.type,name:e.name,size:0,children:e.children.length?e.children.map(s):void 0});return t.map(s)}(i):[],[i,e.tree_mode]);return 0===i.length?null:(0,u.jsxs)("div",{className:"git-section",children:[(0,u.jsxs)("div",{className:"git-section__header",children:[(0,u.jsx)("input",{type:"checkbox",checked:d,ref:e=>{e&&(e.indeterminate=h)},onChange:()=>e.on_toggle_all(o,!d)}),(0,u.jsxs)("span",{className:"git-section__title",children:[s," (",i.length,")"]}),(0,u.jsx)("span",{className:"git-section__action",onClick:()=>e.on_stage_section(i,n),children:t(n?"全部取消暂存":"全部暂存")})]}),e.tree_mode?(0,u.jsx)("div",{className:"git-tree",children:_.map((t,s)=>(0,u.jsx)(v,{node:t,staged:n,file_map:m,prefix:"",selected:e.selected,active_path:e.active_path,on_toggle:e.on_toggle,on_view_diff:e.on_view_diff,on_stage_one:e.on_stage_one,on_view_blame:e.on_view_blame,on_discard_one:e.on_discard_one},s))}):i.map(t=>(0,u.jsx)(N,{file:t,staged:n,status:e.status_of(t),selected:e.selected,active:e.active_path===t.path,leaf:!0,on_toggle:e.on_toggle,on_view_diff:e.on_view_diff,on_stage_one:e.on_stage_one,on_view_blame:e.on_view_blame,on_discard_one:e.on_discard_one},t.path+(n?"_s":"_w")))]})}function b(e){const{t}=(0,c.Bd)(),{files:s}=e,[i,n]=(0,a.useState)(!1),o=s.filter(e=>e.staged),r=s.filter(e=>e.untracked||" "!==e.worktree),d={selected:e.selected,on_toggle:e.on_toggle,on_toggle_all:e.on_toggle_all,active_path:e.active_path,tree_mode:i,on_view_diff:e.on_view_diff,on_stage_section:e.on_stage_section,on_stage_one:e.on_stage_one,on_view_blame:e.on_view_blame,on_discard_one:e.on_discard_one};return(0,u.jsxs)("div",{className:"git-change-list",children:[(0,u.jsxs)("div",{className:"git-change-toolbar",children:[(0,u.jsx)(l.rA,{icon:"account_tree",title:t("树形展示"),selected:i,onClick:()=>n(!i)}),e.selected.size>0&&(0,u.jsx)(l.rA,{icon:"undo",title:`${t("discard")} (${e.selected.size})`,onClick:e.on_discard_selected})]}),(0,u.jsx)(y,{title:t("已暂存的更改"),files:o,staged:!0,status_of:e=>e.conflicted?"U":e.index,...d}),(0,u.jsx)(y,{title:t("更改"),files:r,staged:!1,status_of:e=>e.untracked?"?":e.conflicted?"U":e.worktree,...d}),0===s.length&&(0,u.jsx)("div",{className:"git-change-empty",children:t("没有已更改的文件")})]})}var w=s(48890);function k({valueA:e,valueB:t,mode:s="split",theme:i,filename:n}){const c=(0,a.useRef)(null),l=(0,a.useRef)(null),o=(0,a.useMemo)(()=>n&&w.Tt.getModeForPath(n).mode||"ace/mode/text",[n]);return(0,a.useEffect)(()=>{const a=c.current;if(!a)return;const n=w.Kw.require("ace/ext/diff"),r={valueA:e??"",valueB:t??"",diffProvider:new n.DiffProvider},d="inline"===s,h=d?new n.InlineDiffView({...r,inline:"a"},a):new n.SplitDiffView(r);d||(h.container=a,a.appendChild(h.editorA.container),a.appendChild(h.editorB.container)),i&&h.setTheme(i),h.editorA?.session.setMode(o),h.editorB?.session.setMode(o),h.onInput(),h.foldUnchanged();const m=requestAnimationFrame(()=>{h.editorA?.resize(!0),h.editorB?.resize(!0)});return l.current=h,()=>{cancelAnimationFrame(m);try{h.destroy()}catch(e){}l.current=null,a.innerHTML=""}},[e,t,s,i,o]),(0,u.jsx)("div",{className:"ace-diff",ref:c})}const S={text:"",binary:!1,exists:!1};function C({dir_path:e,file:t,left_ref:s,right_ref:n,mode:l="unified"}){const{t:o}=(0,c.Bd)(),[r,d]=(0,a.useState)(S),[h,m]=(0,a.useState)(S),[_,g]=(0,a.useState)(!1),[p,f]=(0,a.useState)(""),x=(0,a.useRef)(0);return(0,a.useEffect)(()=>{const a=++x.current;g(!0),f("");const c=s=>i.TU.post("file_content",{path:e,file:t,ref:s});Promise.all([c(s),c(n)]).then(([e,t])=>{a===x.current&&(d(0===e.code?e.data:S),m(0===t.code?t.data:S))}).catch(e=>{a===x.current&&(f("string"==typeof e?e:e?.message||""),d(S),m(S))}).finally(()=>{a===x.current&&g(!1)})},[e,t,s,n]),_?(0,u.jsx)("div",{className:"git-diff-empty",children:(0,u.jsx)("span",{children:o("加载中")})}):p?(0,u.jsx)("div",{className:"git-diff-empty",children:(0,u.jsx)("span",{children:p})}):r.binary||h.binary?(0,u.jsx)("div",{className:"git-diff-empty",children:(0,u.jsx)("span",{children:o("二进制文件无法比较")})}):r.text===h.text?(0,u.jsx)("div",{className:"git-diff-empty",children:(0,u.jsx)("span",{children:o("无差异")})}):(0,u.jsx)(k,{valueA:r.text??"",valueB:h.text??"",mode:"split"===l?"split":"inline",filename:t})}function z({dir_path:e,entries:t,is_search:s,has_more:o,loading_more:r,active_hash:d,on_select:h,on_scroll_bottom:m,on_search_result:_}){const{t:g}=(0,c.Bd)(),[p,f]=(0,a.useState)(!1),[x,j]=(0,a.useState)(""),[N,v]=(0,a.useState)(""),[y,b]=(0,a.useState)(!1),{rows:w,width:k}=function(e){const t=[],s=[];let a=1;for(const i of e){let e=t.indexOf(i.hash);e<0&&(e=t.indexOf(null),e<0&&(e=t.length,t.push(null)));const n=i.parents||[],c=[];for(const s of n)s&&t.forEach((a,i)=>{i!==e&&a===s&&(c.push(i),t[i]=null)});const l=[];t.forEach((t,s)=>{null===t||s===e||c.includes(s)||l.push(s)}),t[e]=n[0]??null;const o=[e];for(const e of n.slice(1)){let s=t.indexOf(e);s<0&&(s=t.indexOf(null),s<0&&(s=t.length,t.push(null)),t[s]=e),o.push(s)}for(;t.length&&null===t[t.length-1];)t.pop();s.push({column:e,pass_through:l,out_edges:o,merge_in:c}),a=Math.max(a,t.length,e+1,...o.map(e=>e+1))}return{rows:s,width:a}}(s?[]:t),S=async()=>{if(x.trim()||N.trim()){b(!0);try{const t=await i.TU.post("search_commit",{path:e,keyword:x.trim(),author:N.trim(),maxCount:100});0===t.code?_(t.data||[]):(0,n.zN)(t.message)}catch(e){(0,n.zN)(e?.message)}finally{b(!1)}}else(0,n.zN)(g("请输入搜索条件"))},C=(e,t,s)=>{const a=39,i=12,n=s?i:-2,c=e=>16*e+8,l=c(e.column),o=[];for(const t of e.pass_through)o.push((0,u.jsx)("line",{x1:c(t),y1:n,x2:c(t),y2:41,className:"git-log__graph-edge"},`p${t}`));for(const[t,a]of e.merge_in.entries()){const e=c(a);s||o.push((0,u.jsx)("path",{fill:"none",d:`M ${e} -2 C ${e} 19.5 ${l} 19.5 ${l} 12`,className:"git-log__graph-edge"},`m${t}`))}for(const[t,s]of e.out_edges.entries())if(s===e.column)o.push((0,u.jsx)("line",{x1:l,y1:n,x2:l,y2:41,className:"git-log__graph-edge"},`o${t}`));else{const e=c(s);o.push((0,u.jsx)("path",{fill:"none",d:`M ${l} 12 C ${l} 25.5 ${e} 25.5 ${e} 39`,className:"git-log__graph-edge"},`o${t}`))}return(0,u.jsx)("div",{className:"git-log__graph",children:(0,u.jsxs)("svg",{width:16*k,height:a,overflow:"visible",children:[o,(0,u.jsx)("circle",{cx:l,cy:i,r:3.5,className:"git-log__graph-dot"+(t?" git-log__graph-dot--unpushed":"")})]})})};return(0,u.jsxs)("div",{className:"git-log-wrap",children:[(0,u.jsxs)("div",{className:"git-log-search",children:[(0,u.jsx)(l.rA,{icon:"search",title:g("搜索提交"),onClick:()=>{p?(j(""),v(""),_(null),f(!1)):f(!0)}}),p&&(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)("input",{className:"input input--block",autoFocus:!0,value:x,placeholder:g("提交信息关键词"),onChange:e=>j(e.target.value),onKeyDown:e=>"Enter"===e.key&&S()}),(0,u.jsx)("input",{className:"input input--block",value:N,placeholder:g("作者"),onChange:e=>v(e.target.value),onKeyDown:e=>"Enter"===e.key&&S()}),(0,u.jsx)(l.rA,{icon:"check",title:g("搜索"),onClick:S})]})]}),(0,u.jsxs)("div",{className:"git-log",onScroll:m,children:[y&&(0,u.jsx)("div",{className:"git-change-empty",children:g("加载中")}),!y&&0===t.length&&(0,u.jsx)("div",{className:"git-change-empty",children:g("暂无提交记录")}),!y&&t.map((e,t)=>(0,u.jsxs)("div",{className:`git-log__entry${d===e.hash?" git-log__entry--active":""}${e.unpushed?" git-log__entry--unpushed":""}`,onClick:()=>h(e.hash),children:[!s&&C(w[t],!!e.unpushed,0===t),(0,u.jsxs)("div",{className:"git-log__main",children:[(0,u.jsxs)("div",{className:"git-log__row",children:[e.unpushed&&(0,u.jsx)("span",{className:"git-log__unpushed",title:g("未推送")}),(0,u.jsx)("span",{className:"git-log__hash",children:e.hash}),(e.refs||[]).map(e=>(0,u.jsx)("span",{className:"git-log__ref"+(e.includes("HEAD")?" git-log__ref--head":""),children:e.replace("HEAD -> ","")},e)),(0,u.jsx)("span",{className:"git-log__msg",title:e.message,children:e.message})]}),(0,u.jsxs)("div",{className:"git-log__meta",children:[e.author," · ",e.date]})]})]},e.hash)),!y&&!s&&r&&(0,u.jsx)("div",{className:"git-log__more",children:g("加载中")}),!y&&!s&&!r&&!o&&t.length>0&&(0,u.jsx)("div",{className:"git-log__more",children:g("已到底部")})]})]})}var A=s(45907);function $({nodes:e,selected:t,on_select:s}){const[i,n]=(0,a.useState)(new Set),c=e=>e.map(e=>{if("folder"===e.type){const t=!i.has(e.full_path);return(0,u.jsxs)("div",{children:[(0,u.jsxs)("div",{className:"git-commit-tree__dir",onClick:()=>{return t=e.full_path,void n(e=>{const s=new Set(e);return s.has(t)?s.delete(t):s.add(t),s});var t},children:[(0,u.jsx)("i",{className:"material-icons git-tree__arrow",children:t?"arrow_drop_down":"arrow_right"}),(0,u.jsx)("span",{className:"file-icons",children:(0,u.jsx)("span",{"data-type":p.Iw.folder,"data-dir":!0,"aria-label":e.name,children:(0,u.jsx)(l.In,{icon:"",aria_label:e.name})})}),(0,u.jsx)("span",{className:"git-commit-tree__dir-name",children:e.name})]}),t&&(0,u.jsx)("div",{className:"git-commit-tree__children",children:c(e.children)})]},e.full_path)}const a=e.data;return(0,u.jsxs)("div",{className:"git-commit-file git-commit-file--leaf"+(t===e.full_path?" git-commit-file--active":""),onClick:()=>s(e.full_path),title:e.full_path,children:[(0,u.jsx)("span",{className:"file-icons",children:(0,u.jsx)("span",{"data-type":(0,g.uL)(e.name),"aria-label":e.name,children:(0,u.jsx)(l.In,{icon:"",aria_label:e.name})})}),(0,u.jsx)("span",{className:"git-commit-file__name",children:e.name}),a&&null!==a.additions&&(0,u.jsxs)("span",{className:"git-commit-file__stat",children:[(0,u.jsxs)("span",{className:"git-stat--add",children:["+",a.additions]}),(0,u.jsxs)("span",{className:"git-stat--del",children:["-",a.deletions]})]})]},e.full_path)});return(0,u.jsx)(u.Fragment,{children:c(e)})}function U({dir_path:e,hash:t,on_close:s,on_changed:o}){const{t:r}=(0,c.Bd)(),d=(0,A.y)(),[h,m]=(0,a.useState)(null),[_,g]=(0,a.useState)(null),[p,f]=(0,a.useState)("unified"),[x,N]=(0,a.useState)(!1),[v,y]=(0,a.useState)(!1);(0,a.useEffect)(()=>{t&&(g(null),y(!1),w())},[t,e]);const b=(0,a.useMemo)(()=>j((h?.files??[]).map(e=>({path:e.path,data:e}))),[h]),w=async()=>{try{const s=await i.TU.post("commit_detail",{path:e,hash:t});0===s.code?m(s.data):(0,n.zN)(s.message)}catch(e){(0,n.zN)(e?.message)}};if(!h)return(0,u.jsx)("div",{className:"git-card git-card--diff",children:(0,u.jsx)("div",{className:"git-change-empty",children:r("加载中")})});return(0,u.jsxs)("div",{className:"git-card git-card--diff",children:[(0,u.jsxs)("div",{className:"git-commit-meta",children:[(0,u.jsxs)("div",{className:"git-commit-meta__row",children:[(0,u.jsx)("span",{className:"git-commit-meta__hash",children:h.short_hash}),(0,u.jsx)("span",{className:"git-commit-meta__subject",title:h.subject,children:h.subject}),_&&(0,u.jsx)(l.rA,{icon:"compare_arrows",title:r("与工作区对比"),onClick:()=>{_?y(!0):(0,n.zN)(r("请先选择文件"))}}),(0,u.jsx)(l.rA,{icon:"undo",title:r("撤销提交"),onClick:()=>{d({title:r("撤销提交"),sub_title:`${r("将生成一个反向提交来撤销")} ${h.short_hash} ?`,confirm_fun:async()=>{try{const s=await i.TU.post("revert",{path:e,hash:t});0===s.code?((0,n.SK)(r("已撤销")),o?.()):(0,n.zN)(s.message)}catch(e){(0,n.zN)(e?.message)}}})}}),(0,u.jsx)(l.rA,{icon:"content_cut",title:r("摘取提交"),onClick:()=>{d({title:r("摘取提交"),sub_title:`${r("将该提交应用到当前分支")} ${h.short_hash} ?`,confirm_fun:async()=>{try{const s=await i.TU.post("cherry_pick",{path:e,hash:t});0===s.code?((0,n.SK)(r("摘取成功")),o?.()):(0,n.zN)(s.message)}catch(e){(0,n.zN)(e?.message)}}})}}),(0,u.jsx)(l.rA,{icon:"close",title:r("关闭"),onClick:s})]}),(0,u.jsxs)("div",{className:"git-commit-meta__sub",children:[h.author," <",h.email,"> · ",h.date]})]}),(0,u.jsxs)("div",{className:"git-commit-body",children:[(0,u.jsxs)("div",{className:"git-commit-files",children:[(0,u.jsxs)("div",{className:"git-commit-file__count",children:[r("全部文件")," (",h.files.length,")"]}),(0,u.jsx)($,{nodes:b,selected:_,on_select:e=>{g(e),y(!1)}})]}),(0,u.jsxs)("div",{className:"git-commit-diff",children:[(0,u.jsxs)("div",{className:"git-diff-header",children:[(0,u.jsx)("span",{className:"git-diff-header__badge",children:v?r("与工作区对比"):`${r("提交")} ${h.short_hash}`}),(0,u.jsx)("span",{className:"git-diff-header__path",title:_??"",children:_??`${r("全部文件")} (${h.files.length})`}),(0,u.jsxs)("div",{className:"git-diff-header__modes",children:[(0,u.jsx)(l.rA,{icon:"view_agenda",title:r("单栏"),selected:"unified"===p,onClick:()=>f("unified")}),(0,u.jsx)(l.rA,{icon:"view_column",title:r("并排"),selected:"split"===p,onClick:()=>f("split")})]})]}),_?v?(0,u.jsx)(C,{dir_path:e,file:_,left_ref:t,right_ref:"worktree",mode:p}):(0,u.jsx)(C,{dir_path:e,file:_,left_ref:`${t}^`,right_ref:t,mode:p}):(0,u.jsx)("div",{className:"git-diff-empty",children:(0,u.jsx)("span",{children:r("请选择文件查看改动")})})]})]})]})}function T(e){let t=0;for(let s=0;s<e.length;s++)t+=e.charCodeAt(s);return`hsl(${t%360}, 55%, 45%)`}function K({dir_path:e,file:t,on_close:s}){const{t:o}=(0,c.Bd)(),[r,d]=(0,a.useState)([]),[h,m]=(0,a.useState)(!1);(0,a.useEffect)(()=>{t&&_()},[t,e]);const _=async()=>{m(!0);try{const s=await i.TU.post("blame",{path:e,file:t});0===s.code?d(s.data||[]):((0,n.zN)(s.message),d([]))}catch(e){(0,n.zN)(e?.message),d([])}finally{m(!1)}};return(0,u.jsxs)("div",{className:"git-card git-card--diff",children:[(0,u.jsxs)("div",{className:"git-diff-header",children:[(0,u.jsx)("span",{className:"git-diff-header__badge",children:o("逐行归属")}),(0,u.jsx)("span",{className:"git-diff-header__path",title:t,children:t}),(0,u.jsx)("div",{className:"git-diff-header__modes",children:(0,u.jsx)(l.rA,{icon:"close",title:o("关闭"),onClick:s})})]}),h&&(0,u.jsx)("div",{className:"git-change-empty",children:o("加载中")}),!h&&0===r.length&&(0,u.jsx)("div",{className:"git-change-empty",children:o("无法读取该文件的归属信息")}),!h&&r.length>0&&(0,u.jsx)("div",{className:"git-blame",children:r.map((e,t)=>(0,u.jsxs)("div",{className:"git-blame__row",children:[(0,u.jsx)("span",{className:"git-blame__hash",title:e.hash,children:e.hash}),(0,u.jsx)("span",{className:"git-blame__author",style:{color:T(e.author)},title:`${e.author} · ${e.date}`,children:e.author}),(0,u.jsx)("span",{className:"git-blame__date",children:e.date}),(0,u.jsx)("span",{className:"git-blame__num",children:e.line_num}),(0,u.jsx)("span",{className:"git-blame__code",children:e.text||" "})]},t))})]})}function E({current:e,branches:t,on_checkout:s,on_create:i,on_delete:n,on_merge:o,ahead:r,behind:d}){const{t:h}=(0,c.Bd)(),m=(0,A.y)(),[_,g]=(0,a.useState)(!1),[p,f]=(0,a.useState)(""),x=()=>{const e=p.trim();e&&(i(e),f(""),g(!1))};return(0,u.jsxs)("div",{className:"git-branch-row",children:[(0,u.jsxs)("span",{className:"git-branch__name",children:[h("分支"),": ",e]}),(r>0||d>0)&&(0,u.jsxs)("span",{className:"git-branch__counts",children:[r>0&&(0,u.jsxs)("span",{className:"git-ahead",title:h("领先上游"),children:["↑",r]}),d>0&&(0,u.jsxs)("span",{className:"git-behind",title:h("落后上游"),children:["↓",d]})]}),(0,u.jsx)("div",{className:"git-branch__list",children:t.map(t=>{const a=t===e;return(0,u.jsxs)("div",{className:"git-branch-chip"+(a?" git-branch-chip--current":""),onClick:()=>!a&&s(t),title:a?h("当前分支"):`${h("切换到")} ${t}`,children:[t,!a&&(0,u.jsxs)("span",{className:"git-branch-chip__ops",children:[(0,u.jsx)("span",{className:"git-branch-chip__op",title:h("合并到此分支"),onClick:e=>{e.stopPropagation(),o(t)},children:"⇥"}),(0,u.jsx)("span",{className:"git-branch-chip__op",title:h("删除分支"),onClick:e=>{var s;e.stopPropagation(),s=t,m({title:h("删除分支"),sub_title:`${h("确认删除分支")} ${s} ?`,confirm_fun:()=>n(s,!1)})},children:"×"})]})]},t)})}),_?(0,u.jsxs)("span",{className:"git-branch-new",children:[(0,u.jsx)("input",{className:"input input--block",autoFocus:!0,value:p,placeholder:h("新分支名"),onChange:e=>f(e.target.value),onKeyDown:e=>{"Enter"===e.key&&x(),"Escape"===e.key&&(g(!1),f(""))}}),(0,u.jsx)(l.rA,{icon:"check",title:h("确定"),onClick:x}),(0,u.jsx)(l.rA,{icon:"close",title:h("取消"),onClick:()=>{g(!1),f("")}})]}):(0,u.jsx)(l.rA,{icon:"add",title:h("新建分支"),onClick:()=>g(!0)})]})}function B(e){const{t}=(0,c.Bd)(),{dir_path:s,user_config:r,proxy_config:d}=e,[h,m]=(0,a.useState)(!1),[_,g]=(0,a.useState)(r.name),[p,f]=(0,a.useState)(r.email),[x,j]=(0,a.useState)(!1),[N,v]=(0,a.useState)(d?.global.http||""),[y,b]=(0,a.useState)(d?.global.https||""),[w,k]=(0,a.useState)(d?.local.http||""),[S,C]=(0,a.useState)(d?.local.https||"");return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsxs)("div",{className:"git-config-row",children:[(0,u.jsx)("span",{className:"git-config__label",children:t("用户配置")}),h?(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(o.Sm,{maxWidth:"15rem",value:_,placeholder:"user.name",handleInputChange:e=>g(e)}),(0,u.jsx)(o.Sm,{maxWidth:"15rem",value:p,placeholder:"user.email",handleInputChange:e=>f(e)}),(0,u.jsx)(l.rA,{icon:"check",title:t("保存"),onClick:async()=>{try{const a=await i.TU.post("set_user_config",{path:s,name:_,email:p});0===a.code?((0,n.SK)(t("用户配置已保存")),m(!1),e.on_user_config_saved({name:_,email:p})):(0,n.zN)(a.message)}catch(e){(0,n.zN)(e?.message)}}}),(0,u.jsx)(l.rA,{icon:"close",title:t("取消"),onClick:()=>m(!1)})]}):(0,u.jsxs)(u.Fragment,{children:[(0,u.jsxs)("span",{className:"git-config__value",children:[r.name," / ",r.email]}),(0,u.jsx)(l.rA,{icon:"edit",title:t("编辑"),onClick:()=>{g(r.name),f(r.email),m(!0)}})]})]}),(0,u.jsxs)("div",{className:"git-config-row",children:[(0,u.jsx)("span",{className:"git-config__label",children:t("代理配置")}),x?(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(o.Sm,{maxWidth:"15rem",value:N,placeholder:"global http",handleInputChange:e=>v(e)}),(0,u.jsx)(o.Sm,{maxWidth:"15rem",value:y,placeholder:"global https",handleInputChange:e=>b(e)}),(0,u.jsx)(o.Sm,{maxWidth:"15rem",value:w,placeholder:"local http",handleInputChange:e=>k(e)}),(0,u.jsx)(o.Sm,{maxWidth:"15rem",value:S,placeholder:"local https",handleInputChange:e=>C(e)}),(0,u.jsx)(l.rA,{icon:"check",title:t("保存"),onClick:async()=>{const a=[{scope:"global",type:"http",value:N},{scope:"global",type:"https",value:y},{scope:"local",type:"http",value:w},{scope:"local",type:"https",value:S}];try{for(const e of a)await i.TU.post("set_proxy",{path:s,...e});(0,n.SK)(t("代理配置已保存")),j(!1),e.on_proxy_saved({global:{http:N,https:y},local:{http:w,https:S}})}catch(e){(0,n.zN)(e?.message)}}}),(0,u.jsx)(l.rA,{icon:"close",title:t("取消"),onClick:()=>j(!1)})]}):(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)("span",{className:"git-config__value",children:(()=>{if(!d)return"-";const e=d.global;if(e.http||e.https)return`global ${e.http||e.https}`;const t=d.local;return t.http||t.https?`local ${t.http||t.https}`:"-"})()}),(0,u.jsx)(l.rA,{icon:"edit",title:t("编辑"),onClick:()=>{v(d?.global.http||""),b(d?.global.https||""),k(d?.local.http||""),C(d?.local.https||""),j(!0)}})]})]})]})}function F({dir_path:e,target_hash:t,on_changed:s}){const{t:o}=(0,c.Bd)(),r=(0,A.y)(),[d,h]=(0,a.useState)([]),[m,_]=(0,a.useState)(!1),[g,p]=(0,a.useState)(""),[f,x]=(0,a.useState)(""),[j,N]=(0,a.useState)(!1);(0,a.useEffect)(()=>{v()},[e]);const v=async()=>{try{const t=await i.TU.post("tags",{path:e});0===t.code&&h(t.data||[])}catch(e){}};return(0,u.jsxs)("div",{className:"git-sub-panel",children:[(0,u.jsxs)("div",{className:"git-sub-panel__header",children:[(0,u.jsxs)("span",{className:"git-sub-panel__title",children:[o("标签")," (",d.length,")"]}),(0,u.jsx)(l.rA,{icon:"add",title:o("新建标签"),onClick:()=>_(!m)})]}),m&&(0,u.jsxs)("div",{className:"git-sub-panel__form",children:[(0,u.jsx)("input",{className:"input input--block",autoFocus:!0,value:g,placeholder:o("标签名"),onChange:e=>p(e.target.value)}),(0,u.jsx)("input",{className:"input input--block",value:f,placeholder:o("备注"),onChange:e=>x(e.target.value)}),(0,u.jsxs)("div",{className:"git-sub-panel__form-actions",children:[(0,u.jsx)("span",{className:"git-sub-panel__hint",children:t?`${o("基于提交")} ${t}`:o("基于当前提交")}),(0,u.jsx)(l.rA,{icon:"check",title:o("保存"),onClick:async()=>{const a=g.trim();if(a){N(!0);try{const c=await i.TU.post("tag_create",{path:e,name:a,message:f.trim(),hash:t});0===c.code?((0,n.SK)(o("标签创建成功")),p(""),x(""),_(!1),await v(),s()):(0,n.zN)(c.message)}catch(e){(0,n.zN)(e?.message)}finally{N(!1)}}else(0,n.zN)(o("请输入标签名"))}}),(0,u.jsx)(l.rA,{icon:"close",title:o("取消"),onClick:()=>{_(!1),p(""),x("")}})]})]}),(0,u.jsxs)("div",{className:"git-sub-panel__list",children:[0===d.length&&(0,u.jsx)("div",{className:"git-change-empty",children:o("暂无标签")}),d.map(t=>(0,u.jsxs)("div",{className:"git-sub-item",children:[(0,u.jsx)("span",{className:"git-sub-item__name",title:t.name,children:t.name}),(0,u.jsx)("span",{className:"git-sub-item__desc",title:t.message,children:t.message}),(0,u.jsx)("span",{className:"git-sub-item__meta",children:t.date}),(0,u.jsxs)("span",{className:"git-sub-item__ops",children:[(0,u.jsx)(l.rA,{icon:"upload",title:o("推送到远程"),onClick:()=>(async t=>{try{const s=await i.TU.post("tag_push",{path:e,name:t});0===s.code?(0,n.SK)(o("标签推送成功")):(0,n.zN)(s.message)}catch(e){(0,n.zN)(e?.message)}})(t.name)}),(0,u.jsx)(l.rA,{icon:"delete",title:o("删除标签"),onClick:()=>{return s=t.name,void r({title:o("删除标签"),sub_title:`${o("确认删除标签")} ${s} ?`,confirm_fun:async()=>{try{const t=await i.TU.post("tag_delete",{path:e,name:s});0===t.code?((0,n.SK)(o("标签删除成功")),await v()):(0,n.zN)(t.message)}catch(e){(0,n.zN)(e?.message)}}});var s}})]})]},t.name))]})]})}function I({dir_path:e,on_changed:t}){const{t:s}=(0,c.Bd)(),o=(0,A.y)(),[r,d]=(0,a.useState)([]),[h,m]=(0,a.useState)(!1);(0,a.useEffect)(()=>{h&&_()},[e,h]);const _=async()=>{try{const t=await i.TU.post("stash_list",{path:e});0===t.code&&d(t.data||[])}catch(e){}},g=async(a,c)=>{try{const l=await i.TU.post("stash_apply",{path:e,ref:a,pop:c});0===l.code?((0,n.SK)(s(c?"已恢复并删除记录":"已应用")),await _(),t()):(0,n.zN)(l.message)}catch(e){(0,n.zN)(e?.message)}};return(0,u.jsxs)("div",{className:"git-stash",children:[(0,u.jsx)("div",{className:"git-sub-panel__header",children:(0,u.jsxs)("span",{className:"git-sub-panel__title",onClick:()=>m(!h),style:{cursor:"pointer"},children:[s("暂存工作区记录")," ",h?"▾":"▸"]})}),h&&(0,u.jsxs)("div",{className:"git-sub-panel__list",children:[0===r.length&&(0,u.jsx)("div",{className:"git-change-empty",children:s("暂无记录")}),r.map(t=>(0,u.jsxs)("div",{className:"git-sub-item",children:[(0,u.jsx)("span",{className:"git-sub-item__name",title:t.message,children:t.message}),(0,u.jsx)("span",{className:"git-sub-item__meta",children:t.date}),(0,u.jsxs)("span",{className:"git-sub-item__ops",children:[(0,u.jsx)(l.rA,{icon:"play_arrow",title:s("应用"),onClick:()=>g(t.ref,!1)}),(0,u.jsx)(l.rA,{icon:"unarchive",title:s("恢复并删除"),onClick:()=>g(t.ref,!0)}),(0,u.jsx)(l.rA,{icon:"delete",title:s("删除"),onClick:()=>{return a=t.ref,void o({title:s("删除记录"),sub_title:`${s("确认删除")} ${a} ?`,confirm_fun:async()=>{try{const t=await i.TU.post("stash_drop",{path:e,ref:a});0===t.code?((0,n.SK)(s("已删除")),await _()):(0,n.zN)(t.message)}catch(e){(0,n.zN)(e?.message)}}});var a}})]})]},t.ref))]})]})}function M({dir_path:e,current_branch:t,on_checkout:s,on_compare:r}){const{t:d}=(0,c.Bd)(),h=(0,A.y)(),[m,_]=(0,a.useState)([]),[g,p]=(0,a.useState)([]),[f,x]=(0,a.useState)(!1),[j,N]=(0,a.useState)(!1),[v,y]=(0,a.useState)(null),[b,w]=(0,a.useState)("");(0,a.useEffect)(()=>{f&&k()},[e,f]);const k=async()=>{try{const t=await i.TU.post("remote_branches",{path:e});0===t.code&&(_(t.data?.branches||[]),p(t.data?.remotes||[]))}catch(e){}},S=async t=>{N(!0);try{const s=await i.TU.post("fetch",{path:e,prune:t});0===s.code?((0,n.SK)(d("拉取完成")),await k()):(0,n.zN)(s.message)}catch(e){(0,n.zN)(e?.message)}finally{N(!1)}},C=async()=>{const t=v;if(t&&b.trim()){N(!0);try{const a=await i.TU.post("remote_branch_rename",{path:e,branch:t,new_name:b.trim()});0===a.code?((0,n.SK)(d("重命名成功")),y(null),await k(),s()):(0,n.zN)(a.message)}catch(e){(0,n.zN)(e?.message)}finally{N(!1)}}};return(0,u.jsxs)("div",{className:"git-remote",children:[(0,u.jsxs)("div",{className:"git-sub-panel__header",children:[(0,u.jsxs)("span",{className:"git-sub-panel__title",onClick:()=>x(!f),children:[d("远程分支")," (",m.length,") ",f?"▾":"▸"]}),(0,u.jsx)(l.rA,{icon:"cloud_download",title:d("拉取远程信息"),onClick:()=>S(!1)}),(0,u.jsx)(l.rA,{icon:"cleaning_services",title:d("拉取并清理已删除分支"),onClick:()=>S(!0)})]}),f&&(0,u.jsxs)("div",{className:"git-sub-panel__list",children:[0===g.length&&(0,u.jsx)("div",{className:"git-change-empty",children:d("未配置远程仓库")}),m.map(c=>(0,u.jsxs)(a.Fragment,{children:[(0,u.jsxs)("div",{className:"git-sub-item",children:[(0,u.jsx)("span",{className:"git-sub-item__name",title:c.name,children:c.name}),(0,u.jsx)("span",{className:"git-sub-item__meta",children:c.date}),(0,u.jsxs)("span",{className:"git-sub-item__ops",children:[(0,u.jsx)(l.rA,{icon:"call_split",title:d("签出到本地"),onClick:()=>(async t=>{N(!0);try{const a=await i.TU.post("checkout_remote",{path:e,branch:t});0===a.code?((0,n.SK)(d("切换分支成功")),s()):(0,n.zN)(a.message)}catch(e){(0,n.zN)(e?.message)}finally{N(!1)}})(c.name)}),(0,u.jsx)(l.rA,{icon:"compare_arrows",title:d("与当前分支比较"),onClick:()=>r(c.name)}),(0,u.jsx)(l.rA,{icon:"merge",title:d("合并到当前分支"),onClick:()=>(async a=>{h({title:d("合并到当前分支"),sub_title:`${d("将")} ${a} ${d("合并到")} ${t} ?`,confirm_fun:async()=>{try{const t=await i.TU.post("merge",{path:e,branch:a});0===t.code?((0,n.SK)(d("合并成功")),s()):(0,n.zN)(t.message)}catch(e){(0,n.zN)(e?.message)}}})})(c.name)}),(0,u.jsx)(l.rA,{icon:"drive_file_rename_outline",title:d("重命名"),onClick:()=>(e=>{const t=e.indexOf("/"),s=t>=0?e.substring(t+1):e;w(s),y(e)})(c.name)}),(0,u.jsx)(l.rA,{icon:"delete",title:d("删除"),onClick:()=>{return t=c.name,void h({title:d("删除远程分支"),sub_title:`${d("确认删除远程分支")} ${t} ? ${d("该分支会从远程仓库删除")}`,confirm_fun:async()=>{try{const s=await i.TU.post("remote_branch_delete",{path:e,branch:t});0===s.code?((0,n.SK)(d("删除成功")),await k()):(0,n.zN)(s.message)}catch(e){(0,n.zN)(e?.message)}}});var t}})]})]}),v===c.name&&(0,u.jsxs)("div",{className:"git-remote__rename",children:[(0,u.jsx)(o.Sm,{value:b,width:"12rem",handleInputChange:e=>w(e)}),(0,u.jsx)(l.rA,{icon:"check",title:d("确定"),onClick:C}),(0,u.jsx)(l.rA,{icon:"close",title:d("取消"),onClick:()=>y(null)})]})]},c.name))]})]})}function P({dir_path:e,branch:t,current_branch:s,on_close:o}){const{t:r}=(0,c.Bd)(),[d,h]=(0,a.useState)([]),[m,_]=(0,a.useState)(null),[g,p]=(0,a.useState)("unified"),[f,x]=(0,a.useState)(!0);(0,a.useEffect)(()=>{_(null),N()},[e,t,s]);const N=async()=>{x(!0);try{const a=await i.TU.post("diff_files",{path:e,from:s,to:t});0===a.code?h(a.data||[]):(0,n.zN)(a.message)}catch(e){(0,n.zN)(e?.message)}finally{x(!1)}},v=(0,a.useMemo)(()=>j(d.map(e=>({path:e.path,data:e}))),[d]);return(0,u.jsxs)("div",{className:"git-card git-card--diff",children:[(0,u.jsxs)("div",{className:"git-diff-header",children:[(0,u.jsx)("span",{className:"git-diff-header__badge",children:r("分支比较")}),(0,u.jsxs)("span",{className:"git-diff-header__path",title:`${s} ↔ ${t}`,children:[s," ↔ ",t]}),m&&(0,u.jsxs)("div",{className:"git-diff-header__modes",children:[(0,u.jsx)(l.rA,{icon:"view_agenda",title:r("单栏"),selected:"unified"===g,onClick:()=>p("unified")}),(0,u.jsx)(l.rA,{icon:"view_column",title:r("并排"),selected:"split"===g,onClick:()=>p("split")})]}),(0,u.jsx)(l.rA,{icon:"close",title:r("关闭"),onClick:o})]}),(0,u.jsxs)("div",{className:"git-commit-body",children:[(0,u.jsxs)("div",{className:"git-commit-files",children:[(0,u.jsxs)("div",{className:"git-commit-file__count",children:[r("全部文件")," (",d.length,")"]}),(0,u.jsx)($,{nodes:v,selected:m,on_select:_})]}),(0,u.jsx)("div",{className:"git-commit-diff",children:f?(0,u.jsx)("div",{className:"git-diff-empty",children:(0,u.jsx)("span",{children:r("加载中")})}):m?(0,u.jsx)(C,{dir_path:e,file:m,left_ref:s,right_ref:t,mode:g}):(0,u.jsx)("div",{className:"git-diff-empty",children:(0,u.jsx)("span",{children:r("请选择文件查看改动")})})})]})]})}function D({dir_path:e,on_resolved:t}){const{t:s}=(0,c.Bd)(),o=(0,A.y)(),[r,d]=(0,a.useState)([]),[h,m]=(0,a.useState)("");(0,a.useEffect)(()=>{_()},[e]);const _=async()=>{try{const t=await i.TU.post("conflicts",{path:e});0===t.code&&(d(t.data?.files||[]),m(t.data?.state||""))}catch(e){}},g=async(a,c)=>{try{const l=await i.TU.post("resolve",{path:e,file:a,side:c});0===l.code?((0,n.SK)(s("已解决冲突")),await _(),t()):(0,n.zN)(l.message)}catch(e){(0,n.zN)(e?.message)}};return 0===r.length?null:(0,u.jsxs)("div",{className:"git-card git-conflict",children:[(0,u.jsxs)("div",{className:"git-sub-panel__header",children:[(0,u.jsxs)("span",{className:"git-sub-panel__title",children:[s("冲突")," (",r.length,")",h&&(0,u.jsx)("span",{className:"git-conflict__state",children:h})]}),(0,u.jsx)(l.rA,{icon:"done_all",title:s("标记全部已解决"),onClick:async()=>{try{const a=await i.TU.post("conflict_action",{path:e,action:"merge_continue"});0===a.code?((0,n.SK)(s("合并已完成")),t()):(0,n.zN)(a.message)}catch(e){(0,n.zN)(e?.message)}}}),(0,u.jsx)(l.rA,{icon:"undo",title:s("放弃合并"),onClick:()=>{const a="rebase"===h?"rebase_abort":"cherry-pick"===h?"cherry_pick_abort":"revert"===h?"revert_abort":"merge_abort";o({title:s("放弃合并"),sub_title:s("确认放弃当前合并并恢复到操作前状态"),confirm_fun:async()=>{try{const c=await i.TU.post("conflict_action",{path:e,action:a});0===c.code?((0,n.SK)(s("已放弃合并")),t()):(0,n.zN)(c.message)}catch(e){(0,n.zN)(e?.message)}}})}})]}),r.map(e=>(0,u.jsxs)("div",{className:"git-sub-item",children:[(0,u.jsx)("span",{className:"git-sub-item__name",title:e,children:e}),(0,u.jsxs)("span",{className:"git-sub-item__ops",children:[(0,u.jsx)(l.rA,{icon:"person",title:s("采用我方版本"),onClick:()=>g(e,"ours")}),(0,u.jsx)(l.rA,{icon:"group",title:s("采用对方版本"),onClick:()=>g(e,"theirs")}),(0,u.jsx)(l.rA,{icon:"check",title:s("标记已解决"),onClick:()=>g(e,"resolved")})]})]},e))]})}function R({dir_path:e,on_changed:t}){const{t:s}=(0,c.Bd)(),o=(0,A.y)(),[r,d]=(0,a.useState)([]),[h,m]=(0,a.useState)(!1);(0,a.useEffect)(()=>{h&&_()},[e,h]);const _=async()=>{try{const t=await i.TU.post("reflog",{path:e,maxCount:100});0===t.code&&d(t.data||[])}catch(e){}};return(0,u.jsxs)("div",{className:"git-reflog",children:[(0,u.jsx)("div",{className:"git-sub-panel__header",children:(0,u.jsxs)("span",{className:"git-sub-panel__title",onClick:()=>m(!h),style:{cursor:"pointer"},children:[s("操作历史")," (",r.length,") ",h?"▾":"▸"]})}),h&&(0,u.jsxs)("div",{className:"git-sub-panel__list",children:[0===r.length&&(0,u.jsx)("div",{className:"git-change-empty",children:s("暂无记录")}),r.map(a=>(0,u.jsxs)("div",{className:"git-sub-item",children:[(0,u.jsx)("span",{className:"git-sub-item__name",title:a.message,children:a.selector}),(0,u.jsx)("span",{className:"git-sub-item__desc",title:a.message,children:a.message}),(0,u.jsx)("span",{className:"git-sub-item__meta",children:a.date}),(0,u.jsxs)("span",{className:"git-sub-item__ops",children:[(0,u.jsx)(l.rA,{icon:"undo",title:s("回退到此处"),onClick:()=>{return c=a,void o({title:s("回退到此处"),sub_title:`${c.selector} · ${c.message}`,confirm_fun:async()=>{try{const a=await i.TU.post("reset_commit",{path:e,hash:c.selector,mode:"mixed"});0===a.code?((0,n.SK)(s("已回退")),await _(),t()):(0,n.zN)(a.message)}catch(e){(0,n.zN)(e?.message)}}});var c}}),(0,u.jsx)(l.rA,{icon:"delete_forever",title:s("强制回退(丢弃改动)"),onClick:()=>{return c=a,void o({title:s("强制回退(丢弃改动)"),sub_title:`${s("此操作将永久丢弃未提交的改动")}:${c.selector} · ${c.message}`,confirm_fun:async()=>{try{const a=await i.TU.post("reset_commit",{path:e,hash:c.selector,mode:"hard"});0===a.code?((0,n.SK)(s("已强制回退")),await _(),t()):(0,n.zN)(a.message)}catch(e){(0,n.zN)(e?.message)}}});var c}})]})]},a.selector))]})]})}function W({items:e,on_read:t,on_save:s,on_delete:i}){const{t:n}=(0,c.Bd)(),[r,d]=(0,a.useState)(null),[h,m]=(0,a.useState)(""),[_,g]=(0,a.useState)(!1);(0,a.useEffect)(()=>{r&&!e.some(e=>e.name===r)&&d(null)},[e,r]);const p=async()=>{if(r){g(!0);try{await s(r,h)}finally{g(!1)}}};return(0,u.jsx)("div",{className:"hook-editor",children:(0,u.jsxs)("div",{className:"hook-editor__list",children:[e.map(e=>(0,u.jsxs)(a.Fragment,{children:[(0,u.jsxs)("div",{className:"hook-item"+(r===e.name?" hook-item--editing":""),children:[(0,u.jsx)("span",{className:"hook-item__dot"+(e.enabled?" hook-item__dot--on":"")}),(0,u.jsx)("span",{className:"hook-item__name",children:e.name}),(0,u.jsxs)("span",{className:"hook-item__ops",children:[(0,u.jsx)(l.rA,{icon:r===e.name?"expand_less":"edit",title:n("编辑"),onClick:()=>(async e=>{if(r!==e){g(!0);try{m(await t(e)),d(e)}finally{g(!1)}}else d(null)})(e.name)}),e.enabled&&(0,u.jsx)(l.rA,{icon:"block",title:n("停用钩子"),onClick:()=>(async e=>{g(!0);try{await i(e)}finally{g(!1)}})(e.name)})]})]}),r===e.name&&(0,u.jsxs)("div",{className:"hook-item__editor",children:[(0,u.jsxs)("div",{className:"hook-item__editor-bar",children:[(0,u.jsx)("span",{className:"hook-item__editor-name",children:e.name}),(0,u.jsx)(l.rA,{icon:"check",title:n("保存并启用"),onClick:p}),(0,u.jsx)(l.rA,{icon:"close",title:n("取消"),onClick:()=>d(null)})]}),(0,u.jsx)(o.Z2,{className:"hook-item__text",value:h,spellCheck:!1,disabled:_,onChange:e=>m(e.target.value)})]})]},e.name)),0===e.length&&(0,u.jsx)("div",{className:"git-change-empty",children:n("暂无记录")})]})})}function H({dir_path:e}){const{t}=(0,c.Bd)(),s=(0,A.y)(),[l,o]=(0,a.useState)([]),[r,d]=(0,a.useState)(!1);(0,a.useEffect)(()=>{r&&h()},[e,r]);const h=async()=>{try{const t=await i.TU.post("hooks",{path:e});0===t.code&&o(t.data||[])}catch(e){}};return(0,u.jsxs)("div",{className:"git-hook",children:[(0,u.jsx)("div",{className:"git-sub-panel__header",children:(0,u.jsxs)("span",{className:"git-sub-panel__title",onClick:()=>d(!r),children:[t("钩子")," ",r?"▾":"▸"]})}),r&&(0,u.jsx)(W,{items:l,on_read:async t=>{try{const s=await i.TU.post("hook_read",{path:e,name:t});if(0===s.code)return s.data?.content||"";(0,n.zN)(s.message)}catch(e){(0,n.zN)(e?.message)}return""},on_save:async(s,a)=>{try{const c=await i.TU.post("hook_save",{path:e,name:s,content:a});0===c.code?((0,n.SK)(t("已保存并启用")),await h()):(0,n.zN)(c.message)}catch(e){(0,n.zN)(e?.message)}},on_delete:async a=>{s({title:t("停用钩子"),sub_title:`${t("确认删除并停用")} ${a} ?`,confirm_fun:async()=>{try{const s=await i.TU.post("hook_delete",{path:e,name:a});0===s.code?((0,n.SK)(t("已停用")),await h()):(0,n.zN)(s.message)}catch(e){(0,n.zN)(e?.message)}}})}})]})}function O({dir_path:e,on_info_loaded:t,on_changed:s}){const{t:o}=(0,c.Bd)(),[r,d]=(0,a.useState)(null),[h,m]=(0,a.useState)([]),[_,g]=(0,a.useState)(!1),[p,f]=(0,a.useState)(!1);(0,a.useEffect)(()=>{x(),j()},[e]);const x=async()=>{try{const s=await i.TU.post("repo_info",{path:e});0===s.code&&(d(s.data),t(s.data))}catch(e){}},j=async()=>{try{const t=await i.TU.post("submodules",{path:e});0===t.code&&m(t.data||[])}catch(e){}},N=e=>o("uninitialized"===e?"未初始化":"modified"===e?"与记录不一致":"正常");return(0,u.jsxs)("div",{className:"git-repo-panel",children:[(0,u.jsxs)("div",{className:"git-config-row",children:[(0,u.jsx)("span",{className:"git-config__label",children:o("远程地址")}),(0,u.jsx)("span",{className:"git-config__value",title:r?.remote_url,children:r?.remote_url||o("未配置")})]}),(0,u.jsxs)("div",{className:"git-config-row",children:[(0,u.jsx)("span",{className:"git-config__label",children:o("当前提交")}),(0,u.jsxs)("span",{className:"git-config__value",children:[r?.head_hash||"",r&&(r.ahead>0||r.behind>0)&&(0,u.jsxs)("span",{className:"git-repo-panel__counts",children:[r.ahead>0&&(0,u.jsxs)("span",{className:"git-ahead",children:["↑",r.ahead]}),r.behind>0&&(0,u.jsxs)("span",{className:"git-behind",children:["↓",r.behind]})]})]})]}),(0,u.jsxs)("div",{className:"git-sub-panel__header",children:[(0,u.jsxs)("span",{className:"git-sub-panel__title",onClick:()=>g(!_),style:{cursor:"pointer"},children:[o("子模块")," (",h.length,") ",_?"▾":"▸"]}),h.length>0&&(0,u.jsx)(l.rA,{icon:"sync",title:o("初始化并更新子模块"),onClick:async()=>{f(!0);try{const t=await i.TU.post("submodule_update",{path:e});0===t.code?((0,n.SK)(o("子模块更新完成")),await j(),s()):(0,n.zN)(t.message)}catch(e){(0,n.zN)(e?.message)}finally{f(!1)}}})]}),_&&(0,u.jsxs)("div",{className:"git-sub-panel__list",children:[0===h.length&&(0,u.jsx)("div",{className:"git-change-empty",children:o("无子模块")}),h.map(e=>(0,u.jsxs)("div",{className:"git-sub-item",children:[(0,u.jsx)("span",{className:"git-sub-item__name",title:e.path,children:e.path}),(0,u.jsx)("span",{className:"git-sub-item__desc",title:e.desc,children:e.desc}),(0,u.jsx)("span",{className:`git-sub-item__meta git-sub-status--${e.status}`,children:N(e.status)})]},e.path))]})]})}function L({dir_path:e,on_changed:t}){const{t:s}=(0,c.Bd)(),o=(0,d.Zp)(),[r,h]=(0,a.useState)([]),[_,g]=(0,a.useState)([]),[p,f]=(0,a.useState)("none"),[x,j]=(0,a.useState)(""),[N,v]=(0,a.useState)(""),[y,b]=(0,a.useState)(!1);(0,a.useEffect)(()=>{w(),k()},[e]);const w=async()=>{try{const t=await i.TU.post("repos",{path:e});0===t.code&&h(t.data||[])}catch(e){}},k=async()=>{try{const t=await i.TU.post("dirs",{path:e});0===t.code&&g(t.data?.dirs||[])}catch(e){}},S=async()=>{const a=x.trim();if(a){b(!0);try{const c=await i.TU.post("init",{path:`${e}/${a}`.replace(/\/+/g,"/")});0===c.code?((0,n.SK)(s("仓库初始化成功")),f("none"),j(""),await w(),await k(),t()):(0,n.zN)(c.message)}catch(e){(0,n.zN)(e?.message)}finally{b(!1)}}else(0,n.zN)(s("请输入目录名"))},C=async()=>{const a=x.trim();if(a)if(N.trim()){b(!0);try{const c=await i.TU.post("clone",{target:`${e}/${a}`.replace(/\/+/g,"/"),url:N.trim()});0===c.code?((0,n.SK)(s("克隆成功")),f("none"),j(""),v(""),await w(),await k(),t()):(0,n.zN)(c.message)}catch(e){(0,n.zN)(e?.message)}finally{b(!1)}}else(0,n.zN)(s("请输入仓库地址"));else(0,n.zN)(s("请输入目录名"))};return(0,u.jsxs)("div",{className:"git-repo-manager",children:[(0,u.jsxs)("div",{className:"git-repo-manager__header",children:[(0,u.jsxs)("span",{className:"git-sub-panel__title",children:[s("仓库")," (",r.length,")"]}),(0,u.jsx)(l.rA,{icon:"add",title:s("初始化仓库"),selected:"init"===p,onClick:()=>{f("init"===p?"none":"init"),j("")}}),(0,u.jsx)(l.rA,{icon:"cloud_download",title:s("克隆仓库"),selected:"clone"===p,onClick:()=>{f("clone"===p?"none":"clone"),j("")}})]}),"none"!==p&&(0,u.jsxs)("div",{className:"git-sub-panel__form",children:[(0,u.jsx)("input",{className:"input input--block",autoFocus:!0,value:x,placeholder:s("目录名"),onChange:e=>j(e.target.value),onKeyDown:e=>"Enter"===e.key&&("init"===p?S():C())}),"clone"===p&&(0,u.jsx)("input",{className:"input input--block",value:N,placeholder:s("仓库地址"),onChange:e=>v(e.target.value),onKeyDown:e=>"Enter"===e.key&&C()}),(0,u.jsxs)("div",{className:"git-sub-panel__form-actions",children:[(0,u.jsx)("span",{className:"git-sub-panel__hint",children:`${e}/${x||"..."}`.replace(/\/+/g,"/")}),(0,u.jsx)(l.rA,{icon:"check",title:s("保存"),onClick:"init"===p?S:C}),(0,u.jsx)(l.rA,{icon:"close",title:s("取消"),onClick:()=>{f("none"),j(""),v("")}})]}),_.length>0&&(0,u.jsx)("div",{className:"git-repo-manager__dirs",children:_.map(e=>(0,u.jsx)("span",{className:"git-repo-manager__dir",onClick:()=>j(e),children:e},e))})]}),(0,u.jsxs)("div",{className:"git-sub-panel__list",children:[0===r.length&&(0,u.jsx)("div",{className:"git-change-empty",children:s("当前目录下没有仓库")}),r.map(t=>(0,u.jsxs)("div",{className:"git-sub-item",children:[(0,u.jsx)("span",{className:"git-sub-item__name",title:t.name,children:t.name}),(0,u.jsx)("span",{className:"git-sub-item__meta",children:t.branch}),(0,u.jsx)("span",{className:"git-sub-item__ops",children:(0,u.jsx)(l.rA,{icon:"login",title:s("进入"),onClick:()=>{return s=t,void o(`${m.o.git_page}/${e}/${s.name}/`.replace(/\/+/g,"/"));var s}})})]},t.path))]})]})}const Z=100;function q(){const{t:e}=(0,c.Bd)(),t=(0,A.y)(),s=(0,A.y)(),g=(0,d.Zp)();let p=(0,h.GG)(m.o.git_page,(0,h.vX)());for(let e=0;e<3;e++){let e;try{e=decodeURIComponent(p)}catch{break}if(e===p)break;p=e}p=p.replace(/\/+$/,"");const[f,x]=(0,a.useState)([]),[j,N]=(0,a.useState)([]),[v,y]=(0,a.useState)(!1),[w,k]=(0,a.useState)(!1),S=(0,a.useRef)(!1),[$,T]=(0,a.useState)({current:"",branches:[]}),[W,q]=(0,a.useState)(""),[G,V]=(0,a.useState)(new Set),[X,J]=(0,a.useState)("status"),[Q,Y]=(0,a.useState)(!1),[ee,te]=(0,a.useState)(20),[se,ae]=(0,a.useState)(!1),ie=(0,a.useRef)(null),ne=(0,a.useRef)(null),[ce,le]=(0,a.useState)(null),[oe,re]=(0,a.useState)("unified"),[de,he]=(0,a.useState)({name:"",email:""}),[me,_e]=(0,a.useState)(null),[ge,pe]=(0,a.useState)(0),[ue,fe]=(0,a.useState)(null),[xe,je]=(0,a.useState)(null),[Ne,ve]=(0,a.useState)(!1);(0,a.useEffect)(()=>{p&&be().then(e=>{e&&(we(),ke(),Se(),Ce(),ye())})},[p]);const ye=async()=>{try{const e=await i.TU.post("conflicts",{path:p});0===e.code&&pe((e.data?.files||[]).length)}catch(e){}},be=async()=>{try{Y(!0);const e=await i.TU.post("status",{path:p});return 0===e.code&&(x(e.data||[]),ve(!1),!0)}catch(e){const t="string"==typeof e?e:e?.message;return t&&t.includes("not a git repository")&&ve(!0),!1}finally{Y(!1)}},we=async()=>{try{const e=await i.TU.post("log",{path:p,maxCount:Z,skip:0});if(0===e.code){const t=e.data||[];N(t),y(t.length>=Z)}}catch(e){}},ke=async()=>{try{const e=await i.TU.post("branches",{path:p});0===e.code&&T(e.data||{current:"",branches:[]})}catch(e){}},Se=async()=>{try{const e=await i.TU.post("get_user_config",{path:p});0===e.code&&he(e.data)}catch(e){}},Ce=async()=>{try{const e=await i.TU.post("get_proxy",{path:p});0===e.code&&_e(e.data)}catch(e){}},ze=async(t,s)=>{t.untracked?(0,n.zN)(e("未跟踪文件无差异")):le({kind:"working",path:t.path,staged:s})},Ae=async t=>{try{Y(!0);const s=await i.TU.post("discard",{path:p,files:t});0===s.code?((0,n.SK)(e("discarded")),"working"===ce?.kind&&t.some(e=>e.path===ce.path)&&le(null),await be()):(0,n.zN)(s.message)}catch(e){(0,n.zN)(e?.message)}finally{Y(!1)}},$e=async()=>{const e=f.filter(e=>!e.staged);try{Y(!0);const t=await i.TU.post("add",{path:p,files:e.map(e=>e.path)});if(0!==t.code)return void(0,n.zN)(t.message)}catch(e){return void(0,n.zN)(e?.message)}finally{Y(!1)}await Ue(!1)},Ue=async t=>{try{Y(!0);const s=await i.TU.post("commit",{path:p,message:W.trim(),allChanged:t});0===s.code?((0,n.SK)(e("提交成功")),q(""),le(null),await be(),we()):(0,n.zN)(s.message)}catch(e){(0,n.zN)(e?.message)}finally{Y(!1)}},Te=async(t=!1)=>{try{Y(!0);const s=await i.TU.post("push",{path:p,force:t});0===s.code?(0,n.SK)(e("推送成功")):(0,n.zN)(s.message)}catch(e){(0,n.zN)(e?.message)}finally{Y(!1)}},Ke=async()=>{le(null),await be(),we(),ke()},Ee=(0,a.useCallback)(_.throttle(e=>{const t=parseFloat(getComputedStyle(ne.current).fontSize),s=window.innerWidth/t-4,a=e.clientX/t,i=2.25+ie.current.offsetWidth/t;a<=s&&a>=i&&te(parseFloat(a.toFixed(2)))},32),[]),Be=()=>{ae(!1),ne.current.removeEventListener("pointermove",Ee)},Fe=p.split("/").filter(Boolean).pop()||p;return(0,u.jsxs)("div",{className:"studio",children:[(0,u.jsx)(r.A,{ignore_tags:!0,left_children:[(0,u.jsx)(l.rA,{title:e("取消"),icon:"close",onClick:()=>g(-1)},"close"),(0,u.jsx)("span",{children:Fe},"title")],children:(0,u.jsx)(l.rA,{icon:"refresh",title:e("刷新"),onClick:()=>{be(),we(),ke(),Se(),Ce()}})}),Ne?(0,u.jsx)("div",{className:"studio-body",children:(0,u.jsx)("div",{className:"studio-editor",children:(0,u.jsx)("div",{className:"git-main",children:(0,u.jsx)("div",{className:"git-card",children:(0,u.jsx)(L,{dir_path:p,on_changed:()=>{ve(!1),be(),we(),ke()}})})})})}):(0,u.jsxs)("div",{className:"studio-body",ref:ne,children:[(0,u.jsxs)("div",{className:"studio-nav studio-nav--git",style:{width:ee-1+"em"},children:[(0,u.jsx)("div",{className:"menu git-menu not-select-div",children:(0,u.jsx)("div",{className:"wrapper",children:(0,u.jsxs)("ul",{children:[(0,u.jsxs)("li",{className:"status"===X?"active":"",onClick:()=>J("status"),children:[e("变更")," (",f.length,")"]}),(0,u.jsxs)("li",{className:"log"===X?"active":"",onClick:()=>J("log"),children:[e("提交记录")," (",j.length,")"]})]})})}),"status"===X&&(0,u.jsx)("div",{className:"git-scroll",children:(0,u.jsx)(b,{files:f,selected:G,on_toggle:e=>{const t=new Set(G);t.has(e)?t.delete(e):t.add(e),V(t)},on_toggle_all:(e,t)=>{const s=new Set(G);for(const a of e)t?s.add(a):s.delete(a);V(s)},active_path:"working"===ce?.kind?ce.path:null,on_view_diff:ze,on_stage_section:async(t,s)=>{if(0===t.length)return;const a=t.map(e=>e.path);try{const t=s?await i.TU.post("reset",{path:p,files:a}):await i.TU.post("add",{path:p,files:a});0===t.code?((0,n.SK)(e(s?"已取消暂存":"已暂存")),await be()):(0,n.zN)(t.message)}catch(e){(0,n.zN)(e?.message)}},on_stage_one:async(e,t)=>{try{const s=t?await i.TU.post("reset",{path:p,files:[e.path]}):await i.TU.post("add",{path:p,files:[e.path]});0===s.code?(await be(),"working"===ce?.kind&&ce.path===e.path&&ze(e,!t)):(0,n.zN)(s.message)}catch(e){(0,n.zN)(e?.message)}},on_view_blame:e=>{le({kind:"blame",file:e.path})},on_discard_one:(t,a)=>{s({title:e("discard"),sub_title:t.untracked?e("discard_untracked_tip"):e("discard_modified_tip"),confirm_fun:()=>Ae([{path:t.path,staged:a,untracked:t.untracked}])})},on_discard_selected:()=>{const t=f.filter(e=>G.has(e.path));0!==t.length&&s({title:e("discard"),sub_title:e("discard_selected_tip",{n:t.length}),confirm_fun:()=>Ae(t.map(e=>({path:e.path,staged:e.staged,untracked:e.untracked})))})}})}),"log"===X&&(0,u.jsx)("div",{className:"git-scroll",children:(0,u.jsx)(z,{dir_path:p,entries:ue??j,is_search:null!==ue,has_more:v,loading_more:w,active_hash:"commit"===ce?.kind?ce.hash:null,on_select:e=>{le({kind:"commit",hash:e})},on_scroll_bottom:e=>{if(null!==ue)return;const t=e.currentTarget;t.scrollHeight-t.scrollTop-t.clientHeight<200&&(async()=>{if(!S.current&&v){S.current=!0,k(!0);try{const e=await i.TU.post("log",{path:p,maxCount:Z,skip:j.length});if(0===e.code){const t=e.data||[];N(e=>[...e,...t]),y(t.length>=Z)}}catch(e){}finally{S.current=!1,k(!1)}}})()},on_search_result:e=>{fe(e),null===e&&we()}})})]}),(0,u.jsx)("div",{className:"studio__divider",ref:ie,onPointerDown:()=>{ae(!0),ne.current.addEventListener("pointermove",Ee)},onPointerUp:Be}),se&&(0,u.jsx)("div",{className:"shell__overlay",onPointerUp:Be}),(0,u.jsx)("div",{className:"studio-editor",children:(0,u.jsxs)("div",{className:"git-main",children:[(0,u.jsx)(D,{dir_path:p,on_resolved:Ke}),(0,u.jsxs)("div",{className:"git-card",children:[(0,u.jsx)(E,{current:$.current,branches:$.branches,on_checkout:async t=>{try{Y(!0);const s=await i.TU.post("checkout",{path:p,branch:t});0===s.code?((0,n.SK)(e("切换分支成功")),await Ke()):(0,n.zN)(s.message)}catch(e){(0,n.zN)(e?.message)}finally{Y(!1)}},on_create:async t=>{try{Y(!0);const s=await i.TU.post("branch_create",{path:p,name:t});0===s.code?((0,n.SK)(e("分支创建成功")),await Ke()):(0,n.zN)(s.message)}catch(e){(0,n.zN)(e?.message)}finally{Y(!1)}},on_delete:async(t,s)=>{try{Y(!0);const a=await i.TU.post("branch_delete",{path:p,name:t,force:s});0===a.code?((0,n.SK)(e("分支删除成功")),await Ke()):(0,n.zN)(a.message)}catch(e){(0,n.zN)(e?.message)}finally{Y(!1)}},on_merge:async t=>{try{Y(!0);const s=await i.TU.post("merge",{path:p,branch:t});0===s.code?((0,n.SK)(e("合并成功")),await Ke()):(0,n.zN)(s.message)}catch(e){(0,n.zN)(e?.message)}finally{Y(!1)}},ahead:xe?.ahead,behind:xe?.behind}),(0,u.jsx)(M,{dir_path:p,current_branch:$.current,on_checkout:Ke,on_compare:e=>le({kind:"remote",branch:e})}),(0,u.jsx)(o.Z2,{placeholder:e("git_msg"),value:W,onChange:e=>q(e.target.value),rows:3}),(0,u.jsxs)("div",{className:"git-btn-row",children:[(0,u.jsx)(l.rA,{icon:"check",title:e("提交"),onClick:async()=>{if(!W.trim())return void(0,n.zN)(e("请输入提交信息"));if(0===f.filter(e=>e.staged).length){return 0===f.filter(e=>!e.staged).length?void(0,n.zN)(e("没有可提交的更改")):void t({title:e("提交"),sub_title:e("存在未暂存的改动,是否一并暂存并提交?"),confirm_fun:$e})}await Ue(!1)}}),(0,u.jsx)(l.rA,{icon:"edit_note",title:e("修改最后一次提交"),onClick:async()=>{try{Y(!0);const t=await i.TU.post("commit_amend",{path:p,message:W});0===t.code?((0,n.SK)(e("已修改最后一次提交")),q(""),le(null),await be(),we()):(0,n.zN)(t.message)}catch(e){(0,n.zN)(e?.message)}finally{Y(!1)}}}),(0,u.jsx)(l.rA,{icon:"download",title:e("拉取"),onClick:async()=>{try{Y(!0);const t=await i.TU.post("pull",{path:p});0===t.code?((0,n.SK)(e("拉取成功")),await be(),we()):(0,n.zN)(t.message)}catch(e){(0,n.zN)(e?.message)}finally{Y(!1)}}}),(0,u.jsx)(l.rA,{icon:"upload",title:e("推送"),onClick:()=>Te(!1)}),(0,u.jsx)(l.rA,{icon:"keyboard_double_arrow_up",title:e("强制推送"),onClick:()=>Te(!0)}),(0,u.jsx)("span",{className:"git-btn-gap"}),(0,u.jsx)(l.rA,{icon:"inventory_2",title:e("暂存工作区"),onClick:async()=>{try{const t=await i.TU.post("stash",{path:p});0===t.code?((0,n.SK)(e("暂存工作区成功")),le(null),await be()):(0,n.zN)(t.message)}catch(e){(0,n.zN)(e?.message)}}}),(0,u.jsx)(l.rA,{icon:"unarchive",title:e("恢复工作区"),onClick:async()=>{try{const t=await i.TU.post("stash_pop",{path:p});0===t.code?((0,n.SK)(e("恢复工作区成功")),await be()):(0,n.zN)(t.message)}catch(e){(0,n.zN)(e?.message)}}})]}),(0,u.jsx)(I,{dir_path:p,on_changed:Ke}),(0,u.jsx)(F,{dir_path:p,target_hash:"commit"===ce?.kind?ce.hash:void 0,on_changed:Ke}),(0,u.jsx)(R,{dir_path:p,on_changed:Ke})]}),ce?"commit"===ce.kind?(0,u.jsx)(U,{dir_path:p,hash:ce.hash,on_close:()=>le(null),on_changed:Ke}):"blame"===ce.kind?(0,u.jsx)(K,{dir_path:p,file:ce.file,on_close:()=>le(null)}):"remote"===ce.kind?(0,u.jsx)(P,{dir_path:p,branch:ce.branch,current_branch:$.current,on_close:()=>le(null)}):(0,u.jsxs)("div",{className:"git-card git-card--diff",children:[(0,u.jsxs)("div",{className:"git-diff-header",children:[(0,u.jsx)("span",{className:"git-diff-header__badge",children:ce.staged?e("已暂存"):e("未暂存")}),(0,u.jsx)("span",{className:"git-diff-header__path",title:ce.path,children:ce.path}),(0,u.jsxs)("div",{className:"git-diff-header__modes",children:[(0,u.jsx)(l.rA,{icon:"view_agenda",title:e("单栏"),selected:"unified"===oe,onClick:()=>re("unified")}),(0,u.jsx)(l.rA,{icon:"view_column",title:e("并排"),selected:"split"===oe,onClick:()=>re("split")}),(0,u.jsx)(l.rA,{icon:"close",title:e("关闭"),onClick:()=>le(null)})]})]}),ce.staged?(0,u.jsx)(C,{dir_path:p,file:ce.path,left_ref:"HEAD",right_ref:"staged",mode:oe}):(0,u.jsx)(C,{dir_path:p,file:ce.path,left_ref:"HEAD",right_ref:"worktree",mode:oe})]}):(0,u.jsx)("div",{className:"git-card git-card--placeholder",children:e("点击左侧文件查看差异")}),(0,u.jsxs)("div",{className:"git-card",children:[(0,u.jsx)(B,{dir_path:p,user_config:de,proxy_config:me,on_user_config_saved:he,on_proxy_saved:_e}),(0,u.jsx)(O,{dir_path:p,on_info_loaded:je,on_changed:Ke}),(0,u.jsx)(H,{dir_path:p})]})]})})]})]})}}}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[3659],{22081(e,n,t){var s=t(96540),a=t(16349),i=t(74848);const r=({percentage:e})=>{const n=(0,s.useRef)(null),[t,r]=(0,s.useState)(null);return(0,s.useEffect)(()=>{const t=n.current.getContext("2d"),s=new a.Ay(t,{type:"doughnut",data:{labels:["use","left"],datasets:[{data:[e,100-e],backgroundColor:["#007bff","#f0f0f0"],borderWidth:0}]},options:{plugins:{legend:{display:!1},tooltip:{enabled:!1}},elements:{arc:{borderWidth:0}}}});return r(s),()=>{s.destroy()}},[]),(0,s.useEffect)(()=>{t&&(t.data.datasets[0].data=[e,100-e],t.update())},[e]),(0,i.jsx)("div",{style:{width:"8rem",overflow:"hidden"},children:(0,i.jsx)("canvas",{ref:n})})};t.d(n,["A",0,r])},88062(e,n,t){t(96540),t(47022);var s=t(74848);function a(e){return(0,s.jsx)("div",{className:"black-tip",onClick:()=>{e.click&&e.click(e)},onContextMenu:n=>{n.stopPropagation(),n.nativeEvent.stopImmediatePropagation(),e.onContextMenu&&e.onContextMenu(n,e)},children:e.name})}const i=e=>(0,s.jsxs)("li",{children:[e.click?(0,s.jsx)(a,{...e.node,name:e.render?e.render(e.node):e.node.name,click:e.click,onContextMenu:e.onContextMenu}):(0,s.jsx)("div",{children:e.render?e.render(e.node):e.node.name}),e.node.children&&e.node.children.length>0&&(0,s.jsx)("ul",{children:e.node.children.map((n,t)=>(0,s.jsx)(i,{node:n,click:e.click,onContextMenu:e.onContextMenu,render:e.render},t))})]}),r=e=>(0,s.jsx)("div",{className:"card-tree-view",children:(0,s.jsx)("ul",{children:e.list&&e.list.map((n,t)=>(0,s.jsx)(i,{node:n,click:e.click,onContextMenu:e.onContextMenu,render:e.render},t))})});t.d(n,["A",0,r])},63659(e,n,t){t.r(n),t.d(n,{default:()=>N});var s=t(22022),a=t(96540),i=t(34843),r=t(82893),o=t(92275),d=t(14944),c=(t(14284),t(70447)),l=t(85997),u=t(62042),x=t(4412),h=t(75725),p=(t(22081),t(77481)),j=t(61443),m=t(47071),f=t(99214),w=t(88062),_=t(97856),g=t(88815),v=t(15629),k=t(74848);const y=a.lazy(()=>t.e(3233).then(t.bind(t,85614)));let b,C,S=-1;function N(e){const{t:n}=(0,s.Bd)(),t=(0,f.Du)(),[N,M]=(0,i.fp)(r.AG.workflow_show),[A,F]=(0,a.useState)([]),[E,W]=(0,a.useState)([]),[P,q]=(0,a.useState)(!1),[z,B]=(0,a.useState)(void 0),[I,J]=(0,a.useState)([]),[$,D]=(0,a.useState)(-1),[O,H]=(0,a.useState)(10),[K,Z]=(0,a.useState)(0),[T,V]=(0,a.useState)(0),[X,Y]=(0,a.useState)(""),[G,R]=(0,a.useState)(!1),L=[n("序号"),n("运行名称"),n("状态"),n("运行时长"),n("日期"),n("操作")],Q=[n("名称"),n("状态"),n("cwd"),n("运行时长"),n("操作")],U=async e=>{const n=new m._;n.page_num=e??$,n.page_size=O,n.dir_path=t;const s=await d.ws.sendData(o.HK.workflow_get,n);if(!s)return;const a=s.context;a&&(F(a.list.map(e=>{const n="string"==typeof e.meta?JSON.parse(e.meta):e.meta;return n.index=e.index,n})),Z(a.total),V((0,g.gw)(a.total,O)))};(0,a.useEffect)(()=>(q(!1),b=void 0,C=void 0,S=-1,U(),async()=>{C&&(C.dispose(),C=null)}),[]);const ee=async e=>{const n=e.steps,t=[];(0,v.Y)(t,n??[]),J(t)},ne=async e=>{C||await new Promise(e=>{b=e,q(!0),(async()=>{const e=new _.Terminal({fontFamily:"Monaco, Menlo, Consolas, 'Courier New', monospace",theme:{background:"#FFFFFF",foreground:"#000000",cursor:"#000000",selectionBackground:"#a6d2ff"},cursorBlink:!0,cursorStyle:"bar",scrollback:1e3,scrollSensitivity:1,tabStopWidth:4,convertEol:!0});C=e,B(e)})()}),e&&(C.reset(),C.write(e))};return(0,k.jsxs)("div",{children:[(0,k.jsxs)(x.aZ,{position:"right",children:[z&&(0,k.jsx)(l.rA,{icon:"print",title:"打印日志",onClick:()=>{q(!P)}}),(0,k.jsx)(l.rA,{icon:"close",title:n("关闭"),onClick:()=>{M(!1)}})]}),(0,k.jsx)(h.jW,{isFull:!0,more:!0,children:(0,k.jsx)(h.NN,{children:(0,k.jsx)(h.xh,{children:(0,k.jsxs)(h.fI,{children:[(0,k.jsx)(h.VP,{children:(0,k.jsx)(c.uF,{self_title:(0,k.jsx)("span",{className:" div-row ",children:(0,k.jsx)("h2",{children:n("历史记录")})}),rightTopCom:(0,k.jsx)("div",{className:" div-row ",children:(0,k.jsx)(j.Sm,{disabled:G,value:X,placeholder:"搜索运行名称(支持正则)",handleInputChange:e=>{Y(X)},handlerEnter:e=>{(async e=>{const n=new m._;n.search_name=e,n.dir_path=t,R(!0);const s=await d.ws.sendData(o.HK.workflow_search_by_run_name,n);if(!s)return;const a=s.context;F(a.list.map(e=>{const n="string"==typeof e.meta?JSON.parse(e.meta):e.meta;return n.index=e.index,n})),Z(a.total),V((0,g.gw)(a.total,O)),D(0),R(!1)})(e)}})}),rightBottomCom:(0,k.jsxs)("span",{className:" div-row ",children:[(0,k.jsxs)("span",{children:[Math.abs($),"/",T]}),(0,k.jsx)(j.Sm,{placeholder:`max page ${T}`,handleInputChange:e=>{S=parseInt(e)},handlerEnter:()=>{if(S<1||S>T)return void(0,u.zN)("illegal page num");const e=0-S;D(e),U(e)}}),(0,k.jsx)(l.rA,{icon:"navigate_before",onClick:()=>{const e=$+1;e>-1?(0,u.zN)("max page num"):(D(e),U(e))},title:"上一页"}),(0,k.jsx)(l.rA,{icon:"navigate_next",onClick:()=>{const e=$-1;Math.abs(e)>T?(0,u.zN)("min page num"):(D(e),U(e))},title:"下一页"})]}),children:(0,k.jsx)(p.X,{headers:L,rows:A.map((e,s)=>{let a;a=e.is_running?(0,k.jsxs)("div",{children:[(0,k.jsx)(c.fq,{}),n("正在运行")]}):(0,k.jsxs)("div",{children:[(0,k.jsx)(c.fq,{success:e.is_success}),e.is_success?n("成功"):n("失败")]});const i=[(0,k.jsx)("p",{children:e.index}),(0,k.jsx)("p",{style:{wordWrap:"break-word"},children:e["run-name"]}),a,(0,k.jsx)("span",{children:e.duration}),(0,k.jsx)("span",{children:e.timestamp}),(0,k.jsx)("div",{children:(0,k.jsx)(l.rA,{icon:"details",title:n("详情"),onClick:()=>{(async e=>{if(e.is_running)return;J([]);const n=new m._;n.index=e.index,n.dir_path=t;const s=(await d.ws.sendData(o.HK.workflow_get,n)).context,a="string"==typeof s.one_data.data?JSON.parse(s.one_data.data):s.one_data.data;W(a.all_jobs)})(e)}})})];return i}),width:"10rem"})})}),(0,k.jsxs)(h.VP,{children:[(0,k.jsx)(c.Zp,{title:n("Job"),children:(0,k.jsx)(p.X,{headers:Q,rows:E.map((e,t)=>[(0,k.jsx)("p",{children:e.name}),(0,k.jsx)(v.W,{item:e}),(0,k.jsx)(c.xP,{children:String(e.cwd)}),(0,k.jsx)("span",{children:e.duration}),(0,k.jsxs)("div",{children:[(0,k.jsx)(l.rA,{icon:"details",title:n("详情"),onClick:()=>{ee(e)}}),!!e.message&&(0,k.jsx)(l.rA,{icon:"print",title:n("日志"),onClick:()=>{ne(e.message)}})]})]),width:"10rem"})}),(0,k.jsx)(c.Zp,{title:"Step",children:(0,k.jsx)(w.A,{list:I,click:e=>{(async e=>{if(e?.extra_data?.is_job)await ee(e.extra_data.job_data);else if(e?.extra_data?.context)ne(e.extra_data.context);else{if(!e?.extra_data.code)return;ne(e.extra_data.code??"")}})(e)}})})]})]})})})}),(0,k.jsx)("div",{style:{display:P?"":"none"},children:(0,k.jsx)(y,{show:!0,terminal:z,init:()=>{b&&(b(1),b=void 0)}})})]})}},15629(e,n,t){t.d(n,{W:()=>o});t(96540);var s=t(70447),a=t(47071),i=t(22022),r=t(74848);function o({item:e}){const{t:n}=(0,i.Bd)();let t,o;return null!=e.code?t=0===e.code:e.extra_data?.running_type===a.rl.running&&(o=!0),(0,r.jsxs)("div",{children:[(0,r.jsx)(s.fq,{success:t,running:o}),n(t?"成功":"失败")]})}const d=(e,n,t)=>{if(n)for(const t of n??[]){let n;const a=[];t["use-yml"]?(d(a,void 0,t.use_job_children_list),n=`${t["use-yml"]} ;${t.duration??-1}`):t.runs?n=JSON.stringify(t.runs):t.run?n=t.run:t["run-js"]?n=t["run-js"]:t.sleep&&(n=`sleep ${t.sleep}`),n=(0,r.jsxs)("div",{children:[(0,r.jsx)(s.fq,{success:void 0===t.code?void 0:0===t.code})," ",n+" ;"+(t.duration??"")]}),e.push({name:n,children:a,extra_data:{code:t.code,context:t.message}})}else if(t)for(const n of t??[]){const t=(0,r.jsxs)("div",{children:[(0,r.jsx)(s.fq,{success:void 0===n.code?void 0:0===n.code}),"$",n.name]});e.push({name:t,extra_data:{code:n.code,is_job:!0,job_data:n}})}};t.d(n,["Y",0,d])}}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[4903],{64903(e,t,n){n.r(t),n.d(t,{default:()=>f});var c=n(96540),i=n(34843),s=n(82893),l=n(85997),o=n(57952),r=(n(62042),n(21499),n(40505),n(22022)),a=(n(99214),n(74848));const d=c.lazy(()=>Promise.resolve().then(n.bind(n,50260)));function f(e){const{t}=(0,r.Bd)(),[n,c]=(0,i.fp)(s.AG.markdown);if(n.context)return(0,a.jsxs)("div",{id:"md-container",children:[(0,a.jsx)(o.A,{ignore_tags:!0,left_children:[(0,a.jsx)(l.rA,{title:t("取消"),icon:"close",onClick:function(){c({context:"",filename:""}),n?.close?.()}},1),(0,a.jsx)("title",{children:n.filename},2)]}),(0,a.jsx)("div",{className:"md-context ",children:(0,a.jsx)(d,{context:n.context})})]})}}}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[4935],{24935(e,t,n){n.r(t),n.d(t,{default:()=>S});var r=n(96540),l=n(47049),s=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(),l=r%100,s=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(l)).replace(/(?<!m)m(?!m)/g,String(s)).replace(/mm/g,n(s)).replace(/d(?!d)/g,String(o)).replace(/dd/g,n(o)).replace(/aaaa/g,`星期${c}`)}const h=e=>!!e&&/[ymd]/i.test(e.replace(/"[^"]*"/g,""))&&!/[#0]/.test(e.replace(/"[^"]*"/g,""));function d(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&&h(n)?{text:f(u(e),n)}:{text:String(e)}:{text:null}}return"number"==typeof r&&h(n)?{text:f(u(r),n)}:{text:String(r)}}function m(e,t,n){const r=e?.styleId;if(void 0===r)return;const l=t.cellXfs?.[r];if(!l)return;const s=t.fills?.[l.fillId],o=t.fonts?.[l.fontId],c={};"solid"===s?.patternType&&(c.bg=i(s.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=l.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 l=r.numFmtId;if(void 0===l||0===l)return;const s={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(s[l])return s[l];const o=t.numFmts;return o instanceof Map?o.get(l):void 0}async function x(e){const t=await(0,l.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 l=[],s=/<a:(dk1|lt1|dk2|lt2|accent[1-6]|hlink|folHlink)>([\s\S]*?)<\/a:\1>/g,o=new Map;let c;for(;c=s.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)=>l[n]=o.get(e)??t[n]),l}(t.themeXml);return t.sheets.map(e=>{const r=e.sheet,l=t.styles;let s=0,a=0;r.rows.forEach((e,t)=>{e.size&&(s=Math.max(s,t),e.forEach((e,t)=>{a=Math.max(a,t)}))});const i=[],u=new Map;for(let e=1;e<=s;e++){const t=[],s=r.rows.get(e);for(let r=1;r<=a;r++){const o=s?.get(r),c=d(o,n,g(o,l));t.push(c.text);const a=m(o,l,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),h=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<h.length&&(h[n-1]=t)});const x=c(r.defaultRowHeight??15),y=new Array(s).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<s&&p.add(t-1)});const v=(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:h,row_heights:y,hidden_rows:p,merges:v}})}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),[,h]=(0,r.useState)(0),[d,m]=(0,r.useState)(""),g=(0,r.useRef)(!1),p=(0,r.useRef)(null),[_,S]=(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 b=(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,l.a)(a(e));return t.forEach((e,t)=>{const r=n.sheets[t];if(!r)return;const l=r.sheet;e.values.forEach((e,t)=>{e.forEach((e,n)=>{const r=t+1,s=n+1;let o=l.rows.get(r);o||(o=new Map,l.rows.set(r,o));const c=o.get(s);null!==e&&""!==e?c?c.value=e:o.set(s,{row:r,col:s,value:e}):c&&(c.value=null)})})}),await(0,s.n)(n)}(t,c);return g.current=!1,n(!1),e})},[c,t,o,n]);const C=c[u],{col_x:M,row_y:E,total_w:j,total_h:$}=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]),k=(e,t)=>{let n=0,r=e.length-1;for(;n<r;){const l=n+r>>1;e[l]<t?n=l+1:r=l}return n},F=(0,r.useCallback)(()=>{const e=p.current;if(!e||!M.length)return;const t=Math.max(0,k(M,e.scrollLeft)-1),n=Math.max(0,k(E,e.scrollTop)-1);S({c0:t,c1:Math.min(M.length-1,k(M,e.scrollLeft+e.clientWidth)+2),r0:n,r1:Math.min(E.length-1,k(E,e.scrollTop+e.clientHeight)+2)})},[M,E]);(0,r.useEffect)(()=>{F()},[C,F]);if(d)return(0,y.jsx)("div",{className:"office-editor__tip office-editor__tip--error",children:d});if(!c.length)return(0,y.jsx)("div",{className:"office-editor__tip",children:"解析中…"});const D=C?.values??[],N=(E.length,M.length,new Set);C.merges.forEach(([e,t,n,r])=>{for(let l=e;l<=n;l++)for(let n=t;n<=r;n++)l===e&&n===t||N.add(`${l}_${n}`)});const A=(e,t)=>{const n=D[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:F,children:(0,y.jsxs)("div",{className:"xlsx-grid",style:{width:46+j,height:24+$},children:[Array.from({length:Math.max(0,_.c1-_.c0)}).map((e,t)=>{const n=_.c0+t;return(0,y.jsx)("div",{className:"xlsx-head",style:{left:46+M[n],top:0,width:M[n+1]-M[n],height:24},children:w(n)},"ch"+n)}),Array.from({length:Math.max(0,_.r1-_.r0)}).map((e,t)=>{const n=_.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,_.c1-_.c0)}).map((e,t)=>{const r=_.c0+t;if(N.has(`${n}_${r}`))return null;const l=C.merges.find(e=>e[0]===n&&e[1]===r),s=l?M[l[3]+1]-M[l[1]]:M[r+1]-M[r],o=l?E[l[2]+1]-E[l[0]]:E[n+1]-E[n];return(0,y.jsx)(v,{value:D[n]?.[r]??"",cell_style:C.styles.get(`${n}_${r}`),spillable:A(n,r+1),style:{left:46+M[r],top:24+E[n],width:s,height:o,zIndex:l?2:1},on_change:e=>((e,t,n)=>{const r=c[u];r&&(r.values[e][t]=""===n?null:n,b(),h(e=>e+1))})(n,r,e)},r)})]},n)})]})})]})}function v(e){const{value:t,cell_style:n,style:l,spillable:s,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 h=()=>{a(!1),i!==(t??"")&&o(i)},d={};return n?.bg&&(d.backgroundColor=n.bg),n?.color&&(d.color=n.color),n?.bold&&(d.fontWeight=600),n?.italic&&(d.fontStyle="italic"),n?.fontSize&&(d.fontSize=Math.round(4*n.fontSize/3*10)/10+"px"),n?.fontFamily&&(d.fontFamily=`"${n.fontFamily}", "PingFang SC", sans-serif`),n?.underline&&(d.textDecoration="underline"),n?.strike&&(d.textDecoration=d.textDecoration?`${d.textDecoration} line-through`:"line-through"),n?.align&&(d.textAlign=n.align,d.justifyContent="center"===n.align?"center":"right"===n.align?"flex-end":"flex-start"),n?.valign&&(d.alignItems="middle"===n.valign?"center":"bottom"===n.valign?"flex-end":"flex-start"),n?.wrap&&(d.whiteSpace="pre-wrap"),n?.indent&&(d.paddingLeft=.35+1.4*n.indent+"em"),(0,y.jsx)("div",{className:`xlsx-cell ${n?.wrap?"xlsx-cell--wrap":""} ${s?"xlsx-cell--spill":""}`,style:{...l,...d,"--cell-h":n?.wrap?"1.4":l.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:h,onKeyDown:e=>{"Enter"!==e.key||e.shiftKey?"Escape"===e.key&&a(!1):(e.preventDefault(),h())}}):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 w(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 _=n(99018);function S(e){const{url:t,save_path:n,on_dirty:l,bind_save:s}=e,[o,c]=(0,r.useState)(),[a,i]=(0,r.useState)(""),[u,f]=(0,r.useState)(!0),[h,d]=(0,r.useState)(!1),m=(0,r.useRef)();return(0,r.useEffect)(()=>{if(!t)return;let e=!0;return f(!0),i(""),d(!1),c(void 0),(0,_.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)(()=>{l?.(h)},[h,l]),(0,r.useEffect)(()=>{s?.(async()=>{if(!m.current)return!1;const e=await m.current(),t=await(0,_.GB)(n,e);return t&&(c(e),d(!1)),t})},[n,s]),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:d,bind_save:e=>m.current=e})}},99018(e,t,n){n.d(t,{GB:()=>i,PQ:()=>a,Vi:()=>c});var r=n(14284),l=n(57889),s=n(34289),o=n(62042);function c(e){return`${encodeURIComponent((0,s.GG)("file",(0,s.vX)()))}${e}`}async function a(e){return l.l.get_bytes_url(e)}function i(e,t){return async function(e,t){const n=await r.$M.post(`save_bin/${e}`,{base64:u(t)});return 0===n.code||((0,o.zN)(n.message??"保存失败"),!1)}(function(e){const t=e.lastIndexOf("/");return t<0?encodeURIComponent(e):encodeURIComponent(e.slice(0,t))+e.slice(t)}(e),t)}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)}}}]);