@cartanova/qgrid-cli 2.19.2 → 2.20.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/bundle/dist/application/qgrid/qgrid.frame.js +20 -9
- package/bundle/dist/application/qgrid/qgrid.types.js +84 -2
- package/bundle/dist/utils/providers/openai/openai-realtime-protocol.js +29 -53
- package/bundle/dist/utils/providers/openai/openai-voice-client.js +4 -3
- package/bundle/src/application/qgrid/qgrid.frame.test.ts +36 -0
- package/bundle/src/application/qgrid/qgrid.frame.ts +24 -5
- package/bundle/src/application/qgrid/qgrid.types.ts +90 -0
- package/bundle/src/application/sonamu.generated.http +6 -0
- package/bundle/src/utils/providers/openai/openai-realtime-protocol.ts +64 -56
- package/bundle/src/utils/providers/openai/openai-voice-client.test.ts +27 -2
- package/bundle/src/utils/providers/openai/openai-voice-client.ts +8 -1
- package/bundle/web-dist/client/assets/TimedPlayer-UGSsgTKj.js +1 -0
- package/bundle/web-dist/client/assets/{index-hUNCpC11.css → index-BITKCBxB.css} +1 -1
- package/bundle/web-dist/client/assets/{index-BeceW0U9.js → index-DjrhMvkM.js} +14 -14
- package/bundle/web-dist/client/assets/{logs-jMJnTwZn.js → logs-DN5BhglL.js} +1 -1
- package/bundle/web-dist/client/assets/{monit-B1xRKwua.js → monit-DZPRb015.js} +1 -1
- package/bundle/web-dist/client/assets/{routes-fsiyivXx.js → routes-DJAp0zIh.js} +1 -1
- package/bundle/web-dist/client/assets/{settings-CHX44roa.js → settings-WY3p1iSx.js} +1 -1
- package/bundle/web-dist/client/assets/show-DykCwUpU.js +2 -0
- package/bundle/web-dist/client/assets/{tokens-zGl36OfE.js → tokens-DSdQ7R5O.js} +1 -1
- package/bundle/web-dist/client/assets/{use-oauth-login-flow-DYWj4645.js → use-oauth-login-flow-gc2fKVxE.js} +1 -1
- package/bundle/web-dist/client/assets/{use-update-token-mutation-BRXXrEf5.js → use-update-token-mutation-BGVP43e8.js} +1 -1
- package/bundle/web-dist/client/assets/voice-DRzMbzHH.js +4 -0
- package/bundle/web-dist/client/index.html +2 -2
- package/bundle/web-dist/server/assets/TimedPlayer-CcClBzGi.js +193 -0
- package/bundle/web-dist/server/assets/{logs-HPho1SkC.js → logs-CxAwuDKc.js} +1 -1
- package/bundle/web-dist/server/assets/{routes-BNHCX4VI.js → routes-W-pd1Hps.js} +1 -1
- package/bundle/web-dist/server/assets/{settings-NJUyaSrJ.js → settings-CFdTg1_f.js} +1 -1
- package/bundle/web-dist/server/assets/{show-Dz5QGL7l.js → show-DVEIHsXh.js} +35 -157
- package/bundle/web-dist/server/assets/{tokens-BPQvjIGq.js → tokens-BO1hyBuB.js} +1 -1
- package/bundle/web-dist/server/assets/voice-BCF-Pkzo.js +1115 -0
- package/bundle/web-dist/server/entry-server.generated.js +90 -8
- package/package.json +1 -1
- package/skills/qgrid/references/ai-sdk-provider-contract.md +4 -0
- package/skills/qgrid/references/openai-codex-runtime.md +3 -1
- package/skills/qgrid/references/request-log-run-lifecycle.md +1 -1
- package/skills/qgrid/references/sonamu-api-web-flow.md +2 -2
- package/bundle/web-dist/client/assets/TimedPlayer-cuEgYA3Q.js +0 -1
- package/bundle/web-dist/client/assets/show-BDMwKfEY.js +0 -2
- package/bundle/web-dist/client/assets/voice-Bwcp-KAu.js +0 -1
- package/bundle/web-dist/server/assets/TimedPlayer-COqaTQSl.js +0 -54
- package/bundle/web-dist/server/assets/voice-V-E3tRqD.js +0 -967
|
@@ -52726,6 +52726,79 @@ object({
|
|
|
52726
52726
|
requestLogId: number$1().optional(),
|
|
52727
52727
|
words: array(TranscribedWord).optional()
|
|
52728
52728
|
});
|
|
52729
|
+
var OPENAI_SPEECH_VOICES = [
|
|
52730
|
+
"marin",
|
|
52731
|
+
"cedar",
|
|
52732
|
+
"alloy",
|
|
52733
|
+
"ash",
|
|
52734
|
+
"ballad",
|
|
52735
|
+
"coral",
|
|
52736
|
+
"echo",
|
|
52737
|
+
"sage",
|
|
52738
|
+
"shimmer",
|
|
52739
|
+
"verse"
|
|
52740
|
+
];
|
|
52741
|
+
var OPENAI_LIVE_VOICES = [
|
|
52742
|
+
"cove",
|
|
52743
|
+
"juniper",
|
|
52744
|
+
"maple",
|
|
52745
|
+
"spruce",
|
|
52746
|
+
"ember",
|
|
52747
|
+
"vale",
|
|
52748
|
+
"breeze",
|
|
52749
|
+
"arbor",
|
|
52750
|
+
"sol",
|
|
52751
|
+
"aube",
|
|
52752
|
+
"bubbie",
|
|
52753
|
+
"haetsal",
|
|
52754
|
+
"hanul",
|
|
52755
|
+
"himari",
|
|
52756
|
+
"leher",
|
|
52757
|
+
"miko",
|
|
52758
|
+
"neer",
|
|
52759
|
+
"porto",
|
|
52760
|
+
"rindo",
|
|
52761
|
+
"rio",
|
|
52762
|
+
"rivage",
|
|
52763
|
+
"selva",
|
|
52764
|
+
"sonna",
|
|
52765
|
+
"tinta",
|
|
52766
|
+
"viola"
|
|
52767
|
+
];
|
|
52768
|
+
var GROK_TTS_VOICES = {
|
|
52769
|
+
female: [
|
|
52770
|
+
"ara",
|
|
52771
|
+
"aurora",
|
|
52772
|
+
"carina",
|
|
52773
|
+
"celeste",
|
|
52774
|
+
"eve",
|
|
52775
|
+
"iris",
|
|
52776
|
+
"liora",
|
|
52777
|
+
"luna",
|
|
52778
|
+
"ursa"
|
|
52779
|
+
],
|
|
52780
|
+
male: [
|
|
52781
|
+
"altair",
|
|
52782
|
+
"atlas",
|
|
52783
|
+
"castor",
|
|
52784
|
+
"cosmo",
|
|
52785
|
+
"helios",
|
|
52786
|
+
"helix",
|
|
52787
|
+
"kepler",
|
|
52788
|
+
"leo",
|
|
52789
|
+
"lumen",
|
|
52790
|
+
"lux",
|
|
52791
|
+
"naksh",
|
|
52792
|
+
"orion",
|
|
52793
|
+
"perseus",
|
|
52794
|
+
"rex",
|
|
52795
|
+
"rigel",
|
|
52796
|
+
"sal",
|
|
52797
|
+
"sirius",
|
|
52798
|
+
"zagan",
|
|
52799
|
+
"zenith"
|
|
52800
|
+
]
|
|
52801
|
+
};
|
|
52729
52802
|
object({
|
|
52730
52803
|
model: VoiceModelId.optional(),
|
|
52731
52804
|
text: string$2().min(1).max(15e3),
|
|
@@ -52756,11 +52829,20 @@ object({
|
|
|
52756
52829
|
timestampsSource: _enum(["provider", "aligned"]).optional(),
|
|
52757
52830
|
timestampsError: string$2().optional()
|
|
52758
52831
|
});
|
|
52832
|
+
var LiveHistoryItem = object({
|
|
52833
|
+
role: _enum([
|
|
52834
|
+
"user",
|
|
52835
|
+
"assistant",
|
|
52836
|
+
"developer"
|
|
52837
|
+
]),
|
|
52838
|
+
text: string$2().min(1)
|
|
52839
|
+
});
|
|
52759
52840
|
object({
|
|
52760
52841
|
model: literal("openai/gpt-live-1").optional(),
|
|
52761
52842
|
sdp: string$2().startsWith("v=0", "sdp must be an SDP offer").max(65536),
|
|
52762
52843
|
voice: string$2().min(1).max(64).optional(),
|
|
52763
52844
|
instructions: string$2().min(1).max(8e3).optional(),
|
|
52845
|
+
history: array(LiveHistoryItem).max(128, "history holds at most 128 items").refine((items) => items.reduce((total, item) => total + item.text.length, 0) <= 1e6, "history text exceeds 1,000,000 characters").optional(),
|
|
52764
52846
|
delegation: object({
|
|
52765
52847
|
model: string$2().refine((id) => QGRID_MODELS.includes(id), "model must be one of QGRID_MODELS").optional(),
|
|
52766
52848
|
effort: Effort.optional(),
|
|
@@ -53688,7 +53770,7 @@ function ChatWidget() {
|
|
|
53688
53770
|
}
|
|
53689
53771
|
//#endregion
|
|
53690
53772
|
//#region src/components/Sidebar.tsx
|
|
53691
|
-
var qgridVersion = "2.
|
|
53773
|
+
var qgridVersion = "2.20.0";
|
|
53692
53774
|
function Sidebar({ className }) {
|
|
53693
53775
|
const pathname = useRouterState({ select: (s) => s.location.pathname });
|
|
53694
53776
|
const { tab: currentTab = "tts" } = useSearch({ strict: false });
|
|
@@ -55904,7 +55986,7 @@ function RootComponent() {
|
|
|
55904
55986
|
}
|
|
55905
55987
|
//#endregion
|
|
55906
55988
|
//#region src/routes/index.tsx
|
|
55907
|
-
var $$splitComponentImporter$6 = () => import("./assets/routes-
|
|
55989
|
+
var $$splitComponentImporter$6 = () => import("./assets/routes-W-pd1Hps.js");
|
|
55908
55990
|
var Route$6 = createFileRoute("/")({ component: lazyRouteComponent($$splitComponentImporter$6, "component") });
|
|
55909
55991
|
//#endregion
|
|
55910
55992
|
//#region src/services/sonamu.generated.ts
|
|
@@ -56310,7 +56392,7 @@ object({
|
|
|
56310
56392
|
_enum(["A"]);
|
|
56311
56393
|
//#endregion
|
|
56312
56394
|
//#region src/routes/logs.tsx
|
|
56313
|
-
var $$splitComponentImporter$5 = () => import("./assets/logs-
|
|
56395
|
+
var $$splitComponentImporter$5 = () => import("./assets/logs-CxAwuDKc.js");
|
|
56314
56396
|
var logsSearchSchema = object({
|
|
56315
56397
|
token: string$2().optional(),
|
|
56316
56398
|
project: string$2().optional(),
|
|
@@ -56338,15 +56420,15 @@ var Route$4 = createFileRoute("/monit")({
|
|
|
56338
56420
|
});
|
|
56339
56421
|
//#endregion
|
|
56340
56422
|
//#region src/routes/settings.tsx
|
|
56341
|
-
var $$splitComponentImporter$3 = () => import("./assets/settings-
|
|
56423
|
+
var $$splitComponentImporter$3 = () => import("./assets/settings-CFdTg1_f.js");
|
|
56342
56424
|
var Route$3 = createFileRoute("/settings")({ component: lazyRouteComponent($$splitComponentImporter$3, "component") });
|
|
56343
56425
|
//#endregion
|
|
56344
56426
|
//#region src/routes/tokens.tsx
|
|
56345
|
-
var $$splitComponentImporter$2 = () => import("./assets/tokens-
|
|
56427
|
+
var $$splitComponentImporter$2 = () => import("./assets/tokens-BO1hyBuB.js");
|
|
56346
56428
|
var Route$2 = createFileRoute("/tokens")({ component: lazyRouteComponent($$splitComponentImporter$2, "component") });
|
|
56347
56429
|
//#endregion
|
|
56348
56430
|
//#region src/routes/voice.tsx
|
|
56349
|
-
var $$splitComponentImporter$1 = () => import("./assets/voice-
|
|
56431
|
+
var $$splitComponentImporter$1 = () => import("./assets/voice-BCF-Pkzo.js");
|
|
56350
56432
|
var voiceSearchSchema = object({ tab: _enum(VOICE_TAB_IDS).optional() });
|
|
56351
56433
|
var Route$1 = createFileRoute("/voice")({
|
|
56352
56434
|
validateSearch: voiceSearchSchema,
|
|
@@ -56354,7 +56436,7 @@ var Route$1 = createFileRoute("/voice")({
|
|
|
56354
56436
|
});
|
|
56355
56437
|
//#endregion
|
|
56356
56438
|
//#region src/routes/requests/show.tsx
|
|
56357
|
-
var $$splitComponentImporter = () => import("./assets/show-
|
|
56439
|
+
var $$splitComponentImporter = () => import("./assets/show-DVEIHsXh.js");
|
|
56358
56440
|
var showSearchSchema = object({ id: number$1() });
|
|
56359
56441
|
var Route = createFileRoute("/requests/show")({
|
|
56360
56442
|
validateSearch: showSearchSchema,
|
|
@@ -56443,4 +56525,4 @@ async function render(url, preloadedData = []) {
|
|
|
56443
56525
|
};
|
|
56444
56526
|
}
|
|
56445
56527
|
//#endregion
|
|
56446
|
-
export {
|
|
56528
|
+
export { VOICE_TAB_TITLES as _, RequestLogOrderBy as a, Link as b, OPENAI_LIVE_VOICES as c, ForwardRef as d, ForwardRef$1 as f, VOICE_TAB_IDS as g, Markdown as h, Route$5 as i, OPENAI_SPEECH_VOICES as l, remarkGfm as m, Route$1 as n, Effort as o, ForwardRef$3 as p, Route$4 as r, render, GROK_TTS_VOICES as s, Route as t, QGRID_MODEL_GROUPS as u, ForwardRef$8 as v, useNavigate as x, require_react_dom as y };
|
package/package.json
CHANGED
|
@@ -264,3 +264,7 @@ For external providers, the logger reads AI SDK's provider-neutral `onStart.outp
|
|
|
264
264
|
`qgrid.transcription("openai/<id>")` and `qgrid.speech("openai/<id>")` share the Grok voice factories; the `openai/` prefix selects the realtime route and switches the option namespace to `providerOptions.openai`, whose schemas are copied field-for-field from `@ai-sdk/openai` (`openAITranscriptionModelOptions`, `openaiSpeechModelOptionsSchema`, vercel/ai `fce9210`). Honored: transcription `language`, `prompt` (`gpt-realtime-whisper` rejects `prompt` with HTTP 400 from the server; `whisper-1` accepts it but the upstream ignores it); speech `voice` (one of OpenAI realtime's 10 preset voices: `alloy ash ballad coral echo sage shimmer verse marin cedar`, default `marin`; others fail with HTTP 400), `instructions`/`openai.instructions`, `outputFormat` `wav` (default) or `pcm`. Every other set key emits the AI SDK `unsupported` warning; `language` on speech reuses the official provider's warning text and an unknown `outputFormat` falls back to `wav` with a warning (the official provider falls back to `mp3`). `providerOptions.qgrid.tokenName` must carry the `openai/` prefix. Transcription input must be PCM16 WAV or raw PCM; `segments` is empty, `durationInSeconds` is computed server-side from the audio, `language` echoes the request. Speech `providerMetadata.qgrid.mediaType` is `audio/wav` or `audio/pcm;rate=24000`. Keep model unions equal to the server's candidate lists and prune both from the live matrix (`openai-codex-runtime.md`, "Realtime voice").
|
|
265
265
|
|
|
266
266
|
Grok speech passes the standard `speed` through as `@ai-sdk/xai` does (2.18.0+; the server enforces 0.7-1.5). Speech timing: `qgrid.speech("grok/...")` honors one `providerOptions.xai` key, `withTimestamps` (2.16.0+); `providerOptions.qgrid.withTimestamps` (2.17.0+) works for both `grok/` and `openai/` speech and is read straight from the namespace because the qgrid option parsers drop unknown keys. Every other `xai` key still warns. Timing comes back in `providerMetadata.qgrid.audioTimestamps` (`graphChars`, `graphTimes` `[start, end]` seconds, index-aligned) plus `duration` and `timestampsSource` (`provider` for Grok, `aligned` for OpenAI); the field names match `@ai-sdk/xai`'s `providerMetadata.xai`. A failed timing step returns the audio with `timestampsError` and an `other` warning. Grok transcription maps the server's `words` to AI SDK `segments` (`startSecond`/`endSecond`, 2.17.0+); OpenAI transcription segments stay empty.
|
|
267
|
+
|
|
268
|
+
Voice ids (2.20.0+): `src/voices.ts` (no imports, exported from the main and `/realtime` entries) holds `QGRID_GROK_VOICES` (`{ female, male }`), `QGRID_OPENAI_SPEECH_VOICES` and `QGRID_LIVE_VOICES` with types `QgridGrokVoice`, `QgridOpenAISpeechVoice`, `QgridLiveVoice`, default first. AI SDK types `voice` as `string`, so these are for pickers and `satisfies` checks. The server's lists in `qgrid.types.ts` (`GROK_TTS_VOICES`, `OPENAI_SPEECH_VOICES`, `OPENAI_LIVE_VOICES`, synced to the dashboard, which reads them instead of keeping its own) are the source; `voices.test.ts` fails when the SDK copy drifts.
|
|
269
|
+
|
|
270
|
+
Realtime (2.20.0+, SON-595): `qgrid.realtime("openai/gpt-live-1")` (and `createQgridRealtime` from the browser-safe `@cartanova/qgrid-ai-sdk/realtime` entry, `src/realtime.ts`, a second tsdown entry that must never import `http-transport.ts`/`image-model.ts` because they pull in undici) implements AI SDK `Experimental_RealtimeModelV4` for GPT-Live over WebRTC only (`capabilities`: continuous, `transports`/`connections` `webrtc`, `startup: "session-start"`, `finalization: "session-close"`; peer minimums `ai` 7.0.102 and `@ai-sdk/provider` 4.0.15, where WebRTC landed). The browser runtime (`experimental_useRealtime` / `Experimental_AbstractRealtimeSession`) posts `{ sdp, sessionConfig }` to the app's `api.session` route; the route calls `doCreateWebRTCSession`, which POSTs `liveCall` with plain `fetch` (`voice`/`instructions` from `sessionConfig`, `delegation`/`history`/`tokenName`/`logger` from `sessionConfig.providerOptions.qgrid`, which the route must build server-side) and returns `{ sessionId: callId, sdp, requestLogId }`. The data channel speaks the Codex frameless protocol, not the public API's `session.*` names that `@ai-sdk/openai`'s `OpenAIRealtimeModelLive` maps: a per-connection parser (it keeps only the last usage) maps `session.started` → `session-started` without `delegationMode` (the ai 7.0.148 runtime throws on `"provider"`, and `"client"` would tell the app to answer delegations qgrid already answers), `input_transcript.added`/`output_transcript.added` → `transcript-fragment` (speaker from the event type, `item.text`, top-level `start_ms`/`end_ms`; `turn.delta` is not used because each turn's first word appears only in `turn.created`, seen live 2026-11-10), `delegation.created` → `delegation-created` (`target: "provider"`, `offsetMs` from `offset_ms`), `session.usage.updated`/`session.closed` → seconds from `usage.audio_duration_ms` (close falls back to the last usage), `error` → `error`, everything else → `custom`. Client events: `session-close` → `session.close`; `context-append` → `session.context.append` or `delegation.context.append` with `content: [{ type: "input_text", text }]`; the rest throw `UnsupportedFunctionalityError`. Codex lists `input_audio.pause`/`input_audio.resume` (mute) but their acknowledgement events are unknown, and the runtime flips `isInputMuted` only on an acknowledgement, so mute is out of v1. Verified 2026-11-10 with `Experimental_AbstractRealtimeSession` in a browser (harness: the SON-595 issue): the data channel carries `session.started`, `turn.*`, `*_transcript.added`, `delegation.created`, `session.usage.updated` and, about 0.6 s after `session.close`, `session.closed` with usage, so `close()` ends `disconnected` with finalization `confirmed`. In the first two delegated sessions `session.close` was not honored (no `session.closed` on the data channel or the sideband; the data channel errored about 3 s later and the session ended by peer teardown within about 5 s, so the client saw `error`); it did not recur in seven later runs (direct and through qgrid, with, without and during a pending delegation). If it returns, compare against a direct `/calls` session before changing the SDK.
|
|
@@ -239,6 +239,7 @@ Sources: `openai-realtime-protocol.ts` (wire constants, session builders, PCM he
|
|
|
239
239
|
- TTS timing (2.19.0+): realtime speech carries no timing, so `speak` with `withTimestamps` force-aligns the text to the generated PCM in process (`utils/speech-aligner.ts`; 2.17.x transcribed the audio with Grok STT instead, removed by user decision 2026-11-09). The model is MMS-FA (Meta's CTC forced aligner, 1,130 languages, CC BY-NC 4.0, adopted with that license risk accepted) converted to int8 ONNX by us (355 MB, about 640 MB resident, about 0.17 s per 6 s clip on Apple Silicon). It scores 20 ms frames of 16 kHz audio against 28 letters; a Viterbi pass walks the script's letters in order. The script is romanized (Hangul per syllable, Latin accents stripped); digits, symbols, and other scripts become a star token (log-probability 0, matches any sound), and a star also wraps the script so a spoken preamble is absorbed. Audio over 30 s is scored in 30 s windows with 2 s context. The session loads on first use and unloads after 10 idle minutes. Output keeps `timestampsSource: "aligned"`; the step log records `alignMs`. The model path is `QGRID_ALIGNER_MODEL`, else `~/.cache/qgrid/models/mms-300m-fa-int8.onnx` (where `qgrid --install-aligner` downloads it), and `onnxruntime-node` is an api devDependency kept external in the build (`tsdown.config.ts` `neverBundle`; a bundled import resolves to a missing pnpm path): the Docker image installs both in layers before Claude Code and qgrid (model from the `aligner-model-v1` GitHub release, pinned by checksum, attribution in `/opt/qgrid/models/NOTICE.md`), and the image smoke test runs one alignment. An npm or pnpm install lacks both until `qgrid --install-aligner`, which fetches the model and the pinned `onnxruntime-node`/`onnxruntime-common` tarballs straight from their URLs (SRI hashes checked), unpacks the runtime with `tar` into `~/.cache/qgrid/runtime/node_modules` keeping only this platform's binary, and never calls npm or pnpm: a pnpm v11 global install isolates each global package, so a globally installed `onnxruntime-node` was invisible to qgrid (verified 2026-11-09). The server imports `onnxruntime-node` normally and falls back to that folder through `createRequire`. The Viterbi back-pointer table is frames x (2 x tokens + 1) bytes, capped at 100 MB: both grow with the audio, so about 4 minutes of dense English (251 s at 16.7 chars/s) is the most it can time; `alignSpeech` rejects longer input before running the model. Bench (SON-589): against Grok TTS character timing, word-boundary error median 4 ms / p90 20 ms / p99 25 ms on 523 words (the STT pass: 5 / 24 / 165 ms, failing on dropped fillers like "Hmm" and code-switched lines), digit words median 9 ms / p90 63 ms; on 126 OpenAI clips it agreed with the STT pass within one frame for 96% of words.
|
|
240
240
|
- STT words (2.19.0+): `transcribe` aligns the OpenAI transcript to the input audio with the same aligner (`prepareRealtimeInput` PCM at 24 kHz) and returns `TranscribeOutput.words`, the shape Grok STT returns; the step log records `alignMs`, or `wordsError` when alignment fails and the transcript returns without words. Measured 2026-11-09 on Apple Silicon: 2.9 s for a 54 s clip (cold load included), 9.9 s for 3.6 min; a 4.9 min clip exceeded the table cap.
|
|
241
241
|
- Dispatcher: `OpenAIDispatcher.runVoice` selects a token with the same quota gate as Responses, refreshes once on a 401 and retries once, and invalidates the rate-limit cache afterwards. `OpenAIVoiceInputError` (unsupported audio, bad voice, empty text) becomes HTTP 400 `qgrid.openaiVoiceInvalidRequest`; everything else propagates as an upstream failure.
|
|
242
|
+
- Recommended OpenAI STT (2.20.0+, SON-593): `gpt-transcribe`. OpenAI shuts down `gpt-4o-mini-transcribe`, `gpt-4o-transcribe` and `whisper-1` on 2027-02-26. A transcribe request without `model` goes to Grok (`voiceProvider`), so `OPENAI_REALTIME_DEFAULT_TRANSCRIPTION_MODEL` (now `gpt-transcribe`, was Codex's `gpt-4o-mini-transcribe`) is only the OpenAI client's fallback id and the speech session's input transcription model (TTS accepted `gpt-transcribe` there, or no transcription field, on 2026-11-10). Bench 2026-11-10 through the local server (synthetic speech): `gpt-transcribe` WER 2.3% on 108 English clips and CER 4.4% on 18 Korean/English clips, full transcripts of 60 s and 229 s podcast cuts, empty text for 5 s of silence and of noise, median 4.4 s per clip; `gpt-live-transcribe` 2.8% / 5.9%, stopped at 51 of 126 words (60 s) and 73 of 491 (229 s), median 5.8 s; `gpt-4o-transcribe` 1.4% / 14.5%, failed the 229 s clip, and returned Vietnamese/Japanese phrases for silence/noise. Both successors sometimes corrected learner grammar ("we eat" → "we ate"; run to run it varies). `buildTranscriptionSession` sends qgrid's `language` to `gpt-transcribe` as `languages: [language]` (sending both is an upstream `invalid_value`; the gpt-4o family rejects `languages`; singular `language` was still honored by `gpt-transcribe` on 2026-11-10). `gpt-transcribe` also accepts `keywords`, which qgrid does not expose. The English WER gap to `gpt-4o-transcribe` is number formatting (12 of its 46 edits were "21st" → "twenty-first"). `gpt-live-transcribe` is left as is (user decision 2026-11-10: out of scope); it transcribes only about the first 30 s of one committed buffer (60 s clip: 57 words on one commit, all 129 with a commit every 10 s) and rejects server VAD ("Turn detection is not supported for this transcription model").
|
|
242
243
|
- Exposed ids (user decision 2026-10-17: keep every reachable id, document limits): STT `gpt-4o-mini-transcribe`, `gpt-4o-transcribe`, `gpt-transcribe` (4/4 on the matrix), `gpt-live-transcribe` and `gpt-realtime-whisper` (return about half of a 60 s clip; whisper also mangles Korean), `whisper-1` (ignores `prompt`). `gpt-realtime-whisper` rejects `prompt` upstream, so `OPENAI_TRANSCRIPTION_MODELS_WITHOUT_PROMPT` makes the client fail with a 400 before the realtime call. TTS `gpt-realtime-2.1-mini` (13/13 verbatim, default), `gpt-realtime-2.1` (12/13) on the 2026-10-17 statement texts; `gpt-realtime-1.5` (6/13, often answers instead of repeating) was removed from the server list, SDK union and READMEs on 2026-11-09 (user decision, 2.18.0). Realtime models are conversational and answer text addressed to the listener: on question-form character lines the original one-sentence prompt let `gpt-realtime-2.1` answer 7 of 12, while the current sectioned prompt with `<script>` delimiters read 12/12 on both 2.1 and 2.1-mini (`docs/diagnosis/2026-11-06-openai-realtime-tts-prompt.md`). That 12/12 was judged by the model's own transcript, which can omit a spoken preamble; on 2026-11-09 two independent STT models (gpt-4o-transcribe, Grok) judged 108 English clips (6 lines x `marin` `cedar` `ballad` x 3): 2.1 54/54, 2.1-mini 53/54 (one take opened with "Sure, let me read that out loud for you exactly as written."), and both read all 9 Korean/English mixed takes in full. gpt-4o-transcribe itself dropped the English part of 3 of 18 mixed clips that Grok STT heard in full. Keep every instruction in the system prompt: an instruction placed in the user item was read aloud. Model behavior is tracked by the live matrix (`OPENAI_LIVE=1 pnpm tsx scripts/live-openai-voice-matrix.ts`, results in `docs/diagnosis/2026-10-17-openai-realtime-audio-probe.md`). Remove an id from `OPENAI_TRANSCRIPTION_MODELS`/`OPENAI_SPEECH_MODELS`, the SDK unions, and the READMEs together when it stops passing. Unavailable on subscription (verified 2026-10-17): `/backend-api/codex/audio/transcriptions`, `/audio/speech`, `gpt-4o-mini-tts`, `tts-1*`, `gpt-transcribe` via `/codex/responses`, Responses `input_audio`. The ChatGPT-web `POST /backend-api/transcribe` works but is not used (removed from Codex in PR #16114, ignores model/language, retains uploads 30 days).
|
|
243
244
|
|
|
244
245
|
## GPT-Live conversation (SON-592, 2.19.2+)
|
|
@@ -254,4 +255,5 @@ Sources: `openai-realtime-protocol.ts` (GPT-Live section), `OpenAIVoiceClient.cr
|
|
|
254
255
|
- Request log: `media_kind: "live"`, created at the exchange with an empty `user_prompt` and the instructions as `system_prompt`, plus a `live_session:<callId>` tool step whose result is `{"status":"live",callId}`, not a pending step (a pending one would fall to the 30-minute tool-wait cleanup mid-conversation). After every finished turn `recordRunProgress` rewrites `response` with the conversation so far as `**role** m:ss` lines, in order, so the log reads live and a server restart keeps everything up to the last turn; a live run still running 2 h 15 min after creation lost its server and is closed by `expireStaleLiveRuns` in the stale cleanup. At the end the step result is replaced with the whole summary (turns with times), `response` holds the full conversation, `cost_usd` $0.05 per minute of `audio_duration_ms` (`liveCost`), and a sideband that failed before any turn finishes the run as `error`. No audio is stored (user decision, SON-590 DB size).
|
|
255
256
|
- Delegation: the session asks for `delegation: {type: "client"}` (as Codex does), so the voice model sends `delegation.created` (`item: {id, type: "delegation", target: "client", content: [input_text], handoff_id}`) for lookups or reasoning and talks filler until an answer arrives. Unanswered, it stalled for ten minutes in a debate (request log 900915). `responses` delegation, where OpenAI runs the backend, fails on subscription (`Cannot connect to host responsesapi.openai.svc.cluster.local`), and omitting `delegation` behaves as `client`. Codex answers by routing the text into its own agent thread (`route_realtime_text_input`); qgrid answers through `OpenAILiveCallRequest.onDelegation`: the frame runs `QgridDispatcher.query` on the session's `delegation.model` (default `openai/gpt-6-luna`, effort `low`; validated against `QGRID_MODELS`, the served list in `qgrid.types.ts` that the dashboard chat also offers) with `LIVE_DELEGATION_SYSTEM`, the live instructions and the conversation so far, 90 s timeout, and the watcher sends the reply as `delegation.context.append` (no channel = speakable) on the sideband. A failure is answered with a short failure note so the voice can say so. `delegation.webSearch` sets the internal `InternalQueryInput.webSearch`, which adds `{type: "web_search"}` to the direct provider request: OpenAI sends Codex's hosted `{type: "web_search", external_web_access: true}` (answered on subscription 2026-11-10: gpt-6-luna low 5.4-6.5 s with live results; gpt-5.5 is refused for ChatGPT accounts), Grok forwards its builtin; Claude Code has no such tool, so the frame rejects it with 400 and the dispatcher throws.
|
|
256
257
|
- Events: the summary keeps every sideband event except the audio copies and word-level text (`session.input_audio.append`, `session.output_audio.delta`, `input/output_transcript.added`, `turn.delta`), each with `atMs` since qgrid joined, plus qgrid's own `delegation.context.append` (with `ms` and the reply) or `qgrid.delegation_failed`.
|
|
257
|
-
-
|
|
258
|
+
- History: `LiveCallInput.history` (`{role: user|assistant|developer, text}[]`) becomes Codex's `initial_items` (`{type: "message", role, content: [{type: input_text | output_text (assistant), text}]}`). Measured on subscription 2026-11-10: up to 128 items opens a session and 129 does not (call 201, sideband 404, as for an unknown voice); a `system` role also never starts; 1,000,000 characters (100 x 10,000 or 20 x 50,000) still opened, recall at that size unmeasured. The schema caps 128 items and 1,000,000 characters. A seeded text-chat history was recalled by voice (name and dog from two text turns). The request log stores the history in `request_logs.history`, the delegation prompt puts it before the session's turns, and the session step args record `historyItems`.
|
|
259
|
+
- Not exposed: caller-defined tools during a session (the caller holds only its peer to OpenAI, so qgrid has no channel to ask it to run one), commentary-channel progress.
|
|
@@ -105,7 +105,7 @@ Input images are not stored in `request_logs.user_prompt`; that field remains th
|
|
|
105
105
|
## Media fields
|
|
106
106
|
|
|
107
107
|
- `media_kind`: nullable enum (`image`, `video`, `stt`, `tts`, `live`) written at `createRun` by `startMediaRun` from the media endpoint's kind; text and chat runs keep NULL (chat-generated images are marked only by `is_image_generation`). The list `Fmt` column reads it, so any new media endpoint must open its run through `startMediaRun` or set it explicitly.
|
|
108
|
-
- Live runs (`live`, 2.19.2+): one row per GPT-Live session, `running` for the whole session (up to two hours). The `live_session` tool step is written with a `{"status":"live"}` result rather than pending, because the 30-minute tool-wait cleanup matches pending tool steps; `recordRunProgress` (which writes only to running rows) rewrites `response` with the conversation after every turn, and the session's end replaces the step result with the summary (turns, kept events, usage, end reason) and finishes the run. Each answered delegation is appended as its own `delegation` tool step (`tool_call_index` 1, 2, ...; args: request, model, effort, webSearch; result: answer, serving model, token, usage, cost; or `error`), written as it completes, and the run's `cost_usd` is the session audio estimate plus every delegation's query cost. `expireStaleLiveRuns` closes live runs still running 2 h 15 min after creation (their server stopped mid-session) in the same stale cleanup pass. No audio is stored.
|
|
108
|
+
- Live runs (`live`, 2.19.2+): one row per GPT-Live session, `running` for the whole session (up to two hours). The `live_session` tool step is written with a `{"status":"live"}` result rather than pending, because the 30-minute tool-wait cleanup matches pending tool steps; `recordRunProgress` (which writes only to running rows) rewrites `response` with the conversation after every turn, and the session's end replaces the step result with the summary (turns, kept events, usage, end reason) and finishes the run. Each answered delegation is appended as its own `delegation` tool step (`tool_call_index` 1, 2, ...; args: request, model, effort, webSearch; result: answer, serving model, token, usage, cost; or `error`), written as it completes, and the run's `cost_usd` is the session audio estimate plus every delegation's query cost. A session started from `history` stores it in the run's `history` column as `{type: "message", role, content}` items, which the detail page's History section shows. `expireStaleLiveRuns` closes live runs still running 2 h 15 min after creation (their server stopped mid-session) in the same stale cleanup pass. No audio is stored.
|
|
109
109
|
- Speech `response`: browser-playable audio is embedded as an `<audio>` data URL (see `sonamu-api-web-flow.md`); speech `ttft_ms` is the first audio byte, passed explicitly to `finishRun` because media runs have no generate step to derive it from.
|
|
110
110
|
|
|
111
111
|
- Voice cost (2.17.1+): subscription voice calls have no per-call bill, so `cost_usd` records the public API list-price estimate with `cost_source: "pricing_table"` (`model-cost.ts`, prices checked 2026-11-09): OpenAI realtime speech from its response usage per token type (cached input is not split out, so all input is charged as uncached text; the in-process timing alignment costs nothing, 2.19.0+); transcription per minute of audio (OpenAI's published per-minute estimates, Grok $0.10/hour); Grok TTS $15 per 1M input characters. Unknown model ids stay unpriced (NULL). The detail page labels the figure "Voice" instead of "Driver". OpenAI speech rows store the caller's style `instructions`, and OpenAI transcription rows the STT `prompt`, as `system_prompt` (2.17.1+); the detail page titles that panel "Style instructions" or "Prompt".
|
|
@@ -64,9 +64,9 @@ The list header ends its filter row with a reload button (2.10.2+) that calls th
|
|
|
64
64
|
|
|
65
65
|
Structured output visibility: the list has an `Fmt` column (`voice/stt`, `voice/tts` or `voice/live` when `media_kind` is `stt`, `tts` or `live`, `video` when it is `video`, otherwise `img` when `is_image_generation` is true, otherwise `json` when `is_structured` is true, otherwise `text`) and a `broken` badge driven by `response_json_ok = false`; there is no broken-JSON list filter. At review time, all 114,647 succeeded structured rows had `response_json_ok = true` and zero false rows existed; the unindexed zero-result lookup scanned 1,286,016 rows and took about 3 seconds. Before reinstating the filter, validate the failure-signal semantics and index the predicate. The detail page shows a dark Response Type panel (zod expression by default, `type` declaration via toggle) rendered server-side from the stored `json_schema`. Plain-text rows render no panel. Rows written by pre-2.7.2 servers show `text`.
|
|
66
66
|
|
|
67
|
-
Media rows (2.15.5+): `startMediaRun` writes the nullable `media_kind` column (`image`, `video`, `stt`, `tts`) at `createRun`; text runs keep it NULL, and media rows written before the column stay NULL and show their old `Fmt` label (no backfill). Speech rows store browser-playable audio (`audio/wav`, `audio/mpeg`) in `response` as `<audio src="data:...;base64,..."></audio>`, the same inline pattern image rows use, and the detail page renders it as an `<audio controls>` player; OpenAI `pcm` output is wrapped as WAV for the log copy only, while Grok `pcm`/`mulaw`/`alaw` keep the `[audio <mime> <bytes> bytes]` placeholder. The audio is stored once, not repeated in the `speech` step result. Speech `ttft_ms` is time to the first audio byte measured from the same start as `duration_ms`: the first `response.output_audio.delta` for OpenAI realtime, response-header arrival for Grok `/tts` (not streamed, so it is close to the full duration). `finishRun` takes an explicit `ttft_ms` for runs without generate steps and otherwise derives it from the first generate step. STT rows record no TTFT; since 2.16.0 their browser-playable input audio is embedded the same way in `user_prompt` (the detail page renders the USER panel through the same media parser), and other input types keep the placeholder. Inline audio grows the request-log table with every logged voice call; `logger: false` skips it. Voice step results keep word timing (`words`: TTS output words, or the words heard in the STT input; 2.17.0+). The detail page fetches that one step (subset `A`) only for `tts` rows and renders the RESPONSE clip with the shared `TimedPlayer` (highlighted, clickable words); `stt` rows show the input audio as a plain player (2.19.0+, by user decision 2026-11-09: timing on the user prompt read as wrong). `live` rows (2.19.2+) title the system prompt Instructions, hide the empty User panel, and show `response` as the Conversation; the Voice playground (`/voice?tab=tts|stt|live`, listed as TTS, STT and Live Conversation under Voice in the sidebar, with an in-page tab bar only on narrow screens; panels stay mounted so switching keeps state) runs Live Conversation on the browser's own `RTCPeerConnection` with an `oai-events` data channel, calls `QgridService.liveCall` with the offer, sends the chosen delegation model (any model the dashboard chat offers: both read `QGRID_MODEL_GROUPS` and the `Effort` enum from the synced `qgrid.types.ts`; the served list lives on the server, with the reasons retired ids are left out), effort and web search (disabled for `anthropic/`), a Request log toggle (off sends `logger: false`), builds its transcript from the data channel's `turn.*` events, and ends with `session.close` on that channel (see `openai-codex-runtime.md`).
|
|
67
|
+
Media rows (2.15.5+): `startMediaRun` writes the nullable `media_kind` column (`image`, `video`, `stt`, `tts`) at `createRun`; text runs keep it NULL, and media rows written before the column stay NULL and show their old `Fmt` label (no backfill). Speech rows store browser-playable audio (`audio/wav`, `audio/mpeg`) in `response` as `<audio src="data:...;base64,..."></audio>`, the same inline pattern image rows use, and the detail page renders it as an `<audio controls>` player; OpenAI `pcm` output is wrapped as WAV for the log copy only, while Grok `pcm`/`mulaw`/`alaw` keep the `[audio <mime> <bytes> bytes]` placeholder. The audio is stored once, not repeated in the `speech` step result. Speech `ttft_ms` is time to the first audio byte measured from the same start as `duration_ms`: the first `response.output_audio.delta` for OpenAI realtime, response-header arrival for Grok `/tts` (not streamed, so it is close to the full duration). `finishRun` takes an explicit `ttft_ms` for runs without generate steps and otherwise derives it from the first generate step. STT rows record no TTFT; since 2.16.0 their browser-playable input audio is embedded the same way in `user_prompt` (the detail page renders the USER panel through the same media parser), and other input types keep the placeholder. Inline audio grows the request-log table with every logged voice call; `logger: false` skips it. Voice step results keep word timing (`words`: TTS output words, or the words heard in the STT input; 2.17.0+). The detail page fetches that one step (subset `A`) only for `tts` rows and renders the RESPONSE clip with the shared `TimedPlayer` (highlighted, clickable words); `stt` rows show the input audio as a plain player (2.19.0+, by user decision 2026-11-09: timing on the user prompt read as wrong). `live` rows (2.19.2+) title the system prompt Instructions, hide the empty User panel, and show `response` as the Conversation; the Voice playground (`/voice?tab=tts|stt|live`, listed as TTS, STT and Live Conversation under Voice in the sidebar, with an in-page tab bar only on narrow screens; panels stay mounted so switching keeps state) runs Live Conversation on the browser's own `RTCPeerConnection` with an `oai-events` data channel, calls `QgridService.liveCall` with the offer, sends the chosen delegation model (any model the dashboard chat offers: both read `QGRID_MODEL_GROUPS` and the `Effort` enum from the synced `qgrid.types.ts`; the served list lives on the server, with the reasons retired ids are left out), effort and web search (disabled for `anthropic/`), a Request log toggle (off sends `logger: false`), a Continue button that starts a new session with the earlier history plus the last session's turns as `history` (shown dimmed above the new turns), builds its transcript from the data channel's `turn.*` events, and ends with `session.close` on that channel (see `openai-codex-runtime.md`).
|
|
68
68
|
|
|
69
|
-
Voice playground (2.15.5+): the sidebar's Playground section links `/voice`, a dashboard-only test page with Text to speech and Speech to text panels that call the generated `QgridService.useSpeakMutation` / `useTranscribeMutation` with project name `qgrid_voice`; no API was added. Voice lists are web constants: OpenAI's 10 realtime presets and the 28 Grok `/tts` voices (9 female, 19 male) listed for the subscription token on 2026-11-06; the server still validates them. Instructions and the STT prompt are shown only for `openai/` models; in their place Grok TTS shows a Speed slider (0.7-1.5 in 0.05 steps, 2.18.0+), sent as `speed` only when it is not 1, and the history row title carries the speed. STT sends no `language`: a 2026-11-09 run (6 OpenAI STT models × auto/en/ko × 6 synthetic learner clips) found `en` no better than auto and `ko` translating English audio into Korean on gpt-4o-transcribe and whisper-1. The STT model list
|
|
69
|
+
Voice playground (2.15.5+): the sidebar's Playground section links `/voice`, a dashboard-only test page with Text to speech and Speech to text panels that call the generated `QgridService.useSpeakMutation` / `useTranscribeMutation` with project name `qgrid_voice`; no API was added. Voice lists are web constants: OpenAI's 10 realtime presets and the 28 Grok `/tts` voices (9 female, 19 male) listed for the subscription token on 2026-11-06; the server still validates them. Instructions and the STT prompt are shown only for `openai/` models; in their place Grok TTS shows a Speed slider (0.7-1.5 in 0.05 steps, 2.18.0+), sent as `speed` only when it is not 1, and the history row title carries the speed. STT sends no `language`: a 2026-11-09 run (6 OpenAI STT models × auto/en/ko × 6 synthetic learner clips) found `en` no better than auto and `ko` translating English audio into Korean on gpt-4o-transcribe and whisper-1. The STT model list (2.20.0+, SON-593) is `openai/gpt-transcribe` (replacing `gpt-4o-transcribe`, which shuts down 2027-02-26) and `grok/grok-voice-transcribe-2.0`; the server still accepts the other ids. The page is one card with Text to speech / Speech to text tabs; both panels stay mounted (the inactive one is hidden) so form state and history survive tab switches. Each result is prepended to an in-memory history row (removable, lost on reload) with a request-log link that opens in a new tab so the history is kept. TTS voices are chips (Grok split Female/Male) above the text: a name selects the voice, and ▶ plays a bundled sample from `packages/web/public/voice-samples/{openai,grok}/<voice>.mp3` without a request (and selects it; pressing again stops). Each of the 38 samples introduces itself ("I'm <Voice>. Nice to meet you. How's it going?"), regenerated on 2026-11-09 through qgrid (`grok/grok-tts`, `openai/gpt-realtime-2.1-mini`) and checked with STT; re-encoded to 40 kbps mono MP3 (about 640 KB, shipped in the CLI bundle via `web-dist`). Do not trust the OpenAI speech self-transcript as a verbatim check: one ballad take carried an audible "Okay, let's read that line aloud exactly as written." preamble that two STT models heard while `response.output_audio_transcript.done` showed only the script. A voice added upstream needs a sample file or its ▶ fails to load. STT recordings and uploads are numbered clips so one clip run through several models reads as a comparison. A "Word timing" checkbox (default on, 2.17.0+) sends `withTimestamps`; TTS rows and STT rows with word timing (Grok, or OpenAI through the qgrid aligner, 2.19.0+) then render the clip with its words under the player (`TimedPlayer`), highlight the word being spoken (animation-frame polling with a `timeupdate` fallback when frames are throttled), and show the timing source (Grok TTS, qgrid aligner, or the failure). Clicking a word plays from its start. For OpenAI models, recordings (MediaRecorder webm/opus) and uploads are decoded with `AudioContext` at 24 kHz, mixed to mono, and sent as PCM16 WAV (`voice-audio.ts`), because the OpenAI transcription route accepts only WAV or raw PCM; Grok gets the original file (2.19.0+), which keeps a compressed upload far under the 19 MiB inline limit. Results link to their request log. Each panel (TTS, STT, Live Conversation) shows, beside it from 1280 px (below it when narrower), the `@cartanova/qgrid-ai-sdk` call for its current settings: its imports and the call (`generateSpeech`, `transcribe`, `experimental_useRealtime` plus the server `doCreateWebRTCSession`), in a separate card with a gap like the request log's columns (`voice-sdk-examples.ts`). The card is `CodePanel` (`components/qgrid/CodePanel.tsx`: dark highlighted block and copy button), which the request log's Response Type card (`ResponseTypeSection`) also uses; its highlighter covers server type/zod text and these examples (comments, `import`/`from`/`const`/`await` and `satisfies`, unless used as a property name).
|
|
70
70
|
|
|
71
71
|
Tool contract visibility: the detail page renders a Tools panel between Response Type and Steps for requests whose `tools` is non-empty. It starts collapsed and its header shows the tool count plus a responsive, truncated name list built from the detail subset — collapsed views issue no extra query. Expanding fires `toolsView` once and caches it for that request id, since a stored tool contract never changes. Each card shows the name, the full description, the parameter count, and a compact display-only zod shape; enum values past the sixth collapse to `/* +N */`, with the full shape reachable through hover and keyboard focus. All JSON Schema conversion happens server-side — the web renders completed strings and holds no schema logic.
|
|
72
72
|
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,r as n}from"./vendor-react-8xo7RSum.js";var r=e(t(),1),i=n();function a({src:e,words:t,autoPlay:n,className:a=`h-8 w-full`}){let o=(0,r.useRef)(null),s=(0,r.useRef)(0),[c,l]=(0,r.useState)(-1),u=()=>{l(o.current?.currentTime??-1),s.current=requestAnimationFrame(u)},d=()=>cancelAnimationFrame(s.current);return(0,r.useEffect)(()=>()=>cancelAnimationFrame(s.current),[]),(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(`audio`,{ref:o,controls:!0,autoPlay:n,src:e,className:a,onPlay:()=>{d(),u()},onPause:d,onTimeUpdate:e=>l(e.currentTarget.currentTime),onEnded:()=>{d(),l(-1)}}),t&&t.length>0&&(0,i.jsx)(`p`,{className:`flex flex-wrap gap-x-0.5 gap-y-1 text-[13px] leading-relaxed`,children:t.map((e,t)=>(0,i.jsx)(`button`,{type:`button`,onClick:()=>{let t=o.current;t&&(t.currentTime=e.start,l(e.start),t.play())},title:`${e.start.toFixed(2)}–${e.end.toFixed(2)}s · play from here`,className:`rounded px-1 transition-colors duration-75 ${c>=e.start&&c<e.end?`bg-sienna-500 text-white`:`text-sand-700 hover:bg-sand-100`}`,children:e.text},t))})]})}export{a as t};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,r as n}from"./vendor-react-8xo7RSum.js";import{_ as r,u as i}from"./vendor-tanstack-DMgmqjm4.js";import{E as a,S as o,T as s,_ as c,b as l,c as u,f as d,g as f,h as p,l as m,t as h,v as g,x as _,y as v}from"./index-BeceW0U9.js";import{n as y,t as b}from"./cost-CZzlCFS2.js";import{n as x,t as S}from"./request-model-Dl31cZdf.js";import{t as C}from"./TimedPlayer-cuEgYA3Q.js";function w(){return w=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},w.apply(null,arguments)}function T(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var E=e(t()),D=n(),ee={},te=(0,E.createContext)(ee),ne=(e,t)=>w({},e,t),re=()=>(0,E.useContext)(te),O=(0,E.createContext)(()=>{});O.displayName=`JVR.DispatchShowTools`;function ie(){return(0,E.useReducer)(ne,ee)}function ae(){return(0,E.useContext)(O)}var oe=e=>{var{initial:t,dispatch:n,children:r}=e;return(0,D.jsx)(te.Provider,{value:t,children:(0,D.jsx)(O.Provider,{value:n,children:r})})};oe.displayName=`JVR.ShowTools`;var se={},ce=(0,E.createContext)(se),le=(e,t)=>w({},e,t),k=()=>(0,E.useContext)(ce),ue=(0,E.createContext)(()=>{});ue.displayName=`JVR.DispatchExpands`;function de(){return(0,E.useReducer)(le,se)}function fe(){return(0,E.useContext)(ue)}var pe=e=>{var{initial:t,dispatch:n,children:r}=e;return(0,D.jsx)(ce.Provider,{value:t,children:(0,D.jsx)(ue.Provider,{value:n,children:r})})};pe.displayName=`JVR.Expands`;var me={Str:{as:`span`,"data-type":`string`,style:{color:`var(--w-rjv-type-string-color, #cb4b16)`},className:`w-rjv-type`,children:`string`},Url:{as:`a`,style:{color:`var(--w-rjv-type-url-color, #0969da)`},"data-type":`url`,className:`w-rjv-type`,children:`url`},Undefined:{style:{color:`var(--w-rjv-type-undefined-color, #586e75)`},as:`span`,"data-type":`undefined`,className:`w-rjv-type`,children:`undefined`},Null:{style:{color:`var(--w-rjv-type-null-color, #d33682)`},as:`span`,"data-type":`null`,className:`w-rjv-type`,children:`null`},Map:{style:{color:`var(--w-rjv-type-map-color, #268bd2)`,marginRight:3},as:`span`,"data-type":`map`,className:`w-rjv-type`,children:`Map`},Nan:{style:{color:`var(--w-rjv-type-nan-color, #859900)`},as:`span`,"data-type":`nan`,className:`w-rjv-type`,children:`NaN`},Bigint:{style:{color:`var(--w-rjv-type-bigint-color, #268bd2)`},as:`span`,"data-type":`bigint`,className:`w-rjv-type`,children:`bigint`},Int:{style:{color:`var(--w-rjv-type-int-color, #268bd2)`},as:`span`,"data-type":`int`,className:`w-rjv-type`,children:`int`},Set:{style:{color:`var(--w-rjv-type-set-color, #268bd2)`,marginRight:3},as:`span`,"data-type":`set`,className:`w-rjv-type`,children:`Set`},Float:{style:{color:`var(--w-rjv-type-float-color, #859900)`},as:`span`,"data-type":`float`,className:`w-rjv-type`,children:`float`},True:{style:{color:`var(--w-rjv-type-boolean-color, #2aa198)`},as:`span`,"data-type":`bool`,className:`w-rjv-type`,children:`bool`},False:{style:{color:`var(--w-rjv-type-boolean-color, #2aa198)`},as:`span`,"data-type":`bool`,className:`w-rjv-type`,children:`bool`},Date:{style:{color:`var(--w-rjv-type-date-color, #268bd2)`},as:`span`,"data-type":`date`,className:`w-rjv-type`,children:`date`}},he=(0,E.createContext)(me),ge=(e,t)=>w({},e,t),A=()=>(0,E.useContext)(he),_e=(0,E.createContext)(()=>{});_e.displayName=`JVR.DispatchTypes`;function ve(){return(0,E.useReducer)(ge,me)}function ye(){return(0,E.useContext)(_e)}function be(e){var{initial:t,dispatch:n,children:r}=e;return(0,D.jsx)(he.Provider,{value:t,children:(0,D.jsx)(_e.Provider,{value:n,children:r})})}be.displayName=`JVR.Types`;var xe=[`style`];function Se(e){var{style:t}=e,n=T(e,xe),r=w({cursor:`pointer`,height:`1em`,width:`1em`,userSelect:`none`,display:`inline-flex`},t);return(0,D.jsx)(`svg`,w({viewBox:`0 0 24 24`,fill:`var(--w-rjv-arrow-color, currentColor)`,style:r},n,{children:(0,D.jsx)(`path`,{d:`M16.59 8.59 12 13.17 7.41 8.59 6 10l6 6 6-6z`})}))}Se.displayName=`JVR.TriangleArrow`;var Ce={Arrow:{as:`span`,className:`w-rjv-arrow`,style:{transform:`rotate(0deg)`,transition:`all 0.3s`},children:(0,D.jsx)(Se,{})},Colon:{as:`span`,style:{color:`var(--w-rjv-colon-color, var(--w-rjv-color))`,marginLeft:0,marginRight:2},className:`w-rjv-colon`,children:`:`},Quote:{as:`span`,style:{color:`var(--w-rjv-quotes-color, #236a7c)`},className:`w-rjv-quotes`,children:`"`},ValueQuote:{as:`span`,style:{color:`var(--w-rjv-quotes-string-color, #cb4b16)`},className:`w-rjv-quotes`,children:`"`},BracketsLeft:{as:`span`,style:{color:`var(--w-rjv-brackets-color, #236a7c)`},className:`w-rjv-brackets-start`,children:`[`},BracketsRight:{as:`span`,style:{color:`var(--w-rjv-brackets-color, #236a7c)`},className:`w-rjv-brackets-end`,children:`]`},BraceLeft:{as:`span`,style:{color:`var(--w-rjv-curlybraces-color, #236a7c)`},className:`w-rjv-curlybraces-start`,children:`{`},BraceRight:{as:`span`,style:{color:`var(--w-rjv-curlybraces-color, #236a7c)`},className:`w-rjv-curlybraces-end`,children:`}`}},we=(0,E.createContext)(Ce),Te=(e,t)=>w({},e,t),j=()=>(0,E.useContext)(we),Ee=(0,E.createContext)(()=>{});Ee.displayName=`JVR.DispatchSymbols`;function De(){return(0,E.useReducer)(Te,Ce)}function Oe(){return(0,E.useContext)(Ee)}var ke=e=>{var{initial:t,dispatch:n,children:r}=e;return(0,D.jsx)(we.Provider,{value:t,children:(0,D.jsx)(Ee.Provider,{value:n,children:r})})};ke.displayName=`JVR.Symbols`;var Ae={Copied:{className:`w-rjv-copied`,style:{height:`1em`,width:`1em`,cursor:`pointer`,verticalAlign:`middle`,marginLeft:5}},CountInfo:{as:`span`,className:`w-rjv-object-size`,style:{color:`var(--w-rjv-info-color, #0000004d)`,paddingLeft:8,fontStyle:`italic`}},CountInfoExtra:{as:`span`,className:`w-rjv-object-extra`,style:{paddingLeft:8}},Ellipsis:{as:`span`,style:{cursor:`pointer`,color:`var(--w-rjv-ellipsis-color, #cb4b16)`,userSelect:`none`},className:`w-rjv-ellipsis`,children:`...`},Row:{as:`div`,className:`w-rjv-line`},KeyName:{as:`span`,className:`w-rjv-object-key`}},je=(0,E.createContext)(Ae),Me=(e,t)=>w({},e,t),M=()=>(0,E.useContext)(je),N=(0,E.createContext)(()=>{});N.displayName=`JVR.DispatchSection`;function Ne(){return(0,E.useReducer)(Me,Ae)}function Pe(){return(0,E.useContext)(N)}var Fe=e=>{var{initial:t,dispatch:n,children:r}=e;return(0,D.jsx)(je.Provider,{value:t,children:(0,D.jsx)(N.Provider,{value:n,children:r})})};Fe.displayName=`JVR.Section`;var Ie={objectSortKeys:!1,indentWidth:15},P=(0,E.createContext)(Ie);P.displayName=`JVR.Context`;var Le=(0,E.createContext)(()=>{});Le.displayName=`JVR.DispatchContext`;function Re(e,t){return w({},e,t)}var F=()=>(0,E.useContext)(P),ze=e=>{var{children:t,initialState:n,initialTypes:r}=e,[i,a]=(0,E.useReducer)(Re,Object.assign({},Ie,n)),[o,s]=ie(),[c,l]=de(),[u,d]=ve(),[f,p]=De(),[m,h]=Ne();return(0,E.useEffect)(()=>a(w({},n)),[n]),(0,D.jsx)(P.Provider,{value:i,children:(0,D.jsx)(Le.Provider,{value:a,children:(0,D.jsx)(oe,{initial:o,dispatch:s,children:(0,D.jsx)(pe,{initial:c,dispatch:l,children:(0,D.jsx)(be,{initial:w({},u,r),dispatch:d,children:(0,D.jsx)(ke,{initial:f,dispatch:p,children:(0,D.jsx)(Fe,{initial:m,dispatch:h,children:t})})})})})})})};ze.displayName=`JVR.Provider`;function Be(e){if(e==null)throw TypeError(`Cannot destructure `+e)}var Ve=[`isNumber`,`value`,`parentValue`,`keyName`,`keys`],He=[`as`,`render`],Ue=[`as`,`render`],We=[`as`,`render`],Ge=[`as`,`style`,`render`],Ke=[`as`,`render`],qe=[`as`,`render`],Je=[`as`,`render`],Ye=[`as`,`render`],I=e=>{var{Quote:t={}}=j(),{isNumber:n,value:r,parentValue:i,keyName:a,keys:o}=e,s=T(e,Ve);if(n)return null;var{as:c,render:l}=t,u=T(t,He),d=c||`span`,f=w({},s,u);return typeof f.children==`string`&&(f.children=f.children.trim()||void 0),l&&typeof l==`function`&&l(f,{value:r,parentValue:i,keyName:a,keys:o||(a?[a]:[])})||(0,D.jsx)(d,w({},f))};I.displayName=`JVR.Quote`;var L=e=>{var{ValueQuote:t={}}=j(),n=w({},(Be(e),e)),{as:r,render:i}=t,a=T(t,Ue),o=r||`span`,s=w({},n,a);return i&&typeof i==`function`&&i(s,{})||(0,D.jsx)(o,w({},s))};L.displayName=`JVR.ValueQuote`;var Xe=e=>{var{value:t,parentValue:n,keyName:r,keys:i}=e,{Colon:a={}}=j(),{as:o,render:s}=a,c=T(a,We),l=o||`span`;return s&&typeof s==`function`&&s(c,{value:t,parentValue:n,keyName:r,keys:i||(r?[r]:[])})||(0,D.jsx)(l,w({},c))};Xe.displayName=`JVR.Colon`;var Ze=e=>{var{Arrow:t={}}=j(),n=k(),{expandKey:r,style:i,value:a,parentValue:o,keyName:s,keys:c}=e,l=!!n[r],{as:u,style:d,render:f}=t,p=T(t,Ge),m=u||`span`,h=f&&typeof f==`function`,g=w({},p,{"data-expanded":l,style:w({},d,i)});return h&&f(g,{value:a,parentValue:o,keyName:s,keys:c||(s?[s]:[])})||(0,D.jsx)(m,w({},p,{style:w({},d,i)}))};Ze.displayName=`JVR.Arrow`;var Qe=e=>{var{isBrackets:t,value:n,parentValue:r,keyName:i,keys:a}=e,{BracketsLeft:o={},BraceLeft:s={}}=j(),c={value:n,parentValue:r,keyName:i,keys:a||(i?[i]:[])};if(t){var{as:l,render:u}=o,d=T(o,Ke),f=l||`span`;return u&&typeof u==`function`&&u(d,c)||(0,D.jsx)(f,w({},d))}var{as:p,render:m}=s,h=T(s,qe),g=p||`span`;return m&&typeof m==`function`&&m(h,c)||(0,D.jsx)(g,w({},h))};Qe.displayName=`JVR.BracketsOpen`;var R=e=>{var{isBrackets:t,isVisiable:n,value:r,parentValue:i,keyName:a,keys:o}=e,s={value:r,parentValue:i,keyName:a,keys:o||(a?[a]:[])};if(!n)return null;var{BracketsRight:c={},BraceRight:l={}}=j();if(t){var{as:u,render:d}=c,f=T(c,Je),p=u||`span`;return d&&typeof d==`function`&&d(f,s)||(0,D.jsx)(p,w({},f))}var{as:m,render:h}=l,g=T(l,Ye),_=m||`span`;return h&&typeof h==`function`&&h(g,s)||(0,D.jsx)(_,w({},g))};R.displayName=`JVR.BracketsClose`;var $e=e=>{var{keyName:t,value:n,expandKey:r,parentValue:i,level:a,keys:o=[]}=e,s=k(),{collapsed:c,shouldExpandNodeInitially:l}=F(),u=typeof c==`boolean`?c:typeof c==`number`&&a>c,d=s[r]??(!l&&u),f=l&&l(!d,{value:n,keys:o,level:a,keyName:t,parentValue:i});if(l&&c===!1){if(s[r]===void 0&&!f)return null}else if(s[r]===void 0&&f)return null;var p=Object.keys(n).length;if(d||p===0)return null;var m={paddingLeft:4},h={keyName:t,value:n,keys:o,parentValue:i},g=Array.isArray(n),_=n instanceof Set;return(0,D.jsx)(`div`,{style:m,children:(0,D.jsx)(R,w({isBrackets:g||_},h,{isVisiable:!0}))})};$e.displayName=`JVR.NestedClose`;var et=[`as`,`render`],tt=[`as`,`render`],nt=[`as`,`render`],rt=[`as`,`render`],it=[`as`,`render`],at=[`as`,`render`],ot=[`as`,`render`],st=[`as`,`render`],ct=[`as`,`render`],lt=[`as`,`render`],ut=[`as`,`render`],dt=[`as`,`render`],ft=[`as`,`render`],z=e=>{if(e===void 0)return`0n`;if(typeof e==`string`)try{e=BigInt(e)}catch{return`0n`}return e?e.toString()+`n`:`0n`},pt=e=>{var{value:t,keyName:n}=e,{Set:r={},displayDataTypes:i}=A();if(!(t instanceof Set)||!i)return null;var{as:a,render:o}=r,s=T(r,et);return o&&typeof o==`function`&&o(s,{type:`type`,value:t,keyName:n})||(0,D.jsx)(a||`span`,w({},s))};pt.displayName=`JVR.SetComp`;var mt=e=>{var{value:t,keyName:n}=e,{Map:r={},displayDataTypes:i}=A();if(!(t instanceof Map)||!i)return null;var{as:a,render:o}=r,s=T(r,tt);return o&&typeof o==`function`&&o(s,{type:`type`,value:t,keyName:n})||(0,D.jsx)(a||`span`,w({},s))};mt.displayName=`JVR.MapComp`;var B={opacity:.75,paddingRight:4},ht=e=>{var{children:t=``,keyName:n,keys:r}=e,{Str:i={},displayDataTypes:a}=A(),{shortenTextAfterLength:o=30,stringEllipsis:s=`...`}=F(),{as:c,render:l}=i,u=T(i,nt),d=t,[f,p]=(0,E.useState)(o&&d.length>o);(0,E.useEffect)(()=>p(o&&d.length>o),[o]);var m=c||`span`,h=w({},B,i.style||{});o>0&&(u.style=w({},u.style,{cursor:d.length<=o?`initial`:`pointer`}),d.length>o&&(u.onClick=()=>{p(!f)}));var g=f?``+d.slice(0,o)+s:d,_=l&&typeof l==`function`,v=_&&l(w({},u,{style:h}),{type:`type`,value:t,keyName:n,keys:r}),y=f?`w-rjv-value w-rjv-value-short`:`w-rjv-value`,b=_&&l(w({},u,{children:g,className:y}),{type:`value`,value:t,keyName:n,keys:r});return(0,D.jsxs)(E.Fragment,{children:[a&&(v||(0,D.jsx)(m,w({},u,{style:h}))),b||(0,D.jsxs)(E.Fragment,{children:[(0,D.jsx)(L,{}),(0,D.jsx)(m,w({},u,{className:y,children:g})),(0,D.jsx)(L,{})]})]})};ht.displayName=`JVR.TypeString`;var gt=e=>{var{children:t,keyName:n,keys:r}=e,{True:i={},displayDataTypes:a}=A(),{as:o,render:s}=i,c=T(i,rt),l=o||`span`,u=w({},B,i.style||{}),d=s&&typeof s==`function`,f=d&&s(w({},c,{style:u}),{type:`type`,value:t,keyName:n,keys:r}),p=d&&s(w({},c,{children:t,className:`w-rjv-value`}),{type:`value`,value:t,keyName:n,keys:r});return(0,D.jsxs)(E.Fragment,{children:[a&&(f||(0,D.jsx)(l,w({},c,{style:u}))),p||(0,D.jsx)(l,w({},c,{className:`w-rjv-value`,children:t?.toString()}))]})};gt.displayName=`JVR.TypeTrue`;var _t=e=>{var{children:t,keyName:n,keys:r}=e,{False:i={},displayDataTypes:a}=A(),{as:o,render:s}=i,c=T(i,it),l=o||`span`,u=w({},B,i.style||{}),d=s&&typeof s==`function`,f=d&&s(w({},c,{style:u}),{type:`type`,value:t,keyName:n,keys:r}),p=d&&s(w({},c,{children:t,className:`w-rjv-value`}),{type:`value`,value:t,keyName:n,keys:r});return(0,D.jsxs)(E.Fragment,{children:[a&&(f||(0,D.jsx)(l,w({},c,{style:u}))),p||(0,D.jsx)(l,w({},c,{className:`w-rjv-value`,children:t?.toString()}))]})};_t.displayName=`JVR.TypeFalse`;var vt=e=>{var{children:t,keyName:n,keys:r}=e,{Float:i={},displayDataTypes:a}=A(),{as:o,render:s}=i,c=T(i,at),l=o||`span`,u=w({},B,i.style||{}),d=s&&typeof s==`function`,f=d&&s(w({},c,{style:u}),{type:`type`,value:t,keyName:n,keys:r}),p=d&&s(w({},c,{children:t,className:`w-rjv-value`}),{type:`value`,value:t,keyName:n,keys:r});return(0,D.jsxs)(E.Fragment,{children:[a&&(f||(0,D.jsx)(l,w({},c,{style:u}))),p||(0,D.jsx)(l,w({},c,{className:`w-rjv-value`,children:t?.toString()}))]})};vt.displayName=`JVR.TypeFloat`;var yt=e=>{var{children:t,keyName:n,keys:r}=e,{Int:i={},displayDataTypes:a}=A(),{as:o,render:s}=i,c=T(i,ot),l=o||`span`,u=w({},B,i.style||{}),d=s&&typeof s==`function`,f=d&&s(w({},c,{style:u}),{type:`type`,value:t,keyName:n,keys:r}),p=d&&s(w({},c,{children:t,className:`w-rjv-value`}),{type:`value`,value:t,keyName:n,keys:r});return(0,D.jsxs)(E.Fragment,{children:[a&&(f||(0,D.jsx)(l,w({},c,{style:u}))),p||(0,D.jsx)(l,w({},c,{className:`w-rjv-value`,children:t?.toString()}))]})};yt.displayName=`JVR.TypeInt`;var bt=e=>{var{children:t,keyName:n,keys:r}=e,{Bigint:i={},displayDataTypes:a}=A(),{as:o,render:s}=i,c=T(i,st),l=o||`span`,u=w({},B,i.style||{}),d=s&&typeof s==`function`,f=d&&s(w({},c,{style:u}),{type:`type`,value:t,keyName:n,keys:r}),p=d&&s(w({},c,{children:t,className:`w-rjv-value`}),{type:`value`,value:t,keyName:n,keys:r});return(0,D.jsxs)(E.Fragment,{children:[a&&(f||(0,D.jsx)(l,w({},c,{style:u}))),p||(0,D.jsx)(l,w({},c,{className:`w-rjv-value`,children:z(t?.toString())}))]})};bt.displayName=`JVR.TypeFloat`;var xt=e=>{var{children:t,keyName:n,keys:r}=e,{Url:i={},displayDataTypes:a}=A(),{as:o,render:s}=i,c=T(i,ct),l=o||`span`,u=w({},B,i.style),d=s&&typeof s==`function`,f=d&&s(w({},c,{style:u}),{type:`type`,value:t,keyName:n,keys:r}),p=d&&s(w({},c,{children:t?.href,className:`w-rjv-value`}),{type:`value`,value:t,keyName:n,keys:r});return(0,D.jsxs)(E.Fragment,{children:[a&&(f||(0,D.jsx)(l,w({},c,{style:u}))),p||(0,D.jsxs)(`a`,w({href:t?.href,target:`_blank`},c,{className:`w-rjv-value`,children:[(0,D.jsx)(L,{}),t?.href,(0,D.jsx)(L,{})]}))]})};xt.displayName=`JVR.TypeUrl`;var St=e=>{var{children:t,keyName:n,keys:r}=e,{Date:i={},displayDataTypes:a}=A(),{as:o,render:s}=i,c=T(i,lt),l=o||`span`,u=w({},B,i.style||{}),d=s&&typeof s==`function`,f=d&&s(w({},c,{style:u}),{type:`type`,value:t,keyName:n,keys:r}),p=t instanceof Date?t.toLocaleString():t,m=d&&s(w({},c,{children:p,className:`w-rjv-value`}),{type:`value`,value:t,keyName:n,keys:r});return(0,D.jsxs)(E.Fragment,{children:[a&&(f||(0,D.jsx)(l,w({},c,{style:u}))),m||(0,D.jsx)(l,w({},c,{className:`w-rjv-value`,children:p}))]})};St.displayName=`JVR.TypeDate`;var Ct=e=>{var{children:t,keyName:n,keys:r}=e,{Undefined:i={},displayDataTypes:a}=A(),{as:o,render:s}=i,c=T(i,ut),l=o||`span`,u=w({},B,i.style||{}),d=s&&typeof s==`function`,f=d&&s(w({},c,{style:u}),{type:`type`,value:t,keyName:n,keys:r}),p=d&&s(w({},c,{children:t,className:`w-rjv-value`}),{type:`value`,value:t,keyName:n,keys:r});return(0,D.jsxs)(E.Fragment,{children:[a&&(f||(0,D.jsx)(l,w({},c,{style:u}))),p]})};Ct.displayName=`JVR.TypeUndefined`;var wt=e=>{var{children:t,keyName:n,keys:r}=e,{Null:i={},displayDataTypes:a}=A(),{as:o,render:s}=i,c=T(i,dt),l=o||`span`,u=w({},B,i.style||{}),d=s&&typeof s==`function`,f=d&&s(w({},c,{style:u}),{type:`type`,value:t,keyName:n,keys:r}),p=d&&s(w({},c,{children:t,className:`w-rjv-value`}),{type:`value`,value:t,keyName:n,keys:r});return(0,D.jsxs)(E.Fragment,{children:[a&&(f||(0,D.jsx)(l,w({},c,{style:u}))),p]})};wt.displayName=`JVR.TypeNull`;var Tt=e=>{var{children:t,keyName:n,keys:r}=e,{Nan:i={},displayDataTypes:a}=A(),{as:o,render:s}=i,c=T(i,ft),l=o||`span`,u=w({},B,i.style||{}),d=s&&typeof s==`function`,f=d&&s(w({},c,{style:u}),{type:`type`,value:t,keyName:n,keys:r}),p=d&&s(w({},c,{children:t?.toString(),className:`w-rjv-value`}),{type:`value`,value:t,keyName:n,keys:r});return(0,D.jsxs)(E.Fragment,{children:[a&&(f||(0,D.jsx)(l,w({},c,{style:u}))),p]})};Tt.displayName=`JVR.TypeNan`;var Et=e=>Number(e)===e&&e%1!=0||isNaN(e),Dt=e=>{var{value:t,keyName:n,keys:r}=e,i={keyName:n,keys:r};return t instanceof URL?(0,D.jsx)(xt,w({},i,{children:t})):typeof t==`string`?(0,D.jsx)(ht,w({},i,{children:t})):t===!0?(0,D.jsx)(gt,w({},i,{children:t})):t===!1?(0,D.jsx)(_t,w({},i,{children:t})):t===null?(0,D.jsx)(wt,w({},i,{children:t})):t===void 0?(0,D.jsx)(Ct,w({},i,{children:t})):t instanceof Date?(0,D.jsx)(St,w({},i,{children:t})):typeof t==`number`&&isNaN(t)?(0,D.jsx)(Tt,w({},i,{children:t})):typeof t==`number`&&Et(t)?(0,D.jsx)(vt,w({},i,{children:t})):typeof t==`bigint`?(0,D.jsx)(bt,w({},i,{children:t})):typeof t==`number`?(0,D.jsx)(yt,w({},i,{children:t})):null};Dt.displayName=`JVR.Value`;function V(e,t,n){var r=Oe(),i=[e.className,t.className].filter(Boolean).join(` `),a=w({},e,t,{className:i,style:w({},e.style,t.style),children:t.children||e.children});(0,E.useEffect)(()=>r({[n]:a}),[t])}function H(e,t,n){var r=ye(),i=[e.className,t.className].filter(Boolean).join(` `),a=w({},e,t,{className:i,style:w({},e.style,t.style),children:t.children||e.children});(0,E.useEffect)(()=>r({[n]:a}),[t])}function U(e,t,n){var r=Pe(),i=[e.className,t.className].filter(Boolean).join(` `),a=w({},e,t,{className:i,style:w({},e.style,t.style),children:t.children||e.children});(0,E.useEffect)(()=>r({[n]:a}),[t])}var Ot=[`as`,`render`],kt=e=>{var{KeyName:t={}}=M();return U(t,e,`KeyName`),null};kt.displayName=`JVR.KeyName`;var At=e=>{var{children:t,value:n,parentValue:r,keyName:i,keys:a}=e,o={color:typeof t==`number`?`var(--w-rjv-key-number, #268bd2)`:`var(--w-rjv-key-string, #002b36)`},{KeyName:s={}}=M(),{as:c,render:l}=s,u=T(s,Ot);u.style=w({},u.style,o);var d=c||`span`;return l&&typeof l==`function`&&l(w({},u,{children:t}),{value:n,parentValue:r,keyName:i,keys:a||(i?[i]:[])})||(0,D.jsx)(d,w({},u,{children:t}))};At.displayName=`JVR.KeyNameComp`;var jt=[`children`,`value`,`parentValue`,`keyName`,`keys`],Mt=[`as`,`render`,`children`],Nt=e=>{var{Row:t={}}=M();return U(t,e,`Row`),null};Nt.displayName=`JVR.Row`;var Pt=e=>{var{children:t,value:n,parentValue:r,keyName:i,keys:a}=e,o=T(e,jt),{Row:s={}}=M(),{as:c,render:l}=s,u=T(s,Mt),d=c||`div`;return l&&typeof l==`function`&&l(w({},o,u,{children:t}),{value:n,keyName:i,parentValue:r,keys:a})||(0,D.jsx)(d,w({},o,u,{children:t}))};Pt.displayName=`JVR.RowComp`;function Ft(e){var t=(0,E.useRef)();return(0,E.useEffect)(()=>{t.current=e}),t.current}function It(e){var{value:t,highlightUpdates:n,highlightContainer:r}=e,i=Ft(t),a=(0,E.useMemo)(()=>{if(!n||i===void 0)return!1;if(typeof t!=typeof i)return!0;if(typeof t==`number`)return isNaN(t)&&isNaN(i)?!1:t!==i;if(Array.isArray(t)!==Array.isArray(i))return!0;if(typeof t==`object`||typeof t==`function`)return!1;if(t!==i)return!0},[n,t]);(0,E.useEffect)(()=>{r&&r.current&&a&&`animate`in r.current&&r.current.animate([{backgroundColor:`var(--w-rjv-update-color, #ebcb8b)`},{backgroundColor:``}],{duration:1e3,easing:`ease-in`})},[a,t,r])}var Lt=[`keyName`,`value`,`parentValue`,`expandKey`,`keys`,`beforeCopy`],Rt=[`as`,`render`],zt=e=>{var{keyName:t,value:n,parentValue:r,expandKey:i,keys:a,beforeCopy:o}=e,s=T(e,Lt),{onCopied:c,enableClipboard:l,beforeCopy:u}=F(),d=re()[i],[f,p]=(0,E.useState)(!1),{Copied:m={}}=M(),h=m?.beforeCopy;if(l===!1||!d)return null;var g={style:{display:`inline-flex`},fill:f?`var(--w-rjv-copied-success-color, #28a745)`:`var(--w-rjv-copied-color, currentColor)`,onClick:e=>{e.stopPropagation();var s=``;s=typeof n==`number`&&n===1/0?`Infinity`:typeof n==`number`&&isNaN(n)?`NaN`:typeof n==`bigint`?z(n):n instanceof Date?n.toLocaleString():JSON.stringify(n,(e,t)=>typeof t==`bigint`?z(t):t,2);var l=o||h||u;l&&typeof l==`function`&&(s=l(s,t,n,r,i,a)),c&&c(s,n),p(!0),(navigator.clipboard||{writeText(e){return new Promise((t,n)=>{var r=document.createElement(`textarea`);r.style.position=`absolute`,r.style.opacity=`0`,r.style.left=`-99999999px`,r.value=e,document.body.appendChild(r),r.select(),document.execCommand(`copy`)?t():n(),r.remove()})}}).writeText(s).then(()=>{var e=setTimeout(()=>{p(!1),clearTimeout(e)},3e3)}).catch(e=>{})}},{render:_}=m,v=T(m,Rt),y=w({},v,s,g,{style:w({},v.style,s.style,g.style)});return _&&typeof _==`function`&&_(w({},y,{"data-copied":f}),{value:n,keyName:t,keys:a,parentValue:r})||(f?(0,D.jsx)(`svg`,w({viewBox:`0 0 32 36`},y,{children:(0,D.jsx)(`path`,{d:`M27.5,33 L2.5,33 L2.5,12.5 L27.5,12.5 L27.5,15.2249049 C29.1403264,13.8627542 29.9736597,13.1778155 30,13.1700887 C30,11.9705278 30,10.0804982 30,7.5 C30,6.1 28.9,5 27.5,5 L20,5 C20,2.2 17.8,0 15,0 C12.2,0 10,2.2 10,5 L2.5,5 C1.1,5 0,6.1 0,7.5 L0,33 C0,34.4 1.1,36 2.5,36 L27.5,36 C28.9,36 30,34.4 30,33 L30,26.1114493 L27.5,28.4926435 L27.5,33 Z M7.5,7.5 L10,7.5 C10,7.5 12.5,6.4 12.5,5 C12.5,3.6 13.6,2.5 15,2.5 C16.4,2.5 17.5,3.6 17.5,5 C17.5,6.4 18.8,7.5 20,7.5 L22.5,7.5 C22.5,7.5 25,8.6 25,10 L5,10 C5,8.5 6.1,7.5 7.5,7.5 Z M5,27.5 L10,27.5 L10,25 L5,25 L5,27.5 Z M28.5589286,16 L32,19.6 L21.0160714,30.5382252 L13.5303571,24.2571429 L17.1303571,20.6571429 L21.0160714,24.5428571 L28.5589286,16 Z M17.5,15 L5,15 L5,17.5 L17.5,17.5 L17.5,15 Z M10,20 L5,20 L5,22.5 L10,22.5 L10,20 Z`})})):(0,D.jsx)(`svg`,w({viewBox:`0 0 32 36`},y,{children:(0,D.jsx)(`path`,{d:`M27.5,33 L2.5,33 L2.5,12.5 L27.5,12.5 L27.5,20 L30,20 L30,7.5 C30,6.1 28.9,5 27.5,5 L20,5 C20,2.2 17.8,0 15,0 C12.2,0 10,2.2 10,5 L2.5,5 C1.1,5 0,6.1 0,7.5 L0,33 C0,34.4 1.1,36 2.5,36 L27.5,36 C28.9,36 30,34.4 30,33 L30,29 L27.5,29 L27.5,33 Z M7.5,7.5 L10,7.5 C10,7.5 12.5,6.4 12.5,5 C12.5,3.6 13.6,2.5 15,2.5 C16.4,2.5 17.5,3.6 17.5,5 C17.5,6.4 18.8,7.5 20,7.5 L22.5,7.5 C22.5,7.5 25,8.6 25,10 L5,10 C5,8.5 6.1,7.5 7.5,7.5 Z M5,27.5 L10,27.5 L10,25 L5,25 L5,27.5 Z M22.5,21.5 L22.5,16.5 L12.5,24 L22.5,31.5 L22.5,26.5 L32,26.5 L32,21.5 L22.5,21.5 Z M17.5,15 L5,15 L5,17.5 L17.5,17.5 L17.5,15 Z M10,20 L5,20 L5,22.5 L10,22.5 L10,20 Z`})})))};zt.displayName=`JVR.Copied`;function Bt(){var e=(0,E.useRef)(null);return e.current===null&&(e.current=`custom-id-`+Math.random().toString(36).substr(2,9)),e.current}var Vt=e=>{var{keyName:t,value:n,expandKey:r=``,level:i,keys:a=[],parentValue:o}=e,s=k(),{objectSortKeys:c,indentWidth:l,collapsed:u,shouldExpandNodeInitially:d}=F(),f=typeof u==`boolean`?u:typeof u==`number`&&i>u,p=s[r]??(!d&&f),m=d&&d(!p,{value:n,keys:a,level:i,keyName:t,parentValue:o});if(d&&u===!1){if(s[r]===void 0&&!m)return null}else if(s[r]===void 0&&m)return null;if(p)return null;var h=Array.isArray(n)?Object.entries(n).map(e=>[Number(e[0]),e[1]]):Object.entries(n);return c&&(h=c===!0?h.sort((e,t)=>{var[n]=e,[r]=t;return typeof n==`string`&&typeof r==`string`?n.localeCompare(r):0}):h.sort((e,t)=>{var[n,r]=e,[i,a]=t;return typeof n==`string`&&typeof i==`string`?c(n,i,r,a):0})),(0,D.jsx)(`div`,{className:`w-rjv-wrap`,style:{borderLeft:`var(--w-rjv-border-left-width, 1px) var(--w-rjv-line-style, solid) var(--w-rjv-line-color, #ebebeb)`,paddingLeft:l,marginLeft:6},children:h.map((e,t)=>{var[r,o]=e;return(0,D.jsx)(Ut,{parentValue:n,keyName:r,keys:[...a,r],value:o,level:i},t)})})};Vt.displayName=`JVR.KeyValues`;var Ht=e=>{var{keyName:t,parentValue:n,keys:r,value:i}=e,{highlightUpdates:a}=F(),o=typeof t==`number`,s=(0,E.useRef)(null);It({value:i,highlightUpdates:a,highlightContainer:s});var c={keyName:t,value:i,keys:r,parentValue:n};return(0,D.jsxs)(E.Fragment,{children:[(0,D.jsxs)(`span`,{ref:s,children:[(0,D.jsx)(I,w({isNumber:o,"data-placement":`left`},c)),(0,D.jsx)(At,w({},c,{children:t})),(0,D.jsx)(I,w({isNumber:o,"data-placement":`right`},c))]}),(0,D.jsx)(Xe,w({},c))]})};Ht.displayName=`JVR.KayName`;var Ut=e=>{var{keyName:t,value:n,parentValue:r,level:i=0,keys:a=[]}=e,o=ae(),s=Bt(),c=Array.isArray(n),l=n instanceof Set,u=n instanceof Map,d=n instanceof Date,f=n instanceof URL;if(n&&typeof n==`object`&&!c&&!l&&!u&&!d&&!f||c||l||u){var p=l?Array.from(n):u?Object.fromEntries(n):n;return(0,D.jsx)(rn,{keyName:t,value:p,parentValue:r,initialValue:n,keys:a,level:i+1})}return(0,D.jsxs)(Pt,w({className:`w-rjv-line`,value:n,keyName:t,keys:a,parentValue:r},{onMouseEnter:()=>o({[s]:!0}),onMouseLeave:()=>o({[s]:!1})},{children:[(0,D.jsx)(Ht,{keyName:t,value:n,keys:a,parentValue:r}),(0,D.jsx)(Dt,{keyName:t,value:n,keys:a}),(0,D.jsx)(zt,{keyName:t,value:n,keys:a,parentValue:r,expandKey:s})]}))};Ut.displayName=`JVR.KeyValuesItem`;var Wt=[`value`,`keyName`],Gt=[`as`,`render`],Kt=e=>{var{CountInfoExtra:t={}}=M();return U(t,e,`CountInfoExtra`),null};Kt.displayName=`JVR.CountInfoExtra`;var qt=e=>{var{value:t={},keyName:n}=e,r=T(e,Wt),{CountInfoExtra:i={}}=M(),{as:a,render:o}=i,s=T(i,Gt);if(!o&&!s.children)return null;var c=a||`span`,l=o&&typeof o==`function`,u=w({},s,r);return l&&o(u,{value:t,keyName:n})||(0,D.jsx)(c,w({},u))};qt.displayName=`JVR.CountInfoExtraComps`;var Jt=[`value`,`keyName`],Yt=[`as`,`render`],Xt=e=>{var{CountInfo:t={}}=M();return U(t,e,`CountInfo`),null};Xt.displayName=`JVR.CountInfo`;var Zt=e=>{var{value:t={},keyName:n}=e,r=T(e,Jt),{displayObjectSize:i}=F(),{CountInfo:a={}}=M();if(!i)return null;var{as:o,render:s}=a,c=T(a,Yt),l=o||`span`;c.style=w({},c.style,e.style);var u=Object.keys(t).length;c.children||=u+` item`+(u===1?``:`s`);var d=w({},c,r);return s&&typeof s==`function`&&s(w({},d,{"data-length":u}),{value:t,keyName:n})||(0,D.jsx)(l,w({},d))};Zt.displayName=`JVR.CountInfoComp`;var Qt=[`as`,`render`],$t=e=>{var{Ellipsis:t={}}=M();return U(t,e,`Ellipsis`),null};$t.displayName=`JVR.Ellipsis`;var en=e=>{var{isExpanded:t,value:n,keyName:r}=e,{Ellipsis:i={}}=M(),{as:a,render:o}=i,s=T(i,Qt),c=a||`span`;return o&&typeof o==`function`&&o(w({},s,{"data-expanded":t}),{value:n,keyName:r})||(!t||typeof n==`object`&&Object.keys(n).length==0?null:(0,D.jsx)(c,w({},s)))};en.displayName=`JVR.EllipsisComp`;var tn=e=>{var{keyName:t,expandKey:n,keys:r=[],initialValue:i,value:a,parentValue:o,level:s}=e,c=k(),l=fe(),{onExpand:u,collapsed:d,shouldExpandNodeInitially:f}=F(),p=typeof d==`boolean`?d:typeof d==`number`&&s>d,m=c[n]??(!f&&p),h=f&&f(!m,{value:a,keys:r,level:s,keyName:t,parentValue:o});c[n]===void 0&&f&&(m=!h);var g=()=>{var e={expand:!m,value:a,keyid:n,keyName:t};u&&u(e),l({[n]:e.expand})},_={display:`inline-flex`,alignItems:`center`},v={transform:`rotate(`+(m?`-90`:`0`)+`deg)`,transition:`all 0.3s`},y=Object.keys(a).length,b=typeof a==`object`,x=Array.isArray(a),S=a instanceof Set,C=y!==0&&(x||S||b),T={style:_};C&&(T.onClick=g);var E={keyName:t,value:a,keys:r,parentValue:o};return(0,D.jsxs)(`span`,w({},T,{children:[C&&(0,D.jsx)(Ze,w({style:v,expandKey:n},E)),(t||typeof t==`number`)&&(0,D.jsx)(Ht,w({},E)),(0,D.jsx)(pt,{value:i,keyName:t}),(0,D.jsx)(mt,{value:i,keyName:t}),(0,D.jsx)(Qe,w({isBrackets:x||S},E)),(0,D.jsx)(en,{keyName:t,value:a,isExpanded:m}),(0,D.jsx)(R,w({isVisiable:m||!C,isBrackets:x||S},E)),(0,D.jsx)(Zt,{value:a,keyName:t}),(0,D.jsx)(qt,{value:a,keyName:t}),(0,D.jsx)(zt,{keyName:t,value:a,expandKey:n,parentValue:o,keys:r})]}))};tn.displayName=`JVR.NestedOpen`;var nn=[`className`,`children`,`parentValue`,`keyid`,`level`,`value`,`initialValue`,`keys`,`keyName`],rn=(0,E.forwardRef)((e,t)=>{var{className:n=``,parentValue:r,level:i=1,value:a,initialValue:o,keys:s,keyName:c}=e,l=T(e,nn),u=ae(),d=Bt(),f=[n,`w-rjv-inner`].filter(Boolean).join(` `);return(0,D.jsxs)(`div`,w({className:f,ref:t},l,{onMouseEnter:()=>u({[d]:!0}),onMouseLeave:()=>u({[d]:!1})},{children:[(0,D.jsx)(tn,{expandKey:d,value:a,level:i,keys:s,parentValue:r,keyName:c,initialValue:o}),(0,D.jsx)(Vt,{expandKey:d,value:a,level:i,keys:s,parentValue:r,keyName:c}),(0,D.jsx)($e,{expandKey:d,value:a,level:i,keys:s,parentValue:r,keyName:c})]}))});rn.displayName=`JVR.Container`;var an=e=>{var{BraceLeft:t={}}=j();return V(t,e,`BraceLeft`),null};an.displayName=`JVR.BraceLeft`;var on=e=>{var{BraceRight:t={}}=j();return V(t,e,`BraceRight`),null};on.displayName=`JVR.BraceRight`;var sn=e=>{var{BracketsLeft:t={}}=j();return V(t,e,`BracketsLeft`),null};sn.displayName=`JVR.BracketsLeft`;var cn=e=>{var{BracketsRight:t={}}=j();return V(t,e,`BracketsRight`),null};cn.displayName=`JVR.BracketsRight`;var ln=e=>{var{Arrow:t={}}=j();return V(t,e,`Arrow`),null};ln.displayName=`JVR.Arrow`;var un=e=>{var{Colon:t={}}=j();return V(t,e,`Colon`),null};un.displayName=`JVR.Colon`;var dn=e=>{var{Quote:t={}}=j();return V(t,e,`Quote`),null};dn.displayName=`JVR.Quote`;var fn=e=>{var{ValueQuote:t={}}=j();return V(t,e,`ValueQuote`),null};fn.displayName=`JVR.ValueQuote`;var pn=e=>{var{Bigint:t={}}=A();return H(t,e,`Bigint`),null};pn.displayName=`JVR.Bigint`;var mn=e=>{var{Date:t={}}=A();return H(t,e,`Date`),null};mn.displayName=`JVR.Date`;var hn=e=>{var{False:t={}}=A();return H(t,e,`False`),null};hn.displayName=`JVR.False`;var gn=e=>{var{Float:t={}}=A();return H(t,e,`Float`),null};gn.displayName=`JVR.Float`;var _n=e=>{var{Int:t={}}=A();return H(t,e,`Int`),null};_n.displayName=`JVR.Int`;var vn=e=>{var{Map:t={}}=A();return H(t,e,`Map`),null};vn.displayName=`JVR.Map`;var yn=e=>{var{Nan:t={}}=A();return H(t,e,`Nan`),null};yn.displayName=`JVR.Nan`;var bn=e=>{var{Null:t={}}=A();return H(t,e,`Null`),null};bn.displayName=`JVR.Null`;var xn=e=>{var{Set:t={}}=A();return H(t,e,`Set`),null};xn.displayName=`JVR.Set`;var Sn=e=>{var{Str:t={}}=A();return H(t,e,`Str`),null};Sn.displayName=`JVR.StringText`;var Cn=e=>{var{True:t={}}=A();return H(t,e,`True`),null};Cn.displayName=`JVR.True`;var wn=e=>{var{Undefined:t={}}=A();return H(t,e,`Undefined`),null};wn.displayName=`JVR.Undefined`;var Tn=e=>{var{Url:t={}}=A();return H(t,e,`Url`),null};Tn.displayName=`JVR.Url`;var En=e=>{var{Copied:t={}}=M();return U(t,e,`Copied`),null};En.displayName=`JVR.Copied`;var Dn=[`className`,`style`,`value`,`children`,`collapsed`,`shouldExpandNodeInitially`,`indentWidth`,`displayObjectSize`,`shortenTextAfterLength`,`stringEllipsis`,`highlightUpdates`,`enableClipboard`,`displayDataTypes`,`objectSortKeys`,`onExpand`,`onCopied`,`beforeCopy`],W=(0,E.forwardRef)((e,t)=>{var{className:n=``,style:r,value:i,children:a,collapsed:o=!1,shouldExpandNodeInitially:s,indentWidth:c=15,displayObjectSize:l=!0,shortenTextAfterLength:u=30,stringEllipsis:d,highlightUpdates:f=!0,enableClipboard:p=!0,displayDataTypes:m=!0,objectSortKeys:h=!1,onExpand:g,onCopied:_,beforeCopy:v}=e,y=T(e,Dn),b=w({lineHeight:1.4,fontFamily:`var(--w-rjv-font-family, Menlo, monospace)`,color:`var(--w-rjv-color, #002b36)`,backgroundColor:`var(--w-rjv-background-color, #00000000)`,fontSize:13},r),x=[`w-json-view-container`,`w-rjv`,n].filter(Boolean).join(` `);return(0,D.jsxs)(ze,{initialState:{value:i,objectSortKeys:h,indentWidth:c,shouldExpandNodeInitially:o===!1?s:void 0,displayObjectSize:l,collapsed:o,enableClipboard:p,shortenTextAfterLength:u,stringEllipsis:d,highlightUpdates:f,onCopied:_,onExpand:g,beforeCopy:v},initialTypes:{displayDataTypes:m},children:[(0,D.jsx)(rn,w({value:i},y,{ref:t,className:x,style:b})),a]})});W.Bigint=pn,W.Date=mn,W.False=hn,W.Float=gn,W.Int=_n,W.Map=vn,W.Nan=yn,W.Null=bn,W.Set=xn,W.String=Sn,W.True=Cn,W.Undefined=wn,W.Url=Tn,W.ValueQuote=fn,W.Arrow=ln,W.Colon=un,W.Quote=dn,W.Ellipsis=$t,W.BraceLeft=an,W.BraceRight=on,W.BracketsLeft=sn,W.BracketsRight=cn,W.Copied=En,W.CountInfo=Xt,W.CountInfoExtra=Kt,W.KeyName=kt,W.Row=Nt,W.displayName=`JVR.JsonView`;var On={"--w-rjv-font-family":`monospace`,"--w-rjv-color":`#002b36`,"--w-rjv-key-string":`#002b36`,"--w-rjv-background-color":`#ffffff`,"--w-rjv-line-color":`#ebebeb`,"--w-rjv-arrow-color":`var(--w-rjv-color)`,"--w-rjv-edit-color":`var(--w-rjv-color)`,"--w-rjv-info-color":`#0000004d`,"--w-rjv-update-color":`#ebcb8b`,"--w-rjv-copied-color":`#002b36`,"--w-rjv-copied-success-color":`#28a745`,"--w-rjv-curlybraces-color":`#236a7c`,"--w-rjv-colon-color":`#002b36`,"--w-rjv-brackets-color":`#236a7c`,"--w-rjv-quotes-color":`var(--w-rjv-key-string)`,"--w-rjv-quotes-string-color":`var(--w-rjv-type-string-color)`,"--w-rjv-type-string-color":`#cb4b16`,"--w-rjv-type-int-color":`#268bd2`,"--w-rjv-type-float-color":`#859900`,"--w-rjv-type-bigint-color":`#268bd2`,"--w-rjv-type-boolean-color":`#2aa198`,"--w-rjv-type-date-color":`#586e75`,"--w-rjv-type-url-color":`#0969da`,"--w-rjv-type-null-color":`#d33682`,"--w-rjv-type-nan-color":`#859900`,"--w-rjv-type-undefined-color":`#586e75`},kn=(0,E.forwardRef)(({title:e,titleId:t,...n},r)=>(0,D.jsxs)(`svg`,{viewBox:`0 0 24 24`,width:`1.2em`,height:`1.2em`,ref:r,"aria-labelledby":t,...n,children:[e?(0,D.jsx)(`title`,{id:t,children:e}):null,(0,D.jsx)(`path`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`m12 19l-7-7l7-7m7 7H5`})]})),An=(0,E.forwardRef)(({title:e,titleId:t,...n},r)=>(0,D.jsxs)(`svg`,{viewBox:`0 0 24 24`,width:`1.2em`,height:`1.2em`,ref:r,"aria-labelledby":t,...n,children:[e?(0,D.jsx)(`title`,{id:t,children:e}):null,(0,D.jsx)(`path`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M20 6L9 17l-5-5`})]})),G=(0,E.forwardRef)(({title:e,titleId:t,...n},r)=>(0,D.jsxs)(`svg`,{viewBox:`0 0 24 24`,width:`1.2em`,height:`1.2em`,ref:r,"aria-labelledby":t,...n,children:[e?(0,D.jsx)(`title`,{id:t,children:e}):null,(0,D.jsx)(`path`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`m6 9l6 6l6-6`})]})),jn=(0,E.forwardRef)(({title:e,titleId:t,...n},r)=>(0,D.jsxs)(`svg`,{viewBox:`0 0 24 24`,width:`1.2em`,height:`1.2em`,ref:r,"aria-labelledby":t,...n,children:[e?(0,D.jsx)(`title`,{id:t,children:e}):null,(0,D.jsxs)(`g`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,children:[(0,D.jsx)(`rect`,{width:14,height:14,x:8,y:8,rx:2,ry:2}),(0,D.jsx)(`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`})]})]}));function Mn(){let{id:e}=h.useSearch();return(0,D.jsx)(Er,{id:e})}function K(e){return e.toLocaleString()}var Nn=new Set,q=f();function Pn(e){try{return{ok:!0,value:q.parse(JSON.parse(e))}}catch{return{ok:!1}}}function J(e){if(!e)return{};try{return q.parse(JSON.parse(e))}catch{return e}}function Y({text:e,dark:t}){let[n,r]=(0,E.useState)(!1);return(0,E.useEffect)(()=>{if(!n)return;let e=setTimeout(()=>r(!1),1500);return()=>clearTimeout(e)},[n]),(0,D.jsx)(`button`,{type:`button`,className:`absolute top-2 right-2 p-1 rounded transition-colors ${t?`text-sand-500 hover:text-sand-300`:`text-sand-400 hover:text-sand-600`}`,onClick:()=>{navigator.clipboard.writeText(e),r(!0)},children:n?(0,D.jsx)(An,{className:`size-3.5 text-sage-500`}):(0,D.jsx)(jn,{className:`size-3.5`})})}var Fn=/<img\s+[^>]*src=["'](data:image\/[^"']+;base64,[^"']+)["'][^>]*(?:alt=["']([^"']*)["'][^>]*)?\/?>|<audio\s+[^>]*src=["'](data:audio\/[^"']+;base64,[^"']+)["'][^>]*>(?:<\/audio>)?/gi;function In(e){let t=[],n=0;for(let r of e.matchAll(Fn)){let i=r.index??0;i>n&&t.push({type:`text`,text:e.slice(n,i)}),t.push(r[3]?{type:`audio`,src:r[3]}:{type:`image`,src:r[1],alt:r[2]??`generated image`}),n=i+r[0].length}return n<e.length&&t.push({type:`text`,text:e.slice(n)}),t.filter(e=>e.type!==`text`||e.text.trim().length>0)}function Ln({text:e,markdown:t,audioWords:n}){let[r,i]=(0,E.useState)(null),c=In(e);return c.some(e=>e.type!==`text`)?(0,D.jsxs)(`div`,{className:`space-y-3`,children:[c.map((e,r)=>e.type===`text`?t?(0,D.jsx)(`div`,{className:`prose prose-sm prose-qgrid max-w-none`,children:(0,D.jsx)(a,{remarkPlugins:[s],children:e.text})},`text-${r}`):(0,D.jsx)(`pre`,{className:`text-sm text-sand-800 whitespace-pre-wrap wrap-break-word font-mono leading-relaxed`,children:e.text},`text-${r}`):e.type===`audio`?n?(0,D.jsx)(`div`,{className:`flex max-w-xl flex-col gap-2`,children:(0,D.jsx)(C,{src:e.src,words:n,className:`w-full max-w-md`})},`audio-${r}`):(0,D.jsx)(`audio`,{controls:!0,src:e.src,className:`w-full max-w-md`},`audio-${r}`):(0,D.jsx)(`button`,{type:`button`,className:`block max-w-full rounded-md border border-sand-200 overflow-hidden bg-white hover:border-sienna-300 transition-colors`,onClick:()=>i(e.src),title:`Open image`,children:(0,D.jsx)(`img`,{src:e.src,alt:e.alt,className:`max-h-[520px] max-w-full object-contain`,loading:`lazy`})},`image-${r}`)),r&&(0,D.jsxs)(`div`,{className:`fixed inset-0 z-50 bg-black/70 p-4 flex items-center justify-center`,onClick:e=>{e.target===e.currentTarget&&i(null)},children:[(0,D.jsx)(`button`,{type:`button`,className:`absolute top-4 right-4 p-2 rounded-full bg-white/90 text-sand-700 hover:bg-white`,onClick:()=>i(null),title:`Close image`,children:(0,D.jsx)(o,{className:`size-5`})}),(0,D.jsx)(`img`,{src:r,alt:`generated preview`,className:`max-h-full max-w-full object-contain rounded-md bg-white`})]})]}):t?(0,D.jsx)(`div`,{className:`prose prose-sm prose-qgrid max-w-none`,children:(0,D.jsx)(a,{remarkPlugins:[s],children:e})}):(0,D.jsx)(`pre`,{className:`text-sm text-sand-800 whitespace-pre-wrap wrap-break-word font-mono leading-relaxed`,children:e})}function X({text:e,markdown:t,audioWords:n}){let r=Pn(e),[i,a]=(0,E.useState)(`pretty`),o=r.ok&&r.value instanceof Object?r.value:null;return!r.ok||o===null?t?(0,D.jsx)(Ln,{text:e,markdown:!0,audioWords:n}):(0,D.jsx)(Ln,{text:r.ok?JSON.stringify(r.value,null,2):e}):(0,D.jsxs)(`div`,{children:[(0,D.jsxs)(`div`,{className:`flex gap-1 mb-2`,children:[(0,D.jsx)(`button`,{type:`button`,className:`px-2 py-0.5 text-[10px] rounded-md transition-colors ${i===`plain`?`bg-sand-200 text-sand-700`:`text-sand-400 hover:text-sand-600`}`,onClick:()=>a(`plain`),children:`Plain`}),(0,D.jsx)(`button`,{type:`button`,className:`px-2 py-0.5 text-[10px] rounded-md transition-colors ${i===`pretty`?`bg-sand-200 text-sand-700`:`text-sand-400 hover:text-sand-600`}`,onClick:()=>a(`pretty`),children:`Pretty`})]}),i===`pretty`?(0,D.jsx)(W,{value:o,style:On,displayDataTypes:!1,enableClipboard:!0,collapsed:!1}):(0,D.jsx)(`pre`,{className:`text-sm text-sand-800 whitespace-pre-wrap wrap-break-word font-mono leading-relaxed`,children:JSON.stringify(r.value,null,2)})]})}function Z({title:e,defaultOpen:t=!0,headerMetadata:n,onOpenChange:r,children:i}){let[a,o]=(0,E.useState)(t);return(0,D.jsxs)(`details`,{open:a,className:`group panel overflow-hidden`,onToggle:e=>{let t=e.currentTarget.open;o(t),r?.(t)},children:[(0,D.jsxs)(`summary`,{className:`panel-header flex min-w-0 items-center gap-1.5 whitespace-nowrap cursor-pointer select-none list-none px-4 py-2.5`,children:[(0,D.jsx)(G,{className:`size-3.5 shrink-0 text-sand-400 transition-transform group-open:rotate-0 -rotate-90`}),(0,D.jsx)(`span`,{className:`shrink-0 text-[11px] uppercase tracking-wider text-sand-500 font-medium`,children:e}),n&&(0,D.jsx)(`span`,{className:`flex min-w-0 flex-1 items-center gap-1.5 overflow-hidden whitespace-nowrap text-[11px] normal-case text-sand-400`,children:n})]}),(0,D.jsx)(`div`,{className:`p-4`,children:i})]})}function Q({label:e,value:t}){return(0,D.jsxs)(`div`,{className:`min-w-0`,children:[(0,D.jsx)(`dt`,{className:`text-[10px] uppercase tracking-wider text-sand-400 font-medium truncate`,children:e}),(0,D.jsx)(`dd`,{className:`text-[15px] font-semibold text-sand-800 tabular-nums mt-0.5 truncate`,children:t})]})}var Rn=new Map([[`running`,`bg-blue-100 text-blue-600`],[`succeeded`,`bg-sage-100 text-sage-600`],[`error`,`bg-red-100 text-red-600`],[`aborted`,`bg-caution-400/15 text-caution-500`]]);function zn({message:e}){return(0,D.jsxs)(`div`,{className:`panel overflow-hidden border border-red-200 bg-red-50/60`,children:[(0,D.jsx)(`div`,{className:`px-4 py-2.5 border-b border-red-100 flex items-center gap-1.5`,children:(0,D.jsx)(`span`,{className:`text-[11px] uppercase tracking-wider text-red-600 font-medium`,children:`Error`})}),(0,D.jsx)(`div`,{className:`p-4`,children:(0,D.jsx)(`pre`,{className:`text-[12px] text-red-700 whitespace-pre-wrap break-words font-mono leading-relaxed max-h-80 overflow-auto`,children:e})})]})}function Bn({data:e}){let t=e.status===`running`,n=S({status:e.status,requestedModel:e.requested_model_name,servedModel:e.model_name,imageCostMethod:e.image_cost_method}),r=!t&&e.requested_model_name!==null&&e.model_name===null;return(0,D.jsxs)(`div`,{className:`panel overflow-hidden px-4 py-3 flex flex-wrap items-center gap-x-2 gap-y-1.5 sm:px-5`,children:[(0,D.jsx)(`span`,{className:`text-[15px] font-semibold text-sand-900 break-all`,children:n.label===`—`?`Unknown model`:n.label}),r&&(0,D.jsx)(`span`,{className:`text-[10px] text-sand-400`,children:`요청`}),e.service_tier===`fast`&&(0,D.jsx)(`span`,{title:`Fast 모드`,className:`inline-flex shrink-0`,children:(0,D.jsx)(x,{"aria-label":`Fast 모드`,className:`size-3.5 text-[#1877F2] [&_path]:fill-current`})}),!t&&(e.fallback_count??0)>0&&(0,D.jsxs)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded-full bg-caution-400/15 text-caution-500 font-medium uppercase`,children:[`fallback ×`,e.fallback_count]}),e.status!==`succeeded`&&(0,D.jsx)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded-full font-medium uppercase ${Rn.get(e.status)??`bg-sand-100 text-sand-500`}`,children:e.status}),e.response_json_ok===!1&&(0,D.jsx)(`span`,{title:`structured 요청의 응답이 JSON 파싱에 실패했습니다`,className:`text-[10px] px-1.5 py-0.5 rounded-full bg-caution-400/15 text-caution-500 font-medium uppercase`,children:`broken json`}),e.effort&&(0,D.jsxs)(`span`,{className:`text-[11px] px-1.5 py-0.5 rounded-md bg-sand-100 text-sand-500 font-mono`,children:[`effort=`,e.effort]}),e.project_name&&(0,D.jsxs)(`span`,{className:`text-[12px] text-sand-400`,children:[`· project=`,e.project_name]}),(0,D.jsx)(`span`,{className:`ml-auto text-[11px] text-sand-400`,children:e.token_name})]})}function Vn({data:e,toolCallCount:t}){let n=Jn(e);return(0,D.jsxs)(`div`,{className:`panel overflow-hidden px-5 py-3 space-y-3`,children:[(0,D.jsxs)(`div`,{className:`grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-5 gap-x-6 gap-y-3`,children:[(0,D.jsx)(Q,{label:`Duration`,value:`${(e.duration_ms/1e3).toFixed(1)}s`}),(0,D.jsx)(Q,{label:`TTFT`,value:Kn(e.ttft_ms)}),(0,D.jsx)(Q,{label:`Tokens/sec`,value:Yn(e.output_tokens,e.duration_ms,e.ttft_ms,n)}),(0,D.jsx)(Q,{label:e.media_kind===`stt`||e.media_kind===`tts`||e.media_kind===`live`?`Voice`:`Driver`,value:e.cost_usd===null?`—`:y(e.cost_usd)}),(0,D.jsx)(Q,{label:`Image`,value:e.image_cost_usd===null?`—`:y(e.image_cost_usd)}),(0,D.jsx)(Q,{label:`Tool Calls`,value:`${t}회`})]}),(0,D.jsxs)(`div`,{className:`border-t border-sand-100/60 pt-3 grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-5 gap-x-6 gap-y-3`,children:[(0,D.jsx)(Q,{label:`Input`,value:K(e.input_tokens)}),(0,D.jsx)(Q,{label:`Output`,value:K(e.output_tokens)}),(0,D.jsx)(Q,{label:`Cache Read`,value:K(e.cache_read_tokens)}),(0,D.jsx)(Q,{label:`Cache Write`,value:K(e.cache_creation_tokens)}),(0,D.jsx)(Q,{label:`Cache Write (5m)`,value:e.cache_creation_5m_tokens===null?`—`:K(e.cache_creation_5m_tokens)}),(0,D.jsx)(Q,{label:`Cache Write (1h)`,value:e.cache_creation_1h_tokens===null?`—`:K(e.cache_creation_1h_tokens)}),(0,D.jsx)(Q,{label:`Cache Hit`,value:b(e)})]})]})}var Hn=v({mediaType:l().optional(),data:l().optional(),url:l().optional(),byteSize:g().optional()}),Un=c({inputImages:p(q)}),Wn=c({mediaType:q.optional(),byteSize:q.optional(),url:q.optional(),data:q.optional()});function Gn(e){return e==null?`—`:e>=1e3?`${(e/1e3).toFixed(1)}s`:`${e}ms`}function Kn(e){return e==null||e<=0?`—`:Gn(e)}function qn(e){let t=e.model_name?.trim().toLowerCase();if(t){let e=t.includes(`/`)?t.split(`/`).pop():t;if(e.startsWith(`claude-`))return`anthropic`;if(/^(gpt-|codex-|o\d)/.test(e))return`openai`;if(e.startsWith(`grok-`))return`grok`}let n=e.token_name?.trim().toLowerCase();return n?.startsWith(`anthropic/`)?`anthropic`:n?.startsWith(`openai/`)?`openai`:n?.startsWith(`grok/`)?`grok`:null}function Jn(e){let t=qn(e);return t!==null&&Nn.has(t)}function Yn(e,t,n,r){if(!r||e==null||t==null||n==null||n<=0)return`—`;let i=t-n;return e<=0||i<=0?`—`:`${Math.round(e/(i/1e3)).toLocaleString()} tok/s`}function $({label:e,value:t}){return(0,D.jsxs)(`div`,{className:`min-w-0 self-end`,children:[e&&(0,D.jsx)(`div`,{className:`text-[10px] uppercase tracking-wider text-sand-400 font-medium truncate`,children:e}),(0,D.jsx)(`div`,{className:`mt-0.5 text-[13px] font-semibold text-sand-800 tabular-nums truncate`,children:t})]})}function Xn(e){let t=Un.safeParse(e);return t.success?t.data.inputImages.flatMap(e=>{let t=Hn.safeParse(e);return t.success&&(t.data.url||t.data.data)?[t.data]:[]}):[]}function Zn(e){let t=Wn.safeParse(e);if(!t.success)return e;let n=t.data,r={};n.mediaType!==void 0&&(r.mediaType=n.mediaType),n.byteSize!==void 0&&(r.byteSize=n.byteSize);let i=l().safeParse(n.url),a=i.success&&i.data.toLowerCase().startsWith(`data:`)?`[data-url ${i.data.length} chars]`:n.url;if(a&&(r.url=a),n.data){let e=l().safeParse(n.data);r.data=e.success?`[base64 ${e.data.length} chars]`:`[base64 data]`}return r}function Qn(e){let t=Un.safeParse(e);return!t.success||!(e instanceof Object)||Array.isArray(e)?e:{...e,inputImages:t.data.inputImages.map(Zn)}}function $n({images:e}){let t=e.map((e,t)=>{let n=e.url&&!e.url.startsWith(`[`)?e.url:void 0,r=e.data?`data:${e.mediaType??`image/png`};base64,${e.data}`:``,i=n??r;return i?{image:e,index:t,src:i}:null}).filter(e=>e!==null);return t.length===0?null:(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`span`,{className:`text-[10px] uppercase tracking-wider text-sand-400 font-medium px-2`,children:`Input Images`}),(0,D.jsx)(`div`,{className:`mt-1 grid grid-cols-1 sm:grid-cols-2 gap-2`,children:t.map(({image:e,index:t,src:n})=>(0,D.jsxs)(`div`,{className:`rounded-md border border-sand-200 bg-white overflow-hidden`,children:[(0,D.jsx)(`img`,{src:n,alt:`reference ${t+1}`,className:`max-h-64 w-full object-contain bg-white`,loading:`lazy`}),(0,D.jsxs)(`div`,{className:`px-2 py-1 text-[10px] text-sand-500 font-mono border-t border-sand-100`,children:[e.mediaType??`image`,` ·`,` `,e.byteSize===void 0?`url`:`${e.byteSize.toLocaleString()} bytes`]})]},`${e.mediaType??`image`}-${t}`))})]})}var er=v({words:p(v({text:l(),start:g(),end:g()})).optional()});function tr({text:e,stepId:t}){let{data:n}=m.useRequestLogStep(`A`,t??0,{enabled:t!==null}),r=n?er.safeParse(J(n.tool_result)).data?.words:void 0;return(0,D.jsx)(X,{text:e,markdown:!0,audioWords:r})}function nr({images:e,stepId:t}){let{data:n}=m.useRequestLogStep(`I`,t??0,{enabled:e===null&&t!==null}),r=n?J(n.tool_args):null;return(0,D.jsx)($n,{images:e??Xn(r)})}function rr({entry:e}){let t=!!e.error,[n,r]=(0,E.useState)(!1),{data:i}=m.useRequestLogStep(`A`,e.id,{enabled:n}),a=Qn(i?J(i.tool_args):null),o=i?J(i.tool_result):null,s=l().safeParse(o),c=s.success?s.data:JSON.stringify(o),u=i?.error??e.error;return(0,D.jsxs)(`details`,{className:`group/tool`,onToggle:e=>r(e.currentTarget.open),children:[(0,D.jsxs)(`summary`,{className:`flex items-center gap-2 px-3 py-2 cursor-pointer select-none list-none hover:bg-sand-50 transition-colors rounded-md`,children:[(0,D.jsx)(G,{className:`size-3 text-sand-400 transition-transform group-open/tool:rotate-0 -rotate-90 shrink-0`}),(0,D.jsxs)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded bg-sand-100 text-sand-500 font-mono shrink-0`,children:[`call `,e.callIndex+1]}),(0,D.jsx)(`span`,{className:`text-[13px] font-medium text-sand-800 font-mono truncate`,children:e.toolName}),t&&(0,D.jsx)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded-full bg-red-100 text-red-600 font-medium uppercase shrink-0`,children:`error`}),(0,D.jsx)(`span`,{className:`ml-auto text-[11px] text-sand-400 tabular-nums shrink-0`,children:Gn(e.durationMs)})]}),n&&(0,D.jsxs)(`div`,{className:`mt-1 mx-1 mb-3 space-y-2`,children:[(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`span`,{className:`text-[10px] uppercase tracking-wider text-sand-400 font-medium px-2`,children:`Request`}),(0,D.jsx)(`div`,{className:`mt-1 rounded-md bg-sand-50 p-3 overflow-auto`,children:(0,D.jsx)(X,{text:i?JSON.stringify(a):`Loading...`})})]}),u&&(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`span`,{className:`text-[10px] uppercase tracking-wider text-red-500 font-medium px-2`,children:`Error`}),(0,D.jsx)(`div`,{className:`mt-1 rounded-md bg-red-50 border border-red-100 p-3 overflow-auto`,children:(0,D.jsx)(X,{text:u})})]}),(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`span`,{className:`text-[10px] uppercase tracking-wider text-sand-400 font-medium px-2`,children:`Response`}),(0,D.jsx)(`div`,{className:`mt-1 rounded-md bg-sand-50 p-3 overflow-auto`,children:(0,D.jsx)(X,{text:i?c:`Loading...`,markdown:!0})})]})]})]})}function ir({stepId:e}){let[t,n]=(0,E.useState)(!1),{data:r}=m.useRequestLogStep(`A`,e,{enabled:t}),i=r?.reasoning_text??null;return(0,D.jsxs)(`details`,{className:`group/reason mt-3`,onToggle:e=>n(e.currentTarget.open),children:[(0,D.jsxs)(`summary`,{className:`flex items-center gap-2 cursor-pointer select-none list-none`,children:[(0,D.jsx)(G,{className:`size-3 text-sand-400 transition-transform group-open/reason:rotate-0 -rotate-90 shrink-0`}),(0,D.jsx)(`span`,{className:`text-[10px] uppercase tracking-wider text-sand-500 font-medium`,children:`Reasoning`})]}),t&&(0,D.jsx)(`div`,{className:`mt-2 rounded-md bg-white/70 border border-sand-100 p-3 overflow-auto`,children:i?(0,D.jsx)(X,{text:i,markdown:!0}):r?(0,D.jsx)(`p`,{className:`text-sm text-sand-400`,children:`No reasoning text captured.`}):(0,D.jsx)(`p`,{className:`text-sm text-sand-400`,children:`Loading...`})})]})}function ar({entry:e,tokensPerSecEnabled:t}){let n=e.generate,r=n!==null&&n.reasoningTokens!==null&&n.reasoningTokens!==void 0&&n.reasoningTokens>0,i=e.toolCalls.filter(e=>e.error).length;return(0,D.jsxs)(`details`,{open:!0,className:`group/step border-l border-sand-200 pl-3`,children:[(0,D.jsxs)(`summary`,{className:`flex items-center gap-2 py-2 cursor-pointer select-none list-none`,children:[(0,D.jsx)(G,{className:`size-3.5 text-sand-400 transition-transform group-open/step:rotate-0 -rotate-90 shrink-0`}),(0,D.jsxs)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded bg-sienna-100 text-sienna-700 font-mono shrink-0`,children:[`step `,e.stepIndex+1]}),(0,D.jsx)(`span`,{className:`text-[13px] font-semibold text-sand-900`,children:`LLM call`}),n?.finishReason&&(0,D.jsx)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded bg-sand-100 text-sand-500 font-mono shrink-0`,children:n.finishReason}),n&&(n.fallbackCount??0)>0&&(0,D.jsxs)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded-full bg-caution-400/15 text-caution-500 font-medium uppercase shrink-0`,children:[n.requestedModelName,` → `,n.modelName]}),r&&(0,D.jsx)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded bg-blue-100 text-blue-600 font-medium shrink-0`,children:`reasoning`}),i>0&&(0,D.jsxs)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded-full bg-red-100 text-red-600 font-medium uppercase shrink-0`,children:[i,` error`]}),(0,D.jsxs)(`span`,{className:`ml-auto text-[11px] text-sand-400 tabular-nums shrink-0`,children:[e.toolCalls.length,` tools`]})]}),(0,D.jsxs)(`div`,{className:`ml-4 mb-4 space-y-3`,children:[n&&(0,D.jsxs)(`div`,{className:`rounded-md border border-sand-100 bg-sand-50/70 p-3`,children:[(0,D.jsxs)(`div`,{className:`grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 xl:grid-cols-8 gap-x-4 gap-y-3`,children:[(0,D.jsx)($,{label:`Duration`,value:Gn(n.durationMs)}),(0,D.jsx)($,{label:`TTFT`,value:Kn(n.ttftMs)}),(0,D.jsx)($,{label:`Tokens/sec`,value:Yn(n.outputTokens,n.durationMs,n.ttftMs,t)}),(0,D.jsx)($,{label:`Input`,value:K(n.inputTokens??0)}),(0,D.jsx)($,{label:`Output`,value:K(n.outputTokens??0)}),(0,D.jsx)($,{label:`Cache Read`,value:K(n.cacheReadTokens??0)}),(0,D.jsx)($,{label:`Cache Write`,value:K(n.cacheCreationTokens??0)}),(0,D.jsx)($,{label:`Cache 5m / 1h`,value:`${n.cacheCreation5mTokens===null?`—`:K(n.cacheCreation5mTokens)} / ${n.cacheCreation1hTokens===null?`—`:K(n.cacheCreation1hTokens)}`}),(0,D.jsx)($,{value:n.costUsd===null?`—`:y(n.costUsd)}),(0,D.jsx)($,{label:`Reasoning`,value:n.reasoningTokens!==null&&n.reasoningTokens!==void 0?K(n.reasoningTokens):`—`})]}),r&&(0,D.jsx)(ir,{stepId:n.id})]}),e.toolCalls.length>0&&(0,D.jsx)(`div`,{className:`space-y-0.5`,children:e.toolCalls.map(e=>(0,D.jsx)(rr,{entry:e},`${e.stepIndex}-${e.callIndex}-${e.toolCallId}`))})]})]})}function or({steps:e,tokensPerSecEnabled:t}){let n=e.reduce((e,t)=>e+t.toolCalls.length,0);return(0,D.jsx)(Z,{title:`Steps (${e.length} steps · ${n} tool calls)`,defaultOpen:!0,children:(0,D.jsx)(`div`,{className:`space-y-1`,children:e.map(e=>(0,D.jsx)(ar,{entry:e,tokensPerSecEnabled:t},e.stepIndex))})})}function sr(e){let t=new Map;function n(e){let n=t.get(e);if(n)return n;let r={stepIndex:e,generate:null,toolCalls:[]};return t.set(e,r),r}for(let t of e){let e=n(t.step_index);t.type===`generate`?e.generate={id:t.id,stepIndex:t.step_index,modelName:t.model_name,requestedModelName:t.requested_model_name,fallbackCount:t.fallback_count,inputTokens:t.input_tokens,outputTokens:t.output_tokens,cacheReadTokens:t.cache_read_tokens,cacheCreationTokens:t.cache_creation_tokens,cacheCreation5mTokens:t.cache_creation_5m_tokens,cacheCreation1hTokens:t.cache_creation_1h_tokens,costUsd:t.cost_usd,durationMs:t.duration_ms,ttftMs:t.ttft_ms,finishReason:t.finish_reason,reasoningTokens:t.reasoning_tokens}:t.type===`tool_call`&&e.toolCalls.push({id:t.id,stepIndex:t.step_index,callIndex:t.tool_call_index??e.toolCalls.length,toolCallId:t.tool_call_id??``,toolName:t.tool_name??``,durationMs:t.tool_duration_ms??0,error:t.error})}return[...t.values()].map(e=>({...e,toolCalls:e.toolCalls.toSorted((e,t)=>e.callIndex-t.callIndex)})).toSorted((e,t)=>e.stepIndex-t.stepIndex)}function cr(e){return e.type===`function_call`||e.type===`function_call_output`?`bg-caution-400/10`:e.role===`assistant`?`bg-sage-50`:`bg-sand-50`}function lr(e){return e.type===`function_call`?`fn: ${e.name??`unknown`}`:e.type===`function_call_output`?`fn result`:e.role??e.type}var ur=c({text:l()}),dr=_([l(),p(_([ur,q])),q]);function fr(e){let t=l().safeParse(e);if(t.success)return t.data;let n=p(_([ur,q])).safeParse(e);return n.success?n.data.map(e=>{let t=ur.safeParse(e);return t.success?t.data.text:JSON.stringify(e)}).join(`
|
|
2
|
-
`):JSON.stringify(e)}function pr({className:e,children:t}){return(0,D.jsx)(`pre`,{className:`text-[12px] text-sand-700 whitespace-pre-wrap wrap-break-word font-mono leading-relaxed max-h-40 overflow-auto ${e??``}`,children:t})}function mr({history:e}){return(0,D.jsx)(Z,{title:`History`,defaultOpen:!1,children:(0,D.jsx)(`div`,{className:`space-y-1.5`,children:e.map((e,t)=>{let n=dr.safeParse(e.content);return(0,D.jsxs)(`div`,{className:`rounded-md px-3 py-2 ${cr(e)}`,children:[(0,D.jsx)(`div`,{className:`text-[10px] uppercase tracking-wider text-sand-500 font-medium mb-1`,children:lr(e)}),e.content!==null&&e.content!==void 0&&(0,D.jsx)(pr,{children:n.success?fr(n.data):JSON.stringify(e.content)}),e.arguments&&(0,D.jsx)(pr,{children:e.arguments}),e.output&&(0,D.jsx)(pr,{children:e.output})]},`hist-${t}`)})})})}var hr=60,gr=30,_r=18;function vr(e,t=hr){let n=[];for(let r of e){if([...n,r.name].join(`, `).length>t)break;n.push(r.name)}return{names:n,omittedCount:e.length-n.length}}function yr({tools:e}){let t=vr(e),n=vr(e,gr),r=vr(e,_r);return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`span`,{className:`shrink-0`,children:`·`}),t.names.length>0&&(0,D.jsx)(`span`,{className:`hidden shrink-0 xl:inline`,children:t.names.join(`, `)}),t.omittedCount>0&&(0,D.jsxs)(`span`,{className:`hidden shrink-0 xl:inline`,children:[`+`,t.omittedCount]}),n.names.length>0&&(0,D.jsx)(`span`,{className:`hidden shrink-0 sm:inline xl:hidden`,children:n.names.join(`, `)}),n.omittedCount>0&&(0,D.jsxs)(`span`,{className:`hidden shrink-0 sm:inline xl:hidden`,children:[`+`,n.omittedCount]}),r.names.length>0&&(0,D.jsx)(`span`,{className:`shrink-0 sm:hidden`,children:r.names.join(`, `)}),r.omittedCount>0&&(0,D.jsxs)(`span`,{className:`shrink-0 sm:hidden`,children:[`+`,r.omittedCount]})]})}function br({code:e,fullCode:t}){let n=(0,E.useMemo)(()=>wr(e),[e]);return(0,D.jsx)(`pre`,{"data-zod-parameter-schema":!0,className:`max-h-64 overflow-auto rounded-md bg-sand-900 px-3 py-2.5 font-mono text-[11px] leading-relaxed whitespace-pre text-sand-200 ${t?`cursor-help outline-none focus-visible:ring-2 focus-visible:ring-sienna-300`:``}`,tabIndex:t?0:void 0,title:t,children:t?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`span`,{"aria-hidden":`true`,children:n}),(0,D.jsx)(`span`,{className:`sr-only`,children:t})]}):n})}function xr({tool:e}){return(0,D.jsxs)(`div`,{className:`min-w-0 rounded-md border border-sand-100 bg-sand-50/70 p-3`,children:[(0,D.jsx)(`div`,{className:`break-all font-mono text-[13px] font-semibold text-sand-900`,children:e.name}),e.description&&(0,D.jsx)(`p`,{className:`mt-2 text-[12px] leading-relaxed text-sand-700`,children:e.description}),(0,D.jsxs)(`div`,{className:`mt-3`,children:[(0,D.jsxs)(`div`,{className:`mb-1.5 text-[10px] font-medium uppercase tracking-wider text-sand-400`,children:[`Parameters (`,e.parameterCount,`)`]}),(0,D.jsx)(br,{code:e.inputZod,fullCode:e.fullInputZod})]})]})}function Sr({id:e,tools:t}){let[n,i]=(0,E.useState)(!1),a=r({...u.toolsViewQueryOptions(e),enabled:n,staleTime:e=>e.state.data&&e.state.data.length>0?1/0:0,refetchOnWindowFocus:!1,refetchOnReconnect:!1}),o=a.data!==void 0&&a.data.length>0;return(0,D.jsx)(Z,{title:`Tools (${t.length})`,defaultOpen:!1,headerMetadata:(0,D.jsx)(yr,{tools:t}),onOpenChange:i,children:a.isFetching&&!o?(0,D.jsx)(`p`,{className:`text-[12px] text-sand-400`,children:`Loading tool contracts…`}):a.isError||!o?(0,D.jsx)(`p`,{className:`text-[12px] text-sand-400`,children:`Tool contracts could not be loaded.`}):(0,D.jsx)(`div`,{className:`space-y-2`,children:a.data.map((e,t)=>(0,D.jsx)(xr,{tool:e},`${e.name}-${t}`))})})}var Cr=/("(?:[^"\\]|\\.)*")|(\b\d+(?:\.\d+)?\b)|(\btype\b|\bz\b(?=\.))|(\b(?:string|number|boolean|null|unknown|Record)\b)|([{}[\]()<>|?:,.=])|([A-Za-z_$][\w$]*)|(\s+|.)/g;function wr(e){let t=[],n=!1;for(let r of e.matchAll(Cr)){let[e,i,a,o,s,c,l]=r,u=`${r.index}-${e}`;i||a?t.push((0,D.jsx)(`span`,{className:`text-sage-400`,children:e},u)):o?(n=e===`type`,t.push((0,D.jsx)(`span`,{className:`text-sienna-400`,children:e},u))):s?t.push((0,D.jsx)(`span`,{className:`text-blue-300`,children:e},u)):c?t.push((0,D.jsx)(`span`,{className:`text-sand-500`,children:e},u)):l&&n?(n=!1,t.push((0,D.jsx)(`span`,{className:`font-semibold text-sand-50`,children:e},u))):t.push(e)}return t}function Tr({id:e}){let{data:t}=u.useResponseTypeTs(e),[n,r]=(0,E.useState)(`zod`),{zod:i=null,typescript:a=null}=t??{},o=n===`zod`?i??a:a??i,s=(0,E.useMemo)(()=>o===null?null:wr(o),[o]);return!t||o===null||s===null?null:(0,D.jsxs)(`div`,{className:`panel overflow-hidden`,children:[(0,D.jsxs)(`div`,{className:`panel-header flex items-center px-4 py-2`,children:[(0,D.jsx)(`span`,{className:`text-[11px] uppercase tracking-wider text-sand-500 font-medium`,children:`Response Type`}),(0,D.jsx)(`div`,{className:`ml-auto flex gap-1`,children:[{value:`zod`,label:`zod`,available:i!==null},{value:`ts`,label:`ts`,available:a!==null}].map(e=>(0,D.jsx)(`button`,{type:`button`,disabled:!e.available,className:`px-3 py-1 text-[12px] font-mono rounded-md transition-colors ${n===e.value?`bg-sand-200 text-sand-700`:`text-sand-400 hover:text-sand-600 disabled:text-sand-300 disabled:cursor-not-allowed`}`,onClick:()=>r(e.value),children:e.label},e.value))})]}),(0,D.jsxs)(`div`,{className:`relative`,children:[(0,D.jsx)(Y,{text:o,dark:!0}),(0,D.jsx)(`pre`,{className:`bg-sand-900 px-4 py-3 text-[12px] text-sand-200 whitespace-pre-wrap wrap-break-word font-mono leading-relaxed max-h-64 overflow-auto`,children:s})]})]})}function Er({id:e}){let{data:t,isLoading:n,error:r,isError:a,refresh:o}=u.useRequestLog(`A`,e),s=t?.status===`running`;(0,E.useEffect)(()=>{let e=s?setInterval(()=>void o(),3e3):void 0;return()=>clearInterval(e)},[s,o]);let{data:c,isLoading:l,isError:f}=m.useRequestLogSteps(`T`,{request_log_id:e,num:0,page:1,orderBy:`id-asc`}),p=sr(c?.rows??[]);if(n||l)return(0,D.jsxs)(`div`,{className:`max-w-6xl mx-auto space-y-4`,children:[(0,D.jsx)(`div`,{className:`h-4 w-32 bg-sand-200 rounded animate-pulse`}),(0,D.jsx)(`div`,{className:`h-40 panel animate-pulse`}),(0,D.jsx)(`div`,{className:`h-32 panel animate-pulse`})]});if(a||f||!t)return(0,D.jsxs)(`div`,{className:`max-w-6xl mx-auto`,children:[(0,D.jsxs)(i,{to:`/logs`,className:`flex items-center gap-1 text-[13px] text-sand-500 hover:text-sienna-500 mb-4`,children:[(0,D.jsx)(kn,{className:`size-3.5`}),`Back to Logs`]}),(0,D.jsx)(`p`,{role:`alert`,className:`text-danger-500 text-sm`,children:a?d(r)&&r.code===404?`Request not found.`:`Failed to load request.`:f?`Failed to load request steps.`:`Request not found.`})]});let h=p.flatMap(e=>e.toolCalls),g=h.find(e=>e.toolName===`image_generation`)?.id??null,_=h.find(e=>e.toolName===`speech`)?.id??null,v=p.length>0,y=Jn(t),b=t.history??null,x=b!==null&&b.length>0,S=t.tools??null,C=S!==null&&S.length>0,w=t.is_structured?(0,D.jsx)(Tr,{id:e}):null,T=(0,D.jsxs)(`div`,{className:`space-y-4`,children:[(0,D.jsx)(Z,{title:t.media_kind===`tts`?`Style instructions`:t.media_kind===`stt`?`Prompt`:t.media_kind===`live`?`Instructions`:`System`,children:(0,D.jsxs)(`div`,{className:`relative`,children:[(0,D.jsx)(Y,{text:t.system_prompt??`null`}),(0,D.jsx)(X,{text:t.system_prompt??`null`,markdown:!0})]})}),t.media_kind!==`live`&&(0,D.jsx)(Z,{title:`User`,children:(0,D.jsxs)(`div`,{className:`space-y-3`,children:[(0,D.jsxs)(`div`,{className:`relative`,children:[(0,D.jsx)(Y,{text:t.user_prompt??`null`}),(0,D.jsx)(X,{text:t.user_prompt??`null`,markdown:!0})]}),(0,D.jsx)(nr,{images:t.input_images,stepId:g})]})})]});return(0,D.jsxs)(`div`,{className:`mx-auto space-y-4 ${v?`max-w-[120rem]`:`max-w-6xl`}`,children:[(0,D.jsxs)(i,{to:`/logs`,className:`inline-flex items-center gap-1 text-[13px] text-sand-500 hover:text-sienna-500 transition-colors`,children:[(0,D.jsx)(kn,{className:`size-3.5`}),`Back to Logs`]}),(0,D.jsx)(Bn,{data:t}),t.error_message&&(0,D.jsx)(zn,{message:t.error_message}),x&&(0,D.jsx)(mr,{history:b}),v?(0,D.jsxs)(`div`,{className:`flex flex-col lg:flex-row gap-4 items-stretch lg:items-start`,children:[(0,D.jsxs)(`div`,{className:`order-1 lg:order-2 flex-1 min-w-0 space-y-4`,children:[w,C&&(0,D.jsx)(Sr,{id:e,tools:S}),(0,D.jsx)(or,{steps:p,tokensPerSecEnabled:y})]}),(0,D.jsx)(`div`,{className:`order-2 lg:order-1 flex-1 min-w-0`,children:T})]}):(0,D.jsxs)(D.Fragment,{children:[w,C&&(0,D.jsx)(Sr,{id:e,tools:S}),T]}),(0,D.jsx)(Z,{title:t.media_kind===`live`?`Conversation`:`Response`,children:(0,D.jsxs)(`div`,{className:`relative`,children:[(0,D.jsx)(Y,{text:t.response}),t.media_kind===`tts`?(0,D.jsx)(tr,{text:t.response,stepId:_}):(0,D.jsx)(X,{text:t.response,markdown:!0})]})}),(0,D.jsx)(Vn,{data:t,toolCallCount:h.length}),(0,D.jsx)(`div`,{className:`pb-8`})]})}export{Mn as component};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,r as n}from"./vendor-react-8xo7RSum.js";import{u as r}from"./vendor-tanstack-DMgmqjm4.js";import{C as i,D as a,O as o,S as s,_ as c,b as l,m as u,n as d,p as f,s as p}from"./index-BeceW0U9.js";import{t as m}from"./TimedPlayer-cuEgYA3Q.js";var h=e(t()),g=n(),_=(0,h.forwardRef)(({title:e,titleId:t,...n},r)=>(0,g.jsxs)(`svg`,{viewBox:`0 0 24 24`,width:`1.2em`,height:`1.2em`,ref:r,"aria-labelledby":t,...n,children:[e?(0,g.jsx)(`title`,{id:t,children:e}):null,(0,g.jsx)(`path`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M15 3h6v6m-11 5L21 3m-3 10v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`})]})),v=(0,h.forwardRef)(({title:e,titleId:t,...n},r)=>(0,g.jsxs)(`svg`,{viewBox:`0 0 24 24`,width:`1.2em`,height:`1.2em`,ref:r,"aria-labelledby":t,...n,children:[e?(0,g.jsx)(`title`,{id:t,children:e}):null,(0,g.jsx)(`path`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M21 12a9 9 0 1 1-6.219-8.56`})]})),y=(0,h.forwardRef)(({title:e,titleId:t,...n},r)=>(0,g.jsxs)(`svg`,{viewBox:`0 0 24 24`,width:`1.2em`,height:`1.2em`,ref:r,"aria-labelledby":t,...n,children:[e?(0,g.jsx)(`title`,{id:t,children:e}):null,(0,g.jsxs)(`g`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,children:[(0,g.jsx)(`path`,{d:`M12 19v3m7-12v2a7 7 0 0 1-14 0v-2`}),(0,g.jsx)(`rect`,{width:6,height:13,x:9,y:2,rx:3})]})]})),b=(0,h.forwardRef)(({title:e,titleId:t,...n},r)=>(0,g.jsxs)(`svg`,{viewBox:`0 0 24 24`,width:`1.2em`,height:`1.2em`,ref:r,"aria-labelledby":t,...n,children:[e?(0,g.jsx)(`title`,{id:t,children:e}):null,(0,g.jsx)(`path`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z`})]})),x=24e3;function S(e,t=x){let n=new Uint8Array(44+e.length*2),r=new DataView(n.buffer),i=(e,t)=>{for(let n=0;n<t.length;n++)r.setUint8(e+n,t.charCodeAt(n))};return i(0,`RIFF`),r.setUint32(4,36+e.length*2,!0),i(8,`WAVE`),i(12,`fmt `),r.setUint32(16,16,!0),r.setUint16(20,1,!0),r.setUint16(22,1,!0),r.setUint32(24,t,!0),r.setUint32(28,t*2,!0),r.setUint16(32,2,!0),r.setUint16(34,16,!0),i(36,`data`),r.setUint32(40,e.length*2,!0),e.forEach((e,t)=>{let n=Math.max(-1,Math.min(1,e));r.setInt16(44+t*2,n<0?n*32768:n*32767,!0)}),n}function C(e){let t=``;for(let n=0;n<e.length;n+=32768)t+=String.fromCharCode(...e.subarray(n,n+32768));return btoa(t)}async function w(e){let t=new AudioContext({sampleRate:x});try{let n=await t.decodeAudioData(await e.arrayBuffer()),r=new Float32Array(n.length);for(let e=0;e<n.numberOfChannels;e++){let t=n.getChannelData(e);for(let e=0;e<t.length;e++)r[e]+=t[e]/n.numberOfChannels}return C(S(r))}finally{await t.close()}}var T=`qgrid_voice_playground`,E=[`grok/grok-tts`,`openai/gpt-realtime-2.1-mini`,`openai/gpt-realtime-2.1`],D=[`openai/gpt-4o-transcribe`,`openai/gpt-4o-mini-transcribe`,`grok/grok-voice-transcribe-2.0`],O=`marin cedar alloy ash ballad coral echo sage shimmer verse`.split(` `),k=[{label:`Female`,voices:`ara aurora carina celeste eve iris liora luna ursa`.split(` `)},{label:`Male`,voices:`altair atlas castor cosmo helios helix kepler leo lumen lux naksh orion perseus rex rigel sal sirius zagan zenith`.split(` `)}],A=[{label:``,voices:O}],j={provider:`timing from Grok TTS`,aligned:`timing from qgrid aligner`},M=e=>e.startsWith(`openai/`),N=`w-full rounded-lg border border-sand-200/80 bg-white px-2.5 py-1.5 text-[12px] text-sand-800 placeholder:text-sand-400 focus:outline-none focus:border-sienna-300 disabled:opacity-50`,P=`${N} h-8`,F=`px-3.5 py-1.5 text-[12px] font-medium rounded-lg bg-sienna-500 text-white hover:bg-sienna-600 disabled:opacity-50 transition-all duration-150 active:scale-[0.97] inline-flex items-center gap-1.5 shadow-sm`;function I({label:e,children:t}){return(0,g.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,g.jsx)(`span`,{className:`text-[11px] font-medium text-sand-500`,children:e}),t]})}var L=e=>e.slice(e.indexOf(`/`)+1);function R({title:e,meta:t,requestLogId:n,onRemove:i,children:a}){return(0,g.jsxs)(`li`,{className:`flex flex-col gap-1.5 px-4 py-3`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-2 text-[12px]`,children:[(0,g.jsx)(`span`,{className:`font-medium text-sand-800`,children:e}),(0,g.jsx)(`span`,{className:`tabular-nums text-sand-400`,children:t}),(0,g.jsxs)(`span`,{className:`ml-auto flex items-center gap-2`,children:[n!==void 0&&(0,g.jsxs)(r,{to:`/requests/show`,search:{id:n},target:`_blank`,className:`inline-flex items-center gap-1 tabular-nums text-sand-500 hover:text-sienna-500`,children:[`request log #`,n,(0,g.jsx)(_,{className:`size-3`})]}),(0,g.jsx)(`button`,{type:`button`,onClick:i,title:`Remove from history`,className:`text-sand-300 hover:text-sand-600`,children:(0,g.jsx)(s,{className:`size-3.5`})})]})]}),a]})}function z({empty:e,children:t}){return t.length===0?(0,g.jsx)(`p`,{className:`px-4 py-6 text-center text-[12px] text-sand-400`,children:e}):(0,g.jsx)(`ul`,{className:`divide-y divide-sand-100`,children:t})}function B(e){if(!e)return;let t=[],n;return e.graphChars.forEach((r,i)=>{let[a,o]=e.graphTimes[i];/\s/.test(r)?n=void 0:n?(n.text+=r,n.end=o):(n={text:r,start:a,end:o},t.push(n))}),t}function V(){let[e,t]=(0,h.useState)(E[0]),[n,r]=(0,h.useState)(`ara`),[a,o]=(0,h.useState)(``),[s,c]=(0,h.useState)(`Hi! What did you do this weekend?`),[l,u]=(0,h.useState)([]),[d,f]=(0,h.useState)(!0),[_,y]=(0,h.useState)(1),x=(0,h.useRef)(0),S=p.useSpeakMutation(),C=M(e),w=e=>{M(e)!==C&&r(M(e)?O[0]:`ara`),t(e)},D=C&&a.trim()?a.trim():void 0,V=t=>{let n=performance.now(),r={model:e,text:s,voice:t,projectName:T};D&&(r.instructions=D),d&&(r.withTimestamps=!0),!C&&_!==1&&(r.speed=_),S.mutate({params:r},{onSuccess:i=>{let a={key:x.current++,src:`data:${i.mimeType};base64,${i.audio}`,model:e,voice:t,instructions:r.instructions,speed:r.speed,text:s,elapsedMs:performance.now()-n,requestLogId:i.requestLogId,words:B(i.audioTimestamps),timing:i.timestampsError?`timing failed: ${i.timestampsError}`:i.timestampsSource&&j[i.timestampsSource]};u(e=>[a,...e])}})},H=(0,h.useRef)(null),[U,W]=(0,h.useState)();(0,h.useEffect)(()=>()=>H.current?.pause(),[]);let G=e=>{if(r(e),H.current?.pause(),U===e){W(void 0);return}let t=new Audio(`/voice-samples/${C?`openai`:`grok`}/${e}.mp3`);t.addEventListener(`ended`,()=>W(t=>t===e?void 0:t),{once:!0}),H.current=t,W(e),t.play()};return(0,g.jsxs)(g.Fragment,{children:[(0,g.jsxs)(`div`,{className:`flex flex-col gap-3 p-4`,children:[(0,g.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,g.jsx)(I,{label:`Model`,children:(0,g.jsx)(`select`,{value:e,onChange:e=>w(e.target.value),className:P,children:E.map(e=>(0,g.jsx)(`option`,{value:e,children:e},e))})}),C?(0,g.jsx)(I,{label:`Style instructions (OpenAI only)`,children:(0,g.jsx)(`input`,{value:a,onChange:e=>o(e.target.value),placeholder:`e.g. Speak with a gentle Irish accent.`,className:P})}):(0,g.jsx)(I,{label:`Speed (Grok only) — ${_.toFixed(2)}×`,children:(0,g.jsx)(`input`,{type:`range`,min:.7,max:1.5,step:.05,value:_,onChange:e=>y(Number(e.target.value)),className:`h-8 accent-sienna-500`})})]}),(0,g.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,g.jsx)(`span`,{className:`text-[11px] font-medium text-sand-500`,children:`Voice — ▶ plays a short self-introduction sample, a name selects it`}),(C?A:k).map(e=>(0,g.jsxs)(`div`,{className:`flex items-start gap-2`,children:[e.label&&(0,g.jsx)(`span`,{className:`w-12 shrink-0 pt-1 text-[11px] text-sand-400`,children:e.label}),(0,g.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:e.voices.map(e=>(0,g.jsxs)(`span`,{className:`inline-flex items-center overflow-hidden rounded-full border text-[12px] ${n===e?`border-sienna-400 bg-sienna-50 text-sienna-700`:`border-sand-200/80 bg-white text-sand-700`}`,children:[(0,g.jsx)(`button`,{type:`button`,onClick:()=>r(e),"aria-pressed":n===e,className:`py-0.5 pl-2.5 pr-1 hover:text-sienna-600`,children:e}),(0,g.jsx)(`button`,{type:`button`,onClick:()=>G(e),title:U===e?`Stop "${e}"`:`Play a "${e}" sample`,className:`py-1 pl-1 pr-2 hover:text-sienna-500 ${U===e?`text-sienna-500`:`text-sand-400`}`,children:U===e?(0,g.jsx)(i,{className:`size-3`}):(0,g.jsx)(b,{className:`size-3`})})]},e))})]},e.label))]}),(0,g.jsx)(I,{label:`Text`,children:(0,g.jsx)(`textarea`,{value:s,onChange:e=>c(e.target.value),rows:3,className:`${N} resize-y`})}),(0,g.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,g.jsxs)(`button`,{type:`button`,onClick:()=>V(n),disabled:S.isPending||!s.trim(),className:F,children:[S.isPending&&(0,g.jsx)(v,{className:`size-3.5 animate-spin`}),`Generate with `,n]}),(0,g.jsxs)(`label`,{className:`flex items-center gap-1.5 text-[12px] text-sand-600`,children:[(0,g.jsx)(`input`,{type:`checkbox`,checked:d,onChange:e=>f(e.target.checked),className:`accent-sienna-500`}),`Word timing`]}),S.isError&&(0,g.jsx)(`p`,{className:`text-[12px] text-danger-500 break-words`,children:S.error?.message})]})]}),(0,g.jsx)(`div`,{className:`border-t border-sand-100`,children:(0,g.jsx)(z,{empty:`Generated clips stack here, newest first, so voices can be compared side by side.`,children:l.map(e=>(0,g.jsxs)(R,{title:[e.voice,L(e.model),e.speed&&`${e.speed}×`].filter(Boolean).join(` · `),meta:[`${(e.elapsedMs/1e3).toFixed(1)}s`,e.timing].filter(Boolean).join(` · `),requestLogId:e.requestLogId,onRemove:()=>u(t=>t.filter(t=>t.key!==e.key)),children:[(!e.words||e.instructions)&&(0,g.jsxs)(`p`,{className:`truncate text-[12px] text-sand-600`,title:e.text,children:[!e.words&&e.text,e.instructions&&(0,g.jsxs)(`span`,{className:`text-sand-400`,children:[` — `,e.instructions]})]}),(0,g.jsx)(m,{src:e.src,words:e.words,autoPlay:!0})]},e.key))})})]})}function H(){let[e,t]=(0,h.useState)(D[0]),[n,r]=(0,h.useState)(``),[a,o]=(0,h.useState)(),[s,c]=(0,h.useState)(!1),[l,u]=(0,h.useState)(),[d,f]=(0,h.useState)([]),_=(0,h.useRef)(null),b=(0,h.useRef)([]),x=(0,h.useRef)(0),S=p.useTranscribeMutation(),E=M(e);(0,h.useEffect)(()=>()=>{_.current?.stream.getTracks().forEach(e=>e.stop()),b.current.forEach(e=>URL.revokeObjectURL(e))},[]);let O=e=>{let t=URL.createObjectURL(e);b.current.push(t),o({blob:e,url:t,clip:b.current.length})};return(0,g.jsxs)(g.Fragment,{children:[(0,g.jsxs)(`div`,{className:`flex flex-col gap-3 p-4`,children:[(0,g.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,g.jsx)(I,{label:`Model`,children:(0,g.jsx)(`select`,{value:e,onChange:e=>t(e.target.value),className:P,children:D.map(e=>(0,g.jsx)(`option`,{value:e,children:e},e))})}),E&&(0,g.jsx)(I,{label:`Prompt (OpenAI only)`,children:(0,g.jsx)(`input`,{value:n,onChange:e=>r(e.target.value),placeholder:`domain words, e.g. qgrid, Kuma`,className:P})})]}),(0,g.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,g.jsxs)(`button`,{type:`button`,onClick:async()=>{if(s)_.current?.stop(),c(!1);else{u(void 0);try{let e=await navigator.mediaDevices.getUserMedia({audio:!0}),t=new MediaRecorder(e),n=[];t.ondataavailable=e=>n.push(e.data),t.onstop=()=>{e.getTracks().forEach(e=>e.stop()),O(new Blob(n,{type:t.mimeType}))},t.start(),_.current=t,c(!0)}catch(e){u(e instanceof Error?e.message:String(e))}}},className:`${F} ${s?`bg-danger-500 hover:bg-danger-500`:``}`,children:[s?(0,g.jsx)(i,{className:`size-3.5`}):(0,g.jsx)(y,{className:`size-3.5`}),s?`Stop`:`Record`]}),(0,g.jsxs)(`label`,{className:`text-[12px] text-sand-600 cursor-pointer hover:text-sienna-500`,children:[`or upload a file`,(0,g.jsx)(`input`,{type:`file`,accept:`audio/*`,className:`hidden`,onChange:e=>{let t=e.target.files?.[0];t&&O(t)}})]}),l&&(0,g.jsx)(`p`,{className:`text-[12px] text-danger-500 break-words`,children:l})]}),a&&(0,g.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,g.jsxs)(`span`,{className:`shrink-0 text-[11px] font-medium text-sand-500`,children:[`clip `,a.clip]}),(0,g.jsx)(`audio`,{controls:!0,src:a.url,className:`h-8 w-full`})]}),(0,g.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,g.jsxs)(`button`,{type:`button`,onClick:async()=>{if(!a)return;u(void 0);let t=a.blob.type.split(`;`)[0],r;try{r=!E&&t.startsWith(`audio/`)?{audio:C(new Uint8Array(await a.blob.arrayBuffer())),mediaType:t}:{audio:await w(a.blob),mediaType:`audio/wav`}}catch(e){u(`could not decode audio: ${e instanceof Error?e.message:String(e)}`);return}let i={model:e,...r,projectName:T};E&&n.trim()&&(i.prompt=n.trim());let o=performance.now();S.mutate({params:i},{onSuccess:t=>{let n={key:x.current++,clip:a.clip,clipUrl:a.url,model:e,prompt:i.prompt,text:t.text,elapsedMs:performance.now()-o,durationSec:t.durationSec,requestLogId:t.requestLogId,words:t.words};f(e=>[n,...e])}})},disabled:!a||s||S.isPending,className:F,children:[S.isPending&&(0,g.jsx)(v,{className:`size-3.5 animate-spin`}),`Transcribe`]}),S.isError&&(0,g.jsx)(`p`,{className:`text-[12px] text-danger-500 break-words`,children:S.error?.message})]})]}),(0,g.jsx)(`div`,{className:`border-t border-sand-100`,children:(0,g.jsx)(z,{empty:`Transcripts stack here, newest first; run one clip through several models to compare.`,children:d.map(e=>(0,g.jsx)(R,{title:`clip ${e.clip} · ${L(e.model)}`,meta:[`${(e.elapsedMs/1e3).toFixed(1)}s`,e.durationSec===void 0?``:`${e.durationSec.toFixed(1)}s audio`,e.prompt?`prompt: ${e.prompt}`:``].filter(Boolean).join(` · `),requestLogId:e.requestLogId,onRemove:()=>f(t=>t.filter(t=>t.key!==e.key)),children:e.words&&e.words.length>0?(0,g.jsx)(m,{src:e.clipUrl,words:e.words}):(0,g.jsx)(`p`,{className:`rounded-lg bg-sand-50 px-3 py-2 text-[13px] text-sand-800 whitespace-pre-wrap`,children:e.text||`(empty transcript)`})},e.key))})})]})}var U=`cove juniper maple spruce ember vale breeze arbor sol aube bubbie haetsal hanul himari leher miko neer porto rindo rio rivage selva sonna tinta viola`.split(` `),W=`openai/gpt-6-luna`,G=c({type:l(),turn:c({id:l(),role:l(),transcript:l()}).optional(),turn_id:l().optional(),delta:l().optional()}),K=e=>`${Math.floor(e/60)}:${String(e%60).padStart(2,`0`)}`;function q({pc:e,channel:t,mic:n}){t.readyState===`open`&&t.send(JSON.stringify({type:`session.close`})),n.getTracks().forEach(e=>e.stop()),setTimeout(()=>e.close(),500)}function J(){let[e,t]=(0,h.useState)(U[0]),[n,a]=(0,h.useState)(``),[o,s]=(0,h.useState)(W),[c,l]=(0,h.useState)(`low`),[d,m]=(0,h.useState)(!1),[b,x]=(0,h.useState)(!0),S=!o.startsWith(`anthropic/`),[C,w]=(0,h.useState)(`idle`),[E,D]=(0,h.useState)(),[O,k]=(0,h.useState)([]),[A,j]=(0,h.useState)(),[M,N]=(0,h.useState)(0),L=(0,h.useRef)(null),R=(0,h.useRef)(null),z=p.useLiveCallMutation();(0,h.useEffect)(()=>()=>{L.current&&q(L.current)},[]),(0,h.useEffect)(()=>{if(C!==`live`)return;let e=Date.now(),t=setInterval(()=>N(Math.floor((Date.now()-e)/1e3)),1e3);return()=>clearInterval(t)},[C]);let B=()=>{L.current&&q(L.current),L.current=null,w(`idle`)},V=e=>{let t;try{t=G.safeParse(JSON.parse(e)).data}catch{return}if(!t)return;let{type:n,turn:r,turn_id:i,delta:a}=t;if(n===`session.closed`)B();else if(r&&(n===`turn.created`||n===`turn.done`)){let e={id:r.id,role:r.role,text:r.transcript};k(t=>t.some(e=>e.id===r.id)?t.map(t=>t.id===r.id?e:t):[...t,e])}else n===`turn.delta`&&i&&a&&k(e=>e.map(e=>e.id===i?{...e,text:e.text+a}:e))};return(0,g.jsxs)(`div`,{className:`flex flex-col gap-3 p-4`,children:[(0,g.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,g.jsx)(I,{label:`Voice`,children:(0,g.jsx)(`select`,{value:e,onChange:e=>t(e.target.value),disabled:C!==`idle`,className:P,children:U.map(e=>(0,g.jsx)(`option`,{value:e,children:e},e))})}),(0,g.jsx)(I,{label:`Instructions`,children:(0,g.jsx)(`input`,{value:n,onChange:e=>a(e.target.value),disabled:C!==`idle`,placeholder:`e.g. You are a friendly English tutor. Keep answers short.`,className:P})}),(0,g.jsx)(I,{label:`Delegation model (answers lookups and reasoning)`,children:(0,g.jsx)(`select`,{value:o,onChange:e=>s(e.target.value),disabled:C!==`idle`,className:P,children:u.map(e=>(0,g.jsx)(`optgroup`,{label:e.label,children:e.models.map(e=>(0,g.jsx)(`option`,{value:e,children:e},e))},e.label))})}),(0,g.jsxs)(`div`,{className:`flex items-end gap-3`,children:[(0,g.jsx)(I,{label:`Effort`,children:(0,g.jsx)(`select`,{value:c,onChange:e=>l(f.options.find(t=>t===e.target.value)??`low`),disabled:C!==`idle`,className:P,children:f.options.map(e=>(0,g.jsx)(`option`,{value:e,children:e},e))})}),(0,g.jsxs)(`label`,{className:`flex h-8 items-center gap-1.5 text-[12px] text-sand-600`,children:[(0,g.jsx)(`input`,{type:`checkbox`,checked:S&&d,onChange:e=>m(e.target.checked),disabled:C!==`idle`||!S,className:`accent-sienna-500`}),`Web search`]}),(0,g.jsxs)(`label`,{className:`flex h-8 items-center gap-1.5 text-[12px] text-sand-600`,children:[(0,g.jsx)(`input`,{type:`checkbox`,checked:b,onChange:e=>x(e.target.checked),disabled:C!==`idle`,className:`accent-sienna-500`}),`Request log`]})]})]}),(0,g.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[C===`idle`?(0,g.jsxs)(`button`,{type:`button`,onClick:async()=>{D(void 0),k([]),j(void 0),N(0),w(`connecting`);let t,r;try{t=await navigator.mediaDevices.getUserMedia({audio:!0});let i=new RTCPeerConnection;r=i,t.getTracks().forEach(e=>i.addTrack(e)),i.addEventListener(`track`,e=>{R.current&&(R.current.srcObject=new MediaStream([e.track]))});let a=i.createDataChannel(`oai-events`);a.addEventListener(`message`,e=>V(String(e.data)));let s=await i.createOffer();await i.setLocalDescription(s);let l={sdp:s.sdp??``,voice:e,delegation:{model:o,effort:c,webSearch:S&&d},projectName:T};n.trim()&&(l.instructions=n.trim()),b||(l.logger=!1);let u=await z.mutateAsync({params:l});await i.setRemoteDescription({type:`answer`,sdp:u.sdp}),L.current={pc:i,channel:a,mic:t},j(u.requestLogId),w(`live`)}catch(e){t?.getTracks().forEach(e=>e.stop()),r?.close(),D(e instanceof Error?e.message:String(e)),w(`idle`)}},className:F,children:[(0,g.jsx)(y,{className:`size-3.5`}),`Start conversation`]}):(0,g.jsxs)(`button`,{type:`button`,onClick:B,disabled:C===`connecting`,className:`${F} bg-danger-500 hover:bg-danger-500`,children:[C===`connecting`?(0,g.jsx)(v,{className:`size-3.5 animate-spin`}):(0,g.jsx)(i,{className:`size-3.5`}),C===`connecting`?`Connecting`:`End`]}),C===`live`&&(0,g.jsxs)(`span`,{className:`tabular-nums text-[12px] text-sand-500`,children:[K(M),` · openai/gpt-live-1 · speak any time (ends by itself after 2 h)`]}),A!==void 0&&(0,g.jsxs)(r,{to:`/requests/show`,search:{id:A},target:`_blank`,className:`inline-flex items-center gap-1 text-[12px] tabular-nums text-sand-500 hover:text-sienna-500`,children:[`request log #`,A,(0,g.jsx)(_,{className:`size-3`})]}),E&&(0,g.jsx)(`p`,{className:`text-[12px] text-danger-500 break-words`,children:E})]}),(0,g.jsx)(`audio`,{ref:R,autoPlay:!0}),O.length===0?(0,g.jsx)(`p`,{className:`py-6 text-center text-[12px] text-sand-400`,children:`Start a conversation and talk; both sides of the transcript appear here.`}):(0,g.jsx)(`ul`,{className:`flex flex-col gap-1.5`,children:O.map(e=>(0,g.jsxs)(`li`,{className:`rounded-lg px-3 py-2 text-[13px] text-sand-800 ${e.role===`assistant`?`bg-sage-50`:`bg-sand-50`}`,children:[(0,g.jsx)(`span`,{className:`mr-2 text-[10px] font-medium uppercase tracking-wider text-sand-500`,children:e.role}),e.text.trim()]},e.id))})]})}function Y({tab:e}){return(0,g.jsxs)(`section`,{className:`rounded-xl border border-sand-200/70 bg-white overflow-hidden`,children:[(0,g.jsx)(`div`,{role:`tablist`,className:`flex gap-1 border-b border-sand-100 px-3 pt-2 md:hidden`,children:a.map(t=>(0,g.jsx)(r,{to:`/voice`,search:{tab:t},role:`tab`,"aria-selected":e===t,className:`-mb-px border-b-2 px-3 py-2 text-[13px] no-underline transition-colors duration-150 ${e===t?`border-sienna-500 font-medium text-sand-800`:`border-transparent text-sand-500 hover:text-sand-700`}`,children:o[t]},t))}),(0,g.jsx)(`div`,{role:`tabpanel`,hidden:e!==`tts`,children:(0,g.jsx)(V,{})}),(0,g.jsx)(`div`,{role:`tabpanel`,hidden:e!==`stt`,children:(0,g.jsx)(H,{})}),(0,g.jsx)(`div`,{role:`tabpanel`,hidden:e!==`live`,children:(0,g.jsx)(J,{})})]})}function X(){let{tab:e=`tts`}=d.useSearch();return(0,g.jsx)(`div`,{className:`max-w-3xl mx-auto`,children:(0,g.jsx)(Y,{tab:e})})}export{X as component};
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { X as require_jsx_runtime, Z as require_react, tt as __toESM } from "./services.generated-C3b31_vt.js";
|
|
2
|
-
//#region src/components/qgrid/TimedPlayer.tsx
|
|
3
|
-
var import_react = /* @__PURE__ */ __toESM(require_react(), 1);
|
|
4
|
-
var import_jsx_runtime = require_jsx_runtime();
|
|
5
|
-
/**
|
|
6
|
-
* Audio player with the timed words under it; the word being spoken is highlighted. The current
|
|
7
|
-
* time is read every animation frame while playing, since timeupdate fires only about 4 times a
|
|
8
|
-
* second and short words would be skipped; timeupdate still feeds it when frames are throttled.
|
|
9
|
-
*/
|
|
10
|
-
function TimedPlayer({ src, words, autoPlay, className = "h-8 w-full" }) {
|
|
11
|
-
const audioRef = (0, import_react.useRef)(null);
|
|
12
|
-
const frame = (0, import_react.useRef)(0);
|
|
13
|
-
const [time, setTime] = (0, import_react.useState)(-1);
|
|
14
|
-
const tick = () => {
|
|
15
|
-
setTime(audioRef.current?.currentTime ?? -1);
|
|
16
|
-
frame.current = requestAnimationFrame(tick);
|
|
17
|
-
};
|
|
18
|
-
const stop = () => cancelAnimationFrame(frame.current);
|
|
19
|
-
(0, import_react.useEffect)(() => () => cancelAnimationFrame(frame.current), []);
|
|
20
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("audio", {
|
|
21
|
-
ref: audioRef,
|
|
22
|
-
controls: true,
|
|
23
|
-
autoPlay,
|
|
24
|
-
src,
|
|
25
|
-
className,
|
|
26
|
-
onPlay: () => {
|
|
27
|
-
stop();
|
|
28
|
-
tick();
|
|
29
|
-
},
|
|
30
|
-
onPause: stop,
|
|
31
|
-
onTimeUpdate: (e) => setTime(e.currentTarget.currentTime),
|
|
32
|
-
onEnded: () => {
|
|
33
|
-
stop();
|
|
34
|
-
setTime(-1);
|
|
35
|
-
}
|
|
36
|
-
}), words && words.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
|
|
37
|
-
className: "flex flex-wrap gap-x-0.5 gap-y-1 text-[13px] leading-relaxed",
|
|
38
|
-
children: words.map((word, i) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
|
|
39
|
-
type: "button",
|
|
40
|
-
onClick: () => {
|
|
41
|
-
const audio = audioRef.current;
|
|
42
|
-
if (!audio) return;
|
|
43
|
-
audio.currentTime = word.start;
|
|
44
|
-
setTime(word.start);
|
|
45
|
-
audio.play();
|
|
46
|
-
},
|
|
47
|
-
title: `${word.start.toFixed(2)}–${word.end.toFixed(2)}s · play from here`,
|
|
48
|
-
className: `rounded px-1 transition-colors duration-75 ${time >= word.start && time < word.end ? "bg-sienna-500 text-white" : "text-sand-700 hover:bg-sand-100"}`,
|
|
49
|
-
children: word.text
|
|
50
|
-
}, i))
|
|
51
|
-
})] });
|
|
52
|
-
}
|
|
53
|
-
//#endregion
|
|
54
|
-
export { TimedPlayer as t };
|