texlite 0.19.0 → 0.19.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (201) hide show
  1. package/DESIGN.md +94 -14
  2. package/OPERATIONS.md +47 -5
  3. package/README.md +4 -0
  4. package/README.zh-CN.md +3 -0
  5. package/dist/client/assets/AdminUsers-CuYfWnEk.js +1 -0
  6. package/dist/client/assets/AdminUsers-CuYfWnEk.js.br +0 -0
  7. package/dist/client/assets/AdminUsers-CuYfWnEk.js.gz +0 -0
  8. package/dist/client/assets/{AgentIcon-BlHvdrRo.js → AgentIcon-ClP5dPRL.js} +1 -1
  9. package/dist/client/assets/AgentIcon-ClP5dPRL.js.br +0 -0
  10. package/dist/client/assets/AgentIcon-ClP5dPRL.js.gz +0 -0
  11. package/dist/client/assets/{AgentIcon-DE7FEpRY.css → AgentIcon-DxrC-zx_.css} +1 -1
  12. package/dist/client/assets/AgentIcon-DxrC-zx_.css.br +0 -0
  13. package/dist/client/assets/AgentIcon-DxrC-zx_.css.gz +0 -0
  14. package/dist/client/assets/AgentManagement-jY_BF6Qy.js +1 -0
  15. package/dist/client/assets/AgentManagement-jY_BF6Qy.js.br +0 -0
  16. package/dist/client/assets/AgentManagement-jY_BF6Qy.js.gz +0 -0
  17. package/dist/client/assets/AgentTerminal-JKP2SVkZ.js +2 -0
  18. package/dist/client/assets/AgentTerminal-JKP2SVkZ.js.br +0 -0
  19. package/dist/client/assets/AgentTerminal-JKP2SVkZ.js.gz +0 -0
  20. package/dist/client/assets/{AgentTerminalSurface-D0MLcJmw.js → AgentTerminalSurface-CaYNNZ9A.js} +2 -2
  21. package/dist/client/assets/AgentTerminalSurface-CaYNNZ9A.js.br +0 -0
  22. package/dist/client/assets/AgentTerminalSurface-CaYNNZ9A.js.gz +0 -0
  23. package/dist/client/assets/AvatarSettingsDialog-C2TACfvP.js +1 -0
  24. package/dist/client/assets/AvatarSettingsDialog-C2TACfvP.js.br +0 -0
  25. package/dist/client/assets/AvatarSettingsDialog-C2TACfvP.js.gz +0 -0
  26. package/dist/client/assets/CitationLibraryDialog-BdU9nbgG.js +1 -0
  27. package/dist/client/assets/CitationLibraryDialog-BdU9nbgG.js.br +0 -0
  28. package/dist/client/assets/CitationLibraryDialog-BdU9nbgG.js.gz +0 -0
  29. package/dist/client/assets/Dashboard-B7mMz5Gj.js +5 -0
  30. package/dist/client/assets/Dashboard-B7mMz5Gj.js.br +0 -0
  31. package/dist/client/assets/Dashboard-B7mMz5Gj.js.gz +0 -0
  32. package/dist/client/assets/GitDialog-C2H-jKVO.js +3 -0
  33. package/dist/client/assets/GitDialog-C2H-jKVO.js.br +0 -0
  34. package/dist/client/assets/GitDialog-C2H-jKVO.js.gz +0 -0
  35. package/dist/client/assets/GitHubAccountDialog-DdKiE3pw.js +1 -0
  36. package/dist/client/assets/GitHubAccountDialog-DdKiE3pw.js.br +0 -0
  37. package/dist/client/assets/GitHubAccountDialog-DdKiE3pw.js.gz +0 -0
  38. package/dist/client/assets/{GitHubIcon-BPTVKTrM.js → GitHubIcon-Cjli8pd_.js} +1 -1
  39. package/dist/client/assets/HistoryDialog-CoxJ3EsK.js +8 -0
  40. package/dist/client/assets/HistoryDialog-CoxJ3EsK.js.br +0 -0
  41. package/dist/client/assets/HistoryDialog-CoxJ3EsK.js.gz +0 -0
  42. package/dist/client/assets/{LatexEditor-BDpqgoOa.js → LatexEditor-BhAKioho.js} +26 -26
  43. package/dist/client/assets/LatexEditor-BhAKioho.js.br +0 -0
  44. package/dist/client/assets/LatexEditor-BhAKioho.js.gz +0 -0
  45. package/dist/client/assets/{PdfPreview-C2puKgCh.js → PdfPreview-CC8KEz1Y.js} +1 -1
  46. package/dist/client/assets/PdfPreview-CC8KEz1Y.js.br +0 -0
  47. package/dist/client/assets/PdfPreview-CC8KEz1Y.js.gz +0 -0
  48. package/dist/client/assets/ProjectIconPickerDialog-vi_HwlCS.js +1 -0
  49. package/dist/client/assets/ProjectIconPickerDialog-vi_HwlCS.js.br +0 -0
  50. package/dist/client/assets/ProjectIconPickerDialog-vi_HwlCS.js.gz +0 -0
  51. package/dist/client/assets/ProjectSettings-Bl1t-Gnh.js +4 -0
  52. package/dist/client/assets/ProjectSettings-Bl1t-Gnh.js.br +0 -0
  53. package/dist/client/assets/ProjectSettings-Bl1t-Gnh.js.gz +0 -0
  54. package/dist/client/assets/ProjectWorkspace-1UOdyfBq.js +30 -0
  55. package/dist/client/assets/ProjectWorkspace-1UOdyfBq.js.br +0 -0
  56. package/dist/client/assets/ProjectWorkspace-1UOdyfBq.js.gz +0 -0
  57. package/dist/client/assets/{QuickOpenDialog-CEYxIk4l.js → QuickOpenDialog-BAzyrB-4.js} +1 -1
  58. package/dist/client/assets/QuickOpenDialog-BAzyrB-4.js.br +0 -0
  59. package/dist/client/assets/QuickOpenDialog-BAzyrB-4.js.gz +0 -0
  60. package/dist/client/assets/SaveButton-DkyoEu6j.js +1 -0
  61. package/dist/client/assets/{SelectionHistoryDialog-DBL6vVD4.js → SelectionHistoryDialog-DzlVKtxs.js} +2 -2
  62. package/dist/client/assets/SelectionHistoryDialog-DzlVKtxs.js.br +0 -0
  63. package/dist/client/assets/SelectionHistoryDialog-DzlVKtxs.js.gz +0 -0
  64. package/dist/client/assets/SuccessNotice-ubBtzzi_.js +1 -0
  65. package/dist/client/assets/{SystemMetricsDialog-D2EQX5hh.js → SystemMetricsDialog-C6RVZdJZ.js} +1 -1
  66. package/dist/client/assets/SystemMetricsDialog-C6RVZdJZ.js.br +0 -0
  67. package/dist/client/assets/SystemMetricsDialog-C6RVZdJZ.js.gz +0 -0
  68. package/dist/client/assets/TagColorSelect-xbc2H5ou.js +1 -0
  69. package/dist/client/assets/TagManagementDialog-8pZUVaEI.js +1 -0
  70. package/dist/client/assets/TagManagementDialog-8pZUVaEI.js.br +0 -0
  71. package/dist/client/assets/TagManagementDialog-8pZUVaEI.js.gz +0 -0
  72. package/dist/client/assets/{WordCountDialog-DaHxqArj.js → WordCountDialog-BODhL9iz.js} +1 -1
  73. package/dist/client/assets/WordCountDialog-BODhL9iz.js.br +0 -0
  74. package/dist/client/assets/WordCountDialog-BODhL9iz.js.gz +0 -0
  75. package/dist/client/assets/{arrow-down-BySB1dS6.js → arrow-down-B6T7Z6IO.js} +1 -1
  76. package/dist/client/assets/check-BRlv1lrZ.js +1 -0
  77. package/dist/client/assets/chevron-up-krb7w67X.js +1 -0
  78. package/dist/client/assets/{chktex-B2-niLAo.js → chktex-Bz-LKycq.js} +1 -1
  79. package/dist/client/assets/{clock-3-C_8q2yLj.js → clock-3-Fb1_e3ec.js} +1 -1
  80. package/dist/client/assets/{dist-CIxSPQK5.js → dist-CMYWzCHL.js} +1 -1
  81. package/dist/client/assets/dist-CMYWzCHL.js.br +0 -0
  82. package/dist/client/assets/dist-CMYWzCHL.js.gz +0 -0
  83. package/dist/client/assets/{eye-DpIOhQ2p.js → eye-B6AX_5uX.js} +1 -1
  84. package/dist/client/assets/{hard-drive-DRbINIYf.js → hard-drive-CBmnJ2xS.js} +1 -1
  85. package/dist/client/assets/i18n-DF6keNBA.js +13 -0
  86. package/dist/client/assets/i18n-DF6keNBA.js.br +0 -0
  87. package/dist/client/assets/i18n-DF6keNBA.js.gz +0 -0
  88. package/dist/client/assets/{index-h0BVkT8k.js → index-DCwfhKK9.js} +3 -3
  89. package/dist/client/assets/index-DCwfhKK9.js.br +0 -0
  90. package/dist/client/assets/index-DCwfhKK9.js.gz +0 -0
  91. package/dist/client/assets/index-SVNFLCYh.css +1 -0
  92. package/dist/client/assets/index-SVNFLCYh.css.br +0 -0
  93. package/dist/client/assets/index-SVNFLCYh.css.gz +0 -0
  94. package/dist/client/assets/{info-DB-RajXx.js → info-DNSAs0_-.js} +1 -1
  95. package/dist/client/assets/{minimize-2-DtsKyo4M.js → minimize-2-C8oL6PTV.js} +1 -1
  96. package/dist/client/assets/{minus-CdwrG9Yo.js → minus-TCBOakyi.js} +1 -1
  97. package/dist/client/assets/plus-Dfkyfvvy.js +1 -0
  98. package/dist/client/assets/{refresh-cw-c6Tzy-hb.js → refresh-cw-DuLtxWBX.js} +1 -1
  99. package/dist/client/assets/relativeTime-BR0CVAvz.js +1 -0
  100. package/dist/client/assets/relativeTime-BR0CVAvz.js.br +0 -0
  101. package/dist/client/assets/relativeTime-BR0CVAvz.js.gz +0 -0
  102. package/dist/client/assets/{search-Cy8DgYGb.js → search-n-2tBATf.js} +1 -1
  103. package/dist/client/assets/{spellCheck-DEQIFH7w.js → spellCheck-xzICTGx1.js} +1 -1
  104. package/dist/client/assets/spellCheck-xzICTGx1.js.br +0 -0
  105. package/dist/client/assets/spellCheck-xzICTGx1.js.gz +0 -0
  106. package/dist/client/assets/tags-Dy96boLq.js +1 -0
  107. package/dist/client/assets/{terminal-DaAc1558.js → terminal-C0xh8jVR.js} +1 -1
  108. package/dist/client/assets/{type-Cm3TiSO6.js → type-BjXWxrjH.js} +1 -1
  109. package/dist/client/assets/{user-plus-BLC3_SFQ.js → user-plus-3oJZJXHW.js} +1 -1
  110. package/dist/client/index.html +3 -3
  111. package/dist/server/agents/adapters/claude.js +170 -9
  112. package/dist/server/agents/adapters/opencode.js +15 -3
  113. package/dist/server/agents/sessions.js +18 -8
  114. package/dist/server/collaboration.js +2 -1
  115. package/dist/server/db.js +5 -0
  116. package/dist/server/routes/projectShared.js +6 -1
  117. package/dist/shared/sourceCommentAnchors.js +52 -4
  118. package/package.json +1 -1
  119. package/dist/client/assets/AdminUsers-DXWi8wl0.js +0 -1
  120. package/dist/client/assets/AdminUsers-DXWi8wl0.js.br +0 -0
  121. package/dist/client/assets/AdminUsers-DXWi8wl0.js.gz +0 -0
  122. package/dist/client/assets/AgentIcon-BlHvdrRo.js.br +0 -0
  123. package/dist/client/assets/AgentIcon-BlHvdrRo.js.gz +0 -0
  124. package/dist/client/assets/AgentIcon-DE7FEpRY.css.br +0 -0
  125. package/dist/client/assets/AgentIcon-DE7FEpRY.css.gz +0 -0
  126. package/dist/client/assets/AgentManagement-CDWaxEmP.js +0 -1
  127. package/dist/client/assets/AgentManagement-CDWaxEmP.js.br +0 -0
  128. package/dist/client/assets/AgentManagement-CDWaxEmP.js.gz +0 -0
  129. package/dist/client/assets/AgentTerminal-BXH3gHWm.js +0 -2
  130. package/dist/client/assets/AgentTerminal-BXH3gHWm.js.br +0 -0
  131. package/dist/client/assets/AgentTerminal-BXH3gHWm.js.gz +0 -0
  132. package/dist/client/assets/AgentTerminalSurface-D0MLcJmw.js.br +0 -0
  133. package/dist/client/assets/AgentTerminalSurface-D0MLcJmw.js.gz +0 -0
  134. package/dist/client/assets/AvatarSettingsDialog-CtbzavqH.js +0 -1
  135. package/dist/client/assets/AvatarSettingsDialog-CtbzavqH.js.br +0 -0
  136. package/dist/client/assets/AvatarSettingsDialog-CtbzavqH.js.gz +0 -0
  137. package/dist/client/assets/CitationLibraryDialog-CnQVjovw.js +0 -1
  138. package/dist/client/assets/CitationLibraryDialog-CnQVjovw.js.br +0 -0
  139. package/dist/client/assets/CitationLibraryDialog-CnQVjovw.js.gz +0 -0
  140. package/dist/client/assets/Dashboard-Dzq1oMZU.js +0 -5
  141. package/dist/client/assets/Dashboard-Dzq1oMZU.js.br +0 -0
  142. package/dist/client/assets/Dashboard-Dzq1oMZU.js.gz +0 -0
  143. package/dist/client/assets/GitDialog-CzgguGGW.js +0 -3
  144. package/dist/client/assets/GitDialog-CzgguGGW.js.br +0 -0
  145. package/dist/client/assets/GitDialog-CzgguGGW.js.gz +0 -0
  146. package/dist/client/assets/GitHubAccountDialog-lRAWfkKP.js +0 -1
  147. package/dist/client/assets/GitHubAccountDialog-lRAWfkKP.js.br +0 -0
  148. package/dist/client/assets/GitHubAccountDialog-lRAWfkKP.js.gz +0 -0
  149. package/dist/client/assets/HistoryDialog-Bw3GHfbM.js +0 -8
  150. package/dist/client/assets/HistoryDialog-Bw3GHfbM.js.br +0 -0
  151. package/dist/client/assets/HistoryDialog-Bw3GHfbM.js.gz +0 -0
  152. package/dist/client/assets/LatexEditor-BDpqgoOa.js.br +0 -0
  153. package/dist/client/assets/LatexEditor-BDpqgoOa.js.gz +0 -0
  154. package/dist/client/assets/PdfPreview-C2puKgCh.js.br +0 -0
  155. package/dist/client/assets/PdfPreview-C2puKgCh.js.gz +0 -0
  156. package/dist/client/assets/ProjectIconPickerDialog-BzNdyAz6.js +0 -1
  157. package/dist/client/assets/ProjectIconPickerDialog-BzNdyAz6.js.br +0 -0
  158. package/dist/client/assets/ProjectIconPickerDialog-BzNdyAz6.js.gz +0 -0
  159. package/dist/client/assets/ProjectSettings-B_y5nRgp.js +0 -4
  160. package/dist/client/assets/ProjectSettings-B_y5nRgp.js.br +0 -0
  161. package/dist/client/assets/ProjectSettings-B_y5nRgp.js.gz +0 -0
  162. package/dist/client/assets/ProjectWorkspace-BnT5JPTA.js +0 -30
  163. package/dist/client/assets/ProjectWorkspace-BnT5JPTA.js.br +0 -0
  164. package/dist/client/assets/ProjectWorkspace-BnT5JPTA.js.gz +0 -0
  165. package/dist/client/assets/QuickOpenDialog-CEYxIk4l.js.br +0 -0
  166. package/dist/client/assets/QuickOpenDialog-CEYxIk4l.js.gz +0 -0
  167. package/dist/client/assets/SelectionHistoryDialog-DBL6vVD4.js.br +0 -0
  168. package/dist/client/assets/SelectionHistoryDialog-DBL6vVD4.js.gz +0 -0
  169. package/dist/client/assets/SuccessNotice-C8XV7MAJ.js +0 -1
  170. package/dist/client/assets/SystemMetricsDialog-D2EQX5hh.js.br +0 -0
  171. package/dist/client/assets/SystemMetricsDialog-D2EQX5hh.js.gz +0 -0
  172. package/dist/client/assets/TagColorSelect-CfJaFovr.js +0 -1
  173. package/dist/client/assets/TagManagementDialog-CiJ6AhVk.js +0 -1
  174. package/dist/client/assets/TagManagementDialog-CiJ6AhVk.js.br +0 -0
  175. package/dist/client/assets/TagManagementDialog-CiJ6AhVk.js.gz +0 -0
  176. package/dist/client/assets/WordCountDialog-DaHxqArj.js.br +0 -0
  177. package/dist/client/assets/WordCountDialog-DaHxqArj.js.gz +0 -0
  178. package/dist/client/assets/binary-B57nBiwS.js +0 -1
  179. package/dist/client/assets/check-B-GEn6vk.js +0 -1
  180. package/dist/client/assets/chevron-up-B0yLKMZJ.js +0 -1
  181. package/dist/client/assets/circle-check-CfK-oqlC.js +0 -1
  182. package/dist/client/assets/dist-CIxSPQK5.js.br +0 -0
  183. package/dist/client/assets/dist-CIxSPQK5.js.gz +0 -0
  184. package/dist/client/assets/i18n-BzlyqR_B.js +0 -13
  185. package/dist/client/assets/i18n-BzlyqR_B.js.br +0 -0
  186. package/dist/client/assets/i18n-BzlyqR_B.js.gz +0 -0
  187. package/dist/client/assets/index-BHHBwQuG.css +0 -1
  188. package/dist/client/assets/index-BHHBwQuG.css.br +0 -0
  189. package/dist/client/assets/index-BHHBwQuG.css.gz +0 -0
  190. package/dist/client/assets/index-h0BVkT8k.js.br +0 -0
  191. package/dist/client/assets/index-h0BVkT8k.js.gz +0 -0
  192. package/dist/client/assets/plus-PHvPlka_.js +0 -1
  193. package/dist/client/assets/relativeTime-Cf5dzFc9.js +0 -1
  194. package/dist/client/assets/relativeTime-Cf5dzFc9.js.br +0 -0
  195. package/dist/client/assets/relativeTime-Cf5dzFc9.js.gz +0 -0
  196. package/dist/client/assets/spellCheck-DEQIFH7w.js.br +0 -0
  197. package/dist/client/assets/spellCheck-DEQIFH7w.js.gz +0 -0
  198. package/dist/client/assets/tags-BQ0exG-g.js +0 -1
  199. package/dist/client/assets/terminalPreferences-CgacIg2F.js +0 -1
  200. package/dist/client/assets/terminalPreferences-CgacIg2F.js.br +0 -0
  201. package/dist/client/assets/terminalPreferences-CgacIg2F.js.gz +0 -0
@@ -1,8 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,t as n}from"./react-DUEFWlB7.js";import{L as r,P as i,s as a,w as o}from"./relativeTime-Cf5dzFc9.js";import{t as s}from"./circle-check-CfK-oqlC.js";import{t as c}from"./clock-3-C_8q2yLj.js";import{t as l}from"./hard-drive-DRbINIYf.js";import{n as u,t as d}from"./minus-CdwrG9Yo.js";import{t as f}from"./minimize-2-DtsKyo4M.js";import{t as p}from"./plus-PHvPlka_.js";import{t as m}from"./search-Cy8DgYGb.js";import{C as h,E as g,T as _,b as v,c as ee,j as te,s as y,y as b}from"./index-h0BVkT8k.js";import{r as x}from"./dist-Dxkdrap6.js";import{n as ne,t as re}from"./SuccessNotice-C8XV7MAJ.js";import{B as ie,I as S,L as C,U as ae,z as oe}from"./ProjectWorkspace-BnT5JPTA.js";var w={name:`list-checks`,size:24,node:[[`path`,{d:`M13 5h8`,key:`a7qcls`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`path`,{d:`m3 7 2 2 4-4`,key:`1obspn`}]]};w.node;var se=v(w),T={name:`tag`,size:24,node:[[`path`,{d:`M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z`,key:`vktsd0`}],[`circle`,{cx:`7.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`kqv944`}]]};T.node;var ce=v(T),E=e(t(),1),D=55296,O=2048,k=63487,A=4e4;function j(e,t){if(e===t)return e?[[0,e]]:[];let n=[``],r=new Map,i=(e,t)=>{let i=[];for(let a=0;a<e.length;){let o=e.indexOf(`
2
- `,a),s=o<0?e.length:o+1,c=e.slice(a,s),l=r.get(c);if(l===void 0&&(n.length===t&&(c=e.slice(a),s=e.length,l=r.get(c)),l===void 0)){let e=n.length;l=String.fromCharCode(e<D?e:e+O),n.push(c),r.set(c,l)}i.push(l),a=s}return i.join(``)},a=i(e,A),o=i(t,k);return x(a,o,{checkLines:!1,timeout:1}).map(([e,t])=>[e,Array.from(t,e=>{let t=e.charCodeAt(0),r=t<D?t:t-O;return n[r]}).join(``)])}function le(e,t,n,r=`历史版本`,i=`当前版本`,a=3){let o=t.replace(/\r\n/g,`
3
- `),s=n.replace(/\r\n/g,`
4
- `);if(o===s)return{diffText:``,additions:0,deletions:0,hasChanges:!1};let c=j(o,s),l=[],u=1,d=1,f=0,p=0;for(let[e,t]of c){if(!t)continue;let n=t.split(`
5
- `);n[n.length-1]===``&&n.pop();for(let t of n)e===0?l.push({op:0,text:t,oldNum:u++,newNum:d++}):e===-1?(p++,l.push({op:-1,text:t,oldNum:u++,newNum:d})):e===1&&(f++,l.push({op:1,text:t,oldNum:u,newNum:d++}))}if(f===0&&p===0)return{diffText:``,additions:0,deletions:0,hasChanges:!1};let m=[],h=-1,g=-1;for(let e=0;e<l.length;e++)if(l[e].op!==0){let t=Math.max(0,e-a),n=Math.min(l.length-1,e+a);h===-1?(h=t,g=n):t<=g+1?g=Math.max(g,n):(m.push({start:h,end:g}),h=t,g=n)}h!==-1&&m.push({start:h,end:g});let _=[`--- a/${e} (${r})`,`+++ b/${e} (${i})`];for(let e of m){let t=l.slice(e.start,e.end+1),n=t.filter(e=>e.op<=0).length,r=t.filter(e=>e.op>=0).length,i=t[0],a=n===0?0:i.oldNum,o=r===0?0:i.newNum;_.push(`@@ -${a},${n} +${o},${r} @@`);for(let e of t){let t=e.op===-1?`-`:e.op===1?`+`:` `;_.push(`${t}${e.text}`)}}return{diffText:_.join(`
6
- `),additions:f,deletions:p,hasChanges:!0}}function ue(e,t){try{let n=new Date(e);if(Number.isNaN(n.getTime()))return e;let r=new Date;return n.getFullYear()===r.getFullYear()&&n.getMonth()===r.getMonth()&&n.getDate()===r.getDate()?a(n,t,{hour:`2-digit`,minute:`2-digit`}):a(n,t,{month:`numeric`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})}catch{return e}}function de(e,t,n){if(e.label)return e.label;let r=ue(e.createdAt,n);if(e.changedPaths.length===1)return`${e.changedPaths[0].split(`/`).pop()||e.changedPaths[0]} (${r})`;if(e.changedPaths.length===2)return`${e.changedPaths[0].split(`/`).pop()||e.changedPaths[0]}, ${e.changedPaths[1].split(`/`).pop()||e.changedPaths[1]} (${r})`;if(e.changedPaths.length>2)return`${e.changedPaths[0].split(`/`).pop()||e.changedPaths[0]} +${e.changedPaths.length-1} (${r})`;let i=e.author?.name||e.author?.username;return i?`${i} @ ${r}`:`${t} (${r})`}function fe(e){if(!e)return!1;let t=C(e);return t===`text`||t===`other`}var M=n();function pe({open:e,projectId:t,onOpenChange:n,onSaved:r}){let{t:i}=te(),[a,o]=(0,E.useState)([]),[s,c]=(0,E.useState)(``),[l,u]=(0,E.useState)(``),[d,f]=(0,E.useState)(!1),[p,_]=(0,E.useState)(``),v=(0,E.useRef)(null),y=(0,E.useRef)(!1);(0,E.useEffect)(()=>{if(!e)return;let n=new AbortController;return v.current=n,o([]),c(``),u(``),f(!0),_(``),y.current=!1,g(`/api/projects/${t}/history/files`,{signal:n.signal}).then(e=>{n.signal.aborted||o(e.files)}).catch(e=>{n.signal.aborted||u(h(e))}).finally(()=>{n.signal.aborted||f(!1)}),()=>{n.abort(),v.current===n&&(v.current=null)}},[e,t]);let x=async(e,n)=>{let i=v.current;if(!(!i||i.signal.aborted||d||y.current)){y.current=!0,_(e),u(``);try{let a=await g(`/api/projects/${t}/history/files`,{method:`PATCH`,body:JSON.stringify({path:e,included:n}),signal:i.signal});if(i.signal.aborted)return;o(a.files),r()}catch(e){i.signal.aborted||u(h(e))}finally{i.signal.aborted||(y.current=!1,_(``))}}},ne=(0,E.useMemo)(()=>a.filter(e=>e.path.toLowerCase().includes(s.trim().toLowerCase())),[a,s]);return(0,M.jsx)(ee,{open:e,wide:!0,className:`history-tracking-modal`,title:i(`history.manageFiles`),description:i(`history.trackingDescription`),onOpenChange:n,footer:(0,M.jsx)(`button`,{type:`button`,onClick:()=>n(!1),children:i(`common.close`)}),children:(0,M.jsxs)(`div`,{className:`history-tracking`,children:[(0,M.jsx)(`p`,{className:`muted`,children:i(`history.trackingHint`)}),(0,M.jsxs)(`label`,{className:`history-tracking-search`,children:[(0,M.jsx)(m,{size:15,"aria-hidden":!0}),(0,M.jsx)(`input`,{value:s,onChange:e=>c(e.target.value),placeholder:i(`history.searchFiles`),"aria-label":i(`history.searchFiles`)})]}),l&&(0,M.jsx)(`p`,{className:`error`,role:`alert`,children:l}),d?(0,M.jsxs)(`p`,{className:`muted`,children:[(0,M.jsx)(b,{className:`spin`,size:15}),i(`common.loading`)]}):(0,M.jsxs)(`div`,{className:`history-tracking-grid`,"aria-busy":!!p,children:[ne.map(e=>{let t=e.path.lastIndexOf(`/`),n=e.path.slice(t+1),r=t<0?`./`:e.path.slice(0,t+1);return(0,M.jsxs)(`div`,{className:`history-tracking-card${e.included?` included`:``}${e.missing?` missing`:``}`,children:[(0,M.jsxs)(`label`,{children:[(0,M.jsx)(S,{path:e.path,size:21}),(0,M.jsxs)(`span`,{className:`history-tracking-path`,children:[(0,M.jsx)(`strong`,{title:e.path,children:n}),(0,M.jsx)(`small`,{title:r,children:r})]}),(0,M.jsx)(`input`,{type:`checkbox`,checked:e.included,disabled:!!p||e.missing,onChange:t=>void x(e.path,t.target.checked)})]}),(0,M.jsxs)(`div`,{className:`history-tracking-card-footer`,children:[(0,M.jsx)(`small`,{children:e.missing?i(`history.fileMissing`):e.override===null?e.defaultIncluded?i(`history.defaultTracked`):i(`history.defaultUntracked`):i(`history.customTracking`)}),p===e.path?(0,M.jsx)(b,{className:`spin`,size:14,"aria-label":i(`common.loading`)}):e.override!==null&&(0,M.jsx)(`button`,{type:`button`,disabled:!!p,onClick:()=>void x(e.path,null),title:i(`history.resetTracking`),"aria-label":i(`history.resetTracking`),children:(0,M.jsx)(ie,{size:14})})]})]},e.path)}),ne.length===0&&(0,M.jsx)(`p`,{className:`muted`,children:i(`history.noMatchingFiles`)})]})]})})}var me=100;function N({open:e,project:t,onOpenChange:n,onBeforeMutation:m}){let h=ne(),{t:v,i18n:x}=te(),[S,C]=(0,E.useState)([]),[w,T]=(0,E.useState)(null),[D,O]=(0,E.useState)(``),[k,A]=(0,E.useState)(null),[j,N]=(0,E.useState)(``),[L,R]=(0,E.useState)(null),[he,ge]=(0,E.useState)(0),[z,_e]=(0,E.useState)(`commit`),[ve,ye]=(0,E.useState)(11),[B,V]=(0,E.useState)(!1),[be,xe]=(0,E.useState)(``),[H,Se]=(0,E.useState)(null),[U,Ce]=(0,E.useState)(null),[W,G]=(0,E.useState)(``),[we,Te]=(0,E.useState)(null),[K,Ee]=(0,E.useState)(!1),[De,q]=(0,E.useState)(``),[Oe,ke]=(0,E.useState)(!1),[Ae,je]=(0,E.useState)(0),Me=(0,E.useRef)(null),J=(0,E.useRef)(null),Y=(0,E.useRef)(null),Ne=(0,E.useRef)(D),Pe=(0,E.useRef)(t.id),Fe=(0,E.useRef)(!1),X=(0,E.useRef)(null);Ne.current=D,Pe.current=t.id;let Ie=t.permission!==`read`,Le=t.permission===`owner`,Z=!!W||K;(0,E.useEffect)(()=>{if(h.clear(),!e){ke(!1),Y.current?.abort(),Y.current=null,X.current!==null&&window.clearTimeout(X.current),X.current=null,J.current?.abort(),J.current=null,Ee(!1),document.fullscreenElement&&document.exitFullscreen().catch(()=>void 0),V(!1);return}J.current?.abort(),J.current=null;let n=new AbortController;return G(`load`),q(``),R(null),Te(null),Ee(!1),g(`/api/projects/${t.id}/history?limit=${me}`,{signal:n.signal}).then(e=>{n.signal.aborted||(C(e.versions),T(e.stats),Te(e.nextCursor),O(t=>e.versions.some(e=>e.id===t)?t:e.versions[0]?.id??``))}).catch(e=>{I(e)||q(F(e))}).finally(()=>{n.signal.aborted||G(``)}),()=>n.abort()},[e,t.id,Ae]),(0,E.useEffect)(()=>()=>{J.current?.abort(),J.current=null,Y.current?.abort(),Y.current=null,X.current!==null&&window.clearTimeout(X.current)},[t.id]),(0,E.useEffect)(()=>{Y.current?.abort(),Y.current=null,h.clear()},[D]);let Re=async()=>{let e=we;if(!e||K||W)return;J.current?.abort();let n=new AbortController;J.current=n,Ee(!0),q(``);try{let r=new URLSearchParams({limit:String(me),before:e}),i=await g(`/api/projects/${t.id}/history?${r.toString()}`,{signal:n.signal});if(n.signal.aborted)return;C(e=>{let t=new Set(e.map(e=>e.id));return[...e,...i.versions.filter(e=>!t.has(e.id))]}),T(i.stats),Te(i.nextCursor)}catch(e){I(e)||q(F(e))}finally{J.current===n&&(J.current=null,Ee(!1))}};(0,E.useEffect)(()=>{let e=()=>V(document.fullscreenElement===Me.current);return document.addEventListener(`fullscreenchange`,e),()=>document.removeEventListener(`fullscreenchange`,e)},[]),(0,E.useEffect)(()=>{if(!B)return;let e=e=>{e.key===`Escape`&&!document.fullscreenElement&&V(!1)};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[B]),(0,E.useEffect)(()=>{if(!e||!D){A(null);return}let n=new AbortController;return G(`detail`),R(null),g(`/api/projects/${t.id}/history/${D}`,{signal:n.signal}).then(e=>{if(n.signal.aborted)return;A(e),xe(e.version.label??``);let t=e.version.changedPaths.find(t=>e.files.some(e=>e.path===t))??``;N(t)}).catch(e=>{!n.signal.aborted&&!I(e)&&q(F(e))}).finally(()=>{n.signal.aborted||G(e=>e===`detail`?``:e)}),()=>n.abort()},[e,t.id,D]);let Q=L?.previousVersion??null,ze=k?.files.find(e=>e.path===j),Be=ze?.textContent??fe(j),Ve=ze?.deleted===!0;(0,E.useEffect)(()=>{if(!e||!D||!j||!Be){Fe.current=!1,R(null),G(e=>e===`compare`?``:e);return}let n=new AbortController;R(null),G(`compare`);let r=Fe.current;Fe.current=!1,r||q(``);let i=z===`commit`?`&against=__previous__`:``;return g(`/api/projects/${t.id}/history/${D}/file?path=${encodeURIComponent(j)}${i}`,{signal:n.signal}).then(e=>{n.signal.aborted||R(e)}).catch(e=>{!n.signal.aborted&&!I(e)&&q(F(e))}).finally(()=>{n.signal.aborted||G(e=>e===`compare`?``:e)}),()=>n.abort()},[e,t.id,D,j,Be,z,he]);let $=(0,E.useMemo)(()=>{if(!k)return[];let e=new Set(k.version.changedPaths);return k.files.filter(t=>e.has(t.path))},[k]);(0,E.useEffect)(()=>{$.length>0&&!$.some(e=>e.path===j)?N($[0].path):$.length===0&&j&&N(``)},[$,j]);let He=async()=>{if(B){document.fullscreenElement&&await document.exitFullscreen().catch(()=>void 0),V(!1);return}let e=Me.current;if(e?.requestFullscreen)try{await e.requestFullscreen()}catch{}V(!0)},Ue=async(e,n=!1)=>{let r=t.id;Y.current?.abort();let i=new AbortController;Y.current=i;try{let t=await g(`/api/projects/${r}/history/${e}`,{signal:i.signal});return i.signal.aborted||Pe.current!==r||Ne.current!==e?!1:(A(t),xe(t.version.label??``),N(e=>e&&t.files.some(t=>t.path===e)?e:t.version.changedPaths.find(e=>t.files.some(t=>t.path===e))??``),R(null),n&&(Fe.current=!0),ge(e=>e+1),C(e=>e.map(e=>e.id===t.version.id?t.version:e)),!0)}finally{Y.current===i&&(Y.current=null)}},We=async()=>{if(k){G(`label`),q(``),h.clear();try{let e=await g(`/api/projects/${t.id}/history/${k.version.id}`,{method:`PATCH`,body:JSON.stringify({label:be.trim()||null,snapshotHash:k.version.snapshotHash})});A(t=>t&&{...t,version:e.version}),C(t=>t.map(t=>t.id===e.version.id?e.version:t)),T(e.stats),h.show(v(`common.saveSuccess`)),e.retentionScheduled&&(X.current!==null&&window.clearTimeout(X.current),X.current=window.setTimeout(()=>{X.current=null,g(`/api/projects/${t.id}/history?limit=1`).then(e=>{T(e.stats)}).catch(()=>void 0)},e.retentionRefreshAfterMs))}catch(e){if(e instanceof _&&e.code===`HISTORY_VERSION_CHANGED`)try{if(!await Ue(k.version.id,!0))return}catch(e){if(I(e))return;q(F(e));return}q(F(e))}finally{G(``)}}},Ge=async()=>{let e=U;if(e){Ce(null),G(`delete`),q(``);try{if(!await m())throw Error(v(`errors.collaborationUnavailable`));let n=e===`all`?`/api/projects/${t.id}/history`:`/api/projects/${t.id}/history/${e.id}`,r=await g(n,{method:`DELETE`});if(T(r.stats),e===`all`)C([]),O(``),A(null),R(null),Te(null);else{let t=S.filter(t=>t.id!==e.id);C(t),D===e.id&&(O(t[0]?.id??``),A(null),R(null))}}catch(e){q(F(e))}finally{G(``)}}},Ke=async()=>{let e=H;if(e&&k){Se(null),G(`restore`),q(``);try{if(!await m())throw Error(v(`errors.collaborationUnavailable`));await g(`/api/projects/${t.id}/history/${k.version.id}/restore`,{method:`POST`,body:JSON.stringify(e===`project`?{snapshotHash:k.version.snapshotHash}:{path:e,snapshotHash:k.version.snapshotHash})}),window.location.reload()}catch(e){if(e instanceof _&&e.code===`HISTORY_VERSION_CHANGED`)try{if(!await Ue(k.version.id,!0)){G(``);return}}catch(e){if(I(e)){G(``);return}q(F(e)),G(``);return}q(F(e)),G(``)}}},qe=k?.version.author?.name||k?.version.author?.username||(k?.version.reason===`autosave`?v(`history.reasons.autosave`):v(`editor.deletedUser`)),Je=k?ue(k.version.createdAt,x.resolvedLanguage):``,Ye=(0,E.useMemo)(()=>{if(!L||!k)return{diffText:``,additions:0,deletions:0,hasChanges:!1};if(z===`commit`){let e=L.comparison,t=L.historical,n=Q?`${Q.label||v(`history.reasons.${Q.reason}`)} (${ue(Q.createdAt,x.resolvedLanguage)})`:`/dev/null`,r=`${k.version.label||v(`history.reasons.${k.version.reason}`)} (${Je})`;return le(L.path,e,t,n,r)}{let e=L.historical,t=L.comparison,n=`${k.version.label||v(`history.reasons.${k.version.reason}`)} (${Je})`,r=v(`history.currentVersion`);return le(L.path,e,t,n,r)}},[L,k,z,Q,Je,v,x.resolvedLanguage]),Xe=k?v(`history.reasons.${k.version.reason}`):``,Ze=k?de(k.version,Xe,x.resolvedLanguage):``,Qe=U&&U!==`all`?de(U,v(`history.reasons.${U.reason}`),x.resolvedLanguage):``,$e=Ie&&k?(0,M.jsxs)(`button`,{type:`button`,className:`history-restore-project`,disabled:Z,title:v(`history.restoreProjectTitle`),onClick:()=>Se(`project`),children:[(0,M.jsx)(ie,{size:14}),v(`history.restoreProject`)]}):null;return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(ee,{open:e,extraWide:!0,draggable:!0,className:`history-dialog-modal`,title:v(`history.projectSnapshots`),description:v(`history.description`),onOpenChange:n,footer:(0,M.jsxs)(M.Fragment,{children:[Ie&&(0,M.jsxs)(`button`,{type:`button`,className:`history-manage-files`,disabled:Z,onClick:()=>ke(!0),children:[(0,M.jsx)(se,{size:15,"aria-hidden":!0}),(0,M.jsx)(`span`,{children:v(`history.manageFiles`)})]}),(0,M.jsx)(`button`,{type:`button`,className:`history-close`,onClick:()=>n(!1),children:v(`common.close`)})]}),children:(0,M.jsxs)(`div`,{className:`history-dialog`,children:[(0,M.jsx)(re,{message:h.message,onDismiss:h.clear}),De&&(0,M.jsx)(`p`,{className:`error history-message`,children:De}),W===`load`&&S.length===0?(0,M.jsxs)(`div`,{className:`history-loading`,children:[(0,M.jsx)(b,{className:`spin`,size:22}),v(`common.loading`)]}):(0,M.jsxs)(`div`,{className:`history-dialog-layout`,children:[(0,M.jsxs)(`aside`,{className:`history-timeline`,children:[Le&&w&&(0,M.jsxs)(`div`,{className:`history-stats${w.storageLimitExceeded?` exceeded`:``}`,children:[(0,M.jsxs)(`header`,{children:[(0,M.jsxs)(`span`,{children:[(0,M.jsx)(l,{size:14}),v(`history.storage`)]}),(0,M.jsx)(`button`,{type:`button`,disabled:Z||S.length===0,title:v(`history.clearAll`),"aria-label":v(`history.clearAll`),onClick:()=>Ce(`all`),children:(0,M.jsx)(o,{size:13})})]}),(0,M.jsx)(`strong`,{children:v(`history.storageUsage`,{used:P(w.totalBytes),limit:P(w.maxStorageBytes)})}),(0,M.jsx)(`progress`,{max:w.maxStorageBytes,value:Math.min(w.totalBytes,w.maxStorageBytes)}),(0,M.jsx)(`small`,{children:v(`history.storageBreakdown`,{objects:P(w.objectBytes),metadata:P(w.metadataBytes),protected:P(w.protectedBytes)})}),(0,M.jsxs)(`small`,{children:[v(`history.versionUsage`,{count:w.maxVersions,versions:w.ordinaryVersionCount,limit:w.maxVersions>0?w.maxVersions:`∞`}),w.labeledVersionCount>0?` · ${v(`history.protectedVersions`,{count:w.labeledVersionCount})}`:``]}),w.storageLimitExceeded&&(0,M.jsx)(`small`,{className:`history-storage-warning`,children:v(`history.storageExceeded`)})]}),S.map(e=>{let t=v(`history.reasons.${e.reason}`),n=de(e,t,x.resolvedLanguage),r=e.author?.name||e.author?.username||(e.reason===`autosave`?v(`history.reasons.autosave`):v(`editor.deletedUser`));return(0,M.jsxs)(`button`,{className:e.id===D?`active`:``,onClick:()=>O(e.id),children:[(0,M.jsx)(ae,{size:15}),(0,M.jsxs)(`span`,{children:[(0,M.jsxs)(`div`,{className:`history-item-heading`,children:[(0,M.jsx)(`strong`,{title:n,children:n}),(0,M.jsx)(`span`,{className:`history-reason-badge reason-${e.reason}`,children:t})]}),(0,M.jsx)(`small`,{children:a(e.createdAt,x.resolvedLanguage)}),(0,M.jsxs)(`small`,{children:[(0,M.jsx)(`span`,{className:`history-author-name`,"data-tooltip":e.author?.username?`@${e.author.username}`:void 0,"data-texlite-tooltip-always":!0,children:r}),` · `,v(`history.changedCount`,{count:e.changedPaths.length})]})]})]},e.id)}),we&&(0,M.jsx)(`div`,{className:`history-load-more`,children:(0,M.jsxs)(`button`,{type:`button`,disabled:Z,"aria-busy":K,onClick:()=>void Re(),children:[K?(0,M.jsx)(b,{className:`spin`,size:13}):(0,M.jsx)(c,{size:13}),v(K?`common.loading`:`history.loadOlder`)]})}),S.length===0&&(0,M.jsx)(`p`,{className:`muted padded`,children:v(`history.empty`)})]}),(0,M.jsx)(`section`,{className:`history-detail`,children:k&&(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(`header`,{className:`history-detail-header`,children:[(0,M.jsxs)(`div`,{children:[(0,M.jsxs)(`div`,{className:`history-detail-title-row`,children:[(0,M.jsx)(`strong`,{title:Ze,children:Ze}),(0,M.jsx)(`span`,{className:`history-reason-badge reason-${k.version.reason}`,children:Xe})]}),(0,M.jsxs)(`div`,{className:`history-snapshot-meta`,children:[(0,M.jsxs)(`span`,{className:`history-snapshot-time`,children:[(0,M.jsx)(c,{size:12,"aria-hidden":!0}),(0,M.jsx)(`time`,{dateTime:k.version.createdAt,title:a(k.version.createdAt,x.resolvedLanguage),children:a(k.version.createdAt,x.resolvedLanguage,{year:`numeric`,month:`numeric`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})})]}),k.version.author?(0,M.jsxs)(`span`,{className:`history-snapshot-attribution`,children:[(0,M.jsx)(`span`,{children:v(`history.lastChangedBy`)}),(0,M.jsx)(`strong`,{children:qe})]}):(0,M.jsx)(`span`,{className:`history-snapshot-origin`,children:Xe}),(0,M.jsxs)(`span`,{className:`history-snapshot-file-count`,children:[(0,M.jsx)(i,{size:12,"aria-hidden":!0}),v(`history.fileCount`,{count:k.version.fileCount})]})]})]}),!Le&&$e]}),Le&&(0,M.jsxs)(`div`,{className:`history-snapshot-actions`,children:[(0,M.jsxs)(`button`,{type:`button`,className:`history-delete-action`,disabled:Z,title:v(`history.deleteVersionTitle`),onClick:()=>Ce(k.version),children:[(0,M.jsx)(o,{size:14}),v(`history.deleteVersion`)]}),$e]}),Ie&&(0,M.jsxs)(`div`,{className:`history-label`,children:[(0,M.jsxs)(`label`,{children:[(0,M.jsx)(ce,{size:14}),(0,M.jsx)(`input`,{value:be,maxLength:80,"aria-label":v(`history.labelPlaceholder`),placeholder:v(`history.labelPlaceholder`),onChange:e=>xe(e.target.value)})]}),(0,M.jsxs)(`button`,{type:`button`,className:`history-label-save`,disabled:Z||be.trim()===(k.version.label??``),"aria-busy":W===`label`,onClick:()=>void We(),children:[W===`label`?(0,M.jsx)(b,{className:`spin`,size:13}):(0,M.jsx)(oe,{size:13}),(0,M.jsx)(`span`,{children:v(`history.saveLabel`)})]})]}),(0,M.jsxs)(`div`,{className:`history-files`,children:[(0,M.jsx)(`div`,{className:`history-files-toolbar`,children:(0,M.jsxs)(`div`,{className:`history-files-heading`,children:[(0,M.jsx)(r,{size:13}),(0,M.jsx)(`span`,{children:v(`history.changedFilesHeading`,{count:$.length})})]})}),$.length>0?(0,M.jsxs)(`div`,{className:`history-file-tabs-row`,children:[(0,M.jsx)(`div`,{className:`history-file-list`,children:$.map(e=>(0,M.jsxs)(`button`,{type:`button`,className:e.path===j?`active`:``,title:e.path,onClick:()=>N(e.path),children:[(0,M.jsx)(i,{size:13}),(0,M.jsx)(`span`,{children:e.path})]},e.path))}),Ie&&(0,M.jsx)(`div`,{className:`history-file-actions`,children:(0,M.jsxs)(`button`,{type:`button`,disabled:!j||Ve||Z,title:v(`history.restoreFileTitle`),onClick:()=>Se(j),children:[(0,M.jsx)(ie,{size:13}),v(`history.restoreFile`)]})})]}):(0,M.jsx)(`p`,{className:`muted padded-small`,children:v(`history.noChangedFiles`)})]}),j&&!Be?(0,M.jsxs)(`p`,{className:`history-attachment-change`,children:[(0,M.jsx)(i,{size:14}),(0,M.jsx)(`span`,{children:v(Ve?`history.nonTextFileDeleted`:`history.nonTextFileChanged`,{path:j})})]}):(0,M.jsx)(`div`,{ref:Me,className:`history-comparison${B?` is-fullscreen`:``}`,children:j?(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(`header`,{children:[(0,M.jsxs)(`div`,{className:`history-comparison-meta`,children:[(0,M.jsx)(`strong`,{children:j}),(0,M.jsxs)(`small`,{className:`history-commit-summary`,children:[z===`commit`?(0,M.jsx)(`span`,{children:v(Q?`history.changedAt`:`history.createdAt`,{time:Je})}):(0,M.jsx)(`span`,{children:v(`history.comparingCurrent`)}),Ye.hasChanges&&(0,M.jsxs)(`span`,{className:`history-diff-stats`,children:[(0,M.jsxs)(`span`,{className:`addition`,children:[`+`,Ye.additions]}),` `,(0,M.jsxs)(`span`,{className:`deletion`,children:[`-`,Ye.deletions]})]})]})]}),(0,M.jsxs)(`div`,{className:`history-diff-controls`,children:[(0,M.jsx)(`div`,{className:`history-diff-control-group`,children:(0,M.jsxs)(`div`,{className:`history-mode-toggle`,role:`group`,"aria-label":v(`history.diffMode`),children:[(0,M.jsx)(`button`,{type:`button`,className:z===`commit`?`active`:``,"aria-pressed":z===`commit`,onClick:()=>_e(`commit`),title:v(`history.diffModeCommitHint`),children:(0,M.jsx)(`span`,{children:v(`history.diffModeCommit`)})}),(0,M.jsx)(`button`,{type:`button`,className:z===`current`?`active`:``,"aria-pressed":z===`current`,onClick:()=>_e(`current`),title:v(`history.diffModeCurrentHint`),children:(0,M.jsx)(`span`,{children:v(`history.diffModeCurrent`)})})]})}),(0,M.jsx)(`span`,{className:`history-diff-control-divider`,"aria-hidden":`true`}),(0,M.jsx)(`div`,{className:`history-diff-control-group`,children:(0,M.jsxs)(`div`,{className:`git-diff-font-controls`,role:`group`,"aria-label":v(`git.diffFontSize`),children:[(0,M.jsx)(`button`,{type:`button`,className:`git-diff-font-button`,disabled:ve<=8,title:v(`git.diffFontDecrease`),"aria-label":v(`git.diffFontDecrease`),onClick:()=>ye(e=>Math.max(8,e-1)),children:(0,M.jsx)(d,{size:14})}),(0,M.jsxs)(`span`,{className:`git-diff-font-value`,"aria-live":`polite`,children:[ve,`px`]}),(0,M.jsx)(`button`,{type:`button`,className:`git-diff-font-button`,disabled:ve>=24,title:v(`git.diffFontIncrease`),"aria-label":v(`git.diffFontIncrease`),onClick:()=>ye(e=>Math.min(24,e+1)),children:(0,M.jsx)(p,{size:14})})]})}),(0,M.jsx)(`span`,{className:`history-diff-control-divider`,"aria-hidden":`true`}),(0,M.jsx)(`div`,{className:`history-diff-control-group`,children:(0,M.jsx)(`button`,{type:`button`,className:`git-diff-fullscreen`,title:v(B?`git.exitFullscreenDiff`:`git.fullscreenDiff`),"aria-label":v(B?`git.exitFullscreenDiff`:`git.fullscreenDiff`),onClick:()=>void He(),children:B?(0,M.jsx)(f,{size:15}):(0,M.jsx)(u,{size:15})})})]})]}),W===`compare`&&!L?(0,M.jsxs)(`div`,{className:`history-comparison-empty`,children:[(0,M.jsx)(b,{className:`spin`,size:24}),(0,M.jsx)(`span`,{children:v(`common.loading`)})]}):L?Ye.hasChanges?(0,M.jsx)(`pre`,{className:`git-diff history-git-diff`,style:{fontSize:`${ve}px`},children:Ye.diffText.split(`
7
- `).map((e,t)=>{let n=e.startsWith(`+`)&&!e.startsWith(`+++`)?`addition`:e.startsWith(`-`)&&!e.startsWith(`---`)?`deletion`:e.startsWith(`@@`)?`hunk`:e.startsWith(`diff `)||e.startsWith(`---`)||e.startsWith(`+++`)?`header`:``;return(0,M.jsxs)(`span`,{className:n,children:[e,`
8
- `]},t)})}):(0,M.jsxs)(`div`,{className:`git-diff-empty history-diff-empty`,children:[(0,M.jsx)(s,{size:24}),(0,M.jsx)(`span`,{children:v(z===`commit`?`history.noDifferencesInCommit`:`history.noDifferences`)})]}):(0,M.jsxs)(`div`,{className:`history-comparison-empty`,children:[(0,M.jsx)(i,{size:24}),(0,M.jsx)(`span`,{children:v(`apiErrors.historyPreviewUnsupported`)})]})]}):(0,M.jsxs)(`div`,{className:`history-comparison-empty`,children:[(0,M.jsx)(ae,{size:25}),(0,M.jsx)(`span`,{children:$.length===0?v(`history.noChangedFiles`):v(`history.chooseFile`)})]})})]})})]})]})}),(0,M.jsx)(pe,{open:e&&Oe,projectId:t.id,onOpenChange:ke,onSaved:()=>{je(e=>e+1),ge(e=>e+1)}}),(0,M.jsx)(y,{open:!!H,title:v(H===`project`?`history.restoreProjectTitle`:`history.restoreFileTitle`),description:H===`project`?v(k?.scoped?`history.restoreTrackedDescription`:`history.restoreProjectDescription`):v(`history.restoreFileDescription`,{path:H??``}),confirmLabel:v(`history.restore`),danger:!0,onCancel:()=>Se(null),onConfirm:()=>void Ke()}),(0,M.jsx)(y,{open:!!U,title:v(U===`all`?`history.clearAllTitle`:`history.deleteVersionTitle`),description:U===`all`?v(`history.clearAllDescription`):v(`history.deleteVersionDescription`,{name:Qe}),confirmLabel:v(U===`all`?`history.clearAll`:`history.deleteVersion`),danger:!0,onCancel:()=>Ce(null),onConfirm:()=>void Ge()})]})}function P(e){return e<1024?`${e} B`:e<1048576?`${Math.round(e/102.4)/10} KB`:e<1073741824?`${Math.round(e/1048576*10)/10} MB`:`${Math.round(e/1073741824*10)/10} GB`}function F(e){return e instanceof Error?e.message:String(e)}function I(e){return e instanceof Error&&e.name===`AbortError`}export{N as HistoryDialog};
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,t as n}from"./react-DUEFWlB7.js";import{t as r}from"./search-Cy8DgYGb.js";import{C as i,c as a,j as o}from"./index-h0BVkT8k.js";import{a as s,i as c,n as l,o as u,r as d}from"./Dashboard-Dzq1oMZU.js";var f=e(t(),1),p=n();function m(e){return e.trim().toLocaleLowerCase()}function h({project:e,open:t,onOpenChange:n,onSave:h}){let{t:g,i18n:_}=o(),[v,y]=(0,f.useState)(``),[b,x]=(0,f.useState)(null),[S,C]=(0,f.useState)(``),[w,T]=(0,f.useState)(!1),[E,D]=(0,f.useState)(``);(0,f.useEffect)(()=>{t&&(y(``),x(e?.icon??null),C(e?.icon&&!s(e.icon)?e.icon:``),T(!1),D(``))},[t,e?.id,e?.icon]);let O=(0,f.useMemo)(()=>{let e=m(v);return e?d.filter(({name:t})=>[t,g(`projectIcons.icons.${t}.name`),g(`projectIcons.icons.${t}.keywords`)].some(t=>m(t).includes(e))):d},[_.resolvedLanguage,v,g]),k=async()=>{if(e&&!w){T(!0),D(``);try{await h(e.id,b),n(!1)}catch(e){D(i(e))}finally{T(!1)}}},A=b!==(e?.icon??null),j=e=>{x(e),C(``)},M=e=>{C(e);let t=e.trim();x(t?u(t)??t:null)};return(0,p.jsx)(a,{open:t,wide:!0,className:`project-icon-picker-modal`,title:g(`projectIcons.title`),description:e?g(`projectIcons.description`,{project:e.name}):void 0,onOpenChange:e=>{w||n(e)},footer:(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(`button`,{type:`button`,disabled:w,onClick:()=>n(!1),children:g(`common.cancel`)}),(0,p.jsx)(`button`,{type:`button`,className:`primary`,disabled:w||!A,"aria-busy":w,onClick:()=>void k(),children:g(`projectIcons.save`)})]}),children:(0,p.jsxs)(`div`,{className:`project-icon-picker`,children:[E&&(0,p.jsx)(`p`,{className:`error dialog-error`,role:`alert`,children:E}),(0,p.jsxs)(`label`,{className:`project-icon-search`,children:[(0,p.jsx)(r,{"aria-hidden":`true`,size:16}),(0,p.jsx)(`span`,{className:`sr-only`,children:g(`projectIcons.search`)}),(0,p.jsx)(`input`,{autoFocus:!0,value:v,placeholder:g(`projectIcons.search`),onChange:e=>y(e.target.value)})]}),(0,p.jsxs)(`div`,{className:`project-icon-options`,"aria-label":g(`projectIcons.title`),children:[(0,p.jsxs)(`button`,{type:`button`,"aria-pressed":b===null,className:`project-icon-option project-icon-reset${b===null?` selected`:``}`,title:g(`projectIcons.useInitial`),onClick:()=>j(null),children:[(0,p.jsx)(`span`,{className:`project-icon-option-glyph`,children:(0,p.jsx)(l,{fallback:c(e?.name??``)})}),(0,p.jsx)(`span`,{children:g(`projectIcons.useInitial`)})]}),O.map(({name:e})=>(0,p.jsxs)(`button`,{type:`button`,"aria-pressed":b===e,className:`project-icon-option${b===e?` selected`:``}`,title:g(`projectIcons.icons.${e}.name`),onClick:()=>j(e),children:[(0,p.jsx)(`span`,{className:`project-icon-option-glyph`,children:(0,p.jsx)(l,{icon:e,fallback:`?`})}),(0,p.jsx)(`span`,{children:g(`projectIcons.icons.${e}.name`)})]},e))]}),O.length===0&&(0,p.jsx)(`p`,{className:`project-icon-picker-empty`,children:g(`projectIcons.noMatches`,{query:v})}),(0,p.jsxs)(`div`,{className:`project-icon-advanced`,children:[(0,p.jsx)(`label`,{htmlFor:`project-icon-advanced-name`,children:g(`projectIcons.advancedName`)}),(0,p.jsxs)(`div`,{className:`project-icon-advanced-input`,children:[(0,p.jsx)(`input`,{id:`project-icon-advanced-name`,value:S,placeholder:g(`projectIcons.advancedNamePlaceholder`),onChange:e=>M(e.target.value),spellCheck:!1,autoCapitalize:`off`,autoCorrect:`off`}),S.trim()&&(0,p.jsx)(`span`,{className:`project-icon-advanced-preview`,"aria-label":g(`projectIcons.advancedPreview`),children:(0,p.jsx)(l,{icon:b,fallback:`?`})})]}),(0,p.jsxs)(`p`,{children:[g(`projectIcons.advancedNameDescription`),` `,(0,p.jsx)(`a`,{href:`https://lucide.dev/icons/`,target:`_blank`,rel:`noreferrer`,children:g(`projectIcons.browse`)})]})]})]})})}export{h as ProjectIconPickerDialog};
@@ -1,4 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,t as n}from"./react-DUEFWlB7.js";import{C as r,H as i,V as a,W as o,b as s}from"./relativeTime-Cf5dzFc9.js";import{t as ee}from"./circle-check-CfK-oqlC.js";import{t as c}from"./eye-DpIOhQ2p.js";import{t as l}from"./refresh-cw-c6Tzy-hb.js";import{n as te,t as ne}from"./terminal-DaAc1558.js";import{t as re}from"./type-Cm3TiSO6.js";import{C as u,E as d,b as f,j as p,y as m}from"./index-h0BVkT8k.js";import{n as ie,t as ae}from"./SuccessNotice-C8XV7MAJ.js";import{a as h,c as g,i as _,n as oe,o as se,r as v,s as ce,t as le}from"./terminalPreferences-CgacIg2F.js";import{R as ue,i as y,n as de,r as fe,w as pe,z as b}from"./ProjectWorkspace-BnT5JPTA.js";var x={name:`chevrons-left`,size:24,node:[[`path`,{d:`m11 17-5-5 5-5`,key:`13zhaf`}],[`path`,{d:`m18 17-5-5 5-5`,key:`h8a8et`}]]};x.node;var me=f(x),S={name:`chevrons-right`,size:24,node:[[`path`,{d:`m6 17 5-5-5-5`,key:`xnjwq`}],[`path`,{d:`m13 17 5-5-5-5`,key:`17xmmf`}]]};S.node;var he=f(S),C={name:`circle-alert`,size:24,node:[[`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`}]],aliases:[`alert-circle`]};C.node;var ge=f(C),w={name:`file-check-corner`,size:24,node:[[`path`,{d:`M10.5 22H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v6`,key:`g5mvt7`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`m14 20 2 2 4-4`,key:`15kota`}]],aliases:[`file-check-2`]};w.node;var _e=f(w),T={name:`message-circle-question-mark`,size:24,node:[[`path`,{d:`M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719`,key:`1sd12s`}],[`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`}]],aliases:[`message-circle-question`]};T.node;var ve=f(T),E={name:`panels-top-left`,size:24,node:[[`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`}]],aliases:[`layout`]};E.node;var ye=f(E),D={name:`spell-check-2`,size:24,node:[[`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`}]]};D.node;var be=f(D),O={name:`text-align-start`,size:24,node:[[`path`,{d:`M21 5H3`,key:`1fi0y6`}],[`path`,{d:`M15 12H3`,key:`6jk70r`}],[`path`,{d:`M17 19H3`,key:`z6ezky`}]],aliases:[`text`,`align-left`]};O.node;var xe=f(O),k={name:`text-wrap`,size:24,node:[[`path`,{d:`m16 16-3 3 3 3`,key:`117b85`}],[`path`,{d:`M3 12h14.5a1 1 0 0 1 0 7H13`,key:`18xa6z`}],[`path`,{d:`M3 19h6`,key:`1ygdsz`}],[`path`,{d:`M3 5h18`,key:`1u36vt`}]],aliases:[`wrap-text`]};k.node;var Se=f(k),A=e(t(),1);function Ce(e,t){let n=e.filter(e=>e.type===`file`&&[`latexmkrc`,`.latexmkrc`].includes(e.path.split(`/`).at(-1)??``)).map(e=>e.path);t&&e.some(e=>e.type===`file`&&e.path===t)&&!n.includes(t)&&n.push(t);let r=e=>e===`latexmkrc`?0:e===`.latexmkrc`?1:e.includes(`/`)?3:2;return n.sort((e,t)=>r(e)-r(t)||e.localeCompare(t))}var j=[{id:`texlive`,name:`TeX Live`},{id:`pdflatex`,name:`pdfLaTeX`},{id:`xelatex`,name:`XeLaTeX`},{id:`lualatex`,name:`LuaLaTeX`},{id:`latexmk`,name:`latexmk`},{id:`bibtex`,name:`BibTeX`},{id:`biber`,name:`Biber`},{id:`texcount`,name:`TeXcount`},{id:`chktex`,name:`ChkTeX`}],M=n();function we(){let{t:e}=p(),[t,n]=(0,A.useState)(!1);return t?(0,M.jsx)(N,{}):(0,M.jsx)(`div`,{className:`compiler-versions`,children:(0,M.jsxs)(`button`,{type:`button`,className:`compiler-versions-toggle`,onClick:()=>n(!0),children:[(0,M.jsx)(c,{size:14,"aria-hidden":`true`}),e(`projectSettings.showSoftwareVersions`)]})})}function N(){let{t:e}=p(),t=(0,A.useId)(),[n,r]=(0,A.useState)(null);(0,A.useEffect)(()=>{let e=new AbortController;return d(`/api/compiler/versions`,{signal:e.signal}).then(t=>{e.signal.aborted||r(t)}).catch(()=>{e.signal.aborted||r({tools:[]})}),()=>e.abort()},[]);let i=new Map(n?.tools.map(e=>[e.id,e.version]));return(0,M.jsxs)(`section`,{className:`compiler-versions`,"aria-labelledby":t,"aria-busy":n===null,children:[(0,M.jsxs)(`h3`,{id:t,children:[e(`projectSettings.softwareVersions`),n===null&&(0,M.jsx)(m,{size:13,className:`spin`,"aria-label":e(`common.loading`)})]}),(0,M.jsx)(`dl`,{children:j.map(({id:t,name:r})=>(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`dt`,{children:r}),(0,M.jsx)(`dd`,{className:i.get(t)?``:`compiler-version-unknown`,children:n===null?`—`:i.get(t)??e(`projectSettings.unknownVersion`)})]},t))})]})}function Te({preferences:e,onChange:t,onSave:n}){let{t:r}=p();return(0,M.jsxs)(`section`,{id:`settings-panel-terminal`,role:`tabpanel`,"aria-labelledby":`settings-tab-terminal`,children:[(0,M.jsxs)(`div`,{className:`settings-section-title`,children:[(0,M.jsx)(ne,{size:15}),(0,M.jsx)(`strong`,{children:r(`projectSettings.terminalTab`)})]}),(0,M.jsx)(`p`,{className:`settings-description appearance-description`,children:r(`projectSettings.terminalDescription`)}),(0,M.jsxs)(`label`,{children:[r(`projectSettings.terminalTheme`),(0,M.jsx)(`select`,{value:e.theme,onChange:n=>t({...e,theme:n.target.value}),children:Object.entries(g).map(([e,t])=>(0,M.jsx)(`option`,{value:e,children:r(t.labelKey)},e))})]}),(0,M.jsxs)(`label`,{children:[r(`projectSettings.terminalFont`),(0,M.jsx)(`select`,{value:e.font,onChange:n=>t({...e,font:n.target.value}),children:_.map(e=>(0,M.jsx)(`option`,{value:e.id,children:r(e.labelKey)},e.id))})]}),(0,M.jsxs)(`label`,{children:[r(`projectSettings.fontSize`),(0,M.jsx)(`select`,{value:e.fontSize,onChange:n=>t({...e,fontSize:Number(n.target.value)}),children:oe.map(e=>(0,M.jsxs)(`option`,{value:e,children:[e,` px`]},e))})]}),(0,M.jsxs)(`pre`,{className:`terminal-appearance-preview`,"aria-label":r(`projectSettings.terminalPreview`),style:{...ce(e.theme),fontFamily:v(e.font),fontSize:e.fontSize,lineHeight:h},children:[(0,M.jsx)(`span`,{className:`terminal-preview-directory`,children:`~/paper`}),(0,M.jsx)(`span`,{className:`terminal-preview-muted`,children:` on `}),(0,M.jsx)(`span`,{className:`terminal-preview-branch`,children:`main`}),`
2
- `,(0,M.jsx)(`span`,{className:`terminal-preview-prompt`,children:`❯`}),` codex
3
- Aa Bb 0 O 1 l I
4
- → main.tex [1/2] ✓`]}),(0,M.jsx)(`div`,{className:`settings-actions`,children:(0,M.jsxs)(`button`,{className:`settings-save`,onClick:n,children:[(0,M.jsx)(b,{size:15}),r(`projectSettings.saveTerminal`)]})})]})}function Ee({name:e,state:t,label:n,reloadLabel:r,onReload:i,compact:a=!1}){let o=t.status===`loading`?(0,M.jsx)(m,{className:`spin`,size:14}):t.status===`working`?(0,M.jsx)(ee,{size:14}):(0,M.jsx)(ge,{size:14}),s=(0,M.jsxs)(M.Fragment,{children:[o,(0,M.jsx)(`strong`,{children:e}),(0,M.jsx)(`span`,{children:n}),t.status===`error`&&(0,M.jsxs)(`button`,{type:`button`,className:`browser-tool-reload`,title:r,"aria-label":r,onClick:i,children:[(0,M.jsx)(l,{size:12}),r]})]});return a?(0,M.jsxs)(`span`,{className:`browser-tool-status compact ${t.status}`,role:`status`,"aria-live":`polite`,"aria-label":`${e}: ${n}`,title:t.error||void 0,children:[o,(0,M.jsx)(`span`,{children:n}),t.status===`error`&&(0,M.jsx)(`button`,{type:`button`,className:`browser-tool-reload`,title:r,"aria-label":r,onClick:i,children:(0,M.jsx)(l,{size:12})})]}):(0,M.jsx)(`div`,{className:`browser-tool-status ${t.status}`,title:t.error||void 0,children:s})}function P({onClose:e,project:t,projectId:n,site:c,files:f,dictionaryWords:h,onDictionaryChange:g,editorPreferences:_,onEditorPreferences:oe,spellCheckCount:v,spellCheckUniqueCount:ce,spellCheckIndex:x,onSpellCheckNavigate:S,onProject:C}){let{t:w}=p(),[T,E]=(0,A.useState)(t.engine),[D,O]=(0,A.useState)(!!t.latexmkrc),[k,j]=(0,A.useState)(t.name),[N,P]=(0,A.useState)(t.mainFile),[F,De]=(0,A.useState)(t.chktexEnabled),[I,Oe]=(0,A.useState)(!1),L=(0,A.useRef)(null),R=(0,A.useRef)(!0),ke=(0,A.useRef)({name:t.name,mainFile:t.mainFile,engine:t.engine,latexmkrc:t.latexmkrc,chktexEnabled:t.chktexEnabled}),[z,Ae]=(0,A.useState)(null),[je,B]=(0,A.useState)(``),V=ie(),[H,Me]=(0,A.useState)(``),[Ne,U]=(0,A.useState)(``),[W,G]=(0,A.useState)(`checking`),[Pe,Fe]=(0,A.useState)(0),[K,q]=(0,A.useState)(`appearance`),[J,Y]=(0,A.useState)(_),X=se(),[Ie,Le]=(0,A.useState)(X),Re=(0,A.useSyncExternalStore)(y.subscribe,y.getSnapshot,y.getSnapshot),Z=t.permission===`owner`,Q=t.permission!==`read`,ze=t.permission!==`read`;(0,A.useEffect)(()=>Y(_),[_]),(0,A.useEffect)(()=>Le(X),[X]),(0,A.useEffect)(()=>(R.current=!0,()=>{R.current=!1}),[]),(0,A.useEffect)(()=>{de().catch(y.failed)},[n]),(0,A.useEffect)(()=>{let e=new AbortController;return G(`checking`),d(`/api/projects/${n}/spellcheck/status`,{signal:e.signal}).then(t=>{e.signal.aborted||G(t.available?`available`:`unavailable`)}).catch(()=>{e.signal.aborted||G(`error`)}),()=>e.abort()},[n,Pe]);let Be=()=>{fe().catch(y.failed)},$=Ce(f,t.latexmkrc),Ve=t.latexmkrc&&$.includes(t.latexmkrc)?t.latexmkrc:$[0]??``,He=f.length>0&&t.latexmkrc!==null&&!$.includes(t.latexmkrc);(0,A.useEffect)(()=>{He&&O(!1)},[He]),(0,A.useEffect)(()=>{if(K!==`compiler`)return;let e=new AbortController;return Ae(null),d(`/api/projects/${n}/main-files`,{signal:e.signal}).then(e=>Ae(e.mainFiles)).catch(e=>{e instanceof Error&&e.name===`AbortError`||B(u(e))}),()=>e.abort()},[n,f,K]);let Ue=z??[t.mainFile],We=z!==null&&!z.includes(N),Ge=async()=>{if(L.current)return;V.clear();let e=f.length===0&&t.latexmkrc&&c.allowProjectLatexmkrc!==!1?t.latexmkrc:D&&c.allowProjectLatexmkrc!==!1&&Ve||null,r=ke.current,i={};if(k!==r.name&&(i.name=k),N!==r.mainFile&&(i.mainFile=N),T!==r.engine&&(i.engine=T),e!==r.latexmkrc&&(i.latexmkrc=e),F!==r.chktexEnabled&&(i.chktexEnabled=F),Object.keys(i).length===0){V.show(w(`common.noChangesToSave`));return}let a=Object.fromEntries(Object.keys(i).map(e=>[e,r[e]])),o=new AbortController;L.current=o,Oe(!0);try{B(``);let e=await d(`/api/projects/${n}`,{method:`PATCH`,signal:o.signal,body:JSON.stringify({...i,expectedSettings:a})});if(!R.current){C(e.project);return}ke.current={name:e.project.name,mainFile:e.project.mainFile,engine:e.project.engine,latexmkrc:e.project.latexmkrc,chktexEnabled:e.project.chktexEnabled},j(e.project.name),P(e.project.mainFile),E(e.project.engine),De(e.project.chktexEnabled),O(!!e.project.latexmkrc),C(e.project),V.show(w(`common.saveSuccess`))}catch(e){R.current&&B(u(e))}finally{L.current===o&&(L.current=null,R.current&&Oe(!1))}},Ke=()=>{V.clear(),B(``);try{oe(J),V.show(w(`common.saveSuccess`))}catch{B(w(`projectSettings.appearanceSaveFailed`))}},qe=()=>{V.clear(),B(``),le(Ie)?V.show(w(`common.saveSuccess`)):B(w(`projectSettings.appearanceSaveFailed`))},Je=()=>{if(K===`appearance`)return Ke();if(K===`terminal`)return qe();Z&&Ge()},Ye=w(K===`appearance`?`projectSettings.saveAppearance`:K===`terminal`?`projectSettings.saveTerminal`:`projectSettings.saveCompiler`),Xe=K!==`compiler`||Z,Ze=async()=>{let e=H.trim();if(e)try{g((await d(`/api/projects/${n}/dictionary`,{method:`POST`,body:JSON.stringify({word:e})})).words),Me(``),U(``)}catch(e){U(u(e))}},Qe=async e=>{try{g((await d(`/api/projects/${n}/dictionary/${encodeURIComponent(e)}`,{method:`DELETE`})).words),U(``)}catch(e){U(u(e))}};return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(`div`,{className:`drawer-title settings-drawer-title`,children:[(0,M.jsx)(`strong`,{children:w(`editor.projectSettings`)}),(0,M.jsxs)(`div`,{className:`drawer-title-actions`,children:[Xe&&(0,M.jsxs)(`button`,{type:`button`,className:`drawer-settings-save`,disabled:K===`compiler`&&I,"aria-busy":K===`compiler`&&I,onClick:Je,children:[K===`compiler`&&I?(0,M.jsx)(m,{className:`spin`,size:14}):(0,M.jsx)(b,{size:14}),(0,M.jsx)(`span`,{children:Ye})]}),(0,M.jsx)(`button`,{type:`button`,"aria-label":w(`common.close`),onClick:e,children:(0,M.jsx)(s,{size:17})})]})]}),(0,M.jsx)(ae,{message:V.message,onDismiss:V.clear}),(0,M.jsxs)(`div`,{className:`settings padded`,children:[je&&(0,M.jsx)(`p`,{className:`error`,children:je}),(0,M.jsxs)(`div`,{className:`settings-tabs`,role:`tablist`,"aria-label":w(`common.settings`),children:[(0,M.jsxs)(`button`,{id:`settings-tab-appearance`,type:`button`,role:`tab`,"aria-selected":K===`appearance`,"aria-controls":`settings-panel-appearance`,className:`settings-tab${K===`appearance`?` active`:``}`,onClick:()=>q(`appearance`),children:[(0,M.jsx)(re,{size:15}),w(`projectSettings.editorTab`)]}),(0,M.jsxs)(`button`,{id:`settings-tab-terminal`,type:`button`,role:`tab`,"aria-selected":K===`terminal`,"aria-controls":`settings-panel-terminal`,className:`settings-tab${K===`terminal`?` active`:``}`,onClick:()=>q(`terminal`),children:[(0,M.jsx)(ne,{size:15}),w(`projectSettings.terminalTab`)]}),(0,M.jsxs)(`button`,{id:`settings-tab-compiler`,type:`button`,role:`tab`,"aria-selected":K===`compiler`,"aria-controls":`settings-panel-compiler`,className:`settings-tab${K===`compiler`?` active`:``}`,onClick:()=>q(`compiler`),children:[(0,M.jsx)(ue,{size:15}),w(`projectSettings.compilerTab`)]})]}),K===`appearance`?(0,M.jsxs)(`section`,{id:`settings-panel-appearance`,role:`tabpanel`,"aria-labelledby":`settings-tab-appearance`,children:[(0,M.jsxs)(`div`,{className:`settings-section-title`,children:[(0,M.jsx)(re,{size:15}),(0,M.jsx)(`strong`,{children:w(`projectSettings.editorAppearance`)})]}),(0,M.jsx)(`p`,{className:`settings-description appearance-description`,children:w(`projectSettings.editorAppearanceDescription`)}),(0,M.jsxs)(`label`,{children:[w(`projectSettings.fontFamily`),(0,M.jsx)(`select`,{value:J.font,onChange:e=>Y({...J,font:e.target.value}),children:pe.map(e=>(0,M.jsx)(`option`,{value:e.id,children:w(e.labelKey)},e.id))})]}),(0,M.jsxs)(`label`,{children:[w(`projectSettings.fontSize`),(0,M.jsx)(`select`,{value:J.fontSize,onChange:e=>Y({...J,fontSize:Number(e.target.value)}),children:[12,13,14,15,16,18,20].map(e=>(0,M.jsxs)(`option`,{value:e,children:[e,` px`]},e))})]}),(0,M.jsxs)(`label`,{children:[w(`projectSettings.lineHeight`),(0,M.jsxs)(`select`,{value:J.lineHeight,onChange:e=>Y({...J,lineHeight:Number(e.target.value)}),children:[(0,M.jsx)(`option`,{value:1.45,children:w(`projectSettings.lineHeightCompact`)}),(0,M.jsx)(`option`,{value:1.65,children:w(`projectSettings.lineHeightNormal`)}),(0,M.jsx)(`option`,{value:1.85,children:w(`projectSettings.lineHeightRelaxed`)})]})]}),(0,M.jsxs)(`label`,{className:`editor-checkbox`,children:[(0,M.jsx)(`input`,{type:`checkbox`,checked:J.lineWrapping,onChange:e=>Y({...J,lineWrapping:e.target.checked})}),(0,M.jsx)(Se,{size:15}),(0,M.jsx)(`span`,{children:w(`projectSettings.lineWrapping`)})]}),(0,M.jsx)(`div`,{className:`editor-preference`,children:(0,M.jsxs)(`label`,{className:`editor-checkbox`,children:[(0,M.jsx)(`input`,{type:`checkbox`,checked:J.showTooltips,onChange:e=>Y({...J,showTooltips:e.target.checked})}),(0,M.jsx)(ve,{size:15}),(0,M.jsx)(`span`,{children:w(`projectSettings.showTooltips`)})]})}),(0,M.jsx)(`div`,{className:`editor-preference`,children:(0,M.jsxs)(`label`,{className:`editor-checkbox`,children:[(0,M.jsx)(`input`,{type:`checkbox`,checked:J.mathPreviewOnHover,onChange:e=>Y({...J,mathPreviewOnHover:e.target.checked})}),(0,M.jsx)(te,{size:15}),(0,M.jsx)(`span`,{children:w(`projectSettings.mathPreviewOnHover`)})]})}),(0,M.jsxs)(`div`,{className:`editor-preference`,children:[(0,M.jsxs)(`label`,{className:`editor-checkbox`,children:[(0,M.jsx)(`input`,{type:`checkbox`,checked:J.spellCheck,onChange:e=>Y({...J,spellCheck:e.target.checked})}),(0,M.jsx)(`span`,{children:w(`projectSettings.spellCheck`)})]}),(0,M.jsxs)(`p`,{className:`field-hint`,children:[w(`projectSettings.writingCheckDescription`),` `,(0,M.jsx)(`a`,{href:`https://writewithharper.com/docs/integrations/language-server`,target:`_blank`,rel:`noreferrer`,children:`Harper`})]}),v!==null&&(0,M.jsxs)(`div`,{className:`spell-check-result${v?` has-issues`:``}`,role:`status`,"aria-live":`polite`,children:[(0,M.jsx)(be,{size:14}),(0,M.jsx)(`span`,{children:v?w(`projectSettings.writingIssues`,{count:v,uniqueCount:ce??0}):w(`chktex.noIssues`)}),v>0&&(0,M.jsxs)(`span`,{className:`spell-check-controls`,children:[(0,M.jsx)(`button`,{type:`button`,title:w(`projectSettings.spellCheckFirst`),"aria-label":w(`projectSettings.spellCheckFirst`),disabled:x<=0,onClick:()=>S(0),children:(0,M.jsx)(me,{size:14})}),(0,M.jsx)(`button`,{type:`button`,title:w(`projectSettings.spellCheckPrevious`),"aria-label":w(`projectSettings.spellCheckPrevious`),disabled:x<=0,onClick:()=>S(x-1),children:(0,M.jsx)(i,{size:14})}),(0,M.jsx)(`span`,{className:`spell-check-position`,children:w(`projectSettings.spellCheckPosition`,{current:Math.min(x+1,v),total:v})}),(0,M.jsx)(`button`,{type:`button`,title:w(`projectSettings.spellCheckNext`),"aria-label":w(`projectSettings.spellCheckNext`),disabled:x>=v-1,onClick:()=>S(x+1),children:(0,M.jsx)(a,{size:14})}),(0,M.jsx)(`button`,{type:`button`,title:w(`projectSettings.spellCheckLast`),"aria-label":w(`projectSettings.spellCheckLast`),disabled:x>=v-1,onClick:()=>S(v-1),children:(0,M.jsx)(he,{size:14})})]})]})]}),(0,M.jsxs)(`div`,{className:`editor-preference`,children:[(0,M.jsxs)(`label`,{className:`editor-checkbox`,children:[(0,M.jsx)(`input`,{type:`checkbox`,checked:J.vimMode,onChange:e=>Y({...J,vimMode:e.target.checked})}),(0,M.jsx)(`span`,{children:w(`projectSettings.vimMode`)})]}),(0,M.jsxs)(`p`,{className:`field-hint`,children:[w(`projectSettings.vimModeDescription`),` `,(0,M.jsx)(`a`,{href:`https://replit-codemirror-vim.mintlify.app/`,target:`_blank`,rel:`noreferrer`,children:w(`projectSettings.vimHelp`)})]})]}),(0,M.jsx)(`div`,{className:`editor-preference`,children:(0,M.jsxs)(`label`,{className:`editor-checkbox`,children:[(0,M.jsx)(`input`,{type:`checkbox`,checked:J.openFilesInTabs,onChange:e=>Y({...J,openFilesInTabs:e.target.checked})}),(0,M.jsx)(ye,{size:15}),(0,M.jsx)(`span`,{children:w(`projectSettings.openFilesInTabs`)})]})}),(0,M.jsxs)(`div`,{className:`editor-preference`,children:[(0,M.jsxs)(`label`,{className:`editor-checkbox`,children:[(0,M.jsx)(`input`,{type:`checkbox`,disabled:!Q,checked:J.formatOnCompile,onChange:e=>Y({...J,formatOnCompile:e.target.checked})}),(0,M.jsx)(xe,{size:15}),(0,M.jsx)(`span`,{children:w(`projectSettings.formatOnCompile`)})]}),(0,M.jsxs)(`p`,{className:`field-hint`,children:[w(`projectSettings.formatterDescription`),` `,(0,M.jsx)(`a`,{href:`https://www.npmjs.com/package/tex-fmt`,target:`_blank`,rel:`noreferrer`,children:w(`projectSettings.formatterInstall`)}),` · `,(0,M.jsx)(`a`,{href:`https://github.com/FlamingTempura/bibtex-tidy`,target:`_blank`,rel:`noreferrer`,children:w(`projectSettings.bibtexTidyInstall`)}),!Q&&(0,M.jsxs)(M.Fragment,{children:[` `,w(`projectSettings.formatRequiresWrite`)]})]})]}),(0,M.jsxs)(`div`,{className:`editor-preference`,children:[(0,M.jsxs)(`label`,{className:`tex-fmt-options-field`,children:[(0,M.jsxs)(`span`,{className:`tex-fmt-options-heading`,children:[(0,M.jsx)(`span`,{children:w(`projectSettings.texFmtOptions`)}),(0,M.jsx)(Ee,{compact:!0,name:`tex-fmt`,state:Re,label:w(`projectSettings.toolStatus.${Re.status}`),reloadLabel:w(`projectSettings.reloadTool`),onReload:Be})]}),(0,M.jsx)(`textarea`,{className:`tex-fmt-options-editor`,rows:6,maxLength:16384,spellCheck:!1,value:J.texFmtConfig,placeholder:w(`projectSettings.texFmtOptionsPlaceholder`),onChange:e=>Y({...J,texFmtConfig:e.target.value})})]}),(0,M.jsx)(`p`,{className:`field-hint`,children:w(`projectSettings.texFmtOptionsDescription`)})]}),(0,M.jsxs)(`div`,{className:`settings-section-title dictionary-heading`,children:[(0,M.jsx)(o,{size:15}),(0,M.jsx)(`strong`,{children:w(`projectSettings.dictionary`)}),(0,M.jsxs)(`span`,{className:`harper-cli-status ${W}`,role:`status`,"aria-live":`polite`,children:[W===`checking`?(0,M.jsx)(m,{className:`spin`,size:12,"aria-hidden":`true`}):W===`available`?(0,M.jsx)(ee,{size:12,"aria-hidden":`true`}):(0,M.jsx)(ge,{size:12,"aria-hidden":`true`}),(0,M.jsxs)(`span`,{children:[`Harper CLI · `,w(`projectSettings.harperCliStatus.${W}`)]}),(W===`error`||W===`unavailable`)&&(0,M.jsx)(`button`,{type:`button`,title:w(`projectSettings.harperCliRetry`),"aria-label":w(`projectSettings.harperCliRetry`),onClick:()=>Fe(e=>e+1),children:(0,M.jsx)(l,{size:12})})]})]}),(0,M.jsx)(`p`,{className:`settings-description`,children:w(`projectSettings.dictionaryDescription`)}),Ne&&(0,M.jsx)(`p`,{className:`error dictionary-error`,children:Ne}),ze&&(0,M.jsxs)(`div`,{className:`dictionary-add`,children:[(0,M.jsx)(`input`,{value:H,placeholder:w(`projectSettings.dictionaryPlaceholder`),onChange:e=>Me(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),Ze())}}),(0,M.jsx)(`button`,{type:`button`,disabled:!H.trim(),onClick:()=>void Ze(),children:w(`projectSettings.addWord`)})]}),(0,M.jsxs)(`div`,{className:`dictionary-words`,children:[h.map(e=>(0,M.jsxs)(`span`,{className:`dictionary-word`,children:[(0,M.jsx)(`code`,{children:e}),ze&&(0,M.jsx)(`button`,{type:`button`,title:w(`common.delete`),"aria-label":`${w(`common.delete`)} ${e}`,onClick:()=>void Qe(e),children:(0,M.jsx)(s,{size:13})})]},e)),h.length===0&&(0,M.jsx)(`span`,{className:`dictionary-empty`,children:w(`projectSettings.dictionaryEmpty`)})]}),(0,M.jsx)(`div`,{className:`settings-actions`,children:(0,M.jsxs)(`button`,{className:`settings-save`,onClick:Ke,children:[(0,M.jsx)(b,{size:15}),w(`projectSettings.saveAppearance`)]})})]}):K===`terminal`?(0,M.jsx)(Te,{preferences:Ie,onChange:Le,onSave:qe}):(0,M.jsxs)(`section`,{id:`settings-panel-compiler`,role:`tabpanel`,"aria-labelledby":`settings-tab-compiler`,children:[(0,M.jsxs)(`div`,{className:`settings-section-title`,children:[(0,M.jsx)(ue,{size:15}),(0,M.jsx)(`strong`,{children:w(`projectSettings.compilerTab`)})]}),(0,M.jsx)(`p`,{className:`settings-description compiler-description`,children:w(`projectSettings.compilerDescription`)}),(0,M.jsxs)(`label`,{children:[w(`projects.name`),(0,M.jsx)(`input`,{disabled:!Z||I,value:k,onChange:e=>j(e.target.value)})]}),(0,M.jsxs)(`label`,{children:[w(`projectSettings.mainFile`),(0,M.jsxs)(`select`,{disabled:!Z||I||z===null||z.length===0,value:N,onChange:e=>P(e.target.value),children:[We&&(0,M.jsx)(`option`,{value:N,disabled:!0,children:w(`projectSettings.invalidMainFileOption`,{path:N})}),Ue.map(e=>(0,M.jsx)(`option`,{value:e,children:e},e))]})]}),(0,M.jsxs)(`label`,{children:[w(D&&$.length>0&&c.allowProjectLatexmkrc!==!1?`projectSettings.defaultEngine`:`projectSettings.engine`),(0,M.jsx)(`select`,{disabled:!Z||I,value:T,onChange:e=>E(e.target.value),children:(c.allowedEngines??[`pdflatex`,`xelatex`,`lualatex`]).map(e=>(0,M.jsx)(`option`,{children:e},e))})]}),(0,M.jsxs)(`div`,{className:`editor-preference compiler-check-option`,children:[(0,M.jsxs)(`label`,{className:`editor-checkbox`,children:[(0,M.jsx)(`input`,{type:`checkbox`,disabled:!Z||I,checked:F,onChange:e=>De(e.target.checked)}),(0,M.jsx)(_e,{size:15}),(0,M.jsx)(`span`,{children:w(`chktex.enabled`)})]}),(0,M.jsxs)(`p`,{className:`field-hint`,children:[w(`chktex.description`),` `,(0,M.jsx)(`a`,{href:`https://www.nongnu.org/chktex/`,target:`_blank`,rel:`noreferrer`,children:`ChkTeX`})]})]}),$.length>0&&(0,M.jsxs)(`div`,{className:`editor-preference latexmkrc-setting`,children:[(0,M.jsxs)(`label`,{className:`editor-checkbox`,children:[(0,M.jsx)(`input`,{type:`checkbox`,disabled:!Z||I||c.allowProjectLatexmkrc===!1,checked:D&&c.allowProjectLatexmkrc!==!1,onChange:e=>O(e.target.checked)}),(0,M.jsx)(`span`,{children:w(`projectSettings.enableLatexmkrc`)})]}),(0,M.jsx)(`p`,{className:`field-hint`,children:w(`projectSettings.latexmkrcSource`,{path:Ve})}),c.allowProjectLatexmkrc===!1?(0,M.jsx)(`p`,{className:`field-hint`,children:w(`projectSettings.latexmkrcUnavailable`)}):(0,M.jsxs)(`p`,{className:`field-hint latexmkrc-warning`,children:[(0,M.jsx)(r,{size:14,"aria-hidden":`true`}),(0,M.jsx)(`span`,{children:w(`projectSettings.latexmkrcWarning`)})]})]}),(0,M.jsx)(`div`,{className:`settings-actions`,children:Z&&(0,M.jsxs)(`button`,{className:`settings-save`,disabled:I,"aria-busy":I,onClick:()=>void Ge(),children:[I?(0,M.jsx)(m,{className:`spin`,size:15}):(0,M.jsx)(b,{size:15}),w(`projectSettings.saveCompiler`)]})}),(0,M.jsx)(we,{})]})]})]})}export{P as ProjectSettings};