@arbidocs/react 0.5.61 → 0.5.62

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 (103) hide show
  1. package/dist/ProductionDialog.d-CpzslFn0.d.cts +51 -0
  2. package/dist/ProductionDialog.d-CpzslFn0.d.ts +51 -0
  3. package/dist/annotations/freeze/index.cjs +14 -14
  4. package/dist/annotations/freeze/index.js +3 -3
  5. package/dist/annotations/index.d.cts +3 -2
  6. package/dist/annotations/index.d.ts +3 -2
  7. package/dist/artifacts/index.cjs +12 -12
  8. package/dist/artifacts/index.js +5 -5
  9. package/dist/bundle-IC65W2AO.cjs +14 -0
  10. package/dist/{bundle-DCWPYNGD.cjs.map → bundle-IC65W2AO.cjs.map} +1 -1
  11. package/dist/bundle-YNOX7VIL.js +5 -0
  12. package/dist/{bundle-JCKKGEJE.js.map → bundle-YNOX7VIL.js.map} +1 -1
  13. package/dist/calls/livekit/index.cjs +54 -54
  14. package/dist/calls/livekit/index.js +6 -6
  15. package/dist/{chunk-S2W3ZOWG.js → chunk-2LV53J46.js} +85 -16
  16. package/dist/chunk-2LV53J46.js.map +1 -0
  17. package/dist/{chunk-H3HYKAS5.cjs → chunk-3BFSALPC.cjs} +3 -3
  18. package/dist/{chunk-H3HYKAS5.cjs.map → chunk-3BFSALPC.cjs.map} +1 -1
  19. package/dist/{chunk-2NFUEC5O.js → chunk-3NBPMR3X.js} +3 -3
  20. package/dist/{chunk-2NFUEC5O.js.map → chunk-3NBPMR3X.js.map} +1 -1
  21. package/dist/chunk-4DTTEUVY.js +1042 -0
  22. package/dist/chunk-4DTTEUVY.js.map +1 -0
  23. package/dist/{chunk-U64WCQP3.js → chunk-AOEJ744V.js} +25 -14
  24. package/dist/chunk-AOEJ744V.js.map +1 -0
  25. package/dist/{chunk-4E737GNX.cjs → chunk-BLBXADTN.cjs} +86 -73
  26. package/dist/chunk-BLBXADTN.cjs.map +1 -0
  27. package/dist/{chunk-X7JXQT6F.cjs → chunk-DVL7EFZZ.cjs} +42 -46
  28. package/dist/chunk-DVL7EFZZ.cjs.map +1 -0
  29. package/dist/{chunk-VAMPYLQ4.cjs → chunk-DZUBZ45Y.cjs} +78 -2
  30. package/dist/chunk-DZUBZ45Y.cjs.map +1 -0
  31. package/dist/{chunk-OSWKXZTJ.js → chunk-ER4LFZG3.js} +12 -16
  32. package/dist/chunk-ER4LFZG3.js.map +1 -0
  33. package/dist/{chunk-5HDC43MF.js → chunk-G4Z3IP4J.js} +72 -3
  34. package/dist/chunk-G4Z3IP4J.js.map +1 -0
  35. package/dist/chunk-GOJHU7RZ.cjs +1122 -0
  36. package/dist/chunk-GOJHU7RZ.cjs.map +1 -0
  37. package/dist/{chunk-G76ASVVH.cjs → chunk-GQAXAZN7.cjs} +25 -14
  38. package/dist/chunk-GQAXAZN7.cjs.map +1 -0
  39. package/dist/{chunk-TUPSNW3B.cjs → chunk-LMW46NBD.cjs} +11 -11
  40. package/dist/{chunk-TUPSNW3B.cjs.map → chunk-LMW46NBD.cjs.map} +1 -1
  41. package/dist/{chunk-KRH55LXW.js → chunk-NCMSQACC.js} +37 -24
  42. package/dist/chunk-NCMSQACC.js.map +1 -0
  43. package/dist/{chunk-A2XSLTIP.js → chunk-NIKPG4PW.js} +3 -3
  44. package/dist/{chunk-A2XSLTIP.js.map → chunk-NIKPG4PW.js.map} +1 -1
  45. package/dist/{chunk-B6I2HRRF.cjs → chunk-PC4O3JDV.cjs} +3 -3
  46. package/dist/{chunk-B6I2HRRF.cjs.map → chunk-PC4O3JDV.cjs.map} +1 -1
  47. package/dist/{chunk-M2SZQBCO.js → chunk-SI7DJWBT.js} +3 -3
  48. package/dist/{chunk-M2SZQBCO.js.map → chunk-SI7DJWBT.js.map} +1 -1
  49. package/dist/{chunk-3QK4VVPG.cjs → chunk-TGSEQGM3.cjs} +3 -3
  50. package/dist/{chunk-3QK4VVPG.cjs.map → chunk-TGSEQGM3.cjs.map} +1 -1
  51. package/dist/{chunk-LCSUCZVX.cjs → chunk-ZNQPUPX6.cjs} +118 -41
  52. package/dist/chunk-ZNQPUPX6.cjs.map +1 -0
  53. package/dist/{chunk-CMNZI4WQ.js → chunk-ZTPJNKF2.js} +4 -4
  54. package/dist/{chunk-CMNZI4WQ.js.map → chunk-ZTPJNKF2.js.map} +1 -1
  55. package/dist/document-tools/core.cjs +408 -0
  56. package/dist/document-tools/core.cjs.map +1 -0
  57. package/dist/document-tools/core.d.cts +957 -0
  58. package/dist/document-tools/core.d.ts +957 -0
  59. package/dist/document-tools/core.js +15 -0
  60. package/dist/document-tools/core.js.map +1 -0
  61. package/dist/document-tools/index.cjs +347 -1130
  62. package/dist/document-tools/index.cjs.map +1 -1
  63. package/dist/document-tools/index.d.cts +12 -950
  64. package/dist/document-tools/index.d.ts +12 -950
  65. package/dist/document-tools/index.js +13 -1034
  66. package/dist/document-tools/index.js.map +1 -1
  67. package/dist/index.cjs +1510 -1255
  68. package/dist/index.cjs.map +1 -1
  69. package/dist/{index.d-BLw5AN0H.d.cts → index.d-AT7wdTWC.d.cts} +50 -2
  70. package/dist/{index.d-BLw5AN0H.d.ts → index.d-AT7wdTWC.d.ts} +50 -2
  71. package/dist/{index.d-DPVj21h1.d.ts → index.d-B0dosFZc.d.cts} +6 -6
  72. package/dist/{index.d-DPVj21h1.d.cts → index.d-B0dosFZc.d.ts} +6 -6
  73. package/dist/index.d.cts +145 -69
  74. package/dist/index.d.ts +145 -69
  75. package/dist/index.js +346 -121
  76. package/dist/index.js.map +1 -1
  77. package/dist/{query-keys.d-DEEMzkLz.d.cts → query-keys.d-BFKQVevT.d.cts} +21 -12
  78. package/dist/{query-keys.d-DEEMzkLz.d.ts → query-keys.d-BFKQVevT.d.ts} +21 -12
  79. package/dist/shell/index.cjs +68 -40
  80. package/dist/shell/index.d.cts +1 -1
  81. package/dist/shell/index.d.ts +1 -1
  82. package/dist/shell/index.js +3 -3
  83. package/dist/store.d-DkFXbWDk.d.ts +35 -0
  84. package/dist/store.d-GADDvC7w.d.cts +35 -0
  85. package/dist/ui/index.cjs +149 -149
  86. package/dist/ui/index.d.cts +1 -1
  87. package/dist/ui/index.d.ts +1 -1
  88. package/dist/ui/index.js +2 -2
  89. package/package.json +11 -3
  90. package/dist/ProductionDialog.d-BDJwBSzj.d.ts +0 -84
  91. package/dist/ProductionDialog.d-DjRQFmQw.d.cts +0 -84
  92. package/dist/bundle-DCWPYNGD.cjs +0 -14
  93. package/dist/bundle-JCKKGEJE.js +0 -5
  94. package/dist/chunk-4E737GNX.cjs.map +0 -1
  95. package/dist/chunk-5HDC43MF.js.map +0 -1
  96. package/dist/chunk-G76ASVVH.cjs.map +0 -1
  97. package/dist/chunk-KRH55LXW.js.map +0 -1
  98. package/dist/chunk-LCSUCZVX.cjs.map +0 -1
  99. package/dist/chunk-OSWKXZTJ.js.map +0 -1
  100. package/dist/chunk-S2W3ZOWG.js.map +0 -1
  101. package/dist/chunk-U64WCQP3.js.map +0 -1
  102. package/dist/chunk-VAMPYLQ4.cjs.map +0 -1
  103. package/dist/chunk-X7JXQT6F.cjs.map +0 -1
@@ -1,17 +1,17 @@
1
1
  'use strict';
2
2
 
3
- var chunk4E737GNX_cjs = require('../../chunk-4E737GNX.cjs');
4
- require('../../chunk-X7JXQT6F.cjs');
5
- require('../../chunk-G76ASVVH.cjs');
6
- var chunkVAMPYLQ4_cjs = require('../../chunk-VAMPYLQ4.cjs');
3
+ var chunkBLBXADTN_cjs = require('../../chunk-BLBXADTN.cjs');
4
+ require('../../chunk-DVL7EFZZ.cjs');
5
+ require('../../chunk-GQAXAZN7.cjs');
6
+ var chunkY7S2SQH3_cjs = require('../../chunk-Y7S2SQH3.cjs');
7
+ var chunkDZUBZ45Y_cjs = require('../../chunk-DZUBZ45Y.cjs');
7
8
  require('../../chunk-N73IMVFF.cjs');
8
9
  require('../../chunk-ZWFMFOGP.cjs');
9
10
  require('../../chunk-VOFNX4P6.cjs');
10
11
  require('../../chunk-EEIYXVM4.cjs');
11
12
  require('../../chunk-Z3LLUO32.cjs');
12
- require('../../chunk-S6A6FSG7.cjs');
13
- var chunkY7S2SQH3_cjs = require('../../chunk-Y7S2SQH3.cjs');
14
13
  require('../../chunk-RCKA7BEF.cjs');
14
+ require('../../chunk-S6A6FSG7.cjs');
15
15
  var react = require('react');
16
16
  var livekitClient = require('livekit-client');
17
17
  var componentsReact = require('@livekit/components-react');
@@ -85,7 +85,7 @@ function useMuteRequests() {
85
85
  const onData = (payload, from, _kind, topic) => {
86
86
  if (topic !== MUTE_REQUEST_TOPIC || !from) return;
87
87
  const who = from.name || from.identity;
88
- chunkVAMPYLQ4_cjs.notify.info(`${who} asks you to mute your microphone`, {
88
+ chunkDZUBZ45Y_cjs.notify.info(`${who} asks you to mute your microphone`, {
89
89
  action: {
90
90
  label: "Mute",
91
91
  onClick: () => void room.localParticipant.setMicrophoneEnabled(false)
@@ -101,7 +101,7 @@ function useMuteRequests() {
101
101
  reliable: true,
102
102
  topic: MUTE_REQUEST_TOPIC,
103
103
  destinationIdentities: [identity]
104
- }).then(() => chunkVAMPYLQ4_cjs.notify.info("Asked to mute")).catch((err) => chunkVAMPYLQ4_cjs.notify.error(`Could not ask: ${err.message}`));
104
+ }).then(() => chunkDZUBZ45Y_cjs.notify.info("Asked to mute")).catch((err) => chunkDZUBZ45Y_cjs.notify.error(`Could not ask: ${err.message}`));
105
105
  }
106
106
  var FINAL_SEGMENT_GRACE_MS = 3e4;
107
107
  function mayStillSend(params) {
@@ -125,8 +125,8 @@ function useCallTranscriber({
125
125
  const arbi = chunkY7S2SQH3_cjs.useArbi();
126
126
  const queryClient = reactQuery.useQueryClient();
127
127
  const profile = arbi.isLoggedIn ? arbi.user.profile() : null;
128
- const myProfileName = profile && chunk4E737GNX_cjs.toProfileView(profile).fullName || null;
129
- const deploymentAvailable = chunk4E737GNX_cjs.useCallTranscriptionAvailable();
128
+ const myProfileName = profile && chunkBLBXADTN_cjs.toProfileView(profile).fullName || null;
129
+ const deploymentAvailable = chunkBLBXADTN_cjs.useCallTranscriptionAvailable();
130
130
  const available = deploymentAvailable && !!callKey;
131
131
  const [state, setState] = react.useState(null);
132
132
  const [creatorExtId, setCreatorExtId] = react.useState(null);
@@ -169,7 +169,7 @@ function useCallTranscriber({
169
169
  };
170
170
  }, [available, callExtId]);
171
171
  react.useEffect(
172
- () => chunk4E737GNX_cjs.onCallEvent("call.transcription", (message) => {
172
+ () => chunkBLBXADTN_cjs.onCallEvent("call.transcription", (message) => {
173
173
  if (message.call_ext_id === callExtId) applyState(message);
174
174
  }),
175
175
  [callExtId, applyState]
@@ -185,7 +185,7 @@ function useCallTranscriber({
185
185
  const persist = react.useCallback(
186
186
  (segment, speakerNeedsProxy) => {
187
187
  if (!callKey || persisted.current.has(segment.segmentId)) return;
188
- const role = chunk4E737GNX_cjs.transcriptPersistRole({
188
+ const role = chunkBLBXADTN_cjs.transcriptPersistRole({
189
189
  myIdentity,
190
190
  canPost: canPost && (segment.speakerIdentity !== myIdentity || selfPosts.current),
191
191
  hasCallKey: true,
@@ -194,7 +194,7 @@ function useCallTranscriber({
194
194
  });
195
195
  if (!role) return;
196
196
  persisted.current.add(segment.segmentId);
197
- chunk4E737GNX_cjs.persistTranscriptSegment(arbi, queryClient, callExtId, callKey, segment).catch(
197
+ chunkBLBXADTN_cjs.persistTranscriptSegment(arbi, queryClient, callExtId, callKey, segment).catch(
198
198
  (err) => {
199
199
  persisted.current.delete(segment.segmentId);
200
200
  if (role === "own" && err?.status === 403) {
@@ -203,7 +203,7 @@ function useCallTranscriber({
203
203
  console.warn("[calls] could not keep the transcript line", err);
204
204
  if (!saveFailureShown.current) {
205
205
  saveFailureShown.current = true;
206
- chunkVAMPYLQ4_cjs.notify.warning(
206
+ chunkDZUBZ45Y_cjs.notify.warning(
207
207
  `Transcript lines are not being saved to the meeting chat: ${err?.message ?? "unknown error"}`
208
208
  );
209
209
  }
@@ -214,7 +214,7 @@ function useCallTranscriber({
214
214
  );
215
215
  react.useEffect(() => {
216
216
  const onData = (payload, participant, _kind, topic, _encryption, participantIdentity) => {
217
- if (topic === chunk4E737GNX_cjs.CALL_TRANSCRIPTION_TOPIC) {
217
+ if (topic === chunkBLBXADTN_cjs.CALL_TRANSCRIPTION_TOPIC) {
218
218
  if (participant || participantIdentity) return;
219
219
  try {
220
220
  const next = browser.calls.transcriptionStateFrom(JSON.parse(new TextDecoder().decode(payload)));
@@ -223,10 +223,10 @@ function useCallTranscriber({
223
223
  }
224
224
  return;
225
225
  }
226
- if (topic !== chunk4E737GNX_cjs.CALL_CAPTION_TOPIC || !callKey) return;
226
+ if (topic !== chunkBLBXADTN_cjs.CALL_CAPTION_TOPIC || !callKey) return;
227
227
  const identity = participant?.identity ?? participantIdentity;
228
228
  if (!identity || identity === myIdentity) return;
229
- void chunk4E737GNX_cjs.decodeCaptionPacket(payload, callKey).then((packet) => {
229
+ void chunkBLBXADTN_cjs.decodeCaptionPacket(payload, callKey).then((packet) => {
230
230
  if (!packet || packet.identity !== identity) return;
231
231
  const name = participant?.name || packet.name || identity;
232
232
  const t = Math.min(packet.t, Date.now());
@@ -266,7 +266,7 @@ function useCallTranscriber({
266
266
  })) {
267
267
  return;
268
268
  }
269
- const segmentId = chunk4E737GNX_cjs.newSegmentId();
269
+ const segmentId = chunkBLBXADTN_cjs.newSegmentId();
270
270
  const startedAt = new Date(segment.startedAt).toISOString();
271
271
  let text;
272
272
  try {
@@ -300,7 +300,7 @@ function useCallTranscriber({
300
300
  });
301
301
  try {
302
302
  await localParticipant.publishData(
303
- await chunk4E737GNX_cjs.encodeCaptionPacket(
303
+ await chunkBLBXADTN_cjs.encodeCaptionPacket(
304
304
  {
305
305
  v: 1,
306
306
  segment_id: segmentId,
@@ -312,7 +312,7 @@ function useCallTranscriber({
312
312
  },
313
313
  callKey
314
314
  ),
315
- { reliable: true, topic: chunk4E737GNX_cjs.CALL_CAPTION_TOPIC }
315
+ { reliable: true, topic: chunkBLBXADTN_cjs.CALL_CAPTION_TOPIC }
316
316
  );
317
317
  } catch (err) {
318
318
  console.warn("[calls] could not broadcast a caption", err);
@@ -348,7 +348,7 @@ function useCallTranscriber({
348
348
  answer ?? (next ? { on: true, by_identity: myIdentity, by_name: localParticipant.name || null } : { on: false, by_identity: null, by_name: null })
349
349
  );
350
350
  } catch (err) {
351
- chunkVAMPYLQ4_cjs.notify.error(`Could not turn transcription ${next ? "on" : "off"}: ${err.message}`);
351
+ chunkDZUBZ45Y_cjs.notify.error(`Could not turn transcription ${next ? "on" : "off"}: ${err.message}`);
352
352
  } finally {
353
353
  setBusy(false);
354
354
  }
@@ -410,7 +410,7 @@ function useCallRecorder({
410
410
  const applyState = react.useCallback((next) => {
411
411
  liveUpdate.current = true;
412
412
  if (stateRef.current?.on && next && !next.on && next.reason === "storage_quota_exceeded") {
413
- chunkVAMPYLQ4_cjs.notify.warning("Recording stopped: the storage is full.");
413
+ chunkDZUBZ45Y_cjs.notify.warning("Recording stopped: the storage is full.");
414
414
  }
415
415
  stateRef.current = next;
416
416
  setState(next);
@@ -427,14 +427,14 @@ function useCallRecorder({
427
427
  };
428
428
  }, [callExtId]);
429
429
  react.useEffect(
430
- () => chunk4E737GNX_cjs.onCallEvent("call.recording", (message) => {
430
+ () => chunkBLBXADTN_cjs.onCallEvent("call.recording", (message) => {
431
431
  if (message.call_ext_id === callExtId) applyState(message);
432
432
  }),
433
433
  [callExtId, applyState]
434
434
  );
435
435
  react.useEffect(() => {
436
436
  const onData = (payload, participant, _kind, topic, _encryption, participantIdentity) => {
437
- if (topic !== chunk4E737GNX_cjs.CALL_RECORDING_TOPIC) return;
437
+ if (topic !== chunkBLBXADTN_cjs.CALL_RECORDING_TOPIC) return;
438
438
  if (participant || participantIdentity) return;
439
439
  try {
440
440
  const next = browser.calls.recordingStateFrom(JSON.parse(new TextDecoder().decode(payload)));
@@ -455,13 +455,13 @@ function useCallRecorder({
455
455
  try {
456
456
  const row = call ?? await arbi.calls.get(callExtId);
457
457
  if (!row.workspace_locked && !row.chat_ext_id && callKey) {
458
- const ref = await chunk4E737GNX_cjs.ensureMeetingChat(arbi, queryClient, callExtId, callKey);
458
+ const ref = await chunkBLBXADTN_cjs.ensureMeetingChat(arbi, queryClient, callExtId, callKey);
459
459
  if (ref.kind === "chat") setCall({ ...row, chat_ext_id: ref.chatExtId });
460
460
  }
461
461
  const answer = await arbi.calls.recording.start(callExtId, mode);
462
462
  if (answer) applyState(answer);
463
463
  } catch (err) {
464
- chunkVAMPYLQ4_cjs.notify.error(`Could not start recording: ${err.message}`);
464
+ chunkDZUBZ45Y_cjs.notify.error(`Could not start recording: ${err.message}`);
465
465
  } finally {
466
466
  setBusy(false);
467
467
  }
@@ -500,7 +500,7 @@ function useCallRecorder({
500
500
  const answer = await arbi.calls.recording.stop(callExtId);
501
501
  applyState(answer ?? { ...state, on: false });
502
502
  } catch (err) {
503
- chunkVAMPYLQ4_cjs.notify.error(`Could not stop recording: ${err.message}`);
503
+ chunkDZUBZ45Y_cjs.notify.error(`Could not stop recording: ${err.message}`);
504
504
  } finally {
505
505
  setBusy(false);
506
506
  }
@@ -557,7 +557,7 @@ function useTrackUploader(recording, callKey, kind, mimeType) {
557
557
  const queryClient = reactQuery.useQueryClient();
558
558
  return react.useMemo(() => {
559
559
  if (!shouldCapture || !recordingExtId || !call) return null;
560
- return chunk4E737GNX_cjs.trackUploaderFor({
560
+ return chunkBLBXADTN_cjs.trackUploaderFor({
561
561
  arbi,
562
562
  callExtId: call.external_id,
563
563
  recordingExtId,
@@ -565,7 +565,7 @@ function useTrackUploader(recording, callKey, kind, mimeType) {
565
565
  mimeType,
566
566
  recordingStartedAt: startedAt,
567
567
  linkVersion,
568
- conversationKey: () => chunk4E737GNX_cjs.conversationKeyForCall(arbi, queryClient, call, { callKey }),
568
+ conversationKey: () => chunkBLBXADTN_cjs.conversationKeyForCall(arbi, queryClient, call, { callKey }),
569
569
  // The server stopped the recording at the quota (its state event says so too).
570
570
  onStopped: () => markStopped()
571
571
  });
@@ -614,10 +614,10 @@ function useInCallChat({
614
614
  react.useEffect(() => {
615
615
  if (!callKey) return;
616
616
  const onData = (payload, participant, _kind, topic, _encryption, participantIdentity) => {
617
- if (topic !== chunk4E737GNX_cjs.CALL_CHAT_TOPIC) return;
617
+ if (topic !== chunkBLBXADTN_cjs.CALL_CHAT_TOPIC) return;
618
618
  const identity = participant?.identity ?? participantIdentity;
619
619
  if (!identity || identity === myIdentity) return;
620
- void chunk4E737GNX_cjs.decodeCallChatPacket(payload, callKey).then((packet) => {
620
+ void chunkBLBXADTN_cjs.decodeCallChatPacket(payload, callKey).then((packet) => {
621
621
  if (!packet) return;
622
622
  const key = `${identity}:${packet.id}`;
623
623
  if (seen.current.has(key)) return;
@@ -647,7 +647,7 @@ function useInCallChat({
647
647
  if (!open || !canRead || historyRequested.current) return;
648
648
  historyRequested.current = true;
649
649
  setHistoryLoading(true);
650
- chunk4E737GNX_cjs.loadMeetingHistory(arbi, queryClient, callExtId).then((result) => {
650
+ chunkBLBXADTN_cjs.loadMeetingHistory(arbi, queryClient, callExtId).then((result) => {
651
651
  if (!result) return;
652
652
  setMeetingChat(result.ref);
653
653
  setHistory(result.messages);
@@ -658,13 +658,13 @@ function useInCallChat({
658
658
  }, [open, canRead, callExtId]);
659
659
  const send = react.useCallback(
660
660
  async (raw) => {
661
- const text = raw.trim().slice(0, chunk4E737GNX_cjs.CALL_CHAT_MAX_CHARS);
661
+ const text = raw.trim().slice(0, chunkBLBXADTN_cjs.CALL_CHAT_MAX_CHARS);
662
662
  if (!text || !callKey || readOnly) return;
663
- const id = chunk4E737GNX_cjs.newPacketId();
663
+ const id = chunkBLBXADTN_cjs.newPacketId();
664
664
  const at = Date.now();
665
665
  await localParticipant.publishData(
666
- await chunk4E737GNX_cjs.encodeCallChatPacket({ v: 1, id, text, at }, callKey),
667
- { reliable: true, topic: chunk4E737GNX_cjs.CALL_CHAT_TOPIC }
666
+ await chunkBLBXADTN_cjs.encodeCallChatPacket({ v: 1, id, text, at }, callKey),
667
+ { reliable: true, topic: chunkBLBXADTN_cjs.CALL_CHAT_TOPIC }
668
668
  );
669
669
  setLive((prev) => [
670
670
  ...prev,
@@ -683,7 +683,7 @@ function useInCallChat({
683
683
  (prev) => prev.map((l) => l.id === id && l.senderIdentity === myIdentity ? { ...l, status } : l)
684
684
  );
685
685
  try {
686
- setMeetingChat(await chunk4E737GNX_cjs.persistMeetingMessage(arbi, queryClient, callExtId, callKey, text));
686
+ setMeetingChat(await chunkBLBXADTN_cjs.persistMeetingMessage(arbi, queryClient, callExtId, callKey, text));
687
687
  mark("saved");
688
688
  } catch (err) {
689
689
  console.warn("[calls] could not keep the message in the meeting chat", err);
@@ -695,15 +695,15 @@ function useInCallChat({
695
695
  const openMeeting = react.useCallback(async () => {
696
696
  if (!callKey) return;
697
697
  try {
698
- const ref = meetingChat ?? await chunk4E737GNX_cjs.ensureMeetingChat(arbi, queryClient, callExtId, callKey);
698
+ const ref = meetingChat ?? await chunkBLBXADTN_cjs.ensureMeetingChat(arbi, queryClient, callExtId, callKey);
699
699
  setMeetingChat(ref);
700
700
  openMeetingChat?.(ref);
701
701
  } catch (err) {
702
- chunkVAMPYLQ4_cjs.notify.error(`Could not open the meeting chat: ${err.message}`);
702
+ chunkDZUBZ45Y_cjs.notify.error(`Could not open the meeting chat: ${err.message}`);
703
703
  }
704
704
  }, [callExtId, callKey, meetingChat]);
705
705
  const lines = react.useMemo(
706
- () => chunk4E737GNX_cjs.mergeChatLines(history, live, {
706
+ () => chunkBLBXADTN_cjs.mergeChatLines(history, live, {
707
707
  myIdentity,
708
708
  nameOf: (identity) => identity === myIdentity ? localParticipant.name || "You" : room.remoteParticipants.get(identity)?.name || null
709
709
  }),
@@ -725,7 +725,7 @@ function useInCallChat({
725
725
  var DEMOTE_REJOIN_FALLBACK_MS = 5e3;
726
726
  function failed(what) {
727
727
  return (err) => {
728
- chunkVAMPYLQ4_cjs.notify.error(`Could not ${what}: ${err?.message ?? "unknown error"}`);
728
+ chunkDZUBZ45Y_cjs.notify.error(`Could not ${what}: ${err?.message ?? "unknown error"}`);
729
729
  throw err;
730
730
  };
731
731
  }
@@ -762,7 +762,7 @@ function useWebinar({
762
762
  const n = ++questionsRead.current;
763
763
  try {
764
764
  const rows = await webinarApi().questions.list(callExtId, linkVersion);
765
- const opened = await Promise.all(rows.map((q) => chunk4E737GNX_cjs.openQuestion(q, callKey)));
765
+ const opened = await Promise.all(rows.map((q) => chunkBLBXADTN_cjs.openQuestion(q, callKey)));
766
766
  if (n === questionsRead.current) setQuestions(opened);
767
767
  } catch (err) {
768
768
  console.warn("[calls] could not load the questions", err);
@@ -774,7 +774,7 @@ function useWebinar({
774
774
  }, [refresh, refreshQuestions]);
775
775
  react.useEffect(() => {
776
776
  if (!enabled) return;
777
- return chunk4E737GNX_cjs.onCallEvent("call.webinar", (m) => {
777
+ return chunkBLBXADTN_cjs.onCallEvent("call.webinar", (m) => {
778
778
  if (m.call_ext_id !== callExtId) return;
779
779
  setState((s) => s ? { ...s, live: m.live, chat: m.chat } : s);
780
780
  });
@@ -783,8 +783,8 @@ function useWebinar({
783
783
  react.useEffect(() => {
784
784
  if (!enabled) return;
785
785
  const onData = (payload, participant, _kind, topic, _encryption, participantIdentity) => {
786
- if (topic !== chunk4E737GNX_cjs.CALL_WEBINAR_TOPIC) return;
787
- const packet = chunk4E737GNX_cjs.parseWebinarPacket(payload, !!(participant || participantIdentity));
786
+ if (topic !== chunkBLBXADTN_cjs.CALL_WEBINAR_TOPIC) return;
787
+ const packet = chunkBLBXADTN_cjs.parseWebinarPacket(payload, !!(participant || participantIdentity));
788
788
  if (!packet) return;
789
789
  switch (packet.type) {
790
790
  case "state":
@@ -805,7 +805,7 @@ function useWebinar({
805
805
  return;
806
806
  case "demoted":
807
807
  setStageCheck(false);
808
- chunk4E737GNX_cjs.markRejoining(callExtId);
808
+ chunkBLBXADTN_cjs.markRejoining(callExtId);
809
809
  if (fallback.current) clearTimeout(fallback.current);
810
810
  fallback.current = setTimeout(() => void room.disconnect(), DEMOTE_REJOIN_FALLBACK_MS);
811
811
  return;
@@ -832,12 +832,12 @@ function useWebinar({
832
832
  [callExtId, linkVersion]
833
833
  );
834
834
  const stepDown = react.useCallback(async () => {
835
- chunk4E737GNX_cjs.markRejoining(callExtId);
835
+ chunkBLBXADTN_cjs.markRejoining(callExtId);
836
836
  setStageCheck(false);
837
837
  try {
838
838
  await webinarApi().demote(callExtId, myIdentity, linkVersion);
839
839
  } catch (err) {
840
- chunk4E737GNX_cjs.markRejoining(callExtId, false);
840
+ chunkBLBXADTN_cjs.markRejoining(callExtId, false);
841
841
  failed("leave the stage")(err);
842
842
  }
843
843
  }, [callExtId, myIdentity, linkVersion]);
@@ -897,7 +897,7 @@ function useWebinar({
897
897
  if (!callKey) throw new Error("This call has no key.");
898
898
  await webinarApi().questions.ask(
899
899
  callExtId,
900
- await chunk4E737GNX_cjs.sealQuestionText(text, callKey),
900
+ await chunkBLBXADTN_cjs.sealQuestionText(text, callKey),
901
901
  linkVersion
902
902
  );
903
903
  }, "ask the question"),
@@ -911,7 +911,7 @@ function useWebinar({
911
911
  await webinarApi().questions.update(
912
912
  callExtId,
913
913
  id,
914
- { answer: await chunk4E737GNX_cjs.sealQuestionText(text, callKey) },
914
+ { answer: await chunkBLBXADTN_cjs.sealQuestionText(text, callKey) },
915
915
  linkVersion
916
916
  );
917
917
  }, "answer the question"),
@@ -941,15 +941,15 @@ function useWebinar({
941
941
  function useHostMuteNotice(callExtId) {
942
942
  const room = componentsReact.useRoomContext();
943
943
  react.useEffect(() => {
944
- const notifyMuted = chunk4E737GNX_cjs.createMutedNotifier((text) => chunkVAMPYLQ4_cjs.notify.info(text));
944
+ const notifyMuted = chunkBLBXADTN_cjs.createMutedNotifier((text) => chunkDZUBZ45Y_cjs.notify.info(text));
945
945
  const onData = (payload, participant, _kind, topic, _encryption, participantIdentity) => {
946
- if (topic !== chunk4E737GNX_cjs.CALL_MODERATION_TOPIC) return;
946
+ if (topic !== chunkBLBXADTN_cjs.CALL_MODERATION_TOPIC) return;
947
947
  if (participant || participantIdentity) return;
948
- const notice = chunk4E737GNX_cjs.mutedNoticeFromPacket(payload);
948
+ const notice = chunkBLBXADTN_cjs.mutedNoticeFromPacket(payload);
949
949
  if (notice) notifyMuted(notice);
950
950
  };
951
951
  room.on(livekitClient.RoomEvent.DataReceived, onData);
952
- const offWs = chunk4E737GNX_cjs.onCallEvent("call.muted", (message) => {
952
+ const offWs = chunkBLBXADTN_cjs.onCallEvent("call.muted", (message) => {
953
953
  if (message.callExtId === callExtId) notifyMuted(message);
954
954
  });
955
955
  return () => {
@@ -1,15 +1,15 @@
1
- import { toProfileView, useCallTranscriptionAvailable, onCallEvent, transcriptPersistRole, persistTranscriptSegment, newSegmentId, encodeCaptionPacket, CALL_CAPTION_TOPIC, ensureMeetingChat, trackUploaderFor, conversationKeyForCall, loadMeetingHistory, CALL_CHAT_MAX_CHARS, newPacketId, encodeCallChatPacket, CALL_CHAT_TOPIC, persistMeetingMessage, mergeChatLines, openQuestion, markRejoining, sealQuestionText, createMutedNotifier, CALL_RECORDING_TOPIC, CALL_TRANSCRIPTION_TOPIC, decodeCaptionPacket, CALL_MODERATION_TOPIC, mutedNoticeFromPacket, decodeCallChatPacket, CALL_WEBINAR_TOPIC, parseWebinarPacket } from '../../chunk-KRH55LXW.js';
2
- import '../../chunk-OSWKXZTJ.js';
3
- import '../../chunk-U64WCQP3.js';
4
- import { notify } from '../../chunk-5HDC43MF.js';
1
+ import { toProfileView, useCallTranscriptionAvailable, onCallEvent, transcriptPersistRole, persistTranscriptSegment, newSegmentId, encodeCaptionPacket, CALL_CAPTION_TOPIC, ensureMeetingChat, trackUploaderFor, conversationKeyForCall, loadMeetingHistory, CALL_CHAT_MAX_CHARS, newPacketId, encodeCallChatPacket, CALL_CHAT_TOPIC, persistMeetingMessage, mergeChatLines, openQuestion, markRejoining, sealQuestionText, createMutedNotifier, CALL_RECORDING_TOPIC, CALL_TRANSCRIPTION_TOPIC, decodeCaptionPacket, CALL_MODERATION_TOPIC, mutedNoticeFromPacket, decodeCallChatPacket, CALL_WEBINAR_TOPIC, parseWebinarPacket } from '../../chunk-NCMSQACC.js';
2
+ import '../../chunk-ER4LFZG3.js';
3
+ import '../../chunk-AOEJ744V.js';
4
+ import { useArbi, useArbiHost } from '../../chunk-R7YNABZY.js';
5
+ import { notify } from '../../chunk-G4Z3IP4J.js';
5
6
  import '../../chunk-DPYBZDJB.js';
6
7
  import '../../chunk-NNWMHMEC.js';
7
8
  import '../../chunk-WUTL62MC.js';
8
9
  import '../../chunk-APZZQZ6P.js';
9
10
  import '../../chunk-QRCMKEE6.js';
10
- import '../../chunk-SN5YV6FF.js';
11
- import { useArbi, useArbiHost } from '../../chunk-R7YNABZY.js';
12
11
  import '../../chunk-CPZ36AQS.js';
12
+ import '../../chunk-SN5YV6FF.js';
13
13
  import { useState, useEffect, useRef, useCallback, useMemo } from 'react';
14
14
  import { RoomEvent, ExternalE2EEKeyProvider, Room } from 'livekit-client';
15
15
  import { useRoomContext, useLocalParticipant, useLocalParticipantPermissions } from '@livekit/components-react';
@@ -1,9 +1,10 @@
1
- import { arbiMutationKeys, arbiQueryKeys } from './chunk-U64WCQP3.js';
1
+ import { arbiMutationKeys, arbiQueryKeys } from './chunk-AOEJ744V.js';
2
2
  import { useArbi } from './chunk-R7YNABZY.js';
3
3
  import { create } from 'zustand';
4
- import { useCallback, useSyncExternalStore } from 'react';
4
+ import { useRef, useCallback, useSyncExternalStore } from 'react';
5
5
  import { useQueryClient, useMutation, useQuery } from '@tanstack/react-query';
6
- import { tags } from '@arbidocs/sdk/browser';
6
+ import { ArbiWorkspaceUnavailableError, tags } from '@arbidocs/sdk/browser';
7
+ import { isAbortError } from '@arbidocs/client';
7
8
 
8
9
  // src/documents/documents-cache.ts
9
10
  var rowListeners = /* @__PURE__ */ new Set();
@@ -122,6 +123,62 @@ function finishEntityExtraction(docIds) {
122
123
  function useEntityExtractionDocIds() {
123
124
  return useEntityExtractionStore((state) => state.docIds);
124
125
  }
126
+ var QUEUED_WRITE_BLOCKED_MESSAGE = "This change belongs to a workspace that can't be opened right now, so it was not sent. It is kept here until it can be.";
127
+ function primeOnClient(client) {
128
+ return (workspaceId) => workspaceId === client.session.getState().selectedWorkspaceId ? void 0 : client.workspaceKeys.prime(workspaceId);
129
+ }
130
+ function primeOnArbi(arbi) {
131
+ return (workspaceId) => arbi.hasWorkspace && workspaceId === arbi.getWorkspaceId() ? void 0 : arbi.workspaces.open(workspaceId);
132
+ }
133
+ async function inWorkspace(prime, workspaceId, write) {
134
+ if (workspaceId) {
135
+ try {
136
+ await prime(workspaceId);
137
+ } catch (error) {
138
+ if (isAbortError(error)) throw error;
139
+ throw new ArbiWorkspaceUnavailableError(workspaceId, error, QUEUED_WRITE_BLOCKED_MESSAGE);
140
+ }
141
+ }
142
+ return write();
143
+ }
144
+ function isWorkspaceUnavailable(error) {
145
+ return error instanceof ArbiWorkspaceUnavailableError;
146
+ }
147
+ var QUEUED_WRITE_RETRY = {
148
+ retry: (failureCount, error) => isWorkspaceUnavailable(error) && failureCount < 8,
149
+ retryDelay: (attempt) => Math.min(1e3 * 2 ** attempt, 3e4)
150
+ };
151
+ function isBlockedOnWorkspace(mutation) {
152
+ return isWorkspaceUnavailable(mutation.state.error ?? mutation.state.failureReason);
153
+ }
154
+ function useCapturingWorkspace(mutation, capture) {
155
+ const captureRef = useRef(capture);
156
+ captureRef.current = capture;
157
+ const { mutate: rawMutate, mutateAsync: rawMutateAsync } = mutation;
158
+ const mutate = useCallback(
159
+ (variables, ...rest) => rawMutate(captureRef.current(variables), ...rest),
160
+ [rawMutate]
161
+ );
162
+ const mutateAsync = useCallback(
163
+ (variables, ...rest) => rawMutateAsync(
164
+ captureRef.current(variables),
165
+ ...rest
166
+ ),
167
+ [rawMutateAsync]
168
+ );
169
+ return { ...mutation, mutate, mutateAsync };
170
+ }
171
+
172
+ // src/tags.ts
173
+ function workspaceOfTag(qc, tagId) {
174
+ for (const [key, tags] of qc.getQueriesData({
175
+ queryKey: arbiQueryKeys.allTags()
176
+ })) {
177
+ if (Array.isArray(tags) && tags.some((t) => t.external_id === tagId))
178
+ return key[2] ?? null;
179
+ }
180
+ return null;
181
+ }
125
182
  function openWorkspaceId(arbi) {
126
183
  return arbi.hasWorkspace ? arbi.getWorkspaceId() : null;
127
184
  }
@@ -170,18 +227,24 @@ function settleChangedTag(qc, tag) {
170
227
  var replayableTagMutations = [
171
228
  {
172
229
  mutationKey: arbiMutationKeys.createTag(),
173
- run: (client, input) => tags.createTag(client, input),
230
+ // In the workspace it was made in (named on the request), opened for this session first.
231
+ run: (client, input) => inWorkspace(primeOnClient(client), input.workspaceId, () => tags.createTag(client, input)),
174
232
  settle: (qc, created) => settleCreatedTag(qc, created)
175
233
  }
176
234
  ];
177
235
  function useCreateTag() {
178
236
  const arbi = useArbi();
179
237
  const qc = useQueryClient();
180
- return useMutation({
181
- mutationKey: arbiMutationKeys.createTag(),
182
- mutationFn: (input) => arbi.tags.create(input),
183
- onSuccess: (created) => settleCreatedTag(qc, created)
184
- });
238
+ const capture = (input) => input.workspaceId || !arbi.hasWorkspace ? input : { ...input, workspaceId: arbi.getWorkspaceId() };
239
+ return useCapturingWorkspace(
240
+ useMutation({
241
+ mutationKey: arbiMutationKeys.createTag(),
242
+ mutationFn: (input) => inWorkspace(primeOnArbi(arbi), input.workspaceId, () => arbi.tags.create(input)),
243
+ onSuccess: (created) => settleCreatedTag(qc, created),
244
+ ...QUEUED_WRITE_RETRY
245
+ }),
246
+ capture
247
+ );
185
248
  }
186
249
  function useIsCreatingTag() {
187
250
  const qc = useQueryClient();
@@ -223,9 +286,12 @@ function useDeleteTag() {
223
286
  return useMutation({
224
287
  mutationKey: arbiMutationKeys.deleteTag(),
225
288
  mutationFn: (tagId) => arbi.tags.delete(tagId),
226
- onSuccess: (_data, tagId) => {
289
+ // The tag's own workspace (the cached list holding it), else the one open when it is sent: a
290
+ // switch while the delete runs must not patch the next workspace's list.
291
+ onMutate: (tagId) => ({ workspaceId: workspaceOfTag(qc, tagId) ?? openWorkspaceId(arbi) }),
292
+ onSuccess: (_data, tagId, context) => {
227
293
  dropTagFromCachedDocuments(qc, tagId);
228
- const workspaceId = openWorkspaceId(arbi);
294
+ const workspaceId = context?.workspaceId;
229
295
  if (!workspaceId) return;
230
296
  patchWorkspaceTags(
231
297
  qc,
@@ -265,8 +331,11 @@ function useUpdateTagKindSchema() {
265
331
  kind,
266
332
  fields
267
333
  }) => arbi.tagKinds.update(kind, fields),
268
- onSuccess: (schema) => {
269
- const workspaceId = openWorkspaceId(arbi);
334
+ // The workspace open when it is sent (the server writes the open workspace's schema until
335
+ // the request can name it): a switch meanwhile must not rewrite the next workspace's columns.
336
+ onMutate: () => ({ workspaceId: openWorkspaceId(arbi) }),
337
+ onSuccess: (schema, _input, context) => {
338
+ const workspaceId = context?.workspaceId;
270
339
  if (!workspaceId) return;
271
340
  qc.setQueryData(arbiQueryKeys.tagKind(workspaceId, schema.kind), schema);
272
341
  return invalidateTagData(qc, workspaceId);
@@ -579,6 +648,6 @@ function adjustTagCounts(qc, workspaceId, delta) {
579
648
  void invalidateTagTables(qc, workspaceId);
580
649
  }
581
650
 
582
- export { DISMISSED_TASK_TTL_MS, DOCUMENTS_FIRST_PAGE_MEASURE, DOCUMENTS_FIRST_PAGE_SIZE, DOCUMENTS_PAGE_SIZE, FINISHED_DOCUMENT_STATUSES, IN_FLIGHT_DOCUMENT_STATUSES, SIMILARITY_THRESHOLD, adjustTagCounts, dropTagFromCachedDocuments, finishEntityExtraction, forgetDocuments, getCachedDocuments, invalidateTagData, invalidateTagTables, isDocumentsLoading, isRowNewer, isStaleTaskUpdate, patchCachedDocument, patchDocuments, patchWorkspaceTags, refreshDocuments, replayableTagMutations, resolveDocumentStatus, setCachedDocument, settledByRows, startEntityExtraction, stopDocumentsLoading, subscribeDocumentRows, upsertDocuments, useArbiWsStore, useCreateTag, useDeleteTag, useDocument, useDocuments, useDocumentsById, useDocumentsLoading, useEntityExtractionDocIds, useExtractEntities, useInvalidateTagData, useIsCreatingTag, useRefreshDocuments, useSetTagValues, useSimilarDocuments, useTagKindSchema, useUpdateTag, useUpdateTagKindSchema };
583
- //# sourceMappingURL=chunk-S2W3ZOWG.js.map
584
- //# sourceMappingURL=chunk-S2W3ZOWG.js.map
651
+ export { DISMISSED_TASK_TTL_MS, DOCUMENTS_FIRST_PAGE_MEASURE, DOCUMENTS_FIRST_PAGE_SIZE, DOCUMENTS_PAGE_SIZE, FINISHED_DOCUMENT_STATUSES, IN_FLIGHT_DOCUMENT_STATUSES, QUEUED_WRITE_BLOCKED_MESSAGE, QUEUED_WRITE_RETRY, SIMILARITY_THRESHOLD, adjustTagCounts, dropTagFromCachedDocuments, finishEntityExtraction, forgetDocuments, getCachedDocuments, inWorkspace, invalidateTagData, invalidateTagTables, isBlockedOnWorkspace, isDocumentsLoading, isRowNewer, isStaleTaskUpdate, isWorkspaceUnavailable, patchCachedDocument, patchDocuments, patchWorkspaceTags, primeOnArbi, primeOnClient, refreshDocuments, replayableTagMutations, resolveDocumentStatus, setCachedDocument, settledByRows, startEntityExtraction, stopDocumentsLoading, subscribeDocumentRows, upsertDocuments, useArbiWsStore, useCapturingWorkspace, useCreateTag, useDeleteTag, useDocument, useDocuments, useDocumentsById, useDocumentsLoading, useEntityExtractionDocIds, useExtractEntities, useInvalidateTagData, useIsCreatingTag, useRefreshDocuments, useSetTagValues, useSimilarDocuments, useTagKindSchema, useUpdateTag, useUpdateTagKindSchema };
652
+ //# sourceMappingURL=chunk-2LV53J46.js.map
653
+ //# sourceMappingURL=chunk-2LV53J46.js.map