@aintela/chat 0.2.59 → 0.3.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.
Files changed (85) hide show
  1. package/README.md +63 -0
  2. package/dist/{ClientMessage-EKgfuTp8.js → ClientMessage-DUby3KyC.js} +16 -22
  3. package/dist/{ClientMessage-EKgfuTp8.js.map → ClientMessage-DUby3KyC.js.map} +1 -1
  4. package/dist/Memory-CjrYSkzB.js +47 -0
  5. package/dist/Memory-CjrYSkzB.js.map +1 -0
  6. package/dist/atMentions-CCNBOf5W.js +954 -0
  7. package/dist/atMentions-CCNBOf5W.js.map +1 -0
  8. package/dist/components.js +4239 -4165
  9. package/dist/components.js.map +1 -1
  10. package/dist/environmentUtils-VZNTCzEE.js +88 -0
  11. package/dist/environmentUtils-VZNTCzEE.js.map +1 -0
  12. package/dist/hooks.js +4 -5
  13. package/dist/{httpArtifactService-CpbRpTHb.js → httpArtifactService-kXjuQtGa.js} +518 -643
  14. package/dist/httpArtifactService-kXjuQtGa.js.map +1 -0
  15. package/dist/{httpSessionService-BEQMIKfv.js → httpSessionService-CMT6k-Nu.js} +2 -3
  16. package/dist/{httpSessionService-BEQMIKfv.js.map → httpSessionService-CMT6k-Nu.js.map} +1 -1
  17. package/dist/index.js +243 -258
  18. package/dist/models.js +48 -51
  19. package/dist/models.js.map +1 -1
  20. package/dist/serializer-D2W42bdT.js +1730 -0
  21. package/dist/serializer-D2W42bdT.js.map +1 -0
  22. package/dist/services.js +2 -2
  23. package/dist/src/components/AiChat/AiChatProvider.agent.test.d.ts +1 -0
  24. package/dist/src/components/AiChat/AiChatProvider.d.ts +2 -2
  25. package/dist/src/components/AiChat/AiChatTypes.d.ts +45 -16
  26. package/dist/src/components/AiChat/ChatPane/parts/ThoughtRun.d.ts +28 -0
  27. package/dist/src/components/AiChat/ChatPane/parts/ThoughtRunContext.d.ts +18 -0
  28. package/dist/src/components/AiChat/ChatPane/parts/index.d.ts +5 -1
  29. package/dist/src/components/AiChat/ChatPane/parts/thoughtRun.test.d.ts +1 -0
  30. package/dist/src/components/AiChat/aiChatEngine.d.ts +24 -5
  31. package/dist/src/components/AiChat/sessionStateManagerService.bind.test.d.ts +1 -0
  32. package/dist/src/components/AiChat/sessionStateManagerService.d.ts +22 -10
  33. package/dist/src/components/AiChat/useAgentEngine.d.ts +69 -0
  34. package/dist/src/components/AiChat/useAgentEngine.test.d.ts +1 -0
  35. package/dist/src/components/index.d.ts +4 -4
  36. package/dist/src/hooks/index.d.ts +1 -1
  37. package/dist/src/hooks/useContainerWidth.d.ts +0 -1
  38. package/dist/src/models/ArtifactData.d.ts +0 -7
  39. package/dist/src/models/ChatSession.d.ts +0 -32
  40. package/dist/src/models/ClientMessage.d.ts +0 -4
  41. package/dist/src/models/ServerEvent.d.ts +0 -36
  42. package/dist/src/models/enums.d.ts +0 -1
  43. package/dist/src/models/index.d.ts +1 -2
  44. package/dist/src/models/interactionPartUtils.test.d.ts +1 -0
  45. package/dist/src/models/semanticKernelModel/sanitizeJsonString.test.d.ts +0 -0
  46. package/dist/src/models/serverEventDecode.test.d.ts +0 -0
  47. package/dist/src/services/WebSocketConnection/webSocketConnectionV2.reconnect.test.d.ts +0 -0
  48. package/dist/src/services/interactionService.d.ts +11 -0
  49. package/dist/src/services/interactionServiceGrouping.test.d.ts +1 -0
  50. package/dist/src/services/servers/AgentGatewayService.d.ts +25 -18
  51. package/dist/src/services/servers/AgentGatewayWSAsync.d.ts +0 -1
  52. package/dist/src/services/servers/agentGatewayAgentContext.test.d.ts +1 -0
  53. package/dist/src/services/storageService.d.ts +16 -59
  54. package/dist/src/services/storageService.test.d.ts +1 -0
  55. package/dist/src/utils/index.d.ts +2 -6
  56. package/dist/src/utils/urlParser.d.ts +0 -1
  57. package/dist/tests/fakes/fakeRawWebSocket.d.ts +51 -0
  58. package/dist/tests/fakes/fakeStorage.d.ts +7 -0
  59. package/dist/tests/fakes/makeGateway.d.ts +24 -1
  60. package/dist/{useChatSessions-BQP7DhY1.js → useChatSessions-CpHq0e1n.js} +2 -2
  61. package/dist/{useChatSessions-BQP7DhY1.js.map → useChatSessions-CpHq0e1n.js.map} +1 -1
  62. package/dist/useContainerWidth-B40_i-NW.js +295 -0
  63. package/dist/{useContainerWidth-B3t1ZTlo.js.map → useContainerWidth-B40_i-NW.js.map} +1 -1
  64. package/dist/utils.js +340 -57
  65. package/dist/utils.js.map +1 -1
  66. package/package.json +1 -1
  67. package/dist/Memory-DjLZqgbF.js +0 -84
  68. package/dist/Memory-DjLZqgbF.js.map +0 -1
  69. package/dist/atMentions-C0dza8DD.js +0 -1000
  70. package/dist/atMentions-C0dza8DD.js.map +0 -1
  71. package/dist/auth-lluJZyQO.js +0 -524
  72. package/dist/auth-lluJZyQO.js.map +0 -1
  73. package/dist/environmentUtils-CUVZ6Dq1.js +0 -478
  74. package/dist/environmentUtils-CUVZ6Dq1.js.map +0 -1
  75. package/dist/httpArtifactService-CpbRpTHb.js.map +0 -1
  76. package/dist/serializer-BXSH9aYQ.js +0 -1360
  77. package/dist/serializer-BXSH9aYQ.js.map +0 -1
  78. package/dist/src/components/AiChat/useLiveSession.d.ts +0 -52
  79. package/dist/src/utils/jsonDetector.d.ts +0 -50
  80. package/dist/src/utils/jsonUtils.d.ts +0 -1
  81. package/dist/src/utils/materialIconsSvg.d.ts +0 -51
  82. package/dist/src/utils/objectUtils.d.ts +0 -31
  83. package/dist/src/utils/parseArtifact.d.ts +0 -3
  84. package/dist/src/utils/uriUtils.d.ts +0 -39
  85. package/dist/useContainerWidth-B3t1ZTlo.js +0 -309
@@ -0,0 +1,1730 @@
1
+ var Gt = Object.defineProperty;
2
+ var $t = (s, t, i) => t in s ? Gt(s, t, { enumerable: !0, configurable: !0, writable: !0, value: i }) : s[t] = i;
3
+ var p = (s, t) => Gt(s, "name", { value: t, configurable: !0 });
4
+ var e = (s, t, i) => $t(s, typeof t != "symbol" ? t + "" : t, i);
5
+ import It from "@mui/icons-material/Psychology";
6
+ import L from "@mui/icons-material/FlashOn";
7
+ import At from "@mui/icons-material/RocketLaunch";
8
+ import Vt from "@mui/icons-material/GeneratingTokensOutlined";
9
+ import bt from "@mui/icons-material/SortByAlphaOutlined";
10
+ import Mt from "@mui/icons-material/AllInclusive";
11
+ import { d as vt, A as Qt } from "./environmentUtils-VZNTCzEE.js";
12
+ import { jsonMember as o, jsonObject as f, AnyT as q, jsonArrayMember as xt, TypedJSON as zt } from "typedjson";
13
+ const ue = {
14
+ ChatEvent: "ChatEvent",
15
+ ChatResponse: "ChatResponse",
16
+ ChatRequest: "ChatRequest"
17
+ }, de = {
18
+ Interactive: "interactive",
19
+ Autonomous: "autonomous"
20
+ }, me = {
21
+ SendMessage: "SendMessage",
22
+ Other: "Other",
23
+ Suspend: "Suspend",
24
+ Close: "Close",
25
+ Ping: "Ping",
26
+ AnswerHumanTool: "AnswerHumanTool"
27
+ }, l = {
28
+ FunctionCall: "function_call",
29
+ PartialFunctionCall: "partial_function_call",
30
+ FunctionResponse: "function_response",
31
+ // Persisted, client-only sibling carrying a tool's ToolClientOutput payload, keyed by call id.
32
+ // Folded into its call part on replay (never rendered on its own); the live turn delivers the
33
+ // same payload inline on the StreamingFinalFunctionResultContent result event.
34
+ FunctionClientOutput: "function_client_output",
35
+ // A user turn's rich UI representation (from UserUiContent). Carries functionDetails {name,args,
36
+ // isUi,status:'Done'} so it routes through the uiTool dispatcher/registry exactly like an
37
+ // agent-emitted UI tool — but authored by the user and rendered on the user side of the turn.
38
+ UserAnswer: "user_answer",
39
+ Video: "video",
40
+ Thought: "thought",
41
+ InlineData: "inline_data",
42
+ FileData: "file_data",
43
+ CodeExecutionResult: "code_execution_result",
44
+ ExecutableCode: "executable_code",
45
+ Other: "other",
46
+ Text: "text",
47
+ ToolEvent: "tool_event",
48
+ ServerError: "server_error",
49
+ NotDefined: "not_defined",
50
+ Waiting: "waiting",
51
+ Suspended: "suspended"
52
+ }, Zt = /* @__PURE__ */ p((s) => {
53
+ switch (s.toLocaleLowerCase()) {
54
+ case "functioncall":
55
+ return l.FunctionCall;
56
+ case "functionresponse":
57
+ return l.FunctionResponse;
58
+ // Streaming "final" call/result carry their own $type on the wire — map them like their collapsed
59
+ // KernelContent forms so the top-level event classifies as call/response, not NotDefined.
60
+ case "streamingfinalfunctioncallcontent":
61
+ return l.FunctionCall;
62
+ case "streamingfinalfunctionresultcontent":
63
+ return l.FunctionResponse;
64
+ case "text":
65
+ return l.Text;
66
+ case "streamingtextcontent":
67
+ return l.Text;
68
+ case "partialfunctioncall":
69
+ return l.PartialFunctionCall;
70
+ case "streamingfunctioncallupdatecontent":
71
+ return l.PartialFunctionCall;
72
+ case "streamingreasoningcontent":
73
+ return l.Thought;
74
+ case "functionclientoutputcontent":
75
+ return l.FunctionClientOutput;
76
+ case "streamingclientoutputcontent":
77
+ return l.FunctionClientOutput;
78
+ case "partialText":
79
+ return l.Text;
80
+ case "unknown":
81
+ return l.Other;
82
+ default:
83
+ return l.NotDefined;
84
+ }
85
+ }, "GetEventTypeFromDotNetName"), ge = {
86
+ [l.FunctionCall]: "Executing function call",
87
+ [l.FunctionResponse]: "Getting response",
88
+ [l.Video]: "Video",
89
+ [l.Thought]: "Thought",
90
+ [l.InlineData]: "InlineData",
91
+ [l.FileData]: "FileData",
92
+ [l.CodeExecutionResult]: "Coding...",
93
+ [l.ExecutableCode]: "Coding...",
94
+ [l.Other]: "Other",
95
+ [l.Text]: "Text",
96
+ [l.NotDefined]: "NotDefined"
97
+ }, fe = {
98
+ Regular: "Regular",
99
+ Artifact: "Artifact"
100
+ }, ye = {
101
+ User: "User",
102
+ Agent: "Agent",
103
+ System: "System"
104
+ }, he = {
105
+ Dashboard: "Dashboard",
106
+ Chart: "Chart",
107
+ Code: "Code"
108
+ }, Et = {
109
+ BI_Envision_Agent: "BI_Envision_Agent",
110
+ BI_Master_Customer_Agent: "BI_Master_Customer_Agent",
111
+ BI_Dedicated_Customer_Agent: "BI_Dedicated_Customer_Agent",
112
+ Unknown: "Unknown"
113
+ }, Se = {
114
+ Interactive: "Interactive",
115
+ Newsletter: "Newsletter"
116
+ }, Ce = {
117
+ [Et.BI_Envision_Agent]: {
118
+ name: "Envision",
119
+ description: `Analisa dados de vendas globais
120
+ com insights consolidados de todos os clientes
121
+ e métricas agregadas do mercado`
122
+ },
123
+ [Et.BI_Master_Customer_Agent]: {
124
+ name: "Clientes Master",
125
+ description: `Visão consolidada de todos os clientes
126
+ com análises comparativas e benchmarks
127
+ entre diferentes organizações`
128
+ },
129
+ [Et.BI_Dedicated_Customer_Agent]: {
130
+ name: "Cliente Único",
131
+ description: `Foco em um cliente específico
132
+ com análises detalhadas e personalizadas
133
+ para sua organização`
134
+ },
135
+ [Et.Unknown]: {
136
+ name: "Não definido",
137
+ description: "Não definido"
138
+ }
139
+ }, xe = {
140
+ FAST: "FAST",
141
+ BALANCED: "BALANCED",
142
+ PRO: "PRO",
143
+ LIVE: "LIVE"
144
+ }, S = {
145
+ gemini_3_5_flash: "gemini-3.5-flash",
146
+ gemini_3_1_pro_preview: "gemini-3.1-pro-preview",
147
+ gemini_3_1_flash_lite_preview: "gemini-3.1-flash-lite-preview",
148
+ Gemini_live_2_5_flash_preview: "gemini-live-2.5-flash-lite",
149
+ Claude_Sonnet_4_6: "claude-sonnet-4-6",
150
+ Claude_Opus_4_6: "claude-opus-4-6",
151
+ Gpt_5_1: "gpt-5.1",
152
+ Gpt_5_2: "gpt-5.2",
153
+ Gpt_5_5: "gpt-5.5-2026-04-23",
154
+ Gpt_5_4_mini: "gpt-5.4-mini",
155
+ "Glm-5_2": "Glm-5.2",
156
+ "Glm_4.7": "Glm-4.7",
157
+ "Glm_4.7_flash": "Glm-4.7-Flash",
158
+ Kimi_K26: "kimi-k2.6",
159
+ Kimi_Turbo: "kimi-k2-turbo-preview",
160
+ DeepSeek_v4_Pro: "deepseek-v4-pro",
161
+ "DeepSeek_v4-Flash": "deepseek-v4-flash",
162
+ "Qwen3_6-plus": "qwen3.6-plus",
163
+ "Qwen3_7-max": "qwen3.7-max",
164
+ CorporateTravelDashboard: "CorporateTravelDashboard",
165
+ ShowGuideDemo: "ShowGuideDemo",
166
+ uiToolShowcase: "uiToolShowcase",
167
+ AUTO: "AUTO"
168
+ }, Te = {
169
+ [S.Claude_Opus_4_6]: {
170
+ name: "Claude Opus 4.6",
171
+ description: "Modelo mais avançado da anthropic, no entanto, não tão rápido como o Sonnet",
172
+ icon: Mt,
173
+ contextWindow: "1M tokens",
174
+ speed: "Moderate",
175
+ quality: "Highest"
176
+ },
177
+ [S.Claude_Sonnet_4_6]: {
178
+ name: "Claude Sonnet 4.6",
179
+ description: "Ótima relação velocidade/qualidade",
180
+ icon: Mt,
181
+ contextWindow: "1M tokens",
182
+ speed: "Fast",
183
+ quality: "High"
184
+ },
185
+ [S.gemini_3_1_pro_preview]: {
186
+ name: "Gemini 3.1 Pro",
187
+ description: `Modelo mais avançado
188
+ Melhor qualidade para tarefas complexas
189
+ Contexto: 2M tokens`,
190
+ icon: It,
191
+ contextWindow: "2M tokens",
192
+ speed: "Moderate",
193
+ quality: "Highest"
194
+ },
195
+ [S.gemini_3_5_flash]: {
196
+ name: "Gemini 3.5 Flash",
197
+ description: `Equilibrio ideal entre velocidade e qualidade
198
+ Ótimo para a maioria das tarefas
199
+ Contexto: 1M tokens`,
200
+ icon: L,
201
+ contextWindow: "1M tokens",
202
+ speed: "Fast",
203
+ quality: "High"
204
+ },
205
+ [S.gemini_3_1_flash_lite_preview]: {
206
+ name: "Gemini 3 Lite Flash",
207
+ description: `NOVO: Equilibrio ideal entre velocidade e qualidade
208
+ Ótimo para a maioria das tarefas
209
+ Contexto: 1M tokens`,
210
+ icon: L,
211
+ contextWindow: "1M tokens",
212
+ speed: "Fast",
213
+ quality: "High"
214
+ },
215
+ [S.Gpt_5_1]: {
216
+ name: "Chat GPT 5.1",
217
+ description: "Chat GPT 5.1",
218
+ icon: At,
219
+ contextWindow: "200k tokens",
220
+ speed: "Good",
221
+ quality: "High"
222
+ },
223
+ [S.Gpt_5_2]: {
224
+ name: "Chat GPT 5.2",
225
+ description: "Chat GPT 5.2",
226
+ icon: At,
227
+ contextWindow: "200k tokens",
228
+ speed: "Good",
229
+ quality: "Highest"
230
+ },
231
+ [S.Gpt_5_5]: {
232
+ name: "Chat GPT 5.5",
233
+ description: "A melhor inteligência em escala para fluxos de trabalho de agentes, codificação e profissionais.",
234
+ icon: At,
235
+ contextWindow: "200k tokens",
236
+ speed: "Good",
237
+ quality: "Highest"
238
+ },
239
+ [S.Gpt_5_4_mini]: {
240
+ name: "Chat GPT 5.4 Mini",
241
+ description: "Modelo compacto mais robusto da OpenAi até momento para codificação, uso de computadores e subagentes.",
242
+ icon: At,
243
+ contextWindow: "200k tokens",
244
+ speed: "Fast",
245
+ quality: "Highest"
246
+ },
247
+ [S["Glm-5_2"]]: {
248
+ name: "Z.ai Glm-5",
249
+ description: "Modelo open weights bem competente da Z.Ai. Apesar de gerar respostas mais longas o modelo é muito capaz.",
250
+ icon: bt,
251
+ contextWindow: "200k tokens",
252
+ speed: "Good",
253
+ quality: "Highest"
254
+ },
255
+ [S["Glm_4.7"]]: {
256
+ name: "Z.ai Glm-4.7",
257
+ description: "",
258
+ icon: bt,
259
+ contextWindow: "200k tokens",
260
+ speed: "Fast",
261
+ quality: "High"
262
+ },
263
+ [S["Glm_4.7_flash"]]: {
264
+ name: "Z.ai Glm-4.7",
265
+ description: "",
266
+ icon: bt,
267
+ contextWindow: "200k tokens",
268
+ speed: "Good",
269
+ quality: "High"
270
+ },
271
+ [S.DeepSeek_v4_Pro]: {
272
+ name: "DeepSeek Reasoner",
273
+ description: `Modelo da DeepSeek com modo de raciocínio profundo (thinking mode).
274
+ Ideal para tarefas complexas que se beneficiam de cadeia de pensamento extensa.`,
275
+ icon: It,
276
+ contextWindow: "128k tokens",
277
+ speed: "Moderate",
278
+ quality: "Highest"
279
+ },
280
+ [S["DeepSeek_v4-Flash"]]: {
281
+ name: "DeepSeek Chat",
282
+ description: `Modelo de chat rápido da DeepSeek, sem modo de raciocínio.
283
+ Ótimo equilíbrio entre velocidade e qualidade para uso geral.`,
284
+ icon: L,
285
+ contextWindow: "128k tokens",
286
+ speed: "Fast",
287
+ quality: "High"
288
+ },
289
+ [S.Kimi_K26]: {
290
+ name: "Kimi K2.6 Pro",
291
+ description: `Modelo híbrido da Moonshot com modo de raciocínio (thinking) ativado por padrão.
292
+ Melhor capacidade da família K2 para tarefas complexas.`,
293
+ icon: It,
294
+ contextWindow: "256k tokens",
295
+ speed: "Moderate",
296
+ quality: "Highest"
297
+ },
298
+ [S.Kimi_Turbo]: {
299
+ name: "Kimi K2 Turbo",
300
+ description: `Variante rápida (não-thinking) da Moonshot.
301
+ Ótima relação velocidade/qualidade para uso geral.`,
302
+ icon: L,
303
+ contextWindow: "256k tokens",
304
+ speed: "Fast",
305
+ quality: "High"
306
+ },
307
+ [S["Qwen3_6-plus"]]: {
308
+ name: "Qwen 3.6 Plus - Alibaba",
309
+ description: "Multimodal nativo, context window - 1 milhão de tokens, codificação agentiva",
310
+ icon: L,
311
+ contextWindow: "1 milhão",
312
+ speed: "Moderate",
313
+ quality: "Highest"
314
+ },
315
+ [S["Qwen3_7-max"]]: {
316
+ name: "Qwen 3.7 Max - Alibaba",
317
+ description: "Multimodal nativo, context window - 1 milhão de tokens, codificação agentiva",
318
+ icon: L,
319
+ contextWindow: "1 milhão",
320
+ speed: "Moderate",
321
+ quality: "Highest"
322
+ },
323
+ [S.uiToolShowcase]: {
324
+ name: "UiToolShowcase - Testing",
325
+ description: "Cria um stream de testes.",
326
+ icon: Vt,
327
+ contextWindow: "256k tokens",
328
+ speed: "Fast",
329
+ quality: "High"
330
+ }
331
+ };
332
+ function De(s) {
333
+ if (!s) return "Unknown";
334
+ const t = s.toLowerCase();
335
+ return t.startsWith("gemini") || t.startsWith("live") ? "Google" : t.startsWith("claude") ? "Anthropic" : t.startsWith("gpt") ? "OpenAI" : t.startsWith("glm") ? "ZhiPu" : t.startsWith("kimi") ? "Moonshot" : t.startsWith("deepseek") ? "DeepSeek" : "Unknown";
336
+ }
337
+ p(De, "getModelVendor");
338
+ const _e = /* @__PURE__ */ p((s, t) => {
339
+ switch (s) {
340
+ case "Connected":
341
+ return t.palette.primary.light;
342
+ case "Paused":
343
+ return t.palette.warning.light;
344
+ case "Disconnected":
345
+ return t.palette.text.secondary;
346
+ case "Connecting":
347
+ return t.palette.success.dark;
348
+ case "Unknown":
349
+ return t.palette.text.secondary;
350
+ default:
351
+ return t.palette.text.secondary;
352
+ }
353
+ }, "getConnectionStateColor"), U = class U {
354
+ static replaceFirstTwoTabsPerLine(t) {
355
+ const i = /^\s{15}/gm;
356
+ return typeof t == "string" ? t.replaceAll(i, (a) => a.substring(15)) : t ?? "";
357
+ }
358
+ static jsonToString(t) {
359
+ if (t == null) return "";
360
+ if (typeof t != "object") return String(t);
361
+ const i = Array.isArray(t) ? U.isCharArray(t) ? t.join("") : null : U.tryCollapseCharIndexedObject(t);
362
+ if (i != null) return i;
363
+ if (Array.isArray(t))
364
+ try {
365
+ return JSON.stringify(t, null, 2);
366
+ } catch {
367
+ return String(t);
368
+ }
369
+ const a = Object.keys(t), r = [];
370
+ return a.forEach((c) => {
371
+ let d = t[c];
372
+ typeof d == "object" && (d = JSON.stringify(t[c], null, 2));
373
+ const g = (d == null ? void 0 : d.toString().indexOf(`
374
+ `)) > -1 ? `
375
+ ` : "";
376
+ r.push(`${c}:${g}${d}`);
377
+ }), r.join(`
378
+ `);
379
+ }
380
+ static functionDetailsToString(t) {
381
+ if (t == null) return "";
382
+ if (typeof t == "string") {
383
+ t = t.replaceAll('"{', "{").replaceAll('}"', "}").replaceAll("'{", "{").replaceAll("}'", "}"), t = t.replaceAll('\\"', '"');
384
+ try {
385
+ t = JSON.parse(t);
386
+ } catch {
387
+ return t;
388
+ }
389
+ if (typeof t != "object" || t == null) return String(t);
390
+ }
391
+ if (Array.isArray(t))
392
+ try {
393
+ return JSON.stringify(t, null, 2);
394
+ } catch {
395
+ return String(t);
396
+ }
397
+ const i = Object.keys(t), a = [];
398
+ return i.forEach((r) => {
399
+ let c = t == null ? void 0 : t[r];
400
+ typeof c == "object" && (c = JSON.stringify(c, null, 2));
401
+ const d = (c == null ? void 0 : c.toString().indexOf(`
402
+ `)) > -1 ? `
403
+ ` : "";
404
+ a.push(`${r}:${d}${c}`);
405
+ }), a.join(`
406
+ `);
407
+ }
408
+ /**
409
+ * Reads the server-generated SlotId from a UI render tool's result. The
410
+ * result reaches the client as a plain object on the live path, but as a
411
+ * JSON string — sometimes double-encoded (a JSON string of a JSON string) —
412
+ * on the persisted / session-replay path. Unwrap up to two string layers
413
+ * before reading the field. Returns undefined when absent or unparseable.
414
+ */
415
+ static uiSlotId(t) {
416
+ var c;
417
+ let i = (c = t == null ? void 0 : t.functionDetails) == null ? void 0 : c.response;
418
+ for (let d = 0; d < 2 && typeof i == "string"; d++)
419
+ try {
420
+ i = JSON.parse(i);
421
+ } catch {
422
+ return;
423
+ }
424
+ if (!i || typeof i != "object") return;
425
+ const a = i, r = a.SlotId ?? a.slotId;
426
+ return typeof r == "string" ? r : void 0;
427
+ }
428
+ static fromError(t) {
429
+ return {
430
+ errorDetails: { errorMessage: t },
431
+ eventType: l.ServerError,
432
+ id: "",
433
+ author: "main",
434
+ created: /* @__PURE__ */ new Date(),
435
+ partial: !1,
436
+ isStillWriting: !1,
437
+ mustPush: !1,
438
+ textAppendable: !1
439
+ };
440
+ }
441
+ static fromText(t, i, a) {
442
+ return {
443
+ text: t,
444
+ eventType: l.Text,
445
+ id: a ?? vt(),
446
+ created: /* @__PURE__ */ new Date(),
447
+ author: i ?? "main",
448
+ partial: !1,
449
+ isStillWriting: !1,
450
+ mustPush: !1,
451
+ textAppendable: !1
452
+ };
453
+ }
454
+ /**
455
+ * Builds the user-authored UI part for a `sendMessage(text, { ui })` turn. Mirrors the
456
+ * shape `ServerEvent` produces from a persisted `UserUiContent` on reload, so the live
457
+ * and replayed parts are identical: an `EventType.UserAnswer` carrying functionDetails
458
+ * {name, args, isUi, status:'Done'} that routes through the uiTool dispatcher/registry.
459
+ */
460
+ static fromUserUi(t, i, a) {
461
+ return {
462
+ id: a ?? vt(),
463
+ eventType: l.UserAnswer,
464
+ author: "user",
465
+ created: /* @__PURE__ */ new Date(),
466
+ partial: !1,
467
+ isStillWriting: !1,
468
+ mustPush: !1,
469
+ textAppendable: !1,
470
+ functionDetails: {
471
+ id: "",
472
+ name: t,
473
+ args: i,
474
+ status: "Done",
475
+ isUi: !0
476
+ }
477
+ };
478
+ }
479
+ static createWaiting(t = !1, i = !0, a, r, c) {
480
+ a || (a = "Waiting");
481
+ const d = U.fromText("...", void 0, "waitingpart");
482
+ return d.eventType = l.Waiting, d.waitingDetails = {
483
+ startingPoint: r,
484
+ addTimer: t,
485
+ isTimerRunning: i,
486
+ status: a,
487
+ stopPoint: c
488
+ }, d;
489
+ }
490
+ static createSuspended() {
491
+ const t = U.fromText("SUSPEND");
492
+ return t.eventType = l.Suspended, t;
493
+ }
494
+ static getPartTextContent(t) {
495
+ return t.text ?? "";
496
+ }
497
+ static FlatParts(t) {
498
+ if (t.length === 0)
499
+ return;
500
+ const i = t.filter((c) => c.eventType == l.Text), a = i.length > 0 ? i[0] : t[0], r = [...new Set(t.map((c) => c.eventType))];
501
+ r.length == 1 ? a.eventType = r[0] : i.length > 0 && (a.eventType = l.Text), a.mustPush = !(a.eventType == l.Text || a.eventType == l.Thought || a.eventType == l.NotDefined || a.eventType == l.PartialFunctionCall), a.textAppendable = a.eventType == l.Text || a.eventType == l.Thought || a.eventType == l.PartialFunctionCall;
502
+ for (const c of t) {
503
+ if (!a.codeExecutionResultDetails && c.codeExecutionResultDetails && (a.codeExecutionResultDetails = c.codeExecutionResultDetails), !a.errorDetails && c.errorDetails && (a.errorDetails = c.errorDetails), !a.executableCodeDetails && c.executableCodeDetails && (a.executableCodeDetails = c.executableCodeDetails), !a.functionDetails && c.functionDetails && (a.functionDetails = c.functionDetails), a.functionDetails && c.functionDetails && c !== a) {
504
+ const d = a.functionDetails, g = c.functionDetails;
505
+ !d.askUserComponent && g.askUserComponent && (d.askUserComponent = g.askUserComponent), !d.isUi && g.isUi && (d.isUi = !0), !d.clientOutput && g.clientOutput && (d.clientOutput = g.clientOutput), d.isAskUser = d.isAskUser || g.isAskUser || !!d.askUserComponent;
506
+ }
507
+ !a.rawDetails && c.rawDetails && (a.rawDetails = c.rawDetails), !a.thoughtDetails && c.thoughtDetails && (a.thoughtDetails = c.thoughtDetails), !a.errorDetails && c.errorDetails && (a.errorDetails = c.errorDetails);
508
+ }
509
+ return a;
510
+ }
511
+ static isCharArray(t) {
512
+ return Array.isArray(t) && t.length > 0 && t.every((i) => typeof i == "string" && i.length === 1);
513
+ }
514
+ /**
515
+ * Detects objects like `{0: "a", 1: "b", 2: "c", ...}` — a string that was
516
+ * spread/indexed into an object (e.g. `{...someString}` or the server
517
+ * serializing a string as a char-indexed dict). Returns the reassembled
518
+ * string, or `null` if the value doesn't match this pattern.
519
+ */
520
+ static tryCollapseCharIndexedObject(t) {
521
+ if (t == null || typeof t != "object" || Array.isArray(t)) return null;
522
+ const i = Object.keys(t);
523
+ if (i.length === 0) return null;
524
+ for (let a = 0; a < i.length; a++) {
525
+ if (i[a] !== String(a)) return null;
526
+ const r = t[i[a]];
527
+ if (typeof r != "string" || r.length !== 1) return null;
528
+ }
529
+ return i.map((a) => t[a]).join("");
530
+ }
531
+ static isCodeExecution(t) {
532
+ return t.eventType === l.CodeExecutionResult || t.eventType === l.ExecutableCode;
533
+ }
534
+ };
535
+ p(U, "InteractionPartUtils");
536
+ let Nt = U;
537
+ var Yt = Object.defineProperty, Xt = Object.getOwnPropertyDescriptor, n = /* @__PURE__ */ p((s, t, i, a) => {
538
+ for (var r = a > 1 ? void 0 : a ? Xt(t, i) : t, c = s.length - 1, d; c >= 0; c--)
539
+ (d = s[c]) && (r = (a ? d(t, i, r) : d(r)) || r);
540
+ return a && r && Yt(t, i, r), r;
541
+ }, "__decorateClass");
542
+ const x = {
543
+ // KernelContent derived types
544
+ TextContent: "TextContent",
545
+ ToolEventContent: "ToolEventContent",
546
+ StreamingToolEventContent: "StreamingToolEventContent",
547
+ StreamingReasoningContent: "StreamingReasoningContent",
548
+ FunctionCallContent: "FunctionCallContent",
549
+ FunctionResultContent: "FunctionResultContent",
550
+ FunctionClientOutputContent: "FunctionClientOutputContent",
551
+ UserUiContent: "UserUiContent",
552
+ // StreamingKernelContent derived types
553
+ StreamingTextContent: "StreamingTextContent",
554
+ StreamingFunctionCallUpdateContent: "StreamingFunctionCallUpdateContent",
555
+ StreamingFinalFunctionCallContent: "StreamingFinalFunctionCallContent",
556
+ StreamingFinalFunctionResultContent: "StreamingFinalFunctionResultContent",
557
+ StreamingClientOutputContent: "StreamingClientOutputContent"
558
+ };
559
+ var H;
560
+ let Dt = (H = class {
561
+ constructor() {
562
+ e(this, "label");
563
+ }
564
+ }, p(H, "AuthorRole"), H);
565
+ n([
566
+ o(String)
567
+ ], Dt.prototype, "label", 2);
568
+ Dt = n([
569
+ f({ name: "AuthorRole" })
570
+ ], Dt);
571
+ var B;
572
+ let yt = (B = class {
573
+ constructor() {
574
+ e(this, "type");
575
+ e(this, "fullName");
576
+ }
577
+ }, p(B, "EventTypeInformation"), B);
578
+ n([
579
+ o(String)
580
+ ], yt.prototype, "type", 2);
581
+ n([
582
+ o(String)
583
+ ], yt.prototype, "fullName", 2);
584
+ yt = n([
585
+ f({ name: "EventTypeInformation" })
586
+ ], yt);
587
+ var K;
588
+ let O = (K = class {
589
+ constructor() {
590
+ e(this, "id");
591
+ e(this, "name");
592
+ e(this, "mimeType");
593
+ e(this, "description");
594
+ }
595
+ toArtifact() {
596
+ return {
597
+ created: /* @__PURE__ */ new Date(),
598
+ updatedAt: /* @__PURE__ */ new Date(),
599
+ name: this.name ?? "Not Defined",
600
+ description: this.description,
601
+ mimeType: this.mimeType,
602
+ id: this.id
603
+ };
604
+ }
605
+ }, p(K, "LlmArtifact"), K);
606
+ n([
607
+ o(String)
608
+ ], O.prototype, "id", 2);
609
+ n([
610
+ o(String)
611
+ ], O.prototype, "name", 2);
612
+ n([
613
+ o(String)
614
+ ], O.prototype, "mimeType", 2);
615
+ n([
616
+ o(String)
617
+ ], O.prototype, "description", 2);
618
+ O = n([
619
+ f({ name: "LlmArtifact" })
620
+ ], O);
621
+ var J;
622
+ let T = (J = class {
623
+ constructor() {
624
+ e(this, "mimeType");
625
+ // InnerContent is ignored (JsonIgnore in C#)
626
+ // Not decorated with @jsonMember
627
+ e(this, "innerContent");
628
+ e(this, "modelId");
629
+ e(this, "metadata");
630
+ }
631
+ }, p(J, "KernelContent"), J);
632
+ n([
633
+ o(String)
634
+ ], T.prototype, "mimeType", 2);
635
+ n([
636
+ o(String)
637
+ ], T.prototype, "modelId", 2);
638
+ n([
639
+ o(q)
640
+ ], T.prototype, "metadata", 2);
641
+ T = n([
642
+ f({ name: "KernelContent" })
643
+ ], T);
644
+ var $;
645
+ let D = ($ = class {
646
+ constructor() {
647
+ e(this, "choiceIndex", 0);
648
+ // InnerContent is ignored (JsonIgnore in C#)
649
+ // Not decorated with @jsonMember
650
+ e(this, "innerContent");
651
+ e(this, "modelId");
652
+ e(this, "metadata");
653
+ }
654
+ }, p($, "StreamingKernelContent"), $);
655
+ n([
656
+ o(Number)
657
+ ], D.prototype, "choiceIndex", 2);
658
+ n([
659
+ o(String)
660
+ ], D.prototype, "modelId", 2);
661
+ n([
662
+ o(Object)
663
+ ], D.prototype, "metadata", 2);
664
+ D = n([
665
+ f({ name: "StreamingKernelContent" })
666
+ ], D);
667
+ var V;
668
+ let _t = (V = class extends T {
669
+ constructor() {
670
+ super();
671
+ e(this, "text");
672
+ // Encoding is ignored (JsonIgnore in C#)
673
+ // Not decorated with @jsonMember
674
+ e(this, "encoding");
675
+ this.encoding = "UTF8";
676
+ }
677
+ toString() {
678
+ return this.text ?? "";
679
+ }
680
+ }, p(V, "TextContent"), V);
681
+ n([
682
+ o(String)
683
+ ], _t.prototype, "text", 2);
684
+ _t = n([
685
+ f({ name: "TextContent" })
686
+ ], _t);
687
+ var Q;
688
+ let P = (Q = class extends D {
689
+ constructor() {
690
+ super();
691
+ e(this, "eventName");
692
+ e(this, "eventData");
693
+ e(this, "sessionId");
694
+ }
695
+ }, p(Q, "StreamingToolEventContent"), Q);
696
+ n([
697
+ o(String)
698
+ ], P.prototype, "eventName", 2);
699
+ n([
700
+ o(String)
701
+ ], P.prototype, "eventData", 2);
702
+ n([
703
+ o(String)
704
+ ], P.prototype, "sessionId", 2);
705
+ P = n([
706
+ f({ name: "StreamingToolEventContent" })
707
+ ], P);
708
+ var Z;
709
+ let R = (Z = class extends T {
710
+ constructor() {
711
+ super();
712
+ e(this, "eventName");
713
+ e(this, "eventData");
714
+ e(this, "sessionId");
715
+ }
716
+ }, p(Z, "ToolEventContent"), Z);
717
+ n([
718
+ o(String)
719
+ ], R.prototype, "eventName", 2);
720
+ n([
721
+ o(String)
722
+ ], R.prototype, "eventData", 2);
723
+ n([
724
+ o(String)
725
+ ], R.prototype, "sessionId", 2);
726
+ R = n([
727
+ f({ name: "ToolEventContent" })
728
+ ], R);
729
+ var Y;
730
+ let wt = (Y = class extends T {
731
+ constructor() {
732
+ super(...arguments);
733
+ e(this, "url");
734
+ e(this, "dataUri");
735
+ }
736
+ }, p(Y, "ImageContent"), Y);
737
+ n([
738
+ o(String)
739
+ ], wt.prototype, "url", 2);
740
+ n([
741
+ o(String)
742
+ ], wt.prototype, "dataUri", 2);
743
+ wt = n([
744
+ f({ name: "ImageContent" })
745
+ ], wt);
746
+ var X;
747
+ let v = (X = class extends T {
748
+ constructor() {
749
+ super(...arguments);
750
+ e(this, "id");
751
+ e(this, "pluginName");
752
+ e(this, "functionName");
753
+ e(this, "arguments");
754
+ // Exception is not serializable - omit jsonMember decorator
755
+ e(this, "exception");
756
+ }
757
+ }, p(X, "FunctionCallContent"), X);
758
+ n([
759
+ o(String)
760
+ ], v.prototype, "id", 2);
761
+ n([
762
+ o(String)
763
+ ], v.prototype, "pluginName", 2);
764
+ n([
765
+ o(String)
766
+ ], v.prototype, "functionName", 2);
767
+ n([
768
+ o(q)
769
+ ], v.prototype, "arguments", 2);
770
+ v = n([
771
+ f({ name: "FunctionCallContent" })
772
+ ], v);
773
+ var j;
774
+ let F = (j = class {
775
+ constructor() {
776
+ e(this, "isUi");
777
+ e(this, "askUserComponent");
778
+ e(this, "argsDescription");
779
+ e(this, "cancelUi");
780
+ e(this, "parked");
781
+ }
782
+ }, p(j, "ToolCallPresentation"), j);
783
+ n([
784
+ o(Boolean)
785
+ ], F.prototype, "isUi", 2);
786
+ n([
787
+ o(String)
788
+ ], F.prototype, "askUserComponent", 2);
789
+ n([
790
+ o(String)
791
+ ], F.prototype, "argsDescription", 2);
792
+ n([
793
+ o(Boolean)
794
+ ], F.prototype, "cancelUi", 2);
795
+ n([
796
+ o(Boolean)
797
+ ], F.prototype, "parked", 2);
798
+ F = n([
799
+ f({ name: "ToolCallPresentation" })
800
+ ], F);
801
+ const jt = "aia:presentation";
802
+ var tt;
803
+ let I = (tt = class extends D {
804
+ constructor() {
805
+ super(...arguments);
806
+ e(this, "id");
807
+ e(this, "functionName");
808
+ e(this, "arguments");
809
+ e(this, "presentation");
810
+ }
811
+ }, p(tt, "StreamingFinalFunctionCallContent"), tt);
812
+ n([
813
+ o(String, { name: "callId" })
814
+ ], I.prototype, "id", 2);
815
+ n([
816
+ o(String, { name: "name" })
817
+ ], I.prototype, "functionName", 2);
818
+ n([
819
+ o(String)
820
+ ], I.prototype, "arguments", 2);
821
+ n([
822
+ o(F)
823
+ ], I.prototype, "presentation", 2);
824
+ I = n([
825
+ f({ name: "StreamingFinalFunctionCallContent" })
826
+ ], I);
827
+ var et;
828
+ let b = (et = class extends T {
829
+ constructor() {
830
+ super(...arguments);
831
+ e(this, "id");
832
+ e(this, "pluginName");
833
+ e(this, "functionName");
834
+ e(this, "result");
835
+ }
836
+ }, p(et, "FunctionResultContent"), et);
837
+ n([
838
+ o(String, { name: "callId" })
839
+ ], b.prototype, "id", 2);
840
+ n([
841
+ o(String)
842
+ ], b.prototype, "pluginName", 2);
843
+ n([
844
+ o(String)
845
+ ], b.prototype, "functionName", 2);
846
+ n([
847
+ o(q)
848
+ ], b.prototype, "result", 2);
849
+ b = n([
850
+ f({ name: "FunctionResultContent" })
851
+ ], b);
852
+ var nt;
853
+ let A = (nt = class extends D {
854
+ constructor() {
855
+ super(...arguments);
856
+ e(this, "id");
857
+ e(this, "pluginName");
858
+ e(this, "functionName");
859
+ e(this, "result");
860
+ e(this, "presentation");
861
+ e(this, "clientOutput");
862
+ }
863
+ }, p(nt, "StreamingFinalFunctionResultContent"), nt);
864
+ n([
865
+ o(String, { name: "callId" })
866
+ ], A.prototype, "id", 2);
867
+ n([
868
+ o(String)
869
+ ], A.prototype, "pluginName", 2);
870
+ n([
871
+ o(String)
872
+ ], A.prototype, "functionName", 2);
873
+ n([
874
+ o(q)
875
+ ], A.prototype, "result", 2);
876
+ n([
877
+ o(F)
878
+ ], A.prototype, "presentation", 2);
879
+ n([
880
+ o(q)
881
+ ], A.prototype, "clientOutput", 2);
882
+ A = n([
883
+ f({ name: "StreamingFinalFunctionResultContent" })
884
+ ], A);
885
+ var it;
886
+ let ht = (it = class extends T {
887
+ constructor() {
888
+ super(...arguments);
889
+ e(this, "id");
890
+ e(this, "data");
891
+ }
892
+ }, p(it, "FunctionClientOutputContent"), it);
893
+ n([
894
+ o(String, { name: "callId" })
895
+ ], ht.prototype, "id", 2);
896
+ n([
897
+ o(q)
898
+ ], ht.prototype, "data", 2);
899
+ ht = n([
900
+ f({ name: "FunctionClientOutputContent" })
901
+ ], ht);
902
+ var ot;
903
+ let G = (ot = class extends D {
904
+ constructor() {
905
+ super(...arguments);
906
+ e(this, "id");
907
+ e(this, "clientOutput");
908
+ e(this, "presentation");
909
+ }
910
+ }, p(ot, "StreamingClientOutputContent"), ot);
911
+ n([
912
+ o(String, { name: "callId" })
913
+ ], G.prototype, "id", 2);
914
+ n([
915
+ o(q)
916
+ ], G.prototype, "clientOutput", 2);
917
+ n([
918
+ o(F)
919
+ ], G.prototype, "presentation", 2);
920
+ G = n([
921
+ f({ name: "StreamingClientOutputContent" })
922
+ ], G);
923
+ var at;
924
+ let St = (at = class extends T {
925
+ constructor() {
926
+ super(...arguments);
927
+ e(this, "name");
928
+ e(this, "args");
929
+ }
930
+ }, p(at, "UserUiContent"), at);
931
+ n([
932
+ o(String)
933
+ ], St.prototype, "name", 2);
934
+ n([
935
+ o(String)
936
+ ], St.prototype, "args", 2);
937
+ St = n([
938
+ f({ name: "UserUiContent" })
939
+ ], St);
940
+ var rt;
941
+ let Ct = (rt = class extends T {
942
+ constructor() {
943
+ super(...arguments);
944
+ e(this, "role");
945
+ e(this, "items");
946
+ }
947
+ }, p(rt, "ChatMessageContent"), rt);
948
+ n([
949
+ o(Dt)
950
+ ], Ct.prototype, "role", 2);
951
+ n([
952
+ xt(() => T)
953
+ ], Ct.prototype, "items", 2);
954
+ Ct = n([
955
+ f({ name: "ChatMessageContent" })
956
+ ], Ct);
957
+ var st;
958
+ let N = (st = class extends D {
959
+ constructor() {
960
+ super(...arguments);
961
+ e(this, "callId");
962
+ e(this, "name");
963
+ e(this, "arguments");
964
+ e(this, "functionCallIndex", 0);
965
+ }
966
+ }, p(st, "StreamingFunctionCallUpdateContent"), st);
967
+ n([
968
+ o(String)
969
+ ], N.prototype, "callId", 2);
970
+ n([
971
+ o(String)
972
+ ], N.prototype, "name", 2);
973
+ n([
974
+ o(String)
975
+ ], N.prototype, "arguments", 2);
976
+ n([
977
+ o(Number)
978
+ ], N.prototype, "functionCallIndex", 2);
979
+ N = n([
980
+ f({ name: "StreamingFunctionCallUpdateContent" })
981
+ ], N);
982
+ var lt;
983
+ let kt = (lt = class extends D {
984
+ constructor() {
985
+ super(...arguments);
986
+ e(this, "text");
987
+ // Encoding is not explicitly serialized in C#
988
+ // Not decorated with @jsonMember
989
+ e(this, "encoding");
990
+ }
991
+ }, p(lt, "StreamingTextContent"), lt);
992
+ n([
993
+ o(String)
994
+ ], kt.prototype, "text", 2);
995
+ kt = n([
996
+ f({ name: "StreamingTextContent" })
997
+ ], kt);
998
+ var ct;
999
+ let Ft = (ct = class extends D {
1000
+ constructor() {
1001
+ super(...arguments);
1002
+ e(this, "text");
1003
+ // Encoding is not explicitly serialized in C#
1004
+ // Not decorated with @jsonMember
1005
+ e(this, "encoding");
1006
+ }
1007
+ }, p(ct, "StreamingReasoningContent"), ct);
1008
+ n([
1009
+ o(String)
1010
+ ], Ft.prototype, "text", 2);
1011
+ Ft = n([
1012
+ f({ name: "StreamingReasoningContent" })
1013
+ ], Ft);
1014
+ var pt;
1015
+ let M = (pt = class {
1016
+ constructor() {
1017
+ e(this, "instructionCategory", "");
1018
+ e(this, "description", "");
1019
+ e(this, "interactionId", "");
1020
+ }
1021
+ }, p(pt, "InstructionSummary"), pt);
1022
+ n([
1023
+ o(String)
1024
+ ], M.prototype, "instructionCategory", 2);
1025
+ n([
1026
+ o(String)
1027
+ ], M.prototype, "description", 2);
1028
+ n([
1029
+ o(String)
1030
+ ], M.prototype, "interactionId", 2);
1031
+ M = n([
1032
+ f({ name: "InstructionSummary" })
1033
+ ], M);
1034
+ var ut;
1035
+ let w = (ut = class {
1036
+ constructor() {
1037
+ e(this, "size", 0);
1038
+ e(this, "originalSize", 0);
1039
+ e(this, "ratio", 0);
1040
+ e(this, "previousRatio", 0);
1041
+ e(this, "threshold", 0);
1042
+ e(this, "maxSize", 0);
1043
+ e(this, "id");
1044
+ e(this, "instructionSummaries", []);
1045
+ }
1046
+ }, p(ut, "SessionInformation"), ut);
1047
+ n([
1048
+ o(Number)
1049
+ ], w.prototype, "size", 2);
1050
+ n([
1051
+ o(Number)
1052
+ ], w.prototype, "originalSize", 2);
1053
+ n([
1054
+ o(Number)
1055
+ ], w.prototype, "ratio", 2);
1056
+ n([
1057
+ o(Number)
1058
+ ], w.prototype, "previousRatio", 2);
1059
+ n([
1060
+ o(Number)
1061
+ ], w.prototype, "threshold", 2);
1062
+ n([
1063
+ o(Number)
1064
+ ], w.prototype, "maxSize", 2);
1065
+ n([
1066
+ o(String)
1067
+ ], w.prototype, "id", 2);
1068
+ n([
1069
+ xt(M)
1070
+ ], w.prototype, "instructionSummaries", 2);
1071
+ w = n([
1072
+ f({ name: "SessionInformation" })
1073
+ ], w);
1074
+ var dt;
1075
+ let h = (dt = class {
1076
+ constructor() {
1077
+ e(this, "timestamp");
1078
+ e(this, "mimeType");
1079
+ e(this, "partial");
1080
+ e(this, "turnComplete");
1081
+ e(this, "visible");
1082
+ e(this, "serverError");
1083
+ e(this, "interactionId");
1084
+ e(this, "sessionInformation");
1085
+ e(this, "eventType");
1086
+ e(this, "artifactsGenerated", []);
1087
+ e(this, "author");
1088
+ e(this, "role");
1089
+ e(this, "command");
1090
+ e(this, "content");
1091
+ e(this, "streamingParts");
1092
+ e(this, "subAgentId");
1093
+ e(this, "subAgentName");
1094
+ e(this, "text");
1095
+ }
1096
+ }, p(dt, "LlmEvent"), dt);
1097
+ n([
1098
+ o(Number)
1099
+ ], h.prototype, "timestamp", 2);
1100
+ n([
1101
+ o(String)
1102
+ ], h.prototype, "mimeType", 2);
1103
+ n([
1104
+ o(Boolean)
1105
+ ], h.prototype, "partial", 2);
1106
+ n([
1107
+ o(Boolean)
1108
+ ], h.prototype, "turnComplete", 2);
1109
+ n([
1110
+ o(Boolean)
1111
+ ], h.prototype, "visible", 2);
1112
+ n([
1113
+ o(String)
1114
+ ], h.prototype, "serverError", 2);
1115
+ n([
1116
+ o(String)
1117
+ ], h.prototype, "interactionId", 2);
1118
+ n([
1119
+ o(w)
1120
+ ], h.prototype, "sessionInformation", 2);
1121
+ n([
1122
+ o(yt)
1123
+ ], h.prototype, "eventType", 2);
1124
+ n([
1125
+ xt(O)
1126
+ ], h.prototype, "artifactsGenerated", 2);
1127
+ n([
1128
+ o(String)
1129
+ ], h.prototype, "author", 2);
1130
+ n([
1131
+ o(Dt)
1132
+ ], h.prototype, "role", 2);
1133
+ n([
1134
+ o(String)
1135
+ ], h.prototype, "command", 2);
1136
+ n([
1137
+ o(Ct)
1138
+ ], h.prototype, "content", 2);
1139
+ n([
1140
+ xt(() => D)
1141
+ ], h.prototype, "streamingParts", 2);
1142
+ h = n([
1143
+ f({ name: "LlmEvent" })
1144
+ ], h);
1145
+ var mt;
1146
+ let _ = (mt = class {
1147
+ constructor() {
1148
+ e(this, "timeStamp");
1149
+ e(this, "partialText");
1150
+ e(this, "partialReasoning");
1151
+ e(this, "functionName");
1152
+ e(this, "streamingParts");
1153
+ e(this, "functionCallId");
1154
+ e(this, "type");
1155
+ e(this, "iteractionId");
1156
+ e(this, "partialEventType");
1157
+ e(this, "subAgentId");
1158
+ }
1159
+ }, p(mt, "PartialLlmEvent"), mt);
1160
+ n([
1161
+ o(Number, { name: "ts" })
1162
+ ], _.prototype, "timeStamp", 2);
1163
+ n([
1164
+ o(String, { name: "pt" })
1165
+ ], _.prototype, "partialText", 2);
1166
+ n([
1167
+ o(String, { name: "pr" })
1168
+ ], _.prototype, "partialReasoning", 2);
1169
+ n([
1170
+ o(String, { name: "fn" })
1171
+ ], _.prototype, "functionName", 2);
1172
+ n([
1173
+ xt(() => D)
1174
+ ], _.prototype, "streamingParts", 2);
1175
+ n([
1176
+ o(String, { name: "fid" })
1177
+ ], _.prototype, "functionCallId", 2);
1178
+ n([
1179
+ o(String, { name: "tp" })
1180
+ ], _.prototype, "type", 2);
1181
+ n([
1182
+ o(String, { name: "itid" })
1183
+ ], _.prototype, "iteractionId", 2);
1184
+ n([
1185
+ o(yt)
1186
+ ], _.prototype, "partialEventType", 2);
1187
+ n([
1188
+ o(String, { name: "said" })
1189
+ ], _.prototype, "subAgentId", 2);
1190
+ _ = n([
1191
+ f({ name: "PartialLlmEvent" })
1192
+ ], _);
1193
+ var gt;
1194
+ let k = (gt = class {
1195
+ constructor() {
1196
+ e(this, "type");
1197
+ e(this, "event");
1198
+ e(this, "sessionId");
1199
+ e(this, "accessToken");
1200
+ e(this, "partialEvent");
1201
+ e(this, "subAgentId");
1202
+ e(this, "subAgentName");
1203
+ e(this, "seq");
1204
+ }
1205
+ }, p(gt, "StreamingResponse"), gt);
1206
+ n([
1207
+ o(String)
1208
+ ], k.prototype, "type", 2);
1209
+ n([
1210
+ o(h)
1211
+ ], k.prototype, "event", 2);
1212
+ n([
1213
+ o(String)
1214
+ ], k.prototype, "sessionId", 2);
1215
+ n([
1216
+ o(String)
1217
+ ], k.prototype, "accessToken", 2);
1218
+ n([
1219
+ o(_, { name: "pe" })
1220
+ ], k.prototype, "partialEvent", 2);
1221
+ n([
1222
+ o(String)
1223
+ ], k.prototype, "subAgentId", 2);
1224
+ n([
1225
+ o(String)
1226
+ ], k.prototype, "subAgentName", 2);
1227
+ n([
1228
+ o(Number)
1229
+ ], k.prototype, "seq", 2);
1230
+ k = n([
1231
+ f({ name: "StreamingResponse" })
1232
+ ], k);
1233
+ var ft;
1234
+ let Ut = (ft = class {
1235
+ constructor() {
1236
+ e(this, "events");
1237
+ }
1238
+ }, p(ft, "Payload"), ft);
1239
+ n([
1240
+ xt(h)
1241
+ ], Ut.prototype, "events", 2);
1242
+ Ut = n([
1243
+ f({ name: "Payload" })
1244
+ ], Ut);
1245
+ function qt(s) {
1246
+ var r;
1247
+ const t = (s == null ? void 0 : s.presentation) ?? ((r = s == null ? void 0 : s.metadata) == null ? void 0 : r[jt]);
1248
+ if (!t || typeof t != "object") return { isUi: !1 };
1249
+ const i = t, a = /* @__PURE__ */ p((c, d) => i[c] ?? i[d], "pick");
1250
+ return {
1251
+ isUi: a("isUi", "IsUi") === !0,
1252
+ askUserComponent: a("askUserComponent", "AskUserComponent") || void 0,
1253
+ argsDescription: a("argsDescription", "ArgsDescription") || void 0,
1254
+ // Runtime override on a RESULT: the UI tool chose not to render (CallContext.CancelUiRender).
1255
+ cancelUi: a("cancelUi", "CancelUi") === !0 || void 0,
1256
+ // Live signal on the PARK event: the tool is now waiting on a human, so the drawer may open.
1257
+ parked: a("parked", "Parked") === !0 || void 0
1258
+ };
1259
+ }
1260
+ p(qt, "readPresentation");
1261
+ const E = class E {
1262
+ constructor(t) {
1263
+ e(this, "uniqueId");
1264
+ e(this, "mimeType");
1265
+ e(this, "created");
1266
+ e(this, "author");
1267
+ e(this, "eventType");
1268
+ e(this, "allEventTypes", []);
1269
+ e(this, "interactionId");
1270
+ e(this, "artifactsDelta", []);
1271
+ e(this, "llmArtifacts", []);
1272
+ e(this, "partial");
1273
+ e(this, "turn_complete");
1274
+ e(this, "isFinalResponse");
1275
+ e(this, "interrupted");
1276
+ e(this, "model_session_id");
1277
+ e(this, "functionDetails");
1278
+ e(this, "executableCodeDetails");
1279
+ e(this, "codeExecutionResultDetails");
1280
+ e(this, "thoughtDefails");
1281
+ e(this, "rawDetails");
1282
+ e(this, "rendered");
1283
+ e(this, "serverError");
1284
+ e(this, "server_session_id");
1285
+ e(this, "asyncFinalResponse");
1286
+ e(this, "agentServerBaseUrl");
1287
+ e(this, "parts", []);
1288
+ e(this, "endMessageData");
1289
+ e(this, "command");
1290
+ e(this, "session_information");
1291
+ e(this, "subAgentId");
1292
+ e(this, "subAgentName");
1293
+ e(this, "visible", !0);
1294
+ this.interactionId = t, this.author = "main";
1295
+ }
1296
+ static createErrorEvent(t, i) {
1297
+ const a = new E(i);
1298
+ a.turn_complete = !0, a.partial = !1, a.parts = [];
1299
+ const r = {
1300
+ eventType: l.ServerError,
1301
+ errorDetails: {
1302
+ errorMessage: t
1303
+ },
1304
+ id: "",
1305
+ author: "main",
1306
+ created: /* @__PURE__ */ new Date(),
1307
+ partial: !1,
1308
+ isStillWriting: !1,
1309
+ mustPush: !1,
1310
+ textAppendable: !1
1311
+ };
1312
+ return a.parts.push(r), a;
1313
+ }
1314
+ static parseFlatPropertiesTypedEvent(t) {
1315
+ var a, r, c;
1316
+ const i = new E(t.interactionId);
1317
+ if (i.serverError = t.serverError, !t.interactionId)
1318
+ throw new Error("Interaction ID is required");
1319
+ switch (i.model_session_id = "", i.server_session_id = null, i.asyncFinalResponse = t.turnComplete, i.command = (a = t.command) == null ? void 0 : a.toString(), t.sessionInformation && (i.session_information = t.sessionInformation), (!t.author || t.author == "") && console.warn('[ServerEvent] event with no author; defaulting to "main"', {
1320
+ interactionId: t.interactionId,
1321
+ turnComplete: t.turnComplete
1322
+ }), t == null ? void 0 : t.author) {
1323
+ case Qt:
1324
+ i.author = "tool";
1325
+ break;
1326
+ case "system":
1327
+ i.author = "system";
1328
+ break;
1329
+ default:
1330
+ i.author = "main";
1331
+ }
1332
+ return i.mimeType = t.mimeType, i.created = new Date(t.timestamp), i.eventType = l.NotDefined, i.partial = ((c = (r = t.partial) == null ? void 0 : r.toString()) == null ? void 0 : c.toLowerCase()) === "true", i.turn_complete = t.turnComplete, i.visible = t.visible, i.isFinalResponse = t.turnComplete ?? !1, i.artifactsDelta = [], t.artifactsGenerated && t.artifactsGenerated.length > 0 && (i.created = new Date(t.timestamp), i.llmArtifacts = t.artifactsGenerated), i.subAgentId = t.subAgentId, i.subAgentName = t.subAgentName, i;
1333
+ }
1334
+ static getPartType(t) {
1335
+ return t instanceof _t ? "TextContent" : t instanceof v ? "FunctionCallContent" : t instanceof b ? "FunctionResultContent" : t instanceof N ? "StreamingFunctionCallUpdateContent" : t instanceof I ? "StreamingFinalFunctionCallContent" : t instanceof A ? "StreamingFinalFunctionResultContent" : t instanceof ht ? "FunctionClientOutputContent" : t instanceof G ? "StreamingClientOutputContent" : t instanceof St ? "UserUiContent" : t instanceof kt ? "StreamingTextContent" : t instanceof Ft ? "StreamingReasoningContent" : t instanceof R ? "ToolEventContent" : t instanceof P ? "StreamingToolEventContent" : "Unknown";
1336
+ }
1337
+ static parseFromTypedEvent(t) {
1338
+ var c, d, g, W, Ot, Pt, Rt;
1339
+ const i = E.parseFlatPropertiesTypedEvent(t);
1340
+ if (i.serverError)
1341
+ return i.parts.push(Nt.fromError(i.serverError)), i;
1342
+ if (!t.content && !t.streamingParts)
1343
+ return i;
1344
+ i.parts = [];
1345
+ const a = [...((c = t.content) == null ? void 0 : c.items) ?? [], ...t.streamingParts ?? []];
1346
+ i.eventType = Zt(((d = t.eventType) == null ? void 0 : d.type) ?? "");
1347
+ for (const y of a) {
1348
+ let u = {
1349
+ id: "",
1350
+ author: i.author,
1351
+ eventType: i.eventType,
1352
+ created: /* @__PURE__ */ new Date(),
1353
+ visible: i.visible,
1354
+ partial: i.partial,
1355
+ isStillWriting: !1,
1356
+ mustPush: !1,
1357
+ textAppendable: !1
1358
+ };
1359
+ const C = E.getPartType(y);
1360
+ if (C == x.FunctionCallContent || C == x.FunctionResultContent || C == x.StreamingFinalFunctionCallContent || C == x.StreamingFinalFunctionResultContent) {
1361
+ var r = y;
1362
+ if (r.id == "Server Error") {
1363
+ const m = r.arguments ?? {}, z = typeof m.error == "string" && m.error.trim().length > 0 ? m.error : JSON.stringify(r.arguments);
1364
+ u.eventType = l.ServerError, u.errorDetails = {
1365
+ errorMessage: z,
1366
+ stackTrace: typeof m.stackTrace == "string" ? m.stackTrace : void 0
1367
+ }, u.functionDetails = void 0;
1368
+ } else {
1369
+ u.eventType = C == x.FunctionCallContent || C == x.StreamingFinalFunctionCallContent ? l.FunctionCall : l.FunctionResponse;
1370
+ let m;
1371
+ try {
1372
+ if (r != null && r.result)
1373
+ if (typeof r.result == "object")
1374
+ m = r.result;
1375
+ else if (typeof r.result == "string") {
1376
+ const Tt = JSON.parse(r.result);
1377
+ m = typeof Tt == "object" && Tt !== null ? Tt : r.result;
1378
+ } else
1379
+ m = r.result;
1380
+ } catch (Tt) {
1381
+ console.warn("Parse function error", Tt), m = r == null ? void 0 : r.result;
1382
+ }
1383
+ u.thoughtDetails = {
1384
+ text: ""
1385
+ };
1386
+ const z = qt(r);
1387
+ u.functionDetails = {
1388
+ id: (r == null ? void 0 : r.id) ?? "",
1389
+ args: r == null ? void 0 : r.arguments,
1390
+ start: C == x.FunctionCallContent ? i.created : void 0,
1391
+ end: C == x.FunctionResultContent ? i.created : void 0,
1392
+ text: JSON.stringify(r == null ? void 0 : r.arguments) ?? "",
1393
+ name: (r == null ? void 0 : r.functionName) ?? "",
1394
+ status: u.eventType == l.FunctionCall ? "Executing" : "Done",
1395
+ response: m,
1396
+ isUi: z.isUi,
1397
+ argsDescription: z.argsDescription,
1398
+ // Client-only payload riding the RESULT event: live top-level `clientOutput`, or
1399
+ // metadata.clientOutput on the collapsed/persisted result. Calls leave it undefined.
1400
+ // The persisted-replay form also folds in via FunctionClientOutputContent.
1401
+ clientOutput: (r == null ? void 0 : r.clientOutput) ?? ((g = r == null ? void 0 : r.metadata) == null ? void 0 : g.clientOutput),
1402
+ askUserComponent: z.askUserComponent,
1403
+ // Runtime "don't render" override on a RESULT (CallContext.CancelUiRender).
1404
+ cancelUi: z.cancelUi
1405
+ }, u.functionDetails.isAskUser = !!u.functionDetails.askUserComponent, t.text = r == null ? void 0 : r.arguments;
1406
+ }
1407
+ } else if (C == x.StreamingTextContent)
1408
+ u.eventType = l.Text, u.text = (W = y == null ? void 0 : y.text) == null ? void 0 : W.replaceAll("\\n", `
1409
+ `), u.textLastChunk = y.text, t.text = u.text;
1410
+ else if (C == x.TextContent)
1411
+ u.eventType = l.Text, u.text = (Ot = y == null ? void 0 : y.text) == null ? void 0 : Ot.replaceAll("\\n", `
1412
+ `), u.textLastChunk = y.text, t.text = u.text;
1413
+ else if (C == x.StreamingReasoningContent)
1414
+ u.eventType = l.Thought, u.thoughtDetails = {
1415
+ text: ((Pt = y == null ? void 0 : y.text) == null ? void 0 : Pt.replaceAll("\\n", `
1416
+ `)) ?? ""
1417
+ }, u.text = (Rt = y == null ? void 0 : y.text) == null ? void 0 : Rt.replaceAll("\\n", `
1418
+ `), u.textLastChunk = y.text, t.text = u.text;
1419
+ else if (C == x.StreamingFunctionCallUpdateContent) {
1420
+ const m = y;
1421
+ u.eventType = l.PartialFunctionCall, u.text = m.arguments, u.thoughtDetails = {
1422
+ text: ""
1423
+ }, u.functionDetails = {
1424
+ id: m.callId ?? "",
1425
+ text: u.text,
1426
+ status: "Composing",
1427
+ name: (m == null ? void 0 : m.name) ?? "Unknown"
1428
+ }, t.text = u.text;
1429
+ } else if (C == x.ToolEventContent || C == x.StreamingToolEventContent) {
1430
+ u.eventType = l.ToolEvent;
1431
+ const m = y;
1432
+ u.toolDetails = {
1433
+ eventName: m.eventName ?? "",
1434
+ eventData: m.eventData ?? "",
1435
+ sessionId: m.sessionId ?? void 0
1436
+ };
1437
+ } else if (C == x.FunctionClientOutputContent) {
1438
+ const m = y;
1439
+ u.eventType = l.FunctionClientOutput, u.functionDetails = {
1440
+ id: m.id ?? "",
1441
+ name: "",
1442
+ status: "Done",
1443
+ clientOutput: m.data
1444
+ };
1445
+ } else if (C == x.StreamingClientOutputContent) {
1446
+ const m = y;
1447
+ u.eventType = l.FunctionClientOutput, u.functionDetails = {
1448
+ id: m.id ?? "",
1449
+ name: "",
1450
+ // The parked call stays Executing; interactionService folds only clientOutput onto it and
1451
+ // leaves the existing status untouched, so this is just to satisfy the type.
1452
+ status: "Executing",
1453
+ clientOutput: m.clientOutput,
1454
+ // The park signal itself (the reason this event fires even with no prefill).
1455
+ parked: qt(m).parked
1456
+ };
1457
+ } else if (C == x.UserUiContent) {
1458
+ const m = y;
1459
+ u.eventType = l.UserAnswer, u.author = "user", u.functionDetails = {
1460
+ id: "",
1461
+ name: m.name ?? "",
1462
+ args: m.args,
1463
+ status: "Done",
1464
+ isUi: !0
1465
+ };
1466
+ } else {
1467
+ u.eventType = l.NotDefined, console.warn(`Got a unmapped event_type:${i.eventType}, data:`, C, y);
1468
+ continue;
1469
+ }
1470
+ i.parts.push(u);
1471
+ }
1472
+ return i;
1473
+ }
1474
+ static createFromThought(t, i) {
1475
+ return {
1476
+ author: "main",
1477
+ visible: !0,
1478
+ eventType: l.Thought,
1479
+ uniqueId: (/* @__PURE__ */ new Date()).getTime().toString(),
1480
+ interactionId: t,
1481
+ allEventTypes: [l.Thought],
1482
+ artifactsDelta: [""],
1483
+ model_session_id: "",
1484
+ created: /* @__PURE__ */ new Date(),
1485
+ turn_complete: !1,
1486
+ partial: !0,
1487
+ asyncFinalResponse: !1,
1488
+ mimeType: "text/plain",
1489
+ parts: [
1490
+ {
1491
+ thoughtDetails: {
1492
+ text: i
1493
+ },
1494
+ // ThoughtPart renders `part.text` (via getPartTextContent), so a
1495
+ // thought built here with only `thoughtDetails` rendered as an
1496
+ // EMPTY reasoning block. The live decoder sets both for a
1497
+ // StreamingReasoningContent — match it, or this factory produces
1498
+ // a part the UI cannot show. Only the demo's fake gateway builds
1499
+ // thoughts this way, which is why it went unnoticed.
1500
+ text: i,
1501
+ id: vt(),
1502
+ created: /* @__PURE__ */ new Date(),
1503
+ eventType: l.Thought,
1504
+ author: "main",
1505
+ isStillWriting: !1,
1506
+ textAppendable: !0,
1507
+ partial: !0,
1508
+ mustPush: !0
1509
+ }
1510
+ ]
1511
+ };
1512
+ }
1513
+ static createFromFunctionName(t, i, a) {
1514
+ const r = E.createFromText("", i);
1515
+ return r.parts[0].text = void 0, r.parts[0].thoughtDetails = void 0, r.parts[0].textAppendable = !1, r.parts[0].mustPush = !0, r.parts[0].functionDetails = {
1516
+ name: t,
1517
+ id: "callId",
1518
+ status: "Executing",
1519
+ start: /* @__PURE__ */ new Date(),
1520
+ end: void 0,
1521
+ text: "dfsdfdf",
1522
+ args: a
1523
+ }, r;
1524
+ }
1525
+ static createFromText(t, i, a) {
1526
+ return {
1527
+ author: "main",
1528
+ visible: !0,
1529
+ eventType: l.Text,
1530
+ uniqueId: (/* @__PURE__ */ new Date()).getTime().toString(),
1531
+ interactionId: i,
1532
+ allEventTypes: [l.Text],
1533
+ artifactsDelta: [""],
1534
+ model_session_id: "",
1535
+ created: /* @__PURE__ */ new Date(),
1536
+ turn_complete: !1,
1537
+ partial: !0,
1538
+ asyncFinalResponse: !1,
1539
+ mimeType: "text/plain",
1540
+ parts: [
1541
+ {
1542
+ // Optional reasoning trace shown next to the message. Parts
1543
+ // with `eventType: Text` AND a populated `thoughtDetails`
1544
+ // render the text in the body and the trace in the
1545
+ // thinking strip.
1546
+ thoughtDetails: a ? {
1547
+ text: a
1548
+ } : void 0,
1549
+ id: vt(),
1550
+ created: /* @__PURE__ */ new Date(),
1551
+ // Part eventType MUST match the outer event's eventType.
1552
+ // Was previously `Thought` here, which made the merger
1553
+ // classify a streamed Text part as a Thought (rendered
1554
+ // in the trace strip instead of the message body) —
1555
+ // the chat would show the message during streaming and
1556
+ // then "disappear" once the part was reclassified.
1557
+ eventType: l.Text,
1558
+ author: "main",
1559
+ isStillWriting: !1,
1560
+ textAppendable: !0,
1561
+ partial: !0,
1562
+ mustPush: !0,
1563
+ text: t
1564
+ }
1565
+ ]
1566
+ };
1567
+ }
1568
+ };
1569
+ p(E, "ServerEvent");
1570
+ let Wt = E;
1571
+ const Lt = [
1572
+ // KernelContent derived types
1573
+ _t,
1574
+ wt,
1575
+ v,
1576
+ R,
1577
+ b,
1578
+ ht,
1579
+ St,
1580
+ Ct,
1581
+ // StreamingKernelContent derived types
1582
+ kt,
1583
+ N,
1584
+ Ft,
1585
+ P,
1586
+ I,
1587
+ A,
1588
+ G,
1589
+ M
1590
+ ];
1591
+ function te(s) {
1592
+ return s.name;
1593
+ }
1594
+ p(te, "getConstructorName");
1595
+ function Ht(s, t, i, a) {
1596
+ t.constructor !== i && (s.$type = (a == null ? void 0 : a.name) ?? te(t.constructor));
1597
+ }
1598
+ p(Ht, "dotNetTypeEmitter");
1599
+ function Bt(s, t) {
1600
+ if (s.$type != null)
1601
+ return t.get(s.$type);
1602
+ }
1603
+ p(Bt, "dotnetTypeResolver");
1604
+ function Kt() {
1605
+ const s = new zt(h);
1606
+ return s.config({
1607
+ knownTypes: Lt,
1608
+ typeHintEmitter: Ht,
1609
+ typeResolver: Bt
1610
+ }), s;
1611
+ }
1612
+ p(Kt, "createEventSerializer");
1613
+ function ee() {
1614
+ const s = new zt(k);
1615
+ return s.config({
1616
+ knownTypes: Lt,
1617
+ typeHintEmitter: Ht,
1618
+ typeResolver: Bt
1619
+ }), s;
1620
+ }
1621
+ p(ee, "createStreamingResponseSerializer");
1622
+ function Jt(s) {
1623
+ try {
1624
+ return JSON.parse(s), s;
1625
+ } catch {
1626
+ let i = "", a = !1;
1627
+ for (let r = 0; r < s.length; r++) {
1628
+ const c = s[r], d = c.charCodeAt(0);
1629
+ if (c === "\\" && a && r + 1 < s.length) {
1630
+ const g = s[r + 1];
1631
+ if (g === '"' || g === "\\" || g === "/" || g === "b" || g === "f" || g === "n" || g === "r" || g === "t") {
1632
+ i += c + g, r++;
1633
+ continue;
1634
+ } else if (g === "u" && r + 5 < s.length) {
1635
+ i += s.substring(r, r + 6), r += 5;
1636
+ continue;
1637
+ } else {
1638
+ i += c;
1639
+ continue;
1640
+ }
1641
+ }
1642
+ if (c === '"') {
1643
+ let g = 0;
1644
+ for (let W = r - 1; W >= 0 && s[W] === "\\"; W--)
1645
+ g++;
1646
+ g % 2 === 0 && (a = !a), i += c;
1647
+ continue;
1648
+ }
1649
+ if (a && d < 32)
1650
+ switch (c) {
1651
+ case `
1652
+ `:
1653
+ i += "\\n";
1654
+ break;
1655
+ case "\r":
1656
+ i += "\\r";
1657
+ break;
1658
+ case " ":
1659
+ i += "\\t";
1660
+ break;
1661
+ case "\f":
1662
+ i += "\\f";
1663
+ break;
1664
+ case "\b":
1665
+ i += "\\b";
1666
+ break;
1667
+ default:
1668
+ const g = d.toString(16).padStart(4, "0");
1669
+ i += `\\u${g}`;
1670
+ break;
1671
+ }
1672
+ else
1673
+ i += c;
1674
+ }
1675
+ return i;
1676
+ }
1677
+ }
1678
+ p(Jt, "sanitizeJsonString");
1679
+ function we(s) {
1680
+ const t = Jt(s);
1681
+ return ee().parse(t);
1682
+ }
1683
+ p(we, "deserializePayload");
1684
+ function ke(s) {
1685
+ const t = Jt(s);
1686
+ return Kt().parse(t);
1687
+ }
1688
+ p(ke, "deserializeEvent");
1689
+ function Fe(s) {
1690
+ return Kt().stringify(s);
1691
+ }
1692
+ p(Fe, "serializeEvent");
1693
+ export {
1694
+ Ce as A,
1695
+ me as C,
1696
+ l as E,
1697
+ v as F,
1698
+ Zt as G,
1699
+ Nt as I,
1700
+ h as L,
1701
+ Te as M,
1702
+ x as P,
1703
+ fe as R,
1704
+ Wt as S,
1705
+ _t as T,
1706
+ Se as a,
1707
+ Et as b,
1708
+ he as c,
1709
+ ye as d,
1710
+ ue as e,
1711
+ Ct as f,
1712
+ ge as g,
1713
+ b as h,
1714
+ S as i,
1715
+ de as j,
1716
+ xe as k,
1717
+ N as l,
1718
+ Ft as m,
1719
+ k as n,
1720
+ kt as o,
1721
+ Kt as p,
1722
+ ee as q,
1723
+ ke as r,
1724
+ we as s,
1725
+ _e as t,
1726
+ De as u,
1727
+ Jt as v,
1728
+ Fe as w
1729
+ };
1730
+ //# sourceMappingURL=serializer-D2W42bdT.js.map