texlite 0.9.4 → 0.11.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.
Files changed (58) hide show
  1. package/DESIGN.md +12 -14
  2. package/OPERATIONS.md +12 -6
  3. package/README.md +70 -41
  4. package/README.zh-CN.md +59 -34
  5. package/dist/client/assets/{AdminUsers-B12FJUMy.js → AdminUsers-BExOMZsW.js} +1 -1
  6. package/dist/client/assets/{CitationLibraryDialog-BTmnCP4V.js → CitationLibraryDialog-tVD3i2gg.js} +1 -1
  7. package/dist/client/assets/Dashboard-DRt4rjKP.js +2 -0
  8. package/dist/client/assets/{GitDialog--MoUIW0n.js → GitDialog-CjDCi1uh.js} +1 -1
  9. package/dist/client/assets/{HistoryDialog-LgKbjsTZ.js → HistoryDialog-Pa9mK3Ky.js} +1 -1
  10. package/dist/client/assets/{LatexEditor-Dj2zIaQm.js → LatexEditor-8r486VeG.js} +2 -2
  11. package/dist/client/assets/PdfPreview-CMkO72I5.js +1 -0
  12. package/dist/client/assets/{ProjectIconPickerDialog-GzRuM0oQ.js → ProjectIconPickerDialog-B52xbSyr.js} +1 -1
  13. package/dist/client/assets/{ProjectNavigationDialogs-BiArHmQ9.js → ProjectNavigationDialogs-isGMXCfG.js} +1 -1
  14. package/dist/client/assets/ProjectSettings-Br_kJ113.js +1 -0
  15. package/dist/client/assets/ProjectWorkspace-CcbrdCy8.js +32 -0
  16. package/dist/client/assets/{SelectionHistoryDialog-Bpv6nvrC.js → SelectionHistoryDialog-ZvAhIJMy.js} +2 -2
  17. package/dist/client/assets/{SystemMetricsDialog-hJQATmd4.js → SystemMetricsDialog-D4ouU4HI.js} +1 -1
  18. package/dist/client/assets/{TagManagementDialog-BHC8qULq.js → TagManagementDialog-qhZfHgTr.js} +1 -1
  19. package/dist/client/assets/{WordCountDialog-DZhhO94k.js → WordCountDialog-tFhMCGyn.js} +1 -1
  20. package/dist/client/assets/check-DKIW1zpR.js +1 -0
  21. package/dist/client/assets/chktex-tM1XXPk2.js +3 -0
  22. package/dist/client/assets/{hard-drive-BWZnOgnm.js → hard-drive-CkIPwUSV.js} +1 -1
  23. package/dist/client/assets/index-90X2GUd_.css +1 -0
  24. package/dist/client/assets/index-CqBmQAzW.js +10 -0
  25. package/dist/client/assets/{index-kTamGfTl.js → index-DTYEGzB7.js} +1 -1
  26. package/dist/client/assets/{key-round-CoDwyVJc.js → key-round-BEnQo7IM.js} +1 -1
  27. package/dist/client/assets/{minimize-2-D100opW2.js → minimize-2-CLuDohEf.js} +1 -1
  28. package/dist/client/assets/{minus-DDTYB-Oz.js → minus-BpuvzV2m.js} +1 -1
  29. package/dist/client/assets/{plus-BVXOlQXP.js → plus-BFr75l91.js} +1 -1
  30. package/dist/client/assets/{refresh-cw-LtwnqlWh.js → refresh-cw-DyA4NKh7.js} +1 -1
  31. package/dist/client/assets/{search-DXo_aAp0.js → search-Nu4OcY_n.js} +1 -1
  32. package/dist/client/assets/{sigma-BgvHGPto.js → sigma-B-wjepsY.js} +1 -1
  33. package/dist/client/assets/{spellCheck-BtRppKcC.js → spellCheck-C-bNJsIU.js} +1 -1
  34. package/dist/client/assets/{tags-m9kppdi0.js → tags-BSA08jK3.js} +1 -1
  35. package/dist/client/assets/{type-YO4aprqE.js → type-BCdIbDmF.js} +1 -1
  36. package/dist/client/assets/{user-plus-MRmKeDtX.js → user-plus-gFwY-NA3.js} +1 -1
  37. package/dist/client/assets/{x-eisRQJv_.js → x-Cspw_pa4.js} +1 -1
  38. package/dist/client/index.html +2 -2
  39. package/dist/server/app.js +8 -0
  40. package/dist/server/chktex.js +377 -0
  41. package/dist/server/collaboration.js +6 -0
  42. package/dist/server/db.js +6 -1
  43. package/dist/server/environment.js +1 -0
  44. package/dist/server/history.js +4 -4
  45. package/dist/server/i18n.js +12 -2
  46. package/dist/server/projectImportUploads.js +133 -0
  47. package/dist/server/routes/projectFiles.js +3 -0
  48. package/dist/server/routes/projectShared.js +1 -0
  49. package/dist/server/routes/projects.js +87 -15
  50. package/dist/shared/writingChecks.js +4 -0
  51. package/package.json +1 -1
  52. package/dist/client/assets/Dashboard-JA5_M3TK.js +0 -2
  53. package/dist/client/assets/PdfPreview-C_W7w360.js +0 -1
  54. package/dist/client/assets/ProjectSettings-DgJohWUv.js +0 -1
  55. package/dist/client/assets/ProjectWorkspace-C6sYiBF2.js +0 -32
  56. package/dist/client/assets/check-C1db8iNn.js +0 -1
  57. package/dist/client/assets/index-BiwJj0Np.css +0 -1
  58. package/dist/client/assets/index-p1NHkGGG.js +0 -12
@@ -1 +0,0 @@
1
- import{u as X,r as s,j as i}from"./react-BVUjbTTn.js";import{P as K,g as J,w as Q,G as ee}from"./pdf-DUYcbPMK.js";import{M as te,a as ne}from"./minus-DDTYB-Oz.js";import{P as re}from"./plus-BVXOlQXP.js";import{d as V}from"./index-p1NHkGGG.js";ee.workerSrc=Q;const Y=new K,O=2,R=new Map;async function fe(){await Y.promise}function _(a,r){const o=`${r}:${a}`,f=R.get(o);if(f)return f.lastUsed=Date.now(),f;const u=J({url:a,worker:Y,disableRange:r==="full"}),c={task:u,promise:u.promise,consumers:0,settled:!1,lastUsed:Date.now()};return R.set(o,c),c.promise.then(()=>{c.settled=!0,q()},()=>{c.settled=!0,R.get(o)===c&&R.delete(o)}),c}function q(){if(R.size<=O)return;const a=[...R.entries()].filter(([,r])=>r.consumers===0&&r.settled).sort((r,o)=>r[1].lastUsed-o[1].lastUsed);for(;R.size>O&&a.length;){const[r,o]=a.shift();R.get(r)===o&&(R.delete(r),o.task.destroy())}}function he(a,r){if(!a)return;_(a,r).promise.catch(()=>{})}function se(a,r){const o=_(a,r);o.consumers+=1,o.lastUsed=Date.now();let f=!1;return{promise:o.promise,release:()=>{f||(f=!0,o.consumers=Math.max(0,o.consumers-1),o.lastUsed=Date.now(),q())}}}function me({url:a,loadingMode:r,target:o,compiling:f=!1,onViewportLocation:u,onDoubleClickLocation:c}){const{t:h}=X(),x=s.useRef(null),[m,D]=s.useState(null),[g,p]=s.useState(0),[d,E]=s.useState(100),[v,N]=s.useState(""),b=s.useRef(new Map),w=s.useRef(null),k=s.useRef(u);k.current=u;const M=s.useCallback((t,e)=>{e?b.current.set(t,e):b.current.delete(t)},[]),C=async t=>{if(!m||t==null)return;let e=t;if(typeof t=="string"&&(e=await m.getDestination(t).catch(()=>null)),!Array.isArray(e)||e.length===0)return;const l=e[0];let n=null;if(typeof l=="number"&&Number.isInteger(l))n=l;else if(l!=null)try{n=await m.getPageIndex(l)}catch{return}n==null||n<0||n>=m.numPages||b.current.get(n+1)?.scrollIntoView({behavior:"smooth",block:"start",inline:"nearest"})},y=s.useCallback(()=>{w.current=null;const t=x.current;if(!t)return;const e=t.getBoundingClientRect(),l=e.left+e.width/2,n=e.top+e.height/2,P=[...t.querySelectorAll(".pdf-page")],S=P.find(F=>{const I=F.getBoundingClientRect();return n>=I.top&&n<=I.bottom})??P.reduce((F,I)=>{if(!F)return I;const H=Math.abs(I.getBoundingClientRect().top-n),G=Math.abs(F.getBoundingClientRect().top-n);return H<G?I:F},null);if(!S)return;const j=S.getBoundingClientRect(),U=Number(S.dataset.scale)||1,T=Number(S.dataset.page),$=Math.max(0,Math.min(j.width,l-j.left))/U,B=Math.max(0,Math.min(j.height,n-j.top))/U;T&&k.current(T,$,B)},[]),A=s.useCallback(()=>{w.current===null&&(w.current=window.requestAnimationFrame(y))},[y]);s.useEffect(()=>()=>{w.current!==null&&window.cancelAnimationFrame(w.current),w.current=null},[]),s.useEffect(()=>{const t=x.current;if(!t)return;const e=()=>p(t.clientWidth);e();const l=new ResizeObserver(e);return l.observe(t),()=>l.disconnect()},[]),s.useEffect(()=>{let t=!1;D(null),N("");const e=se(a,r);return e.promise.then(l=>{t||D(l)}).catch(()=>{t||N(h("editor.pdfLoadFailed"))}),()=>{t=!0,e.release()}},[a,r]),s.useEffect(()=>{d>100||!x.current||(x.current.scrollLeft=0)},[d,g,m]);const z=t=>E(e=>Math.min(200,Math.max(50,e+t))),W=()=>{x.current&&(x.current.scrollLeft=0),E(100)},L=t=>{!t.shiftKey||Math.abs(t.deltaX)>Math.abs(t.deltaY)||(t.preventDefault(),t.currentTarget.scrollLeft+=t.deltaY,A())};return i.jsxs("div",{className:"pdf-viewer",children:[i.jsxs("div",{className:"pdf-toolbar",role:"toolbar","aria-label":h("editor.pdfZoomControls"),children:[i.jsx("button",{disabled:d<=50,title:h("editor.pdfZoomOut"),"aria-label":h("editor.pdfZoomOut"),onClick:()=>z(-10),children:i.jsx(te,{size:14})}),i.jsxs("span",{className:"pdf-zoom-value","aria-live":"polite",children:[d,"%"]}),i.jsx("button",{disabled:d>=200,title:h("editor.pdfZoomIn"),"aria-label":h("editor.pdfZoomIn"),onClick:()=>z(10),children:i.jsx(re,{size:14})}),i.jsxs("button",{className:"pdf-fit-width",title:h("editor.pdfFitWidth"),onClick:W,children:[i.jsx(ne,{size:13}),h("editor.pdfFitWidth")]})]}),f&&i.jsxs("div",{className:"pdf-compiling-overlay",role:"status","aria-live":"polite",children:[i.jsx(V,{className:"spin",size:20}),i.jsx("span",{children:h("editor.compiling")})]}),i.jsx("div",{className:"pdf-document",ref:x,onScroll:A,onWheel:L,children:i.jsxs("div",{className:"pdf-pages",style:{width:`${Math.max(1,g-28)*Math.max(1,d/100)}px`},children:[!m&&!v&&i.jsxs("div",{className:"pdf-loading",role:"status","aria-live":"polite",children:[i.jsx(V,{className:"spin",size:24}),i.jsx("span",{children:h("editor.loadingPdf")})]}),v&&i.jsx("div",{className:"preview-empty",children:i.jsx("strong",{children:v})}),m&&g>0&&Array.from({length:m.numPages},(t,e)=>i.jsx(ie,{document:m,pageNumber:e+1,availableWidth:g-28,zoom:d/100,target:o?.page===e+1?o:null,onReady:A,onPageElement:M,onInternalLink:C,onDoubleClickLocation:c},e+1))]})})]})}function ie({document:a,pageNumber:r,availableWidth:o,zoom:f,target:u,onReady:c,onPageElement:h,onInternalLink:x,onDoubleClickLocation:m}){const D=s.useRef(null),g=s.useRef(null),p=s.useRef(null),[d,E]=s.useState(1),[v,N]=s.useState({width:0,height:0}),[b,w]=s.useState(r===1),[k,M]=s.useState(!1),[C,y]=s.useState(null),[A,z]=s.useState([]);s.useEffect(()=>{const e=D.current;if(!e||b)return;if(!("IntersectionObserver"in window)){w(!0);return}const l=new IntersectionObserver(n=>{n.some(P=>P.isIntersecting)&&(w(!0),l.disconnect())},{rootMargin:"900px 0px"});return l.observe(e),()=>l.disconnect()},[b]),s.useEffect(()=>{u&&w(!0)},[u?.nonce]),s.useEffect(()=>{if(!b)return;let e=!1,l=null;return M(!1),y(null),z([]),a.getPage(r).then(n=>{if(e)return;const P=n.getViewport({scale:1}),S=o/P.width,j=Math.min(3.3,Math.max(.175,S*f)),U=n.getViewport({scale:j});if(E(j),N({width:U.width,height:U.height}),y(U),n.getAnnotations({intent:"display"}).then(B=>{e||z(B)}).catch(()=>{e||z([])}),!g.current)return;const T=Math.max(1,window.devicePixelRatio||1),$=n.getViewport({scale:j*T});return g.current.width=Math.floor($.width),g.current.height=Math.floor($.height),l=n.render({canvas:g.current,viewport:$}),l.promise.then(()=>{e||(M(!0),window.requestAnimationFrame(c))})}).catch(()=>{}),()=>{e=!0,l?.cancel()}},[a,r,o,f,b]),s.useEffect(()=>{!u||!p.current||p.current.scrollIntoView({behavior:"smooth",block:"center",inline:"center"})},[u?.nonce,d]);const W=e=>{if(!m||!k||e.target instanceof HTMLElement&&e.target.closest("a"))return;const l=g.current;if(!l)return;const n=l.getBoundingClientRect();if(e.clientX<n.left||e.clientX>n.right||e.clientY<n.top||e.clientY>n.bottom)return;const P=d||1,S=Math.max(0,Math.min(n.width,e.clientX-n.left))/P,j=Math.max(0,Math.min(n.height,e.clientY-n.top))/P;m(r,S,j)},L=Math.max(1,o*f),t=L*(792/612);return i.jsxs("figure",{ref:e=>{D.current=e,h(r,e)},onDoubleClick:W,className:`pdf-page${k?" rendered":" loading"}`,"data-page":r,"data-scale":d,style:{width:`${v.width||L}px`,minHeight:`${v.height||t}px`},children:[i.jsx("canvas",{ref:g,style:{width:`${v.width||L}px`,height:`${v.height||t}px`}}),k&&C&&i.jsx(oe,{annotations:A,viewport:C,onInternalLink:x}),u&&i.jsx("span",{ref:p,className:"pdf-sync-marker",style:{left:u.x*d,top:u.y*d}}),i.jsx("figcaption",{children:r})]})}function oe({annotations:a,viewport:r,onInternalLink:o}){const{t:f}=X(),u=f("editor.pdfLink");return i.jsx("div",{className:"pdf-annotation-layer","aria-label":f("editor.pdfLinks"),children:a.filter(c=>c.subtype==="Link"&&Array.isArray(c.rect)&&c.rect.length>=4).map((c,h)=>{const[x,m]=r.convertToViewportPoint(c.rect[0],c.rect[1]),[D,g]=r.convertToViewportPoint(c.rect[2],c.rect[3]),p=[x,m,D,g],d=Math.min(p[0],p[2]),E=Math.min(p[1],p[3]),v=Math.abs(p[2]-p[0]),N=Math.abs(p[3]-p[1]),b=typeof c.title=="string"?c.title.trim():"",w=typeof c.unsafeUrl=="string"?c.unsafeUrl.trim():"",k=typeof c.url=="string"?c.url.trim():"",M=Z(k)?k:Z(w)?w:"",C=c.dest;if(!M&&C==null)return null;const y=!!M;return i.jsx("a",{className:"pdf-annotation-link",href:M||"#",target:y?"_blank":void 0,rel:y?"noreferrer":void 0,title:b||(y?M:u),"aria-label":b||(y?M:u),style:{left:d,top:E,width:v,height:N},onClick:y?void 0:A=>{A.preventDefault(),o(C)}},`${h}-${d}-${E}`)})})}function Z(a){return/^(?:https?|mailto|ftp):/i.test(a)}export{me as PdfPreview,he as preloadPdf,fe as preloadPdfRuntime};
@@ -1 +0,0 @@
1
- import{u as oe,r,j as e}from"./react-BVUjbTTn.js";import{c as m,g as j,h as S,d as le}from"./index-p1NHkGGG.js";import{D as y,E as pe,S as E,G as U,I as de,J as he,A as xe,K as me}from"./ProjectWorkspace-C6sYiBF2.js";import{X as V,i as je,C as ge,d as ue}from"./x-eisRQJv_.js";import{T as B}from"./type-YO4aprqE.js";import{S as be}from"./sigma-BgvHGPto.js";import{R as Q}from"./refresh-cw-LtwnqlWh.js";import"./check-C1db8iNn.js";import"./search-DXo_aAp0.js";import"./user-plus-MRmKeDtX.js";const ve=m("ChevronsLeft",[["path",{d:"m11 17-5-5 5-5",key:"13zhaf"}],["path",{d:"m18 17-5-5 5-5",key:"h8a8et"}]]);const Se=m("ChevronsRight",[["path",{d:"m6 17 5-5-5-5",key:"xnjwq"}],["path",{d:"m13 17 5-5-5-5",key:"17xmmf"}]]);const ye=m("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);const fe=m("MessageCircleQuestion",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);const ke=m("PanelsTopLeft",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M9 21V9",key:"1oto5p"}]]);const Ne=m("SpellCheck2",[["path",{d:"m6 16 6-12 6 12",key:"1b4byz"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M4 21c1.1 0 1.1-1 2.3-1s1.1 1 2.3 1c1.1 0 1.1-1 2.3-1 1.1 0 1.1 1 2.3 1 1.1 0 1.1-1 2.3-1 1.1 0 1.1 1 2.3 1 1.1 0 1.1-1 2.3-1",key:"8mdmtu"}]]);const Ce=m("WrapText",[["line",{x1:"3",x2:"21",y1:"6",y2:"6",key:"4m8b97"}],["path",{d:"M3 12h15a3 3 0 1 1 0 6h-4",key:"1cl7v7"}],["polyline",{points:"16 16 14 18 16 20",key:"1jznyi"}],["line",{x1:"3",x2:"10",y1:"18",y2:"18",key:"1h33wv"}]]);function we({name:f,state:n,label:c,reloadLabel:d,onReload:k,compact:N=!1}){const g=n.status==="loading"?e.jsx(le,{className:"spin",size:14}):n.status==="working"?e.jsx(xe,{size:14}):e.jsx(ye,{size:14}),u=e.jsxs(e.Fragment,{children:[g,e.jsx("strong",{children:f}),e.jsx("span",{children:c}),n.status==="error"&&e.jsxs("button",{type:"button",className:"browser-tool-reload",title:d,"aria-label":d,onClick:k,children:[e.jsx(Q,{size:12}),d]})]});return N?e.jsxs("span",{className:`browser-tool-status compact ${n.status}`,role:"status","aria-live":"polite","aria-label":`${f}: ${c}`,title:n.error||void 0,children:[g,e.jsx("span",{children:c}),n.status==="error"&&e.jsx("button",{type:"button",className:"browser-tool-reload",title:d,"aria-label":d,onClick:k,children:e.jsx(Q,{size:12})})]}):e.jsx("div",{className:`browser-tool-status ${n.status}`,title:n.error||void 0,children:u})}function He({onClose:f,project:n,projectId:c,site:d,files:k,dictionaryWords:N,onDictionaryChange:g,editorPreferences:u,onEditorPreferences:G,spellCheckCount:l,spellCheckUniqueCount:X,spellCheckIndex:h,onSpellCheckNavigate:C,onProject:Z}){const{t:s}=oe(),[O,Y]=r.useState(n.engine),[T,F]=r.useState(""),[D,I]=r.useState(n.name),[b,ee]=r.useState(n.mainFile),[v,$]=r.useState(null),[P,z]=r.useState(""),[M,A]=r.useState(""),[H,w]=r.useState(""),[p,L]=r.useState("appearance"),[i,o]=r.useState(u),R=r.useSyncExternalStore(y.subscribe,y.getSnapshot,y.getSnapshot),x=n.permission==="owner",W=n.permission!=="read",q=n.permission!=="read";r.useEffect(()=>o(u),[u]),r.useEffect(()=>{pe().catch(y.failed)},[c]);const te=()=>{me().catch(y.failed)};r.useEffect(()=>{if(!n.latexmkrc)return F("");j(`/api/projects/${c}/file?path=${encodeURIComponent(n.latexmkrc)}`).then(({content:t})=>F(t)).catch(t=>z(S(t)))},[n.latexmkrc]),r.useEffect(()=>{if(p!=="compiler")return;const t=new AbortController;return $(null),j(`/api/projects/${c}/main-files`,{signal:t.signal}).then(a=>$(a.mainFiles)).catch(a=>{a instanceof Error&&a.name==="AbortError"||z(S(a))}),()=>t.abort()},[c,k,p]);const se=v??[n.mainFile],ie=v!==null&&!v.includes(b),J=async()=>{try{const t=T.trim()&&d.allowProjectLatexmkrc!==!1?".latexmkrc":null;t&&await j(`/api/projects/${c}/file`,{method:"PUT",body:JSON.stringify({path:t,content:T})});const a=await j(`/api/projects/${c}`,{method:"PATCH",body:JSON.stringify({name:D,mainFile:b,engine:O,latexmkrc:t})});Z(a.project)}catch(t){z(S(t))}},_=()=>G(i),ne=()=>{if(p==="appearance")return _();x&&J()},ae=s(p==="appearance"?"projectSettings.saveAppearance":"projectSettings.saveCompiler"),re=p==="appearance"||x,K=async()=>{const t=M.trim();if(t)try{const a=await j(`/api/projects/${c}/dictionary`,{method:"POST",body:JSON.stringify({word:t})});g(a.words),A(""),w("")}catch(a){w(S(a))}},ce=async t=>{try{const a=await j(`/api/projects/${c}/dictionary/${encodeURIComponent(t)}`,{method:"DELETE"});g(a.words),w("")}catch(a){w(S(a))}};return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"drawer-title settings-drawer-title",children:[e.jsx("strong",{children:s("editor.projectSettings")}),e.jsxs("div",{className:"drawer-title-actions",children:[re&&e.jsxs("button",{type:"button",className:"drawer-settings-save",onClick:ne,children:[e.jsx(E,{size:14}),e.jsx("span",{children:ae})]}),e.jsx("button",{type:"button","aria-label":s("common.close"),onClick:f,children:e.jsx(V,{size:17})})]})]}),e.jsxs("div",{className:"settings padded",children:[P&&e.jsx("p",{className:"error",children:P}),e.jsxs("div",{className:"settings-tabs",role:"tablist","aria-label":s("common.settings"),children:[e.jsxs("button",{id:"settings-tab-appearance",type:"button",role:"tab","aria-selected":p==="appearance","aria-controls":"settings-panel-appearance",className:`settings-tab${p==="appearance"?" active":""}`,onClick:()=>L("appearance"),children:[e.jsx(B,{size:15}),s("projectSettings.editorTab")]}),e.jsxs("button",{id:"settings-tab-compiler",type:"button",role:"tab","aria-selected":p==="compiler","aria-controls":"settings-panel-compiler",className:`settings-tab${p==="compiler"?" active":""}`,onClick:()=>L("compiler"),children:[e.jsx(U,{size:15}),s("projectSettings.compilerTab")]})]}),p==="appearance"?e.jsxs("section",{id:"settings-panel-appearance",role:"tabpanel","aria-labelledby":"settings-tab-appearance",children:[e.jsxs("div",{className:"settings-section-title",children:[e.jsx(B,{size:15}),e.jsx("strong",{children:s("projectSettings.editorAppearance")})]}),e.jsx("p",{className:"settings-description appearance-description",children:s("projectSettings.editorAppearanceDescription")}),e.jsxs("label",{children:[s("projectSettings.fontFamily"),e.jsx("select",{value:i.font,onChange:t=>o({...i,font:t.target.value}),children:de.map(t=>e.jsx("option",{value:t.id,children:s(t.labelKey)},t.id))})]}),e.jsxs("label",{children:[s("projectSettings.fontSize"),e.jsx("select",{value:i.fontSize,onChange:t=>o({...i,fontSize:Number(t.target.value)}),children:[12,13,14,15,16,18,20].map(t=>e.jsxs("option",{value:t,children:[t," px"]},t))})]}),e.jsxs("label",{children:[s("projectSettings.lineHeight"),e.jsxs("select",{value:i.lineHeight,onChange:t=>o({...i,lineHeight:Number(t.target.value)}),children:[e.jsx("option",{value:1.45,children:s("projectSettings.lineHeightCompact")}),e.jsx("option",{value:1.65,children:s("projectSettings.lineHeightNormal")}),e.jsx("option",{value:1.85,children:s("projectSettings.lineHeightRelaxed")})]})]}),e.jsxs("label",{className:"editor-checkbox",children:[e.jsx("input",{type:"checkbox",checked:i.lineWrapping,onChange:t=>o({...i,lineWrapping:t.target.checked})}),e.jsx(Ce,{size:15}),e.jsx("span",{children:s("projectSettings.lineWrapping")})]}),e.jsxs("div",{className:"editor-preference",children:[e.jsxs("label",{className:"editor-checkbox",children:[e.jsx("input",{type:"checkbox",checked:i.showTooltips,onChange:t=>o({...i,showTooltips:t.target.checked})}),e.jsx(fe,{size:15}),e.jsx("span",{children:s("projectSettings.showTooltips")})]}),e.jsx("p",{className:"field-hint",children:s("projectSettings.showTooltipsDescription")})]}),e.jsxs("div",{className:"editor-preference",children:[e.jsxs("label",{className:"editor-checkbox",children:[e.jsx("input",{type:"checkbox",checked:i.mathPreviewOnHover,onChange:t=>o({...i,mathPreviewOnHover:t.target.checked})}),e.jsx(be,{size:15}),e.jsx("span",{children:s("projectSettings.mathPreviewOnHover")})]}),e.jsx("p",{className:"field-hint",children:s("projectSettings.mathPreviewOnHoverDescription")})]}),e.jsxs("div",{className:"editor-preference",children:[e.jsxs("label",{className:"editor-checkbox",children:[e.jsx("input",{type:"checkbox",checked:i.spellCheck,onChange:t=>o({...i,spellCheck:t.target.checked})}),e.jsx("span",{children:s("projectSettings.spellCheck")})]}),e.jsxs("p",{className:"field-hint",children:[s("projectSettings.writingCheckDescription")," ",e.jsx("a",{href:"https://writewithharper.com/docs/integrations/language-server",target:"_blank",rel:"noreferrer",children:"Harper"})]})]}),e.jsxs("div",{className:"editor-preference",children:[e.jsxs("label",{className:"editor-checkbox",children:[e.jsx("input",{type:"checkbox",checked:i.vimMode,onChange:t=>o({...i,vimMode:t.target.checked})}),e.jsx("span",{children:s("projectSettings.vimMode")})]}),e.jsxs("p",{className:"field-hint",children:[s("projectSettings.vimModeDescription")," ",e.jsx("a",{href:"https://replit-codemirror-vim.mintlify.app/",target:"_blank",rel:"noreferrer",children:s("projectSettings.vimHelp")})]})]}),e.jsxs("div",{className:"editor-preference",children:[e.jsxs("label",{className:"editor-checkbox",children:[e.jsx("input",{type:"checkbox",checked:i.openFilesInTabs,onChange:t=>o({...i,openFilesInTabs:t.target.checked})}),e.jsx(ke,{size:15}),e.jsx("span",{children:s("projectSettings.openFilesInTabs")})]}),e.jsx("p",{className:"field-hint",children:s("projectSettings.openFilesInTabsDescription")})]}),e.jsxs("div",{className:"editor-preference",children:[e.jsxs("label",{className:"editor-checkbox",children:[e.jsx("input",{type:"checkbox",disabled:!W,checked:i.formatOnCompile,onChange:t=>o({...i,formatOnCompile:t.target.checked})}),e.jsx(he,{size:15}),e.jsx("span",{children:s("projectSettings.formatOnCompile")})]}),e.jsxs("p",{className:"field-hint",children:[s(W?"projectSettings.formatOnCompileDescription":"projectSettings.formatRequiresWrite")," ",s("projectSettings.formatterDescription")," ",e.jsx("a",{href:"https://www.npmjs.com/package/tex-fmt",target:"_blank",rel:"noreferrer",children:s("projectSettings.formatterInstall")})," · ",e.jsx("a",{href:"https://github.com/FlamingTempura/bibtex-tidy",target:"_blank",rel:"noreferrer",children:s("projectSettings.bibtexTidyInstall")})]})]}),e.jsxs("div",{className:"editor-preference",children:[e.jsxs("label",{className:"tex-fmt-options-field",children:[e.jsxs("span",{className:"tex-fmt-options-heading",children:[e.jsx("span",{children:s("projectSettings.texFmtOptions")}),e.jsx(we,{compact:!0,name:"tex-fmt",state:R,label:s(`projectSettings.toolStatus.${R.status}`),reloadLabel:s("projectSettings.reloadTool"),onReload:te})]}),e.jsx("textarea",{className:"tex-fmt-options-editor",rows:6,maxLength:16*1024,spellCheck:!1,value:i.texFmtConfig,placeholder:s("projectSettings.texFmtOptionsPlaceholder"),onChange:t=>o({...i,texFmtConfig:t.target.value})})]}),e.jsx("p",{className:"field-hint",children:s("projectSettings.texFmtOptionsDescription")})]}),l!==null&&e.jsxs("div",{className:`spell-check-result${l?" has-issues":""}`,role:"status","aria-live":"polite",children:[e.jsx(Ne,{size:14}),e.jsx("span",{children:l?s("projectSettings.writingIssues",{count:l,uniqueCount:X??0}):s("projectSettings.noWritingIssues")}),l>0&&e.jsxs("span",{className:"spell-check-controls",children:[e.jsx("button",{type:"button",title:s("projectSettings.spellCheckFirst"),"aria-label":s("projectSettings.spellCheckFirst"),disabled:h<=0,onClick:()=>C(0),children:e.jsx(ve,{size:14})}),e.jsx("button",{type:"button",title:s("projectSettings.spellCheckPrevious"),"aria-label":s("projectSettings.spellCheckPrevious"),disabled:h<=0,onClick:()=>C(h-1),children:e.jsx(je,{size:14})}),e.jsx("span",{className:"spell-check-position",children:s("projectSettings.spellCheckPosition",{current:Math.min(h+1,l),total:l})}),e.jsx("button",{type:"button",title:s("projectSettings.spellCheckNext"),"aria-label":s("projectSettings.spellCheckNext"),disabled:h>=l-1,onClick:()=>C(h+1),children:e.jsx(ge,{size:14})}),e.jsx("button",{type:"button",title:s("projectSettings.spellCheckLast"),"aria-label":s("projectSettings.spellCheckLast"),disabled:h>=l-1,onClick:()=>C(l-1),children:e.jsx(Se,{size:14})})]})]}),e.jsxs("div",{className:"settings-section-title",children:[e.jsx(ue,{size:15}),e.jsx("strong",{children:s("projectSettings.dictionary")})]}),e.jsx("p",{className:"settings-description",children:s("projectSettings.dictionaryDescription")}),H&&e.jsx("p",{className:"error dictionary-error",children:H}),q&&e.jsxs("div",{className:"dictionary-add",children:[e.jsx("input",{value:M,placeholder:s("projectSettings.dictionaryPlaceholder"),onChange:t=>A(t.target.value),onKeyDown:t=>{t.key==="Enter"&&(t.preventDefault(),K())}}),e.jsx("button",{type:"button",disabled:!M.trim(),onClick:()=>{K()},children:s("projectSettings.addWord")})]}),e.jsxs("div",{className:"dictionary-words",children:[N.map(t=>e.jsxs("span",{className:"dictionary-word",children:[e.jsx("code",{children:t}),q&&e.jsx("button",{type:"button",title:s("common.delete"),"aria-label":`${s("common.delete")} ${t}`,onClick:()=>{ce(t)},children:e.jsx(V,{size:13})})]},t)),N.length===0&&e.jsx("span",{className:"dictionary-empty",children:s("projectSettings.dictionaryEmpty")})]}),e.jsx("div",{className:"settings-actions",children:e.jsxs("button",{className:"settings-save",onClick:_,children:[e.jsx(E,{size:15}),s("projectSettings.saveAppearance")]})})]}):e.jsxs("section",{id:"settings-panel-compiler",role:"tabpanel","aria-labelledby":"settings-tab-compiler",children:[e.jsxs("div",{className:"settings-section-title",children:[e.jsx(U,{size:15}),e.jsx("strong",{children:s("projectSettings.compilerTab")})]}),e.jsx("p",{className:"settings-description compiler-description",children:s("projectSettings.compilerDescription")}),e.jsxs("label",{children:[s("projects.name"),e.jsx("input",{disabled:!x,value:D,onChange:t=>I(t.target.value)})]}),e.jsxs("label",{children:[s("projectSettings.mainFile"),e.jsxs("select",{disabled:!x||v===null||v.length===0,value:b,onChange:t=>ee(t.target.value),children:[ie&&e.jsx("option",{value:b,disabled:!0,children:s("projectSettings.invalidMainFileOption",{path:b})}),se.map(t=>e.jsx("option",{value:t,children:t},t))]})]}),e.jsxs("label",{children:[s("projectSettings.engine"),e.jsx("select",{disabled:!x,value:O,onChange:t=>Y(t.target.value),children:(d.allowedEngines??["pdflatex","xelatex","lualatex"]).map(t=>e.jsx("option",{children:t},t))})]}),e.jsxs("label",{children:[s("projectSettings.latexmkrc"),e.jsx("textarea",{className:"latexmkrc-editor",rows:10,spellCheck:!1,disabled:!x||d.allowProjectLatexmkrc===!1,value:T,placeholder:s("projectSettings.latexmkrcPlaceholder"),onChange:t=>F(t.target.value)})]}),e.jsx("div",{className:"settings-actions",children:x&&e.jsxs("button",{className:"settings-save",onClick:()=>{J()},children:[e.jsx(E,{size:15}),s("projectSettings.saveCompiler")]})})]})]})]})}export{He as ProjectSettings};