@superinterface/react 5.3.0-beta.2 → 5.3.0-beta.20

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.js CHANGED
@@ -354,7 +354,7 @@ var require_lib = __commonJS({
354
354
  Object.defineProperty(exports, "__esModule", {
355
355
  value: true
356
356
  });
357
- function _objectWithoutPropertiesLoose10(r, e) {
357
+ function _objectWithoutPropertiesLoose12(r, e) {
358
358
  if (null == r) return {};
359
359
  var t = {};
360
360
  for(var n in r)if (({}).hasOwnProperty.call(r, n)) {
@@ -721,7 +721,7 @@ var require_lib = __commonJS({
721
721
  PrimaryTopicNotAllowed: "Topic reference was used in a lexical context without topic binding.",
722
722
  PrimaryTopicRequiresSmartPipeline: 'Topic reference is used, but the pipelineOperator plugin was not passed a "proposal": "hack" or "smart" option.'
723
723
  });
724
- var _excluded10 = [
724
+ var _excluded12 = [
725
725
  "message"
726
726
  ];
727
727
  function defineHidden(obj, key2, value) {
@@ -796,7 +796,7 @@ var require_lib = __commonJS({
796
796
  }
797
797
  } : typeof template === "function" ? {
798
798
  message: template
799
- } : template, message = _ref.message, rest = _objectWithoutPropertiesLoose10(_ref, _excluded10);
799
+ } : template, message = _ref.message, rest = _objectWithoutPropertiesLoose12(_ref, _excluded12);
800
800
  var toMessage = typeof message === "string" ? function() {
801
801
  return message;
802
802
  } : message;
@@ -46888,7 +46888,7 @@ var useAudioThreadContext = function() {
46888
46888
  import { c as _c90 } from "react-compiler-runtime";
46889
46889
  // src/hooks/audioRuntimes/useTtsAudioRuntime/index.ts
46890
46890
  import { c as _c89 } from "react-compiler-runtime";
46891
- import { useMemo as useMemo18 } from "react";
46891
+ import { useMemo as useMemo19 } from "react";
46892
46892
  // src/hooks/misc/usePermission/index.ts
46893
46893
  import { c as _c86 } from "react-compiler-runtime";
46894
46894
  import { useEffect as useEffect7, useState as useState7 } from "react";
@@ -47220,10 +47220,7 @@ var useRecorder = function(_ref) {
47220
47220
  };
47221
47221
  // src/hooks/audioThreads/useMessageAudio/index.ts
47222
47222
  import { c as _c88 } from "react-compiler-runtime";
47223
- import { useMemo as useMemo17, useRef as useRef8, useState as useState9, useEffect as useEffect10, useCallback as useCallback7 } from "react";
47224
- import nlp from "compromise";
47225
- import { Howler } from "howler";
47226
- import { useAudioPlayer as useAudioPlayer2 } from "react-use-audio-player";
47223
+ import { useCallback as useCallback8, useEffect as useEffect11, useMemo as useMemo18, useRef as useRef9, useState as useState10 } from "react";
47227
47224
  // src/hooks/audioThreads/useMessageAudio/lib/input.ts
47228
47225
  import { isEmpty as isEmpty2 } from "radash";
47229
47226
  var input = function(_ref) {
@@ -47237,6 +47234,10 @@ var input = function(_ref) {
47237
47234
  if (isEmpty2(result)) return null;
47238
47235
  return result;
47239
47236
  };
47237
+ // src/hooks/audioThreads/useMessageAudio/lib/useDefaultPlay.ts
47238
+ import { useCallback as useCallback7, useEffect as useEffect10, useMemo as useMemo17, useRef as useRef8, useState as useState9 } from "react";
47239
+ import { Howler } from "howler";
47240
+ import { useAudioPlayer as useAudioPlayer2 } from "react-use-audio-player";
47240
47241
  // src/hooks/audioThreads/useMessageAudio/lib/isHtmlAudioSupported.ts
47241
47242
  import { detect } from "detect-browser";
47242
47243
  var _detect;
@@ -47245,7 +47246,7 @@ var unsupportedNames = [
47245
47246
  "ios"
47246
47247
  ];
47247
47248
  var isHtmlAudioSupported = !unsupportedNames.includes(((_detect = detect()) === null || _detect === void 0 ? void 0 : _detect.name) || "");
47248
- // src/hooks/audioThreads/useMessageAudio/index.ts
47249
+ // src/hooks/audioThreads/useMessageAudio/lib/useDefaultPlay.ts
47249
47250
  function ownKeys47(e, r) {
47250
47251
  var t = Object.keys(e);
47251
47252
  if (Object.getOwnPropertySymbols) {
@@ -47289,14 +47290,516 @@ function _toPrimitive47(t, r) {
47289
47290
  }
47290
47291
  return ("string" === r ? String : Number)(t);
47291
47292
  }
47292
- var segment = function(input2) {
47293
- return nlp(input2).sentences().json().map(function(s) {
47294
- return s.text;
47295
- });
47293
+ var MAX_SEG_CACHE = 256;
47294
+ var KEEP_FINISHED_MESSAGES = 12;
47295
+ var hasLetters = function(input2) {
47296
+ for(var i = 0; i < input2.length; i++){
47297
+ var ch = input2.charAt(i);
47298
+ if (ch.toLowerCase() !== ch.toUpperCase()) return true;
47299
+ }
47300
+ return false;
47301
+ };
47302
+ var isSentencePunct = function(ch) {
47303
+ return ch === "." || ch === "!" || ch === "?" || ch === "\u3002" || ch === "\uFF01" || ch === "\uFF1F";
47304
+ };
47305
+ var normalizeBoundaries = function(text) {
47306
+ var out = "";
47307
+ for(var i = 0; i < text.length; i++){
47308
+ var ch = text.charAt(i);
47309
+ out += ch;
47310
+ if (isSentencePunct(ch)) {
47311
+ var next = text.charAt(i + 1);
47312
+ if (next && next !== " " && hasLetters(next)) {
47313
+ out += " ";
47314
+ }
47315
+ }
47316
+ }
47317
+ return out;
47318
+ };
47319
+ var splitSentencesFast = function(raw) {
47320
+ var normalized = normalizeBoundaries(raw.replace(/\s+/g, " ").trim());
47321
+ if (!normalized) return [];
47322
+ var parts = normalized.split(RegExp("(?<=[.!?])\\s+(?=[^\\s])", "g"));
47323
+ var filtered = [];
47324
+ for(var i = 0; i < parts.length; i++){
47325
+ var part = parts[i].trim();
47326
+ if (part && hasLetters(part)) filtered.push(part);
47327
+ }
47328
+ return filtered;
47329
+ };
47330
+ var getIncrementalSentences = function(prev, nextInput, now) {
47331
+ if (!prev) {
47332
+ return {
47333
+ input: nextInput,
47334
+ sentences: splitSentencesFast(nextInput),
47335
+ touched: now
47336
+ };
47337
+ }
47338
+ if (nextInput === prev.input) {
47339
+ return {
47340
+ input: prev.input,
47341
+ sentences: prev.sentences,
47342
+ touched: now
47343
+ };
47344
+ }
47345
+ if (nextInput.startsWith(prev.input)) {
47346
+ var prevSentences = prev.sentences;
47347
+ var prevLast = prevSentences[prevSentences.length - 1] || "";
47348
+ var baseLen = prev.input.length - prevLast.length;
47349
+ if (baseLen >= 0 && prev.input.slice(baseLen) === prevLast) {
47350
+ var tail = nextInput.slice(baseLen);
47351
+ var tailSegments = splitSentencesFast(tail);
47352
+ var merged = prevSentences.length > 0 ? prevSentences.slice(0, -1).concat(tailSegments) : tailSegments;
47353
+ return {
47354
+ input: nextInput,
47355
+ sentences: merged,
47356
+ touched: now
47357
+ };
47358
+ }
47359
+ }
47360
+ return {
47361
+ input: nextInput,
47362
+ sentences: splitSentencesFast(nextInput),
47363
+ touched: now
47364
+ };
47365
+ };
47366
+ var getPerformanceNow = function() {
47367
+ return typeof performance !== "undefined" && typeof performance.now === "function" ? performance.now() : Date.now();
47368
+ };
47369
+ var useDefaultPlay = function(_ref) {
47370
+ var enabled = _ref.enabled, fullSentenceRegex = _ref.fullSentenceRegex, onEnd = _ref.onEnd, superinterfaceContext = _ref.superinterfaceContext, isAudioPlayed = _ref.isAudioPlayed;
47371
+ var audioPlayer = useAudioPlayer2();
47372
+ var nextAudioPlayer = useAudioPlayer2();
47373
+ var _useState9 = _sliced_to_array(useState9(false), 2), isPlaying = _useState9[0], setIsPlaying = _useState9[1];
47374
+ var _useState91 = _sliced_to_array(useState9([]), 2), audioQueue = _useState91[0], setAudioQueue = _useState91[1];
47375
+ var audioQueueRef = useRef8(audioQueue);
47376
+ useEffect10(function() {
47377
+ audioQueueRef.current = audioQueue;
47378
+ }, [
47379
+ audioQueue
47380
+ ]);
47381
+ var messageStatesRef = useRef8(/* @__PURE__ */ new Map());
47382
+ var segCacheRef = useRef8(/* @__PURE__ */ new Map());
47383
+ var chunkQueuesRef = useRef8(/* @__PURE__ */ new Map());
47384
+ var messageOrderRef = useRef8(/* @__PURE__ */ new Map());
47385
+ var pickLockRef = useRef8(false);
47386
+ var currentSentenceRef = useRef8(null);
47387
+ var currentChunkRef = useRef8(null);
47388
+ var evictSegCache = useCallback7(function() {
47389
+ var segCache = segCacheRef.current;
47390
+ if (segCache.size <= MAX_SEG_CACHE) return;
47391
+ var entries = Array.from(segCache.entries());
47392
+ entries.sort(function(a, b) {
47393
+ return a[1].touched - b[1].touched;
47394
+ });
47395
+ var toRemove = segCache.size - MAX_SEG_CACHE;
47396
+ for(var i = 0; i < toRemove; i++)segCache.delete(entries[i][0]);
47397
+ }, []);
47398
+ var getOrder = useCallback7(function(state) {
47399
+ var explicit = messageOrderRef.current.get(state.id);
47400
+ if (explicit != null) return explicit;
47401
+ return state.order;
47402
+ }, []);
47403
+ var rebuildQueue = useCallback7(function() {
47404
+ if (!enabled) return;
47405
+ var states = Array.from(messageStatesRef.current.values());
47406
+ states.sort(function(a_0, b_0) {
47407
+ return getOrder(a_0) - getOrder(b_0);
47408
+ });
47409
+ var unfinished = [];
47410
+ var finished = [];
47411
+ for(var i_0 = 0; i_0 < states.length; i_0++){
47412
+ var state_0 = states[i_0];
47413
+ if (!state_0.stopped && (state_0.status === "in_progress" || state_0.nextIndex < state_0.sentences.length)) {
47414
+ unfinished.push(state_0);
47415
+ } else {
47416
+ finished.push(state_0);
47417
+ }
47418
+ }
47419
+ if (finished.length > KEEP_FINISHED_MESSAGES) {
47420
+ var toTrim = finished.length - KEEP_FINISHED_MESSAGES;
47421
+ for(var i_1 = 0; i_1 < toTrim; i_1++){
47422
+ var removed = finished.shift();
47423
+ if (!removed) break;
47424
+ messageStatesRef.current.delete(removed.id);
47425
+ segCacheRef.current.delete(removed.id);
47426
+ chunkQueuesRef.current.delete(removed.id);
47427
+ }
47428
+ }
47429
+ var combined = _to_consumable_array(unfinished).concat(_to_consumable_array(finished));
47430
+ audioQueueRef.current = combined;
47431
+ setAudioQueue(function(prev) {
47432
+ if (prev.length === combined.length) {
47433
+ var identical = true;
47434
+ for(var i_2 = 0; i_2 < prev.length; i_2++){
47435
+ if (prev[i_2] !== combined[i_2]) {
47436
+ identical = false;
47437
+ break;
47438
+ }
47439
+ }
47440
+ if (identical) return prev;
47441
+ }
47442
+ return combined;
47443
+ });
47444
+ }, [
47445
+ enabled,
47446
+ getOrder
47447
+ ]);
47448
+ var checkForCompletion = useCallback7(function() {
47449
+ if (!enabled) return;
47450
+ var hasPending = Array.from(messageStatesRef.current.values()).some(function(state_1) {
47451
+ if (state_1.stopped) return false;
47452
+ var hasMore = state_1.nextIndex < state_1.sentences.length;
47453
+ var streaming = state_1.status === "in_progress";
47454
+ return hasMore || streaming;
47455
+ });
47456
+ if (!hasPending) onEnd();
47457
+ }, [
47458
+ enabled,
47459
+ onEnd
47460
+ ]);
47461
+ var finishChunk = useCallback7(function(messageId, reason) {
47462
+ if (!enabled) return;
47463
+ var queues = chunkQueuesRef.current;
47464
+ var queue = queues.get(messageId);
47465
+ if (!queue || queue.length === 0) return;
47466
+ var chunk = queue[0];
47467
+ if (reason === "stop") {
47468
+ if (!chunk.stopped) {
47469
+ chunk.stopped = true;
47470
+ chunk.onStop();
47471
+ }
47472
+ queue.shift();
47473
+ if (queue.length === 0) queues.delete(messageId);
47474
+ return;
47475
+ }
47476
+ chunk.remaining -= 1;
47477
+ if (chunk.remaining <= 0) {
47478
+ chunk.onEnd();
47479
+ queue.shift();
47480
+ if (queue.length === 0) queues.delete(messageId);
47481
+ }
47482
+ }, [
47483
+ enabled
47484
+ ]);
47485
+ var startNextSegment = useCallback7(function() {
47486
+ if (!enabled) return;
47487
+ if (isPlaying) return;
47488
+ if (audioPlayer.playing) return;
47489
+ if (pickLockRef.current) return;
47490
+ var queueSnapshot = audioQueueRef.current.slice();
47491
+ queueSnapshot.sort(function(a_1, b_1) {
47492
+ return getOrder(a_1) - getOrder(b_1);
47493
+ });
47494
+ var candidate = null;
47495
+ for(var i_3 = 0; i_3 < queueSnapshot.length; i_3++){
47496
+ var state_2 = queueSnapshot[i_3];
47497
+ if (state_2.stopped) continue;
47498
+ var sentence = state_2.sentences[state_2.nextIndex];
47499
+ if (!sentence) continue;
47500
+ var isFull = isOptimistic({
47501
+ id: state_2.id
47502
+ }) || state_2.status !== "in_progress" || fullSentenceRegex.test(sentence);
47503
+ if (!isFull) continue;
47504
+ candidate = {
47505
+ messageId: state_2.id,
47506
+ sentence: sentence,
47507
+ index: state_2.nextIndex,
47508
+ status: state_2.status
47509
+ };
47510
+ break;
47511
+ }
47512
+ if (!candidate) return;
47513
+ pickLockRef.current = true;
47514
+ setIsPlaying(true);
47515
+ currentSentenceRef.current = {
47516
+ messageId: candidate.messageId,
47517
+ index: candidate.index
47518
+ };
47519
+ var state_3 = messageStatesRef.current.get(candidate.messageId);
47520
+ if (!state_3) {
47521
+ pickLockRef.current = false;
47522
+ setIsPlaying(false);
47523
+ currentSentenceRef.current = null;
47524
+ return;
47525
+ }
47526
+ state_3.nextIndex = candidate.index + 1;
47527
+ rebuildQueue();
47528
+ var chunkQueue = chunkQueuesRef.current.get(candidate.messageId);
47529
+ var activeChunk = chunkQueue && chunkQueue.length > 0 ? chunkQueue[0] : null;
47530
+ currentChunkRef.current = activeChunk;
47531
+ var searchParams = new URLSearchParams(_objectSpread47({
47532
+ input: candidate.sentence
47533
+ }, superinterfaceContext.variables));
47534
+ audioPlayer.load("".concat(superinterfaceContext.baseUrl, "/audio-runtimes/tts?").concat(searchParams), {
47535
+ format: "mp3",
47536
+ autoplay: isAudioPlayed,
47537
+ html5: isHtmlAudioSupported,
47538
+ onplay: function() {
47539
+ if (activeChunk && !activeChunk.started) {
47540
+ activeChunk.started = true;
47541
+ activeChunk.onPlay();
47542
+ }
47543
+ },
47544
+ onstop: function() {
47545
+ var stateToUpdate = messageStatesRef.current.get(candidate.messageId);
47546
+ if (stateToUpdate) {
47547
+ stateToUpdate.stopped = true;
47548
+ }
47549
+ finishChunk(candidate.messageId, "stop");
47550
+ setIsPlaying(false);
47551
+ currentSentenceRef.current = null;
47552
+ currentChunkRef.current = null;
47553
+ pickLockRef.current = false;
47554
+ rebuildQueue();
47555
+ checkForCompletion();
47556
+ },
47557
+ onload: function() {
47558
+ var current = currentSentenceRef.current;
47559
+ if (!current) return;
47560
+ var owner = messageStatesRef.current.get(current.messageId);
47561
+ if (!owner) return;
47562
+ var nextSentence = owner.sentences[owner.nextIndex];
47563
+ if (!nextSentence) return;
47564
+ var allowQueued = owner.status !== "in_progress" || isOptimistic({
47565
+ id: owner.id
47566
+ }) || fullSentenceRegex.test(nextSentence);
47567
+ if (!allowQueued) return;
47568
+ var nextSearchParams = new URLSearchParams(_objectSpread47({
47569
+ input: nextSentence
47570
+ }, superinterfaceContext.variables));
47571
+ nextAudioPlayer.load("".concat(superinterfaceContext.baseUrl, "/audio-runtimes/tts?").concat(nextSearchParams), {
47572
+ format: "mp3",
47573
+ autoplay: false,
47574
+ html5: isHtmlAudioSupported
47575
+ });
47576
+ },
47577
+ onend: function() {
47578
+ finishChunk(candidate.messageId, "end");
47579
+ setIsPlaying(false);
47580
+ currentSentenceRef.current = null;
47581
+ currentChunkRef.current = null;
47582
+ pickLockRef.current = false;
47583
+ rebuildQueue();
47584
+ checkForCompletion();
47585
+ startNextSegment();
47586
+ }
47587
+ });
47588
+ }, [
47589
+ enabled,
47590
+ isPlaying,
47591
+ audioPlayer,
47592
+ fullSentenceRegex,
47593
+ superinterfaceContext,
47594
+ isAudioPlayed,
47595
+ rebuildQueue,
47596
+ finishChunk,
47597
+ checkForCompletion,
47598
+ getOrder
47599
+ ]);
47600
+ var play = useCallback7(function(_ref2) {
47601
+ var _existing$playableCou, _ref3, _existing$fallbackOrd, _ref4, _messageOrderRef$curr, _existing$stopped, _ref5;
47602
+ var input2 = _ref2.input, message = _ref2.message, onPlay = _ref2.onPlay, onStop = _ref2.onStop, chunkOnEnd = _ref2.onEnd;
47603
+ if (!enabled) {
47604
+ chunkOnEnd();
47605
+ return;
47606
+ }
47607
+ var fullInput = input({
47608
+ message: message
47609
+ });
47610
+ if (fullInput == null) {
47611
+ chunkOnEnd();
47612
+ return;
47613
+ }
47614
+ var id = String(message.id);
47615
+ var now = getPerformanceNow();
47616
+ var segCache_0 = segCacheRef.current;
47617
+ var prevSeg = segCache_0.get(id);
47618
+ var nextSeg = getIncrementalSentences(prevSeg, fullInput, now);
47619
+ segCache_0.set(id, nextSeg);
47620
+ evictSegCache();
47621
+ var existing = messageStatesRef.current.get(id);
47622
+ var prevPlayable = (_existing$playableCou = existing === null || existing === void 0 ? void 0 : existing.playableCount) !== null && _existing$playableCou !== void 0 ? _existing$playableCou : 0;
47623
+ var sentences = nextSeg.sentences;
47624
+ var playableCount = sentences.length;
47625
+ if (!isOptimistic({
47626
+ id: id
47627
+ }) && message.status === "in_progress" && sentences.length > 0) {
47628
+ var last3 = sentences[sentences.length - 1];
47629
+ if (last3 && !fullSentenceRegex.test(last3)) {
47630
+ playableCount -= 1;
47631
+ }
47632
+ }
47633
+ if (playableCount < 0) playableCount = 0;
47634
+ var fallbackOrder = (_ref3 = (_existing$fallbackOrd = existing === null || existing === void 0 ? void 0 : existing.fallbackOrder) !== null && _existing$fallbackOrd !== void 0 ? _existing$fallbackOrd : message.created_at) !== null && _ref3 !== void 0 ? _ref3 : Date.now();
47635
+ var order2 = (_ref4 = (_messageOrderRef$curr = messageOrderRef.current.get(id)) !== null && _messageOrderRef$curr !== void 0 ? _messageOrderRef$curr : existing === null || existing === void 0 ? void 0 : existing.order) !== null && _ref4 !== void 0 ? _ref4 : fallbackOrder;
47636
+ var nextIndex = existing ? Math.min(existing.nextIndex, sentences.length) : 0;
47637
+ var stopped = (_existing$stopped = existing === null || existing === void 0 ? void 0 : existing.stopped) !== null && _existing$stopped !== void 0 ? _existing$stopped : false;
47638
+ var nextState = {
47639
+ id: id,
47640
+ status: (_ref5 = message.status) !== null && _ref5 !== void 0 ? _ref5 : "completed",
47641
+ sentences: sentences,
47642
+ nextIndex: nextIndex,
47643
+ playableCount: playableCount,
47644
+ stopped: stopped,
47645
+ order: order2,
47646
+ fallbackOrder: fallbackOrder
47647
+ };
47648
+ messageStatesRef.current.set(id, nextState);
47649
+ rebuildQueue();
47650
+ var newSegments = Math.max(playableCount - prevPlayable, 0);
47651
+ if (newSegments > 0) {
47652
+ var _chunkQueuesRef$curre;
47653
+ var queue_0 = (_chunkQueuesRef$curre = chunkQueuesRef.current.get(id)) !== null && _chunkQueuesRef$curre !== void 0 ? _chunkQueuesRef$curre : [];
47654
+ queue_0.push({
47655
+ remaining: newSegments,
47656
+ onPlay: onPlay,
47657
+ onStop: onStop,
47658
+ onEnd: chunkOnEnd,
47659
+ started: false,
47660
+ stopped: false
47661
+ });
47662
+ chunkQueuesRef.current.set(id, queue_0);
47663
+ startNextSegment();
47664
+ } else {
47665
+ chunkOnEnd();
47666
+ }
47667
+ }, [
47668
+ enabled,
47669
+ fullSentenceRegex,
47670
+ rebuildQueue,
47671
+ startNextSegment,
47672
+ evictSegCache
47673
+ ]);
47674
+ var syncMessages = useCallback7(function(messagesAsc) {
47675
+ messageOrderRef.current.clear();
47676
+ for(var i_4 = 0; i_4 < messagesAsc.length; i_4++){
47677
+ var _ref6;
47678
+ messageOrderRef.current.set(String(messagesAsc[i_4].id), i_4);
47679
+ var state_4 = messageStatesRef.current.get(String(messagesAsc[i_4].id));
47680
+ if (state_4) state_4.status = (_ref6 = messagesAsc[i_4].status) !== null && _ref6 !== void 0 ? _ref6 : "completed";
47681
+ }
47682
+ if (!enabled) return;
47683
+ rebuildQueue();
47684
+ }, [
47685
+ enabled,
47686
+ rebuildQueue
47687
+ ]);
47688
+ useEffect10(function() {
47689
+ if (!enabled) return;
47690
+ if (isHtmlAudioSupported) {
47691
+ var _Howler$_howls;
47692
+ var node = Howler === null || Howler === void 0 || (_Howler$_howls = Howler._howls) === null || _Howler$_howls === void 0 || (_Howler$_howls = _Howler$_howls[0]) === null || _Howler$_howls === void 0 || (_Howler$_howls = _Howler$_howls._sounds) === null || _Howler$_howls === void 0 || (_Howler$_howls = _Howler$_howls[0]) === null || _Howler$_howls === void 0 ? void 0 : _Howler$_howls._node;
47693
+ if (node) node.crossOrigin = "anonymous";
47694
+ }
47695
+ }, [
47696
+ enabled,
47697
+ audioPlayer
47698
+ ]);
47699
+ var _useState92 = _sliced_to_array(useState9(null), 2), audioEngine = _useState92[0], setAudioEngine = _useState92[1];
47700
+ var isAudioEngineInited = useRef8(false);
47701
+ useEffect10(function() {
47702
+ if (!enabled) return;
47703
+ if (!audioPlayer.playing) return;
47704
+ if (isAudioEngineInited.current) return;
47705
+ isAudioEngineInited.current = true;
47706
+ if (isHtmlAudioSupported) {
47707
+ var _Howler$_howls2;
47708
+ var AudioCtx = window.AudioContext || window.webkitAudioContext;
47709
+ var audioContext = new AudioCtx();
47710
+ var node_0 = Howler === null || Howler === void 0 || (_Howler$_howls2 = Howler._howls) === null || _Howler$_howls2 === void 0 || (_Howler$_howls2 = _Howler$_howls2[0]) === null || _Howler$_howls2 === void 0 || (_Howler$_howls2 = _Howler$_howls2._sounds) === null || _Howler$_howls2 === void 0 || (_Howler$_howls2 = _Howler$_howls2[0]) === null || _Howler$_howls2 === void 0 ? void 0 : _Howler$_howls2._node;
47711
+ if (node_0) {
47712
+ setAudioEngine({
47713
+ // @ts-ignore-next-line
47714
+ source: audioContext.createMediaElementSource(node_0),
47715
+ audioContext: audioContext
47716
+ });
47717
+ }
47718
+ } else {
47719
+ setAudioEngine({
47720
+ source: Howler.masterGain,
47721
+ audioContext: Howler.ctx
47722
+ });
47723
+ }
47724
+ }, [
47725
+ enabled,
47726
+ audioPlayer
47727
+ ]);
47728
+ var visualizationAnalyser = useMemo17(function() {
47729
+ if (!enabled) return null;
47730
+ if (!audioEngine) return null;
47731
+ var analyser = audioEngine.audioContext.createAnalyser();
47732
+ audioEngine.source.connect(audioEngine.audioContext.destination);
47733
+ audioEngine.source.connect(analyser);
47734
+ return analyser;
47735
+ }, [
47736
+ enabled,
47737
+ audioEngine
47738
+ ]);
47739
+ var isPending = useMemo17(function() {
47740
+ if (!enabled) return false;
47741
+ return isPlaying || Array.from(messageStatesRef.current.values()).some(function(state_5) {
47742
+ return !state_5.stopped && (state_5.status === "in_progress" || state_5.nextIndex < state_5.sentences.length);
47743
+ });
47744
+ }, [
47745
+ enabled,
47746
+ isPlaying
47747
+ ]);
47748
+ return {
47749
+ play: play,
47750
+ syncMessages: syncMessages,
47751
+ isPending: isPending,
47752
+ visualizationAnalyser: visualizationAnalyser,
47753
+ controls: audioPlayer
47754
+ };
47296
47755
  };
47756
+ // src/hooks/audioThreads/useMessageAudio/index.ts
47757
+ function ownKeys48(e, r) {
47758
+ var t = Object.keys(e);
47759
+ if (Object.getOwnPropertySymbols) {
47760
+ var o = Object.getOwnPropertySymbols(e);
47761
+ r && (o = o.filter(function(r2) {
47762
+ return Object.getOwnPropertyDescriptor(e, r2).enumerable;
47763
+ })), t.push.apply(t, o);
47764
+ }
47765
+ return t;
47766
+ }
47767
+ function _objectSpread48(e) {
47768
+ for(var r = 1; r < arguments.length; r++){
47769
+ var t = null != arguments[r] ? arguments[r] : {};
47770
+ r % 2 ? ownKeys48(Object(t), true).forEach(function(r2) {
47771
+ _defineProperty48(e, r2, t[r2]);
47772
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys48(Object(t)).forEach(function(r2) {
47773
+ Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2));
47774
+ });
47775
+ }
47776
+ return e;
47777
+ }
47778
+ function _defineProperty48(e, r, t) {
47779
+ return (r = _toPropertyKey48(r)) in e ? Object.defineProperty(e, r, {
47780
+ value: t,
47781
+ enumerable: true,
47782
+ configurable: true,
47783
+ writable: true
47784
+ }) : e[r] = t, e;
47785
+ }
47786
+ function _toPropertyKey48(t) {
47787
+ var i = _toPrimitive48(t, "string");
47788
+ return "symbol" == (typeof i === "undefined" ? "undefined" : _type_of(i)) ? i : i + "";
47789
+ }
47790
+ function _toPrimitive48(t, r) {
47791
+ if ("object" != (typeof t === "undefined" ? "undefined" : _type_of(t)) || !t) return t;
47792
+ var e = t[Symbol.toPrimitive];
47793
+ if (void 0 !== e) {
47794
+ var i = e.call(t, r || "default");
47795
+ if ("object" != (typeof i === "undefined" ? "undefined" : _type_of(i))) return i;
47796
+ throw new TypeError("@@toPrimitive must return a primitive value.");
47797
+ }
47798
+ return ("string" === r ? String : Number)(t);
47799
+ }
47297
47800
  var useMessageAudio = function(t0) {
47298
- var $ = _c88(41);
47299
- var _onEnd = t0.onEnd, passedPlay = t0.play, t1 = t0.fullSentenceRegex;
47801
+ var $ = _c88(42);
47802
+ var onEnd = t0.onEnd, passedPlay = t0.play, t1 = t0.fullSentenceRegex;
47300
47803
  var t2;
47301
47804
  if ($[0] !== t1) {
47302
47805
  t2 = t1 === void 0 ? /[\.?!]$/ : t1;
@@ -47306,193 +47809,168 @@ var useMessageAudio = function(t0) {
47306
47809
  t2 = $[1];
47307
47810
  }
47308
47811
  var fullSentenceRegex = t2;
47309
- var _useState9 = _sliced_to_array(useState9(false), 2), isAudioPlayed = _useState9[0], setIsAudioPlayed = _useState9[1];
47310
- var audioPlayer = useAudioPlayer2();
47311
- var nextAudioPlayer = useAudioPlayer2();
47312
47812
  var superinterfaceContext = useSuperinterfaceContext();
47313
- var _useState91 = _sliced_to_array(useState9(false), 2), isPlaying = _useState91[0], setIsPlaying = _useState91[1];
47813
+ var messagesProps = useMessages();
47314
47814
  var t3;
47315
- if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
47316
- t3 = [];
47317
- $[2] = t3;
47318
- } else {
47319
- t3 = $[2];
47320
- }
47321
- var _useState92 = _sliced_to_array(useState9(t3), 2), audioQueue = _useState92[0], setAudioQueue = _useState92[1];
47322
47815
  var t4;
47323
- if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
47324
- t4 = [];
47816
+ if ($[2] !== messagesProps.messages) {
47817
+ var assistantsDesc = messagesProps.messages.filter(_temp9);
47818
+ t4 = assistantsDesc.slice().reverse();
47819
+ $[2] = messagesProps.messages;
47325
47820
  $[3] = t4;
47326
47821
  } else {
47327
47822
  t4 = $[3];
47328
47823
  }
47329
- var audioQueueRef = useRef8(t4);
47824
+ t3 = t4;
47825
+ var assistantsAsc = t3;
47826
+ var _useState10 = _sliced_to_array(useState10(false), 2), isAudioPlayed = _useState10[0], setIsAudioPlayed = _useState10[1];
47827
+ var _useState101 = _sliced_to_array(useState10(0), 2), activeChunks = _useState101[0], setActiveChunks = _useState101[1];
47828
+ var activeChunksRef = useRef9(0);
47330
47829
  var t5;
47331
47830
  var t6;
47332
- if ($[4] !== audioQueue) {
47831
+ if ($[4] !== activeChunks) {
47333
47832
  t5 = function() {
47334
- audioQueueRef.current = audioQueue;
47833
+ activeChunksRef.current = activeChunks;
47335
47834
  };
47336
47835
  t6 = [
47337
- audioQueue
47836
+ activeChunks
47338
47837
  ];
47339
- $[4] = audioQueue;
47838
+ $[4] = activeChunks;
47340
47839
  $[5] = t5;
47341
47840
  $[6] = t6;
47342
47841
  } else {
47343
47842
  t5 = $[5];
47344
47843
  t6 = $[6];
47345
47844
  }
47346
- useEffect10(t5, t6);
47347
- var currentSentenceRef = useRef8(null);
47348
- var messagesProps = useMessages();
47349
- var t7;
47845
+ useEffect11(t5, t6);
47846
+ var onEndPendingRef = useRef9(false);
47847
+ var t7 = !passedPlay;
47350
47848
  var t8;
47351
- if ($[7] !== messagesProps.messages) {
47352
- t7 = function() {
47353
- var assistants = messagesProps.messages.filter(_temp9);
47354
- setAudioQueue(function(prev) {
47355
- var prevById = new Map(prev.map(_temp24));
47356
- var next = [];
47357
- var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
47358
- try {
47359
- for(var _iterator = assistants[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
47360
- var m_0 = _step.value;
47361
- var _existing$nextIndex, _existing$stopped;
47362
- var inp = input({
47363
- message: m_0
47364
- });
47365
- if (inp == null) {
47366
- continue;
47367
- }
47368
- var sentences = segment(inp);
47369
- var existing = prevById.get(m_0.id);
47370
- next.push({
47371
- id: m_0.id,
47372
- status: m_0.status,
47373
- sentences: sentences,
47374
- nextIndex: Math.min((_existing$nextIndex = existing === null || existing === void 0 ? void 0 : existing.nextIndex) !== null && _existing$nextIndex !== void 0 ? _existing$nextIndex : 0, sentences.length),
47375
- stopped: (_existing$stopped = existing === null || existing === void 0 ? void 0 : existing.stopped) !== null && _existing$stopped !== void 0 ? _existing$stopped : false
47376
- });
47377
- }
47378
- } catch (err) {
47379
- _didIteratorError = true;
47380
- _iteratorError = err;
47381
- } finally{
47382
- try {
47383
- if (!_iteratorNormalCompletion && _iterator.return != null) {
47384
- _iterator.return();
47385
- }
47386
- } finally{
47387
- if (_didIteratorError) {
47388
- throw _iteratorError;
47389
- }
47390
- }
47391
- }
47392
- return next;
47393
- });
47849
+ if ($[7] !== fullSentenceRegex || $[8] !== isAudioPlayed || $[9] !== onEnd || $[10] !== superinterfaceContext || $[11] !== t7) {
47850
+ t8 = {
47851
+ enabled: t7,
47852
+ fullSentenceRegex: fullSentenceRegex,
47853
+ onEnd: onEnd,
47854
+ superinterfaceContext: superinterfaceContext,
47855
+ isAudioPlayed: isAudioPlayed
47394
47856
  };
47395
- t8 = [
47396
- messagesProps.messages
47397
- ];
47398
- $[7] = messagesProps.messages;
47399
- $[8] = t7;
47400
- $[9] = t8;
47857
+ $[7] = fullSentenceRegex;
47858
+ $[8] = isAudioPlayed;
47859
+ $[9] = onEnd;
47860
+ $[10] = superinterfaceContext;
47861
+ $[11] = t7;
47862
+ $[12] = t8;
47401
47863
  } else {
47402
- t7 = $[8];
47403
- t8 = $[9];
47864
+ t8 = $[12];
47404
47865
  }
47405
- useEffect10(t7, t8);
47866
+ var defaultPlayback = useDefaultPlay(t8);
47867
+ var defaultPlayFn = defaultPlayback.play, syncMessages = defaultPlayback.syncMessages, defaultIsPending = defaultPlayback.isPending, defaultVisualizer = defaultPlayback.visualizationAnalyser, controls = defaultPlayback.controls;
47406
47868
  var t9;
47407
- if ($[10] !== audioPlayer || $[11] !== fullSentenceRegex || $[12] !== isAudioPlayed || $[13] !== nextAudioPlayer || $[14] !== superinterfaceContext) {
47408
- t9 = function(t102) {
47409
- var input2 = t102.input, onPlay = t102.onPlay, onStop = t102.onStop, onEnd_0 = t102.onEnd;
47410
- var searchParams = new URLSearchParams(_objectSpread47({
47411
- input: input2
47412
- }, superinterfaceContext.variables));
47413
- audioPlayer.load("".concat(superinterfaceContext.baseUrl, "/audio-runtimes/tts?").concat(searchParams), {
47414
- format: "mp3",
47415
- autoplay: isAudioPlayed,
47416
- html5: isHtmlAudioSupported,
47417
- onplay: onPlay,
47418
- onstop: onStop,
47419
- onload: function() {
47420
- var current = currentSentenceRef.current;
47421
- if (!current) {
47422
- return;
47423
- }
47424
- var msg = audioQueueRef.current.find(function(m_1) {
47425
- return m_1.id === current.messageId;
47426
- });
47427
- if (!msg) {
47428
- return;
47429
- }
47430
- var nextSentence = msg.sentences[msg.nextIndex];
47431
- if (!nextSentence) {
47432
- return;
47433
- }
47434
- if (!fullSentenceRegex.test(nextSentence)) {
47435
- return;
47436
- }
47437
- var nextSearchParams = new URLSearchParams(_objectSpread47({
47438
- input: nextSentence
47439
- }, superinterfaceContext.variables));
47440
- nextAudioPlayer.load("".concat(superinterfaceContext.baseUrl, "/audio-runtimes/tts?").concat(nextSearchParams), {
47441
- format: "mp3",
47442
- autoplay: false,
47443
- html5: isHtmlAudioSupported
47444
- });
47869
+ t9 = passedPlay || defaultPlayFn;
47870
+ var playImpl = t9;
47871
+ var t10;
47872
+ if ($[13] !== passedPlay) {
47873
+ t10 = function() {
47874
+ if (passedPlay) {
47875
+ onEndPendingRef.current = true;
47876
+ setActiveChunks(_temp24);
47877
+ }
47878
+ var finished;
47879
+ finished = false;
47880
+ var finish = function() {
47881
+ if (finished) {
47882
+ return;
47883
+ }
47884
+ finished = true;
47885
+ if (passedPlay) {
47886
+ setActiveChunks(_temp32);
47887
+ }
47888
+ };
47889
+ return {
47890
+ onPlay: function() {
47891
+ return setIsAudioPlayed(true);
47445
47892
  },
47446
- onend: onEnd_0
47447
- });
47893
+ onStop: function() {
47894
+ return finish();
47895
+ },
47896
+ onEnd: function() {
47897
+ return finish();
47898
+ }
47899
+ };
47448
47900
  };
47449
- $[10] = audioPlayer;
47450
- $[11] = fullSentenceRegex;
47451
- $[12] = isAudioPlayed;
47452
- $[13] = nextAudioPlayer;
47453
- $[14] = superinterfaceContext;
47454
- $[15] = t9;
47901
+ $[13] = passedPlay;
47902
+ $[14] = t10;
47455
47903
  } else {
47456
- t9 = $[15];
47904
+ t10 = $[14];
47457
47905
  }
47458
- var defaultPlay = t9;
47459
- var t10;
47460
- t10 = passedPlay || defaultPlay;
47461
- var play = t10;
47906
+ var createChunkCallbacks = t10;
47462
47907
  var t11;
47908
+ if ($[15] === Symbol.for("react.memo_cache_sentinel")) {
47909
+ t11 = /* @__PURE__ */ new Map();
47910
+ $[15] = t11;
47911
+ } else {
47912
+ t11 = $[15];
47913
+ }
47914
+ var processedRef = useRef9(t11);
47463
47915
  var t12;
47464
- if ($[16] !== audioPlayer.playing || $[17] !== audioQueue || $[18] !== fullSentenceRegex || $[19] !== isPlaying || $[20] !== _onEnd || $[21] !== play) {
47465
- t11 = function() {
47466
- if (isPlaying) {
47467
- return;
47468
- }
47469
- if (audioPlayer.playing) {
47470
- return;
47916
+ var t13;
47917
+ if ($[16] !== assistantsAsc || $[17] !== createChunkCallbacks || $[18] !== passedPlay || $[19] !== playImpl || $[20] !== syncMessages) {
47918
+ t12 = function() {
47919
+ var seenIds = /* @__PURE__ */ new Set();
47920
+ for(var idx = 0; idx < assistantsAsc.length; idx++){
47921
+ var _prev_1$text;
47922
+ var message_0 = assistantsAsc[idx];
47923
+ var id = String(message_0.id);
47924
+ var input2 = input({
47925
+ message: message_0
47926
+ });
47927
+ if (input2 == null) {
47928
+ continue;
47929
+ }
47930
+ var prev_1 = processedRef.current.get(id);
47931
+ var prevText = (_prev_1$text = prev_1 === null || prev_1 === void 0 ? void 0 : prev_1.text) !== null && _prev_1$text !== void 0 ? _prev_1$text : "";
47932
+ var prevStatus = prev_1 === null || prev_1 === void 0 ? void 0 : prev_1.status;
47933
+ var hasSamePrefix = prevText.length > 0 && input2.startsWith(prevText) && prevText !== input2;
47934
+ var delta = void 0;
47935
+ if (hasSamePrefix) {
47936
+ delta = input2.slice(prevText.length);
47937
+ } else {
47938
+ if (input2 === prevText) {
47939
+ delta = "";
47940
+ } else {
47941
+ delta = input2;
47942
+ }
47943
+ }
47944
+ var statusChanged = prevStatus !== message_0.status;
47945
+ if (delta.length > 0 || statusChanged) {
47946
+ var callbacks = createChunkCallbacks();
47947
+ ;
47948
+ try {
47949
+ playImpl({
47950
+ input: delta,
47951
+ message: message_0,
47952
+ onPlay: callbacks.onPlay,
47953
+ onStop: callbacks.onStop,
47954
+ onEnd: callbacks.onEnd
47955
+ });
47956
+ } catch (t142) {
47957
+ var error = t142;
47958
+ callbacks.onEnd();
47959
+ throw error;
47960
+ }
47961
+ }
47962
+ processedRef.current.set(id, {
47963
+ text: input2,
47964
+ status: message_0.status
47965
+ });
47966
+ seenIds.add(id);
47471
47967
  }
47472
- var candidate;
47473
- candidate = null;
47474
47968
  var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
47475
47969
  try {
47476
- for(var _iterator = audioQueue[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
47477
- var msg_0 = _step.value;
47478
- if (msg_0.stopped) {
47479
- continue;
47480
- }
47481
- var sentence = msg_0.sentences[msg_0.nextIndex];
47482
- if (!sentence) {
47483
- continue;
47484
- }
47485
- var isFull = isOptimistic({
47486
- id: msg_0.id
47487
- }) || msg_0.status !== "in_progress" || fullSentenceRegex.test(sentence);
47488
- if (isFull) {
47489
- candidate = {
47490
- messageId: msg_0.id,
47491
- sentence: sentence,
47492
- index: msg_0.nextIndex,
47493
- ownerStatus: msg_0.status
47494
- };
47495
- break;
47970
+ for(var _iterator = Array.from(processedRef.current.keys())[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
47971
+ var id_0 = _step.value;
47972
+ if (!seenIds.has(id_0)) {
47973
+ processedRef.current.delete(id_0);
47496
47974
  }
47497
47975
  }
47498
47976
  } catch (err) {
@@ -47509,198 +47987,116 @@ var useMessageAudio = function(t0) {
47509
47987
  }
47510
47988
  }
47511
47989
  }
47512
- if (!candidate) {
47513
- return;
47990
+ if (!passedPlay) {
47991
+ syncMessages(assistantsAsc);
47514
47992
  }
47515
- setIsPlaying(true);
47516
- currentSentenceRef.current = {
47517
- messageId: candidate.messageId,
47518
- index: candidate.index
47519
- };
47520
- setAudioQueue(function(prev_0) {
47521
- return prev_0.map(function(m_2) {
47522
- return m_2.id === candidate.messageId ? _objectSpread47(_objectSpread47({}, m_2), {}, {
47523
- nextIndex: m_2.nextIndex + 1
47524
- }) : m_2;
47525
- });
47526
- });
47527
- play({
47528
- input: candidate.sentence,
47529
- onPlay: function() {
47530
- return setIsAudioPlayed(true);
47531
- },
47532
- onStop: function() {
47533
- setAudioQueue(function(prev_1) {
47534
- return prev_1.map(function(m_3) {
47535
- return m_3.id === candidate.messageId ? _objectSpread47(_objectSpread47({}, m_3), {}, {
47536
- stopped: true
47537
- }) : m_3;
47538
- });
47539
- });
47540
- setIsPlaying(false);
47541
- currentSentenceRef.current = null;
47542
- },
47543
- onEnd: function() {
47544
- setIsPlaying(false);
47545
- currentSentenceRef.current = null;
47546
- var hasPending = audioQueueRef.current.some(_temp32);
47547
- if (!hasPending) {
47548
- _onEnd();
47549
- }
47550
- }
47551
- });
47552
47993
  };
47553
- t12 = [
47554
- isPlaying,
47555
- audioPlayer.playing,
47556
- audioQueue,
47557
- play,
47558
- fullSentenceRegex,
47559
- _onEnd
47560
- ];
47561
- $[16] = audioPlayer.playing;
47562
- $[17] = audioQueue;
47563
- $[18] = fullSentenceRegex;
47564
- $[19] = isPlaying;
47565
- $[20] = _onEnd;
47566
- $[21] = play;
47567
- $[22] = t11;
47568
- $[23] = t12;
47569
- } else {
47570
- t11 = $[22];
47571
- t12 = $[23];
47572
- }
47573
- useEffect10(t11, t12);
47574
- var t13;
47575
- if ($[24] !== audioPlayer) {
47576
47994
  t13 = [
47577
- audioPlayer
47995
+ assistantsAsc,
47996
+ playImpl,
47997
+ passedPlay,
47998
+ createChunkCallbacks,
47999
+ syncMessages
47578
48000
  ];
47579
- $[24] = audioPlayer;
47580
- $[25] = t13;
47581
- } else {
47582
- t13 = $[25];
47583
- }
47584
- useEffect10(_temp42, t13);
47585
- var _useState93 = _sliced_to_array(useState9(null), 2), audioEngine = _useState93[0], setAudioEngine = _useState93[1];
47586
- var isAudioEngineInited = useRef8(false);
48001
+ $[16] = assistantsAsc;
48002
+ $[17] = createChunkCallbacks;
48003
+ $[18] = passedPlay;
48004
+ $[19] = playImpl;
48005
+ $[20] = syncMessages;
48006
+ $[21] = t12;
48007
+ $[22] = t13;
48008
+ } else {
48009
+ t12 = $[21];
48010
+ t13 = $[22];
48011
+ }
48012
+ useEffect11(t12, t13);
47587
48013
  var t14;
47588
- if ($[26] !== audioPlayer.playing) {
48014
+ if ($[23] !== assistantsAsc || $[24] !== onEnd || $[25] !== passedPlay) {
47589
48015
  t14 = function() {
47590
- if (!audioPlayer.playing) {
48016
+ if (!passedPlay) {
47591
48017
  return;
47592
48018
  }
47593
- if (isAudioEngineInited.current) {
48019
+ if (!onEndPendingRef.current) {
47594
48020
  return;
47595
48021
  }
47596
- isAudioEngineInited.current = true;
47597
- if (isHtmlAudioSupported) {
47598
- var audioContext = new AudioContext();
47599
- setAudioEngine({
47600
- source: audioContext.createMediaElementSource(Howler._howls[0]._sounds[0]._node),
47601
- audioContext: audioContext
47602
- });
47603
- } else {
47604
- setAudioEngine({
47605
- source: Howler.masterGain,
47606
- audioContext: Howler.ctx
47607
- });
48022
+ if (activeChunksRef.current !== 0) {
48023
+ return;
48024
+ }
48025
+ var hasStreaming = assistantsAsc.some(_temp42);
48026
+ if (!hasStreaming) {
48027
+ onEnd();
48028
+ onEndPendingRef.current = false;
47608
48029
  }
47609
48030
  };
47610
- $[26] = audioPlayer.playing;
47611
- $[27] = t14;
48031
+ $[23] = assistantsAsc;
48032
+ $[24] = onEnd;
48033
+ $[25] = passedPlay;
48034
+ $[26] = t14;
47612
48035
  } else {
47613
- t14 = $[27];
48036
+ t14 = $[26];
47614
48037
  }
47615
48038
  var t15;
47616
- if ($[28] !== audioPlayer) {
48039
+ if ($[27] !== activeChunks || $[28] !== assistantsAsc || $[29] !== onEnd || $[30] !== passedPlay) {
47617
48040
  t15 = [
47618
- audioPlayer
48041
+ passedPlay,
48042
+ assistantsAsc,
48043
+ onEnd,
48044
+ activeChunks
47619
48045
  ];
47620
- $[28] = audioPlayer;
47621
- $[29] = t15;
48046
+ $[27] = activeChunks;
48047
+ $[28] = assistantsAsc;
48048
+ $[29] = onEnd;
48049
+ $[30] = passedPlay;
48050
+ $[31] = t15;
47622
48051
  } else {
47623
- t15 = $[29];
48052
+ t15 = $[31];
47624
48053
  }
47625
- useEffect10(t14, t15);
48054
+ useEffect11(t14, t15);
47626
48055
  var t16;
47627
- bb0: {
47628
- if (!audioEngine) {
47629
- t16 = null;
47630
- break bb0;
47631
- }
47632
- var analyser;
47633
- if ($[30] !== audioEngine.audioContext || $[31] !== audioEngine.source) {
47634
- analyser = audioEngine.audioContext.createAnalyser();
47635
- audioEngine.source.connect(audioEngine.audioContext.destination);
47636
- audioEngine.source.connect(analyser);
47637
- $[30] = audioEngine.audioContext;
47638
- $[31] = audioEngine.source;
47639
- $[32] = analyser;
47640
- } else {
47641
- analyser = $[32];
47642
- }
47643
- t16 = analyser;
47644
- }
47645
- var visualizationAnalyser = t16;
48056
+ if ($[32] !== activeChunks || $[33] !== assistantsAsc || $[34] !== defaultIsPending || $[35] !== passedPlay) {
48057
+ t16 = passedPlay ? activeChunks > 0 || assistantsAsc.some(_temp52) : defaultIsPending;
48058
+ $[32] = activeChunks;
48059
+ $[33] = assistantsAsc;
48060
+ $[34] = defaultIsPending;
48061
+ $[35] = passedPlay;
48062
+ $[36] = t16;
48063
+ } else {
48064
+ t16 = $[36];
48065
+ }
48066
+ var isPending = t16;
48067
+ var visualizationAnalyser = passedPlay ? null : defaultVisualizer;
47646
48068
  var t17;
47647
- var t18;
47648
- if ($[33] !== audioQueue || $[34] !== isPlaying) {
47649
- t18 = isPlaying || audioQueue.some(_temp52);
47650
- $[33] = audioQueue;
47651
- $[34] = isPlaying;
47652
- $[35] = t18;
47653
- } else {
47654
- t18 = $[35];
47655
- }
47656
- t17 = t18;
47657
- var isPending = t17;
47658
- var t19;
47659
- if ($[36] !== audioPlayer || $[37] !== isAudioPlayed || $[38] !== isPending || $[39] !== visualizationAnalyser) {
47660
- t19 = _objectSpread47(_objectSpread47({
48069
+ if ($[37] !== controls || $[38] !== isAudioPlayed || $[39] !== isPending || $[40] !== visualizationAnalyser) {
48070
+ t17 = _objectSpread48(_objectSpread48({
47661
48071
  isPending: isPending,
47662
48072
  isAudioPlayed: isAudioPlayed
47663
- }, audioPlayer), {}, {
48073
+ }, controls), {}, {
47664
48074
  visualizationAnalyser: visualizationAnalyser
47665
48075
  });
47666
- $[36] = audioPlayer;
47667
- $[37] = isAudioPlayed;
47668
- $[38] = isPending;
47669
- $[39] = visualizationAnalyser;
47670
- $[40] = t19;
48076
+ $[37] = controls;
48077
+ $[38] = isAudioPlayed;
48078
+ $[39] = isPending;
48079
+ $[40] = visualizationAnalyser;
48080
+ $[41] = t17;
47671
48081
  } else {
47672
- t19 = $[40];
48082
+ t17 = $[41];
47673
48083
  }
47674
- return t19;
48084
+ return t17;
47675
48085
  };
47676
- function _temp9(m) {
47677
- return m.role === "assistant";
48086
+ function _temp9(message) {
48087
+ return message.role === "assistant";
47678
48088
  }
47679
- function _temp24(p) {
47680
- return [
47681
- p.id,
47682
- p
47683
- ];
48089
+ function _temp24(prev) {
48090
+ return prev + 1;
47684
48091
  }
47685
- function _temp32(m_4) {
47686
- if (m_4.stopped) {
47687
- return false;
47688
- }
47689
- var hasMore = m_4.nextIndex < m_4.sentences.length;
47690
- var streaming = m_4.status === "in_progress";
47691
- return hasMore || streaming;
48092
+ function _temp32(prev_0) {
48093
+ return Math.max(prev_0 - 1, 0);
47692
48094
  }
47693
- function _temp42() {
47694
- if (isHtmlAudioSupported) {
47695
- var _Howler$_howls$;
47696
- if (!(Howler !== null && Howler !== void 0 && (_Howler$_howls$ = Howler._howls[0]) !== null && _Howler$_howls$ !== void 0 && (_Howler$_howls$ = _Howler$_howls$._sounds[0]) !== null && _Howler$_howls$ !== void 0 && _Howler$_howls$._node)) {
47697
- return;
47698
- }
47699
- Howler._howls[0]._sounds[0]._node.crossOrigin = "anonymous";
47700
- }
48095
+ function _temp42(message_1) {
48096
+ return message_1.status === "in_progress";
47701
48097
  }
47702
- function _temp52(m_5) {
47703
- return !m_5.stopped && (m_5.nextIndex < m_5.sentences.length || m_5.status === "in_progress");
48098
+ function _temp52(message_2) {
48099
+ return message_2.status === "in_progress";
47704
48100
  }
47705
48101
  // src/hooks/audioRuntimes/useTtsAudioRuntime/index.ts
47706
48102
  import { useQueryClient as useQueryClient6 } from "@tanstack/react-query";
@@ -47715,6 +48111,52 @@ var blobToData = function(blob) {
47715
48111
  });
47716
48112
  };
47717
48113
  // src/hooks/audioRuntimes/useTtsAudioRuntime/index.ts
48114
+ var _excluded5 = [
48115
+ "onEnd"
48116
+ ];
48117
+ function ownKeys49(e, r) {
48118
+ var t = Object.keys(e);
48119
+ if (Object.getOwnPropertySymbols) {
48120
+ var o = Object.getOwnPropertySymbols(e);
48121
+ r && (o = o.filter(function(r2) {
48122
+ return Object.getOwnPropertyDescriptor(e, r2).enumerable;
48123
+ })), t.push.apply(t, o);
48124
+ }
48125
+ return t;
48126
+ }
48127
+ function _objectSpread49(e) {
48128
+ for(var r = 1; r < arguments.length; r++){
48129
+ var t = null != arguments[r] ? arguments[r] : {};
48130
+ r % 2 ? ownKeys49(Object(t), true).forEach(function(r2) {
48131
+ _defineProperty49(e, r2, t[r2]);
48132
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys49(Object(t)).forEach(function(r2) {
48133
+ Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2));
48134
+ });
48135
+ }
48136
+ return e;
48137
+ }
48138
+ function _defineProperty49(e, r, t) {
48139
+ return (r = _toPropertyKey49(r)) in e ? Object.defineProperty(e, r, {
48140
+ value: t,
48141
+ enumerable: true,
48142
+ configurable: true,
48143
+ writable: true
48144
+ }) : e[r] = t, e;
48145
+ }
48146
+ function _toPropertyKey49(t) {
48147
+ var i = _toPrimitive49(t, "string");
48148
+ return "symbol" == (typeof i === "undefined" ? "undefined" : _type_of(i)) ? i : i + "";
48149
+ }
48150
+ function _toPrimitive49(t, r) {
48151
+ if ("object" != (typeof t === "undefined" ? "undefined" : _type_of(t)) || !t) return t;
48152
+ var e = t[Symbol.toPrimitive];
48153
+ if (void 0 !== e) {
48154
+ var i = e.call(t, r || "default");
48155
+ if ("object" != (typeof i === "undefined" ? "undefined" : _type_of(i))) return i;
48156
+ throw new TypeError("@@toPrimitive must return a primitive value.");
48157
+ }
48158
+ return ("string" === r ? String : Number)(t);
48159
+ }
47718
48160
  function asyncGeneratorStep11(n, t, e, r, o, a, c) {
47719
48161
  try {
47720
48162
  var i = n[a](c), u = i.value;
@@ -47738,20 +48180,52 @@ function _asyncToGenerator11(n) {
47738
48180
  });
47739
48181
  };
47740
48182
  }
48183
+ function _objectWithoutProperties5(e, t) {
48184
+ if (null == e) return {};
48185
+ var o, r, i = _objectWithoutPropertiesLoose5(e, t);
48186
+ if (Object.getOwnPropertySymbols) {
48187
+ var n = Object.getOwnPropertySymbols(e);
48188
+ for(r = 0; r < n.length; r++)o = n[r], -1 === t.indexOf(o) && ({}).propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
48189
+ }
48190
+ return i;
48191
+ }
48192
+ function _objectWithoutPropertiesLoose5(r, e) {
48193
+ if (null == r) return {};
48194
+ var t = {};
48195
+ for(var n in r)if (({}).hasOwnProperty.call(r, n)) {
48196
+ if (-1 !== e.indexOf(n)) continue;
48197
+ t[n] = r[n];
48198
+ }
48199
+ return t;
48200
+ }
47741
48201
  var useTtsAudioRuntime = function(t0) {
47742
- var $ = _c89(30);
47743
- var play = t0.play, passedOnEnd = t0.onEnd;
48202
+ var $ = _c89(33);
48203
+ var overrides;
48204
+ var passedOnEnd;
48205
+ if ($[0] !== t0) {
48206
+ var _t = t0;
48207
+ var ref;
48208
+ ref = _t, passedOnEnd = ref.onEnd, ref;
48209
+ overrides = _objectWithoutProperties5(_t, _excluded5);
48210
+ _t;
48211
+ $[0] = t0;
48212
+ $[1] = overrides;
48213
+ $[2] = passedOnEnd;
48214
+ } else {
48215
+ overrides = $[1];
48216
+ passedOnEnd = $[2];
48217
+ }
47744
48218
  var addToast = useToasts().addToast;
47745
48219
  var queryClient = useQueryClient6();
47746
48220
  var threadContext = useSuperinterfaceContext();
47747
48221
  var t1;
47748
- if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
48222
+ if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
47749
48223
  t1 = {
47750
48224
  name: "microphone"
47751
48225
  };
47752
- $[0] = t1;
48226
+ $[3] = t1;
47753
48227
  } else {
47754
- t1 = $[0];
48228
+ t1 = $[3];
47755
48229
  }
47756
48230
  var microphonePermission = usePermission(t1);
47757
48231
  var createMessageProps = useCreateMessage({
@@ -47765,7 +48239,7 @@ var useTtsAudioRuntime = function(t0) {
47765
48239
  }
47766
48240
  });
47767
48241
  var t2;
47768
- if ($[1] !== createMessageProps) {
48242
+ if ($[4] !== createMessageProps) {
47769
48243
  t2 = {
47770
48244
  isStopOnSilence: true,
47771
48245
  onStart: _temp10,
@@ -47799,10 +48273,10 @@ var useTtsAudioRuntime = function(t0) {
47799
48273
  return onStop;
47800
48274
  }()
47801
48275
  };
47802
- $[1] = createMessageProps;
47803
- $[2] = t2;
48276
+ $[4] = createMessageProps;
48277
+ $[5] = t2;
47804
48278
  } else {
47805
- t2 = $[2];
48279
+ t2 = $[5];
47806
48280
  }
47807
48281
  var recorderProps = useRecorder(t2);
47808
48282
  recorderProps;
@@ -47812,39 +48286,38 @@ var useTtsAudioRuntime = function(t0) {
47812
48286
  t3 = passedOnEnd;
47813
48287
  break bb0;
47814
48288
  }
47815
- var _t;
47816
- if ($[3] !== microphonePermission || $[4] !== recorderProps) {
47817
- _t = function() {
48289
+ var _t2;
48290
+ if ($[6] !== microphonePermission || $[7] !== recorderProps) {
48291
+ _t2 = function() {
47818
48292
  if (microphonePermission === "granted") {
47819
48293
  recorderProps.start();
47820
48294
  }
47821
48295
  };
47822
- $[3] = microphonePermission;
47823
- $[4] = recorderProps;
47824
- $[5] = _t;
48296
+ $[6] = microphonePermission;
48297
+ $[7] = recorderProps;
48298
+ $[8] = _t2;
47825
48299
  } else {
47826
- _t = $[5];
48300
+ _t2 = $[8];
47827
48301
  }
47828
- t3 = _t;
48302
+ t3 = _t2;
47829
48303
  }
47830
48304
  var onEnd = t3;
47831
48305
  var t4;
47832
- if ($[6] !== onEnd || $[7] !== play) {
47833
- t4 = {
47834
- play: play,
48306
+ if ($[9] !== onEnd || $[10] !== overrides) {
48307
+ t4 = _objectSpread49({
47835
48308
  onEnd: onEnd
47836
- };
47837
- $[6] = onEnd;
47838
- $[7] = play;
47839
- $[8] = t4;
48309
+ }, overrides);
48310
+ $[9] = onEnd;
48311
+ $[10] = overrides;
48312
+ $[11] = t4;
47840
48313
  } else {
47841
- t4 = $[8];
48314
+ t4 = $[11];
47842
48315
  }
47843
48316
  var messageAudioProps = useMessageAudio(t4);
47844
48317
  recorderProps;
47845
48318
  var t5;
47846
48319
  var t6;
47847
- if ($[9] !== createMessageProps.isPending || $[10] !== recorderProps.pause || $[11] !== recorderProps.resume || $[12] !== recorderProps.start || $[13] !== recorderProps.status || $[14] !== recorderProps.stop || $[15] !== recorderProps.visualizationAnalyser) {
48320
+ if ($[12] !== createMessageProps.isPending || $[13] !== recorderProps.pause || $[14] !== recorderProps.resume || $[15] !== recorderProps.start || $[16] !== recorderProps.status || $[17] !== recorderProps.stop || $[18] !== recorderProps.visualizationAnalyser) {
47848
48321
  t6 = {
47849
48322
  start: recorderProps.start,
47850
48323
  stop: recorderProps.stop,
@@ -47854,19 +48327,19 @@ var useTtsAudioRuntime = function(t0) {
47854
48327
  visualizationAnalyser: recorderProps.visualizationAnalyser,
47855
48328
  rawStatus: recorderProps.status
47856
48329
  };
47857
- $[9] = createMessageProps.isPending;
47858
- $[10] = recorderProps.pause;
47859
- $[11] = recorderProps.resume;
47860
- $[12] = recorderProps.start;
47861
- $[13] = recorderProps.status;
47862
- $[14] = recorderProps.stop;
47863
- $[15] = recorderProps.visualizationAnalyser;
47864
- $[16] = t6;
48330
+ $[12] = createMessageProps.isPending;
48331
+ $[13] = recorderProps.pause;
48332
+ $[14] = recorderProps.resume;
48333
+ $[15] = recorderProps.start;
48334
+ $[16] = recorderProps.status;
48335
+ $[17] = recorderProps.stop;
48336
+ $[18] = recorderProps.visualizationAnalyser;
48337
+ $[19] = t6;
47865
48338
  } else {
47866
- t6 = $[16];
48339
+ t6 = $[19];
47867
48340
  }
47868
48341
  var t7;
47869
- if ($[17] !== messageAudioProps.isAudioPlayed || $[18] !== messageAudioProps.isPending || $[19] !== messageAudioProps.isReady || $[20] !== messageAudioProps.pause || $[21] !== messageAudioProps.paused || $[22] !== messageAudioProps.play || $[23] !== messageAudioProps.playing || $[24] !== messageAudioProps.stop || $[25] !== messageAudioProps.visualizationAnalyser) {
48342
+ if ($[20] !== messageAudioProps.isAudioPlayed || $[21] !== messageAudioProps.isPending || $[22] !== messageAudioProps.isReady || $[23] !== messageAudioProps.pause || $[24] !== messageAudioProps.paused || $[25] !== messageAudioProps.play || $[26] !== messageAudioProps.playing || $[27] !== messageAudioProps.stop || $[28] !== messageAudioProps.visualizationAnalyser) {
47870
48343
  t7 = {
47871
48344
  play: messageAudioProps.play,
47872
48345
  pause: messageAudioProps.pause,
@@ -47879,32 +48352,32 @@ var useTtsAudioRuntime = function(t0) {
47879
48352
  isAudioPlayed: messageAudioProps.isAudioPlayed,
47880
48353
  rawStatus: void 0
47881
48354
  };
47882
- $[17] = messageAudioProps.isAudioPlayed;
47883
- $[18] = messageAudioProps.isPending;
47884
- $[19] = messageAudioProps.isReady;
47885
- $[20] = messageAudioProps.pause;
47886
- $[21] = messageAudioProps.paused;
47887
- $[22] = messageAudioProps.play;
47888
- $[23] = messageAudioProps.playing;
47889
- $[24] = messageAudioProps.stop;
47890
- $[25] = messageAudioProps.visualizationAnalyser;
47891
- $[26] = t7;
47892
- } else {
47893
- t7 = $[26];
48355
+ $[20] = messageAudioProps.isAudioPlayed;
48356
+ $[21] = messageAudioProps.isPending;
48357
+ $[22] = messageAudioProps.isReady;
48358
+ $[23] = messageAudioProps.pause;
48359
+ $[24] = messageAudioProps.paused;
48360
+ $[25] = messageAudioProps.play;
48361
+ $[26] = messageAudioProps.playing;
48362
+ $[27] = messageAudioProps.stop;
48363
+ $[28] = messageAudioProps.visualizationAnalyser;
48364
+ $[29] = t7;
48365
+ } else {
48366
+ t7 = $[29];
47894
48367
  }
47895
48368
  var t8;
47896
- if ($[27] !== t6 || $[28] !== t7) {
48369
+ if ($[30] !== t6 || $[31] !== t7) {
47897
48370
  t8 = {
47898
48371
  ttsAudioRuntime: {
47899
48372
  user: t6,
47900
48373
  assistant: t7
47901
48374
  }
47902
48375
  };
47903
- $[27] = t6;
47904
- $[28] = t7;
47905
- $[29] = t8;
48376
+ $[30] = t6;
48377
+ $[31] = t7;
48378
+ $[32] = t8;
47906
48379
  } else {
47907
- t8 = $[29];
48380
+ t8 = $[32];
47908
48381
  }
47909
48382
  t5 = t8;
47910
48383
  return t5;
@@ -47924,49 +48397,130 @@ function _temp25() {
47924
48397
  }
47925
48398
  // src/components/audioRuntimes/TtsAudioRuntimeProvider.tsx
47926
48399
  import { jsx as _jsx87 } from "react/jsx-runtime";
48400
+ var _excluded6 = [
48401
+ "children",
48402
+ "onEnd"
48403
+ ];
48404
+ function ownKeys50(e, r) {
48405
+ var t = Object.keys(e);
48406
+ if (Object.getOwnPropertySymbols) {
48407
+ var o = Object.getOwnPropertySymbols(e);
48408
+ r && (o = o.filter(function(r2) {
48409
+ return Object.getOwnPropertyDescriptor(e, r2).enumerable;
48410
+ })), t.push.apply(t, o);
48411
+ }
48412
+ return t;
48413
+ }
48414
+ function _objectSpread50(e) {
48415
+ for(var r = 1; r < arguments.length; r++){
48416
+ var t = null != arguments[r] ? arguments[r] : {};
48417
+ r % 2 ? ownKeys50(Object(t), true).forEach(function(r2) {
48418
+ _defineProperty50(e, r2, t[r2]);
48419
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys50(Object(t)).forEach(function(r2) {
48420
+ Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2));
48421
+ });
48422
+ }
48423
+ return e;
48424
+ }
48425
+ function _defineProperty50(e, r, t) {
48426
+ return (r = _toPropertyKey50(r)) in e ? Object.defineProperty(e, r, {
48427
+ value: t,
48428
+ enumerable: true,
48429
+ configurable: true,
48430
+ writable: true
48431
+ }) : e[r] = t, e;
48432
+ }
48433
+ function _toPropertyKey50(t) {
48434
+ var i = _toPrimitive50(t, "string");
48435
+ return "symbol" == (typeof i === "undefined" ? "undefined" : _type_of(i)) ? i : i + "";
48436
+ }
48437
+ function _toPrimitive50(t, r) {
48438
+ if ("object" != (typeof t === "undefined" ? "undefined" : _type_of(t)) || !t) return t;
48439
+ var e = t[Symbol.toPrimitive];
48440
+ if (void 0 !== e) {
48441
+ var i = e.call(t, r || "default");
48442
+ if ("object" != (typeof i === "undefined" ? "undefined" : _type_of(i))) return i;
48443
+ throw new TypeError("@@toPrimitive must return a primitive value.");
48444
+ }
48445
+ return ("string" === r ? String : Number)(t);
48446
+ }
48447
+ function _objectWithoutProperties6(e, t) {
48448
+ if (null == e) return {};
48449
+ var o, r, i = _objectWithoutPropertiesLoose6(e, t);
48450
+ if (Object.getOwnPropertySymbols) {
48451
+ var n = Object.getOwnPropertySymbols(e);
48452
+ for(r = 0; r < n.length; r++)o = n[r], -1 === t.indexOf(o) && ({}).propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
48453
+ }
48454
+ return i;
48455
+ }
48456
+ function _objectWithoutPropertiesLoose6(r, e) {
48457
+ if (null == r) return {};
48458
+ var t = {};
48459
+ for(var n in r)if (({}).hasOwnProperty.call(r, n)) {
48460
+ if (-1 !== e.indexOf(n)) continue;
48461
+ t[n] = r[n];
48462
+ }
48463
+ return t;
48464
+ }
47927
48465
  var TtsAudioRuntimeProvider = function(t0) {
47928
- var $ = _c90(8);
47929
- var children = t0.children, play = t0.play, onEnd = t0.onEnd;
48466
+ var $ = _c90(12);
48467
+ var children;
48468
+ var onEnd;
48469
+ var overrides;
48470
+ if ($[0] !== t0) {
48471
+ var _t = t0;
48472
+ var ref;
48473
+ ref = _t, children = ref.children, onEnd = ref.onEnd, ref;
48474
+ overrides = _objectWithoutProperties6(_t, _excluded6);
48475
+ _t;
48476
+ $[0] = t0;
48477
+ $[1] = children;
48478
+ $[2] = onEnd;
48479
+ $[3] = overrides;
48480
+ } else {
48481
+ children = $[1];
48482
+ onEnd = $[2];
48483
+ overrides = $[3];
48484
+ }
47930
48485
  var t1;
47931
- if ($[0] !== onEnd || $[1] !== play) {
47932
- t1 = {
47933
- play: play,
48486
+ if ($[4] !== onEnd || $[5] !== overrides) {
48487
+ t1 = _objectSpread50({
47934
48488
  onEnd: onEnd
47935
- };
47936
- $[0] = onEnd;
47937
- $[1] = play;
47938
- $[2] = t1;
48489
+ }, overrides);
48490
+ $[4] = onEnd;
48491
+ $[5] = overrides;
48492
+ $[6] = t1;
47939
48493
  } else {
47940
- t1 = $[2];
48494
+ t1 = $[6];
47941
48495
  }
47942
48496
  var ttsAudioRuntime = useTtsAudioRuntime(t1).ttsAudioRuntime;
47943
48497
  var t2;
47944
- if ($[3] !== ttsAudioRuntime) {
48498
+ if ($[7] !== ttsAudioRuntime) {
47945
48499
  t2 = {
47946
48500
  audioRuntime: ttsAudioRuntime
47947
48501
  };
47948
- $[3] = ttsAudioRuntime;
47949
- $[4] = t2;
48502
+ $[7] = ttsAudioRuntime;
48503
+ $[8] = t2;
47950
48504
  } else {
47951
- t2 = $[4];
48505
+ t2 = $[8];
47952
48506
  }
47953
48507
  var t3;
47954
- if ($[5] !== children || $[6] !== t2) {
48508
+ if ($[9] !== children || $[10] !== t2) {
47955
48509
  t3 = /* @__PURE__ */ _jsx87(AudioThreadContext.Provider, {
47956
48510
  value: t2,
47957
48511
  children: children
47958
48512
  });
47959
- $[5] = children;
47960
- $[6] = t2;
47961
- $[7] = t3;
48513
+ $[9] = children;
48514
+ $[10] = t2;
48515
+ $[11] = t3;
47962
48516
  } else {
47963
- t3 = $[7];
48517
+ t3 = $[11];
47964
48518
  }
47965
48519
  return t3;
47966
48520
  };
47967
48521
  // src/components/threads/AudioThread/Root/index.tsx
47968
48522
  import { jsx as _jsx88 } from "react/jsx-runtime";
47969
- var _excluded5 = [
48523
+ var _excluded7 = [
47970
48524
  "children"
47971
48525
  ];
47972
48526
  var _excluded22 = [
@@ -47976,7 +48530,7 @@ var _excluded22 = [
47976
48530
  "className",
47977
48531
  "style"
47978
48532
  ];
47979
- function ownKeys48(e, r) {
48533
+ function ownKeys51(e, r) {
47980
48534
  var t = Object.keys(e);
47981
48535
  if (Object.getOwnPropertySymbols) {
47982
48536
  var o = Object.getOwnPropertySymbols(e);
@@ -47986,30 +48540,30 @@ function ownKeys48(e, r) {
47986
48540
  }
47987
48541
  return t;
47988
48542
  }
47989
- function _objectSpread48(e) {
48543
+ function _objectSpread51(e) {
47990
48544
  for(var r = 1; r < arguments.length; r++){
47991
48545
  var t = null != arguments[r] ? arguments[r] : {};
47992
- r % 2 ? ownKeys48(Object(t), true).forEach(function(r2) {
47993
- _defineProperty48(e, r2, t[r2]);
47994
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys48(Object(t)).forEach(function(r2) {
48546
+ r % 2 ? ownKeys51(Object(t), true).forEach(function(r2) {
48547
+ _defineProperty51(e, r2, t[r2]);
48548
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys51(Object(t)).forEach(function(r2) {
47995
48549
  Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2));
47996
48550
  });
47997
48551
  }
47998
48552
  return e;
47999
48553
  }
48000
- function _defineProperty48(e, r, t) {
48001
- return (r = _toPropertyKey48(r)) in e ? Object.defineProperty(e, r, {
48554
+ function _defineProperty51(e, r, t) {
48555
+ return (r = _toPropertyKey51(r)) in e ? Object.defineProperty(e, r, {
48002
48556
  value: t,
48003
48557
  enumerable: true,
48004
48558
  configurable: true,
48005
48559
  writable: true
48006
48560
  }) : e[r] = t, e;
48007
48561
  }
48008
- function _toPropertyKey48(t) {
48009
- var i = _toPrimitive48(t, "string");
48562
+ function _toPropertyKey51(t) {
48563
+ var i = _toPrimitive51(t, "string");
48010
48564
  return "symbol" == (typeof i === "undefined" ? "undefined" : _type_of(i)) ? i : i + "";
48011
48565
  }
48012
- function _toPrimitive48(t, r) {
48566
+ function _toPrimitive51(t, r) {
48013
48567
  if ("object" != (typeof t === "undefined" ? "undefined" : _type_of(t)) || !t) return t;
48014
48568
  var e = t[Symbol.toPrimitive];
48015
48569
  if (void 0 !== e) {
@@ -48019,16 +48573,16 @@ function _toPrimitive48(t, r) {
48019
48573
  }
48020
48574
  return ("string" === r ? String : Number)(t);
48021
48575
  }
48022
- function _objectWithoutProperties5(e, t) {
48576
+ function _objectWithoutProperties7(e, t) {
48023
48577
  if (null == e) return {};
48024
- var o, r, i = _objectWithoutPropertiesLoose5(e, t);
48578
+ var o, r, i = _objectWithoutPropertiesLoose7(e, t);
48025
48579
  if (Object.getOwnPropertySymbols) {
48026
48580
  var n = Object.getOwnPropertySymbols(e);
48027
48581
  for(r = 0; r < n.length; r++)o = n[r], -1 === t.indexOf(o) && ({}).propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
48028
48582
  }
48029
48583
  return i;
48030
48584
  }
48031
- function _objectWithoutPropertiesLoose5(r, e) {
48585
+ function _objectWithoutPropertiesLoose7(r, e) {
48032
48586
  if (null == r) return {};
48033
48587
  var t = {};
48034
48588
  for(var n in r)if (({}).hasOwnProperty.call(r, n)) {
@@ -48061,7 +48615,7 @@ var Content9 = function(t0) {
48061
48615
  };
48062
48616
  var AudioRuntimeProvider = function(t0) {
48063
48617
  var $ = _c91(4);
48064
- var children = t0.children, play = t0.play, onEnd = t0.onEnd;
48618
+ var children = t0.children, onEnd = t0.onEnd, play = t0.play;
48065
48619
  var audioThreadContext = useAudioThreadContext();
48066
48620
  if (audioThreadContext.audioRuntime) {
48067
48621
  return children;
@@ -48069,8 +48623,8 @@ var AudioRuntimeProvider = function(t0) {
48069
48623
  var t1;
48070
48624
  if ($[0] !== children || $[1] !== onEnd || $[2] !== play) {
48071
48625
  t1 = /* @__PURE__ */ _jsx88(TtsAudioRuntimeProvider, {
48072
- play: play,
48073
48626
  onEnd: onEnd,
48627
+ play: play,
48074
48628
  children: children
48075
48629
  });
48076
48630
  $[0] = children;
@@ -48089,7 +48643,7 @@ var Provider5 = function(t0) {
48089
48643
  if ($[0] !== t0) {
48090
48644
  var _t = t0;
48091
48645
  children = _t.children;
48092
- rest = _objectWithoutProperties5(_t, _excluded5);
48646
+ rest = _objectWithoutProperties7(_t, _excluded7);
48093
48647
  _t;
48094
48648
  $[0] = t0;
48095
48649
  $[1] = children;
@@ -48101,7 +48655,7 @@ var Provider5 = function(t0) {
48101
48655
  var audioThreadContext = useAudioThreadContext();
48102
48656
  var t1;
48103
48657
  if ($[3] !== audioThreadContext || $[4] !== rest) {
48104
- t1 = _objectSpread48(_objectSpread48({}, audioThreadContext), rest);
48658
+ t1 = _objectSpread51(_objectSpread51({}, audioThreadContext), rest);
48105
48659
  $[3] = audioThreadContext;
48106
48660
  $[4] = rest;
48107
48661
  $[5] = t1;
@@ -48134,7 +48688,7 @@ var Root16 = function(t0) {
48134
48688
  var _t2 = t0;
48135
48689
  var ref;
48136
48690
  ref = _t2, children = ref.children, play = ref.play, onEnd = ref.onEnd, className = ref.className, style = ref.style, ref;
48137
- rest = _objectWithoutProperties5(_t2, _excluded22);
48691
+ rest = _objectWithoutProperties7(_t2, _excluded22);
48138
48692
  _t2;
48139
48693
  $[0] = t0;
48140
48694
  $[1] = children;
@@ -48170,8 +48724,8 @@ var Root16 = function(t0) {
48170
48724
  var t2;
48171
48725
  if ($[11] !== onEnd || $[12] !== play || $[13] !== t1) {
48172
48726
  t2 = /* @__PURE__ */ _jsx88(AudioRuntimeProvider, {
48173
- play: play,
48174
48727
  onEnd: onEnd,
48728
+ play: play,
48175
48729
  children: t1
48176
48730
  });
48177
48731
  $[11] = onEnd;
@@ -48183,7 +48737,7 @@ var Root16 = function(t0) {
48183
48737
  }
48184
48738
  var t3;
48185
48739
  if ($[15] !== rest || $[16] !== t2) {
48186
- t3 = /* @__PURE__ */ _jsx88(Provider5, _objectSpread48(_objectSpread48({}, rest), {}, {
48740
+ t3 = /* @__PURE__ */ _jsx88(Provider5, _objectSpread51(_objectSpread51({}, rest), {}, {
48187
48741
  children: t2
48188
48742
  }));
48189
48743
  $[15] = rest;
@@ -48196,20 +48750,20 @@ var Root16 = function(t0) {
48196
48750
  };
48197
48751
  // src/components/threads/AudioThread/Visualization/index.tsx
48198
48752
  import { c as _c93 } from "react-compiler-runtime";
48199
- import { useState as useState11, useCallback as useCallback9, useEffect as useEffect12, useContext as useContext20, createContext as createContext14 } from "react";
48753
+ import { useState as useState12, useCallback as useCallback10, useEffect as useEffect13, useContext as useContext20, createContext as createContext14 } from "react";
48200
48754
  import _9 from "lodash";
48201
48755
  import { Flex as Flex31 } from "@radix-ui/themes";
48202
48756
  // src/components/threads/AudioThread/BarsVisualizer/index.tsx
48203
48757
  import _8 from "lodash";
48204
48758
  import { Flex as Flex30, Grid } from "@radix-ui/themes";
48205
- import { useState as useState10, useEffect as useEffect11, useCallback as useCallback8 } from "react";
48759
+ import { useState as useState11, useEffect as useEffect12, useCallback as useCallback9 } from "react";
48206
48760
  import { cluster } from "radash";
48207
48761
  import { jsx as _jsx89 } from "react/jsx-runtime";
48208
48762
  var barCount = 4;
48209
48763
  var BarsVisualizer = function(_ref) {
48210
48764
  var visualizationAnalyser = _ref.visualizationAnalyser, backgroundColor = _ref.backgroundColor, height = _ref.height, barWidth = _ref.barWidth;
48211
- var _useState10 = _sliced_to_array(useState10([]), 2), barHeights = _useState10[0], setBarHeights = _useState10[1];
48212
- var draw = useCallback8(function(_ref2) {
48765
+ var _useState11 = _sliced_to_array(useState11([]), 2), barHeights = _useState11[0], setBarHeights = _useState11[1];
48766
+ var draw = useCallback9(function(_ref2) {
48213
48767
  var visualizationAnalyser_0 = _ref2.visualizationAnalyser;
48214
48768
  if (!visualizationAnalyser_0) {
48215
48769
  setBarHeights(Array(barCount).fill(0));
@@ -48227,7 +48781,7 @@ var BarsVisualizer = function(_ref) {
48227
48781
  });
48228
48782
  });
48229
48783
  }, []);
48230
- useEffect11(function() {
48784
+ useEffect12(function() {
48231
48785
  draw({
48232
48786
  visualizationAnalyser: visualizationAnalyser
48233
48787
  });
@@ -48265,7 +48819,7 @@ var BarsVisualizer = function(_ref) {
48265
48819
  };
48266
48820
  // src/hooks/audioThreads/useStatus/index.ts
48267
48821
  import { c as _c92 } from "react-compiler-runtime";
48268
- import { useMemo as useMemo19 } from "react";
48822
+ import { useMemo as useMemo20 } from "react";
48269
48823
  var useStatus = function() {
48270
48824
  var $ = _c92(2);
48271
48825
  var audioRuntime = useAudioThreadContext().audioRuntime;
@@ -48316,7 +48870,7 @@ var useStatus = function() {
48316
48870
  };
48317
48871
  // src/components/threads/AudioThread/Visualization/index.tsx
48318
48872
  import { jsx as _jsx90, jsxs as _jsxs31 } from "react/jsx-runtime";
48319
- var _excluded6 = [
48873
+ var _excluded8 = [
48320
48874
  "children"
48321
48875
  ];
48322
48876
  var _excluded23 = [
@@ -48328,7 +48882,7 @@ var _excluded32 = [
48328
48882
  "height",
48329
48883
  "width"
48330
48884
  ];
48331
- function ownKeys49(e, r) {
48885
+ function ownKeys52(e, r) {
48332
48886
  var t = Object.keys(e);
48333
48887
  if (Object.getOwnPropertySymbols) {
48334
48888
  var o = Object.getOwnPropertySymbols(e);
@@ -48338,30 +48892,30 @@ function ownKeys49(e, r) {
48338
48892
  }
48339
48893
  return t;
48340
48894
  }
48341
- function _objectSpread49(e) {
48895
+ function _objectSpread52(e) {
48342
48896
  for(var r = 1; r < arguments.length; r++){
48343
48897
  var t = null != arguments[r] ? arguments[r] : {};
48344
- r % 2 ? ownKeys49(Object(t), true).forEach(function(r2) {
48345
- _defineProperty49(e, r2, t[r2]);
48346
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys49(Object(t)).forEach(function(r2) {
48898
+ r % 2 ? ownKeys52(Object(t), true).forEach(function(r2) {
48899
+ _defineProperty52(e, r2, t[r2]);
48900
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys52(Object(t)).forEach(function(r2) {
48347
48901
  Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2));
48348
48902
  });
48349
48903
  }
48350
48904
  return e;
48351
48905
  }
48352
- function _defineProperty49(e, r, t) {
48353
- return (r = _toPropertyKey49(r)) in e ? Object.defineProperty(e, r, {
48906
+ function _defineProperty52(e, r, t) {
48907
+ return (r = _toPropertyKey52(r)) in e ? Object.defineProperty(e, r, {
48354
48908
  value: t,
48355
48909
  enumerable: true,
48356
48910
  configurable: true,
48357
48911
  writable: true
48358
48912
  }) : e[r] = t, e;
48359
48913
  }
48360
- function _toPropertyKey49(t) {
48361
- var i = _toPrimitive49(t, "string");
48914
+ function _toPropertyKey52(t) {
48915
+ var i = _toPrimitive52(t, "string");
48362
48916
  return "symbol" == (typeof i === "undefined" ? "undefined" : _type_of(i)) ? i : i + "";
48363
48917
  }
48364
- function _toPrimitive49(t, r) {
48918
+ function _toPrimitive52(t, r) {
48365
48919
  if ("object" != (typeof t === "undefined" ? "undefined" : _type_of(t)) || !t) return t;
48366
48920
  var e = t[Symbol.toPrimitive];
48367
48921
  if (void 0 !== e) {
@@ -48371,16 +48925,16 @@ function _toPrimitive49(t, r) {
48371
48925
  }
48372
48926
  return ("string" === r ? String : Number)(t);
48373
48927
  }
48374
- function _objectWithoutProperties6(e, t) {
48928
+ function _objectWithoutProperties8(e, t) {
48375
48929
  if (null == e) return {};
48376
- var o, r, i = _objectWithoutPropertiesLoose6(e, t);
48930
+ var o, r, i = _objectWithoutPropertiesLoose8(e, t);
48377
48931
  if (Object.getOwnPropertySymbols) {
48378
48932
  var n = Object.getOwnPropertySymbols(e);
48379
48933
  for(r = 0; r < n.length; r++)o = n[r], -1 === t.indexOf(o) && ({}).propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
48380
48934
  }
48381
48935
  return i;
48382
48936
  }
48383
- function _objectWithoutPropertiesLoose6(r, e) {
48937
+ function _objectWithoutPropertiesLoose8(r, e) {
48384
48938
  if (null == r) return {};
48385
48939
  var t = {};
48386
48940
  for(var n in r)if (({}).hasOwnProperty.call(r, n)) {
@@ -48395,8 +48949,8 @@ var AudioThreadVisualizationContext = /* @__PURE__ */ createContext14({
48395
48949
  var Provider6 = function(_ref) {
48396
48950
  var children = _ref.children;
48397
48951
  var audioThreadContext = useAudioThreadContext();
48398
- var _useState11 = _sliced_to_array(useState11(0), 2), scale = _useState11[0], setScale = _useState11[1];
48399
- var draw = useCallback9(function(_ref2) {
48952
+ var _useState12 = _sliced_to_array(useState12(0), 2), scale = _useState12[0], setScale = _useState12[1];
48953
+ var draw = useCallback10(function(_ref2) {
48400
48954
  var visualizationAnalyser = _ref2.visualizationAnalyser;
48401
48955
  if (!visualizationAnalyser) {
48402
48956
  setScale(1);
@@ -48411,7 +48965,7 @@ var Provider6 = function(_ref) {
48411
48965
  });
48412
48966
  });
48413
48967
  }, []);
48414
- useEffect12(function() {
48968
+ useEffect13(function() {
48415
48969
  draw({
48416
48970
  visualizationAnalyser: audioThreadContext.audioRuntime.user.visualizationAnalyser
48417
48971
  });
@@ -48433,7 +48987,7 @@ var Root17 = function(t0) {
48433
48987
  if ($[0] !== t0) {
48434
48988
  var _t = t0;
48435
48989
  children = _t.children;
48436
- rest = _objectWithoutProperties6(_t, _excluded6);
48990
+ rest = _objectWithoutProperties8(_t, _excluded8);
48437
48991
  _t;
48438
48992
  $[0] = t0;
48439
48993
  $[1] = children;
@@ -48445,7 +48999,7 @@ var Root17 = function(t0) {
48445
48999
  var t1;
48446
49000
  if ($[3] !== children || $[4] !== rest) {
48447
49001
  t1 = /* @__PURE__ */ _jsx90(Provider6, {
48448
- children: /* @__PURE__ */ _jsx90(Flex31, _objectSpread49(_objectSpread49({
49002
+ children: /* @__PURE__ */ _jsx90(Flex31, _objectSpread52(_objectSpread52({
48449
49003
  direction: "column",
48450
49004
  align: "center",
48451
49005
  justify: "center",
@@ -48472,7 +49026,7 @@ var BarsVisualizer2 = function(t0) {
48472
49026
  var _t2 = t0;
48473
49027
  var ref;
48474
49028
  ref = _t2, t1 = ref.height, t2 = ref.barWidth, ref;
48475
- rest = _objectWithoutProperties6(_t2, _excluded23);
49029
+ rest = _objectWithoutProperties8(_t2, _excluded23);
48476
49030
  _t2;
48477
49031
  $[0] = t0;
48478
49032
  $[1] = rest;
@@ -48490,7 +49044,7 @@ var BarsVisualizer2 = function(t0) {
48490
49044
  var t3 = status === "playing" ? "var(--accent-11)" : "var(--gray-11)";
48491
49045
  var t4;
48492
49046
  if ($[4] !== audioThreadContext.audioRuntime.assistant.visualizationAnalyser || $[5] !== barWidth || $[6] !== height || $[7] !== rest || $[8] !== t3) {
48493
- t4 = /* @__PURE__ */ _jsx90(BarsVisualizer, _objectSpread49({
49047
+ t4 = /* @__PURE__ */ _jsx90(BarsVisualizer, _objectSpread52({
48494
49048
  visualizationAnalyser: audioThreadContext.audioRuntime.assistant.visualizationAnalyser,
48495
49049
  backgroundColor: t3,
48496
49050
  height: height,
@@ -48517,7 +49071,7 @@ var AssistantVisualizationRoot = function(t0) {
48517
49071
  var _t3 = t0;
48518
49072
  var ref;
48519
49073
  ref = _t3, children = ref.children, t1 = ref.height, t2 = ref.width, ref;
48520
- rest = _objectWithoutProperties6(_t3, _excluded32);
49074
+ rest = _objectWithoutProperties8(_t3, _excluded32);
48521
49075
  _t3;
48522
49076
  $[0] = t0;
48523
49077
  $[1] = children;
@@ -48546,7 +49100,7 @@ var AssistantVisualizationRoot = function(t0) {
48546
49100
  }
48547
49101
  var t5;
48548
49102
  if ($[7] !== scale || $[8] !== t3 || $[9] !== t4) {
48549
- t5 = _objectSpread49({
49103
+ t5 = _objectSpread52({
48550
49104
  backgroundColor: t3,
48551
49105
  borderRadius: "9999px",
48552
49106
  scale: scale
@@ -48560,7 +49114,7 @@ var AssistantVisualizationRoot = function(t0) {
48560
49114
  }
48561
49115
  var t6;
48562
49116
  if ($[11] !== children || $[12] !== height || $[13] !== rest || $[14] !== t5 || $[15] !== width2) {
48563
- t6 = /* @__PURE__ */ _jsx90(Flex31, _objectSpread49(_objectSpread49({
49117
+ t6 = /* @__PURE__ */ _jsx90(Flex31, _objectSpread52(_objectSpread52({
48564
49118
  align: "center",
48565
49119
  justify: "center",
48566
49120
  height: height,
@@ -48591,7 +49145,7 @@ var AssistantVisualization = function(props) {
48591
49145
  }
48592
49146
  var t1;
48593
49147
  if ($[1] !== props) {
48594
- t1 = /* @__PURE__ */ _jsx90(AssistantVisualizationRoot, _objectSpread49(_objectSpread49({}, props), {}, {
49148
+ t1 = /* @__PURE__ */ _jsx90(AssistantVisualizationRoot, _objectSpread52(_objectSpread52({}, props), {}, {
48595
49149
  children: t0
48596
49150
  }));
48597
49151
  $[1] = props;
@@ -48625,7 +49179,7 @@ var AssistantInfo = function(props) {
48625
49179
  }
48626
49180
  var t2;
48627
49181
  if ($[3] !== props || $[4] !== t1) {
48628
- t2 = /* @__PURE__ */ _jsxs31(Flex31, _objectSpread49(_objectSpread49({
49182
+ t2 = /* @__PURE__ */ _jsxs31(Flex31, _objectSpread52(_objectSpread52({
48629
49183
  ml: "-22.5px",
48630
49184
  gap: "3",
48631
49185
  pt: "5"
@@ -48658,7 +49212,7 @@ var Visualization = function(props) {
48658
49212
  }
48659
49213
  var t2;
48660
49214
  if ($[2] !== props) {
48661
- t2 = /* @__PURE__ */ _jsxs31(Root17, _objectSpread49(_objectSpread49({}, props), {}, {
49215
+ t2 = /* @__PURE__ */ _jsxs31(Root17, _objectSpread52(_objectSpread52({}, props), {}, {
48662
49216
  children: [
48663
49217
  t0,
48664
49218
  t1
@@ -48748,7 +49302,7 @@ var StatusMessages = function(t0) {
48748
49302
  };
48749
49303
  // src/components/threads/AudioThread/Status/index.tsx
48750
49304
  import { jsx as _jsx92 } from "react/jsx-runtime";
48751
- function ownKeys50(e, r) {
49305
+ function ownKeys53(e, r) {
48752
49306
  var t = Object.keys(e);
48753
49307
  if (Object.getOwnPropertySymbols) {
48754
49308
  var o = Object.getOwnPropertySymbols(e);
@@ -48758,30 +49312,30 @@ function ownKeys50(e, r) {
48758
49312
  }
48759
49313
  return t;
48760
49314
  }
48761
- function _objectSpread50(e) {
49315
+ function _objectSpread53(e) {
48762
49316
  for(var r = 1; r < arguments.length; r++){
48763
49317
  var t = null != arguments[r] ? arguments[r] : {};
48764
- r % 2 ? ownKeys50(Object(t), true).forEach(function(r2) {
48765
- _defineProperty50(e, r2, t[r2]);
48766
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys50(Object(t)).forEach(function(r2) {
49318
+ r % 2 ? ownKeys53(Object(t), true).forEach(function(r2) {
49319
+ _defineProperty53(e, r2, t[r2]);
49320
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys53(Object(t)).forEach(function(r2) {
48767
49321
  Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2));
48768
49322
  });
48769
49323
  }
48770
49324
  return e;
48771
49325
  }
48772
- function _defineProperty50(e, r, t) {
48773
- return (r = _toPropertyKey50(r)) in e ? Object.defineProperty(e, r, {
49326
+ function _defineProperty53(e, r, t) {
49327
+ return (r = _toPropertyKey53(r)) in e ? Object.defineProperty(e, r, {
48774
49328
  value: t,
48775
49329
  enumerable: true,
48776
49330
  configurable: true,
48777
49331
  writable: true
48778
49332
  }) : e[r] = t, e;
48779
49333
  }
48780
- function _toPropertyKey50(t) {
48781
- var i = _toPrimitive50(t, "string");
49334
+ function _toPropertyKey53(t) {
49335
+ var i = _toPrimitive53(t, "string");
48782
49336
  return "symbol" == (typeof i === "undefined" ? "undefined" : _type_of(i)) ? i : i + "";
48783
49337
  }
48784
- function _toPrimitive50(t, r) {
49338
+ function _toPrimitive53(t, r) {
48785
49339
  if ("object" != (typeof t === "undefined" ? "undefined" : _type_of(t)) || !t) return t;
48786
49340
  var e = t[Symbol.toPrimitive];
48787
49341
  if (void 0 !== e) {
@@ -48809,7 +49363,7 @@ var Status = function(props) {
48809
49363
  }
48810
49364
  var _t2;
48811
49365
  if ($[1] !== props) {
48812
- _t2 = /* @__PURE__ */ _jsx92(StatusMessages, _objectSpread50({
49366
+ _t2 = /* @__PURE__ */ _jsx92(StatusMessages, _objectSpread53({
48813
49367
  texts: _t
48814
49368
  }, props));
48815
49369
  $[1] = props;
@@ -48835,7 +49389,7 @@ var Status = function(props) {
48835
49389
  }
48836
49390
  var _t4;
48837
49391
  if ($[4] !== props) {
48838
- _t4 = /* @__PURE__ */ _jsx92(StatusMessages, _objectSpread50({
49392
+ _t4 = /* @__PURE__ */ _jsx92(StatusMessages, _objectSpread53({
48839
49393
  texts: _t3
48840
49394
  }, props));
48841
49395
  $[4] = props;
@@ -48857,7 +49411,7 @@ var Status = function(props) {
48857
49411
  }
48858
49412
  var _t6;
48859
49413
  if ($[7] !== props) {
48860
- _t6 = /* @__PURE__ */ _jsx92(StatusMessages, _objectSpread50({
49414
+ _t6 = /* @__PURE__ */ _jsx92(StatusMessages, _objectSpread53({
48861
49415
  texts: _t5
48862
49416
  }, props));
48863
49417
  $[7] = props;
@@ -48878,7 +49432,7 @@ var Status = function(props) {
48878
49432
  }
48879
49433
  var t1;
48880
49434
  if ($[10] !== props) {
48881
- t1 = /* @__PURE__ */ _jsx92(StatusMessages, _objectSpread50({
49435
+ t1 = /* @__PURE__ */ _jsx92(StatusMessages, _objectSpread53({
48882
49436
  texts: t0
48883
49437
  }, props));
48884
49438
  $[10] = props;
@@ -48894,7 +49448,7 @@ import { Flex as Flex34 } from "@radix-ui/themes";
48894
49448
  // src/components/threads/AudioThread/Form/MicIcon.tsx
48895
49449
  import { c as _c96 } from "react-compiler-runtime";
48896
49450
  import { jsx as _jsx93 } from "react/jsx-runtime";
48897
- function ownKeys51(e, r) {
49451
+ function ownKeys54(e, r) {
48898
49452
  var t = Object.keys(e);
48899
49453
  if (Object.getOwnPropertySymbols) {
48900
49454
  var o = Object.getOwnPropertySymbols(e);
@@ -48904,30 +49458,30 @@ function ownKeys51(e, r) {
48904
49458
  }
48905
49459
  return t;
48906
49460
  }
48907
- function _objectSpread51(e) {
49461
+ function _objectSpread54(e) {
48908
49462
  for(var r = 1; r < arguments.length; r++){
48909
49463
  var t = null != arguments[r] ? arguments[r] : {};
48910
- r % 2 ? ownKeys51(Object(t), true).forEach(function(r2) {
48911
- _defineProperty51(e, r2, t[r2]);
48912
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys51(Object(t)).forEach(function(r2) {
49464
+ r % 2 ? ownKeys54(Object(t), true).forEach(function(r2) {
49465
+ _defineProperty54(e, r2, t[r2]);
49466
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys54(Object(t)).forEach(function(r2) {
48913
49467
  Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2));
48914
49468
  });
48915
49469
  }
48916
49470
  return e;
48917
49471
  }
48918
- function _defineProperty51(e, r, t) {
48919
- return (r = _toPropertyKey51(r)) in e ? Object.defineProperty(e, r, {
49472
+ function _defineProperty54(e, r, t) {
49473
+ return (r = _toPropertyKey54(r)) in e ? Object.defineProperty(e, r, {
48920
49474
  value: t,
48921
49475
  enumerable: true,
48922
49476
  configurable: true,
48923
49477
  writable: true
48924
49478
  }) : e[r] = t, e;
48925
49479
  }
48926
- function _toPropertyKey51(t) {
48927
- var i = _toPrimitive51(t, "string");
49480
+ function _toPropertyKey54(t) {
49481
+ var i = _toPrimitive54(t, "string");
48928
49482
  return "symbol" == (typeof i === "undefined" ? "undefined" : _type_of(i)) ? i : i + "";
48929
49483
  }
48930
- function _toPrimitive51(t, r) {
49484
+ function _toPrimitive54(t, r) {
48931
49485
  if ("object" != (typeof t === "undefined" ? "undefined" : _type_of(t)) || !t) return t;
48932
49486
  var e = t[Symbol.toPrimitive];
48933
49487
  if (void 0 !== e) {
@@ -48951,7 +49505,7 @@ var MicIcon = function(props) {
48951
49505
  }
48952
49506
  var t1;
48953
49507
  if ($[1] !== props) {
48954
- t1 = /* @__PURE__ */ _jsx93("svg", _objectSpread51(_objectSpread51({
49508
+ t1 = /* @__PURE__ */ _jsx93("svg", _objectSpread54(_objectSpread54({
48955
49509
  xmlns: "http://www.w3.org/2000/svg",
48956
49510
  fill: "currentColor",
48957
49511
  stroke: "currentColor",
@@ -49169,7 +49723,7 @@ var ActionButton = function() {
49169
49723
  };
49170
49724
  // src/components/threads/AudioThread/Form/index.tsx
49171
49725
  import { jsx as _jsx95, jsxs as _jsxs34 } from "react/jsx-runtime";
49172
- function ownKeys52(e, r) {
49726
+ function ownKeys55(e, r) {
49173
49727
  var t = Object.keys(e);
49174
49728
  if (Object.getOwnPropertySymbols) {
49175
49729
  var o = Object.getOwnPropertySymbols(e);
@@ -49179,30 +49733,30 @@ function ownKeys52(e, r) {
49179
49733
  }
49180
49734
  return t;
49181
49735
  }
49182
- function _objectSpread52(e) {
49736
+ function _objectSpread55(e) {
49183
49737
  for(var r = 1; r < arguments.length; r++){
49184
49738
  var t = null != arguments[r] ? arguments[r] : {};
49185
- r % 2 ? ownKeys52(Object(t), true).forEach(function(r2) {
49186
- _defineProperty52(e, r2, t[r2]);
49187
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys52(Object(t)).forEach(function(r2) {
49739
+ r % 2 ? ownKeys55(Object(t), true).forEach(function(r2) {
49740
+ _defineProperty55(e, r2, t[r2]);
49741
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys55(Object(t)).forEach(function(r2) {
49188
49742
  Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2));
49189
49743
  });
49190
49744
  }
49191
49745
  return e;
49192
49746
  }
49193
- function _defineProperty52(e, r, t) {
49194
- return (r = _toPropertyKey52(r)) in e ? Object.defineProperty(e, r, {
49747
+ function _defineProperty55(e, r, t) {
49748
+ return (r = _toPropertyKey55(r)) in e ? Object.defineProperty(e, r, {
49195
49749
  value: t,
49196
49750
  enumerable: true,
49197
49751
  configurable: true,
49198
49752
  writable: true
49199
49753
  }) : e[r] = t, e;
49200
49754
  }
49201
- function _toPropertyKey52(t) {
49202
- var i = _toPrimitive52(t, "string");
49755
+ function _toPropertyKey55(t) {
49756
+ var i = _toPrimitive55(t, "string");
49203
49757
  return "symbol" == (typeof i === "undefined" ? "undefined" : _type_of(i)) ? i : i + "";
49204
49758
  }
49205
- function _toPrimitive52(t, r) {
49759
+ function _toPrimitive55(t, r) {
49206
49760
  if ("object" != (typeof t === "undefined" ? "undefined" : _type_of(t)) || !t) return t;
49207
49761
  var e = t[Symbol.toPrimitive];
49208
49762
  if (void 0 !== e) {
@@ -49300,7 +49854,7 @@ var Form = function(props) {
49300
49854
  }
49301
49855
  var t9;
49302
49856
  if ($[14] !== props || $[15] !== t7) {
49303
- t9 = /* @__PURE__ */ _jsxs34(Flex34, _objectSpread52(_objectSpread52({
49857
+ t9 = /* @__PURE__ */ _jsxs34(Flex34, _objectSpread55(_objectSpread55({
49304
49858
  direction: "column",
49305
49859
  align: "center"
49306
49860
  }, props), {}, {
@@ -49319,7 +49873,7 @@ var Form = function(props) {
49319
49873
  };
49320
49874
  // src/components/threads/AudioThread/index.tsx
49321
49875
  import { jsx as _jsx96, jsxs as _jsxs35 } from "react/jsx-runtime";
49322
- function ownKeys53(e, r) {
49876
+ function ownKeys56(e, r) {
49323
49877
  var t = Object.keys(e);
49324
49878
  if (Object.getOwnPropertySymbols) {
49325
49879
  var o = Object.getOwnPropertySymbols(e);
@@ -49329,30 +49883,30 @@ function ownKeys53(e, r) {
49329
49883
  }
49330
49884
  return t;
49331
49885
  }
49332
- function _objectSpread53(e) {
49886
+ function _objectSpread56(e) {
49333
49887
  for(var r = 1; r < arguments.length; r++){
49334
49888
  var t = null != arguments[r] ? arguments[r] : {};
49335
- r % 2 ? ownKeys53(Object(t), true).forEach(function(r2) {
49336
- _defineProperty53(e, r2, t[r2]);
49337
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys53(Object(t)).forEach(function(r2) {
49889
+ r % 2 ? ownKeys56(Object(t), true).forEach(function(r2) {
49890
+ _defineProperty56(e, r2, t[r2]);
49891
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys56(Object(t)).forEach(function(r2) {
49338
49892
  Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2));
49339
49893
  });
49340
49894
  }
49341
49895
  return e;
49342
49896
  }
49343
- function _defineProperty53(e, r, t) {
49344
- return (r = _toPropertyKey53(r)) in e ? Object.defineProperty(e, r, {
49897
+ function _defineProperty56(e, r, t) {
49898
+ return (r = _toPropertyKey56(r)) in e ? Object.defineProperty(e, r, {
49345
49899
  value: t,
49346
49900
  enumerable: true,
49347
49901
  configurable: true,
49348
49902
  writable: true
49349
49903
  }) : e[r] = t, e;
49350
49904
  }
49351
- function _toPropertyKey53(t) {
49352
- var i = _toPrimitive53(t, "string");
49905
+ function _toPropertyKey56(t) {
49906
+ var i = _toPrimitive56(t, "string");
49353
49907
  return "symbol" == (typeof i === "undefined" ? "undefined" : _type_of(i)) ? i : i + "";
49354
49908
  }
49355
- function _toPrimitive53(t, r) {
49909
+ function _toPrimitive56(t, r) {
49356
49910
  if ("object" != (typeof t === "undefined" ? "undefined" : _type_of(t)) || !t) return t;
49357
49911
  var e = t[Symbol.toPrimitive];
49358
49912
  if (void 0 !== e) {
@@ -49381,7 +49935,7 @@ var AudioThread = function(props) {
49381
49935
  }
49382
49936
  var t3;
49383
49937
  if ($[3] !== props) {
49384
- t3 = /* @__PURE__ */ _jsxs35(Root16, _objectSpread53(_objectSpread53({}, props), {}, {
49938
+ t3 = /* @__PURE__ */ _jsxs35(Root16, _objectSpread56(_objectSpread56({}, props), {}, {
49385
49939
  children: [
49386
49940
  t0,
49387
49941
  t1,
@@ -49401,7 +49955,7 @@ AudioThread.Status = Status;
49401
49955
  AudioThread.Form = Form;
49402
49956
  // src/components/threads/AudioThreadDialog/index.tsx
49403
49957
  import { jsx as _jsx97, jsxs as _jsxs36 } from "react/jsx-runtime";
49404
- function ownKeys54(e, r) {
49958
+ function ownKeys57(e, r) {
49405
49959
  var t = Object.keys(e);
49406
49960
  if (Object.getOwnPropertySymbols) {
49407
49961
  var o = Object.getOwnPropertySymbols(e);
@@ -49411,30 +49965,30 @@ function ownKeys54(e, r) {
49411
49965
  }
49412
49966
  return t;
49413
49967
  }
49414
- function _objectSpread54(e) {
49968
+ function _objectSpread57(e) {
49415
49969
  for(var r = 1; r < arguments.length; r++){
49416
49970
  var t = null != arguments[r] ? arguments[r] : {};
49417
- r % 2 ? ownKeys54(Object(t), true).forEach(function(r2) {
49418
- _defineProperty54(e, r2, t[r2]);
49419
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys54(Object(t)).forEach(function(r2) {
49971
+ r % 2 ? ownKeys57(Object(t), true).forEach(function(r2) {
49972
+ _defineProperty57(e, r2, t[r2]);
49973
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys57(Object(t)).forEach(function(r2) {
49420
49974
  Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2));
49421
49975
  });
49422
49976
  }
49423
49977
  return e;
49424
49978
  }
49425
- function _defineProperty54(e, r, t) {
49426
- return (r = _toPropertyKey54(r)) in e ? Object.defineProperty(e, r, {
49979
+ function _defineProperty57(e, r, t) {
49980
+ return (r = _toPropertyKey57(r)) in e ? Object.defineProperty(e, r, {
49427
49981
  value: t,
49428
49982
  enumerable: true,
49429
49983
  configurable: true,
49430
49984
  writable: true
49431
49985
  }) : e[r] = t, e;
49432
49986
  }
49433
- function _toPropertyKey54(t) {
49434
- var i = _toPrimitive54(t, "string");
49987
+ function _toPropertyKey57(t) {
49988
+ var i = _toPrimitive57(t, "string");
49435
49989
  return "symbol" == (typeof i === "undefined" ? "undefined" : _type_of(i)) ? i : i + "";
49436
49990
  }
49437
- function _toPrimitive54(t, r) {
49991
+ function _toPrimitive57(t, r) {
49438
49992
  if ("object" != (typeof t === "undefined" ? "undefined" : _type_of(t)) || !t) return t;
49439
49993
  var e = t[Symbol.toPrimitive];
49440
49994
  if (void 0 !== e) {
@@ -49461,7 +50015,7 @@ var AudioThreadDialog = function(props) {
49461
50015
  }
49462
50016
  var t2;
49463
50017
  if ($[2] !== props) {
49464
- t2 = /* @__PURE__ */ _jsxs36(Root13, _objectSpread54(_objectSpread54({}, props), {}, {
50018
+ t2 = /* @__PURE__ */ _jsxs36(Root13, _objectSpread57(_objectSpread57({}, props), {}, {
49465
50019
  children: [
49466
50020
  t0,
49467
50021
  t1
@@ -49478,7 +50032,7 @@ AudioThreadDialog.Root = Root13;
49478
50032
  AudioThreadDialog.Trigger = Trigger;
49479
50033
  AudioThreadDialog.Content = Content8;
49480
50034
  // src/hooks/audioRuntimes/useWebrtcAudioRuntime/index.ts
49481
- import { useEffect as useEffect13, useMemo as useMemo20, useRef as useRef9, useState as useState12 } from "react";
50035
+ import { useEffect as useEffect14, useMemo as useMemo21, useRef as useRef10, useState as useState13 } from "react";
49482
50036
  function asyncGeneratorStep12(n, t, e, r, o, a, c) {
49483
50037
  try {
49484
50038
  var i = n[a](c), u = i.value;
@@ -49567,22 +50121,22 @@ var useWebrtcAudioRuntime = function() {
49567
50121
  console.warn("Could not build analyzers:", err_0);
49568
50122
  }
49569
50123
  };
49570
- var _useState12 = _sliced_to_array(useState12("idle"), 2), recorderStatus = _useState12[0], setRecorderStatus = _useState12[1];
50124
+ var _useState13 = _sliced_to_array(useState13("idle"), 2), recorderStatus = _useState13[0], setRecorderStatus = _useState13[1];
49571
50125
  var superinterfaceContext = useSuperinterfaceContext();
49572
- var _useState121 = _sliced_to_array(useState12(false), 2), userIsPending = _useState121[0], setUserIsPending = _useState121[1];
49573
- var _useState122 = _sliced_to_array(useState12(false), 2), assistantPlaying = _useState122[0], setAssistantPlaying = _useState122[1];
49574
- var _useState123 = _sliced_to_array(useState12(false), 2), assistantPaused = _useState123[0], setAssistantPaused = _useState123[1];
49575
- var _useState124 = _sliced_to_array(useState12(true), 2), assistantIsPending = _useState124[0], setAssistantIsPending = _useState124[1];
49576
- var _useState125 = _sliced_to_array(useState12(false), 2), assistantIsReady = _useState125[0], setAssistantIsReady = _useState125[1];
49577
- var _useState126 = _sliced_to_array(useState12(false), 2), assistantAudioPlayed = _useState126[0], setAssistantAudioPlayed = _useState126[1];
49578
- var sessionStartedRef = useRef9(false);
49579
- var pcRef = useRef9(null);
49580
- var localStreamRef = useRef9(null);
49581
- var remoteStreamRef = useRef9(null);
49582
- var userAnalyserRef = useRef9(null);
49583
- var assistantAnalyserRef = useRef9(null);
49584
- var assistantAudioElRef = useRef9(null);
49585
- useEffect13(function() {
50126
+ var _useState131 = _sliced_to_array(useState13(false), 2), userIsPending = _useState131[0], setUserIsPending = _useState131[1];
50127
+ var _useState132 = _sliced_to_array(useState13(false), 2), assistantPlaying = _useState132[0], setAssistantPlaying = _useState132[1];
50128
+ var _useState133 = _sliced_to_array(useState13(false), 2), assistantPaused = _useState133[0], setAssistantPaused = _useState133[1];
50129
+ var _useState134 = _sliced_to_array(useState13(true), 2), assistantIsPending = _useState134[0], setAssistantIsPending = _useState134[1];
50130
+ var _useState135 = _sliced_to_array(useState13(false), 2), assistantIsReady = _useState135[0], setAssistantIsReady = _useState135[1];
50131
+ var _useState136 = _sliced_to_array(useState13(false), 2), assistantAudioPlayed = _useState136[0], setAssistantAudioPlayed = _useState136[1];
50132
+ var sessionStartedRef = useRef10(false);
50133
+ var pcRef = useRef10(null);
50134
+ var localStreamRef = useRef10(null);
50135
+ var remoteStreamRef = useRef10(null);
50136
+ var userAnalyserRef = useRef10(null);
50137
+ var assistantAnalyserRef = useRef10(null);
50138
+ var assistantAudioElRef = useRef10(null);
50139
+ useEffect14(function() {
49586
50140
  return function() {
49587
50141
  if (pcRef.current) {
49588
50142
  pcRef.current.close();
@@ -49918,7 +50472,7 @@ var useWebrtcAudioRuntime = function() {
49918
50472
  return _ref7.apply(this, arguments);
49919
50473
  };
49920
50474
  }();
49921
- return useMemo20(function() {
50475
+ return useMemo21(function() {
49922
50476
  return {
49923
50477
  webrtcAudioRuntime: {
49924
50478
  user: {
@@ -49999,11 +50553,11 @@ var WebrtcAudioRuntimeProvider = function(t0) {
49999
50553
  };
50000
50554
  // src/components/gui/Gui/index.tsx
50001
50555
  import { c as _c104 } from "react-compiler-runtime";
50002
- import { useMemo as useMemo23 } from "react";
50556
+ import { useMemo as useMemo24 } from "react";
50003
50557
  import { Flex as Flex35, Card as Card5, Spinner as Spinner3 } from "@radix-ui/themes";
50004
50558
  // src/hooks/messages/useLatestAssistantMessage/index.ts
50005
50559
  import { c as _c102 } from "react-compiler-runtime";
50006
- import { useMemo as useMemo21 } from "react";
50560
+ import { useMemo as useMemo22 } from "react";
50007
50561
  var useLatestAssistantMessage = function() {
50008
50562
  var $ = _c102(4);
50009
50563
  var _useMessages = useMessages(), messages2 = _useMessages.messages;
@@ -50036,7 +50590,7 @@ function _temp11(message) {
50036
50590
  // src/hooks/messages/useLatestAssistantMessageWithContent/index.ts
50037
50591
  import { c as _c103 } from "react-compiler-runtime";
50038
50592
  import { isEmpty as isEmpty3 } from "radash";
50039
- import { useMemo as useMemo22 } from "react";
50593
+ import { useMemo as useMemo23 } from "react";
50040
50594
  var useLatestAssistantMessageWithContent = function() {
50041
50595
  var $ = _c103(4);
50042
50596
  var _useMessages = useMessages(), messages2 = _useMessages.messages;
@@ -50257,21 +50811,21 @@ function _temp13(rs) {
50257
50811
  }
50258
50812
  // src/components/markdown/MarkdownProvider/index.tsx
50259
50813
  import { c as _c105 } from "react-compiler-runtime";
50260
- import { useMemo as useMemo24 } from "react";
50814
+ import { useMemo as useMemo25 } from "react";
50261
50815
  import { jsx as _jsx100 } from "react/jsx-runtime";
50262
- var _excluded7 = [
50816
+ var _excluded9 = [
50263
50817
  "children"
50264
50818
  ];
50265
- function _objectWithoutProperties7(e, t) {
50819
+ function _objectWithoutProperties9(e, t) {
50266
50820
  if (null == e) return {};
50267
- var o, r, i = _objectWithoutPropertiesLoose7(e, t);
50821
+ var o, r, i = _objectWithoutPropertiesLoose9(e, t);
50268
50822
  if (Object.getOwnPropertySymbols) {
50269
50823
  var n = Object.getOwnPropertySymbols(e);
50270
50824
  for(r = 0; r < n.length; r++)o = n[r], -1 === t.indexOf(o) && ({}).propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
50271
50825
  }
50272
50826
  return i;
50273
50827
  }
50274
- function _objectWithoutPropertiesLoose7(r, e) {
50828
+ function _objectWithoutPropertiesLoose9(r, e) {
50275
50829
  if (null == r) return {};
50276
50830
  var t = {};
50277
50831
  for(var n in r)if (({}).hasOwnProperty.call(r, n)) {
@@ -50287,7 +50841,7 @@ var MarkdownProvider = function(t0) {
50287
50841
  if ($[0] !== t0) {
50288
50842
  var _t = t0;
50289
50843
  children = _t.children;
50290
- rest = _objectWithoutProperties7(_t, _excluded7);
50844
+ rest = _objectWithoutProperties9(_t, _excluded9);
50291
50845
  _t;
50292
50846
  $[0] = t0;
50293
50847
  $[1] = children;
@@ -50327,7 +50881,7 @@ var MarkdownProvider = function(t0) {
50327
50881
  import { c as _c108 } from "react-compiler-runtime";
50328
50882
  // src/components/annotations/SourceAnnotation/FileCitation/index.tsx
50329
50883
  import { c as _c107 } from "react-compiler-runtime";
50330
- import { useState as useState13 } from "react";
50884
+ import { useState as useState14 } from "react";
50331
50885
  import { QuoteIcon as QuoteIcon2 } from "@radix-ui/react-icons";
50332
50886
  import { Dialog, VisuallyHidden, IconButton as IconButton11 } from "@radix-ui/themes";
50333
50887
  // src/components/annotations/SourceAnnotation/FileCitation/Content.tsx
@@ -50403,7 +50957,7 @@ import { jsx as _jsx102, jsxs as _jsxs38, Fragment as _Fragment6 } from "react/j
50403
50957
  var FileCitation = function(t0) {
50404
50958
  var $ = _c107(18);
50405
50959
  var annotation = t0.annotation;
50406
- var _useState13 = _sliced_to_array(useState13(null), 2), activeFileId = _useState13[0], setActiveFileId = _useState13[1];
50960
+ var _useState14 = _sliced_to_array(useState14(null), 2), activeFileId = _useState14[0], setActiveFileId = _useState14[1];
50407
50961
  var t1;
50408
50962
  if ($[0] !== annotation.file_citation.file_id) {
50409
50963
  t1 = function() {
@@ -50528,19 +51082,19 @@ var FileCitation = function(t0) {
50528
51082
  };
50529
51083
  // src/components/annotations/SourceAnnotation/index.tsx
50530
51084
  import { jsx as _jsx103 } from "react/jsx-runtime";
50531
- var _excluded8 = [
51085
+ var _excluded10 = [
50532
51086
  "children"
50533
51087
  ];
50534
- function _objectWithoutProperties8(e, t) {
51088
+ function _objectWithoutProperties10(e, t) {
50535
51089
  if (null == e) return {};
50536
- var o, r, i = _objectWithoutPropertiesLoose8(e, t);
51090
+ var o, r, i = _objectWithoutPropertiesLoose10(e, t);
50537
51091
  if (Object.getOwnPropertySymbols) {
50538
51092
  var n = Object.getOwnPropertySymbols(e);
50539
51093
  for(r = 0; r < n.length; r++)o = n[r], -1 === t.indexOf(o) && ({}).propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
50540
51094
  }
50541
51095
  return i;
50542
51096
  }
50543
- function _objectWithoutPropertiesLoose8(r, e) {
51097
+ function _objectWithoutPropertiesLoose10(r, e) {
50544
51098
  if (null == r) return {};
50545
51099
  var t = {};
50546
51100
  for(var n in r)if (({}).hasOwnProperty.call(r, n)) {
@@ -50556,7 +51110,7 @@ var SourceAnnotation = function(t0) {
50556
51110
  if ($[0] !== t0) {
50557
51111
  var _t = t0;
50558
51112
  children = _t.children;
50559
- rest = _objectWithoutProperties8(_t, _excluded8);
51113
+ rest = _objectWithoutProperties10(_t, _excluded10);
50560
51114
  _t;
50561
51115
  $[0] = t0;
50562
51116
  $[1] = children;
@@ -50724,7 +51278,7 @@ var ImageAvatar = function(t0) {
50724
51278
  };
50725
51279
  // src/components/iconAvatars/IconAvatar.tsx
50726
51280
  import { c as _c110 } from "react-compiler-runtime";
50727
- import { useMemo as useMemo25 } from "react";
51281
+ import { useMemo as useMemo26 } from "react";
50728
51282
  import { Avatar as Avatar5 } from "@radix-ui/themes";
50729
51283
  // src/lib/iconAvatars/iconAvatarComponents.ts
50730
51284
  import { BackpackIcon, RocketIcon, MagicWandIcon, CubeIcon, TargetIcon, DiscIcon, GlobeIcon, StarIcon, LightningBoltIcon as LightningBoltIcon2, FaceIcon, PersonIcon as PersonIcon2, HeartIcon } from "@radix-ui/react-icons";
@@ -50829,21 +51383,21 @@ var Avatar6 = function(t0) {
50829
51383
  };
50830
51384
  // src/components/components/ComponentsProvider.tsx
50831
51385
  import { c as _c112 } from "react-compiler-runtime";
50832
- import { useMemo as useMemo26 } from "react";
51386
+ import { useMemo as useMemo27 } from "react";
50833
51387
  import { jsx as _jsx107 } from "react/jsx-runtime";
50834
- var _excluded9 = [
51388
+ var _excluded11 = [
50835
51389
  "children"
50836
51390
  ];
50837
- function _objectWithoutProperties9(e, t) {
51391
+ function _objectWithoutProperties11(e, t) {
50838
51392
  if (null == e) return {};
50839
- var o, r, i = _objectWithoutPropertiesLoose9(e, t);
51393
+ var o, r, i = _objectWithoutPropertiesLoose11(e, t);
50840
51394
  if (Object.getOwnPropertySymbols) {
50841
51395
  var n = Object.getOwnPropertySymbols(e);
50842
51396
  for(r = 0; r < n.length; r++)o = n[r], -1 === t.indexOf(o) && ({}).propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
50843
51397
  }
50844
51398
  return i;
50845
51399
  }
50846
- function _objectWithoutPropertiesLoose9(r, e) {
51400
+ function _objectWithoutPropertiesLoose11(r, e) {
50847
51401
  if (null == r) return {};
50848
51402
  var t = {};
50849
51403
  for(var n in r)if (({}).hasOwnProperty.call(r, n)) {
@@ -50859,7 +51413,7 @@ var ComponentsProvider = function(t0) {
50859
51413
  if ($[0] !== t0) {
50860
51414
  var _t = t0;
50861
51415
  children = _t.children;
50862
- rest = _objectWithoutProperties9(_t, _excluded9);
51416
+ rest = _objectWithoutProperties11(_t, _excluded11);
50863
51417
  _t;
50864
51418
  $[0] = t0;
50865
51419
  $[1] = children;