@superinterface/react 3.10.3 → 3.12.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 +1044 -529
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +56 -77
- package/dist/index.d.ts +56 -77
- package/dist/index.js +1006 -507
- package/dist/index.js.map +1 -1
- package/dist/types/index.d.cts +26 -1
- package/dist/types/index.d.ts +26 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2713,11 +2713,11 @@ function _asyncToGenerator3(n) {
|
|
|
2713
2713
|
}
|
|
2714
2714
|
var threadRunRequiresAction = /* @__PURE__ */ function() {
|
|
2715
2715
|
var _ref2 = _asyncToGenerator3(function(_ref) {
|
|
2716
|
-
var value,
|
|
2716
|
+
var value, superinterfaceContext, toolCalls, toolOutputs;
|
|
2717
2717
|
return _ts_generator(this, function(_state) {
|
|
2718
2718
|
switch(_state.label){
|
|
2719
2719
|
case 0:
|
|
2720
|
-
value = _ref.value,
|
|
2720
|
+
value = _ref.value, superinterfaceContext = _ref.superinterfaceContext;
|
|
2721
2721
|
if (!(value.data.required_action.type === "submit_client_tool_outputs")) return [
|
|
2722
2722
|
3,
|
|
2723
2723
|
2
|
|
@@ -8601,125 +8601,23 @@ ThreadDialog.Root = Root9;
|
|
|
8601
8601
|
ThreadDialog.Trigger = Trigger;
|
|
8602
8602
|
ThreadDialog.Content = Content7;
|
|
8603
8603
|
// src/components/threads/AudioThread/Root/index.tsx
|
|
8604
|
-
import { c as
|
|
8604
|
+
import { c as _c52 } from "react-compiler-runtime";
|
|
8605
8605
|
import { Flex as Flex29 } from "@radix-ui/themes";
|
|
8606
8606
|
// src/contexts/threads/AudioThreadContext/index.ts
|
|
8607
8607
|
import { createContext as createContext13 } from "react";
|
|
8608
|
-
function asyncGeneratorStep10(n, t, e, r, o, a, c) {
|
|
8609
|
-
try {
|
|
8610
|
-
var i = n[a](c), u = i.value;
|
|
8611
|
-
} catch (n2) {
|
|
8612
|
-
return void e(n2);
|
|
8613
|
-
}
|
|
8614
|
-
i.done ? t(u) : Promise.resolve(u).then(r, o);
|
|
8615
|
-
}
|
|
8616
|
-
function _asyncToGenerator10(n) {
|
|
8617
|
-
return function() {
|
|
8618
|
-
var t = this, e = arguments;
|
|
8619
|
-
return new Promise(function(r, o) {
|
|
8620
|
-
var a = n.apply(t, e);
|
|
8621
|
-
function _next(n2) {
|
|
8622
|
-
asyncGeneratorStep10(a, r, o, _next, _throw, "next", n2);
|
|
8623
|
-
}
|
|
8624
|
-
function _throw(n2) {
|
|
8625
|
-
asyncGeneratorStep10(a, r, o, _next, _throw, "throw", n2);
|
|
8626
|
-
}
|
|
8627
|
-
_next(void 0);
|
|
8628
|
-
});
|
|
8629
|
-
};
|
|
8630
|
-
}
|
|
8631
8608
|
var AudioThreadContext = /* @__PURE__ */ createContext13({
|
|
8632
|
-
|
|
8633
|
-
recorderProps: {
|
|
8634
|
-
status: "idle",
|
|
8635
|
-
start: function() {
|
|
8636
|
-
var _start = _asyncToGenerator10(function() {
|
|
8637
|
-
return _ts_generator(this, function(_state) {
|
|
8638
|
-
return [
|
|
8639
|
-
2
|
|
8640
|
-
];
|
|
8641
|
-
});
|
|
8642
|
-
});
|
|
8643
|
-
function start() {
|
|
8644
|
-
return _start.apply(this, arguments);
|
|
8645
|
-
}
|
|
8646
|
-
return start;
|
|
8647
|
-
}(),
|
|
8648
|
-
stop: function() {
|
|
8649
|
-
var _stop = _asyncToGenerator10(function() {
|
|
8650
|
-
return _ts_generator(this, function(_state) {
|
|
8651
|
-
return [
|
|
8652
|
-
2
|
|
8653
|
-
];
|
|
8654
|
-
});
|
|
8655
|
-
});
|
|
8656
|
-
function stop() {
|
|
8657
|
-
return _stop.apply(this, arguments);
|
|
8658
|
-
}
|
|
8659
|
-
return stop;
|
|
8660
|
-
}(),
|
|
8661
|
-
pause: function() {
|
|
8662
|
-
var _pause = _asyncToGenerator10(function() {
|
|
8663
|
-
return _ts_generator(this, function(_state) {
|
|
8664
|
-
return [
|
|
8665
|
-
2
|
|
8666
|
-
];
|
|
8667
|
-
});
|
|
8668
|
-
});
|
|
8669
|
-
function pause() {
|
|
8670
|
-
return _pause.apply(this, arguments);
|
|
8671
|
-
}
|
|
8672
|
-
return pause;
|
|
8673
|
-
}(),
|
|
8674
|
-
resume: function() {
|
|
8675
|
-
var _resume = _asyncToGenerator10(function() {
|
|
8676
|
-
return _ts_generator(this, function(_state) {
|
|
8677
|
-
return [
|
|
8678
|
-
2
|
|
8679
|
-
];
|
|
8680
|
-
});
|
|
8681
|
-
});
|
|
8682
|
-
function resume() {
|
|
8683
|
-
return _resume.apply(this, arguments);
|
|
8684
|
-
}
|
|
8685
|
-
return resume;
|
|
8686
|
-
}(),
|
|
8687
|
-
visualizationAnalyser: null
|
|
8688
|
-
},
|
|
8689
|
-
// @ts-ignore-next-line
|
|
8690
|
-
messageAudioProps: {
|
|
8691
|
-
visualizationAnalyser: null,
|
|
8692
|
-
playing: false,
|
|
8693
|
-
paused: false,
|
|
8694
|
-
isReady: false,
|
|
8695
|
-
play: function() {
|
|
8696
|
-
var _play = _asyncToGenerator10(function() {
|
|
8697
|
-
return _ts_generator(this, function(_state) {
|
|
8698
|
-
return [
|
|
8699
|
-
2
|
|
8700
|
-
];
|
|
8701
|
-
});
|
|
8702
|
-
});
|
|
8703
|
-
function play() {
|
|
8704
|
-
return _play.apply(this, arguments);
|
|
8705
|
-
}
|
|
8706
|
-
return play;
|
|
8707
|
-
}(),
|
|
8708
|
-
pause: function() {
|
|
8709
|
-
var _pause2 = _asyncToGenerator10(function() {
|
|
8710
|
-
return _ts_generator(this, function(_state) {
|
|
8711
|
-
return [
|
|
8712
|
-
2
|
|
8713
|
-
];
|
|
8714
|
-
});
|
|
8715
|
-
});
|
|
8716
|
-
function pause() {
|
|
8717
|
-
return _pause2.apply(this, arguments);
|
|
8718
|
-
}
|
|
8719
|
-
return pause;
|
|
8720
|
-
}()
|
|
8721
|
-
}
|
|
8609
|
+
audioRuntime: null
|
|
8722
8610
|
});
|
|
8611
|
+
// src/hooks/threads/useAudioThreadContext/index.ts
|
|
8612
|
+
import { useContext as useContext15 } from "react";
|
|
8613
|
+
var useAudioThreadContext = function() {
|
|
8614
|
+
return useContext15(AudioThreadContext);
|
|
8615
|
+
};
|
|
8616
|
+
// src/components/audioRuntimes/TtsAudioRuntimeProvider.tsx
|
|
8617
|
+
import { c as _c51 } from "react-compiler-runtime";
|
|
8618
|
+
// src/hooks/audioRuntimes/useTtsAudioRuntime/index.ts
|
|
8619
|
+
import { c as _c50 } from "react-compiler-runtime";
|
|
8620
|
+
import { useMemo as useMemo18 } from "react";
|
|
8723
8621
|
// src/hooks/misc/usePermission/index.ts
|
|
8724
8622
|
import { c as _c47 } from "react-compiler-runtime";
|
|
8725
8623
|
import { useEffect as useEffect7, useState as useState7 } from "react";
|
|
@@ -8788,83 +8686,16 @@ var usePermission = function(permissionDesc) {
|
|
|
8788
8686
|
useEffect7(t0, t1);
|
|
8789
8687
|
return state;
|
|
8790
8688
|
};
|
|
8791
|
-
// src/components/threads/AudioThread/Root/lib/blobToData.ts
|
|
8792
|
-
var blobToData = function(blob) {
|
|
8793
|
-
return new Promise(function(resolve) {
|
|
8794
|
-
var reader = new FileReader();
|
|
8795
|
-
reader.onloadend = function() {
|
|
8796
|
-
return resolve(reader.result);
|
|
8797
|
-
};
|
|
8798
|
-
reader.readAsDataURL(blob);
|
|
8799
|
-
});
|
|
8800
|
-
};
|
|
8801
|
-
// src/hooks/audioThreads/useStatus/index.ts
|
|
8802
|
-
import { c as _c48 } from "react-compiler-runtime";
|
|
8803
|
-
import { useMemo as useMemo16 } from "react";
|
|
8804
|
-
var useStatus = function(t0) {
|
|
8805
|
-
var $ = _c48(2);
|
|
8806
|
-
var messageAudioProps = t0.messageAudioProps, recorderProps = t0.recorderProps, createMessageProps = t0.createMessageProps;
|
|
8807
|
-
var latestMessageProps = useLatestMessage();
|
|
8808
|
-
var t1;
|
|
8809
|
-
bb0: {
|
|
8810
|
-
var _latestMessageProps$l;
|
|
8811
|
-
if (recorderProps.status === "recording") {
|
|
8812
|
-
t1 = "recording";
|
|
8813
|
-
break bb0;
|
|
8814
|
-
}
|
|
8815
|
-
if (createMessageProps.isPending) {
|
|
8816
|
-
t1 = "creatingMessage";
|
|
8817
|
-
break bb0;
|
|
8818
|
-
}
|
|
8819
|
-
if (messageAudioProps.paused || !messageAudioProps.isAudioPlayed) {
|
|
8820
|
-
t1 = "playerPaused";
|
|
8821
|
-
break bb0;
|
|
8822
|
-
}
|
|
8823
|
-
if (messageAudioProps.playing || messageAudioProps.isPending) {
|
|
8824
|
-
t1 = "playing";
|
|
8825
|
-
break bb0;
|
|
8826
|
-
}
|
|
8827
|
-
if (!messageAudioProps.isAudioPlayed && !messageAudioProps.isReady) {
|
|
8828
|
-
t1 = "loading";
|
|
8829
|
-
break bb0;
|
|
8830
|
-
}
|
|
8831
|
-
if (((_latestMessageProps$l = latestMessageProps.latestMessage) === null || _latestMessageProps$l === void 0 ? void 0 : _latestMessageProps$l.status) === "in_progress") {
|
|
8832
|
-
t1 = "creatingMessage";
|
|
8833
|
-
break bb0;
|
|
8834
|
-
}
|
|
8835
|
-
if (recorderProps.status === "idle") {
|
|
8836
|
-
t1 = "idle";
|
|
8837
|
-
break bb0;
|
|
8838
|
-
}
|
|
8839
|
-
if (recorderProps.status === "paused") {
|
|
8840
|
-
t1 = "recorderPaused";
|
|
8841
|
-
break bb0;
|
|
8842
|
-
}
|
|
8843
|
-
t1 = "loading";
|
|
8844
|
-
}
|
|
8845
|
-
var status = t1;
|
|
8846
|
-
var t2;
|
|
8847
|
-
if ($[0] !== status) {
|
|
8848
|
-
t2 = {
|
|
8849
|
-
status: status
|
|
8850
|
-
};
|
|
8851
|
-
$[0] = status;
|
|
8852
|
-
$[1] = t2;
|
|
8853
|
-
} else {
|
|
8854
|
-
t2 = $[1];
|
|
8855
|
-
}
|
|
8856
|
-
return t2;
|
|
8857
|
-
};
|
|
8858
8689
|
// src/hooks/audioThreads/useRecorder/index.ts
|
|
8859
8690
|
import dayjs3 from "dayjs";
|
|
8860
8691
|
import { useAudioCapture } from "use-audio-capture";
|
|
8861
|
-
import { useMemo as
|
|
8692
|
+
import { useMemo as useMemo16, useRef as useRef7, useState as useState8, useCallback as useCallback5, useEffect as useEffect9 } from "react";
|
|
8862
8693
|
import { useAudioPlayer } from "react-use-audio-player";
|
|
8863
8694
|
// src/hooks/misc/useInterval.ts
|
|
8864
|
-
import { c as
|
|
8695
|
+
import { c as _c48 } from "react-compiler-runtime";
|
|
8865
8696
|
import { useEffect as useEffect8, useRef as useRef6 } from "react";
|
|
8866
8697
|
var useInterval = function(callback, delay) {
|
|
8867
|
-
var $ =
|
|
8698
|
+
var $ = _c48(5);
|
|
8868
8699
|
var savedCallback = useRef6(_temp10);
|
|
8869
8700
|
var t0;
|
|
8870
8701
|
if ($[0] !== callback) {
|
|
@@ -8947,7 +8778,7 @@ function _toPrimitive44(t, r) {
|
|
|
8947
8778
|
}
|
|
8948
8779
|
return ("string" === r ? String : Number)(t);
|
|
8949
8780
|
}
|
|
8950
|
-
function
|
|
8781
|
+
function asyncGeneratorStep10(n, t, e, r, o, a, c) {
|
|
8951
8782
|
try {
|
|
8952
8783
|
var i = n[a](c), u = i.value;
|
|
8953
8784
|
} catch (n2) {
|
|
@@ -8955,16 +8786,16 @@ function asyncGeneratorStep11(n, t, e, r, o, a, c) {
|
|
|
8955
8786
|
}
|
|
8956
8787
|
i.done ? t(u) : Promise.resolve(u).then(r, o);
|
|
8957
8788
|
}
|
|
8958
|
-
function
|
|
8789
|
+
function _asyncToGenerator10(n) {
|
|
8959
8790
|
return function() {
|
|
8960
8791
|
var t = this, e = arguments;
|
|
8961
8792
|
return new Promise(function(r, o) {
|
|
8962
8793
|
var a = n.apply(t, e);
|
|
8963
8794
|
function _next(n2) {
|
|
8964
|
-
|
|
8795
|
+
asyncGeneratorStep10(a, r, o, _next, _throw, "next", n2);
|
|
8965
8796
|
}
|
|
8966
8797
|
function _throw(n2) {
|
|
8967
|
-
|
|
8798
|
+
asyncGeneratorStep10(a, r, o, _next, _throw, "throw", n2);
|
|
8968
8799
|
}
|
|
8969
8800
|
_next(void 0);
|
|
8970
8801
|
});
|
|
@@ -8997,7 +8828,7 @@ var useRecorder = function(_ref) {
|
|
|
8997
8828
|
setNoiseStart(null);
|
|
8998
8829
|
},
|
|
8999
8830
|
onStop: function() {
|
|
9000
|
-
var _onStop2 =
|
|
8831
|
+
var _onStop2 = _asyncToGenerator10(function() {
|
|
9001
8832
|
var _arguments = arguments;
|
|
9002
8833
|
return _ts_generator(this, function(_state) {
|
|
9003
8834
|
switch(_state.label){
|
|
@@ -9054,7 +8885,7 @@ var useRecorder = function(_ref) {
|
|
|
9054
8885
|
isInited,
|
|
9055
8886
|
mediaStream
|
|
9056
8887
|
]);
|
|
9057
|
-
var visualizationAnalyser =
|
|
8888
|
+
var visualizationAnalyser = useMemo16(function() {
|
|
9058
8889
|
if (!audioEngine) return null;
|
|
9059
8890
|
var result = audioEngine.audioContext.createAnalyser();
|
|
9060
8891
|
audioEngine.source.connect(result);
|
|
@@ -9062,7 +8893,7 @@ var useRecorder = function(_ref) {
|
|
|
9062
8893
|
}, [
|
|
9063
8894
|
audioEngine
|
|
9064
8895
|
]);
|
|
9065
|
-
var silenceAnalyser =
|
|
8896
|
+
var silenceAnalyser = useMemo16(function() {
|
|
9066
8897
|
if (!audioEngine) return null;
|
|
9067
8898
|
var result_0 = audioEngine.audioContext.createAnalyser();
|
|
9068
8899
|
result_0.minDecibels = -60;
|
|
@@ -9117,8 +8948,8 @@ var useRecorder = function(_ref) {
|
|
|
9117
8948
|
});
|
|
9118
8949
|
};
|
|
9119
8950
|
// src/hooks/audioThreads/useMessageAudio/index.ts
|
|
9120
|
-
import { c as
|
|
9121
|
-
import { useMemo as
|
|
8951
|
+
import { c as _c49 } from "react-compiler-runtime";
|
|
8952
|
+
import { useMemo as useMemo17, useRef as useRef8, useState as useState9, useEffect as useEffect10, useCallback as useCallback6 } from "react";
|
|
9122
8953
|
import nlp from "compromise";
|
|
9123
8954
|
import { Howler } from "howler";
|
|
9124
8955
|
import { useAudioPlayer as useAudioPlayer2 } from "react-use-audio-player";
|
|
@@ -9199,7 +9030,8 @@ var getMessageSentences = function(_ref) {
|
|
|
9199
9030
|
});
|
|
9200
9031
|
};
|
|
9201
9032
|
var useMessageAudio = function(t0) {
|
|
9202
|
-
var $
|
|
9033
|
+
var _latestMessageProps$l;
|
|
9034
|
+
var $ = _c49(50);
|
|
9203
9035
|
var _onEnd = t0.onEnd, passedPlay = t0.play;
|
|
9204
9036
|
var _useState9 = _sliced_to_array(useState9(false), 2), isAudioPlayed = _useState9[0], setIsAudioPlayed = _useState9[1];
|
|
9205
9037
|
var t1;
|
|
@@ -9309,7 +9141,7 @@ var useMessageAudio = function(t0) {
|
|
|
9309
9141
|
var searchParams = new URLSearchParams(_objectSpread45({
|
|
9310
9142
|
input: input_0
|
|
9311
9143
|
}, superinterfaceContext.variables));
|
|
9312
|
-
audioPlayer.load("".concat(superinterfaceContext.baseUrl, "/tts?").concat(searchParams), {
|
|
9144
|
+
audioPlayer.load("".concat(superinterfaceContext.baseUrl, "/audio-runtimes/tts?").concat(searchParams), {
|
|
9313
9145
|
format: "mp3",
|
|
9314
9146
|
autoplay: isAudioPlayed,
|
|
9315
9147
|
html5: isHtmlAudioSupported,
|
|
@@ -9327,7 +9159,7 @@ var useMessageAudio = function(t0) {
|
|
|
9327
9159
|
var nextSearchParams = new URLSearchParams(_objectSpread45({
|
|
9328
9160
|
input: nextUnplayedMessageSentence.sentence
|
|
9329
9161
|
}, superinterfaceContext.variables));
|
|
9330
|
-
nextAudioPlayer.load("".concat(superinterfaceContext.baseUrl, "/tts?").concat(nextSearchParams), {
|
|
9162
|
+
nextAudioPlayer.load("".concat(superinterfaceContext.baseUrl, "/audio-runtimes/tts?").concat(nextSearchParams), {
|
|
9331
9163
|
format: "mp3",
|
|
9332
9164
|
autoplay: false,
|
|
9333
9165
|
html5: isHtmlAudioSupported
|
|
@@ -9514,7 +9346,7 @@ var useMessageAudio = function(t0) {
|
|
|
9514
9346
|
}
|
|
9515
9347
|
var visualizationAnalyser = t11;
|
|
9516
9348
|
var t12;
|
|
9517
|
-
t12 = isPlaying || unplayedMessageSentences.length > 0;
|
|
9349
|
+
t12 = isPlaying || unplayedMessageSentences.length > 0 || ((_latestMessageProps$l = latestMessageProps.latestMessage) === null || _latestMessageProps$l === void 0 ? void 0 : _latestMessageProps$l.status) === "in_progress";
|
|
9518
9350
|
var isPending = t12;
|
|
9519
9351
|
var t13;
|
|
9520
9352
|
if ($[45] !== audioPlayer || $[46] !== isAudioPlayed || $[47] !== isPending || $[48] !== visualizationAnalyser) {
|
|
@@ -9543,74 +9375,20 @@ function _temp11() {
|
|
|
9543
9375
|
Howler._howls[0]._sounds[0]._node.crossOrigin = "anonymous";
|
|
9544
9376
|
}
|
|
9545
9377
|
}
|
|
9546
|
-
// src/
|
|
9378
|
+
// src/hooks/audioRuntimes/useTtsAudioRuntime/index.ts
|
|
9547
9379
|
import { useQueryClient as useQueryClient6 } from "@tanstack/react-query";
|
|
9548
|
-
|
|
9549
|
-
var
|
|
9550
|
-
|
|
9551
|
-
|
|
9552
|
-
function
|
|
9553
|
-
|
|
9554
|
-
|
|
9555
|
-
|
|
9556
|
-
|
|
9557
|
-
|
|
9558
|
-
|
|
9559
|
-
|
|
9560
|
-
return t;
|
|
9561
|
-
}
|
|
9562
|
-
function _objectSpread46(e) {
|
|
9563
|
-
for(var r = 1; r < arguments.length; r++){
|
|
9564
|
-
var t = null != arguments[r] ? arguments[r] : {};
|
|
9565
|
-
r % 2 ? ownKeys46(Object(t), true).forEach(function(r2) {
|
|
9566
|
-
_defineProperty46(e, r2, t[r2]);
|
|
9567
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys46(Object(t)).forEach(function(r2) {
|
|
9568
|
-
Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2));
|
|
9569
|
-
});
|
|
9570
|
-
}
|
|
9571
|
-
return e;
|
|
9572
|
-
}
|
|
9573
|
-
function _defineProperty46(e, r, t) {
|
|
9574
|
-
return (r = _toPropertyKey46(r)) in e ? Object.defineProperty(e, r, {
|
|
9575
|
-
value: t,
|
|
9576
|
-
enumerable: true,
|
|
9577
|
-
configurable: true,
|
|
9578
|
-
writable: true
|
|
9579
|
-
}) : e[r] = t, e;
|
|
9580
|
-
}
|
|
9581
|
-
function _toPropertyKey46(t) {
|
|
9582
|
-
var i = _toPrimitive46(t, "string");
|
|
9583
|
-
return "symbol" == (typeof i === "undefined" ? "undefined" : _type_of(i)) ? i : i + "";
|
|
9584
|
-
}
|
|
9585
|
-
function _toPrimitive46(t, r) {
|
|
9586
|
-
if ("object" != (typeof t === "undefined" ? "undefined" : _type_of(t)) || !t) return t;
|
|
9587
|
-
var e = t[Symbol.toPrimitive];
|
|
9588
|
-
if (void 0 !== e) {
|
|
9589
|
-
var i = e.call(t, r || "default");
|
|
9590
|
-
if ("object" != (typeof i === "undefined" ? "undefined" : _type_of(i))) return i;
|
|
9591
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
9592
|
-
}
|
|
9593
|
-
return ("string" === r ? String : Number)(t);
|
|
9594
|
-
}
|
|
9595
|
-
function _objectWithoutProperties5(e, t) {
|
|
9596
|
-
if (null == e) return {};
|
|
9597
|
-
var o, r, i = _objectWithoutPropertiesLoose5(e, t);
|
|
9598
|
-
if (Object.getOwnPropertySymbols) {
|
|
9599
|
-
var s = Object.getOwnPropertySymbols(e);
|
|
9600
|
-
for(r = 0; r < s.length; r++)o = s[r], t.includes(o) || ({}).propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
|
|
9601
|
-
}
|
|
9602
|
-
return i;
|
|
9603
|
-
}
|
|
9604
|
-
function _objectWithoutPropertiesLoose5(r, e) {
|
|
9605
|
-
if (null == r) return {};
|
|
9606
|
-
var t = {};
|
|
9607
|
-
for(var n in r)if (({}).hasOwnProperty.call(r, n)) {
|
|
9608
|
-
if (e.includes(n)) continue;
|
|
9609
|
-
t[n] = r[n];
|
|
9610
|
-
}
|
|
9611
|
-
return t;
|
|
9612
|
-
}
|
|
9613
|
-
function asyncGeneratorStep12(n, t, e, r, o, a, c) {
|
|
9380
|
+
// src/hooks/audioRuntimes/useTtsAudioRuntime/blobToData.ts
|
|
9381
|
+
var blobToData = function(blob) {
|
|
9382
|
+
return new Promise(function(resolve) {
|
|
9383
|
+
var reader = new FileReader();
|
|
9384
|
+
reader.onloadend = function() {
|
|
9385
|
+
return resolve(reader.result);
|
|
9386
|
+
};
|
|
9387
|
+
reader.readAsDataURL(blob);
|
|
9388
|
+
});
|
|
9389
|
+
};
|
|
9390
|
+
// src/hooks/audioRuntimes/useTtsAudioRuntime/index.ts
|
|
9391
|
+
function asyncGeneratorStep11(n, t, e, r, o, a, c) {
|
|
9614
9392
|
try {
|
|
9615
9393
|
var i = n[a](c), u = i.value;
|
|
9616
9394
|
} catch (n2) {
|
|
@@ -9618,27 +9396,37 @@ function asyncGeneratorStep12(n, t, e, r, o, a, c) {
|
|
|
9618
9396
|
}
|
|
9619
9397
|
i.done ? t(u) : Promise.resolve(u).then(r, o);
|
|
9620
9398
|
}
|
|
9621
|
-
function
|
|
9399
|
+
function _asyncToGenerator11(n) {
|
|
9622
9400
|
return function() {
|
|
9623
9401
|
var t = this, e = arguments;
|
|
9624
9402
|
return new Promise(function(r, o) {
|
|
9625
9403
|
var a = n.apply(t, e);
|
|
9626
9404
|
function _next(n2) {
|
|
9627
|
-
|
|
9405
|
+
asyncGeneratorStep11(a, r, o, _next, _throw, "next", n2);
|
|
9628
9406
|
}
|
|
9629
9407
|
function _throw(n2) {
|
|
9630
|
-
|
|
9408
|
+
asyncGeneratorStep11(a, r, o, _next, _throw, "throw", n2);
|
|
9631
9409
|
}
|
|
9632
9410
|
_next(void 0);
|
|
9633
9411
|
});
|
|
9634
9412
|
};
|
|
9635
9413
|
}
|
|
9636
|
-
var
|
|
9637
|
-
var $ =
|
|
9638
|
-
var
|
|
9414
|
+
var useTtsAudioRuntime = function(t0) {
|
|
9415
|
+
var $ = _c50(30);
|
|
9416
|
+
var play = t0.play;
|
|
9639
9417
|
var addToast = useToasts().addToast;
|
|
9640
9418
|
var queryClient = useQueryClient6();
|
|
9641
9419
|
var threadContext = useSuperinterfaceContext();
|
|
9420
|
+
var t1;
|
|
9421
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
9422
|
+
t1 = {
|
|
9423
|
+
name: "microphone"
|
|
9424
|
+
};
|
|
9425
|
+
$[0] = t1;
|
|
9426
|
+
} else {
|
|
9427
|
+
t1 = $[0];
|
|
9428
|
+
}
|
|
9429
|
+
var microphonePermission = usePermission(t1);
|
|
9642
9430
|
var createMessageProps = useCreateMessage({
|
|
9643
9431
|
onError: function(error) {
|
|
9644
9432
|
createMessageDefaultOnError({
|
|
@@ -9649,13 +9437,13 @@ var Content8 = function(t0) {
|
|
|
9649
9437
|
recorderProps.start();
|
|
9650
9438
|
}
|
|
9651
9439
|
});
|
|
9652
|
-
var
|
|
9653
|
-
if ($[
|
|
9654
|
-
|
|
9440
|
+
var t2;
|
|
9441
|
+
if ($[1] !== createMessageProps) {
|
|
9442
|
+
t2 = {
|
|
9655
9443
|
isStopOnSilence: true,
|
|
9656
9444
|
onStart: _temp12,
|
|
9657
9445
|
onStop: function() {
|
|
9658
|
-
var _onStop =
|
|
9446
|
+
var _onStop = _asyncToGenerator11(function(_event, chunks) {
|
|
9659
9447
|
var blob, audioContent;
|
|
9660
9448
|
return _ts_generator(this, function(_state) {
|
|
9661
9449
|
switch(_state.label){
|
|
@@ -9684,22 +9472,12 @@ var Content8 = function(t0) {
|
|
|
9684
9472
|
return onStop;
|
|
9685
9473
|
}()
|
|
9686
9474
|
};
|
|
9687
|
-
$[
|
|
9688
|
-
$[1] = t1;
|
|
9689
|
-
} else {
|
|
9690
|
-
t1 = $[1];
|
|
9691
|
-
}
|
|
9692
|
-
var recorderProps = useRecorder(t1);
|
|
9693
|
-
var t2;
|
|
9694
|
-
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
|
|
9695
|
-
t2 = {
|
|
9696
|
-
name: "microphone"
|
|
9697
|
-
};
|
|
9475
|
+
$[1] = createMessageProps;
|
|
9698
9476
|
$[2] = t2;
|
|
9699
9477
|
} else {
|
|
9700
9478
|
t2 = $[2];
|
|
9701
9479
|
}
|
|
9702
|
-
var
|
|
9480
|
+
var recorderProps = useRecorder(t2);
|
|
9703
9481
|
var t3;
|
|
9704
9482
|
if ($[3] !== microphonePermission || $[4] !== recorderProps) {
|
|
9705
9483
|
t3 = function() {
|
|
@@ -9726,81 +9504,91 @@ var Content8 = function(t0) {
|
|
|
9726
9504
|
t4 = $[8];
|
|
9727
9505
|
}
|
|
9728
9506
|
var messageAudioProps = useMessageAudio(t4);
|
|
9729
|
-
|
|
9730
|
-
|
|
9731
|
-
|
|
9732
|
-
|
|
9733
|
-
|
|
9734
|
-
|
|
9735
|
-
|
|
9736
|
-
|
|
9737
|
-
|
|
9738
|
-
$[10] = messageAudioProps;
|
|
9739
|
-
$[11] = t5;
|
|
9740
|
-
$[12] = t6;
|
|
9741
|
-
} else {
|
|
9742
|
-
t6 = $[12];
|
|
9743
|
-
}
|
|
9744
|
-
var status = useStatus(t6).status;
|
|
9507
|
+
recorderProps;
|
|
9508
|
+
recorderProps;
|
|
9509
|
+
recorderProps;
|
|
9510
|
+
recorderProps;
|
|
9511
|
+
recorderProps;
|
|
9512
|
+
recorderProps;
|
|
9513
|
+
recorderProps;
|
|
9514
|
+
var t5;
|
|
9515
|
+
var t6 = recorderProps;
|
|
9745
9516
|
var t7 = recorderProps;
|
|
9746
|
-
var t8;
|
|
9747
|
-
|
|
9748
|
-
|
|
9749
|
-
|
|
9750
|
-
|
|
9751
|
-
|
|
9517
|
+
var t8 = recorderProps;
|
|
9518
|
+
var t9 = recorderProps;
|
|
9519
|
+
var t10 = recorderProps;
|
|
9520
|
+
var t11 = recorderProps;
|
|
9521
|
+
var t12;
|
|
9522
|
+
if ($[9] !== createMessageProps.isPending || $[10] !== t10.visualizationAnalyser || $[11] !== t11.status || $[12] !== t6.start || $[13] !== t7.stop || $[14] !== t8.pause || $[15] !== t9.resume) {
|
|
9523
|
+
t12 = {
|
|
9524
|
+
start: t6.start,
|
|
9525
|
+
stop: t7.stop,
|
|
9526
|
+
pause: t8.pause,
|
|
9527
|
+
resume: t9.resume,
|
|
9528
|
+
isPending: createMessageProps.isPending,
|
|
9529
|
+
visualizationAnalyser: t10.visualizationAnalyser,
|
|
9530
|
+
rawStatus: t11.status
|
|
9752
9531
|
};
|
|
9753
|
-
$[
|
|
9754
|
-
$[
|
|
9755
|
-
$[
|
|
9756
|
-
$[
|
|
9532
|
+
$[9] = createMessageProps.isPending;
|
|
9533
|
+
$[10] = t10.visualizationAnalyser;
|
|
9534
|
+
$[11] = t11.status;
|
|
9535
|
+
$[12] = t6.start;
|
|
9536
|
+
$[13] = t7.stop;
|
|
9537
|
+
$[14] = t8.pause;
|
|
9538
|
+
$[15] = t9.resume;
|
|
9539
|
+
$[16] = t12;
|
|
9757
9540
|
} else {
|
|
9758
|
-
|
|
9541
|
+
t12 = $[16];
|
|
9759
9542
|
}
|
|
9760
|
-
var
|
|
9761
|
-
if ($[17] !==
|
|
9762
|
-
|
|
9763
|
-
|
|
9764
|
-
|
|
9765
|
-
|
|
9766
|
-
|
|
9767
|
-
|
|
9768
|
-
|
|
9769
|
-
|
|
9770
|
-
|
|
9771
|
-
|
|
9772
|
-
|
|
9773
|
-
|
|
9774
|
-
|
|
9775
|
-
|
|
9776
|
-
|
|
9777
|
-
|
|
9778
|
-
|
|
9779
|
-
|
|
9780
|
-
|
|
9781
|
-
|
|
9782
|
-
|
|
9783
|
-
$[
|
|
9784
|
-
|
|
9785
|
-
$[
|
|
9543
|
+
var t13;
|
|
9544
|
+
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) {
|
|
9545
|
+
t13 = {
|
|
9546
|
+
play: messageAudioProps.play,
|
|
9547
|
+
pause: messageAudioProps.pause,
|
|
9548
|
+
stop: messageAudioProps.stop,
|
|
9549
|
+
visualizationAnalyser: messageAudioProps.visualizationAnalyser,
|
|
9550
|
+
playing: messageAudioProps.playing,
|
|
9551
|
+
paused: messageAudioProps.paused,
|
|
9552
|
+
isPending: messageAudioProps.isPending,
|
|
9553
|
+
isReady: messageAudioProps.isReady,
|
|
9554
|
+
isAudioPlayed: messageAudioProps.isAudioPlayed,
|
|
9555
|
+
rawStatus: void 0
|
|
9556
|
+
};
|
|
9557
|
+
$[17] = messageAudioProps.isAudioPlayed;
|
|
9558
|
+
$[18] = messageAudioProps.isPending;
|
|
9559
|
+
$[19] = messageAudioProps.isReady;
|
|
9560
|
+
$[20] = messageAudioProps.pause;
|
|
9561
|
+
$[21] = messageAudioProps.paused;
|
|
9562
|
+
$[22] = messageAudioProps.play;
|
|
9563
|
+
$[23] = messageAudioProps.playing;
|
|
9564
|
+
$[24] = messageAudioProps.stop;
|
|
9565
|
+
$[25] = messageAudioProps.visualizationAnalyser;
|
|
9566
|
+
$[26] = t13;
|
|
9567
|
+
} else {
|
|
9568
|
+
t13 = $[26];
|
|
9569
|
+
}
|
|
9570
|
+
var t14;
|
|
9571
|
+
if ($[27] !== t12 || $[28] !== t13) {
|
|
9572
|
+
t14 = {
|
|
9573
|
+
ttsAudioRuntime: {
|
|
9574
|
+
user: t12,
|
|
9575
|
+
assistant: t13
|
|
9576
|
+
}
|
|
9577
|
+
};
|
|
9578
|
+
$[27] = t12;
|
|
9579
|
+
$[28] = t13;
|
|
9580
|
+
$[29] = t14;
|
|
9786
9581
|
} else {
|
|
9787
|
-
|
|
9582
|
+
t14 = $[29];
|
|
9788
9583
|
}
|
|
9789
|
-
|
|
9790
|
-
|
|
9791
|
-
var Root12 = function(_ref) {
|
|
9792
|
-
var children = _ref.children, rest = _objectWithoutProperties5(_ref, _excluded5);
|
|
9793
|
-
return /* @__PURE__ */ _jsx82(ToastsProvider, {
|
|
9794
|
-
children: /* @__PURE__ */ _jsx82(Content8, _objectSpread46(_objectSpread46({}, rest), {}, {
|
|
9795
|
-
children: children
|
|
9796
|
-
}))
|
|
9797
|
-
});
|
|
9584
|
+
t5 = t14;
|
|
9585
|
+
return t5;
|
|
9798
9586
|
};
|
|
9799
9587
|
function _temp12() {
|
|
9800
9588
|
return _temp23.apply(this, arguments);
|
|
9801
9589
|
}
|
|
9802
9590
|
function _temp23() {
|
|
9803
|
-
_temp23 =
|
|
9591
|
+
_temp23 = _asyncToGenerator11(function() {
|
|
9804
9592
|
return _ts_generator(this, function(_state) {
|
|
9805
9593
|
return [
|
|
9806
9594
|
2
|
|
@@ -9809,21 +9597,215 @@ function _temp23() {
|
|
|
9809
9597
|
});
|
|
9810
9598
|
return _temp23.apply(this, arguments);
|
|
9811
9599
|
}
|
|
9600
|
+
// src/components/audioRuntimes/TtsAudioRuntimeProvider.tsx
|
|
9601
|
+
import { jsx as _jsx82 } from "react/jsx-runtime";
|
|
9602
|
+
var TtsAudioRuntimeProvider = function(t0) {
|
|
9603
|
+
var $ = _c51(7);
|
|
9604
|
+
var children = t0.children, play = t0.play;
|
|
9605
|
+
var t1;
|
|
9606
|
+
if ($[0] !== play) {
|
|
9607
|
+
t1 = {
|
|
9608
|
+
play: play
|
|
9609
|
+
};
|
|
9610
|
+
$[0] = play;
|
|
9611
|
+
$[1] = t1;
|
|
9612
|
+
} else {
|
|
9613
|
+
t1 = $[1];
|
|
9614
|
+
}
|
|
9615
|
+
var ttsAudioRuntime = useTtsAudioRuntime(t1).ttsAudioRuntime;
|
|
9616
|
+
var t2;
|
|
9617
|
+
if ($[2] !== ttsAudioRuntime) {
|
|
9618
|
+
t2 = {
|
|
9619
|
+
audioRuntime: ttsAudioRuntime
|
|
9620
|
+
};
|
|
9621
|
+
$[2] = ttsAudioRuntime;
|
|
9622
|
+
$[3] = t2;
|
|
9623
|
+
} else {
|
|
9624
|
+
t2 = $[3];
|
|
9625
|
+
}
|
|
9626
|
+
var t3;
|
|
9627
|
+
if ($[4] !== children || $[5] !== t2) {
|
|
9628
|
+
t3 = /* @__PURE__ */ _jsx82(AudioThreadContext.Provider, {
|
|
9629
|
+
value: t2,
|
|
9630
|
+
children: children
|
|
9631
|
+
});
|
|
9632
|
+
$[4] = children;
|
|
9633
|
+
$[5] = t2;
|
|
9634
|
+
$[6] = t3;
|
|
9635
|
+
} else {
|
|
9636
|
+
t3 = $[6];
|
|
9637
|
+
}
|
|
9638
|
+
return t3;
|
|
9639
|
+
};
|
|
9640
|
+
// src/components/threads/AudioThread/Root/index.tsx
|
|
9641
|
+
import { jsx as _jsx83 } from "react/jsx-runtime";
|
|
9642
|
+
var _excluded5 = [
|
|
9643
|
+
"children"
|
|
9644
|
+
];
|
|
9645
|
+
var _excluded22 = [
|
|
9646
|
+
"children",
|
|
9647
|
+
"play",
|
|
9648
|
+
"className",
|
|
9649
|
+
"style"
|
|
9650
|
+
];
|
|
9651
|
+
function ownKeys46(e, r) {
|
|
9652
|
+
var t = Object.keys(e);
|
|
9653
|
+
if (Object.getOwnPropertySymbols) {
|
|
9654
|
+
var o = Object.getOwnPropertySymbols(e);
|
|
9655
|
+
r && (o = o.filter(function(r2) {
|
|
9656
|
+
return Object.getOwnPropertyDescriptor(e, r2).enumerable;
|
|
9657
|
+
})), t.push.apply(t, o);
|
|
9658
|
+
}
|
|
9659
|
+
return t;
|
|
9660
|
+
}
|
|
9661
|
+
function _objectSpread46(e) {
|
|
9662
|
+
for(var r = 1; r < arguments.length; r++){
|
|
9663
|
+
var t = null != arguments[r] ? arguments[r] : {};
|
|
9664
|
+
r % 2 ? ownKeys46(Object(t), true).forEach(function(r2) {
|
|
9665
|
+
_defineProperty46(e, r2, t[r2]);
|
|
9666
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys46(Object(t)).forEach(function(r2) {
|
|
9667
|
+
Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2));
|
|
9668
|
+
});
|
|
9669
|
+
}
|
|
9670
|
+
return e;
|
|
9671
|
+
}
|
|
9672
|
+
function _defineProperty46(e, r, t) {
|
|
9673
|
+
return (r = _toPropertyKey46(r)) in e ? Object.defineProperty(e, r, {
|
|
9674
|
+
value: t,
|
|
9675
|
+
enumerable: true,
|
|
9676
|
+
configurable: true,
|
|
9677
|
+
writable: true
|
|
9678
|
+
}) : e[r] = t, e;
|
|
9679
|
+
}
|
|
9680
|
+
function _toPropertyKey46(t) {
|
|
9681
|
+
var i = _toPrimitive46(t, "string");
|
|
9682
|
+
return "symbol" == (typeof i === "undefined" ? "undefined" : _type_of(i)) ? i : i + "";
|
|
9683
|
+
}
|
|
9684
|
+
function _toPrimitive46(t, r) {
|
|
9685
|
+
if ("object" != (typeof t === "undefined" ? "undefined" : _type_of(t)) || !t) return t;
|
|
9686
|
+
var e = t[Symbol.toPrimitive];
|
|
9687
|
+
if (void 0 !== e) {
|
|
9688
|
+
var i = e.call(t, r || "default");
|
|
9689
|
+
if ("object" != (typeof i === "undefined" ? "undefined" : _type_of(i))) return i;
|
|
9690
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
9691
|
+
}
|
|
9692
|
+
return ("string" === r ? String : Number)(t);
|
|
9693
|
+
}
|
|
9694
|
+
function _objectWithoutProperties5(e, t) {
|
|
9695
|
+
if (null == e) return {};
|
|
9696
|
+
var o, r, i = _objectWithoutPropertiesLoose5(e, t);
|
|
9697
|
+
if (Object.getOwnPropertySymbols) {
|
|
9698
|
+
var s = Object.getOwnPropertySymbols(e);
|
|
9699
|
+
for(r = 0; r < s.length; r++)o = s[r], t.includes(o) || ({}).propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
|
|
9700
|
+
}
|
|
9701
|
+
return i;
|
|
9702
|
+
}
|
|
9703
|
+
function _objectWithoutPropertiesLoose5(r, e) {
|
|
9704
|
+
if (null == r) return {};
|
|
9705
|
+
var t = {};
|
|
9706
|
+
for(var n in r)if (({}).hasOwnProperty.call(r, n)) {
|
|
9707
|
+
if (e.includes(n)) continue;
|
|
9708
|
+
t[n] = r[n];
|
|
9709
|
+
}
|
|
9710
|
+
return t;
|
|
9711
|
+
}
|
|
9712
|
+
var Content8 = function(_ref) {
|
|
9713
|
+
var children = _ref.children, className = _ref.className, style = _ref.style;
|
|
9714
|
+
return /* @__PURE__ */ _jsx83(Flex29, {
|
|
9715
|
+
direction: "column",
|
|
9716
|
+
flexGrow: "1",
|
|
9717
|
+
p: "9",
|
|
9718
|
+
className: className,
|
|
9719
|
+
style: style,
|
|
9720
|
+
children: children
|
|
9721
|
+
});
|
|
9722
|
+
};
|
|
9723
|
+
var AudioRuntimeProvider = function(t0) {
|
|
9724
|
+
var $ = _c52(3);
|
|
9725
|
+
var children = t0.children, play = t0.play;
|
|
9726
|
+
var audioThreadContext = useAudioThreadContext();
|
|
9727
|
+
if (audioThreadContext.audioRuntime) {
|
|
9728
|
+
return children;
|
|
9729
|
+
}
|
|
9730
|
+
var t1;
|
|
9731
|
+
if ($[0] !== children || $[1] !== play) {
|
|
9732
|
+
t1 = /* @__PURE__ */ _jsx83(TtsAudioRuntimeProvider, {
|
|
9733
|
+
play: play,
|
|
9734
|
+
children: children
|
|
9735
|
+
});
|
|
9736
|
+
$[0] = children;
|
|
9737
|
+
$[1] = play;
|
|
9738
|
+
$[2] = t1;
|
|
9739
|
+
} else {
|
|
9740
|
+
t1 = $[2];
|
|
9741
|
+
}
|
|
9742
|
+
return t1;
|
|
9743
|
+
};
|
|
9744
|
+
var Provider5 = function(t0) {
|
|
9745
|
+
var $ = _c52(9);
|
|
9746
|
+
var children;
|
|
9747
|
+
var rest;
|
|
9748
|
+
if ($[0] !== t0) {
|
|
9749
|
+
var _t = t0;
|
|
9750
|
+
children = _t.children;
|
|
9751
|
+
rest = _objectWithoutProperties5(_t, _excluded5);
|
|
9752
|
+
_t;
|
|
9753
|
+
$[0] = t0;
|
|
9754
|
+
$[1] = children;
|
|
9755
|
+
$[2] = rest;
|
|
9756
|
+
} else {
|
|
9757
|
+
children = $[1];
|
|
9758
|
+
rest = $[2];
|
|
9759
|
+
}
|
|
9760
|
+
var audioThreadContext = useAudioThreadContext();
|
|
9761
|
+
var t1;
|
|
9762
|
+
if ($[3] !== audioThreadContext || $[4] !== rest) {
|
|
9763
|
+
t1 = _objectSpread46(_objectSpread46({}, audioThreadContext), rest);
|
|
9764
|
+
$[3] = audioThreadContext;
|
|
9765
|
+
$[4] = rest;
|
|
9766
|
+
$[5] = t1;
|
|
9767
|
+
} else {
|
|
9768
|
+
t1 = $[5];
|
|
9769
|
+
}
|
|
9770
|
+
var t2;
|
|
9771
|
+
if ($[6] !== children || $[7] !== t1) {
|
|
9772
|
+
t2 = /* @__PURE__ */ _jsx83(AudioThreadContext.Provider, {
|
|
9773
|
+
value: t1,
|
|
9774
|
+
children: children
|
|
9775
|
+
});
|
|
9776
|
+
$[6] = children;
|
|
9777
|
+
$[7] = t1;
|
|
9778
|
+
$[8] = t2;
|
|
9779
|
+
} else {
|
|
9780
|
+
t2 = $[8];
|
|
9781
|
+
}
|
|
9782
|
+
return t2;
|
|
9783
|
+
};
|
|
9784
|
+
var Root12 = function(_ref2) {
|
|
9785
|
+
var children = _ref2.children, play = _ref2.play, className = _ref2.className, style = _ref2.style, rest = _objectWithoutProperties5(_ref2, _excluded22);
|
|
9786
|
+
return /* @__PURE__ */ _jsx83(Provider5, _objectSpread46(_objectSpread46({}, rest), {}, {
|
|
9787
|
+
children: /* @__PURE__ */ _jsx83(AudioRuntimeProvider, {
|
|
9788
|
+
play: play,
|
|
9789
|
+
children: /* @__PURE__ */ _jsx83(ToastsProvider, {
|
|
9790
|
+
children: /* @__PURE__ */ _jsx83(Content8, {
|
|
9791
|
+
className: className,
|
|
9792
|
+
style: style,
|
|
9793
|
+
children: children
|
|
9794
|
+
})
|
|
9795
|
+
})
|
|
9796
|
+
})
|
|
9797
|
+
}));
|
|
9798
|
+
};
|
|
9812
9799
|
// src/components/threads/AudioThread/Visualization/index.tsx
|
|
9813
9800
|
import { useContext as useContext16, useState as useState11, useCallback as useCallback8, useEffect as useEffect12 } from "react";
|
|
9814
9801
|
import _9 from "lodash";
|
|
9815
9802
|
import { Flex as Flex31 } from "@radix-ui/themes";
|
|
9816
|
-
// src/hooks/threads/useAudioThreadContext/index.ts
|
|
9817
|
-
import { useContext as useContext15 } from "react";
|
|
9818
|
-
var useAudioThreadContext = function() {
|
|
9819
|
-
return useContext15(AudioThreadContext);
|
|
9820
|
-
};
|
|
9821
9803
|
// src/components/threads/AudioThread/BarsVisualizer/index.tsx
|
|
9822
9804
|
import _8 from "lodash";
|
|
9823
9805
|
import { Flex as Flex30, Grid } from "@radix-ui/themes";
|
|
9824
9806
|
import { useState as useState10, useEffect as useEffect11, useCallback as useCallback7 } from "react";
|
|
9825
9807
|
import { cluster } from "radash";
|
|
9826
|
-
import { jsx as
|
|
9808
|
+
import { jsx as _jsx84 } from "react/jsx-runtime";
|
|
9827
9809
|
var barCount = 4;
|
|
9828
9810
|
var BarsVisualizer = function(_ref) {
|
|
9829
9811
|
var visualizationAnalyser = _ref.visualizationAnalyser, backgroundColor = _ref.backgroundColor, height = _ref.height, barWidth = _ref.barWidth;
|
|
@@ -9854,7 +9836,7 @@ var BarsVisualizer = function(_ref) {
|
|
|
9854
9836
|
draw,
|
|
9855
9837
|
visualizationAnalyser
|
|
9856
9838
|
]);
|
|
9857
|
-
return /* @__PURE__ */
|
|
9839
|
+
return /* @__PURE__ */ _jsx84(Grid, {
|
|
9858
9840
|
columns: "".concat(barCount),
|
|
9859
9841
|
gap: "1",
|
|
9860
9842
|
width: "auto",
|
|
@@ -9863,12 +9845,12 @@ var BarsVisualizer = function(_ref) {
|
|
|
9863
9845
|
gridTemplateColumns: "repeat(4, minmax(0, 1fr))"
|
|
9864
9846
|
},
|
|
9865
9847
|
children: barHeights.map(function(barHeight, index) {
|
|
9866
|
-
return /* @__PURE__ */
|
|
9848
|
+
return /* @__PURE__ */ _jsx84(Flex30, {
|
|
9867
9849
|
direction: "column",
|
|
9868
9850
|
align: "center",
|
|
9869
9851
|
justify: "center",
|
|
9870
9852
|
height: height,
|
|
9871
|
-
children: /* @__PURE__ */
|
|
9853
|
+
children: /* @__PURE__ */ _jsx84(Flex30, {
|
|
9872
9854
|
minHeight: "50%",
|
|
9873
9855
|
maxHeight: "100%",
|
|
9874
9856
|
height: "".concat(barHeight + 20, "%"),
|
|
@@ -9882,8 +9864,59 @@ var BarsVisualizer = function(_ref) {
|
|
|
9882
9864
|
})
|
|
9883
9865
|
});
|
|
9884
9866
|
};
|
|
9867
|
+
// src/hooks/audioThreads/useStatus/index.ts
|
|
9868
|
+
import { c as _c53 } from "react-compiler-runtime";
|
|
9869
|
+
import { useMemo as useMemo19 } from "react";
|
|
9870
|
+
var useStatus = function() {
|
|
9871
|
+
var $ = _c53(2);
|
|
9872
|
+
var audioRuntime = useAudioThreadContext().audioRuntime;
|
|
9873
|
+
var t0;
|
|
9874
|
+
bb0: {
|
|
9875
|
+
if (audioRuntime.user.rawStatus === "recording") {
|
|
9876
|
+
t0 = "recording";
|
|
9877
|
+
break bb0;
|
|
9878
|
+
}
|
|
9879
|
+
if (audioRuntime.user.isPending) {
|
|
9880
|
+
t0 = "creatingMessage";
|
|
9881
|
+
break bb0;
|
|
9882
|
+
}
|
|
9883
|
+
if (audioRuntime.assistant.paused || !audioRuntime.assistant.isAudioPlayed) {
|
|
9884
|
+
t0 = "playerPaused";
|
|
9885
|
+
break bb0;
|
|
9886
|
+
}
|
|
9887
|
+
if (audioRuntime.assistant.playing || audioRuntime.assistant.isPending) {
|
|
9888
|
+
t0 = "playing";
|
|
9889
|
+
break bb0;
|
|
9890
|
+
}
|
|
9891
|
+
if (!audioRuntime.assistant.isAudioPlayed && !audioRuntime.assistant.isReady) {
|
|
9892
|
+
t0 = "loading";
|
|
9893
|
+
break bb0;
|
|
9894
|
+
}
|
|
9895
|
+
if (audioRuntime.user.rawStatus === "idle") {
|
|
9896
|
+
t0 = "idle";
|
|
9897
|
+
break bb0;
|
|
9898
|
+
}
|
|
9899
|
+
if (audioRuntime.user.rawStatus === "paused") {
|
|
9900
|
+
t0 = "recorderPaused";
|
|
9901
|
+
break bb0;
|
|
9902
|
+
}
|
|
9903
|
+
t0 = "loading";
|
|
9904
|
+
}
|
|
9905
|
+
var status = t0;
|
|
9906
|
+
var t1;
|
|
9907
|
+
if ($[0] !== status) {
|
|
9908
|
+
t1 = {
|
|
9909
|
+
status: status
|
|
9910
|
+
};
|
|
9911
|
+
$[0] = status;
|
|
9912
|
+
$[1] = t1;
|
|
9913
|
+
} else {
|
|
9914
|
+
t1 = $[1];
|
|
9915
|
+
}
|
|
9916
|
+
return t1;
|
|
9917
|
+
};
|
|
9885
9918
|
// src/components/threads/AudioThread/Visualization/index.tsx
|
|
9886
|
-
import { jsx as
|
|
9919
|
+
import { jsx as _jsx85, jsxs as _jsxs31 } from "react/jsx-runtime";
|
|
9887
9920
|
function ownKeys47(e, r) {
|
|
9888
9921
|
var t = Object.keys(e);
|
|
9889
9922
|
if (Object.getOwnPropertySymbols) {
|
|
@@ -9928,6 +9961,7 @@ function _toPrimitive47(t, r) {
|
|
|
9928
9961
|
return ("string" === r ? String : Number)(t);
|
|
9929
9962
|
}
|
|
9930
9963
|
var Visualization = function(props) {
|
|
9964
|
+
var status = useStatus().status;
|
|
9931
9965
|
var audioThreadContext = useAudioThreadContext();
|
|
9932
9966
|
var assistantNameContext = useContext16(AssistantNameContext);
|
|
9933
9967
|
var _useState11 = _sliced_to_array(useState11(0), 2), scale = _useState11[0], setScale = _useState11[1];
|
|
@@ -9948,7 +9982,7 @@ var Visualization = function(props) {
|
|
|
9948
9982
|
}, []);
|
|
9949
9983
|
useEffect12(function() {
|
|
9950
9984
|
draw({
|
|
9951
|
-
visualizationAnalyser: audioThreadContext.
|
|
9985
|
+
visualizationAnalyser: audioThreadContext.audioRuntime.user.visualizationAnalyser
|
|
9952
9986
|
});
|
|
9953
9987
|
}, [
|
|
9954
9988
|
draw,
|
|
@@ -9962,19 +9996,19 @@ var Visualization = function(props) {
|
|
|
9962
9996
|
flexGrow: "1"
|
|
9963
9997
|
}, props), {}, {
|
|
9964
9998
|
children: [
|
|
9965
|
-
/* @__PURE__ */
|
|
9999
|
+
/* @__PURE__ */ _jsx85(Flex31, {
|
|
9966
10000
|
align: "center",
|
|
9967
10001
|
justify: "center",
|
|
9968
10002
|
height: "200px",
|
|
9969
10003
|
width: "200px",
|
|
9970
10004
|
style: {
|
|
9971
|
-
backgroundColor:
|
|
10005
|
+
backgroundColor: status === "playing" ? "var(--accent-4)" : "var(--gray-4)",
|
|
9972
10006
|
borderRadius: "9999px",
|
|
9973
10007
|
scale: scale
|
|
9974
10008
|
},
|
|
9975
|
-
children: /* @__PURE__ */
|
|
9976
|
-
visualizationAnalyser: audioThreadContext.
|
|
9977
|
-
backgroundColor:
|
|
10009
|
+
children: /* @__PURE__ */ _jsx85(BarsVisualizer, {
|
|
10010
|
+
visualizationAnalyser: audioThreadContext.audioRuntime.assistant.visualizationAnalyser,
|
|
10011
|
+
backgroundColor: status === "playing" ? "var(--accent-11)" : "var(--gray-11)",
|
|
9978
10012
|
height: "40px",
|
|
9979
10013
|
barWidth: "24px"
|
|
9980
10014
|
})
|
|
@@ -9984,8 +10018,8 @@ var Visualization = function(props) {
|
|
|
9984
10018
|
gap: "3",
|
|
9985
10019
|
pt: "5",
|
|
9986
10020
|
children: [
|
|
9987
|
-
/* @__PURE__ */
|
|
9988
|
-
/* @__PURE__ */
|
|
10021
|
+
/* @__PURE__ */ _jsx85(AssistantAvatar, {}),
|
|
10022
|
+
/* @__PURE__ */ _jsx85(Name, {
|
|
9989
10023
|
children: assistantNameContext
|
|
9990
10024
|
})
|
|
9991
10025
|
]
|
|
@@ -9994,10 +10028,10 @@ var Visualization = function(props) {
|
|
|
9994
10028
|
}));
|
|
9995
10029
|
};
|
|
9996
10030
|
// src/components/threads/AudioThread/Status/index.tsx
|
|
9997
|
-
import { c as
|
|
10031
|
+
import { c as _c54 } from "react-compiler-runtime";
|
|
9998
10032
|
// src/components/threads/AudioThread/Status/StatusMessages.tsx
|
|
9999
10033
|
import { Flex as Flex32, Text as Text9 } from "@radix-ui/themes";
|
|
10000
|
-
import { jsx as
|
|
10034
|
+
import { jsx as _jsx86, jsxs as _jsxs32 } from "react/jsx-runtime";
|
|
10001
10035
|
var html = function(_ref) {
|
|
10002
10036
|
var texts = _ref.texts;
|
|
10003
10037
|
return "\n .status-messages-texts:after {\n content: '".concat(texts[0], "';\n animation: texts ").concat(texts.length * 5, "s linear infinite;\n }\n\n @keyframes texts {\n ").concat(texts.map(function(_10, i) {
|
|
@@ -10012,13 +10046,13 @@ var StatusMessages = function(_ref2) {
|
|
|
10012
10046
|
className: className,
|
|
10013
10047
|
style: style,
|
|
10014
10048
|
children: [
|
|
10015
|
-
/* @__PURE__ */
|
|
10049
|
+
/* @__PURE__ */ _jsx86(Text9, {
|
|
10016
10050
|
size: "2",
|
|
10017
10051
|
weight: "regular",
|
|
10018
10052
|
color: "gray",
|
|
10019
10053
|
className: "status-messages-texts"
|
|
10020
10054
|
}),
|
|
10021
|
-
/* @__PURE__ */
|
|
10055
|
+
/* @__PURE__ */ _jsx86("style", {
|
|
10022
10056
|
dangerouslySetInnerHTML: {
|
|
10023
10057
|
__html: html({
|
|
10024
10058
|
texts: texts
|
|
@@ -10029,7 +10063,7 @@ var StatusMessages = function(_ref2) {
|
|
|
10029
10063
|
});
|
|
10030
10064
|
};
|
|
10031
10065
|
// src/components/threads/AudioThread/Status/index.tsx
|
|
10032
|
-
import { jsx as
|
|
10066
|
+
import { jsx as _jsx87 } from "react/jsx-runtime";
|
|
10033
10067
|
function ownKeys48(e, r) {
|
|
10034
10068
|
var t = Object.keys(e);
|
|
10035
10069
|
if (Object.getOwnPropertySymbols) {
|
|
@@ -10074,9 +10108,9 @@ function _toPrimitive48(t, r) {
|
|
|
10074
10108
|
return ("string" === r ? String : Number)(t);
|
|
10075
10109
|
}
|
|
10076
10110
|
var Status = function(props) {
|
|
10077
|
-
var $ =
|
|
10078
|
-
var
|
|
10079
|
-
if (
|
|
10111
|
+
var $ = _c54(12);
|
|
10112
|
+
var status = useStatus().status;
|
|
10113
|
+
if (status === "recording") {
|
|
10080
10114
|
var _t;
|
|
10081
10115
|
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
10082
10116
|
_t = [
|
|
@@ -10091,7 +10125,7 @@ var Status = function(props) {
|
|
|
10091
10125
|
}
|
|
10092
10126
|
var _t2;
|
|
10093
10127
|
if ($[1] !== props) {
|
|
10094
|
-
_t2 = /* @__PURE__ */
|
|
10128
|
+
_t2 = /* @__PURE__ */ _jsx87(StatusMessages, _objectSpread48({
|
|
10095
10129
|
texts: _t
|
|
10096
10130
|
}, props));
|
|
10097
10131
|
$[1] = props;
|
|
@@ -10105,7 +10139,7 @@ var Status = function(props) {
|
|
|
10105
10139
|
"recorderPaused",
|
|
10106
10140
|
"idle",
|
|
10107
10141
|
"playerPaused"
|
|
10108
|
-
].includes(
|
|
10142
|
+
].includes(status)) {
|
|
10109
10143
|
var _t3;
|
|
10110
10144
|
if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
|
|
10111
10145
|
_t3 = [
|
|
@@ -10117,7 +10151,7 @@ var Status = function(props) {
|
|
|
10117
10151
|
}
|
|
10118
10152
|
var _t4;
|
|
10119
10153
|
if ($[4] !== props) {
|
|
10120
|
-
_t4 = /* @__PURE__ */
|
|
10154
|
+
_t4 = /* @__PURE__ */ _jsx87(StatusMessages, _objectSpread48({
|
|
10121
10155
|
texts: _t3
|
|
10122
10156
|
}, props));
|
|
10123
10157
|
$[4] = props;
|
|
@@ -10127,7 +10161,7 @@ var Status = function(props) {
|
|
|
10127
10161
|
}
|
|
10128
10162
|
return _t4;
|
|
10129
10163
|
}
|
|
10130
|
-
if (
|
|
10164
|
+
if (status === "playing") {
|
|
10131
10165
|
var _t5;
|
|
10132
10166
|
if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
|
|
10133
10167
|
_t5 = [
|
|
@@ -10139,7 +10173,7 @@ var Status = function(props) {
|
|
|
10139
10173
|
}
|
|
10140
10174
|
var _t6;
|
|
10141
10175
|
if ($[7] !== props) {
|
|
10142
|
-
_t6 = /* @__PURE__ */
|
|
10176
|
+
_t6 = /* @__PURE__ */ _jsx87(StatusMessages, _objectSpread48({
|
|
10143
10177
|
texts: _t5
|
|
10144
10178
|
}, props));
|
|
10145
10179
|
$[7] = props;
|
|
@@ -10160,7 +10194,7 @@ var Status = function(props) {
|
|
|
10160
10194
|
}
|
|
10161
10195
|
var t1;
|
|
10162
10196
|
if ($[10] !== props) {
|
|
10163
|
-
t1 = /* @__PURE__ */
|
|
10197
|
+
t1 = /* @__PURE__ */ _jsx87(StatusMessages, _objectSpread48({
|
|
10164
10198
|
texts: t0
|
|
10165
10199
|
}, props));
|
|
10166
10200
|
$[10] = props;
|
|
@@ -10171,10 +10205,10 @@ var Status = function(props) {
|
|
|
10171
10205
|
return t1;
|
|
10172
10206
|
};
|
|
10173
10207
|
// src/components/threads/AudioThread/Form/index.tsx
|
|
10174
|
-
import { c as
|
|
10208
|
+
import { c as _c56 } from "react-compiler-runtime";
|
|
10175
10209
|
import { Flex as Flex34 } from "@radix-ui/themes";
|
|
10176
10210
|
// src/components/threads/AudioThread/Form/MicIcon.tsx
|
|
10177
|
-
import { jsx as
|
|
10211
|
+
import { jsx as _jsx88 } from "react/jsx-runtime";
|
|
10178
10212
|
function ownKeys49(e, r) {
|
|
10179
10213
|
var t = Object.keys(e);
|
|
10180
10214
|
if (Object.getOwnPropertySymbols) {
|
|
@@ -10219,7 +10253,7 @@ function _toPrimitive49(t, r) {
|
|
|
10219
10253
|
return ("string" === r ? String : Number)(t);
|
|
10220
10254
|
}
|
|
10221
10255
|
var MicIcon = function(props) {
|
|
10222
|
-
return /* @__PURE__ */
|
|
10256
|
+
return /* @__PURE__ */ _jsx88("svg", _objectSpread49(_objectSpread49({
|
|
10223
10257
|
xmlns: "http://www.w3.org/2000/svg",
|
|
10224
10258
|
fill: "currentColor",
|
|
10225
10259
|
stroke: "currentColor",
|
|
@@ -10228,64 +10262,65 @@ var MicIcon = function(props) {
|
|
|
10228
10262
|
height: "15",
|
|
10229
10263
|
width: "15"
|
|
10230
10264
|
}, props), {}, {
|
|
10231
|
-
children: /* @__PURE__ */
|
|
10265
|
+
children: /* @__PURE__ */ _jsx88("path", {
|
|
10232
10266
|
stroke: "none",
|
|
10233
10267
|
d: "M192 0c-53 0-96 43-96 96v160c0 53 43 96 96 96s96-43 96-96V96c0-53-43-96-96-96zM64 216c0-13.3-10.7-24-24-24s-24 10.7-24 24v40c0 89.1 66.2 162.7 152 174.4V464h-48c-13.3 0-24 10.7-24 24s10.7 24 24 24h144c13.3 0 24-10.7 24-24s-10.7-24-24-24h-48v-33.6c85.8-11.7 152-85.3 152-174.4v-40c0-13.3-10.7-24-24-24s-24 10.7-24 24v40c0 70.7-57.3 128-128 128S64 326.7 64 256v-40z"
|
|
10234
10268
|
})
|
|
10235
10269
|
}));
|
|
10236
10270
|
};
|
|
10237
10271
|
// src/components/threads/AudioThread/Form/ActionButton/index.tsx
|
|
10238
|
-
import { c as
|
|
10272
|
+
import { c as _c55 } from "react-compiler-runtime";
|
|
10239
10273
|
import { Flex as Flex33, IconButton as IconButton10 } from "@radix-ui/themes";
|
|
10240
10274
|
import { StopIcon as StopIcon2, PauseIcon as PauseIcon2, ArrowUpIcon as ArrowUpIcon3, ResumeIcon } from "@radix-ui/react-icons";
|
|
10241
|
-
import { jsx as
|
|
10275
|
+
import { jsx as _jsx89, jsxs as _jsxs33 } from "react/jsx-runtime";
|
|
10242
10276
|
var ActionButton = function() {
|
|
10243
|
-
var $ =
|
|
10277
|
+
var $ = _c55(27);
|
|
10278
|
+
var status = useStatus().status;
|
|
10244
10279
|
var audioThreadContext = useAudioThreadContext();
|
|
10245
10280
|
var superinterfaceContext = useSuperinterfaceContext();
|
|
10246
|
-
if (
|
|
10281
|
+
if (status === "recording") {
|
|
10247
10282
|
var _t;
|
|
10248
10283
|
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
10249
|
-
_t = /* @__PURE__ */
|
|
10284
|
+
_t = /* @__PURE__ */ _jsx89(PauseIcon2, {});
|
|
10250
10285
|
$[0] = _t;
|
|
10251
10286
|
} else {
|
|
10252
10287
|
_t = $[0];
|
|
10253
10288
|
}
|
|
10254
10289
|
var t1;
|
|
10255
|
-
if ($[1] !== audioThreadContext.
|
|
10256
|
-
t1 = /* @__PURE__ */
|
|
10290
|
+
if ($[1] !== audioThreadContext.audioRuntime.user.pause) {
|
|
10291
|
+
t1 = /* @__PURE__ */ _jsx89(Flex33, {
|
|
10257
10292
|
mr: "3",
|
|
10258
10293
|
ml: "-7",
|
|
10259
|
-
children: /* @__PURE__ */
|
|
10260
|
-
onClick: audioThreadContext.
|
|
10294
|
+
children: /* @__PURE__ */ _jsx89(IconButton10, {
|
|
10295
|
+
onClick: audioThreadContext.audioRuntime.user.pause,
|
|
10261
10296
|
color: "gray",
|
|
10262
10297
|
variant: "soft",
|
|
10263
10298
|
size: "1",
|
|
10264
10299
|
children: _t
|
|
10265
10300
|
})
|
|
10266
10301
|
});
|
|
10267
|
-
$[1] = audioThreadContext.
|
|
10302
|
+
$[1] = audioThreadContext.audioRuntime.user.pause;
|
|
10268
10303
|
$[2] = t1;
|
|
10269
10304
|
} else {
|
|
10270
10305
|
t1 = $[2];
|
|
10271
10306
|
}
|
|
10272
10307
|
var t2;
|
|
10273
10308
|
if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
|
|
10274
|
-
t2 = /* @__PURE__ */
|
|
10309
|
+
t2 = /* @__PURE__ */ _jsx89(ArrowUpIcon3, {});
|
|
10275
10310
|
$[3] = t2;
|
|
10276
10311
|
} else {
|
|
10277
10312
|
t2 = $[3];
|
|
10278
10313
|
}
|
|
10279
10314
|
var t3;
|
|
10280
|
-
if ($[4] !== audioThreadContext.
|
|
10281
|
-
t3 = /* @__PURE__ */
|
|
10282
|
-
onClick: audioThreadContext.
|
|
10315
|
+
if ($[4] !== audioThreadContext.audioRuntime.user.stop) {
|
|
10316
|
+
t3 = /* @__PURE__ */ _jsx89(IconButton10, {
|
|
10317
|
+
onClick: audioThreadContext.audioRuntime.user.stop,
|
|
10283
10318
|
highContrast: true,
|
|
10284
10319
|
variant: "soft",
|
|
10285
10320
|
size: "4",
|
|
10286
10321
|
children: t2
|
|
10287
10322
|
});
|
|
10288
|
-
$[4] = audioThreadContext.
|
|
10323
|
+
$[4] = audioThreadContext.audioRuntime.user.stop;
|
|
10289
10324
|
$[5] = t3;
|
|
10290
10325
|
} else {
|
|
10291
10326
|
t3 = $[5];
|
|
@@ -10307,57 +10342,57 @@ var ActionButton = function() {
|
|
|
10307
10342
|
}
|
|
10308
10343
|
return t4;
|
|
10309
10344
|
}
|
|
10310
|
-
if (
|
|
10345
|
+
if (status === "recorderPaused") {
|
|
10311
10346
|
var _t2;
|
|
10312
10347
|
if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
|
|
10313
|
-
_t2 = /* @__PURE__ */
|
|
10348
|
+
_t2 = /* @__PURE__ */ _jsx89(ResumeIcon, {});
|
|
10314
10349
|
$[9] = _t2;
|
|
10315
10350
|
} else {
|
|
10316
10351
|
_t2 = $[9];
|
|
10317
10352
|
}
|
|
10318
10353
|
var _t3;
|
|
10319
|
-
if ($[10] !== audioThreadContext.
|
|
10320
|
-
_t3 = /* @__PURE__ */
|
|
10321
|
-
onClick: audioThreadContext.
|
|
10354
|
+
if ($[10] !== audioThreadContext.audioRuntime.user.resume) {
|
|
10355
|
+
_t3 = /* @__PURE__ */ _jsx89(IconButton10, {
|
|
10356
|
+
onClick: audioThreadContext.audioRuntime.user.resume,
|
|
10322
10357
|
color: "red",
|
|
10323
10358
|
size: "4",
|
|
10324
10359
|
children: _t2
|
|
10325
10360
|
});
|
|
10326
|
-
$[10] = audioThreadContext.
|
|
10361
|
+
$[10] = audioThreadContext.audioRuntime.user.resume;
|
|
10327
10362
|
$[11] = _t3;
|
|
10328
10363
|
} else {
|
|
10329
10364
|
_t3 = $[11];
|
|
10330
10365
|
}
|
|
10331
10366
|
return _t3;
|
|
10332
10367
|
}
|
|
10333
|
-
if (
|
|
10368
|
+
if (status === "idle") {
|
|
10334
10369
|
var _t4;
|
|
10335
|
-
if ($[12] !== audioThreadContext.
|
|
10336
|
-
_t4 = /* @__PURE__ */
|
|
10370
|
+
if ($[12] !== audioThreadContext.audioRuntime.user) {
|
|
10371
|
+
_t4 = /* @__PURE__ */ _jsx89(IconButton10, {
|
|
10337
10372
|
onClick: function() {
|
|
10338
|
-
return audioThreadContext.
|
|
10373
|
+
return audioThreadContext.audioRuntime.user.start();
|
|
10339
10374
|
},
|
|
10340
10375
|
size: "4",
|
|
10341
10376
|
color: "red"
|
|
10342
10377
|
});
|
|
10343
|
-
$[12] = audioThreadContext.
|
|
10378
|
+
$[12] = audioThreadContext.audioRuntime.user;
|
|
10344
10379
|
$[13] = _t4;
|
|
10345
10380
|
} else {
|
|
10346
10381
|
_t4 = $[13];
|
|
10347
10382
|
}
|
|
10348
10383
|
return _t4;
|
|
10349
10384
|
}
|
|
10350
|
-
if (
|
|
10385
|
+
if (status === "playing") {
|
|
10351
10386
|
var _t5;
|
|
10352
|
-
if ($[14] !== audioThreadContext.
|
|
10387
|
+
if ($[14] !== audioThreadContext.audioRuntime.assistant || $[15] !== audioThreadContext.audioRuntime.user || $[16] !== superinterfaceContext.createMessageAbortControllerRef.current) {
|
|
10353
10388
|
_t5 = function() {
|
|
10354
10389
|
var _superinterfaceContex;
|
|
10355
|
-
audioThreadContext.
|
|
10390
|
+
audioThreadContext.audioRuntime.assistant.stop();
|
|
10356
10391
|
(_superinterfaceContex = superinterfaceContext.createMessageAbortControllerRef.current) === null || _superinterfaceContex === void 0 || _superinterfaceContex.abort();
|
|
10357
|
-
audioThreadContext.
|
|
10392
|
+
audioThreadContext.audioRuntime.user.start();
|
|
10358
10393
|
};
|
|
10359
|
-
$[14] = audioThreadContext.
|
|
10360
|
-
$[15] = audioThreadContext.
|
|
10394
|
+
$[14] = audioThreadContext.audioRuntime.assistant;
|
|
10395
|
+
$[15] = audioThreadContext.audioRuntime.user;
|
|
10361
10396
|
$[16] = superinterfaceContext.createMessageAbortControllerRef.current;
|
|
10362
10397
|
$[17] = _t5;
|
|
10363
10398
|
} else {
|
|
@@ -10365,14 +10400,14 @@ var ActionButton = function() {
|
|
|
10365
10400
|
}
|
|
10366
10401
|
var _t6;
|
|
10367
10402
|
if ($[18] === Symbol.for("react.memo_cache_sentinel")) {
|
|
10368
|
-
_t6 = /* @__PURE__ */
|
|
10403
|
+
_t6 = /* @__PURE__ */ _jsx89(StopIcon2, {});
|
|
10369
10404
|
$[18] = _t6;
|
|
10370
10405
|
} else {
|
|
10371
10406
|
_t6 = $[18];
|
|
10372
10407
|
}
|
|
10373
10408
|
var _t7;
|
|
10374
10409
|
if ($[19] !== _t5) {
|
|
10375
|
-
_t7 = /* @__PURE__ */
|
|
10410
|
+
_t7 = /* @__PURE__ */ _jsx89(IconButton10, {
|
|
10376
10411
|
onClick: _t5,
|
|
10377
10412
|
size: "4",
|
|
10378
10413
|
color: "gray",
|
|
@@ -10386,27 +10421,27 @@ var ActionButton = function() {
|
|
|
10386
10421
|
}
|
|
10387
10422
|
return _t7;
|
|
10388
10423
|
}
|
|
10389
|
-
if (
|
|
10424
|
+
if (status === "playerPaused") {
|
|
10390
10425
|
var _t8;
|
|
10391
|
-
if ($[21] !== audioThreadContext.
|
|
10426
|
+
if ($[21] !== audioThreadContext.audioRuntime.assistant) {
|
|
10392
10427
|
_t8 = function() {
|
|
10393
|
-
return audioThreadContext.
|
|
10428
|
+
return audioThreadContext.audioRuntime.assistant.play();
|
|
10394
10429
|
};
|
|
10395
|
-
$[21] = audioThreadContext.
|
|
10430
|
+
$[21] = audioThreadContext.audioRuntime.assistant;
|
|
10396
10431
|
$[22] = _t8;
|
|
10397
10432
|
} else {
|
|
10398
10433
|
_t8 = $[22];
|
|
10399
10434
|
}
|
|
10400
10435
|
var _t9;
|
|
10401
10436
|
if ($[23] === Symbol.for("react.memo_cache_sentinel")) {
|
|
10402
|
-
_t9 = /* @__PURE__ */
|
|
10437
|
+
_t9 = /* @__PURE__ */ _jsx89(ResumeIcon, {});
|
|
10403
10438
|
$[23] = _t9;
|
|
10404
10439
|
} else {
|
|
10405
10440
|
_t9 = $[23];
|
|
10406
10441
|
}
|
|
10407
10442
|
var _t10;
|
|
10408
10443
|
if ($[24] !== _t8) {
|
|
10409
|
-
_t10 = /* @__PURE__ */
|
|
10444
|
+
_t10 = /* @__PURE__ */ _jsx89(IconButton10, {
|
|
10410
10445
|
onClick: _t8,
|
|
10411
10446
|
size: "4",
|
|
10412
10447
|
children: _t9
|
|
@@ -10420,7 +10455,7 @@ var ActionButton = function() {
|
|
|
10420
10455
|
}
|
|
10421
10456
|
var t0;
|
|
10422
10457
|
if ($[26] === Symbol.for("react.memo_cache_sentinel")) {
|
|
10423
|
-
t0 = /* @__PURE__ */
|
|
10458
|
+
t0 = /* @__PURE__ */ _jsx89(IconButton10, {
|
|
10424
10459
|
size: "4",
|
|
10425
10460
|
variant: "soft",
|
|
10426
10461
|
disabled: true
|
|
@@ -10432,7 +10467,7 @@ var ActionButton = function() {
|
|
|
10432
10467
|
return t0;
|
|
10433
10468
|
};
|
|
10434
10469
|
// src/components/threads/AudioThread/Form/index.tsx
|
|
10435
|
-
import { jsx as
|
|
10470
|
+
import { jsx as _jsx90, jsxs as _jsxs34 } from "react/jsx-runtime";
|
|
10436
10471
|
function ownKeys50(e, r) {
|
|
10437
10472
|
var t = Object.keys(e);
|
|
10438
10473
|
if (Object.getOwnPropertySymbols) {
|
|
@@ -10477,16 +10512,17 @@ function _toPrimitive50(t, r) {
|
|
|
10477
10512
|
return ("string" === r ? String : Number)(t);
|
|
10478
10513
|
}
|
|
10479
10514
|
var Form = function(props) {
|
|
10480
|
-
var $ =
|
|
10515
|
+
var $ = _c56(17);
|
|
10516
|
+
var status = useStatus().status;
|
|
10481
10517
|
var audioThreadContext = useAudioThreadContext();
|
|
10482
|
-
var t0 =
|
|
10518
|
+
var t0 = status === "recording" ? "var(--accent-11)" : "var(--gray-11)";
|
|
10483
10519
|
var t1;
|
|
10484
10520
|
if ($[0] !== t0) {
|
|
10485
|
-
t1 = /* @__PURE__ */
|
|
10521
|
+
t1 = /* @__PURE__ */ _jsx90(Flex34, {
|
|
10486
10522
|
ml: "-22.5px",
|
|
10487
10523
|
mr: "2",
|
|
10488
10524
|
align: "center",
|
|
10489
|
-
children: /* @__PURE__ */
|
|
10525
|
+
children: /* @__PURE__ */ _jsx90(MicIcon, {
|
|
10490
10526
|
style: {
|
|
10491
10527
|
color: t0
|
|
10492
10528
|
}
|
|
@@ -10497,7 +10533,7 @@ var Form = function(props) {
|
|
|
10497
10533
|
} else {
|
|
10498
10534
|
t1 = $[1];
|
|
10499
10535
|
}
|
|
10500
|
-
var t2 =
|
|
10536
|
+
var t2 = status === "recording" ? "var(--accent-4)" : "var(--gray-4)";
|
|
10501
10537
|
var t3;
|
|
10502
10538
|
if ($[2] !== t2) {
|
|
10503
10539
|
t3 = {
|
|
@@ -10509,16 +10545,16 @@ var Form = function(props) {
|
|
|
10509
10545
|
} else {
|
|
10510
10546
|
t3 = $[3];
|
|
10511
10547
|
}
|
|
10512
|
-
var t4 =
|
|
10548
|
+
var t4 = status === "recording" ? "var(--accent-11)" : "var(--gray-11)";
|
|
10513
10549
|
var t5;
|
|
10514
|
-
if ($[4] !== audioThreadContext.
|
|
10515
|
-
t5 = /* @__PURE__ */
|
|
10516
|
-
visualizationAnalyser: audioThreadContext.
|
|
10550
|
+
if ($[4] !== audioThreadContext.audioRuntime.user.visualizationAnalyser || $[5] !== t4) {
|
|
10551
|
+
t5 = /* @__PURE__ */ _jsx90(BarsVisualizer, {
|
|
10552
|
+
visualizationAnalyser: audioThreadContext.audioRuntime.user.visualizationAnalyser,
|
|
10517
10553
|
backgroundColor: t4,
|
|
10518
10554
|
height: "20px",
|
|
10519
10555
|
barWidth: "12px"
|
|
10520
10556
|
});
|
|
10521
|
-
$[4] = audioThreadContext.
|
|
10557
|
+
$[4] = audioThreadContext.audioRuntime.user.visualizationAnalyser;
|
|
10522
10558
|
$[5] = t4;
|
|
10523
10559
|
$[6] = t5;
|
|
10524
10560
|
} else {
|
|
@@ -10526,7 +10562,7 @@ var Form = function(props) {
|
|
|
10526
10562
|
}
|
|
10527
10563
|
var t6;
|
|
10528
10564
|
if ($[7] !== t3 || $[8] !== t5) {
|
|
10529
|
-
t6 = /* @__PURE__ */
|
|
10565
|
+
t6 = /* @__PURE__ */ _jsx90(Flex34, {
|
|
10530
10566
|
px: "2",
|
|
10531
10567
|
py: "1",
|
|
10532
10568
|
style: t3,
|
|
@@ -10556,7 +10592,7 @@ var Form = function(props) {
|
|
|
10556
10592
|
}
|
|
10557
10593
|
var t8;
|
|
10558
10594
|
if ($[13] === Symbol.for("react.memo_cache_sentinel")) {
|
|
10559
|
-
t8 = /* @__PURE__ */
|
|
10595
|
+
t8 = /* @__PURE__ */ _jsx90(ActionButton, {});
|
|
10560
10596
|
$[13] = t8;
|
|
10561
10597
|
} else {
|
|
10562
10598
|
t8 = $[13];
|
|
@@ -10581,7 +10617,7 @@ var Form = function(props) {
|
|
|
10581
10617
|
return t9;
|
|
10582
10618
|
};
|
|
10583
10619
|
// src/components/threads/AudioThread/index.tsx
|
|
10584
|
-
import { jsx as
|
|
10620
|
+
import { jsx as _jsx91, jsxs as _jsxs35 } from "react/jsx-runtime";
|
|
10585
10621
|
function ownKeys51(e, r) {
|
|
10586
10622
|
var t = Object.keys(e);
|
|
10587
10623
|
if (Object.getOwnPropertySymbols) {
|
|
@@ -10628,9 +10664,9 @@ function _toPrimitive51(t, r) {
|
|
|
10628
10664
|
var AudioThread = function(props) {
|
|
10629
10665
|
return /* @__PURE__ */ _jsxs35(Root12, _objectSpread51(_objectSpread51({}, props), {}, {
|
|
10630
10666
|
children: [
|
|
10631
|
-
/* @__PURE__ */
|
|
10632
|
-
/* @__PURE__ */
|
|
10633
|
-
/* @__PURE__ */
|
|
10667
|
+
/* @__PURE__ */ _jsx91(Visualization, {}),
|
|
10668
|
+
/* @__PURE__ */ _jsx91(Status, {}),
|
|
10669
|
+
/* @__PURE__ */ _jsx91(Form, {})
|
|
10634
10670
|
]
|
|
10635
10671
|
}));
|
|
10636
10672
|
};
|
|
@@ -10639,7 +10675,7 @@ AudioThread.Visualization = Visualization;
|
|
|
10639
10675
|
AudioThread.Status = Status;
|
|
10640
10676
|
AudioThread.Form = Form;
|
|
10641
10677
|
// src/components/threads/AudioThreadDialog/index.tsx
|
|
10642
|
-
import { jsx as
|
|
10678
|
+
import { jsx as _jsx92, jsxs as _jsxs36 } from "react/jsx-runtime";
|
|
10643
10679
|
function ownKeys52(e, r) {
|
|
10644
10680
|
var t = Object.keys(e);
|
|
10645
10681
|
if (Object.getOwnPropertySymbols) {
|
|
@@ -10686,20 +10722,483 @@ function _toPrimitive52(t, r) {
|
|
|
10686
10722
|
var AudioThreadDialog = function(props) {
|
|
10687
10723
|
return /* @__PURE__ */ _jsxs36(Root9, _objectSpread52(_objectSpread52({}, props), {}, {
|
|
10688
10724
|
children: [
|
|
10689
|
-
/* @__PURE__ */
|
|
10690
|
-
children: /* @__PURE__ */
|
|
10725
|
+
/* @__PURE__ */ _jsx92(Content7.Root, {
|
|
10726
|
+
children: /* @__PURE__ */ _jsx92(AudioThread, {})
|
|
10691
10727
|
}),
|
|
10692
|
-
/* @__PURE__ */
|
|
10728
|
+
/* @__PURE__ */ _jsx92(Trigger, {})
|
|
10693
10729
|
]
|
|
10694
10730
|
}));
|
|
10695
10731
|
};
|
|
10696
10732
|
AudioThreadDialog.Root = Root9;
|
|
10697
10733
|
AudioThreadDialog.Trigger = Trigger;
|
|
10698
10734
|
AudioThreadDialog.Content = Content7;
|
|
10735
|
+
// src/hooks/audioRuntimes/useWebrtcAudioRuntime/index.ts
|
|
10736
|
+
import { useEffect as useEffect13, useMemo as useMemo20, useRef as useRef9, useState as useState12 } from "react";
|
|
10737
|
+
function asyncGeneratorStep12(n, t, e, r, o, a, c) {
|
|
10738
|
+
try {
|
|
10739
|
+
var i = n[a](c), u = i.value;
|
|
10740
|
+
} catch (n2) {
|
|
10741
|
+
return void e(n2);
|
|
10742
|
+
}
|
|
10743
|
+
i.done ? t(u) : Promise.resolve(u).then(r, o);
|
|
10744
|
+
}
|
|
10745
|
+
function _asyncToGenerator12(n) {
|
|
10746
|
+
return function() {
|
|
10747
|
+
var t = this, e = arguments;
|
|
10748
|
+
return new Promise(function(r, o) {
|
|
10749
|
+
var a = n.apply(t, e);
|
|
10750
|
+
function _next(n2) {
|
|
10751
|
+
asyncGeneratorStep12(a, r, o, _next, _throw, "next", n2);
|
|
10752
|
+
}
|
|
10753
|
+
function _throw(n2) {
|
|
10754
|
+
asyncGeneratorStep12(a, r, o, _next, _throw, "throw", n2);
|
|
10755
|
+
}
|
|
10756
|
+
_next(void 0);
|
|
10757
|
+
});
|
|
10758
|
+
};
|
|
10759
|
+
}
|
|
10760
|
+
var useWebrtcAudioRuntime = function() {
|
|
10761
|
+
var startSessionIfNeeded = function startSessionIfNeeded() {
|
|
10762
|
+
return _startSessionIfNeeded.apply(this, arguments);
|
|
10763
|
+
};
|
|
10764
|
+
var initRealtimeSession = function initRealtimeSession() {
|
|
10765
|
+
return _initRealtimeSession.apply(this, arguments);
|
|
10766
|
+
};
|
|
10767
|
+
var buildAnalyzers = function buildAnalyzers(localStream, audioEl_0) {
|
|
10768
|
+
try {
|
|
10769
|
+
var audioCtx1 = new AudioContext();
|
|
10770
|
+
var micSource = audioCtx1.createMediaStreamSource(localStream);
|
|
10771
|
+
var micAnalyser = audioCtx1.createAnalyser();
|
|
10772
|
+
micSource.connect(micAnalyser);
|
|
10773
|
+
userAnalyserRef.current = micAnalyser;
|
|
10774
|
+
audioEl_0.addEventListener("canplay", function() {
|
|
10775
|
+
var audioCtx2 = new AudioContext();
|
|
10776
|
+
var remoteSource = audioCtx2.createMediaElementSource(audioEl_0);
|
|
10777
|
+
var remoteAnalyser = audioCtx2.createAnalyser();
|
|
10778
|
+
remoteSource.connect(remoteAnalyser);
|
|
10779
|
+
remoteSource.connect(audioCtx2.destination);
|
|
10780
|
+
assistantAnalyserRef.current = remoteAnalyser;
|
|
10781
|
+
});
|
|
10782
|
+
} catch (err_0) {
|
|
10783
|
+
console.warn("Could not build analyzers:", err_0);
|
|
10784
|
+
}
|
|
10785
|
+
};
|
|
10786
|
+
var _useState12 = _sliced_to_array(useState12("idle"), 2), recorderStatus = _useState12[0], setRecorderStatus = _useState12[1];
|
|
10787
|
+
var superinterfaceContext = useSuperinterfaceContext();
|
|
10788
|
+
var _useState121 = _sliced_to_array(useState12(false), 2), userIsPending = _useState121[0], setUserIsPending = _useState121[1];
|
|
10789
|
+
var _useState122 = _sliced_to_array(useState12(false), 2), assistantPlaying = _useState122[0], setAssistantPlaying = _useState122[1];
|
|
10790
|
+
var _useState123 = _sliced_to_array(useState12(false), 2), assistantPaused = _useState123[0], setAssistantPaused = _useState123[1];
|
|
10791
|
+
var _useState124 = _sliced_to_array(useState12(true), 2), assistantIsPending = _useState124[0], setAssistantIsPending = _useState124[1];
|
|
10792
|
+
var _useState125 = _sliced_to_array(useState12(false), 2), assistantIsReady = _useState125[0], setAssistantIsReady = _useState125[1];
|
|
10793
|
+
var _useState126 = _sliced_to_array(useState12(false), 2), assistantAudioPlayed = _useState126[0], setAssistantAudioPlayed = _useState126[1];
|
|
10794
|
+
var sessionStartedRef = useRef9(false);
|
|
10795
|
+
var pcRef = useRef9(null);
|
|
10796
|
+
var localStreamRef = useRef9(null);
|
|
10797
|
+
var remoteStreamRef = useRef9(null);
|
|
10798
|
+
var userAnalyserRef = useRef9(null);
|
|
10799
|
+
var assistantAnalyserRef = useRef9(null);
|
|
10800
|
+
var assistantAudioElRef = useRef9(null);
|
|
10801
|
+
useEffect13(function() {
|
|
10802
|
+
return function() {
|
|
10803
|
+
if (pcRef.current) {
|
|
10804
|
+
pcRef.current.close();
|
|
10805
|
+
pcRef.current = null;
|
|
10806
|
+
}
|
|
10807
|
+
if (assistantAudioElRef.current) {
|
|
10808
|
+
assistantAudioElRef.current.srcObject = null;
|
|
10809
|
+
}
|
|
10810
|
+
};
|
|
10811
|
+
}, []);
|
|
10812
|
+
function _startSessionIfNeeded() {
|
|
10813
|
+
_startSessionIfNeeded = _asyncToGenerator12(function() {
|
|
10814
|
+
return _ts_generator(this, function(_state) {
|
|
10815
|
+
switch(_state.label){
|
|
10816
|
+
case 0:
|
|
10817
|
+
if (sessionStartedRef.current) return [
|
|
10818
|
+
2
|
|
10819
|
+
];
|
|
10820
|
+
sessionStartedRef.current = true;
|
|
10821
|
+
return [
|
|
10822
|
+
4,
|
|
10823
|
+
initRealtimeSession()
|
|
10824
|
+
];
|
|
10825
|
+
case 1:
|
|
10826
|
+
_state.sent();
|
|
10827
|
+
return [
|
|
10828
|
+
2
|
|
10829
|
+
];
|
|
10830
|
+
}
|
|
10831
|
+
});
|
|
10832
|
+
});
|
|
10833
|
+
return _startSessionIfNeeded.apply(this, arguments);
|
|
10834
|
+
}
|
|
10835
|
+
function _initRealtimeSession() {
|
|
10836
|
+
_initRealtimeSession = _asyncToGenerator12(function() {
|
|
10837
|
+
var peerConn, audioEl, ms, offer, searchParams, sdpResponse, answerSdp, answer, err;
|
|
10838
|
+
return _ts_generator(this, function(_state) {
|
|
10839
|
+
switch(_state.label){
|
|
10840
|
+
case 0:
|
|
10841
|
+
_state.trys.push([
|
|
10842
|
+
0,
|
|
10843
|
+
7,
|
|
10844
|
+
,
|
|
10845
|
+
8
|
|
10846
|
+
]);
|
|
10847
|
+
setUserIsPending(true);
|
|
10848
|
+
peerConn = new RTCPeerConnection();
|
|
10849
|
+
pcRef.current = peerConn;
|
|
10850
|
+
audioEl = document.createElement("audio");
|
|
10851
|
+
audioEl.autoplay = true;
|
|
10852
|
+
assistantAudioElRef.current = audioEl;
|
|
10853
|
+
peerConn.ontrack = function(evt) {
|
|
10854
|
+
remoteStreamRef.current = evt.streams[0];
|
|
10855
|
+
audioEl.srcObject = evt.streams[0];
|
|
10856
|
+
setAssistantIsPending(false);
|
|
10857
|
+
setAssistantPlaying(true);
|
|
10858
|
+
setAssistantPaused(false);
|
|
10859
|
+
setAssistantAudioPlayed(true);
|
|
10860
|
+
};
|
|
10861
|
+
peerConn.createDataChannel("unused-negotiation-only");
|
|
10862
|
+
peerConn.addEventListener("datachannel", function(event) {
|
|
10863
|
+
var channel = event.channel;
|
|
10864
|
+
if (channel.label === "thread-events") {
|
|
10865
|
+
channel.onmessage = function(_ref) {
|
|
10866
|
+
var data2 = _ref.data;
|
|
10867
|
+
console.log("Data channel message:", data2);
|
|
10868
|
+
var parsedData = JSON.parse(data2);
|
|
10869
|
+
if (parsedData.event === "thread.created") {
|
|
10870
|
+
threadCreated({
|
|
10871
|
+
value: parsedData,
|
|
10872
|
+
superinterfaceContext: superinterfaceContext
|
|
10873
|
+
});
|
|
10874
|
+
} else if (parsedData.event === "thread.run.requires_action") {
|
|
10875
|
+
threadRunRequiresAction({
|
|
10876
|
+
value: parsedData,
|
|
10877
|
+
superinterfaceContext: superinterfaceContext
|
|
10878
|
+
});
|
|
10879
|
+
}
|
|
10880
|
+
};
|
|
10881
|
+
}
|
|
10882
|
+
});
|
|
10883
|
+
return [
|
|
10884
|
+
4,
|
|
10885
|
+
navigator.mediaDevices.getUserMedia({
|
|
10886
|
+
audio: true
|
|
10887
|
+
})
|
|
10888
|
+
];
|
|
10889
|
+
case 1:
|
|
10890
|
+
ms = _state.sent();
|
|
10891
|
+
localStreamRef.current = ms;
|
|
10892
|
+
ms.getTracks().forEach(function(t) {
|
|
10893
|
+
peerConn.addTrack(t, ms);
|
|
10894
|
+
});
|
|
10895
|
+
setRecorderStatus("idle");
|
|
10896
|
+
return [
|
|
10897
|
+
4,
|
|
10898
|
+
peerConn.createOffer()
|
|
10899
|
+
];
|
|
10900
|
+
case 2:
|
|
10901
|
+
offer = _state.sent();
|
|
10902
|
+
return [
|
|
10903
|
+
4,
|
|
10904
|
+
peerConn.setLocalDescription(offer)
|
|
10905
|
+
];
|
|
10906
|
+
case 3:
|
|
10907
|
+
_state.sent();
|
|
10908
|
+
searchParams = new URLSearchParams(variableParams({
|
|
10909
|
+
variables: superinterfaceContext.variables,
|
|
10910
|
+
superinterfaceContext: superinterfaceContext
|
|
10911
|
+
}));
|
|
10912
|
+
return [
|
|
10913
|
+
4,
|
|
10914
|
+
fetch("".concat(superinterfaceContext.baseUrl, "/audio-runtimes/webrtc?").concat(searchParams), {
|
|
10915
|
+
method: "POST",
|
|
10916
|
+
body: offer.sdp,
|
|
10917
|
+
headers: {
|
|
10918
|
+
"Content-Type": "application/sdp"
|
|
10919
|
+
}
|
|
10920
|
+
})
|
|
10921
|
+
];
|
|
10922
|
+
case 4:
|
|
10923
|
+
sdpResponse = _state.sent();
|
|
10924
|
+
return [
|
|
10925
|
+
4,
|
|
10926
|
+
sdpResponse.text()
|
|
10927
|
+
];
|
|
10928
|
+
case 5:
|
|
10929
|
+
answerSdp = _state.sent();
|
|
10930
|
+
answer = {
|
|
10931
|
+
type: "answer",
|
|
10932
|
+
sdp: answerSdp
|
|
10933
|
+
};
|
|
10934
|
+
return [
|
|
10935
|
+
4,
|
|
10936
|
+
peerConn.setRemoteDescription(answer)
|
|
10937
|
+
];
|
|
10938
|
+
case 6:
|
|
10939
|
+
_state.sent();
|
|
10940
|
+
buildAnalyzers(ms, audioEl);
|
|
10941
|
+
setUserIsPending(false);
|
|
10942
|
+
setAssistantIsPending(false);
|
|
10943
|
+
setAssistantIsReady(true);
|
|
10944
|
+
setAssistantPlaying(true);
|
|
10945
|
+
return [
|
|
10946
|
+
3,
|
|
10947
|
+
8
|
|
10948
|
+
];
|
|
10949
|
+
case 7:
|
|
10950
|
+
err = _state.sent();
|
|
10951
|
+
console.error("Error initRealtimeSession:", err);
|
|
10952
|
+
setUserIsPending(false);
|
|
10953
|
+
setRecorderStatus("stopped");
|
|
10954
|
+
setAssistantPlaying(false);
|
|
10955
|
+
setAssistantPaused(false);
|
|
10956
|
+
setAssistantIsPending(false);
|
|
10957
|
+
setAssistantIsReady(false);
|
|
10958
|
+
setAssistantAudioPlayed(false);
|
|
10959
|
+
return [
|
|
10960
|
+
3,
|
|
10961
|
+
8
|
|
10962
|
+
];
|
|
10963
|
+
case 8:
|
|
10964
|
+
return [
|
|
10965
|
+
2
|
|
10966
|
+
];
|
|
10967
|
+
}
|
|
10968
|
+
});
|
|
10969
|
+
});
|
|
10970
|
+
return _initRealtimeSession.apply(this, arguments);
|
|
10971
|
+
}
|
|
10972
|
+
return useMemo20(function() {
|
|
10973
|
+
return {
|
|
10974
|
+
webrtcAudioRuntime: {
|
|
10975
|
+
user: {
|
|
10976
|
+
start: function() {
|
|
10977
|
+
var _start = _asyncToGenerator12(function() {
|
|
10978
|
+
return _ts_generator(this, function(_state) {
|
|
10979
|
+
switch(_state.label){
|
|
10980
|
+
case 0:
|
|
10981
|
+
return [
|
|
10982
|
+
4,
|
|
10983
|
+
startSessionIfNeeded()
|
|
10984
|
+
];
|
|
10985
|
+
case 1:
|
|
10986
|
+
_state.sent();
|
|
10987
|
+
setRecorderStatus("recording");
|
|
10988
|
+
if (localStreamRef.current) {
|
|
10989
|
+
localStreamRef.current.getAudioTracks().forEach(function(t_0) {
|
|
10990
|
+
return t_0.enabled = true;
|
|
10991
|
+
});
|
|
10992
|
+
}
|
|
10993
|
+
return [
|
|
10994
|
+
2
|
|
10995
|
+
];
|
|
10996
|
+
}
|
|
10997
|
+
});
|
|
10998
|
+
});
|
|
10999
|
+
function start() {
|
|
11000
|
+
return _start.apply(this, arguments);
|
|
11001
|
+
}
|
|
11002
|
+
return start;
|
|
11003
|
+
}(),
|
|
11004
|
+
pause: function() {
|
|
11005
|
+
var _pause = _asyncToGenerator12(function() {
|
|
11006
|
+
return _ts_generator(this, function(_state) {
|
|
11007
|
+
if (!sessionStartedRef.current) return [
|
|
11008
|
+
2
|
|
11009
|
+
];
|
|
11010
|
+
setRecorderStatus("paused");
|
|
11011
|
+
if (localStreamRef.current) {
|
|
11012
|
+
localStreamRef.current.getAudioTracks().forEach(function(t_1) {
|
|
11013
|
+
return t_1.enabled = false;
|
|
11014
|
+
});
|
|
11015
|
+
}
|
|
11016
|
+
return [
|
|
11017
|
+
2
|
|
11018
|
+
];
|
|
11019
|
+
});
|
|
11020
|
+
});
|
|
11021
|
+
function pause() {
|
|
11022
|
+
return _pause.apply(this, arguments);
|
|
11023
|
+
}
|
|
11024
|
+
return pause;
|
|
11025
|
+
}(),
|
|
11026
|
+
resume: function() {
|
|
11027
|
+
var _resume = _asyncToGenerator12(function() {
|
|
11028
|
+
return _ts_generator(this, function(_state) {
|
|
11029
|
+
if (!sessionStartedRef.current) return [
|
|
11030
|
+
2
|
|
11031
|
+
];
|
|
11032
|
+
setRecorderStatus("recording");
|
|
11033
|
+
if (localStreamRef.current) {
|
|
11034
|
+
localStreamRef.current.getAudioTracks().forEach(function(t_2) {
|
|
11035
|
+
return t_2.enabled = true;
|
|
11036
|
+
});
|
|
11037
|
+
}
|
|
11038
|
+
return [
|
|
11039
|
+
2
|
|
11040
|
+
];
|
|
11041
|
+
});
|
|
11042
|
+
});
|
|
11043
|
+
function resume() {
|
|
11044
|
+
return _resume.apply(this, arguments);
|
|
11045
|
+
}
|
|
11046
|
+
return resume;
|
|
11047
|
+
}(),
|
|
11048
|
+
stop: function() {
|
|
11049
|
+
var _stop = _asyncToGenerator12(function() {
|
|
11050
|
+
return _ts_generator(this, function(_state) {
|
|
11051
|
+
if (!sessionStartedRef.current) return [
|
|
11052
|
+
2
|
|
11053
|
+
];
|
|
11054
|
+
setRecorderStatus("stopped");
|
|
11055
|
+
if (localStreamRef.current) {
|
|
11056
|
+
localStreamRef.current.getTracks().forEach(function(track) {
|
|
11057
|
+
return track.stop();
|
|
11058
|
+
});
|
|
11059
|
+
}
|
|
11060
|
+
return [
|
|
11061
|
+
2
|
|
11062
|
+
];
|
|
11063
|
+
});
|
|
11064
|
+
});
|
|
11065
|
+
function stop() {
|
|
11066
|
+
return _stop.apply(this, arguments);
|
|
11067
|
+
}
|
|
11068
|
+
return stop;
|
|
11069
|
+
}(),
|
|
11070
|
+
isPending: userIsPending,
|
|
11071
|
+
visualizationAnalyser: userAnalyserRef.current,
|
|
11072
|
+
rawStatus: recorderStatus
|
|
11073
|
+
},
|
|
11074
|
+
assistant: {
|
|
11075
|
+
play: function() {
|
|
11076
|
+
var _play = _asyncToGenerator12(function() {
|
|
11077
|
+
return _ts_generator(this, function(_state) {
|
|
11078
|
+
switch(_state.label){
|
|
11079
|
+
case 0:
|
|
11080
|
+
return [
|
|
11081
|
+
4,
|
|
11082
|
+
startSessionIfNeeded()
|
|
11083
|
+
];
|
|
11084
|
+
case 1:
|
|
11085
|
+
_state.sent();
|
|
11086
|
+
setAssistantPaused(false);
|
|
11087
|
+
setAssistantPlaying(true);
|
|
11088
|
+
if (assistantAudioElRef.current) {
|
|
11089
|
+
assistantAudioElRef.current.play().catch(function(err_1) {
|
|
11090
|
+
console.error("Assistant play error:", err_1);
|
|
11091
|
+
});
|
|
11092
|
+
}
|
|
11093
|
+
return [
|
|
11094
|
+
2
|
|
11095
|
+
];
|
|
11096
|
+
}
|
|
11097
|
+
});
|
|
11098
|
+
});
|
|
11099
|
+
function play() {
|
|
11100
|
+
return _play.apply(this, arguments);
|
|
11101
|
+
}
|
|
11102
|
+
return play;
|
|
11103
|
+
}(),
|
|
11104
|
+
pause: function() {
|
|
11105
|
+
var _pause2 = _asyncToGenerator12(function() {
|
|
11106
|
+
return _ts_generator(this, function(_state) {
|
|
11107
|
+
if (!sessionStartedRef.current) return [
|
|
11108
|
+
2
|
|
11109
|
+
];
|
|
11110
|
+
setAssistantPaused(true);
|
|
11111
|
+
setAssistantPlaying(false);
|
|
11112
|
+
if (assistantAudioElRef.current) {
|
|
11113
|
+
assistantAudioElRef.current.pause();
|
|
11114
|
+
}
|
|
11115
|
+
return [
|
|
11116
|
+
2
|
|
11117
|
+
];
|
|
11118
|
+
});
|
|
11119
|
+
});
|
|
11120
|
+
function pause() {
|
|
11121
|
+
return _pause2.apply(this, arguments);
|
|
11122
|
+
}
|
|
11123
|
+
return pause;
|
|
11124
|
+
}(),
|
|
11125
|
+
stop: function() {
|
|
11126
|
+
var _stop2 = _asyncToGenerator12(function() {
|
|
11127
|
+
return _ts_generator(this, function(_state) {
|
|
11128
|
+
if (!sessionStartedRef.current) return [
|
|
11129
|
+
2
|
|
11130
|
+
];
|
|
11131
|
+
setAssistantPaused(false);
|
|
11132
|
+
setAssistantPlaying(false);
|
|
11133
|
+
if (assistantAudioElRef.current) {
|
|
11134
|
+
assistantAudioElRef.current.pause();
|
|
11135
|
+
assistantAudioElRef.current.currentTime = 0;
|
|
11136
|
+
}
|
|
11137
|
+
return [
|
|
11138
|
+
2
|
|
11139
|
+
];
|
|
11140
|
+
});
|
|
11141
|
+
});
|
|
11142
|
+
function stop() {
|
|
11143
|
+
return _stop2.apply(this, arguments);
|
|
11144
|
+
}
|
|
11145
|
+
return stop;
|
|
11146
|
+
}(),
|
|
11147
|
+
visualizationAnalyser: assistantAnalyserRef.current,
|
|
11148
|
+
playing: assistantPlaying,
|
|
11149
|
+
paused: assistantPaused,
|
|
11150
|
+
isPending: assistantIsPending,
|
|
11151
|
+
isReady: assistantIsReady,
|
|
11152
|
+
isAudioPlayed: assistantAudioPlayed,
|
|
11153
|
+
rawStatus: void 0
|
|
11154
|
+
}
|
|
11155
|
+
}
|
|
11156
|
+
};
|
|
11157
|
+
}, [
|
|
11158
|
+
recorderStatus,
|
|
11159
|
+
userIsPending,
|
|
11160
|
+
assistantPlaying,
|
|
11161
|
+
assistantPaused,
|
|
11162
|
+
assistantIsPending,
|
|
11163
|
+
assistantIsReady,
|
|
11164
|
+
assistantAudioPlayed
|
|
11165
|
+
]);
|
|
11166
|
+
};
|
|
11167
|
+
// src/components/audioRuntimes/WebrtcAudioRuntimeProvider.tsx
|
|
11168
|
+
import { c as _c57 } from "react-compiler-runtime";
|
|
11169
|
+
import { jsx as _jsx93 } from "react/jsx-runtime";
|
|
11170
|
+
var WebrtcAudioRuntimeProvider = function(t0) {
|
|
11171
|
+
var $ = _c57(5);
|
|
11172
|
+
var children = t0.children;
|
|
11173
|
+
var webrtcAudioRuntime = useWebrtcAudioRuntime().webrtcAudioRuntime;
|
|
11174
|
+
var t1;
|
|
11175
|
+
if ($[0] !== webrtcAudioRuntime) {
|
|
11176
|
+
t1 = {
|
|
11177
|
+
audioRuntime: webrtcAudioRuntime
|
|
11178
|
+
};
|
|
11179
|
+
$[0] = webrtcAudioRuntime;
|
|
11180
|
+
$[1] = t1;
|
|
11181
|
+
} else {
|
|
11182
|
+
t1 = $[1];
|
|
11183
|
+
}
|
|
11184
|
+
var t2;
|
|
11185
|
+
if ($[2] !== children || $[3] !== t1) {
|
|
11186
|
+
t2 = /* @__PURE__ */ _jsx93(AudioThreadContext.Provider, {
|
|
11187
|
+
value: t1,
|
|
11188
|
+
children: children
|
|
11189
|
+
});
|
|
11190
|
+
$[2] = children;
|
|
11191
|
+
$[3] = t1;
|
|
11192
|
+
$[4] = t2;
|
|
11193
|
+
} else {
|
|
11194
|
+
t2 = $[4];
|
|
11195
|
+
}
|
|
11196
|
+
return t2;
|
|
11197
|
+
};
|
|
10699
11198
|
// src/components/markdown/MarkdownProvider/index.tsx
|
|
10700
|
-
import { c as
|
|
10701
|
-
import { useMemo as
|
|
10702
|
-
import { jsx as
|
|
11199
|
+
import { c as _c58 } from "react-compiler-runtime";
|
|
11200
|
+
import { useMemo as useMemo21 } from "react";
|
|
11201
|
+
import { jsx as _jsx94 } from "react/jsx-runtime";
|
|
10703
11202
|
var _excluded6 = [
|
|
10704
11203
|
"children"
|
|
10705
11204
|
];
|
|
@@ -10722,7 +11221,7 @@ function _objectWithoutPropertiesLoose6(r, e) {
|
|
|
10722
11221
|
return t;
|
|
10723
11222
|
}
|
|
10724
11223
|
var MarkdownProvider = function(t0) {
|
|
10725
|
-
var $ =
|
|
11224
|
+
var $ = _c58(9);
|
|
10726
11225
|
var children;
|
|
10727
11226
|
var rest;
|
|
10728
11227
|
if ($[0] !== t0) {
|
|
@@ -10752,7 +11251,7 @@ var MarkdownProvider = function(t0) {
|
|
|
10752
11251
|
var value = t1;
|
|
10753
11252
|
var t3;
|
|
10754
11253
|
if ($[6] !== children || $[7] !== value) {
|
|
10755
|
-
t3 = /* @__PURE__ */
|
|
11254
|
+
t3 = /* @__PURE__ */ _jsx94(MarkdownContext.Provider, {
|
|
10756
11255
|
value: value,
|
|
10757
11256
|
children: children
|
|
10758
11257
|
});
|
|
@@ -10765,18 +11264,18 @@ var MarkdownProvider = function(t0) {
|
|
|
10765
11264
|
return t3;
|
|
10766
11265
|
};
|
|
10767
11266
|
// src/components/annotations/SourceAnnotation/index.tsx
|
|
10768
|
-
import { c as
|
|
11267
|
+
import { c as _c61 } from "react-compiler-runtime";
|
|
10769
11268
|
// src/components/annotations/SourceAnnotation/FileCitation/index.tsx
|
|
10770
|
-
import { c as
|
|
10771
|
-
import { useState as
|
|
11269
|
+
import { c as _c60 } from "react-compiler-runtime";
|
|
11270
|
+
import { useState as useState13 } from "react";
|
|
10772
11271
|
import { QuoteIcon as QuoteIcon2 } from "@radix-ui/react-icons";
|
|
10773
11272
|
import { Dialog, VisuallyHidden, IconButton as IconButton11 } from "@radix-ui/themes";
|
|
10774
11273
|
// src/components/annotations/SourceAnnotation/FileCitation/Content.tsx
|
|
10775
|
-
import { c as
|
|
11274
|
+
import { c as _c59 } from "react-compiler-runtime";
|
|
10776
11275
|
import { Flex as Flex35, Card as Card5, Inset as Inset3 } from "@radix-ui/themes";
|
|
10777
|
-
import { jsx as
|
|
11276
|
+
import { jsx as _jsx95 } from "react/jsx-runtime";
|
|
10778
11277
|
var Content9 = function(t0) {
|
|
10779
|
-
var $ =
|
|
11278
|
+
var $ = _c59(5);
|
|
10780
11279
|
var fileId = t0.fileId;
|
|
10781
11280
|
var superinterfaceContext = useSuperinterfaceContext();
|
|
10782
11281
|
var nextSearchParams = new URLSearchParams(superinterfaceContext.variables);
|
|
@@ -10813,18 +11312,18 @@ var Content9 = function(t0) {
|
|
|
10813
11312
|
}
|
|
10814
11313
|
var t5;
|
|
10815
11314
|
if ($[3] !== t3) {
|
|
10816
|
-
t5 = /* @__PURE__ */
|
|
11315
|
+
t5 = /* @__PURE__ */ _jsx95(Flex35, {
|
|
10817
11316
|
direction: "column",
|
|
10818
11317
|
flexGrow: "1",
|
|
10819
11318
|
gap: "3",
|
|
10820
|
-
children: /* @__PURE__ */
|
|
11319
|
+
children: /* @__PURE__ */ _jsx95(Card5, {
|
|
10821
11320
|
style: t1,
|
|
10822
|
-
children: /* @__PURE__ */
|
|
11321
|
+
children: /* @__PURE__ */ _jsx95(Inset3, {
|
|
10823
11322
|
clip: "padding-box",
|
|
10824
11323
|
style: t2,
|
|
10825
|
-
children: /* @__PURE__ */
|
|
11324
|
+
children: /* @__PURE__ */ _jsx95(Flex35, {
|
|
10826
11325
|
flexGrow: "1",
|
|
10827
|
-
children: /* @__PURE__ */
|
|
11326
|
+
children: /* @__PURE__ */ _jsx95("embed", {
|
|
10828
11327
|
src: t3,
|
|
10829
11328
|
style: t4
|
|
10830
11329
|
})
|
|
@@ -10840,11 +11339,11 @@ var Content9 = function(t0) {
|
|
|
10840
11339
|
return t5;
|
|
10841
11340
|
};
|
|
10842
11341
|
// src/components/annotations/SourceAnnotation/FileCitation/index.tsx
|
|
10843
|
-
import { jsx as
|
|
11342
|
+
import { jsx as _jsx96, jsxs as _jsxs37, Fragment as _Fragment4 } from "react/jsx-runtime";
|
|
10844
11343
|
var FileCitation = function(t0) {
|
|
10845
|
-
var $ =
|
|
11344
|
+
var $ = _c60(18);
|
|
10846
11345
|
var annotation = t0.annotation;
|
|
10847
|
-
var
|
|
11346
|
+
var _useState13 = _sliced_to_array(useState13(null), 2), activeFileId = _useState13[0], setActiveFileId = _useState13[1];
|
|
10848
11347
|
var t1;
|
|
10849
11348
|
if ($[0] !== annotation.file_citation.file_id) {
|
|
10850
11349
|
t1 = function() {
|
|
@@ -10857,14 +11356,14 @@ var FileCitation = function(t0) {
|
|
|
10857
11356
|
}
|
|
10858
11357
|
var t2;
|
|
10859
11358
|
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
|
|
10860
|
-
t2 = /* @__PURE__ */
|
|
11359
|
+
t2 = /* @__PURE__ */ _jsx96(QuoteIcon2, {});
|
|
10861
11360
|
$[2] = t2;
|
|
10862
11361
|
} else {
|
|
10863
11362
|
t2 = $[2];
|
|
10864
11363
|
}
|
|
10865
11364
|
var t3;
|
|
10866
11365
|
if ($[3] !== t1) {
|
|
10867
|
-
t3 = /* @__PURE__ */
|
|
11366
|
+
t3 = /* @__PURE__ */ _jsx96(IconButton11, {
|
|
10868
11367
|
variant: "soft",
|
|
10869
11368
|
color: "gray",
|
|
10870
11369
|
size: "1",
|
|
@@ -10900,9 +11399,9 @@ var FileCitation = function(t0) {
|
|
|
10900
11399
|
}
|
|
10901
11400
|
var t7;
|
|
10902
11401
|
if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
|
|
10903
|
-
t7 = /* @__PURE__ */
|
|
11402
|
+
t7 = /* @__PURE__ */ _jsx96(VisuallyHidden, {
|
|
10904
11403
|
asChild: true,
|
|
10905
|
-
children: /* @__PURE__ */
|
|
11404
|
+
children: /* @__PURE__ */ _jsx96(Dialog.Title, {
|
|
10906
11405
|
children: "Source"
|
|
10907
11406
|
})
|
|
10908
11407
|
});
|
|
@@ -10912,7 +11411,7 @@ var FileCitation = function(t0) {
|
|
|
10912
11411
|
}
|
|
10913
11412
|
var t8;
|
|
10914
11413
|
if ($[8] !== activeFileId) {
|
|
10915
|
-
t8 = activeFileId && /* @__PURE__ */
|
|
11414
|
+
t8 = activeFileId && /* @__PURE__ */ _jsx96(Content9, {
|
|
10916
11415
|
fileId: activeFileId
|
|
10917
11416
|
});
|
|
10918
11417
|
$[8] = activeFileId;
|
|
@@ -10940,7 +11439,7 @@ var FileCitation = function(t0) {
|
|
|
10940
11439
|
}
|
|
10941
11440
|
var t10;
|
|
10942
11441
|
if ($[12] !== t4 || $[13] !== t9) {
|
|
10943
|
-
t10 = /* @__PURE__ */
|
|
11442
|
+
t10 = /* @__PURE__ */ _jsx96(Dialog.Root, {
|
|
10944
11443
|
open: t4,
|
|
10945
11444
|
onOpenChange: t5,
|
|
10946
11445
|
children: t9
|
|
@@ -10968,7 +11467,7 @@ var FileCitation = function(t0) {
|
|
|
10968
11467
|
return t11;
|
|
10969
11468
|
};
|
|
10970
11469
|
// src/components/annotations/SourceAnnotation/index.tsx
|
|
10971
|
-
import { jsx as
|
|
11470
|
+
import { jsx as _jsx97 } from "react/jsx-runtime";
|
|
10972
11471
|
var _excluded7 = [
|
|
10973
11472
|
"children"
|
|
10974
11473
|
];
|
|
@@ -10991,7 +11490,7 @@ function _objectWithoutPropertiesLoose7(r, e) {
|
|
|
10991
11490
|
return t;
|
|
10992
11491
|
}
|
|
10993
11492
|
var SourceAnnotation = function(t0) {
|
|
10994
|
-
var $ =
|
|
11493
|
+
var $ = _c61(10);
|
|
10995
11494
|
var children;
|
|
10996
11495
|
var rest;
|
|
10997
11496
|
if ($[0] !== t0) {
|
|
@@ -11019,7 +11518,7 @@ var SourceAnnotation = function(t0) {
|
|
|
11019
11518
|
if (annotation.type === "file_citation") {
|
|
11020
11519
|
var t2;
|
|
11021
11520
|
if ($[5] !== annotation) {
|
|
11022
|
-
t2 = /* @__PURE__ */
|
|
11521
|
+
t2 = /* @__PURE__ */ _jsx97(FileCitation, {
|
|
11023
11522
|
annotation: annotation
|
|
11024
11523
|
});
|
|
11025
11524
|
$[5] = annotation;
|
|
@@ -11032,7 +11531,7 @@ var SourceAnnotation = function(t0) {
|
|
|
11032
11531
|
if (annotation.type === "file_path") {
|
|
11033
11532
|
var _t2;
|
|
11034
11533
|
if ($[7] !== annotation || $[8] !== children) {
|
|
11035
|
-
_t2 = /* @__PURE__ */
|
|
11534
|
+
_t2 = /* @__PURE__ */ _jsx97(FilePathAnnotation, {
|
|
11036
11535
|
annotation: annotation,
|
|
11037
11536
|
children: children
|
|
11038
11537
|
});
|
|
@@ -11048,7 +11547,7 @@ var SourceAnnotation = function(t0) {
|
|
|
11048
11547
|
return null;
|
|
11049
11548
|
};
|
|
11050
11549
|
// src/components/avatars/Avatar.tsx
|
|
11051
|
-
import { c as
|
|
11550
|
+
import { c as _c64 } from "react-compiler-runtime";
|
|
11052
11551
|
// src/lib/enums/index.ts
|
|
11053
11552
|
var IconAvatarName = /* @__PURE__ */ function(IconAvatarName2) {
|
|
11054
11553
|
IconAvatarName2["BACKPACK"] = "BACKPACK";
|
|
@@ -11073,7 +11572,7 @@ var AvatarType = /* @__PURE__ */ function(AvatarType2) {
|
|
|
11073
11572
|
// src/components/avatars/Avatar.tsx
|
|
11074
11573
|
import { Avatar as RadixAvatar } from "@radix-ui/themes";
|
|
11075
11574
|
// src/components/imageAvatars/ImageAvatar/index.tsx
|
|
11076
|
-
import { c as
|
|
11575
|
+
import { c as _c62 } from "react-compiler-runtime";
|
|
11077
11576
|
import { Avatar as Avatar4 } from "@radix-ui/themes";
|
|
11078
11577
|
// src/components/imageAvatars/ImageAvatar/lib/optimizedSrc/path.ts
|
|
11079
11578
|
var width = function(_ref) {
|
|
@@ -11125,9 +11624,9 @@ var optimizedSrc = function(_ref) {
|
|
|
11125
11624
|
}));
|
|
11126
11625
|
};
|
|
11127
11626
|
// src/components/imageAvatars/ImageAvatar/index.tsx
|
|
11128
|
-
import { jsx as
|
|
11627
|
+
import { jsx as _jsx98 } from "react/jsx-runtime";
|
|
11129
11628
|
var ImageAvatar = function(t0) {
|
|
11130
|
-
var $ =
|
|
11629
|
+
var $ = _c62(9);
|
|
11131
11630
|
var imageAvatar = t0.imageAvatar, size = t0.size, className = t0.className, style = t0.style;
|
|
11132
11631
|
var superinterfaceContext = useSuperinterfaceContext();
|
|
11133
11632
|
var t1;
|
|
@@ -11146,7 +11645,7 @@ var ImageAvatar = function(t0) {
|
|
|
11146
11645
|
}
|
|
11147
11646
|
var t2;
|
|
11148
11647
|
if ($[4] !== className || $[5] !== size || $[6] !== style || $[7] !== t1) {
|
|
11149
|
-
t2 = /* @__PURE__ */
|
|
11648
|
+
t2 = /* @__PURE__ */ _jsx98(Avatar4, {
|
|
11150
11649
|
className: className,
|
|
11151
11650
|
style: style,
|
|
11152
11651
|
fallback: "",
|
|
@@ -11164,24 +11663,24 @@ var ImageAvatar = function(t0) {
|
|
|
11164
11663
|
return t2;
|
|
11165
11664
|
};
|
|
11166
11665
|
// src/components/iconAvatars/IconAvatar.tsx
|
|
11167
|
-
import { c as
|
|
11168
|
-
import { useMemo as
|
|
11666
|
+
import { c as _c63 } from "react-compiler-runtime";
|
|
11667
|
+
import { useMemo as useMemo22 } from "react";
|
|
11169
11668
|
import { Avatar as Avatar5 } from "@radix-ui/themes";
|
|
11170
11669
|
// src/lib/iconAvatars/iconAvatarComponents.ts
|
|
11171
11670
|
import { BackpackIcon, RocketIcon, MagicWandIcon, CubeIcon, TargetIcon, DiscIcon, GlobeIcon, StarIcon, LightningBoltIcon as LightningBoltIcon2, FaceIcon, PersonIcon as PersonIcon2, HeartIcon } from "@radix-ui/react-icons";
|
|
11172
11671
|
var _obj;
|
|
11173
11672
|
var iconAvatarComponents = (_obj = {}, _define_property(_obj, IconAvatarName.BACKPACK, BackpackIcon), _define_property(_obj, IconAvatarName.ROCKET, RocketIcon), _define_property(_obj, IconAvatarName.MAGIC_WAND, MagicWandIcon), _define_property(_obj, IconAvatarName.CUBE, CubeIcon), _define_property(_obj, IconAvatarName.TARGET, TargetIcon), _define_property(_obj, IconAvatarName.DISC, DiscIcon), _define_property(_obj, IconAvatarName.GLOBE, GlobeIcon), _define_property(_obj, IconAvatarName.STAR, StarIcon), _define_property(_obj, IconAvatarName.LIGHTNING_BOLT, LightningBoltIcon2), _define_property(_obj, IconAvatarName.FACE, FaceIcon), _define_property(_obj, IconAvatarName.PERSON, PersonIcon2), _define_property(_obj, IconAvatarName.HEART, HeartIcon), _obj);
|
|
11174
11673
|
// src/components/iconAvatars/IconAvatar.tsx
|
|
11175
|
-
import { jsx as
|
|
11674
|
+
import { jsx as _jsx99 } from "react/jsx-runtime";
|
|
11176
11675
|
var IconAvatar = function(t0) {
|
|
11177
|
-
var $ =
|
|
11676
|
+
var $ = _c63(7);
|
|
11178
11677
|
var iconAvatar = t0.iconAvatar, size = t0.size, className = t0.className, style = t0.style;
|
|
11179
11678
|
var t1;
|
|
11180
11679
|
t1 = iconAvatarComponents[iconAvatar.name];
|
|
11181
11680
|
var Component2 = t1;
|
|
11182
11681
|
var t2;
|
|
11183
11682
|
if ($[0] !== Component2) {
|
|
11184
|
-
t2 = Component2 ? /* @__PURE__ */
|
|
11683
|
+
t2 = Component2 ? /* @__PURE__ */ _jsx99(Component2, {}) : "";
|
|
11185
11684
|
$[0] = Component2;
|
|
11186
11685
|
$[1] = t2;
|
|
11187
11686
|
} else {
|
|
@@ -11189,7 +11688,7 @@ var IconAvatar = function(t0) {
|
|
|
11189
11688
|
}
|
|
11190
11689
|
var t3;
|
|
11191
11690
|
if ($[2] !== className || $[3] !== size || $[4] !== style || $[5] !== t2) {
|
|
11192
|
-
t3 = /* @__PURE__ */
|
|
11691
|
+
t3 = /* @__PURE__ */ _jsx99(Avatar5, {
|
|
11193
11692
|
className: className,
|
|
11194
11693
|
style: style,
|
|
11195
11694
|
size: size,
|
|
@@ -11206,16 +11705,16 @@ var IconAvatar = function(t0) {
|
|
|
11206
11705
|
return t3;
|
|
11207
11706
|
};
|
|
11208
11707
|
// src/components/avatars/Avatar.tsx
|
|
11209
|
-
import { jsx as
|
|
11708
|
+
import { jsx as _jsx100 } from "react/jsx-runtime";
|
|
11210
11709
|
var Avatar6 = function(t0) {
|
|
11211
|
-
var $ =
|
|
11710
|
+
var $ = _c64(14);
|
|
11212
11711
|
var avatar = t0.avatar, t1 = t0.size, className = t0.className, style = t0.style;
|
|
11213
11712
|
var size = t1 === void 0 ? "1" : t1;
|
|
11214
11713
|
if (avatar) {
|
|
11215
11714
|
if (avatar.type === AvatarType.IMAGE && avatar.imageAvatar) {
|
|
11216
11715
|
var _t;
|
|
11217
11716
|
if ($[0] !== avatar.imageAvatar || $[1] !== className || $[2] !== size || $[3] !== style) {
|
|
11218
|
-
_t = /* @__PURE__ */
|
|
11717
|
+
_t = /* @__PURE__ */ _jsx100(ImageAvatar, {
|
|
11219
11718
|
imageAvatar: avatar.imageAvatar,
|
|
11220
11719
|
size: size,
|
|
11221
11720
|
className: className,
|
|
@@ -11234,7 +11733,7 @@ var Avatar6 = function(t0) {
|
|
|
11234
11733
|
if (avatar.type === AvatarType.ICON && avatar.iconAvatar) {
|
|
11235
11734
|
var _t2;
|
|
11236
11735
|
if ($[5] !== avatar.iconAvatar || $[6] !== className || $[7] !== size || $[8] !== style) {
|
|
11237
|
-
_t2 = /* @__PURE__ */
|
|
11736
|
+
_t2 = /* @__PURE__ */ _jsx100(IconAvatar, {
|
|
11238
11737
|
iconAvatar: avatar.iconAvatar,
|
|
11239
11738
|
size: size,
|
|
11240
11739
|
className: className,
|
|
@@ -11253,7 +11752,7 @@ var Avatar6 = function(t0) {
|
|
|
11253
11752
|
}
|
|
11254
11753
|
var t2;
|
|
11255
11754
|
if ($[10] !== className || $[11] !== size || $[12] !== style) {
|
|
11256
|
-
t2 = /* @__PURE__ */
|
|
11755
|
+
t2 = /* @__PURE__ */ _jsx100(RadixAvatar, {
|
|
11257
11756
|
fallback: "",
|
|
11258
11757
|
size: size,
|
|
11259
11758
|
className: className,
|
|
@@ -11269,15 +11768,15 @@ var Avatar6 = function(t0) {
|
|
|
11269
11768
|
return t2;
|
|
11270
11769
|
};
|
|
11271
11770
|
// src/components/components/ComponentsProvider.tsx
|
|
11272
|
-
import { c as
|
|
11273
|
-
import { useMemo as
|
|
11771
|
+
import { c as _c65 } from "react-compiler-runtime";
|
|
11772
|
+
import { useMemo as useMemo23 } from "react";
|
|
11274
11773
|
// src/hooks/components/useComponents.ts
|
|
11275
11774
|
import { useContext as useContext17 } from "react";
|
|
11276
11775
|
var useComponents = function() {
|
|
11277
11776
|
return useContext17(ComponentsContext);
|
|
11278
11777
|
};
|
|
11279
11778
|
// src/components/components/ComponentsProvider.tsx
|
|
11280
|
-
import { jsx as
|
|
11779
|
+
import { jsx as _jsx101 } from "react/jsx-runtime";
|
|
11281
11780
|
var _excluded8 = [
|
|
11282
11781
|
"children"
|
|
11283
11782
|
];
|
|
@@ -11300,7 +11799,7 @@ function _objectWithoutPropertiesLoose8(r, e) {
|
|
|
11300
11799
|
return t;
|
|
11301
11800
|
}
|
|
11302
11801
|
var ComponentsProvider = function(t0) {
|
|
11303
|
-
var $ =
|
|
11802
|
+
var $ = _c65(9);
|
|
11304
11803
|
var children;
|
|
11305
11804
|
var rest;
|
|
11306
11805
|
if ($[0] !== t0) {
|
|
@@ -11330,7 +11829,7 @@ var ComponentsProvider = function(t0) {
|
|
|
11330
11829
|
var value = t1;
|
|
11331
11830
|
var t3;
|
|
11332
11831
|
if ($[6] !== children || $[7] !== value) {
|
|
11333
|
-
t3 = /* @__PURE__ */
|
|
11832
|
+
t3 = /* @__PURE__ */ _jsx101(ComponentsContext.Provider, {
|
|
11334
11833
|
value: value,
|
|
11335
11834
|
children: children
|
|
11336
11835
|
});
|
|
@@ -11343,11 +11842,11 @@ var ComponentsProvider = function(t0) {
|
|
|
11343
11842
|
return t3;
|
|
11344
11843
|
};
|
|
11345
11844
|
// src/components/assistants/AssistantProvider/index.tsx
|
|
11346
|
-
import { c as
|
|
11347
|
-
import { jsx as
|
|
11845
|
+
import { c as _c66 } from "react-compiler-runtime";
|
|
11846
|
+
import { jsx as _jsx102 } from "react/jsx-runtime";
|
|
11348
11847
|
var AssistantProvider = function(t0) {
|
|
11349
11848
|
var _assistant$name;
|
|
11350
|
-
var $ =
|
|
11849
|
+
var $ = _c66(10);
|
|
11351
11850
|
var children = t0.children;
|
|
11352
11851
|
var superinterfaceContext = useSuperinterfaceContext();
|
|
11353
11852
|
var t1;
|
|
@@ -11365,7 +11864,7 @@ var AssistantProvider = function(t0) {
|
|
|
11365
11864
|
var t3 = assistant === null || assistant === void 0 ? void 0 : assistant.avatar;
|
|
11366
11865
|
var t4;
|
|
11367
11866
|
if ($[2] !== t3) {
|
|
11368
|
-
t4 = /* @__PURE__ */
|
|
11867
|
+
t4 = /* @__PURE__ */ _jsx102(Avatar6, {
|
|
11369
11868
|
avatar: t3
|
|
11370
11869
|
});
|
|
11371
11870
|
$[2] = t3;
|
|
@@ -11375,7 +11874,7 @@ var AssistantProvider = function(t0) {
|
|
|
11375
11874
|
}
|
|
11376
11875
|
var t5;
|
|
11377
11876
|
if ($[4] !== children || $[5] !== t4) {
|
|
11378
|
-
t5 = /* @__PURE__ */
|
|
11877
|
+
t5 = /* @__PURE__ */ _jsx102(AssistantAvatarContext.Provider, {
|
|
11379
11878
|
value: t4,
|
|
11380
11879
|
children: children
|
|
11381
11880
|
});
|
|
@@ -11387,7 +11886,7 @@ var AssistantProvider = function(t0) {
|
|
|
11387
11886
|
}
|
|
11388
11887
|
var t6;
|
|
11389
11888
|
if ($[7] !== t2 || $[8] !== t5) {
|
|
11390
|
-
t6 = /* @__PURE__ */
|
|
11889
|
+
t6 = /* @__PURE__ */ _jsx102(AssistantNameContext.Provider, {
|
|
11391
11890
|
value: t2,
|
|
11392
11891
|
children: t5
|
|
11393
11892
|
});
|
|
@@ -11399,5 +11898,5 @@ var AssistantProvider = function(t0) {
|
|
|
11399
11898
|
}
|
|
11400
11899
|
return t6;
|
|
11401
11900
|
};
|
|
11402
|
-
export { AssistantAvatarContext, AssistantNameContext, AssistantProvider, AudioThread, AudioThreadDialog, Avatar6 as Avatar, ComponentsProvider, FunctionBase, FunctionComponentsContext, MarkdownContext, MarkdownProvider, RunStep, SourceAnnotation, Suggestions, SuperinterfaceProvider, Thread, ThreadDialog, ThreadDialogContext, UserAvatarContext, useAssistant, useAudioThreadContext, useComponents, useCreateMessage, useIsMutatingMessage, useLatestMessage, useMarkdownContext, useMessageContext, useMessageFormContext, useMessages, useSuperinterfaceContext, useSuperinterfaceContext as useThreadContext, useThreadDialogContext };
|
|
11901
|
+
export { AssistantAvatarContext, AssistantNameContext, AssistantProvider, AudioThread, AudioThreadDialog, Avatar6 as Avatar, ComponentsProvider, FunctionBase, FunctionComponentsContext, MarkdownContext, MarkdownProvider, RunStep, SourceAnnotation, Suggestions, SuperinterfaceProvider, Thread, ThreadDialog, ThreadDialogContext, TtsAudioRuntimeProvider, UserAvatarContext, WebrtcAudioRuntimeProvider, useAssistant, useAudioThreadContext, useComponents, useCreateMessage, useIsMutatingMessage, useLatestMessage, useMarkdownContext, useMessageContext, useMessageFormContext, useMessages, useSuperinterfaceContext, useSuperinterfaceContext as useThreadContext, useThreadDialogContext, useTtsAudioRuntime, useWebrtcAudioRuntime };
|
|
11403
11902
|
//# sourceMappingURL=index.js.map
|