@nivaro/react 0.2.53 → 0.2.55

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 (294) hide show
  1. package/dist/full.css +1 -1
  2. package/dist/hooks/useSessionRecorder.js +99 -98
  3. package/dist/index.d.ts +452 -4
  4. package/dist/index.js +644 -618
  5. package/dist/layout-editor.d.ts +252 -2
  6. package/dist/shared/components/BackgroundRunOffer.js +117 -0
  7. package/dist/shared/components/BroadcastView.js +214 -213
  8. package/dist/shared/components/CollectionBrowserView.js +2592 -2695
  9. package/dist/shared/components/FormWhatsNew.js +60 -0
  10. package/dist/shared/components/ItemEditForm.js +3968 -3618
  11. package/dist/shared/components/JobsTray.js +100 -55
  12. package/dist/shared/components/MyWorkView.js +91 -89
  13. package/dist/shared/components/NotificationBell.js +80 -79
  14. package/dist/shared/components/ProfileView.js +568 -520
  15. package/dist/shared/components/RecordCompare.js +254 -0
  16. package/dist/shared/components/RecordReadView.js +598 -543
  17. package/dist/shared/components/ReportView.js +578 -543
  18. package/dist/shared/components/RowPresence.js +91 -0
  19. package/dist/shared/components/TipLayer.js +27 -27
  20. package/dist/shared/components/WidgetSlot.js +474 -458
  21. package/dist/shared/components/ai/AiAnalyticsView.js +16 -6
  22. package/dist/shared/components/ai/AskPanel.js +139 -119
  23. package/dist/shared/components/ai/FirstWeekCard.js +126 -0
  24. package/dist/shared/components/bulk/BulkFieldUpdate.js +289 -0
  25. package/dist/shared/components/bulk/bulk-field-options.js +45 -0
  26. package/dist/shared/components/charts/CumulativeFlowChart.js +176 -0
  27. package/dist/shared/components/chat/ChannelArchive.js +326 -0
  28. package/dist/shared/components/chat/ChannelExtras.js +141 -121
  29. package/dist/shared/components/chat/ChatAnalyticsView.js +112 -110
  30. package/dist/shared/components/chat/ChatPanel.js +1695 -1733
  31. package/dist/shared/components/chat/Composer.js +357 -303
  32. package/dist/shared/components/chat/MessageActions.js +92 -0
  33. package/dist/shared/components/chat/MessageFormat.js +290 -264
  34. package/dist/shared/components/chat/OutboxBubbles.js +146 -0
  35. package/dist/shared/components/chat/RequestIdCard.js +135 -0
  36. package/dist/shared/components/chat/RoomHeaderMenu.js +202 -0
  37. package/dist/shared/components/chat/RoomParts.js +213 -274
  38. package/dist/shared/components/chat/ScreenClip.js +184 -0
  39. package/dist/shared/components/chat/chat-core.js +402 -483
  40. package/dist/shared/components/chat/chat-drafts.js +59 -0
  41. package/dist/shared/components/chat/chat-emoji.js +348 -0
  42. package/dist/shared/components/chat/chat-local-time.js +41 -0
  43. package/dist/shared/components/chat/chat-outbox.js +303 -0
  44. package/dist/shared/components/chat/chat-window.js +163 -0
  45. package/dist/shared/components/chat/huddle/HuddleControls.js +143 -0
  46. package/dist/shared/components/chat/huddle/HuddleStage.js +164 -0
  47. package/dist/shared/components/chat/huddle/huddle-store.js +342 -0
  48. package/dist/shared/components/chat/huddle/useHuddle.js +58 -0
  49. package/dist/shared/components/help-videos/api.js +80 -67
  50. package/dist/shared/components/help-videos/editor/DetailsTab.js +147 -130
  51. package/dist/shared/components/item-edit/CatalogPickerField.js +113 -112
  52. package/dist/shared/components/item-edit/ChangeReasonDialog.js +13 -13
  53. package/dist/shared/components/item-edit/FieldAffordances.js +9 -8
  54. package/dist/shared/components/item-edit/FieldRenderer.js +248 -245
  55. package/dist/shared/components/item-edit/FieldRow.js +382 -320
  56. package/dist/shared/components/item-edit/FormHelpVideoButton.js +59 -0
  57. package/dist/shared/components/item-edit/GroupSection.js +786 -639
  58. package/dist/shared/components/item-edit/HeaderTools.js +59 -56
  59. package/dist/shared/components/item-edit/InlineTableField.js +3 -1
  60. package/dist/shared/components/item-edit/LayoutContentBlock.js +47 -24
  61. package/dist/shared/components/item-edit/RelationCombobox.js +186 -176
  62. package/dist/shared/components/item-edit/entry/EntryStrip.js +54 -0
  63. package/dist/shared/components/item-edit/entry/entry-keys.js +27 -0
  64. package/dist/shared/components/item-edit/entry/useEntryKeyboard.js +70 -0
  65. package/dist/shared/components/item-edit/entry/useEntryMode.js +59 -0
  66. package/dist/shared/components/item-edit/form-structure-ui.js +105 -0
  67. package/dist/shared/components/item-edit/lazy-sections.js +36 -0
  68. package/dist/shared/components/item-edit/lock-why.js +94 -0
  69. package/dist/shared/components/item-edit/picker-miss.js +26 -0
  70. package/dist/shared/components/item-edit/placement-behaviour.js +196 -0
  71. package/dist/shared/components/item-edit/useFormUsageBeacon.js +65 -0
  72. package/dist/shared/components/layout-editor/AddPanel.js +226 -151
  73. package/dist/shared/components/layout-editor/ArrangeButton.js +34 -0
  74. package/dist/shared/components/layout-editor/AutoArrange.js +86 -0
  75. package/dist/shared/components/layout-editor/CanvasCompare.js +79 -0
  76. package/dist/shared/components/layout-editor/ChangeNote.js +147 -0
  77. package/dist/shared/components/layout-editor/CollabParts.js +175 -0
  78. package/dist/shared/components/layout-editor/DesignNode.js +311 -116
  79. package/dist/shared/components/layout-editor/EditorCanvas.js +30 -26
  80. package/dist/shared/components/layout-editor/EditorTopBar.js +463 -175
  81. package/dist/shared/components/layout-editor/FindReplace.js +188 -0
  82. package/dist/shared/components/layout-editor/FormMapButton.js +141 -0
  83. package/dist/shared/components/layout-editor/HistoryPanel.js +250 -109
  84. package/dist/shared/components/layout-editor/LayoutEditor.js +1196 -305
  85. package/dist/shared/components/layout-editor/LayoutsRail.js +94 -67
  86. package/dist/shared/components/layout-editor/NoteMarker.js +38 -0
  87. package/dist/shared/components/layout-editor/PlacementsTable.js +187 -0
  88. package/dist/shared/components/layout-editor/RestorePiece.js +143 -0
  89. package/dist/shared/components/layout-editor/ScheduleChange.js +106 -0
  90. package/dist/shared/components/layout-editor/SessionHistory.js +84 -0
  91. package/dist/shared/components/layout-editor/StagedChip.js +22 -0
  92. package/dist/shared/components/layout-editor/StructureMenu.js +464 -0
  93. package/dist/shared/components/layout-editor/UnsavedConfirm.js +103 -0
  94. package/dist/shared/components/layout-editor/ai/AiToolsButton.js +625 -0
  95. package/dist/shared/components/layout-editor/ai/ChangeCheck.js +153 -0
  96. package/dist/shared/components/layout-editor/ai/ai-tools-api.js +80 -0
  97. package/dist/shared/components/layout-editor/ai/assist-ops.js +38 -0
  98. package/dist/shared/components/layout-editor/ai/autofill-ops.js +73 -0
  99. package/dist/shared/components/layout-editor/ai/canvas-capture.js +41 -0
  100. package/dist/shared/components/layout-editor/ai-forms/AiComposer.js +271 -0
  101. package/dist/shared/components/layout-editor/ai-forms/AiFormsButton.js +182 -0
  102. package/dist/shared/components/layout-editor/ai-forms/MeaningSuggestions.js +109 -0
  103. package/dist/shared/components/layout-editor/ai-forms/SlimPanel.js +170 -0
  104. package/dist/shared/components/layout-editor/ai-forms/ai-forms-api.js +40 -0
  105. package/dist/shared/components/layout-editor/ai-forms/pending.js +25 -0
  106. package/dist/shared/components/layout-editor/ai-forms/plan.js +263 -0
  107. package/dist/shared/components/layout-editor/ai-rules/AiAskPopover.js +160 -0
  108. package/dist/shared/components/layout-editor/ai-rules/CascadeWriter.js +175 -0
  109. package/dist/shared/components/layout-editor/ai-rules/FieldRuleWriter.js +97 -0
  110. package/dist/shared/components/layout-editor/ai-rules/RuleWriter.js +94 -0
  111. package/dist/shared/components/layout-editor/ai-rules/ValidationSuggest.js +153 -0
  112. package/dist/shared/components/layout-editor/ai-rules/api.js +6 -0
  113. package/dist/shared/components/layout-editor/ai-text/AiTextTools.js +383 -0
  114. package/dist/shared/components/layout-editor/ai-text/text-ops.js +125 -0
  115. package/dist/shared/components/layout-editor/assist/AskPanel.js +278 -0
  116. package/dist/shared/components/layout-editor/assist/ExplainDiff.js +93 -0
  117. package/dist/shared/components/layout-editor/assist/ProposalsButton.js +150 -0
  118. package/dist/shared/components/layout-editor/assist/assist-api.js +63 -0
  119. package/dist/shared/components/layout-editor/assist/jump.js +142 -0
  120. package/dist/shared/components/layout-editor/assist/settings-index.js +118 -0
  121. package/dist/shared/components/layout-editor/auto-arrange.js +101 -0
  122. package/dist/shared/components/layout-editor/bulk/BulkChangesButton.js +221 -0
  123. package/dist/shared/components/layout-editor/bulk/BulkRun.js +237 -0
  124. package/dist/shared/components/layout-editor/bulk/MacrosPanel.js +230 -0
  125. package/dist/shared/components/layout-editor/bulk/bulk-api.js +65 -0
  126. package/dist/shared/components/layout-editor/bulk/field-labels.js +22 -0
  127. package/dist/shared/components/layout-editor/bulk/macro-record.js +142 -0
  128. package/dist/shared/components/layout-editor/bulk/useMacroRecorder.js +65 -0
  129. package/dist/shared/components/layout-editor/bundle-to-active.js +1 -0
  130. package/dist/shared/components/layout-editor/canvas-diff.js +157 -0
  131. package/dist/shared/components/layout-editor/collab/FormFollowShare.js +388 -0
  132. package/dist/shared/components/layout-editor/collab/collab-api.js +80 -0
  133. package/dist/shared/components/layout-editor/commands/CommandPalette.js +221 -0
  134. package/dist/shared/components/layout-editor/commands/intents.js +214 -0
  135. package/dist/shared/components/layout-editor/commands/parse.js +242 -0
  136. package/dist/shared/components/layout-editor/design-context.js +26 -6
  137. package/dist/shared/components/layout-editor/dnd/LayoutDndProvider.js +181 -164
  138. package/dist/shared/components/layout-editor/dnd/collision.js +25 -23
  139. package/dist/shared/components/layout-editor/dnd/node.js +69 -57
  140. package/dist/shared/components/layout-editor/dnd/rail-drop.js +56 -0
  141. package/dist/shared/components/layout-editor/draft-recovery.js +131 -0
  142. package/dist/shared/components/layout-editor/editor-notes.js +78 -0
  143. package/dist/shared/components/layout-editor/editors/swap-config.js +1 -0
  144. package/dist/shared/components/layout-editor/entry/PlacementPresets.js +149 -0
  145. package/dist/shared/components/layout-editor/entry/entry-editor-context.js +10 -0
  146. package/dist/shared/components/layout-editor/entry/presets.js +71 -0
  147. package/dist/shared/components/layout-editor/entry/tab-order.js +110 -0
  148. package/dist/shared/components/layout-editor/entry/theme-preview.js +37 -0
  149. package/dist/shared/components/layout-editor/explain/CanvasRules.js +142 -0
  150. package/dist/shared/components/layout-editor/explain/default-ghosts.js +81 -0
  151. package/dist/shared/components/layout-editor/explain/driver-hover.js +62 -0
  152. package/dist/shared/components/layout-editor/explain/field-sources.js +246 -0
  153. package/dist/shared/components/layout-editor/explain/rule-graph.js +215 -0
  154. package/dist/shared/components/layout-editor/explain/use-explain.js +132 -0
  155. package/dist/shared/components/layout-editor/field-zones.js +116 -0
  156. package/dist/shared/components/layout-editor/form-map.js +138 -0
  157. package/dist/shared/components/layout-editor/grid-guides.js +142 -0
  158. package/dist/shared/components/layout-editor/history-api.js +87 -0
  159. package/dist/shared/components/layout-editor/inheritance.js +55 -0
  160. package/dist/shared/components/layout-editor/inspect/inspect-api.js +66 -0
  161. package/dist/shared/components/layout-editor/inspect/picker-preview.js +48 -0
  162. package/dist/shared/components/layout-editor/inspect/width-fit.js +87 -0
  163. package/dist/shared/components/layout-editor/inspector/AiFillSetting.js +85 -0
  164. package/dist/shared/components/layout-editor/inspector/BehaviourSettings.js +402 -0
  165. package/dist/shared/components/layout-editor/inspector/Breadcrumb.js +36 -0
  166. package/dist/shared/components/layout-editor/inspector/BulkInspector.js +179 -0
  167. package/dist/shared/components/layout-editor/inspector/ColumnFit.js +112 -0
  168. package/dist/shared/components/layout-editor/inspector/GroupInspector.js +291 -141
  169. package/dist/shared/components/layout-editor/inspector/HelpTab.js +174 -0
  170. package/dist/shared/components/layout-editor/inspector/Inspector.js +282 -180
  171. package/dist/shared/components/layout-editor/inspector/LookTab.js +166 -109
  172. package/dist/shared/components/layout-editor/inspector/OverrideNotice.js +61 -0
  173. package/dist/shared/components/layout-editor/inspector/PickerMisses.js +129 -0
  174. package/dist/shared/components/layout-editor/inspector/PickerPreview.js +134 -0
  175. package/dist/shared/components/layout-editor/inspector/PickerTab.js +146 -118
  176. package/dist/shared/components/layout-editor/inspector/RulesTab.js +162 -111
  177. package/dist/shared/components/layout-editor/inspector/Translations.js +156 -0
  178. package/dist/shared/components/layout-editor/inspector/kit.js +71 -70
  179. package/dist/shared/components/layout-editor/inspector/tab-request.js +21 -0
  180. package/dist/shared/components/layout-editor/is-typing.js +9 -0
  181. package/dist/shared/components/layout-editor/keyboard-move.js +66 -0
  182. package/dist/shared/components/layout-editor/lint/LintPanel.js +190 -0
  183. package/dist/shared/components/layout-editor/lint/lint-api.js +52 -0
  184. package/dist/shared/components/layout-editor/load-error.js +37 -0
  185. package/dist/shared/components/layout-editor/matrix/FieldStateMatrix.js +305 -0
  186. package/dist/shared/components/layout-editor/matrix/MatrixGrid.js +181 -0
  187. package/dist/shared/components/layout-editor/matrix/RoleSectionMatrix.js +147 -0
  188. package/dist/shared/components/layout-editor/matrix/matrix-api.js +48 -0
  189. package/dist/shared/components/layout-editor/matrix/role-matrix.js +36 -0
  190. package/dist/shared/components/layout-editor/matrix/state-matrix.js +145 -0
  191. package/dist/shared/components/layout-editor/nav/FindPanel.js +109 -0
  192. package/dist/shared/components/layout-editor/nav/NavTools.js +114 -0
  193. package/dist/shared/components/layout-editor/nav/OutlinePanel.js +228 -0
  194. package/dist/shared/components/layout-editor/nav/ShortcutSheet.js +31 -0
  195. package/dist/shared/components/layout-editor/nav/find.js +20 -0
  196. package/dist/shared/components/layout-editor/nav/tree.js +142 -0
  197. package/dist/shared/components/layout-editor/nav/useEditorNav.js +101 -0
  198. package/dist/shared/components/layout-editor/nav/view-prefs.js +34 -0
  199. package/dist/shared/components/layout-editor/ops/ChangeRequestsPanel.js +143 -0
  200. package/dist/shared/components/layout-editor/ops/DependencyDiagram.js +179 -0
  201. package/dist/shared/components/layout-editor/ops/LayoutOpsBlocks.js +92 -0
  202. package/dist/shared/components/layout-editor/ops/PromotePanel.js +287 -0
  203. package/dist/shared/components/layout-editor/ops/ops-api.js +122 -0
  204. package/dist/shared/components/layout-editor/outputs/OutputsButton.js +254 -0
  205. package/dist/shared/components/layout-editor/outputs/help-sheet.js +154 -0
  206. package/dist/shared/components/layout-editor/outputs/output-api.js +61 -0
  207. package/dist/shared/components/layout-editor/overview/OverviewActions.js +15 -3
  208. package/dist/shared/components/layout-editor/overview/describe-conditions.js +24 -14
  209. package/dist/shared/components/layout-editor/overview/overview-api.js +105 -88
  210. package/dist/shared/components/layout-editor/overview/purpose.js +15 -13
  211. package/dist/shared/components/layout-editor/panel-style.js +8 -7
  212. package/dist/shared/components/layout-editor/parity-keys.json.js +4 -0
  213. package/dist/shared/components/layout-editor/pin.js +25 -0
  214. package/dist/shared/components/layout-editor/presence.js +111 -0
  215. package/dist/shared/components/layout-editor/preview/PreviewModes.js +224 -0
  216. package/dist/shared/components/layout-editor/preview/PreviewPanes.js +262 -0
  217. package/dist/shared/components/layout-editor/preview/preview-api.js +57 -0
  218. package/dist/shared/components/layout-editor/preview/preview-model.js +157 -0
  219. package/dist/shared/components/layout-editor/restore-piece.js +192 -0
  220. package/dist/shared/components/layout-editor/reuse/FieldMapStep.js +70 -0
  221. package/dist/shared/components/layout-editor/reuse/FormMoreMenu.js +127 -0
  222. package/dist/shared/components/layout-editor/reuse/LibraryRows.js +150 -0
  223. package/dist/shared/components/layout-editor/reuse/NewFormStart.js +20 -0
  224. package/dist/shared/components/layout-editor/reuse/SectionReuseActions.js +291 -0
  225. package/dist/shared/components/layout-editor/reuse/field-match.js +77 -0
  226. package/dist/shared/components/layout-editor/reuse/reuse-api.js +73 -0
  227. package/dist/shared/components/layout-editor/reuse/seed.js +13 -0
  228. package/dist/shared/components/layout-editor/reuse/useFormFromRecord.js +43 -0
  229. package/dist/shared/components/layout-editor/reuse/useRailCopy.js +34 -0
  230. package/dist/shared/components/layout-editor/section-structure.js +241 -0
  231. package/dist/shared/components/layout-editor/settings/EntrySection.js +296 -0
  232. package/dist/shared/components/layout-editor/settings/FormSettings.js +125 -103
  233. package/dist/shared/components/layout-editor/settings/InheritanceSection.js +1 -1
  234. package/dist/shared/components/layout-editor/settings/ResolveSettings.js +255 -0
  235. package/dist/shared/components/layout-editor/settings/ToolsSection.js +215 -105
  236. package/dist/shared/components/layout-editor/settings/WhoSection.js +139 -100
  237. package/dist/shared/components/layout-editor/settings/controls.js +8 -8
  238. package/dist/shared/components/layout-editor/settings/settings-registry.js +142 -21
  239. package/dist/shared/components/layout-editor/shortcuts.js +88 -0
  240. package/dist/shared/components/layout-editor/show-when.js +35 -0
  241. package/dist/shared/components/layout-editor/slot-names.js +4 -3
  242. package/dist/shared/components/layout-editor/staged-api.js +64 -0
  243. package/dist/shared/components/layout-editor/structure-ops.js +403 -0
  244. package/dist/shared/components/layout-editor/testing/CostLimitSetting.js +42 -0
  245. package/dist/shared/components/layout-editor/testing/TestingPanels.js +556 -0
  246. package/dist/shared/components/layout-editor/testing/testing-api.js +67 -0
  247. package/dist/shared/components/layout-editor/testing/testing-model.js +406 -0
  248. package/dist/shared/components/layout-editor/testing/use-record-check.js +44 -0
  249. package/dist/shared/components/layout-editor/toolbar-kit.js +242 -0
  250. package/dist/shared/components/layout-editor/unsaved-marks.js +72 -0
  251. package/dist/shared/components/layout-editor/usage/AbTestSection.js +355 -0
  252. package/dist/shared/components/layout-editor/usage/FillChip.js +27 -0
  253. package/dist/shared/components/layout-editor/usage/UsagePanel.js +232 -0
  254. package/dist/shared/components/layout-editor/usage/ab-api.js +86 -0
  255. package/dist/shared/components/layout-editor/usage/suggest-collapse.js +32 -0
  256. package/dist/shared/components/layout-editor/usage/suggest-sections.js +55 -0
  257. package/dist/shared/components/layout-editor/usage/usage-api.js +104 -0
  258. package/dist/shared/components/layout-editor/useLayoutDraft.js +573 -306
  259. package/dist/shared/components/notifications/NotificationAnalyticsView.js +148 -77
  260. package/dist/shared/components/panels/ErpFailureBanner.js +18 -17
  261. package/dist/shared/components/panels/ExternalRequestsChip.js +63 -62
  262. package/dist/shared/components/pipeline/PipelineEditorView.js +106 -104
  263. package/dist/shared/components/profile/AgentsPanel.js +479 -0
  264. package/dist/shared/components/queue/QueueWorklist.js +1026 -1040
  265. package/dist/shared/components/support/SuggestFormChange.js +143 -0
  266. package/dist/shared/components/support/SupportAnalytics.js +171 -0
  267. package/dist/shared/components/support/SupportView.js +75 -73
  268. package/dist/shared/lib/ai-fill.js +37 -0
  269. package/dist/shared/lib/background-runs.js +150 -0
  270. package/dist/shared/lib/delivery-ack.js +9 -0
  271. package/dist/shared/lib/entry-badge-style.js +13 -0
  272. package/dist/shared/lib/entry-config.js +71 -0
  273. package/dist/shared/lib/form-sections.js +64 -0
  274. package/dist/shared/lib/form-structure.js +99 -0
  275. package/dist/shared/lib/form-usage-beacon.js +133 -0
  276. package/dist/shared/lib/jobs-tray.js +25 -23
  277. package/dist/shared/lib/keyset-pager.js +37 -0
  278. package/dist/shared/lib/layout-i18n.js +66 -0
  279. package/dist/shared/lib/layout-lint.js +490 -0
  280. package/dist/shared/lib/layout-ops.js +116 -110
  281. package/dist/shared/lib/layout-resolve.js +113 -0
  282. package/dist/shared/lib/placement-behaviour.js +144 -0
  283. package/dist/shared/lib/prefetch.js +149 -0
  284. package/dist/shared/lib/presence-hooks.js +199 -0
  285. package/dist/shared/lib/record-outbox.js +82 -81
  286. package/dist/shared/lib/replay-socket.js +93 -0
  287. package/dist/shared/lib/request-gate.js +51 -50
  288. package/dist/shared/lib/room-gaps.js +96 -0
  289. package/dist/shared/lib/screenshot.js +54 -28
  290. package/dist/shared/lib/search-log.js +27 -0
  291. package/dist/shared/lib/socket-realtime.js +101 -80
  292. package/dist/shared/lib/visible-when.js +34 -0
  293. package/dist/shared/lib/worker-socket.js +200 -0
  294. package/package.json +1 -1
@@ -59,7 +59,7 @@ function J({ id: d }) {
59
59
  }
60
60
  function te() {
61
61
  var L, R, B;
62
- const d = C(), [s, n] = g(168), [o, i] = g(""), [l, $] = g(""), [x, F] = g(""), [h, b] = g(1), [v, D] = g(null), S = _({
62
+ const d = C(), [s, n] = g(168), [o, i] = g(""), [l, $] = g(""), [x, S] = g(""), [h, b] = g(1), [v, D] = g(null), F = _({
63
63
  queryKey: ["nvr-ai-analytics", s],
64
64
  queryFn: () => d.request(w("/ai/analytics", { hours: s })),
65
65
  refetchInterval: 6e4
@@ -76,7 +76,7 @@ function te() {
76
76
  })
77
77
  ),
78
78
  placeholderData: (t) => t
79
- }), a = (L = S.data) == null ? void 0 : L.data, M = ((R = k.data) == null ? void 0 : R.data) ?? [], A = ((B = k.data) == null ? void 0 : B.total) ?? 0, I = Math.max(1, Math.ceil(A / 50));
79
+ }), a = (L = F.data) == null ? void 0 : L.data, M = ((R = k.data) == null ? void 0 : R.data) ?? [], A = ((B = k.data) == null ? void 0 : B.total) ?? 0, I = Math.max(1, Math.ceil(A / 50));
80
80
  return /* @__PURE__ */ r("div", { className: "flex flex-col gap-4", "data-ai-analytics": !0, children: [
81
81
  /* @__PURE__ */ r("div", { className: "flex flex-wrap items-center gap-2", children: [
82
82
  /* @__PURE__ */ e("div", { className: "inline-flex rounded-md border border-border p-0.5", children: H.map((t) => /* @__PURE__ */ e(
@@ -99,7 +99,7 @@ function te() {
99
99
  {
100
100
  type: "button",
101
101
  onClick: () => {
102
- S.refetch(), k.refetch();
102
+ F.refetch(), k.refetch();
103
103
  },
104
104
  className: "inline-flex h-7 items-center gap-1 rounded-md border border-border px-2 text-[12px] text-muted-foreground hover:bg-muted",
105
105
  children: [
@@ -264,7 +264,7 @@ function te() {
264
264
  "button",
265
265
  {
266
266
  type: "button",
267
- onClick: () => F(""),
267
+ onClick: () => S(""),
268
268
  className: "rounded bg-nvr-cyan/15 px-1.5 py-0.5 text-[11px]",
269
269
  children: [
270
270
  "question ",
@@ -325,7 +325,7 @@ function te() {
325
325
  className: "ml-1 text-[10.5px] text-muted-foreground underline-offset-2 hover:underline",
326
326
  "data-tip": "Show every call of this question",
327
327
  onClick: (q) => {
328
- q.stopPropagation(), F(t.request_id ?? ""), b(1);
328
+ q.stopPropagation(), S(t.request_id ?? ""), b(1);
329
329
  },
330
330
  children: [
331
331
  "#",
@@ -335,7 +335,17 @@ function te() {
335
335
  ) : null
336
336
  ] }),
337
337
  /* @__PURE__ */ e("td", { className: "max-w-[160px] truncate px-2 py-1.5", children: t.user_name ?? (t.user ? "…" : "System") }),
338
- /* @__PURE__ */ e("td", { className: "px-2 py-1.5 font-mono text-[11px]", children: t.model }),
338
+ /* @__PURE__ */ r("td", { className: "px-2 py-1.5 font-mono text-[11px]", children: [
339
+ t.model,
340
+ t.tier && /* @__PURE__ */ e(
341
+ "span",
342
+ {
343
+ className: "ml-1.5 rounded bg-muted px-1 py-px font-sans text-[10px] text-muted-foreground",
344
+ "data-tip": t.tier === "cheap" ? "Started cheap: the small model" : `Moved up to the main model${t.tier_reason ? ` (${t.tier_reason.replace(/_/g, " ")})` : ""}`,
345
+ children: t.tier === "cheap" ? "quick" : "moved up"
346
+ }
347
+ )
348
+ ] }),
339
349
  /* @__PURE__ */ e("td", { className: "px-2 py-1.5 text-right", children: u(t.input_tokens) }),
340
350
  /* @__PURE__ */ e("td", { className: "px-2 py-1.5 text-right text-muted-foreground", children: u(t.cache_read_tokens) }),
341
351
  /* @__PURE__ */ e("td", { className: "px-2 py-1.5 text-right", children: u(t.output_tokens) }),
@@ -1,7 +1,7 @@
1
1
  import { jsx as t, jsxs as i } from "react/jsx-runtime";
2
2
  import { useQuery as he } from "@tanstack/react-query";
3
- import { FileText as re, Rows3 as xe, ListChecks as be, LayoutDashboard as ge, Paperclip as M, Sparkles as ve, ExternalLink as ye, Plus as ke, X as ne, Loader2 as oe, Square as Ne, Send as we } from "lucide-react";
4
- import { useState as c, useEffect as g, useRef as D } from "react";
3
+ import { FileText as re, Rows3 as xe, ListChecks as be, LayoutDashboard as ge, Paperclip as L, Sparkles as ye, ExternalLink as ve, Plus as ke, X as ne, Loader2 as oe, Square as Ne, Send as we } from "lucide-react";
4
+ import { useState as c, useEffect as y, useRef as R } from "react";
5
5
  import { createPortal as Ae } from "react-dom";
6
6
  import { useNivaroClient as $e, useNavigation as Ce } from "../../context.js";
7
7
  import { get as De } from "../../lib/commands.js";
@@ -10,119 +10,127 @@ import { cn as se } from "../../lib/utils.js";
10
10
  import { AiFeedbackButtons as qe } from "./AiFeedbackButtons.js";
11
11
  import { AiMarkdown as ae } from "./AiMarkdown.js";
12
12
  import { AiStepList as Ee } from "./AiStepList.js";
13
- import { useAskHost as le, readDroppedRecord as Se, askContextBody as Te } from "./ask-context.js";
14
- const Ie = ".pdf,.docx,.xlsx,.xls,.xlsm,.csv,.txt,.md,.eml,.html,.htm", Oe = 20, R = 5;
13
+ import { useAskHost as le, readDroppedRecord as Se, askContextBody as Oe } from "./ask-context.js";
14
+ const Te = ".pdf,.docx,.xlsx,.xls,.xlsm,.csv,.txt,.md,.eml,.html,.htm", Ie = 20, q = 5;
15
15
  function We({
16
- subscribe: q,
17
- connected: E,
18
- askPath: S = "/ask"
16
+ subscribe: E,
17
+ connected: S,
18
+ askPath: O = "/ask"
19
19
  }) {
20
- const s = le(), [f, T] = c(!1);
21
- return g(() => {
20
+ const s = le(), [p, T] = c(!1);
21
+ return y(() => {
22
22
  s != null && s.open && T(!0);
23
- }, [s == null ? void 0 : s.open]), !s || !f || typeof document > "u" ? null : Ae(
24
- /* @__PURE__ */ t(je, { subscribe: q, connected: E, askPath: S }),
23
+ }, [s == null ? void 0 : s.open]), !s || !p || typeof document > "u" ? null : Ae(
24
+ /* @__PURE__ */ t(je, { subscribe: E, connected: S, askPath: O }),
25
25
  document.body
26
26
  );
27
27
  }
28
28
  function je({
29
- subscribe: q,
30
- connected: E,
31
- askPath: S
29
+ subscribe: E,
30
+ connected: S,
31
+ askPath: O
32
32
  }) {
33
33
  var Z, ee, te;
34
- const s = le(), f = $e(), { navigate: T } = Ce(), r = s.page, [x, v] = c([]), [y, k] = c(""), [I, B] = c(null), [h, z] = c(/* @__PURE__ */ new Set()), [Q, O] = c([]), [N, j] = c([]), [P, X] = c(0), [H, J] = c([]), [U, _] = c(!1), [W, b] = c(null), F = D(null), K = D(null), G = D(null), V = D(null);
34
+ const s = le(), p = $e(), { navigate: T } = Ce(), n = s.page, [h, v] = c([]), [k, N] = c(""), [I, M] = c(null), [x, B] = c(/* @__PURE__ */ new Set()), [Q, j] = c([]), [w, _] = c([]), [P, z] = c(0), [X, J] = c([]), [U, F] = c(!1), [W, g] = c(null), H = R(null), K = R(null), G = R(null), V = R(null);
35
35
  V.current = I;
36
- const ie = JSON.stringify(r ?? {});
37
- g(() => {
38
- z(/* @__PURE__ */ new Set()), J([]);
36
+ const ie = JSON.stringify(n ?? {});
37
+ y(() => {
38
+ B(/* @__PURE__ */ new Set()), J([]);
39
39
  }, [ie]);
40
40
  const ce = ((Z = s.seed) == null ? void 0 : Z.at) ?? 0;
41
- g(() => {
41
+ y(() => {
42
42
  var e;
43
- (e = s.seed) != null && e.question && k(s.seed.question);
44
- }, [ce]), g(() => {
43
+ (e = s.seed) != null && e.question && N(s.seed.question);
44
+ }, [ce]), y(() => {
45
45
  var e;
46
- s.open && ((e = F.current) == null || e.focus());
46
+ s.open && ((e = H.current) == null || e.focus());
47
47
  }, [s.open]);
48
- const d = r != null && r.record && !h.has("record") ? r.record : null, { data: w } = he({
48
+ const d = n != null && n.record && !x.has("record") ? n.record : null, { data: A } = he({
49
49
  queryKey: ["ask-panel-record-files", d == null ? void 0 : d.collection, d == null ? void 0 : d.id],
50
- queryFn: () => f.request(
50
+ queryFn: () => p.request(
51
51
  De("/ai/ask/record-files", { collection: d.collection, id: d.id })
52
52
  ).then((e) => e.data),
53
53
  enabled: !!d,
54
54
  staleTime: 6e4,
55
55
  retry: !1
56
- }), l = Re(f, {
57
- subscribe: q,
58
- connected: E,
56
+ }), l = Re(p, {
57
+ subscribe: E,
58
+ connected: S,
59
59
  onDone: (e) => {
60
- v((n) => [
61
- ...n,
62
- {
63
- role: "assistant",
64
- content: e.reply,
65
- requestId: e.request_id ?? null,
66
- stopped: e.stopped === !0
67
- }
68
- ]), e.conversation_id && B(e.conversation_id);
60
+ v((r) => {
61
+ var o;
62
+ return [
63
+ ...r,
64
+ {
65
+ role: "assistant",
66
+ content: e.reply,
67
+ requestId: e.request_id ?? null,
68
+ stopped: e.stopped === !0,
69
+ quick: ((o = e.routing) == null ? void 0 : o.tier) === "cheap"
70
+ }
71
+ ];
72
+ }), e.conversation_id && M(e.conversation_id);
69
73
  },
70
74
  onError: (e) => {
71
- b(e || "Ask AI failed"), v((n) => n.slice(0, -1));
75
+ g(e || "Ask AI failed"), v((r) => r.slice(0, -1));
72
76
  }
73
77
  });
74
- g(() => {
78
+ y(() => {
75
79
  var e;
76
80
  (e = K.current) == null || e.scrollTo({ top: K.current.scrollHeight });
77
- }, [x.length, l.text, l.steps.length]);
78
- const A = ((ee = [...x].reverse().find((e) => e.role === "user")) == null ? void 0 : ee.content) ?? "";
79
- function L(e, n = {}) {
80
- const o = (e ?? y).trim();
81
+ }, [h.length, l.text, l.steps.length]);
82
+ const b = ((ee = [...h].reverse().find((e) => e.role === "user")) == null ? void 0 : ee.content) ?? "";
83
+ function $(e, r = {}) {
84
+ const o = (e ?? k).trim();
81
85
  if (!o || l.active) return;
82
- b(null), v((m) => [...m, { role: "user", content: o }]), e === void 0 && k("");
83
- const a = Te(r, {
84
- dismissed: h,
86
+ g(null), v((m) => [...m, { role: "user", content: o }]), e === void 0 && N("");
87
+ const a = Oe(n, {
88
+ dismissed: x,
85
89
  records: Q,
86
- attachments: N.map((m) => m.id),
87
- recordFiles: H
88
- }), u = V.current, C = u ? [] : x.slice(-18).map((m) => ({ role: m.role, content: m.content.slice(0, 4e3) }));
90
+ attachments: w.map((m) => m.id),
91
+ recordFiles: X
92
+ }), u = V.current, D = u ? [] : h.slice(-18).map((m) => ({ role: m.role, content: m.content.slice(0, 4e3) }));
89
93
  l.start({
90
- messages: [...C, { role: "user", content: o }],
94
+ messages: [...D, { role: "user", content: o }],
91
95
  ...u ? { conversation_id: u } : { save: !0 },
92
- ...n.fresh ? { fresh: !0 } : {},
96
+ ...r.fresh ? { fresh: !0 } : {},
97
+ ...r.tryHarder ? {
98
+ try_harder: !0,
99
+ ...r.tryHarder.retryOf ? { retry_of: r.tryHarder.retryOf } : {}
100
+ } : {},
93
101
  ...a ? { context: a } : {}
94
102
  });
95
103
  }
96
104
  async function Y(e) {
97
- const n = R - N.length;
98
- for (const o of e.slice(0, Math.max(0, n))) {
99
- X((a) => a + 1);
105
+ const r = q - w.length;
106
+ for (const o of e.slice(0, Math.max(0, r))) {
107
+ z((a) => a + 1);
100
108
  try {
101
109
  const a = new FormData();
102
110
  a.append("file", o, o.name);
103
- const u = f.getToken(), C = await fetch(`${f.url}/api/ai/ask/attachments`, {
111
+ const u = p.getToken(), D = await fetch(`${p.url}/api/ai/ask/attachments`, {
104
112
  method: "POST",
105
113
  headers: u ? { Authorization: `Bearer ${u}` } : {},
106
114
  credentials: u ? "omit" : "include",
107
115
  body: a
108
- }), m = await C.json().catch(() => ({}));
109
- if (!C.ok || !m.data) throw new Error(m.error || `Could not read ${o.name}`);
110
- const pe = m.data;
111
- j((fe) => [...fe, pe]);
116
+ }), m = await D.json().catch(() => ({}));
117
+ if (!D.ok || !m.data) throw new Error(m.error || `Could not read ${o.name}`);
118
+ const fe = m.data;
119
+ _((pe) => [...pe, fe]);
112
120
  } catch (a) {
113
- b(a instanceof Error ? a.message : `Could not read ${o.name}`);
121
+ g(a instanceof Error ? a.message : `Could not read ${o.name}`);
114
122
  } finally {
115
- X((a) => a - 1);
123
+ z((a) => a - 1);
116
124
  }
117
125
  }
118
- e.length > n && b(`At most ${R} files per conversation`);
126
+ e.length > r && g(`At most ${q} files per conversation`);
119
127
  }
120
128
  function de(e) {
121
- e.preventDefault(), _(!1);
122
- const n = Se(e.dataTransfer);
123
- if (n) {
124
- O(
125
- (a) => a.some((u) => u.collection === n.collection && u.id === n.id) || a.length >= Oe ? a : [...a, n]
129
+ e.preventDefault(), F(!1);
130
+ const r = Se(e.dataTransfer);
131
+ if (r) {
132
+ j(
133
+ (a) => a.some((u) => u.collection === r.collection && u.id === r.id) || a.length >= Ie ? a : [...a, r]
126
134
  );
127
135
  return;
128
136
  }
@@ -131,58 +139,58 @@ function je({
131
139
  }
132
140
  function ue(e) {
133
141
  if (e.key === "Enter" && (e.metaKey || e.ctrlKey)) {
134
- e.preventDefault(), A && L(A, { fresh: !0 });
142
+ e.preventDefault(), b && $(b, { fresh: !0 });
135
143
  return;
136
144
  }
137
145
  if (e.key === "Enter" && !e.shiftKey) {
138
- e.preventDefault(), L();
146
+ e.preventDefault(), $();
139
147
  return;
140
148
  }
141
- if (e.key === "ArrowUp" && !y && A) {
142
- e.preventDefault(), k(A);
149
+ if (e.key === "ArrowUp" && !k && b) {
150
+ e.preventDefault(), N(b);
143
151
  return;
144
152
  }
145
153
  e.key === "Escape" && (e.preventDefault(), l.active ? l.stop() : s.setOpen(!1));
146
154
  }
147
155
  function me() {
148
156
  var e;
149
- l.active || (v([]), B(null), O([]), j([]), b(null), (e = F.current) == null || e.focus());
157
+ l.active || (v([]), M(null), j([]), _([]), g(null), (e = H.current) == null || e.focus());
150
158
  }
151
- const p = [], $ = (e) => z((n) => new Set(n).add(e));
152
- r != null && r.record && !h.has("record") && p.push({
159
+ const f = [], C = (e) => B((r) => new Set(r).add(e));
160
+ n != null && n.record && !x.has("record") && f.push({
153
161
  key: "record",
154
162
  icon: /* @__PURE__ */ t(re, { className: "h-3 w-3" }),
155
- label: r.record.label || `${r.record.collection} ${r.record.id}`,
156
- onRemove: () => $("record")
157
- }), r != null && r.list && !h.has("list") && p.push({
163
+ label: n.record.label || `${n.record.collection} ${n.record.id}`,
164
+ onRemove: () => C("record")
165
+ }), n != null && n.list && !x.has("list") && f.push({
158
166
  key: "list",
159
167
  icon: /* @__PURE__ */ t(xe, { className: "h-3 w-3" }),
160
- label: `${r.list.label || r.list.collection} · ${r.list.ids.length} on screen${r.list.filters.length ? ` · ${r.list.filters.length} filter(s)` : ""}`,
161
- onRemove: () => $("list")
162
- }), r != null && r.queue && !h.has("queue") && p.push({
168
+ label: `${n.list.label || n.list.collection} · ${n.list.ids.length} on screen${n.list.filters.length ? ` · ${n.list.filters.length} filter(s)` : ""}`,
169
+ onRemove: () => C("list")
170
+ }), n != null && n.queue && !x.has("queue") && f.push({
163
171
  key: "queue",
164
172
  icon: /* @__PURE__ */ t(be, { className: "h-3 w-3" }),
165
- label: `${r.queue.label || "Queue"} · ${r.queue.items.length} on screen`,
166
- onRemove: () => $("queue")
167
- }), r != null && r.report && !h.has("report") && p.push({
173
+ label: `${n.queue.label || "Queue"} · ${n.queue.items.length} on screen`,
174
+ onRemove: () => C("queue")
175
+ }), n != null && n.report && !x.has("report") && f.push({
168
176
  key: "report",
169
177
  icon: /* @__PURE__ */ t(ge, { className: "h-3 w-3" }),
170
- label: `${r.report.label || "Report"}${(te = r.report.entity_filters) != null && te.length ? ` · ${r.report.entity_filters.length} filter(s)` : ""}`,
171
- onRemove: () => $("report")
178
+ label: `${n.report.label || "Report"}${(te = n.report.entity_filters) != null && te.length ? ` · ${n.report.entity_filters.length} filter(s)` : ""}`,
179
+ onRemove: () => C("report")
172
180
  });
173
181
  for (const e of Q)
174
- p.push({
182
+ f.push({
175
183
  key: `rec:${e.collection}:${e.id}`,
176
184
  icon: /* @__PURE__ */ t(re, { className: "h-3 w-3" }),
177
185
  label: e.label || `${e.collection} ${e.id}`,
178
- onRemove: () => O((n) => n.filter((o) => !(o.collection === e.collection && o.id === e.id)))
186
+ onRemove: () => j((r) => r.filter((o) => !(o.collection === e.collection && o.id === e.id)))
179
187
  });
180
- for (const e of N)
181
- p.push({
188
+ for (const e of w)
189
+ f.push({
182
190
  key: `doc:${e.id}`,
183
- icon: /* @__PURE__ */ t(M, { className: "h-3 w-3" }),
191
+ icon: /* @__PURE__ */ t(L, { className: "h-3 w-3" }),
184
192
  label: `${e.name}${e.truncated ? " (long — first part)" : ""}`,
185
- onRemove: () => j((n) => n.filter((o) => o.id !== e.id))
193
+ onRemove: () => _((r) => r.filter((o) => o.id !== e.id))
186
194
  });
187
195
  return /* @__PURE__ */ i(
188
196
  "aside",
@@ -196,15 +204,15 @@ function je({
196
204
  U && "ring-2 ring-inset ring-nvr-cyan"
197
205
  ),
198
206
  onDragOver: (e) => {
199
- e.preventDefault(), e.dataTransfer.dropEffect = "copy", U || _(!0);
207
+ e.preventDefault(), e.dataTransfer.dropEffect = "copy", U || F(!0);
200
208
  },
201
209
  onDragLeave: (e) => {
202
- e.currentTarget === e.target && _(!1);
210
+ e.currentTarget === e.target && F(!1);
203
211
  },
204
212
  onDrop: de,
205
213
  children: [
206
214
  /* @__PURE__ */ i("header", { className: "flex shrink-0 items-center gap-2 border-b border-border px-3 py-2", children: [
207
- /* @__PURE__ */ t(ve, { className: "h-4 w-4 text-nvr-cyan" }),
215
+ /* @__PURE__ */ t(ye, { className: "h-4 w-4 text-nvr-cyan" }),
208
216
  /* @__PURE__ */ t("span", { className: "text-[13px] font-semibold", children: "Ask AI" }),
209
217
  /* @__PURE__ */ t("span", { className: "text-[11px] text-muted-foreground", children: "⌘J" }),
210
218
  /* @__PURE__ */ i("div", { className: "ml-auto flex items-center gap-1", children: [
@@ -214,11 +222,11 @@ function je({
214
222
  type: "button",
215
223
  "data-ask-panel-open-full": !0,
216
224
  onClick: () => {
217
- s.setOpen(!1), T(`${S}?conversation=${I}`);
225
+ s.setOpen(!1), T(`${O}?conversation=${I}`);
218
226
  },
219
227
  className: "inline-flex h-7 items-center gap-1 rounded-md px-2 text-[12px] text-muted-foreground hover:bg-muted hover:text-foreground",
220
228
  children: [
221
- /* @__PURE__ */ t(ye, { className: "h-3.5 w-3.5" }),
229
+ /* @__PURE__ */ t(ve, { className: "h-3.5 w-3.5" }),
222
230
  " Open in Ask AI"
223
231
  ]
224
232
  }
@@ -253,23 +261,35 @@ function je({
253
261
  ref: K,
254
262
  className: "min-h-0 flex-1 space-y-3 overflow-y-auto overscroll-contain px-3 py-3",
255
263
  children: [
256
- x.length === 0 && !l.active && /* @__PURE__ */ i("div", { className: "space-y-2 pt-6 text-center text-[12.5px] text-muted-foreground", children: [
264
+ h.length === 0 && !l.active && /* @__PURE__ */ i("div", { className: "space-y-2 pt-6 text-center text-[12.5px] text-muted-foreground", children: [
257
265
  /* @__PURE__ */ t("p", { children: "Ask about what is on this page — the chips below say what rides along." }),
258
266
  /* @__PURE__ */ t("p", { className: "text-[11.5px]", children: "Drop records or a PDF, Word or Excel file here to ask about them too." })
259
267
  ] }),
260
- x.map(
261
- (e, n) => e.role === "user" ? (
268
+ h.map(
269
+ (e, r) => e.role === "user" ? (
262
270
  // biome-ignore lint/suspicious/noArrayIndexKey: turns only append; the index is stable
263
- /* @__PURE__ */ t("div", { className: "flex justify-end", children: /* @__PURE__ */ t("div", { className: "max-w-[85%] whitespace-pre-wrap rounded-lg bg-nvr-cyan/10 px-3 py-2 text-[13px]", children: e.content }) }, n)
271
+ /* @__PURE__ */ t("div", { className: "flex justify-end", children: /* @__PURE__ */ t("div", { className: "max-w-[85%] whitespace-pre-wrap rounded-lg bg-nvr-cyan/10 px-3 py-2 text-[13px]", children: e.content }) }, r)
264
272
  ) : (
265
273
  // biome-ignore lint/suspicious/noArrayIndexKey: turns only append; the index is stable
266
274
  /* @__PURE__ */ i("div", { className: "space-y-1", children: [
267
275
  /* @__PURE__ */ t(ae, { content: e.content, className: "text-[13px]" }),
268
276
  /* @__PURE__ */ i("div", { className: "flex items-center gap-2", children: [
269
277
  e.stopped && /* @__PURE__ */ t("span", { className: "text-[11px] text-muted-foreground", children: "Stopped" }),
278
+ e.quick && r === h.length - 1 && b && /* @__PURE__ */ t(
279
+ "button",
280
+ {
281
+ type: "button",
282
+ "data-ask-panel-try-harder": !0,
283
+ "data-tip": "Quick answer from a smaller model — ask the main one",
284
+ className: "text-[11px] text-muted-foreground underline decoration-dotted underline-offset-2 hover:text-foreground disabled:opacity-40",
285
+ disabled: l.active,
286
+ onClick: () => $(b, { tryHarder: { retryOf: e.requestId ?? null } }),
287
+ children: "Try harder"
288
+ }
289
+ ),
270
290
  /* @__PURE__ */ t(qe, { requestId: e.requestId })
271
291
  ] })
272
- ] }, n)
292
+ ] }, r)
273
293
  )
274
294
  ),
275
295
  l.active && /* @__PURE__ */ i("div", { "data-ask-panel-streaming": !0, className: "space-y-1.5", children: [
@@ -285,8 +305,8 @@ function je({
285
305
  }
286
306
  ),
287
307
  /* @__PURE__ */ i("footer", { className: "shrink-0 space-y-2 border-t border-border px-3 py-2.5", children: [
288
- (p.length > 0 || P > 0) && /* @__PURE__ */ i("div", { className: "flex flex-wrap gap-1.5", "data-ask-panel-chips": !0, children: [
289
- p.map((e) => /* @__PURE__ */ i(
308
+ (f.length > 0 || P > 0) && /* @__PURE__ */ i("div", { className: "flex flex-wrap gap-1.5", "data-ask-panel-chips": !0, children: [
309
+ f.map((e) => /* @__PURE__ */ i(
290
310
  "span",
291
311
  {
292
312
  className: "inline-flex max-w-full items-center gap-1 rounded-full border border-border bg-muted px-2 py-0.5 text-[11.5px]",
@@ -312,24 +332,24 @@ function je({
312
332
  " Reading file…"
313
333
  ] })
314
334
  ] }),
315
- d && ((w == null ? void 0 : w.length) ?? 0) > 0 && /* @__PURE__ */ i("div", { className: "space-y-1", "data-ask-panel-record-files": !0, children: [
335
+ d && ((A == null ? void 0 : A.length) ?? 0) > 0 && /* @__PURE__ */ i("div", { className: "space-y-1", "data-ask-panel-record-files": !0, children: [
316
336
  /* @__PURE__ */ t("p", { className: "text-[11px] font-medium text-muted-foreground", children: "Attachments on this record — use as sources" }),
317
- /* @__PURE__ */ t("div", { className: "flex flex-wrap gap-1.5", children: w.map((e) => {
318
- const n = H.includes(e.id);
337
+ /* @__PURE__ */ t("div", { className: "flex flex-wrap gap-1.5", children: A.map((e) => {
338
+ const r = X.includes(e.id);
319
339
  return /* @__PURE__ */ i(
320
340
  "button",
321
341
  {
322
342
  type: "button",
323
- "aria-pressed": n,
343
+ "aria-pressed": r,
324
344
  onClick: () => J(
325
- (o) => n ? o.filter((a) => a !== e.id) : o.length >= R ? o : [...o, e.id]
345
+ (o) => r ? o.filter((a) => a !== e.id) : o.length >= q ? o : [...o, e.id]
326
346
  ),
327
347
  className: se(
328
348
  "inline-flex max-w-full items-center gap-1 rounded-full border px-2 py-0.5 text-[11.5px]",
329
- n ? "border-nvr-cyan bg-nvr-cyan/10 text-foreground" : "border-border text-muted-foreground hover:bg-muted"
349
+ r ? "border-nvr-cyan bg-nvr-cyan/10 text-foreground" : "border-border text-muted-foreground hover:bg-muted"
330
350
  ),
331
351
  children: [
332
- /* @__PURE__ */ t(M, { className: "h-3 w-3" }),
352
+ /* @__PURE__ */ t(L, { className: "h-3 w-3" }),
333
353
  /* @__PURE__ */ t("span", { className: "truncate", children: e.name })
334
354
  ]
335
355
  },
@@ -346,11 +366,11 @@ function je({
346
366
  var e;
347
367
  return (e = G.current) == null ? void 0 : e.click();
348
368
  },
349
- disabled: N.length >= R,
369
+ disabled: w.length >= q,
350
370
  "aria-label": "Attach a file",
351
371
  "data-tip": "Attach a PDF, Word or Excel file",
352
372
  className: "inline-flex h-9 w-9 shrink-0 items-center justify-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground disabled:opacity-50",
353
- children: /* @__PURE__ */ t(M, { className: "h-4 w-4" })
373
+ children: /* @__PURE__ */ t(L, { className: "h-4 w-4" })
354
374
  }
355
375
  ),
356
376
  /* @__PURE__ */ t(
@@ -358,22 +378,22 @@ function je({
358
378
  {
359
379
  ref: G,
360
380
  type: "file",
361
- accept: Ie,
381
+ accept: Te,
362
382
  multiple: !0,
363
383
  className: "hidden",
364
384
  onChange: (e) => {
365
- const n = [...e.target.files ?? []];
366
- e.target.value = "", n.length && Y(n);
385
+ const r = [...e.target.files ?? []];
386
+ e.target.value = "", r.length && Y(r);
367
387
  }
368
388
  }
369
389
  ),
370
390
  /* @__PURE__ */ t(
371
391
  "textarea",
372
392
  {
373
- ref: F,
393
+ ref: H,
374
394
  "data-ask-panel-input": !0,
375
- value: y,
376
- onChange: (e) => k(e.target.value),
395
+ value: k,
396
+ onChange: (e) => N(e.target.value),
377
397
  onKeyDown: ue,
378
398
  rows: 2,
379
399
  placeholder: "Ask about this page…",
@@ -393,8 +413,8 @@ function je({
393
413
  "button",
394
414
  {
395
415
  type: "button",
396
- onClick: () => L(),
397
- disabled: !y.trim() || P > 0,
416
+ onClick: () => $(),
417
+ disabled: !k.trim() || P > 0,
398
418
  "aria-label": "Ask",
399
419
  className: "inline-flex h-9 w-9 shrink-0 items-center justify-center rounded-md bg-nvr-cyan text-white disabled:opacity-50",
400
420
  children: /* @__PURE__ */ t(we, { className: "h-4 w-4" })
@@ -0,0 +1,126 @@
1
+ import { jsxs as n, jsx as a } from "react/jsx-runtime";
2
+ import { useQueryClient as v, useQuery as y, useMutation as x } from "@tanstack/react-query";
3
+ import { X as N, Check as _ } from "lucide-react";
4
+ import { useApiFetchConfig as C, useNavigation as F } from "../../context.js";
5
+ import { cn as h } from "../../lib/utils.js";
6
+ function H({ onOpenPath: i }) {
7
+ const { apiBase: d, authHeaders: l, credentials: c } = C(), p = F(), u = v(), o = ["my-work-first-week"], b = y({
8
+ queryKey: o,
9
+ staleTime: 6e4,
10
+ queryFn: async () => {
11
+ const e = await fetch(`${d}/my-work/first-week`, {
12
+ headers: l,
13
+ credentials: c
14
+ });
15
+ if (!e.ok) throw new Error("first-week failed");
16
+ return (await e.json()).data;
17
+ }
18
+ }), m = (e, k) => fetch(`${d}/my-work/first-week/${e}`, {
19
+ method: "POST",
20
+ headers: { ...l, "content-type": "application/json" },
21
+ credentials: c,
22
+ body: JSON.stringify(k ?? {})
23
+ }), g = x({
24
+ mutationFn: () => m("dismiss"),
25
+ onSuccess: () => u.setQueryData(o, { active: !1, steps: [], done_count: 0 })
26
+ }), t = b.data;
27
+ if (!(t != null && t.active) || !t.steps.length) return null;
28
+ const w = (e) => {
29
+ e.path && (e.kind === "open" && m("opened", { step_id: e.id }).then(() => u.invalidateQueries({ queryKey: o })), i ? i(e.path) : p.navigate(e.path));
30
+ }, s = t.ends_at ? Math.max(0, Math.ceil((new Date(t.ends_at).getTime() - Date.now()) / 864e5)) : null, r = t.steps.length, f = t.done_count >= r;
31
+ return /* @__PURE__ */ n(
32
+ "section",
33
+ {
34
+ "aria-label": "Your first week",
35
+ "data-first-week": !0,
36
+ className: "rounded-lg border border-slate-200 bg-white p-4 dark:border-border dark:bg-card",
37
+ children: [
38
+ /* @__PURE__ */ n("div", { className: "flex flex-wrap items-center gap-2", children: [
39
+ /* @__PURE__ */ n("h2", { className: "text-[13px] font-semibold", children: [
40
+ f ? "First week done" : "Your first week",
41
+ t.role_name && /* @__PURE__ */ n("span", { className: "font-normal text-muted-foreground", children: [
42
+ " · ",
43
+ t.role_name
44
+ ] })
45
+ ] }),
46
+ /* @__PURE__ */ n("span", { className: "text-[11.5px] text-muted-foreground tabular-nums", children: [
47
+ t.done_count,
48
+ " of ",
49
+ r,
50
+ s !== null && !f && ` · ${s} day${s === 1 ? "" : "s"} left`
51
+ ] }),
52
+ /* @__PURE__ */ a(
53
+ "button",
54
+ {
55
+ type: "button",
56
+ onClick: () => g.mutate(),
57
+ "aria-label": "Hide the first-week checklist",
58
+ "data-tip": "Hide this for good",
59
+ className: "ml-auto rounded p-1 text-muted-foreground hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan",
60
+ children: /* @__PURE__ */ a(N, { className: "h-3.5 w-3.5" })
61
+ }
62
+ )
63
+ ] }),
64
+ /* @__PURE__ */ a(
65
+ "div",
66
+ {
67
+ className: "mt-2 h-1 overflow-hidden rounded-full bg-slate-100 dark:bg-muted",
68
+ role: "progressbar",
69
+ "aria-label": "First-week steps done",
70
+ "aria-valuemin": 0,
71
+ "aria-valuemax": r,
72
+ "aria-valuenow": t.done_count,
73
+ children: /* @__PURE__ */ a(
74
+ "div",
75
+ {
76
+ className: "h-full rounded-full bg-nvr-cyan transition-[width] duration-300",
77
+ style: { width: `${t.done_count / r * 100}%` }
78
+ }
79
+ )
80
+ }
81
+ ),
82
+ /* @__PURE__ */ a("ul", { className: "mt-3 grid gap-1 md:grid-cols-2", children: t.steps.map((e) => /* @__PURE__ */ a("li", { children: /* @__PURE__ */ n(
83
+ "button",
84
+ {
85
+ type: "button",
86
+ onClick: () => w(e),
87
+ disabled: !e.path,
88
+ className: "flex w-full items-start gap-2 rounded-md px-2 py-1.5 text-left hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan disabled:cursor-default disabled:hover:bg-transparent",
89
+ children: [
90
+ /* @__PURE__ */ a(
91
+ "span",
92
+ {
93
+ "aria-hidden": !0,
94
+ className: h(
95
+ "mt-0.5 flex h-4 w-4 shrink-0 items-center justify-center rounded-full border",
96
+ e.done ? "border-nvr-cyan bg-nvr-cyan text-white" : "border-slate-300 dark:border-slate-600"
97
+ ),
98
+ children: e.done && /* @__PURE__ */ a(_, { className: "h-3 w-3" })
99
+ }
100
+ ),
101
+ /* @__PURE__ */ n("span", { className: "min-w-0", children: [
102
+ /* @__PURE__ */ n(
103
+ "span",
104
+ {
105
+ className: h(
106
+ "block text-[12.5px]",
107
+ e.done && "text-muted-foreground line-through"
108
+ ),
109
+ children: [
110
+ e.title,
111
+ /* @__PURE__ */ a("span", { className: "sr-only", children: e.done ? " (done)" : " (to do)" })
112
+ ]
113
+ }
114
+ ),
115
+ e.detail && !e.done && /* @__PURE__ */ a("span", { className: "block text-[11.5px] text-muted-foreground", children: e.detail })
116
+ ] })
117
+ ]
118
+ }
119
+ ) }, e.id)) })
120
+ ]
121
+ }
122
+ );
123
+ }
124
+ export {
125
+ H as FirstWeekCard
126
+ };