efficient-shell 9.1.0 → 9.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (451) hide show
  1. package/README.md +70 -20
  2. package/dist/Browser-ZPOVP4Z7.js +43 -0
  3. package/dist/Calculator-CSYRZAS5.js +29 -0
  4. package/dist/CurrencyConverter-SSR2XDIC.js +21 -0
  5. package/dist/{Documents-BOVXZFYC.js → Documents-T7JYO223.js} +27 -27
  6. package/dist/Files-HBGW3JWI.js +88 -0
  7. package/dist/Notepad-GO2QT55C.js +25 -0
  8. package/dist/PdfViewer-XSISAJZP.js +1 -0
  9. package/dist/{PomodoroTimer-ZCJBTFV5.js → PomodoroTimer-EV6D4OFU.js} +28 -28
  10. package/dist/Preview-Z2CRCDHA.js +177 -0
  11. package/dist/Sidebar-Y4DTQYW2.js +43 -0
  12. package/dist/Spreadsheet-GEE77GD3.js +37 -0
  13. package/dist/Stock-6ZIQHGPH.js +16 -0
  14. package/dist/Weather-II7NFRMK.js +60 -0
  15. package/dist/WorldClock-NBLNO63Q.js +32 -0
  16. package/dist/ai/index.d.ts +34 -3
  17. package/dist/ai/index.js +53 -53
  18. package/dist/ai.css +1 -1
  19. package/dist/apps/index.js +1 -1
  20. package/dist/bin/media-host-check.js +1 -1
  21. package/dist/bin/ui-check.js +1 -1
  22. package/dist/brand.css +1 -1
  23. package/dist/charts/BoxPlotChart.js +1 -1
  24. package/dist/charts/CandlestickChart.js +1 -1
  25. package/dist/charts/CartesianPlot.js +1 -1
  26. package/dist/charts/ChartBrush.js +1 -1
  27. package/dist/charts/ChartFrame.js +1 -1
  28. package/dist/charts/ChartSkeleton.js +1 -1
  29. package/dist/charts/ChartTooltip.js +1 -1
  30. package/dist/charts/ChordChart.js +1 -1
  31. package/dist/charts/ColumnChart.js +1 -1
  32. package/dist/charts/FunnelChart.js +1 -1
  33. package/dist/charts/HeatmapChart.js +1 -1
  34. package/dist/charts/HistogramChart.js +1 -1
  35. package/dist/charts/Meter.js +1 -1
  36. package/dist/charts/PieChart.js +1 -1
  37. package/dist/charts/RadarChart.js +1 -1
  38. package/dist/charts/RadialBarChart.js +1 -1
  39. package/dist/charts/RangeChart.js +1 -1
  40. package/dist/charts/RankedBars.js +1 -1
  41. package/dist/charts/SankeyChart.js +1 -1
  42. package/dist/charts/ScatterChart.js +1 -1
  43. package/dist/charts/SpecChart.js +1 -1
  44. package/dist/charts/StatTile.js +1 -1
  45. package/dist/charts/SunburstChart.js +1 -1
  46. package/dist/charts/TimeSeriesChart.js +1 -1
  47. package/dist/charts/TreemapChart.js +1 -1
  48. package/dist/charts/WaterfallChart.js +1 -1
  49. package/dist/chunk-24K6GVNM.js +28 -0
  50. package/dist/{chunk-ZEKM6HAA.js → chunk-2HEJDLPP.js} +2 -2
  51. package/dist/{chunk-BRHIRE4D.js → chunk-2MLRK7IO.js} +2 -2
  52. package/dist/chunk-2R3BVU75.js +26 -0
  53. package/dist/chunk-2YLG32JY.js +2 -0
  54. package/dist/{chunk-TZSPJIP4.js → chunk-32VV2J22.js} +1 -1
  55. package/dist/{chunk-QQCHLRKG.js → chunk-3APSMJPN.js} +1 -1
  56. package/dist/{chunk-6SMQNPWS.js → chunk-43ONX6UZ.js} +1 -1
  57. package/dist/{chunk-L7IKTEOC.js → chunk-442FFHQJ.js} +13 -13
  58. package/dist/chunk-4MVRSCQE.js +1 -0
  59. package/dist/{chunk-BT3XDH3L.js → chunk-56RAOI7O.js} +6 -6
  60. package/dist/chunk-5F7HMNCX.js +5 -0
  61. package/dist/chunk-5GUBNCTP.js +1 -0
  62. package/dist/{chunk-LGLZTJ2W.js → chunk-5JRL5LXD.js} +6 -6
  63. package/dist/{chunk-OFHCDTJM.js → chunk-5VOVNIOU.js} +1 -1
  64. package/dist/{chunk-NID6MGGC.js → chunk-5VRMQTKV.js} +8 -8
  65. package/dist/chunk-6453ISTQ.js +4 -0
  66. package/dist/chunk-6FEL5D56.js +8 -0
  67. package/dist/{chunk-MVQBVPWP.js → chunk-6KBDNYRW.js} +1 -1
  68. package/dist/{chunk-D2AUUIKG.js → chunk-6MVHRNWC.js} +1 -1
  69. package/dist/{chunk-TW7TA2AB.js → chunk-6ZHX56NM.js} +1 -1
  70. package/dist/{chunk-RNBM5JZI.js → chunk-7JGR7WPD.js} +4 -4
  71. package/dist/{chunk-BIJ7ADTZ.js → chunk-7WGOLPGM.js} +1 -1
  72. package/dist/{chunk-SXSMIMFY.js → chunk-A6RB4PIX.js} +4 -4
  73. package/dist/chunk-AC373WIU.js +8 -0
  74. package/dist/{chunk-BMPBVI7P.js → chunk-AGUA3O5O.js} +1 -1
  75. package/dist/{chunk-UVUBZL7K.js → chunk-ANFLQSGX.js} +5 -5
  76. package/dist/chunk-ARWMJSQJ.js +3 -0
  77. package/dist/chunk-AYZY3YNC.js +1 -0
  78. package/dist/{chunk-BSNWVZHW.js → chunk-B4KMHEFZ.js} +1 -1
  79. package/dist/chunk-B6YOP2IX.js +6 -0
  80. package/dist/{chunk-4VLKDANH.js → chunk-BBEOFKLY.js} +1 -1
  81. package/dist/{chunk-22S6LG6D.js → chunk-BCDG4N6L.js} +1 -1
  82. package/dist/{chunk-DFDDRKIJ.js → chunk-BCUQXILM.js} +1 -1
  83. package/dist/chunk-BGRT775Y.js +2 -0
  84. package/dist/{chunk-5TFTSYOD.js → chunk-BVTNGW5S.js} +1 -1
  85. package/dist/{chunk-TVJRENCQ.js → chunk-BWUU565Y.js} +9 -9
  86. package/dist/{chunk-TFMC2WAS.js → chunk-BZBMZDLD.js} +1 -1
  87. package/dist/chunk-BZG5E7GF.js +6 -0
  88. package/dist/{chunk-SBHFEWR6.js → chunk-C4UL2UNR.js} +1 -1
  89. package/dist/{chunk-DOCUM3K7.js → chunk-CAG3TSV2.js} +1 -1
  90. package/dist/chunk-CE5BARZI.js +16 -0
  91. package/dist/chunk-CJB73MHF.js +2 -0
  92. package/dist/{chunk-N6DTTOB6.js → chunk-CKPVXDKX.js} +3 -3
  93. package/dist/chunk-CO5RKOVX.js +20 -0
  94. package/dist/chunk-CRXFSN5K.js +20 -0
  95. package/dist/chunk-CVNJSD2J.js +18 -0
  96. package/dist/{chunk-RYBJ6MMM.js → chunk-CXMTDYVI.js} +1 -1
  97. package/dist/chunk-D7IXMMZT.js +9 -0
  98. package/dist/{chunk-LBLV64XG.js → chunk-DLNYXXNE.js} +2 -2
  99. package/dist/chunk-DNWV6N4P.js +5 -0
  100. package/dist/{chunk-KZHPX4FM.js → chunk-DWBZ3Z34.js} +2 -2
  101. package/dist/chunk-DZTAGMNY.js +100 -0
  102. package/dist/chunk-E4E7MACR.js +20 -0
  103. package/dist/{chunk-DZNG34DC.js → chunk-EFFF3FCS.js} +23 -23
  104. package/dist/{chunk-CPK7JTN3.js → chunk-EGAV5LSX.js} +1 -1
  105. package/dist/{chunk-M5P6A7KS.js → chunk-ENL5L6NR.js} +1 -1
  106. package/dist/chunk-EW3L4W2I.js +14 -0
  107. package/dist/{chunk-6GWZ5UPX.js → chunk-EWVOGTEX.js} +1 -1
  108. package/dist/{chunk-I7HDD4IM.js → chunk-EXNAAHN4.js} +2 -2
  109. package/dist/{chunk-YDYDR72S.js → chunk-F4DIVARP.js} +1 -1
  110. package/dist/{chunk-WYN5KVU4.js → chunk-F7F6Z64G.js} +3 -3
  111. package/dist/{chunk-5PY4H4ZJ.js → chunk-FBUUXK5G.js} +1 -1
  112. package/dist/chunk-FKNJSD6B.js +14 -0
  113. package/dist/{chunk-D7FT2PXG.js → chunk-FLEG5KP5.js} +5 -5
  114. package/dist/{chunk-4OFD6ICH.js → chunk-FLQZ7GQ3.js} +10 -10
  115. package/dist/{chunk-DXTKNHWG.js → chunk-FPGRKHUW.js} +12 -12
  116. package/dist/chunk-G6CTTBKE.js +9 -0
  117. package/dist/{chunk-3CST4ZDP.js → chunk-GS5AISRS.js} +4 -4
  118. package/dist/{chunk-4Y4PWKMM.js → chunk-GVC535IA.js} +3 -3
  119. package/dist/chunk-HEEY4TVP.js +8 -0
  120. package/dist/chunk-HJWTWS5E.js +8 -0
  121. package/dist/{chunk-VH6GB73Q.js → chunk-HL6JSDN3.js} +1 -1
  122. package/dist/chunk-HNQPF5QZ.js +2 -0
  123. package/dist/{chunk-WRORJNS5.js → chunk-HQMN5THW.js} +10 -10
  124. package/dist/chunk-HUF34LSW.js +15 -0
  125. package/dist/chunk-IB4333CI.js +14 -0
  126. package/dist/chunk-IGNZULKG.js +17 -0
  127. package/dist/{chunk-EZULNHQH.js → chunk-IJIESSTX.js} +5 -5
  128. package/dist/{chunk-S7VSXUKS.js → chunk-IJWFKUYA.js} +4 -4
  129. package/dist/chunk-IK2WXW2E.js +27 -0
  130. package/dist/{chunk-UZMZ2EDW.js → chunk-IMOPDLMA.js} +1 -1
  131. package/dist/{chunk-2FLYC6I2.js → chunk-IN4KV3SJ.js} +1 -1
  132. package/dist/chunk-IPTCV6CQ.js +69 -0
  133. package/dist/{chunk-ZWAVSUWT.js → chunk-IQWIYZB5.js} +2 -2
  134. package/dist/chunk-IX6QMUJQ.js +9 -0
  135. package/dist/{chunk-4G5VLI7E.js → chunk-JDQGHQ2C.js} +1 -1
  136. package/dist/{chunk-3S3DYAVB.js → chunk-JIW5CJXC.js} +2 -2
  137. package/dist/{chunk-P42YNSKI.js → chunk-JKDEE35P.js} +1 -1
  138. package/dist/{chunk-CKZ6ZDU5.js → chunk-JS6ZSEZJ.js} +1 -1
  139. package/dist/chunk-K4D63NP3.js +12 -0
  140. package/dist/chunk-KEK47CP3.js +12 -0
  141. package/dist/chunk-KWT6GT4M.js +29 -0
  142. package/dist/chunk-L4TN4EWK.js +1 -0
  143. package/dist/{chunk-SR4XAYLC.js → chunk-L67VXJMF.js} +1 -1
  144. package/dist/chunk-LAEXWXJA.js +9 -0
  145. package/dist/{chunk-D323R2FT.js → chunk-LNARMEEZ.js} +1 -1
  146. package/dist/{chunk-CZ25A5RS.js → chunk-LNQVTH5S.js} +1 -1
  147. package/dist/chunk-LUWRPPJA.js +7 -0
  148. package/dist/chunk-M554OMPA.js +2 -0
  149. package/dist/{chunk-BVW5U7QQ.js → chunk-M5GMIQ47.js} +3 -3
  150. package/dist/{chunk-GX2GSDJP.js → chunk-MAMWQCJ6.js} +1 -1
  151. package/dist/{chunk-ZTB6EMC7.js → chunk-MV6WDGB6.js} +1 -1
  152. package/dist/chunk-MWIT4UN2.js +14 -0
  153. package/dist/{chunk-JPRJQ6B7.js → chunk-N3JXHNID.js} +10 -10
  154. package/dist/{chunk-EYKUKN32.js → chunk-N7T63BVD.js} +4 -4
  155. package/dist/chunk-NHH2MXFU.js +2 -0
  156. package/dist/chunk-NHVXVHUR.js +23 -0
  157. package/dist/{chunk-EYX6KLCZ.js → chunk-NWCW22U6.js} +2 -2
  158. package/dist/{chunk-J47HXHSL.js → chunk-O5LQBBW2.js} +7 -7
  159. package/dist/{chunk-IHQX4GYD.js → chunk-OQ2EDMB2.js} +1 -1
  160. package/dist/chunk-OUSKOWNP.js +12 -0
  161. package/dist/chunk-OV2SWQPT.js +22 -0
  162. package/dist/chunk-OX2DOOOI.js +8 -0
  163. package/dist/{chunk-6KO5VTL7.js → chunk-OZAAIE4E.js} +1 -1
  164. package/dist/chunk-P3OBE43Q.js +8 -0
  165. package/dist/{chunk-Z2YGQBLZ.js → chunk-P3Y5RFI4.js} +2 -2
  166. package/dist/{chunk-2UXAI77F.js → chunk-P4XTWAKJ.js} +1 -1
  167. package/dist/{chunk-7PCI6AUU.js → chunk-PB7G6CJ7.js} +1 -1
  168. package/dist/chunk-PDB5W7VI.js +6 -0
  169. package/dist/chunk-PDXPMHG3.js +4 -0
  170. package/dist/chunk-POCQ7ZL4.js +3 -0
  171. package/dist/chunk-PVR4KU7H.js +7 -0
  172. package/dist/{chunk-2RBWQVDC.js → chunk-PYLNMN6E.js} +13 -13
  173. package/dist/chunk-Q7KTTDUS.js +11 -0
  174. package/dist/{chunk-3PGK3VFS.js → chunk-QC6OK3ED.js} +1 -1
  175. package/dist/{chunk-MEJK6PBN.js → chunk-QSJR7EI7.js} +3 -3
  176. package/dist/chunk-QWHQJNKL.js +1 -0
  177. package/dist/chunk-QXWY3CJ2.js +11 -0
  178. package/dist/{chunk-QDLGU62M.js → chunk-QZKWIVZW.js} +1 -1
  179. package/dist/chunk-R2VKEMZH.js +3 -0
  180. package/dist/{chunk-EXWGPXOS.js → chunk-RBD7SB6M.js} +1 -1
  181. package/dist/chunk-RC6UHOAV.js +4 -0
  182. package/dist/{chunk-45S6M77O.js → chunk-RULVWW4A.js} +6 -6
  183. package/dist/chunk-RUTUVS4H.js +1 -0
  184. package/dist/{chunk-MAOJENIB.js → chunk-RWJCKZEY.js} +1 -1
  185. package/dist/chunk-S4Z657L6.js +6 -0
  186. package/dist/{chunk-Q3OCGLW7.js → chunk-SOP447EP.js} +2 -2
  187. package/dist/{chunk-CDRXZBVR.js → chunk-TBPHW42V.js} +1 -1
  188. package/dist/chunk-TLRCTNUF.js +6 -0
  189. package/dist/{chunk-KWX6NAOR.js → chunk-TVL3JPMY.js} +1 -1
  190. package/dist/{chunk-VYXDI63I.js → chunk-U4OGRIP6.js} +1 -1
  191. package/dist/chunk-U5N6PSXO.js +9 -0
  192. package/dist/{chunk-SZIENHKR.js → chunk-UKDJUYIV.js} +1 -1
  193. package/dist/chunk-UQYNPYF4.js +1 -0
  194. package/dist/chunk-URHGHXDN.js +1 -0
  195. package/dist/{chunk-6WWAQC5V.js → chunk-VG2R6PZV.js} +1 -1
  196. package/dist/{chunk-RWGSMZGS.js → chunk-VVAJ23SD.js} +1 -1
  197. package/dist/chunk-VVGL5O4F.js +8 -0
  198. package/dist/chunk-VVJIKS47.js +1 -0
  199. package/dist/chunk-WE7CYRZT.js +7 -0
  200. package/dist/{chunk-B2XDNBR3.js → chunk-WFHYU66E.js} +1 -1
  201. package/dist/{chunk-NGBT7AHL.js → chunk-WH3JHMEA.js} +8 -8
  202. package/dist/chunk-WUKN5WUM.js +11 -0
  203. package/dist/{chunk-ET2EF5CI.js → chunk-X7PM7JOD.js} +1 -1
  204. package/dist/{chunk-4NXMMWL6.js → chunk-XD34TCRG.js} +1 -1
  205. package/dist/chunk-XI4HKNFI.js +19 -0
  206. package/dist/{chunk-Y4MI6NRI.js → chunk-XNWQ72WA.js} +1 -1
  207. package/dist/{chunk-Y6IQYQYN.js → chunk-XS4HFUTW.js} +2 -2
  208. package/dist/{chunk-Y5T257HX.js → chunk-XZYAFTW4.js} +4 -4
  209. package/dist/{chunk-KFJIO5ED.js → chunk-Y44ABEW3.js} +1 -1
  210. package/dist/chunk-YWGC7J6B.js +11 -0
  211. package/dist/{chunk-MMFJBWJC.js → chunk-Z3JW77LH.js} +1 -1
  212. package/dist/chunk-ZAU2HIRH.js +21 -0
  213. package/dist/{chunk-Y53KNQKL.js → chunk-ZDMZM7HD.js} +2 -2
  214. package/dist/{chunk-ZCHBOAPA.js → chunk-ZHHEMSOD.js} +2 -2
  215. package/dist/chunk-ZOHQVSB3.js +27 -0
  216. package/dist/{chunk-G63BCOQ6.js → chunk-ZTL2RPNY.js} +1 -1
  217. package/dist/{chunk-U4BMS5EV.js → chunk-ZYDZY6ED.js} +1 -1
  218. package/dist/data/DataTable.js +1 -1
  219. package/dist/data/Kanban.js +1 -1
  220. package/dist/data/ListFooter.js +1 -1
  221. package/dist/data/ListLoadError.js +1 -1
  222. package/dist/data/Pagination.js +1 -1
  223. package/dist/file-intake/index.js +1 -1
  224. package/dist/forms/AlignmentGrid.js +1 -1
  225. package/dist/forms/BorderInput.js +1 -1
  226. package/dist/forms/BrandAssetEditor.js +1 -1
  227. package/dist/forms/Button.js +1 -1
  228. package/dist/forms/Calendar.js +1 -1
  229. package/dist/forms/ColorPicker.js +1 -1
  230. package/dist/forms/ComposerAttachments.js +1 -1
  231. package/dist/forms/CornersInput.js +1 -1
  232. package/dist/forms/DatePicker.js +1 -1
  233. package/dist/forms/DateRangePicker.js +1 -1
  234. package/dist/forms/DateTimePicker.js +1 -1
  235. package/dist/forms/DisplayChips.js +1 -1
  236. package/dist/forms/FilePicker.js +1 -1
  237. package/dist/forms/FormErrorSummary.js +1 -1
  238. package/dist/forms/FormField.js +1 -1
  239. package/dist/forms/IconButton.js +1 -1
  240. package/dist/forms/IconPicker.js +1 -1
  241. package/dist/forms/ImageFocusPoint.js +1 -1
  242. package/dist/forms/Input.js +1 -1
  243. package/dist/forms/InputNumber.js +1 -1
  244. package/dist/forms/LinkPicker.js +1 -1
  245. package/dist/forms/MediaLibrary.d.ts +6 -1
  246. package/dist/forms/MediaLibrary.js +1 -1
  247. package/dist/forms/MediaUploadField.js +1 -1
  248. package/dist/forms/MediaUploadGrid.js +1 -1
  249. package/dist/forms/MediaUsedInList.js +1 -1
  250. package/dist/forms/NumericKeypad.js +1 -1
  251. package/dist/forms/PictureTiles.js +1 -1
  252. package/dist/forms/PositionInput.js +1 -1
  253. package/dist/forms/RadioGroup.js +1 -1
  254. package/dist/forms/Segmented.js +1 -1
  255. package/dist/forms/Select.d.ts +6 -0
  256. package/dist/forms/Select.js +1 -1
  257. package/dist/forms/SidesInput.js +1 -1
  258. package/dist/forms/Slider.js +1 -1
  259. package/dist/forms/Snippet.js +1 -1
  260. package/dist/forms/SplitButton.js +1 -1
  261. package/dist/forms/TagInput.js +1 -1
  262. package/dist/forms/TextToolbar.js +1 -1
  263. package/dist/forms/Textarea.js +1 -1
  264. package/dist/forms/TimePicker.js +1 -1
  265. package/dist/forms/WidthsBar.d.ts +7 -8
  266. package/dist/forms/WidthsBar.js +1 -1
  267. package/dist/forms/buttonStyles.js +1 -1
  268. package/dist/forms/mediaLibraryMenu.js +1 -1
  269. package/dist/forms/mediaMoveItems.js +1 -1
  270. package/dist/forms/styles.d.ts +2 -2
  271. package/dist/forms/styles.js +1 -1
  272. package/dist/forms/textAlign.js +1 -1
  273. package/dist/forms/useFileIntake.js +1 -1
  274. package/dist/hooks/useTheme.d.ts +1 -1
  275. package/dist/icons/efficient-glyphs.js +1 -1
  276. package/dist/icons/efficient-looks.js +1 -1
  277. package/dist/icons/efficient.js +1 -1
  278. package/dist/icons/glyphs/SpinnerIcon.js +1 -1
  279. package/dist/icons/looks/map.js +1 -1
  280. package/dist/icons/sets.js +1 -1
  281. package/dist/index.d.ts +3 -1
  282. package/dist/index.js +695 -695
  283. package/dist/locales/zh-Hans.js +1 -1
  284. package/dist/map/index.js +12 -12
  285. package/dist/markdown/index.js +5 -5
  286. package/dist/page-tabs/index.js +5 -5
  287. package/dist/pdf/index.js +1 -1
  288. package/dist/shell/Accordion.js +1 -1
  289. package/dist/shell/AppUpdateBanner.js +1 -1
  290. package/dist/shell/Avatar.js +1 -1
  291. package/dist/shell/Banner.js +1 -1
  292. package/dist/shell/Breadcrumbs.js +1 -1
  293. package/dist/shell/BudgetBar.js +1 -1
  294. package/dist/shell/Card.js +1 -1
  295. package/dist/shell/ColoredBadge.js +1 -1
  296. package/dist/shell/ConfirmDialog.js +1 -1
  297. package/dist/shell/ContainerFillChart.js +1 -1
  298. package/dist/shell/ContextMenu.js +1 -1
  299. package/dist/shell/CountBadge.js +1 -1
  300. package/dist/shell/Dialog.js +1 -1
  301. package/dist/shell/Drawer.js +1 -1
  302. package/dist/shell/DropdownMenu.js +1 -1
  303. package/dist/shell/EditableGrid.js +1 -1
  304. package/dist/shell/EmptyState.js +1 -1
  305. package/dist/shell/EmptyValue.js +1 -1
  306. package/dist/shell/GlobalSearch.js +1 -1
  307. package/dist/shell/HelpCenter.js +1 -1
  308. package/dist/shell/IconRail.js +1 -1
  309. package/dist/shell/ImageLightbox.js +1 -1
  310. package/dist/shell/ItemCount.d.ts +20 -0
  311. package/dist/shell/ItemCount.js +1 -0
  312. package/dist/shell/Kbd.js +1 -1
  313. package/dist/shell/LanguageSelect.js +1 -1
  314. package/dist/shell/Markdown.js +1 -1
  315. package/dist/shell/MetricBar.js +1 -1
  316. package/dist/shell/MetricBarLegend.js +1 -1
  317. package/dist/shell/MilestoneTimeline.js +1 -1
  318. package/dist/shell/PageHeader.js +1 -1
  319. package/dist/shell/Popover.js +1 -1
  320. package/dist/shell/PopupMenu.js +1 -1
  321. package/dist/shell/ProductionTimeline.js +1 -1
  322. package/dist/shell/ResizeHandle.js +1 -1
  323. package/dist/shell/Result.js +1 -1
  324. package/dist/shell/SearchableSelect.js +1 -1
  325. package/dist/shell/SettingReset.js +1 -1
  326. package/dist/shell/SettingRow.js +1 -1
  327. package/dist/shell/SidebarLayout.js +1 -1
  328. package/dist/shell/SidebarNav.d.ts +19 -5
  329. package/dist/shell/SidebarNav.js +1 -1
  330. package/dist/shell/SortableList.js +1 -1
  331. package/dist/shell/Spinner.js +1 -1
  332. package/dist/shell/Statistic.js +1 -1
  333. package/dist/shell/StatusBadge.js +1 -1
  334. package/dist/shell/StepChain.js +1 -1
  335. package/dist/shell/Tabs.js +1 -1
  336. package/dist/shell/TimeAgo.js +1 -1
  337. package/dist/shell/TimelineTrack.js +1 -1
  338. package/dist/shell/Tooltip.js +1 -1
  339. package/dist/shell/TopNav.js +1 -1
  340. package/dist/shell/TransferProgress.js +1 -1
  341. package/dist/shell/Tree.d.ts +15 -6
  342. package/dist/shell/Tree.js +1 -1
  343. package/dist/shell/language.js +1 -1
  344. package/dist/shell/strings.d.ts +24 -2
  345. package/dist/shell/strings.js +1 -1
  346. package/dist/shell/toast.js +1 -1
  347. package/dist/telemetry/index.js +1 -1
  348. package/dist/templates/AuthScreen.js +1 -1
  349. package/dist/templates/ChatTemplate.js +1 -1
  350. package/dist/templates/CheckoutTemplate.js +1 -1
  351. package/dist/templates/DashboardTemplate.js +1 -1
  352. package/dist/templates/DataTablePage.js +1 -1
  353. package/dist/templates/EmailTemplate.js +1 -1
  354. package/dist/templates/ErrorBoundary.d.ts +1 -1
  355. package/dist/templates/ErrorBoundary.js +1 -1
  356. package/dist/templates/ErrorPage.js +1 -1
  357. package/dist/templates/FormLayoutPage.js +1 -1
  358. package/dist/templates/GalleryTemplate.js +1 -1
  359. package/dist/themes.css +101 -0
  360. package/dist/tokens/colour.d.ts +42 -0
  361. package/dist/tokens/colour.js +1 -0
  362. package/dist/tokens/elevation.d.ts +3 -1
  363. package/dist/tokens/elevation.js +1 -1
  364. package/dist/ui/index.d.ts +2 -0
  365. package/dist/ui/index.js +1 -1
  366. package/dist/ui.css +266 -24
  367. package/dist/version.js +1 -1
  368. package/package.json +1 -1
  369. package/dist/Browser-FTCJCMD3.js +0 -43
  370. package/dist/Calculator-7O7HXEKH.js +0 -29
  371. package/dist/CurrencyConverter-IVJJCYZ7.js +0 -21
  372. package/dist/Files-YWBBU2FZ.js +0 -87
  373. package/dist/Notepad-KKKCTUB3.js +0 -25
  374. package/dist/PdfViewer-KJCJ6EPG.js +0 -1
  375. package/dist/Preview-CHV67AA7.js +0 -177
  376. package/dist/Sidebar-6I4FC5AK.js +0 -43
  377. package/dist/Spreadsheet-SNLKLOLL.js +0 -37
  378. package/dist/Stock-PHY6Z26A.js +0 -16
  379. package/dist/Weather-YQA5CAFQ.js +0 -60
  380. package/dist/WorldClock-J6L7FWI2.js +0 -32
  381. package/dist/chunk-2NMT3Y5H.js +0 -20
  382. package/dist/chunk-3WC6ITJ3.js +0 -11
  383. package/dist/chunk-3ZHFKOFX.js +0 -14
  384. package/dist/chunk-454DAGYG.js +0 -19
  385. package/dist/chunk-4CANQ3B3.js +0 -1
  386. package/dist/chunk-4CFOKYVR.js +0 -12
  387. package/dist/chunk-4IU5BSVE.js +0 -2
  388. package/dist/chunk-4IVT244O.js +0 -8
  389. package/dist/chunk-4SZDP3JF.js +0 -12
  390. package/dist/chunk-63EK6S3W.js +0 -3
  391. package/dist/chunk-64WSMLXG.js +0 -2
  392. package/dist/chunk-6BCFVOG7.js +0 -22
  393. package/dist/chunk-6NMDKOQA.js +0 -7
  394. package/dist/chunk-7C56GLLI.js +0 -28
  395. package/dist/chunk-7DKPJUGU.js +0 -2
  396. package/dist/chunk-7MSFHQAY.js +0 -8
  397. package/dist/chunk-7OCNF4AI.js +0 -5
  398. package/dist/chunk-AAW27HJY.js +0 -3
  399. package/dist/chunk-BI6ZLD4X.js +0 -11
  400. package/dist/chunk-BIYL7CEI.js +0 -2
  401. package/dist/chunk-BOBUSE33.js +0 -2
  402. package/dist/chunk-BUGAWNOC.js +0 -14
  403. package/dist/chunk-CRLSG5AY.js +0 -9
  404. package/dist/chunk-DITCVBR7.js +0 -15
  405. package/dist/chunk-DODH46ZQ.js +0 -8
  406. package/dist/chunk-E5ALJIXV.js +0 -9
  407. package/dist/chunk-E6UCGCOC.js +0 -1
  408. package/dist/chunk-EGDJEY4K.js +0 -27
  409. package/dist/chunk-EL2RLUT6.js +0 -20
  410. package/dist/chunk-ET32NQHX.js +0 -2
  411. package/dist/chunk-EZ3BQ6PK.js +0 -18
  412. package/dist/chunk-FRPNTDP4.js +0 -8
  413. package/dist/chunk-GATKJSGL.js +0 -8
  414. package/dist/chunk-GNPTNAZH.js +0 -4
  415. package/dist/chunk-JPP7UWQA.js +0 -4
  416. package/dist/chunk-K7KQDPLW.js +0 -27
  417. package/dist/chunk-K7U4RWXJ.js +0 -1
  418. package/dist/chunk-KJY57QPT.js +0 -100
  419. package/dist/chunk-LGAN7DNC.js +0 -9
  420. package/dist/chunk-MEYYQC43.js +0 -8
  421. package/dist/chunk-MVP6Q6KV.js +0 -1
  422. package/dist/chunk-NDO24PK6.js +0 -21
  423. package/dist/chunk-OSA24YH6.js +0 -19
  424. package/dist/chunk-P5BOTIJU.js +0 -6
  425. package/dist/chunk-PCQPV6MS.js +0 -6
  426. package/dist/chunk-PF3ANJFI.js +0 -1
  427. package/dist/chunk-PXEEDRPW.js +0 -14
  428. package/dist/chunk-Q23EHOXW.js +0 -17
  429. package/dist/chunk-Q5MD3VY6.js +0 -3
  430. package/dist/chunk-QR4RM7PO.js +0 -1
  431. package/dist/chunk-REVC6YPT.js +0 -7
  432. package/dist/chunk-RSO67DWS.js +0 -8
  433. package/dist/chunk-S2OIRC5H.js +0 -12
  434. package/dist/chunk-SB7OTZI4.js +0 -69
  435. package/dist/chunk-SRKSGUGT.js +0 -23
  436. package/dist/chunk-SURSVJA2.js +0 -6
  437. package/dist/chunk-TH6EAYMO.js +0 -29
  438. package/dist/chunk-TIQKDAON.js +0 -11
  439. package/dist/chunk-TVDVVPTN.js +0 -1
  440. package/dist/chunk-VU6VPKM3.js +0 -11
  441. package/dist/chunk-W5M6P4DZ.js +0 -8
  442. package/dist/chunk-X6PPP6NX.js +0 -14
  443. package/dist/chunk-XLD53X4P.js +0 -9
  444. package/dist/chunk-XSPDPN5O.js +0 -26
  445. package/dist/chunk-Y37PBT4H.js +0 -9
  446. package/dist/chunk-YAEUF3GP.js +0 -1
  447. package/dist/chunk-YALPQIBR.js +0 -7
  448. package/dist/chunk-ZK2SULCA.js +0 -16
  449. package/dist/chunk-ZOSIPTXM.js +0 -6
  450. package/dist/chunk-ZSFUNXRD.js +0 -5
  451. /package/dist/{chunk-KJRYEKQP.js → chunk-DSIDJYH7.js} +0 -0
@@ -1,87 +0,0 @@
1
- import{openPreviewFile as e}from"./chunk-ZTB6EMC7.js";import{SidebarLayout as t}from"./chunk-LGLZTJ2W.js";import"./chunk-QWK6DRSN.js";import"./chunk-KZHPX4FM.js";import{Breadcrumbs as r}from"./chunk-6SMQNPWS.js";import{formatBytes as a}from"./chunk-X2S2XDZI.js";import"./chunk-5OTS2G3M.js";import"./chunk-36BRD5J3.js";import{getFilesDemoTree as n}from"./chunk-TGLHJS3M.js";import{AboutApp as s}from"./chunk-Y37PBT4H.js";import{peekFilesViewRequest as i,consumeFilesViewRequest as o,FILES_SHOW_TRASH_EVENT as l,FILES_OPEN_DESKTOP_FOLDER_EVENT as c,subscribeDesktopFolders as d,getDesktopFoldersSnapshot as m,FolderGlyph as h,DesktopItemMiniIcon as p,desktopItemTypeLabel as u}from"./chunk-GSBIJLTD.js";import"./chunk-ESL5TDNA.js";import"./chunk-VTVSMRFX.js";import{useWindowManager as f,WindowTitle as x}from"./chunk-KJY57QPT.js";import"./chunk-CY5N5OA3.js";import"./chunk-AW7TOB6N.js";import"./chunk-KNUR2UEG.js";import"./chunk-JDCM2VHG.js";import"./chunk-BMPBVI7P.js";import"./chunk-5A7MWTXX.js";import"./chunk-Y53KNQKL.js";import"./chunk-6WWAQC5V.js";import{confirm as g,prompt as y}from"./chunk-EGDJEY4K.js";import"./chunk-GNPTNAZH.js";import"./chunk-KC3EX26K.js";import"./chunk-4AJRHTTB.js";import"./chunk-VWGWZY7A.js";import"./chunk-PKXQDCNR.js";import{toast_default as b}from"./chunk-4NXMMWL6.js";import"./chunk-UGTRSRIW.js";import"./chunk-ET2EF5CI.js";import"./chunk-CDAJKLGL.js";import"./chunk-YAEUF3GP.js";import"./chunk-DXTKNHWG.js";import"./chunk-QR4RM7PO.js";import"./chunk-5QFPTDQF.js";import"./chunk-D323R2FT.js";import"./chunk-4IU5BSVE.js";import"./chunk-K7U4RWXJ.js";import"./chunk-VH6GB73Q.js";import{Icon as k}from"./chunk-FSPFV4MI.js";import"./chunk-J75ZT2JQ.js";import{LoadingSpinner as N}from"./chunk-Q5MD3VY6.js";import"./chunk-MRJKZWWV.js";import{TH_ONE_LINE as w}from"./chunk-6KO5VTL7.js";import"./chunk-22S6LG6D.js";import"./chunk-PGN5ME7B.js";import"./chunk-62LW225J.js";import"./chunk-GLUJS42B.js";import"./chunk-D65T4H6J.js";import"./chunk-DTJRIWFR.js";import"./chunk-TWVUQUUD.js";import"./chunk-E6UCGCOC.js";import"./chunk-C3QOHMR6.js";import{useState as v,useEffect as j,useSyncExternalStore as $,useRef as C,useCallback as T}from"react";import{jsxs as D,jsx as L,Fragment as E}from"react/jsx-runtime";var R="undefined"!=typeof window&&window.__REACT_OS_SHELL_FILE_SERVER__||"http://localhost:4000",W={pdf:"pdf",dxf:"dxf",csv:"csv",jpg:"image",jpeg:"image",png:"image",gif:"image",webp:"image",svg:"image",avif:"image",bmp:"image",stp:"3d",step:"3d",stl:"3d",obj:"3d",gltf:"3d",glb:"3d","3mf":"3d",iges:"3d",igs:"3d",ply:"3d",fbx:"3d"};function P(e,t){return"/"===e||""===e?"/"+t:e.replace(/\/$/,"")+"/"+t}function S(e){if(!e)return"—";try{const t=new Date(e);return isNaN(t.getTime())?"—":t.toLocaleString(void 0,{dateStyle:"short",timeStyle:"short"})}catch{return e}}function M(){const M=R.replace(/\/$/,""),F=null!==n(),[I,U]=v("/"),[A,O]=v([]),[J,V]=v([]),[B,G]=v(null),[K,Q]=v(!0),[H,z]=v(!1),[X,Y]=v(null),[Z,_]=v(!1),[q,ee]=v(()=>{const e=i();return"trash"===e?"trash":e?{desktopFolderId:e.folderId}:"files"});j(()=>{o()},[]);const[te,re]=v([]);j(()=>{const e=()=>{o(),ee("trash")},t=e=>{o();const t=e.detail?.folderId;t&&ee({desktopFolderId:t})};return window.addEventListener(l,e),window.addEventListener(c,t),()=>{window.removeEventListener(l,e),window.removeEventListener(c,t)}},[]);const ae=$(d,m,m),ne="object"==typeof q?q.desktopFolderId:null,se=ne?ae?.folders.find(e=>e.id===ne)??null:null,ie=ne&&ae?.itemsByFolder[ne]||[];j(()=>{ne&&ae&&!ae.folders.some(e=>e.id===ne)&&ee("files")},[ne,ae]);const oe=C(0),le=C(null),{openPage:ce,openEntity:de}=f(),me=t=>{"preview-file"===t.entityType&&t.filePath&&t.fileKind?e({filePath:t.filePath,filename:t.label,kind:t.fileKind,onStaged:e=>ce(e)}):"page"===t.entityType?ce(t.entityId):de(t.entityType,t.entityId,null,t.label)},he=T((e,t={})=>fetch(e,{...t,credentials:"include"}),[]),pe=T(async()=>{try{const e=await he(`${M}/api/quota`);if(e.ok){const t=await e.json();Y({used:t.used,limit:t.limit})}}catch{}},[he,M]),ue=T(async e=>{if(G(null),F){const t=function(e){const t=n();if(!t)return[];let r=t;for(const t of e.split("/").filter(Boolean)){const e=r.find(e=>"folder"===e.kind&&e.name===t);if(!e||!e.children)return[];r=e.children}return r.map(e=>({name:e.name,kind:e.kind,size:e.size??0,modifiedAt:e.modifiedAt??""}))}(e);return O(t),U(e),z(!1),Q(!1),void("/"===e&&V(t.filter(e=>"folder"===e.kind).map(e=>e.name)))}Q(!0);try{const t=await he(`${M}/api/files?path=${encodeURIComponent(e)}`);if(!t.ok){const e=await t.json().catch(()=>({}));return void b.error(e.error||`Failed to list (${t.status})`)}const r=await t.json(),a=r.entries||[];O(a),U(r.path||e),z(!1),"/"===(r.path||e)&&V(a.filter(e=>"folder"===e.kind).map(e=>e.name))}catch(e){z(!0)}finally{Q(!1)}pe()},[he,M,pe,F]),fe=T(async()=>{if(F)return re([]),void Q(!1);Q(!0),G(null);try{const e=await he(`${M}/api/trash`);if(!e.ok){const t=await e.json().catch(()=>({}));return void b.error(t.error||`Failed to list trash (${e.status})`)}const t=await e.json();re(t.entries||[]),z(!1)}catch{z(!0)}finally{Q(!1)}pe()},[he,M,pe,F]);j(()=>{"files"===q?ue(I):"trash"===q&&fe()},[I,q]);const xe=async e=>{const t=P(I,e.name);try{const r=await he(`${M}/api/file?path=${encodeURIComponent(t)}`);if(!r.ok)return void b.error(`Download failed (${r.status})`);const a=await r.blob(),n=URL.createObjectURL(a),s=document.createElement("a");s.href=n,s.download=e.name,s.click(),setTimeout(()=>URL.revokeObjectURL(n),1e3)}catch(e){b.error(e?.message||"Download failed")}},ge=async e=>{const t=Array.from(e);for(const e of t){const t=new FormData;t.append("file",e);try{const r=await he(`${M}/api/upload?path=${encodeURIComponent(I)}`,{method:"POST",body:t});if(!r.ok){const t=await r.json().catch(()=>({}));if(413===r.status){const r=Math.max(0,(t.limit||0)-(t.used||0));b.error(`Quota exceeded — ${a(r)} free, ${e.name} is ${a(t.attempted||e.size)}`)}else b.error(`Upload ${e.name}: ${t.error||r.status}`)}}catch(t){b.error(`Upload ${e.name}: ${t?.message||"failed"}`)}}ue(I)},ye=()=>{oe.current=0,_(!1)};if(j(()=>{const e=()=>ye();return window.addEventListener("dragend",e),window.addEventListener("drop",e),()=>{window.removeEventListener("dragend",e),window.removeEventListener("drop",e)}},[]),H)/* @__PURE__ */
2
- return D("div",{className:"flex flex-col h-full bg-white",children:[
3
- /* @__PURE__ */L(x,{title:"Files - offline"}),
4
- /* @__PURE__ */L("div",{className:"flex-1 flex items-center justify-center p-8 text-center",children:/* @__PURE__ */D("div",{className:"max-w-md",children:[
5
- /* @__PURE__ */L(k,{name:"close-circle",className:"h-12 w-12 mx-auto text-gray-300 mb-3",strokeWidth:1.4}),
6
- /* @__PURE__ */L("h3",{className:"text-base font-semibold text-gray-800 mb-1",children:"Can't reach the file server"}),
7
- /* @__PURE__ */D("p",{className:"text-sm text-gray-500 mb-3",children:["No response from ",
8
- /* @__PURE__ */L("span",{className:"font-mono",children:M}),". Make sure the server is running — see ",
9
- /* @__PURE__ */L("span",{className:"font-mono",children:"examples/file-server/README.md"}),"."]}),
10
- /* @__PURE__ */L("button",{onClick:()=>ue(I),className:"px-3 h-8 text-sm bg-blue-500 text-white rounded hover:bg-blue-600",children:"Retry"})]})})]});const be="/"===I?[]:I.split("/").filter(Boolean),ke=X&&X.limit>0?Math.min(100,Math.round(X.used/X.limit*100)):0,Ne=ke>90?"bg-red-500":ke>75?"bg-amber-500":"bg-blue-500",we=[{label:"My files",onClick:()=>U("/")},...be.map((e,t)=>({label:e,onClick:()=>U("/"+be.slice(0,t+1).join("/"))}))],ve=e=>"flex w-full items-center gap-2 rounded-md px-3 min-h-(--row-height-menu) py-2 text-left text-sm transition-colors "+(e?"bg-blue-50 font-medium text-blue-700":"text-gray-700 hover:bg-gray-100"),je=e=>/* @__PURE__ */L("svg",{className:"h-4 w-4 shrink-0 text-gray-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.6,children:/* @__PURE__ */L("path",{strokeLinecap:"round",strokeLinejoin:"round",d:e})}),$e=/* @__PURE__ */D("nav",{className:"p-2",children:[
11
- /* @__PURE__ */L("div",{className:"px-2 py-2 text-2xs font-semibold uppercase tracking-wide text-gray-400",children:"Locations"}),
12
- /* @__PURE__ */D("button",{onClick:()=>{ee("files"),U("/")},className:ve("files"===q&&"/"===I),children:[je("M2.25 12l8.954-8.955a1.5 1.5 0 012.122 0L21.75 12M4.5 9.75v9.75a.75.75 0 00.75.75H9V15a.75.75 0 01.75-.75h4.5A.75.75 0 0115 15v5.25h3.75a.75.75 0 00.75-.75V9.75"),"My files"]}),J.map(e=>/* @__PURE__ */D("button",{onClick:()=>{ee("files"),U("/"+e)},className:ve("files"===q&&I==="/"+e),children:[je("M2.25 12.75V12A2.25 2.25 0 014.5 9.75h15A2.25 2.25 0 0121.75 12v.75m-8.69-6.44l-2.12-2.12a1.5 1.5 0 00-1.061-.44H4.5A2.25 2.25 0 002.25 6v12a2.25 2.25 0 002.25 2.25h15A2.25 2.25 0 0021.75 18V9a2.25 2.25 0 00-2.25-2.25h-5.379a1.5 1.5 0 01-1.06-.44z"),
13
- /* @__PURE__ */L("span",{className:"truncate",children:e})]},e)),!F&&/* @__PURE__ */D("button",{onClick:()=>ee("trash"),className:ve("trash"===q),children:[je("M14.74 9l-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 01-2.244 2.077H8.084a2.25 2.25 0 01-2.244-2.077L4.772 5.79"),"Trash"]}),ae&&ae.folders.length>0&&/* @__PURE__ */D(E,{children:[
14
- /* @__PURE__ */L("div",{className:"px-2 pt-3 pb-2 text-2xs font-semibold uppercase tracking-wide text-gray-400",children:"Desktop"}),ae.folders.map(e=>/* @__PURE__ */D("button",{onClick:()=>ee({desktopFolderId:e.id}),className:ve(ne===e.id),children:[
15
- /* @__PURE__ */L(h,{className:"h-4 w-4 shrink-0 text-amber-500"}),
16
- /* @__PURE__ */L("span",{className:"truncate",children:e.name}),e.itemCount>0&&/* @__PURE__ */L("span",{className:"ml-auto text-2xs text-gray-400 tabular-nums",children:e.itemCount})]},e.id))]})]});/* @__PURE__ */
17
- return D("div",{className:"relative flex flex-col h-full bg-white",onDragEnter:e=>{F||"object"==typeof q||e.dataTransfer?.types?.includes?.("Files")&&(e.preventDefault(),oe.current++,Z||_(!0))},onDragOver:e=>{e.dataTransfer?.types?.includes?.("Files")&&e.preventDefault()},onDragLeave:()=>{oe.current>0&&oe.current--,0===oe.current&&_(!1)},onDrop:e=>{e.preventDefault(),ye(),F||"object"==typeof q||e.dataTransfer.files?.length&&ge(e.dataTransfer.files)},children:[
18
- /* @__PURE__ */L(x,{title:se?`Files - ${se.name}`:"Files"+("/"===I?"":" - "+I)}),
19
- /* @__PURE__ */L(s,{app:"files"}),
20
- /* @__PURE__ */L("input",{ref:le,type:"file",multiple:!0,className:"hidden",onChange:e=>{e.target.files?.length&&ge(e.target.files),le.current&&(le.current.value="")}}),
21
- /* @__PURE__ */L("div",{className:"flex-1 min-h-0",children:/* @__PURE__ */L(t,{sidebar:$e,storageKey:"files.sidebarWidth",defaultWidth:200,minWidth:150,maxWidth:320,children:/* @__PURE__ */D("div",{className:"flex h-full min-w-0 flex-col",children:[
22
- /* @__PURE__ */D("div",{className:"flex items-center gap-1 px-2 py-2 border-b border-gray-200 bg-gray-50 shrink-0 text-xs",children:[/* @__PURE__ */D(E,"files"===q?{children:[
23
- /* @__PURE__ */L("button",{onClick:()=>U(function(e){if("/"===e||""===e)return"/";const t=e.replace(/\/$/,""),r=t.lastIndexOf("/");return r<=0?"/":t.slice(0,r)}(I)),disabled:"/"===I,className:"px-2 py-1 rounded hover:bg-gray-200 disabled:opacity-30 text-gray-600",title:"Parent folder",children:/* @__PURE__ */L(k,{name:"arrow-left",className:"h-3.5 w-3.5",strokeWidth:2})}),
24
- /* @__PURE__ */L("div",{className:"flex-1 min-w-0",children:/* @__PURE__ */L(r,{items:we,maxItems:5})}),
25
- /* @__PURE__ */L("button",{onClick:()=>ue(I),className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-600",title:"Refresh",children:/* @__PURE__ */L(k,{name:"refresh",className:"h-3.5 w-3.5",strokeWidth:1.8})}),!F&&/* @__PURE__ */D(E,{children:[
26
- /* @__PURE__ */D("button",{onClick:()=>ee("trash"),className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-600 flex items-center gap-1",title:"Open trash",children:[
27
- /* @__PURE__ */L(k,{name:"trash",className:"h-3.5 w-3.5",strokeWidth:1.5}),"Trash"]}),
28
- /* @__PURE__ */D("button",{onClick:async()=>{const e=await y({title:"New folder",placeholder:"Folder name",confirmLabel:"Create"});if(!e)return;if(/[\\/]/.test(e))return void b.error("Folder names cannot contain slashes");const t=P(I,e),r=await he(`${M}/api/folder`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:t})});if(!r.ok){const e=await r.json().catch(()=>({}));return void b.error(e.error||`Create folder failed (${r.status})`)}ue(I)},className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-600 flex items-center gap-1",children:[
29
- /* @__PURE__ */L(k,{name:"folder-plus",className:"h-3.5 w-3.5",strokeWidth:1.5}),"New Folder"]}),
30
- /* @__PURE__ */D("button",{onClick:()=>le.current?.click(),className:"px-2 py-1 rounded bg-blue-500 text-white hover:bg-blue-600 flex items-center gap-1",children:[
31
- /* @__PURE__ */L(k,{name:"upload",className:"h-3.5 w-3.5",strokeWidth:1.8}),"Upload"]})]})]}:"trash"===q?{children:[
32
- /* @__PURE__ */L("button",{onClick:()=>ee("files"),className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-600",title:"Back to files",children:/* @__PURE__ */L(k,{name:"arrow-left",className:"h-3.5 w-3.5",strokeWidth:2})}),
33
- /* @__PURE__ */L("span",{className:"flex-1 text-gray-700 font-medium px-2",children:"Trash"}),
34
- /* @__PURE__ */L("button",{onClick:fe,className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-600",title:"Refresh",children:/* @__PURE__ */L(k,{name:"refresh",className:"h-3.5 w-3.5",strokeWidth:1.8})}),
35
- /* @__PURE__ */L("button",{onClick:async()=>{if(0===te.length)return;if(!await g({title:"Empty trash",message:`${te.length} item${1===te.length?"":"s"} will be permanently removed. This can't be undone.`,confirmLabel:"Empty trash",variant:"danger"}))return;const e=await he(`${M}/api/trash`,{method:"DELETE"});if(!e.ok){const t=await e.json().catch(()=>({}));return void b.error(t.error||`Empty trash failed (${e.status})`)}fe()},disabled:0===te.length,className:"px-2 py-1 rounded text-red-600 hover:bg-red-50 disabled:opacity-30 flex items-center gap-1",children:"Empty trash"})]}:{children:[
36
- /* @__PURE__ */L("button",{onClick:()=>ee("files"),className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-600",title:"Back to files",children:/* @__PURE__ */L(k,{name:"arrow-left",className:"h-3.5 w-3.5",strokeWidth:2})}),
37
- /* @__PURE__ */L(h,{className:"h-4 w-4 text-amber-500 ml-1"}),
38
- /* @__PURE__ */L("span",{className:"flex-1 text-gray-700 font-medium px-1 truncate",children:se?.name??"Desktop folder"}),
39
- /* @__PURE__ */L("span",{className:"text-2xs text-gray-400 px-2",children:"Desktop shortcuts"})]}),X&&/* @__PURE__ */D(E,{children:[
40
- /* @__PURE__ */L("div",{className:"h-4 w-px bg-gray-300 mx-1"}),
41
- /* @__PURE__ */D("div",{className:"flex items-center gap-2",title:`${a(X.used)} of ${a(X.limit)} used`,children:[
42
- /* @__PURE__ */L("div",{className:"w-20 h-1.5 rounded-full bg-gray-200 overflow-hidden",children:/* @__PURE__ */L("div",{className:`h-full ${Ne} transition-all`,style:{width:`${ke}%`}})}),
43
- /* @__PURE__ */D("span",{className:"text-2xs text-gray-500 tabular-nums whitespace-nowrap",children:[a(X.used)," / ",a(X.limit)]})]})]})]}),
44
- /* @__PURE__ */L("div",{className:"flex-1 overflow-auto",children:"object"==typeof q?0===ie.length?/* @__PURE__ */L("div",{className:"p-10 text-center text-sm text-gray-400",children:"This desktop folder is empty. Drag shortcuts onto it on the desktop."}):/* @__PURE__ */D("table",{className:"w-full text-sm",children:[
45
- /* @__PURE__ */L("thead",{className:"bg-gray-50 text-2xs uppercase tracking-wide text-gray-500",children:/* @__PURE__ */D("tr",{children:[
46
- /* @__PURE__ */L("th",{className:`${w} text-left font-medium px-3 h-8`,children:"Name"}),
47
- /* @__PURE__ */L("th",{className:`${w} text-left font-medium px-3 h-8 w-28`,children:"Type"}),
48
- /* @__PURE__ */L("th",{className:`${w} w-56`})]})}),
49
- /* @__PURE__ */L("tbody",{children:ie.map(e=>{const t=`${e.entityType}|${e.entityId}`;/* @__PURE__ */
50
- return D("tr",{onClick:()=>G(t),onDoubleClick:()=>me(e),className:"cursor-default border-b border-gray-100 "+(B===t?"bg-blue-50":"hover:bg-gray-50"),children:[
51
- /* @__PURE__ */D("td",{className:"px-3 h-8 flex items-center gap-2",children:[
52
- /* @__PURE__ */L(p,{item:e}),
53
- /* @__PURE__ */L("span",{className:"truncate",title:e.label,children:e.label})]}),
54
- /* @__PURE__ */L("td",{className:"px-3 h-8 text-xs text-gray-500",children:u(e)}),
55
- /* @__PURE__ */D("td",{className:"px-3 h-8 text-right whitespace-nowrap",children:[
56
- /* @__PURE__ */L("button",{onClick:t=>{t.stopPropagation(),me(e)},className:"px-2 py-0.5 rounded hover:bg-gray-200 text-blue-600 text-2xs",children:"Open"}),
57
- /* @__PURE__ */L("button",{onClick:t=>{t.stopPropagation(),ae?.moveToDesktop([e])},className:"px-2 py-0.5 rounded hover:bg-gray-200 text-gray-500 text-2xs ml-1",children:"Move to desktop"}),
58
- /* @__PURE__ */L("button",{onClick:t=>{t.stopPropagation(),ae?.removeShortcuts([e])},className:"px-2 py-0.5 rounded hover:bg-red-100 text-red-600 text-2xs ml-1",children:"Remove"})]})]},t)})})]}):"trash"===q?K&&0===te.length?/* @__PURE__ */L(N,{size:"sm",padding:"p-6",label:"Loading"}):0===te.length?/* @__PURE__ */L("div",{className:"p-10 text-center text-sm text-gray-400",children:"Trash is empty."}):/* @__PURE__ */D("table",{className:"w-full text-sm",children:[
59
- /* @__PURE__ */L("thead",{className:"bg-gray-50 text-2xs uppercase tracking-wide text-gray-500",children:/* @__PURE__ */D("tr",{children:[
60
- /* @__PURE__ */L("th",{className:`${w} text-left font-medium px-3 h-8`,children:"Name"}),
61
- /* @__PURE__ */L("th",{className:`${w} text-left font-medium px-3 h-8`,children:"Original location"}),
62
- /* @__PURE__ */L("th",{className:`${w} text-right font-medium px-3 h-8 w-24`,children:"Size"}),
63
- /* @__PURE__ */L("th",{className:`${w} text-right font-medium px-3 h-8 w-40`,children:"Deleted"}),
64
- /* @__PURE__ */L("th",{className:`${w} w-44`})]})}),
65
- /* @__PURE__ */L("tbody",{children:te.map(e=>/* @__PURE__ */D("tr",{className:"border-b border-gray-100 hover:bg-gray-50",children:[
66
- /* @__PURE__ */D("td",{className:"px-3 h-8 flex items-center gap-2",children:["folder"===e.kind?/* @__PURE__ */L(k,{name:"folder",look:"solid",className:"h-4 w-4 text-amber-500 shrink-0"}):/* @__PURE__ */L(k,{name:"page",className:"h-4 w-4 text-gray-400 shrink-0",strokeWidth:1.5}),
67
- /* @__PURE__ */L("span",{className:"truncate",title:e.name,children:e.name})]}),
68
- /* @__PURE__ */L("td",{className:"px-3 h-8 text-gray-500 text-xs font-mono truncate",title:e.originalPath,children:e.originalPath||"—"}),
69
- /* @__PURE__ */L("td",{className:"px-3 h-8 text-right tabular-nums text-gray-500",children:a(e.size)}),
70
- /* @__PURE__ */L("td",{className:"px-3 h-8 text-right text-gray-500 tabular-nums",children:e.deletedAt?S(e.deletedAt):"—"}),
71
- /* @__PURE__ */D("td",{className:"px-3 h-8 text-right whitespace-nowrap",children:[
72
- /* @__PURE__ */L("button",{onClick:()=>(async e=>{const t=await he(`${M}/api/trash/restore`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e.id})});if(!t.ok){const e=await t.json().catch(()=>({}));return void b.error(e.error||`Restore failed (${t.status})`)}b.success(`Restored "${e.name}"`),fe()})(e),className:"px-2 py-0.5 rounded hover:bg-gray-200 text-blue-600 text-2xs",children:"Restore"}),
73
- /* @__PURE__ */L("button",{onClick:()=>(async e=>{if(!await g({title:"Permanently delete",message:`"${e.name}" will be permanently removed. This can't be undone.`,confirmLabel:"Delete forever",variant:"danger"}))return;const t=await he(`${M}/api/trash/${encodeURIComponent(e.id)}`,{method:"DELETE"});if(!t.ok){const e=await t.json().catch(()=>({}));return void b.error(e.error||`Delete failed (${t.status})`)}fe()})(e),className:"px-2 py-0.5 rounded hover:bg-red-100 text-red-600 text-2xs ml-1",children:"Delete forever"})]})]},e.id))})]}):K&&0===A.length?/* @__PURE__ */L(N,{size:"sm",padding:"p-6",label:"Loading"}):0===A.length?/* @__PURE__ */D("div",{className:"p-10 text-center text-sm text-gray-400",children:["Empty folder.",!F&&/* @__PURE__ */D(E,{children:[" Drop files here or click ",
74
- /* @__PURE__ */L("span",{className:"font-medium",children:"Upload"}),"."]})]}):/* @__PURE__ */D("table",{className:"w-full text-sm",children:[
75
- /* @__PURE__ */L("thead",{className:"bg-gray-50 text-2xs uppercase tracking-wide text-gray-500",children:/* @__PURE__ */D("tr",{children:[
76
- /* @__PURE__ */L("th",{className:`${w} text-left font-medium px-3 h-8`,children:"Name"}),
77
- /* @__PURE__ */L("th",{className:`${w} text-right font-medium px-3 h-8 w-24`,children:"Size"}),
78
- /* @__PURE__ */L("th",{className:`${w} text-right font-medium px-3 h-8 w-40`,children:"Modified"}),
79
- /* @__PURE__ */L("th",{className:`${w} w-32`})]})}),
80
- /* @__PURE__ */L("tbody",{children:A.map(t=>/* @__PURE__ */D("tr",{onClick:()=>G(t.name),onDoubleClick:()=>{"folder"===t.kind?U(P(I,t.name)):(async t=>{if(F)return;const r=P(I,t.name),a=(t.name.split(".").pop()||"").toLowerCase(),n=W[a];n?await e({filePath:r,filename:t.name,kind:n,onStaged:e=>ce(e)}):xe(t)})(t)},className:"cursor-default border-b border-gray-100 "+(B===t.name?"bg-blue-50":"hover:bg-gray-50"),children:[
81
- /* @__PURE__ */D("td",{className:"px-3 h-8 flex items-center gap-2",children:["folder"===t.kind?/* @__PURE__ */L(k,{name:"folder",look:"solid",className:"h-4 w-4 text-amber-500 shrink-0"}):/* @__PURE__ */L(k,{name:"page",className:"h-4 w-4 text-gray-400 shrink-0",strokeWidth:1.5}),
82
- /* @__PURE__ */L("span",{className:"truncate",title:t.name,children:t.name})]}),
83
- /* @__PURE__ */L("td",{className:"px-3 h-8 text-right tabular-nums text-gray-500",children:"folder"===t.kind?"—":a(t.size)}),
84
- /* @__PURE__ */L("td",{className:"px-3 h-8 text-right text-gray-500 tabular-nums",children:S(t.modifiedAt)}),
85
- /* @__PURE__ */L("td",{className:"px-3 h-8 text-right whitespace-nowrap",children:!F&&/* @__PURE__ */D(E,{children:["file"===t.kind&&/* @__PURE__ */L("button",{onClick:e=>{e.stopPropagation(),xe(t)},className:"px-2 py-0.5 rounded hover:bg-gray-200 text-gray-500 text-2xs",children:"Download"}),
86
- /* @__PURE__ */L("button",{onClick:e=>{e.stopPropagation(),(async e=>{const t=await y({title:`Rename ${e.kind}`,defaultValue:e.name,confirmLabel:"Rename"});if(!t||t===e.name)return;if(/[\\/]/.test(t))return void b.error("Names cannot contain slashes");const r=P(I,e.name),a=P(I,t),n=await he(`${M}/api/rename`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({from:r,to:a})});if(!n.ok){const e=await n.json().catch(()=>({}));return void b.error(e.error||`Rename failed (${n.status})`)}ue(I)})(t)},className:"px-2 py-0.5 rounded hover:bg-gray-200 text-gray-500 text-2xs ml-1",children:"Rename"}),
87
- /* @__PURE__ */L("button",{onClick:e=>{e.stopPropagation(),(async e=>{if(!await g({title:`Delete ${e.kind}`,message:`"${e.name}"${"folder"===e.kind?" and everything inside":""} will be permanently removed.`,confirmLabel:"Delete",variant:"danger"}))return;const t=P(I,e.name),r=await he(`${M}/api/files?path=${encodeURIComponent(t)}`,{method:"DELETE"});if(!r.ok){const e=await r.json().catch(()=>({}));return void b.error(e.error||`Delete failed (${r.status})`)}ue(I)})(t)},className:"px-2 py-0.5 rounded hover:bg-red-100 text-red-600 text-2xs ml-1",children:"Delete"})]})})]},t.name))})]})})]})})}),Z&&/* @__PURE__ */L("div",{className:"absolute inset-0 bg-blue-500/15 border-4 border-dashed border-blue-500 pointer-events-none flex items-center justify-center z-20",children:/* @__PURE__ */L("div",{className:"px-4 py-2 rounded-md bg-blue-600 text-white text-sm font-medium shadow-lg",children:"Drop to upload"})})]})}export{M as default};
@@ -1,25 +0,0 @@
1
- import{getNumberingConfigs as e}from"./chunk-QDLGU62M.js";import{SidebarLayout as t}from"./chunk-LGLZTJ2W.js";import"./chunk-QWK6DRSN.js";import"./chunk-KZHPX4FM.js";import{timeAgo as r}from"./chunk-X2S2XDZI.js";import"./chunk-5OTS2G3M.js";import"./chunk-36BRD5J3.js";import{AboutApp as n}from"./chunk-Y37PBT4H.js";import{useWindowManager as o,client_default as i}from"./chunk-KJY57QPT.js";import"./chunk-CY5N5OA3.js";import"./chunk-AW7TOB6N.js";import"./chunk-KNUR2UEG.js";import"./chunk-JDCM2VHG.js";import"./chunk-BMPBVI7P.js";import"./chunk-5A7MWTXX.js";import"./chunk-Y53KNQKL.js";import"./chunk-6WWAQC5V.js";import"./chunk-EGDJEY4K.js";import"./chunk-GNPTNAZH.js";import{useShellPrefs as s}from"./chunk-KC3EX26K.js";import"./chunk-4AJRHTTB.js";import"./chunk-VWGWZY7A.js";import"./chunk-PKXQDCNR.js";import{toast_default as c}from"./chunk-4NXMMWL6.js";import"./chunk-UGTRSRIW.js";import"./chunk-ET2EF5CI.js";import"./chunk-CDAJKLGL.js";import"./chunk-YAEUF3GP.js";import"./chunk-DXTKNHWG.js";import"./chunk-QR4RM7PO.js";import"./chunk-5QFPTDQF.js";import"./chunk-D323R2FT.js";import"./chunk-4IU5BSVE.js";import"./chunk-K7U4RWXJ.js";import"./chunk-VH6GB73Q.js";import{Icon as a}from"./chunk-FSPFV4MI.js";import"./chunk-J75ZT2JQ.js";import"./chunk-Q5MD3VY6.js";import"./chunk-MRJKZWWV.js";import"./chunk-6KO5VTL7.js";import"./chunk-22S6LG6D.js";import"./chunk-PGN5ME7B.js";import"./chunk-62LW225J.js";import"./chunk-GLUJS42B.js";import"./chunk-D65T4H6J.js";import"./chunk-DTJRIWFR.js";import"./chunk-TWVUQUUD.js";import"./chunk-E6UCGCOC.js";import"./chunk-C3QOHMR6.js";import{useRef as l,useEffect as p,useState as d,useCallback as m}from"react";import{useQuery as u}from"@tanstack/react-query";import{jsxs as h,Fragment as y,jsx as g}from"react/jsx-runtime";var x=[{key:"yellow",bg:"bg-yellow-100",border:"border-yellow-300",text:"text-yellow-900",dot:"bg-yellow-400"},{key:"blue",bg:"bg-blue-100",border:"border-blue-300",text:"text-blue-900",dot:"bg-blue-400"},{key:"green",bg:"bg-green-100",border:"border-green-300",text:"text-green-900",dot:"bg-green-400"},{key:"pink",bg:"bg-pink-100",border:"border-pink-300",text:"text-pink-900",dot:"bg-pink-400"},{key:"purple",bg:"bg-purple-100",border:"border-purple-300",text:"text-purple-900",dot:"bg-purple-400"},{key:"orange",bg:"bg-orange-100",border:"border-orange-300",text:"text-orange-900",dot:"bg-orange-400"},{key:"white",bg:"bg-white",border:"border-gray-300",text:"text-gray-900",dot:"bg-gray-300"}];var k={sales_order:{entityType:"order",endpoint:"/orders/sales-orders/"},purchase_order:{entityType:"purchase_order",endpoint:"/purchase-orders/"},invoice:{entityType:"invoice",endpoint:"/invoicing/invoices/"},vendor_invoice:{entityType:"vendor_invoice",endpoint:"/invoicing/vendor-invoices/"},shipment:{entityType:"shipment",endpoint:"/shipments/delivery-notes/"},receipt:{entityType:"payment",endpoint:"/invoicing/payments/"},vendor_payment:{entityType:"vendor_payment",endpoint:"/invoicing/vendor-payments/"},vendor_price_sheet:{entityType:"vendor_price_sheet",endpoint:"/pricing/manufacturer-price-sheets/"},client_price_sheet:{entityType:"price_sheet",endpoint:"/pricing/price-sheets/"},qc_report:{entityType:"qc_report",endpoint:"/qc-reports/"},warranty_claim:{entityType:"warranty_claim",endpoint:"/warranty-claims/claims/"},vendor_shipment:{entityType:"vendor_shipment",endpoint:"/shipments/goods-receipts/"}},b=/\[([ xX]?)\]/g;function f(){const{openEntity:f}=o(),{prefs:v,save:N}=s(),{data:j}=u({queryKey:["numbering-configs"],queryFn:()=>e(),retry:!1}),T=l({});p(()=>{if(!j)return;const e={};for(const t of j){const r=k[t.entity_type];if(!r)continue;const n=(t.prefix||"").replace("#","").toUpperCase();if(n&&(e[n]={...r,prefix:t.prefix}),t.alt_prefix){const n=t.alt_prefix.replace("#","").toUpperCase();n&&(e[n]={...r,prefix:t.alt_prefix})}}T.current=e},[j]);const w=v.notepad_notes||[],[_,C]=d(null),[W,D]=d(""),[S,$]=d(""),[G,K]=d("yellow"),[R,X]=d(!1),[P,J]=d(!1),M=l(null),U=l(),Q=w.find(e=>e.id===_);p(()=>{if(!_&&w.length>0){const e=w[0];C(e.id),D(e.title),$(e.content),K(e.color)}},[w.length]);const E=m(e=>{N({notepad_notes:e})},[N]),O=m(()=>{if(!_||!R)return;const e=w.map(e=>e.id===_?{...e,title:W,content:S,color:G,updated_at:/* @__PURE__ */(new Date).toISOString()}:e);E(e),X(!1)},[_,R,W,S,G,w,E]);p(()=>{if(R)return U.current&&clearTimeout(U.current),U.current=setTimeout(O,800),()=>{U.current&&clearTimeout(U.current)}},[R,O]),p(()=>()=>{R&&O()},[]);const I=e=>{R&&O(),C(e.id),D(e.title),$(e.content),K(e.color),X(!1),J(!1)},L=e=>{const t=S.slice(0,e),r=S.slice(e).match(/^\[([ xX]?)\]/);if(!r)return;const n="x"===r[1]||"X"===r[1]?"[ ]":"[x]",o=S.slice(e+r[0].length);$(t+n+o),X(!0)},V=async(e,t)=>{const r=T.current[e];if(!r)return;const n=`${e}#${t}`;try{const{data:e}=await i.get(r.endpoint,{params:{search:n,page_size:1}}),t=(e?.results??e??[])[0];t?f(r.entityType,t.id,t,n):c.error(`${n} not found`)}catch{c.error(`Failed to look up ${n}`)}},B="Start writing...\n\nTips:\n [] Type [] for a checkbox, click to toggle\n SO#35001 Type XX#NNNNN to link entities (SO, PO, CI, VI, PL, etc.)",F=/* @__PURE__ */h(y,{children:[
2
- /* @__PURE__ */g("div",{className:"p-2 border-b border-gray-200",children:/* @__PURE__ */h("button",{onClick:()=>{R&&O();const e={id:`note-${Date.now()}-${Math.random().toString(36).slice(2,6)}`,title:"",content:"",color:"yellow",sticky:!1,updated_at:/* @__PURE__ */(new Date).toISOString()},t=[e,...w];E(t),C(e.id),D(""),$(""),K("yellow"),X(!1),J(!0),setTimeout(()=>M.current?.focus(),50)},className:"w-full flex items-center justify-center gap-2 rounded-lg bg-blue-600 text-white px-3 min-h-8 py-1 text-sm font-medium hover:bg-blue-700 transition-colors",children:[
3
- /* @__PURE__ */g(a,{name:"add",className:"h-4 w-4",strokeWidth:2}),"New Note"]})}),
4
- /* @__PURE__ */g("div",{className:"flex-1 overflow-y-auto",children:0===w.length?/* @__PURE__ */g("p",{className:"text-sm text-gray-400 text-center py-8 px-4",children:"No notes yet. Create one to get started."}):w.map(e=>{const t=(n=e.color,x.find(e=>e.key===n)||x[0]);var n;/* @__PURE__ */
5
- return h("button",{onClick:()=>I(e),className:"w-full text-left px-3 py-3 border-b border-gray-100 transition-colors "+(_===e.id?"bg-blue-50":"hover:bg-gray-50"),children:[
6
- /* @__PURE__ */h("div",{className:"flex items-center gap-2",children:[
7
- /* @__PURE__ */g("div",{className:`w-3 h-3 rounded-full shrink-0 ${t.dot}`}),
8
- /* @__PURE__ */g("span",{className:"text-sm font-medium text-gray-900 truncate flex-1",children:e.title||"Untitled"}),e.sticky&&/* @__PURE__ */g(a,{name:"bookmark",look:"solid",className:"h-3 w-3 text-amber-500 shrink-0"})]}),
9
- /* @__PURE__ */g("p",{className:"text-xs text-gray-400 mt-0.5 truncate ml-5",children:e.content.replace(/\[[ xX]?\]/g,"").slice(0,60)||"Empty note"}),
10
- /* @__PURE__ */g("p",{className:"text-2xs text-gray-300 mt-0.5 ml-5",children:r(e.updated_at)})]},e.id)})})]});/* @__PURE__ */
11
- return h("div",{className:"h-full",children:[
12
- /* @__PURE__ */g(n,{app:"notepad"}),
13
- /* @__PURE__ */g(t,{sidebar:F,storageKey:"notepad.sidebarWidth",defaultWidth:224,minWidth:180,maxWidth:360,children:_?/* @__PURE__ */h("div",{className:"flex-1 flex flex-col min-w-0",children:[
14
- /* @__PURE__ */h("div",{className:"flex items-center gap-2 px-4 py-2 border-b border-gray-200",children:[
15
- /* @__PURE__ */g("input",{value:W,onChange:e=>{D(e.target.value),X(!0)},placeholder:"Note title...",className:"flex-1 text-lg font-semibold text-gray-900 outline-none bg-transparent placeholder:text-gray-300"}),
16
- /* @__PURE__ */g("div",{className:"flex gap-1",children:x.map(e=>/* @__PURE__ */g("button",{onClick:()=>{K(e.key),X(!0)},className:`w-5 h-5 rounded-full border-2 transition-all ${e.dot} ${G===e.key?"border-gray-600 scale-110":"border-transparent hover:border-gray-400"}`,title:e.key},e.key))}),
17
- /* @__PURE__ */g("button",{onClick:()=>(e=>{const t=w.map(t=>t.id===e?{...t,sticky:!t.sticky}:t);E(t);const r=t.find(t=>t.id===e);c.success(r?.sticky?"Pinned to desktop":"Removed from desktop")})(_),title:Q?.sticky?"Remove from desktop":"Pin to desktop",className:"p-1 rounded transition-colors "+(Q?.sticky?"text-amber-500 hover:text-amber-600":"text-gray-300 hover:text-amber-400"),children:/* @__PURE__ */g(a,{name:"bookmark",className:"h-4 w-4",fill:Q?.sticky?"currentColor":"none",strokeWidth:1.5})}),
18
- /* @__PURE__ */g("button",{onClick:()=>(e=>{const t=w.filter(t=>t.id!==e);if(E(t),_===e){const e=t[0];e?I(e):(C(null),D(""),$(""))}})(_),title:"Delete note",className:"p-1 rounded text-gray-300 hover:text-red-500 transition-colors",children:/* @__PURE__ */g(a,{name:"trash",className:"h-4 w-4",strokeWidth:1.5})})]}),P?/* @__PURE__ */g("textarea",{ref:M,value:S,onChange:e=>{$(e.target.value),X(!0)},onBlur:()=>{J(!1),R&&O()},placeholder:B,className:"flex-1 p-4 text-sm text-gray-700 outline-none resize-none bg-transparent leading-relaxed placeholder:text-gray-300 font-mono"}):/* @__PURE__ */g("div",{onClick:()=>{J(!0),setTimeout(()=>M.current?.focus(),50)},className:"flex-1 p-4 text-sm text-gray-700 overflow-y-auto leading-relaxed cursor-text",children:S?(e=>{if(!e)return[];const t=e.split("\n");return t.map((e,r)=>{const n=[];let o=0;const i=[],s=/([A-Z]{2,4})#(\d{4,6})/g;let c;for(;null!==(c=s.exec(e));){const e=c[1],t=c[2];if(T.current[e]){const n=c.index,o=c[0];i.push({idx:n,len:o.length,render:()=>/* @__PURE__ */g("button",{onClick:()=>V(e,t),className:"text-blue-600 hover:text-blue-800 hover:underline font-medium cursor-pointer",children:o},`ref-${r}-${n}`)})}}b.lastIndex=0;let l=0;for(let e=0;e<r;e++)l+=t[e].length+1;for(;null!==(c=b.exec(e));){const e="x"===c[1]||"X"===c[1],t=c.index,n=l+t;i.push({idx:t,len:c[0].length,render:()=>/* @__PURE__ */g("button",{onClick:()=>L(n),className:`inline-flex items-center justify-center w-4 h-4 rounded border ${e?"bg-blue-500 border-blue-500 text-white":"border-gray-400 bg-white hover:border-blue-400"} cursor-pointer align-text-bottom mr-0.5`,children:e&&/* @__PURE__ */g(a,{name:"check",className:"w-3 h-3",strokeWidth:3})},`cb-${r}-${t}`)})}i.sort((e,t)=>e.idx-t.idx);for(const t of i)t.idx>o&&n.push(/* @__PURE__ */g("span",{children:e.slice(o,t.idx)},`t-${r}-${o}`)),n.push(t.render()),o=t.idx+t.len;o<e.length&&n.push(/* @__PURE__ */g("span",{children:e.slice(o)},`t-${r}-${o}`)),0===n.length&&n.push(/* @__PURE__ */g("span",{children:"​"},`empty-${r}`));const p=/^\[x\]/i.test(e.trimStart());/* @__PURE__ */
19
- return g("div",{className:p?"line-through text-gray-400":"",children:n},r)})})(S):/* @__PURE__ */g("p",{className:"text-gray-300 whitespace-pre-line",children:B})}),
20
- /* @__PURE__ */h("div",{className:"px-4 min-h-8 py-1 border-t border-gray-100 flex items-center gap-4 text-2xs text-gray-400",children:[
21
- /* @__PURE__ */g("span",{children:"[] checkbox"}),
22
- /* @__PURE__ */g("span",{children:"SO#35001 entity link"}),
23
- /* @__PURE__ */g("span",{className:"ml-auto",children:P?"Editing":"Click to edit"})]})]}):/* @__PURE__ */g("div",{className:"flex-1 flex items-center justify-center",children:/* @__PURE__ */h("div",{className:"text-center text-gray-400",children:[
24
- /* @__PURE__ */g(a,{name:"page",className:"h-12 w-12 mx-auto mb-3 text-gray-300",strokeWidth:1}),
25
- /* @__PURE__ */g("p",{className:"text-sm",children:"Select a note or create a new one"})]})})})]})}export{f as default};
@@ -1 +0,0 @@
1
- export{PdfViewer as default,fitScale,pdfWasmParams}from"./chunk-WRORJNS5.js";import"./chunk-4NXMMWL6.js";import"./chunk-K7U4RWXJ.js";import"./chunk-FSPFV4MI.js";import"./chunk-J75ZT2JQ.js";import"./chunk-Q5MD3VY6.js";import"./chunk-MRJKZWWV.js";import"./chunk-E6UCGCOC.js";import"./chunk-C3QOHMR6.js";
@@ -1,177 +0,0 @@
1
- import{PdfViewer as e,ToolbarSlotContext as t,PanelActions as n}from"./chunk-WRORJNS5.js";import{ImageAnnotator_default as r}from"./chunk-SB7OTZI4.js";import{AboutApp as s}from"./chunk-Y37PBT4H.js";import{peekPdfPreviewStage as i,claimPdfPreviewStage as a,PDF_PREVIEW_UPDATE_EVENT as o}from"./chunk-ESL5TDNA.js";import{WindowTitle as l,getActiveModalId as c}from"./chunk-KJY57QPT.js";import"./chunk-CY5N5OA3.js";import"./chunk-AW7TOB6N.js";import"./chunk-KNUR2UEG.js";import"./chunk-JDCM2VHG.js";import"./chunk-BMPBVI7P.js";import"./chunk-5A7MWTXX.js";import"./chunk-Y53KNQKL.js";import"./chunk-6WWAQC5V.js";import"./chunk-EGDJEY4K.js";import"./chunk-GNPTNAZH.js";import"./chunk-KC3EX26K.js";import"./chunk-4AJRHTTB.js";import"./chunk-VWGWZY7A.js";import"./chunk-PKXQDCNR.js";import{toast_default as d}from"./chunk-4NXMMWL6.js";import"./chunk-UGTRSRIW.js";import"./chunk-ET2EF5CI.js";import"./chunk-CDAJKLGL.js";import"./chunk-YAEUF3GP.js";import"./chunk-DXTKNHWG.js";import"./chunk-QR4RM7PO.js";import"./chunk-5QFPTDQF.js";import"./chunk-D323R2FT.js";import"./chunk-4IU5BSVE.js";import"./chunk-K7U4RWXJ.js";import"./chunk-VH6GB73Q.js";import{Icon as u}from"./chunk-FSPFV4MI.js";import"./chunk-J75ZT2JQ.js";import{SpinnerRing as p,LoadingSpinner as m}from"./chunk-Q5MD3VY6.js";import"./chunk-MRJKZWWV.js";import"./chunk-6KO5VTL7.js";import"./chunk-22S6LG6D.js";import"./chunk-PGN5ME7B.js";import"./chunk-62LW225J.js";import"./chunk-GLUJS42B.js";import"./chunk-D65T4H6J.js";import"./chunk-DTJRIWFR.js";import{registerModalEscapeInterceptor as h}from"./chunk-TWVUQUUD.js";import{useShellStrings as y,splitAround as x}from"./chunk-E6UCGCOC.js";import"./chunk-C3QOHMR6.js";import{useRef as f,useState as g,useEffect as b}from"react";import{jsxs as w,jsx as v,Fragment as k}from"react/jsx-runtime";var N=!1;function C(e,t){return e?.url&&e.url!==t.url&&e.url.startsWith("blob:")&&URL.revokeObjectURL(e.url),t}function A(){const n=f(void 0);void 0===n.current&&(n.current=i());const[r,p]=g(n.current?.data??null);b(()=>{const e=n.current;null!=e&&(a(e),p(t=>t===e.data?t:C(t,e.data)))},[]),b(()=>{const e=n.current?.token;if(null==e)return;const t=t=>{const n=t.detail;n&&n.token===e&&p(e=>C(e,n.data))};return window.addEventListener(o,t),()=>window.removeEventListener(o,t)},[]);const m=f(void 0);b(()=>{m.current=r?.url},[r?.url]);const h=f(null);b(()=>(null!==h.current&&(clearTimeout(h.current),h.current=null),()=>{const e=m.current;e?.startsWith("blob:")&&(h.current=setTimeout(()=>URL.revokeObjectURL(e),0))}),[]);const N=y().preview,A=r?.filename?(L=r.filename).length>24?`${L.slice(0,23)}…`:L:N.untitled;var L;const M=f(null),z=f(null),[T,j]=g(null),[R,D]=g(!1),W=f(0),H=()=>M.current?.click(),I=()=>{W.current=0,D(!1)},O=e=>{const t=e.closest("[data-modal-id]");return!t||c()===t.dataset.modalId};b(()=>{const e=()=>I(),t=()=>I(),n=e=>{"Escape"===e.key&&I()};return window.addEventListener("dragend",e),window.addEventListener("drop",t),window.addEventListener("keydown",n),()=>{window.removeEventListener("dragend",e),window.removeEventListener("drop",t),window.removeEventListener("keydown",n)}},[]);const B=e=>{const t=(e.name.split(".").pop()||"").toLowerCase(),n="pdf"===t?"pdf":"dxf"===t?"dxf":["jpg","jpeg","png","gif","webp","svg","avif","bmp"].includes(t)?"image":["stp","step","stl","obj","gltf","glb","3mf","iges","igs","ply","fbx"].includes(t)?"3d":void 0;if(!n)return void("dwg"===t?d.error(N.dwgUnsupported):d.error(N.unsupportedType(t)));const r=URL.createObjectURL(e);p(t=>(t?.url?.startsWith("blob:")&&t.url!==r&&URL.revokeObjectURL(t.url),{url:r,filename:e.name,kind:n}))},G=/* @__PURE__ */w("div",{className:"flex items-center gap-2 px-3 py-2 border-b border-gray-200 bg-gray-50 shrink-0",children:[
2
- /* @__PURE__ */v("input",{ref:M,type:"file",accept:".pdf,.dxf,.jpg,.jpeg,.png,.gif,.webp,.svg,.avif,.bmp,.stp,.step,.stl,.obj,.gltf,.glb,.3mf,.iges,.igs,.ply,.fbx",onChange:e=>{const t=e.target.files?.[0];t&&B(t),M.current&&(M.current.value="")},className:"hidden"}),
3
- /* @__PURE__ */w("button",{onClick:H,className:"text-xs text-gray-700 hover:text-gray-900 px-2 py-1 rounded hover:bg-gray-200 transition-colors flex items-center gap-1",children:[
4
- /* @__PURE__ */v(u,{name:"folder-open",className:"h-3.5 w-3.5",strokeWidth:1.5}),N.open]}),
5
- /* @__PURE__ */v("span",{className:"text-2xs text-gray-400 ml-1",children:N.formats}),r?.filename&&/* @__PURE__ */w(k,{children:[
6
- /* @__PURE__ */v("div",{className:"h-4 w-px bg-gray-300 mx-1"}),
7
- /* @__PURE__ */v("span",{className:"text-xs font-medium text-gray-700 truncate max-w-[200px]",title:r.filename,children:r.filename})]}),
8
- /* @__PURE__ */v("div",{ref:j,className:"ml-auto flex items-center gap-1 text-xs"})]});let X;if(r)X=r.converting||!r.url?/* @__PURE__ */v(E,{filename:r.filename,message:r.convertingMessage}):"dxf"===r.kind?/* @__PURE__ */v(S,{url:r.url,filename:r.filename,onDownload:r.onDownload,onEmail:r.onEmail},r.url):"3d"===r.kind?/* @__PURE__ */v(F,{url:r.url,filename:r.filename,onDownload:r.onDownload,onEmail:r.onEmail},r.url):"image"===r.kind?/* @__PURE__ */v(P,{url:r.url,filename:r.filename,onDownload:r.onDownload,onEmail:r.onEmail},r.url):/* @__PURE__ */v(e,{url:r.url,filename:r.filename,onDownload:r.onDownload,onEmail:r.onEmail},r.url);else{const[e,t]=x(N.dropHere),[n,r]=x(N.formatDxf),[s,i]=x(N.format3d);X=/* @__PURE__ */w("div",{className:"flex flex-1 flex-col items-center justify-center text-gray-500 text-sm gap-3 p-8 text-center",children:[
9
- /* @__PURE__ */v(u,{name:"page",className:"h-12 w-12 text-gray-300",strokeWidth:1.5}),
10
- /* @__PURE__ */w("p",{className:"font-medium text-gray-700",children:[e,
11
- /* @__PURE__ */v("button",{onClick:H,className:"text-blue-600 hover:underline",children:N.open}),t]}),
12
- /* @__PURE__ */w("div",{className:"text-xs text-gray-500 max-w-sm",children:[
13
- /* @__PURE__ */v("p",{className:"font-semibold uppercase tracking-wide text-3xs text-gray-400 mb-1",children:N.supportedFormats}),
14
- /* @__PURE__ */w("ul",{className:"space-y-0.5",children:[
15
- /* @__PURE__ */w("li",{children:[
16
- /* @__PURE__ */v("span",{className:"font-mono text-gray-700",children:".pdf"})," — ",N.formatPdf]}),
17
- /* @__PURE__ */w("li",{children:[
18
- /* @__PURE__ */v("span",{className:"font-mono text-gray-700",children:".dxf"})," — ",n,
19
- /* @__PURE__ */v("span",{className:"font-mono",children:"dxf-viewer"}),r]}),
20
- /* @__PURE__ */w("li",{children:[
21
- /* @__PURE__ */v("span",{className:"font-mono text-gray-700",children:".stp .step .stl .obj .gltf .glb .3mf .iges"})," — ",s,
22
- /* @__PURE__ */v("span",{className:"font-mono",children:"online-3d-viewer"}),i]}),
23
- /* @__PURE__ */w("li",{children:[
24
- /* @__PURE__ */v("span",{className:"font-mono text-gray-700",children:".jpg .jpeg .png .gif .webp .svg .avif .bmp"})," — ",N.formatImage]})]}),
25
- /* @__PURE__ */v("p",{className:"mt-2 text-2xs text-gray-400 italic",children:N.dwgNote})]})]})}/* @__PURE__ */
26
- return w("div",{className:"relative flex flex-col h-full",ref:z,onDragEnter:e=>{e.dataTransfer?.types?.includes?.("Files")&&O(e.currentTarget)&&(e.preventDefault(),W.current++,R||D(!0))},onDragOver:e=>{e.dataTransfer?.types?.includes?.("Files")&&O(e.currentTarget)&&e.preventDefault()},onDragLeave:()=>{W.current>0&&W.current--,0===W.current&&D(!1)},onDrop:e=>{O(e.currentTarget)?(e=>{e.preventDefault(),I();const t=e.dataTransfer.files?.[0];t&&B(t)})(e):I()},children:[
27
- /* @__PURE__ */v(l,{title:N.windowTitle(A)}),
28
- /* @__PURE__ */v(s,{app:"preview"}),G,
29
- /* @__PURE__ */v(t.Provider,{value:T,children:/* @__PURE__ */v("div",{className:"flex-1 min-h-0",children:X})}),R&&/* @__PURE__ */v("div",{className:"absolute inset-0 bg-blue-500/15 border-4 border-dashed border-blue-500 pointer-events-none flex items-center justify-center z-20",children:/* @__PURE__ */v("div",{className:"px-4 py-2 rounded-md bg-blue-600 text-white text-sm font-medium shadow-lg",children:N.dropToOpen})})]})}function E({filename:e,message:t}){const n=y().preview;/* @__PURE__ */
30
- return w("div",{className:"flex flex-col items-center justify-center h-full bg-gray-100 gap-4 px-8",children:[
31
- /* @__PURE__ */w("div",{className:"flex flex-col items-center gap-3",children:[
32
- /* @__PURE__ */v(p,{className:"h-12 w-12"}),
33
- /* @__PURE__ */v("div",{className:"text-base font-semibold tracking-wide text-gray-700 uppercase",children:t||n.converting}),
34
- /* @__PURE__ */v("div",{className:"text-xs text-gray-400 truncate max-w-md",children:e})]}),
35
- /* @__PURE__ */v("div",{className:"w-72 h-1.5 rounded-full bg-gray-200 overflow-hidden",children:/* @__PURE__ */v("div",{className:"h-full w-1/3 bg-blue-500 rounded-full animate-pulse",style:{animation:"preview-bar 1.4s ease-in-out infinite"}})}),
36
- /* @__PURE__ */v("style",{children:"@keyframes preview-bar { 0% { transform: translateX(-110%); } 100% { transform: translateX(310%); } }"})]})}var L=["https://cdn.jsdelivr.net/gh/vagran/dxf-viewer-example-src@master/src/assets/fonts/Roboto-LightItalic.ttf","https://cdn.jsdelivr.net/gh/vagran/dxf-viewer-example-src@master/src/assets/fonts/NotoSansDisplay-SemiCondensedLightItalic.ttf","https://cdn.jsdelivr.net/gh/vagran/dxf-viewer-example-src@master/src/assets/fonts/NanumGothic-Regular.ttf"],M={l:"LINE",line:"LINE",pl:"PLINE",pline:"PLINE",ex:"EXTEND",extend:"EXTEND",tr:"TRIM",trim:"TRIM",e:"ERASE",erase:"ERASE",m:"MOVE",move:"MOVE",co:"COPY",cp:"COPY",copy:"COPY",o:"OFFSET",offset:"OFFSET",f:"FILLET",fillet:"FILLET",cha:"CHAMFER",chamfer:"CHAMFER",x:"EXPLODE",explode:"EXPLODE",mi:"MIRROR",mirror:"MIRROR",ro:"ROTATE",rotate:"ROTATE",sc:"SCALE",scale:"SCALE",s:"STRETCH",stretch:"STRETCH",ar:"ARRAY",array:"ARRAY",rec:"RECTANG",rectang:"RECTANG",rectangle:"RECTANG",c:"CIRCLE",circle:"CIRCLE",a:"ARC",arc:"ARC",el:"ELLIPSE",ellipse:"ELLIPSE",t:"MTEXT",mt:"MTEXT",mtext:"MTEXT",text:"TEXT",b:"BLOCK",block:"BLOCK",i:"INSERT",insert:"INSERT",ha:"HATCH",hatch:"HATCH"};function S({url:e,filename:t,onDownload:r,onEmail:s}){const i=f(null),a=f(null),[o,l]=g(!0),[d,p]=g(null),[N,C]=g([]),[A,E]=g(!1),[S,z]=g(!0),T=y(),j=T.drawing,R=T.preview,F=f(j);F.current=j;const[P,W]=g(!1),[H,I]=g("auto"),[O,B]=g(null),[G,X]=g(null),[U,V]=g(null),[_,Y]=g(""),$=f(H),K=f(U);b(()=>{$.current=H},[H]),b(()=>{K.current=U},[U]);const J=f(null),Z=f(null),q=f(null),[Q,ee]=g(""),[te,ne]=g(null),re=f(""),se=f(null),ie=f(null),ae=f(null);b(()=>{let t=!1,n=null;return l(!0),p(null),C([]),(async()=>{let r;try{r=(await(import("dxf-viewer"))).DxfViewer}catch(e){return void(t||(p(F.current.notInstalled),l(!1)))}if(!t&&i.current)try{if(await new Promise(e=>{const t=()=>{const n=i.current?.getBoundingClientRect();n&&n.width>4&&n.height>4?e():requestAnimationFrame(t)};t()}),t||!i.current)return;const s={autoResize:!0},o=r.DefaultOptions?.clearColor;"function"==typeof o?.clone&&(s.clearColor=o.clone().setHex(16777215)),n=new r(i.current,s),a.current=n;const c="undefined"!=typeof window&&window.__REACT_OS_SHELL_DXF_FONTS__||L;if(await n.Load({url:e,fonts:c,workerFactory:null}),t)return;try{const e=n.GetLayers?.()??[];Array.isArray(e)&&C(e.map(e=>({name:e.name,displayName:e.displayName??e.name,color:"number"==typeof e.color?e.color:void 0,visible:!0})))}catch{}const d=()=>{try{const e=i.current?.getBoundingClientRect();e&&e.width>0&&e.height>0&&n.SetSize?.(Math.round(e.width),Math.round(e.height));const t=n.GetBounds?.(),r=n.GetOrigin?.();t&&r&&n.FitView(t.minX-r.x,t.maxX-r.x,t.minY-r.y,t.maxY-r.y),n.Render?.()}catch(e){console.warn("[Preview] DXF refit failed",e)}};d(),requestAnimationFrame(d),l(!1)}catch(e){t||(p(e?.message||F.current.renderFailed),l(!1))}})(),()=>{t=!0;try{n?.Destroy?.()}catch{}a.current=null}},[e]),b(()=>{if(!S||o)return;const e=setTimeout(()=>z(!1),5e3);return()=>clearTimeout(e)},[S,o]);const oe=N.map(e=>e.visible?"1":"0").join("");b(()=>{const e=a.current;if(o||d||!e)return;const t=e.GetScene?.(),n=e.GetCamera?.(),r=e.GetCanvas?.();if(!(t&&n&&r&&i.current))return;const s=()=>{const e=ae.current;e&&(e.overlay&&e.overlay.parentElement&&e.overlay.parentElement.removeChild(e.overlay),ae.current=null)};if(!P)return s(),B(null),void X(null);const l=document.createElement("div");l.style.cssText="position:absolute;inset:0;pointer-events:none;z-index:5;",i.current.appendChild(l);const c=document.createElementNS("http://www.w3.org/2000/svg","svg");c.setAttribute("style","position:absolute;inset:0;width:100%;height:100%;pointer-events:none;");const u=document.createElementNS("http://www.w3.org/2000/svg","defs"),p=document.createElementNS("http://www.w3.org/2000/svg","marker");p.setAttribute("id","dxf-measure-arrow"),p.setAttribute("viewBox","0 0 10 10"),p.setAttribute("refX","9"),p.setAttribute("refY","5"),p.setAttribute("markerWidth","6"),p.setAttribute("markerHeight","6"),p.setAttribute("orient","auto-start-reverse");const m=document.createElementNS("http://www.w3.org/2000/svg","path");m.setAttribute("d","M 0 0 L 10 5 L 0 10 z"),m.setAttribute("fill","#ff8800"),p.appendChild(m),u.appendChild(p),c.appendChild(u),l.appendChild(c);const h=()=>{const e=document.createElementNS("http://www.w3.org/2000/svg","line");return e.setAttribute("stroke","#ff8800"),e.setAttribute("stroke-width","1"),e.setAttribute("stroke-dasharray","6,4"),e.setAttribute("opacity","0.55"),e.style.display="none",c.appendChild(e),e},y=h(),x=h(),f=document.createElementNS("http://www.w3.org/2000/svg","line");f.setAttribute("stroke","#ff8800"),f.setAttribute("stroke-width","1"),f.setAttribute("opacity","0.85"),f.style.display="none",c.appendChild(f);const g=document.createElementNS("http://www.w3.org/2000/svg","line");g.setAttribute("stroke","#ff8800"),g.setAttribute("stroke-width","1"),g.setAttribute("opacity","0.85"),g.style.display="none",c.appendChild(g);const b=document.createElementNS("http://www.w3.org/2000/svg","line");b.setAttribute("stroke","#ff8800"),b.setAttribute("stroke-width","1.5"),b.setAttribute("stroke-linecap","round"),b.style.display="none",c.appendChild(b);const w=document.createElementNS("http://www.w3.org/2000/svg","line");w.setAttribute("stroke","#ff8800"),w.setAttribute("stroke-width","1.5"),w.setAttribute("stroke-linecap","round"),w.style.display="none",c.appendChild(w);const v=document.createElement("div");v.style.cssText="position:absolute;transform:translate(-50%,-50%);pointer-events:none;display:none;";const k="http://www.w3.org/2000/svg",N=document.createElementNS(k,"svg");N.setAttribute("width","22"),N.setAttribute("height","22"),N.setAttribute("viewBox","0 0 22 22"),N.setAttribute("style","overflow:visible;display:block"),v.appendChild(N);const C=e=>{const t=document.createElementNS(k,"g");return e(t),t.style.display="none",N.appendChild(t),t},A=C(e=>{const t=document.createElementNS(k,"rect");t.setAttribute("x","4"),t.setAttribute("y","4"),t.setAttribute("width","14"),t.setAttribute("height","14"),t.setAttribute("fill","rgba(255,255,255,0.9)"),t.setAttribute("stroke","#ff8800"),t.setAttribute("stroke-width","1.8"),e.appendChild(t)}),E=C(e=>{const t=(e,t,n,r)=>{const s=document.createElementNS(k,"line");return s.setAttribute("x1",String(e)),s.setAttribute("y1",String(t)),s.setAttribute("x2",String(n)),s.setAttribute("y2",String(r)),s.setAttribute("stroke","#ff8800"),s.setAttribute("stroke-width","2.2"),s.setAttribute("stroke-linecap","round"),s};e.appendChild(t(4,4,18,18)),e.appendChild(t(18,4,4,18))}),L=C(e=>{const t=document.createElementNS(k,"polygon");t.setAttribute("points","4,4 18,4 4,18 18,18"),t.setAttribute("fill","rgba(255,255,255,0.9)"),t.setAttribute("stroke","#ff8800"),t.setAttribute("stroke-width","1.8"),t.setAttribute("stroke-linejoin","round"),e.appendChild(t)}),M=C(e=>{const t=document.createElementNS(k,"polygon");t.setAttribute("points","11,3 19,18 3,18"),t.setAttribute("fill","rgba(255,255,255,0.9)"),t.setAttribute("stroke","#ff8800"),t.setAttribute("stroke-width","1.8"),t.setAttribute("stroke-linejoin","round"),e.appendChild(t)}),S=C(e=>{const t=document.createElementNS(k,"circle");t.setAttribute("cx","11"),t.setAttribute("cy","11"),t.setAttribute("r","7"),t.setAttribute("fill","rgba(255,255,255,0.9)"),t.setAttribute("stroke","#ff8800"),t.setAttribute("stroke-width","1.8"),e.appendChild(t);const n=(e,t,n,r)=>{const s=document.createElementNS(k,"line");return s.setAttribute("x1",String(e)),s.setAttribute("y1",String(t)),s.setAttribute("x2",String(n)),s.setAttribute("y2",String(r)),s.setAttribute("stroke","#ff8800"),s.setAttribute("stroke-width","1.6"),s.setAttribute("stroke-linecap","round"),s};e.appendChild(n(6.5,6.5,15.5,15.5)),e.appendChild(n(15.5,6.5,6.5,15.5))});l.appendChild(v),ae.current={picks:[],rawSecondClick:null,overlay:l,svg:c,line:b,fixedLine:w,fixedLabel:null,refLine:y,refLineV:x,extLineA:f,extLineB:g,markers:[],label:null,snap:v,segs:null,nodes:null};const z=n?.position?.constructor??t?.position?.constructor??null;let T=!1;const j=(e,t)=>{if(!z)return{x:0,y:0};const s=new z(e,t,0).project(n),i=r.clientWidth,a=r.clientHeight;return{x:(s.x+1)/2*i,y:(1-s.y)/2*a}};(()=>{try{const e=ae.current;if(!e)return;const n=[],r=[];let s=!1;const i=e=>{const t=e?.attributes?.instanceTransform0,n=e?.attributes?.instanceTransform1;if(t&&n){const e=[],r=Math.min(t.count,n.count);for(let s=0;s<r;s++)e.push([t.getX(s),t.getY(s),t.getZ(s),n.getX(s),n.getY(s),n.getZ(s)]);return e}const r=e?.attributes?.instanceTransform;if(r){const e=[];for(let t=0;t<r.count;t++)e.push([1,0,r.getX(t),0,1,r.getY(t)]);return e}return[[1,0,0,0,1,0]]},a=e=>{const t=!!e?.isLineSegments;if(!t&&!!!e?.isPoints)return;const a=e.geometry,o=a?.attributes?.position;if(!o)return;const l=i(a);if(t){const e=a.index,t=Math.floor((e?e.count:o.count)/2);for(let r=0;r<t;r++){const t=e?e.getX(2*r):2*r,i=e?e.getX(2*r+1):2*r+1,a=o.getX(t),c=o.getY(t),d=o.getX(i),u=o.getY(i);if(Number.isFinite(a+c+d+u))for(const e of l){if(n.length>=16e5)return void(s=!0);const t=e[0]*a+e[1]*c+e[2],r=e[3]*a+e[4]*c+e[5],i=e[0]*d+e[1]*u+e[2],o=e[3]*d+e[4]*u+e[5];t===i&&r===o||n.push(t,r,i,o)}}}else for(let e=0;e<o.count;e++){const t=o.getX(e),n=o.getY(e);if(Number.isFinite(t+n))for(const e of l)r.push(e[0]*t+e[1]*n+e[2],e[3]*t+e[4]*n+e[5])}};"function"==typeof t.traverseVisible?t.traverseVisible(a):t.traverse(a),e.segs=new Float64Array(n),e.nodes=new Float64Array(r),s&&console.warn("[Preview] DXF snap cache truncated at 400000 segments — snapping may miss some geometry."),T=!0}catch{}})();const R=(e,t,n,r,s,i,a,o)=>{const l=(n-e)*(o-i)-(r-t)*(a-s);if(Math.abs(l)<1e-9)return null;const c=((s-e)*(o-i)-(i-t)*(a-s))/l,d=((s-e)*(r-t)-(i-t)*(n-e))/l,u=1e-4;return c<-u||c>1+u||d<-u||d>1+u?null:{px:e+c*(n-e),py:t+c*(r-t),t:c}},H=()=>{const e=document.createElement("div");return e.style.cssText="position:absolute;width:10px;height:10px;border-radius:50%;background:#ff8800;border:2px solid #fff;box-shadow:0 0 0 1px rgba(0,0,0,0.25);transform:translate(-50%,-50%);pointer-events:none;",l.appendChild(e),e},I=(e,t,n)=>{const r=j(t,n);e.style.left=`${r.x}px`,e.style.top=`${r.y}px`},O=()=>{const e=ae.current;if(!e||!e.rawSecondClick||e.picks.length<2)return;const t=e.picks[0],n=e.rawSecondClick,r=K.current,s=$.current;if(null===r||!Number.isFinite(r)||"horizontal"!==s&&"vertical"!==s)e.picks[1]={x:n.x,y:n.y};else if("horizontal"===s){const s=n.x>=t.x?1:-1;e.picks[1]={x:t.x+s*Math.abs(r),y:n.y}}else{const s=n.y>=t.y?1:-1;e.picks[1]={x:n.x,y:t.y+s*Math.abs(r)}}},G=(e,t)=>{const n=$.current;return"auto"!==n?n:e&&t?Math.abs(t.x-e.x)>=Math.abs(t.y-e.y)?"horizontal":"vertical":"horizontal"},U=()=>{const e=ae.current;if(!e)return;O();const t=$.current,n=K.current,s=null!==n&&Number.isFinite(n)&&("horizontal"===t||"vertical"===t);e.markers[0]&&I(e.markers[0],e.picks[0].x,e.picks[0].y),e.markers[1]&&I(e.markers[1],e.picks[1].x,e.picks[1].y);const i=(t,n,s)=>{if(!t)return;if(!s||e.picks.length<1)return void(t.style.display="none");const i=e.picks[0],a=r.clientWidth,o=r.clientHeight,l=4*Math.hypot(a,o),c=j(i.x,i.y),d=j(i.x+n.dx,i.y+n.dy),u=l/(Math.hypot(d.x-c.x,d.y-c.y)||1),p=j(i.x-n.dx*u,i.y-n.dy*u),m=j(i.x+n.dx*u,i.y+n.dy*u);t.setAttribute("x1",String(p.x)),t.setAttribute("y1",String(p.y)),t.setAttribute("x2",String(m.x)),t.setAttribute("y2",String(m.y)),t.style.display=""};let a="horizontal"===t,o="vertical"===t;if("auto"===t)if(e.picks.length>=2){const t=G(e.picks[0],e.picks[1]);a="horizontal"===t,o="vertical"===t}else a=!0,o=!0;if(i(e.refLine,{dx:1,dy:0},a),i(e.refLineV,{dx:0,dy:1},o),2===e.picks.length){const t=e.picks[0],i=e.picks[1],a=G(t,i),o=(()=>{const e=ae.current,t=e.picks[0],n=e.picks[1],r=G(t,n),s=$.current,i=K.current;return null!==i&&Number.isFinite(i)&&"horizontal"===s?{from:{x:n.x,y:t.y},to:{x:n.x,y:n.y}}:null!==i&&Number.isFinite(i)&&"vertical"===s?{from:{x:t.x,y:n.y},to:{x:n.x,y:n.y}}:"horizontal"===r?{from:t,to:{x:n.x,y:t.y}}:"vertical"===r?{from:t,to:{x:t.x,y:n.y}}:{from:t,to:n}})(),l=j(o.from.x,o.from.y),c=j(o.to.x,o.to.y);e.line.setAttribute("x1",String(l.x)),e.line.setAttribute("y1",String(l.y)),e.line.setAttribute("x2",String(c.x)),e.line.setAttribute("y2",String(c.y)),e.line.setAttribute("marker-start","url(#dxf-measure-arrow)"),e.line.setAttribute("marker-end","url(#dxf-measure-arrow)");const d=Math.hypot(c.x-l.x,c.y-l.y);if(e.line.style.display=d>.5?"":"none",s&&e.fixedLine){const s="horizontal"===a?{x:i.x,y:t.y}:{x:t.x,y:i.y},o=j(t.x,t.y),l=j(s.x,s.y);e.fixedLine.setAttribute("x1",String(o.x)),e.fixedLine.setAttribute("y1",String(o.y)),e.fixedLine.setAttribute("x2",String(l.x)),e.fixedLine.setAttribute("y2",String(l.y)),e.fixedLine.setAttribute("marker-start","url(#dxf-measure-arrow)"),e.fixedLine.setAttribute("marker-end","url(#dxf-measure-arrow)"),e.fixedLine.style.display="";const c=V();c.textContent=D(Math.abs(n));const d=(o.x+l.x)/2,u=(o.y+l.y)/2;c.style.left=`${d}px`,c.style.top=`${u}px`;const p=r.clientWidth,m=r.clientHeight;c.style.display=d<0||u<0||d>p||u>m?"none":""}else e.fixedLine&&(e.fixedLine.style.display="none"),e.fixedLabel&&(e.fixedLabel.style.display="none");const u=e.extLineA,p=e.extLineB;if(!s&&"horizontal"===a&&Math.abs(i.y-t.y)>1e-9){const e=j(i.x,t.y),n=j(i.x,i.y);p.setAttribute("x1",String(e.x)),p.setAttribute("y1",String(e.y)),p.setAttribute("x2",String(n.x)),p.setAttribute("y2",String(n.y)),p.style.display="",u.style.display="none"}else if(!s&&"vertical"===a&&Math.abs(i.x-t.x)>1e-9){const e=j(t.x,i.y),n=j(i.x,i.y);p.setAttribute("x1",String(e.x)),p.setAttribute("y1",String(e.y)),p.setAttribute("x2",String(n.x)),p.setAttribute("y2",String(n.y)),p.style.display="",u.style.display="none"}else u.style.display="none",p.style.display="none";if(e.label){const t=(l.x+c.x)/2,n=(l.y+c.y)/2;e.label.style.left=`${t}px`,e.label.style.top=`${n}px`;const s=r.clientWidth,i=r.clientHeight;e.label.style.display=t<0||n<0||t>s||n>i?"none":"",d<=.5&&(e.label.style.display="none")}}else e.line.style.display="none",e.fixedLine&&(e.fixedLine.style.display="none"),e.fixedLabel&&(e.fixedLabel.style.display="none"),e.extLineA&&(e.extLineA.style.display="none"),e.extLineB&&(e.extLineB.style.display="none")},V=()=>{const e=ae.current;if(e.fixedLabel)return e.fixedLabel;const t=document.createElement("div");return t.style.cssText="position:absolute;left:-9999px;top:-9999px;transform:translate(-50%,-50%);padding:2px 6px;font-size:var(--text-2xs);font-weight:600;font-family:system-ui,-apple-system,sans-serif;background:rgba(255,136,0,0.75);color:#fff;border-radius:4px;white-space:nowrap;box-shadow:0 1px 4px rgba(0,0,0,0.25);pointer-events:none;",l.appendChild(t),e.fixedLabel=t,t};let _=0,Y=0,Q=0,ee=!1,te=!1,re=null;const se=e=>{const t=e?.detail;t&&0===t.domEvent?.button&&(_=t.canvasCoord.x,Y=t.canvasCoord.y,Q=performance.now(),te=!1,ee=!0)},ie=e=>{const t=r.getBoundingClientRect(),n=e.clientX-t.left,s=e.clientY-t.top;ee&&(n-_)**2+(s-Y)**2>16&&(te=!0);const i=ae.current;var a;if(i&&i.snap)if(ee&&te)i.snap.style.display="none";else if(re=((e,t)=>{const n=ae.current;if(!n||!T||!n.segs)return null;const r=j(0,0),s=j(1,0),i=j(0,1),a=s.x-r.x,o=s.y-r.y,l=i.x-r.x,c=i.y-r.y,d=a*c-l*o;if(!d)return null;const u=((e-r.x)*c-(t-r.y)*l)/d,p=((t-r.y)*a-(e-r.x)*o)/d,m=18/(Math.hypot(a,o)||1),h=18/(Math.hypot(l,c)||1),y=u-m,x=u+m,f=p-h,g=p+h,b=324;let w=null,v=b,k=null,N=b,C=null,A=b,E=null,L=b;const M=[],S=n.segs;for(let n=0;n<S.length;n+=4){const s=S[n],i=S[n+1],d=S[n+2],u=S[n+3];if(s<y&&d<y||s>x&&d>x||i<f&&u<f||i>g&&u>g)continue;const p=r.x+a*s+l*i,m=r.y+o*s+c*i,h=r.x+a*d+l*u,E=r.y+o*d+c*u;let L=!1,z=e-p,T=t-m,j=z*z+T*T;j<b&&(L=!0,j<v&&(v=j,w={sx:s,sy:i,type:"endpoint"})),z=e-h,T=t-E,j=z*z+T*T,j<b&&(L=!0,j<v&&(v=j,w={sx:d,sy:u,type:"endpoint"})),z=e-(p+h)/2,T=t-(m+E)/2,j=z*z+T*T,j<b&&(L=!0,j<N&&(N=j,k={sx:(s+d)/2,sy:(i+u)/2,type:"midpoint"}));const R=h-p,D=E-m,F=R*R+D*D;if(F>0){const n=((e-p)*R+(t-m)*D)/F;n>0&&n<1&&(z=e-(p+n*R),T=t-(m+n*D),j=z*z+T*T,j<b&&(L=!0,j<A&&(A=j,C={sx:s+n*(d-s),sy:i+n*(u-i),type:"line"})))}L&&M.push({ax:s,ay:i,bx:d,by:u,apx:p,apy:m,bpx:h,bpy:E})}const z=n.nodes;if(z)for(let n=0;n<z.length;n+=2){const s=z[n],i=z[n+1];if(s<y||s>x||i<f||i>g)continue;const d=e-(r.x+a*s+l*i),u=t-(r.y+o*s+c*i),p=d*d+u*u;p<v&&(v=p,w={sx:s,sy:i,type:"node"})}for(let n=0;n<M.length;n++){const r=M[n];for(let s=n+1;s<M.length;s++){const n=M[s],i=R(r.apx,r.apy,r.bpx,r.bpy,n.apx,n.apy,n.bpx,n.bpy);if(!i)continue;const a=e-i.px,o=t-i.py,l=a*a+o*o;l>=b||l>=L||(L=l,E={sx:r.ax+i.t*(r.bx-r.ax),sy:r.ay+i.t*(r.by-r.ay),type:"intersection"})}}return(E&&w?L<v-1?E:w:E??w)??k??C})(n,s),re){const e=j(re.sx,re.sy);i.snap.style.left=`${e.x}px`,i.snap.style.top=`${e.y}px`,i.snap.style.display="",a=re.type,A.style.display="endpoint"===a?"":"none",E.style.display="intersection"===a?"":"none",L.style.display="line"===a?"":"none",M.style.display="midpoint"===a?"":"none",S.style.display="node"===a?"":"none"}else i.snap.style.display="none"},oe=e=>{if(!ee)return;ee=!1;const t=performance.now()-Q;if(te||t>350)return;const n=e?.detail?.position;if(!n)return;const r=re?{x:re.sx,y:re.sy}:{x:n.x,y:n.y};ue(r)},le=()=>{const e=ae.current;if(!e||2!==e.picks.length)return;O();const t=e.picks[0],n=e.picks[1],r=$.current,s=G(t,n),i=K.current,a=null!==i&&Number.isFinite(i)&&("horizontal"===r||"vertical"===r);let o,c,d="",u=s;const p=Math.abs(n.x-t.x),m=Math.abs(n.y-t.y);if(a&&"horizontal"===r?(o=m,d=" ↕",u="vertical",c=F.current.echoLocked("ΔY",D(m),"ΔX",D(Math.abs(i)))):a&&"vertical"===r?(o=p,d=" ↔",u="horizontal",c=F.current.echoLocked("ΔX",D(p),"ΔY",D(Math.abs(i)))):"horizontal"===s?(o=p,d=" ↔",c=F.current.echoLinear(D(p),"ΔX")):"vertical"===s?(o=m,d=" ↕",c=F.current.echoLinear(D(m),"ΔY")):(o=Math.hypot(n.x-t.x,n.y-t.y),c=F.current.echoDistance(D(o),D(p),D(m))),!Number.isFinite(o))return B(null),X(null),void(e.label&&(e.label.style.opacity="0"));B(o),X(u),ne(c);const h=(()=>{const e=ae.current;if(e.label)return e.label;const t=document.createElement("div");return t.style.cssText="position:absolute;left:-9999px;top:-9999px;transform:translate(-50%,-50%);padding:2px 6px;font-size:var(--text-2xs);font-weight:600;font-family:system-ui,-apple-system,sans-serif;background:rgba(255,136,0,0.95);color:#fff;border-radius:4px;white-space:nowrap;box-shadow:0 1px 4px rgba(0,0,0,0.25);pointer-events:none;",l.appendChild(t),e.label=t,t})();h.style.opacity="1",h.textContent=`${D(o)}${d}`};J.current=()=>{le(),U()};const ce=e=>{e.line.style.display="none",e.fixedLine&&(e.fixedLine.style.display="none"),e.fixedLabel&&(e.fixedLabel.style.display="none"),e.extLineA&&(e.extLineA.style.display="none"),e.extLineB&&(e.extLineB.style.display="none"),e.label&&(e.label.style.opacity="0"),B(null),X(null)},de=()=>{const e=ae.current;if(e){for(const t of e.markers)t.parentElement?.removeChild(t);e.markers=[],e.picks=[],e.rawSecondClick=null,e.refLine&&(e.refLine.style.display="none"),e.refLineV&&(e.refLineV.style.display="none"),ce(e)}};Z.current=de,q.current=()=>{const e=ae.current;if(!e||0===e.picks.length)return;e.picks.pop();const t=e.markers.pop();t?.parentElement?.removeChild(t),e.rawSecondClick=null,ce(e),U()};const ue=e=>{const t=ae.current;t&&(2===t.picks.length&&de(),0===t.picks.length?(t.picks.push({x:e.x,y:e.y}),t.markers.push(H())):(t.rawSecondClick={x:e.x,y:e.y},t.picks.push({x:e.x,y:e.y}),t.markers.push(H()),le()),U())},pe=e=>{"Escape"===e.key&&W(!1)};r.style.cursor="crosshair";try{e.Subscribe?.("pointerdown",se)}catch{}try{e.Subscribe?.("pointerup",oe)}catch{}try{e.Subscribe?.("viewChanged",U)}catch{}return r.addEventListener("pointermove",ie),window.addEventListener("keydown",pe),()=>{r.style.cursor="";try{e.Unsubscribe?.("pointerdown",se)}catch{}try{e.Unsubscribe?.("pointerup",oe)}catch{}try{e.Unsubscribe?.("viewChanged",U)}catch{}r.removeEventListener("pointermove",ie),window.removeEventListener("keydown",pe),J.current=null,Z.current=null,q.current=null,s(),B(null),X(null)}},[P,o,d,oe]),b(()=>{J.current?.()},[H,U]);const le=e=>{C(t=>t.map(t=>{if(t.visible===e)return t;try{a.current?.ShowLayer?.(t.name,e)}catch{}return{...t,visible:e}}))},ce=()=>{try{const e=a.current,t=e?.GetBounds?.(),n=e?.GetOrigin?.();t&&n?e.FitView(t.minX-n.x,t.maxX-n.x,t.minY-n.y,t.maxY-n.y):e?.FitView?.(),e?.Render?.()}catch{}};b(()=>{const e=e=>{if(e.defaultPrevented||e.metaKey||e.ctrlKey||e.altKey)return;if(1!==e.key.length||" "===e.key)return;const t=e.target;if(t&&("INPUT"===t.tagName||"TEXTAREA"===t.tagName||t.isContentEditable))return;const n=ie.current;if(!n)return;const r=n.closest("[data-modal-id]");r&&c()!==r.dataset.modalId||se.current?.focus()};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[]);const de=f(Q),ue=f(P);b(()=>{de.current=Q},[Q]),b(()=>{ue.current=P},[P]),b(()=>h(()=>{const e=ie.current;if(!e)return!1;const t=e.closest("[data-modal-id]");return!(!t||c()!==t.dataset.modalId)&&(de.current?(ee(""),ne(F.current.cancelled),!0):!!ue.current&&(W(!1),ne(F.current.measureOff),!0))}),[]);const pe="px-2 py-1 rounded hover:bg-gray-200 transition-colors text-gray-600 flex items-center gap-1",[me,he]=x(j.typeToMeasure);/* @__PURE__ */
37
- return w("div",{ref:ie,className:"flex flex-col h-full",children:[
38
- /* @__PURE__ */w(n,{children:[
39
- /* @__PURE__ */w("button",{onClick:()=>E(e=>!e),className:pe+(A?" bg-gray-200":""),title:j.layersHint,disabled:0===N.length,children:[
40
- /* @__PURE__ */v(u,{name:"layers",className:"h-3.5 w-3.5",strokeWidth:1.5}),j.layers," ",N.length>0&&/* @__PURE__ */w("span",{className:"text-gray-400",children:["(",N.filter(e=>e.visible).length,"/",N.length,")"]})]}),
41
- /* @__PURE__ */v("button",{onClick:()=>z(e=>!e),className:pe,title:R.howToNavigate,children:/* @__PURE__ */v(u,{name:"help",className:"h-3.5 w-3.5",strokeWidth:1.5})}),
42
- /* @__PURE__ */w("button",{onClick:()=>W(e=>!e),className:pe+(P?" bg-gray-200":""),title:P?R.stopMeasuring:j.measureHint,children:[
43
- /* @__PURE__ */w("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:[
44
- /* @__PURE__ */v("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 14.25l6-6 6 6 4.5-4.5M9.75 8.25v3M12.75 11.25v3M15.75 14.25v3"}),
45
- /* @__PURE__ */v("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.25 18.75h19.5"})]}),j.measure]}),P&&/* @__PURE__ */w(k,{children:[
46
- /* @__PURE__ */w("div",{className:"flex items-stretch h-7 rounded border border-gray-200 overflow-hidden text-2xs font-semibold",children:[
47
- /* @__PURE__ */v("button",{onClick:()=>I("auto"),className:"px-2 transition-colors "+("auto"===H?"bg-orange-500 text-white":"bg-white text-gray-600 hover:bg-gray-50"),title:j.autoHint,children:j.auto}),
48
- /* @__PURE__ */v("button",{onClick:()=>I("horizontal"),className:"px-2 transition-colors "+("horizontal"===H?"bg-orange-500 text-white":"bg-white text-gray-600 hover:bg-gray-50"),title:j.horizontalHint,children:"H"}),
49
- /* @__PURE__ */v("button",{onClick:()=>I("vertical"),className:"px-2 transition-colors "+("vertical"===H?"bg-orange-500 text-white":"bg-white text-gray-600 hover:bg-gray-50"),title:j.verticalHint,children:"V"}),
50
- /* @__PURE__ */v("button",{onClick:()=>I("point"),className:"px-2 transition-colors "+("point"===H?"bg-orange-500 text-white":"bg-white text-gray-600 hover:bg-gray-50"),title:j.pointHint,children:j.point})]}),("horizontal"===H||"vertical"===H)&&/* @__PURE__ */w("div",{className:"flex items-center gap-1",children:[
51
- /* @__PURE__ */v("input",{type:"number",inputMode:"decimal",step:"any",value:_,placeholder:"horizontal"===H?j.fixX:j.fixY,onChange:e=>{const t=e.target.value;if(Y(t),""===t.trim())V(null);else{const e=parseFloat(t);V(Number.isFinite(e)&&0!==e?e:null)}},className:"h-7 w-20 px-2 text-2xs font-mono rounded border border-gray-200 bg-white text-gray-700 focus:outline-none focus:border-orange-400",title:j.fixHint}),null!==U&&/* @__PURE__ */v("button",{onClick:()=>{V(null),Y("")},className:"text-gray-400 hover:text-gray-600 text-2xs px-1",title:j.clearFixed,children:"×"})]})]}),P&&null!==O&&/* @__PURE__ */w("div",{className:"px-2 py-1 text-2xs font-mono font-semibold text-orange-600 bg-orange-50 border border-orange-200 rounded whitespace-nowrap",title:"horizontal"===G?j.horizontalDistance("auto"===H):"vertical"===G?j.verticalDistance("auto"===H):j.straightDistance,children:[D(O),"horizontal"===G?" ↔":"vertical"===G?" ↕":""]}),
52
- /* @__PURE__ */v("button",{onClick:ce,className:pe,title:j.fitHint,children:j.fit}),
53
- /* @__PURE__ */w("button",{onClick:r??(()=>{const n=document.createElement("a");n.href=e,n.download=t,n.click()}),className:pe,children:[
54
- /* @__PURE__ */v(u,{name:"download",className:"h-3.5 w-3.5",strokeWidth:1.5}),R.download]}),s&&/* @__PURE__ */w("button",{onClick:s,className:pe,children:[
55
- /* @__PURE__ */v(u,{name:"email",className:"h-3.5 w-3.5",strokeWidth:1.5}),R.email]})]}),
56
- /* @__PURE__ */w("div",{className:"relative flex-1 bg-white min-h-0",children:[
57
- /* @__PURE__ */v("div",{ref:i,style:{width:"100%",height:"100%"}}),A&&N.length>0&&/* @__PURE__ */w("div",{className:"absolute top-2 right-2 w-64 max-h-[70%] flex flex-col bg-white/95 backdrop-blur border border-gray-200 rounded-md shadow-xl z-10 text-xs",children:[
58
- /* @__PURE__ */w("div",{className:"flex items-center justify-between px-2 min-h-8 py-1 border-b border-gray-200 bg-gray-50",children:[
59
- /* @__PURE__ */v("span",{className:"font-medium text-gray-700",children:j.layers}),
60
- /* @__PURE__ */w("div",{className:"flex items-center gap-1",children:[
61
- /* @__PURE__ */v("button",{onClick:()=>le(!0),className:"px-2 py-0.5 rounded hover:bg-gray-200 text-gray-600",children:j.allLayers}),
62
- /* @__PURE__ */v("button",{onClick:()=>le(!1),className:"px-2 py-0.5 rounded hover:bg-gray-200 text-gray-600",children:j.noLayers}),
63
- /* @__PURE__ */v("button",{onClick:()=>E(!1),className:"px-2 py-0.5 rounded hover:bg-gray-200 text-gray-600",title:R.closePanel,children:"×"})]})]}),
64
- /* @__PURE__ */v("div",{className:"overflow-y-auto py-1",children:N.map(e=>{/* @__PURE__ */return w("label",{className:"flex items-center gap-2 px-2 py-1 hover:bg-gray-100 cursor-pointer",children:[
65
- /* @__PURE__ */v("input",{type:"checkbox",checked:e.visible,onChange:()=>{return t=e.name,void C(e=>e.map(e=>{if(e.name!==t)return e;const n=!e.visible;try{a.current?.ShowLayer?.(t,n)}catch{}return{...e,visible:n}}));var t},className:"h-3.5 w-3.5"}),
66
- /* @__PURE__ */v("span",{className:"inline-block h-3 w-3 rounded-sm border border-gray-300 shrink-0",style:{background:(t=e.color,"number"!=typeof t?"#999":"#"+t.toString(16).padStart(6,"0"))}}),
67
- /* @__PURE__ */v("span",{className:"truncate text-gray-700",title:e.displayName,children:e.displayName||e.name})]},e.name);var t})})]}),S&&!o&&!d&&/* @__PURE__ */w("div",{className:"absolute bottom-3 left-1/2 -translate-x-1/2 bg-gray-900/85 text-white text-2xs px-3 min-h-8 py-1 rounded-full shadow-lg flex items-center gap-3 z-10 pointer-events-none",children:[
68
- /* @__PURE__ */w("span",{className:"flex items-center gap-1",children:[
69
- /* @__PURE__ */v("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */v("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 15l-2 5L9 9l11 4-5 2zm0 0l5 5M7.188 2.239l.777 2.897M5.136 7.965l-2.898-.777M13.95 4.05l-2.122 2.122m-5.657 5.656l-2.12 2.122"})}),j.dragToPan]}),
70
- /* @__PURE__ */v("span",{className:"text-white/40",children:"•"}),
71
- /* @__PURE__ */w("span",{className:"flex items-center gap-1",children:[
72
- /* @__PURE__ */v(u,{name:"zoom-in",className:"h-3.5 w-3.5",strokeWidth:1.8}),R.scrollToZoom]}),
73
- /* @__PURE__ */v("span",{className:"text-white/40",children:"•"}),
74
- /* @__PURE__ */v("span",{children:j.fitToReset}),
75
- /* @__PURE__ */v("span",{className:"text-white/40",children:"•"}),
76
- /* @__PURE__ */w("span",{children:[me,
77
- /* @__PURE__ */v("span",{className:"font-mono font-semibold",children:"DI"})," / ",
78
- /* @__PURE__ */v("span",{className:"font-mono font-semibold",children:"DIM"}),he]})]}),o&&/* @__PURE__ */v("div",{className:"absolute inset-0 flex items-center justify-center bg-white/80",children:/* @__PURE__ */v(m,{size:"sm",padding:"",label:j.loading})}),d&&/* @__PURE__ */v("div",{className:"absolute inset-0 flex items-center justify-center text-sm text-red-600 px-6 text-center",children:d})]}),
79
- /* @__PURE__ */w("div",{className:"shrink-0 border-t border-gray-200 bg-gray-50",children:[te&&/* @__PURE__ */v("div",{className:"px-3 pt-1 text-2xs font-mono text-gray-500 truncate",title:te,children:te}),
80
- /* @__PURE__ */w("div",{className:"flex items-center gap-2 px-3 h-7",children:[
81
- /* @__PURE__ */v("span",{className:"text-2xs font-mono font-semibold text-gray-400 select-none",children:">"}),
82
- /* @__PURE__ */v("input",{ref:se,value:Q,onChange:e=>ee(e.target.value),onKeyDown:e=>{"Enter"===e.key||" "===e.key?(e.preventDefault(),(e=>{const t=e.trim()||re.current;if(ee(""),!t)return;const n=t.toLowerCase().split(/\s+/)[0],r=()=>{re.current=t},s=(e,t)=>{W(!0),I(e),Z.current?.(),ne(t),r()};if(/^-?(\d+\.?\d*|\.\d+)$/.test(n))if(!P||"horizontal"!==H&&"vertical"!==H)ne(j.fixedNeedsAxis);else{const e=parseFloat(n);e?(Y(n),V(e),ne(j.axisLocked("horizontal"===H?"ΔX":"ΔY",D(Math.abs(e))))):(Y(""),V(null),ne(j.fixedCleared))}else switch(n){case"di":case"dist":case"mea":case"measuregeom":s("point",j.echoDist);break;case"dim":case"dli":case"dimlin":case"dimlinear":s("auto",j.echoDimLinear);break;case"h":case"hor":case"horizontal":W(!0),I("horizontal"),ne(j.echoHorizontal),r();break;case"v":case"ver":case"vertical":W(!0),I("vertical"),ne(j.echoVertical),r();break;case"au":case"auto":W(!0),I("auto"),ne(j.echoAuto),r();break;case"measure":W(!P),ne(P?j.measureOff:j.measureOn),r();break;case"u":case"undo":q.current?.(),ne(j.pickRemoved),r();break;case"z":case"ze":case"zoom":case"fit":case"zoomextents":ce(),ne(j.zoomExtents),r();break;case"la":case"layer":case"layers":E(e=>!e),ne(j.layersToggled),r();break;case"off":case"clear":V(null),Y(""),Z.current?.(),ne(j.measurementCleared),r();break;case"?":case"help":ne(j.commandHelp);break;default:{const e=M[n];ne(e?j.readOnly(e):j.unknownCommand(n.toUpperCase()))}}})(Q)):"Escape"===e.key&&(Q?(e.stopPropagation(),ee(""),ne(j.cancelled)):e.target.blur())},placeholder:j.commandPlaceholder,spellCheck:!1,autoComplete:"off",className:"flex-1 min-w-0 bg-transparent text-2xs font-mono text-gray-700 focus:outline-none placeholder:text-gray-300"})]})]})]})}var z="https://cdn.jsdelivr.net/npm/online-3d-viewer@0.18.0/libs/";function T(e,t,n=0){return{id:e.GetId?.()??0,name:e.GetName?.()||(0===n?t.root:t.node),isMeshNode:!!e.IsMeshNode?.(),meshIndices:e.GetMeshIndices?.()??[],children:(e.GetChildNodes?.()??[]).map(e=>T(e,t,n+1))}}function j(e,t){t.add(e.id);for(const n of e.children)j(n,t)}function R(e,t){const n=/^#?([0-9a-f]{6})$/i.exec(t),r=n?parseInt(n[1],16):0;return new e.RGBColor(r>>16&255,r>>8&255,255&r)}function D(e){return e>=1e3?`${(e/1e3).toFixed(3)} m`:`${e.toFixed(2)} mm`}function F({url:e,filename:t,onDownload:r,onEmail:s}){const i=f(null),a=f(null),o=f(null),[l,c]=g(!0),[d,p]=g(null),[h,x]=g(!0),k=y(),C=k.model,A=k.preview,E=f(C);E.current=C;const[L,M]=g(null),[S,F]=g({}),[P,W]=g(/* @__PURE__ */new Set),[H,I]=g("#f5f6f8"),[O,B]=g(!0),[G,X]=g("#000000"),[U,V]=g(1),[_,Y]=g(!1),[$,K]=g(!1),[J,Z]=g(!1),[q,Q]=g(!1),[ee,te]=g("x"),[ne,re]=g(!1),[se,ie]=g(.5),[ae,oe]=g(0),[le,ce]=g(!1),[de,ue]=g("point"),[pe,me]=g(null),he=f(null),ye=f(null);b(()=>{let n=!1,r=null,s=null;return c(!0),p(null),M(null),F({}),W(/* @__PURE__ */new Set),(async()=>{let l;try{l=await(import("online-3d-viewer"))}catch{return void(n||(p(E.current.notInstalled),c(!1)))}if(o.current=l,!n&&i.current&&(await new Promise(e=>{const t=()=>{const n=i.current?.getBoundingClientRect();n&&n.width>4&&n.height>4?e():requestAnimationFrame(t)};t()}),!n&&i.current))try{const o="undefined"!=typeof window&&window.__REACT_OS_SHELL_O3DV_LIBS__||z;l.SetExternalLibLocation?.(o),function(){if(N)return;if("undefined"==typeof HTMLCanvasElement)return;N=!0;const e=HTMLCanvasElement.prototype.getContext;HTMLCanvasElement.prototype.getContext=function(t,n){return"webgl"!==t&&"webgl2"!==t&&"experimental-webgl"!==t||(n={...n||{},stencil:!0}),e.call(this,t,n)},console.info("[Preview] section: canvas getContext patched (force stencil=true)")}(),r=new l.EmbeddedViewer(i.current,{backgroundColor:new l.RGBAColor(245,246,248,255),defaultColor:new l.RGBColor(180,188,200),edgeSettings:new l.EdgeSettings(!0,new l.RGBColor(0,0,0),1),onModelLoaded:()=>{if(!n){try{const e=r.GetModel?.(),t=e?.GetRootNode?.();if(t){const e=T(t,{root:E.current.rootNode,node:E.current.node});M(e);const n={[e.id]:!0};for(const t of e.children)n[t.id]=!0;F(n)}}catch(e){console.warn("[Preview] mesh tree extraction failed",e)}c(!1)}},onModelLoadFailed:()=>{n||(p(E.current.loadFailed),c(!1))}}),a.current=r;const d=new l.InputFile(t,l.FileSource.Url,e);r.LoadModelFromInputFiles([d]),i.current&&"undefined"!=typeof ResizeObserver&&(s=new ResizeObserver(()=>{try{const e=a.current;e?.Resize?e.Resize():e?.viewer?.Resize&&e.viewer.Resize(),e?.viewer?.Render?.()}catch{}}),s.observe(i.current))}catch(e){n||(p(e?.message||E.current.loadFailed),c(!1))}})(),()=>{n=!0;try{s?.disconnect()}catch{}try{r?.Destroy?.()}catch{}a.current=null}},[e,t]),b(()=>{const e=a.current;if(e?.viewer)try{const t=e=>{if(e.userData?.__sectionHelper)return;const t=e.userData?.originalMeshInstance??e.userData,n=t?.id?.nodeId??t?.nodeId;"number"==typeof n&&(e.visible=!P.has(n))};e.viewer.mainModel?.EnumerateMeshesAndLines?.(t),e.viewer.mainModel?.EnumerateEdges?.(t),e.viewer.Render?.()}catch(e){console.warn("[Preview] visibility update failed",e)}},[P,L]),b(()=>{const e=o.current,t=a.current;if(e&&t?.viewer)try{t.viewer.SetEdgeSettings(new e.EdgeSettings(O,R(e,G),U));const n=ye.current;if(n){const e=[];t.viewer.mainModel?.EnumerateEdges?.(t=>{t.userData?.__sectionHelper&&e.push(t)});for(const t of e)t.parent?.remove(t),t.geometry?.dispose?.(),t.material?.dispose?.();const r=n.plane,s=e=>{e&&!n.materialState.has(e)&&(n.materialState.set(e,{clippingPlanes:e.clippingPlanes,clipShadows:e.clipShadows}),e.clippingPlanes=[r],e.clipShadows=!0,e.needsUpdate=!0)};t.viewer.mainModel?.EnumerateEdges?.(e=>{const t=e.material;if(Array.isArray(t))for(const e of t)s(e);else s(t)})}t.viewer.Render?.()}catch{}},[O,G,U]),b(()=>{const e=o.current,t=a.current;if(e&&t?.viewer)try{const n=R(e,H);t.viewer.SetBackgroundColor(new e.RGBAColor(n.r,n.g,n.b,255)),t.viewer.Render?.()}catch{}},[H]),b(()=>{const e=a.current;if(!e?.viewer||l)return;const t=e.viewer.renderer,n=e.viewer.scene;if(!t||!n)return;if(ye.current){const e=ye.current;for(const[t,n]of e.materialState.entries())t.clippingPlanes=n.clippingPlanes,t.clipShadows=n.clipShadows,t.needsUpdate=!0;for(const t of e.helpers)t.parent?.remove(t),t.material?.dispose?.();e.capMesh&&(n.remove(e.capMesh),e.capMesh.geometry?.dispose?.(),e.capMesh.material?.dispose?.()),ye.current=null}if(!q)return t.localClippingEnabled=!1,void e.viewer.Render?.();const r=e.viewer.GetBoundingBox?.(()=>!0);if(!r)return;const s=[];if(e.viewer.mainModel?.EnumerateMeshes?.(e=>{e.userData?.__sectionHelper||s.push(e)}),!s.length)return t.localClippingEnabled=!1,void e.viewer.Render?.();const i=s[0],o=i.constructor,c=i.material?.constructor,d=i.geometry?.constructor,u=i.geometry?.attributes?.position?.constructor;o&&c&&d&&u||console.warn("[Preview] section: missing THREE constructors, falling back to no cap");const p=7681;let m=!0;try{const e=t.getContext?.(),n=e?.getContextAttributes?.();m=!1!==n?.stencil,t.autoClearStencil=!0,console.info("[Preview] section: stencil buffer =",m,"targets =",s.length)}catch{}t.localClippingEnabled=!0;const h={normal:{x:0,y:0,z:-1},constant:0,clone:function e(){const t={normal:{x:this.normal.x,y:this.normal.y,z:this.normal.z},constant:this.constant};return t.clone=e,t}},y=[],x=/* @__PURE__ */new Map,f=e=>{e&&!x.has(e)&&(x.set(e,{clippingPlanes:e.clippingPlanes,clipShadows:e.clipShadows}),e.clippingPlanes=[h],e.clipShadows=!0,e.needsUpdate=!0)};for(const e of s){const t=e.material;if(Array.isArray(t))for(const e of t)f(e);else f(t);const n=Array.isArray(t)?t[0]:t;if(o&&m&&n?.clone){const t=(t,r)=>{const s=n.clone();s.depthWrite=!1,s.depthTest=!1,s.colorWrite=!1,s.stencilWrite=!0,s.stencilFunc=519,s.stencilFail=r,s.stencilZFail=r,s.stencilZPass=r,s.side=t,s.transparent=!1,s.clippingPlanes=[h],s.clipShadows=!0,s.needsUpdate=!0;const i=new o(e.geometry,s);i.matrixAutoUpdate=!1,i.renderOrder=1,i.userData.__sectionHelper=!0,e.add(i),y.push(i)};t(1,7682),t(0,7683)}}e.viewer.mainModel?.EnumerateEdges?.(e=>{const t=e.material;if(Array.isArray(t))for(const e of t)f(e);else f(t)});let g=null;const b=s[0]?.material&&(Array.isArray(s[0].material)?s[0].material[0]:s[0].material);if(m&&o&&d&&u&&b?.clone){const e=r.max.x-r.min.x,t=r.max.y-r.min.y,s=r.max.z-r.min.z,i=2*Math.max(e,t,s,1)/2,a=new d,l=new Float32Array([-i,-i,0,i,-i,0,i,i,0,-i,i,0]),c=new Float32Array([0,0,1,0,0,1,0,0,1,0,0,1]);a.setAttribute("position",new u(l,3)),a.setAttribute("normal",new u(c,3)),a.setIndex([0,1,2,0,2,3]);const m=b.clone(),h=b.color?.getHex?.()??11844808;m.emissive?.setHex?.(h),"emissiveIntensity"in m&&(m.emissiveIntensity=.25),m.side=2,m.transparent=!1,m.opacity=1,m.stencilWrite=!0,m.stencilRef=0,m.stencilFunc=517,m.stencilFail=p,m.stencilZFail=p,m.stencilZPass=p,m.clippingPlanes=[],m.polygonOffset=!0,m.polygonOffsetFactor=-1,m.polygonOffsetUnits=-1,m.needsUpdate=!0,g=new o(a,m),g.renderOrder=2,g.userData.__sectionHelper=!0,n.add(g)}ye.current={plane:h,capMesh:g,helpers:y,materialState:x,bbox:r},console.info("[Preview] section: helpers =",y.length,"cap =",!!g),e.viewer.Render?.()},[q,l,L]),b(()=>{const e=a.current,t=ye.current;if(e?.viewer&&t&&q)try{const n=t.bbox,r="x"===ee?0:"y"===ee?1:2,s=[n.min.x,n.min.y,n.min.z][r],i=s+([n.max.x,n.max.y,n.max.z][r]-s)*se,a=ae*Math.PI/180,o=Math.cos(a),l=Math.sin(a),c=ne?-1:1;let d=0,u=0,p=0;"x"===ee?(d=c*o,p=c*l):"y"===ee?(u=c*o,d=c*l):(p=c*o,u=c*l);const m={x:(n.min.x+n.max.x)/2,y:(n.min.y+n.max.y)/2,z:(n.min.z+n.max.z)/2},h="x"===ee?i:m.x,y="y"===ee?i:m.y,x="z"===ee?i:m.z;if(t.plane.normal.x=d,t.plane.normal.y=u,t.plane.normal.z=p,t.plane.constant=-(d*h+u*y+p*x),t.capMesh){const e=m.x,n=m.y,r=m.z,s=d*e+u*n+p*r+t.plane.constant,i=e-d*s,a=n-u*s,o=r-p*s;t.capMesh.position.set(i,a,o),t.capMesh.lookAt?.(i+d,a+u,o+p)}e.viewer.Render?.()}catch(e){console.warn("[Preview] section update failed",e)}},[q,ee,ne,se,ae]),b(()=>{const e=a.current;if(!e?.viewer||l||!i.current)return;const t=e.viewer.renderer,n=e.viewer.scene,r=t?.domElement;if(!t||!n||!r)return;let s=null;if(e.viewer.mainModel?.EnumerateMeshes?.(e=>{s||e.userData?.__sectionHelper||e.userData?.__measureHelper||(s=e)}),!s)return;const c=s.position.constructor,d=s.constructor,u=(Array.isArray(s.material)?s.material[0]:s.material)?.constructor,p=s.geometry.constructor,m=s.geometry.attributes?.position?.constructor;if(!(c&&d&&u&&p&&m))return;let h=null,y=null;n.traverse(e=>{if(h&&y)return;if(!e?.isLineSegments)return;h=e.constructor;const t=Array.isArray(e.material)?e.material[0]:e.material;t?.constructor&&(y=t.constructor)});const x=()=>{const t=he.current;if(t){null!==t.rafId&&cancelAnimationFrame(t.rafId);for(const e of t.markers)n.remove(e),e.geometry?.dispose?.(),e.material?.dispose?.();t.line&&(n.remove(t.line),t.line.geometry?.dispose?.(),t.line.material?.dispose?.()),t.label&&t.label.parentElement&&t.label.parentElement.removeChild(t.label),he.current=null,e.viewer.Render?.()}};if(!le)return x(),void me(null);he.current={points:[],normals:[],markers:[],line:null,label:null,rafId:null};const f=o.current,g=f?.IntersectionMode?.MeshOnly??1,b=e.viewer.GetBoundingBox?.(()=>!0),w=b?Math.sqrt((b.max.x-b.min.x)**2+(b.max.y-b.min.y)**2+(b.max.z-b.min.z)**2):100,v=Math.max(.005*w,.2),k=e=>{const t=[],r=[];for(let e=0;e<=12;e++){const n=e/12*Math.PI;for(let e=0;e<=16;e++){const r=e/16*Math.PI*2;t.push(v*Math.sin(n)*Math.cos(r),v*Math.cos(n),v*Math.sin(n)*Math.sin(r))}}for(let e=0;e<12;e++)for(let t=0;t<16;t++){const n=17*e+t,s=n+16+1;r.push(n,s,n+1,s,s+1,n+1)}const s=new p;s.setAttribute("position",new m(new Float32Array(t),3)),s.setIndex(r),s.computeVertexNormals?.();const i=new u;i.color?.setHex?.(16746496),i.depthTest=!1,i.depthWrite=!1,i.transparent=!0,i.opacity=.95;const a=new d(s,i);return a.position.copy(e),a.renderOrder=9999,a.userData.__measureHelper=!0,n.add(a),a},N=()=>{const t=he.current;t&&((()=>{const t=he.current;if(!t||t.points.length<2||!t.label)return;const n=e.viewer.camera;if(!n)return;const s=t.points[0],i=t.points[1],a=new c((s.x+i.x)/2,(s.y+i.y)/2,(s.z+i.z)/2).clone();a.project?.(n);const o=r.getBoundingClientRect(),l=(a.x+1)/2*o.width,d=(1-a.y)/2*o.height;t.label.style.left=`${l}px`,t.label.style.top=`${d}px`;const u=l<0||d<0||l>o.width||d>o.height;t.label.style.opacity=a.z>1||u?"0":"1"})(),t.rafId=requestAnimationFrame(N))};he.current.rafId=requestAnimationFrame(N);let C=0,A=0,E=0,L=!1,M=!1;const S=t=>{if(!e.viewer.camera)return;const s=r.getBoundingClientRect(),a={x:t.clientX-s.left,y:t.clientY-s.top},o=e.viewer.GetMeshIntersectionUnderMouse?.(g,a);if(!o)return;const l=he.current,x=new c(o.point.x,o.point.y,o.point.z),f=(e=>{const t=e?.face?.normal,n=e?.object;if(!t||!n)return null;try{const e=new c(t.x,t.y,t.z);return e.transformDirection?.(n.matrixWorld),{x:e.x,y:e.y,z:e.z}}catch{return{x:t.x,y:t.y,z:t.z}}})(o);if(2===l.points.length){for(const e of l.markers)n.remove(e),e.geometry?.dispose?.(),e.material?.dispose?.();l.line&&(n.remove(l.line),l.line.geometry?.dispose?.(),l.line.material?.dispose?.()),l.label&&(l.label.style.opacity="0"),l.points=[],l.markers=[],l.line=null,l.normals=[],me(null)}if(l.points.push(x),l.normals.push(f),"perp"===de){const e=((e,t)=>{const r=e?.geometry,s=r?.attributes?.position;if(!r||!s||!t?.face?.normal)return null;const i=s.array,a=r.index?r.index.array:null,o=new c(t.point.x,t.point.y,t.point.z);e.worldToLocal?.(o);const l=t.face.normal,h=-(l.x*o.x+l.y*o.y+l.z*o.z);r.computeBoundingBox?.();const y=r.boundingBox,x=y?Math.sqrt((y.max.x-y.min.x)**2+(y.max.y-y.min.y)**2+(y.max.z-y.min.z)**2):100,f=Math.max(.001*x,.005),g=a?a.length/3:s.count/3,b=[],w=new c;for(let t=0;t<g;t++){const n=a?a[3*t]:3*t,r=a?a[3*t+1]:3*t+1,s=a?a[3*t+2]:3*t+2,o=i[3*n],c=i[3*n+1],d=i[3*n+2],u=i[3*r],p=i[3*r+1],m=i[3*r+2],y=i[3*s],x=i[3*s+1],g=i[3*s+2],v=u-o,k=p-c,N=m-d,C=y-o,A=x-c,E=g-d;let L=k*E-N*A,M=N*C-v*E,S=v*A-k*C;const z=Math.sqrt(L*L+M*M+S*S);if(0===z)continue;if(L/=z,M/=z,S/=z,L*l.x+M*l.y+S*l.z<.9995)continue;const T=(o+u+y)/3,j=(c+p+x)/3,R=(d+m+g)/3;if(!(Math.abs(l.x*T+l.y*j+l.z*R+h)>f))for(const[t,n,r]of[[o,c,d],[u,p,m],[y,x,g]])w.set?.(t,n,r),e.localToWorld?.(w),b.push(w.x,w.y,w.z)}if(0===b.length)return null;const v=new p;v.setAttribute("position",new m(new Float32Array(b),3)),v.computeVertexNormals?.();const k=new u;k.color?.setHex?.(16746496),k.transparent=!0,k.opacity=.45,k.depthWrite=!1,k.polygonOffset=!0,k.polygonOffsetFactor=-2,k.polygonOffsetUnits=-2;const N=new d(v,k);return N.renderOrder=9998,N.userData.__measureHelper=!0,n.add(N),N})(o.object,o);l.markers.push(e??k(x))}else l.markers.push(k(x));if(2===l.points.length){const e=l.points[0];let t,r=l.points[1],s="";if("perp"===de){const n=l.normals[0]??l.normals[1];if(n){const i=Math.sqrt(n.x*n.x+n.y*n.y+n.z*n.z)||1,a=n.x/i,o=n.y/i,d=n.z/i,u=(r.x-e.x)*a+(r.y-e.y)*o+(r.z-e.z)*d,p=new c(e.x+a*u,e.y+o*u,e.z+d*u);l.points[1]=p,r=p,t=Math.abs(u),s=" ⊥"}else{const n=r.x-e.x,s=r.y-e.y,i=r.z-e.z;t=Math.sqrt(n*n+s*s+i*i)}}else{const n=r.x-e.x,s=r.y-e.y,i=r.z-e.z;t=Math.sqrt(n*n+s*s+i*i)}l.line=((e,t)=>{const r=new p;r.setAttribute("position",new m(new Float32Array([e.x,e.y,e.z,t.x,t.y,t.z]),3));const s=new(h??d)(r,new(y??u)({color:16746496,depthTest:!1,depthWrite:!1,transparent:!0,opacity:.95}));return s.renderOrder=9998,s.userData.__measureHelper=!0,n.add(s),s})(e,r),me(t);const a=(()=>{const e=he.current;if(e.label)return e.label;const t=document.createElement("div");return t.style.position="absolute",t.style.left="-9999px",t.style.top="-9999px",t.style.transform="translate(-50%, -50%)",t.style.padding="2px 6px",t.style.fontSize="11px",t.style.fontWeight="600",t.style.fontFamily="system-ui, -apple-system, sans-serif",t.style.background="rgba(255, 136, 0, 0.95)",t.style.color="#fff",t.style.borderRadius="4px",t.style.pointerEvents="none",t.style.whiteSpace="nowrap",t.style.boxShadow="0 1px 4px rgba(0,0,0,0.25)",t.style.zIndex="5",i.current.appendChild(t),e.label=t,t})();a.textContent=`${D(t)}${s}`}e.viewer.Render?.()},z=e=>{0===e.button&&(C=e.clientX,A=e.clientY,E=performance.now(),L=!1,M=!0)},T=e=>{if(!M)return;const t=e.clientX-C,n=e.clientY-A;t*t+n*n>16&&(L=!0)},j=e=>{if(0!==e.button||!M)return;const t=performance.now()-E;M=!1,!L&&t<350&&S(e)},R=e=>{"Escape"===e.key&&ce(!1)};return r.style.cursor="crosshair",r.addEventListener("pointerdown",z),r.addEventListener("pointermove",T),r.addEventListener("pointerup",j),r.addEventListener("pointercancel",j),window.addEventListener("keydown",R),()=>{r.style.cursor="",r.removeEventListener("pointerdown",z),r.removeEventListener("pointermove",T),r.removeEventListener("pointerup",j),r.removeEventListener("pointercancel",j),window.removeEventListener("keydown",R),x(),me(null)}},[le,de,l,L]),b(()=>{if(!h||l)return;const e=setTimeout(()=>x(!1),5e3);return()=>clearTimeout(e)},[h,l]);const xe=e=>{const t=/* @__PURE__ */new Set;j(e,t),W(e=>{const n=new Set(e),r=[...t].some(e=>!n.has(e));for(const e of t)r?n.add(e):n.delete(e);return n})},fe=()=>{try{const e=a.current,t=e?.viewer?.GetBoundingSphere?.(()=>!0);t&&e.viewer.FitSphereToWindow(t,!0),e?.viewer?.Render?.()}catch{}};b(()=>{const e=o.current,t=a.current;if(e&&t?.viewer&&!l)try{t.viewer.SetProjectionMode(J?e.ProjectionMode.Perspective:e.ProjectionMode.Orthographic)}catch{}},[J,l]);const ge=e=>{const t=o.current,n=a.current;if(t&&n?.viewer)try{const r=n.viewer.GetBoundingSphere?.(()=>!0);if(!r)return;const s=r.center,i=3*(r.radius||1),a=s.x??0,o=s.y??0,l=s.z??0;let c,d;switch(e){case"top":c=new t.Coord3D(a,o,l+i),d=new t.Coord3D(0,1,0);break;case"front":c=new t.Coord3D(a,o-i,l),d=new t.Coord3D(0,0,1);break;case"side":c=new t.Coord3D(a+i,o,l),d=new t.Coord3D(0,0,1);break;default:{const e=i/Math.sqrt(3);c=new t.Coord3D(a+e,o-e,l+e),d=new t.Coord3D(0,0,1);break}}const u=new t.Coord3D(a,o,l),p=new t.Camera(c,u,d,45);n.viewer.SetCamera(p),n.viewer.AdjustClippingPlanesToSphere?.(r),n.viewer.Render?.()}catch{}},be=(t.split(".").pop()||"").toUpperCase(),we=(e,t=0)=>{const n=e.children.length>0,r=!1!==S[e.id],s=!P.has(e.id);/* @__PURE__ */
83
- return w("div",{children:[
84
- /* @__PURE__ */w("div",{className:"group flex items-center gap-1 px-2 py-1 hover:bg-gray-100 cursor-default text-xs text-gray-700",style:{paddingLeft:12*t+6+"px"},children:[n?/* @__PURE__ */v("button",{onClick:()=>{return t=e.id,void F(e=>({...e,[t]:!e[t]}));var t},className:"h-4 w-4 shrink-0 flex items-center justify-center text-gray-500 hover:text-gray-900",title:r?C.collapse:C.expand,children:/* @__PURE__ */v(u,r?{name:"chevron-down",className:"h-3 w-3",strokeWidth:2}:{name:"chevron-right",className:"h-3 w-3",strokeWidth:2})}):/* @__PURE__ */v("span",{className:"h-4 w-4 shrink-0 flex items-center justify-center",children:/* @__PURE__ */v("span",{className:"h-1 w-1 rounded-full bg-gray-400"})}),
85
- /* @__PURE__ */v("span",{className:"flex-1 truncate "+(s?"":"opacity-40"),title:e.name,children:e.name}),
86
- /* @__PURE__ */v("button",{onClick:()=>{fe()},className:"h-4 w-4 shrink-0 text-gray-400 hover:text-gray-900 opacity-0 group-hover:opacity-100 transition-opacity",title:C.fitToView,children:/* @__PURE__ */v(u,{name:"expand",className:"h-3.5 w-3.5",strokeWidth:1.5})}),
87
- /* @__PURE__ */v("button",{onClick:()=>xe(e),className:"h-4 w-4 shrink-0 text-gray-500 hover:text-gray-900",title:s?C.hide:C.show,children:/* @__PURE__ */v(u,s?{name:"eye",className:"h-3.5 w-3.5",strokeWidth:1.5}:{name:"eye-off",className:"h-3.5 w-3.5",strokeWidth:1.5})})]}),r&&n&&/* @__PURE__ */v("div",{children:e.children.map(e=>we(e,t+1))})]},e.id)},ve="h-8 w-8 shrink-0 flex items-center justify-center rounded text-gray-600 hover:bg-gray-200 hover:text-gray-900 transition-colors",ke="h-8 w-8 shrink-0 flex items-center justify-center rounded bg-gray-200 text-gray-900",Ne="h-5 w-px bg-gray-300 mx-1";/* @__PURE__ */
88
- return w("div",{className:"flex flex-col h-full bg-white",children:[
89
- /* @__PURE__ */w(n,{children:[
90
- /* @__PURE__ */v("button",{onClick:fe,className:ve,title:C.fitToView,children:/* @__PURE__ */v(u,{name:"expand",className:"h-4 w-4",strokeWidth:1.5})}),
91
- /* @__PURE__ */v("div",{className:Ne}),
92
- /* @__PURE__ */v("button",{onClick:()=>ge("iso"),className:ve,title:C.isometricView,children:/* @__PURE__ */v("span",{className:"text-2xs font-semibold",children:C.isometric})}),
93
- /* @__PURE__ */v("button",{onClick:()=>ge("top"),className:ve,title:C.topView,children:/* @__PURE__ */v("span",{className:"text-2xs font-semibold",children:C.top})}),
94
- /* @__PURE__ */v("button",{onClick:()=>ge("front"),className:ve,title:C.frontView,children:/* @__PURE__ */v("span",{className:"text-2xs font-semibold",children:C.front})}),
95
- /* @__PURE__ */v("button",{onClick:()=>ge("side"),className:ve,title:C.sideView,children:/* @__PURE__ */v("span",{className:"text-2xs font-semibold",children:C.side})}),
96
- /* @__PURE__ */v("button",{onClick:()=>Z(e=>!e),className:J?"h-8 shrink-0 flex items-center justify-center px-2 rounded bg-gray-200 text-gray-900":"h-8 shrink-0 flex items-center justify-center px-2 rounded text-gray-600 hover:bg-gray-200 hover:text-gray-900 transition-colors",title:J?C.toOrthographic:C.toPerspective,children:/* @__PURE__ */v("span",{className:"text-2xs font-semibold whitespace-nowrap",children:J?C.perspective:C.orthographic})}),
97
- /* @__PURE__ */v("div",{className:Ne}),
98
- /* @__PURE__ */v("button",{onClick:()=>{try{const e=a.current,n=e?.viewer?.GetCanvasSize?.()??{width:1280,height:720},r=e?.viewer?.GetImageAsDataUrl?.(n.width,n.height,!1);if(!r)return;const s=document.createElement("a");s.href=r,s.download=`${t.replace(/\.[^.]+$/,"")}-snapshot.png`,s.click()}catch{}},className:ve,title:C.snapshot,children:/* @__PURE__ */v(u,{name:"camera",className:"h-4 w-4",strokeWidth:1.5})}),
99
- /* @__PURE__ */v("button",{onClick:()=>x(e=>!e),className:ve,title:A.howToNavigate,children:/* @__PURE__ */v(u,{name:"help",className:"h-4 w-4",strokeWidth:1.5})}),
100
- /* @__PURE__ */v("button",{onClick:()=>ce(e=>!e),className:le?ke:ve,title:le?A.stopMeasuring:C.measureHint,children:/* @__PURE__ */w("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:[
101
- /* @__PURE__ */v("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 14.25l6-6 6 6 4.5-4.5M9.75 8.25v3M12.75 11.25v3M15.75 14.25v3"}),
102
- /* @__PURE__ */v("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.25 18.75h19.5"})]})}),le&&/* @__PURE__ */w("div",{className:"flex items-stretch h-8 rounded border border-gray-200 overflow-hidden",children:[
103
- /* @__PURE__ */v("button",{onClick:()=>ue("point"),className:"px-2 text-2xs font-semibold transition-colors "+("point"===de?"bg-orange-500 text-white":"bg-white text-gray-600 hover:bg-gray-50"),title:C.pointHint,children:C.point}),
104
- /* @__PURE__ */v("button",{onClick:()=>ue("perp"),className:"px-2 text-xs font-semibold transition-colors "+("perp"===de?"bg-orange-500 text-white":"bg-white text-gray-600 hover:bg-gray-50"),title:C.perpendicularHint,children:"⊥"})]}),le&&null!==pe&&/* @__PURE__ */w("div",{className:"px-2 py-1 text-2xs font-mono font-semibold text-orange-600 bg-orange-50 border border-orange-200 rounded whitespace-nowrap",title:"perp"===de?C.perpendicularDistance:C.straightDistance,children:[D(pe),"perp"===de?" ⊥":""]}),
105
- /* @__PURE__ */v("div",{className:Ne}),
106
- /* @__PURE__ */v("button",{onClick:()=>Y(e=>!e),className:_?ke:ve,title:C.meshesHint,children:/* @__PURE__ */v(u,{name:"menu",className:"h-4 w-4",strokeWidth:1.5})}),
107
- /* @__PURE__ */v("button",{onClick:()=>K(e=>!e),className:$?ke:ve,title:C.displayHint,children:/* @__PURE__ */v(u,{name:"settings",className:"h-4 w-4",strokeWidth:1.5})}),
108
- /* @__PURE__ */v("button",{onClick:r??(()=>{const n=document.createElement("a");n.href=e,n.download=t,n.click()}),className:ve,title:C.downloadOriginal,children:/* @__PURE__ */v(u,{name:"download",className:"h-4 w-4",strokeWidth:1.5})}),s&&/* @__PURE__ */v("button",{onClick:s,className:ve,title:A.email,children:/* @__PURE__ */v(u,{name:"email",className:"h-4 w-4",strokeWidth:1.5})})]}),
109
- /* @__PURE__ */v("div",{className:"flex-1 flex min-h-0",children:/* @__PURE__ */w("div",{className:"relative flex-1 min-w-0",style:{background:H},children:[
110
- /* @__PURE__ */v("div",{ref:i,style:{width:"100%",height:"100%"}}),_&&/* @__PURE__ */w("div",{className:"absolute top-2 left-2 w-64 max-h-[80%] flex flex-col bg-white/95 backdrop-blur border border-gray-200 rounded-md shadow-xl z-10 text-xs",children:[
111
- /* @__PURE__ */w("div",{className:"flex items-center justify-between px-2 min-h-8 py-1 border-b border-gray-200 bg-gray-50",children:[
112
- /* @__PURE__ */v("span",{className:"font-medium text-gray-700",children:C.meshes}),
113
- /* @__PURE__ */v("button",{onClick:()=>Y(!1),className:"px-2 py-0.5 rounded hover:bg-gray-200 text-gray-600",title:A.closePanel,children:"×"})]}),
114
- /* @__PURE__ */v("div",{className:"flex-1 overflow-y-auto py-1",children:L?we(L):l?/* @__PURE__ */v(m,{size:"sm",padding:"py-3",label:C.readingModel}):/* @__PURE__ */v("div",{className:"px-3 py-3 text-2xs text-gray-500 italic",children:C.noStructure})}),L&&/* @__PURE__ */v("div",{className:"px-3 py-2 text-2xs text-gray-500 border-t border-gray-200",children:0===P.size?C.allVisible:C.hiddenCount(P.size)})]}),h&&!l&&!d&&/* @__PURE__ */w("div",{className:"absolute bottom-3 left-1/2 -translate-x-1/2 bg-gray-900/85 text-white text-2xs px-3 min-h-8 py-1 rounded-full shadow-lg flex items-center gap-3 z-10 pointer-events-none",children:[
115
- /* @__PURE__ */v("span",{children:C.dragToRotate}),
116
- /* @__PURE__ */v("span",{className:"text-white/40",children:"•"}),
117
- /* @__PURE__ */v("span",{children:C.rightDragToPan}),
118
- /* @__PURE__ */v("span",{className:"text-white/40",children:"•"}),
119
- /* @__PURE__ */v("span",{children:A.scrollToZoom})]}),l&&/* @__PURE__ */w("div",{className:"absolute inset-0 flex flex-col items-center justify-center bg-white/85 gap-2",children:[
120
- /* @__PURE__ */v(m,{size:"sm",padding:"",label:C.loading}),"STP"===be||"STEP"===be?/* @__PURE__ */v("span",{className:"text-2xs text-gray-400",children:C.stepNote}):null]}),d&&/* @__PURE__ */v("div",{className:"absolute inset-0 flex items-center justify-center text-sm text-red-600 px-6 text-center bg-white/85",children:d}),$&&/* @__PURE__ */w("div",{className:"absolute top-2 right-2 w-64 max-h-[80%] flex flex-col bg-white/95 backdrop-blur border border-gray-200 rounded-md shadow-xl z-10 text-xs",children:[
121
- /* @__PURE__ */w("div",{className:"flex items-center justify-between px-2 min-h-8 py-1 border-b border-gray-200 bg-gray-50",children:[
122
- /* @__PURE__ */v("span",{className:"font-medium text-gray-700",children:C.display}),
123
- /* @__PURE__ */v("button",{onClick:()=>K(!1),className:"px-2 py-0.5 rounded hover:bg-gray-200 text-gray-600",title:A.closePanel,children:"×"})]}),
124
- /* @__PURE__ */w("div",{className:"flex-1 overflow-y-auto px-3 py-3 space-y-3 text-xs text-gray-700",children:[
125
- /* @__PURE__ */w("label",{className:"flex items-center justify-between gap-2",children:[
126
- /* @__PURE__ */v("span",{children:C.backgroundColor}),
127
- /* @__PURE__ */v("input",{type:"color",value:H,onChange:e=>I(e.target.value),className:"h-6 w-10 rounded border border-gray-300 bg-white"})]}),
128
- /* @__PURE__ */w("label",{className:"flex items-center justify-between gap-2",children:[
129
- /* @__PURE__ */v("span",{children:C.showEdges}),
130
- /* @__PURE__ */v("button",{onClick:()=>B(e=>!e),role:"switch","aria-checked":O,className:"relative inline-flex h-5 w-9 shrink-0 items-center rounded-full transition-colors "+(O?"bg-blue-500":"bg-gray-300"),children:/* @__PURE__ */v("span",{className:"inline-block h-4 w-4 rounded-full bg-white shadow-sm transition-transform "+(O?"translate-x-[18px]":"translate-x-0.5")})})]}),
131
- /* @__PURE__ */w("label",{className:"flex items-center justify-between gap-2",children:[
132
- /* @__PURE__ */v("span",{className:O?"":"opacity-40",children:C.edgeColor}),
133
- /* @__PURE__ */v("input",{type:"color",value:G,onChange:e=>X(e.target.value),disabled:!O,className:"h-6 w-10 rounded border border-gray-300 bg-white disabled:opacity-40"})]}),
134
- /* @__PURE__ */w("div",{className:O?"":"opacity-40 pointer-events-none",children:[
135
- /* @__PURE__ */w("div",{className:"flex items-center justify-between gap-2 mb-1",children:[
136
- /* @__PURE__ */v("span",{children:C.edgeThreshold}),
137
- /* @__PURE__ */w("span",{className:"text-gray-500 tabular-nums",children:[U,"°"]})]}),
138
- /* @__PURE__ */v("input",{type:"range",min:0,max:45,step:1,value:U,onChange:e=>V(Number(e.target.value)),className:"w-full accent-blue-500"})]}),
139
- /* @__PURE__ */w("div",{className:"border-t border-gray-200 -mx-3 px-3 pt-3 mt-1",children:[
140
- /* @__PURE__ */w("label",{className:"flex items-center justify-between gap-2",children:[
141
- /* @__PURE__ */v("span",{className:"font-medium",children:C.sectionView}),
142
- /* @__PURE__ */v("button",{onClick:()=>Q(e=>!e),role:"switch","aria-checked":q,className:"relative inline-flex h-5 w-9 shrink-0 items-center rounded-full transition-colors "+(q?"bg-blue-500":"bg-gray-300"),children:/* @__PURE__ */v("span",{className:"inline-block h-4 w-4 rounded-full bg-white shadow-sm transition-transform "+(q?"translate-x-[18px]":"translate-x-0.5")})})]}),
143
- /* @__PURE__ */w("div",{className:q?"mt-2 space-y-2":"mt-2 space-y-2 opacity-40 pointer-events-none",children:[
144
- /* @__PURE__ */w("div",{children:[
145
- /* @__PURE__ */w("div",{className:"flex items-center justify-between gap-2 mb-1",children:[
146
- /* @__PURE__ */v("span",{children:C.angle}),
147
- /* @__PURE__ */w("span",{className:"text-gray-500 tabular-nums",children:[ae,"°"]})]}),
148
- /* @__PURE__ */v("input",{type:"range",min:0,max:180,step:1,value:ae,onChange:e=>oe(Number(e.target.value)),className:"w-full accent-blue-500"})]}),
149
- /* @__PURE__ */w("div",{children:[
150
- /* @__PURE__ */w("div",{className:"flex items-center justify-between gap-2 mb-1",children:[
151
- /* @__PURE__ */v("span",{children:C.axis}),
152
- /* @__PURE__ */v("button",{onClick:()=>re(e=>!e),className:"text-2xs text-gray-600 hover:text-gray-900 px-2 py-0.5 rounded bg-gray-100 hover:bg-gray-200",title:C.flipHint,children:ne?C.flipped:C.flip})]}),
153
- /* @__PURE__ */v("div",{className:"grid grid-cols-3 gap-1",children:["x","y","z"].map(e=>/* @__PURE__ */v("button",{onClick:()=>te(e),className:"py-1 rounded text-2xs font-semibold "+(ee===e?"bg-blue-500 text-white":"bg-gray-100 text-gray-700 hover:bg-gray-200"),children:e.toUpperCase()},e))})]}),
154
- /* @__PURE__ */w("div",{children:[
155
- /* @__PURE__ */w("div",{className:"flex items-center justify-between gap-2 mb-1",children:[
156
- /* @__PURE__ */v("span",{children:C.position}),
157
- /* @__PURE__ */w("span",{className:"text-gray-500 tabular-nums",children:[Math.round(100*se),"%"]})]}),
158
- /* @__PURE__ */v("input",{type:"range",min:0,max:1,step:.01,value:se,onChange:e=>ie(Number(e.target.value)),className:"w-full accent-blue-500"})]})]})]})]}),
159
- /* @__PURE__ */v("div",{className:"px-3 py-2 border-t border-gray-200",children:/* @__PURE__ */v("button",{onClick:()=>{I("#f5f6f8"),B(!0),X("#000000"),V(1),Q(!1),te("x"),re(!1),ie(.5),oe(0)},className:"w-full text-2xs text-gray-700 bg-gray-100 hover:bg-gray-200 rounded py-2 transition-colors",children:C.resetDisplay})})]})]})})]})}function P({url:e,filename:t,onDownload:s,onEmail:i}){const[a,o]=g(1),[l,c]=g(!1),[p,m]=g(!1),h=f(null),x=y().preview,b="px-2 py-1 rounded hover:bg-gray-200 transition-colors text-gray-600 flex items-center gap-1";/* @__PURE__ */
160
- return w("div",{className:"flex flex-col h-full",children:[
161
- /* @__PURE__ */w(n,{children:[!p&&/* @__PURE__ */w(k,{children:[
162
- /* @__PURE__ */v("button",{onClick:()=>o(e=>Math.max(.1,Math.round(100*(e-.25))/100)),className:b,children:"−"}),
163
- /* @__PURE__ */w("span",{className:"text-gray-500 w-12 text-center tabular-nums",children:[Math.round(100*a),"%"]}),
164
- /* @__PURE__ */v("button",{onClick:()=>o(e=>Math.min(8,Math.round(100*(e+.25))/100)),className:b,children:"+"}),
165
- /* @__PURE__ */v("button",{onClick:()=>o(1),className:b,children:"1:1"}),
166
- /* @__PURE__ */v("div",{className:"h-4 w-px bg-gray-300 mx-1"}),
167
- /* @__PURE__ */w("button",{onClick:()=>m(!0),className:b,title:x.annotateHint,children:[
168
- /* @__PURE__ */v(u,{name:"edit",className:"h-3.5 w-3.5",strokeWidth:1.5}),x.annotate]})]}),p&&/* @__PURE__ */w(k,{children:[
169
- /* @__PURE__ */w("button",{onClick:()=>m(!1),className:b,title:x.viewHint,children:[
170
- /* @__PURE__ */v(u,{name:"chevron-left",className:"h-3.5 w-3.5",strokeWidth:1.5}),x.view]}),
171
- /* @__PURE__ */w("button",{onClick:()=>h.current?.copy(),className:b,children:[
172
- /* @__PURE__ */v(u,{name:"duplicate",className:"h-3.5 w-3.5",strokeWidth:1.5}),x.copy]}),
173
- /* @__PURE__ */w("button",{onClick:()=>h.current?.save(),className:b,children:[
174
- /* @__PURE__ */v(u,{name:"download",className:"h-3.5 w-3.5",strokeWidth:1.5}),x.save]})]}),
175
- /* @__PURE__ */w("button",{onClick:s??(async()=>{if(e.startsWith("blob:")||e.startsWith("data:")){const n=document.createElement("a");return n.href=e,n.download=t,void n.click()}const n=async t=>{const n=await fetch(e,t);if(!n.ok)throw new Error(`HTTP ${n.status}`);return n.blob()};try{let e;try{e=await n({credentials:"include"})}catch{e=await n({credentials:"omit"})}const r=URL.createObjectURL(e),s=document.createElement("a");s.href=r,s.download=t,s.click(),setTimeout(()=>URL.revokeObjectURL(r),1e3)}catch{d.error(x.downloadFailed)}}),className:b,children:[
176
- /* @__PURE__ */v(u,{name:"download",className:"h-3.5 w-3.5",strokeWidth:1.5}),x.download]}),i&&/* @__PURE__ */w("button",{onClick:i,className:b,children:[
177
- /* @__PURE__ */v(u,{name:"email",className:"h-3.5 w-3.5",strokeWidth:1.5}),x.email]})]}),p?/* @__PURE__ */v(r,{ref:h,src:e,filename:t}):/* @__PURE__ */v("div",{className:"flex-1 overflow-auto bg-gray-100 flex items-center justify-center p-4",children:l?/* @__PURE__ */v("div",{className:"text-sm text-red-600",children:x.imageFailed}):/* @__PURE__ */v("img",{src:e,alt:t,onError:()=>c(!0),style:{transform:`scale(${a})`,transformOrigin:"center center",transition:"transform 120ms ease"},className:"max-w-full max-h-full shadow-lg rounded bg-white"})})]})}export{A as default};