tabularium 0.3.0__py3-none-any.whl

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 (245) hide show
  1. app/__init__.py +1 -0
  2. app/_bundle/VERSION +1 -0
  3. app/_bundle/conf/profiles/lloyds-list-1900s.json +36 -0
  4. app/_bundle/frontend/dist/assets/AcceptInvitePage-mmfgf6m1.js +1 -0
  5. app/_bundle/frontend/dist/assets/AnnotationEntry-BwG_saxU.js +2 -0
  6. app/_bundle/frontend/dist/assets/AnnotationPage-DH-87aUG.js +40 -0
  7. app/_bundle/frontend/dist/assets/BenchmarkPage-qjFgbXPG.js +1 -0
  8. app/_bundle/frontend/dist/assets/ContentPane-DPwsshn8.js +7 -0
  9. app/_bundle/frontend/dist/assets/DatasetPage-DFRTWXF0.js +1 -0
  10. app/_bundle/frontend/dist/assets/EvaluationPage-BTn5VHpn.js +1 -0
  11. app/_bundle/frontend/dist/assets/FineTuningPage-B09T-w0T.js +1 -0
  12. app/_bundle/frontend/dist/assets/HomePage-Buvrl10l.js +1 -0
  13. app/_bundle/frontend/dist/assets/LoginPage-BacwEFgw.js +1 -0
  14. app/_bundle/frontend/dist/assets/ModelsHubPage-i-JlXvoV.js +3 -0
  15. app/_bundle/frontend/dist/assets/PipelineView-B61UZ5RU.js +1 -0
  16. app/_bundle/frontend/dist/assets/PlaygroundPage-DdLbW7Cz.js +3 -0
  17. app/_bundle/frontend/dist/assets/ProjectDetailPage-CmSNb4G_.js +1 -0
  18. app/_bundle/frontend/dist/assets/ProjectReader-fMmVHqkV.js +1 -0
  19. app/_bundle/frontend/dist/assets/ProjectsPage-DitX5ysq.js +1 -0
  20. app/_bundle/frontend/dist/assets/RecognizePage-VVw2Z-Qw.js +1 -0
  21. app/_bundle/frontend/dist/assets/ResultsPage-BIjY0LGg.js +1 -0
  22. app/_bundle/frontend/dist/assets/SetPasswordPage-CWb7kbIn.js +1 -0
  23. app/_bundle/frontend/dist/assets/SettingsPage-CaJbnPc9.js +2 -0
  24. app/_bundle/frontend/dist/assets/SetupPage-3w2m35t_.js +1 -0
  25. app/_bundle/frontend/dist/assets/ShareDialog-CNF0oznE.js +1 -0
  26. app/_bundle/frontend/dist/assets/TableEntry-DdlC3pJj.js +2 -0
  27. app/_bundle/frontend/dist/assets/TableWorkspacePage-DYqW4eXA.js +1 -0
  28. app/_bundle/frontend/dist/assets/TrainingPage-xnyPwDG9.js +57 -0
  29. app/_bundle/frontend/dist/assets/UniverSheet-BwKQUIYP.js +495 -0
  30. app/_bundle/frontend/dist/assets/UniverSheet-DbvMtUcB.css +1 -0
  31. app/_bundle/frontend/dist/assets/UsersPage-BgEmi8o1.js +1 -0
  32. app/_bundle/frontend/dist/assets/af-DK_CjRn6-CZxsvT2y.js +1 -0
  33. app/_bundle/frontend/dist/assets/as-BPtSu6VN-F6qyW8uH.js +1 -0
  34. app/_bundle/frontend/dist/assets/avatar-CNaispuS.js +1 -0
  35. app/_bundle/frontend/dist/assets/be-CrQ0smca-BYVdQd18.js +1 -0
  36. app/_bundle/frontend/dist/assets/bg-CrQqGwni-B5xv6TfF.js +1 -0
  37. app/_bundle/frontend/dist/assets/bn-NCLZcWHi-BGS6_hxH.js +1 -0
  38. app/_bundle/frontend/dist/assets/ca-SUf6Y2Om-DrduLk3W.js +1 -0
  39. app/_bundle/frontend/dist/assets/clsx-DB0hHKMi.js +1 -0
  40. app/_bundle/frontend/dist/assets/cop-C3sk0IUo-Dw82IjCr.js +1 -0
  41. app/_bundle/frontend/dist/assets/cs-CmAteokq-BI5q4aVA.js +1 -0
  42. app/_bundle/frontend/dist/assets/cu-CBUlrW6Y-BRCy0UAr.js +1 -0
  43. app/_bundle/frontend/dist/assets/cy-BBPa6z2x-Cag4snSk.js +1 -0
  44. app/_bundle/frontend/dist/assets/da-CCDXfXtG-BWliw5hZ.js +1 -0
  45. app/_bundle/frontend/dist/assets/dates-8UlpNJqU.js +1 -0
  46. app/_bundle/frontend/dist/assets/de-1901-CWoAOigE-BlgpCKr2.js +1 -0
  47. app/_bundle/frontend/dist/assets/de-1996-BL6awyxG-BjfWxQKM.js +1 -0
  48. app/_bundle/frontend/dist/assets/de-ch-1901-hVThVHVb-_Xg3_np3.js +1 -0
  49. app/_bundle/frontend/dist/assets/el-monoton-D3aKqTz2-CuqNQIvE.js +1 -0
  50. app/_bundle/frontend/dist/assets/el-polyton-ogVWcTzh-B5J5pGHR.js +1 -0
  51. app/_bundle/frontend/dist/assets/en-gb-B7Al27b_-COWGBqwJ.js +1 -0
  52. app/_bundle/frontend/dist/assets/es-DcaaHPU_-CnHE1eri.js +1 -0
  53. app/_bundle/frontend/dist/assets/et-B_spaleu-H7jVbiHv.js +1 -0
  54. app/_bundle/frontend/dist/assets/eu-Ctv_kq9Z-D1jw9zt8.js +1 -0
  55. app/_bundle/frontend/dist/assets/fi-RW5VB8Yp-mParSSSy.js +1 -0
  56. app/_bundle/frontend/dist/assets/fr-BC2onEz9-Dc1KqFHa.js +1 -0
  57. app/_bundle/frontend/dist/assets/fur-AC12wySk-tJv2icDr.js +1 -0
  58. app/_bundle/frontend/dist/assets/ga-Cn6LkudM-CDuqe3gr.js +1 -0
  59. app/_bundle/frontend/dist/assets/gl-DZGc-K_G-D9_oxkqv.js +1 -0
  60. app/_bundle/frontend/dist/assets/grc-DOlGgO8T-DANBReIg.js +1 -0
  61. app/_bundle/frontend/dist/assets/gu-Bjl0l-cf-COW9d1dt.js +1 -0
  62. app/_bundle/frontend/dist/assets/hi-DsAaTPCC-CiihDo6Q.js +1 -0
  63. app/_bundle/frontend/dist/assets/hr-DT1SBBes-D_vEJhf2.js +1 -0
  64. app/_bundle/frontend/dist/assets/hsb-DC_ITc1e-kb5QeNH1.js +1 -0
  65. app/_bundle/frontend/dist/assets/hu-DVk7Y_ka-Ct1fysVO.js +1 -0
  66. app/_bundle/frontend/dist/assets/hy-e995ysyO-Cjfrs2ZM.js +1 -0
  67. app/_bundle/frontend/dist/assets/ia-Cr4TJH0c-B1i9kDPT.js +1 -0
  68. app/_bundle/frontend/dist/assets/id-DifDyWg9-C3Hzl2m4.js +1 -0
  69. app/_bundle/frontend/dist/assets/index-Bu1kTJtO.css +2 -0
  70. app/_bundle/frontend/dist/assets/index-DVWuV1Ff.js +12 -0
  71. app/_bundle/frontend/dist/assets/is-BT8UVRze-DWEBuJpb.js +1 -0
  72. app/_bundle/frontend/dist/assets/it-Bt_Meacx-HiFRunf5.js +1 -0
  73. app/_bundle/frontend/dist/assets/ka-jyoLzyDE-BU45urC7.js +1 -0
  74. app/_bundle/frontend/dist/assets/kmr-Cfwhwuff-DfPyPgkK.js +1 -0
  75. app/_bundle/frontend/dist/assets/kn-C6Lov-DP-BuXzi7S-.js +1 -0
  76. app/_bundle/frontend/dist/assets/la-DuvHjUWw-Bwiuou7l.js +1 -0
  77. app/_bundle/frontend/dist/assets/la-x-classic-yTyAOQEt-aO_2QO0y.js +1 -0
  78. app/_bundle/frontend/dist/assets/la-x-liturgic-CXeQb4FY-BpDOy20C.js +1 -0
  79. app/_bundle/frontend/dist/assets/live-CFfryZUM.js +1 -0
  80. app/_bundle/frontend/dist/assets/lt-BBe8DlDF-B3cgXplB.js +1 -0
  81. app/_bundle/frontend/dist/assets/lv-Q2BBHnzp-CLjYDJHB.js +1 -0
  82. app/_bundle/frontend/dist/assets/ml-2xLVYkVY-Ct0js8Am.js +1 -0
  83. app/_bundle/frontend/dist/assets/mn-cyrl-lHM4n0oC-DN6sz9R4.js +1 -0
  84. app/_bundle/frontend/dist/assets/mn-cyrl-x-lmc-3aetruI8-BJqn49ay.js +1 -0
  85. app/_bundle/frontend/dist/assets/mr-CjWJPVmH-DGtESPcG.js +1 -0
  86. app/_bundle/frontend/dist/assets/mul-ethi-D_CMSMEq-D6ioGuYP.js +1 -0
  87. app/_bundle/frontend/dist/assets/nb-DI8u59ch-BfDSp4tN.js +1 -0
  88. app/_bundle/frontend/dist/assets/nl-BHQJ6Gvn-8_OIBsy0.js +1 -0
  89. app/_bundle/frontend/dist/assets/nn-ntZvarUK-BWT83oy8.js +1 -0
  90. app/_bundle/frontend/dist/assets/no-B8ItS0F3-Cjg1mxae.js +1 -0
  91. app/_bundle/frontend/dist/assets/oc-P_i3-xLA-W5_I63nO.js +1 -0
  92. app/_bundle/frontend/dist/assets/or-50rxpoq4-Cf5-bcl5.js +1 -0
  93. app/_bundle/frontend/dist/assets/pa-C54UG8eN-Bj-XExX_.js +1 -0
  94. app/_bundle/frontend/dist/assets/pi-B9cgjyG1-o9084kBf.js +1 -0
  95. app/_bundle/frontend/dist/assets/pipeline-CPPlVFee.js +1 -0
  96. app/_bundle/frontend/dist/assets/pl-9fg-ESVt-Bv_p-a9x.js +1 -0
  97. app/_bundle/frontend/dist/assets/pms-BRGfm5gS-DfOt2RSi.js +1 -0
  98. app/_bundle/frontend/dist/assets/projectAccess-D3wgwunj.js +1 -0
  99. app/_bundle/frontend/dist/assets/pt-Cum2_NUC-CrkeeQaZ.js +1 -0
  100. app/_bundle/frontend/dist/assets/rm-C0MIK9N4-CNhvXnnG.js +1 -0
  101. app/_bundle/frontend/dist/assets/ro-0fmdH0HA-Bov_DAVD.js +1 -0
  102. app/_bundle/frontend/dist/assets/ru-v4l-ayaq-DLdM0nWP.js +1 -0
  103. app/_bundle/frontend/dist/assets/sa-CKY9c_Vq-CvBCyoRG.js +1 -0
  104. app/_bundle/frontend/dist/assets/sh-cyrl-BpCRFOmq-UY09gie6.js +1 -0
  105. app/_bundle/frontend/dist/assets/sh-latn-sRy4Tuaj-De-tA-2J.js +1 -0
  106. app/_bundle/frontend/dist/assets/sk-_iOeDNrQ-DC8Al4lF.js +1 -0
  107. app/_bundle/frontend/dist/assets/sl-DpiklF-D-B8FnrXi1.js +1 -0
  108. app/_bundle/frontend/dist/assets/sr-cyrl-Dpzrbd0W-yGc0Jz1j.js +1 -0
  109. app/_bundle/frontend/dist/assets/sv-CFm5y56M-DeQDoAsB.js +1 -0
  110. app/_bundle/frontend/dist/assets/ta-BcghgTbD-B5_ztYXp.js +1 -0
  111. app/_bundle/frontend/dist/assets/te-B5Spl2Jk-BjTOzs5s.js +1 -0
  112. app/_bundle/frontend/dist/assets/th-DWX5iPSo-CFfNau1h.js +1 -0
  113. app/_bundle/frontend/dist/assets/tk-BMbKB10q-UHPz-lif.js +1 -0
  114. app/_bundle/frontend/dist/assets/tr-CIHIuzqc-DvQDK0dA.js +1 -0
  115. app/_bundle/frontend/dist/assets/ui-BtIxuKN2.js +13 -0
  116. app/_bundle/frontend/dist/assets/uk-Dir3oxLs-DGVpthWV.js +1 -0
  117. app/_bundle/frontend/dist/assets/vocab-C9TBNLaa.js +1 -0
  118. app/_bundle/frontend/dist/assets/zh-latn-pinyin-BdYb-Ey_-CW52gdb_.js +1 -0
  119. app/_bundle/frontend/dist/fonts/archivo-latin-ext.woff2 +0 -0
  120. app/_bundle/frontend/dist/fonts/archivo-latin.woff2 +0 -0
  121. app/_bundle/frontend/dist/fonts/chivomono-latin-ext.woff2 +0 -0
  122. app/_bundle/frontend/dist/fonts/chivomono-latin.woff2 +0 -0
  123. app/_bundle/frontend/dist/index.html +33 -0
  124. app/_bundle/scripts/cloud/glmocr_native_gateway.py +118 -0
  125. app/_bundle/scripts/cloud/mineru_native_gateway.py +154 -0
  126. app/_bundle/scripts/cloud/modal_deepseek_ocr.py +124 -0
  127. app/_bundle/scripts/cloud/modal_dots_ocr.py +121 -0
  128. app/_bundle/scripts/cloud/modal_glm_ocr.py +127 -0
  129. app/_bundle/scripts/cloud/modal_mineru.py +151 -0
  130. app/_bundle/scripts/cloud/modal_paddleocr_vl.py +136 -0
  131. app/_bundle/scripts/cloud/modal_publish_checkpoint.sh +11 -0
  132. app/_bundle/scripts/cloud/modal_qwen3_vl.py +124 -0
  133. app/_bundle/scripts/cloud/modal_teleocr.py +119 -0
  134. app/_bundle/scripts/cloud/modal_unlimited_ocr.py +142 -0
  135. app/_bundle/scripts/cloud/modal_vllm.py +222 -0
  136. app/_bundle/scripts/cloud/setup_cloud_train.sh +53 -0
  137. app/_bundle/scripts/cloud/setup_cloud_vllm.sh +765 -0
  138. app/_bundle/scripts/cloud/ssh_tunnel.sh +90 -0
  139. app/_bundle/scripts/cloud/teleocr_native_gateway.py +134 -0
  140. app/_bundle/scripts/cloud/test_cloud_connection.py +124 -0
  141. app/_bundle/scripts/cloud/vast_onstart.sh +26 -0
  142. app/_bundle/scripts/local/mineru_mlx_gateway.py +139 -0
  143. app/_bundle/scripts/serve_model.sh +79 -0
  144. app/api/__init__.py +54 -0
  145. app/api/auth.py +257 -0
  146. app/api/benchmark.py +111 -0
  147. app/api/blocks.py +712 -0
  148. app/api/cloud.py +622 -0
  149. app/api/datasets.py +213 -0
  150. app/api/deps.py +56 -0
  151. app/api/evaluate.py +68 -0
  152. app/api/live.py +148 -0
  153. app/api/models.py +206 -0
  154. app/api/page_work.py +66 -0
  155. app/api/pages.py +678 -0
  156. app/api/playground.py +198 -0
  157. app/api/prelabel.py +244 -0
  158. app/api/projects.py +772 -0
  159. app/api/recognition.py +135 -0
  160. app/api/settings.py +33 -0
  161. app/api/system.py +543 -0
  162. app/api/training.py +177 -0
  163. app/api/users.py +149 -0
  164. app/cli.py +69 -0
  165. app/config.py +188 -0
  166. app/db.py +513 -0
  167. app/main.py +134 -0
  168. app/schemas.py +599 -0
  169. app/services/__init__.py +1 -0
  170. app/services/alternative_training.py +236 -0
  171. app/services/annotation_schema.py +133 -0
  172. app/services/artifacts.py +52 -0
  173. app/services/audit.py +28 -0
  174. app/services/auth.py +229 -0
  175. app/services/backup.py +74 -0
  176. app/services/benchmark.py +633 -0
  177. app/services/blocks.py +173 -0
  178. app/services/cloud_manager.py +2191 -0
  179. app/services/compute_profiles.py +115 -0
  180. app/services/corpus.py +32 -0
  181. app/services/custom_models.py +209 -0
  182. app/services/dataset_builder.py +716 -0
  183. app/services/dewarp.py +177 -0
  184. app/services/domain_profiles.py +28 -0
  185. app/services/evaluate.py +587 -0
  186. app/services/export_formats.py +109 -0
  187. app/services/hardware.py +255 -0
  188. app/services/huggingface_auth.py +103 -0
  189. app/services/i18n.py +609 -0
  190. app/services/images.py +266 -0
  191. app/services/inference.py +1796 -0
  192. app/services/labeling.py +210 -0
  193. app/services/live.py +160 -0
  194. app/services/local_runtime.py +160 -0
  195. app/services/mineru_mlx_runtime.py +153 -0
  196. app/services/mlx_runtime.py +218 -0
  197. app/services/modal_manager.py +617 -0
  198. app/services/model_adapters.py +1862 -0
  199. app/services/model_labels.py +266 -0
  200. app/services/model_registry.py +609 -0
  201. app/services/model_settings.py +558 -0
  202. app/services/monkey_preprocess.py +153 -0
  203. app/services/native_picker.py +110 -0
  204. app/services/ocr.py +169 -0
  205. app/services/opencode_gateway.py +63 -0
  206. app/services/otsl.py +290 -0
  207. app/services/paddle_dataset.py +280 -0
  208. app/services/paddle_official.py +271 -0
  209. app/services/paddle_runtime.py +230 -0
  210. app/services/paddle_training.py +86 -0
  211. app/services/page_meta.py +74 -0
  212. app/services/page_work.py +138 -0
  213. app/services/pages.py +435 -0
  214. app/services/pilot.py +48 -0
  215. app/services/pipeline.py +73 -0
  216. app/services/prefill.py +1010 -0
  217. app/services/process_probe.py +87 -0
  218. app/services/rate_limit.py +21 -0
  219. app/services/recognition.py +653 -0
  220. app/services/scan.py +286 -0
  221. app/services/security.py +45 -0
  222. app/services/serve_manager.py +967 -0
  223. app/services/serve_recipes.py +380 -0
  224. app/services/settings.py +61 -0
  225. app/services/table_checks.py +386 -0
  226. app/services/table_detect.py +989 -0
  227. app/services/table_headers.py +102 -0
  228. app/services/table_hint.py +28 -0
  229. app/services/table_provenance.py +17 -0
  230. app/services/train_recipes.py +175 -0
  231. app/services/trainer.py +633 -0
  232. app/services/trainer_metrics.py +122 -0
  233. app/services/trainer_script.py +230 -0
  234. app/services/training_executor.py +305 -0
  235. app/services/unlimited_ocr_mlx_server.py +254 -0
  236. app/services/url_security.py +29 -0
  237. app/services/users.py +191 -0
  238. app/services/vault.py +142 -0
  239. app/services/vendor_repos.py +51 -0
  240. app/services/vram.py +191 -0
  241. tabularium-0.3.0.dist-info/METADATA +225 -0
  242. tabularium-0.3.0.dist-info/RECORD +245 -0
  243. tabularium-0.3.0.dist-info/WHEEL +4 -0
  244. tabularium-0.3.0.dist-info/entry_points.txt +2 -0
  245. tabularium-0.3.0.dist-info/licenses/LICENSE +21 -0
@@ -0,0 +1 @@
1
+ import{$ as e,L as t,N as n,X as r,c as i,ct as a,d as o,dt as s,ht as c,i as l,l as u,lt as d,r as f,st as p,t as m,tt as h}from"./ui-BtIxuKN2.js";import{D as g,E as ee,N as te,O as ne,i as re,j as ie}from"./index-DVWuV1Ff.js";import{n as _,t as ae}from"./projectAccess-D3wgwunj.js";import{l as oe,u as se}from"./vocab-C9TBNLaa.js";import{t as ce}from"./ShareDialog-CNF0oznE.js";var v=c(s(),1),y=d();function le({start:t,onPick:n,onClose:r}){let{t:o}=a(),[s,c]=(0,v.useState)(null),[l,u]=(0,v.useState)(null),[d,p]=(0,v.useState)(!1),m=async t=>{p(!0),u(null);try{c(await e(`/system/fs/browse${t?`?path=${encodeURIComponent(t)}`:``}`))}catch(n){if(t)try{c(await e(`/system/fs/browse`))}catch(e){u(e)}else u(n)}finally{p(!1)}};return(0,v.useEffect)(()=>{m(t.trim()||void 0)},[]),(0,y.jsx)(i,{title:o(`projects.picker.title`),onClose:r,wide:!0,footer:(0,y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,y.jsx)(`span`,{className:`text-[12px] text-[color:var(--color-ink-2)]`,children:s?o(`projects.picker.files`,{n:s.files}):``}),(0,y.jsx)(`button`,{type:`button`,className:`btn ml-auto`,onClick:r,children:o(`common.cancel`)}),(0,y.jsx)(`button`,{type:`button`,className:`btn btn-primary`,disabled:!s,onClick:()=>s&&n(s.path),children:o(`projects.picker.use`)})]}),children:(0,y.jsxs)(`div`,{className:`space-y-2 p-3`,children:[l!=null&&(0,y.jsx)(f,{error:l}),s&&(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,y.jsxs)(`button`,{type:`button`,className:`btn btn-sm`,disabled:!s.parent||d,onClick:()=>s.parent&&void m(s.parent),children:[`↑ `,o(`projects.picker.up`)]}),(0,y.jsx)(`span`,{className:`mono min-w-0 flex-1 truncate text-[12px]`,title:s.path,children:s.path})]}),(0,y.jsx)(`p`,{className:`text-[11px] text-[color:var(--color-ink-3)]`,children:o(`projects.picker.recursive`)}),(0,y.jsxs)(`ul`,{className:`max-h-[50vh] divide-y divide-[color:var(--color-rule)] overflow-auto border border-[color:var(--color-rule)]`,children:[s.dirs.length===0&&(0,y.jsx)(`li`,{className:`p-2 text-[12px] text-[color:var(--color-ink-3)]`,children:o(`projects.picker.noSubfolders`)}),s.dirs.map(e=>(0,y.jsx)(`li`,{children:(0,y.jsxs)(`button`,{type:`button`,disabled:d,onClick:()=>void m(e.path),className:`block w-full px-2 py-1.5 text-left text-[13px] hover:bg-[color:var(--color-fill)]`,children:[`▸ `,e.name]})},e.path))]}),s.truncated&&(0,y.jsx)(`p`,{className:`text-[11px] text-[color:var(--color-warn)]`,children:o(`projects.picker.truncated`)})]})]})})}function b(){let{t:s}=a(),c=ie(),d=ee(),b=!d.enabled||d.user?.role===`admin`||d.user?.role===`editor`,[x,S]=(0,v.useState)(`all`),[C,w]=(0,v.useState)(null),[T,E]=te(),D=T.get(`nuovo`)===`1`,[O,k]=(0,v.useState)(``),A=()=>{if(R)return;let e=new URLSearchParams(T);e.delete(`nuovo`),E(e),U(null)},j=()=>{b&&(U(null),E({nuovo:`1`}))},[M,ue]=(0,v.useState)(`upload`),[N,de]=(0,v.useState)([]),[P,F]=(0,v.useState)(``),[I,L]=(0,v.useState)(``),[R,z]=(0,v.useState)(!1),[B,V]=(0,v.useState)(!0),[H,U]=(0,v.useState)(null),[W,G]=(0,v.useState)(!1),[K,q]=(0,v.useState)(!1),[J,Y]=(0,v.useState)(!1),fe=g(),X=e=>{L(e),G(!0),P.trim()||F(e.split(/[\\/]/).filter(Boolean).pop()??``)},Z=(()=>{let e=I.trim();return!e||/^\//.test(e)||/^[A-Za-z]:[\\/]/.test(e)?null:s(`projects.dirError`)})(),Q=()=>e(`/projects`).then(e=>{de(e.items),w(t=>t?e.items.find(e=>e.id===t.id)??null:null)}).catch(U).finally(()=>V(!1));(0,v.useEffect)(()=>{Q()},[]);let pe=async e=>{if(e.preventDefault(),G(!0),!(!b||!P.trim()||M===`server`&&(!I.trim()||Z))){z(!0),U(null);try{let e=await h(`/projects`,{name:P.trim(),archive_dir:M===`server`?I.trim():null});re(e.id),c(`/progetti/${e.id}`)}catch(e){U(e)}finally{z(!1)}}},me=async()=>{Y(!0),U(null);try{let e=I.trim(),t=await h(`/system/fs/pick${e?`?start=${encodeURIComponent(e)}`:``}`);t.path&&X(t.path)}catch(e){e instanceof r&&e.status===501?q(!0):U(e)}finally{Y(!1)}},$=N.filter(e=>e.name.toLocaleLowerCase().includes(O.trim().toLocaleLowerCase())&&(x===`all`||(x===`mine`?e.owner_id===d.user?.id:e.access?.source===`member`)));return(0,y.jsxs)(`div`,{className:`p-3`,children:[(0,y.jsx)(o,{title:s(`projects.title`),intro:s(b?`projects.intro`:`team.projectsIntro`),aux:b&&(0,y.jsxs)(`button`,{type:`button`,className:`btn btn-primary`,onClick:j,children:[(0,y.jsx)(n,{size:13}),s(`projects.new`)]})}),H!=null&&!D&&(0,y.jsx)(`div`,{className:`mb-3`,children:(0,y.jsx)(f,{error:H,onDismiss:()=>U(null)})}),D&&b&&(0,y.jsx)(i,{title:s(`projects.new`),onClose:A,children:(0,y.jsxs)(`div`,{className:`p-4`,children:[H!=null&&(0,y.jsx)(`div`,{className:`mb-3`,children:(0,y.jsx)(f,{error:H,onDismiss:()=>U(null)})}),(0,y.jsx)(`p`,{className:`mb-3 text-[13px] text-[color:var(--color-ink-2)]`,children:s(`workflow.createHint`)}),(0,y.jsxs)(`form`,{onSubmit:pe,children:[(0,y.jsxs)(`div`,{className:`grid gap-3`,children:[(0,y.jsx)(l,{label:s(`projects.name`),children:(0,y.jsx)(`input`,{"data-autofocus":!0,value:P,onChange:e=>F(e.target.value),required:!0,placeholder:s(`projects.namePlaceholder`),className:`fld`})}),(0,y.jsx)(l,{label:s(`workflow.importSource`),children:(0,y.jsxs)(`select`,{className:`fld mb-3`,value:M,onChange:e=>ue(e.target.value),children:[(0,y.jsx)(`option`,{value:`upload`,children:s(`workflow.fromComputer`)}),(0,y.jsx)(`option`,{value:`server`,children:s(`workflow.fromServer`)})]})}),M===`server`&&(0,y.jsx)(l,{label:s(`projects.archiveDir`),error:W&&Z?Z:null,children:(0,y.jsxs)(`div`,{children:[(0,y.jsxs)(`div`,{className:`flex gap-2`,children:[(0,y.jsx)(`input`,{value:I,onChange:e=>L(e.target.value),onBlur:()=>G(!0),required:!0,placeholder:s(`projects.archiveDirPlaceholder`),"aria-invalid":W&&Z?!0:void 0,className:`fld fld-mono`}),fe&&(0,y.jsx)(`button`,{type:`button`,className:`btn shrink-0`,disabled:J,onClick:()=>void me(),children:s(`projects.picker.open`)})]}),J&&(0,y.jsx)(`span`,{className:`mt-1 block text-[11px] text-[color:var(--color-ink-2)]`,children:s(`projects.picker.nativeWaiting`)})]})})]}),(0,y.jsxs)(`button`,{type:`submit`,disabled:R||!P.trim(),className:`btn btn-primary mt-3`,children:[(0,y.jsx)(n,{size:13}),s(R?`projects.creating`:`projects.create`)]}),(0,y.jsx)(`button`,{type:`button`,className:`btn ml-2`,disabled:R,onClick:A,children:s(`common.cancel`)})]}),K&&(0,y.jsx)(le,{start:I,onClose:()=>q(!1),onPick:e=>{X(e),q(!1)}})]})}),d.enabled&&(0,y.jsx)(`div`,{className:`mb-3 flex flex-wrap gap-1`,role:`group`,"aria-label":s(`team.projectFilters`),children:[`all`,`mine`,`shared`].map(e=>(0,y.jsx)(`button`,{type:`button`,className:`btn btn-sm`,"aria-pressed":x===e,onClick:()=>S(e),children:s(`team.filter.${e}`)},e))}),(0,y.jsx)(`div`,{className:`mb-3 max-w-lg`,children:(0,y.jsx)(l,{label:s(`ux.projectsSearch`),children:(0,y.jsx)(`input`,{type:`search`,className:`fld`,value:O,onChange:e=>k(e.target.value),placeholder:s(`ux.projectsSearchHint`)})})}),(0,y.jsx)(u,{tab:s(`projects.list`),quiet:!0,flush:!0,aux:(0,y.jsx)(`span`,{children:se(N.length)}),children:$.length>0?(0,y.jsx)(`ul`,{className:`cascade ruled`,children:$.map(e=>(0,y.jsxs)(`li`,{className:`flex flex-wrap items-center gap-3 px-3 py-3 hover:bg-[color:var(--color-fill)]`,children:[(0,y.jsxs)(ne,{to:`/progetti/${e.id}`,className:`min-w-0 flex-1 basis-56 no-underline text-[color:var(--color-ink)]`,children:[(0,y.jsx)(`span`,{className:`block text-[15px] font-semibold`,children:e.name}),(0,y.jsx)(`span`,{className:`mt-1 block text-[12px] text-[color:var(--color-ink-2)]`,children:s(`team.ownerLine`,{name:e.owner_name??s(d.enabled?`team.noOwner`:`team.localProject`)})})]}),(0,y.jsx)(m,{tone:`neutral`,children:ae(_(e,d))}),(0,y.jsx)(`span`,{className:`text-[12px] text-[color:var(--color-ink-2)]`,children:oe(e.pages_count)}),e.members_count!=null&&(0,y.jsx)(`span`,{className:`text-[12px] text-[color:var(--color-ink-2)]`,children:p(`team.peopleCount`,e.members_count)}),(0,y.jsx)(`button`,{type:`button`,className:`btn btn-sm`,onClick:()=>w(e),"aria-label":s(`team.accessFor`,{name:e.name}),children:s(`team.peopleAccess`)})]},e.id))}):(0,y.jsxs)(`div`,{className:`flex flex-col items-start gap-2 p-6`,children:[(0,y.jsx)(t,{size:22}),(0,y.jsx)(`p`,{className:`text-[13px] font-semibold`,children:B?s(`common.loading`):N.length>0?s(`ux.noProjectMatch`):s(`projects.emptyTitle`)}),(0,y.jsx)(`p`,{className:`max-w-[60ch] text-[12px] text-[color:var(--color-ink-2)]`,children:N.length>0?s(`ux.noProjectMatchHint`):s(b?`ux.firstProjectHint`:`team.noAssignedProjects`)}),!B&&(N.length>0?(0,y.jsx)(`button`,{type:`button`,className:`btn`,onClick:()=>{k(``),S(`all`)},children:s(`ux.clearSearch`)}):b&&(0,y.jsx)(`button`,{type:`button`,className:`btn btn-primary`,onClick:j,children:s(`projects.new`)}))]})}),C&&(0,y.jsx)(ce,{projectId:C.id,projectName:C.name,canManage:_(C,d)?.can_manage===!0,onClose:()=>w(null),onAccessChanged:()=>void Q()},C.id)]})}export{b as default};
@@ -0,0 +1 @@
1
+ import{$ as e,M as t,X as n,b as r,c as i,ct as a,d as o,dt as s,ht as c,i as l,l as u,lt as d,p as f,r as ee,t as p,tt as te,u as m}from"./ui-BtIxuKN2.js";import{D as ne,O as h,S as re,T as ie,a as g,c as _,i as ae,o as oe,r as se,s as v}from"./index-DVWuV1Ff.js";var y=c(s(),1),b=d();function x(e,t){let n={queued:`recognition.statusQueued`,running:`recognition.statusRunning`,finished:`recognition.statusFinished`,finished_with_errors:`recognition.statusFinishedWithErrors`,failed:`recognition.statusFailed`,cancelled:`recognition.statusCancelled`}[e.state];return t(n)}function ce(e){return e.state===`finished`?`ok`:e.state===`finished_with_errors`?`warn`:e.state===`failed`||e.state===`cancelled`?`sig`:`progress`}function S(e){return e.engine===`ocr`?`local`:e.provider}var C=100;function le({run:e,onCancel:t}){let{t:n}=a(),r=_(),i=e.state===`queued`||e.state===`running`,o=e.total_pages?e.completed_pages/e.total_pages*100:0,s=S(e),c=[`local`,`ssh`,`vast`,`runpod`,`modal`,`custom`].includes(s)?`recognition.provider.${s}`:null;return(0,b.jsxs)(u,{tab:n(i?`recognition.current`:`recognition.recent`),aux:(0,b.jsx)(p,{tone:ce(e),children:x(e,n)}),children:[(0,b.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-x-4 gap-y-1`,children:[(0,b.jsx)(`strong`,{className:`text-[16px]`,children:v(e,r)}),(0,b.jsxs)(`span`,{className:`mono text-[11px] text-[color:var(--color-ink-3)]`,children:[c?n(c):s,` · #`,e.id]})]}),(0,b.jsxs)(`div`,{className:`mt-3`,children:[(0,b.jsx)(f,{value:o,label:n(`recognition.progress`,{done:e.completed_pages,total:e.total_pages})}),(0,b.jsxs)(`div`,{className:`mt-1.5 flex flex-wrap gap-x-4 gap-y-1 text-[12px] text-[color:var(--color-ink-2)]`,children:[(0,b.jsx)(`span`,{children:n(`recognition.progress`,{done:e.completed_pages,total:e.total_pages})}),(0,b.jsx)(`span`,{children:n(`recognition.completed`,{ok:e.succeeded_pages})}),e.failed_pages>0&&(0,b.jsx)(`span`,{children:n(`recognition.failed`,{n:e.failed_pages})})]})]}),(0,b.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[e.items?.[0]&&(0,b.jsx)(h,{to:`/annotazione?project=${e.project_id}&page=${e.items[0].page_id}&run=${e.id}`,className:`btn btn-primary no-underline`,children:n(`recognition.openStudio`)}),(0,b.jsx)(h,{to:`/risultati?project=${e.project_id}&run=${e.id}`,className:`btn btn-primary no-underline`,children:n(`recognition.openResults`)}),i&&(0,b.jsx)(`button`,{type:`button`,className:`btn btn-danger`,onClick:t,children:n(`recognition.cancel`)})]})]})}function w(){let{t:s}=a(),c=_(),d=ie(),f=ne(),[S,w]=(0,y.useState)(``),[T,E]=(0,y.useState)([]),[D,ue]=(0,y.useState)(``),[de,fe]=(0,y.useState)(C),[O,k]=(0,y.useState)(new Set),[pe,A]=(0,y.useState)([]),[me,he]=(0,y.useState)([]),[j,M]=(0,y.useState)(null),[N,P]=(0,y.useState)(`model`),[F,ge]=(0,y.useState)(!0),[I,L]=(0,y.useState)(!1),[R,z]=(0,y.useState)(null),[B,V]=(0,y.useState)(!1),[H,_e]=(0,y.useState)(null),[U,ve]=(0,y.useState)(null),[ye,be]=(0,y.useState)(!1);(0,y.useEffect)(()=>{re().catch(()=>{}),Promise.all([e(`/models`).then(e=>he(e.items)),e(`/system/prefill-engines`).then(_e),e(`/system/info`).then(e=>ve(e.capabilities??null))]).catch(()=>{})},[]),(0,y.useEffect)(()=>{ye||!H?.recommended||P(H.recommended)},[H?.recommended,ye]);let xe=async t=>{try{let n=await e(`/recognition-runs?project_id=${t}`);V(!1),A(n.items);let r=n.items.find(e=>e.state===`queued`||e.state===`running`);r&&M(await e(`/projects/${t}/recognition-runs/${r.id}`))}catch(e){if(e instanceof n&&e.status===404){V(!0),A([]);return}throw e}},Se=async t=>{if(w(t),ae(t===``?null:t),E([]),ue(``),fe(C),A([]),M(null),k(new Set),t!==``)try{let n=await e(`/projects/${t}/pages`);E(n.items),await xe(t)}catch(e){z(e)}},W=se(e=>void Se(e),z);(0,y.useEffect)(()=>{if(!j||j.state!==`queued`&&j.state!==`running`)return;let t=!1,n=async()=>{try{let n=await e(`/projects/${j.project_id}/recognition-runs/${j.id}`);if(t)return;if(M(n),n.state!==`queued`&&n.state!==`running`){await xe(n.project_id);let r=await e(`/projects/${n.project_id}/pages`);t||E(r.items)}}catch(e){t||z(e)}},r=setInterval(()=>void n(),2e3);return()=>{t=!0,clearInterval(r)}},[j?.id,j?.state]);let G=(0,y.useMemo)(()=>{let e=D.trim().toLocaleLowerCase();return e?T.filter(t=>g(t).toLocaleLowerCase().includes(e)):T},[T,D]),K=G.slice(0,de),q=(0,y.useMemo)(()=>T.filter(e=>(e.blocks??0)===0),[T]),J=me.find(e=>e.adapter_id===d.adapterId),Ce=!H||H.ocr.available,Y=H?H.model.available:d.available,X=N===`ocr`?Ce:d.enabled&&Y,we=N===`model`&&!d.isCloud&&!Y&&J?.local?.runnable!==!0&&U?.local_cuda===!1,Te=(U?.local_compute?.usable_runtimes?.length??0)>0,Ee=(0,y.useRef)(null),De=(0,y.useRef)(!1),Oe=e=>{let t=Ee.current,n=De.current&&t!=null&&t!==e;Ee.current=e,k(r=>{let i=new Set(r);if(n){let n=G.map(e=>e.id),a=n.indexOf(t),o=n.indexOf(e);if(a>=0&&o>=0){let t=!r.has(e);for(let e of n.slice(Math.min(a,o),Math.max(a,o)+1))t?i.add(e):i.delete(e);return i}}return i.has(e)?i.delete(e):i.add(e),i})},[Z,Q]=(0,y.useState)(null),ke=()=>{if(S===``||O.size===0)return;let e=T.filter(e=>O.has(e.id)&&(e.drafts??0)>0);if(e.length>0){Q({pages:e.length,drafts:e.reduce((e,t)=>e+(t.drafts??0),0)});return}$(`replace_drafts`)},$=async e=>{if(Q(null),S!==``&&O.size!==0){L(!0),z(null);try{let t=await te(`/projects/${S}/recognition-runs`,{page_ids:[...O],engine:N,mode:e,model_mode:`native`,stop_policy:f&&F&&N===`model`?`disable_inference`:`none`});M(t),A(e=>[t,...e.filter(e=>e.id!==t.id)])}catch(e){z(e)}finally{L(!1)}}},Ae=async()=>{if(j)try{M(await te(`/projects/${j.project_id}/recognition-runs/${j.id}/cancel`))}catch(e){z(e)}};return(0,b.jsxs)(`div`,{className:`p-3`,children:[(0,b.jsx)(o,{title:s(`recognition.title`),intro:s(`recognition.intro`)}),(0,b.jsxs)(`div`,{className:`mb-3 flex flex-wrap gap-2`,children:[(0,b.jsx)(h,{to:`/progetti?nuovo=1`,className:`btn btn-sm no-underline`,children:s(`projects.new`)}),S!==``&&(0,b.jsx)(h,{to:`/progetti/${S}`,className:`btn btn-sm no-underline`,children:s(`workflow.addPages`)}),(0,b.jsx)(h,{to:`/playground`,className:`btn btn-sm no-underline`,children:s(`nav.playground`)})]}),R!=null&&(0,b.jsx)(`div`,{className:`mb-3`,children:(0,b.jsx)(ee,{error:R,onDismiss:()=>z(null)})}),B&&(0,b.jsx)(`div`,{className:`mb-3`,children:(0,b.jsxs)(m,{tone:`warn`,children:[(0,b.jsx)(`span`,{children:s(`recognition.backendRestartRequired`)}),` `,(0,b.jsx)(`button`,{type:`button`,className:`font-semibold underline underline-offset-2`,onClick:()=>window.location.reload(),children:s(`recognition.reloadAfterRestart`)})]})}),j&&(0,b.jsx)(`div`,{className:`mb-3`,children:(0,b.jsx)(le,{run:j,onCancel:()=>void Ae()})}),(0,b.jsxs)(`div`,{className:`grid gap-3 xl:grid-cols-[minmax(0,1fr)_360px]`,children:[(0,b.jsxs)(u,{tab:s(`recognition.pages`),flush:!0,aux:(0,b.jsxs)(`span`,{children:[s(`recognition.selected`,{n:O.size}),` `,(0,b.jsxs)(`span`,{className:`text-[color:var(--color-ink-3)]`,children:[`· `,s(`recognition.rangeHint`)]})]}),children:[(0,b.jsxs)(`div`,{className:`flex flex-wrap items-end gap-3 border-b border-[color:var(--color-rule)] p-3`,children:[(0,b.jsx)(`div`,{className:`min-w-56 flex-1`,children:(0,b.jsx)(l,{label:s(`recognition.project`),children:(0,b.jsxs)(`select`,{value:S,onChange:e=>void Se(e.target.value===``?``:Number(e.target.value)),className:`fld`,children:[(0,b.jsx)(`option`,{value:``,children:s(`common.chooseProject`)}),W.map(e=>(0,b.jsx)(`option`,{value:e.id,children:e.name},e.id))]})})}),(0,b.jsx)(`div`,{className:`min-w-56 flex-1`,children:(0,b.jsx)(l,{label:s(`recognition.filterPages`),children:(0,b.jsx)(`input`,{value:D,onChange:e=>ue(e.target.value),className:`fld`,placeholder:s(`recognition.filterPagesHint`)})})}),(0,b.jsx)(`button`,{type:`button`,className:`btn`,disabled:G.length===0,onClick:()=>k(e=>new Set([...e,...G.map(e=>e.id)])),children:s(`recognition.selectAll`)}),q.length>0&&q.length<T.length&&(0,b.jsx)(`button`,{type:`button`,className:`btn`,onClick:()=>k(new Set(q.map(e=>e.id))),children:s(`recognition.selectUnrecognized`,{n:q.length})}),(0,b.jsx)(`button`,{type:`button`,className:`btn`,disabled:O.size===0,onClick:()=>k(new Set),children:s(`recognition.clearSelection`)})]}),T.length===0?(0,b.jsxs)(`div`,{className:`flex flex-col items-start gap-2 p-6`,children:[(0,b.jsx)(r,{size:22}),(0,b.jsx)(`p`,{className:`text-[13px] font-semibold`,children:W.length===0?s(`recognition.emptyNoArchive`):s(S===``?`recognition.emptyChooseProject`:`recognition.emptyPages`)}),(0,b.jsx)(`p`,{className:`max-w-[60ch] text-[12px] text-[color:var(--color-ink-2)]`,children:W.length===0?s(`recognition.emptyNoArchiveBody`):s(S===``?`recognition.emptyChooseProjectBody`:`recognition.emptyPagesBody`)}),W.length===0?(0,b.jsx)(h,{to:`/progetti`,className:`btn btn-primary no-underline`,children:s(`recognition.emptyCreateArchive`)}):S===``?null:(0,b.jsx)(h,{to:`/progetti/${S}`,className:`btn no-underline`,children:s(`recognition.emptyOpenProject`)})]}):G.length===0?(0,b.jsx)(`div`,{className:`p-6 text-[12px] text-[color:var(--color-ink-2)]`,children:s(`recognition.noFilteredPages`)}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`ul`,{className:`cascade grid grid-cols-2 border-l border-t border-[color:var(--color-rule)] sm:grid-cols-3 lg:grid-cols-5 2xl:grid-cols-7`,children:K.map(e=>{let t=O.has(e.id);return(0,b.jsx)(`li`,{className:`border-b border-r border-[color:var(--color-rule)]`,children:(0,b.jsxs)(`label`,{className:`block cursor-pointer ${t?`bg-[color:var(--color-sig-wash)] outline outline-2 -outline-offset-2 outline-[color:var(--color-sig)]`:`hover:bg-[color:var(--color-fill)]`}`,children:[(0,b.jsx)(`img`,{"data-fade":!0,src:`/api/pages/${e.id}/thumbnail`,alt:``,loading:`lazy`,className:`aspect-[3/4] w-full bg-white object-cover object-top`}),(0,b.jsxs)(`span`,{className:`flex items-center gap-2 border-t border-[color:var(--color-rule)] p-1.5`,children:[(0,b.jsx)(`input`,{type:`checkbox`,checked:t,onClick:e=>{De.current=e.shiftKey},onChange:()=>Oe(e.id)}),(0,b.jsx)(`span`,{className:`mono min-w-0 flex-1 truncate text-[11px]`,title:g(e),children:oe(e)}),(e.drafts??0)>0&&(0,b.jsx)(p,{tone:`warn`,children:s(`home.draftsBadge`,{n:e.drafts??0})})]})]})},e.id)})}),K.length<G.length&&(0,b.jsx)(`div`,{className:`flex items-center justify-center border-x border-b border-[color:var(--color-rule)] p-2`,children:(0,b.jsx)(`button`,{type:`button`,className:`btn btn-sm`,onClick:()=>fe(e=>e+C),children:s(`recognition.showMorePages`,{n:G.length-K.length})})})]})]}),(0,b.jsxs)(`div`,{className:`space-y-3`,children:[(0,b.jsxs)(u,{tab:s(`recognition.newRun`),className:`xl:sticky xl:top-0 xl:z-10`,children:[(0,b.jsx)(l,{label:s(`recognition.engine`),children:(0,b.jsxs)(`select`,{value:N,onChange:e=>{be(!0),P(e.target.value)},className:`fld`,children:[(0,b.jsx)(`option`,{value:`model`,disabled:!d.enabled||!Y,children:s(`recognition.servedModel`)}),(0,b.jsx)(`option`,{value:`ocr`,children:s(`recognition.localOcr`)})]})}),(0,b.jsx)(`p`,{className:`mt-1 text-[11px] text-[color:var(--color-ink-2)]`,children:s(N===`model`?`recognition.servedModelHint`:`recognition.localOcrHint`)}),N===`model`&&!d.isCloud&&J?.vram_warning&&(0,b.jsx)(m,{tone:`warn`,children:J.vram_warning}),N===`model`&&!d.isCloud&&J?.local_serve_blocker&&(0,b.jsx)(m,{tone:`sig`,children:J.local_serve_blocker}),N===`model`&&d.enabled&&!Y&&!we&&(0,b.jsx)(m,{tone:`warn`,children:s(`recognition.unreachableNotice`,{url:d.url})}),N===`ocr`&&H&&!H.ocr.available&&(0,b.jsx)(m,{tone:`sig`,children:s(`recognition.ocrMissingNotice`)}),we&&(0,b.jsx)(m,{tone:`warn`,children:Te?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`b`,{className:`font-semibold`,children:s(`recognition.modelNotLocalHere`)}),` `,s(`recognition.modelNotLocalHereBody`)]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`b`,{className:`font-semibold`,children:s(`recognition.noLocalGpu`)}),` `,U?.cuda_note===`WSL2`?s(`recognition.noLocalGpuWslBody`):s(`recognition.noLocalGpuBody`)]})}),(0,b.jsxs)(`div`,{className:`mt-3 border-y border-[color:var(--color-rule)] py-2`,children:[(0,b.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,b.jsxs)(`div`,{className:`min-w-0`,children:[(0,b.jsx)(`div`,{className:`text-[13px] font-semibold`,children:N===`model`?c(d.adapterId)??(d.model||`—`):s(`recognition.localOcr`)}),(0,b.jsx)(`div`,{className:`mono truncate text-[11px] text-[color:var(--color-ink-3)]`,children:N===`model`?d.provider?s(`recognition.provider.${d.provider}`):s(d.isCloud?`recognition.locationCloud`:`recognition.locationLocal`):s(`recognition.locationCpu`)})]}),(0,b.jsx)(p,{tone:X?`ok`:`warn`,children:N===`ocr`?s(Ce?`recognition.modelReady`:`recognition.ocrMissing`):d.enabled?s(X?`recognition.modelReady`:`recognition.modelUnreachable`):s(`recognition.modelOff`)})]}),(0,b.jsx)(h,{to:`/modelli`,className:`mt-2 inline-block text-[11px] font-semibold no-underline`,children:d.enabled?s(`recognition.changeModel`):s(`recognition.chooseModel`)})]}),N===`model`&&f&&(0,b.jsxs)(`label`,{className:`mt-3 flex items-start gap-2 text-[12px]`,children:[(0,b.jsx)(`input`,{type:`checkbox`,checked:F,onChange:e=>ge(e.target.checked)}),(0,b.jsxs)(`span`,{children:[(0,b.jsx)(`b`,{className:`font-semibold`,children:s(`recognition.stopAfter`)}),(0,b.jsx)(`span`,{className:`mt-0.5 block text-[11px] text-[color:var(--color-ink-3)]`,children:s(`recognition.stopAfterHint`)})]})]}),(0,b.jsxs)(`button`,{type:`button`,onClick:ke,disabled:B||I||S===``||O.size===0||!X,className:`btn btn-primary mt-4 w-full`,children:[(0,b.jsx)(t,{size:13}),s(I?`recognition.starting`:`recognition.start`)]})]}),(0,b.jsx)(u,{tab:s(`recognition.recent`),quiet:!0,flush:!0,children:pe.length===0?(0,b.jsx)(`p`,{className:`p-3 text-[12px] text-[color:var(--color-ink-2)]`,children:s(`recognition.noRuns`)}):(0,b.jsx)(`ul`,{className:`divide-y divide-[color:var(--color-rule)]`,children:pe.slice(0,8).map(e=>(0,b.jsx)(`li`,{children:(0,b.jsxs)(h,{to:`/risultati?project=${e.project_id}&run=${e.id}`,className:`flex items-center gap-2 p-2 text-[12px] no-underline hover:bg-[color:var(--color-fill)]`,children:[(0,b.jsxs)(`span`,{className:`mono text-[11px]`,children:[`#`,e.id]}),(0,b.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:v(e,c)}),(0,b.jsx)(p,{tone:ce(e),children:x(e,s)})]})},e.id))})})]})]}),Z&&(0,b.jsx)(i,{title:s(`recognition.replace.title`),onClose:()=>Q(null),footer:(0,b.jsxs)(`div`,{className:`flex flex-wrap justify-end gap-2`,children:[(0,b.jsx)(`button`,{type:`button`,className:`btn`,onClick:()=>Q(null),children:s(`common.cancel`)}),(0,b.jsx)(`button`,{type:`button`,className:`btn`,onClick:()=>void $(`merge`),children:s(`recognition.replace.merge`)}),(0,b.jsx)(`button`,{type:`button`,className:`btn btn-primary`,onClick:()=>void $(`replace_drafts`),children:s(`recognition.replace.replace`)})]}),children:(0,b.jsxs)(`div`,{className:`space-y-2 p-3 text-[13px]`,children:[(0,b.jsx)(`p`,{children:s(`recognition.replace.body`,{pages:Z.pages,drafts:Z.drafts})}),(0,b.jsx)(`p`,{className:`text-[12px] text-[color:var(--color-warn)]`,children:s(`recognition.replace.warning`)}),(0,b.jsx)(`p`,{className:`text-[12px] text-[color:var(--color-ink-2)]`,children:s(`recognition.replace.mergeHint`)})]})})]})}export{w as default};
@@ -0,0 +1 @@
1
+ import{$ as e,Q as t,Y as n,ct as r,d as i,dt as a,ht as o,i as s,j as ee,l as c,lt as l,p as u,r as d,t as f,tt as p,u as m,v as h,x as g}from"./ui-BtIxuKN2.js";import{D as te,N as ne,O as _,S as re,T as ie,a as v,c as y,i as b,r as x,s as S,w as C}from"./index-DVWuV1Ff.js";import{n as w}from"./dates-8UlpNJqU.js";var T=o(a(),1),E=l(),D=e=>e?.state===`queued`||e?.state===`running`,O=e=>({queued:`recognition.statusQueued`,running:`recognition.statusRunning`,finished:`recognition.statusFinished`,finished_with_errors:`recognition.statusFinishedWithErrors`,failed:`recognition.statusFailed`,cancelled:`recognition.statusCancelled`})[e]??e;function k(e,t,n){let r=t===`ocr`?`local`:e;return[`local`,`ssh`,`vast`,`runpod`,`modal`,`custom`].includes(r)?n(`recognition.provider.${r}`):r}var A=e=>e.state===`finished`&&e.blocks===0;function j(){let{t:a,locale:o}=r(),l=y(),[j,M]=(0,T.useState)(`all`),[N,P]=ne(),F=ie(),I=te(),[L,R]=(0,T.useState)(()=>Number(N.get(`project`))||``),[z,B]=(0,T.useState)([]),[V,H]=(0,T.useState)(null),[U,W]=(0,T.useState)(`text`),[G,K]=(0,T.useState)(null),q=async(t,n)=>{let r=await e(`/projects/${t}/recognition-runs/${n}`);H(r),M(`all`),P({project:String(t),run:String(n)},{replace:!0})},J=async t=>{if(R(t),b(t===``?null:t),B([]),H(null),t!==``)try{let n=await e(`/recognition-runs?project_id=${t}`);B(n.items);let r=Number(N.get(`run`)),i=n.items.find(e=>e.id===r)??n.items[0];i&&await q(t,i.id)}catch(e){K(e)}},ae=x(e=>void J(L===``?e:L),K);(0,T.useEffect)(()=>{if(!V||!D(V))return;let t=!1,n=async()=>{try{let n=await e(`/projects/${V.project_id}/recognition-runs/${V.id}`);t||(H(n),D(n)||await re())}catch(e){t||K(e)}},r=setInterval(()=>void n(),2e3);return()=>{t=!0,clearInterval(r)}},[V?.id,V?.state]);let Y=async e=>{if(V)try{let n=await t(`/projects/${V.project_id}/recognition-runs/${V.id}/export?scope=${e}&format=${U}`),r=URL.createObjectURL(n),i=document.createElement(`a`);i.href=r;let a=U===`text`?`txt`:U;i.download=`tabularium-run-${V.id}-${e}.${a}`,i.click(),URL.revokeObjectURL(r)}catch(e){K(e)}},oe=async()=>{try{await C(!1)}catch(e){K(e)}},se=async()=>{if(V)try{let e=await p(`/projects/${V.project_id}/recognition-runs/${V.id}/retry`);B(t=>[e,...t.filter(t=>t.id!==e.id)]),H(e),P({project:String(e.project_id),run:String(e.id)},{replace:!0})}catch(e){K(e)}},ce=V?.total_pages?V.completed_pages/V.total_pages*100:0,X=V?.items?.find(e=>e.drafts>0)??V?.items?.[0],Z=V?.items??[],Q={all:Z.length,drafts:Z.filter(e=>e.drafts>0).length,empty:Z.filter(A).length,failed:Z.filter(e=>e.state===`failed`).length},$=Z.filter(e=>j===`drafts`?e.drafts>0:j===`empty`?A(e):j!==`failed`||e.state===`failed`);return(0,E.jsxs)(`div`,{className:`p-3`,children:[(0,E.jsx)(i,{title:a(`recognition.resultsTitle`),intro:a(`recognition.resultsIntro`)}),G!=null&&(0,E.jsx)(`div`,{className:`mb-3`,children:(0,E.jsx)(d,{error:G,onDismiss:()=>K(null)})}),(0,E.jsxs)(`div`,{className:`grid gap-3 lg:grid-cols-[300px_minmax(0,1fr)]`,children:[(0,E.jsxs)(`div`,{className:`space-y-3`,children:[(0,E.jsx)(c,{tab:a(`recognition.project`),children:(0,E.jsx)(s,{label:a(`recognition.projectPick`),children:(0,E.jsxs)(`select`,{value:L,onChange:e=>void J(e.target.value===``?``:Number(e.target.value)),className:`fld`,children:[(0,E.jsx)(`option`,{value:``,children:a(`common.chooseProject`)}),ae.map(e=>(0,E.jsx)(`option`,{value:e.id,children:e.name},e.id))]})})}),(0,E.jsx)(c,{tab:a(`recognition.recent`),quiet:!0,flush:!0,children:z.length===0?(0,E.jsx)(`p`,{className:`p-3 text-[12px] text-[color:var(--color-ink-2)]`,children:a(`recognition.noRuns`)}):(0,E.jsx)(`ul`,{className:`divide-y divide-[color:var(--color-rule)]`,children:z.map(e=>(0,E.jsx)(`li`,{children:(0,E.jsxs)(`button`,{type:`button`,onClick:()=>L!==``&&void q(L,e.id),className:`w-full p-2 text-left ${V?.id===e.id?`bg-[color:var(--color-sig-wash)] outline outline-2 -outline-offset-2 outline-[color:var(--color-sig)]`:`hover:bg-[color:var(--color-fill)]`}`,children:[(0,E.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,E.jsxs)(`b`,{className:`mono text-[11px]`,children:[`#`,e.id]}),(0,E.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[12px] font-semibold`,children:S(e,l)})]}),(0,E.jsxs)(`span`,{className:`mt-1 flex flex-wrap items-center gap-x-2 text-[11px] text-[color:var(--color-ink-3)]`,children:[(0,E.jsx)(`span`,{children:a(`recognition.runPagesCount`,{done:e.completed_pages,total:e.total_pages})}),(0,E.jsxs)(`span`,{children:[`· `,k(e.provider,e.engine,a)]}),(0,E.jsxs)(`span`,{className:`mono`,children:[`· `,w(e.created_at,o)]}),e.state!==`finished`&&(0,E.jsx)(f,{tone:D(e)?`progress`:`warn`,children:a(O(e.state))})]})]})},e.id))})})]}),V?(0,E.jsxs)(`div`,{className:`space-y-3 lg:sticky lg:top-0 lg:max-h-[calc(100dvh-6rem)] lg:self-start lg:overflow-y-auto`,children:[(0,E.jsxs)(c,{tab:`${a(`recognition.resultsTitle`)} · #${V.id}`,aux:(0,E.jsx)(f,{tone:D(V)?`progress`:V.failed_pages?`warn`:`ok`,children:a(O(V.state))}),children:[(0,E.jsxs)(`div`,{className:`mb-2 flex flex-wrap items-baseline gap-x-3`,children:[(0,E.jsx)(`span`,{className:`text-[18px] font-bold`,children:S(V,l)}),(0,E.jsx)(`span`,{className:`mono text-[11px] text-[color:var(--color-ink-3)]`,children:w(V.created_at,o)})]}),(0,E.jsx)(u,{value:ce,label:a(`recognition.progress`,{done:V.completed_pages,total:V.total_pages})}),(0,E.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2 text-[12px]`,children:[(0,E.jsx)(`span`,{children:a(`recognition.progress`,{done:V.completed_pages,total:V.total_pages})}),(0,E.jsxs)(`span`,{className:`mono text-[11px] text-[color:var(--color-ink-3)]`,children:[k(V.provider,V.engine,a),` · `,V.adapter_id]}),(0,E.jsxs)(`span`,{className:`ml-auto flex flex-wrap gap-2`,children:[X&&(0,E.jsx)(_,{to:`/annotazione?project=${V.project_id}&page=${X.page_id}&run=${V.id}`,className:`btn btn-primary no-underline`,children:D(V)?a(`recognition.openStudio`):a(`recognition.startReview`)}),(0,E.jsxs)(`select`,{value:U,onChange:e=>W(e.target.value),className:`fld !w-auto`,"aria-label":a(`recognition.exportFormat`),children:[(0,E.jsx)(`option`,{value:`text`,children:a(`recognition.formatText`)}),(0,E.jsx)(`option`,{value:`csv`,children:a(`recognition.formatCsv`)}),(0,E.jsx)(`option`,{value:`json`,children:a(`recognition.formatJson`)})]}),(0,E.jsx)(`button`,{type:`button`,className:`btn`,disabled:D(V),onClick:()=>void Y(`raw`),children:a(`recognition.rawExport`)}),(0,E.jsx)(`button`,{type:`button`,className:`btn`,disabled:D(V),onClick:()=>void Y(`reviewed`),children:a(`recognition.reviewedExport`)})]})]}),!D(V)&&!F.enabled&&(0,E.jsx)(m,{tone:`ok`,children:a(`recognition.computeOff`)}),!D(V)&&(0,E.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[(V.failed_pages>0||V.state===`cancelled`)&&(0,E.jsx)(`button`,{type:`button`,className:`btn btn-primary`,onClick:()=>void se(),children:a(`recognition.retryFailed`)}),V.engine===`model`&&F.enabled&&I&&(0,E.jsx)(`button`,{type:`button`,className:`btn`,onClick:()=>void oe(),children:a(`recognition.disableNow`)})]})]}),(0,E.jsxs)(c,{tab:a(`recognition.runPages`),quiet:!0,flush:!0,aux:(0,E.jsx)(`div`,{role:`group`,"aria-label":a(`recognition.filterLabel`),className:`flex flex-wrap gap-1`,children:[`all`,`drafts`,`empty`,`failed`].filter(e=>e===`all`||Q[e]>0).map(e=>(0,E.jsx)(`button`,{type:`button`,"aria-pressed":j===e,onClick:()=>M(e),className:`btn btn-sm ${j===e?`!border-[color:var(--color-ink)] !bg-[color:var(--color-ink)] !text-white`:``}`,children:a(`recognition.filter.${e}`,{n:Q[e]})},e))}),children:[Q.empty>0&&j!==`failed`&&(0,E.jsx)(`p`,{className:`border-b border-[color:var(--color-rule)] bg-[color:var(--color-warn-wash)] px-3 py-2 text-[12px] text-[color:var(--color-warn)]`,children:a(`recognition.emptyHint`,{n:Q.empty})}),$.length===0&&(0,E.jsx)(`p`,{className:`p-3 text-[12px] text-[color:var(--color-ink-2)]`,children:a(`recognition.noneInFilter`)}),(0,E.jsx)(`ul`,{className:`cascade divide-y divide-[color:var(--color-rule)]`,children:$.map(e=>{let t=A(e),r=t?`text-[color:var(--color-warn)]`:e.state===`finished`?`text-[color:var(--color-ok)]`:e.state===`failed`?`text-[color:var(--color-sig-text)]`:`text-[color:var(--color-ink-2)]`,i=t?n:e.state===`finished`?g:e.state===`failed`?h:null;return(0,E.jsxs)(`li`,{className:`grid grid-cols-[48px_minmax(0,1fr)] items-center gap-x-3.5 gap-y-2 px-3.5 py-3 sm:grid-cols-[48px_minmax(0,1fr)_auto]`,children:[(0,E.jsx)(`img`,{"data-fade":!0,src:`/api/pages/${e.page_id}/thumbnail`,alt:``,className:`h-16 w-12 rounded-[4px] border border-[color:var(--color-rule)] bg-white object-cover object-top`}),(0,E.jsxs)(`div`,{className:`min-w-0`,children:[(0,E.jsx)(`div`,{className:`text-[18px] font-semibold leading-tight tracking-[-0.01em]`,children:e.pdf_page==null?e.rel_path:a(`recognition.pageN`,{n:e.pdf_page+1})}),e.pdf_page!=null&&(0,E.jsx)(`div`,{className:`mono truncate text-[12px] text-[color:var(--color-ink-2)]`,title:v(e),children:e.rel_path}),(0,E.jsxs)(`div`,{className:`mt-1.5 flex flex-wrap items-center gap-x-3 gap-y-1 text-[12px] text-[color:var(--color-ink-2)]`,children:[(0,E.jsxs)(`span`,{className:`inline-flex items-center gap-1 font-semibold ${r}`,children:[i&&(0,E.jsx)(i,{size:12}),a(t?`recognition.emptyResult`:O(e.state))]}),!t&&e.state!==`failed`&&(0,E.jsx)(`span`,{children:a(`recognition.blocks`,{n:e.blocks})}),e.drafts>0&&(0,E.jsx)(`span`,{className:`text-[color:var(--color-warn)]`,children:a(`recognition.drafts`,{n:e.drafts})})]}),e.error&&(0,E.jsx)(`p`,{className:`mt-1 text-[11px] text-[color:var(--color-sig-text)]`,children:e.error})]}),(0,E.jsxs)(_,{to:`/annotazione?project=${V.project_id}&page=${e.page_id}&run=${V.id}`,className:`btn col-span-2 justify-center no-underline sm:col-span-1`,children:[a(`recognition.review`),(0,E.jsx)(ee,{size:12})]})]},e.id)})})]})]}):(0,E.jsx)(c,{tab:a(`recognition.resultsTitle`),quiet:!0,children:(0,E.jsx)(`p`,{className:`text-[12px] text-[color:var(--color-ink-2)]`,children:a(`recognition.pickRun`)})})]})]})}export{j as default};
@@ -0,0 +1 @@
1
+ import{ct as e,dt as t,ht as n,i as r,lt as i,tt as a}from"./ui-BtIxuKN2.js";import{E as o}from"./index-DVWuV1Ff.js";var s=n(t(),1),c=i();function l(){let{t}=e(),{user:n,refresh:i}=o(),[l,u]=(0,s.useState)(``),[d,f]=(0,s.useState)(``),[p,m]=(0,s.useState)(``),[h,g]=(0,s.useState)(!1),[_,v]=(0,s.useState)(null),y=d.length>0&&d.length<8,b=p.length>0&&d!==p,x=l.length>0&&d.length>=8&&d===p&&!h;return(0,c.jsx)(`div`,{className:`flex min-h-screen items-center justify-center bg-[color:var(--color-fill)] p-4`,children:(0,c.jsxs)(`div`,{className:`mod w-full max-w-sm border-[color:var(--color-rule-strong)]`,children:[(0,c.jsx)(`div`,{className:`mod-head border-b-[color:var(--color-rule-strong)]`,children:(0,c.jsx)(`span`,{className:`mod-tab`,children:t(`account.setTitle`)})}),(0,c.jsxs)(`div`,{className:`mod-body`,children:[(0,c.jsx)(`p`,{className:`text-[12px] text-[color:var(--color-ink-2)]`,children:t(`account.setIntro`)}),(0,c.jsxs)(`form`,{onSubmit:async e=>{if(e.preventDefault(),x){g(!0),v(null);try{await a(`/auth/change-password`,{current_password:l,new_password:d}),await i()}catch{v(t(`account.wrongCurrent`)),g(!1)}}},className:`mt-3 space-y-3`,children:[(0,c.jsx)(r,{label:t(`account.currentPassword`),children:(0,c.jsx)(`input`,{type:`password`,value:l,onChange:e=>u(e.target.value),autoComplete:`current-password`,autoFocus:!0,className:`fld`})}),(0,c.jsx)(r,{label:t(`account.newPassword`),hint:t(`auth.passwordHint`),children:(0,c.jsx)(`input`,{type:`password`,value:d,onChange:e=>f(e.target.value),autoComplete:`new-password`,className:`fld`,"aria-invalid":y})}),(0,c.jsx)(r,{label:t(`account.confirmPassword`),children:(0,c.jsx)(`input`,{type:`password`,value:p,onChange:e=>m(e.target.value),autoComplete:`new-password`,className:`fld`,"aria-invalid":b})}),y&&(0,c.jsx)(`p`,{className:`text-[12px] text-[color:var(--color-sig-text)]`,children:t(`account.tooShort`)}),b&&(0,c.jsx)(`p`,{className:`text-[12px] text-[color:var(--color-sig-text)]`,children:t(`account.mismatch`)}),_&&(0,c.jsx)(`p`,{role:`alert`,className:`text-[12px] text-[color:var(--color-sig-text)]`,children:_}),(0,c.jsx)(`button`,{type:`submit`,disabled:!x,className:`btn btn-primary w-full justify-center`,children:t(h?`account.changing`:`account.setSubmit`)})]}),n&&(0,c.jsx)(`p`,{className:`mt-3 text-[11px] text-[color:var(--color-ink-3)]`,children:t(`auth.inviteFor`,{name:n.username})})]})]})})}export{l as default};
@@ -0,0 +1,2 @@
1
+ import{$ as e,_ as t,c as n,ct as r,d as i,dt as a,g as o,h as s,ht as c,i as l,it as u,l as d,lt as f,nt as p,r as m,rt as h,t as g,tt as _,u as v}from"./ui-BtIxuKN2.js";import{A as y,D as b,E as x,N as S,k as C,t as w}from"./index-DVWuV1Ff.js";import{t as T}from"./dates-8UlpNJqU.js";var E=c(a(),1),D=f();function O({onClose:e}){let{t}=r(),[i,a]=(0,E.useState)(``),[o,s]=(0,E.useState)(``),[c,l]=(0,E.useState)(``),[u,d]=(0,E.useState)(!1),[f,p]=(0,E.useState)(!1),[m,h]=(0,E.useState)(null),g=c.length>0&&o!==c,v=o.length>0&&o.length<8,y=i.length>0&&o.length>=8&&o===c&&!u,b=async()=>{if(y){d(!0),h(null);try{await _(`/auth/change-password`,{current_password:i,new_password:o}),p(!0)}catch(e){h(String(e).includes(`401`)?t(`account.wrongCurrent`):t(`account.changeFailed`))}finally{d(!1)}}};return(0,D.jsx)(n,{title:t(`account.changeTitle`),onClose:e,footer:(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`button`,{type:`button`,className:`btn btn-sm`,onClick:e,children:t(`common.close`)}),!f&&(0,D.jsx)(`button`,{type:`button`,className:`btn btn-sm btn-primary`,disabled:!y,onClick:()=>void b(),children:t(u?`account.changing`:`account.changeApply`)})]}),children:f?(0,D.jsx)(`p`,{className:`text-[13px] text-[color:var(--color-ok)]`,children:t(`account.changeOk`)}):(0,D.jsxs)(`div`,{className:`space-y-3`,children:[(0,D.jsx)(`p`,{className:`text-[12px] text-[color:var(--color-ink-2)]`,children:t(`account.changeIntro`)}),(0,D.jsxs)(`label`,{className:`block`,children:[(0,D.jsx)(`span`,{className:`lbl`,children:t(`account.currentPassword`)}),(0,D.jsx)(`input`,{type:`password`,value:i,onChange:e=>a(e.target.value),autoComplete:`current-password`,className:`fld w-full`})]}),(0,D.jsxs)(`label`,{className:`block`,children:[(0,D.jsx)(`span`,{className:`lbl`,children:t(`account.newPassword`)}),(0,D.jsx)(`input`,{type:`password`,value:o,onChange:e=>s(e.target.value),autoComplete:`new-password`,className:`fld w-full`,"aria-invalid":v}),v&&(0,D.jsx)(`span`,{className:`mt-1 block text-[11px] text-[color:var(--color-sig-text)]`,children:t(`account.tooShort`)})]}),(0,D.jsxs)(`label`,{className:`block`,children:[(0,D.jsx)(`span`,{className:`lbl`,children:t(`account.confirmPassword`)}),(0,D.jsx)(`input`,{type:`password`,value:c,onChange:e=>l(e.target.value),autoComplete:`new-password`,className:`fld w-full`,"aria-invalid":g}),g&&(0,D.jsx)(`span`,{className:`mt-1 block text-[11px] text-[color:var(--color-sig-text)]`,children:t(`account.mismatch`)})]}),m&&(0,D.jsx)(`p`,{className:`text-[12px] text-[color:var(--color-sig-text)]`,children:m})]})})}function k(){let{locale:e,setLocale:t,t:n}=r(),{user:i,updateProfile:a}=x(),[o,s]=(0,E.useState)(!1),[c,f]=(0,E.useState)(i?.email??``),[p,m]=(0,E.useState)(`idle`);if(!i)return(0,D.jsxs)(d,{tab:n(`settings.account`),children:[(0,D.jsx)(`p`,{className:`text-[13px] font-semibold`,children:n(`settings.localModeTitle`)}),(0,D.jsx)(`p`,{className:`mt-1 max-w-[72ch] text-[12px] text-[color:var(--color-ink-2)]`,children:n(`settings.localModeBody`)}),(0,D.jsx)(`div`,{className:`mt-3 grid items-end gap-3 sm:grid-cols-[minmax(220px,360px)_auto]`,children:(0,D.jsx)(l,{label:n(`settings.language`),hint:n(`settings.languageHint`),children:(0,D.jsx)(`select`,{className:`fld`,value:e,onChange:e=>t(e.target.value),children:h.map(e=>(0,D.jsx)(`option`,{value:e,children:u[e]},e))})})})]});let g=`users.role${i.role.charAt(0).toUpperCase()}${i.role.slice(1)}`,_=async()=>{m(`saving`);try{await a(c.trim()||null),m(`saved`),window.setTimeout(()=>m(`idle`),2500)}catch{m(`error`)}};return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(d,{tab:n(`settings.account`),children:[i.must_change_password&&(0,D.jsx)(`p`,{className:`mb-3 border-l-2 border-[color:var(--color-warn)] pl-2 text-[12px] text-[color:var(--color-warn)]`,children:n(`account.mustChangeNotice`)}),(0,D.jsxs)(`dl`,{className:`grid gap-x-6 gap-y-3 border-b border-[color:var(--color-rule)] pb-3 sm:grid-cols-3`,children:[(0,D.jsxs)(`div`,{className:`min-w-0`,children:[(0,D.jsx)(`dt`,{className:`lbl`,children:n(`settings.accountUser`)}),(0,D.jsx)(`dd`,{className:`truncate text-[13px] font-semibold`,children:i.username})]}),(0,D.jsxs)(`div`,{className:`min-w-0`,children:[(0,D.jsx)(`dt`,{className:`lbl`,children:n(`settings.accountRole`)}),(0,D.jsx)(`dd`,{className:`text-[13px]`,children:n(g)})]}),(0,D.jsxs)(`div`,{className:`min-w-0`,children:[(0,D.jsx)(`dt`,{className:`lbl`,children:n(`settings.accountEmail`)}),(0,D.jsx)(`dd`,{className:`truncate text-[13px] text-[color:var(--color-ink-2)]`,title:i.email||void 0,children:i.email||n(`settings.accountNoEmail`)})]})]}),(0,D.jsxs)(`div`,{className:`mt-3 grid items-end gap-3 sm:grid-cols-[minmax(200px,320px)_minmax(200px,320px)_auto]`,children:[(0,D.jsx)(l,{label:n(`settings.language`),hint:n(`settings.languageHint`),children:(0,D.jsx)(`select`,{className:`fld`,value:e,onChange:e=>t(e.target.value),children:h.map(e=>(0,D.jsx)(`option`,{value:e,children:u[e]},e))})}),(0,D.jsx)(l,{label:n(`account.email`),hint:n(p===`saved`?`account.emailSaved`:p===`error`?`account.emailFailed`:`account.emailHint`),children:(0,D.jsx)(`input`,{type:`email`,value:c,onChange:e=>{f(e.target.value),m(`idle`)},autoComplete:`email`,className:`fld`})}),(0,D.jsxs)(`div`,{className:`flex gap-2`,children:[(0,D.jsx)(`button`,{type:`button`,className:`btn`,disabled:p===`saving`||(c.trim()||``)===(i.email??``),onClick:()=>void _(),children:n(p===`saving`?`account.saving`:`account.saveProfile`)}),(0,D.jsx)(`button`,{type:`button`,className:`btn`,onClick:()=>s(!0),children:n(`settings.changePassword`)})]})]})]}),o&&(0,D.jsx)(O,{onClose:()=>s(!1)})]})}function A({isAdmin:n}){let{t:i,locale:a}=r(),c=w(),[l,u]=(0,E.useState)(null),[f,p]=(0,E.useState)(null),[h,y]=(0,E.useState)(null),[b,x]=(0,E.useState)(null),S=()=>(x(null),e(`/system/backup`).then(u).catch(e=>{u(null),x(e)}));(0,E.useEffect)(()=>{S()},[]);let C=e=>y({tone:`sig`,text:t(e).messaggio}),O=async()=>{p(`create`),y(null);try{let e=await _(`/system/backup`);y({tone:`ok`,text:i(`settings.backupCreated`,{name:e.name})}),await S()}catch(e){C(e)}finally{p(null)}},k=async e=>{if(await c({title:i(`settings.backupRestoreTitle`),message:i(`settings.backupRestoreBody`,{name:e.name}),acceptLabel:i(`settings.backupRestore`)})){p(e.name),y(null);try{await _(`/system/backup/${encodeURIComponent(e.name)}/restore?confirm=true`),y({tone:`ok`,text:i(`settings.backupRestored`,{name:e.name})}),await S()}catch(e){C(e)}finally{p(null)}}},A=l?.integrity,j=A?A.ok?(0,D.jsx)(g,{tone:`ok`,children:i(`settings.backupIntegrityOk`,{mode:A.journal_mode.toUpperCase()})}):(0,D.jsx)(g,{tone:`warn`,children:i(`settings.backupIntegrityFail`)}):(0,D.jsx)(g,{tone:`neutral`,children:i(`settings.backupIntegrityUnknown`)});return(0,D.jsxs)(`div`,{className:`space-y-3`,children:[b!=null&&(0,D.jsxs)(`div`,{children:[(0,D.jsx)(m,{error:b,onDismiss:()=>x(null)}),(0,D.jsx)(`button`,{type:`button`,className:`btn mt-2`,onClick:()=>void S(),children:i(`common.retry`)})]}),!n&&(0,D.jsx)(o,{title:i(`settings.tabData`),children:i(`settings.backupAdminOnly`)}),(0,D.jsxs)(d,{tab:i(`settings.backup`),aux:j,children:[(0,D.jsx)(`p`,{className:`max-w-[70ch] text-[12px] text-[color:var(--color-ink-2)]`,children:i(`settings.backupHint`)}),A&&!A.ok&&A.messages.length>0&&(0,D.jsx)(`pre`,{className:`mono mt-2 max-h-32 overflow-auto border border-[color:var(--color-rule)] bg-[color:var(--color-fill)] p-2 text-[11px] whitespace-pre-wrap`,children:A.messages.join(`
2
+ `)}),h&&(0,D.jsx)(v,{tone:h.tone,children:h.text}),l==null&&b==null&&(0,D.jsx)(s,{lines:3,label:i(`common.loading`)}),n&&(0,D.jsx)(`button`,{type:`button`,className:`btn btn-primary mt-3`,disabled:f!=null,onClick:()=>void O(),children:i(f===`create`?`settings.backupCreating`:`settings.backupCreate`)})]}),n&&(0,D.jsx)(d,{tab:i(`settings.backupList`),quiet:!0,flush:!0,children:(0,D.jsxs)(`div`,{className:`divide-y divide-[color:var(--color-rule)]`,children:[(l?.items??[]).map(e=>(0,D.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 px-3 py-2 text-[12px]`,children:[(0,D.jsx)(`span`,{className:`mono truncate`,children:e.name}),(0,D.jsx)(`span`,{className:`mono text-[11px] text-[color:var(--color-ink-3)]`,children:new Intl.NumberFormat(void 0,{style:`unit`,unit:e.size>=1048576?`megabyte`:`kilobyte`,maximumFractionDigits:1}).format(e.size/(e.size>=1048576?1048576:1024))}),(0,D.jsx)(`time`,{className:`text-[11px] text-[color:var(--color-ink-3)]`,dateTime:e.modified_at,children:T(e.modified_at,a)}),(0,D.jsxs)(`span`,{className:`ml-auto flex items-center gap-2`,children:[(0,D.jsx)(`a`,{className:`btn btn-sm`,href:`/api/system/backup/${encodeURIComponent(e.name)}`,children:i(`settings.backupDownload`)}),(0,D.jsx)(`button`,{type:`button`,className:`btn btn-sm btn-danger`,disabled:f!=null,onClick:()=>void k(e),children:f===e.name?i(`settings.backupRestoring`):i(`settings.backupRestore`)})]})]},e.name)),l!=null&&l.items.length===0&&(0,D.jsx)(`p`,{className:`px-3 py-2 text-[12px] text-[color:var(--color-ink-3)]`,children:i(`settings.backupEmpty`)}),l==null&&(0,D.jsx)(`p`,{className:`px-3 py-2 text-[12px] text-[color:var(--color-ink-3)]`,children:i(b==null?`common.loading`:`settings.backupUnavailable`)})]})})]})}function j(){let{t}=r(),[n,i]=(0,E.useState)(null),[a,o]=(0,E.useState)(null),[s,c]=(0,E.useState)(null),[l,u]=(0,E.useState)(!0),f=()=>{u(!0),c(null),Promise.all([e(`/system/info`),e(`/health`)]).then(([e,t])=>{i(e),o(t)}).catch(c).finally(()=>u(!1))};(0,E.useEffect)(f,[]);let p=[[t(`settings.envApp`),a?.version??n?.version??`—`],[t(`settings.envSchema`),n?.schema_version??`—`],[t(`settings.envData`),n?.data_dir??`—`],[t(`settings.envPython`),n?.python??`—`],[t(`settings.envPlatform`),n?.platform??`—`],[t(`settings.envDashboard`),n?.capabilities?.dashboard===void 0?`—`:n.capabilities.dashboard?t(`settings.yes`):t(`settings.no`)],[t(`settings.envCpuOcr`),n?.capabilities?.cpu_ocr===void 0?`—`:n.capabilities.cpu_ocr?t(`settings.yes`):t(`settings.no`)],[t(`settings.envLocalCuda`),n?.capabilities?.local_cuda===void 0?`—`:n.capabilities.local_cuda?t(`settings.yes`):n.capabilities.cuda_note??t(`settings.no`)],[t(`settings.envRemoteGpu`),n?.capabilities?.remote_gpu===void 0?`—`:n.capabilities.remote_gpu?t(`settings.yes`):t(`settings.no`)]];return(0,D.jsxs)(`div`,{className:`space-y-3`,children:[s!=null&&(0,D.jsxs)(`div`,{children:[(0,D.jsx)(m,{error:s,onDismiss:()=>c(null)}),(0,D.jsx)(`button`,{type:`button`,className:`btn mt-2`,onClick:f,children:t(`common.retry`)})]}),(0,D.jsxs)(d,{tab:t(`settings.env`),quiet:!0,aux:(0,D.jsx)(g,{tone:a?.status===`ok`?`ok`:l?`progress`:`warn`,children:l?t(`common.loading`):a?.status===`ok`?t(`settings.envOnline`):t(`settings.envUnavailable`)}),children:[(0,D.jsx)(`p`,{className:`mb-3 max-w-[70ch] text-[12px] text-[color:var(--color-ink-2)]`,children:t(`settings.envHint`)}),(0,D.jsx)(`dl`,{className:`grid gap-x-6 gap-y-2 sm:grid-cols-2 lg:grid-cols-3`,children:p.map(([e,t])=>(0,D.jsxs)(`div`,{className:`min-w-0 border-t border-[color:var(--color-rule)] pt-2`,children:[(0,D.jsx)(`dt`,{className:`lbl`,children:e}),(0,D.jsx)(`dd`,{className:`mono min-w-0 truncate text-[12px]`,title:t,children:t})]},e))})]})]})}function M({isAdmin:t}){let n=x().enabled,{t:i}=r(),[a,c]=(0,E.useState)(null),[u,f]=(0,E.useState)(null),[h,g]=(0,E.useState)(!1),[_,y]=(0,E.useState)(!1),[b,S]=(0,E.useState)(null);(0,E.useEffect)(()=>{e(`/settings`).then(e=>{c(e),f(e)}).catch(S)},[]);let w=async e=>{if(e.preventDefault(),a){g(!0),S(null),y(!1);try{let e=await p(`/settings`,{...a,instance_name:a.instance_name.trim()});c(e),f(e),y(!0)}catch(e){S(e)}finally{g(!1)}}},T=a!=null&&u!=null&&JSON.stringify(a)!==JSON.stringify(u),O=!!a?.instance_name.trim();return(0,D.jsxs)(`div`,{className:`space-y-3`,children:[b!=null&&(0,D.jsx)(m,{error:b,onDismiss:()=>S(null)}),!t&&(0,D.jsx)(o,{title:i(`settings.tabInstance`),children:i(`settings.readOnly`)}),(0,D.jsx)(d,{tab:i(`settings.instance`),children:a==null?(0,D.jsx)(s,{lines:4,label:i(`common.loading`)}):(0,D.jsxs)(`form`,{onSubmit:w,children:[(0,D.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,D.jsxs)(l,{label:i(`settings.instanceName`),hint:i(`settings.instanceNameHint`),children:[(0,D.jsx)(`input`,{className:`fld`,value:a.instance_name,maxLength:100,required:!0,"aria-invalid":!O,disabled:!t,onChange:e=>{y(!1),c({...a,instance_name:e.target.value})}}),!O&&(0,D.jsx)(`p`,{className:`mt-1 text-[11px] text-[color:var(--color-sig-text)]`,children:i(`settings.instanceNameRequired`)})]}),n&&(0,D.jsx)(l,{label:i(`settings.defaultRole`),hint:i(`settings.defaultRoleHint`),children:(0,D.jsxs)(`select`,{className:`fld`,value:a.default_new_user_role,disabled:!t,onChange:e=>{y(!1),c({...a,default_new_user_role:e.target.value})},children:[(0,D.jsx)(`option`,{value:`editor`,children:i(`users.roleEditor`)}),(0,D.jsx)(`option`,{value:`viewer`,children:i(`users.roleViewer`)})]})})]}),n?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(`label`,{className:`mt-3 flex items-center gap-2 text-[13px]`,children:[(0,D.jsx)(`input`,{type:`checkbox`,className:`h-4 w-4 accent-[color:var(--color-sig)]`,checked:a.allow_registration,disabled:!t,onChange:e=>{y(!1),c({...a,allow_registration:e.target.checked})}}),i(`settings.allowRegistration`)]}),(0,D.jsx)(`p`,{className:`mt-1 max-w-[70ch] text-[11px] text-[color:var(--color-ink-3)]`,children:i(`settings.allowRegistrationHint`)})]}):(0,D.jsx)(`p`,{className:`mt-3 max-w-[70ch] text-[12px] text-[color:var(--color-ink-2)]`,children:i(`settings.localNoAccounts`)}),_&&(0,D.jsx)(v,{tone:`ok`,children:i(`settings.saved`)}),t&&(0,D.jsx)(`button`,{type:`submit`,disabled:h||!T||!O,className:`btn btn-primary mt-3`,children:i(h?`settings.saving`:`settings.save`)})]})}),t&&n&&(0,D.jsxs)(d,{tab:i(`settings.accounts`),quiet:!0,children:[(0,D.jsx)(`p`,{className:`max-w-[70ch] text-[12px] text-[color:var(--color-ink-2)]`,children:i(`settings.accountsHint`)}),(0,D.jsx)(C,{to:`/utenti`,className:`btn mt-3`,children:i(`settings.manageUsers`)})]})]})}var N=[`paddleocr-vl`,`qwen3-vl-8b`,`unlimited-ocr`],P=[{key:`gpu_memory_utilization`,min:.2,max:.98,step:.01},{key:`max_model_len`,min:512,max:131072,step:512},{key:`max_num_seqs`,min:1,max:128,step:1},{key:`max_num_batched_tokens`,min:512,max:131072,step:512}],F=[{key:`temperature`,min:0,max:2,step:.05},{key:`top_p`,min:1e-6,max:1,step:1e-5},{key:`top_k`,min:1,max:1e3,step:1},{key:`max_tokens`,min:1,max:131072,step:128},{key:`repetition_penalty`,min:.5,max:2,step:.05},{key:`presence_penalty`,min:-2,max:2,step:.05},{key:`frequency_penalty`,min:-2,max:2,step:.005},{key:`no_repeat_ngram_size`,min:0,max:512,step:1}],I=[`use_layout_detection`,`layout_nms`,`use_doc_orientation_classify`,`use_doc_unwarping`,`use_chart_recognition`,`use_seal_recognition`,`use_ocr_for_image_block`,`format_block_content`,`merge_layout_blocks`,`use_queues`],L=[{key:`layout_threshold`,min:0,max:1,step:.01},{key:`layout_unclip_ratio`,min:.01,max:10,step:.05}],R=[`auto`,`rect`,`quad`,`poly`];function z({isAdmin:t}){let{t:n}=r(),[i,a]=(0,E.useState)([]),[o,c]=(0,E.useState)(``),[l,u]=(0,E.useState)({}),[f,h]=(0,E.useState)(!0),[_,y]=(0,E.useState)(!1),[b,x]=(0,E.useState)(null),[S,C]=(0,E.useState)(!1),w=Array.isArray(l.workflow?.layout_image_size)?l.workflow.layout_image_size:[1036,1036],T=async()=>{h(!0),x(null);try{let t=await e(`/system/model-settings`);a(t.items);let n=o||t.items[0]?.adapter_id||``;c(n);let r=t.items.find(e=>e.adapter_id===n);u(r?JSON.parse(JSON.stringify(r.effective)):{})}catch(e){x(e)}finally{h(!1)}};(0,E.useEffect)(()=>{T()},[]);let O=(0,E.useMemo)(()=>i.find(e=>e.adapter_id===o)??null,[i,o]),k=(e,t,n)=>{let r=n===``?null:Number(n);u(n=>({...n,[e]:{...n[e]??{},[t]:r}})),C(!1)},A=()=>{let e={};for(let t of[`serving`,`generation`,`image`,`workflow`,`mlx`]){let n=l[t]??{},r=O?.recommended[t]??{},i=Object.fromEntries(Object.entries(n).filter(([e,t])=>t!==null&&JSON.stringify(t)!==JSON.stringify(r[e])));Object.keys(i).length&&(e[t]=i)}return e},j=async(e=!1)=>{if(!(!O||!t)){y(!0),x(null);try{let t=await p(`/system/model-settings/${O.adapter_id}`,e?{}:A());a(e=>e.map(e=>e.adapter_id===t.adapter_id?t:e)),u(JSON.parse(JSON.stringify(t.effective))),C(!e)}catch(e){x(e)}finally{y(!1)}}},M=(e,r,i,a,o,s,c=!1)=>{let u=l[e]?.[r],d=O?.recommended[e]?.[r];return(0,D.jsxs)(`label`,{className:`block border-t border-[color:var(--color-rule)] pt-2`,children:[(0,D.jsx)(`span`,{className:`lbl`,children:i}),(0,D.jsx)(`input`,{type:`number`,min:a,max:o,step:s,value:typeof u==`boolean`||Array.isArray(u)?``:u??``,placeholder:c||d==null?n(`settings.modelAuto`):String(d),disabled:!t||f||_,onChange:t=>k(e,r,t.target.value),className:`fld mt-1 w-full`}),(0,D.jsx)(`span`,{className:`mt-1 block text-[10px] text-[color:var(--color-ink-3)]`,children:d==null?n(`settings.modelUsesAdapter`):n(`settings.modelRecommended`,{value:String(d)})})]},`${e}.${r}`)};return(0,D.jsxs)(`div`,{className:`space-y-3`,children:[b!=null&&(0,D.jsx)(m,{error:b,onDismiss:()=>x(null)}),S&&(0,D.jsx)(v,{tone:`ok`,children:n(`settings.modelSaved`)}),!t&&(0,D.jsx)(v,{tone:`warn`,children:n(`settings.modelAdminOnly`)}),(0,D.jsxs)(d,{tab:n(`settings.modelTuning`),quiet:!0,aux:(0,D.jsx)(g,{tone:O?.restart_required?`warn`:`ok`,children:O?.restart_required?n(`settings.modelRestart`):n(`settings.modelRecommendedBadge`)}),children:[(0,D.jsx)(`p`,{className:`mb-3 max-w-[75ch] text-[12px] text-[color:var(--color-ink-2)]`,children:n(`settings.modelTuningIntro`)}),(0,D.jsxs)(`label`,{className:`mb-3 block max-w-xl`,children:[(0,D.jsx)(`span`,{className:`lbl`,children:n(`settings.modelChoose`)}),(0,D.jsx)(`select`,{className:`fld mt-1 w-full`,value:o,onChange:e=>{let t=e.target.value;c(t);let n=i.find(e=>e.adapter_id===t);u(n?JSON.parse(JSON.stringify(n.effective)):{}),C(!1)},disabled:f,children:i.map(e=>(0,D.jsx)(`option`,{value:e.adapter_id,children:e.display_name},e.adapter_id))})]}),f&&(0,D.jsx)(s,{lines:5,label:n(`common.loading`)}),O&&(0,D.jsxs)(D.Fragment,{children:[O.restart_required&&(0,D.jsx)(v,{tone:`warn`,children:n(`settings.modelRestartHint`)}),(0,D.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-3`,children:[(0,D.jsxs)(`section`,{children:[(0,D.jsx)(`h3`,{className:`mb-2 text-[12px] font-bold uppercase tracking-wide`,children:n(`settings.modelRemoteRuntime`)}),(0,D.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-2 lg:grid-cols-1`,children:[O.adapter_id!==`monkeyocrv2-parsing`&&(0,D.jsxs)(`label`,{className:`block border-t border-[color:var(--color-rule)] pt-2`,children:[(0,D.jsx)(`span`,{className:`lbl`,children:n(`settings.modelField.dtype`)}),(0,D.jsxs)(`select`,{className:`fld mt-1 w-full`,value:String(l.serving?.dtype??``),disabled:!t||f||_,onChange:e=>{u(t=>({...t,serving:{...t.serving??{},dtype:e.target.value||null}})),C(!1)},children:[(0,D.jsx)(`option`,{value:``,children:n(`settings.modelAuto`)}),[`half`,`float16`,`bfloat16`,`float`,`float32`].map(e=>(0,D.jsx)(`option`,{value:e,children:e},e))]}),(0,D.jsx)(`span`,{className:`mt-1 block text-[10px] text-[color:var(--color-ink-3)]`,children:n(`settings.modelDtypeHint`)})]}),P.map(e=>M(`serving`,e.key,n(`settings.modelField.${e.key}`),e.min,e.max,e.step))]})]}),(0,D.jsxs)(`section`,{children:[(0,D.jsx)(`h3`,{className:`mb-2 text-[12px] font-bold uppercase tracking-wide`,children:n(`settings.modelGeneration`)}),(0,D.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-2 lg:grid-cols-1`,children:F.filter(e=>e.key===`no_repeat_ngram_size`?[`teleocr`,`mineru2.5`].includes(O.adapter_id):!(O.adapter_id===`glm-ocr`&&[`presence_penalty`,`frequency_penalty`].includes(e.key))).map(e=>M(`generation`,e.key,n(`settings.modelField.${e.key}`),e.min,e.max,e.step,!0))})]}),(0,D.jsxs)(`section`,{children:[(0,D.jsx)(`h3`,{className:`mb-2 text-[12px] font-bold uppercase tracking-wide`,children:n(`settings.modelImage`)}),(0,D.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-2 lg:grid-cols-1`,children:[O.adapter_id!==`mineru2.5`&&M(`image`,`max_pixels`,n(`settings.modelField.max_pixels`),0,128e6,1e3,!0),[`paddleocr-vl`,`qwen3-vl-8b`].includes(O.adapter_id)&&M(`image`,`min_pixels`,n(`settings.modelField.min_pixels`),1,64e6,1e3,!0)]}),(0,D.jsx)(`p`,{className:`mt-2 text-[10px] text-[color:var(--color-ink-3)]`,children:n(`settings.modelPixelsHint`)})]})]}),N.includes(O.adapter_id)&&(0,D.jsxs)(`section`,{className:`mt-4 border-t border-[color:var(--color-rule)] pt-3`,children:[(0,D.jsx)(`h3`,{className:`mb-1 text-[12px] font-bold uppercase tracking-wide`,children:n(`settings.modelMlxRuntime`)}),(0,D.jsx)(`p`,{className:`mb-3 max-w-[75ch] text-[11px] text-[color:var(--color-ink-2)]`,children:n(`settings.modelMlxIntro`)}),(0,D.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-2 lg:grid-cols-3`,children:[(O.mlx_repo_choices?.length??0)>0&&(0,D.jsxs)(`label`,{className:`block border-t border-[color:var(--color-rule)] pt-2`,children:[(0,D.jsx)(`span`,{className:`lbl`,children:n(`settings.mlxField.repo`)}),(0,D.jsxs)(`select`,{className:`fld mt-1 w-full`,value:String(l.mlx?.repo??``),disabled:!t||f||_,onChange:e=>{u(t=>({...t,mlx:{...t.mlx??{},repo:e.target.value||null}})),C(!1)},children:[(0,D.jsx)(`option`,{value:``,children:n(`settings.modelAuto`)}),O.mlx_repo_choices?.map(e=>(0,D.jsxs)(`option`,{value:e.repo,children:[e.variant,` · `,e.repo]},e.repo))]}),(0,D.jsx)(`span`,{className:`mt-1 block text-[10px] text-[color:var(--color-ink-3)]`,children:n(`settings.mlxRepoHint`)})]}),[[`kv_bits`,2,8,.5],[`kv_group_size`,16,256,16],[`max_kv_size`,512,131072,512],[`vision_cache_size`,0,1024,1]].map(([e,t,r,i])=>M(`mlx`,e,n(`settings.mlxField.${e}`),t,r,i,!0)),O.recommended?.mlx?.repetition_penalty!=null&&(0,D.jsxs)(D.Fragment,{children:[M(`mlx`,`repetition_penalty`,n(`settings.mlxField.repetition_penalty`),.5,2,.05,!0),M(`mlx`,`repetition_context_size`,n(`settings.mlxField.repetition_context_size`),1,2048,1,!0)]}),[`kv_quant_scheme`,`log_level`].map(e=>(0,D.jsxs)(`label`,{className:`block border-t border-[color:var(--color-rule)] pt-2`,children:[(0,D.jsx)(`span`,{className:`lbl`,children:n(`settings.mlxField.${e}`)}),(0,D.jsxs)(`select`,{className:`fld mt-1 w-full`,value:String(l.mlx?.[e]??``),disabled:!t||f||_,onChange:t=>{u(n=>({...n,mlx:{...n.mlx??{},[e]:t.target.value||null}})),C(!1)},children:[(0,D.jsx)(`option`,{value:``,children:n(`settings.modelAuto`)}),(e===`kv_quant_scheme`?[`uniform`,`turboquant`]:[`DEBUG`,`INFO`,`WARNING`,`ERROR`,`CRITICAL`]).map(e=>(0,D.jsx)(`option`,{value:e,children:e},e))]})]},e))]}),O.recommended?.mlx?.repetition_penalty!=null&&(0,D.jsx)(`p`,{className:`mt-2 text-[10px] text-[color:var(--color-ink-3)]`,children:n(`settings.mlxRepetitionHint`)})]}),O.adapter_id===`teleocr`&&(0,D.jsxs)(`section`,{className:`mt-4 max-w-xl border-t border-[color:var(--color-rule)] pt-3`,children:[(0,D.jsx)(`h3`,{className:`mb-2 text-[12px] font-bold uppercase tracking-wide`,children:n(`settings.modelWorkflow`)}),(0,D.jsxs)(`label`,{className:`block`,children:[(0,D.jsx)(`span`,{className:`lbl`,children:n(`settings.teleocrLayoutMode`)}),(0,D.jsxs)(`select`,{className:`fld mt-1 w-full`,value:String(l.workflow?.layout_mode??`Detection`),disabled:!t||f||_,onChange:e=>{u(t=>({...t,workflow:{...t.workflow??{},layout_mode:e.target.value}})),C(!1)},children:[(0,D.jsxs)(`option`,{value:`Detection`,children:[`Detection · `,n(`settings.teleocrDetectionHint`)]}),(0,D.jsxs)(`option`,{value:`Segmentation`,children:[`Segmentation · `,n(`settings.teleocrSegmentationHint`)]})]})]}),(0,D.jsx)(`p`,{className:`mt-1 text-[10px] text-[color:var(--color-ink-3)]`,children:n(`settings.teleocrLayoutOfficial`)})]}),O.adapter_id===`mineru2.5`&&(0,D.jsxs)(`section`,{className:`mt-4 max-w-3xl border-t border-[color:var(--color-rule)] pt-3`,children:[(0,D.jsx)(`h3`,{className:`mb-2 text-[12px] font-bold uppercase tracking-wide`,children:n(`settings.modelWorkflow`)}),(0,D.jsx)(`p`,{className:`mb-3 max-w-[75ch] text-[11px] text-[color:var(--color-ink-2)]`,children:`MinerUClient ufficiale: dimensione del layout, preparazione dei ritagli, post-processing e riconoscimento di formule/immagini.`}),(0,D.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-2 lg:grid-cols-3`,children:[M(`workflow`,`min_image_edge`,`min_image_edge`,1,4096,1),M(`workflow`,`max_image_edge_ratio`,`max_image_edge_ratio`,1,200,1),[`simple_post_process`,`handle_equation_block`,`abandon_list`,`abandon_paratext`,`image_analysis`,`enable_table_formula_eq_wrap`].map(e=>(0,D.jsxs)(`label`,{className:`block border-t border-[color:var(--color-rule)] pt-2`,children:[(0,D.jsx)(`span`,{className:`lbl`,children:e}),(0,D.jsxs)(`select`,{className:`fld mt-1 w-full`,value:String(l.workflow?.[e]??e===`handle_equation_block`),disabled:!t||f||_,onChange:t=>{u(n=>({...n,workflow:{...n.workflow??{},[e]:t.target.value===`true`}})),C(!1)},children:[(0,D.jsx)(`option`,{value:`true`,children:n(`settings.paddleEnabled`)}),(0,D.jsx)(`option`,{value:`false`,children:n(`settings.paddleDisabled`)})]})]},e)),[`width`,`height`].map((e,n)=>(0,D.jsxs)(`label`,{className:`block border-t border-[color:var(--color-rule)] pt-2`,children:[(0,D.jsxs)(`span`,{className:`lbl`,children:[`layout_image_size `,e]}),(0,D.jsx)(`input`,{className:`fld mt-1 w-full`,type:`number`,min:256,max:4096,step:1,value:Number(w[n]??1036),disabled:!t||f||_,onChange:e=>{let t=[...w];t[n]=Number(e.target.value),u(e=>({...e,workflow:{...e.workflow??{},layout_image_size:t}})),C(!1)}})]},e))]})]}),O.adapter_id===`monkeyocrv2-parsing`&&(0,D.jsxs)(`section`,{className:`mt-4 max-w-xl border-t border-[color:var(--color-rule)] pt-3`,children:[(0,D.jsx)(`h3`,{className:`mb-2 text-[12px] font-bold uppercase tracking-wide`,children:n(`settings.modelWorkflow`)}),(0,D.jsx)(`p`,{className:`mb-3 max-w-[75ch] text-[11px] text-[color:var(--color-ink-2)]`,children:n(`settings.monkeyDFlashIntro`)}),(0,D.jsxs)(`label`,{className:`block border-t border-[color:var(--color-rule)] pt-2`,children:[(0,D.jsx)(`span`,{className:`lbl`,children:n(`settings.monkeyDFlashEnabled`)}),(0,D.jsxs)(`select`,{className:`fld mt-1 w-full`,value:String(l.workflow?.dflash_enabled??!0),disabled:!t||f||_,onChange:e=>{u(t=>({...t,workflow:{...t.workflow??{},dflash_enabled:e.target.value===`true`}})),C(!1)},children:[(0,D.jsx)(`option`,{value:`true`,children:n(`settings.paddleEnabled`)}),(0,D.jsx)(`option`,{value:`false`,children:n(`settings.paddleDisabled`)})]})]}),(0,D.jsx)(`div`,{className:`mt-2 grid gap-2 sm:grid-cols-2`,children:M(`workflow`,`dflash_num_speculative_tokens`,n(`settings.monkeyDFlashTokens`),1,16,1,!0)})]}),O.adapter_id===`glm-ocr`&&(0,D.jsxs)(`section`,{className:`mt-4 max-w-xl border-t border-[color:var(--color-rule)] pt-3`,children:[(0,D.jsx)(`h3`,{className:`mb-2 text-[12px] font-bold uppercase tracking-wide`,children:n(`settings.modelWorkflow`)}),(0,D.jsx)(`p`,{className:`mb-3 max-w-[75ch] text-[11px] text-[color:var(--color-ink-2)]`,children:n(`settings.glmWorkflowIntro`)}),(0,D.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:M(`workflow`,`speculative_tokens`,n(`settings.glmSpeculativeTokens`),1,16,1)})]}),O.adapter_id===`deepseek-ocr`&&(0,D.jsxs)(`section`,{className:`mt-4 max-w-xl border-t border-[color:var(--color-rule)] pt-3`,children:[(0,D.jsx)(`h3`,{className:`mb-2 text-[12px] font-bold uppercase tracking-wide`,children:n(`settings.modelWorkflow`)}),(0,D.jsx)(`p`,{className:`mb-3 max-w-[75ch] text-[11px] text-[color:var(--color-ink-2)]`,children:n(`settings.deepseekWorkflowIntro`)}),(0,D.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:[M(`workflow`,`ngram_size`,n(`settings.deepseekNgramSize`),1,256,1),M(`workflow`,`window_size`,n(`settings.deepseekWindowSize`),1,1024,1)]})]}),O.adapter_id===`unlimited-ocr`&&(0,D.jsxs)(`section`,{className:`mt-4 max-w-xl border-t border-[color:var(--color-rule)] pt-3`,children:[(0,D.jsx)(`h3`,{className:`mb-2 text-[12px] font-bold uppercase tracking-wide`,children:n(`settings.modelWorkflow`)}),(0,D.jsx)(`p`,{className:`mb-3 max-w-[75ch] text-[11px] text-[color:var(--color-ink-2)]`,children:n(`settings.unlimitedWorkflowIntro`)}),(0,D.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:[M(`workflow`,`ngram_size`,n(`settings.unlimitedNgramSize`),1,512,1),M(`workflow`,`window_size`,n(`settings.unlimitedWindowSize`),1,2048,1),(0,D.jsxs)(`label`,{className:`block border-t border-[color:var(--color-rule)] pt-2`,children:[(0,D.jsx)(`span`,{className:`lbl`,children:n(`settings.unlimitedImageMode`)}),(0,D.jsxs)(`select`,{className:`fld mt-1 w-full`,value:String(l.workflow?.image_mode??`gundam`),disabled:!t||f||_,onChange:e=>{u(t=>({...t,workflow:{...t.workflow??{},image_mode:e.target.value}})),C(!1)},children:[(0,D.jsxs)(`option`,{value:`gundam`,children:[`gundam · `,n(`settings.unlimitedGundamHint`)]}),(0,D.jsxs)(`option`,{value:`base`,children:[`base · `,n(`settings.unlimitedBaseHint`)]})]})]})]})]}),O.adapter_id===`paddleocr-vl`&&(0,D.jsxs)(`section`,{className:`mt-4 border-t border-[color:var(--color-rule)] pt-3`,children:[(0,D.jsx)(`h3`,{className:`mb-1 text-[12px] font-bold uppercase tracking-wide`,children:n(`settings.modelWorkflow`)}),(0,D.jsx)(`p`,{className:`mb-3 max-w-[75ch] text-[11px] text-[color:var(--color-ink-2)]`,children:n(`settings.paddleWorkflowIntro`)}),(0,D.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-2 lg:grid-cols-3`,children:[I.map(e=>(0,D.jsxs)(`label`,{className:`block border-t border-[color:var(--color-rule)] pt-2`,children:[(0,D.jsx)(`span`,{className:`lbl`,children:n(`settings.paddleWorkflow.${e}`)}),(0,D.jsxs)(`select`,{className:`fld mt-1 w-full`,value:l.workflow?.[e]==null?`auto`:String(l.workflow[e]),disabled:!t||f||_,onChange:t=>{let n=t.target.value;u(t=>({...t,workflow:{...t.workflow??{},[e]:n===`auto`?null:n===`true`}})),C(!1)},children:[(0,D.jsx)(`option`,{value:`auto`,children:n(`settings.modelAuto`)}),(0,D.jsx)(`option`,{value:`true`,children:n(`settings.paddleEnabled`)}),(0,D.jsx)(`option`,{value:`false`,children:n(`settings.paddleDisabled`)})]})]},e)),L.map(e=>M(`workflow`,e.key,e.key,e.min,e.max,e.step,!0)),M(`workflow`,`vl_rec_max_concurrency`,n(`settings.paddleConcurrency`),1,128,1,!0),(0,D.jsxs)(`label`,{className:`block border-t border-[color:var(--color-rule)] pt-2`,children:[(0,D.jsx)(`span`,{className:`lbl`,children:n(`settings.paddleWorkflow.layout_shape_mode`)}),(0,D.jsx)(`select`,{className:`fld mt-1 w-full`,value:String(l.workflow?.layout_shape_mode??`auto`),disabled:!t||f||_,onChange:e=>{let t=e.target.value||null;u(e=>({...e,workflow:{...e.workflow??{},layout_shape_mode:t}})),C(!1)},children:R.map(e=>(0,D.jsx)(`option`,{value:e,children:n(`settings.paddleLayoutShape.${e}`)},e))})]}),(0,D.jsxs)(`label`,{className:`block border-t border-[color:var(--color-rule)] pt-2`,children:[(0,D.jsx)(`span`,{className:`lbl`,children:`layout_merge_bboxes_mode`}),(0,D.jsxs)(`select`,{className:`fld mt-1 w-full`,value:String(l.workflow?.layout_merge_bboxes_mode??``),disabled:!t||f||_,onChange:e=>{let t=e.target.value||null;u(e=>({...e,workflow:{...e.workflow??{},layout_merge_bboxes_mode:t}})),C(!1)},children:[(0,D.jsx)(`option`,{value:``,children:n(`settings.modelAuto`)}),(0,D.jsx)(`option`,{value:`large`,children:`large`}),(0,D.jsx)(`option`,{value:`small`,children:`small`}),(0,D.jsx)(`option`,{value:`union`,children:`union`})]})]})]})]}),(0,D.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2 border-t border-[color:var(--color-rule)] pt-3`,children:[(0,D.jsx)(`button`,{type:`button`,className:`btn btn-primary`,onClick:()=>void j(),disabled:!t||_||f,children:n(_?`common.saving`:`settings.modelSave`)}),(0,D.jsx)(`button`,{type:`button`,className:`btn`,onClick:()=>void j(!0),disabled:!t||_||f,children:n(`settings.modelReset`)})]})]})]})]})}var B=[{id:`account`,labelKey:`settings.tabAccount`,Section:k},{id:`istanza`,labelKey:`settings.tabInstance`,Section:M},{id:`modelli`,labelKey:`settings.tabModels`,Section:z},{id:`dati`,labelKey:`settings.tabData`,Section:A},{id:`ambiente`,labelKey:`settings.tabEnv`,Section:j}];function V(){let{t}=r(),[n,a]=S(),[o,s]=(0,E.useState)(null);(0,E.useEffect)(()=>{e(`/health`).then(e=>s(e.version)).catch(()=>{})},[]);let c=b();if(n.get(`s`)===`calcolo`)return(0,D.jsx)(y,{to:`/modelli`,replace:!0});let l=B.find(e=>e.id===n.get(`s`))??B[0],u=l.Section;return(0,D.jsxs)(`div`,{className:`p-3`,children:[(0,D.jsx)(i,{title:t(`settings.title`),intro:t(`settings.intro`),className:`pb-2`,aux:o&&(0,D.jsxs)(`span`,{className:`mono text-[12px] text-[color:var(--color-ink-3)]`,children:[`Tabularium v`,o]})}),(0,D.jsxs)(`nav`,{"aria-label":t(`settings.sections`),className:`-mx-3 flex overflow-x-auto border-b border-[color:var(--color-rule)]`,children:[(0,D.jsx)(`span`,{className:`w-px shrink-0 bg-[color:var(--color-rule)]`}),B.map(e=>(0,D.jsx)(`button`,{type:`button`,onClick:()=>a(e.id===B[0].id?{}:{s:e.id}),"aria-current":e.id===l.id?`page`:void 0,className:`shrink-0`,children:(0,D.jsx)(`span`,{className:`navtab`,"data-active":e.id===l.id,children:t(e.labelKey)})},e.id))]}),(0,D.jsx)(`div`,{className:`swap pt-3`,children:(0,D.jsx)(u,{isAdmin:c})},l.id)]})}export{V as default};
@@ -0,0 +1 @@
1
+ import{_ as e,ct as t,dt as n,ht as r,i,lt as a}from"./ui-BtIxuKN2.js";import{E as o}from"./index-DVWuV1Ff.js";var s=r(n(),1),c=a();function l(){let{t:n}=t(),{setup:r}=o(),[a,l]=(0,s.useState)(``),[u,d]=(0,s.useState)(``),[f,p]=(0,s.useState)(``),[m,h]=(0,s.useState)(``),[g,_]=(0,s.useState)(null),[v,y]=(0,s.useState)(!1);return(0,c.jsx)(`div`,{className:`flex min-h-screen items-center justify-center bg-[color:var(--color-fill)] p-4`,children:(0,c.jsxs)(`div`,{className:`mod w-full max-w-sm border-[color:var(--color-rule-strong)]`,children:[(0,c.jsx)(`div`,{className:`mod-head border-b-[color:var(--color-rule-strong)]`,children:(0,c.jsx)(`span`,{className:`mod-tab`,children:n(`auth.setupTitle`)})}),(0,c.jsxs)(`div`,{className:`mod-body`,children:[(0,c.jsxs)(`h1`,{className:`text-[22px] font-bold leading-tight tracking-[-0.03em]`,children:[`Tabularium`,(0,c.jsx)(`span`,{className:`text-[color:var(--color-sig-text)]`,children:`Lab`})]}),(0,c.jsx)(`p`,{className:`mt-1 text-[12px] text-[color:var(--color-ink-2)]`,children:n(`auth.setupSubtitle`)}),(0,c.jsxs)(`form`,{onSubmit:async t=>{if(t.preventDefault(),!a.trim()||!u){_(n(`auth.fillRequired`));return}if(u!==f){_(n(`auth.passwordsDiffer`));return}y(!0),_(null);try{await r(a.trim(),u,m)}catch(t){_(e(t).messaggio)}finally{y(!1)}},className:`mt-4 space-y-3`,children:[(0,c.jsx)(i,{label:n(`auth.username`),children:(0,c.jsx)(`input`,{type:`text`,value:a,onChange:e=>l(e.target.value),autoComplete:`username`,autoFocus:!0,className:`fld`})}),(0,c.jsx)(i,{label:n(`auth.password`),hint:n(`auth.passwordHint`),children:(0,c.jsx)(`input`,{type:`password`,value:u,onChange:e=>d(e.target.value),autoComplete:`new-password`,className:`fld`})}),(0,c.jsx)(i,{label:n(`auth.confirmPassword`),children:(0,c.jsx)(`input`,{type:`password`,value:f,onChange:e=>p(e.target.value),autoComplete:`new-password`,className:`fld`})}),(0,c.jsx)(i,{label:n(`auth.email`),hint:n(`auth.emailHint`),children:(0,c.jsx)(`input`,{type:`email`,value:m,onChange:e=>h(e.target.value),autoComplete:`email`,className:`fld`})}),g&&(0,c.jsx)(`p`,{role:`alert`,className:`text-[12px] text-[color:var(--color-sig-text)]`,children:g}),(0,c.jsx)(`button`,{type:`submit`,disabled:v,className:`btn btn-primary w-full justify-center`,children:n(v?`auth.busy`:`auth.setupSubmit`)})]})]})]})})}export{l as default};
@@ -0,0 +1 @@
1
+ import{$ as e,G as t,N as n,Z as r,a as i,c as a,ct as o,dt as s,ht as c,i as l,lt as u,nt as d,r as f,t as p,tt as m,u as h}from"./ui-BtIxuKN2.js";import{O as g,t as ee}from"./index-DVWuV1Ff.js";import{n as _,t as v}from"./avatar-CNaispuS.js";import{t as y}from"./dates-8UlpNJqU.js";var b=c(s(),1),x=u(),S=new Set([`block.deleted`,`block.updated`,`page.annotations_deleted`,`page.annotations_saved`,`page.approved`,`project.member_removed`,`project.member_set`,`project.owner_transferred`,`table.updated`,`training.started`,`training.stopped`]);function C(e){try{return e.payload_json?JSON.parse(e.payload_json):{}}catch{return{}}}function w({items:e,projectId:t,pages:n=[]}){let{t:r,locale:i}=o();return(0,x.jsxs)(`div`,{className:`divide-y divide-[color:var(--color-rule)] border-y border-[color:var(--color-rule)]`,children:[e.map(e=>{let a=C(e),o=e.resource_type===`page`?n.find(t=>t.id===e.resource_id):void 0,s=Number(a.blocks??a.deleted??NaN);return(0,x.jsxs)(`div`,{className:`grid gap-1 py-2 text-[12px] sm:grid-cols-[minmax(0,1fr)_auto] sm:items-baseline sm:gap-3`,children:[(0,x.jsxs)(`span`,{className:`min-w-0 break-words`,children:[(0,x.jsx)(`span`,{className:`font-semibold`,children:e.username||r(`project.localActor`)}),` · `,S.has(e.action)?r(`project.activity.${e.action.replace(`.`,`_`)}`):e.action,Number.isFinite(s)&&(0,x.jsxs)(`span`,{className:`text-[color:var(--color-ink-3)]`,children:[` (`,r(`project.activityBlocks`,{n:s}),`)`]}),o&&(0,x.jsxs)(x.Fragment,{children:[` · `,(0,x.jsx)(g,{className:`mono`,to:`/annotazione?project=${t}&page=${o.id}`,children:o.rel_path})]})]}),(0,x.jsx)(`time`,{className:`mono text-[11px] text-[color:var(--color-ink-3)]`,dateTime:e.created_at,children:y(e.created_at,i)})]},e.id)}),!e.length&&(0,x.jsx)(`p`,{className:`py-2 text-[12px] text-[color:var(--color-ink-2)]`,children:r(`project.noActivity`)})]})}function T({name:e,id:t,size:n=28}){return(0,x.jsx)(`span`,{"aria-hidden":`true`,className:`inline-flex shrink-0 items-center justify-center rounded-full font-semibold uppercase text-white`,style:{backgroundColor:v(t??e),width:n,height:n,fontSize:Math.round(n*.4)},children:_(e)})}function E({projectId:s,projectName:c,canManage:u,onClose:g,onAccessChanged:_}){let{t:v}=o(),y=ee(),[S,C]=(0,b.useState)([]),[E,O]=(0,b.useState)([]),[k,A]=(0,b.useState)([]),[j,M]=(0,b.useState)(``),[N,P]=(0,b.useState)(!1),[F,I]=(0,b.useState)(!1),[L,R]=(0,b.useState)(!0),[z,B]=(0,b.useState)(null),[V,H]=(0,b.useState)(`viewer`),[U,W]=(0,b.useState)(null),[G,K]=(0,b.useState)(null),[q,J]=(0,b.useState)(`people`),Y=(0,b.useRef)(null),X=async()=>{C(D(await e(`/projects/${s}/members`))),$(),u?O(await e(`/projects/${s}/member-candidates`)):(O([]),B(null),P(!1))};(0,b.useEffect)(()=>{R(!0),X().catch(K).finally(()=>R(!1))},[s,u]);let Z=S.find(e=>e.role===`owner`)??null,Q=(0,b.useMemo)(()=>{let e=j.trim().toLowerCase();return e?E.filter(t=>t.username.toLowerCase().includes(e)||(t.email??``).toLowerCase().includes(e)):E},[E,j]),te=async()=>{let e=z;if(!(!e||!u||F)){I(!0),K(null);try{await d(`/projects/${s}/members/${e.user_id}`,{user_id:e.user_id,role:V}),M(``),B(null),P(!1),W(v(`team.accessAdded`,{name:e.username})),await X(),_?.()}catch(e){K(e)}finally{I(!1)}}},ne=async(e,t)=>{if(!F){I(!0),K(null);try{await d(`/projects/${s}/members/${e.user_id}`,{user_id:e.user_id,role:t}),C(n=>n.map(n=>n.user_id===e.user_id?{...n,role:t}:n)),$()}catch(e){K(e)}finally{I(!1)}}},re=async e=>{if(!F&&await y({title:v(`share.removeTitle`),message:v(`share.removeConfirm`,{name:e.username})})){K(null),I(!0);try{await r(`/projects/${s}/members/${e.user_id}`),C(t=>t.filter(t=>t.user_id!==e.user_id)),u&&O(t=>[...t,e].sort((e,t)=>e.username.localeCompare(t.username))),$(),_?.()}catch(e){K(e)}finally{I(!1)}}},ie=async e=>{if(await y({title:v(`project.transferOwnerTitle`),message:v(`project.transferOwnerConfirm`)})){K(null),I(!0);try{await m(`/projects/${s}/owner`,{user_id:e.user_id}),_?.(),await X()}catch(e){K(e)}finally{I(!1)}}},$=async()=>{try{A((await e(`/projects/${s}/activity?limit=15`)).items)}catch{}};return(0,x.jsx)(a,{title:v(`share.title`,{name:c}),wide:!0,onClose:g,children:(0,x.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,x.jsx)(`div`,{className:`flex items-center gap-1 border-b border-[color:var(--color-rule)] px-3 pt-2`,role:`tablist`,children:[`people`,`activity`].map(e=>(0,x.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":q===e,onClick:()=>J(e),className:`-mb-px border-b-2 px-3 py-1.5 text-[12px] font-semibold ${q===e?`border-[color:var(--color-sig)] text-[color:var(--color-ink)]`:`border-transparent text-[color:var(--color-ink-3)] hover:text-[color:var(--color-ink)]`}`,children:e===`people`?v(`share.tabPeople`,{n:S.length}):v(`share.tabActivity`)},e))}),G!=null&&(0,x.jsx)(`div`,{className:`p-3`,children:(0,x.jsx)(f,{error:G,onDismiss:()=>K(null)})}),U&&(0,x.jsx)(`div`,{className:`px-3 pt-3`,children:(0,x.jsx)(h,{tone:`ok`,children:U})}),(0,x.jsx)(`p`,{className:`px-3 pt-3 text-[13px] text-[color:var(--color-ink-2)]`,children:v(u?`team.sharingHint`:`team.sharingReadOnly`)}),q===`people`?(0,x.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-auto p-3`,children:[u&&(0,x.jsxs)(`div`,{className:`relative mb-3`,onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||P(!1)},children:[(0,x.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,x.jsx)(`span`,{className:`lbl !mb-0 shrink-0`,children:v(`share.addPeople`)}),(0,x.jsx)(`input`,{ref:Y,value:j,onChange:e=>{M(e.target.value),B(null),P(!0)},onFocus:()=>P(!0),placeholder:v(`share.addPlaceholder`),className:`fld`,disabled:F||L,"aria-label":v(`share.addPlaceholder`)})]}),N&&(0,x.jsxs)(`div`,{className:`absolute left-0 right-0 top-full z-20 mt-1 max-h-56 overflow-auto border border-[color:var(--color-rule-strong)] bg-[color:var(--color-sheet)] shadow-lg`,children:[Q.slice(0,12).map(e=>(0,x.jsxs)(`button`,{type:`button`,disabled:F,onMouseDown:e=>e.preventDefault(),onClick:()=>{B(e),M(e.username),P(!1),W(null)},className:`flex w-full items-center gap-2 px-3 py-1.5 text-left text-[12px] hover:bg-[color:var(--color-fill)] disabled:opacity-50`,children:[(0,x.jsx)(T,{name:e.username,id:e.user_id,size:22}),(0,x.jsx)(`span`,{className:`min-w-0 truncate font-semibold`,children:e.username}),e.email&&(0,x.jsx)(`span`,{className:`min-w-0 truncate text-[11px] text-[color:var(--color-ink-3)]`,children:e.email}),(0,x.jsx)(n,{size:11,className:`ml-auto shrink-0`})]},e.user_id)),!Q.length&&(0,x.jsx)(`p`,{className:`px-3 py-2 text-[12px] text-[color:var(--color-ink-3)]`,children:E.length?v(`share.noMatches`):v(`share.noCandidates`)})]}),(0,x.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-end gap-2`,children:[(0,x.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,x.jsx)(l,{label:v(`team.newRole`),hint:v(V===`editor`?`team.editorHelp`:`team.viewerHelp`),children:(0,x.jsxs)(`select`,{className:`fld`,"aria-label":v(`team.newRole`),value:V,disabled:F,onChange:e=>H(e.target.value),children:[(0,x.jsx)(`option`,{value:`viewer`,children:v(`share.roleViewer`)}),(0,x.jsx)(`option`,{value:`editor`,children:v(`share.roleEditor`)})]})})}),(0,x.jsx)(`button`,{type:`button`,className:`btn btn-primary`,disabled:!z||F||L,onClick:()=>void te(),children:v(`team.addToProject`)})]}),!L&&!E.length&&(0,x.jsx)(`p`,{className:`mt-2 text-[13px] text-[color:var(--color-ink-2)]`,children:v(`team.newAccountHint`)})]}),(0,x.jsx)(`p`,{className:`lbl`,children:v(`share.whoHasAccess`)}),L&&(0,x.jsx)(i,{label:v(`common.loading`)}),(0,x.jsxs)(`div`,{className:`divide-y divide-[color:var(--color-rule)] border-y border-[color:var(--color-rule)]`,children:[S.map(e=>(0,x.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 py-2 text-[12px]`,children:[(0,x.jsx)(T,{name:e.username,id:e.user_id,size:30}),(0,x.jsxs)(`div`,{className:`min-w-0`,children:[(0,x.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,x.jsx)(`span`,{className:`truncate font-semibold`,title:e.username,children:e.username}),!e.active&&(0,x.jsx)(p,{tone:`warn`,children:v(`share.inactive`)})]}),e.email&&(0,x.jsx)(`span`,{className:`mono block truncate text-[11px] text-[color:var(--color-ink-3)]`,children:e.email})]}),(0,x.jsx)(`div`,{className:`ml-auto flex items-center gap-2`,children:e.role===`owner`||!u?(0,x.jsx)(`span`,{className:`mono text-[12px] text-[color:var(--color-ink-2)]`,children:v(e.role===`owner`?`share.roleOwner`:e.role===`editor`?`share.roleEditor`:`share.roleViewer`)}):(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(`select`,{className:`fld w-auto min-w-[8rem]`,value:e.role,disabled:F,onChange:t=>void ne(e,t.target.value),"aria-label":v(`project.memberRoleFor`,{name:e.username}),children:[(0,x.jsx)(`option`,{value:`editor`,children:v(`share.roleEditor`)}),(0,x.jsx)(`option`,{value:`viewer`,children:v(`share.roleViewer`)})]}),(0,x.jsx)(`button`,{type:`button`,className:`btn btn-sm`,disabled:F,onClick:()=>void ie(e),title:v(`project.transferOwner`),children:v(`share.makeOwner`)}),(0,x.jsx)(`button`,{type:`button`,className:`btn btn-sm`,disabled:F,onClick:()=>void re(e),"aria-label":v(`share.removeFor`,{name:e.username}),title:v(`project.removeMember`),children:(0,x.jsx)(t,{size:11})})]})})]},e.user_id)),!L&&!S.length&&(0,x.jsx)(`p`,{className:`py-2 text-[12px] text-[color:var(--color-ink-2)]`,children:v(`project.noMembers`)})]}),Z&&(0,x.jsx)(`p`,{className:`mt-2 text-[11px] text-[color:var(--color-ink-3)]`,children:v(`share.ownerHint`,{name:Z.username})})]}):(0,x.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto p-3`,children:(0,x.jsx)(w,{items:k,projectId:s})})]})})}function D(e){let t={owner:0,editor:1,viewer:2};return[...e].sort((e,n)=>t[e.role]-t[n.role]||e.username.localeCompare(n.username))}export{w as n,E as t};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/TableWorkspacePage-DYqW4eXA.js","assets/ui-BtIxuKN2.js","assets/index-DVWuV1Ff.js","assets/index-Bu1kTJtO.css","assets/ContentPane-DPwsshn8.js"])))=>i.map(i=>d[i]);
2
+ import{$ as e,a as t,ct as n,dt as r,ht as i,lt as a,r as o,u as s}from"./ui-BtIxuKN2.js";import{E as c,M as l,O as u,P as d}from"./index-DVWuV1Ff.js";import{n as f}from"./projectAccess-D3wgwunj.js";var p=i(r(),1),m=a(),h=(0,p.lazy)(()=>d(()=>import(`./TableWorkspacePage-DYqW4eXA.js`),__vite__mapDeps([0,1,2,3,4])));function g(){let{blockId:r}=l(),i=c(),{t:a}=n(),[d,g]=(0,p.useState)(null),[_,v]=(0,p.useState)(null);return(0,p.useEffect)(()=>{let t=!0;return g(null),v(null),e(`/blocks/${r}`).then(async n=>{let r=await e(`/projects/${n.project_id}`);t&&g({block:n,project:r})}).catch(e=>{t&&v(e)}),()=>{t=!1}},[r,i.user?.id]),_?(0,m.jsx)(`div`,{className:`p-3`,children:(0,m.jsx)(o,{error:_})}):!d||String(d.block.id)!==r?(0,m.jsx)(t,{label:a(`team.loadingAccess`)}):f(d.project,i)?.can_edit?(0,m.jsx)(p.Suspense,{fallback:(0,m.jsx)(t,{label:a(`common.loading`)}),children:(0,m.jsx)(h,{block:d.block},r)}):(0,m.jsxs)(`div`,{className:`p-3`,children:[(0,m.jsx)(s,{children:a(`team.readerNotice`)}),(0,m.jsx)(u,{className:`btn mt-3`,to:`/annotazione?project=${d.project.id}&page=${d.block.page_id}`,children:a(`team.openReader`)})]})}export{g as default};
@@ -0,0 +1 @@
1
+ import{ct as e,dt as t,et as n,ht as r,lt as i,nt as a,r as o}from"./ui-BtIxuKN2.js";import{M as s,N as c,j as l}from"./index-DVWuV1Ff.js";import{n as u,s as d}from"./ContentPane-DPwsshn8.js";var f=r(t(),1),p=i();function m({block:t}){let{blockId:r=``}=s(),[i]=c(),{t:m}=e(),h=Number(r),g=(0,f.useRef)(t?.annotation_revision??0),[_,v]=(0,f.useState)(null),y=t?.page_id??(Number(i.get(`page`))||null),b=Number(i.get(`width`))||0,x=Number(i.get(`height`))||0,S=b>0&&x>0?{w:b,h:x}:null,C=(0,f.useMemo)(()=>y?`/api/pages/${y}/preview`:null,[y]),w=l(),T=(0,f.useRef)(null),[E,D]=(0,f.useState)(t?!!t.confirmed:i.get(`confirmed`)===`1`),O=!!(window.opener&&!window.opener.closed),k=`/annotazione?${t?.project_id?`project=${t.project_id}&`:``}${y?`page=${y}`:``}`,A=async()=>{try{if(await T.current?.(),!O){w(k);return}window.opener?.focus(),window.close(),window.setTimeout(()=>{window.closed||w(k)},200)}catch(e){v(e)}};if(!Number.isInteger(h)||h<1)return(0,p.jsx)(`div`,{className:`p-4 text-sm`,children:m(`table.loadFailed`)});let j=e=>{if(!y||!(`BroadcastChannel`in window))return;let t=new BroadcastChannel(`tabularium.annotation-revision`);t.postMessage({pageId:y,...e}),t.close()},M=async(e,t)=>{let n=await a(`/blocks/${h}/table?expected_revision=${g.current}`,t);return n.annotation_revision!=null&&(g.current=n.annotation_revision),j({revision:n.annotation_revision}),n.otsl},N=async e=>{D(e);try{await T.current?.();let t=await n(`/blocks/${h}?expected_revision=${g.current}`,{confirmed:e});t.annotation_revision!=null&&(g.current=t.annotation_revision),j({revision:t.annotation_revision,blockId:h,confirmed:e})}catch(t){v(t),D(!e)}};return(0,p.jsxs)(`main`,{className:`flex h-[100dvh] min-h-0 flex-col overflow-hidden bg-[color:var(--color-sheet)]`,children:[(0,p.jsxs)(`header`,{className:`flex shrink-0 items-center gap-3 border-b border-[color:var(--color-rule-strong)] bg-[color:var(--color-fill)] px-3 py-2`,children:[O?(0,p.jsx)(`button`,{type:`button`,onClick:()=>void A(),className:`btn btn-sm`,title:m(`table.closeAndReturnHint`),children:m(`table.closeAndReturn`)}):(0,p.jsx)(`button`,{type:`button`,onClick:()=>void A(),className:`btn btn-sm`,children:m(`table.backToAnnotation`)}),(0,p.jsx)(`h1`,{className:`mod-tab title-plate m-0`,children:m(`table.workspaceTitle`)}),(0,p.jsx)(u,{checked:E,onChange:e=>void N(e)}),(0,p.jsx)(`span`,{className:`flex-1`}),(0,p.jsxs)(`span`,{className:`mono text-[11px] text-[color:var(--color-ink-2)]`,children:[`#`,h]})]}),_!=null&&(0,p.jsx)(o,{error:_,onDismiss:()=>v(null)}),(0,p.jsx)(`div`,{className:`enter flex min-h-0 flex-1 flex-col p-2`,children:(0,p.jsx)(d,{serverId:h,pageImageUrl:C,pageId:y,pageImageSize:S,onSaveTable:M,flushRef:T},h)})]})}export{m as default};