efficient-shell 12.3.0 → 12.4.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 (291) hide show
  1. package/README.md +17 -1
  2. package/dist/{Browser-OE7IMID6.js → Browser-Z4Q2NDFT.js} +16 -16
  3. package/dist/Calculator-AHBFZ4EN.js +29 -0
  4. package/dist/{CurrencyConverter-TLI6PVRE.js → CurrencyConverter-PZYRBADV.js} +8 -8
  5. package/dist/Files-EX6JA4CJ.js +121 -0
  6. package/dist/{Notepad-TUW4JP7M.js → Notepad-U4OSPCX3.js} +11 -11
  7. package/dist/PdfViewer-GUXUWGMG.js +1 -0
  8. package/dist/{PomodoroTimer-FPGRFPNT.js → PomodoroTimer-WGN2KNSB.js} +7 -7
  9. package/dist/{Preview-BJRRRU4N.js → Preview-JGRBT3EM.js} +53 -53
  10. package/dist/Sidebar-F7HHC5GY.js +44 -0
  11. package/dist/{Stock-P7D5WNKC.js → Stock-5GEEDQVT.js} +3 -3
  12. package/dist/{Weather-OUHUYBZ6.js → Weather-WMQQXWHH.js} +18 -18
  13. package/dist/{WorldClock-WXIV2KC6.js → WorldClock-IK3WTHVW.js} +7 -7
  14. package/dist/ai/index.js +33 -33
  15. package/dist/apps/ImageAnnotator.d.ts +21 -0
  16. package/dist/apps/ImageAnnotator.js +2 -0
  17. package/dist/apps/index.js +1 -1
  18. package/dist/bin/media-host-check.js +1 -1
  19. package/dist/bin/ui-check.js +1 -1
  20. package/dist/brand.css +1 -1
  21. package/dist/charts/BoxPlotChart.js +1 -1
  22. package/dist/charts/CandlestickChart.js +1 -1
  23. package/dist/charts/CartesianPlot.js +1 -1
  24. package/dist/charts/ChartTooltip.js +1 -1
  25. package/dist/charts/ChordChart.js +1 -1
  26. package/dist/charts/ColumnChart.js +1 -1
  27. package/dist/charts/FlowChart.js +1 -1
  28. package/dist/charts/FunnelChart.js +1 -1
  29. package/dist/charts/HeatmapChart.js +1 -1
  30. package/dist/charts/HistogramChart.js +1 -1
  31. package/dist/charts/PieChart.js +1 -1
  32. package/dist/charts/RadarChart.js +1 -1
  33. package/dist/charts/RadialBarChart.js +1 -1
  34. package/dist/charts/RangeChart.js +1 -1
  35. package/dist/charts/SankeyChart.js +1 -1
  36. package/dist/charts/ScatterChart.js +1 -1
  37. package/dist/charts/SpecChart.js +1 -1
  38. package/dist/charts/SunburstChart.js +1 -1
  39. package/dist/charts/TimeSeriesChart.js +1 -1
  40. package/dist/charts/TreemapChart.js +1 -1
  41. package/dist/charts/WaterfallChart.js +1 -1
  42. package/dist/{chunk-NRLTGGCS.js → chunk-2BMGV6DE.js} +8 -8
  43. package/dist/chunk-2YRLRMZH.js +23 -0
  44. package/dist/{chunk-5BV2WW74.js → chunk-3LTZ4N46.js} +11 -11
  45. package/dist/{chunk-MQKUGIN7.js → chunk-3PWI5IH7.js} +13 -13
  46. package/dist/{chunk-Q2MW334M.js → chunk-3UHTHQGK.js} +8 -8
  47. package/dist/{chunk-RQ4UIWWD.js → chunk-4UGFNTZ3.js} +11 -11
  48. package/dist/{chunk-Y7ANTS5W.js → chunk-4ZUV6WQT.js} +1 -1
  49. package/dist/{chunk-P4L74UA5.js → chunk-525O4AUQ.js} +1 -1
  50. package/dist/chunk-56GGBTAD.js +3 -0
  51. package/dist/{chunk-KDWK5WGU.js → chunk-57YY4J6T.js} +1 -1
  52. package/dist/{chunk-IL56C56I.js → chunk-5JUG74UR.js} +2 -2
  53. package/dist/{chunk-TKXUDCOI.js → chunk-5MO5JBBK.js} +1 -1
  54. package/dist/{chunk-6TLSXBKC.js → chunk-62275PI2.js} +1 -1
  55. package/dist/{chunk-5LZTYOYD.js → chunk-6BATVJBA.js} +17 -17
  56. package/dist/{chunk-2KNVUOWJ.js → chunk-6C4T3HRB.js} +19 -19
  57. package/dist/{chunk-SSUZAOGI.js → chunk-6U25ELYF.js} +10 -10
  58. package/dist/{chunk-QOQ6GXVA.js → chunk-75MSXRFY.js} +5 -5
  59. package/dist/{chunk-UDL2A2GT.js → chunk-7RRJPNYN.js} +3 -3
  60. package/dist/{chunk-ZXNJSSRV.js → chunk-A4KQKN32.js} +1 -1
  61. package/dist/chunk-A6WZF65N.js +22 -0
  62. package/dist/{chunk-DONZDILI.js → chunk-AAIUJJDQ.js} +1 -1
  63. package/dist/chunk-BG2OL3MO.js +7 -0
  64. package/dist/{chunk-ZZ67Q5HJ.js → chunk-BKKKIHHV.js} +6 -6
  65. package/dist/{chunk-KZNJXV5I.js → chunk-BQ5CRQYR.js} +2 -2
  66. package/dist/chunk-BTFBXZS2.js +1 -0
  67. package/dist/chunk-BUGTNNZQ.js +15 -0
  68. package/dist/chunk-C57PNNAW.js +13 -0
  69. package/dist/{chunk-DULMOL3I.js → chunk-C5LBNLFJ.js} +1 -1
  70. package/dist/chunk-CAXOKGMB.js +27 -0
  71. package/dist/{chunk-WGLHB6WE.js → chunk-CJH2BGXY.js} +1 -1
  72. package/dist/chunk-CURXYF2R.js +9 -0
  73. package/dist/{chunk-ZRLWE3JM.js → chunk-DANLBFBD.js} +1 -1
  74. package/dist/{chunk-JYGUTY6R.js → chunk-DFYXIW4O.js} +1 -1
  75. package/dist/{chunk-GZJ5F7SB.js → chunk-DJ2XDBAO.js} +5 -5
  76. package/dist/{chunk-PFMZL3ZG.js → chunk-DW45EZHA.js} +2 -2
  77. package/dist/{chunk-GYDCXCJT.js → chunk-EB2UE6ZR.js} +1 -1
  78. package/dist/{chunk-OR5HUQSB.js → chunk-EEVLRCMA.js} +7 -7
  79. package/dist/{chunk-FGCIEJPP.js → chunk-EIY6YGEZ.js} +1 -1
  80. package/dist/{chunk-THASH6OO.js → chunk-EUUCNDIS.js} +9 -9
  81. package/dist/{chunk-5PP435FL.js → chunk-EYPKBJYG.js} +1 -1
  82. package/dist/{chunk-ASQX3GXB.js → chunk-FLTPVFKA.js} +5 -5
  83. package/dist/chunk-FPYABAOX.js +69 -0
  84. package/dist/chunk-FVZXRGVM.js +8 -0
  85. package/dist/{chunk-67JHJO6V.js → chunk-G7I255HN.js} +13 -13
  86. package/dist/{chunk-2YBJQUYQ.js → chunk-GEXETMGL.js} +1 -1
  87. package/dist/chunk-GEZ45J4Z.js +2 -0
  88. package/dist/chunk-GUIJCTFJ.js +8 -0
  89. package/dist/{chunk-7JY3YYN4.js → chunk-GZQD6IBV.js} +3 -3
  90. package/dist/chunk-H7HRYFRQ.js +14 -0
  91. package/dist/{chunk-AANXPLMA.js → chunk-I5BS6AP6.js} +4 -4
  92. package/dist/chunk-I5CSYOOZ.js +28 -0
  93. package/dist/chunk-I64TVNHS.js +6 -0
  94. package/dist/{chunk-F44E76EC.js → chunk-IFQXTIMY.js} +4 -4
  95. package/dist/chunk-IHPAYSTJ.js +8 -0
  96. package/dist/{chunk-QTMRW6DK.js → chunk-IXBKWVEP.js} +1 -1
  97. package/dist/{chunk-O6H2ZD32.js → chunk-J53LQWWY.js} +7 -7
  98. package/dist/{chunk-IXAYZNOZ.js → chunk-JM2IQC4J.js} +1 -1
  99. package/dist/{chunk-FZM3ZPW3.js → chunk-JPNAEN53.js} +1 -1
  100. package/dist/{chunk-S4FPYCUU.js → chunk-JQBVSPF5.js} +3 -3
  101. package/dist/{chunk-XGVMOV3O.js → chunk-KDTL6VEC.js} +8 -8
  102. package/dist/{chunk-KT5LLPUV.js → chunk-KQDSAN75.js} +1 -1
  103. package/dist/{chunk-2XQOK3CT.js → chunk-KUEYOJBN.js} +2 -2
  104. package/dist/{chunk-QA33EHHO.js → chunk-LCC3NXQX.js} +6 -6
  105. package/dist/{chunk-7JGR7WPD.js → chunk-LFYZ7NQ4.js} +3 -3
  106. package/dist/chunk-M54OL3YR.js +2 -0
  107. package/dist/chunk-MGW7SX53.js +11 -0
  108. package/dist/{chunk-3QYAYBJE.js → chunk-MOMOZVOW.js} +3 -3
  109. package/dist/{chunk-RYBYTUGZ.js → chunk-N442GPRJ.js} +1 -1
  110. package/dist/{chunk-6NHPL5JL.js → chunk-N6Q7HNAH.js} +1 -1
  111. package/dist/{chunk-RXHTIJ64.js → chunk-N7JX27JE.js} +1 -1
  112. package/dist/{chunk-SKFFBBAG.js → chunk-N7YHXL2F.js} +2 -2
  113. package/dist/{chunk-GR43CABV.js → chunk-ND5IZ37V.js} +5 -5
  114. package/dist/{chunk-LKVS4WCZ.js → chunk-NEYHBQLG.js} +3 -3
  115. package/dist/{chunk-ZDO62V4I.js → chunk-NIBE57KV.js} +1 -1
  116. package/dist/{chunk-6Y2BQI44.js → chunk-NS37Y5CN.js} +3 -3
  117. package/dist/chunk-OLVKHYHV.js +9 -0
  118. package/dist/{chunk-CVLWJBR5.js → chunk-PIWC3CAC.js} +1 -1
  119. package/dist/chunk-PMJMYH5O.js +5 -0
  120. package/dist/{chunk-6GDZUW3L.js → chunk-PVXX77MY.js} +6 -6
  121. package/dist/{chunk-NHNRNT4T.js → chunk-QIUIP6YZ.js} +2 -2
  122. package/dist/{chunk-NJN5IKWO.js → chunk-QQ2LDC6C.js} +1 -1
  123. package/dist/{chunk-FAIHSCOG.js → chunk-RBMZSZOH.js} +1 -1
  124. package/dist/{chunk-53WYJ5LZ.js → chunk-RFKCSRJX.js} +10 -10
  125. package/dist/chunk-RJ3J4BLH.js +1 -0
  126. package/dist/{chunk-NDLXD4EY.js → chunk-RNQBWWYR.js} +5 -5
  127. package/dist/{chunk-N5KO2IHG.js → chunk-RQDVAUXD.js} +4 -4
  128. package/dist/{chunk-B5OYS65L.js → chunk-RVQUSPXC.js} +1 -1
  129. package/dist/chunk-SBZCJNNP.js +11 -0
  130. package/dist/{chunk-RDKIYORS.js → chunk-SYZLS2JA.js} +1 -1
  131. package/dist/chunk-TQWLJ5VM.js +7 -0
  132. package/dist/{chunk-RM74EAMV.js → chunk-TS36J7RW.js} +2 -2
  133. package/dist/{chunk-ZATTQ3FX.js → chunk-TTQ7K4AJ.js} +1 -1
  134. package/dist/{chunk-FPRQB5W6.js → chunk-UDHJTQBA.js} +12 -12
  135. package/dist/{chunk-P3BLJCTQ.js → chunk-UDVQORQM.js} +3 -3
  136. package/dist/chunk-UGOJLNYR.js +1 -0
  137. package/dist/chunk-UJJXWLHE.js +2 -0
  138. package/dist/{chunk-CF4YOJUQ.js → chunk-UPTKROT7.js} +9 -9
  139. package/dist/{chunk-SGNJ7I7P.js → chunk-UVBX5LEU.js} +4 -4
  140. package/dist/{chunk-HRMG2WMW.js → chunk-UWF45S5L.js} +23 -23
  141. package/dist/chunk-VIOILTE4.js +13 -0
  142. package/dist/{chunk-M3PUAGXJ.js → chunk-VWQNCYGQ.js} +7 -7
  143. package/dist/{chunk-2B4EKAZL.js → chunk-VYMM2BPX.js} +2 -2
  144. package/dist/{chunk-HNQKXOFU.js → chunk-WCPAQHHA.js} +1 -1
  145. package/dist/{chunk-36VIGB6J.js → chunk-WDQI3FV6.js} +6 -6
  146. package/dist/chunk-WUGQAZMC.js +14 -0
  147. package/dist/{chunk-74LZVJND.js → chunk-X32TVINY.js} +1 -1
  148. package/dist/{chunk-LBMC6GR5.js → chunk-XK4SMAVR.js} +1 -1
  149. package/dist/{chunk-U7PXMVIY.js → chunk-XK4U5MAS.js} +3 -3
  150. package/dist/{chunk-S6BGMLXI.js → chunk-XMH2JOZ2.js} +1 -1
  151. package/dist/{chunk-TE6R53YD.js → chunk-XWFLIGDQ.js} +1 -1
  152. package/dist/{chunk-PA273FZF.js → chunk-YMAU4EIK.js} +1 -1
  153. package/dist/{chunk-LDEFEPPL.js → chunk-YRJJKF5H.js} +1 -1
  154. package/dist/{chunk-7TZRICMH.js → chunk-YU6KOO6O.js} +4 -4
  155. package/dist/chunk-YZR4T5FZ.js +7 -0
  156. package/dist/{chunk-NC36LJCA.js → chunk-ZB2H2JJ2.js} +4 -4
  157. package/dist/{chunk-FLYOI6EW.js → chunk-ZOZEQZUA.js} +1 -1
  158. package/dist/data/DataTable.js +1 -1
  159. package/dist/data/EntityList.js +1 -1
  160. package/dist/data/Kanban.js +1 -1
  161. package/dist/data/ListLoadError.js +1 -1
  162. package/dist/data/ResizableTable.js +1 -1
  163. package/dist/format/index.js +1 -1
  164. package/dist/forms/AlignmentGrid.js +1 -1
  165. package/dist/forms/BorderInput.js +1 -1
  166. package/dist/forms/BrandAssetEditor.js +1 -1
  167. package/dist/forms/Button.js +1 -1
  168. package/dist/forms/ColorPicker.js +1 -1
  169. package/dist/forms/ComposerAttachments.js +1 -1
  170. package/dist/forms/CornersInput.js +1 -1
  171. package/dist/forms/DatePicker.js +1 -1
  172. package/dist/forms/DateRangePicker.js +1 -1
  173. package/dist/forms/DisplayChips.js +1 -1
  174. package/dist/forms/FilePicker.js +1 -1
  175. package/dist/forms/IconButton.js +1 -1
  176. package/dist/forms/IconPicker.js +1 -1
  177. package/dist/forms/Input.js +1 -1
  178. package/dist/forms/InputNumber.js +1 -1
  179. package/dist/forms/LinkPicker.js +1 -1
  180. package/dist/forms/MediaLibrary.js +1 -1
  181. package/dist/forms/MediaUploadField.js +1 -1
  182. package/dist/forms/MediaUploadGrid.js +1 -1
  183. package/dist/forms/MediaUsedInList.js +1 -1
  184. package/dist/forms/NumericKeypad.js +1 -1
  185. package/dist/forms/PictureTiles.js +1 -1
  186. package/dist/forms/PositionInput.js +1 -1
  187. package/dist/forms/RenameField.js +1 -1
  188. package/dist/forms/Segmented.js +1 -1
  189. package/dist/forms/Select.js +1 -1
  190. package/dist/forms/SidesInput.js +1 -1
  191. package/dist/forms/Slider.js +1 -1
  192. package/dist/forms/Snippet.js +1 -1
  193. package/dist/forms/SplitButton.js +1 -1
  194. package/dist/forms/TagInput.js +1 -1
  195. package/dist/forms/TextToolbar.js +1 -1
  196. package/dist/forms/WidthsBar.js +1 -1
  197. package/dist/icons/efficient-glyphs.js +1 -1
  198. package/dist/icons/efficient-looks.js +1 -1
  199. package/dist/icons/efficient.js +1 -1
  200. package/dist/icons/looks/map.js +1 -1
  201. package/dist/icons/payment.js +1 -1
  202. package/dist/icons/sets.js +1 -1
  203. package/dist/index.d.ts +2 -19
  204. package/dist/index.js +416 -416
  205. package/dist/map/index.js +2 -2
  206. package/dist/page-tabs/index.js +5 -5
  207. package/dist/pdf/index.js +1 -1
  208. package/dist/shell/AppUpdateBanner.js +1 -1
  209. package/dist/shell/ColoredBadge.js +1 -1
  210. package/dist/shell/ConfirmDialog.js +1 -1
  211. package/dist/shell/ContextMenu.js +1 -1
  212. package/dist/shell/Dialog.js +1 -1
  213. package/dist/shell/Drawer.js +1 -1
  214. package/dist/shell/DropdownMenu.js +1 -1
  215. package/dist/shell/EditableGrid.js +1 -1
  216. package/dist/shell/GlobalSearch.js +1 -1
  217. package/dist/shell/HelpCenter.js +1 -1
  218. package/dist/shell/IconRail.js +1 -1
  219. package/dist/shell/ImageLightbox.js +1 -1
  220. package/dist/shell/ItemCount.js +1 -1
  221. package/dist/shell/LanguageSelect.js +1 -1
  222. package/dist/shell/Markdown.js +1 -1
  223. package/dist/shell/MilestoneTimeline.js +1 -1
  224. package/dist/shell/Popover.js +1 -1
  225. package/dist/shell/PopupMenu.js +1 -1
  226. package/dist/shell/ProductionTimeline.js +1 -1
  227. package/dist/shell/ResizeHandle.js +1 -1
  228. package/dist/shell/SearchableSelect.js +1 -1
  229. package/dist/shell/SettingReset.js +1 -1
  230. package/dist/shell/SettingRow.js +1 -1
  231. package/dist/shell/SidebarLayout.js +1 -1
  232. package/dist/shell/SidebarNav.js +1 -1
  233. package/dist/shell/SortableList.js +1 -1
  234. package/dist/shell/StatusBadge.js +1 -1
  235. package/dist/shell/Tabs.js +1 -1
  236. package/dist/shell/TimelineTrack.js +1 -1
  237. package/dist/shell/Tooltip.js +1 -1
  238. package/dist/shell/TopNav.js +1 -1
  239. package/dist/shell/TransferProgress.js +1 -1
  240. package/dist/shell/Tree.js +1 -1
  241. package/dist/shell/discardGuard.js +1 -1
  242. package/dist/telemetry/index.js +1 -1
  243. package/dist/templates/AuthScreen.js +1 -1
  244. package/dist/templates/ChatTemplate.js +1 -1
  245. package/dist/templates/CheckoutTemplate.js +1 -1
  246. package/dist/templates/DashboardTemplate.js +1 -1
  247. package/dist/templates/DataTablePage.js +1 -1
  248. package/dist/templates/EmailTemplate.js +1 -1
  249. package/dist/templates/ErrorBoundary.js +1 -1
  250. package/dist/templates/FormLayoutPage.js +1 -1
  251. package/dist/templates/GalleryTemplate.js +1 -1
  252. package/dist/ui/index.d.ts +1 -0
  253. package/dist/ui/index.js +1 -1
  254. package/dist/ui.css +10 -0
  255. package/dist/version.js +1 -1
  256. package/package.json +1 -1
  257. package/dist/Calculator-W6YA44OY.js +0 -29
  258. package/dist/Files-5WRVSC5R.js +0 -121
  259. package/dist/PdfViewer-GFQAIHDP.js +0 -1
  260. package/dist/Sidebar-ROMFJHCD.js +0 -44
  261. package/dist/chunk-4DZVWK7U.js +0 -7
  262. package/dist/chunk-5N6AC3LN.js +0 -15
  263. package/dist/chunk-6JKSRXZM.js +0 -8
  264. package/dist/chunk-AUZKIL62.js +0 -23
  265. package/dist/chunk-B3PNZBZM.js +0 -27
  266. package/dist/chunk-DCICBH2L.js +0 -3
  267. package/dist/chunk-DICWZEGH.js +0 -2
  268. package/dist/chunk-EOVXFXVV.js +0 -2
  269. package/dist/chunk-F245EG2A.js +0 -9
  270. package/dist/chunk-FPZBHNZU.js +0 -7
  271. package/dist/chunk-GIUX7WUS.js +0 -7
  272. package/dist/chunk-GMLGR4R6.js +0 -8
  273. package/dist/chunk-IMRGGJIJ.js +0 -22
  274. package/dist/chunk-IWFWPFYQ.js +0 -13
  275. package/dist/chunk-KZD2AFH2.js +0 -13
  276. package/dist/chunk-LE5LWALR.js +0 -1
  277. package/dist/chunk-LJJSFJA2.js +0 -69
  278. package/dist/chunk-M3OEWPXZ.js +0 -1
  279. package/dist/chunk-NPQBJJLP.js +0 -9
  280. package/dist/chunk-NSOAHIQZ.js +0 -11
  281. package/dist/chunk-SEJAT3UE.js +0 -1
  282. package/dist/chunk-SPJIFRNY.js +0 -8
  283. package/dist/chunk-SYDGCECZ.js +0 -14
  284. package/dist/chunk-UCIOCS4X.js +0 -2
  285. package/dist/chunk-UMQLDWSS.js +0 -6
  286. package/dist/chunk-VF53GD6D.js +0 -5
  287. package/dist/chunk-WD3I7AEZ.js +0 -14
  288. package/dist/chunk-YAQ5RF3H.js +0 -28
  289. package/dist/chunk-ZICLAMMR.js +0 -11
  290. /package/dist/{chunk-R3K2BNFF.js → chunk-2762IAB7.js} +0 -0
  291. /package/dist/{chunk-K5A62ZS5.js → chunk-T75VCE6K.js} +0 -0
@@ -1,14 +1,14 @@
1
- import{FormField as e}from"./chunk-6KBDNYRW.js";import{zoneFocusClass as t,mediaPromptLine as r,UploadGlyph as a,dropzoneClass as n,BusyOverlay as l,isVideoUrl as i,mediaFileName as o,FilenameBadge as s}from"./chunk-LBMC6GR5.js";import{useFileIntake as d,FileIntakeAlert as c}from"./chunk-7KIDOIPY.js";import{ColoredBadge as u}from"./chunk-IL56C56I.js";import{MENU_ON_MEDIA_ATTR as m}from"./chunk-5QFPTDQF.js";import{Icon as p}from"./chunk-UIWGVOFH.js";import{Tooltip as f}from"./chunk-NJN5IKWO.js";import{useShellStrings as h}from"./chunk-43MCNASD.js";import{useId as g,useState as b,useRef as y}from"react";import{jsxs as v,jsx as x}from"react/jsx-runtime";var k=112,D=/* @__PURE__ */x(p,{name:"close",strokeWidth:2,strokeLinecap:"round","aria-hidden":"true",className:"h-3 w-3"});function N({items:p,onPick:k,onFiles:N,onRemove:w,onReorder:j,dragType:K,onDragOutChange:C,dropType:I,onDropData:T,label:A,hint:O,error:F,required:L,className:P,accept:S="image/*",maxSizeBytes:z,maxFiles:M,fit:$="cover",thumbSize:E=96,placeholder:H,cta:R,acceptHint:W,showCover:B=!1,coverLabel:q,busy:G=!1,busyLabel:Q,progress:U,disabled:Y=!1,readOnly:J=!1,selected:V,onItemClick:X,onItemDoubleClick:Z,onItemContextMenu:_,menuOnMedia:ee=!1}){const te=h().media,re=R??te.cta,ae=q??te.cover,ne=Q??te.uploading,le=g(),[ie,oe]=b(null),se=Y||G,de=!(!k&&!N||se||J),ce=!!w&&!se&&!J,ue=!!j&&!se&&!J,me=!!K&&!Y&&!ue,pe=!(!I||!T||se||J),fe=t(se),he=H??r(S,te),ge=d({accept:S,maxSizeBytes:z,maxFiles:M,acceptHint:W,multiple:!0,disabled:!de,currentCount:p.length,onAccept:e=>{if(N)N(e);else for(const t of e)k(t)}}),[be,ye]=b(!1),ve=y(0),xe=e=>pe&&Array.from(e.dataTransfer?.types??[]).includes(I),ke=ge.zoneProps,De={onDragEnter:e=>{if(!xe(e))return ke.onDragEnter?.(e);e.preventDefault(),ve.current+=1,ye(!0)},onDragOver:e=>{if(!xe(e))return ke.onDragOver?.(e);e.preventDefault(),e.dataTransfer.dropEffect="link",be||ye(!0)},onDragLeave:e=>{if(!xe(e))return ke.onDragLeave?.(e);ve.current=Math.max(0,ve.current-1),0===ve.current&&ye(!1)},onDrop:e=>{if(!xe(e))return ke.onDrop?.(e);e.preventDefault(),ve.current=0,ye(!1);const t=e.dataTransfer.getData(I);t&&T(t)}},Ne=ge.dragOver||be,we=()=>{de&&(k?k():ge.open())},je={width:E,height:E},Ke=null==V?null:new Set(V),Ce=!!X,Ie=E<112,Te=(e,t)=>{const r=e.kind?"video"===e.kind:i(e.url,S),a=e.name??o(e.url),n=B&&(e.cover??0===t);/* @__PURE__ */
1
+ import{FormField as e}from"./chunk-6KBDNYRW.js";import{zoneFocusClass as t,mediaPromptLine as r,UploadGlyph as a,dropzoneClass as n,BusyOverlay as l,isVideoUrl as i,mediaFileName as o,FilenameBadge as s}from"./chunk-XK4SMAVR.js";import{useFileIntake as d,FileIntakeAlert as c}from"./chunk-7KIDOIPY.js";import{ColoredBadge as u}from"./chunk-5JUG74UR.js";import{MENU_ON_MEDIA_ATTR as m}from"./chunk-5QFPTDQF.js";import{Icon as p}from"./chunk-UIWGVOFH.js";import{Tooltip as f}from"./chunk-QQ2LDC6C.js";import{useShellStrings as h}from"./chunk-43MCNASD.js";import{useId as g,useState as b,useRef as y}from"react";import{jsxs as v,jsx as x}from"react/jsx-runtime";var k=112,D=/* @__PURE__ */x(p,{name:"close",strokeWidth:2,strokeLinecap:"round","aria-hidden":"true",className:"h-3 w-3"});function N({items:p,onPick:k,onFiles:N,onRemove:w,onReorder:j,dragType:K,onDragOutChange:C,dropType:T,onDropData:A,label:I,hint:O,error:F,required:S,className:L,accept:P="image/*",maxSizeBytes:z,maxFiles:M,fit:$="cover",thumbSize:E=96,placeholder:R,cta:H,acceptHint:Q,showCover:U=!1,coverLabel:W,busy:B=!1,busyLabel:q,progress:G,disabled:V=!1,readOnly:Y=!1,selected:J,onItemClick:X,onItemDoubleClick:Z,onItemContextMenu:_,menuOnMedia:ee=!1}){const te=h().media,re=H??te.cta,ae=W??te.cover,ne=q??te.uploading,le=g(),[ie,oe]=b(null),se=V||B,de=!(!k&&!N||se||Y),ce=!!w&&!se&&!Y,ue=!!j&&!se&&!Y,me=!!K&&!V&&!ue,pe=!(!T||!A||se||Y),fe=t(se),he=R??r(P,te),ge=d({accept:P,maxSizeBytes:z,maxFiles:M,acceptHint:Q,multiple:!0,disabled:!de,currentCount:p.length,onAccept:e=>{if(N)N(e);else for(const t of e)k(t)}}),[be,ye]=b(!1),ve=y(0),xe=e=>pe&&Array.from(e.dataTransfer?.types??[]).includes(T),ke=ge.zoneProps,De={onDragEnter:e=>{if(!xe(e))return ke.onDragEnter?.(e);e.preventDefault(),ve.current+=1,ye(!0)},onDragOver:e=>{if(!xe(e))return ke.onDragOver?.(e);e.preventDefault(),e.dataTransfer.dropEffect="link",be||ye(!0)},onDragLeave:e=>{if(!xe(e))return ke.onDragLeave?.(e);ve.current=Math.max(0,ve.current-1),0===ve.current&&ye(!1)},onDrop:e=>{if(!xe(e))return ke.onDrop?.(e);e.preventDefault(),ve.current=0,ye(!1);const t=e.dataTransfer.getData(T);t&&A(t)}},Ne=ge.dragOver||be,we=()=>{de&&(k?k():ge.open())},je={width:E,height:E},Ke=null==J?null:new Set(J),Ce=!!X,Te=E<112,Ae=(e,t)=>{const r=e.kind?"video"===e.kind:i(e.url,P),a=e.name??o(e.url),n=U&&(e.cover??0===t);/* @__PURE__ */
2
2
  return v("div",{...Ce?{"data-grid-item":"","data-grid-id":e.id,role:"option"}:{},...ee?{[m]:""}:{},"aria-selected":Ke?Ke.has(e.id):void 0,onClick:Ce?t=>{t.target.closest?.("button")||X(e.id,{ctrlKey:t.ctrlKey,metaKey:t.metaKey,shiftKey:t.shiftKey})}:void 0,onDoubleClick:Z?()=>Z(e.id):void 0,onContextMenu:_?t=>_(e.id,t):void 0,draggable:ue||me&&!!e.dragData||void 0,onDragStart:ue?e=>{e.dataTransfer.effectAllowed="move",e.dataTransfer.setData("text/plain",String(t)),oe(t)}:me&&e.dragData?t=>{t.dataTransfer.effectAllowed=e.dragAlso?"all":"link",t.dataTransfer.setData(K,e.dragData);for(const[r,a]of Object.entries(e.dragAlso??{}))t.dataTransfer.setData(r,a);C?.("start",e.id)}:void 0,onDragEnd:ue?()=>oe(null):me&&e.dragData&&C?t=>C("none"===t.dataTransfer.dropEffect?"cancelled":"dropped",e.id):void 0,onDragOver:ue?e=>{null!=ie&&(e.preventDefault(),e.stopPropagation())}:void 0,onDrop:ue?e=>{null!=ie&&(e.preventDefault(),e.stopPropagation(),ie!==t&&j(ie,t),oe(null))}:void 0,tabIndex:ue||Ce?0:void 0,"aria-label":ue?te.reorder(a,t+1,p.length):Ce?a:void 0,onKeyDown:Ce&&!ue?t=>{t.target!==t.currentTarget||"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),X(e.id,{ctrlKey:t.ctrlKey,metaKey:t.metaKey,shiftKey:t.shiftKey}))}:ue?e=>{"ArrowLeft"===e.key||"ArrowUp"===e.key?t>0&&(e.preventDefault(),j(t,t-1)):"ArrowRight"!==e.key&&"ArrowDown"!==e.key||t<p.length-1&&(e.preventDefault(),j(t,t+1))}:void 0,className:["relative shrink-0 overflow-hidden rounded-md border border-line bg-gray-100",fe,ie===t?"opacity-50":"",Ke?.has(e.id)?"ring-2 ring-blue-500 ring-offset-1":"",Ce?"cursor-pointer":""].join(" "),style:{...je,cursor:ue?"move":void 0},children:[r?/* @__PURE__ */x("video",{src:e.url,muted:!0,playsInline:!0,preload:"metadata","aria-label":a,className:"h-full w-full",style:{objectFit:$}}):/* @__PURE__ */x("img",{src:e.url,alt:a,className:"h-full w-full",style:{objectFit:$}}),n&&/* @__PURE__ */x("span",{className:"absolute left-1 top-1 rounded bg-accent-fill px-2 py-0.5 text-xs font-medium text-on-accent",children:ae}),!n&&null!=e.mark&&/* @__PURE__ */x("span",{className:"absolute left-1 top-1 inline-flex items-center gap-1 rounded px-2 py-0.5 text-xs font-medium text-on-accent",style:{background:"var(--rosh-media-scrim)"},children:e.mark}),!n&&null==e.mark&&!!e.badges?.length&&
3
- /* @__PURE__ */x("span",{"data-tile-badges":"",className:"absolute left-1 top-1 flex flex-nowrap items-center gap-1 overflow-hidden rounded-md bg-surface p-0.5 shadow-sm",style:{maxWidth:"calc(100% - 8px)"},children:e.badges.map(e=>/* @__PURE__ */x("span",{"data-tile-badge":"",className:"flex min-w-0",children:Ie?
3
+ /* @__PURE__ */x("span",{"data-tile-badges":"",className:"absolute left-1 top-1 flex flex-nowrap items-center gap-1 overflow-hidden rounded-md bg-surface p-0.5 shadow-sm",style:{maxWidth:"calc(100% - 8px)"},children:e.badges.map(e=>/* @__PURE__ */x("span",{"data-tile-badge":"",className:"flex min-w-0",children:Te?
4
4
  /* @__PURE__ */x(f,{content:e.label,children:/* @__PURE__ */x("span",{tabIndex:0,"aria-label":e.label,className:`flex rounded-full ${fe}`,children:/* @__PURE__ */x(u,{tone:e.tone,size:"xs",children:/* @__PURE__ */v("span",{"aria-hidden":"true",className:"inline-flex items-center gap-0.5",children:[
5
- /* @__PURE__ */x("span",{className:"inline-flex h-3 w-3 shrink-0 items-center justify-center",children:e.icon}),null!=e.count&&/* @__PURE__ */x("span",{children:e.count})]})})})}):/* @__PURE__ */x(u,{tone:e.tone,size:"xs",children:e.label})},e.key))}),null!=e.caption&&/* @__PURE__ */x(s,{children:e.caption}),ce&&/* @__PURE__ */x("button",{type:"button",onClick:()=>w(e.id),"aria-label":e.removeLabel??te.removeItem(a),className:`absolute right-1 top-1 flex h-5 w-5 items-center justify-center rounded-full text-white ${fe}`,style:{background:"var(--rosh-media-scrim-button)"},children:D})]},e.id)},Ae=de&&/* @__PURE__ */v("button",{type:"button",onClick:()=>we(),"aria-label":te.addMedia,className:`flex shrink-0 flex-col items-center justify-center gap-1 rounded-md border-2 border-dashed border-gray-300 bg-gray-50 text-gray-400 transition-colors hover:bg-gray-100 hover:text-gray-500 ${fe}`,style:je,children:[
5
+ /* @__PURE__ */x("span",{className:"inline-flex h-3 w-3 shrink-0 items-center justify-center",children:e.icon}),null!=e.count&&/* @__PURE__ */x("span",{children:e.count})]})})})}):/* @__PURE__ */x(u,{tone:e.tone,size:"xs",children:e.label})},e.key))}),null!=e.caption&&/* @__PURE__ */x(s,{children:e.caption}),ce&&/* @__PURE__ */x("button",{type:"button",onClick:()=>w(e.id),"aria-label":e.removeLabel??te.removeItem(a),className:`absolute right-1 top-1 flex h-5 w-5 items-center justify-center rounded-full text-white ${fe}`,style:{background:"var(--rosh-media-scrim-button)"},children:D})]},e.id)},Ie=de&&/* @__PURE__ */v("button",{type:"button",onClick:()=>we(),"aria-label":te.addMedia,className:`flex shrink-0 flex-col items-center justify-center gap-1 rounded-md border-2 border-dashed border-gray-300 bg-gray-50 text-gray-400 transition-colors hover:bg-gray-100 hover:text-gray-500 ${fe}`,style:je,children:[
6
6
  /* @__PURE__ */x(a,{className:"h-5 w-5"}),
7
7
  /* @__PURE__ */x("span",{className:"text-xs font-medium text-gray-500",children:te.add})]}),Oe=de?/* @__PURE__ */v("button",{type:"button",onClick:()=>we(),"aria-label":"string"==typeof he?he:te.upload,className:n(Ne,!1,fe),style:{minHeight:E+32},children:[
8
8
  /* @__PURE__ */x("span",{className:"text-ink-faintest",children:/* @__PURE__ */x(a,{})}),
9
9
  /* @__PURE__ */x("span",{className:"px-3 text-xs text-ink-faint",children:he}),
10
- /* @__PURE__ */x("span",{className:"text-sm font-medium text-blue-600",children:re}),W&&/* @__PURE__ */x("span",{className:"text-xs text-ink-faintest",children:W})]}):/* @__PURE__ */x("div",{className:"flex w-full items-center justify-center rounded-lg border border-line bg-surface-sunken px-3 text-xs text-ink-faintest",style:{minHeight:E+32},children:/* @__PURE__ */x("span",{className:G?"invisible":void 0,children:te.empty})});/* @__PURE__ */
11
- return v(e,{label:A,labelId:A?`${le}-label`:void 0,htmlFor:le,hint:O,error:F,required:L,className:P,children:[
12
- /* @__PURE__ */v("div",{id:le,role:"group","aria-labelledby":A?`${le}-label`:void 0,"aria-describedby":F?`${le}-error`:O?`${le}-hint`:void 0,"aria-busy":G||void 0,...ge.zoneProps,...pe?De:{},className:"relative rounded-lg transition-colors",style:{...se?{opacity:.6}:{},...Ne?{boxShadow:"0 0 0 2px var(--rosh-drop-ring)"}:{}},children:[0===p.length?Oe:/* @__PURE__ */v("div",{className:"flex flex-wrap gap-2",children:[Ce?
13
- /* @__PURE__ */x("div",{role:"listbox","aria-multiselectable":!!Ke||void 0,"aria-label":"string"==typeof A?A:te.files,className:"contents",children:p.map(Te)}):p.map(Te),Ae]}),G&&/* @__PURE__ */x(l,{label:ne,progress:U})]}),!k&&N&&/* @__PURE__ */x("input",{...ge.inputProps}),
10
+ /* @__PURE__ */x("span",{className:"text-sm font-medium text-blue-600",children:re}),Q&&/* @__PURE__ */x("span",{className:"text-xs text-ink-faintest",children:Q})]}):/* @__PURE__ */x("div",{className:"flex w-full items-center justify-center rounded-lg border border-line bg-surface-sunken px-3 text-xs text-ink-faintest",style:{minHeight:E+32},children:/* @__PURE__ */x("span",{className:B?"invisible":void 0,children:te.empty})});/* @__PURE__ */
11
+ return v(e,{label:I,labelId:I?`${le}-label`:void 0,htmlFor:le,hint:O,error:F,required:S,className:L,children:[
12
+ /* @__PURE__ */v("div",{id:le,role:"group","aria-labelledby":I?`${le}-label`:void 0,"aria-describedby":F?`${le}-error`:O?`${le}-hint`:void 0,"aria-busy":B||void 0,...ge.zoneProps,...pe?De:{},className:"relative rounded-lg transition-colors",style:{...se?{opacity:.6}:{},...Ne?{boxShadow:"0 0 0 2px var(--rosh-drop-ring)"}:{}},children:[0===p.length?Oe:/* @__PURE__ */v("div",{className:"flex flex-wrap gap-2",children:[Ce?
13
+ /* @__PURE__ */x("div",{role:"listbox","aria-multiselectable":!!Ke||void 0,"aria-label":"string"==typeof I?I:te.files,className:"contents",children:p.map(Ae)}):p.map(Ae),Ie]}),B&&/* @__PURE__ */x(l,{label:ne,progress:G})]}),!k&&N&&/* @__PURE__ */x("input",{...ge.inputProps}),
14
14
  /* @__PURE__ */x(c,{rejections:ge.rejections})]})}export{k as FULL_BADGE_TILE_PX,N as MediaUploadGrid};
@@ -1,3 +1,3 @@
1
- import{ColoredBadge as e}from"./chunk-IL56C56I.js";import{Button_default as n}from"./chunk-EOVXFXVV.js";import{useShellStrings as i}from"./chunk-43MCNASD.js";import{useId as t}from"react";import{jsx as m,jsxs as a}from"react/jsx-runtime";function s({items:s,heading:l,emptyText:r,className:c=""}){const o=i().media,d=t();return s.length?/* @__PURE__ */a("div",{className:c||void 0,children:[
1
+ import{ColoredBadge as e}from"./chunk-5JUG74UR.js";import{Button_default as n}from"./chunk-UJJXWLHE.js";import{useShellStrings as i}from"./chunk-43MCNASD.js";import{useId as t}from"react";import{jsx as m,jsxs as a}from"react/jsx-runtime";function s({items:s,heading:l,emptyText:r,className:c=""}){const o=i().media,d=t();return s.length?/* @__PURE__ */a("div",{className:c||void 0,children:[
2
2
  /* @__PURE__ */m("p",{id:d,className:"text-xs font-medium text-ink-faint",children:l??o.usedIn(s.length)}),
3
3
  /* @__PURE__ */m("ul",{"aria-labelledby":d,className:"mt-2 flex flex-col gap-1",children:s.map(i=>/* @__PURE__ */a("li",{className:"flex min-w-0 items-center gap-2 text-sm",children:[null!=i.kind&&/* @__PURE__ */m(e,{size:"xs",className:"flex-none",children:i.kind}),i.onOpen?/* @__PURE__ */m(n,{variant:"link",size:"sm",onClick:i.onOpen,className:"min-w-0 text-left",children:i.name}):/* @__PURE__ */m("span",{className:"min-w-0 break-words text-ink",children:i.name})]},i.key))})]}):/* @__PURE__ */m("p",{className:`text-sm text-ink-faint ${c}`.trim(),children:r??o.notUsed})}export{s as MediaUsedInList};
@@ -1,10 +1,10 @@
1
- import{toast_default as e}from"./chunk-TRWHVG3A.js";import{Icon as t}from"./chunk-UIWGVOFH.js";import{LoadingSpinner as n}from"./chunk-R2VKEMZH.js";import{useShellStrings as r}from"./chunk-43MCNASD.js";import{createContext as a,useContext as o,useRef as i,useState as s,useEffect as l}from"react";import*as c from"pdfjs-dist";import{createPortal as d}from"react-dom";import{jsx as u,jsxs as m}from"react/jsx-runtime";function h(e,t,n){return new Error(`The response for ${e} is not a WebAssembly module (got ${function(e){if(0===e.length)return"an empty response";const t=Array.from(e.subarray(0,24)).map(e=>e>=32&&e<127?String.fromCharCode(e):".").join("");return`${e.length} bytes starting "${t}"`}(n)}). The bundler did not emit "${t}" as an asset, and the host answered with a fallback page instead of a 404. Serve pdfjs-dist/wasm/ yourself and point window.__REACT_OS_SHELL_PDF_WASM__ at it.`)}var p=a(null);function f({children:e}){const t=o(p);return t?d(e,t):
2
- /* @__PURE__ */u("div",{className:"flex shrink-0 flex-wrap items-center gap-1 border-b border-gray-200 bg-gray-50 px-3 py-2 text-xs",children:e})}"undefined"==typeof window||c.GlobalWorkerOptions.workerSrc||(c.GlobalWorkerOptions.workerSrc=`https://unpkg.com/pdfjs-dist@${c.version}/build/pdf.worker.min.mjs`);var g={"jbig2.wasm":new URL("pdfjs-dist/wasm/jbig2.wasm",import.meta.url).href,"openjpeg.wasm":new URL("pdfjs-dist/wasm/openjpeg.wasm",import.meta.url).href},w=class{async fetch({kind:e,filename:t}){if("wasmUrl"!==e)throw new Error(`Ensure that the \`${e}\` API parameter is provided.`);const n=g[t];if(!n)throw new Error(`No bundled pdf.js wasm module for "${t}".`);const r=await fetch(n);if(!r.ok)throw new Error(`Unable to load wasm data at: ${n}`);const a=new Uint8Array(await r.arrayBuffer());if(!function(e){return e.length>=4&&0===e[0]&&97===e[1]&&115===e[2]&&109===e[3]}(a))throw h(n,t,a);return a}};function y(e){const t=e||("undefined"!=typeof window?window.__REACT_OS_SHELL_PDF_WASM__:void 0);return"string"==typeof t&&t?{wasmUrl:t.endsWith("/")?t:`${t}/`}:{BinaryDataFactory:w}}var v=[50,75,100,125,150,200,300,400];function b(e,t,n){const r=(t.width-40)/n.width,a="page"===e?Math.min(r,(t.height-40)/n.height):r;return Math.min(Math.max(a,.3),4)}function x({url:a,filename:o,fit:d="width",onDownload:h,onEmail:p,workerSrc:g,wasmUrl:w}){const x=r().pdf,k=i(null),C=i(null),N=i(null),[M,j]=s(null),[E,z]=s(1),[W,_]=s(0),[D,P]=s(1),[S,A]=s(!0),[L,T]=s(!0),$=i(x.loadFailed);$.current=x.loadFailed,l(()=>{let t=!1;return T(!0),z(1),g&&(c.GlobalWorkerOptions.workerSrc=g),c.getDocument({url:a,...y(w)}).promise.then(e=>{t||(j(e),_(e.numPages),T(!1))}).catch(()=>{t||(e.error($.current),T(!1))}),()=>{t=!0}},[a,g,w]),l(()=>{if(!M||!S||!N.current)return;const e=()=>{const e=N.current;e&&M.getPage(E).then(t=>{if(!N.current)return;const n=t.getViewport({scale:1}),r=b(d,{width:e.clientWidth,height:e.clientHeight},{width:n.width,height:n.height});P(e=>Math.abs(e-r)<.005?e:r)})};e();const t=new ResizeObserver(e);return t.observe(N.current),()=>t.disconnect()},[M,E,S,d]),l(()=>{if(!M||!k.current)return;let e=!1,t=null,n=null;return M.getPage(E).then(r=>{if(e||!k.current)return;const a=r.getViewport({scale:D}),o=k.current;o.width=a.width,o.height=a.height,o.style.width=`${a.width}px`,o.style.height=`${a.height}px`;const i=o.getContext("2d");t=r.render({canvas:o,canvasContext:i,viewport:a}),t.promise.catch(()=>{});const s=C.current;s&&(s.replaceChildren(),s.style.setProperty("--total-scale-factor",String(a.scale)),n=new c.TextLayer({textContentSource:r.streamTextContent(),container:s,viewport:a}),n.render().then(()=>{if(e)return;const t=document.createElement("div");t.className="endOfContent",s.append(t)}).catch(()=>{}))}),()=>{e=!0,t?.cancel(),n?.cancel()}},[M,E,D]),l(()=>{const e=()=>C.current?.classList.remove("selecting");return window.addEventListener("pointerup",e),()=>window.removeEventListener("pointerup",e)},[]);const O="page"===d?x.fitPage:x.fitWidth,H="px-2 py-1 rounded hover:bg-gray-200 transition-colors text-gray-600 flex items-center gap-1";/* @__PURE__ */
1
+ import{Icon as e}from"./chunk-UIWGVOFH.js";import{LoadingSpinner as t}from"./chunk-R2VKEMZH.js";import{toast_default as n}from"./chunk-TRWHVG3A.js";import{useShellStrings as r}from"./chunk-43MCNASD.js";import{createContext as a,useContext as o,useRef as i,useState as s,useEffect as l}from"react";import*as c from"pdfjs-dist";import{createPortal as d}from"react-dom";import{jsx as u,jsxs as m}from"react/jsx-runtime";function h(e,t,n){return new Error(`The response for ${e} is not a WebAssembly module (got ${function(e){if(0===e.length)return"an empty response";const t=Array.from(e.subarray(0,24)).map(e=>e>=32&&e<127?String.fromCharCode(e):".").join("");return`${e.length} bytes starting "${t}"`}(n)}). The bundler did not emit "${t}" as an asset, and the host answered with a fallback page instead of a 404. Serve pdfjs-dist/wasm/ yourself and point window.__REACT_OS_SHELL_PDF_WASM__ at it.`)}var p=a(null);function f({children:e}){const t=o(p);return t?d(e,t):
2
+ /* @__PURE__ */u("div",{className:"flex shrink-0 flex-wrap items-center gap-1 border-b border-gray-200 bg-gray-50 px-3 py-2 text-xs",children:e})}"undefined"==typeof window||c.GlobalWorkerOptions.workerSrc||(c.GlobalWorkerOptions.workerSrc=`https://unpkg.com/pdfjs-dist@${c.version}/build/pdf.worker.min.mjs`);var g={"jbig2.wasm":new URL("pdfjs-dist/wasm/jbig2.wasm",import.meta.url).href,"openjpeg.wasm":new URL("pdfjs-dist/wasm/openjpeg.wasm",import.meta.url).href},w=class{async fetch({kind:e,filename:t}){if("wasmUrl"!==e)throw new Error(`Ensure that the \`${e}\` API parameter is provided.`);const n=g[t];if(!n)throw new Error(`No bundled pdf.js wasm module for "${t}".`);const r=await fetch(n);if(!r.ok)throw new Error(`Unable to load wasm data at: ${n}`);const a=new Uint8Array(await r.arrayBuffer());if(!function(e){return e.length>=4&&0===e[0]&&97===e[1]&&115===e[2]&&109===e[3]}(a))throw h(n,t,a);return a}};function y(e){const t=e||("undefined"!=typeof window?window.__REACT_OS_SHELL_PDF_WASM__:void 0);return"string"==typeof t&&t?{wasmUrl:t.endsWith("/")?t:`${t}/`}:{BinaryDataFactory:w}}var v=[50,75,100,125,150,200,300,400];function b(e,t,n){const r=(t.width-40)/n.width,a="page"===e?Math.min(r,(t.height-40)/n.height):r;return Math.min(Math.max(a,.3),4)}function x({url:a,filename:o,fit:d="width",onDownload:h,onEmail:p,workerSrc:g,wasmUrl:w}){const x=r().pdf,k=i(null),C=i(null),N=i(null),[M,j]=s(null),[E,z]=s(1),[W,_]=s(0),[D,P]=s(1),[S,A]=s(!0),[L,T]=s(!0),$=i(x.loadFailed);$.current=x.loadFailed,l(()=>{let e=!1;return T(!0),z(1),g&&(c.GlobalWorkerOptions.workerSrc=g),c.getDocument({url:a,...y(w)}).promise.then(t=>{e||(j(t),_(t.numPages),T(!1))}).catch(()=>{e||(n.error($.current),T(!1))}),()=>{e=!0}},[a,g,w]),l(()=>{if(!M||!S||!N.current)return;const e=()=>{const e=N.current;e&&M.getPage(E).then(t=>{if(!N.current)return;const n=t.getViewport({scale:1}),r=b(d,{width:e.clientWidth,height:e.clientHeight},{width:n.width,height:n.height});P(e=>Math.abs(e-r)<.005?e:r)})};e();const t=new ResizeObserver(e);return t.observe(N.current),()=>t.disconnect()},[M,E,S,d]),l(()=>{if(!M||!k.current)return;let e=!1,t=null,n=null;return M.getPage(E).then(r=>{if(e||!k.current)return;const a=r.getViewport({scale:D}),o=k.current;o.width=a.width,o.height=a.height,o.style.width=`${a.width}px`,o.style.height=`${a.height}px`;const i=o.getContext("2d");t=r.render({canvas:o,canvasContext:i,viewport:a}),t.promise.catch(()=>{});const s=C.current;s&&(s.replaceChildren(),s.style.setProperty("--total-scale-factor",String(a.scale)),n=new c.TextLayer({textContentSource:r.streamTextContent(),container:s,viewport:a}),n.render().then(()=>{if(e)return;const t=document.createElement("div");t.className="endOfContent",s.append(t)}).catch(()=>{}))}),()=>{e=!0,t?.cancel(),n?.cancel()}},[M,E,D]),l(()=>{const e=()=>C.current?.classList.remove("selecting");return window.addEventListener("pointerup",e),()=>window.removeEventListener("pointerup",e)},[]);const O="page"===d?x.fitPage:x.fitWidth,H="px-2 py-1 rounded hover:bg-gray-200 transition-colors text-gray-600 flex items-center gap-1";/* @__PURE__ */
3
3
  return m("div",{className:"flex flex-col h-full",children:[
4
4
  /* @__PURE__ */m(f,{children:[
5
- /* @__PURE__ */u("button",{type:"button","aria-label":x.previousPage,onClick:()=>z(e=>Math.max(1,e-1)),disabled:E<=1,className:"px-1 py-1 rounded hover:bg-gray-200 disabled:opacity-30 text-gray-600",children:/* @__PURE__ */u(t,{name:"chevron-left",className:"h-3.5 w-3.5",strokeWidth:2})}),
5
+ /* @__PURE__ */u("button",{type:"button","aria-label":x.previousPage,onClick:()=>z(e=>Math.max(1,e-1)),disabled:E<=1,className:"px-1 py-1 rounded hover:bg-gray-200 disabled:opacity-30 text-gray-600",children:/* @__PURE__ */u(e,{name:"chevron-left",className:"h-3.5 w-3.5",strokeWidth:2})}),
6
6
  /* @__PURE__ */u("span",{className:"text-gray-600 font-medium tabular-nums whitespace-nowrap",children:x.pageOf(E,W)}),
7
- /* @__PURE__ */u("button",{type:"button","aria-label":x.nextPage,onClick:()=>z(e=>Math.min(W,e+1)),disabled:E>=W,className:"px-1 py-1 rounded hover:bg-gray-200 disabled:opacity-30 text-gray-600",children:/* @__PURE__ */u(t,{name:"chevron-right",className:"h-3.5 w-3.5",strokeWidth:2})}),
7
+ /* @__PURE__ */u("button",{type:"button","aria-label":x.nextPage,onClick:()=>z(e=>Math.min(W,e+1)),disabled:E>=W,className:"px-1 py-1 rounded hover:bg-gray-200 disabled:opacity-30 text-gray-600",children:/* @__PURE__ */u(e,{name:"chevron-right",className:"h-3.5 w-3.5",strokeWidth:2})}),
8
8
  /* @__PURE__ */u("div",{className:"h-4 w-px bg-gray-300 mx-1"}),
9
9
  /* @__PURE__ */u("button",{type:"button","aria-label":x.zoomOut,title:x.zoomOut,onClick:()=>{A(!1),P(e=>Math.max(.3,Math.round(100*(e-.25))/100))},className:H,children:/* @__PURE__ */u("span",{"aria-hidden":"true",children:"−"})}),
10
10
  /* @__PURE__ */m("select",{value:S?"fit":v.includes(Math.round(100*D))?Math.round(100*D):"custom",onChange:e=>{const t=e.target.value;"fit"!==t?"custom"!==t&&(A(!1),P(Number(t)/100)):A(!0)},className:"bg-transparent hover:bg-gray-200 rounded px-1 py-1 text-gray-600 tabular-nums cursor-pointer focus:outline-none focus:ring-1 focus:ring-blue-400","aria-label":x.zoom,title:x.zoom,children:[
@@ -12,12 +12,12 @@ return m("div",{className:"flex flex-col h-full",children:[
12
12
  /* @__PURE__ */u("button",{type:"button","aria-label":x.zoomIn,title:x.zoomIn,onClick:()=>{A(!1),P(e=>Math.min(4,Math.round(100*(e+.25))/100))},className:H,children:/* @__PURE__ */u("span",{"aria-hidden":"true",children:"+"})}),
13
13
  /* @__PURE__ */u("button",{type:"button",onClick:()=>A(!0),"aria-pressed":S,className:H+(S?" bg-gray-200 text-gray-900":""),title:x.fitHint,children:x.fit}),
14
14
  /* @__PURE__ */u("div",{className:"h-4 w-px bg-gray-300 mx-1"}),
15
- /* @__PURE__ */m("button",{type:"button",onClick:()=>{if(!M)return;const t=window.open("","_blank");if(!t)return void e.error(x.allowPopups);const n=[];for(let e=1;e<=W;e++)n.push(M.getPage(e).then(e=>{const t=e.getViewport({scale:2}),n=document.createElement("canvas");return n.width=t.width,n.height=t.height,e.render({canvas:n,canvasContext:n.getContext("2d"),viewport:t}).promise.then(()=>n.toDataURL())}));Promise.all(n).then(e=>{var n;t.document.write(`<html><head><title>${n=o,n.replace(/[&<>"]/g,e=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;"}[e]))}</title><style>@media print{body{margin:0}img{width:100%;page-break-after:always}}</style></head><body>`),t.document.write(e.map(e=>`<img src="${e}"/>`).join("")),t.document.write("</body></html>"),t.document.close(),setTimeout(()=>{t.print(),t.close()},300)})},className:H,children:[
16
- /* @__PURE__ */u(t,{name:"print",className:"h-3.5 w-3.5",strokeWidth:1.5}),x.print]}),
15
+ /* @__PURE__ */m("button",{type:"button",onClick:()=>{if(!M)return;const e=window.open("","_blank");if(!e)return void n.error(x.allowPopups);const t=[];for(let e=1;e<=W;e++)t.push(M.getPage(e).then(e=>{const t=e.getViewport({scale:2}),n=document.createElement("canvas");return n.width=t.width,n.height=t.height,e.render({canvas:n,canvasContext:n.getContext("2d"),viewport:t}).promise.then(()=>n.toDataURL())}));Promise.all(t).then(t=>{var n;e.document.write(`<html><head><title>${n=o,n.replace(/[&<>"]/g,e=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;"}[e]))}</title><style>@media print{body{margin:0}img{width:100%;page-break-after:always}}</style></head><body>`),e.document.write(t.map(e=>`<img src="${e}"/>`).join("")),e.document.write("</body></html>"),e.document.close(),setTimeout(()=>{e.print(),e.close()},300)})},className:H,children:[
16
+ /* @__PURE__ */u(e,{name:"print",className:"h-3.5 w-3.5",strokeWidth:1.5}),x.print]}),
17
17
  /* @__PURE__ */m("button",{type:"button",onClick:h??(()=>{const e=document.createElement("a");e.href=a,e.download=o,e.click()}),className:H,children:[
18
- /* @__PURE__ */u(t,{name:"download",className:"h-3.5 w-3.5",strokeWidth:1.5}),x.download]}),p&&/* @__PURE__ */m("button",{type:"button",onClick:p,className:H,children:[
19
- /* @__PURE__ */u(t,{name:"email",className:"h-3.5 w-3.5",strokeWidth:1.5}),x.email]})]}),
20
- /* @__PURE__ */u("div",{ref:N,className:"flex-1 overflow-auto bg-gray-100 outline-none",tabIndex:0,onWheel:e=>{if(!M)return;if(e.ctrlKey||e.metaKey)return;const t=N.current;if(!t)return;const n=t.scrollTop<=0,r=t.scrollTop+t.clientHeight>=t.scrollHeight-1;e.deltaY>0&&r&&E<W?(e.preventDefault(),z(e=>Math.min(W,e+1)),requestAnimationFrame(()=>{N.current&&(N.current.scrollTop=0)})):e.deltaY<0&&n&&E>1&&(e.preventDefault(),z(e=>Math.max(1,e-1)),requestAnimationFrame(()=>{N.current&&(N.current.scrollTop=N.current.scrollHeight)}))},onKeyDown:e=>{if(!M)return;const t=(document.activeElement?.tagName||"").toLowerCase();"input"===t||"textarea"===t||document.activeElement?.isContentEditable||("PageDown"===e.key||"ArrowRight"===e.key?E<W&&(e.preventDefault(),z(e=>Math.min(W,e+1))):"PageUp"===e.key||"ArrowLeft"===e.key?E>1&&(e.preventDefault(),z(e=>Math.max(1,e-1))):"Home"===e.key?(e.preventDefault(),z(1)):"End"===e.key&&(e.preventDefault(),z(W)))},children:L?/* @__PURE__ */u(n,{size:"sm",padding:"",className:"h-full",label:x.loading}):/* @__PURE__ */m("div",{className:"min-h-full flex items-center justify-center p-4",children:[
18
+ /* @__PURE__ */u(e,{name:"download",className:"h-3.5 w-3.5",strokeWidth:1.5}),x.download]}),p&&/* @__PURE__ */m("button",{type:"button",onClick:p,className:H,children:[
19
+ /* @__PURE__ */u(e,{name:"email",className:"h-3.5 w-3.5",strokeWidth:1.5}),x.email]})]}),
20
+ /* @__PURE__ */u("div",{ref:N,className:"flex-1 overflow-auto bg-gray-100 outline-none",tabIndex:0,onWheel:e=>{if(!M)return;if(e.ctrlKey||e.metaKey)return;const t=N.current;if(!t)return;const n=t.scrollTop<=0,r=t.scrollTop+t.clientHeight>=t.scrollHeight-1;e.deltaY>0&&r&&E<W?(e.preventDefault(),z(e=>Math.min(W,e+1)),requestAnimationFrame(()=>{N.current&&(N.current.scrollTop=0)})):e.deltaY<0&&n&&E>1&&(e.preventDefault(),z(e=>Math.max(1,e-1)),requestAnimationFrame(()=>{N.current&&(N.current.scrollTop=N.current.scrollHeight)}))},onKeyDown:e=>{if(!M)return;const t=(document.activeElement?.tagName||"").toLowerCase();"input"===t||"textarea"===t||document.activeElement?.isContentEditable||("PageDown"===e.key||"ArrowRight"===e.key?E<W&&(e.preventDefault(),z(e=>Math.min(W,e+1))):"PageUp"===e.key||"ArrowLeft"===e.key?E>1&&(e.preventDefault(),z(e=>Math.max(1,e-1))):"Home"===e.key?(e.preventDefault(),z(1)):"End"===e.key&&(e.preventDefault(),z(W)))},children:L?/* @__PURE__ */u(t,{size:"sm",padding:"",className:"h-full",label:x.loading}):/* @__PURE__ */m("div",{className:"min-h-full flex items-center justify-center p-4",children:[
21
21
  /* @__PURE__ */u("style",{children:'\n.preview-pdf-textlayer {\n position: absolute;\n inset: 0;\n overflow: clip;\n line-height: 1;\n text-align: initial;\n text-size-adjust: none;\n forced-color-adjust: none;\n transform-origin: 0 0;\n caret-color: CanvasText;\n --min-font-size: 1;\n --text-scale-factor: calc(var(--total-scale-factor, 1) * var(--min-font-size));\n --min-font-size-inv: calc(1 / var(--min-font-size));\n}\n.preview-pdf-textlayer :is(span, br) {\n color: transparent;\n position: absolute;\n white-space: pre;\n cursor: text;\n transform-origin: 0% 0%;\n}\n.preview-pdf-textlayer > :not(.markedContent),\n.preview-pdf-textlayer .markedContent span:not(.markedContent) {\n z-index: 1;\n --font-height: 0;\n font-size: calc(var(--text-scale-factor) * var(--font-height));\n --scale-x: 1;\n --rotate: 0deg;\n transform: rotate(var(--rotate)) scaleX(var(--scale-x)) scale(var(--min-font-size-inv));\n}\n.preview-pdf-textlayer .markedContent {\n display: contents;\n}\n.preview-pdf-textlayer span[role="img"] {\n user-select: none;\n cursor: default;\n}\n.preview-pdf-textlayer ::selection {\n background: rgba(0, 80, 255, 0.25);\n}\n.preview-pdf-textlayer br::selection {\n background: transparent;\n}\n.preview-pdf-textlayer .endOfContent {\n display: block;\n position: absolute;\n inset: 100% 0 0;\n z-index: 0;\n cursor: default;\n user-select: none;\n}\n.preview-pdf-textlayer.selecting .endOfContent {\n top: 0;\n}\n'}),
22
22
  /* @__PURE__ */m("div",{className:"relative shadow-lg rounded",children:[
23
23
  /* @__PURE__ */u("canvas",{ref:k,className:"block rounded"}),
@@ -1,4 +1,4 @@
1
- import{TH_ONE_LINE as r}from"./chunk-WGLHB6WE.js";import{jsxs as e,jsx as c}from"react/jsx-runtime";function n({caption:n,head:t,rows:i}){/* @__PURE__ */
1
+ import{TH_ONE_LINE as r}from"./chunk-CJH2BGXY.js";import{jsxs as e,jsx as c}from"react/jsx-runtime";function n({caption:n,head:t,rows:i}){/* @__PURE__ */
2
2
  return e("table",{className:"sr-only",children:[
3
3
  /* @__PURE__ */c("caption",{children:n}),
4
4
  /* @__PURE__ */c("thead",{children:/* @__PURE__ */c("tr",{children:t.map(e=>/* @__PURE__ */c("th",{className:r,scope:"col",children:e},e))})}),
@@ -1,5 +1,5 @@
1
- import{OneLineLabel as e}from"./chunk-WGLHB6WE.js";import{swallowPress as i,describedByWith as r,OffWithReason as a}from"./chunk-TE6R53YD.js";import{Icon as o}from"./chunk-UIWGVOFH.js";import{Tooltip as s}from"./chunk-NJN5IKWO.js";import{useShellStrings as n}from"./chunk-43MCNASD.js";import{useId as l,Fragment as d}from"react";import{jsx as t,jsxs as c}from"react/jsx-runtime";function b({items:b,onChange:h,label:m,className:u="","aria-labelledby":f,"aria-describedby":p}){const w=n().displayChips,g=l();/* @__PURE__ */
2
- return t("div",{role:"group","aria-label":f?void 0:m,"aria-labelledby":f,"aria-describedby":p,className:`flex flex-wrap gap-2 ${u}`.trim(),children:b.map((n,l)=>{const b=`${g}-${l}-state`,m=`${g}-${l}-reason`,u=Boolean(n.disabled)&&null!=n.disabledReason&&""!==n.disabledReason,f=/* @__PURE__ */c("button",{type:"button","aria-pressed":n.shown,disabled:!(!n.disabled||u)||void 0,"aria-disabled":!!u||void 0,"aria-describedby":r(b,u?m:void 0),onClick:u?i:()=>h(n.id,!n.shown),className:"inline-flex h-6 max-w-full shrink-0 items-center gap-1 whitespace-nowrap rounded-full border pl-2 pr-3 text-xs font-medium transition-colors rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring)] disabled:cursor-not-allowed disabled:opacity-60 aria-disabled:cursor-not-allowed aria-disabled:opacity-60 "+(n.shown?"border-blue-200 bg-accent-tint text-blue-700 hover:bg-blue-100":"border-line bg-surface text-ink-faint hover:bg-row-hover hover:text-ink-strongest"),children:[
3
- /* @__PURE__ */t(o,{name:n.shown?"eye":"eye-off",className:"h-4 w-4 shrink-0",strokeWidth:"1.75"}),
4
- /* @__PURE__ */t(e,{children:n.label})]}),p=/* @__PURE__ */t("span",{id:b,className:"sr-only",children:n.shown?w.shown:w.hidden});/* @__PURE__ */
5
- return c(d,{children:[u?/* @__PURE__ */t(a,{reason:n.disabledReason,id:m,children:f}):/* @__PURE__ */t(s,{content:n.shown?w.shownHint:w.hiddenHint,describe:!1,className:"relative inline-flex max-w-full",children:f}),p]},n.id)})})}export{b as DisplayChips};
1
+ import{swallowPress as e,describedByWith as i,OffWithReason as r}from"./chunk-XWFLIGDQ.js";import{Icon as a}from"./chunk-UIWGVOFH.js";import{OneLineLabel as o}from"./chunk-CJH2BGXY.js";import{Tooltip as s}from"./chunk-QQ2LDC6C.js";import{useShellStrings as n}from"./chunk-43MCNASD.js";import{useId as l,Fragment as d}from"react";import{jsx as t,jsxs as c}from"react/jsx-runtime";function b({items:b,onChange:h,label:m,className:u="","aria-labelledby":f,"aria-describedby":p}){const w=n().displayChips,g=l();/* @__PURE__ */
2
+ return t("div",{role:"group","aria-label":f?void 0:m,"aria-labelledby":f,"aria-describedby":p,className:`flex flex-wrap gap-2 ${u}`.trim(),children:b.map((n,l)=>{const b=`${g}-${l}-state`,m=`${g}-${l}-reason`,u=Boolean(n.disabled)&&null!=n.disabledReason&&""!==n.disabledReason,f=/* @__PURE__ */c("button",{type:"button","aria-pressed":n.shown,disabled:!(!n.disabled||u)||void 0,"aria-disabled":!!u||void 0,"aria-describedby":i(b,u?m:void 0),onClick:u?e:()=>h(n.id,!n.shown),className:"inline-flex h-6 max-w-full shrink-0 items-center gap-1 whitespace-nowrap rounded-full border pl-2 pr-3 text-xs font-medium transition-colors rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring)] disabled:cursor-not-allowed disabled:opacity-60 aria-disabled:cursor-not-allowed aria-disabled:opacity-60 "+(n.shown?"border-blue-200 bg-accent-tint text-blue-700 hover:bg-blue-100":"border-line bg-surface text-ink-faint hover:bg-row-hover hover:text-ink-strongest"),children:[
3
+ /* @__PURE__ */t(a,{name:n.shown?"eye":"eye-off",className:"h-4 w-4 shrink-0",strokeWidth:"1.75"}),
4
+ /* @__PURE__ */t(o,{children:n.label})]}),p=/* @__PURE__ */t("span",{id:b,className:"sr-only",children:n.shown?w.shown:w.hidden});/* @__PURE__ */
5
+ return c(d,{children:[u?/* @__PURE__ */t(r,{reason:n.disabledReason,id:m,children:f}):/* @__PURE__ */t(s,{content:n.shown?w.shownHint:w.hiddenHint,describe:!1,className:"relative inline-flex max-w-full",children:f}),p]},n.id)})})}export{b as DisplayChips};
@@ -0,0 +1,69 @@
1
+ import{toast_default as e}from"./chunk-TRWHVG3A.js";import{useShellStrings as t}from"./chunk-43MCNASD.js";import{forwardRef as r,useRef as n,useState as o,useMemo as i,useEffect as a,useImperativeHandle as l}from"react";import{jsx as s,jsxs as c,Fragment as d}from"react/jsx-runtime";var h=["#ef4444","#f97316","#eab308","#22c55e","#3b82f6","#8b5cf6","#000000","#ffffff"],u=[{id:"system",name:"fontSystem",css:"-apple-system, system-ui, sans-serif"},{id:"serif",name:"fontSerif",css:'Georgia, "Times New Roman", serif'},{id:"mono",name:"fontMono",css:'ui-monospace, "SF Mono", Menlo, monospace'},{id:"cursive",name:"fontCursive",css:'"Brush Script MT", "Comic Sans MS", cursive'}],p=()=>Math.random().toString(36).slice(2,9),y=r(function({src:r,filename:y,onApply:m,onCancel:g},N){const L=n(null),z=n(null),D=n(null),P=n(null),$=t().annotator,E=n($);E.current=$;const[I,S]=o("select"),[W,B]=o(h[0]),[R,j]=o(4),[H,T]=o(24),[F,A]=o(u[0].id),[U,O]=o(!0),[K,V]=o(!1),[Z,G]=o(!1),[X,q]=o(null),[Y,_]=o(null),[J,Q]=o(6),[ee,te]=o(12),[re,ne]=o([]),[oe,ie]=o(null),[ae,le]=o(null),[se,ce]=o(null),[de,he]=o(1),[ue,pe]=o(null),[ye,xe]=o(null),[me,ge]=o(null),we=n(null),[fe,ve]=o(!1),be=i(()=>se?{w:se.w*de,h:se.h*de}:null,[se,de]),ke=be&&ae?be.w/ae.w:1,Me=i(()=>re.find(e=>e.id===oe)??null,[re,oe]);a(()=>{"select"===I&&Me&&("color"in Me&&B(Me.color),"stroke"in Me&&j(Me.stroke),"rect"===Me.type&&te(Me.radius),"text"===Me.type&&(T(Me.size),A(Me.font),O(Me.bold),V(Me.italic),G(Me.underline),q(Me.borderColor),_(Me.background),Q(Me.padding)))},[oe]),a(()=>{const t=new Image;t.crossOrigin="anonymous",t.onload=()=>{P.current=t,le({w:t.naturalWidth,h:t.naturalHeight}),ne([]),ie(null)},t.onerror=()=>e.error(E.current.loadFailed),t.src=r},[r]),a(()=>{if(!ae)return;const e=()=>{const e=L.current;if(!e)return;const t=e.getBoundingClientRect(),r=Math.max(0,t.width-32),n=Math.max(0,t.height-32);if(0===r||0===n)return;const o=ae.w/ae.h;let i=ae.w,a=ae.h;i>r&&(i=r,a=i/o),a>n&&(a=n,i=a*o),ce({w:i,h:a})};e();const t=new ResizeObserver(e);return L.current&&t.observe(L.current),()=>t.disconnect()},[ae]);const Ne=i(()=>re.filter(e=>"mosaic"===e.type),[re]);a(()=>{const e=P.current,t=z.current;if(!e||!t||!ae)return;t.width=ae.w,t.height=ae.h;const r=t.getContext("2d");r.drawImage(e,0,0);for(const e of Ne)C(r,e)},[ae,Ne,se]);const Ce=e=>{const t=D.current;if(!t)return{x:0,y:0};const r=t.createSVGPoint();r.x=e.clientX,r.y=e.clientY;const n=t.getScreenCTM();if(!n)return{x:0,y:0};const o=r.matrixTransform(n.inverse());return{x:o.x,y:o.y}},Le=e=>{we.current=e,ve(!0)};a(()=>{if(!fe)return;const e=e=>{const t=we.current;if(!t)return;const r=Ce(e);if("draw"===t.kind)pe(v(I,t.start,r,W,R,ee));else if("pen"===t.kind){const e=t.points[t.points.length-1];(Math.abs(r.x-e.x)>1||Math.abs(r.y-e.y)>1)&&(t.points.push(r),pe({id:"",type:"draw",points:t.points.slice(),color:W,stroke:R}))}else if("crop"===t.kind)ge(M(t.start,r));else if("move"===t.kind){const e=r.x-t.start.x,n=r.y-t.start.y;ne(r=>r.map(r=>r.id===t.id?b(t.original,e,n):r))}else"resize"===t.kind&&ne(e=>e.map(e=>e.id===t.id?function(e,t,r){if("arrow"===e.type)return"start"===t?{...e,x1:r.x,y1:r.y}:"end"===t?{...e,x2:r.x,y2:r.y}:e;if("text"===e.type||"draw"===e.type)return e;const n=e.x,o=e.x+e.w,i=e.y,a=e.y+e.h;let l=n,s=i,c=o,d=a;"nw"===t&&(l=r.x,s=r.y);"ne"===t&&(c=r.x,s=r.y);"se"===t&&(c=r.x,d=r.y);"sw"===t&&(l=r.x,d=r.y);const h=M({x:l,y:s},{x:c,y:d});return{...e,x:h.x,y:h.y,w:h.w,h:h.h}}(t.original,t.corner,r):e))},t=()=>{const e=we.current;if(we.current=null,ve(!1),"draw"===e?.kind)pe(e=>{if(!e||("arrow"===(t=e).type?Math.abs(t.x2-t.x1)<4&&Math.abs(t.y2-t.y1)<4:"draw"===t.type?t.points.length<2:"w"in t&&"h"in t&&(t.w<4||t.h<4)))return null;var t;const r={...e,id:p()};return ne(e=>[...e,r]),ie(r.id),S("select"),null});else if("pen"===e?.kind){if(e.points.length<2)return void pe(null);const t={id:p(),type:"draw",points:e.points,color:W,stroke:R};ne(e=>[...e,t]),ie(t.id),S("select"),pe(null)}};return window.addEventListener("pointermove",e),window.addEventListener("pointerup",t),window.addEventListener("pointercancel",t),()=>{window.removeEventListener("pointermove",e),window.removeEventListener("pointerup",t),window.removeEventListener("pointercancel",t)}},[fe,I,W,R,ee]);a(()=>{const e=e=>{if(!document.activeElement||!/^(INPUT|TEXTAREA)$/.test(document.activeElement.tagName))return!e.metaKey&&!e.ctrlKey||"z"!==e.key&&"Z"!==e.key||e.shiftKey?void(oe&&("Delete"===e.key||"Backspace"===e.key?(e.preventDefault(),ne(e=>e.filter(e=>e.id!==oe)),ie(null)):"Escape"===e.key&&ie(null))):(e.preventDefault(),ne(e=>e.slice(0,-1)),void ie(null))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[oe]);const ze=e=>{const t=!{bold:U,italic:K,underline:Z}[e];"bold"===e&&O(t),"italic"===e&&V(t),"underline"===e&&G(t),oe&&ne(r=>r.map(r=>r.id===oe&&"text"===r.type?{...r,[e]:t}:r))},De=e=>{q(e),oe&&ne(t=>t.map(t=>t.id===oe&&"text"===t.type?{...t,borderColor:e}:t))},Pe=e=>{_(e),oe&&ne(t=>t.map(t=>t.id===oe&&"text"===t.type?{...t,background:e}:t))},$e=e=>{if(!ye)return;const t=e??ye.value;if(!t.trim())return ye.editingId&&ne(e=>e.filter(e=>e.id!==ye.editingId)),void xe(null);if(ye.editingId)ne(e=>e.map(e=>e.id===ye.editingId&&"text"===e.type?{...e,text:t}:e));else{const e={id:p(),type:"text",x:ye.x,y:ye.y,text:t,color:W,size:H,font:F,bold:U,italic:K,underline:Z,borderColor:X,background:Y,padding:J};ne(t=>[...t,e]),ie(e.id),S("select")}xe(null)},Ee=async()=>{const e=z.current,t=D.current;if(!e||!t||!ae)return null;const r=document.createElement("canvas");r.width=ae.w,r.height=ae.h;const n=r.getContext("2d");n.drawImage(e,0,0);const o=t.cloneNode(!0);o.querySelectorAll("[data-chrome]").forEach(e=>e.remove());const i=(new XMLSerializer).serializeToString(o),a=new Blob([i],{type:"image/svg+xml;charset=utf-8"}),l=URL.createObjectURL(a),s=new Image;return await new Promise(e=>{s.onload=()=>e(),s.onerror=()=>e(),s.src=l}),n.drawImage(s,0,0,ae.w,ae.h),URL.revokeObjectURL(l),r};l(N,()=>({save:async()=>{const t=await Ee();t&&t.toBlob(t=>{if(!t)return void e.error(E.current.exportFailed);const r=URL.createObjectURL(t),n=document.createElement("a");n.href=r;const o=y.replace(/\.[^.]+$/,"");n.download=`${o}-annotated.png`,n.click(),URL.revokeObjectURL(r)},"image/png")},copy:async()=>{if(!("clipboard"in navigator)||"undefined"==typeof ClipboardItem)return void e.error(E.current.clipboardUnsupported);const t=await Ee();t&&t.toBlob(async t=>{if(t)try{await navigator.clipboard.write([new ClipboardItem({"image/png":t})]),e.success(E.current.copied)}catch{e.error(E.current.copyRefused)}else e.error(E.current.copyFailed)},"image/png")}}),[ae,y]);const Ie=i(()=>[{id:"select",label:$.toolSelect,icon:/* @__PURE__ */s("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */s("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 3l7 17 2-7 7-2L5 3z"})})},{id:"draw",label:$.toolDraw,icon:/* @__PURE__ */s("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */s("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.862 4.487l1.687-1.688a1.875 1.875 0 112.652 2.652L6.832 19.82a4.5 4.5 0 01-1.897 1.13l-2.685.8.8-2.685a4.5 4.5 0 011.13-1.897L16.863 4.487z"})})},{id:"rect",label:$.toolRect,icon:/* @__PURE__ */s("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */s("rect",{x:"4",y:"6",width:"16",height:"12",rx:"3"})})},{id:"circle",label:$.toolEllipse,icon:/* @__PURE__ */s("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */s("ellipse",{cx:"12",cy:"12",rx:"8",ry:"6"})})},{id:"arrow",label:$.toolArrow,icon:/* @__PURE__ */s("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */s("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 19L19 5m0 0h-7m7 0v7"})})},{id:"mosaic",label:$.toolMosaic,icon:/* @__PURE__ */s("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */s("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4h6v6H4zM14 4h6v6h-6zM4 14h6v6H4zM14 14h6v6h-6z"})})},{id:"text",label:$.toolText,icon:/* @__PURE__ */s("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */s("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 6h16M12 6v14M9 20h6"})})},{id:"crop",label:$.toolCrop,icon:/* @__PURE__ */s("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */s("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 2v15a1 1 0 001 1h15M2 6h15a1 1 0 011 1v15"})})}],[$]),Se=e=>"p-2 rounded transition-colors "+(e?"bg-blue-500 text-on-accent":"text-ink hover:bg-gray-200"),We=Me?.type??("select"===I?null:I),Be="rect"===We||"circle"===We||"arrow"===We||"draw"===We,Re="rect"===We,je="text"===We;/* @__PURE__ */
2
+ return c("div",{className:"flex flex-col h-full bg-gray-100",children:[
3
+ /* @__PURE__ */c("div",{className:"flex items-center gap-2 px-3 py-2 border-b border-line bg-surface shrink-0 flex-wrap text-xs",children:[Ie.map(e=>/* @__PURE__ */s("button",{onClick:()=>{S(e.id),ie(null)},title:e.label,className:Se(I===e.id),children:e.icon},e.id)),
4
+ /* @__PURE__ */s("div",{className:"h-5 w-px bg-gray-300 mx-1"}),
5
+ /* @__PURE__ */s("div",{className:"flex items-center gap-1",children:h.map(e=>/* @__PURE__ */s("button",{onClick:()=>(e=>{B(e),oe&&ne(t=>t.map(t=>t.id!==oe||"mosaic"===t.type?t:{...t,color:e}))})(e),title:e,className:"h-5 w-5 rounded-full border "+(W===e?"ring-2 ring-blue-500 ring-offset-1":"border-gray-300"),style:{background:e}},e))}),Be&&/* @__PURE__ */c(d,{children:[
6
+ /* @__PURE__ */s("div",{className:"h-5 w-px bg-gray-300 mx-1"}),
7
+ /* @__PURE__ */c("label",{className:"flex items-center gap-2 text-gray-600",children:[
8
+ /* @__PURE__ */s("span",{children:$.weight}),
9
+ /* @__PURE__ */s("input",{type:"range",min:1,max:20,step:1,value:R,onChange:e=>{return t=Number(e.target.value),j(t),void(oe&&ne(e=>e.map(e=>e.id!==oe?e:"rect"===e.type||"circle"===e.type||"arrow"===e.type||"draw"===e.type?{...e,stroke:t}:e)));var t},className:"w-16 accent-blue-500"}),
10
+ /* @__PURE__ */s("span",{className:"tabular-nums w-5 text-right",children:R})]})]}),Re&&/* @__PURE__ */c(d,{children:[
11
+ /* @__PURE__ */s("div",{className:"h-5 w-px bg-gray-300 mx-1"}),
12
+ /* @__PURE__ */c("label",{className:"flex items-center gap-2 text-gray-600",children:[
13
+ /* @__PURE__ */s("span",{children:$.radius}),
14
+ /* @__PURE__ */s("input",{type:"range",min:0,max:48,step:1,value:ee,onChange:e=>{return t=Number(e.target.value),te(t),void(oe&&ne(e=>e.map(e=>e.id===oe&&"rect"===e.type?{...e,radius:t}:e)));var t},className:"w-16 accent-blue-500"}),
15
+ /* @__PURE__ */s("span",{className:"tabular-nums w-6 text-right",children:ee})]})]}),je&&/* @__PURE__ */c(d,{children:[
16
+ /* @__PURE__ */s("div",{className:"h-5 w-px bg-gray-300 mx-1"}),
17
+ /* @__PURE__ */s("select",{value:F,onChange:e=>{return t=e.target.value,A(t),void(oe&&ne(e=>e.map(e=>e.id===oe&&"text"===e.type?{...e,font:t}:e)));var t},className:"text-xs border border-gray-300 rounded px-1 py-0.5 bg-white",children:u.map(e=>/* @__PURE__ */s("option",{value:e.id,children:$[e.name]},e.id))}),
18
+ /* @__PURE__ */s("button",{onClick:()=>ze("bold"),className:Se(U),title:$.bold,children:/* @__PURE__ */s("span",{className:"font-bold",children:$.boldLetter})}),
19
+ /* @__PURE__ */s("button",{onClick:()=>ze("italic"),className:Se(K),title:$.italic,children:/* @__PURE__ */s("span",{className:"italic",children:$.italicLetter})}),
20
+ /* @__PURE__ */s("button",{onClick:()=>ze("underline"),className:Se(Z),title:$.underline,children:/* @__PURE__ */s("span",{className:"underline",children:$.underlineLetter})}),
21
+ /* @__PURE__ */c("label",{className:"flex items-center gap-2 text-gray-600",children:[
22
+ /* @__PURE__ */s("span",{children:$.size}),
23
+ /* @__PURE__ */s("input",{type:"range",min:10,max:96,step:1,value:H,onChange:e=>{return t=Number(e.target.value),T(t),void(oe&&ne(e=>e.map(e=>e.id===oe&&"text"===e.type?{...e,size:t}:e)));var t},className:"w-16 accent-blue-500"}),
24
+ /* @__PURE__ */s("span",{className:"tabular-nums w-7 text-right",children:H})]}),
25
+ /* @__PURE__ */c("label",{className:"flex items-center gap-1 text-gray-600",children:[
26
+ /* @__PURE__ */s("span",{children:$.border}),X?/* @__PURE__ */c(d,{children:[
27
+ /* @__PURE__ */s("input",{type:"color",value:X,onChange:e=>De(e.target.value),title:$.borderColor,className:"h-5 w-6 rounded border border-gray-300 bg-white p-0 cursor-pointer"}),
28
+ /* @__PURE__ */s("button",{onClick:()=>De(null),title:$.removeBorder,className:"px-0.5 text-gray-400 hover:text-gray-700",children:"✕"})]}):/* @__PURE__ */s("button",{onClick:()=>De(W),title:$.addBorder,className:"px-2 py-0.5 rounded border border-line-strong text-gray-600 hover:bg-gray-100",children:$.add})]}),
29
+ /* @__PURE__ */c("label",{className:"flex items-center gap-1 text-gray-600",children:[
30
+ /* @__PURE__ */s("span",{children:$.fill}),Y?/* @__PURE__ */c(d,{children:[
31
+ /* @__PURE__ */s("input",{type:"color",value:Y,onChange:e=>Pe(e.target.value),title:$.fillColor,className:"h-5 w-6 rounded border border-gray-300 bg-white p-0 cursor-pointer"}),
32
+ /* @__PURE__ */s("button",{onClick:()=>Pe(null),title:$.removeFill,className:"px-0.5 text-gray-400 hover:text-gray-700",children:"✕"})]}):/* @__PURE__ */s("button",{onClick:()=>Pe("#ffffff"),title:$.addFill,className:"px-2 py-0.5 rounded border border-line-strong text-gray-600 hover:bg-gray-100",children:$.add})]}),
33
+ /* @__PURE__ */c("label",{className:"flex items-center gap-2 text-gray-600",children:[
34
+ /* @__PURE__ */s("span",{children:$.padding}),
35
+ /* @__PURE__ */s("input",{type:"range",min:0,max:40,step:1,value:J,onChange:e=>{return t=Number(e.target.value),Q(t),void(oe&&ne(e=>e.map(e=>e.id===oe&&"text"===e.type?{...e,padding:t}:e)));var t},className:"w-14 accent-blue-500"}),
36
+ /* @__PURE__ */s("span",{className:"tabular-nums w-6 text-right",children:J})]})]}),
37
+ /* @__PURE__ */s("div",{className:"h-5 w-px bg-gray-300 mx-1"}),
38
+ /* @__PURE__ */s("button",{onClick:()=>he(e=>Math.max(.25,Math.round(100*(e-.25))/100)),className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-700",title:$.zoomOut,children:"−"}),
39
+ /* @__PURE__ */c("span",{className:"text-gray-600 tabular-nums w-10 text-center",children:[Math.round(100*de),"%"]}),
40
+ /* @__PURE__ */s("button",{onClick:()=>he(e=>Math.min(4,Math.round(100*(e+.25))/100)),className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-700",title:$.zoomIn,children:"+"}),
41
+ /* @__PURE__ */s("button",{onClick:()=>he(1),className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-700",title:$.fitHint,children:$.fit}),
42
+ /* @__PURE__ */s("div",{className:"h-5 w-px bg-gray-300 mx-1"}),
43
+ /* @__PURE__ */s("button",{onClick:()=>{ne(e=>e.slice(0,-1)),ie(null)},disabled:0===re.length,className:"px-2 py-1 rounded hover:bg-gray-200 disabled:opacity-30 text-gray-700",children:$.undo}),
44
+ /* @__PURE__ */c("div",{className:"ml-auto flex items-center gap-2",children:[me&&/* @__PURE__ */c(d,{children:[
45
+ /* @__PURE__ */s("button",{onClick:()=>{if(!me||!P.current||!ae)return;const e=me,t=document.createElement("canvas");t.width=Math.round(e.w),t.height=Math.round(e.h);const r=t.getContext("2d"),n=document.createElement("canvas");n.width=ae.w,n.height=ae.h;const o=n.getContext("2d");o.drawImage(P.current,0,0);for(const e of Ne)C(o,e);r.drawImage(n,e.x,e.y,e.w,e.h,0,0,e.w,e.h);const i=new Image;i.onload=()=>{P.current=i,le({w:i.naturalWidth,h:i.naturalHeight}),ne(t=>t.filter(e=>"mosaic"!==e.type).map(t=>b(t,-e.x,-e.y)).filter(e=>function(e,t,r){const n=k(e);return n.x+n.w>0&&n.y+n.h>0&&n.x<t&&n.y<r}(e,i.naturalWidth,i.naturalHeight))),ge(null)},i.src=t.toDataURL("image/png")},className:"px-2 py-1 rounded bg-blue-500 text-white hover:bg-blue-600",children:$.applyCrop}),
46
+ /* @__PURE__ */s("button",{onClick:()=>ge(null),className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-700",children:$.cancel})]}),m&&!me&&/* @__PURE__ */c(d,{children:[g&&/* @__PURE__ */s("button",{onClick:g,className:"px-3 py-1 rounded hover:bg-gray-200 text-gray-700 text-xs font-medium",children:$.cancel}),
47
+ /* @__PURE__ */s("button",{onClick:async()=>{const t=await Ee();t?t.toBlob(t=>{t?m(t):e.error(E.current.exportFailed)},"image/png"):e.error(E.current.exportFailed)},className:"px-3 py-1 rounded bg-blue-500 text-white hover:bg-blue-600 text-xs font-medium",children:$.apply})]})]})]}),
48
+ /* @__PURE__ */s("div",{ref:L,className:"flex-1 overflow-auto bg-gray-200 flex items-center justify-center p-4 relative",children:be&&ae&&/* @__PURE__ */c("div",{className:"relative shadow-lg rounded overflow-hidden bg-white shrink-0",style:{width:be.w,height:be.h},children:[
49
+ /* @__PURE__ */s("canvas",{ref:z,style:{position:"absolute",inset:0,width:"100%",height:"100%",display:"block"}}),
50
+ /* @__PURE__ */c("svg",{ref:D,viewBox:`0 0 ${ae.w} ${ae.h}`,preserveAspectRatio:"none",style:{position:"absolute",inset:0,width:"100%",height:"100%",touchAction:"none",cursor:"select"===I?"default":"text"===I?"text":"crosshair"},onPointerDown:e=>{if("select"===I)return void ie(null);if("text"===I){if(ye)return void $e();const t=Ce(e);return void xe({x:t.x,y:t.y,value:""})}const t=Ce(e);if("crop"!==I){if("draw"===I)return Le({kind:"pen",points:[t]}),void pe({id:"",type:"draw",points:[t],color:W,stroke:R});pe(v(I,t,t,W,R,ee)),Le({kind:"draw",start:t})}else Le({kind:"crop",start:t})},children:[re.map(e=>/* @__PURE__ */s(x,{anno:e,selected:oe===e.id,zoom:de,onPointerDown:t=>((e,t)=>{"select"===I&&(e.stopPropagation(),ie(t.id),Le({kind:"move",id:t.id,start:Ce(e),original:t}))})(t,e),onDoubleClick:()=>{var t;"text"===(t=e).type&&xe({x:t.x,y:t.y,value:t.text,editingId:t.id})},onHandlePointerDown:(t,r)=>((e,t,r)=>{e.stopPropagation(),Le({kind:"resize",id:t.id,corner:r,start:Ce(e),original:t})})(t,e,r)},e.id)),ue&&/* @__PURE__ */s(x,{anno:{...ue,id:"__preview"},preview:!0}),me&&/* @__PURE__ */s(w,{rect:me,imageSize:ae})]}),ye&&/* @__PURE__ */s(f,{pendingText:ye,color:W,size:H,font:u.find(e=>e.id===F)?.css??u[0].css,bold:U,italic:K,underline:Z,borderColor:X,background:Y,padding:J,scale:ke,onChange:e=>xe({...ye,value:e}),onCommit:$e,onCancel:()=>xe(null)})]})}),
51
+ /* @__PURE__ */s("div",{className:"px-3 py-2 border-t border-line bg-surface text-2xs text-ink-faint shrink-0",children:"select"===I?oe?$.hintSelected:$.hintSelect:"text"===I?$.hintText:"crop"===I?$.hintCrop:"draw"===I?$.hintDraw:$.hintShape})]})});function x({anno:e,selected:t,preview:r,zoom:n=1,onPointerDown:o,onDoubleClick:i,onHandlePointerDown:a}){const l=k(e),h=o?{onPointerDown:o,pointerEvents:"all",style:{cursor:"move"}}:{},p=i?{onDoubleClick:i}:{};let y;if("rect"===e.type)y=/* @__PURE__ */s("rect",{x:e.x,y:e.y,width:e.w,height:e.h,rx:e.radius,ry:e.radius,fill:"none",stroke:e.color,strokeWidth:e.stroke,strokeLinecap:"round",strokeLinejoin:"round",...h});else if("circle"===e.type)y=/* @__PURE__ */s("ellipse",{cx:e.x+e.w/2,cy:e.y+e.h/2,rx:e.w/2,ry:e.h/2,fill:"none",stroke:e.color,strokeWidth:e.stroke,...h});else if("arrow"===e.type)y=/* @__PURE__ */s(g,{anno:e,interactive:h});else if("draw"===e.type)y=/* @__PURE__ */s("path",{d:N(e.points),fill:"none",stroke:e.color,strokeWidth:e.stroke,strokeLinecap:"round",strokeLinejoin:"round",...h});else if("mosaic"===e.type)y=/* @__PURE__ */s("rect",{x:e.x,y:e.y,width:e.w,height:e.h,fill:"rgba(0,0,0,0.001)",stroke:"none",strokeWidth:t?2:0,strokeDasharray:t?"6,4":void 0,...h,style:t?{...h.style,stroke:"var(--rosh-annotator-selection)"}:h.style});else{const t=u.find(t=>t.id===e.font)?.css??u[0].css,r=e.padding??0,n=!!e.borderColor||!!e.background,o=k(e),i=e.borderColor?Math.max(1,Math.round(e.size/12)):0;y=/* @__PURE__ */c("g",{...h,...p,children:[n&&/* @__PURE__ */s("rect",{x:o.x-r,y:o.y-r,width:Math.max(0,o.w)+2*r,height:Math.max(0,o.h)+2*r,rx:Math.min(8,r),ry:Math.min(8,r),fill:e.background??"none",stroke:e.borderColor??"none",strokeWidth:i}),
52
+ /* @__PURE__ */s("text",{x:e.x,y:e.y+e.size,fill:e.color,fontSize:e.size,fontWeight:e.bold?700:400,fontStyle:e.italic?"italic":"normal",textDecoration:e.underline?"underline":void 0,fontFamily:t,style:{userSelect:"none"},children:e.text.split("\n").map((t,r)=>/* @__PURE__ */s("tspan",{x:e.x,dy:0===r?0:1.2*e.size,children:t},r))})]})}/* @__PURE__ */
53
+ return c("g",{children:[y,t&&!r&&/* @__PURE__ */c(d,{children:[
54
+ /* @__PURE__ */s("rect",{"data-chrome":"selection",x:l.x-4,y:l.y-4,width:l.w+8,height:l.h+8,fill:"none",strokeWidth:2/n,strokeDasharray:`${6/n},${4/n}`,pointerEvents:"none",style:{stroke:"var(--rosh-annotator-selection)"}}),a&&/* @__PURE__ */s(m,{anno:e,zoom:n,onHandlePointerDown:a})]})]})}function m({anno:e,zoom:t,onHandlePointerDown:r}){const n=6/t,o=1.5/t,i=e=>({fill:"white",strokeWidth:o,pointerEvents:"all",style:{cursor:e,stroke:"var(--rosh-annotator-selection)"},"data-chrome":"handle"});if("arrow"===e.type)/* @__PURE__ */
55
+ return c(d,{children:[
56
+ /* @__PURE__ */s("circle",{cx:e.x1,cy:e.y1,r:n,...i("grab"),onPointerDown:e=>r(e,"start")}),
57
+ /* @__PURE__ */s("circle",{cx:e.x2,cy:e.y2,r:n,...i("grab"),onPointerDown:e=>r(e,"end")})]});if("text"===e.type||"draw"===e.type)return null;const a=e.x,l=e.y,h=e.w,u=e.h;/* @__PURE__ */
58
+ return c(d,{children:[
59
+ /* @__PURE__ */s("circle",{cx:a,cy:l,r:n,...i("nwse-resize"),onPointerDown:e=>r(e,"nw")}),
60
+ /* @__PURE__ */s("circle",{cx:a+h,cy:l,r:n,...i("nesw-resize"),onPointerDown:e=>r(e,"ne")}),
61
+ /* @__PURE__ */s("circle",{cx:a+h,cy:l+u,r:n,...i("nwse-resize"),onPointerDown:e=>r(e,"se")}),
62
+ /* @__PURE__ */s("circle",{cx:a,cy:l+u,r:n,...i("nesw-resize"),onPointerDown:e=>r(e,"sw")})]})}function g({anno:e,interactive:t}){const r=Math.max(12,4*e.stroke),n=Math.atan2(e.y2-e.y1,e.x2-e.x1),o=n+Math.PI-Math.PI/7,i=n+Math.PI+Math.PI/7,a=`M${e.x2},${e.y2} L${e.x2+r*Math.cos(o)},${e.y2+r*Math.sin(o)} L${e.x2+r*Math.cos(i)},${e.y2+r*Math.sin(i)} Z`;/* @__PURE__ */
63
+ return c("g",{...t,children:[
64
+ /* @__PURE__ */s("line",{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,stroke:e.color,strokeWidth:e.stroke,strokeLinecap:"round"}),
65
+ /* @__PURE__ */s("path",{d:a,fill:e.color})]})}function w({rect:e,imageSize:t}){/* @__PURE__ */
66
+ return c("g",{pointerEvents:"none",children:[
67
+ /* @__PURE__ */s("path",{d:`M0,0 H${t.w} V${t.h} H0 Z M${e.x},${e.y} V${e.y+e.h} H${e.x+e.w} V${e.y} Z`,fillRule:"evenodd",style:{fill:"var(--rosh-annotator-crop-scrim)"}}),
68
+ /* @__PURE__ */s("rect",{x:e.x,y:e.y,width:e.w,height:e.h,fill:"none",stroke:"white",strokeWidth:2,strokeDasharray:"8,6"})]})}function f({pendingText:e,color:r,size:o,font:i,bold:l,italic:c,underline:d,borderColor:h,background:u,padding:p,scale:y,onChange:x,onCommit:m,onCancel:g}){const w=n(null),f=t().annotator;a(()=>{const e=requestAnimationFrame(()=>{w.current?.focus(),w.current?.select?.()});return()=>cancelAnimationFrame(e)},[]);const v=()=>m(w.current?.value),b=h?Math.max(1,Math.round(o/12)):0;/* @__PURE__ */
69
+ return s("div",{style:{position:"absolute",left:e.x*y+"px",top:e.y*y+"px",transform:"translateY(-2px)",zIndex:5},onPointerDown:e=>e.stopPropagation(),children:/* @__PURE__ */s("textarea",{ref:w,value:e.value,onChange:e=>x(e.target.value),onBlur:v,onKeyDown:e=>{"Escape"===e.key?(e.preventDefault(),g()):"Enter"!==e.key||e.shiftKey||(e.preventDefault(),v())},placeholder:f.textPlaceholder,rows:1,className:"rosh-focus-ring resize-none shadow-(--elevation-panel)",style:{color:r,fontSize:o*y+"px",fontFamily:i,fontWeight:l?700:400,fontStyle:c?"italic":"normal",textDecoration:d?"underline":void 0,minWidth:80,padding:p*y+"px",borderRadius:Math.min(8,p)*y+"px",border:h?`${b*y}px solid ${h}`:"1px dashed var(--rosh-annotator-edit-hint)",background:u??"var(--rosh-annotator-edit-surface)"}})})}function v(e,t,r,n,o,i){if("rect"===e){const e=M(t,r);return{id:"",type:"rect",x:e.x,y:e.y,w:e.w,h:e.h,color:n,stroke:o,radius:i}}if("circle"===e){const e=M(t,r);return{id:"",type:"circle",x:e.x,y:e.y,w:e.w,h:e.h,color:n,stroke:o}}if("arrow"===e)return{id:"",type:"arrow",x1:t.x,y1:t.y,x2:r.x,y2:r.y,color:n,stroke:o};if("mosaic"===e){const e=M(t,r);return{id:"",type:"mosaic",x:e.x,y:e.y,w:e.w,h:e.h}}return null}function b(e,t,r){return"arrow"===e.type?{...e,x1:e.x1+t,y1:e.y1+r,x2:e.x2+t,y2:e.y2+r}:"draw"===e.type?{...e,points:e.points.map(e=>({x:e.x+t,y:e.y+r}))}:(e.type,{...e,x:e.x+t,y:e.y+r})}function k(e){if("arrow"===e.type){return{x:Math.min(e.x1,e.x2),y:Math.min(e.y1,e.y2),w:Math.abs(e.x2-e.x1),h:Math.abs(e.y2-e.y1)}}if("draw"===e.type){if(0===e.points.length)return{x:0,y:0,w:0,h:0};let t=e.points[0].x,r=e.points[0].x,n=e.points[0].y,o=e.points[0].y;for(const i of e.points)i.x<t&&(t=i.x),i.x>r&&(r=i.x),i.y<n&&(n=i.y),i.y>o&&(o=i.y);return{x:t,y:n,w:r-t,h:o-n}}if("text"===e.type){const t=e.text.split("\n"),r=t.reduce((e,t)=>Math.max(e,t.length),0);return{x:e.x,y:e.y,w:r*e.size*.55,h:t.length*e.size*1.2}}return{x:e.x,y:e.y,w:e.w,h:e.h}}function M(e,t){return{x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),w:Math.abs(e.x-t.x),h:Math.abs(e.y-t.y)}}function N(e){if(0===e.length)return"";let t=`M ${e[0].x} ${e[0].y}`;for(let r=1;r<e.length;r++)t+=` L ${e[r].x} ${e[r].y}`;return t}function C(e,t){const r=Math.round(Math.max(0,t.x)),n=Math.round(Math.max(0,t.y)),o=Math.round(Math.min(e.canvas.width-r,t.w)),i=Math.round(Math.min(e.canvas.height-n,t.h));if(o<2||i<2)return;const a=e.getImageData(r,n,o,i);for(let e=0;e<i;e+=12)for(let t=0;t<o;t+=12){let r=0,n=0,l=0,s=0,c=0;const d=Math.min(12,o-t),h=Math.min(12,i-e);for(let i=0;i<h;i++)for(let h=0;h<d;h++){const d=4*((e+i)*o+(t+h));r+=a.data[d],n+=a.data[d+1],l+=a.data[d+2],s+=a.data[d+3],c++}r=Math.round(r/c),n=Math.round(n/c),l=Math.round(l/c),s=Math.round(s/c);for(let i=0;i<h;i++)for(let c=0;c<d;c++){const d=4*((e+i)*o+(t+c));a.data[d]=r,a.data[d+1]=n,a.data[d+2]=l,a.data[d+3]=s}}e.putImageData(a,r,n)}export{y as ImageAnnotator_default};
@@ -0,0 +1,8 @@
1
+ import{AccessibleTable as t}from"./chunk-EYPKBJYG.js";import{arcPath as e}from"./chunk-VFC6QUEN.js";import{useHighlight as o}from"./chunk-CNYAHYE6.js";import{ChartTooltip as n}from"./chunk-WDQI3FV6.js";import{CHART_INK as r,resolveSeriesColor as a}from"./chunk-TZFACUMR.js";import{useShellStrings as l,useShellLocale as i}from"./chunk-43MCNASD.js";import{formatPlain as s}from"./chunk-C3QOHMR6.js";import{useState as c}from"react";import{jsx as d,jsxs as m}from"react/jsx-runtime";function h(t,e,o,n){const r=(t,o)=>{const n=e[t]?.[o];return"number"==typeof n&&Number.isFinite(n)?n:0},a=t.map((e,o)=>t.reduce((t,e,n)=>t+r(o,n)+r(n,o),0)),l=Math.max(2,o),i=t.length>l,s=i?t.map((t,e)=>e).sort((t,e)=>a[e]-a[t]).slice(0,l-1).sort((t,e)=>t-e):t.map((t,e)=>e),c=new Map(s.map((t,e)=>[t,e])),d=i?s.length:-1,m=i?[...s.map(e=>t[e]),n]:[...t],h=m.map(()=>m.map(()=>0));let u=0;t.forEach((e,o)=>t.forEach((t,e)=>{const n=c.get(o)??d,a=c.get(e)??d;n!==d||a!==d?h[n][a]+=r(o,e):u+=r(o,e)}));const f=m.map((t,e)=>m.reduce((t,o,n)=>t+h[e][n]+h[n][e],0));return d>=0&&(f[d]+=u),{labels:m,matrix:h,totals:f,otherIndex:d,foldedCount:i?t.length-s.length:0}}function u({labels:u,matrix:f,size:p=340,maxNodes:x=8,padAngle:g=.04,arcWidth:b=12,formatValue:k,className:v,emptyLabel:M}){const $=l().charts,w=i(),N=k??(t=>s(t,w)),j=M??$.noFlows,[y,E]=c(null),{highlighted:F}=o(),C=h(u,f,x,$.other),{labels:A,matrix:I,otherIndex:z,foldedCount:Q}=C,Y=(t,e)=>I[t]?.[e]??0,L=t=>t===z?r.muted:a(t),O=C.totals,P=A.map((t,e)=>e).sort((t,e)=>O[e]-O[t]),V=P.reduce((t,e)=>t+O[e],0);if(V<=0)/* @__PURE__ */return d("p",{className:`text-sm text-gray-500 ${v??""}`,children:j});const W=p/2,B=p/2,D=p/2-44,H=D-b,R=g*P.length,S=/* @__PURE__ */new Map;let T=-Math.PI/2;P.forEach((t,e)=>{const o=O[t]/V*(2*Math.PI-R);S.set(t,{start:T,end:T+o,slot:e}),T+=o+g});const U=/* @__PURE__ */new Map,G=[];for(const t of P)for(const e of P){const o=Y(t,e);if(o<=0)continue;const n=S.get(t),r=o/Math.max(1,O[t])*(n.end-n.start),a=U.get(t)??0;U.set(t,a+r),G.push({from:t,to:e,value:o,a:n.start+a+r/2,b:S.get(e).start+(S.get(e).end-S.get(e).start)/2})}const J=(t,e)=>[W+e*Math.cos(t),B+e*Math.sin(t)],K="arc"===y?.kind?y.index:void 0,Z="ribbon"===y?.kind?G[y.index]:void 0;/* @__PURE__ */
2
+ return m("div",{className:`relative ${v??""}`,children:[
3
+ /* @__PURE__ */m("svg",{width:"100%",height:p,viewBox:`0 0 ${p} ${p}`,role:"img","aria-label":$.chord(P.length),onMouseLeave:()=>E(null),children:[G.map((t,e)=>{const[o,n]=J(t.a,H),[r,a]=J(t.b,H),l=L(t.from),i=((t,e)=>y?"ribbon"===y.kind?y.index===e:y.index===t.from||y.index===t.to:null!==F?A[t.from]===F||A[t.to]===F:null)(t,e);/* @__PURE__ */
4
+ return d("path",{d:`M${o},${n} Q${W},${B} ${r},${a}`,fill:"none",stroke:l,strokeWidth:Math.max(1,t.value/V*p*.9),strokeOpacity:null===i||i?.34:.07,strokeLinecap:"round",onMouseEnter:()=>E({kind:"ribbon",index:e})},`${A[t.from]}→${A[t.to]}`)}),P.map(t=>{const o=S.get(t),n=(o.start+o.end)/2,[a,l]=J(n,D+16),i=(t=>y?"arc"===y.kind?y.index===t:G[y.index].from===t||G[y.index].to===t:null!==F?A[t]===F:null)(t);/* @__PURE__ */
5
+ return m("g",{onMouseEnter:()=>E({kind:"arc",index:t}),children:[
6
+ /* @__PURE__ */d("path",{d:e(W,B,H,D,o.start,o.end),fill:L(t),fillOpacity:null===i||i?1:.45}),
7
+ /* @__PURE__ */d("text",{x:a,y:l+4,fontSize:11,fill:r.label,textAnchor:Math.cos(n)>.15?"start":Math.cos(n)<-.15?"end":"middle",children:A[t]})]},t)})]}),Q>0&&/* @__PURE__ */d("p",{className:"mt-1 text-xs text-ink-faint",children:$.chordFolded(Q)}),void 0!==K&&/* @__PURE__ */d("div",{className:"pointer-events-none absolute top-2 left-2 z-10",children:/* @__PURE__ */d(n,{title:A[K],rows:[{key:"total",label:$.totalFlow,color:L(K),value:N(O[K])}]})}),Z&&/* @__PURE__ */d("div",{className:"pointer-events-none absolute top-2 left-2 z-10",children:/* @__PURE__ */d(n,{title:`${A[Z.from]} → ${A[Z.to]}`,rows:[{key:"value",label:$.flow,color:L(Z.from),value:N(Z.value)}]})}),
8
+ /* @__PURE__ */d(t,{caption:$.chord(P.length),head:[$.tableFrom,$.tableTo,$.value],rows:G.map(t=>[A[t.from],A[t.to],N(t.value)])})]})}export{u as ChordChart,h as foldChord};
@@ -1,20 +1,20 @@
1
- import{MOVE_KEYS as e,MoveGrip as t,MoveHint as r,moveFromKey as a}from"./chunk-B5OYS65L.js";import{ItemCount as n}from"./chunk-RXHTIJ64.js";import{GROUP_COLORS as o}from"./chunk-FZM3ZPW3.js";import{OneLineLabel as i}from"./chunk-WGLHB6WE.js";import{Icon as s}from"./chunk-UIWGVOFH.js";import{Tooltip as l}from"./chunk-NJN5IKWO.js";import{useBrowserLayoutEffect as c}from"./chunk-D65T4H6J.js";import{useShellStrings as d}from"./chunk-43MCNASD.js";import{useRef as u,useCallback as p,useId as m,isValidElement as f}from"react";import{jsx as h,jsxs as g}from"react/jsx-runtime";var b='[role="treeitem"]';function v(e){return[...e.querySelectorAll(b)].filter(t=>{for(let r=t.parentElement?.closest('[role="group"]');r&&e.contains(r);r=r.parentElement?.closest('[role="group"]')??null)if(r.hasAttribute("hidden"))return!1;return!0})}function y({"aria-label":e,"aria-labelledby":t,children:r,className:a="",rootProps:n}){const o=u(null);c(()=>{const e=o.current;if(!e)return;const t=[...e.querySelectorAll(b)];if(0===t.length)return;const r=t.find(e=>e===document.activeElement)??t.find(e=>"true"===e.getAttribute("aria-selected"))??v(e)[0]??t[0];for(const e of t)e.tabIndex=e===r?0:-1});const i=p(e=>{n?.onKeyDown?.(e);const t=o.current,r=e.target.closest?.(b);if(!t||!r||e.target!==r||e.defaultPrevented)return;if(e.altKey||e.ctrlKey||e.metaKey)return;const a=v(t),i=a.indexOf(r),s=Number(r.getAttribute("aria-level")??"1"),l=r=>{e.preventDefault(),function(e,t){if(t){for(const r of e.querySelectorAll(b))r.tabIndex=r===t?0:-1;t.focus()}}(t,r)};switch(e.key){case"ArrowDown":l(a[i+1]);break;case"ArrowUp":l(a[i-1]);break;case"Home":l(a[0]);break;case"End":l(a[a.length-1]);break;case"ArrowRight":if("true"===r.getAttribute("aria-expanded")){const t=a[i+1];t&&Number(t.getAttribute("aria-level")??"1")>s?l(t):e.preventDefault()}break;case"ArrowLeft":if("true"!==r.getAttribute("aria-expanded"))for(let e=i-1;e>=0;e--)if(Number(a[e].getAttribute("aria-level")??"1")<s){l(a[e]);break}}},[n]);/* @__PURE__ */
1
+ import{MOVE_KEYS as e,MoveGrip as t,MoveHint as r,moveFromKey as a}from"./chunk-RVQUSPXC.js";import{ItemCount as n}from"./chunk-N7JX27JE.js";import{GROUP_COLORS as o}from"./chunk-JPNAEN53.js";import{Icon as i}from"./chunk-UIWGVOFH.js";import{OneLineLabel as s}from"./chunk-CJH2BGXY.js";import{Tooltip as l}from"./chunk-QQ2LDC6C.js";import{useBrowserLayoutEffect as c}from"./chunk-D65T4H6J.js";import{useShellStrings as d}from"./chunk-43MCNASD.js";import{useRef as u,useCallback as p,useId as m,isValidElement as f}from"react";import{jsx as h,jsxs as g}from"react/jsx-runtime";var b='[role="treeitem"]';function v(e){return[...e.querySelectorAll(b)].filter(t=>{for(let r=t.parentElement?.closest('[role="group"]');r&&e.contains(r);r=r.parentElement?.closest('[role="group"]')??null)if(r.hasAttribute("hidden"))return!1;return!0})}function y({"aria-label":e,"aria-labelledby":t,children:r,className:a="",rootProps:n}){const o=u(null);c(()=>{const e=o.current;if(!e)return;const t=[...e.querySelectorAll(b)];if(0===t.length)return;const r=t.find(e=>e===document.activeElement)??t.find(e=>"true"===e.getAttribute("aria-selected"))??v(e)[0]??t[0];for(const e of t)e.tabIndex=e===r?0:-1});const i=p(e=>{n?.onKeyDown?.(e);const t=o.current,r=e.target.closest?.(b);if(!t||!r||e.target!==r||e.defaultPrevented)return;if(e.altKey||e.ctrlKey||e.metaKey)return;const a=v(t),i=a.indexOf(r),s=Number(r.getAttribute("aria-level")??"1"),l=r=>{e.preventDefault(),function(e,t){if(t){for(const r of e.querySelectorAll(b))r.tabIndex=r===t?0:-1;t.focus()}}(t,r)};switch(e.key){case"ArrowDown":l(a[i+1]);break;case"ArrowUp":l(a[i-1]);break;case"Home":l(a[0]);break;case"End":l(a[a.length-1]);break;case"ArrowRight":if("true"===r.getAttribute("aria-expanded")){const t=a[i+1];t&&Number(t.getAttribute("aria-level")??"1")>s?l(t):e.preventDefault()}break;case"ArrowLeft":if("true"!==r.getAttribute("aria-expanded"))for(let e=i-1;e>=0;e--)if(Number(a[e].getAttribute("aria-level")??"1")<s){l(a[e]);break}}},[n]);/* @__PURE__ */
2
2
  return h("div",{...n,ref:o,role:"tree","aria-label":t?void 0:e,"aria-labelledby":t,onKeyDown:i,className:`flex flex-col gap-1 ${a}`.trim(),children:r})}function x({children:e,hidden:t,className:r=""}){/* @__PURE__ */
3
- return h("div",{role:"group",hidden:t,className:`ml-4 flex flex-col gap-1 border-l border-gray-200 pl-2 ${r}`.trim(),children:e})}var k=["inline-flex h-5 min-w-5 shrink-0 items-center justify-center rounded-full px-2","text-2xs font-medium normal-case tabular-nums tracking-normal"].join(" "),w=`${k} bg-[color:color-mix(in_srgb,var(--ink-faint)_12%,transparent)] text-gray-600`;function N(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)&&!f(e)&&"label"in e}function A(e){if(null==e||!1===e||"number"==typeof e)return null;const t=Array.isArray(e)&&e.length>0&&e.every(N)?e:N(e)?[e]:null;return t?t.map((e,t)=>/* @__PURE__ */h("span",{"data-tree-count":"","data-tone":e.tone,className:e.tone?`${k} ${o[e.tone]}`:w,children:e.label},t)):/* @__PURE__ */h("span",{"data-tree-count":"",className:w,children:e})}function j({children:e,count:t,countLabel:r,expanded:a,onToggle:o}){const s=void 0!==a,l=
4
- /* @__PURE__ */h("span",{"data-tree-label-text":"",className:"flex min-w-0 flex-1 text-left",children:/* @__PURE__ */h(i,{children:e})}),c="number"==typeof t?/* @__PURE__ */h(n,{count:t,label:r,showZero:!0}):null!=t&&!1!==t&&/* @__PURE__ */h("span",{"data-tree-count":"",className:w,children:t}),d="text-xs font-semibold uppercase tracking-wide text-ink-faint";return s?/* @__PURE__ */h("div",{role:"presentation",className:"pb-1 pt-3",children:/* @__PURE__ */g("button",{type:"button","aria-expanded":a,onClick:o,className:["flex w-full items-center gap-2 rounded-md px-2 hover:text-ink-strongest","rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]",d].join(" "),children:[
5
- /* @__PURE__ */h("span",{"aria-hidden":"true","data-tree-caret":"",className:"flex h-4 w-4 shrink-0 items-center justify-center",children:$(!!a)}),l,c]})}):/* @__PURE__ */g("div",{role:"presentation",className:`flex items-center gap-2 px-2 pb-1 pt-3 ${d}`,children:[
6
- /* @__PURE__ */h("span",{"aria-hidden":"true",className:"h-4 w-4 shrink-0"}),l,c]})}var $=e=>/* @__PURE__ */h(s,{name:"chevron-right","aria-hidden":"true",strokeWidth:2.6,className:"h-3 w-3 transition-transform "+(e?"rotate-90":"")}),D={backgroundColor:"inherit",maskImage:"linear-gradient(to right, transparent, black 12px)",WebkitMaskImage:"linear-gradient(to right, transparent, black 12px)"};function P({label:o,level:s=1,icon:l,preview:c,selected:d=!1,tone:u,expanded:p,onToggle:f,onSelect:b,muted:v=!1,badge:y,count:x,countLabel:k,actions:w,actionsPinned:N=!1,actionsOverlay:j=!0,rename:P,drop:C,dragging:K=!1,draggable:I=!1,dragHint:H,onMove:W,rowProps:E,className:L=""}){const S=void 0!==p,O=m(),T=x??("number"==typeof y?y:void 0),B=[E?.["aria-describedby"],W?O:void 0].filter(Boolean).join(" ")||void 0,M="shared"===u?"text-[color:var(--status-success-soft-ink)]":null,Z=d?M?`bg-[var(--status-success-soft)] ${M}`:"bg-accent-tint text-blue-700":"into"===C?`bg-accent-tint ${M??"text-ink-strongest"}`:`${M??"text-ink"} hover:bg-gray-100`;/* @__PURE__ */
7
- return g("div",{...E,role:"treeitem","aria-level":s,"aria-selected":d,"aria-expanded":S?p:void 0,"data-tone":u,tabIndex:d?0:-1,"aria-keyshortcuts":E?.["aria-keyshortcuts"]??(W?e:void 0),"aria-describedby":B,"data-drop":C,"data-draggable":I||void 0,onKeyDown:e=>{if(E?.onKeyDown?.(e),e.target!==e.currentTarget||e.defaultPrevented)return;const t=a(e);t&&W?(e.preventDefault(),W(t)):"Enter"!==e.key&&" "!==e.key||!b?("ArrowRight"===e.key&&S&&!p&&f||"ArrowLeft"===e.key&&S&&p&&f)&&(e.preventDefault(),f()):(e.preventDefault(),b())},onClick:e=>{E?.onClick?.(e),e.defaultPrevented||b?.()},className:["group/treerow relative flex h-8 shrink-0 select-none items-center gap-2 rounded-md px-2 text-sm",I?"cursor-grab active:cursor-grabbing":"cursor-pointer","rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]",Z,"into"===C?"ring-2 ring-inset ring-[color:var(--rosh-drop-ring)]":"",K?"opacity-40":"",L].filter(Boolean).join(" "),children:["before"===C&&/* @__PURE__ */h("span",{"aria-hidden":"true","data-tree-drop-line":"",className:"pointer-events-none absolute inset-x-2 -top-0.5 h-0.5 rounded-full bg-blue-500"}),"after"===C&&/* @__PURE__ */h("span",{"aria-hidden":"true","data-tree-drop-line":"",className:"pointer-events-none absolute inset-x-2 -bottom-0.5 h-0.5 rounded-full bg-blue-500"}),I&&
3
+ return h("div",{role:"group",hidden:t,className:`ml-4 flex flex-col gap-1 border-l border-gray-200 pl-2 ${r}`.trim(),children:e})}var k=["inline-flex h-5 min-w-5 shrink-0 items-center justify-center rounded-full px-2","text-2xs font-medium normal-case tabular-nums tracking-normal"].join(" "),w=`${k} bg-[color:color-mix(in_srgb,var(--ink-faint)_12%,transparent)] text-gray-600`;function N(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)&&!f(e)&&"label"in e}function A(e){if(null==e||!1===e||"number"==typeof e)return null;const t=Array.isArray(e)&&e.length>0&&e.every(N)?e:N(e)?[e]:null;return t?t.map((e,t)=>/* @__PURE__ */h("span",{"data-tree-count":"","data-tone":e.tone,className:e.tone?`${k} ${o[e.tone]}`:w,children:e.label},t)):/* @__PURE__ */h("span",{"data-tree-count":"",className:w,children:e})}function j({children:e,count:t,countLabel:r,expanded:a,onToggle:o}){const i=void 0!==a,l=
4
+ /* @__PURE__ */h("span",{"data-tree-label-text":"",className:"flex min-w-0 flex-1 text-left",children:/* @__PURE__ */h(s,{children:e})}),c="number"==typeof t?/* @__PURE__ */h(n,{count:t,label:r,showZero:!0}):null!=t&&!1!==t&&/* @__PURE__ */h("span",{"data-tree-count":"",className:w,children:t}),d="text-xs font-semibold uppercase tracking-wide text-ink-faint";return i?/* @__PURE__ */h("div",{role:"presentation",className:"pb-1 pt-3",children:/* @__PURE__ */g("button",{type:"button","aria-expanded":a,onClick:o,className:["flex w-full items-center gap-2 rounded-md px-2 hover:text-ink-strongest","rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]",d].join(" "),children:[
5
+ /* @__PURE__ */h("span",{"aria-hidden":"true","data-tree-caret":"",className:"flex h-4 w-4 shrink-0 items-center justify-center",children:C(!!a)}),l,c]})}):/* @__PURE__ */g("div",{role:"presentation",className:`flex items-center gap-2 px-2 pb-1 pt-3 ${d}`,children:[
6
+ /* @__PURE__ */h("span",{"aria-hidden":"true",className:"h-4 w-4 shrink-0"}),l,c]})}var C=e=>/* @__PURE__ */h(i,{name:"chevron-right","aria-hidden":"true",strokeWidth:2.6,className:"h-3 w-3 transition-transform "+(e?"rotate-90":"")}),$={backgroundColor:"inherit",maskImage:"linear-gradient(to right, transparent, black 12px)",WebkitMaskImage:"linear-gradient(to right, transparent, black 12px)"};function D({label:o,level:i=1,icon:l,preview:c,selected:d=!1,tone:u,expanded:p,onToggle:f,onSelect:b,muted:v=!1,badge:y,count:x,countLabel:k,actions:w,actionsPinned:N=!1,actionsOverlay:j=!0,rename:D,drop:P,dragging:K=!1,draggable:E=!1,dragHint:H,onMove:I,rowProps:S,className:J=""}){const L=void 0!==p,T=m(),W=x??("number"==typeof y?y:void 0),q=[S?.["aria-describedby"],I?T:void 0].filter(Boolean).join(" ")||void 0,B="shared"===u?"text-[color:var(--status-success-soft-ink)]":null,M=d?B?`bg-[var(--status-success-soft)] ${B}`:"bg-accent-tint text-blue-700":"into"===P?`bg-accent-tint ${B??"text-ink-strongest"}`:`${B??"text-ink"} hover:bg-gray-100`;/* @__PURE__ */
7
+ return g("div",{...S,role:"treeitem","aria-level":i,"aria-selected":d,"aria-expanded":L?p:void 0,"data-tone":u,tabIndex:d?0:-1,"aria-keyshortcuts":S?.["aria-keyshortcuts"]??(I?e:void 0),"aria-describedby":q,"data-drop":P,"data-draggable":E||void 0,onKeyDown:e=>{if(S?.onKeyDown?.(e),e.target!==e.currentTarget||e.defaultPrevented)return;const t=a(e);t&&I?(e.preventDefault(),I(t)):"Enter"!==e.key&&" "!==e.key||!b?("ArrowRight"===e.key&&L&&!p&&f||"ArrowLeft"===e.key&&L&&p&&f)&&(e.preventDefault(),f()):(e.preventDefault(),b())},onClick:e=>{S?.onClick?.(e),e.defaultPrevented||b?.()},className:["group/treerow relative flex h-8 shrink-0 select-none items-center gap-2 rounded-md px-2 text-sm",E?"cursor-grab active:cursor-grabbing":"cursor-pointer","rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]",M,"into"===P?"ring-2 ring-inset ring-[color:var(--rosh-drop-ring)]":"",K?"opacity-40":"",J].filter(Boolean).join(" "),children:["before"===P&&/* @__PURE__ */h("span",{"aria-hidden":"true","data-tree-drop-line":"",className:"pointer-events-none absolute inset-x-2 -top-0.5 h-0.5 rounded-full bg-blue-500"}),"after"===P&&/* @__PURE__ */h("span",{"aria-hidden":"true","data-tree-drop-line":"",className:"pointer-events-none absolute inset-x-2 -bottom-0.5 h-0.5 rounded-full bg-blue-500"}),E&&
8
8
  /* @__PURE__ */h(t,{marker:"tree",hint:H,dragging:K,revealClassName:"group-hover/treerow:opacity-100"}),
9
- /* @__PURE__ */h("span",S?{"aria-hidden":"true","data-tree-caret":"",onClick:e=>{e.stopPropagation(),f?.()},className:"flex h-4 w-4 shrink-0 items-center justify-center rounded text-gray-500 hover:bg-gray-200 hover:text-gray-900",children:$(!!p)}:{"aria-hidden":"true",className:"h-4 w-4 shrink-0"}),null!=l&&/* @__PURE__ */h("span",{"aria-hidden":"true",className:"flex h-4 w-4 shrink-0 items-center justify-center "+(v?"text-ink-faintest":""),children:l}),
10
- /* @__PURE__ */g("span",{className:"relative flex min-w-0 flex-1 items-center gap-2",children:[P??
11
- /* @__PURE__ */h("span",{"data-tree-name":"",className:`flex min-w-0 ${d?"font-semibold":"font-medium"} ${v?"text-ink-faintest line-through":""}`,children:/* @__PURE__ */g(i,{children:[o,null!=c&&/* @__PURE__ */h("span",{className:"ml-2 font-normal text-ink-faint",children:c})]})}),A(y),null!=T&&/* @__PURE__ */h(n,{count:T,label:k,active:d,showZero:!0,className:"ml-auto"}),null!=w&&!j&&/* @__PURE__ */h("span",{"data-tree-actions":"",onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),className:`${null!=T?"":"ml-auto "}flex shrink-0 items-center gap-0.5 transition-opacity ${N||v?"opacity-100":"opacity-0 group-hover/treerow:opacity-100 group-focus-within/treerow:opacity-100"}`,children:w})]}),null!=w&&j&&
12
- /* @__PURE__ */g("span",{"data-tree-actions":"","data-tree-actions-overlay":"",onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),style:D,className:"absolute inset-y-0 right-0 grid rounded-r-md transition-opacity "+(N||v||d?"opacity-100":"pointer-events-none opacity-0 group-hover/treerow:pointer-events-auto group-hover/treerow:opacity-100 group-focus-within/treerow:pointer-events-auto group-focus-within/treerow:opacity-100"),children:[
9
+ /* @__PURE__ */h("span",L?{"aria-hidden":"true","data-tree-caret":"",onClick:e=>{e.stopPropagation(),f?.()},className:"flex h-4 w-4 shrink-0 items-center justify-center rounded text-gray-500 hover:bg-gray-200 hover:text-gray-900",children:C(!!p)}:{"aria-hidden":"true",className:"h-4 w-4 shrink-0"}),null!=l&&/* @__PURE__ */h("span",{"aria-hidden":"true",className:"flex h-4 w-4 shrink-0 items-center justify-center "+(v?"text-ink-faintest":""),children:l}),
10
+ /* @__PURE__ */g("span",{className:"relative flex min-w-0 flex-1 items-center gap-2",children:[D??
11
+ /* @__PURE__ */h("span",{"data-tree-name":"",className:`flex min-w-0 ${d?"font-semibold":"font-medium"} ${v?"text-ink-faintest line-through":""}`,children:/* @__PURE__ */g(s,{children:[o,null!=c&&/* @__PURE__ */h("span",{className:"ml-2 font-normal text-ink-faint",children:c})]})}),A(y),null!=W&&/* @__PURE__ */h(n,{count:W,label:k,active:d,showZero:!0,className:"ml-auto"}),null!=w&&!j&&/* @__PURE__ */h("span",{"data-tree-actions":"",onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),className:`${null!=W?"":"ml-auto "}flex shrink-0 items-center gap-0.5 transition-opacity ${N||v?"opacity-100":"opacity-0 group-hover/treerow:opacity-100 group-focus-within/treerow:opacity-100"}`,children:w})]}),null!=w&&j&&
12
+ /* @__PURE__ */g("span",{"data-tree-actions":"","data-tree-actions-overlay":"",onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),style:$,className:"absolute inset-y-0 right-0 grid rounded-r-md transition-opacity "+(N||v||d?"opacity-100":"pointer-events-none opacity-0 group-hover/treerow:pointer-events-auto group-hover/treerow:opacity-100 group-focus-within/treerow:pointer-events-auto group-focus-within/treerow:opacity-100"),children:[
13
13
  /* @__PURE__ */h("span",{"aria-hidden":"true","data-tree-actions-scrim":"",className:"col-start-1 row-start-1",style:{background:"var(--rosh-tree-ground, var(--surface))"}}),
14
14
  /* @__PURE__ */h("span",{"aria-hidden":"true",className:"col-start-1 row-start-1",style:{backgroundColor:"inherit"}}),
15
- /* @__PURE__ */h("span",{className:"col-start-1 row-start-1 flex items-center gap-0.5 pl-4 pr-2",children:w})]}),W&&/* @__PURE__ */h(r,{id:O})]})}function C({onAdd:e,label:t,drop:r=!1,slotProps:a}){const n=d().tree,o=r?n.dropHere:t??n.empty,i="flex min-h-8 w-full items-center gap-2 rounded-md border border-dashed px-3 text-sm "+(r?"border-blue-500 bg-blue-50 text-blue-700":"border-gray-300 text-gray-500");/* @__PURE__ */
15
+ /* @__PURE__ */h("span",{className:"col-start-1 row-start-1 flex items-center gap-0.5 pl-4 pr-2",children:w})]}),I&&/* @__PURE__ */h(r,{id:T})]})}function P({onAdd:e,label:t,drop:r=!1,slotProps:a}){const n=d().tree,o=r?n.dropHere:t??n.empty,i="flex min-h-8 w-full items-center gap-2 rounded-md border border-dashed px-3 text-sm "+(r?"border-blue-500 bg-blue-50 text-blue-700":"border-gray-300 text-gray-500");/* @__PURE__ */
16
16
  return h("div",{...a,role:"presentation","data-drop":r||void 0,children:e?/* @__PURE__ */g("button",{type:"button",onClick:e,className:`${i} text-left hover:bg-gray-100 hover:text-gray-900 rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]`,children:[
17
- /* @__PURE__ */h("span",{"aria-hidden":"true",children:"+"}),o]}):/* @__PURE__ */h("span",{className:i,children:o})})}function K({onInsert:e,label:t,drop:r=!1,seamProps:a}){const n=d().tree,o=t??n.insertHere,i=r?"opacity-100":e?"opacity-0 group-hover/seam:opacity-100 group-focus-within/seam:opacity-100":"opacity-0";/* @__PURE__ */
17
+ /* @__PURE__ */h("span",{"aria-hidden":"true",children:"+"}),o]}):/* @__PURE__ */h("span",{className:i,children:o})})}function K({onInsert:e,label:t,drop:r=!1,seamProps:a}){const n=d().tree,o=t??n.insertHere,s=r?"opacity-100":e?"opacity-0 group-hover/seam:opacity-100 group-focus-within/seam:opacity-100":"opacity-0";/* @__PURE__ */
18
18
  return g("div",{...a,role:"presentation","data-tree-seam":"","data-drop":r||void 0,className:`group/seam relative z-10 -my-1 h-1 shrink-0 ${a?.className??""}`.trim(),children:[
19
19
  /* @__PURE__ */h("span",{"aria-hidden":"true",className:"absolute inset-x-0 -bottom-1 -top-1"}),
20
- /* @__PURE__ */h("span",{"aria-hidden":"true","data-tree-seam-line":"",className:`pointer-events-none absolute inset-x-2 top-1/2 h-0.5 -translate-y-1/2 rounded-full bg-blue-500 transition-opacity ${i}`}),e&&/* @__PURE__ */h(l,{content:o,className:"absolute left-1/2 top-1/2 inline-flex -translate-x-1/2 -translate-y-1/2",children:/* @__PURE__ */h("button",{type:"button","aria-label":o,onClick:e,className:"flex h-5 w-5 items-center justify-center rounded-full bg-blue-600 text-white transition rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)] "+(r?"scale-75 opacity-0":"scale-75 opacity-0 group-hover/seam:scale-100 group-hover/seam:opacity-100 focus-visible:scale-100 focus-visible:opacity-100"),children:/* @__PURE__ */h(s,{name:"add","aria-hidden":"true",strokeWidth:2.6,className:"h-3 w-3"})})})]})}export{y as Tree,C as TreeEmptySlot,x as TreeGroup,j as TreeGroupLabel,P as TreeRow,K as TreeSeam};
20
+ /* @__PURE__ */h("span",{"aria-hidden":"true","data-tree-seam-line":"",className:`pointer-events-none absolute inset-x-2 top-1/2 h-0.5 -translate-y-1/2 rounded-full bg-blue-500 transition-opacity ${s}`}),e&&/* @__PURE__ */h(l,{content:o,className:"absolute left-1/2 top-1/2 inline-flex -translate-x-1/2 -translate-y-1/2",children:/* @__PURE__ */h("button",{type:"button","aria-label":o,onClick:e,className:"flex h-5 w-5 items-center justify-center rounded-full bg-blue-600 text-white transition rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)] "+(r?"scale-75 opacity-0":"scale-75 opacity-0 group-hover/seam:scale-100 group-hover/seam:opacity-100 focus-visible:scale-100 focus-visible:opacity-100"),children:/* @__PURE__ */h(i,{name:"add","aria-hidden":"true",strokeWidth:2.6,className:"h-3 w-3"})})})]})}export{y as Tree,P as TreeEmptySlot,x as TreeGroup,j as TreeGroupLabel,D as TreeRow,K as TreeSeam};
@@ -1,4 +1,4 @@
1
- import{Tabs as e}from"./chunk-N5KO2IHG.js";import{Card as a}from"./chunk-EOGXCGQF.js";import{StatusBadgeProvider as r,StatusBadge as t}from"./chunk-FZM3ZPW3.js";import{Button_default as l}from"./chunk-EOVXFXVV.js";import{useState as i}from"react";import{jsx as d,jsxs as s}from"react/jsx-runtime";var n={featured:"success",new:"active",draft:"draft"},c=["linear-gradient(135deg,#60a5fa,#a78bfa)","linear-gradient(135deg,#34d399,#10b981)","linear-gradient(135deg,#fbbf24,#f59e0b)","linear-gradient(135deg,#f472b6,#ec4899)","linear-gradient(135deg,#38bdf8,#6366f1)","linear-gradient(135deg,#fb7185,#ef4444)","linear-gradient(135deg,#4ade80,#22c55e)","linear-gradient(135deg,#c084fc,#8b5cf6)"].map((e,a)=>({id:a,title:["Sunrise","Forest","Desert","Bloom","Ocean","Ember","Meadow","Dusk"][a],tag:["featured","new","draft"][a%3],bg:e}));function m(){const[m,g]=i("all"),f="all"===m?c:c.filter(e=>e.tag===m);/* @__PURE__ */
1
+ import{Tabs as e}from"./chunk-RQDVAUXD.js";import{Card as a}from"./chunk-EOGXCGQF.js";import{StatusBadgeProvider as r,StatusBadge as t}from"./chunk-JPNAEN53.js";import{Button_default as l}from"./chunk-UJJXWLHE.js";import{useState as i}from"react";import{jsx as d,jsxs as s}from"react/jsx-runtime";var n={featured:"success",new:"active",draft:"draft"},c=["linear-gradient(135deg,#60a5fa,#a78bfa)","linear-gradient(135deg,#34d399,#10b981)","linear-gradient(135deg,#fbbf24,#f59e0b)","linear-gradient(135deg,#f472b6,#ec4899)","linear-gradient(135deg,#38bdf8,#6366f1)","linear-gradient(135deg,#fb7185,#ef4444)","linear-gradient(135deg,#4ade80,#22c55e)","linear-gradient(135deg,#c084fc,#8b5cf6)"].map((e,a)=>({id:a,title:["Sunrise","Forest","Desert","Bloom","Ocean","Ember","Meadow","Dusk"][a],tag:["featured","new","draft"][a%3],bg:e}));function m(){const[m,g]=i("all"),f="all"===m?c:c.filter(e=>e.tag===m);/* @__PURE__ */
2
2
  return d(r,{groups:n,children:/* @__PURE__ */d("div",{className:"h-full overflow-auto bg-gray-50 p-6",children:/* @__PURE__ */s("div",{className:"mx-auto max-w-5xl space-y-4",children:[
3
3
  /* @__PURE__ */s("div",{className:"flex items-center justify-between gap-4",children:[
4
4
  /* @__PURE__ */d("h1",{className:"text-xl font-semibold text-gray-900",children:"Gallery"}),
@@ -0,0 +1,2 @@
1
+ import{TimelineCard as e}from"./chunk-S4Z657L6.js";import{TimelineTrack as n,TimelineMilestoneIcon as s}from"./chunk-4UGFNTZ3.js";import{toDayMs as i,fmtSliderDate as t,DAY_MS as a}from"./chunk-7TC3LJQM.js";import{useBrowserValueOnce as l}from"./chunk-D65T4H6J.js";import{useShellStrings as o,useShellLocale as r}from"./chunk-43MCNASD.js";import{jsx as h}from"react/jsx-runtime";function m({title:m,heading:d,subject:c,milestones:p,summary:u,endDate:g,phaseLabels:k,variant:v="card",edgeCaptions:f,highlightKeys:y=null,onHoverChange:b}){const M=l(Date.now,null),j=[],C=[],x=o().timeline,N=r();for(const e of p){const n=i(e.date??null);null===n?C.push({key:e.key,label:e.label,kind:e.kind}):j.push({...e,ms:n})}j.sort((e,n)=>e.ms-n.ms);const D=i(g??null);let L,w,H=!0;0===j.length?(w=D??M??0,L=w-30*a,H=null!==D||null!==M):(L=j[0].ms,w=D??j[j.length-1].ms,w-L<a&&(w=L+a));const O=j.length>0?Math.max(0,Math.round((w-L)/a)):0,T=u??(O>0?x.duration(O):void 0),J=[j.length>0?x.started(t(j[0].ms,N)):void 0,T,C.length>0?x.reached(j.length,p.length):void 0],K=j.map(e=>{return{key:e.key,ms:e.ms,kind:e.kind,label:e.label,detail:e.detail,preview:e.preview,glyph:e.glyph,onClick:e.onClick,onOpen:e.onOpen,priority:(n=e.kind,"dfm"===n?1:0),caption:e.caption,provisional:e.provisional};var n}),S={};for(const e of j)e.phase&&(S[e.phase]=S[e.phase]||[]).push(e.ms);const Z=Object.entries(S).filter(([,e])=>e.length>=2).map(([e,n])=>({key:e,label:k?.[e]??e,minMs:Math.min(...n),maxMs:Math.max(...n)})),A="rail"===v,F=H&&/* @__PURE__ */h("div",{className:"select-none",children:/* @__PURE__ */h(n,{axis:A?"spread":"compressed",labels:A?"none":"lanes",items:K,pending:C,phases:Z,startMs:L,endMs:w,todayMs:M??void 0,edgeCaptions:f,highlightKeys:y,onHoverChange:b,ariaLabel:x.milestones(m)})});/* @__PURE__ */
2
+ return h("div",A?{className:"shrink-0","data-timeline-variant":"rail",children:F}:{className:"shrink-0",children:/* @__PURE__ */h(e,{icon:/* @__PURE__ */h(s,{}),heading:d??m,subject:c,meta:J,children:F})})}export{m as MilestoneTimeline};
@@ -0,0 +1,8 @@
1
+ import{optionMatches as e,OptionSublabel as t}from"./chunk-7HIHQR3X.js";import{inputClasses as n}from"./chunk-AYZY3YNC.js";import{GROUP_COLORS as o}from"./chunk-JPNAEN53.js";import{Tooltip as r}from"./chunk-QQ2LDC6C.js";import{onOverlayOpen as l}from"./chunk-PGN5ME7B.js";import{Z_LAYERS as i}from"./chunk-62LW225J.js";import{useDropdownPosition as s,POPUP_MAX_WIDTH as a,MENU_MAX_HEIGHT as c}from"./chunk-GLUJS42B.js";import{glassStyle as u}from"./chunk-5FYDNH4Y.js";import{useShellStrings as d}from"./chunk-43MCNASD.js";import{useState as m,useRef as h,useMemo as p,useEffect as f}from"react";import{createPortal as v}from"react-dom";import{jsxs as g,jsx as x,Fragment as b}from"react/jsx-runtime";var w={accent:{chip:"inline-flex max-w-full items-center gap-1 rounded bg-accent-tint px-2 py-0.5 text-xs font-medium text-blue-700",remove:"text-blue-400 hover:text-red-500 rosh-focus-ring focus-visible:ring-1 focus-visible:ring-[color:var(--rosh-focus-ring-deep)] rounded leading-none"},danger:{chip:`inline-flex max-w-full items-center gap-1 rounded ${o.danger} px-2 py-0.5 text-xs font-medium`,remove:"text-current opacity-70 hover:opacity-100 rosh-focus-ring focus-visible:ring-1 focus-visible:ring-[color:var(--rosh-focus-ring-deep)] rounded leading-none"}};function y({value:o,onChange:y,options:k=[],placeholder:N,allowFreeText:C=!1,invalid:j,disabled:D,id:L,className:E="",tone:H,tooltip:M,split:W}){const[Y,$]=m(!1),[S,A]=m(""),B=d(),F=h(null),I=h(null),J=h(null),Q=s(F,Y),G=e=>k.find(t=>t.value===e)?.label??e,P=p(()=>{const t=new Set(o),n=[],r=S.trim().toLowerCase();for(const o of k)t.has(o.value)||(t.add(o.value),r&&!e(o,r)||n.push(o));return n},[k,o,S]),T=e=>{const t=[...o];for(const n of e){const e=n.trim();if(!e)continue;const o=e.toLowerCase(),r=k.find(t=>t.value===e||t.label.toLowerCase()===o)?.value,l=r??(C?e:null);l&&!t.includes(l)&&t.push(l)}t.length!==o.length&&y(t)},z=e=>{e&&!o.includes(e)?(y([...o,e]),A("")):A("")},K=e=>y(o.filter(t=>t!==e)),R=()=>{const e=S.trim();if(W&&e)return T(e.split(W)),void A("");C&&e?z(e):A("")},U=h(()=>{});U.current=()=>{R(),$(!1)},f(()=>{if(!Y)return;const e=e=>{const t=e.target;F.current?.contains(t)||J.current?.contains(t)||(R(),$(!1))};document.addEventListener("mousedown",e);const t=l(()=>U.current());return()=>{document.removeEventListener("mousedown",e),t()}});const X=k.length>0;/* @__PURE__ */
2
+ return g("div",{ref:F,className:"relative",children:[
3
+ /* @__PURE__ */g("div",{onMouseDown:e=>{D||e.target.closest("button")||(e.preventDefault(),I.current?.focus())},className:n({invalid:j,multiline:!0,className:`flex flex-wrap items-center gap-1 cursor-text focus-within:border-blue-400 has-focus-visible:ring-2 has-focus-visible:ring-[color:var(--rosh-focus-ring)] ${D?"bg-gray-50 cursor-not-allowed":""} ${E}`}),children:[o.map(e=>{const t=H?.(e),n=w[t??"accent"],o=/* @__PURE__ */g("span",{"data-tone":t,className:n.chip,children:[
4
+ /* @__PURE__ */x("span",{className:"truncate",children:G(e)}),!D&&/* @__PURE__ */x("button",{type:"button","aria-label":B.select.removeItem?.(G(e))??`${B.select.remove} ${G(e)}`,onClick:()=>K(e),className:n.remove,children:"×"})]},e),l=M?.(e);return null==l?o:/* @__PURE__ */x(r,{content:l,className:"relative inline-flex max-w-full",children:o},e)}),
5
+ /* @__PURE__ */x("input",{id:L,ref:I,type:"text",autoComplete:"off",role:"combobox","aria-expanded":Y&&X,"aria-invalid":j||void 0,disabled:D,value:S,placeholder:0===o.length?N:void 0,onChange:e=>{(e=>{if(W){const t=e.split(W);if(t.length>1)return T(t.slice(0,-1)),void A(t[t.length-1])}A(e)})(e.target.value),$(!0)},onFocus:()=>{!D&&X&&$(!0)},onKeyDown:t=>{if("Enter"===t.key||","===t.key&&C){t.preventDefault();const n=S.trim(),o=n?P.filter(t=>e(t,n.toLowerCase())):[];1===o.length?z(o[0].value):R()}else"Backspace"===t.key&&""===S&&o.length>0?K(o[o.length-1]):"Escape"===t.key?($(!1),A(""),I.current?.blur()):"Tab"===t.key&&(R(),$(!1))},className:"min-w-[8ch] flex-1 border-none bg-transparent p-0 text-sm text-ink-strong placeholder:text-[color:var(--ink-placeholder)] rosh-focus-ring focus-visible:ring-0 disabled:cursor-not-allowed"})]}),Y&&X&&v(
6
+ /* @__PURE__ */x("div",{ref:J,className:"fixed rounded-(--radius-popup) overflow-hidden",style:{zIndex:i.popup,left:Q?.left,right:Q?.right,top:Q?.top,bottom:Q?.bottom,minWidth:Q?.minWidth,maxWidth:Q?.maxWidth??a,width:"max-content",visibility:Q?void 0:"hidden",...u()},children:/* @__PURE__ */x("div",{className:"overflow-y-auto",style:{maxHeight:Q?.maxHeight??c},children:0===P.length?/* @__PURE__ */x("p",{className:"px-3 py-3 text-sm text-gray-400 text-center",children:k.length>0&&o.length>=k.length?B.select.allSelected:B.select.noMatches}):P.map(e=>/* @__PURE__ */x("button",{type:"button",onMouseDown:t=>{t.preventDefault(),z(e.value)},className:e.sublabel?"w-full text-left px-3 min-h-(--row-height-menu) py-2 text-sm hover:bg-row-hover text-ink whitespace-nowrap flex items-center justify-between gap-3":"w-full text-left px-3 min-h-(--row-height-menu) py-2 leading-5 text-sm hover:bg-row-hover text-ink whitespace-nowrap",children:e.sublabel?/* @__PURE__ */g(b,{children:[
7
+ /* @__PURE__ */x("span",{className:"min-w-0 truncate",children:e.label}),
8
+ /* @__PURE__ */x(t,{grows:!0,children:e.sublabel})]}):e.label},e.value))})}),document.body)]})}export{y as TagInput};
@@ -1,5 +1,5 @@
1
- import{DropdownMenu as e}from"./chunk-4DZVWK7U.js";import{IconButton_default as r}from"./chunk-LE5LWALR.js";import{inputClasses as n,PLACEHOLDER_INK as t}from"./chunk-AYZY3YNC.js";import{iconButtonClasses as i}from"./chunk-UQYNPYF4.js";import{Tooltip as a}from"./chunk-NJN5IKWO.js";import{forwardRef as s}from"react";import{jsx as o,jsxs as l}from"react/jsx-runtime";var c={sm:"sm",md:"sm",lg:"md",touch:"touch-sm"},m={sm:"pr-8",md:"pr-8",lg:"pr-10",touch:"pr-12"};function p({children:e}){/* @__PURE__ */
1
+ import{DropdownMenu as e}from"./chunk-YZR4T5FZ.js";import{IconButton_default as r}from"./chunk-UGOJLNYR.js";import{inputClasses as n,PLACEHOLDER_INK as t}from"./chunk-AYZY3YNC.js";import{Tooltip as i}from"./chunk-QQ2LDC6C.js";import{iconButtonClasses as a}from"./chunk-UQYNPYF4.js";import{forwardRef as s}from"react";import{jsx as o,jsxs as l}from"react/jsx-runtime";var c={sm:"sm",md:"sm",lg:"md",touch:"touch-sm"},m={sm:"pr-8",md:"pr-8",lg:"pr-10",touch:"pr-12"};function p({children:e}){/* @__PURE__ */
2
2
  return o("span",{className:"absolute right-1 top-1/2 flex -translate-y-1/2 items-center gap-1",children:e})}function d({action:e,size:r="md"}){/* @__PURE__ */
3
3
  return o(h,{action:e,size:c[r]})}var u=["","pr-8","pr-16"];function h({action:n,size:t}){const{label:s,icon:l,onClick:c,menu:m}=n;/* @__PURE__ */
4
- return o(a,{content:s,describe:!1,children:m?/* @__PURE__ */o(e,{"aria-label":s,trigger:l,items:m,triggerClassName:i({size:t})}):/* @__PURE__ */o(r,{"aria-label":s,size:t,onClick:c,children:l})})}var f=s(function({invalid:e,leftIcon:r,rightAdornment:i,endAction:a,size:s,className:c="",readOnly:u,...h},f){const N=s??"md",g=`${r?"pl-10":""} ${a?m[N]:i?"pr-10":""}`.trim(),v=
5
- /* @__PURE__ */o("input",{ref:f,"aria-invalid":e||void 0,readOnly:u,className:n({invalid:e,size:s,readOnly:u,className:[g,c].filter(Boolean).join(" ")}),...h});return r||i||a?/* @__PURE__ */l("div",{className:"relative",children:[r&&/* @__PURE__ */o("span",{className:`pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 ${t}`,children:r}),v,a?/* @__PURE__ */o(p,{children:/* @__PURE__ */o(d,{action:a,size:N})}):i&&/* @__PURE__ */o("span",{className:"absolute right-3 top-1/2 -translate-y-1/2 text-gray-400",children:i})]}):v});export{u as END_ACTIONS_PAD,c as INPUT_END_ACTION_SIZE,d as InputEndActionButton,p as InputEndActionSlot,f as Input_default};
4
+ return o(i,{content:s,describe:!1,children:m?/* @__PURE__ */o(e,{"aria-label":s,trigger:l,items:m,triggerClassName:a({size:t})}):/* @__PURE__ */o(r,{"aria-label":s,size:t,onClick:c,children:l})})}var f=s(function({invalid:e,leftIcon:r,rightAdornment:i,endAction:a,size:s,className:c="",readOnly:u,...h},f){const g=s??"md",N=`${r?"pl-10":""} ${a?m[g]:i?"pr-10":""}`.trim(),v=
5
+ /* @__PURE__ */o("input",{ref:f,"aria-invalid":e||void 0,readOnly:u,className:n({invalid:e,size:s,readOnly:u,className:[N,c].filter(Boolean).join(" ")}),...h});return r||i||a?/* @__PURE__ */l("div",{className:"relative",children:[r&&/* @__PURE__ */o("span",{className:`pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 ${t}`,children:r}),v,a?/* @__PURE__ */o(p,{children:/* @__PURE__ */o(d,{action:a,size:g})}):i&&/* @__PURE__ */o("span",{className:"absolute right-3 top-1/2 -translate-y-1/2 text-gray-400",children:i})]}):v});export{u as END_ACTIONS_PAD,c as INPUT_END_ACTION_SIZE,d as InputEndActionButton,p as InputEndActionSlot,f as Input_default};
@@ -0,0 +1,14 @@
1
+ import{useHighlight as e}from"./chunk-CNYAHYE6.js";import{usePlotWidth as t}from"./chunk-MAFUXCPZ.js";import{ChartTooltip as l}from"./chunk-WDQI3FV6.js";import{resolveSeriesColor as a,CHART_INK as n,STATUS_VARS as r}from"./chunk-TZFACUMR.js";import{useShellStrings as o,useShellLocale as i}from"./chunk-43MCNASD.js";import{formatPercent as u,formatPlain as h}from"./chunk-C3QOHMR6.js";import{useId as c,useState as m,useRef as s}from"react";import{jsx as d,jsxs as f}from"react/jsx-runtime";function x({stages:x,shape:v="funnel",height:p,width:$,gap:g=4,minBandWidth:M=0,formatValue:y,color:b,className:k,emptyLabel:A}){const N=o().charts,S=i(),L=y??(e=>h(e,S)),j=A??N.noStages,z=c(),[V,C]=m(null),{highlighted:F}=e(),W=s(null),w=t(W,560),Z=$??w;if(0===x.length)/* @__PURE__ */return d("p",{className:`text-sm text-gray-500 ${k??""}`,children:j});const E=b??a(0),H=p??54*x.length,B=Math.max(...x.map(e=>e.value),1),D="bars"===v,Q=D?Math.round(Math.min(132,Math.max(80,.24*Z))):Math.round(Math.min(168,Math.max(104,.38*Z))),R=e=>{const t=x[e-1]?.value;return null!=t&&t>0?100*(1-x[e].value/t):null},U=e=>{const t=R(e);return{count:L(x[e].value),drop:null!=t?`−${u(t,1,S)}`:""}},Y=D?Math.ceil(Math.max(...x.map((e,t)=>{const{count:l,drop:a}=U(t);return.62*(l.length+(a?a.length+1:0))*12}))+16):0,I=Z-Q-Y,O=Math.max(D?2:0,Math.min(M,I)),P=e=>Math.max(O,I*Math.max(0,e/B)),T=e=>P(e)/2,X=Q+I/2,q=e=>46+e/Math.max(1,x.length-1)*54,G=e=>`color-mix(in oklab, ${E} ${q(e).toFixed(0)}%, ${n.surface})`,J=e=>q(e)>=55?n.surface:n.label,K=(e,t)=>null!==V?V!==e:null!==F&&F!==t,_=null!==V?x[V]:void 0;/* @__PURE__ */
2
+ return f("div",{className:`relative ${k??""}`,ref:W,children:[
3
+ /* @__PURE__ */f("svg",{width:"100%",height:H,viewBox:`0 0 ${Z} ${H}`,role:"img","aria-labelledby":z,onMouseLeave:()=>C(null),children:[
4
+ /* @__PURE__ */d("title",{id:z,children:N.funnel(x.length,L(x[0].value),L(x[x.length-1].value))}),x.map((e,t)=>{const l=t*H/x.length+g/2,a=(t+1)*H/x.length-g/2,r=(l+a)/2,o=u(e.value/(x[0].value||1)*100,0,S),i=.62*o.length*12+12;if(D){const u=Q,h=u+P(e.value),{count:c,drop:m}=U(t);/* @__PURE__ */
5
+ return f("g",{opacity:K(t,e.key)?.45:1,onMouseEnter:()=>C(t),children:[
6
+ /* @__PURE__ */d("path",{d:`M${u},${l} L${h},${l} L${h},${a} L${u},${a} Z`,fill:G(t)}),
7
+ /* @__PURE__ */d("text",{x:Q-12,y:r+4,textAnchor:"end",fontSize:12,fill:n.label,children:e.label}),h-u>=i&&/* @__PURE__ */d("text",{x:u+8,y:r+4,textAnchor:"start",fontSize:12,fontWeight:600,fill:J(t),style:{fontVariantNumeric:"tabular-nums"},children:o}),
8
+ /* @__PURE__ */f("text",{"data-funnel-value":"true",x:h+8,y:r+4,textAnchor:"start",fontSize:12,fill:n.label,style:{fontVariantNumeric:"tabular-nums"},children:[
9
+ /* @__PURE__ */d("tspan",{fontWeight:600,children:c}),m&&/* @__PURE__ */d("tspan",{fill:n.muted,children:` ${m}`})]})]},e.key)}const h=T(e.value),c="cone"===v?T(x[t+1]?.value??e.value):h,m=R(t),s=2*Math.min(h,c)>=i;/* @__PURE__ */
10
+ return f("g",{opacity:K(t,e.key)?.45:1,onMouseEnter:()=>C(t),children:[
11
+ /* @__PURE__ */d("path",{d:`M${X-h},${l} L${X+h},${l} L${X+c},${a} L${X-c},${a} Z`,fill:G(t)}),
12
+ /* @__PURE__ */d("text",{x:Q-14,y:r-2,textAnchor:"end",fontSize:12,fill:n.label,children:e.label}),
13
+ /* @__PURE__ */f("text",{x:Q-14,y:r+14,textAnchor:"end",fontSize:11,fill:n.muted,style:{fontVariantNumeric:"tabular-nums"},children:[L(e.value),null!=m?` · −${u(m,1,S)}`:""]}),
14
+ /* @__PURE__ */d("text",{x:s?X:X+Math.max(h,c)+6,y:r+4,textAnchor:s?"middle":"start",fontSize:12,fontWeight:600,fill:s?J(t):n.label,style:{fontVariantNumeric:"tabular-nums"},children:o})]},e.key)})]}),_&&null!==V&&/* @__PURE__ */d("div",{className:"pointer-events-none absolute top-2 left-2 z-10",children:/* @__PURE__ */d(l,{title:_.label,rows:[{key:"value",label:N.count,color:G(V),value:L(_.value)},{key:"share",label:N.ofFirstStage,color:n.muted,value:u(_.value/(x[0].value||1)*100,0,S)},...V>0&&x[V-1].value>0?[{key:"drop",label:N.droppedHere,color:r.critical,value:`−${u(100*(1-_.value/x[V-1].value),1,S)}`}]:[]]})})]})}export{x as FunnelChart};
@@ -1,4 +1,4 @@
1
- import{InputNumber_default as e}from"./chunk-SKFFBBAG.js";import{IconButton_default as r}from"./chunk-LE5LWALR.js";import{Icon as a}from"./chunk-UIWGVOFH.js";import{Tooltip as i}from"./chunk-NJN5IKWO.js";import{useShellStrings as n}from"./chunk-43MCNASD.js";import{useState as l,useRef as o}from"react";import{jsxs as t,jsx as s}from"react/jsx-runtime";var d={tl:"",tr:"rotate-90",br:"rotate-180",bl:"-rotate-90"},c=["tl","tr","bl","br"];function u({label:u,value:m,corners:f,onChange:p,radius:h=null,onRadiusChange:v,radiusLabel:b,radiusMin:k=0,radiusMax:g,radiusStep:x=1,radiusPlaceholder:w,disabled:y=!1,disabledReason:A,id:N,className:j=""}){const K=n(),C=function(e){const r=c.map(r=>e.find(e=>e.value===r));for(const a of e){if(c.includes(a.value))continue;const e=r.findIndex(e=>void 0===e);-1===e?r.push(a):r[e]=a}return r.filter(e=>void 0!==e)}(f),[L,M]=l(0),R=o(null);/* @__PURE__ */
2
- return t("div",{id:N,role:"group","aria-label":u,className:`flex min-w-0 flex-wrap items-center gap-2 ${j}`.trim(),children:[v&&
3
- /* @__PURE__ */s("div",{className:"w-30 shrink-0",children:/* @__PURE__ */s(e,{value:h,onChange:v,min:k,max:g,step:x,precision:0,placeholder:w,prefix:/* @__PURE__ */s("span",{"data-radius-mark":"","aria-hidden":"true",children:K.corners.radiusMark}),suffix:K.corners.unit,steppers:"compact",disabled:y,"aria-label":b??K.corners.radius})}),
4
- /* @__PURE__ */s("div",{ref:R,"data-corners-grid":"",className:"grid shrink-0 grid-cols-2 gap-1",onKeyDown:e=>{if(e.altKey||e.ctrlKey||e.metaKey)return;const r=Array.from(R.current?.querySelectorAll("button[data-corner]")??[]),a=r.indexOf(document.activeElement);if(-1===a)return;const i=a%2,n=Math.floor(a/2),l="ArrowRight"===e.key?2*n+1:"ArrowLeft"===e.key?2*n:"ArrowDown"===e.key?2+i:"ArrowUp"===e.key?i:null;null!==l&&(e.preventDefault(),l<r.length&&r[l].focus())},children:C.map((e,n)=>{const l=m.includes(e.value),o=y||!0===e.disabled,t=o&&(!0===e.disabled&&e.title||(y?A:void 0))||void 0,c=/* @__PURE__ */s(r,{"aria-pressed":l,"aria-label":e.label,"aria-disabled":o||void 0,disabledReason:t,"data-corner":e.value,size:"sm",tabIndex:n===L?0:-1,onFocus:()=>M(n),onClick:()=>{o||p(l?m.filter(r=>r!==e.value):[...m,e.value])},children:/* @__PURE__ */s(a,{name:"corner",strokeWidth:2,className:["h-4 w-4",d[e.value]??""].filter(Boolean).join(" ")})},e.value);return t?c:/* @__PURE__ */s(i,{content:e.title??e.label,children:c},e.value)})})]})}export{u as CornersInput};
1
+ import{InputNumber_default as e}from"./chunk-N7YHXL2F.js";import{IconButton_default as r}from"./chunk-UGOJLNYR.js";import{Icon as a}from"./chunk-UIWGVOFH.js";import{Tooltip as i}from"./chunk-QQ2LDC6C.js";import{useShellStrings as n}from"./chunk-43MCNASD.js";import{useState as l,useRef as o}from"react";import{jsxs as t,jsx as s}from"react/jsx-runtime";var d={tl:"",tr:"rotate-90",br:"rotate-180",bl:"-rotate-90"},c=["tl","tr","bl","br"];function u({label:u,value:m,corners:f,onChange:p,radius:h=null,onRadiusChange:v,radiusLabel:b,radiusMin:k=0,radiusMax:g,radiusStep:x=1,radiusPlaceholder:w,disabled:y=!1,disabledReason:N,id:j,className:A=""}){const C=n(),D=function(e){const r=c.map(r=>e.find(e=>e.value===r));for(const a of e){if(c.includes(a.value))continue;const e=r.findIndex(e=>void 0===e);-1===e?r.push(a):r[e]=a}return r.filter(e=>void 0!==e)}(f),[L,M]=l(0),R=o(null);/* @__PURE__ */
2
+ return t("div",{id:j,role:"group","aria-label":u,className:`flex min-w-0 flex-wrap items-center gap-2 ${A}`.trim(),children:[v&&
3
+ /* @__PURE__ */s("div",{className:"w-30 shrink-0",children:/* @__PURE__ */s(e,{value:h,onChange:v,min:k,max:g,step:x,precision:0,placeholder:w,prefix:/* @__PURE__ */s("span",{"data-radius-mark":"","aria-hidden":"true",children:C.corners.radiusMark}),suffix:C.corners.unit,steppers:"compact",disabled:y,"aria-label":b??C.corners.radius})}),
4
+ /* @__PURE__ */s("div",{ref:R,"data-corners-grid":"",className:"grid shrink-0 grid-cols-2 gap-1",onKeyDown:e=>{if(e.altKey||e.ctrlKey||e.metaKey)return;const r=Array.from(R.current?.querySelectorAll("button[data-corner]")??[]),a=r.indexOf(document.activeElement);if(-1===a)return;const i=a%2,n=Math.floor(a/2),l="ArrowRight"===e.key?2*n+1:"ArrowLeft"===e.key?2*n:"ArrowDown"===e.key?2+i:"ArrowUp"===e.key?i:null;null!==l&&(e.preventDefault(),l<r.length&&r[l].focus())},children:D.map((e,n)=>{const l=m.includes(e.value),o=y||!0===e.disabled,t=o&&(!0===e.disabled&&e.title||(y?N:void 0))||void 0,c=/* @__PURE__ */s(r,{"aria-pressed":l,"aria-label":e.label,"aria-disabled":o||void 0,disabledReason:t,"data-corner":e.value,size:"sm",tabIndex:n===L?0:-1,onFocus:()=>M(n),onClick:()=>{o||p(l?m.filter(r=>r!==e.value):[...m,e.value])},children:/* @__PURE__ */s(a,{name:"corner",strokeWidth:2,className:["h-4 w-4",d[e.value]??""].filter(Boolean).join(" ")})},e.value);return t?c:/* @__PURE__ */s(i,{content:e.title??e.label,children:c},e.value)})})]})}export{u as CornersInput};