@superinterface/react 3.7.2 → 3.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +184 -148
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -2
- package/dist/index.d.ts +4 -2
- package/dist/index.js +189 -153
- package/dist/index.js.map +1 -1
- package/dist/types/index.d.cts +7 -1
- package/dist/types/index.d.ts +7 -1
- package/package.json +2 -6
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { MessagesPage, ThreadStorageOptions, StyleProps, SerializedMessage, UseCreateMessageVariables, Avatar as Avatar$1, SerializedRunStep, ToolCall } from './types/index.cjs';
|
|
2
|
+
import { MessagesPage, ThreadStorageOptions, StyleProps, SerializedMessage, UseCreateMessageVariables, PlayArgs, Avatar as Avatar$1, SerializedRunStep, ToolCall } from './types/index.cjs';
|
|
3
3
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
4
4
|
import { UseInfiniteQueryOptions, InfiniteData, UseMutationOptions } from '@tanstack/react-query';
|
|
5
5
|
import * as react_hook_form from 'react-hook-form';
|
|
@@ -537,6 +537,7 @@ declare const AudioThreadDialog: {
|
|
|
537
537
|
|
|
538
538
|
type Args$5 = {
|
|
539
539
|
children: React.ReactNode;
|
|
540
|
+
play?: (args: PlayArgs) => void;
|
|
540
541
|
} & StyleProps;
|
|
541
542
|
|
|
542
543
|
type Args$4 = Omit<Args$5, 'children'>;
|
|
@@ -553,8 +554,9 @@ declare const useThreadDialogContext: () => {
|
|
|
553
554
|
setIsOpen: react.Dispatch<react.SetStateAction<boolean>>;
|
|
554
555
|
};
|
|
555
556
|
|
|
556
|
-
declare const useMessageAudio: ({ onEnd, }: {
|
|
557
|
+
declare const useMessageAudio: ({ onEnd, play: passedPlay, }: {
|
|
557
558
|
onEnd: () => void;
|
|
559
|
+
play?: (args: PlayArgs) => void;
|
|
558
560
|
}) => {
|
|
559
561
|
visualizationAnalyser: AnalyserNode | null;
|
|
560
562
|
play: () => void;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { MessagesPage, ThreadStorageOptions, StyleProps, SerializedMessage, UseCreateMessageVariables, Avatar as Avatar$1, SerializedRunStep, ToolCall } from './types/index.js';
|
|
2
|
+
import { MessagesPage, ThreadStorageOptions, StyleProps, SerializedMessage, UseCreateMessageVariables, PlayArgs, Avatar as Avatar$1, SerializedRunStep, ToolCall } from './types/index.js';
|
|
3
3
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
4
4
|
import { UseInfiniteQueryOptions, InfiniteData, UseMutationOptions } from '@tanstack/react-query';
|
|
5
5
|
import * as react_hook_form from 'react-hook-form';
|
|
@@ -537,6 +537,7 @@ declare const AudioThreadDialog: {
|
|
|
537
537
|
|
|
538
538
|
type Args$5 = {
|
|
539
539
|
children: React.ReactNode;
|
|
540
|
+
play?: (args: PlayArgs) => void;
|
|
540
541
|
} & StyleProps;
|
|
541
542
|
|
|
542
543
|
type Args$4 = Omit<Args$5, 'children'>;
|
|
@@ -553,8 +554,9 @@ declare const useThreadDialogContext: () => {
|
|
|
553
554
|
setIsOpen: react.Dispatch<react.SetStateAction<boolean>>;
|
|
554
555
|
};
|
|
555
556
|
|
|
556
|
-
declare const useMessageAudio: ({ onEnd, }: {
|
|
557
|
+
declare const useMessageAudio: ({ onEnd, play: passedPlay, }: {
|
|
557
558
|
onEnd: () => void;
|
|
559
|
+
play?: (args: PlayArgs) => void;
|
|
558
560
|
}) => {
|
|
559
561
|
visualizationAnalyser: AnalyserNode | null;
|
|
560
562
|
play: () => void;
|
package/dist/index.js
CHANGED
|
@@ -9066,7 +9066,7 @@ var useRecorder = function(_ref) {
|
|
|
9066
9066
|
};
|
|
9067
9067
|
// src/hooks/audioThreads/useMessageAudio/index.ts
|
|
9068
9068
|
import { c as _c50 } from "react-compiler-runtime";
|
|
9069
|
-
import { useMemo as useMemo18, useRef as useRef8, useState as useState9, useEffect as useEffect10 } from "react";
|
|
9069
|
+
import { useMemo as useMemo18, useRef as useRef8, useState as useState9, useEffect as useEffect10, useCallback as useCallback6 } from "react";
|
|
9070
9070
|
import nlp from "compromise";
|
|
9071
9071
|
import { Howler } from "howler";
|
|
9072
9072
|
import { useAudioPlayer as useAudioPlayer2 } from "react-use-audio-player";
|
|
@@ -9147,8 +9147,8 @@ var getMessageSentences = function(_ref) {
|
|
|
9147
9147
|
});
|
|
9148
9148
|
};
|
|
9149
9149
|
var useMessageAudio = function(t0) {
|
|
9150
|
-
var $ = _c50(
|
|
9151
|
-
var onEnd = t0.
|
|
9150
|
+
var $ = _c50(50);
|
|
9151
|
+
var _onEnd = t0.onEnd, passedPlay = t0.play;
|
|
9152
9152
|
var _useState9 = _sliced_to_array(useState9(false), 2), isAudioPlayed = _useState9[0], setIsAudioPlayed = _useState9[1];
|
|
9153
9153
|
var t1;
|
|
9154
9154
|
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
@@ -9251,8 +9251,56 @@ var useMessageAudio = function(t0) {
|
|
|
9251
9251
|
}
|
|
9252
9252
|
var unplayedMessageSentences = t3;
|
|
9253
9253
|
var t4;
|
|
9254
|
-
if ($[12] !== audioPlayer || $[13] !== isAudioPlayed || $[14] !==
|
|
9255
|
-
t4 = function() {
|
|
9254
|
+
if ($[12] !== audioPlayer || $[13] !== isAudioPlayed || $[14] !== nextAudioPlayer || $[15] !== superinterfaceContext.baseUrl || $[16] !== superinterfaceContext.variables || $[17] !== unplayedMessageSentences) {
|
|
9255
|
+
t4 = function(t52) {
|
|
9256
|
+
var input_0 = t52.input, onPlay = t52.onPlay, onStop = t52.onStop, onEnd_0 = t52.onEnd;
|
|
9257
|
+
var searchParams = new URLSearchParams(_objectSpread45({
|
|
9258
|
+
input: input_0
|
|
9259
|
+
}, superinterfaceContext.variables));
|
|
9260
|
+
audioPlayer.load("".concat(superinterfaceContext.baseUrl, "/tts?").concat(searchParams), {
|
|
9261
|
+
format: "mp3",
|
|
9262
|
+
autoplay: isAudioPlayed,
|
|
9263
|
+
html5: isHtmlAudioSupported,
|
|
9264
|
+
onplay: onPlay,
|
|
9265
|
+
onstop: onStop,
|
|
9266
|
+
onload: function() {
|
|
9267
|
+
var nextUnplayedMessageSentence = unplayedMessageSentences[1];
|
|
9268
|
+
if (!nextUnplayedMessageSentence) {
|
|
9269
|
+
return;
|
|
9270
|
+
}
|
|
9271
|
+
var isNextFullSentence = FULL_SENTENCE_REGEX.test(nextUnplayedMessageSentence.sentence);
|
|
9272
|
+
if (!isNextFullSentence) {
|
|
9273
|
+
return;
|
|
9274
|
+
}
|
|
9275
|
+
var nextSearchParams = new URLSearchParams(_objectSpread45({
|
|
9276
|
+
input: nextUnplayedMessageSentence.sentence
|
|
9277
|
+
}, superinterfaceContext.variables));
|
|
9278
|
+
nextAudioPlayer.load("".concat(superinterfaceContext.baseUrl, "/tts?").concat(nextSearchParams), {
|
|
9279
|
+
format: "mp3",
|
|
9280
|
+
autoplay: false,
|
|
9281
|
+
html5: isHtmlAudioSupported
|
|
9282
|
+
});
|
|
9283
|
+
},
|
|
9284
|
+
onend: onEnd_0
|
|
9285
|
+
});
|
|
9286
|
+
};
|
|
9287
|
+
$[12] = audioPlayer;
|
|
9288
|
+
$[13] = isAudioPlayed;
|
|
9289
|
+
$[14] = nextAudioPlayer;
|
|
9290
|
+
$[15] = superinterfaceContext.baseUrl;
|
|
9291
|
+
$[16] = superinterfaceContext.variables;
|
|
9292
|
+
$[17] = unplayedMessageSentences;
|
|
9293
|
+
$[18] = t4;
|
|
9294
|
+
} else {
|
|
9295
|
+
t4 = $[18];
|
|
9296
|
+
}
|
|
9297
|
+
var defaultPlay = t4;
|
|
9298
|
+
var t5;
|
|
9299
|
+
t5 = passedPlay || defaultPlay;
|
|
9300
|
+
var play = t5;
|
|
9301
|
+
var t6;
|
|
9302
|
+
if ($[19] !== audioPlayer.playing || $[20] !== isPlaying || $[21] !== latestMessageProps.latestMessage || $[22] !== _onEnd || $[23] !== play || $[24] !== unplayedMessageSentences) {
|
|
9303
|
+
t6 = function() {
|
|
9256
9304
|
if (isPlaying) {
|
|
9257
9305
|
return;
|
|
9258
9306
|
}
|
|
@@ -9281,17 +9329,13 @@ var useMessageAudio = function(t0) {
|
|
|
9281
9329
|
firstUnplayedMessageSentence
|
|
9282
9330
|
]);
|
|
9283
9331
|
});
|
|
9284
|
-
var
|
|
9285
|
-
|
|
9286
|
-
|
|
9287
|
-
|
|
9288
|
-
format: "mp3",
|
|
9289
|
-
autoplay: isAudioPlayed,
|
|
9290
|
-
html5: isHtmlAudioSupported,
|
|
9291
|
-
onplay: function() {
|
|
9332
|
+
var input_1 = firstUnplayedMessageSentence.sentence;
|
|
9333
|
+
play({
|
|
9334
|
+
input: input_1,
|
|
9335
|
+
onPlay: function() {
|
|
9292
9336
|
setIsAudioPlayed(true);
|
|
9293
9337
|
},
|
|
9294
|
-
|
|
9338
|
+
onStop: function() {
|
|
9295
9339
|
setStoppedMessageIds(function(prev_0) {
|
|
9296
9340
|
return _to_consumable_array(prev_0).concat([
|
|
9297
9341
|
firstUnplayedMessageSentence.messageId
|
|
@@ -9299,47 +9343,27 @@ var useMessageAudio = function(t0) {
|
|
|
9299
9343
|
});
|
|
9300
9344
|
setIsPlaying(false);
|
|
9301
9345
|
},
|
|
9302
|
-
|
|
9303
|
-
var nextUnplayedMessageSentence = unplayedMessageSentences[1];
|
|
9304
|
-
if (!nextUnplayedMessageSentence) {
|
|
9305
|
-
return;
|
|
9306
|
-
}
|
|
9307
|
-
var isNextFullSentence = FULL_SENTENCE_REGEX.test(nextUnplayedMessageSentence.sentence);
|
|
9308
|
-
if (!isNextFullSentence) {
|
|
9309
|
-
return;
|
|
9310
|
-
}
|
|
9311
|
-
var nextSearchParams = new URLSearchParams(_objectSpread45({
|
|
9312
|
-
input: nextUnplayedMessageSentence.sentence
|
|
9313
|
-
}, superinterfaceContext.variables));
|
|
9314
|
-
nextAudioPlayer.load("".concat(superinterfaceContext.baseUrl, "/tts?").concat(nextSearchParams), {
|
|
9315
|
-
format: "mp3",
|
|
9316
|
-
autoplay: false,
|
|
9317
|
-
html5: isHtmlAudioSupported
|
|
9318
|
-
});
|
|
9319
|
-
},
|
|
9320
|
-
onend: function() {
|
|
9346
|
+
onEnd: function() {
|
|
9321
9347
|
setIsPlaying(false);
|
|
9322
9348
|
if (unplayedMessageSentences.length === 1 && latestMessageProps.latestMessage.status !== "in_progress") {
|
|
9323
|
-
|
|
9349
|
+
_onEnd();
|
|
9324
9350
|
}
|
|
9325
9351
|
}
|
|
9326
9352
|
});
|
|
9327
9353
|
};
|
|
9328
|
-
$[
|
|
9329
|
-
$[
|
|
9330
|
-
$[
|
|
9331
|
-
$[
|
|
9332
|
-
$[
|
|
9333
|
-
$[
|
|
9334
|
-
$[
|
|
9335
|
-
$[19] = unplayedMessageSentences;
|
|
9336
|
-
$[20] = t4;
|
|
9354
|
+
$[19] = audioPlayer.playing;
|
|
9355
|
+
$[20] = isPlaying;
|
|
9356
|
+
$[21] = latestMessageProps.latestMessage;
|
|
9357
|
+
$[22] = _onEnd;
|
|
9358
|
+
$[23] = play;
|
|
9359
|
+
$[24] = unplayedMessageSentences;
|
|
9360
|
+
$[25] = t6;
|
|
9337
9361
|
} else {
|
|
9338
|
-
|
|
9362
|
+
t6 = $[25];
|
|
9339
9363
|
}
|
|
9340
|
-
var
|
|
9341
|
-
if ($[
|
|
9342
|
-
|
|
9364
|
+
var t7;
|
|
9365
|
+
if ($[26] !== audioPlayer || $[27] !== isPlaying || $[28] !== latestMessageProps || $[29] !== nextAudioPlayer || $[30] !== _onEnd || $[31] !== play || $[32] !== playedMessageSentences || $[33] !== superinterfaceContext || $[34] !== unplayedMessageSentences) {
|
|
9366
|
+
t7 = [
|
|
9343
9367
|
unplayedMessageSentences,
|
|
9344
9368
|
isPlaying,
|
|
9345
9369
|
superinterfaceContext,
|
|
@@ -9347,37 +9371,39 @@ var useMessageAudio = function(t0) {
|
|
|
9347
9371
|
audioPlayer,
|
|
9348
9372
|
nextAudioPlayer,
|
|
9349
9373
|
playedMessageSentences,
|
|
9350
|
-
|
|
9374
|
+
_onEnd,
|
|
9375
|
+
play
|
|
9351
9376
|
];
|
|
9352
|
-
$[
|
|
9353
|
-
$[
|
|
9354
|
-
$[
|
|
9355
|
-
$[
|
|
9356
|
-
$[
|
|
9357
|
-
$[
|
|
9358
|
-
$[
|
|
9359
|
-
$[
|
|
9360
|
-
$[
|
|
9361
|
-
|
|
9362
|
-
|
|
9363
|
-
|
|
9364
|
-
|
|
9365
|
-
|
|
9366
|
-
|
|
9367
|
-
|
|
9377
|
+
$[26] = audioPlayer;
|
|
9378
|
+
$[27] = isPlaying;
|
|
9379
|
+
$[28] = latestMessageProps;
|
|
9380
|
+
$[29] = nextAudioPlayer;
|
|
9381
|
+
$[30] = _onEnd;
|
|
9382
|
+
$[31] = play;
|
|
9383
|
+
$[32] = playedMessageSentences;
|
|
9384
|
+
$[33] = superinterfaceContext;
|
|
9385
|
+
$[34] = unplayedMessageSentences;
|
|
9386
|
+
$[35] = t7;
|
|
9387
|
+
} else {
|
|
9388
|
+
t7 = $[35];
|
|
9389
|
+
}
|
|
9390
|
+
useEffect10(t6, t7);
|
|
9391
|
+
var t8;
|
|
9392
|
+
if ($[36] !== audioPlayer) {
|
|
9393
|
+
t8 = [
|
|
9368
9394
|
audioPlayer
|
|
9369
9395
|
];
|
|
9370
|
-
$[
|
|
9371
|
-
$[
|
|
9396
|
+
$[36] = audioPlayer;
|
|
9397
|
+
$[37] = t8;
|
|
9372
9398
|
} else {
|
|
9373
|
-
|
|
9399
|
+
t8 = $[37];
|
|
9374
9400
|
}
|
|
9375
|
-
useEffect10(_temp11,
|
|
9401
|
+
useEffect10(_temp11, t8);
|
|
9376
9402
|
var _useState94 = _sliced_to_array(useState9(null), 2), audioEngine = _useState94[0], setAudioEngine = _useState94[1];
|
|
9377
9403
|
var isAudioEngineInited = useRef8(false);
|
|
9378
|
-
var
|
|
9379
|
-
if ($[
|
|
9380
|
-
|
|
9404
|
+
var t9;
|
|
9405
|
+
if ($[38] !== audioPlayer.playing) {
|
|
9406
|
+
t9 = function() {
|
|
9381
9407
|
if (!audioPlayer.playing) {
|
|
9382
9408
|
return;
|
|
9383
9409
|
}
|
|
@@ -9398,63 +9424,63 @@ var useMessageAudio = function(t0) {
|
|
|
9398
9424
|
});
|
|
9399
9425
|
}
|
|
9400
9426
|
};
|
|
9401
|
-
$[
|
|
9402
|
-
$[
|
|
9427
|
+
$[38] = audioPlayer.playing;
|
|
9428
|
+
$[39] = t9;
|
|
9403
9429
|
} else {
|
|
9404
|
-
|
|
9430
|
+
t9 = $[39];
|
|
9405
9431
|
}
|
|
9406
|
-
var
|
|
9407
|
-
if ($[
|
|
9408
|
-
|
|
9432
|
+
var t10;
|
|
9433
|
+
if ($[40] !== audioPlayer) {
|
|
9434
|
+
t10 = [
|
|
9409
9435
|
audioPlayer,
|
|
9410
9436
|
isAudioEngineInited
|
|
9411
9437
|
];
|
|
9412
|
-
$[
|
|
9413
|
-
$[
|
|
9438
|
+
$[40] = audioPlayer;
|
|
9439
|
+
$[41] = t10;
|
|
9414
9440
|
} else {
|
|
9415
|
-
|
|
9441
|
+
t10 = $[41];
|
|
9416
9442
|
}
|
|
9417
|
-
useEffect10(
|
|
9418
|
-
var
|
|
9443
|
+
useEffect10(t9, t10);
|
|
9444
|
+
var t11;
|
|
9419
9445
|
bb1: {
|
|
9420
9446
|
if (!audioEngine) {
|
|
9421
|
-
|
|
9447
|
+
t11 = null;
|
|
9422
9448
|
break bb1;
|
|
9423
9449
|
}
|
|
9424
9450
|
var result;
|
|
9425
|
-
if ($[
|
|
9451
|
+
if ($[42] !== audioEngine.audioContext || $[43] !== audioEngine.source) {
|
|
9426
9452
|
result = audioEngine.audioContext.createAnalyser();
|
|
9427
9453
|
audioEngine.source.connect(audioEngine.audioContext.destination);
|
|
9428
9454
|
audioEngine.source.connect(result);
|
|
9429
|
-
$[
|
|
9430
|
-
$[
|
|
9431
|
-
$[
|
|
9455
|
+
$[42] = audioEngine.audioContext;
|
|
9456
|
+
$[43] = audioEngine.source;
|
|
9457
|
+
$[44] = result;
|
|
9432
9458
|
} else {
|
|
9433
|
-
result = $[
|
|
9459
|
+
result = $[44];
|
|
9434
9460
|
}
|
|
9435
|
-
|
|
9461
|
+
t11 = result;
|
|
9436
9462
|
}
|
|
9437
|
-
var visualizationAnalyser =
|
|
9438
|
-
var
|
|
9439
|
-
|
|
9440
|
-
var isPending =
|
|
9441
|
-
var
|
|
9442
|
-
if ($[
|
|
9443
|
-
|
|
9463
|
+
var visualizationAnalyser = t11;
|
|
9464
|
+
var t12;
|
|
9465
|
+
t12 = isPlaying || unplayedMessageSentences.length > 0;
|
|
9466
|
+
var isPending = t12;
|
|
9467
|
+
var t13;
|
|
9468
|
+
if ($[45] !== audioPlayer || $[46] !== isAudioPlayed || $[47] !== isPending || $[48] !== visualizationAnalyser) {
|
|
9469
|
+
t13 = _objectSpread45(_objectSpread45({
|
|
9444
9470
|
isPending: isPending,
|
|
9445
9471
|
isAudioPlayed: isAudioPlayed
|
|
9446
9472
|
}, audioPlayer), {}, {
|
|
9447
9473
|
visualizationAnalyser: visualizationAnalyser
|
|
9448
9474
|
});
|
|
9449
|
-
$[
|
|
9450
|
-
$[
|
|
9451
|
-
$[
|
|
9452
|
-
$[
|
|
9453
|
-
$[
|
|
9475
|
+
$[45] = audioPlayer;
|
|
9476
|
+
$[46] = isAudioPlayed;
|
|
9477
|
+
$[47] = isPending;
|
|
9478
|
+
$[48] = visualizationAnalyser;
|
|
9479
|
+
$[49] = t13;
|
|
9454
9480
|
} else {
|
|
9455
|
-
|
|
9481
|
+
t13 = $[49];
|
|
9456
9482
|
}
|
|
9457
|
-
return
|
|
9483
|
+
return t13;
|
|
9458
9484
|
};
|
|
9459
9485
|
function _temp11() {
|
|
9460
9486
|
if (isHtmlAudioSupported) {
|
|
@@ -9556,8 +9582,8 @@ function _asyncToGenerator12(n) {
|
|
|
9556
9582
|
};
|
|
9557
9583
|
}
|
|
9558
9584
|
var Content8 = function(t0) {
|
|
9559
|
-
var $ = _c51(
|
|
9560
|
-
var children = t0.children, className = t0.className, style = t0.style;
|
|
9585
|
+
var $ = _c51(24);
|
|
9586
|
+
var children = t0.children, className = t0.className, style = t0.style, play = t0.play;
|
|
9561
9587
|
var addToast = useToasts().addToast;
|
|
9562
9588
|
var queryClient = useQueryClient6();
|
|
9563
9589
|
var threadContext = useSuperinterfaceContext();
|
|
@@ -9624,11 +9650,9 @@ var Content8 = function(t0) {
|
|
|
9624
9650
|
var microphonePermission = usePermission(t2);
|
|
9625
9651
|
var t3;
|
|
9626
9652
|
if ($[3] !== microphonePermission || $[4] !== recorderProps) {
|
|
9627
|
-
t3 = {
|
|
9628
|
-
|
|
9629
|
-
|
|
9630
|
-
recorderProps.start();
|
|
9631
|
-
}
|
|
9653
|
+
t3 = function() {
|
|
9654
|
+
if (microphonePermission === "granted") {
|
|
9655
|
+
recorderProps.start();
|
|
9632
9656
|
}
|
|
9633
9657
|
};
|
|
9634
9658
|
$[3] = microphonePermission;
|
|
@@ -9637,41 +9661,53 @@ var Content8 = function(t0) {
|
|
|
9637
9661
|
} else {
|
|
9638
9662
|
t3 = $[5];
|
|
9639
9663
|
}
|
|
9640
|
-
var
|
|
9641
|
-
|
|
9642
|
-
|
|
9643
|
-
|
|
9644
|
-
|
|
9645
|
-
recorderProps: t4,
|
|
9646
|
-
createMessageProps: createMessageProps,
|
|
9647
|
-
messageAudioProps: messageAudioProps
|
|
9664
|
+
var t4;
|
|
9665
|
+
if ($[6] !== play || $[7] !== t3) {
|
|
9666
|
+
t4 = {
|
|
9667
|
+
play: play,
|
|
9668
|
+
onEnd: t3
|
|
9648
9669
|
};
|
|
9649
|
-
$[6] =
|
|
9650
|
-
$[7] =
|
|
9670
|
+
$[6] = play;
|
|
9671
|
+
$[7] = t3;
|
|
9651
9672
|
$[8] = t4;
|
|
9652
|
-
$[9] = t5;
|
|
9653
9673
|
} else {
|
|
9654
|
-
|
|
9674
|
+
t4 = $[8];
|
|
9655
9675
|
}
|
|
9656
|
-
var
|
|
9657
|
-
var
|
|
9658
|
-
var
|
|
9659
|
-
if ($[
|
|
9660
|
-
|
|
9661
|
-
|
|
9662
|
-
|
|
9676
|
+
var messageAudioProps = useMessageAudio(t4);
|
|
9677
|
+
var t5 = recorderProps;
|
|
9678
|
+
var t6;
|
|
9679
|
+
if ($[9] !== createMessageProps || $[10] !== messageAudioProps || $[11] !== t5) {
|
|
9680
|
+
t6 = {
|
|
9681
|
+
recorderProps: t5,
|
|
9682
|
+
createMessageProps: createMessageProps,
|
|
9663
9683
|
messageAudioProps: messageAudioProps
|
|
9664
9684
|
};
|
|
9685
|
+
$[9] = createMessageProps;
|
|
9665
9686
|
$[10] = messageAudioProps;
|
|
9666
|
-
$[11] =
|
|
9687
|
+
$[11] = t5;
|
|
9667
9688
|
$[12] = t6;
|
|
9668
|
-
$[13] = t7;
|
|
9669
9689
|
} else {
|
|
9670
|
-
|
|
9690
|
+
t6 = $[12];
|
|
9671
9691
|
}
|
|
9692
|
+
var status = useStatus(t6).status;
|
|
9693
|
+
var t7 = recorderProps;
|
|
9672
9694
|
var t8;
|
|
9673
|
-
if ($[
|
|
9674
|
-
t8 =
|
|
9695
|
+
if ($[13] !== messageAudioProps || $[14] !== status || $[15] !== t7) {
|
|
9696
|
+
t8 = {
|
|
9697
|
+
status: status,
|
|
9698
|
+
recorderProps: t7,
|
|
9699
|
+
messageAudioProps: messageAudioProps
|
|
9700
|
+
};
|
|
9701
|
+
$[13] = messageAudioProps;
|
|
9702
|
+
$[14] = status;
|
|
9703
|
+
$[15] = t7;
|
|
9704
|
+
$[16] = t8;
|
|
9705
|
+
} else {
|
|
9706
|
+
t8 = $[16];
|
|
9707
|
+
}
|
|
9708
|
+
var t9;
|
|
9709
|
+
if ($[17] !== children || $[18] !== className || $[19] !== style) {
|
|
9710
|
+
t9 = /* @__PURE__ */ _jsx82(Flex29, {
|
|
9675
9711
|
direction: "column",
|
|
9676
9712
|
flexGrow: "1",
|
|
9677
9713
|
p: "9",
|
|
@@ -9679,26 +9715,26 @@ var Content8 = function(t0) {
|
|
|
9679
9715
|
style: style,
|
|
9680
9716
|
children: children
|
|
9681
9717
|
});
|
|
9682
|
-
$[
|
|
9683
|
-
$[
|
|
9684
|
-
$[
|
|
9685
|
-
$[
|
|
9718
|
+
$[17] = children;
|
|
9719
|
+
$[18] = className;
|
|
9720
|
+
$[19] = style;
|
|
9721
|
+
$[20] = t9;
|
|
9686
9722
|
} else {
|
|
9687
|
-
|
|
9723
|
+
t9 = $[20];
|
|
9688
9724
|
}
|
|
9689
|
-
var
|
|
9690
|
-
if ($[
|
|
9691
|
-
|
|
9692
|
-
value:
|
|
9693
|
-
children:
|
|
9725
|
+
var t10;
|
|
9726
|
+
if ($[21] !== t8 || $[22] !== t9) {
|
|
9727
|
+
t10 = /* @__PURE__ */ _jsx82(AudioThreadContext.Provider, {
|
|
9728
|
+
value: t8,
|
|
9729
|
+
children: t9
|
|
9694
9730
|
});
|
|
9695
|
-
$[
|
|
9696
|
-
$[
|
|
9697
|
-
$[
|
|
9731
|
+
$[21] = t8;
|
|
9732
|
+
$[22] = t9;
|
|
9733
|
+
$[23] = t10;
|
|
9698
9734
|
} else {
|
|
9699
|
-
|
|
9735
|
+
t10 = $[23];
|
|
9700
9736
|
}
|
|
9701
|
-
return
|
|
9737
|
+
return t10;
|
|
9702
9738
|
};
|
|
9703
9739
|
var Root12 = function(_ref) {
|
|
9704
9740
|
var children = _ref.children, rest = _objectWithoutProperties4(_ref, _excluded4);
|
|
@@ -9722,7 +9758,7 @@ function _temp23() {
|
|
|
9722
9758
|
return _temp23.apply(this, arguments);
|
|
9723
9759
|
}
|
|
9724
9760
|
// src/components/threads/AudioThread/Visualization/index.tsx
|
|
9725
|
-
import { useContext as useContext16, useState as useState11, useCallback as
|
|
9761
|
+
import { useContext as useContext16, useState as useState11, useCallback as useCallback8, useEffect as useEffect12 } from "react";
|
|
9726
9762
|
import _9 from "lodash";
|
|
9727
9763
|
import { Flex as Flex31 } from "@radix-ui/themes";
|
|
9728
9764
|
// src/hooks/threads/useAudioThreadContext/index.ts
|
|
@@ -9733,14 +9769,14 @@ var useAudioThreadContext = function() {
|
|
|
9733
9769
|
// src/components/threads/AudioThread/BarsVisualizer/index.tsx
|
|
9734
9770
|
import _8 from "lodash";
|
|
9735
9771
|
import { Flex as Flex30, Grid } from "@radix-ui/themes";
|
|
9736
|
-
import { useState as useState10, useEffect as useEffect11, useCallback as
|
|
9772
|
+
import { useState as useState10, useEffect as useEffect11, useCallback as useCallback7 } from "react";
|
|
9737
9773
|
import { cluster } from "radash";
|
|
9738
9774
|
import { jsx as _jsx83 } from "react/jsx-runtime";
|
|
9739
9775
|
var barCount = 4;
|
|
9740
9776
|
var BarsVisualizer = function(_ref) {
|
|
9741
9777
|
var visualizationAnalyser = _ref.visualizationAnalyser, backgroundColor = _ref.backgroundColor, height = _ref.height, barWidth = _ref.barWidth;
|
|
9742
9778
|
var _useState10 = _sliced_to_array(useState10([]), 2), barHeights = _useState10[0], setBarHeights = _useState10[1];
|
|
9743
|
-
var draw =
|
|
9779
|
+
var draw = useCallback7(function(_ref2) {
|
|
9744
9780
|
var visualizationAnalyser_0 = _ref2.visualizationAnalyser;
|
|
9745
9781
|
if (!visualizationAnalyser_0) {
|
|
9746
9782
|
setBarHeights(Array(barCount).fill(0));
|
|
@@ -9843,7 +9879,7 @@ var Visualization = function(props) {
|
|
|
9843
9879
|
var audioThreadContext = useAudioThreadContext();
|
|
9844
9880
|
var assistantNameContext = useContext16(AssistantNameContext);
|
|
9845
9881
|
var _useState11 = _sliced_to_array(useState11(0), 2), scale = _useState11[0], setScale = _useState11[1];
|
|
9846
|
-
var draw =
|
|
9882
|
+
var draw = useCallback8(function(_ref) {
|
|
9847
9883
|
var visualizationAnalyser = _ref.visualizationAnalyser;
|
|
9848
9884
|
if (!visualizationAnalyser) {
|
|
9849
9885
|
setScale(1);
|