@arbidocs/react 0.4.84 → 0.4.86

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.
package/dist/index.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkPXHRLAOX_cjs = require('./chunk-PXHRLAOX.cjs');
3
+ var chunkE26JGYT4_cjs = require('./chunk-E26JGYT4.cjs');
4
4
  var chunk5DCRIWCA_cjs = require('./chunk-5DCRIWCA.cjs');
5
5
  var chunkF7KQVVD2_cjs = require('./chunk-F7KQVVD2.cjs');
6
6
  var chunkQJRP2LLQ_cjs = require('./chunk-QJRP2LLQ.cjs');
@@ -11,7 +11,7 @@ var chunkHUZB36QU_cjs = require('./chunk-HUZB36QU.cjs');
11
11
  var chunkHJDR5HEO_cjs = require('./chunk-HJDR5HEO.cjs');
12
12
  var chunkS6A6FSG7_cjs = require('./chunk-S6A6FSG7.cjs');
13
13
  var chunkTMPDW7J5_cjs = require('./chunk-TMPDW7J5.cjs');
14
- var chunkIIT7DMQL_cjs = require('./chunk-IIT7DMQL.cjs');
14
+ var chunkXIDDXD5Y_cjs = require('./chunk-XIDDXD5Y.cjs');
15
15
  var React = require('react');
16
16
  var reactQuery = require('@tanstack/react-query');
17
17
  var browser = require('@arbidocs/sdk/browser');
@@ -34,45 +34,45 @@ var ReactMarkdown__default = /*#__PURE__*/_interopDefault(ReactMarkdown);
34
34
  var Cropper__default = /*#__PURE__*/_interopDefault(Cropper);
35
35
 
36
36
  function useUpdateConversation() {
37
- const arbi = chunkIIT7DMQL_cjs.useArbi();
37
+ const arbi = chunkXIDDXD5Y_cjs.useArbi();
38
38
  const qc = reactQuery.useQueryClient();
39
39
  return reactQuery.useMutation({
40
40
  mutationFn: ({
41
41
  conversationId,
42
42
  patch
43
43
  }) => arbi.conversations.update(conversationId, patch),
44
- onSuccess: () => qc.invalidateQueries({ queryKey: chunkPXHRLAOX_cjs.arbiQueryKeys.allConversations() })
44
+ onSuccess: () => qc.invalidateQueries({ queryKey: chunkE26JGYT4_cjs.arbiQueryKeys.allConversations() })
45
45
  });
46
46
  }
47
47
  function useCreateWork() {
48
- const arbi = chunkIIT7DMQL_cjs.useArbi();
48
+ const arbi = chunkXIDDXD5Y_cjs.useArbi();
49
49
  const qc = reactQuery.useQueryClient();
50
50
  return reactQuery.useMutation({
51
51
  mutationFn: (body) => arbi.conversations.createWork(body),
52
- onSuccess: () => qc.invalidateQueries({ queryKey: chunkPXHRLAOX_cjs.arbiQueryKeys.allConversations() })
52
+ onSuccess: () => qc.invalidateQueries({ queryKey: chunkE26JGYT4_cjs.arbiQueryKeys.allConversations() })
53
53
  });
54
54
  }
55
55
  function useRunConversation() {
56
- const arbi = chunkIIT7DMQL_cjs.useArbi();
56
+ const arbi = chunkXIDDXD5Y_cjs.useArbi();
57
57
  const qc = reactQuery.useQueryClient();
58
58
  return reactQuery.useMutation({
59
59
  mutationFn: (conversationId) => arbi.conversations.runWithAuth(conversationId),
60
- onSuccess: () => qc.invalidateQueries({ queryKey: chunkPXHRLAOX_cjs.arbiQueryKeys.allConversations() })
60
+ onSuccess: () => qc.invalidateQueries({ queryKey: chunkE26JGYT4_cjs.arbiQueryKeys.allConversations() })
61
61
  });
62
62
  }
63
63
  function useActOnStep() {
64
- const arbi = chunkIIT7DMQL_cjs.useArbi();
64
+ const arbi = chunkXIDDXD5Y_cjs.useArbi();
65
65
  const qc = reactQuery.useQueryClient();
66
66
  return reactQuery.useMutation({
67
67
  mutationFn: ({
68
68
  conversationId,
69
69
  body
70
70
  }) => arbi.conversations.actOnStep(conversationId, body),
71
- onSuccess: () => qc.invalidateQueries({ queryKey: chunkPXHRLAOX_cjs.arbiQueryKeys.allConversations() })
71
+ onSuccess: () => qc.invalidateQueries({ queryKey: chunkE26JGYT4_cjs.arbiQueryKeys.allConversations() })
72
72
  });
73
73
  }
74
74
  function useSendBackStep() {
75
- const arbi = chunkIIT7DMQL_cjs.useArbi();
75
+ const arbi = chunkXIDDXD5Y_cjs.useArbi();
76
76
  const qc = reactQuery.useQueryClient();
77
77
  return reactQuery.useMutation({
78
78
  mutationFn: ({
@@ -81,106 +81,106 @@ function useSendBackStep() {
81
81
  to,
82
82
  note
83
83
  }) => arbi.conversations.sendBackStep(conversationId, step, { to, note }),
84
- onSuccess: () => qc.invalidateQueries({ queryKey: chunkPXHRLAOX_cjs.arbiQueryKeys.allConversations() })
84
+ onSuccess: () => qc.invalidateQueries({ queryKey: chunkE26JGYT4_cjs.arbiQueryKeys.allConversations() })
85
85
  });
86
86
  }
87
87
  function usePlanWork() {
88
- const arbi = chunkIIT7DMQL_cjs.useArbi();
88
+ const arbi = chunkXIDDXD5Y_cjs.useArbi();
89
89
  return reactQuery.useMutation({
90
90
  mutationFn: (body) => arbi.conversations.plan(body)
91
91
  });
92
92
  }
93
93
  function useConversationPendingAuth(conversationId, options) {
94
- const arbi = chunkIIT7DMQL_cjs.useArbi();
94
+ const arbi = chunkXIDDXD5Y_cjs.useArbi();
95
95
  return reactQuery.useQuery({
96
- queryKey: [...chunkPXHRLAOX_cjs.arbiQueryKeys.allConversations(), conversationId ?? "", "pending-auth"],
96
+ queryKey: [...chunkE26JGYT4_cjs.arbiQueryKeys.allConversations(), conversationId ?? "", "pending-auth"],
97
97
  queryFn: () => arbi.conversations.pendingAuth(conversationId),
98
98
  enabled: (options?.enabled ?? true) && !!conversationId && arbi.isLoggedIn,
99
99
  retry: false
100
100
  });
101
101
  }
102
102
  function useConversationActivity(conversationId, options) {
103
- const arbi = chunkIIT7DMQL_cjs.useArbi();
103
+ const arbi = chunkXIDDXD5Y_cjs.useArbi();
104
104
  return reactQuery.useQuery({
105
- queryKey: [...chunkPXHRLAOX_cjs.arbiQueryKeys.allConversations(), conversationId ?? "", "activity"],
105
+ queryKey: [...chunkE26JGYT4_cjs.arbiQueryKeys.allConversations(), conversationId ?? "", "activity"],
106
106
  queryFn: () => arbi.conversations.activity(conversationId),
107
107
  enabled: (options?.enabled ?? true) && !!conversationId && arbi.isLoggedIn,
108
108
  refetchInterval: options?.live ? 2500 : false
109
109
  });
110
110
  }
111
111
  function useWorkflows(options) {
112
- const arbi = chunkIIT7DMQL_cjs.useArbi();
112
+ const arbi = chunkXIDDXD5Y_cjs.useArbi();
113
113
  return reactQuery.useQuery({
114
- queryKey: chunkPXHRLAOX_cjs.arbiQueryKeys.workflows(),
114
+ queryKey: chunkE26JGYT4_cjs.arbiQueryKeys.workflows(),
115
115
  queryFn: () => arbi.workflows.list(),
116
116
  refetchInterval: options?.live ? 15e3 : false,
117
117
  enabled: options?.enabled ?? arbi.isLoggedIn
118
118
  });
119
119
  }
120
120
  function useCreateWorkflow() {
121
- const arbi = chunkIIT7DMQL_cjs.useArbi();
121
+ const arbi = chunkXIDDXD5Y_cjs.useArbi();
122
122
  const qc = reactQuery.useQueryClient();
123
123
  return reactQuery.useMutation({
124
124
  mutationFn: (body) => arbi.workflows.create(body),
125
- onSuccess: () => qc.invalidateQueries({ queryKey: chunkPXHRLAOX_cjs.arbiQueryKeys.workflows() })
125
+ onSuccess: () => qc.invalidateQueries({ queryKey: chunkE26JGYT4_cjs.arbiQueryKeys.workflows() })
126
126
  });
127
127
  }
128
128
  function useUpdateWorkflow() {
129
- const arbi = chunkIIT7DMQL_cjs.useArbi();
129
+ const arbi = chunkXIDDXD5Y_cjs.useArbi();
130
130
  const qc = reactQuery.useQueryClient();
131
131
  return reactQuery.useMutation({
132
132
  mutationFn: ({
133
133
  workflowId,
134
134
  patch
135
135
  }) => arbi.workflows.update(workflowId, patch),
136
- onSuccess: () => qc.invalidateQueries({ queryKey: chunkPXHRLAOX_cjs.arbiQueryKeys.workflows() })
136
+ onSuccess: () => qc.invalidateQueries({ queryKey: chunkE26JGYT4_cjs.arbiQueryKeys.workflows() })
137
137
  });
138
138
  }
139
139
  function useDeleteWorkflow() {
140
- const arbi = chunkIIT7DMQL_cjs.useArbi();
140
+ const arbi = chunkXIDDXD5Y_cjs.useArbi();
141
141
  const qc = reactQuery.useQueryClient();
142
142
  return reactQuery.useMutation({
143
143
  mutationFn: (workflowId) => arbi.workflows.delete(workflowId),
144
- onSuccess: () => qc.invalidateQueries({ queryKey: chunkPXHRLAOX_cjs.arbiQueryKeys.workflows() })
144
+ onSuccess: () => qc.invalidateQueries({ queryKey: chunkE26JGYT4_cjs.arbiQueryKeys.workflows() })
145
145
  });
146
146
  }
147
147
  function useRunWorkflow() {
148
- const arbi = chunkIIT7DMQL_cjs.useArbi();
148
+ const arbi = chunkXIDDXD5Y_cjs.useArbi();
149
149
  const qc = reactQuery.useQueryClient();
150
150
  return reactQuery.useMutation({
151
151
  mutationFn: (workflowId) => arbi.workflows.run(workflowId),
152
152
  onSuccess: () => Promise.all([
153
- qc.invalidateQueries({ queryKey: chunkPXHRLAOX_cjs.arbiQueryKeys.workflows() }),
154
- qc.invalidateQueries({ queryKey: chunkPXHRLAOX_cjs.arbiQueryKeys.allConversations() })
153
+ qc.invalidateQueries({ queryKey: chunkE26JGYT4_cjs.arbiQueryKeys.workflows() }),
154
+ qc.invalidateQueries({ queryKey: chunkE26JGYT4_cjs.arbiQueryKeys.allConversations() })
155
155
  ])
156
156
  });
157
157
  }
158
158
  function useCreateAgent() {
159
- const arbi = chunkIIT7DMQL_cjs.useArbi();
159
+ const arbi = chunkXIDDXD5Y_cjs.useArbi();
160
160
  const qc = reactQuery.useQueryClient();
161
161
  return reactQuery.useMutation({
162
162
  mutationFn: (name) => arbi.agents.create(name),
163
- onSuccess: () => qc.invalidateQueries({ queryKey: chunkPXHRLAOX_cjs.arbiQueryKeys.agents() })
163
+ onSuccess: () => qc.invalidateQueries({ queryKey: chunkE26JGYT4_cjs.arbiQueryKeys.agents() })
164
164
  });
165
165
  }
166
166
  function useAgentConfig(agentExtId, options) {
167
- const arbi = chunkIIT7DMQL_cjs.useArbi();
167
+ const arbi = chunkXIDDXD5Y_cjs.useArbi();
168
168
  return reactQuery.useQuery({
169
- queryKey: chunkPXHRLAOX_cjs.arbiQueryKeys.agentConfig(agentExtId),
169
+ queryKey: chunkE26JGYT4_cjs.arbiQueryKeys.agentConfig(agentExtId),
170
170
  queryFn: async () => agentExtId ? await arbi.agents.getConfig(agentExtId) : await arbi.agentConfig.get("default"),
171
171
  enabled: (options?.enabled ?? true) && arbi.isLoggedIn
172
172
  });
173
173
  }
174
174
  function useAgentModels(options) {
175
- const arbi = chunkIIT7DMQL_cjs.useArbi();
175
+ const arbi = chunkXIDDXD5Y_cjs.useArbi();
176
176
  return reactQuery.useQuery({
177
- queryKey: chunkPXHRLAOX_cjs.arbiQueryKeys.models(),
177
+ queryKey: chunkE26JGYT4_cjs.arbiQueryKeys.models(),
178
178
  queryFn: async () => (await arbi.agentConfig.getModels()).models.map((m) => m.model_name),
179
179
  enabled: (options?.enabled ?? true) && arbi.isLoggedIn
180
180
  });
181
181
  }
182
182
  function useSaveAgentConfig() {
183
- const arbi = chunkIIT7DMQL_cjs.useArbi();
183
+ const arbi = chunkXIDDXD5Y_cjs.useArbi();
184
184
  const qc = reactQuery.useQueryClient();
185
185
  return reactQuery.useMutation({
186
186
  mutationFn: async ({ agentExtId, title, sections }) => {
@@ -197,23 +197,23 @@ function useSaveAgentConfig() {
197
197
  });
198
198
  },
199
199
  onSuccess: (_saved, { agentExtId }) => Promise.all([
200
- qc.invalidateQueries({ queryKey: chunkPXHRLAOX_cjs.arbiQueryKeys.configs() }),
201
- qc.invalidateQueries({ queryKey: chunkPXHRLAOX_cjs.arbiQueryKeys.agentConfig(agentExtId) }),
200
+ qc.invalidateQueries({ queryKey: chunkE26JGYT4_cjs.arbiQueryKeys.configs() }),
201
+ qc.invalidateQueries({ queryKey: chunkE26JGYT4_cjs.arbiQueryKeys.agentConfig(agentExtId) }),
202
202
  // The agent list shows the pinned persona/model, so it refreshes too.
203
- qc.invalidateQueries({ queryKey: chunkPXHRLAOX_cjs.arbiQueryKeys.agents() })
203
+ qc.invalidateQueries({ queryKey: chunkE26JGYT4_cjs.arbiQueryKeys.agents() })
204
204
  ])
205
205
  });
206
206
  }
207
207
  function useAgentWorkspaces(agentExtId, options) {
208
- const arbi = chunkIIT7DMQL_cjs.useArbi();
208
+ const arbi = chunkXIDDXD5Y_cjs.useArbi();
209
209
  return reactQuery.useQuery({
210
- queryKey: chunkPXHRLAOX_cjs.arbiQueryKeys.agentWorkspaces(agentExtId ?? ""),
210
+ queryKey: chunkE26JGYT4_cjs.arbiQueryKeys.agentWorkspaces(agentExtId ?? ""),
211
211
  queryFn: () => arbi.agents.listWorkspaces(agentExtId),
212
212
  enabled: (options?.enabled ?? true) && !!agentExtId && arbi.isLoggedIn
213
213
  });
214
214
  }
215
215
  function useGrantAgentAccess() {
216
- const arbi = chunkIIT7DMQL_cjs.useArbi();
216
+ const arbi = chunkXIDDXD5Y_cjs.useArbi();
217
217
  const qc = reactQuery.useQueryClient();
218
218
  return reactQuery.useMutation({
219
219
  mutationFn: async ({
@@ -228,11 +228,11 @@ function useGrantAgentAccess() {
228
228
  if (!agent?.email) throw new Error("The agent's address is unknown.");
229
229
  return arbi.workspaces.grantAccess({ workspaceId, emails: [agent.email] });
230
230
  },
231
- onSuccess: (_res, { agentExtId }) => qc.invalidateQueries({ queryKey: chunkPXHRLAOX_cjs.arbiQueryKeys.agentWorkspaces(agentExtId) })
231
+ onSuccess: (_res, { agentExtId }) => qc.invalidateQueries({ queryKey: chunkE26JGYT4_cjs.arbiQueryKeys.agentWorkspaces(agentExtId) })
232
232
  });
233
233
  }
234
234
  function useRevokeAgentAccess() {
235
- const arbi = chunkIIT7DMQL_cjs.useArbi();
235
+ const arbi = chunkXIDDXD5Y_cjs.useArbi();
236
236
  const qc = reactQuery.useQueryClient();
237
237
  return reactQuery.useMutation({
238
238
  mutationFn: async ({
@@ -247,13 +247,13 @@ function useRevokeAgentAccess() {
247
247
  if (previous && previous !== workspaceId) await arbi.selectWorkspace(previous);
248
248
  }
249
249
  },
250
- onSuccess: (_res, { agentExtId }) => qc.invalidateQueries({ queryKey: chunkPXHRLAOX_cjs.arbiQueryKeys.agentWorkspaces(agentExtId) })
250
+ onSuccess: (_res, { agentExtId }) => qc.invalidateQueries({ queryKey: chunkE26JGYT4_cjs.arbiQueryKeys.agentWorkspaces(agentExtId) })
251
251
  });
252
252
  }
253
253
  function useSkills(options) {
254
- const arbi = chunkIIT7DMQL_cjs.useArbi();
254
+ const arbi = chunkXIDDXD5Y_cjs.useArbi();
255
255
  return reactQuery.useQuery({
256
- queryKey: [...chunkPXHRLAOX_cjs.arbiQueryKeys.skills(), options?.includeHidden ?? false],
256
+ queryKey: [...chunkE26JGYT4_cjs.arbiQueryKeys.skills(), options?.includeHidden ?? false],
257
257
  queryFn: () => arbi.assistant.listSkills({ includeHidden: options?.includeHidden }),
258
258
  refetchInterval: options?.live ? 5e3 : false,
259
259
  enabled: (options?.enabled ?? true) && arbi.isLoggedIn,
@@ -261,7 +261,7 @@ function useSkills(options) {
261
261
  });
262
262
  }
263
263
  function useUploadSkillFiles() {
264
- const arbi = chunkIIT7DMQL_cjs.useArbi();
264
+ const arbi = chunkXIDDXD5Y_cjs.useArbi();
265
265
  const qc = reactQuery.useQueryClient();
266
266
  return reactQuery.useMutation({
267
267
  mutationFn: async (entries) => {
@@ -284,11 +284,11 @@ function useUploadSkillFiles() {
284
284
  }
285
285
  return results;
286
286
  },
287
- onSuccess: () => qc.invalidateQueries({ queryKey: chunkPXHRLAOX_cjs.arbiQueryKeys.skills() })
287
+ onSuccess: () => qc.invalidateQueries({ queryKey: chunkE26JGYT4_cjs.arbiQueryKeys.skills() })
288
288
  });
289
289
  }
290
290
  function useStartWorkQuery() {
291
- const arbi = chunkIIT7DMQL_cjs.useArbi();
291
+ const arbi = chunkXIDDXD5Y_cjs.useArbi();
292
292
  const qc = reactQuery.useQueryClient();
293
293
  return reactQuery.useMutation({
294
294
  mutationFn: async ({
@@ -311,11 +311,11 @@ function useStartWorkQuery() {
311
311
  `The run ${response.id} started, but its thread is not available yet. Do not submit it again.`
312
312
  );
313
313
  },
314
- onSuccess: () => qc.invalidateQueries({ queryKey: chunkPXHRLAOX_cjs.arbiQueryKeys.allConversations() })
314
+ onSuccess: () => qc.invalidateQueries({ queryKey: chunkE26JGYT4_cjs.arbiQueryKeys.allConversations() })
315
315
  });
316
316
  }
317
317
  function useAgentSession(agentId, options) {
318
- const arbi = chunkIIT7DMQL_cjs.useArbi();
318
+ const arbi = chunkXIDDXD5Y_cjs.useArbi();
319
319
  return reactQuery.useQuery({
320
320
  queryKey: ["arbi", "agent-session", agentId],
321
321
  queryFn: () => arbi.agents.getSession(agentId),
@@ -324,7 +324,7 @@ function useAgentSession(agentId, options) {
324
324
  });
325
325
  }
326
326
  function useAgentChats(agentId) {
327
- const arbi = chunkIIT7DMQL_cjs.useArbi();
327
+ const arbi = chunkXIDDXD5Y_cjs.useArbi();
328
328
  return reactQuery.useQuery({
329
329
  queryKey: ["arbi", "agent-chats", agentId],
330
330
  queryFn: () => arbi.agents.listChats(agentId),
@@ -333,7 +333,7 @@ function useAgentChats(agentId) {
333
333
  });
334
334
  }
335
335
  function useStartAgentSession() {
336
- const arbi = chunkIIT7DMQL_cjs.useArbi();
336
+ const arbi = chunkXIDDXD5Y_cjs.useArbi();
337
337
  const cache = reactQuery.useQueryClient();
338
338
  return reactQuery.useMutation({
339
339
  mutationFn: ({ agentId, workspaceId }) => arbi.agents.startSession(agentId, workspaceId),
@@ -341,7 +341,7 @@ function useStartAgentSession() {
341
341
  });
342
342
  }
343
343
  function useCloseAgentSession() {
344
- const arbi = chunkIIT7DMQL_cjs.useArbi();
344
+ const arbi = chunkXIDDXD5Y_cjs.useArbi();
345
345
  const cache = reactQuery.useQueryClient();
346
346
  return reactQuery.useMutation({
347
347
  mutationFn: (agentId) => arbi.agents.closeSession(agentId),
@@ -470,9 +470,9 @@ function useArbiChat(options = {}) {
470
470
  const { workspaceId, agentId, model, titleLength = 48, streamRecovery } = options;
471
471
  const recoveryIntervalMs = streamRecovery?.intervalMs ?? 3e3;
472
472
  const recoveryTimeoutMs = streamRecovery?.timeoutMs ?? 12e4;
473
- const arbi = chunkIIT7DMQL_cjs.useArbi();
474
- const { data: docs = [], isLoading: isLoadingDocuments, refetch } = chunkPXHRLAOX_cjs.useDocuments(workspaceId);
475
- const ordinaryHistory = chunkPXHRLAOX_cjs.useConversations(workspaceId, { enabled: !agentId, live: true });
473
+ const arbi = chunkXIDDXD5Y_cjs.useArbi();
474
+ const { data: docs = [], isLoading: isLoadingDocuments, refetch } = chunkE26JGYT4_cjs.useDocuments(workspaceId);
475
+ const ordinaryHistory = chunkE26JGYT4_cjs.useConversations(workspaceId, { enabled: !agentId, live: true });
476
476
  const agentHistory = useAgentChats(agentId);
477
477
  const stored = React.useMemo(
478
478
  () => agentId ? (agentHistory.data ?? []).filter((chat) => chat.workspace_ext_id === workspaceId).map((chat) => ({
@@ -487,7 +487,7 @@ function useArbiChat(options = {}) {
487
487
  );
488
488
  const isLoadingThreads = agentId ? agentHistory.isLoading : ordinaryHistory.isLoading;
489
489
  const refetchConversations = agentId ? agentHistory.refetch : ordinaryHistory.refetch;
490
- const query = chunkPXHRLAOX_cjs.useAssistantQuery();
490
+ const query = chunkE26JGYT4_cjs.useAssistantQuery();
491
491
  const { mutateAsync } = query;
492
492
  const [stagedFiles, setStagedFiles] = React.useState([]);
493
493
  const [threads, setThreads] = React.useState(() => [emptyThread()]);
@@ -547,7 +547,7 @@ function useArbiChat(options = {}) {
547
547
  (conversation) => conversation.external_id === active.conversationId && conversation.status === "generating"
548
548
  ) || active.messages.some((message) => message.status === "streaming");
549
549
  const needsLoad = !!active.conversationId && !active.isLoaded;
550
- const loaded = chunkPXHRLAOX_cjs.useConversationThreads(workspaceId, active.conversationId ?? void 0, {
550
+ const loaded = chunkE26JGYT4_cjs.useConversationThreads(workspaceId, active.conversationId ?? void 0, {
551
551
  enabled: needsLoad || liveHistory && !isRunning && !isPostingComment,
552
552
  live: liveHistory
553
553
  });
@@ -1214,7 +1214,7 @@ function useArbiWsContext() {
1214
1214
  return ctx;
1215
1215
  }
1216
1216
  function ArbiWebSocketProvider({ enabled = true, children }) {
1217
- const arbi = chunkIIT7DMQL_cjs.useArbi();
1217
+ const arbi = chunkXIDDXD5Y_cjs.useArbi();
1218
1218
  const subscribersRef = React.useRef(/* @__PURE__ */ new Set());
1219
1219
  const setStatus = useArbiWsStore((s) => s.setStatus);
1220
1220
  const applyTaskUpdate = useArbiWsStore((s) => s.applyTaskUpdate);
@@ -1326,14 +1326,14 @@ function useArbiDocumentSync(workspaceId) {
1326
1326
  if (!workspaceId) return;
1327
1327
  if (client.isMessageType(msg, "batch_complete")) {
1328
1328
  if (msg.workspace_ext_id !== workspaceId) return;
1329
- void queryClient.invalidateQueries({ queryKey: chunkPXHRLAOX_cjs.arbiQueryKeys.documents(workspaceId) });
1330
- void queryClient.invalidateQueries({ queryKey: chunkPXHRLAOX_cjs.arbiQueryKeys.tags(workspaceId) });
1329
+ void queryClient.invalidateQueries({ queryKey: chunkE26JGYT4_cjs.arbiQueryKeys.documents(workspaceId) });
1330
+ void queryClient.invalidateQueries({ queryKey: chunkE26JGYT4_cjs.arbiQueryKeys.tags(workspaceId) });
1331
1331
  return;
1332
1332
  }
1333
1333
  if (client.isMessageType(msg, "task_update")) {
1334
1334
  if (msg.workspace_ext_id !== workspaceId) return;
1335
1335
  if (TERMINAL_STATUSES.has(msg.status)) {
1336
- void queryClient.invalidateQueries({ queryKey: chunkPXHRLAOX_cjs.arbiQueryKeys.documents(workspaceId) });
1336
+ void queryClient.invalidateQueries({ queryKey: chunkE26JGYT4_cjs.arbiQueryKeys.documents(workspaceId) });
1337
1337
  }
1338
1338
  }
1339
1339
  });
@@ -1461,8 +1461,8 @@ function useShellWorkspaces(options) {
1461
1461
  };
1462
1462
  }
1463
1463
  function useArbiShellWorkspaces(options = {}) {
1464
- const arbi = chunkIIT7DMQL_cjs.useArbi();
1465
- const query = chunkPXHRLAOX_cjs.useWorkspaces();
1464
+ const arbi = chunkXIDDXD5Y_cjs.useArbi();
1465
+ const query = chunkE26JGYT4_cjs.useWorkspaces();
1466
1466
  const { select, ...rest } = options;
1467
1467
  const defaultSelect = React.useCallback(
1468
1468
  (workspace) => arbi.selectWorkspace(workspace.id),
@@ -1476,68 +1476,80 @@ function useArbiShellWorkspaces(options = {}) {
1476
1476
  select: select ?? defaultSelect
1477
1477
  });
1478
1478
  }
1479
- var selectionKey = (selection) => !selection ? "" : "parentId" in selection ? `parent:${selection.parentId}` : `tags:${selection.tagIds.join(",")}`;
1480
1479
  function invalidateTagData(qc, workspaceId) {
1481
1480
  return Promise.all([
1482
- qc.invalidateQueries({ queryKey: chunkPXHRLAOX_cjs.arbiQueryKeys.tags(workspaceId) }),
1483
- qc.invalidateQueries({ queryKey: chunkPXHRLAOX_cjs.arbiQueryKeys.facts(workspaceId) })
1481
+ qc.invalidateQueries({ queryKey: chunkE26JGYT4_cjs.arbiQueryKeys.tags(workspaceId) }),
1482
+ qc.invalidateQueries({ queryKey: chunkE26JGYT4_cjs.arbiQueryKeys.facts(workspaceId) })
1484
1483
  ]);
1485
1484
  }
1486
1485
  function useInvalidateTagData() {
1487
- const arbi = chunkIIT7DMQL_cjs.useArbi();
1486
+ const arbi = chunkXIDDXD5Y_cjs.useArbi();
1488
1487
  const qc = reactQuery.useQueryClient();
1489
1488
  return React.useCallback(() => {
1490
1489
  const workspaceId = arbi.getWorkspaceId();
1491
1490
  return workspaceId ? invalidateTagData(qc, workspaceId) : Promise.resolve();
1492
1491
  }, [arbi, qc]);
1493
1492
  }
1494
- function useTagMatrix(selection, options) {
1495
- const arbi = chunkIIT7DMQL_cjs.useArbi();
1493
+ function useTagKindSchema(kind, options) {
1494
+ const arbi = chunkXIDDXD5Y_cjs.useArbi();
1496
1495
  const workspaceId = arbi.getWorkspaceId() ?? "";
1497
- const key = selectionKey(selection);
1498
- const hasSelection = !!selection && ("parentId" in selection ? !!selection.parentId : selection.tagIds.length > 0);
1499
1496
  return reactQuery.useQuery({
1500
- queryKey: chunkPXHRLAOX_cjs.arbiQueryKeys.tagMatrix(workspaceId, key, options?.linksLimit),
1501
- queryFn: () => arbi.tags.matrix(selection, options?.linksLimit),
1502
- enabled: (options?.enabled ?? true) && hasSelection && !!workspaceId && arbi.hasWorkspace
1497
+ queryKey: chunkE26JGYT4_cjs.arbiQueryKeys.tagKind(workspaceId, kind ?? ""),
1498
+ queryFn: () => arbi.tagKinds.get(kind),
1499
+ enabled: (options?.enabled ?? true) && !!kind && !!workspaceId && arbi.hasWorkspace
1503
1500
  });
1504
1501
  }
1505
- function useUpdateTagFields() {
1506
- const arbi = chunkIIT7DMQL_cjs.useArbi();
1502
+ function useUpdateTagKindSchema() {
1503
+ const arbi = chunkXIDDXD5Y_cjs.useArbi();
1504
+ const qc = reactQuery.useQueryClient();
1505
+ return reactQuery.useMutation({
1506
+ mutationFn: ({
1507
+ kind,
1508
+ fields
1509
+ }) => arbi.tagKinds.update(kind, fields),
1510
+ onSuccess: (schema) => {
1511
+ const workspaceId = arbi.getWorkspaceId();
1512
+ if (!workspaceId) return;
1513
+ qc.setQueryData(chunkE26JGYT4_cjs.arbiQueryKeys.tagKind(workspaceId, schema.kind), schema);
1514
+ return invalidateTagData(qc, workspaceId);
1515
+ }
1516
+ });
1517
+ }
1518
+ function useSetTagValues() {
1519
+ const arbi = chunkXIDDXD5Y_cjs.useArbi();
1507
1520
  const qc = reactQuery.useQueryClient();
1508
1521
  return reactQuery.useMutation({
1509
1522
  mutationFn: ({
1510
1523
  tagId,
1511
- fields,
1512
1524
  values
1513
- }) => arbi.tags.updateFields(tagId, { fields, values }),
1525
+ }) => arbi.tags.setValues(tagId, values),
1514
1526
  onSuccess: (tag) => invalidateTagData(qc, tag.workspace_ext_id)
1515
1527
  });
1516
1528
  }
1517
1529
  function useFilteredProjects(filters, options) {
1518
- const arbi = chunkIIT7DMQL_cjs.useArbi();
1530
+ const arbi = chunkXIDDXD5Y_cjs.useArbi();
1519
1531
  return reactQuery.useQuery({
1520
- queryKey: chunkPXHRLAOX_cjs.arbiQueryKeys.projectsFiltered(filters.stage, filters.leadUser),
1532
+ queryKey: chunkE26JGYT4_cjs.arbiQueryKeys.projectsFiltered(filters.stage, filters.leadUser),
1521
1533
  queryFn: () => arbi.projects.list(filters),
1522
1534
  enabled: options?.enabled ?? arbi.isLoggedIn
1523
1535
  });
1524
1536
  }
1525
1537
  function useUpdateProjectFields() {
1526
- const arbi = chunkIIT7DMQL_cjs.useArbi();
1538
+ const arbi = chunkXIDDXD5Y_cjs.useArbi();
1527
1539
  const qc = reactQuery.useQueryClient();
1528
1540
  return reactQuery.useMutation({
1529
1541
  mutationFn: ({
1530
1542
  projectExtId,
1531
1543
  patch
1532
1544
  }) => arbi.projects.update(projectExtId, patch),
1533
- onSuccess: () => qc.invalidateQueries({ queryKey: chunkPXHRLAOX_cjs.arbiQueryKeys.projects() })
1545
+ onSuccess: () => qc.invalidateQueries({ queryKey: chunkE26JGYT4_cjs.arbiQueryKeys.projects() })
1534
1546
  });
1535
1547
  }
1536
1548
  function useProjectEvents(projectExtId, options) {
1537
- const arbi = chunkIIT7DMQL_cjs.useArbi();
1549
+ const arbi = chunkXIDDXD5Y_cjs.useArbi();
1538
1550
  return reactQuery.useQuery({
1539
1551
  queryKey: [
1540
- ...chunkPXHRLAOX_cjs.arbiQueryKeys.projectEvents(projectExtId ?? ""),
1552
+ ...chunkE26JGYT4_cjs.arbiQueryKeys.projectEvents(projectExtId ?? ""),
1541
1553
  options?.kind ?? "all",
1542
1554
  options?.limit ?? "default"
1543
1555
  ],
@@ -1546,26 +1558,26 @@ function useProjectEvents(projectExtId, options) {
1546
1558
  });
1547
1559
  }
1548
1560
  function useConversationUsage(conversationId, options) {
1549
- const arbi = chunkIIT7DMQL_cjs.useArbi();
1561
+ const arbi = chunkXIDDXD5Y_cjs.useArbi();
1550
1562
  return reactQuery.useQuery({
1551
- queryKey: chunkPXHRLAOX_cjs.arbiQueryKeys.conversationUsage(conversationId ?? ""),
1563
+ queryKey: chunkE26JGYT4_cjs.arbiQueryKeys.conversationUsage(conversationId ?? ""),
1552
1564
  queryFn: () => arbi.conversations.usage(conversationId),
1553
1565
  enabled: (options?.enabled ?? true) && !!conversationId && arbi.isLoggedIn,
1554
1566
  refetchInterval: options?.live ? 1e4 : false
1555
1567
  });
1556
1568
  }
1557
1569
  function useProjectConversationUsage(projectExtId, monthsBack = 0, options) {
1558
- const arbi = chunkIIT7DMQL_cjs.useArbi();
1570
+ const arbi = chunkXIDDXD5Y_cjs.useArbi();
1559
1571
  return reactQuery.useQuery({
1560
- queryKey: chunkPXHRLAOX_cjs.arbiQueryKeys.projectConversationUsage(projectExtId ?? "", monthsBack),
1572
+ queryKey: chunkE26JGYT4_cjs.arbiQueryKeys.projectConversationUsage(projectExtId ?? "", monthsBack),
1561
1573
  queryFn: () => arbi.projects.usageByConversation(projectExtId, monthsBack),
1562
1574
  enabled: (options?.enabled ?? true) && !!projectExtId && arbi.isLoggedIn
1563
1575
  });
1564
1576
  }
1565
1577
  function useContacts(options) {
1566
- const arbi = chunkIIT7DMQL_cjs.useArbi();
1578
+ const arbi = chunkXIDDXD5Y_cjs.useArbi();
1567
1579
  return reactQuery.useQuery({
1568
- queryKey: chunkPXHRLAOX_cjs.arbiQueryKeys.contacts(),
1580
+ queryKey: chunkE26JGYT4_cjs.arbiQueryKeys.contacts(),
1569
1581
  queryFn: () => arbi.contacts.list(),
1570
1582
  enabled: (options?.enabled ?? true) && arbi.isLoggedIn
1571
1583
  });
@@ -1581,19 +1593,19 @@ function usePendingContacts(options) {
1581
1593
  return { ...contacts, pending };
1582
1594
  }
1583
1595
  function useAddContacts() {
1584
- const arbi = chunkIIT7DMQL_cjs.useArbi();
1596
+ const arbi = chunkXIDDXD5Y_cjs.useArbi();
1585
1597
  const qc = reactQuery.useQueryClient();
1586
1598
  return reactQuery.useMutation({
1587
1599
  mutationFn: (emails) => arbi.contacts.add(emails),
1588
- onSuccess: () => qc.invalidateQueries({ queryKey: chunkPXHRLAOX_cjs.arbiQueryKeys.contacts() })
1600
+ onSuccess: () => qc.invalidateQueries({ queryKey: chunkE26JGYT4_cjs.arbiQueryKeys.contacts() })
1589
1601
  });
1590
1602
  }
1591
1603
  function useRemoveContacts() {
1592
- const arbi = chunkIIT7DMQL_cjs.useArbi();
1604
+ const arbi = chunkXIDDXD5Y_cjs.useArbi();
1593
1605
  const qc = reactQuery.useQueryClient();
1594
1606
  return reactQuery.useMutation({
1595
1607
  mutationFn: (contactIds) => arbi.contacts.remove(contactIds),
1596
- onSuccess: () => qc.invalidateQueries({ queryKey: chunkPXHRLAOX_cjs.arbiQueryKeys.contacts() })
1608
+ onSuccess: () => qc.invalidateQueries({ queryKey: chunkE26JGYT4_cjs.arbiQueryKeys.contacts() })
1597
1609
  });
1598
1610
  }
1599
1611
  function toProfileView(profile) {
@@ -1603,9 +1615,9 @@ function toProfileView(profile) {
1603
1615
  };
1604
1616
  }
1605
1617
  function useProfile(options) {
1606
- const arbi = chunkIIT7DMQL_cjs.useArbi();
1618
+ const arbi = chunkXIDDXD5Y_cjs.useArbi();
1607
1619
  return reactQuery.useQuery({
1608
- queryKey: chunkPXHRLAOX_cjs.arbiQueryKeys.profile(),
1620
+ queryKey: chunkE26JGYT4_cjs.arbiQueryKeys.profile(),
1609
1621
  queryFn: () => {
1610
1622
  const profile = arbi.user.profile();
1611
1623
  return profile ? toProfileView(profile) : null;
@@ -1615,7 +1627,7 @@ function useProfile(options) {
1615
1627
  });
1616
1628
  }
1617
1629
  function useUpdateProfile() {
1618
- const arbi = chunkIIT7DMQL_cjs.useArbi();
1630
+ const arbi = chunkXIDDXD5Y_cjs.useArbi();
1619
1631
  const qc = reactQuery.useQueryClient();
1620
1632
  return reactQuery.useMutation({
1621
1633
  mutationFn: async (vars) => {
@@ -1628,9 +1640,9 @@ function useUpdateProfile() {
1628
1640
  return profile ? toProfileView(profile) : null;
1629
1641
  },
1630
1642
  onSuccess: (profile) => {
1631
- qc.setQueryData(chunkPXHRLAOX_cjs.arbiQueryKeys.profile(), profile);
1632
- void qc.invalidateQueries({ queryKey: chunkPXHRLAOX_cjs.arbiQueryKeys.identity() });
1633
- return qc.invalidateQueries({ queryKey: chunkPXHRLAOX_cjs.arbiQueryKeys.workspaces() });
1643
+ qc.setQueryData(chunkE26JGYT4_cjs.arbiQueryKeys.profile(), profile);
1644
+ void qc.invalidateQueries({ queryKey: chunkE26JGYT4_cjs.arbiQueryKeys.identity() });
1645
+ return qc.invalidateQueries({ queryKey: chunkE26JGYT4_cjs.arbiQueryKeys.workspaces() });
1634
1646
  }
1635
1647
  });
1636
1648
  }
@@ -1703,19 +1715,19 @@ function useAvatarCrop({
1703
1715
  };
1704
1716
  }
1705
1717
  function useRequestEmailChange() {
1706
- const arbi = chunkIIT7DMQL_cjs.useArbi();
1718
+ const arbi = chunkXIDDXD5Y_cjs.useArbi();
1707
1719
  return reactQuery.useMutation({
1708
1720
  mutationFn: (newEmail) => arbi.account.requestEmailChange(newEmail)
1709
1721
  });
1710
1722
  }
1711
1723
  function useConfirmEmailChange() {
1712
- const arbi = chunkIIT7DMQL_cjs.useArbi();
1724
+ const arbi = chunkXIDDXD5Y_cjs.useArbi();
1713
1725
  const qc = reactQuery.useQueryClient();
1714
1726
  return reactQuery.useMutation({
1715
1727
  mutationFn: ({ newEmail, code }) => arbi.account.confirmEmailChange(newEmail, code),
1716
1728
  onSuccess: () => {
1717
1729
  const profile = arbi.user.profile();
1718
- qc.setQueryData(chunkPXHRLAOX_cjs.arbiQueryKeys.profile(), profile ? toProfileView(profile) : null);
1730
+ qc.setQueryData(chunkE26JGYT4_cjs.arbiQueryKeys.profile(), profile ? toProfileView(profile) : null);
1719
1731
  }
1720
1732
  });
1721
1733
  }
@@ -1780,7 +1792,7 @@ function useEmailChange({
1780
1792
  };
1781
1793
  }
1782
1794
  function usePasswordChange() {
1783
- const arbi = chunkIIT7DMQL_cjs.useArbi();
1795
+ const arbi = chunkXIDDXD5Y_cjs.useArbi();
1784
1796
  return reactQuery.useMutation({
1785
1797
  mutationFn: (vars) => arbi.account.changePassword(vars)
1786
1798
  });
@@ -1806,7 +1818,7 @@ function usePasswordChangeForm({
1806
1818
  const [confirmPassword, setConfirmPassword] = React.useState("");
1807
1819
  const [error, setError] = React.useState(null);
1808
1820
  const [isProcessing, setIsProcessing] = React.useState(false);
1809
- const [result, setResult] = React.useState(null);
1821
+ const [isChanged, setIsChanged] = React.useState(false);
1810
1822
  const clear = React.useCallback(() => {
1811
1823
  setCurrentPassword("");
1812
1824
  setNewPassword("");
@@ -1823,13 +1835,13 @@ function usePasswordChangeForm({
1823
1835
  if (unmet !== null) return setError(unmet);
1824
1836
  if (!recoveryMode && currentPassword === newPassword) return setError(m.sameAsCurrent);
1825
1837
  setIsProcessing(true);
1826
- void submit({ newPassword, currentPassword: recoveryMode ? void 0 : currentPassword }).then((outcome) => {
1838
+ void submit({ newPassword, currentPassword: recoveryMode ? void 0 : currentPassword }).then(() => {
1827
1839
  clear();
1828
1840
  if (recoveryMode) {
1829
1841
  onClose();
1830
1842
  onRecoveryComplete?.();
1831
1843
  } else {
1832
- setResult(outcome);
1844
+ setIsChanged(true);
1833
1845
  }
1834
1846
  }).catch((e) => {
1835
1847
  const message = client.passwordChangeErrorMessage(e);
@@ -1859,15 +1871,15 @@ function usePasswordChangeForm({
1859
1871
  isProcessing,
1860
1872
  isSubmitDisabled,
1861
1873
  onSubmit,
1862
- result,
1874
+ isChanged,
1863
1875
  onCancel: () => {
1864
1876
  clear();
1865
1877
  setError(null);
1866
- setResult(null);
1878
+ setIsChanged(false);
1867
1879
  onClose();
1868
1880
  },
1869
1881
  onDone: () => {
1870
- setResult(null);
1882
+ setIsChanged(false);
1871
1883
  onClose();
1872
1884
  }
1873
1885
  };
@@ -1882,33 +1894,33 @@ function toNotificationPreferences(stored, keys) {
1882
1894
  };
1883
1895
  }
1884
1896
  function useUserSettings(options) {
1885
- const arbi = chunkIIT7DMQL_cjs.useArbi();
1897
+ const arbi = chunkXIDDXD5Y_cjs.useArbi();
1886
1898
  return reactQuery.useQuery({
1887
- queryKey: chunkPXHRLAOX_cjs.arbiQueryKeys.userSettings(),
1899
+ queryKey: chunkE26JGYT4_cjs.arbiQueryKeys.userSettings(),
1888
1900
  queryFn: () => arbi.settings.get(),
1889
1901
  enabled: (options?.enabled ?? true) && arbi.isLoggedIn
1890
1902
  });
1891
1903
  }
1892
1904
  function useNotificationPreferences(keys, options) {
1893
- const arbi = chunkIIT7DMQL_cjs.useArbi();
1905
+ const arbi = chunkXIDDXD5Y_cjs.useArbi();
1894
1906
  const qc = reactQuery.useQueryClient();
1895
1907
  const settings = useUserSettings(options);
1896
1908
  const stored = settings.data?.email_notifications;
1897
1909
  const save = reactQuery.useMutation({
1898
1910
  mutationFn: (patch) => arbi.settings.update({ email_notifications: patch }),
1899
1911
  onMutate: async (patch) => {
1900
- await qc.cancelQueries({ queryKey: chunkPXHRLAOX_cjs.arbiQueryKeys.userSettings() });
1901
- const previous = qc.getQueryData(chunkPXHRLAOX_cjs.arbiQueryKeys.userSettings());
1912
+ await qc.cancelQueries({ queryKey: chunkE26JGYT4_cjs.arbiQueryKeys.userSettings() });
1913
+ const previous = qc.getQueryData(chunkE26JGYT4_cjs.arbiQueryKeys.userSettings());
1902
1914
  qc.setQueryData(
1903
- chunkPXHRLAOX_cjs.arbiQueryKeys.userSettings(),
1915
+ chunkE26JGYT4_cjs.arbiQueryKeys.userSettings(),
1904
1916
  (old) => old ? { ...old, email_notifications: { ...old.email_notifications, ...patch } } : old
1905
1917
  );
1906
1918
  return { previous };
1907
1919
  },
1908
1920
  onError: (_err, _patch, context) => {
1909
- qc.setQueryData(chunkPXHRLAOX_cjs.arbiQueryKeys.userSettings(), context?.previous);
1921
+ qc.setQueryData(chunkE26JGYT4_cjs.arbiQueryKeys.userSettings(), context?.previous);
1910
1922
  },
1911
- onSettled: () => qc.invalidateQueries({ queryKey: chunkPXHRLAOX_cjs.arbiQueryKeys.userSettings() })
1923
+ onSettled: () => qc.invalidateQueries({ queryKey: chunkE26JGYT4_cjs.arbiQueryKeys.userSettings() })
1912
1924
  });
1913
1925
  const model = React.useMemo(() => toNotificationPreferences(stored, keys), [stored, keys]);
1914
1926
  const setAll = React.useCallback(
@@ -1930,15 +1942,15 @@ function useNotificationPreferences(keys, options) {
1930
1942
  };
1931
1943
  }
1932
1944
  function useTerminateSession() {
1933
- const arbi = chunkIIT7DMQL_cjs.useArbi();
1945
+ const arbi = chunkXIDDXD5Y_cjs.useArbi();
1934
1946
  const qc = reactQuery.useQueryClient();
1935
1947
  return reactQuery.useMutation({
1936
1948
  mutationFn: (sessionId) => arbi.sessions.terminate(sessionId),
1937
- onSuccess: () => qc.invalidateQueries({ queryKey: chunkPXHRLAOX_cjs.arbiQueryKeys.sessions() })
1949
+ onSuccess: () => qc.invalidateQueries({ queryKey: chunkE26JGYT4_cjs.arbiQueryKeys.sessions() })
1938
1950
  });
1939
1951
  }
1940
1952
  function useLogoutAllSessions() {
1941
- const arbi = chunkIIT7DMQL_cjs.useArbi();
1953
+ const arbi = chunkXIDDXD5Y_cjs.useArbi();
1942
1954
  const qc = reactQuery.useQueryClient();
1943
1955
  return reactQuery.useMutation({
1944
1956
  mutationFn: () => arbi.sessions.logoutAll(),
@@ -1946,7 +1958,7 @@ function useLogoutAllSessions() {
1946
1958
  });
1947
1959
  }
1948
1960
  function useCurrentSessionId() {
1949
- return chunkIIT7DMQL_cjs.useArbi().sessions.currentId();
1961
+ return chunkXIDDXD5Y_cjs.useArbi().sessions.currentId();
1950
1962
  }
1951
1963
  function parseDeleteAccountBlockers(error) {
1952
1964
  const body = error?.apiError ?? error;
@@ -1961,7 +1973,7 @@ function parseDeleteAccountBlockers(error) {
1961
1973
  return [];
1962
1974
  }
1963
1975
  function useDeleteAccount() {
1964
- const arbi = chunkIIT7DMQL_cjs.useArbi();
1976
+ const arbi = chunkXIDDXD5Y_cjs.useArbi();
1965
1977
  return reactQuery.useMutation({ mutationFn: () => arbi.account.requestDeletion() });
1966
1978
  }
1967
1979
  function useDeleteAccountFlow({
@@ -2077,7 +2089,7 @@ function useIdentityVerificationFlow(api, {
2077
2089
  const apiRef = React.useRef(api);
2078
2090
  apiRef.current = api;
2079
2091
  const query = reactQuery.useQuery({
2080
- queryKey: chunkPXHRLAOX_cjs.arbiQueryKeys.identity(),
2092
+ queryKey: chunkE26JGYT4_cjs.arbiQueryKeys.identity(),
2081
2093
  queryFn: () => apiRef.current.status(),
2082
2094
  enabled,
2083
2095
  staleTime: 6e4
@@ -2095,7 +2107,7 @@ function useIdentityVerificationFlow(api, {
2095
2107
  const lastVerified = React.useRef(void 0);
2096
2108
  const apply = React.useCallback(
2097
2109
  (next) => {
2098
- qc.setQueryData(chunkPXHRLAOX_cjs.arbiQueryKeys.identity(), next);
2110
+ qc.setQueryData(chunkE26JGYT4_cjs.arbiQueryKeys.identity(), next);
2099
2111
  if (lastVerified.current !== void 0 && lastVerified.current !== next.verified) {
2100
2112
  onVerifiedChange?.(next.verified);
2101
2113
  }
@@ -2283,7 +2295,7 @@ function useIdentityVerificationFlow(api, {
2283
2295
  };
2284
2296
  }
2285
2297
  function useIdentityVerification(options = {}) {
2286
- const arbi = chunkIIT7DMQL_cjs.useArbi();
2298
+ const arbi = chunkXIDDXD5Y_cjs.useArbi();
2287
2299
  const qc = reactQuery.useQueryClient();
2288
2300
  const api = React.useMemo(
2289
2301
  () => ({
@@ -2300,18 +2312,361 @@ function useIdentityVerification(options = {}) {
2300
2312
  return useIdentityVerificationFlow(api, {
2301
2313
  enabled: arbi.isLoggedIn,
2302
2314
  onVerifiedChange: (verified) => {
2303
- void qc.invalidateQueries({ queryKey: chunkPXHRLAOX_cjs.arbiQueryKeys.profile() });
2315
+ void qc.invalidateQueries({ queryKey: chunkE26JGYT4_cjs.arbiQueryKeys.profile() });
2304
2316
  onVerifiedChange?.(verified);
2305
2317
  },
2306
2318
  onNameAccepted: (name) => {
2307
- void qc.invalidateQueries({ queryKey: chunkPXHRLAOX_cjs.arbiQueryKeys.profile() });
2308
- void qc.invalidateQueries({ queryKey: chunkPXHRLAOX_cjs.arbiQueryKeys.workspaces() });
2319
+ void qc.invalidateQueries({ queryKey: chunkE26JGYT4_cjs.arbiQueryKeys.profile() });
2320
+ void qc.invalidateQueries({ queryKey: chunkE26JGYT4_cjs.arbiQueryKeys.workspaces() });
2309
2321
  onNameAccepted?.(name);
2310
2322
  }
2311
2323
  });
2312
2324
  }
2325
+
2326
+ // src/mail/client.ts
2327
+ var MailOfflineUnavailableError = class extends Error {
2328
+ constructor(message) {
2329
+ super(message);
2330
+ this.name = "MailOfflineUnavailableError";
2331
+ }
2332
+ };
2333
+ function accountPath(id) {
2334
+ return `/accounts/${encodeURIComponent(id)}`;
2335
+ }
2336
+ async function mailJson(fetch, path, init) {
2337
+ const response = await fetch(path, init);
2338
+ return response.status === 204 ? void 0 : response.json();
2339
+ }
2340
+ function createMailClient(fetch, overrides = {}) {
2341
+ return {
2342
+ fetch,
2343
+ getPolicy: () => mailJson(fetch, "/policy"),
2344
+ listAccounts: () => mailJson(fetch, "/accounts"),
2345
+ listFolders: (account) => mailJson(fetch, `${accountPath(account.id)}/folders`),
2346
+ listMessages: (account, folderId, query, cursor) => mailJson(
2347
+ fetch,
2348
+ `${accountPath(account.id)}/messages?${new URLSearchParams({ folder_id: folderId, q: query, ...cursor ? { cursor } : {} })}`
2349
+ ),
2350
+ getMessage: (account, messageId) => mailJson(fetch, `${accountPath(account.id)}/messages/${encodeURIComponent(messageId)}`),
2351
+ unlock: async () => {
2352
+ },
2353
+ ...overrides
2354
+ };
2355
+ }
2356
+ function arbiMailClient(arbi) {
2357
+ let unlocking = null;
2358
+ const unlockNative = () => {
2359
+ unlocking ??= arbi.mail.unlockNative().finally(() => {
2360
+ unlocking = null;
2361
+ });
2362
+ return unlocking;
2363
+ };
2364
+ const fetch = async (path, init = {}) => {
2365
+ if (path.startsWith("/accounts/native/") && (init.method ?? "GET") !== "POST")
2366
+ await unlockNative();
2367
+ return arbi.mail.fetch(path, init);
2368
+ };
2369
+ return createMailClient(fetch, {
2370
+ unlock: async (account) => {
2371
+ if (account.provider === "native") await unlockNative();
2372
+ }
2373
+ });
2374
+ }
2375
+ async function fileAttachment(file) {
2376
+ const data = await new Promise((resolve, reject) => {
2377
+ const reader = new FileReader();
2378
+ reader.onload = () => resolve(String(reader.result).split(",")[1]);
2379
+ reader.onerror = () => reject(new Error(`Could not read ${file.name}`));
2380
+ reader.readAsDataURL(file);
2381
+ });
2382
+ return {
2383
+ id: "",
2384
+ name: file.name,
2385
+ content_type: file.type || "application/octet-stream",
2386
+ size: file.size,
2387
+ content_base64: data
2388
+ };
2389
+ }
2390
+ function defaultMailAlias(user) {
2391
+ return [user?.given_name, user?.family_name].filter(Boolean).map(
2392
+ (name) => name.normalize("NFKD").replace(/[̀-ͯ]/g, "").toLowerCase().replace(/[^a-z0-9]/g, "")
2393
+ ).filter(Boolean).join(".").slice(0, 63);
2394
+ }
2395
+ function nextAliasSuggestion(alias) {
2396
+ const number = /(\d+)$/.exec(alias);
2397
+ if (!number) return `${alias}2`;
2398
+ return `${alias.slice(0, -number[1].length)}${Number(number[1]) + 1}`;
2399
+ }
2400
+ function isAliasTakenError(err) {
2401
+ return "status" in err && err.status === 409;
2402
+ }
2403
+ function aliasTakenMessage(alias, suggestion, domain) {
2404
+ return `${alias}@${domain} is already taken. Try ${suggestion}@${domain}: we check it when you confirm.`;
2405
+ }
2406
+ function mailDraftIdFromContent(content) {
2407
+ try {
2408
+ const meta = JSON.parse(content || "{}");
2409
+ return typeof meta.mail_id === "string" && meta.mail_id ? meta.mail_id : void 0;
2410
+ } catch {
2411
+ return void 0;
2412
+ }
2413
+ }
2414
+ var MailClientContext = React.createContext(null);
2415
+ var NO_MAIL = {
2416
+ client: createMailClient(
2417
+ () => Promise.reject(new Error("Mail needs a <MailClientProvider> or an <ArbiProvider> above it"))
2418
+ ),
2419
+ enabled: false,
2420
+ sessionKey: null
2421
+ };
2422
+ function MailClientProvider({
2423
+ client,
2424
+ enabled = true,
2425
+ sessionKey = "session",
2426
+ children
2427
+ }) {
2428
+ const value = React.useMemo(() => ({ client, enabled, sessionKey }), [client, enabled, sessionKey]);
2429
+ return /* @__PURE__ */ jsxRuntime.jsx(MailClientContext.Provider, { value, children });
2430
+ }
2431
+ function useMailClient() {
2432
+ const provided = React.useContext(MailClientContext);
2433
+ const arbi = React.useContext(chunkXIDDXD5Y_cjs.ArbiContext);
2434
+ const fallback = React.useMemo(() => arbi ? arbiMailClient(arbi) : null, [arbi]);
2435
+ if (provided) return provided;
2436
+ if (!arbi || !fallback) return NO_MAIL;
2437
+ let identity = null;
2438
+ try {
2439
+ identity = arbi.isLoggedIn ? arbi.user.identity()?.externalId ?? "session" : null;
2440
+ } catch {
2441
+ identity = null;
2442
+ }
2443
+ return { client: fallback, enabled: identity !== null, sessionKey: identity };
2444
+ }
2445
+ var mailQueryKeys = {
2446
+ all: () => ["mail"],
2447
+ policy: () => ["mail", "policy"],
2448
+ accounts: () => ["mail", "accounts"],
2449
+ unlock: (accountId, sessionKey) => ["mail", "unlock", accountId, sessionKey ?? ""],
2450
+ allFolders: () => ["mail", "folders"],
2451
+ folders: (accountId) => ["mail", "folders", accountId],
2452
+ allMessages: () => ["mail", "messages"],
2453
+ messages: (accountId, folderId, query, cursor) => ["mail", "messages", accountId, folderId, query, cursor],
2454
+ message: (accountId, messageId) => ["mail", "message", accountId, messageId]
2455
+ };
2456
+ function useMailOnline() {
2457
+ return React.useSyncExternalStore(
2458
+ (onChange) => reactQuery.onlineManager.subscribe(onChange),
2459
+ () => reactQuery.onlineManager.isOnline(),
2460
+ () => true
2461
+ );
2462
+ }
2463
+ function useMailPolicy() {
2464
+ const { client, enabled } = useMailClient();
2465
+ return reactQuery.useQuery({
2466
+ queryKey: mailQueryKeys.policy(),
2467
+ queryFn: () => client.getPolicy(),
2468
+ networkMode: "always",
2469
+ enabled,
2470
+ staleTime: 6e4,
2471
+ retry: false
2472
+ });
2473
+ }
2474
+ function useMailAccounts(options = {}) {
2475
+ const { client, enabled } = useMailClient();
2476
+ return reactQuery.useQuery({
2477
+ queryKey: mailQueryKeys.accounts(),
2478
+ queryFn: () => client.listAccounts(),
2479
+ networkMode: "always",
2480
+ enabled: enabled && (options.enabled ?? true),
2481
+ retry: false
2482
+ });
2483
+ }
2484
+ function useMailUnlock(account) {
2485
+ const { client, enabled, sessionKey } = useMailClient();
2486
+ const isOnline = useMailOnline();
2487
+ return reactQuery.useQuery({
2488
+ queryKey: mailQueryKeys.unlock(account?.id, sessionKey),
2489
+ queryFn: async () => {
2490
+ if (!account) throw new Error("Sign in to unlock your mailbox");
2491
+ await client.unlock(account);
2492
+ return true;
2493
+ },
2494
+ enabled: enabled && !!account && sessionKey !== null && !account.needs_reconsent && isOnline,
2495
+ staleTime: Infinity,
2496
+ retry: false
2497
+ });
2498
+ }
2499
+ function useMailFolders(account, options) {
2500
+ const { client } = useMailClient();
2501
+ return reactQuery.useQuery({
2502
+ queryKey: mailQueryKeys.folders(account?.id),
2503
+ queryFn: () => client.listFolders(account),
2504
+ networkMode: "always",
2505
+ enabled: !!account && (options.enabled ?? true),
2506
+ retry: false
2507
+ });
2508
+ }
2509
+ function useMailMessages(account, folderId, query, cursor, options = {}) {
2510
+ const { client } = useMailClient();
2511
+ return reactQuery.useQuery({
2512
+ queryKey: mailQueryKeys.messages(account?.id, folderId, query, cursor),
2513
+ queryFn: () => client.listMessages(account, folderId, query, cursor),
2514
+ networkMode: "always",
2515
+ enabled: !!account && !!folderId && (options.enabled ?? true),
2516
+ retry: false,
2517
+ refetchInterval: options.refetchInterval
2518
+ });
2519
+ }
2520
+ function useMailMessage(account, messageId, options = {}) {
2521
+ const { client } = useMailClient();
2522
+ return reactQuery.useQuery({
2523
+ queryKey: mailQueryKeys.message(account?.id, messageId),
2524
+ queryFn: () => client.getMessage(account, messageId),
2525
+ networkMode: "always",
2526
+ enabled: !!account && !!messageId && (options.enabled ?? true),
2527
+ retry: false
2528
+ });
2529
+ }
2530
+ function useClaimNativeAlias(onClaimed) {
2531
+ const { client } = useMailClient();
2532
+ const queryClient = reactQuery.useQueryClient();
2533
+ return reactQuery.useMutation({
2534
+ mutationFn: (alias) => mailJson(client.fetch, "/native/alias", { method: "POST", body: JSON.stringify({ alias }) }),
2535
+ onSuccess: async (_data, alias) => {
2536
+ await queryClient.invalidateQueries({ queryKey: mailQueryKeys.all() });
2537
+ onClaimed?.(alias);
2538
+ }
2539
+ });
2540
+ }
2541
+ function useConnectMailAccount() {
2542
+ const { client } = useMailClient();
2543
+ const queryClient = reactQuery.useQueryClient();
2544
+ return reactQuery.useMutation({
2545
+ mutationFn: (input) => mailJson(client.fetch, "/accounts", {
2546
+ method: "POST",
2547
+ body: JSON.stringify({
2548
+ profile_id: input.profileId,
2549
+ email: input.email,
2550
+ username: input.username || input.email,
2551
+ password: input.password
2552
+ })
2553
+ }),
2554
+ onSuccess: () => queryClient.invalidateQueries({ queryKey: mailQueryKeys.accounts() })
2555
+ });
2556
+ }
2557
+ function useDisconnectMailAccount() {
2558
+ const { client } = useMailClient();
2559
+ const queryClient = reactQuery.useQueryClient();
2560
+ return reactQuery.useMutation({
2561
+ mutationFn: (accountId) => mailJson(client.fetch, accountPath(accountId), { method: "DELETE" }),
2562
+ onSuccess: () => queryClient.invalidateQueries({ queryKey: mailQueryKeys.all() })
2563
+ });
2564
+ }
2565
+ function useMailCache() {
2566
+ const queryClient = reactQuery.useQueryClient();
2567
+ return React.useMemo(() => {
2568
+ const refreshAll = () => queryClient.invalidateQueries({ queryKey: mailQueryKeys.all() });
2569
+ return {
2570
+ refreshAll,
2571
+ refreshFolders: () => queryClient.invalidateQueries({ queryKey: mailQueryKeys.allFolders() }),
2572
+ /** After a write to one message: drop a read of it still in flight (it may carry the old state), then refresh. */
2573
+ settleMessage: async (accountId, messageId) => {
2574
+ await queryClient.cancelQueries({ queryKey: mailQueryKeys.message(accountId, messageId) });
2575
+ await refreshAll();
2576
+ }
2577
+ };
2578
+ }, [queryClient]);
2579
+ }
2580
+ function useUpdateMailMessage() {
2581
+ const { client } = useMailClient();
2582
+ return reactQuery.useMutation({
2583
+ mutationFn: ({
2584
+ accountId,
2585
+ messageId,
2586
+ update
2587
+ }) => mailJson(
2588
+ client.fetch,
2589
+ `${accountPath(accountId)}/messages/${encodeURIComponent(messageId)}`,
2590
+ {
2591
+ method: "PATCH",
2592
+ body: JSON.stringify(update)
2593
+ }
2594
+ )
2595
+ });
2596
+ }
2597
+ async function withFallback(compose, fallback, online) {
2598
+ if (fallback && !reactQuery.onlineManager.isOnline()) {
2599
+ await fallback.keep(compose);
2600
+ return { onDevice: true };
2601
+ }
2602
+ try {
2603
+ return await online();
2604
+ } catch (error) {
2605
+ if (!fallback?.isNetworkFailure(error)) throw error;
2606
+ await fallback.keep(compose);
2607
+ return { onDevice: true };
2608
+ }
2609
+ }
2610
+ function useSaveMailDraft(fallback) {
2611
+ const { client } = useMailClient();
2612
+ const queryClient = reactQuery.useQueryClient();
2613
+ return reactQuery.useMutation({
2614
+ // networkMode 'always': offline the save runs (to the device) instead of pausing on "Saving…".
2615
+ networkMode: "always",
2616
+ mutationFn: ({ accountId, compose }) => withFallback(
2617
+ compose,
2618
+ fallback,
2619
+ () => mailJson(client.fetch, `${accountPath(accountId)}/drafts`, {
2620
+ method: "POST",
2621
+ body: JSON.stringify(compose)
2622
+ })
2623
+ ),
2624
+ onSuccess: (result) => {
2625
+ if (!("onDevice" in result))
2626
+ void queryClient.invalidateQueries({ queryKey: mailQueryKeys.allMessages() });
2627
+ }
2628
+ });
2629
+ }
2630
+ function useSendMail(fallback) {
2631
+ const { client } = useMailClient();
2632
+ const queryClient = reactQuery.useQueryClient();
2633
+ return reactQuery.useMutation({
2634
+ networkMode: "always",
2635
+ retry: false,
2636
+ mutationFn: ({
2637
+ accountId,
2638
+ compose,
2639
+ requestId,
2640
+ secure
2641
+ }) => withFallback(
2642
+ compose,
2643
+ fallback,
2644
+ async () => secure ? mailJson(client.fetch, "/secure/send", {
2645
+ method: "POST",
2646
+ body: JSON.stringify(await secure())
2647
+ }) : mailJson(client.fetch, `${accountPath(accountId)}/send`, {
2648
+ method: "POST",
2649
+ body: JSON.stringify({ ...compose, request_id: requestId })
2650
+ })
2651
+ ),
2652
+ onSuccess: (result) => {
2653
+ if (!(result && typeof result === "object" && "onDevice" in result))
2654
+ void queryClient.invalidateQueries({ queryKey: mailQueryKeys.all() });
2655
+ }
2656
+ });
2657
+ }
2658
+ function useMailDraftCompose(account, draftId, prepare, options = {}) {
2659
+ return reactQuery.useQuery({
2660
+ queryKey: ["mail", "draft-compose", account?.id, draftId],
2661
+ queryFn: () => prepare(account, draftId),
2662
+ networkMode: "always",
2663
+ enabled: !!account && !!draftId && (options.enabled ?? true),
2664
+ retry: false,
2665
+ staleTime: Infinity
2666
+ });
2667
+ }
2313
2668
  function useWorkspaceDocs(workspaceId) {
2314
- const { data: docs = [], isLoading, isError } = chunkPXHRLAOX_cjs.useDocuments(workspaceId);
2669
+ const { data: docs = [], isLoading, isError } = chunkE26JGYT4_cjs.useDocuments(workspaceId);
2315
2670
  const docIds = React.useMemo(
2316
2671
  () => docs.map((d) => d.external_id).filter((id) => !!id),
2317
2672
  [docs]
@@ -2319,7 +2674,7 @@ function useWorkspaceDocs(workspaceId) {
2319
2674
  return { wsId: workspaceId, docs, docIds, isLoading, isError, ready: docIds.length > 0 };
2320
2675
  }
2321
2676
  function useAiTask() {
2322
- const mutation = chunkPXHRLAOX_cjs.useAssistantQuery();
2677
+ const mutation = chunkE26JGYT4_cjs.useAssistantQuery();
2323
2678
  const [status, setStatus] = React.useState("idle");
2324
2679
  const [text, setText] = React.useState("");
2325
2680
  const [stepCount, setStepCount] = React.useState(0);
@@ -2409,7 +2764,7 @@ function useAiTask() {
2409
2764
  };
2410
2765
  }
2411
2766
  function useSemanticSearch(docIds) {
2412
- const arbi = chunkIIT7DMQL_cjs.useArbi();
2767
+ const arbi = chunkXIDDXD5Y_cjs.useArbi();
2413
2768
  const [query, setQuery] = React.useState("");
2414
2769
  const mutation = reactQuery.useMutation({
2415
2770
  mutationFn: async ({ query: q, mode }) => {
@@ -2912,8 +3267,8 @@ function DocumentReview({
2912
3267
  onClose,
2913
3268
  className
2914
3269
  }) {
2915
- const parsedQuery = chunkPXHRLAOX_cjs.useParsedDocument(docId, stage);
2916
- const tagsQuery = chunkPXHRLAOX_cjs.useTags(workspaceId);
3270
+ const parsedQuery = chunkE26JGYT4_cjs.useParsedDocument(docId, stage);
3271
+ const tagsQuery = chunkE26JGYT4_cjs.useTags(workspaceId);
2917
3272
  const tagNameById = React__default.default.useMemo(() => {
2918
3273
  const map = /* @__PURE__ */ new Map();
2919
3274
  for (const t of tagsQuery.data ?? []) {
@@ -3144,7 +3499,7 @@ function SemanticSearch({
3144
3499
  const { results, status, error, search, isRunning, query } = useSemanticSearch(docIds);
3145
3500
  const [value, setValue] = React.useState("");
3146
3501
  const [selected, setSelected] = React.useState(null);
3147
- const { data: docs = [] } = chunkPXHRLAOX_cjs.useDocuments(workspaceId, { enabled: !!workspaceId });
3502
+ const { data: docs = [] } = chunkE26JGYT4_cjs.useDocuments(workspaceId, { enabled: !!workspaceId });
3148
3503
  const docMap = React.useMemo(() => {
3149
3504
  const map = /* @__PURE__ */ new Map();
3150
3505
  for (const d of docs) if (d.external_id) map.set(d.external_id, d);
@@ -4248,7 +4603,7 @@ function ActivityFeed({
4248
4603
  enabled,
4249
4604
  "data-testid": testId = "activity-feed"
4250
4605
  }) {
4251
- const { data, isLoading, isError } = chunkPXHRLAOX_cjs.useActivity({ limit, enabled });
4606
+ const { data, isLoading, isError } = chunkE26JGYT4_cjs.useActivity({ limit, enabled });
4252
4607
  if (isLoading) {
4253
4608
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: chunkS6A6FSG7_cjs.cn("space-y-2", className), "data-testid": testId, "aria-busy": "true", children: Array.from({ length: 3 }).map((_, i) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3 py-1.5", children: [
4254
4609
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-4 w-4 shrink-0 animate-pulse rounded-full bg-muted" }),
@@ -4294,10 +4649,11 @@ var workTypes = [
4294
4649
  "workspace_access_request",
4295
4650
  "conversation_ready",
4296
4651
  "conversation_done",
4297
- "workflow_failed"
4652
+ "workflow_failed",
4653
+ "mail_draft_ready"
4298
4654
  ];
4299
4655
  function useWorkNotifications(options) {
4300
- const arbi = chunkIIT7DMQL_cjs.useArbi();
4656
+ const arbi = chunkXIDDXD5Y_cjs.useArbi();
4301
4657
  const queries = reactQuery.useQueryClient();
4302
4658
  const queryKey = ["work-notifications", options.apiUrl, options.userId];
4303
4659
  const query = reactQuery.useQuery({
@@ -4390,7 +4746,7 @@ function groupConversations(notifications, myExtId) {
4390
4746
  return conversations;
4391
4747
  }
4392
4748
  function useDirectMessages(options) {
4393
- const arbi = chunkIIT7DMQL_cjs.useArbi();
4749
+ const arbi = chunkXIDDXD5Y_cjs.useArbi();
4394
4750
  const queryClient = reactQuery.useQueryClient();
4395
4751
  const enabled = options?.enabled ?? arbi.isLoggedIn;
4396
4752
  const query = reactQuery.useQuery({
@@ -4399,7 +4755,7 @@ function useDirectMessages(options) {
4399
4755
  enabled
4400
4756
  });
4401
4757
  const contactsQuery = reactQuery.useQuery({
4402
- queryKey: chunkPXHRLAOX_cjs.arbiQueryKeys.contacts(),
4758
+ queryKey: chunkE26JGYT4_cjs.arbiQueryKeys.contacts(),
4403
4759
  queryFn: () => arbi.contacts.list(),
4404
4760
  enabled
4405
4761
  });
@@ -5570,10 +5926,10 @@ function DocumentTable({
5570
5926
  extraColumns,
5571
5927
  className
5572
5928
  }) {
5573
- const query = chunkPXHRLAOX_cjs.useDocuments(workspaceId, { enabled: !documents });
5929
+ const query = chunkE26JGYT4_cjs.useDocuments(workspaceId, { enabled: !documents });
5574
5930
  const rows = documents ?? query.data ?? [];
5575
5931
  const isLoading = !documents && query.isLoading;
5576
- const tagsQuery = chunkPXHRLAOX_cjs.useTags(workspaceId);
5932
+ const tagsQuery = chunkE26JGYT4_cjs.useTags(workspaceId);
5577
5933
  const tagNameById = React__default.default.useMemo(() => {
5578
5934
  const map = /* @__PURE__ */ new Map();
5579
5935
  for (const t of tagsQuery.data ?? []) {
@@ -5749,12 +6105,12 @@ function DocumentCardMenu({
5749
6105
  canDelete = true,
5750
6106
  testId = "document-card-menu"
5751
6107
  }) {
5752
- const arbi = chunkIIT7DMQL_cjs.useArbi();
6108
+ const arbi = chunkXIDDXD5Y_cjs.useArbi();
5753
6109
  const queryClient = reactQuery.useQueryClient();
5754
6110
  const invalidateDocuments = () => {
5755
6111
  const workspaceId = arbi.getWorkspaceId();
5756
6112
  if (workspaceId) {
5757
- void queryClient.invalidateQueries({ queryKey: chunkPXHRLAOX_cjs.arbiQueryKeys.documents(workspaceId) });
6113
+ void queryClient.invalidateQueries({ queryKey: chunkE26JGYT4_cjs.arbiQueryKeys.documents(workspaceId) });
5758
6114
  }
5759
6115
  };
5760
6116
  const download = reactQuery.useMutation({
@@ -5853,10 +6209,10 @@ function DocumentGallery({
5853
6209
  minTileWidth = 148,
5854
6210
  className
5855
6211
  }) {
5856
- const query = chunkPXHRLAOX_cjs.useDocuments(workspaceId, { enabled: !documents });
6212
+ const query = chunkE26JGYT4_cjs.useDocuments(workspaceId, { enabled: !documents });
5857
6213
  const rows = documents ?? query.data ?? [];
5858
6214
  const isLoading = !documents && query.isLoading;
5859
- const tagsQuery = chunkPXHRLAOX_cjs.useTags(workspaceId);
6215
+ const tagsQuery = chunkE26JGYT4_cjs.useTags(workspaceId);
5860
6216
  const tagNameById = React__default.default.useMemo(() => {
5861
6217
  const map = /* @__PURE__ */ new Map();
5862
6218
  for (const t of tagsQuery.data ?? []) {
@@ -5868,7 +6224,7 @@ function DocumentGallery({
5868
6224
  () => rows.map((d) => d.external_id).filter((id) => !!id),
5869
6225
  [rows]
5870
6226
  );
5871
- const thumbsQuery = chunkPXHRLAOX_cjs.useThumbnails(docIds);
6227
+ const thumbsQuery = chunkE26JGYT4_cjs.useThumbnails(docIds);
5872
6228
  const thumbs = thumbsQuery.data ?? {};
5873
6229
  const storeSelected = useArbiUiStore((s) => s.selectedDocIds);
5874
6230
  const storeSetSelected = useArbiUiStore((s) => s.setSelectedDocIds);
@@ -5893,7 +6249,7 @@ function DocumentGallery({
5893
6249
  },
5894
6250
  [onOpenDocument, setViewingDocId]
5895
6251
  );
5896
- const arbi = chunkIIT7DMQL_cjs.useArbi();
6252
+ const arbi = chunkXIDDXD5Y_cjs.useArbi();
5897
6253
  const queryClient = reactQuery.useQueryClient();
5898
6254
  const [renamingId, setRenamingId] = React__default.default.useState(null);
5899
6255
  const rename = reactQuery.useMutation({
@@ -5904,7 +6260,7 @@ function DocumentGallery({
5904
6260
  setRenamingId(null);
5905
6261
  const activeWorkspace = workspaceId ?? arbi.getWorkspaceId();
5906
6262
  if (activeWorkspace) {
5907
- void queryClient.invalidateQueries({ queryKey: chunkPXHRLAOX_cjs.arbiQueryKeys.documents(activeWorkspace) });
6263
+ void queryClient.invalidateQueries({ queryKey: chunkE26JGYT4_cjs.arbiQueryKeys.documents(activeWorkspace) });
5908
6264
  }
5909
6265
  }
5910
6266
  });
@@ -6522,107 +6878,107 @@ function hasVideoTrack(blob) {
6522
6878
 
6523
6879
  Object.defineProperty(exports, "DEFAULT_USD_PER_CREDIT", {
6524
6880
  enumerable: true,
6525
- get: function () { return chunkPXHRLAOX_cjs.DEFAULT_USD_PER_CREDIT; }
6881
+ get: function () { return chunkE26JGYT4_cjs.DEFAULT_USD_PER_CREDIT; }
6526
6882
  });
6527
6883
  Object.defineProperty(exports, "arbiQueryKeys", {
6528
6884
  enumerable: true,
6529
- get: function () { return chunkPXHRLAOX_cjs.arbiQueryKeys; }
6885
+ get: function () { return chunkE26JGYT4_cjs.arbiQueryKeys; }
6530
6886
  });
6531
6887
  Object.defineProperty(exports, "creditsToUsd", {
6532
6888
  enumerable: true,
6533
- get: function () { return chunkPXHRLAOX_cjs.creditsToUsd; }
6889
+ get: function () { return chunkE26JGYT4_cjs.creditsToUsd; }
6534
6890
  });
6535
6891
  Object.defineProperty(exports, "formatCredits", {
6536
6892
  enumerable: true,
6537
- get: function () { return chunkPXHRLAOX_cjs.formatCredits; }
6893
+ get: function () { return chunkE26JGYT4_cjs.formatCredits; }
6538
6894
  });
6539
6895
  Object.defineProperty(exports, "isUsageMetered", {
6540
6896
  enumerable: true,
6541
- get: function () { return chunkPXHRLAOX_cjs.isUsageMetered; }
6897
+ get: function () { return chunkE26JGYT4_cjs.isUsageMetered; }
6542
6898
  });
6543
6899
  Object.defineProperty(exports, "useActivity", {
6544
6900
  enumerable: true,
6545
- get: function () { return chunkPXHRLAOX_cjs.useActivity; }
6901
+ get: function () { return chunkE26JGYT4_cjs.useActivity; }
6546
6902
  });
6547
6903
  Object.defineProperty(exports, "useAgents", {
6548
6904
  enumerable: true,
6549
- get: function () { return chunkPXHRLAOX_cjs.useAgents; }
6905
+ get: function () { return chunkE26JGYT4_cjs.useAgents; }
6550
6906
  });
6551
6907
  Object.defineProperty(exports, "useAssistantQuery", {
6552
6908
  enumerable: true,
6553
- get: function () { return chunkPXHRLAOX_cjs.useAssistantQuery; }
6909
+ get: function () { return chunkE26JGYT4_cjs.useAssistantQuery; }
6554
6910
  });
6555
6911
  Object.defineProperty(exports, "useConfigs", {
6556
6912
  enumerable: true,
6557
- get: function () { return chunkPXHRLAOX_cjs.useConfigs; }
6913
+ get: function () { return chunkE26JGYT4_cjs.useConfigs; }
6558
6914
  });
6559
6915
  Object.defineProperty(exports, "useConversationThreads", {
6560
6916
  enumerable: true,
6561
- get: function () { return chunkPXHRLAOX_cjs.useConversationThreads; }
6917
+ get: function () { return chunkE26JGYT4_cjs.useConversationThreads; }
6562
6918
  });
6563
6919
  Object.defineProperty(exports, "useConversations", {
6564
6920
  enumerable: true,
6565
- get: function () { return chunkPXHRLAOX_cjs.useConversations; }
6921
+ get: function () { return chunkE26JGYT4_cjs.useConversations; }
6566
6922
  });
6567
6923
  Object.defineProperty(exports, "useDeleteAgents", {
6568
6924
  enumerable: true,
6569
- get: function () { return chunkPXHRLAOX_cjs.useDeleteAgents; }
6925
+ get: function () { return chunkE26JGYT4_cjs.useDeleteAgents; }
6570
6926
  });
6571
6927
  Object.defineProperty(exports, "useDocuments", {
6572
6928
  enumerable: true,
6573
- get: function () { return chunkPXHRLAOX_cjs.useDocuments; }
6929
+ get: function () { return chunkE26JGYT4_cjs.useDocuments; }
6574
6930
  });
6575
6931
  Object.defineProperty(exports, "useFacts", {
6576
6932
  enumerable: true,
6577
- get: function () { return chunkPXHRLAOX_cjs.useFacts; }
6933
+ get: function () { return chunkE26JGYT4_cjs.useFacts; }
6578
6934
  });
6579
6935
  Object.defineProperty(exports, "useHealth", {
6580
6936
  enumerable: true,
6581
- get: function () { return chunkPXHRLAOX_cjs.useHealth; }
6937
+ get: function () { return chunkE26JGYT4_cjs.useHealth; }
6582
6938
  });
6583
6939
  Object.defineProperty(exports, "useParsedDocument", {
6584
6940
  enumerable: true,
6585
- get: function () { return chunkPXHRLAOX_cjs.useParsedDocument; }
6941
+ get: function () { return chunkE26JGYT4_cjs.useParsedDocument; }
6586
6942
  });
6587
6943
  Object.defineProperty(exports, "useProjectInvoices", {
6588
6944
  enumerable: true,
6589
- get: function () { return chunkPXHRLAOX_cjs.useProjectInvoices; }
6945
+ get: function () { return chunkE26JGYT4_cjs.useProjectInvoices; }
6590
6946
  });
6591
6947
  Object.defineProperty(exports, "useProjectUsage", {
6592
6948
  enumerable: true,
6593
- get: function () { return chunkPXHRLAOX_cjs.useProjectUsage; }
6949
+ get: function () { return chunkE26JGYT4_cjs.useProjectUsage; }
6594
6950
  });
6595
6951
  Object.defineProperty(exports, "useProjects", {
6596
6952
  enumerable: true,
6597
- get: function () { return chunkPXHRLAOX_cjs.useProjects; }
6953
+ get: function () { return chunkE26JGYT4_cjs.useProjects; }
6598
6954
  });
6599
6955
  Object.defineProperty(exports, "useProjectsUsage", {
6600
6956
  enumerable: true,
6601
- get: function () { return chunkPXHRLAOX_cjs.useProjectsUsage; }
6957
+ get: function () { return chunkE26JGYT4_cjs.useProjectsUsage; }
6602
6958
  });
6603
6959
  Object.defineProperty(exports, "useSessions", {
6604
6960
  enumerable: true,
6605
- get: function () { return chunkPXHRLAOX_cjs.useSessions; }
6961
+ get: function () { return chunkE26JGYT4_cjs.useSessions; }
6606
6962
  });
6607
6963
  Object.defineProperty(exports, "useTags", {
6608
6964
  enumerable: true,
6609
- get: function () { return chunkPXHRLAOX_cjs.useTags; }
6965
+ get: function () { return chunkE26JGYT4_cjs.useTags; }
6610
6966
  });
6611
6967
  Object.defineProperty(exports, "useThumbnails", {
6612
6968
  enumerable: true,
6613
- get: function () { return chunkPXHRLAOX_cjs.useThumbnails; }
6969
+ get: function () { return chunkE26JGYT4_cjs.useThumbnails; }
6614
6970
  });
6615
6971
  Object.defineProperty(exports, "useUserUsageToday", {
6616
6972
  enumerable: true,
6617
- get: function () { return chunkPXHRLAOX_cjs.useUserUsageToday; }
6973
+ get: function () { return chunkE26JGYT4_cjs.useUserUsageToday; }
6618
6974
  });
6619
6975
  Object.defineProperty(exports, "useWorkspaceUsers", {
6620
6976
  enumerable: true,
6621
- get: function () { return chunkPXHRLAOX_cjs.useWorkspaceUsers; }
6977
+ get: function () { return chunkE26JGYT4_cjs.useWorkspaceUsers; }
6622
6978
  });
6623
6979
  Object.defineProperty(exports, "useWorkspaces", {
6624
6980
  enumerable: true,
6625
- get: function () { return chunkPXHRLAOX_cjs.useWorkspaces; }
6981
+ get: function () { return chunkE26JGYT4_cjs.useWorkspaces; }
6626
6982
  });
6627
6983
  Object.defineProperty(exports, "cleanDraftMarkdown", {
6628
6984
  enumerable: true,
@@ -7366,15 +7722,15 @@ Object.defineProperty(exports, "cn", {
7366
7722
  });
7367
7723
  Object.defineProperty(exports, "ArbiProvider", {
7368
7724
  enumerable: true,
7369
- get: function () { return chunkIIT7DMQL_cjs.ArbiProvider; }
7725
+ get: function () { return chunkXIDDXD5Y_cjs.ArbiProvider; }
7370
7726
  });
7371
7727
  Object.defineProperty(exports, "useArbi", {
7372
7728
  enumerable: true,
7373
- get: function () { return chunkIIT7DMQL_cjs.useArbi; }
7729
+ get: function () { return chunkXIDDXD5Y_cjs.useArbi; }
7374
7730
  });
7375
7731
  Object.defineProperty(exports, "useDeploymentDomain", {
7376
7732
  enumerable: true,
7377
- get: function () { return chunkIIT7DMQL_cjs.useDeploymentDomain; }
7733
+ get: function () { return chunkXIDDXD5Y_cjs.useDeploymentDomain; }
7378
7734
  });
7379
7735
  Object.defineProperty(exports, "Arbi", {
7380
7736
  enumerable: true,
@@ -7425,6 +7781,8 @@ exports.ImageCropModal = ImageCropModal;
7425
7781
  exports.ImageCropper = ImageCropper;
7426
7782
  exports.LinkedInIcon = LinkedInIcon;
7427
7783
  exports.MAX_AVATAR_FILE_BYTES = MAX_AVATAR_FILE_BYTES;
7784
+ exports.MailClientProvider = MailClientProvider;
7785
+ exports.MailOfflineUnavailableError = MailOfflineUnavailableError;
7428
7786
  exports.MessageArtifactCard = MessageArtifactCard;
7429
7787
  exports.MessageBubble = MessageBubble;
7430
7788
  exports.MessageThread = MessageThread;
@@ -7437,11 +7795,17 @@ exports.StartByEmail = StartByEmail;
7437
7795
  exports.TypingIndicator = TypingIndicator;
7438
7796
  exports.VideoCapture = VideoCapture;
7439
7797
  exports.VoiceNoteRecorder = VoiceNoteRecorder;
7798
+ exports.accountPath = accountPath;
7799
+ exports.aliasTakenMessage = aliasTakenMessage;
7440
7800
  exports.annotateThread = annotateThread;
7801
+ exports.arbiMailClient = arbiMailClient;
7441
7802
  exports.captureFrameAsBlob = captureFrameAsBlob;
7803
+ exports.createMailClient = createMailClient;
7442
7804
  exports.cropImage = cropImage;
7443
7805
  exports.dayKey = dayKey;
7806
+ exports.defaultMailAlias = defaultMailAlias;
7444
7807
  exports.describeActivity = describeActivity;
7808
+ exports.fileAttachment = fileAttachment;
7445
7809
  exports.formatIdentityPrice = formatIdentityPrice;
7446
7810
  exports.getNotificationTypeMeta = getNotificationTypeMeta;
7447
7811
  exports.getWorkspaceActionText = getWorkspaceActionText;
@@ -7450,8 +7814,13 @@ exports.getWorkspaceSentPhrase = getWorkspaceSentPhrase;
7450
7814
  exports.hasVideoTrack = hasVideoTrack;
7451
7815
  exports.identityStepFor = identityStepFor;
7452
7816
  exports.invalidateTagData = invalidateTagData;
7817
+ exports.isAliasTakenError = isAliasTakenError;
7453
7818
  exports.isWorkspaceNotificationType = isWorkspaceNotificationType;
7819
+ exports.mailDraftIdFromContent = mailDraftIdFromContent;
7820
+ exports.mailJson = mailJson;
7821
+ exports.mailQueryKeys = mailQueryKeys;
7454
7822
  exports.mountDiditVerification = mountDiditVerification;
7823
+ exports.nextAliasSuggestion = nextAliasSuggestion;
7455
7824
  exports.parseActivityContent = parseActivityContent;
7456
7825
  exports.parseDeleteAccountBlockers = parseDeleteAccountBlockers;
7457
7826
  exports.pickRecentWorkspaces = pickRecentWorkspaces;
@@ -7486,9 +7855,11 @@ exports.useArbiWsTask = useArbiWsTask;
7486
7855
  exports.useArbiWsTasks = useArbiWsTasks;
7487
7856
  exports.useAvatarCrop = useAvatarCrop;
7488
7857
  exports.useCameraStream = useCameraStream;
7858
+ exports.useClaimNativeAlias = useClaimNativeAlias;
7489
7859
  exports.useCloseAgentSession = useCloseAgentSession;
7490
7860
  exports.useCommandPalette = useCommandPalette;
7491
7861
  exports.useConfirmEmailChange = useConfirmEmailChange;
7862
+ exports.useConnectMailAccount = useConnectMailAccount;
7492
7863
  exports.useContacts = useContacts;
7493
7864
  exports.useConversationActivity = useConversationActivity;
7494
7865
  exports.useConversationPendingAuth = useConversationPendingAuth;
@@ -7501,6 +7872,7 @@ exports.useDeleteAccount = useDeleteAccount;
7501
7872
  exports.useDeleteAccountFlow = useDeleteAccountFlow;
7502
7873
  exports.useDeleteWorkflow = useDeleteWorkflow;
7503
7874
  exports.useDirectMessages = useDirectMessages;
7875
+ exports.useDisconnectMailAccount = useDisconnectMailAccount;
7504
7876
  exports.useEmailChange = useEmailChange;
7505
7877
  exports.useFilteredProjects = useFilteredProjects;
7506
7878
  exports.useGrantAgentAccess = useGrantAgentAccess;
@@ -7508,6 +7880,16 @@ exports.useIdentityVerification = useIdentityVerification;
7508
7880
  exports.useIdentityVerificationFlow = useIdentityVerificationFlow;
7509
7881
  exports.useInvalidateTagData = useInvalidateTagData;
7510
7882
  exports.useLogoutAllSessions = useLogoutAllSessions;
7883
+ exports.useMailAccounts = useMailAccounts;
7884
+ exports.useMailCache = useMailCache;
7885
+ exports.useMailClient = useMailClient;
7886
+ exports.useMailDraftCompose = useMailDraftCompose;
7887
+ exports.useMailFolders = useMailFolders;
7888
+ exports.useMailMessage = useMailMessage;
7889
+ exports.useMailMessages = useMailMessages;
7890
+ exports.useMailOnline = useMailOnline;
7891
+ exports.useMailPolicy = useMailPolicy;
7892
+ exports.useMailUnlock = useMailUnlock;
7511
7893
  exports.useNameEditor = useNameEditor;
7512
7894
  exports.useNotificationPreferences = useNotificationPreferences;
7513
7895
  exports.usePasswordChange = usePasswordChange;
@@ -7523,18 +7905,22 @@ exports.useRevokeAgentAccess = useRevokeAgentAccess;
7523
7905
  exports.useRunConversation = useRunConversation;
7524
7906
  exports.useRunWorkflow = useRunWorkflow;
7525
7907
  exports.useSaveAgentConfig = useSaveAgentConfig;
7908
+ exports.useSaveMailDraft = useSaveMailDraft;
7526
7909
  exports.useSemanticSearch = useSemanticSearch;
7527
7910
  exports.useSendBackStep = useSendBackStep;
7911
+ exports.useSendMail = useSendMail;
7912
+ exports.useSetTagValues = useSetTagValues;
7528
7913
  exports.useShellWorkspaces = useShellWorkspaces;
7529
7914
  exports.useSkills = useSkills;
7530
7915
  exports.useStartAgentSession = useStartAgentSession;
7531
7916
  exports.useStartWorkQuery = useStartWorkQuery;
7532
- exports.useTagMatrix = useTagMatrix;
7917
+ exports.useTagKindSchema = useTagKindSchema;
7533
7918
  exports.useTerminateSession = useTerminateSession;
7534
7919
  exports.useUpdateConversation = useUpdateConversation;
7920
+ exports.useUpdateMailMessage = useUpdateMailMessage;
7535
7921
  exports.useUpdateProfile = useUpdateProfile;
7536
7922
  exports.useUpdateProjectFields = useUpdateProjectFields;
7537
- exports.useUpdateTagFields = useUpdateTagFields;
7923
+ exports.useUpdateTagKindSchema = useUpdateTagKindSchema;
7538
7924
  exports.useUpdateWorkflow = useUpdateWorkflow;
7539
7925
  exports.useUploadSkillFiles = useUploadSkillFiles;
7540
7926
  exports.useUserSettings = useUserSettings;