@evandu/super-pi 0.1.299 → 0.1.301
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.super-pi-check-inputs.json +2 -2
- package/dist/client/.super-pi-client-sources.json +14 -11
- package/dist/client/assets/CodeMirrorEditor-C8sidScW.css +1 -0
- package/dist/client/assets/CodeMirrorEditor-Y2IIf7Zj.js +2 -0
- package/dist/client/assets/{GitDiffEditor-BuozIMBT.js → GitDiffEditor-DtcBKTbz.js} +4 -4
- package/dist/client/assets/{index-BYAipWq-.js → index-BJds5OrY.js} +34 -34
- package/dist/client/assets/index-BV-OeWsY.css +1 -0
- package/dist/client/index.html +2 -2
- package/dist/server/application/run-service.js +1 -1
- package/dist/server/git.js +4 -3
- package/dist/server/workspace-file-operations.js +1 -1
- package/package.json +1 -1
- package/dist/client/assets/CodeMirrorEditor-C-L7B565.css +0 -1
- package/dist/client/assets/CodeMirrorEditor-CyYniLtN.js +0 -2
- package/dist/client/assets/index-Dcs7gmUf.css +0 -1
package/dist/client/index.html
CHANGED
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
<link rel="alternate icon" href="/favicon.ico" />
|
|
9
9
|
<link rel="apple-touch-icon" href="/favicon.svg" />
|
|
10
10
|
<title>Super Pi</title>
|
|
11
|
-
<script type="module" crossorigin src="/assets/index-
|
|
11
|
+
<script type="module" crossorigin src="/assets/index-BJds5OrY.js"></script>
|
|
12
12
|
<link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-XKyaHtl9.js">
|
|
13
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
13
|
+
<link rel="stylesheet" crossorigin href="/assets/index-BV-OeWsY.css">
|
|
14
14
|
</head>
|
|
15
15
|
<body>
|
|
16
16
|
<div id="root"></div>
|
|
@@ -55,7 +55,7 @@ async function expandAtReferences(store, workspace, content) {
|
|
|
55
55
|
continue;
|
|
56
56
|
}
|
|
57
57
|
try {
|
|
58
|
-
const { stdout } = await execFileAsync("git", ["-C", workspace.path, "worktree", "list", "--porcelain"], { maxBuffer: 1024 * 1024 });
|
|
58
|
+
const { stdout } = await execFileAsync("git", ["-C", workspace.path, "worktree", "list", "--porcelain"], { env: { ...process.env, GIT_OPTIONAL_LOCKS: "0" }, maxBuffer: 1024 * 1024 });
|
|
59
59
|
const entries = stdout.split(/\n\n+/).map(block => {
|
|
60
60
|
const path = block.match(/^worktree (.+)$/m)?.[1];
|
|
61
61
|
return path ? { path, block } : undefined;
|
package/dist/server/git.js
CHANGED
|
@@ -7,7 +7,8 @@ import { mkdir, readFile, realpath, stat } from "node:fs/promises";
|
|
|
7
7
|
import { MAX_FILE_BYTES } from "./files.js";
|
|
8
8
|
import { ignoreWorkspaceTrash } from "./workspace-file-operations.js";
|
|
9
9
|
const exec = promisify(execFile);
|
|
10
|
-
|
|
10
|
+
// Background reads must not refresh the index under an optional lock; writes still take required locks.
|
|
11
|
+
async function git(cwd, args, options) { return exec("git", ["--literal-pathspecs", "-c", "core.quotepath=false", "-c", "diff.autoRefreshIndex=false", ...args], { cwd, env: { ...process.env, GIT_OPTIONAL_LOCKS: "0" }, windowsHide: true, maxBuffer: options?.maxBuffer ?? 8 * 1024 * 1024, timeout: options?.timeout }); }
|
|
11
12
|
function files(raw, cwd = "") {
|
|
12
13
|
const staged = [], unstaged = [], untracked = [];
|
|
13
14
|
const records = raw.split("\0");
|
|
@@ -470,8 +471,8 @@ export async function gitStashes(root, cwd, query = "", offset = 0) {
|
|
|
470
471
|
}
|
|
471
472
|
export async function gitStagedDraftInput(root, cwd) {
|
|
472
473
|
const maxBytes = 24 * 1024;
|
|
473
|
-
const child = spawn("git", ["--literal-pathspecs", "--no-pager", "diff", "--cached", "--no-ext-diff", "--no-textconv", "--no-color", "--", cwd || "."], {
|
|
474
|
-
cwd: root, stdio: ["ignore", "pipe", "ignore"], windowsHide: true,
|
|
474
|
+
const child = spawn("git", ["--literal-pathspecs", "-c", "diff.autoRefreshIndex=false", "--no-pager", "diff", "--cached", "--no-ext-diff", "--no-textconv", "--no-color", "--", cwd || "."], {
|
|
475
|
+
cwd: root, env: { ...process.env, GIT_OPTIONAL_LOCKS: "0" }, stdio: ["ignore", "pipe", "ignore"], windowsHide: true,
|
|
475
476
|
});
|
|
476
477
|
const chunks = [];
|
|
477
478
|
let bytes = 0, truncated = false;
|
|
@@ -15,7 +15,7 @@ export async function ignoreWorkspaceTrash(workspace, forthcoming = false) {
|
|
|
15
15
|
return;
|
|
16
16
|
let top, exclude;
|
|
17
17
|
try {
|
|
18
|
-
const options = { cwd: workspace, windowsHide: true, timeout: 5000 };
|
|
18
|
+
const options = { cwd: workspace, env: { ...process.env, GIT_OPTIONAL_LOCKS: "0" }, windowsHide: true, timeout: 5000 };
|
|
19
19
|
top = (await exec("git", ["rev-parse", "--show-toplevel"], options)).stdout.trim();
|
|
20
20
|
const path = (await exec("git", ["rev-parse", "--git-path", "info/exclude"], options)).stdout.trim();
|
|
21
21
|
exclude = resolve(workspace, path);
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
.workbench-shell .cm-editor .cm-workbench-selectedText,.workbench-shell .cm-editor .cm-workbench-selectedText *{background:var(--selected)!important;color:var(--bg-app)!important}.workbench-shell :is(.cm-editor,.workbench-editor-search) .cm-panels{background:var(--bg-panel);color:var(--text-primary)}.workbench-shell :is(.cm-editor,.workbench-editor-search) .cm-panels-top{border-bottom:1px solid var(--border-default)}.workbench-shell .workbench-editor-search{z-index:10;pointer-events:none;width:min(420px,100% - 24px);height:auto;min-height:0;max-height:calc(100% - 16px);top:8px;left:auto;right:12px;overflow:auto;position:absolute!important}.workbench-shell .workbench-editor-search:has(.cm-panels){pointer-events:auto}.workbench-shell .workbench-editor-search .cm-panels-top{border:1px solid var(--border-default);width:100%;box-shadow:0 4px 12px var(--shadow-faint);pointer-events:auto;border-radius:5px;max-height:100%;position:relative;overflow:auto}.git-diff-merge-wrap[data-git-diff-layout=split] .workbench-editor-search{width:min(420px,50% - 24px)}.git-diff-merge-wrap[data-git-diff-layout=split] [data-editor-find-host=original]{right:calc(50% + 12px)}.workbench-shell :is(.cm-editor,.workbench-editor-search) .cm-search:not([data-editor-search-expanded=true]) :is(label,br,input[name=replace],button[name=replace],button[name=replaceAll],button[name=select]){display:none}.workbench-shell :is(.cm-editor,.workbench-editor-search) .cm-search:not([data-editor-search-expanded=true]) .cm-textfield{flex-basis:120px;width:160px;min-width:80px}.workbench-shell :is(.cm-editor,.workbench-editor-search) .cm-panel.cm-search{min-width:0;font-family:Manrope,system-ui,sans-serif;font-size:var(--type-control);line-height:var(--type-control-line);background:var(--bg-panel);color:var(--text-primary);flex-wrap:wrap;align-items:center;gap:6px 8px;padding:10px 46px 10px 12px;display:flex;position:relative}.workbench-shell :is(.cm-editor,.workbench-editor-search) .cm-search :is(input,button,label){font:inherit;margin:0}.workbench-shell :is(.cm-editor,.workbench-editor-search) .cm-search .cm-textfield{border:1px solid var(--border-default);width:220px;min-width:100px;max-width:340px;height:32px;color:var(--text-primary);background:var(--bg-input);box-shadow:none;border-radius:4px;flex:180px;padding:5px 8px}.workbench-shell :is(.cm-editor,.workbench-editor-search) .cm-search .cm-textfield::placeholder{color:var(--text-muted)}.workbench-shell :is(.cm-editor,.workbench-editor-search) .cm-search button{border:1px solid var(--border-default);min-height:32px;color:var(--text-primary);background:var(--bg-raised);box-shadow:none;cursor:pointer;background-image:none;border-radius:4px;flex:none;justify-content:center;align-items:center;padding:4px 8px;display:inline-flex}.workbench-shell :is(.cm-editor,.workbench-editor-search) .cm-search button:hover{background:var(--bg-hover)}.workbench-shell :is(.cm-editor,.workbench-editor-search) .cm-search label{white-space:nowrap;min-height:32px;color:var(--text-secondary);align-items:center;gap:5px;display:inline-flex}.workbench-shell :is(.cm-editor,.workbench-editor-search) .cm-search input[type=checkbox]{width:16px;height:16px;accent-color:var(--accent);cursor:pointer;margin:0}.workbench-shell :is(.cm-editor,.workbench-editor-search) .cm-search br{flex-basis:100%;height:0}.workbench-shell :is(.cm-editor,.workbench-editor-search) .cm-search button[name=close]{background:0 0;border-color:#0000;width:30px;height:32px;min-height:32px;padding:0;font-size:20px;line-height:1;position:absolute;top:10px;right:8px}.workbench-shell :is(.cm-editor,.workbench-editor-search) .cm-search button[name=close]:hover{background:var(--bg-hover)}.workbench-shell :is(.cm-editor,.workbench-editor-search) .cm-search :is(input,button):focus-visible{outline:2px solid var(--focus-ring);outline-offset:1px}.workbench-shell :is(.cm-editor,.workbench-editor-search) .cm-searchMatch{color:var(--editor-find-fg);background-color:var(--editor-find-bg);box-shadow:inset 0 0 0 1px var(--editor-find-border)}.workbench-shell .cm-editor .cm-selectionMatch{background-color:var(--editor-find-bg);color:var(--editor-find-fg);box-shadow:inset 0 0 0 1px var(--editor-find-border)}.workbench-shell .cm-editor .cm-selectionMatch span{color:inherit;background-color:#0000}.workbench-shell :is(.cm-editor,.workbench-editor-search) .cm-searchMatch-selected{color:var(--editor-find-current-fg);background-color:var(--editor-find-current-bg);outline:1px solid var(--editor-find-current-border);box-shadow:inset 0 0 0 1px var(--editor-find-current-border)}.workbench-shell :is(.cm-editor,.workbench-editor-search) .cm-searchMatch span{color:inherit;background-color:#0000}@media (width<=700px){.workbench-shell :is(.cm-editor,.workbench-editor-search) .cm-panel.cm-search{padding-right:60px}.workbench-shell :is(.cm-editor,.workbench-editor-search) .cm-search :is(button,label){min-height:44px}.workbench-shell :is(.cm-editor,.workbench-editor-search) .cm-search .cm-textfield{height:44px}.workbench-shell :is(.cm-editor,.workbench-editor-search) .cm-search button[name=close]{width:44px;height:44px}}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/dist-D978o95T.js","assets/rolldown-runtime-XKyaHtl9.js","assets/dist-DTIPfQj7.js","assets/dist-S5ntGzJB.js","assets/dist-Cus6_oaF.js","assets/dist-DP4hrTBF.js","assets/dist-Qjm1p8SR.js","assets/dist-BJHpSQV1.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{_ as t,c as n,g as r,h as i,i as a,m as o,o as s,p as c,r as l,s as u}from"./index-BYAipWq-.js";var d=e(t(),1);function f(e,t,n,r){return[n.EditorView.decorations.compute([`selection`,`doc`],e=>n.Decoration.set(e.selection.ranges.filter(e=>!e.empty).map(e=>n.Decoration.mark({class:`cm-workbench-selectedText`}).range(e.from,e.to)),!0)),n.ViewPlugin.define(e=>{let t=()=>{let e=r.querySelector(`.cm-panel.cm-search`);if(!e||e.querySelector(`[data-editor-search-options]`))return;let t=document.createElement(`button`);t.type=`button`,t.dataset.editorSearchOptions=``,t.textContent=`选项`,t.setAttribute(`aria-label`,`展开查找选项`),t.setAttribute(`aria-expanded`,`false`),t.onclick=()=>{let n=e.dataset.editorSearchExpanded!==`true`;e.dataset.editorSearchExpanded=String(n),t.setAttribute(`aria-expanded`,String(n)),t.setAttribute(`aria-label`,n?`收起查找选项`:`展开查找选项`)},e.append(t)},n=new MutationObserver(t);return n.observe(r,{childList:!0,subtree:!0}),t(),{destroy(){n.disconnect()}}}),e.Prec.highest(n.keymap.of([{key:`Mod-Shift-l`,run:t.selectSelectionMatches},{key:`Mod-h`,run:e=>(t.openSearchPanel(e),requestAnimationFrame(()=>{e.dom.isConnected&&r.querySelector(`[data-editor-search-options][aria-expanded="false"]`)?.click()}),!0)},...[`c`,`w`,`r`].map(e=>({key:`Alt-${e}`,run:n=>{t.openSearchPanel(n);let r=t.getSearchQuery(n.state);return n.dispatch({effects:t.setSearchQuery.of(new t.SearchQuery({...r,...e===`c`?{caseSensitive:!r.caseSensitive}:e===`w`?{wholeWord:!r.wholeWord}:{regexp:!r.regexp}}))}),!0}}))])),n.panels({topContainer:r}),n.EditorView.scrollMargins.of(()=>({top:r.querySelector(`.cm-search`)?Math.min(r.getBoundingClientRect().height+8,Math.max(0,(r.parentElement?.clientHeight??0)-32)):0})),t.highlightSelectionMatches({wholeWords:!0,minSelectionLength:1,maxMatches:1e3}),t.search({top:!0}),e.EditorState.phrases.of({Find:`查找`,Replace:`替换为`,next:`下一处`,previous:`上一处`,all:`全部选中`,"match case":`区分大小写`,regexp:`正则表达式`,"by word":`全词匹配`,replace:`替换`,"replace all":`全部替换`,close:`关闭查找`,"current match":`当前匹配`,"on line":`所在行`})]}function p(e,t,r,i,a){let o=new e.Compartment,c=()=>{let n=s();return[e.EditorState.tabSize.of(n.tabSize),r.indentUnit.of(n.indent===`tabs`?` `:` `.repeat(n.tabSize)),n.wrap?t.EditorView.lineWrapping:[],n.whitespace?[t.highlightWhitespace(),t.highlightTrailingWhitespace()]:[]]};return[e.EditorState.allowMultipleSelections.of(!0),t.rectangularSelection(),t.crosshairCursor({key:`Alt`}),e.EditorState.phrases.of({"folded code":`已折叠代码`,unfold:`展开代码`,"Fold line":`折叠代码`,"Unfold line":`展开代码`}),t.highlightActiveLineGutter(),t.highlightSpecialChars(),t.dropCursor(),r.bracketMatching(),r.indentOnInput(),r.foldGutter(),i.closeBrackets(),e.Prec.highest(t.keymap.of([...i.closeBracketsKeymap,...r.foldKeymap,{key:`Alt-z`,run:()=>(u({wrap:!s().wrap}),!0)},{key:`Mod-Shift-z`,run:a.redo},{key:`Mod-y`,run:a.redo}])),o.of(c()),t.ViewPlugin.define(e=>({destroy:n(()=>{e.dispatch({effects:o.reconfigure(c())})})}))]}var m=new Map;function ee(e){let t=m.get(e);return t&&(m.delete(e),m.set(e,t)),t}function h(e,t){m.delete(e),m.set(e,t);let n=[...m.values()].reduce((e,t)=>e+t.state.doc.length,0);for(;m.size>32||n>16777216;){let e=m.keys().next().value;n-=m.get(e).state.doc.length,m.delete(e)}}var g=r(),te=262144,_=131072;function v(e){return e.split(`.`).pop()?.toLowerCase()??``}function y(e,t,n=!1){let r=e=>n?`var(--git-diff-${e.slice(5)}, var(${e}))`:`var(${e})`;return e.HighlightStyle.define([{tag:t.tags.keyword,color:r(`--cm-keyword`)},{tag:t.tags.string,color:r(`--cm-string`)},{tag:t.tags.number,color:r(`--cm-number`)},{tag:t.tags.comment,color:r(`--cm-comment`),fontStyle:`italic`},{tag:t.tags.function(t.tags.variableName),color:r(`--cm-function`)},{tag:t.tags.typeName,color:r(`--cm-type`)},{tag:t.tags.className,color:r(`--cm-type`)},{tag:t.tags.propertyName,color:r(`--cm-property`)},{tag:t.tags.operator,color:r(`--cm-operator`)},{tag:t.tags.variableName,color:r(`--cm-variable`)}])}function b({path:e,value:t,onChange:n,jumpToLine:r,onSave:s,workspaceId:u,cwd:m=``,blame:b,onPosition:x,onView:S,readOnly:C=!1,languageOverride:w}){let T=(0,d.useRef)(null),E=(0,d.useRef)(null),D=(0,d.useRef)(null),O=(0,d.useRef)(null),k=JSON.stringify([u,m,e]),A=(0,d.useRef)(void 0),j=(0,d.useRef)(null),M=(0,d.useRef)(null),ne=(0,d.useRef)(null),re=(0,d.useRef)(null),N=(0,d.useRef)(null),P=(0,d.useRef)(null),F=(0,d.useRef)(n),ie=(0,d.useRef)(s),I=(0,d.useRef)(!1),L=(0,d.useRef)(S);L.current=S,F.current=n,ie.current=s;let[R,ae]=(0,d.useState)(!1),[z,B]=(0,d.useState)(!1),[V,H]=(0,d.useState)(`0,0`),[U,oe]=(0,d.useState)(0),[W,G]=(0,d.useState)(1);(0,d.useEffect)(()=>{let n=!1,r,s,c,l,u;return(async()=>{try{let d=w??v(e),m=o(d),[h,g,_,b,x,S,R,z,V]=await Promise.all([i(()=>import(`./dist-D978o95T.js`).then(e=>e.S),__vite__mapDeps([0,1])),i(()=>import(`./dist-DTIPfQj7.js`).then(e=>e.s),__vite__mapDeps([2,1,0])),i(()=>import(`./dist-S5ntGzJB.js`),__vite__mapDeps([3,0,1,2,4,5])),i(()=>import(`./dist-Qjm1p8SR.js`),__vite__mapDeps([6,0,1,2])),i(()=>import(`./dist-DP4hrTBF.js`).then(e=>e.d),__vite__mapDeps([5,1,0,2,4])),i(()=>import(`./dist-Cus6_oaF.js`).then(e=>e.n),__vite__mapDeps([4,1])),m?m().catch(e=>(console.warn(`[CodeMirror] Failed to load language for .${d}:`,e),null)):Promise.resolve(null),a().catch(e=>(console.warn(`[CodeMirror] Failed to build the blame extension:`,e),null)),i(()=>import(`./dist-BJHpSQV1.js`).then(e=>e.r),__vite__mapDeps([7,1,0,2,5,4]))]);if(n||!T.current||!E.current)return;O.current=g.EditorView,l=x,u=S,M.current=h.Annotation.define(),ne.current=h.Transaction.addToHistory;let U=t.length<=te&&R!==null;s=new h.Compartment;let W=[g.lineNumbers(),g.highlightActiveLine(),g.drawSelection(),_.history(),g.keymap.of([_.indentWithTab,..._.defaultKeymap,..._.historyKeymap,...b.searchKeymap,{key:`Mod-s`,run:()=>(ie.current(),!0)}]),g.EditorView.updateListener.of(e=>{e.docChanged&&!(M.current&&e.transactions.some(e=>e.annotation(M.current)===!0))&&F.current(e.state.doc.toString()),e.selectionSet&&H(`${e.state.selection.main.from},${e.state.selection.main.to}`)}),g.EditorView.domEventHandlers({mousedown:(e,t)=>(t.focus(),!1)})];if(W.push(g.EditorView.updateListener.of(e=>{e.selectionSet&&G(e.state.selection.ranges.length),e.docChanged?I.current=!1:e.selectionSet&&(I.current=e.transactions.some(e=>e.isUserEvent(`select.search`)||e.isUserEvent(`select.pointer`)))}),f(h,b,g,E.current),p(h,g,x,V,_)),C&&W.push(h.EditorState.readOnly.of(!0),g.EditorView.editable.of(!1),g.EditorView.contentAttributes.of({tabindex:`0`})),z&&!C&&(c=new h.Compartment,W.splice(1,0,c.of([])),W.push(z.base)),R)try{W.push(R)}catch(e){console.warn(`[CodeMirror] Failed to apply language extension for .${d}:`,e),U=!1}if(U&&s&&l&&u)try{W.push(s.of(l.syntaxHighlighting(y(l,u))))}catch(e){console.warn(`[CodeMirror] Failed to attach syntaxHighlighting for .${d}:`,e),U=!1}let K=ee(k),q=K&&K.state.doc.toString()===t,se=q?K.state.update({effects:h.StateEffect.reconfigure.of(W)}).state:h.EditorState.create({doc:t,extensions:W});if(r=new g.EditorView({state:se,parent:T.current}),A.current=q?K.jump:void 0,G(r.state.selection.ranges.length),H(`${r.state.selection.main.from},${r.state.selection.main.to}`),q&&(r.scrollDOM.scrollTop=K.top,r.scrollDOM.scrollLeft=K.left,A.current=K.jump),n){r.destroy();return}D.current=r,L.current?.(r),ae(U),B(!0),re.current=z,N.current=c??null,P.current=null,oe(e=>e+1);let J=new MutationObserver(()=>{let e=D.current;if(e&&U&&s&&l&&u)try{e.dispatch({effects:s.reconfigure(l.syntaxHighlighting(y(l,u)))})}catch{}});j.current=J,J.observe(document.documentElement,{attributes:!0,attributeFilter:[`data-theme`]})}catch(e){console.error(`[CodeMirror] Fatal editor initialization error:`,e),n||B(!0)}})(),()=>{n=!0,j.current?.disconnect(),j.current=null,r&&h(k,{state:r.state,top:r.scrollDOM.scrollTop,left:r.scrollDOM.scrollLeft,jump:A.current}),r?.destroy(),D.current=null,L.current?.(),B(!1),T.current&&(T.current.textContent=``)}},[k,C,w]),(0,d.useEffect)(()=>{let e=D.current;if(!e)return;let n=e.state.doc.toString();n!==t&&e.dispatch({changes:{from:0,to:n.length,insert:t},annotations:M.current?M.current.of(!0):void 0})},[t]),(0,d.useEffect)(()=>{let e=D.current;if(!e||!r||A.current===r.request)return;A.current=r.request;let t=e.state.doc.line(Math.min(Math.max(1,r.line),e.state.doc.lines)),n=Math.min(t.to,t.from+(r.column??1)-1);e.dispatch({selection:{anchor:t.to,head:n},effects:O.current?.scrollIntoView(n,{y:`start`,yMargin:Math.round(e.scrollDOM.clientHeight/3)})}),e.focus()},[r,z]);let K=!!(b&&b.state===`ready`&&b.response&&b.path===e&&b.workspaceId===u);(0,d.useEffect)(()=>{let t=D.current,n=re.current,r=N.current;if(!t||!n||!r)return;let i=b&&b.state===`ready`&&b.response&&b.path===e&&b.workspaceId===u?b.response:null,a=i?l(i):null;P.current!==a&&(P.current=a,t.dispatch({effects:[n.setBlame.of(a),r.reconfigure(a?n.gutter:[])]}))},[b?.state,b?.response,b?.path,b?.workspaceId,e,u,U]);let q=D.current?.state.doc.toString()??t,se=q.length<=_?q:q.slice(0,_),J=w??v(e),Y=c(J),ce=D.current?.state,X=ce?.selection.main.head,Z=X===void 0?void 0:ce?.doc.lineAt(X),Q=Z?.number,$=X!==void 0&&Z?X-Z.from+1:void 0;return(0,d.useEffect)(()=>{z&&Q!==void 0&&$!==void 0&&x?.({line:Q,column:$,language:R&&Y||`纯文本`,highlight:R?J:`plain`,navigation:I.current,selections:W})},[z,Q,$,R,Y,J,x,W]),(0,d.useEffect)(()=>()=>x?.(),[x]),(0,g.jsxs)(`div`,{className:`file-cm-wrap`,"data-file-text":e,"data-file-content":se,"data-file-content-truncated":q.length>_?`1`:`0`,"data-file-selection":V,"data-editor-selection-count":W,"data-file-editor-ready":z?`1`:`0`,"data-file-blame-gutter":K?`1`:void 0,onMouseDown:e=>{e.target.closest(`.cm-panels`)||D.current?.focus()},children:[(0,g.jsx)(`div`,{className:`file-cm`,ref:T,"aria-label":`${C?`查看`:`编辑`} ${e}`}),(0,g.jsx)(`div`,{className:`workbench-editor-search`,ref:E,"data-editor-find-host":`file`}),(!z||!x)&&(0,g.jsxs)(`div`,{className:`file-editor-status`,children:[!z&&(0,g.jsx)(`span`,{"data-file-editor-loading":`1`,children:`正在加载编辑器…`}),z&&X!==void 0&&Z&&(0,g.jsxs)(`span`,{children:[`第 `,Z.number,` 行,第 `,X-Z.from+1,` 列`]}),z&&!R&&(0,g.jsx)(`span`,{"data-file-highlight-status":`plain`,children:`纯文本`}),z&&R&&Y&&(0,g.jsx)(`span`,{"data-file-highlight-status":J,children:Y})]})]})}export{b as CodeMirrorEditor,f as n,p as t,y as themeHighlightStyle};
|