texlite 0.16.0 → 0.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/DESIGN.md +87 -5
- package/OPERATIONS.md +27 -0
- package/dist/client/assets/AdminUsers-5cAOkdRO.js +1 -0
- package/dist/client/assets/CitationLibraryDialog-G2kKkA2f.js +1 -0
- package/dist/client/assets/Dashboard-BJDFbzQa.js +5 -0
- package/dist/client/assets/GitDialog-BEtLh2S_.js +3 -0
- package/dist/client/assets/GitHubAccountDialog-D2kdCzOs.js +1 -0
- package/dist/client/assets/{HistoryDialog-DWYErBwj.js → HistoryDialog-BwxDdj-j.js} +3 -3
- package/dist/client/assets/LatexEditor-sMjmvA6V.js +141 -0
- package/dist/client/assets/{PdfPreview-BjghzUb1.js → PdfPreview-z5KnowpL.js} +1 -1
- package/dist/client/assets/ProjectIconPickerDialog-DNV7M7vH.js +1 -0
- package/dist/client/assets/ProjectSettings-Mf8zDGRu.js +1 -0
- package/dist/client/assets/ProjectWorkspace-BJFxjMCn.js +32 -0
- package/dist/client/assets/QuickOpenDialog-C758pouQ.js +1 -0
- package/dist/client/assets/{SelectionHistoryDialog-CR5c3I8k.js → SelectionHistoryDialog-p8L2n4RS.js} +2 -2
- package/dist/client/assets/SystemMetricsDialog-DDiSuglF.js +1 -0
- package/dist/client/assets/TagManagementDialog-BTVERmQS.js +1 -0
- package/dist/client/assets/WordCountDialog-B6RvAI6V.js +1 -0
- package/dist/client/assets/check-Hlb-tLSh.js +1 -0
- package/dist/client/assets/chevron-up-D0psXvTv.js +1 -0
- package/dist/client/assets/chktex-ZnIx425m.js +3 -0
- package/dist/client/assets/clock-3-C71NmJZI.js +1 -0
- package/dist/client/assets/{editor-CLY5CgkY.js → editor-_i6aPXT4.js} +1 -1
- package/dist/client/assets/eye-swovgNYS.js +1 -0
- package/dist/client/assets/github-y6i0qxSV.js +1 -0
- package/dist/client/assets/{hard-drive-Ctj3K_zx.js → hard-drive-BqcHPdoY.js} +1 -1
- package/dist/client/assets/index-7WrjzKvC.js +5 -0
- package/dist/client/assets/index-C5T8_lAl.js +1 -0
- package/dist/client/assets/index-DF5cor0N.js +10 -0
- package/dist/client/assets/index-Do5FsFqg.js +1 -0
- package/dist/client/assets/index-Y-wXUwwe.css +1 -0
- package/dist/client/assets/{minimize-2-BiVyoWZA.js → minimize-2-CK7jUy7-.js} +1 -1
- package/dist/client/assets/{minus-Bl8l4LXq.js → minus-B2sswwWT.js} +1 -1
- package/dist/client/assets/{plus-CCxK-HNt.js → plus-Co7iyp5m.js} +1 -1
- package/dist/client/assets/{refresh-cw-BE8IbaHI.js → refresh-cw-BHVcjInn.js} +1 -1
- package/dist/client/assets/{search-CPbhRWQE.js → search-Tpi6WAga.js} +1 -1
- package/dist/client/assets/{sigma-LxGD9tK2.js → sigma-DoHJQYf7.js} +1 -1
- package/dist/client/assets/spellCheck-BSbFJY9f.js +1 -0
- package/dist/client/assets/{tags-DuN89PsZ.js → tags-BHDlIcSb.js} +1 -1
- package/dist/client/assets/{type-BiettCiY.js → type-C-6Jq_0r.js} +1 -1
- package/dist/client/index.html +15 -3
- package/dist/server/app.js +6 -1
- package/dist/server/cgroups.js +35 -0
- package/dist/server/compilerVersions.js +46 -0
- package/dist/server/config.js +8 -0
- package/dist/server/cpuMetrics.js +122 -0
- package/dist/server/db.js +13 -0
- package/dist/server/environment.js +11 -0
- package/dist/server/i18n.js +0 -2
- package/dist/server/resourceMetrics.js +214 -0
- package/dist/server/routes/projectFiles.js +1 -59
- package/dist/server/routes/system.js +32 -1
- package/dist/server/systemMemory.js +51 -0
- package/dist/server/updates.js +116 -0
- package/dist/shared/compilerVersions.js +11 -0
- package/dist/shared/resourceMetrics.js +1 -0
- package/dist/shared/updates.js +5 -0
- package/package.json +3 -1
- package/texlite.config.example.json +3 -0
- package/dist/client/assets/AdminUsers-Dyapv-3c.js +0 -1
- package/dist/client/assets/CitationLibraryDialog-CU7Q7r0Z.js +0 -1
- package/dist/client/assets/Dashboard-DsdhFENx.js +0 -2
- package/dist/client/assets/GitDialog-CZpnKw-J.js +0 -3
- package/dist/client/assets/GitHubAccountDialog-CZ8O_PjD.js +0 -1
- package/dist/client/assets/LatexEditor-CssVgypt.js +0 -141
- package/dist/client/assets/ProjectIconPickerDialog-CqRmgFBM.js +0 -1
- package/dist/client/assets/ProjectNavigationDialogs-BZxI3PJO.js +0 -1
- package/dist/client/assets/ProjectSettings-CZE_xDKn.js +0 -1
- package/dist/client/assets/ProjectWorkspace-CAX3qEYr.js +0 -32
- package/dist/client/assets/SystemMetricsDialog-DDpFwgXh.js +0 -1
- package/dist/client/assets/TagManagementDialog-CXLA9h_j.js +0 -1
- package/dist/client/assets/WordCountDialog-DUyR24vv.js +0 -1
- package/dist/client/assets/check-CwBYzomT.js +0 -1
- package/dist/client/assets/chevron-up-D5lCNKlk.js +0 -1
- package/dist/client/assets/chktex-CRkLYKcV.js +0 -3
- package/dist/client/assets/external-link-C9Td1CCj.js +0 -1
- package/dist/client/assets/github-D-JDXb-w.js +0 -1
- package/dist/client/assets/index-9hnQ8Q9x.js +0 -5
- package/dist/client/assets/index-C0qg2Ylw.css +0 -1
- package/dist/client/assets/index-DkpU9Fgs.js +0 -10
- package/dist/client/assets/index-_eYe7K9T.js +0 -1
- package/dist/client/assets/spellCheck-hpm8qZTr.js +0 -1
- package/dist/client/assets/x-C_3swJOC.js +0 -1
- package/dist/server/projectSearch.js +0 -113
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{u as g,r as a,j as s}from"./react-CltQJflK.js";import{M as j}from"./index-DF5cor0N.js";import{S as k}from"./search-Tpi6WAga.js";import{h as w}from"./index-C5T8_lAl.js";import{C as v}from"./check-Hlb-tLSh.js";function q({open:i,files:p,onOpenChange:n,onOpenFile:f}){const{t:c}=g(),[l,h]=a.useState(""),[o,r]=a.useState(0),d=a.useRef(null),m=a.useRef(null),u=a.useMemo(()=>p.filter(e=>e.type==="file").map(e=>({entry:e,score:y(e.path,l)})).filter(e=>e.score>=0).sort((e,t)=>t.score-e.score||e.entry.path.localeCompare(t.entry.path)).slice(0,100),[p,l]);a.useEffect(()=>{i&&(h(""),r(0),window.setTimeout(()=>d.current?.focus(),0))},[i]),a.useEffect(()=>r(e=>Math.min(e,Math.max(0,u.length-1))),[u.length]),a.useEffect(()=>{i&&m.current?.scrollIntoView({block:"nearest"})},[i,o]);const x=e=>{f(e),n(!1)};return s.jsx(j,{open:i,wide:!0,title:c("navigation.quickOpen"),description:c("navigation.quickOpenDescription"),onOpenChange:n,children:s.jsxs("div",{className:"quick-open-dialog",children:[s.jsxs("label",{children:[s.jsx(k,{size:16}),s.jsx("input",{ref:d,value:l,placeholder:c("navigation.filePlaceholder"),onChange:e=>{h(e.target.value),r(0)},onKeyDown:e=>{e.key==="ArrowDown"&&(e.preventDefault(),r(t=>Math.min(u.length-1,t+1))),e.key==="ArrowUp"&&(e.preventDefault(),r(t=>Math.max(0,t-1))),e.key==="Enter"&&u[o]&&(e.preventDefault(),x(u[o].entry.path))}})]}),s.jsxs("div",{className:"quick-open-results",children:[u.map(({entry:e},t)=>s.jsxs("button",{ref:t===o?m:void 0,className:t===o?"active":"",onMouseEnter:()=>r(t),onClick:()=>x(e.path),children:[s.jsx(w,{size:14}),s.jsx("span",{children:e.path}),t===o&&s.jsx(v,{size:13})]},e.path)),u.length===0&&s.jsx("p",{className:"muted padded",children:c("navigation.noFiles")})]})]})})}function y(i,p){const n=i.toLocaleLowerCase(),f=p.trim().toLocaleLowerCase();if(!f)return 1;const c=n.indexOf(f);if(c>=0)return 1e4-c-n.length;let l=0,h=0;for(const o of f){const r=n.indexOf(o,l);if(r<0)return-1;h+=r===l?5:1,l=r+1}return h-n.length/100}export{q as QuickOpenDialog};
|
package/dist/client/assets/{SelectionHistoryDialog-CR5c3I8k.js → SelectionHistoryDialog-p8L2n4RS.js}
RENAMED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{u as oe,r as a,j as t}from"./react-CltQJflK.js";import{c as re,
|
|
1
|
+
import{u as oe,r as a,j as t}from"./react-CltQJflK.js";import{c as re,a as B,M as ae,C as le,L as ce}from"./index-DF5cor0N.js";import{d as de}from"./index-7WrjzKvC.js";import{D as ue}from"./ProjectWorkspace-BJFxjMCn.js";import{C as fe}from"./clock-3-C71NmJZI.js";import"./index-C5T8_lAl.js";import"./check-Hlb-tLSh.js";import"./index-Do5FsFqg.js";import"./chevron-up-D0psXvTv.js";import"./refresh-cw-BHVcjInn.js";const he=re("UserRound",[["circle",{cx:"12",cy:"8",r:"5",key:"1hypcn"}],["path",{d:"M20 21a8 8 0 0 0-16 0",key:"rfgkzh"}]]),O=96,R=48;function me(e,s){const o=e.replace(/\r\n/g,`
|
|
2
2
|
`),r=s.replace(/\r\n/g,`
|
|
3
|
-
`);if(o===r)return{previous:[],current:[],additions:0,deletions:0,hasChanges:!1};const d=new de,p=d.diff_main(o,r,!1);d.diff_cleanupSemantic(p);const n=[],g=[];let f=0,c=0;for(let h=0;h<p.length;h+=1){const[y,u]=p[h];if(u)if(y===0){const v=pe(u,h,p.length);E(n,v),E(g,v)}else y<0?(c+=u.length,E(n,{kind:"deletion",text:u})):(f+=u.length,E(g,{kind:"addition",text:u}))}return{previous:n,current:g,additions:f,deletions:c,hasChanges:f>0||c>0}}function pe(e,s,o){const r=s===0,d=s===o-1;return(r||d)&&e.length<=O?{kind:"equal",text:e}:!r&&!d&&e.length<=R*2?{kind:"equal",text:e}:r?{kind:"omitted",text:`…${I(e,O)}`}:d?{kind:"omitted",text:`${q(e,O)}…`}:{kind:"omitted",text:`${q(e,R)}…${I(e,R)}`}}function q(e,s){if(e.length<=s)return e;const o=ye(e,s);return e.slice(0,o)}function I(e,s){if(e.length<=s)return e;const o=ge(e,e.length-s);return e.slice(o)}function ye(e,s){const o=Math.min(e.length,s+24);for(let r=s;r<o;r+=1)if(J(e[r]))return r+1;return s}function ge(e,s){const o=Math.max(0,s-24);for(let r=s;r>o;r-=1)if(J(e[r-1]))return r;return s}function J(e){return/\s|[.,;:!?)}\]]/.test(e)}function E(e,s){const o=e.at(-1);o?.kind===s.kind?o.text+=s.text:e.push({...s})}function De({open:e,project:s,filePath:o,selection:r,currentSource:d,onOpenChange:p}){const{t:n,i18n:g}=oe(),[{filePath:f,selection:c,source:h}]=a.useState(()=>({filePath:o,selection:r,source:d})),[y,u]=a.useState([]),[v,k]=a.useState(null),[K,T]=a.useState(!1),[Q,$]=a.useState(!0),[U,w]=a.useState(!1),[D,C]=a.useState(""),[b,P]=a.useState(null),[W,L]=a.useState(!1),[H,z]=a.useState(!1),[Y,M]=a.useState(""),[Z,ee]=a.useState(0);a.useEffect(()=>{if(P(null),!e||s.permission!=="owner")return;const i=new AbortController;return B(`/api/projects/${s.id}/edit-history/stats`,{signal:i.signal}).then(m=>{i.signal.aborted||P(m)}).catch(m=>{!i.signal.aborted&&!G(m)&&C(_(m))}),()=>i.abort()},[e,s.id,s.permission,Z]);const te=async()=>{if(!H){z(!0),M("");try{await B(`/api/projects/${s.id}/edit-history`,{method:"DELETE"}),u([]),k(null),T(!1),$(!0),ee(i=>i+1),L(!1)}catch(i){M(_(i))}finally{z(!1)}}},[se,A]=a.useState({}),N=Math.max(0,c.endOffset-c.startOffset);a.useEffect(()=>{if(!e||!f||N<=0)return;const i=new AbortController;if(w(!0),C(""),u([]),$(!0),A({}),k(null),T(!1),h.slice(c.startOffset,c.endOffset)!==c.selectedText){C(n("selectionHistory.sourceChanged")),w(!1);return}const m=new URLSearchParams({path:f,start:String(c.startOffset),end:String(c.endOffset),sourceHash:
|
|
3
|
+
`);if(o===r)return{previous:[],current:[],additions:0,deletions:0,hasChanges:!1};const d=new de,p=d.diff_main(o,r,!1);d.diff_cleanupSemantic(p);const n=[],g=[];let f=0,c=0;for(let h=0;h<p.length;h+=1){const[y,u]=p[h];if(u)if(y===0){const v=pe(u,h,p.length);E(n,v),E(g,v)}else y<0?(c+=u.length,E(n,{kind:"deletion",text:u})):(f+=u.length,E(g,{kind:"addition",text:u}))}return{previous:n,current:g,additions:f,deletions:c,hasChanges:f>0||c>0}}function pe(e,s,o){const r=s===0,d=s===o-1;return(r||d)&&e.length<=O?{kind:"equal",text:e}:!r&&!d&&e.length<=R*2?{kind:"equal",text:e}:r?{kind:"omitted",text:`…${I(e,O)}`}:d?{kind:"omitted",text:`${q(e,O)}…`}:{kind:"omitted",text:`${q(e,R)}…${I(e,R)}`}}function q(e,s){if(e.length<=s)return e;const o=ye(e,s);return e.slice(0,o)}function I(e,s){if(e.length<=s)return e;const o=ge(e,e.length-s);return e.slice(o)}function ye(e,s){const o=Math.min(e.length,s+24);for(let r=s;r<o;r+=1)if(J(e[r]))return r+1;return s}function ge(e,s){const o=Math.max(0,s-24);for(let r=s;r>o;r-=1)if(J(e[r-1]))return r;return s}function J(e){return/\s|[.,;:!?)}\]]/.test(e)}function E(e,s){const o=e.at(-1);o?.kind===s.kind?o.text+=s.text:e.push({...s})}function De({open:e,project:s,filePath:o,selection:r,currentSource:d,onOpenChange:p}){const{t:n,i18n:g}=oe(),[{filePath:f,selection:c,source:h}]=a.useState(()=>({filePath:o,selection:r,source:d})),[y,u]=a.useState([]),[v,k]=a.useState(null),[K,T]=a.useState(!1),[Q,$]=a.useState(!0),[U,w]=a.useState(!1),[D,C]=a.useState(""),[b,P]=a.useState(null),[W,L]=a.useState(!1),[H,z]=a.useState(!1),[Y,M]=a.useState(""),[Z,ee]=a.useState(0);a.useEffect(()=>{if(P(null),!e||s.permission!=="owner")return;const i=new AbortController;return B(`/api/projects/${s.id}/edit-history/stats`,{signal:i.signal}).then(m=>{i.signal.aborted||P(m)}).catch(m=>{!i.signal.aborted&&!G(m)&&C(_(m))}),()=>i.abort()},[e,s.id,s.permission,Z]);const te=async()=>{if(!H){z(!0),M("");try{await B(`/api/projects/${s.id}/edit-history`,{method:"DELETE"}),u([]),k(null),T(!1),$(!0),ee(i=>i+1),L(!1)}catch(i){M(_(i))}finally{z(!1)}}},[se,A]=a.useState({}),N=Math.max(0,c.endOffset-c.startOffset);a.useEffect(()=>{if(!e||!f||N<=0)return;const i=new AbortController;if(w(!0),C(""),u([]),$(!0),A({}),k(null),T(!1),h.slice(c.startOffset,c.endOffset)!==c.selectedText){C(n("selectionHistory.sourceChanged")),w(!1);return}const m=new URLSearchParams({path:f,start:String(c.startOffset),end:String(c.endOffset),sourceHash:ue(h)});return B(`/api/projects/${s.id}/edit-history?${m}`,{signal:i.signal}).then(l=>{u(l.entries),$(l.chainComplete),k(l.baseline),T(l.hasMore)}).catch(l=>{G(l)||C(_(l))}).finally(()=>{i.signal.aborted||w(!1)}),()=>i.abort()},[e,s.id,f,c,N,h,n]);const ne=a.useMemo(()=>n("selectionHistory.description",{path:f,count:N}),[n,f,N]);return t.jsx(ae,{open:e,wide:!0,draggable:!0,className:"selection-history-modal",title:n("selectionHistory.title"),description:ne,onOpenChange:p,footer:t.jsx("button",{onClick:()=>p(!1),children:n("common.close")}),children:t.jsxs("div",{className:"selection-history-dialog",children:[s.permission==="owner"&&b&&t.jsxs("div",{className:"history-stats",children:[t.jsx("strong",{children:n("selectionHistory.storageUsage",{used:(b.payloadBytes/1048576).toFixed(2),limit:(b.maxStorageBytes/1048576).toFixed(0),count:b.segmentCount})}),t.jsx("small",{children:n("selectionHistory.storageDescription")}),t.jsx("button",{type:"button",className:"danger-text",disabled:U||H||b.segmentCount===0,onClick:()=>{M(""),L(!0)},children:n("selectionHistory.clearAll")})]}),t.jsx(le,{open:W,title:n("selectionHistory.clearAll"),description:n("selectionHistory.clearDescription"),confirmLabel:n("common.delete"),danger:!0,busy:H,error:Y,onConfirm:()=>{te()},onCancel:()=>{H||L(!1)}}),D&&t.jsx("p",{className:"error selection-history-message",children:D}),U?t.jsxs("div",{className:"selection-history-loading",children:[t.jsx(ce,{className:"spin",size:22}),n("common.loading")]}):t.jsxs(t.Fragment,{children:[!Q&&t.jsx("p",{className:"selection-history-boundary",children:n("selectionHistory.boundary")}),K&&t.jsx("p",{className:"selection-history-boundary",children:n("selectionHistory.limited",{count:y.length})}),y.length===0&&!D?t.jsxs("div",{className:"selection-history-empty",children:[t.jsx(fe,{size:28}),t.jsx("strong",{children:n("selectionHistory.emptyTitle")}),t.jsx("span",{children:n("selectionHistory.emptyDescription")})]}):t.jsx("ol",{className:"selection-history-list",children:y.map((i,m)=>{const l=se[i.id]||"content",j=y[m+1]||v,F=!!(j&&i.content!==null&&j.content!==null&&!i.contentTruncated&&!j.contentTruncated),S=l==="diff"&&F?me(j.content,i.content):null,V=j?F?S&&!S.hasChanges?n("selectionHistory.noDiff"):null:n("selectionHistory.diffUnavailable"):n("selectionHistory.noPrevious");return t.jsx("li",{children:t.jsxs("article",{className:"selection-history-entry",children:[t.jsxs("header",{children:[t.jsx("time",{title:new Date(i.updatedAt).toLocaleString(g.resolvedLanguage),children:je(i.updatedAt,g.resolvedLanguage)}),t.jsxs("span",{className:"selection-history-authors",children:[t.jsx(he,{size:14}),t.jsx("span",{children:n("selectionHistory.changedBy")}),t.jsx("span",{className:"selection-history-author-list",children:i.authors.map((x,ie)=>t.jsx("span",{children:xe(x,n("editor.deletedUser"))},x.id||`deleted-${ie}`))})]})]}),t.jsxs("div",{className:"selection-history-tabs",role:"tablist","aria-label":n("selectionHistory.view"),children:[t.jsx("button",{type:"button",className:l==="content"?"active":"",role:"tab","aria-selected":l==="content","aria-controls":`selection-history-content-${i.id}`,onClick:()=>A(x=>({...x,[i.id]:"content"})),children:n("selectionHistory.contentTab")}),t.jsx("button",{type:"button",className:l==="diff"?"active":"",role:"tab","aria-selected":l==="diff","aria-controls":`selection-history-diff-${i.id}`,onClick:()=>A(x=>({...x,[i.id]:"diff"})),children:n("selectionHistory.diffTab")})]}),l==="content"?t.jsxs("div",{className:"selection-history-content",id:`selection-history-content-${i.id}`,role:"tabpanel",children:[i.content===null?t.jsx("p",{className:"selection-history-content-unavailable",children:n("selectionHistory.contentUnavailable")}):t.jsx("pre",{children:i.content||"∅"}),i.contentTruncated&&t.jsx("small",{children:n("selectionHistory.contentTruncated")})]}):t.jsx("div",{className:"selection-history-content",id:`selection-history-diff-${i.id}`,role:"tabpanel",children:V?t.jsx("p",{className:"selection-history-content-unavailable",children:V}):S&&t.jsx(be,{diff:S,previousLabel:n("selectionHistory.previousVersion"),currentLabel:n("selectionHistory.currentVersion")})})]})},i.id)})})]})]})})}function xe(e,s){return!e.name&&!e.username?s:e.name&&e.username?`${e.name} (@${e.username})`:e.name||`@${e.username}`}function be({diff:e,previousLabel:s,currentLabel:o}){return t.jsxs("div",{className:"selection-history-semantic-diff",children:[t.jsx(X,{label:s,pieces:e.previous,variant:"previous"}),t.jsx(X,{label:o,pieces:e.current,variant:"current"})]})}function X({label:e,pieces:s,variant:o}){return t.jsxs("section",{className:`selection-history-diff-side ${o}`,children:[t.jsx("header",{children:e}),t.jsx("pre",{children:s.length?s.map((r,d)=>t.jsx("span",{className:r.kind,children:r.text},`${d}-${r.kind}`)):"∅"})]})}function je(e,s){const o=new Date(e);return Number.isNaN(o.getTime())?e:o.toLocaleString(s,{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit"})}function G(e){return e instanceof Error&&e.name==="AbortError"}function _(e){return e instanceof Error?e.message:String(e)}export{De as SelectionHistoryDialog};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{u as k,r as u,j as e}from"./react-CltQJflK.js";import{c as M,a as N,M as $}from"./index-DF5cor0N.js";import{C as w,A as g}from"./Dashboard-BJDFbzQa.js";import{C as L}from"./clock-3-C71NmJZI.js";import{U as C}from"./index-C5T8_lAl.js";import{R as S}from"./refresh-cw-BHVcjInn.js";import"./github-y6i0qxSV.js";import"./hard-drive-BqcHPdoY.js";import"./sigma-DoHJQYf7.js";import"./tags-BHDlIcSb.js";const z=M("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);const D=M("Layers",[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]]);const P=M("MemoryStick",[["path",{d:"M6 19v-3",key:"1nvgqn"}],["path",{d:"M10 19v-3",key:"iu8nkm"}],["path",{d:"M14 19v-3",key:"kcehxu"}],["path",{d:"M18 19v-3",key:"1vh91z"}],["path",{d:"M8 11V9",key:"63erz4"}],["path",{d:"M16 11V9",key:"fru6f3"}],["path",{d:"M12 11V9",key:"ha00sb"}],["path",{d:"M2 15h20",key:"16ne18"}],["path",{d:"M2 7a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v1.1a2 2 0 0 0 0 3.837V17a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-5.1a2 2 0 0 0 0-3.837Z",key:"lhddv3"}]]);const A=M("Timer",[["line",{x1:"10",x2:"14",y1:"2",y2:"2",key:"14vaq8"}],["line",{x1:"12",x2:"15",y1:"14",y2:"11",key:"17fdiu"}],["circle",{cx:"12",cy:"14",r:"8",key:"1e1u0o"}]]);function J({open:r,onOpenChange:i}){const{t,i18n:l}=k(),[s,x]=u.useState(null),[c,v]=u.useState(!1),[p,y]=u.useState(""),[n,j]=u.useState(null),o=u.useRef(!1),d=u.useCallback(async()=>{if(!o.current){o.current=!0,v(!0);try{x(await N("/api/health/metrics")),j(new Date),y("")}catch(a){y(a instanceof Error?a.message:t("errors.generic"))}finally{o.current=!1,v(!1)}}},[t]);return u.useEffect(()=>{if(!r)return;d();const a=window.setInterval(()=>{d()},5e3);return()=>window.clearInterval(a)},[r,d]),e.jsxs($,{open:r,onOpenChange:i,extraWide:!0,className:"system-metrics-dialog",title:t("metrics.title"),description:t("metrics.description"),footer:e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"metric-refresh-status",children:n?t("metrics.updatedAt",{time:n.toLocaleTimeString(l.resolvedLanguage,{hour:"2-digit",minute:"2-digit",second:"2-digit"})}):t("metrics.autoRefresh")}),e.jsxs("button",{onClick:()=>{d()},disabled:c,children:[e.jsx(S,{"aria-hidden":"true",size:14,className:c?"spin":""}),t("metrics.refresh")]})]}),children:[p&&e.jsx("p",{className:"error",children:p}),!s&&!p&&e.jsx("p",{className:"muted",children:t("common.loading")}),s&&e.jsxs("div",{className:"system-metrics",children:[e.jsxs("div",{className:"metric-resource-panels",children:[e.jsxs("section",{className:"metric-section",children:[e.jsxs("h3",{children:[e.jsx(P,{"aria-hidden":"true",size:16}),t(s.systemMemory.scope==="container"?"metrics.containerMemory":"metrics.hostMemory")]}),e.jsx(B,{metrics:s}),e.jsx("p",{className:"muted metric-memory-note",children:t("metrics.memoryNote")})]}),e.jsxs("section",{className:"metric-section",children:[e.jsxs("h3",{children:[e.jsx(w,{"aria-hidden":"true",size:16}),t(s.cpu.scope==="container"?"metrics.containerCpu":"metrics.hostCpu")]}),e.jsx(I,{cpu:s.cpu}),e.jsx("p",{className:"muted metric-memory-note",children:t("metrics.cpuNote")})]})]}),e.jsxs("div",{className:"metric-runtime",children:[e.jsx(f,{icon:L,label:t("metrics.uptime"),value:E(s.uptimeSeconds)}),e.jsx(f,{icon:D,label:t("metrics.compileQueue"),value:`${s.compileQueue.running} / ${s.compileQueue.concurrency}`,detail:t("metrics.pending",{count:s.compileQueue.pending})}),e.jsx(f,{icon:C,label:t("metrics.collaboration"),value:t("metrics.sessions",{count:s.collaboration.sessions}),detail:t("metrics.roomsAndDirty",{rooms:s.collaboration.rooms,dirty:s.collaboration.dirtyFiles})})]}),e.jsxs("section",{className:"metric-section metric-latency",children:[e.jsxs("h3",{children:[e.jsx(g,{"aria-hidden":"true",size:16}),t("metrics.eventLoop")]}),e.jsxs("dl",{"aria-label":t("metrics.latencySummary",s.eventLoopDelay),children:[e.jsxs("div",{children:[e.jsx("dt",{children:"P50"}),e.jsx("dd",{children:h(s.eventLoopDelay.p50Ms)})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"P95"}),e.jsx("dd",{children:h(s.eventLoopDelay.p95Ms)})]}),e.jsxs("div",{children:[e.jsx("dt",{children:t("metrics.max")}),e.jsx("dd",{children:h(s.eventLoopDelay.maxMs)})]})]})]}),e.jsxs("section",{className:"metric-section",children:[e.jsxs("h3",{children:[e.jsx(A,{"aria-hidden":"true",size:16}),t("metrics.operationDurations")]}),Object.keys(s.durationsMs).length===0?e.jsx("p",{className:"metric-empty",children:t("metrics.noSamples")}):e.jsx("div",{className:"metric-table-wrap",children:e.jsxs("table",{className:"metric-table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:t("metrics.operation")}),e.jsx("th",{children:t("metrics.samples")}),e.jsx("th",{children:t("metrics.last")}),e.jsx("th",{children:"P50"}),e.jsx("th",{children:"P95"}),e.jsx("th",{children:t("metrics.max")})]})}),e.jsx("tbody",{children:Object.entries(s.durationsMs).sort(([a],[m])=>a.localeCompare(m)).map(([a,m])=>e.jsxs("tr",{children:[e.jsx("td",{children:T(a,t)}),e.jsx("td",{children:m.count}),e.jsx("td",{children:h(m.last)}),e.jsx("td",{children:h(m.p50)}),e.jsx("td",{children:h(m.p95)}),e.jsx("td",{children:h(m.max)})]},a))})]})})]})]})]})}function B({metrics:r}){const{t:i}=k(),{usedBytes:t,totalBytes:l,scope:s}=r.systemMemory,x=r.memory.rssBytes,c=r.texMemory.rssBytes,v=t!==null&&c!==null?Math.max(0,t-x-c):null,p=t!==null&&l!==null?Math.max(0,l-t):null,y=l??t,n=x+(c??0),j=t!==null&&n>t&&n>0?t/n:1,o=[{key:"service",bytes:x,plotted:x*j,label:i("metrics.serviceMemory")},{key:"tex",bytes:c,plotted:(c??0)*j,label:i("metrics.texMemory")},{key:"other",bytes:v,plotted:t===null?0:Math.max(0,t-n*j),label:i("metrics.otherMemory")},...l===null?[]:[{key:"free",bytes:p,plotted:p??0,label:i("metrics.freeMemory")}]].map(a=>({...a,tooltip:`${a.label}: ${a.bytes===null?i("metrics.unavailable"):b(a.bytes)}`})),d=o.map(a=>a.tooltip).join(" · ");return e.jsxs("div",{className:"metric-resource-overview",children:[e.jsxs("div",{className:"metric-resource-heading",children:[e.jsxs("div",{children:[e.jsx("strong",{children:e.jsx(R,{bytes:t,unavailable:i("metrics.unavailable")})}),t!==null&&e.jsx("span",{children:i("metrics.usedMemory")})]}),e.jsx("span",{children:l===null?i("metrics.noReportedLimit"):i(s==="container"?"metrics.memoryLimit":"metrics.memoryCapacity",{total:b(l)})})]}),t!==null&&y!==null&&y>0&&e.jsx("div",{className:"metric-resource-bar",role:"img",tabIndex:0,"aria-label":d,"data-tooltip":d,"data-texlite-tooltip-always":!0,children:o.map(a=>e.jsx("span",{className:`resource-segment-${a.key}`,style:{width:`${Math.max(0,Math.min(100,a.plotted/y*100))}%`},"data-tooltip":a.tooltip,"data-texlite-tooltip-always":!0,"aria-hidden":"true"},a.key))}),e.jsx("dl",{className:"metric-resource-legend",children:o.filter(a=>a.key==="service"||a.key==="tex").map(a=>e.jsxs("div",{children:[e.jsxs("dt",{children:[e.jsx("span",{className:`metric-resource-dot resource-segment-${a.key}`,"aria-hidden":"true"}),a.label]}),e.jsx("dd",{children:a.bytes===null?i("metrics.unavailable"):b(a.bytes)})]},a.key))})]})}function I({cpu:r}){const{t:i}=k(),t=[{key:"service",value:r.texlitePercent,label:i("metrics.texliteCpu")},{key:"other",value:r.otherPercent,label:i("metrics.otherMemory")},{key:"free",value:r.idlePercent,label:i("metrics.cpuIdle")}].map(s=>({...s,tooltip:`${s.label}: ${s.value===null?"—":`${s.value}%`}`})),l=r.status==="ready"?t.map(s=>s.tooltip).join(" · "):i(r.status==="warming"?"metrics.cpuSampling":"metrics.unavailable");return e.jsxs("div",{className:"metric-resource-overview",children:[e.jsxs("div",{className:"metric-resource-heading",children:[e.jsx("div",{children:r.status==="ready"&&r.idlePercent!==null?e.jsxs(e.Fragment,{children:[e.jsxs("strong",{children:[Math.round((100-r.idlePercent)*10)/10,e.jsx("span",{className:"metric-value-unit",children:"%"})]}),e.jsx("span",{children:i("metrics.usedMemory")})]}):e.jsx("span",{className:"metric-unavailable",children:i(r.status==="warming"?"metrics.cpuSampling":"metrics.unavailable")})}),e.jsx("span",{children:i("metrics.cpuCapacity")})]}),e.jsx("div",{className:"metric-resource-bar",role:"img",tabIndex:0,"aria-label":l,"data-tooltip":l,"data-texlite-tooltip-always":!0,children:r.status==="ready"&&t.map(s=>e.jsx("span",{className:`resource-segment-${s.key}`,style:{width:`${s.value??0}%`},"data-tooltip":s.tooltip,"data-texlite-tooltip-always":!0,"aria-hidden":"true"},s.key))}),e.jsx("dl",{className:"metric-resource-legend",children:t.filter(s=>s.key!=="free").map(s=>e.jsxs("div",{children:[e.jsxs("dt",{children:[e.jsx("span",{className:`metric-resource-dot resource-segment-${s.key}`,"aria-hidden":"true"}),s.label]}),e.jsx("dd",{children:s.value===null?"—":`${s.value}%`})]},s.key))})]})}function R({bytes:r,unavailable:i}){if(r===null)return e.jsx("span",{className:"metric-unavailable",children:i});const[t,l]=b(r).split(" ");return e.jsxs(e.Fragment,{children:[t,e.jsx("span",{className:"metric-value-unit",children:l})]})}function f({icon:r,label:i,value:t,detail:l}){return e.jsxs("div",{className:"metric-runtime-item",children:[e.jsxs("span",{className:"metric-runtime-label",children:[e.jsx(r,{"aria-hidden":"true",size:14}),i,l&&e.jsx("button",{type:"button",className:"metric-runtime-detail","data-tooltip":l,"aria-label":`${i}: ${l}`,"data-texlite-tooltip-always":!0,children:e.jsx(z,{"aria-hidden":"true",size:13})})]}),e.jsx("strong",{children:t})]})}function b(r){const i=r>=1073741824?"GB":"MB";return`${Math.round(r/1024**(i==="GB"?3:2)*10)/10} ${i}`}function E(r){const i=Math.floor(r/86400),t=Math.floor(r%86400/3600),l=Math.floor(r%3600/60);return i?`${i} d ${t} h`:t?`${t} h ${l} m`:`${l} m`}function h(r){return r>=1e3?`${Math.round(r/100)/10} s`:`${Math.round(r*10)/10} ms`}function T(r,i){return i(`metrics.operations.${r}`,{defaultValue:r})}export{J as SystemMetricsDialog};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{u as W,r as s,j as a}from"./react-CltQJflK.js";import{a as f,e as b,M as Y,L as E,C as Z}from"./index-DF5cor0N.js";import{P as _}from"./plus-Co7iyp5m.js";import{i as ee,T as ae,X as te}from"./index-C5T8_lAl.js";import{C as ne}from"./check-Hlb-tLSh.js";const H=["red","orange","yellow","green","blue","purple","gray"];function S(l){return[...l].sort((C,y)=>C.name.localeCompare(y.name))}function se(l){return l instanceof Error&&l.name==="AbortError"}function de({open:l,onOpenChange:C,onTagCreated:y,onTagUpdated:R,onTagDeleted:X}){const{t}=W(),[T,h]=s.useState([]),[G,w]=s.useState(!1),[D,i]=s.useState(""),[p,k]=s.useState(""),[z,L]=s.useState("blue"),[d,$]=s.useState(!1),[I,m]=s.useState(null),[j,M]=s.useState(""),[P,A]=s.useState("blue"),[N,O]=s.useState(null),[o,v]=s.useState(null),[Q,g]=s.useState(""),[u,q]=s.useState(!1);s.useEffect(()=>{if(!l)return;const e=new AbortController;return w(!0),i(""),f("/api/tags/management",{signal:e.signal}).then(n=>h(S(n.tags))).catch(n=>{se(n)||i(b(n))}).finally(()=>{e.signal.aborted||w(!1)}),()=>e.abort()},[l]);const F=async()=>{if(!(!p.trim()||d)){$(!0),i("");try{const e=await f("/api/tags",{method:"POST",body:JSON.stringify({name:p,color:z})});h(n=>S([...n,{...e.tag,projectCount:0}])),y(e.tag),k(""),L("blue")}catch(e){i(b(e))}finally{$(!1)}}},U=e=>{m(e.id),M(e.name),A(e.color),i("")},J=async e=>{if(!(!j.trim()||N)){O(e.id),i("");try{const n=await f(`/api/tags/${e.id}`,{method:"PATCH",body:JSON.stringify({name:j,color:P})}),c={...n.tag,projectCount:e.projectCount};h(r=>S(r.map(B=>B.id===e.id?c:B))),R(n.tag),m(null)}catch(n){i(b(n))}finally{O(null)}}},V=async()=>{if(!(!o||u)){q(!0),g("");try{await f(`/api/tags/${o.id}`,{method:"DELETE"}),h(e=>e.filter(n=>n.id!==o.id)),X(o.id),v(null),I===o.id&&m(null)}catch(e){g(b(e))}finally{q(!1)}}},x=d||N!==null||u,K=e=>{!e&&x||(e||(i(""),g(""),m(null)),C(e))};return a.jsxs(a.Fragment,{children:[a.jsx(Y,{open:l,title:t("tags.manage"),description:t("tags.manageDescription"),wide:!0,className:"tag-management-modal",onOpenChange:K,footer:a.jsx("button",{onClick:()=>K(!1),disabled:x,children:t("common.close")}),children:a.jsxs("div",{className:"tag-management",children:[D&&a.jsx("p",{className:"error dialog-error",role:"alert",children:D}),a.jsxs("div",{className:"tag-management-create",children:[a.jsxs("label",{className:"tag-management-field",children:[a.jsx("span",{children:t("tags.name")}),a.jsx("input",{autoFocus:!0,value:p,maxLength:32,placeholder:t("tags.name"),onChange:e=>{k(e.target.value),i("")},onKeyDown:e=>{e.key==="Enter"&&(e.preventDefault(),F())}})]}),a.jsxs("label",{className:"tag-management-field tag-management-color",children:[a.jsx("span",{children:t("tags.color")}),a.jsx("select",{value:z,onChange:e=>L(e.target.value),children:H.map(e=>a.jsx("option",{value:e,children:t(`tags.${e}`)},e))})]}),a.jsxs("button",{type:"button",className:"primary",disabled:!p.trim()||d,"aria-busy":d,onClick:()=>{F()},children:[d?a.jsx(E,{className:"spin",size:14}):a.jsx(_,{"aria-hidden":!0,size:14}),t("tags.createInManager")]})]}),G?a.jsxs("div",{className:"tag-management-loading",children:[a.jsx(E,{className:"spin",size:16}),t("common.loading")]}):T.length===0?a.jsx("p",{className:"tag-management-empty",children:t("tags.noTags")}):a.jsx("div",{className:"tag-management-list",children:T.map(e=>{const n=I===e.id,c=N===e.id;return a.jsxs("article",{className:`tag-management-item${n?" editing":""}`,children:[a.jsxs("div",{className:"tag-management-item-main",children:[a.jsx("span",{className:`tag-dot tag-${e.color}`,"aria-hidden":"true"}),a.jsxs("div",{children:[a.jsx("strong",{title:e.name,children:e.name}),a.jsx("small",{children:t("tags.projectCount",{count:e.projectCount})})]})]}),a.jsxs("div",{className:"tag-management-item-actions",children:[a.jsx("button",{type:"button",title:t("tags.edit"),"aria-label":t("tags.edit"),disabled:x&&!n,onClick:()=>U(e),children:a.jsx(ee,{"aria-hidden":!0,size:14})}),a.jsx("button",{type:"button",className:"danger-text",title:t("common.delete"),"aria-label":t("common.delete"),disabled:x,onClick:()=>{v(e),g("")},children:a.jsx(ae,{"aria-hidden":!0,size:14})})]}),n&&a.jsxs("div",{className:"tag-management-edit",children:[a.jsxs("label",{className:"tag-management-field",children:[a.jsx("span",{children:t("tags.rename")}),a.jsx("input",{value:j,maxLength:32,onChange:r=>{M(r.target.value),i("")},onKeyDown:r=>{r.key==="Enter"&&(r.preventDefault(),J(e))}})]}),a.jsxs("label",{className:"tag-management-field tag-management-color",children:[a.jsx("span",{children:t("tags.color")}),a.jsx("select",{value:P,onChange:r=>{A(r.target.value),i("")},children:H.map(r=>a.jsx("option",{value:r,children:t(`tags.${r}`)},r))})]}),a.jsxs("div",{className:"tag-management-edit-actions",children:[a.jsxs("button",{type:"button",disabled:c,onClick:()=>{m(null),i("")},children:[a.jsx(te,{"aria-hidden":!0,size:14}),t("common.cancel")]}),a.jsxs("button",{type:"button",className:"primary",disabled:!j.trim()||c,"aria-busy":c,onClick:()=>{J(e)},children:[c?a.jsx(E,{className:"spin",size:14}):a.jsx(ne,{"aria-hidden":!0,size:14}),t("common.save")]})]})]})]},e.id)})})]})}),a.jsx(Z,{open:!!o,title:t("tags.deleteTitle"),description:t("tags.deleteDescription",{tag:o?.name??"",count:o?.projectCount??0}),confirmLabel:t(u?"common.loading":"common.delete"),danger:!0,busy:u,error:Q,onCancel:()=>{u||(v(null),g(""))},onConfirm:()=>{V()}})]})}export{de as TagManagementDialog};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{u as c,j as o}from"./react-CltQJflK.js";import{M as x,L as h}from"./index-DF5cor0N.js";import{H as j}from"./ProjectWorkspace-BJFxjMCn.js";import{T as u}from"./type-C-6Jq_0r.js";import{p as m}from"./index-C5T8_lAl.js";import"./check-Hlb-tLSh.js";import"./index-Do5FsFqg.js";import"./chevron-up-D0psXvTv.js";import"./refresh-cw-BHVcjInn.js";function T({open:l,mode:d,path:s,busy:i,error:e,result:t,onOpenChange:n}){const{t:r}=c(),a=r(d==="full"?"editor.wordCountFullHint":"editor.wordCountSelectionHint");return o.jsxs(x,{open:l,title:r("editor.wordCountTitle"),description:a,onOpenChange:n,footer:o.jsx("button",{type:"button",onClick:()=>n(!1),children:r("common.close")}),children:[s&&o.jsxs("p",{className:"word-count-source",children:[r(d==="full"?"editor.wordCountFull":"editor.wordCountSelection")," · ",o.jsx("code",{children:s}),o.jsx("a",{href:"https://app.uio.no/ifi/texcount/",target:"_blank",rel:"noreferrer",children:r("editor.wordCountHelp")})]}),o.jsx("p",{className:"word-count-template-note",children:r("editor.wordCountTemplateNote")}),i&&o.jsxs("div",{className:"word-count-loading",role:"status","aria-live":"polite",children:[o.jsx(h,{className:"spin",size:22}),o.jsx("span",{children:r("editor.wordCountLoading")})]}),e&&o.jsx("p",{className:"error dialog-error",children:e}),t&&!i&&o.jsxs("div",{className:"word-count-result","aria-live":"polite",children:[o.jsxs("div",{className:"word-count-totals",children:[o.jsxs("div",{className:"word-count-total",children:[o.jsx(j,{size:20}),o.jsx("strong",{children:t.totalWords.toLocaleString()}),o.jsx("span",{children:r("editor.wordCountTotal")})]}),o.jsxs("div",{className:"word-count-total word-count-characters",children:[o.jsx(u,{size:20}),o.jsx("strong",{children:t.totalCharacters.toLocaleString()}),o.jsxs("span",{children:[r("editor.wordCountCharacters"),o.jsx("small",{children:r("editor.wordCountCharactersHint")})]})]})]}),o.jsxs("dl",{className:"word-count-breakdown",children:[o.jsxs("div",{children:[o.jsx("dt",{children:r("editor.wordCountText")}),o.jsxs("dd",{children:[t.textWords.toLocaleString(),o.jsx("small",{children:r("editor.wordCountWordsUnit")})]})]}),o.jsxs("div",{children:[o.jsx("dt",{children:r("editor.wordCountHeaders")}),o.jsxs("dd",{children:[t.headerWords.toLocaleString(),o.jsx("small",{children:r("editor.wordCountWordsUnit")})]})]}),o.jsxs("div",{children:[o.jsx("dt",{children:r("editor.wordCountCaptions")}),o.jsxs("dd",{children:[t.captionWords.toLocaleString(),o.jsx("small",{children:r("editor.wordCountWordsUnit")})]})]}),o.jsxs("div",{children:[o.jsx("dt",{children:r("editor.wordCountFloats")}),o.jsxs("dd",{children:[t.floats.toLocaleString(),o.jsx("small",{children:r("editor.wordCountItemsUnit")})]})]}),o.jsxs("div",{children:[o.jsx("dt",{children:r("editor.wordCountInlineMath")}),o.jsxs("dd",{children:[t.inlineMath.toLocaleString(),o.jsx("small",{children:r("editor.wordCountExpressionsUnit")})]})]}),o.jsxs("div",{children:[o.jsx("dt",{children:r("editor.wordCountDisplayMath")}),o.jsxs("dd",{children:[t.displayMath.toLocaleString(),o.jsx("small",{children:r("editor.wordCountExpressionsUnit")})]})]}),t.files!==null&&o.jsxs("div",{children:[o.jsx("dt",{children:r("editor.wordCountFiles")}),o.jsxs("dd",{children:[t.files.toLocaleString(),o.jsx("small",{children:r("editor.wordCountItemsUnit")})]})]})]}),t.parserErrors>0&&o.jsxs("p",{className:"warning word-count-warning",children:[o.jsx(m,{size:14}),r("editor.wordCountParserErrors",{count:t.parserErrors})]})]})]})}export{T as WordCountDialog};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c}from"./index-DF5cor0N.js";const o=c("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);export{o as C};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as e}from"./index-DF5cor0N.js";const r=e("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);export{r as C};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{a as y,A as b}from"./index-DF5cor0N.js";import{a as L,c as $}from"./ProjectWorkspace-BJFxjMCn.js";import"./react-CltQJflK.js";import"./index-C5T8_lAl.js";import"./check-Hlb-tLSh.js";import"./index-Do5FsFqg.js";import"./chevron-up-D0psXvTv.js";import"./refresh-cw-BHVcjInn.js";class k extends Error{constructor(){super("A newer ChkTeX check replaced this request."),this.name="ChktexLintSupersededError"}}function H(t){return t instanceof k}const O=$();let T=0;async function I(t,s,e,r){try{return(await y(`/api/projects/${t}/chktex`,{method:"POST",body:JSON.stringify({path:s,source:e,clientId:O,sequence:r})})).issues}catch(o){throw o instanceof b&&o.code==="CHK_TEX_SUPERSEDED"?new k:o}}function M(t){const s=[0],e=new TextEncoder;let r=0;for(const o of t){const a=e.encode(o).length;r+=o.length;for(let n=0;n<a;n+=1)s.push(r)}return s}function X(t){const s=[0];for(let e=0;e<t.length;e+=1)t[e]===`
|
|
2
|
+
`&&s.push(e+1);return s}function q(t,s){const e=X(t),r=new Set,o=new Map,a=[];for(const n of s){const i=n.line-1;if(!Number.isSafeInteger(i)||i<0||i>=e.length)continue;let l=o.get(i);if(!l){const m=e[i]??0,g=t.indexOf(`
|
|
3
|
+
`,m),w=g===-1?t.length:g,x=t.slice(m,w);l={start:m,line:x,offsets:M(x)},o.set(i,l)}const{start:d,line:C,offsets:h}=l,c=n.column-1;if(!Number.isSafeInteger(c)||c<0||c>=h.length-1)continue;const f=d+h[c],E=Math.min(h.length-1,c+Math.max(1,n.length)),u=d+(h[E]??C.length);if(f>=t.length||u<=f)continue;const S=t.slice(f,Math.min(u,t.length)),p=`${f}:${u}:${n.number??""}`;r.has(p)||(r.add(p),a.push({from:f,to:Math.min(u,t.length),word:S,kind:"latex",message:n.number===null?`ChkTeX: ${n.message}`:`ChkTeX ${n.number}: ${n.message}`,suggestions:[]}))}return a.sort((n,i)=>n.from-i.from||n.to-i.to)}async function J(t,s,e){if(!L(s))return[];const r=await I(t,s,e,++T);return q(e,r)}export{k as ChktexLintSupersededError,H as isChktexLintSupersededError,J as lintChktex,q as mapChktexLints};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c}from"./index-DF5cor0N.js";const e=c("Clock3",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16.5 12",key:"1aq6pp"}]]);export{e as C};
|