@ramme-io/kernel 7.3.1 → 8.1.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 (52) hide show
  1. package/dist/{AiGateway-Bdcl3v8h.js → AiGateway-CjamGYdA.js} +409 -358
  2. package/dist/{bodewellAdapter-BzbeTSIP.js → bodewellAdapter-PfSOdsEI.js} +1 -1
  3. package/dist/deviceReadings-cxZE1T-0.js +1627 -0
  4. package/dist/index.es.js +4341 -4610
  5. package/dist/kernel/src/agents/roster.d.ts +11 -3
  6. package/dist/kernel/src/agents/roster.d.ts.map +1 -1
  7. package/dist/kernel/src/agents/scope.d.ts +21 -0
  8. package/dist/kernel/src/agents/scope.d.ts.map +1 -0
  9. package/dist/kernel/src/agents/scope.test.d.ts +2 -0
  10. package/dist/kernel/src/agents/scope.test.d.ts.map +1 -0
  11. package/dist/kernel/src/components/AIChatPanel.d.ts +12 -0
  12. package/dist/kernel/src/components/AIChatPanel.d.ts.map +1 -1
  13. package/dist/kernel/src/engine/runtime/data-seeder.d.ts +2 -0
  14. package/dist/kernel/src/engine/runtime/data-seeder.d.ts.map +1 -1
  15. package/dist/kernel/src/engine/runtime/useSignal.d.ts +15 -0
  16. package/dist/kernel/src/engine/runtime/useSignal.d.ts.map +1 -1
  17. package/dist/kernel/src/engine/runtime/useSignal.test.d.ts +2 -0
  18. package/dist/kernel/src/engine/runtime/useSignal.test.d.ts.map +1 -0
  19. package/dist/kernel/src/index.d.ts +2 -4
  20. package/dist/kernel/src/index.d.ts.map +1 -1
  21. package/dist/kernel/src/renderers/AppDocumentRenderer.d.ts +57 -5
  22. package/dist/kernel/src/renderers/AppDocumentRenderer.d.ts.map +1 -1
  23. package/dist/kernel/src/renderers/AppOrientation.test.d.ts +2 -0
  24. package/dist/kernel/src/renderers/AppOrientation.test.d.ts.map +1 -0
  25. package/dist/kernel/src/server.d.ts +3 -0
  26. package/dist/kernel/src/server.d.ts.map +1 -1
  27. package/dist/kernel/src/services/ai/AiGatewayService.d.ts.map +1 -1
  28. package/dist/kernel/src/services/ai/providers/GeminiAdapter.d.ts.map +1 -1
  29. package/dist/kernel/src/services/ai/providers/OllamaAdapter.d.ts +1 -0
  30. package/dist/kernel/src/services/ai/providers/OllamaAdapter.d.ts.map +1 -1
  31. package/dist/kernel/src/services/ai/toolPromptGenerator.d.ts +0 -1
  32. package/dist/kernel/src/services/ai/toolPromptGenerator.d.ts.map +1 -1
  33. package/dist/kernel/src/signals/deviceReadings.d.ts +9 -0
  34. package/dist/kernel/src/signals/deviceReadings.d.ts.map +1 -0
  35. package/dist/kernel/src/signals/deviceReadings.test.d.ts +2 -0
  36. package/dist/kernel/src/signals/deviceReadings.test.d.ts.map +1 -0
  37. package/dist/kernel/src/signals/index.d.ts +1 -0
  38. package/dist/kernel/src/signals/index.d.ts.map +1 -1
  39. package/dist/server.es.js +43 -41
  40. package/dist/signals.es.js +12 -10
  41. package/package.json +4 -4
  42. package/dist/index-kBkq1FSR.js +0 -1236
  43. package/dist/kernel/src/events/mockEventSource.d.ts +0 -28
  44. package/dist/kernel/src/events/mockEventSource.d.ts.map +0 -1
  45. package/dist/kernel/src/services/MarketDataService.d.ts +0 -29
  46. package/dist/kernel/src/services/MarketDataService.d.ts.map +0 -1
  47. package/dist/kernel/src/services/marketSession.d.ts +0 -33
  48. package/dist/kernel/src/services/marketSession.d.ts.map +0 -1
  49. package/dist/kernel/src/services/marketSession.test.d.ts +0 -14
  50. package/dist/kernel/src/services/marketSession.test.d.ts.map +0 -1
  51. package/dist/kernel/src/stores/useMarketDataStore.d.ts +0 -50
  52. package/dist/kernel/src/stores/useMarketDataStore.d.ts.map +0 -1
@@ -1,5 +1,5 @@
1
- import { i as x, j as O, k as W, l as C } from "./index-kBkq1FSR.js";
2
- const st = {
1
+ import { j as x, k as O, l as F, m as M } from "./deviceReadings-cxZE1T-0.js";
2
+ const se = {
3
3
  // ── ROOM 1: STRATEGY OFFICE ──────────────────────────────────────
4
4
  strategist: {
5
5
  id: "strategist",
@@ -113,7 +113,16 @@ Provide a structured audit report with:
113
113
  - 💡 Suggestions (improvements not required but recommended)
114
114
  `.trim()
115
115
  }
116
- }, B = {
116
+ };
117
+ function lt(n, e) {
118
+ const r = se[n];
119
+ if (!r) throw new Error(`scopePatch: unknown agent role "${String(n)}"`);
120
+ const t = new Set(r.scope), o = {}, a = [];
121
+ for (const [s, c] of Object.entries(e ?? {}))
122
+ t.has(s) ? o[s] = c : a.push(s);
123
+ return { patch: o, dropped: a };
124
+ }
125
+ const G = {
117
126
  // May 2026 stable series — gemini-2.0-flash is deprecated (404)
118
127
  "google-gemini": ["gemini-2.5-flash", "gemini-2.5-pro", "gemini-2.5-flash-preview-05-20", "gemini-1.5-flash"],
119
128
  openai: ["gpt-4o", "gpt-4o-mini", "gpt-4-turbo", "gpt-3.5-turbo"],
@@ -136,20 +145,20 @@ Provide a structured audit report with:
136
145
  // (core/ai_router.py's DEFAULT_MODELS) — llama3.2 (3B) was found live
137
146
  // to mis-trigger tool calls on plain greetings.
138
147
  ollama: ["llama3.3", "qwen2.5:32b", "qwen2.5-coder:32b", "qwen2.5-coder:14b", "qwen2.5-coder:7b", "llama3.2"]
139
- }, it = {
148
+ }, ut = {
140
149
  "google-gemini": "Google Gemini",
141
150
  openai: "OpenAI",
142
151
  anthropic: "Anthropic (Claude)",
143
152
  grok: "xAI Grok",
144
153
  deepseek: "DeepSeek",
145
154
  ollama: "Ollama (Local)"
146
- }, ct = {
155
+ }, dt = {
147
156
  "google-gemini": "AIzaSy…",
148
157
  openai: "sk-…",
149
158
  anthropic: "sk-ant-…",
150
159
  grok: "xai-…",
151
160
  deepseek: "sk-…"
152
- }, oe = Symbol("Let zodToJsonSchema decide on which parser to use"), F = {
161
+ }, ie = Symbol("Let zodToJsonSchema decide on which parser to use"), V = {
153
162
  name: void 0,
154
163
  $refStrategy: "root",
155
164
  basePath: ["#"],
@@ -172,14 +181,14 @@ Provide a structured audit report with:
172
181
  base64Strategy: "contentEncoding:base64",
173
182
  nameStrategy: "ref",
174
183
  openAiAnyTypeName: "OpenAiAnyType"
175
- }, ae = (n) => typeof n == "string" ? {
176
- ...F,
184
+ }, ce = (n) => typeof n == "string" ? {
185
+ ...V,
177
186
  name: n
178
187
  } : {
179
- ...F,
188
+ ...V,
180
189
  ...n
181
- }, se = (n) => {
182
- const e = ae(n), r = e.name !== void 0 ? [...e.basePath, e.definitionPath, e.name] : e.basePath;
190
+ }, le = (n) => {
191
+ const e = ce(n), r = e.name !== void 0 ? [...e.basePath, e.definitionPath, e.name] : e.basePath;
183
192
  return {
184
193
  ...e,
185
194
  flags: { hasReferencedOpenAiAnyType: !1 },
@@ -196,16 +205,16 @@ Provide a structured audit report with:
196
205
  ]))
197
206
  };
198
207
  };
199
- function V(n, e, r, t) {
208
+ function Q(n, e, r, t) {
200
209
  t != null && t.errorMessages && r && (n.errorMessage = {
201
210
  ...n.errorMessage,
202
211
  [e]: r
203
212
  });
204
213
  }
205
- function E(n, e, r, t, o) {
206
- n[e] = r, V(n, e, t, o);
214
+ function k(n, e, r, t, o) {
215
+ n[e] = r, Q(n, e, t, o);
207
216
  }
208
- const X = (n, e) => {
217
+ const ee = (n, e) => {
209
218
  let r = 0;
210
219
  for (; r < n.length && r < e.length && n[r] === e[r]; r++)
211
220
  ;
@@ -224,10 +233,10 @@ function P(n) {
224
233
  n.openAiAnyTypeName
225
234
  ];
226
235
  return n.flags.hasReferencedOpenAiAnyType = !0, {
227
- $ref: n.$refStrategy === "relative" ? X(e, n.currentPath) : e.join("/")
236
+ $ref: n.$refStrategy === "relative" ? ee(e, n.currentPath) : e.join("/")
228
237
  };
229
238
  }
230
- function ie(n, e) {
239
+ function ue(n, e) {
231
240
  var t, o, a;
232
241
  const r = {
233
242
  type: "array"
@@ -235,9 +244,9 @@ function ie(n, e) {
235
244
  return (t = n.type) != null && t._def && ((a = (o = n.type) == null ? void 0 : o._def) == null ? void 0 : a.typeName) !== f.ZodAny && (r.items = b(n.type._def, {
236
245
  ...e,
237
246
  currentPath: [...e.currentPath, "items"]
238
- })), n.minLength && E(r, "minItems", n.minLength.value, n.minLength.message, e), n.maxLength && E(r, "maxItems", n.maxLength.value, n.maxLength.message, e), n.exactLength && (E(r, "minItems", n.exactLength.value, n.exactLength.message, e), E(r, "maxItems", n.exactLength.value, n.exactLength.message, e)), r;
247
+ })), n.minLength && k(r, "minItems", n.minLength.value, n.minLength.message, e), n.maxLength && k(r, "maxItems", n.maxLength.value, n.maxLength.message, e), n.exactLength && (k(r, "minItems", n.exactLength.value, n.exactLength.message, e), k(r, "maxItems", n.exactLength.value, n.exactLength.message, e)), r;
239
248
  }
240
- function ce(n, e) {
249
+ function de(n, e) {
241
250
  const r = {
242
251
  type: "integer",
243
252
  format: "int64"
@@ -247,31 +256,31 @@ function ce(n, e) {
247
256
  for (const t of n.checks)
248
257
  switch (t.kind) {
249
258
  case "min":
250
- e.target === "jsonSchema7" ? t.inclusive ? E(r, "minimum", t.value, t.message, e) : E(r, "exclusiveMinimum", t.value, t.message, e) : (t.inclusive || (r.exclusiveMinimum = !0), E(r, "minimum", t.value, t.message, e));
259
+ e.target === "jsonSchema7" ? t.inclusive ? k(r, "minimum", t.value, t.message, e) : k(r, "exclusiveMinimum", t.value, t.message, e) : (t.inclusive || (r.exclusiveMinimum = !0), k(r, "minimum", t.value, t.message, e));
251
260
  break;
252
261
  case "max":
253
- e.target === "jsonSchema7" ? t.inclusive ? E(r, "maximum", t.value, t.message, e) : E(r, "exclusiveMaximum", t.value, t.message, e) : (t.inclusive || (r.exclusiveMaximum = !0), E(r, "maximum", t.value, t.message, e));
262
+ e.target === "jsonSchema7" ? t.inclusive ? k(r, "maximum", t.value, t.message, e) : k(r, "exclusiveMaximum", t.value, t.message, e) : (t.inclusive || (r.exclusiveMaximum = !0), k(r, "maximum", t.value, t.message, e));
254
263
  break;
255
264
  case "multipleOf":
256
- E(r, "multipleOf", t.value, t.message, e);
265
+ k(r, "multipleOf", t.value, t.message, e);
257
266
  break;
258
267
  }
259
268
  return r;
260
269
  }
261
- function le() {
270
+ function me() {
262
271
  return {
263
272
  type: "boolean"
264
273
  };
265
274
  }
266
- function Q(n, e) {
275
+ function te(n, e) {
267
276
  return b(n.type._def, e);
268
277
  }
269
- const de = (n, e) => b(n.innerType._def, e);
270
- function ee(n, e, r) {
278
+ const pe = (n, e) => b(n.innerType._def, e);
279
+ function re(n, e, r) {
271
280
  const t = r ?? e.dateStrategy;
272
281
  if (Array.isArray(t))
273
282
  return {
274
- anyOf: t.map((o, a) => ee(n, e, o))
283
+ anyOf: t.map((o, a) => re(n, e, o))
275
284
  };
276
285
  switch (t) {
277
286
  case "string":
@@ -286,10 +295,10 @@ function ee(n, e, r) {
286
295
  format: "date"
287
296
  };
288
297
  case "integer":
289
- return ue(n, e);
298
+ return he(n, e);
290
299
  }
291
300
  }
292
- const ue = (n, e) => {
301
+ const he = (n, e) => {
293
302
  const r = {
294
303
  type: "integer",
295
304
  format: "unix-time"
@@ -299,7 +308,7 @@ const ue = (n, e) => {
299
308
  for (const t of n.checks)
300
309
  switch (t.kind) {
301
310
  case "min":
302
- E(
311
+ k(
303
312
  r,
304
313
  "minimum",
305
314
  t.value,
@@ -309,7 +318,7 @@ const ue = (n, e) => {
309
318
  );
310
319
  break;
311
320
  case "max":
312
- E(
321
+ k(
313
322
  r,
314
323
  "maximum",
315
324
  t.value,
@@ -321,23 +330,23 @@ const ue = (n, e) => {
321
330
  }
322
331
  return r;
323
332
  };
324
- function me(n, e) {
333
+ function ge(n, e) {
325
334
  return {
326
335
  ...b(n.innerType._def, e),
327
336
  default: n.defaultValue()
328
337
  };
329
338
  }
330
- function pe(n, e) {
339
+ function fe(n, e) {
331
340
  return e.effectStrategy === "input" ? b(n.schema._def, e) : P(e);
332
341
  }
333
- function he(n) {
342
+ function ye(n) {
334
343
  return {
335
344
  type: "string",
336
345
  enum: Array.from(n.values)
337
346
  };
338
347
  }
339
- const ge = (n) => "type" in n && n.type === "string" ? !1 : "allOf" in n;
340
- function fe(n, e) {
348
+ const we = (n) => "type" in n && n.type === "string" ? !1 : "allOf" in n;
349
+ function be(n, e) {
341
350
  const r = [
342
351
  b(n.left._def, {
343
352
  ...e,
@@ -351,7 +360,7 @@ function fe(n, e) {
351
360
  let t = e.target === "jsonSchema2019-09" ? { unevaluatedProperties: !1 } : void 0;
352
361
  const o = [];
353
362
  return r.forEach((a) => {
354
- if (ge(a))
363
+ if (we(a))
355
364
  o.push(...a.allOf), a.unevaluatedProperties === void 0 && (t = void 0);
356
365
  else {
357
366
  let s = a;
@@ -367,7 +376,7 @@ function fe(n, e) {
367
376
  ...t
368
377
  } : void 0;
369
378
  }
370
- function ye(n, e) {
379
+ function Ee(n, e) {
371
380
  const r = typeof n.value;
372
381
  return r !== "bigint" && r !== "number" && r !== "boolean" && r !== "string" ? {
373
382
  type: Array.isArray(n.value) ? "array" : "object"
@@ -379,7 +388,7 @@ function ye(n, e) {
379
388
  const: n.value
380
389
  };
381
390
  }
382
- let q;
391
+ let U;
383
392
  const R = {
384
393
  /**
385
394
  * `c` was changed to `[cC]` to replicate /i flag
@@ -402,7 +411,7 @@ const R = {
402
411
  * Fix in Zod:
403
412
  * https://github.com/colinhacks/zod/commit/9340fd51e48576a75adc919bff65dbc4a5d4c99b
404
413
  */
405
- emoji: () => (q === void 0 && (q = RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$", "u")), q),
414
+ emoji: () => (U === void 0 && (U = RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$", "u")), U),
406
415
  /**
407
416
  * Unused
408
417
  */
@@ -422,7 +431,7 @@ const R = {
422
431
  nanoid: /^[a-zA-Z0-9_-]{21}$/,
423
432
  jwt: /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/
424
433
  };
425
- function te(n, e) {
434
+ function ne(n, e) {
426
435
  const r = {
427
436
  type: "string"
428
437
  };
@@ -430,10 +439,10 @@ function te(n, e) {
430
439
  for (const t of n.checks)
431
440
  switch (t.kind) {
432
441
  case "min":
433
- E(r, "minLength", typeof r.minLength == "number" ? Math.max(r.minLength, t.value) : t.value, t.message, e);
442
+ k(r, "minLength", typeof r.minLength == "number" ? Math.max(r.minLength, t.value) : t.value, t.message, e);
434
443
  break;
435
444
  case "max":
436
- E(r, "maxLength", typeof r.maxLength == "number" ? Math.min(r.maxLength, t.value) : t.value, t.message, e);
445
+ k(r, "maxLength", typeof r.maxLength == "number" ? Math.min(r.maxLength, t.value) : t.value, t.message, e);
437
446
  break;
438
447
  case "email":
439
448
  switch (e.emailStrategy) {
@@ -464,10 +473,10 @@ function te(n, e) {
464
473
  _(r, R.cuid2, t.message, e);
465
474
  break;
466
475
  case "startsWith":
467
- _(r, RegExp(`^${U(t.value, e)}`), t.message, e);
476
+ _(r, RegExp(`^${z(t.value, e)}`), t.message, e);
468
477
  break;
469
478
  case "endsWith":
470
- _(r, RegExp(`${U(t.value, e)}$`), t.message, e);
479
+ _(r, RegExp(`${z(t.value, e)}$`), t.message, e);
471
480
  break;
472
481
  case "datetime":
473
482
  $(r, "date-time", t.message, e);
@@ -482,10 +491,10 @@ function te(n, e) {
482
491
  $(r, "duration", t.message, e);
483
492
  break;
484
493
  case "length":
485
- E(r, "minLength", typeof r.minLength == "number" ? Math.max(r.minLength, t.value) : t.value, t.message, e), E(r, "maxLength", typeof r.maxLength == "number" ? Math.min(r.maxLength, t.value) : t.value, t.message, e);
494
+ k(r, "minLength", typeof r.minLength == "number" ? Math.max(r.minLength, t.value) : t.value, t.message, e), k(r, "maxLength", typeof r.maxLength == "number" ? Math.min(r.maxLength, t.value) : t.value, t.message, e);
486
495
  break;
487
496
  case "includes": {
488
- _(r, RegExp(U(t.value, e)), t.message, e);
497
+ _(r, RegExp(z(t.value, e)), t.message, e);
489
498
  break;
490
499
  }
491
500
  case "ip": {
@@ -516,7 +525,7 @@ function te(n, e) {
516
525
  break;
517
526
  }
518
527
  case "contentEncoding:base64": {
519
- E(r, "contentEncoding", "base64", t.message, e);
528
+ k(r, "contentEncoding", "base64", t.message, e);
520
529
  break;
521
530
  }
522
531
  case "pattern:zod": {
@@ -531,14 +540,14 @@ function te(n, e) {
531
540
  }
532
541
  return r;
533
542
  }
534
- function U(n, e) {
535
- return e.patternStrategy === "escape" ? be(n) : n;
543
+ function z(n, e) {
544
+ return e.patternStrategy === "escape" ? ke(n) : n;
536
545
  }
537
- const we = new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");
538
- function be(n) {
546
+ const Ae = new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");
547
+ function ke(n) {
539
548
  let e = "";
540
549
  for (let r = 0; r < n.length; r++)
541
- we.has(n[r]) || (e += "\\"), e += n[r];
550
+ Ae.has(n[r]) || (e += "\\"), e += n[r];
542
551
  return e;
543
552
  }
544
553
  function $(n, e, r, t) {
@@ -551,7 +560,7 @@ function $(n, e, r, t) {
551
560
  }), delete n.format, n.errorMessage && (delete n.errorMessage.format, Object.keys(n.errorMessage).length === 0 && delete n.errorMessage)), n.anyOf.push({
552
561
  format: e,
553
562
  ...r && t.errorMessages && { errorMessage: { format: r } }
554
- })) : E(n, "format", e, r, t);
563
+ })) : k(n, "format", e, r, t);
555
564
  }
556
565
  function _(n, e, r, t) {
557
566
  var o;
@@ -561,11 +570,11 @@ function _(n, e, r, t) {
561
570
  errorMessage: { pattern: n.errorMessage.pattern }
562
571
  }
563
572
  }), delete n.pattern, n.errorMessage && (delete n.errorMessage.pattern, Object.keys(n.errorMessage).length === 0 && delete n.errorMessage)), n.allOf.push({
564
- pattern: H(e, t),
573
+ pattern: K(e, t),
565
574
  ...r && t.errorMessages && { errorMessage: { pattern: r } }
566
- })) : E(n, "pattern", H(e, t), r, t);
575
+ })) : k(n, "pattern", K(e, t), r, t);
567
576
  }
568
- function H(n, e) {
577
+ function K(n, e) {
569
578
  var i;
570
579
  if (!e.applyRegexFlags || !n.flags)
571
580
  return n.source;
@@ -618,17 +627,17 @@ function H(n, e) {
618
627
  }
619
628
  return o;
620
629
  }
621
- function re(n, e) {
630
+ function oe(n, e) {
622
631
  var t, o, a, s, c, i;
623
632
  if (e.target === "openAi" && console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead."), e.target === "openApi3" && ((t = n.keyType) == null ? void 0 : t._def.typeName) === f.ZodEnum)
624
633
  return {
625
634
  type: "object",
626
635
  required: n.keyType._def.values,
627
- properties: n.keyType._def.values.reduce((l, d) => ({
636
+ properties: n.keyType._def.values.reduce((l, u) => ({
628
637
  ...l,
629
- [d]: b(n.valueType._def, {
638
+ [u]: b(n.valueType._def, {
630
639
  ...e,
631
- currentPath: [...e.currentPath, "properties", d]
640
+ currentPath: [...e.currentPath, "properties", u]
632
641
  }) ?? P(e)
633
642
  }), {}),
634
643
  additionalProperties: e.rejectedAdditionalProperties
@@ -643,10 +652,10 @@ function re(n, e) {
643
652
  if (e.target === "openApi3")
644
653
  return r;
645
654
  if (((o = n.keyType) == null ? void 0 : o._def.typeName) === f.ZodString && ((a = n.keyType._def.checks) != null && a.length)) {
646
- const { type: l, ...d } = te(n.keyType._def, e);
655
+ const { type: l, ...u } = ne(n.keyType._def, e);
647
656
  return {
648
657
  ...r,
649
- propertyNames: d
658
+ propertyNames: u
650
659
  };
651
660
  } else {
652
661
  if (((s = n.keyType) == null ? void 0 : s._def.typeName) === f.ZodEnum)
@@ -657,18 +666,18 @@ function re(n, e) {
657
666
  }
658
667
  };
659
668
  if (((c = n.keyType) == null ? void 0 : c._def.typeName) === f.ZodBranded && n.keyType._def.type._def.typeName === f.ZodString && ((i = n.keyType._def.type._def.checks) != null && i.length)) {
660
- const { type: l, ...d } = Q(n.keyType._def, e);
669
+ const { type: l, ...u } = te(n.keyType._def, e);
661
670
  return {
662
671
  ...r,
663
- propertyNames: d
672
+ propertyNames: u
664
673
  };
665
674
  }
666
675
  }
667
676
  return r;
668
677
  }
669
- function ke(n, e) {
678
+ function ve(n, e) {
670
679
  if (e.mapStrategy === "record")
671
- return re(n, e);
680
+ return oe(n, e);
672
681
  const r = b(n.keyType._def, {
673
682
  ...e,
674
683
  currentPath: [...e.currentPath, "items", "items", "0"]
@@ -687,14 +696,14 @@ function ke(n, e) {
687
696
  }
688
697
  };
689
698
  }
690
- function Ae(n) {
699
+ function Se(n) {
691
700
  const e = n.values, t = Object.keys(n.values).filter((a) => typeof e[e[a]] != "number").map((a) => e[a]), o = Array.from(new Set(t.map((a) => typeof a)));
692
701
  return {
693
702
  type: o.length === 1 ? o[0] === "string" ? "string" : "number" : ["string", "number"],
694
703
  enum: t
695
704
  };
696
705
  }
697
- function Ee(n) {
706
+ function xe(n) {
698
707
  return n.target === "openAi" ? void 0 : {
699
708
  not: P({
700
709
  ...n,
@@ -702,7 +711,7 @@ function Ee(n) {
702
711
  })
703
712
  };
704
713
  }
705
- function ve(n) {
714
+ function Oe(n) {
706
715
  return n.target === "openApi3" ? {
707
716
  enum: ["null"],
708
717
  nullable: !0
@@ -717,9 +726,9 @@ const L = {
717
726
  ZodBoolean: "boolean",
718
727
  ZodNull: "null"
719
728
  };
720
- function Se(n, e) {
729
+ function _e(n, e) {
721
730
  if (e.target === "openApi3")
722
- return K(n, e);
731
+ return X(n, e);
723
732
  const r = n.options instanceof Map ? Array.from(n.options.values()) : n.options;
724
733
  if (r.every((t) => t._def.typeName in L && (!t._def.checks || !t._def.checks.length))) {
725
734
  const t = r.reduce((o, a) => {
@@ -764,16 +773,16 @@ function Se(n, e) {
764
773
  ...o._def.values.filter((a) => !t.includes(a))
765
774
  ], [])
766
775
  };
767
- return K(n, e);
776
+ return X(n, e);
768
777
  }
769
- const K = (n, e) => {
778
+ const X = (n, e) => {
770
779
  const r = (n.options instanceof Map ? Array.from(n.options.values()) : n.options).map((t, o) => b(t._def, {
771
780
  ...e,
772
781
  currentPath: [...e.currentPath, "anyOf", `${o}`]
773
782
  })).filter((t) => !!t && (!e.strictUnions || typeof t == "object" && Object.keys(t).length > 0));
774
783
  return r.length ? { anyOf: r } : void 0;
775
784
  };
776
- function xe(n, e) {
785
+ function Pe(n, e) {
777
786
  if (["ZodString", "ZodNumber", "ZodBigInt", "ZodBoolean", "ZodNull"].includes(n.innerType._def.typeName) && (!n.innerType._def.checks || !n.innerType._def.checks.length))
778
787
  return e.target === "openApi3" ? {
779
788
  type: L[n.innerType._def.typeName],
@@ -797,7 +806,7 @@ function xe(n, e) {
797
806
  });
798
807
  return r && { anyOf: [r, { type: "null" }] };
799
808
  }
800
- function Oe(n, e) {
809
+ function Te(n, e) {
801
810
  const r = {
802
811
  type: "number"
803
812
  };
@@ -806,21 +815,21 @@ function Oe(n, e) {
806
815
  for (const t of n.checks)
807
816
  switch (t.kind) {
808
817
  case "int":
809
- r.type = "integer", V(r, "type", t.message, e);
818
+ r.type = "integer", Q(r, "type", t.message, e);
810
819
  break;
811
820
  case "min":
812
- e.target === "jsonSchema7" ? t.inclusive ? E(r, "minimum", t.value, t.message, e) : E(r, "exclusiveMinimum", t.value, t.message, e) : (t.inclusive || (r.exclusiveMinimum = !0), E(r, "minimum", t.value, t.message, e));
821
+ e.target === "jsonSchema7" ? t.inclusive ? k(r, "minimum", t.value, t.message, e) : k(r, "exclusiveMinimum", t.value, t.message, e) : (t.inclusive || (r.exclusiveMinimum = !0), k(r, "minimum", t.value, t.message, e));
813
822
  break;
814
823
  case "max":
815
- e.target === "jsonSchema7" ? t.inclusive ? E(r, "maximum", t.value, t.message, e) : E(r, "exclusiveMaximum", t.value, t.message, e) : (t.inclusive || (r.exclusiveMaximum = !0), E(r, "maximum", t.value, t.message, e));
824
+ e.target === "jsonSchema7" ? t.inclusive ? k(r, "maximum", t.value, t.message, e) : k(r, "exclusiveMaximum", t.value, t.message, e) : (t.inclusive || (r.exclusiveMaximum = !0), k(r, "maximum", t.value, t.message, e));
816
825
  break;
817
826
  case "multipleOf":
818
- E(r, "multipleOf", t.value, t.message, e);
827
+ k(r, "multipleOf", t.value, t.message, e);
819
828
  break;
820
829
  }
821
830
  return r;
822
831
  }
823
- function _e(n, e) {
832
+ function Re(n, e) {
824
833
  const r = e.target === "openAi", t = {
825
834
  type: "object",
826
835
  properties: {}
@@ -829,20 +838,20 @@ function _e(n, e) {
829
838
  let i = a[c];
830
839
  if (i === void 0 || i._def === void 0)
831
840
  continue;
832
- let l = Te(i);
841
+ let l = Ie(i);
833
842
  l && r && (i._def.typeName === "ZodOptional" && (i = i._def.innerType), i.isNullable() || (i = i.nullable()), l = !1);
834
- const d = b(i._def, {
843
+ const u = b(i._def, {
835
844
  ...e,
836
845
  currentPath: [...e.currentPath, "properties", c],
837
846
  propertyPath: [...e.currentPath, "properties", c]
838
847
  });
839
- d !== void 0 && (t.properties[c] = d, l || o.push(c));
848
+ u !== void 0 && (t.properties[c] = u, l || o.push(c));
840
849
  }
841
850
  o.length && (t.required = o);
842
- const s = Pe(n, e);
851
+ const s = $e(n, e);
843
852
  return s !== void 0 && (t.additionalProperties = s), t;
844
853
  }
845
- function Pe(n, e) {
854
+ function $e(n, e) {
846
855
  if (n.catchall._def.typeName !== "ZodNever")
847
856
  return b(n.catchall._def, {
848
857
  ...e,
@@ -857,14 +866,14 @@ function Pe(n, e) {
857
866
  return e.removeAdditionalStrategy === "strict" ? e.allowedAdditionalProperties : e.rejectedAdditionalProperties;
858
867
  }
859
868
  }
860
- function Te(n) {
869
+ function Ie(n) {
861
870
  try {
862
871
  return n.isOptional();
863
872
  } catch {
864
873
  return !0;
865
874
  }
866
875
  }
867
- const Re = (n, e) => {
876
+ const Ne = (n, e) => {
868
877
  var t;
869
878
  if (e.currentPath.toString() === ((t = e.propertyPath) == null ? void 0 : t.toString()))
870
879
  return b(n.innerType._def, e);
@@ -880,7 +889,7 @@ const Re = (n, e) => {
880
889
  r
881
890
  ]
882
891
  } : P(e);
883
- }, $e = (n, e) => {
892
+ }, je = (n, e) => {
884
893
  if (e.pipeStrategy === "input")
885
894
  return b(n.in._def, e);
886
895
  if (e.pipeStrategy === "output")
@@ -896,10 +905,10 @@ const Re = (n, e) => {
896
905
  allOf: [r, t].filter((o) => o !== void 0)
897
906
  };
898
907
  };
899
- function Ne(n, e) {
908
+ function De(n, e) {
900
909
  return b(n.type._def, e);
901
910
  }
902
- function Ie(n, e) {
911
+ function Ce(n, e) {
903
912
  const t = {
904
913
  type: "array",
905
914
  uniqueItems: !0,
@@ -908,9 +917,9 @@ function Ie(n, e) {
908
917
  currentPath: [...e.currentPath, "items"]
909
918
  })
910
919
  };
911
- return n.minSize && E(t, "minItems", n.minSize.value, n.minSize.message, e), n.maxSize && E(t, "maxItems", n.maxSize.value, n.maxSize.message, e), t;
920
+ return n.minSize && k(t, "minItems", n.minSize.value, n.minSize.message, e), n.maxSize && k(t, "maxItems", n.maxSize.value, n.maxSize.message, e), t;
912
921
  }
913
- function je(n, e) {
922
+ function Me(n, e) {
914
923
  return n.rest ? {
915
924
  type: "array",
916
925
  minItems: n.items.length,
@@ -932,80 +941,80 @@ function je(n, e) {
932
941
  })).reduce((r, t) => t === void 0 ? r : [...r, t], [])
933
942
  };
934
943
  }
935
- function De(n) {
944
+ function Ze(n) {
936
945
  return {
937
946
  not: P(n)
938
947
  };
939
948
  }
940
- function Me(n) {
949
+ function qe(n) {
941
950
  return P(n);
942
951
  }
943
- const Ce = (n, e) => b(n.innerType._def, e), Ze = (n, e, r) => {
952
+ const Le = (n, e) => b(n.innerType._def, e), Ue = (n, e, r) => {
944
953
  switch (e) {
945
954
  case f.ZodString:
946
- return te(n, r);
955
+ return ne(n, r);
947
956
  case f.ZodNumber:
948
- return Oe(n, r);
957
+ return Te(n, r);
949
958
  case f.ZodObject:
950
- return _e(n, r);
959
+ return Re(n, r);
951
960
  case f.ZodBigInt:
952
- return ce(n, r);
961
+ return de(n, r);
953
962
  case f.ZodBoolean:
954
- return le();
963
+ return me();
955
964
  case f.ZodDate:
956
- return ee(n, r);
965
+ return re(n, r);
957
966
  case f.ZodUndefined:
958
- return De(r);
967
+ return Ze(r);
959
968
  case f.ZodNull:
960
- return ve(r);
969
+ return Oe(r);
961
970
  case f.ZodArray:
962
- return ie(n, r);
971
+ return ue(n, r);
963
972
  case f.ZodUnion:
964
973
  case f.ZodDiscriminatedUnion:
965
- return Se(n, r);
974
+ return _e(n, r);
966
975
  case f.ZodIntersection:
967
- return fe(n, r);
976
+ return be(n, r);
968
977
  case f.ZodTuple:
969
- return je(n, r);
978
+ return Me(n, r);
970
979
  case f.ZodRecord:
971
- return re(n, r);
980
+ return oe(n, r);
972
981
  case f.ZodLiteral:
973
- return ye(n, r);
982
+ return Ee(n, r);
974
983
  case f.ZodEnum:
975
- return he(n);
984
+ return ye(n);
976
985
  case f.ZodNativeEnum:
977
- return Ae(n);
986
+ return Se(n);
978
987
  case f.ZodNullable:
979
- return xe(n, r);
988
+ return Pe(n, r);
980
989
  case f.ZodOptional:
981
- return Re(n, r);
990
+ return Ne(n, r);
982
991
  case f.ZodMap:
983
- return ke(n, r);
992
+ return ve(n, r);
984
993
  case f.ZodSet:
985
- return Ie(n, r);
994
+ return Ce(n, r);
986
995
  case f.ZodLazy:
987
996
  return () => n.getter()._def;
988
997
  case f.ZodPromise:
989
- return Ne(n, r);
998
+ return De(n, r);
990
999
  case f.ZodNaN:
991
1000
  case f.ZodNever:
992
- return Ee(r);
1001
+ return xe(r);
993
1002
  case f.ZodEffects:
994
- return pe(n, r);
1003
+ return fe(n, r);
995
1004
  case f.ZodAny:
996
1005
  return P(r);
997
1006
  case f.ZodUnknown:
998
- return Me(r);
1007
+ return qe(r);
999
1008
  case f.ZodDefault:
1000
- return me(n, r);
1009
+ return ge(n, r);
1001
1010
  case f.ZodBranded:
1002
- return Q(n, r);
1011
+ return te(n, r);
1003
1012
  case f.ZodReadonly:
1004
- return Ce(n, r);
1013
+ return Le(n, r);
1005
1014
  case f.ZodCatch:
1006
- return de(n, r);
1015
+ return pe(n, r);
1007
1016
  case f.ZodPipeline:
1008
- return $e(n, r);
1017
+ return je(n, r);
1009
1018
  case f.ZodFunction:
1010
1019
  case f.ZodVoid:
1011
1020
  case f.ZodSymbol:
@@ -1020,38 +1029,38 @@ function b(n, e, r = !1) {
1020
1029
  const t = e.seen.get(n);
1021
1030
  if (e.override) {
1022
1031
  const i = (c = e.override) == null ? void 0 : c.call(e, n, e, t, r);
1023
- if (i !== oe)
1032
+ if (i !== ie)
1024
1033
  return i;
1025
1034
  }
1026
1035
  if (t && !r) {
1027
- const i = Le(t, e);
1036
+ const i = ze(t, e);
1028
1037
  if (i !== void 0)
1029
1038
  return i;
1030
1039
  }
1031
1040
  const o = { def: n, path: e.currentPath, jsonSchema: void 0 };
1032
1041
  e.seen.set(n, o);
1033
- const a = Ze(n, n.typeName, e), s = typeof a == "function" ? b(a(), e) : a;
1034
- if (s && qe(n, e, s), e.postProcess) {
1042
+ const a = Ue(n, n.typeName, e), s = typeof a == "function" ? b(a(), e) : a;
1043
+ if (s && Be(n, e, s), e.postProcess) {
1035
1044
  const i = e.postProcess(s, n, e);
1036
1045
  return o.jsonSchema = s, i;
1037
1046
  }
1038
1047
  return o.jsonSchema = s, s;
1039
1048
  }
1040
- const Le = (n, e) => {
1049
+ const ze = (n, e) => {
1041
1050
  switch (e.$refStrategy) {
1042
1051
  case "root":
1043
1052
  return { $ref: n.path.join("/") };
1044
1053
  case "relative":
1045
- return { $ref: X(e.currentPath, n.path) };
1054
+ return { $ref: ee(e.currentPath, n.path) };
1046
1055
  case "none":
1047
1056
  case "seen":
1048
1057
  return n.path.length < e.currentPath.length && n.path.every((r, t) => e.currentPath[t] === r) ? (console.warn(`Recursive reference detected at ${e.currentPath.join("/")}! Defaulting to any`), P(e)) : e.$refStrategy === "seen" ? P(e) : void 0;
1049
1058
  }
1050
- }, qe = (n, e, r) => (n.description && (r.description = n.description, e.markdownDescription && (r.markdownDescription = n.description)), r), Ue = (n, e) => {
1051
- const r = se(e);
1052
- let t = typeof e == "object" && e.definitions ? Object.entries(e.definitions).reduce((i, [l, d]) => ({
1059
+ }, Be = (n, e, r) => (n.description && (r.description = n.description, e.markdownDescription && (r.markdownDescription = n.description)), r), Je = (n, e) => {
1060
+ const r = le(e);
1061
+ let t = typeof e == "object" && e.definitions ? Object.entries(e.definitions).reduce((i, [l, u]) => ({
1053
1062
  ...i,
1054
- [l]: b(d._def, {
1063
+ [l]: b(u._def, {
1055
1064
  ...r,
1056
1065
  currentPath: [...r.basePath, r.definitionPath, l]
1057
1066
  }, !0) ?? P(r)
@@ -1087,21 +1096,28 @@ const Le = (n, e) => {
1087
1096
  };
1088
1097
  return r.target === "jsonSchema7" ? c.$schema = "http://json-schema.org/draft-07/schema#" : (r.target === "jsonSchema2019-09" || r.target === "openAi") && (c.$schema = "https://json-schema.org/draft/2019-09/schema#"), r.target === "openAi" && ("anyOf" in c || "oneOf" in c || "allOf" in c || "type" in c && Array.isArray(c.type)) && console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property."), c;
1089
1098
  };
1090
- function lt(n) {
1091
- const e = Ue(n.parameters, { target: "jsonSchema7", $refStrategy: "none" });
1099
+ function mt(n) {
1100
+ const e = Je(n.parameters, { target: "jsonSchema7", $refStrategy: "none" });
1092
1101
  return {
1093
1102
  name: n.name,
1094
1103
  description: n.description,
1095
1104
  parameters: e
1096
1105
  };
1097
1106
  }
1098
- function ze(n) {
1107
+ function Ge(n) {
1099
1108
  const e = /* @__PURE__ */ new Set(["$schema", "additionalProperties", "default"]), r = (t) => Array.isArray(t) ? t.map(r) : t && typeof t == "object" ? Object.fromEntries(
1100
1109
  Object.entries(t).filter(([o]) => !e.has(o)).map(([o, a]) => [o, r(a)])
1101
1110
  ) : t;
1102
1111
  return r(n);
1103
1112
  }
1104
- class Be {
1113
+ const Z = (n) => {
1114
+ try {
1115
+ return JSON.parse(n);
1116
+ } catch {
1117
+ return { error: { message: n } };
1118
+ }
1119
+ };
1120
+ class Ye {
1105
1121
  async *streamChat(e, r, t) {
1106
1122
  var p, h, w, g;
1107
1123
  const { apiKey: o, model: a = x["google-gemini"] } = r;
@@ -1110,7 +1126,7 @@ class Be {
1110
1126
  functionDeclarations: t.map((y) => ({
1111
1127
  name: y.name,
1112
1128
  description: y.description,
1113
- parameters: ze(y.parameters)
1129
+ parameters: Ge(y.parameters)
1114
1130
  }))
1115
1131
  }] : void 0, l = await fetch(
1116
1132
  `https://generativelanguage.googleapis.com/v1beta/models/${a}:streamGenerateContent?alt=sse`,
@@ -1126,28 +1142,28 @@ class Be {
1126
1142
  );
1127
1143
  if (!l.ok) {
1128
1144
  const y = await l.text();
1129
- throw new Error(`Gemini Error ${l.status}: ${y}`);
1145
+ throw this.normalizeError(l.status, Z(y));
1130
1146
  }
1131
- const d = (p = l.body) == null ? void 0 : p.getReader();
1132
- if (!d) throw new Error("No response body");
1133
- const u = new TextDecoder();
1147
+ const u = (p = l.body) == null ? void 0 : p.getReader();
1148
+ if (!u) throw new Error("No response body");
1149
+ const d = new TextDecoder();
1134
1150
  let m = "";
1135
1151
  for (; ; ) {
1136
- const { done: y, value: A } = await d.read();
1152
+ const { done: y, value: A } = await u.read();
1137
1153
  if (y) break;
1138
- m += u.decode(A, { stream: !0 });
1154
+ m += d.decode(A, { stream: !0 });
1139
1155
  const S = m.split(`
1140
1156
  `);
1141
1157
  m = S.pop() || "";
1142
1158
  for (const v of S) {
1143
- const k = v.trim();
1144
- if (!(!k || !k.startsWith("data: ")))
1159
+ const E = v.trim();
1160
+ if (!(!E || !E.startsWith("data: ")))
1145
1161
  try {
1146
- const j = ((g = (w = (h = JSON.parse(k.slice(6)).candidates) == null ? void 0 : h[0]) == null ? void 0 : w.content) == null ? void 0 : g.parts) ?? [];
1147
- for (const I of j)
1148
- I.text && (yield { type: "text-delta", text: I.text }), I.functionCall && (yield {
1162
+ const j = ((g = (w = (h = JSON.parse(E.slice(6)).candidates) == null ? void 0 : h[0]) == null ? void 0 : w.content) == null ? void 0 : g.parts) ?? [];
1163
+ for (const N of j)
1164
+ N.text && (yield { type: "text-delta", text: N.text }), N.functionCall && (yield {
1149
1165
  type: "tool-call",
1150
- toolCall: { name: I.functionCall.name, arguments: I.functionCall.args ?? {} }
1166
+ toolCall: { name: N.functionCall.name, arguments: N.functionCall.args ?? {} }
1151
1167
  });
1152
1168
  } catch {
1153
1169
  }
@@ -1155,7 +1171,7 @@ class Be {
1155
1171
  }
1156
1172
  }
1157
1173
  async generateText(e, r) {
1158
- var i, l, d, u, m;
1174
+ var i, l, u, d, m;
1159
1175
  const { apiKey: t, model: o = x["google-gemini"], temperature: a = 0.7 } = r;
1160
1176
  if (!t) throw new Error("Gemini API key required");
1161
1177
  if (!o) throw new Error("GeminiAdapter: model is required but was undefined");
@@ -1175,12 +1191,12 @@ class Be {
1175
1191
  );
1176
1192
  if (!s.ok) {
1177
1193
  const p = await s.text();
1178
- throw new Error(`Gemini Error ${s.status}: ${p}`);
1194
+ throw this.normalizeError(s.status, Z(p));
1179
1195
  }
1180
- return ((m = (u = (d = (l = (i = (await s.json()).candidates) == null ? void 0 : i[0]) == null ? void 0 : l.content) == null ? void 0 : d.parts) == null ? void 0 : u[0]) == null ? void 0 : m.text) || "";
1196
+ return ((m = (d = (u = (l = (i = (await s.json()).candidates) == null ? void 0 : i[0]) == null ? void 0 : l.content) == null ? void 0 : u.parts) == null ? void 0 : d[0]) == null ? void 0 : m.text) || "";
1181
1197
  }
1182
1198
  async *streamText(e, r) {
1183
- var l, d, u, m, p, h;
1199
+ var l, u, d, m, p, h;
1184
1200
  const { apiKey: t, model: o = x["google-gemini"] } = r;
1185
1201
  if (!t) throw new Error("Gemini API key required");
1186
1202
  if (!o) throw new Error("GeminiAdapter: model is required but was undefined");
@@ -1199,7 +1215,7 @@ class Be {
1199
1215
  );
1200
1216
  if (!a.ok) {
1201
1217
  const w = await a.text();
1202
- throw new Error(`Gemini Error ${a.status}: ${w}`);
1218
+ throw this.normalizeError(a.status, Z(w));
1203
1219
  }
1204
1220
  const s = (l = a.body) == null ? void 0 : l.getReader();
1205
1221
  if (!s) throw new Error("No response body");
@@ -1216,8 +1232,8 @@ class Be {
1216
1232
  const S = A.trim();
1217
1233
  if (!(!S || !S.startsWith("data: ")))
1218
1234
  try {
1219
- const k = (h = (p = (m = (u = (d = JSON.parse(S.slice(6)).candidates) == null ? void 0 : d[0]) == null ? void 0 : u.content) == null ? void 0 : m.parts) == null ? void 0 : p[0]) == null ? void 0 : h.text;
1220
- k && (yield k);
1235
+ const E = (h = (p = (m = (d = (u = JSON.parse(S.slice(6)).candidates) == null ? void 0 : u[0]) == null ? void 0 : d.content) == null ? void 0 : m.parts) == null ? void 0 : p[0]) == null ? void 0 : h.text;
1236
+ E && (yield E);
1221
1237
  } catch {
1222
1238
  continue;
1223
1239
  }
@@ -1225,7 +1241,7 @@ class Be {
1225
1241
  }
1226
1242
  }
1227
1243
  async generateObject(e, r, t) {
1228
- var l, d, u, m, p;
1244
+ var l, u, d, m, p;
1229
1245
  const { apiKey: o, model: a = x["google-gemini"] } = t;
1230
1246
  if (!o) throw new Error("Gemini API key required");
1231
1247
  if (!a) throw new Error("GeminiAdapter: model is required but was undefined");
@@ -1248,9 +1264,9 @@ class Be {
1248
1264
  );
1249
1265
  if (!s.ok) {
1250
1266
  const h = await s.json();
1251
- throw this.normalizeError(h, s.status);
1267
+ throw this.normalizeError(s.status, h);
1252
1268
  }
1253
- const i = ((p = (m = (u = (d = (l = (await s.json()).candidates) == null ? void 0 : l[0]) == null ? void 0 : d.content) == null ? void 0 : u.parts) == null ? void 0 : m[0]) == null ? void 0 : p.text) || "{}";
1269
+ const i = ((p = (m = (d = (u = (l = (await s.json()).candidates) == null ? void 0 : l[0]) == null ? void 0 : u.content) == null ? void 0 : d.parts) == null ? void 0 : m[0]) == null ? void 0 : p.text) || "{}";
1254
1270
  return JSON.parse(i);
1255
1271
  }
1256
1272
  async listModels(e) {
@@ -1262,24 +1278,39 @@ class Be {
1262
1278
  headers: { "x-goog-api-key": e }
1263
1279
  }
1264
1280
  );
1265
- if (!r.ok)
1266
- throw new Error("Failed to fetch model list");
1281
+ if (!r.ok) {
1282
+ const a = await r.text();
1283
+ throw this.normalizeError(r.status, Z(a));
1284
+ }
1267
1285
  return ((o = (await r.json()).models) == null ? void 0 : o.map((a) => a.name)) || [];
1268
1286
  }
1269
1287
  normalizeError(e, r) {
1270
- var t;
1271
- if (r === 429) {
1272
- const o = new Error("Rate limit exceeded. Please wait 30 seconds before retrying.");
1273
- return o.code = "RATE_LIMIT", o;
1288
+ var a;
1289
+ const t = ((a = r == null ? void 0 : r.error) == null ? void 0 : a.message) || (r == null ? void 0 : r.message) || "Gemini request failed";
1290
+ if (e === 429) {
1291
+ const s = new Error(`Rate limit exceeded: ${t}`);
1292
+ return s.code = "RATE_LIMIT_EXCEEDED", s.status = 429, s;
1274
1293
  }
1275
- if (r === 401 || r === 403) {
1276
- const o = new Error("Invalid API key.");
1277
- return o.code = "AUTH_ERROR", o;
1294
+ if (e === 401 || e === 403) {
1295
+ const s = new Error(`Authentication failed: ${t}`);
1296
+ return s.code = "AUTH_ERROR", s.status = e, s;
1278
1297
  }
1279
- return new Error(((t = e.error) == null ? void 0 : t.message) || "Unknown error");
1298
+ if (e === 400) {
1299
+ const s = new Error(`Bad request: ${t}`);
1300
+ return s.code = "INVALID_REQUEST", s.status = 400, s;
1301
+ }
1302
+ const o = new Error(t);
1303
+ return o.code = "API_ERROR", o.status = e, o;
1280
1304
  }
1281
1305
  }
1282
- class Je {
1306
+ const B = (n) => {
1307
+ try {
1308
+ return JSON.parse(n);
1309
+ } catch {
1310
+ return { error: n };
1311
+ }
1312
+ };
1313
+ class We {
1283
1314
  /**
1284
1315
  * Tool calling requires /api/chat, not /api/generate (which has no tool
1285
1316
  * support at all). Tool support itself is model-dependent (llama3.1+,
@@ -1288,7 +1319,7 @@ class Je {
1288
1319
  * this degrades gracefully rather than special-casing it.
1289
1320
  */
1290
1321
  async *streamChat(e, r, t) {
1291
- var u, m, p, h, w;
1322
+ var d, m, p, h, w;
1292
1323
  const { baseUrl: o = "http://localhost:11434", model: a = x.ollama } = r, s = t != null && t.length ? t.map((g) => ({ type: "function", function: { name: g.name, description: g.description, parameters: g.parameters } })) : void 0, c = await fetch(`${o}/api/chat`, {
1293
1324
  method: "POST",
1294
1325
  headers: { "Content-Type": "application/json" },
@@ -1301,29 +1332,29 @@ class Je {
1301
1332
  });
1302
1333
  if (!c.ok) {
1303
1334
  const g = await c.text();
1304
- throw new Error(`Ollama Error ${c.status}: ${g}`);
1335
+ throw this.normalizeError(c.status, B(g));
1305
1336
  }
1306
- const i = (u = c.body) == null ? void 0 : u.getReader();
1337
+ const i = (d = c.body) == null ? void 0 : d.getReader();
1307
1338
  if (!i) throw new Error("No response body");
1308
1339
  const l = new TextDecoder();
1309
- let d = "";
1340
+ let u = "";
1310
1341
  for (; ; ) {
1311
1342
  const { done: g, value: y } = await i.read();
1312
1343
  if (g) break;
1313
- d += l.decode(y, { stream: !0 });
1314
- const A = d.split(`
1344
+ u += l.decode(y, { stream: !0 });
1345
+ const A = u.split(`
1315
1346
  `);
1316
- d = A.pop() || "";
1347
+ u = A.pop() || "";
1317
1348
  for (const S of A) {
1318
1349
  const v = S.trim();
1319
1350
  if (v)
1320
1351
  try {
1321
- const k = JSON.parse(v);
1322
- if ((m = k.message) != null && m.content && (yield { type: "text-delta", text: k.message.content }), (p = k.message) != null && p.tool_calls)
1323
- for (const N of k.message.tool_calls)
1352
+ const E = JSON.parse(v);
1353
+ if ((m = E.message) != null && m.content && (yield { type: "text-delta", text: E.message.content }), (p = E.message) != null && p.tool_calls)
1354
+ for (const I of E.message.tool_calls)
1324
1355
  yield {
1325
1356
  type: "tool-call",
1326
- toolCall: { name: (h = N.function) == null ? void 0 : h.name, arguments: ((w = N.function) == null ? void 0 : w.arguments) ?? {} }
1357
+ toolCall: { name: (h = I.function) == null ? void 0 : h.name, arguments: ((w = I.function) == null ? void 0 : w.arguments) ?? {} }
1327
1358
  };
1328
1359
  } catch {
1329
1360
  }
@@ -1342,7 +1373,7 @@ class Je {
1342
1373
  });
1343
1374
  if (!a.ok) {
1344
1375
  const c = await a.text();
1345
- throw new Error(`Ollama Error ${a.status}: ${c}`);
1376
+ throw this.normalizeError(a.status, B(c));
1346
1377
  }
1347
1378
  return (await a.json()).response;
1348
1379
  }
@@ -1358,17 +1389,17 @@ class Je {
1358
1389
  })
1359
1390
  });
1360
1391
  if (!a.ok) {
1361
- const d = await a.text();
1362
- throw new Error(`Ollama Error ${a.status}: ${d}`);
1392
+ const u = await a.text();
1393
+ throw this.normalizeError(a.status, B(u));
1363
1394
  }
1364
1395
  const s = (l = a.body) == null ? void 0 : l.getReader();
1365
1396
  if (!s) throw new Error("No response body");
1366
1397
  const c = new TextDecoder();
1367
1398
  let i = "";
1368
1399
  for (; ; ) {
1369
- const { done: d, value: u } = await s.read();
1370
- if (d) break;
1371
- i += c.decode(u, { stream: !0 });
1400
+ const { done: u, value: d } = await s.read();
1401
+ if (u) break;
1402
+ i += c.decode(d, { stream: !0 });
1372
1403
  const m = i.split(`
1373
1404
  `);
1374
1405
  i = m.pop() || "";
@@ -1397,17 +1428,36 @@ Do not include any explanation, only the raw JSON object.`, a = await this.gener
1397
1428
  var a;
1398
1429
  const t = await fetch(`${r}/api/tags`);
1399
1430
  if (!t.ok)
1400
- throw new Error(`Failed to fetch Ollama models. Is Ollama running at ${r}?`);
1431
+ throw this.normalizeError(t.status, {
1432
+ error: `Failed to fetch Ollama models. Is Ollama running at ${r}?`
1433
+ });
1401
1434
  return ((a = (await t.json()).models) == null ? void 0 : a.map((s) => s.name)) || [];
1402
1435
  }
1436
+ normalizeError(e, r) {
1437
+ const t = (r == null ? void 0 : r.error) || (r == null ? void 0 : r.message) || "Ollama request failed";
1438
+ if (e === 429) {
1439
+ const a = new Error(`Rate limit exceeded: ${t}`);
1440
+ return a.code = "RATE_LIMIT_EXCEEDED", a.status = 429, a;
1441
+ }
1442
+ if (e === 401 || e === 403) {
1443
+ const a = new Error(`Authentication failed: ${t}`);
1444
+ return a.code = "AUTH_ERROR", a.status = e, a;
1445
+ }
1446
+ if (e === 400) {
1447
+ const a = new Error(`Bad request: ${t}`);
1448
+ return a.code = "INVALID_REQUEST", a.status = 400, a;
1449
+ }
1450
+ const o = new Error(t);
1451
+ return o.code = "API_ERROR", o.status = e, o;
1452
+ }
1403
1453
  }
1404
- const Z = (n) => {
1454
+ const q = (n) => {
1405
1455
  try {
1406
1456
  return JSON.parse(n);
1407
1457
  } catch {
1408
1458
  return { error: { message: n } };
1409
1459
  }
1410
- }, z = (n) => typeof n == "string" ? n ? [{ type: "text", text: n }] : [] : n, Ge = (n) => {
1460
+ }, J = (n) => typeof n == "string" ? n ? [{ type: "text", text: n }] : [] : n, He = (n) => {
1411
1461
  var r;
1412
1462
  const e = [];
1413
1463
  for (const t of n) {
@@ -1419,7 +1469,7 @@ const Z = (n) => {
1419
1469
  } : t.role === "assistant" && ((r = t.toolCalls) != null && r.length) ? o = {
1420
1470
  role: "assistant",
1421
1471
  content: [
1422
- ...z(t.content),
1472
+ ...J(t.content),
1423
1473
  ...t.toolCalls.map((s) => ({
1424
1474
  type: "tool_use",
1425
1475
  id: s.id ?? "",
@@ -1429,11 +1479,11 @@ const Z = (n) => {
1429
1479
  ]
1430
1480
  } : o = { role: t.role, content: t.content };
1431
1481
  const a = e[e.length - 1];
1432
- a && a.role === o.role ? a.content = [...z(a.content), ...z(o.content)] : e.push(o);
1482
+ a && a.role === o.role ? a.content = [...J(a.content), ...J(o.content)] : e.push(o);
1433
1483
  }
1434
1484
  return e;
1435
1485
  };
1436
- class Ye {
1486
+ class Fe {
1437
1487
  async *streamChat(e, r, t) {
1438
1488
  var y, A, S;
1439
1489
  const {
@@ -1444,7 +1494,7 @@ class Ye {
1444
1494
  baseUrl: i = "https://api.anthropic.com/v1"
1445
1495
  } = r;
1446
1496
  if (!o) throw new Error("Anthropic API key required");
1447
- const l = e.find((v) => v.role === "system"), d = Ge(e), u = t != null && t.length ? t.map((v) => ({ name: v.name, description: v.description, input_schema: v.parameters })) : void 0, m = await fetch(`${i}/messages`, {
1497
+ const l = e.find((v) => v.role === "system"), u = He(e), d = t != null && t.length ? t.map((v) => ({ name: v.name, description: v.description, input_schema: v.parameters })) : void 0, m = await fetch(`${i}/messages`, {
1448
1498
  method: "POST",
1449
1499
  headers: {
1450
1500
  "Content-Type": "application/json",
@@ -1454,34 +1504,34 @@ class Ye {
1454
1504
  },
1455
1505
  body: JSON.stringify({
1456
1506
  model: a,
1457
- messages: d,
1507
+ messages: u,
1458
1508
  ...l && { system: l.content },
1459
1509
  max_tokens: c,
1460
1510
  temperature: s,
1461
1511
  stream: !0,
1462
- ...u && { tools: u }
1512
+ ...d && { tools: d }
1463
1513
  })
1464
1514
  });
1465
1515
  if (!m.ok) {
1466
1516
  const v = await m.text();
1467
- throw this.normalizeError(m.status, Z(v));
1517
+ throw this.normalizeError(m.status, q(v));
1468
1518
  }
1469
1519
  if (!m.body) throw new Error("No response body for streaming");
1470
1520
  const p = m.body.getReader(), h = new TextDecoder();
1471
1521
  let w = "", g = null;
1472
1522
  try {
1473
1523
  for (; ; ) {
1474
- const { done: v, value: k } = await p.read();
1524
+ const { done: v, value: E } = await p.read();
1475
1525
  if (v) break;
1476
- w += h.decode(k, { stream: !0 });
1477
- const N = w.split(`
1526
+ w += h.decode(E, { stream: !0 });
1527
+ const I = w.split(`
1478
1528
  `);
1479
- w = N.pop() || "";
1480
- for (const j of N) {
1481
- const I = j.trim();
1482
- if (!(!I || !I.startsWith("data: ")))
1529
+ w = I.pop() || "";
1530
+ for (const j of I) {
1531
+ const N = j.trim();
1532
+ if (!(!N || !N.startsWith("data: ")))
1483
1533
  try {
1484
- const T = JSON.parse(I.slice(6));
1534
+ const T = JSON.parse(N.slice(6));
1485
1535
  if (T.type === "content_block_start" && ((y = T.content_block) == null ? void 0 : y.type) === "tool_use")
1486
1536
  g = { id: T.content_block.id, name: T.content_block.name, argsBuf: "" };
1487
1537
  else if (T.type === "content_block_delta")
@@ -1509,7 +1559,7 @@ class Ye {
1509
1559
  }
1510
1560
  }
1511
1561
  async generateText(e, r) {
1512
- var d, u;
1562
+ var u, d;
1513
1563
  const {
1514
1564
  apiKey: t,
1515
1565
  model: o = x.anthropic,
@@ -1537,9 +1587,9 @@ class Ye {
1537
1587
  });
1538
1588
  if (!i.ok) {
1539
1589
  const m = await i.text();
1540
- throw console.error("🔴 RAW ANTHROPIC ERROR:", i.status, m), console.error("🔴 Request was made to:", `${c}/messages`), console.error("🔴 Model requested:", o), this.normalizeError(i.status, Z(m));
1590
+ throw console.error("🔴 RAW ANTHROPIC ERROR:", i.status, m), console.error("🔴 Request was made to:", `${c}/messages`), console.error("🔴 Model requested:", o), this.normalizeError(i.status, q(m));
1541
1591
  }
1542
- return ((u = (d = (await i.json()).content) == null ? void 0 : d[0]) == null ? void 0 : u.text) || "";
1592
+ return ((d = (u = (await i.json()).content) == null ? void 0 : u[0]) == null ? void 0 : d.text) || "";
1543
1593
  }
1544
1594
  async *streamText(e, r) {
1545
1595
  var m;
@@ -1571,19 +1621,19 @@ class Ye {
1571
1621
  });
1572
1622
  if (!i.ok) {
1573
1623
  const p = await i.text();
1574
- throw console.error("🔴 RAW ANTHROPIC STREAM ERROR:", i.status, p), console.error("🔴 Request was made to:", `${c}/messages`), console.error("🔴 Model requested:", o), this.normalizeError(i.status, Z(p));
1624
+ throw console.error("🔴 RAW ANTHROPIC STREAM ERROR:", i.status, p), console.error("🔴 Request was made to:", `${c}/messages`), console.error("🔴 Model requested:", o), this.normalizeError(i.status, q(p));
1575
1625
  }
1576
1626
  if (!i.body) throw new Error("No response body for streaming");
1577
- const l = i.body.getReader(), d = new TextDecoder();
1578
- let u = "";
1627
+ const l = i.body.getReader(), u = new TextDecoder();
1628
+ let d = "";
1579
1629
  try {
1580
1630
  for (; ; ) {
1581
1631
  const { done: p, value: h } = await l.read();
1582
1632
  if (p) break;
1583
- u += d.decode(h, { stream: !0 });
1584
- const w = u.split(`
1633
+ d += u.decode(h, { stream: !0 });
1634
+ const w = d.split(`
1585
1635
  `);
1586
- u = w.pop() || "";
1636
+ d = w.pop() || "";
1587
1637
  for (const g of w) {
1588
1638
  const y = g.trim();
1589
1639
  if (!y || !y.startsWith("data: ")) continue;
@@ -1629,9 +1679,9 @@ class Ye {
1629
1679
  const l = r ? `
1630
1680
 
1631
1681
  It must match this shape:
1632
- ${JSON.stringify(r)}` : "", d = `${e}${l}
1682
+ ${JSON.stringify(r)}` : "", u = `${e}${l}
1633
1683
 
1634
- IMPORTANT: Respond ONLY with valid JSON. No markdown, no explanation, just the JSON object.`, u = await fetch(`${i}/messages`, {
1684
+ IMPORTANT: Respond ONLY with valid JSON. No markdown, no explanation, just the JSON object.`, d = await fetch(`${i}/messages`, {
1635
1685
  method: "POST",
1636
1686
  headers: {
1637
1687
  "Content-Type": "application/json",
@@ -1641,21 +1691,21 @@ IMPORTANT: Respond ONLY with valid JSON. No markdown, no explanation, just the J
1641
1691
  },
1642
1692
  body: JSON.stringify({
1643
1693
  model: a,
1644
- messages: [{ role: "user", content: d }],
1694
+ messages: [{ role: "user", content: u }],
1645
1695
  max_tokens: c,
1646
1696
  // REQUIRED by Anthropic
1647
1697
  temperature: s
1648
1698
  })
1649
1699
  });
1650
- if (!u.ok) {
1651
- const A = await u.text();
1652
- throw console.error("🔴 RAW ANTHROPIC OBJECT ERROR:", u.status, A), console.error("🔴 Request was made to:", `${i}/messages`), console.error("🔴 Model requested:", a), this.normalizeError(u.status, Z(A));
1700
+ if (!d.ok) {
1701
+ const A = await d.text();
1702
+ throw console.error("🔴 RAW ANTHROPIC OBJECT ERROR:", d.status, A), console.error("🔴 Request was made to:", `${i}/messages`), console.error("🔴 Model requested:", a), this.normalizeError(d.status, q(A));
1653
1703
  }
1654
- const p = ((y = (g = (await u.json()).content) == null ? void 0 : g[0]) == null ? void 0 : y.text) || "{}", h = p.match(/\{[\s\S]*\}/), w = h ? h[0] : p;
1704
+ const p = ((y = (g = (await d.json()).content) == null ? void 0 : g[0]) == null ? void 0 : y.text) || "{}", h = p.match(/\{[\s\S]*\}/), w = h ? h[0] : p;
1655
1705
  return JSON.parse(w);
1656
1706
  }
1657
1707
  async listModels(e, r) {
1658
- return [...B.anthropic];
1708
+ return [...G.anthropic];
1659
1709
  }
1660
1710
  normalizeError(e, r) {
1661
1711
  var a;
@@ -1676,15 +1726,15 @@ IMPORTANT: Respond ONLY with valid JSON. No markdown, no explanation, just the J
1676
1726
  return o.code = "API_ERROR", o.status = e, o;
1677
1727
  }
1678
1728
  }
1679
- function M(n) {
1729
+ function C(n) {
1680
1730
  if (!(!n || n.length === 0))
1681
1731
  return n.map((e) => ({
1682
1732
  type: "function",
1683
1733
  function: { name: e.name, description: e.description, parameters: e.parameters }
1684
1734
  }));
1685
1735
  }
1686
- async function* J(n, e, r, t) {
1687
- var l, d, u, m;
1736
+ async function* Y(n, e, r, t) {
1737
+ var l, u, d, m;
1688
1738
  const o = await fetch(n, {
1689
1739
  method: "POST",
1690
1740
  headers: e,
@@ -1712,12 +1762,12 @@ async function* J(n, e, r, t) {
1712
1762
  const A = y.slice(6);
1713
1763
  if (A !== "[DONE]")
1714
1764
  try {
1715
- const v = (d = (l = JSON.parse(A).choices) == null ? void 0 : l[0]) == null ? void 0 : d.delta;
1765
+ const v = (u = (l = JSON.parse(A).choices) == null ? void 0 : l[0]) == null ? void 0 : u.delta;
1716
1766
  if (!v) continue;
1717
1767
  if (v.content && (yield { type: "text-delta", text: v.content }), v.tool_calls)
1718
- for (const k of v.tool_calls) {
1719
- const N = k.index ?? 0, j = i.get(N) ?? { name: "", args: "" };
1720
- k.id && (j.id = k.id), (u = k.function) != null && u.name && (j.name += k.function.name), (m = k.function) != null && m.arguments && (j.args += k.function.arguments), i.set(N, j);
1768
+ for (const E of v.tool_calls) {
1769
+ const I = E.index ?? 0, j = i.get(I) ?? { name: "", args: "" };
1770
+ E.id && (j.id = E.id), (d = E.function) != null && d.name && (j.name += E.function.name), (m = E.function) != null && m.arguments && (j.args += E.function.arguments), i.set(I, j);
1721
1771
  }
1722
1772
  } catch {
1723
1773
  }
@@ -1740,28 +1790,28 @@ async function* J(n, e, r, t) {
1740
1790
  } catch {
1741
1791
  }
1742
1792
  }
1743
- function G(n) {
1793
+ function W(n) {
1744
1794
  return n.map((e) => ({ role: e.role, content: e.content }));
1745
1795
  }
1746
- class We {
1796
+ class Ve {
1747
1797
  async *streamChat(e, r, t) {
1748
1798
  const { apiKey: o, model: a = x.openai, temperature: s = 0.7, baseUrl: c = "https://api.openai.com/v1" } = r;
1749
1799
  if (!o) throw new Error("OpenAI API key required");
1750
- yield* J(
1800
+ yield* Y(
1751
1801
  `${c}/chat/completions`,
1752
1802
  { "Content-Type": "application/json", Authorization: `Bearer ${o}` },
1753
1803
  {
1754
1804
  model: a,
1755
- messages: G(e),
1805
+ messages: W(e),
1756
1806
  temperature: s,
1757
1807
  stream: !0,
1758
- ...M(t) && { tools: M(t), tool_choice: "auto" }
1808
+ ...C(t) && { tools: C(t), tool_choice: "auto" }
1759
1809
  },
1760
1810
  this.normalizeError
1761
1811
  );
1762
1812
  }
1763
1813
  async generateText(e, r) {
1764
- var l, d, u;
1814
+ var l, u, d;
1765
1815
  const { apiKey: t, model: o = x.openai, temperature: a = 0.7, baseUrl: s = "https://api.openai.com/v1" } = r;
1766
1816
  if (!t) throw new Error("OpenAI API key required");
1767
1817
  const c = await fetch(`${s}/chat/completions`, {
@@ -1780,10 +1830,10 @@ class We {
1780
1830
  const m = await c.json();
1781
1831
  throw this.normalizeError(c.status, m);
1782
1832
  }
1783
- return ((u = (d = (l = (await c.json()).choices) == null ? void 0 : l[0]) == null ? void 0 : d.message) == null ? void 0 : u.content) || "";
1833
+ return ((d = (u = (l = (await c.json()).choices) == null ? void 0 : l[0]) == null ? void 0 : u.message) == null ? void 0 : d.content) || "";
1784
1834
  }
1785
1835
  async *streamText(e, r) {
1786
- var u, m, p;
1836
+ var d, m, p;
1787
1837
  const { apiKey: t, model: o = x.openai, temperature: a = 0.7, baseUrl: s = "https://api.openai.com/v1" } = r;
1788
1838
  if (!t) throw new Error("OpenAI API key required");
1789
1839
  const c = await fetch(`${s}/chat/completions`, {
@@ -1805,23 +1855,23 @@ class We {
1805
1855
  }
1806
1856
  if (!c.body) throw new Error("No response body for streaming");
1807
1857
  const i = c.body.getReader(), l = new TextDecoder();
1808
- let d = "";
1858
+ let u = "";
1809
1859
  try {
1810
1860
  for (; ; ) {
1811
1861
  const { done: h, value: w } = await i.read();
1812
1862
  if (h) break;
1813
- d += l.decode(w, { stream: !0 });
1814
- const g = d.split(`
1863
+ u += l.decode(w, { stream: !0 });
1864
+ const g = u.split(`
1815
1865
  `);
1816
- d = g.pop() || "";
1866
+ u = g.pop() || "";
1817
1867
  for (const y of g) {
1818
1868
  const A = y.trim();
1819
1869
  if (!A || !A.startsWith("data: ")) continue;
1820
1870
  const S = A.slice(6);
1821
1871
  if (S !== "[DONE]")
1822
1872
  try {
1823
- const k = (p = (m = (u = JSON.parse(S).choices) == null ? void 0 : u[0]) == null ? void 0 : m.delta) == null ? void 0 : p.content;
1824
- k && (yield k);
1873
+ const E = (p = (m = (d = JSON.parse(S).choices) == null ? void 0 : d[0]) == null ? void 0 : m.delta) == null ? void 0 : p.content;
1874
+ E && (yield E);
1825
1875
  } catch {
1826
1876
  }
1827
1877
  }
@@ -1831,7 +1881,7 @@ class We {
1831
1881
  }
1832
1882
  }
1833
1883
  async generateObject(e, r, t) {
1834
- var u, m, p;
1884
+ var d, m, p;
1835
1885
  const { apiKey: o, model: a = x.openai, temperature: s = 0.7, baseUrl: c = "https://api.openai.com/v1" } = t;
1836
1886
  if (!o) throw new Error("OpenAI API key required");
1837
1887
  const i = await fetch(`${c}/chat/completions`, {
@@ -1851,8 +1901,8 @@ class We {
1851
1901
  const h = await i.json();
1852
1902
  throw this.normalizeError(i.status, h);
1853
1903
  }
1854
- const d = ((p = (m = (u = (await i.json()).choices) == null ? void 0 : u[0]) == null ? void 0 : m.message) == null ? void 0 : p.content) || "{}";
1855
- return JSON.parse(d);
1904
+ const u = ((p = (m = (d = (await i.json()).choices) == null ? void 0 : d[0]) == null ? void 0 : m.message) == null ? void 0 : p.content) || "{}";
1905
+ return JSON.parse(u);
1856
1906
  }
1857
1907
  async listModels(e, r) {
1858
1908
  var s, c;
@@ -1884,25 +1934,25 @@ class We {
1884
1934
  return o.code = "API_ERROR", o.status = e, o;
1885
1935
  }
1886
1936
  }
1887
- class Fe {
1937
+ class Ke {
1888
1938
  async *streamChat(e, r, t) {
1889
1939
  const { apiKey: o, model: a = x.grok, temperature: s = 0.7, baseUrl: c = "https://api.x.ai/v1" } = r;
1890
1940
  if (!o) throw new Error("Grok API key required");
1891
- yield* J(
1941
+ yield* Y(
1892
1942
  `${c}/chat/completions`,
1893
1943
  { "Content-Type": "application/json", Authorization: `Bearer ${o}` },
1894
1944
  {
1895
1945
  model: a,
1896
- messages: G(e),
1946
+ messages: W(e),
1897
1947
  temperature: s,
1898
1948
  stream: !0,
1899
- ...M(t) && { tools: M(t), tool_choice: "auto" }
1949
+ ...C(t) && { tools: C(t), tool_choice: "auto" }
1900
1950
  },
1901
1951
  this.normalizeError
1902
1952
  );
1903
1953
  }
1904
1954
  async generateText(e, r) {
1905
- var l, d, u;
1955
+ var l, u, d;
1906
1956
  const { apiKey: t, model: o = x.grok, temperature: a = 0.7, baseUrl: s = "https://api.x.ai/v1" } = r;
1907
1957
  if (!t) throw new Error("Grok API key required");
1908
1958
  const c = await fetch(`${s}/chat/completions`, {
@@ -1921,10 +1971,10 @@ class Fe {
1921
1971
  const m = await c.json();
1922
1972
  throw this.normalizeError(c.status, m);
1923
1973
  }
1924
- return ((u = (d = (l = (await c.json()).choices) == null ? void 0 : l[0]) == null ? void 0 : d.message) == null ? void 0 : u.content) || "";
1974
+ return ((d = (u = (l = (await c.json()).choices) == null ? void 0 : l[0]) == null ? void 0 : u.message) == null ? void 0 : d.content) || "";
1925
1975
  }
1926
1976
  async *streamText(e, r) {
1927
- var u, m, p;
1977
+ var d, m, p;
1928
1978
  const { apiKey: t, model: o = x.grok, temperature: a = 0.7, baseUrl: s = "https://api.x.ai/v1" } = r;
1929
1979
  if (!t) throw new Error("Grok API key required");
1930
1980
  const c = await fetch(`${s}/chat/completions`, {
@@ -1946,23 +1996,23 @@ class Fe {
1946
1996
  }
1947
1997
  if (!c.body) throw new Error("No response body for streaming");
1948
1998
  const i = c.body.getReader(), l = new TextDecoder();
1949
- let d = "";
1999
+ let u = "";
1950
2000
  try {
1951
2001
  for (; ; ) {
1952
2002
  const { done: h, value: w } = await i.read();
1953
2003
  if (h) break;
1954
- d += l.decode(w, { stream: !0 });
1955
- const g = d.split(`
2004
+ u += l.decode(w, { stream: !0 });
2005
+ const g = u.split(`
1956
2006
  `);
1957
- d = g.pop() || "";
2007
+ u = g.pop() || "";
1958
2008
  for (const y of g) {
1959
2009
  const A = y.trim();
1960
2010
  if (!A || !A.startsWith("data: ")) continue;
1961
2011
  const S = A.slice(6);
1962
2012
  if (S !== "[DONE]")
1963
2013
  try {
1964
- const k = (p = (m = (u = JSON.parse(S).choices) == null ? void 0 : u[0]) == null ? void 0 : m.delta) == null ? void 0 : p.content;
1965
- k && (yield k);
2014
+ const E = (p = (m = (d = JSON.parse(S).choices) == null ? void 0 : d[0]) == null ? void 0 : m.delta) == null ? void 0 : p.content;
2015
+ E && (yield E);
1966
2016
  } catch {
1967
2017
  }
1968
2018
  }
@@ -1993,11 +2043,11 @@ Respond with valid JSON only.`, l = await fetch(`${c}/chat/completions`, {
1993
2043
  const y = await l.json();
1994
2044
  throw this.normalizeError(l.status, y);
1995
2045
  }
1996
- const u = ((g = (w = (h = (await l.json()).choices) == null ? void 0 : h[0]) == null ? void 0 : w.message) == null ? void 0 : g.content) || "{}", m = u.match(/\{[\s\S]*\}/), p = m ? m[0] : u;
2046
+ const d = ((g = (w = (h = (await l.json()).choices) == null ? void 0 : h[0]) == null ? void 0 : w.message) == null ? void 0 : g.content) || "{}", m = d.match(/\{[\s\S]*\}/), p = m ? m[0] : d;
1997
2047
  return JSON.parse(p);
1998
2048
  }
1999
2049
  async listModels(e, r) {
2000
- return [...B.grok];
2050
+ return [...G.grok];
2001
2051
  }
2002
2052
  normalizeError(e, r) {
2003
2053
  var a;
@@ -2014,25 +2064,25 @@ Respond with valid JSON only.`, l = await fetch(`${c}/chat/completions`, {
2014
2064
  return o.code = "API_ERROR", o.status = e, o;
2015
2065
  }
2016
2066
  }
2017
- class He {
2067
+ class Xe {
2018
2068
  async *streamChat(e, r, t) {
2019
2069
  const { apiKey: o, model: a = x.deepseek, temperature: s = 0.7, baseUrl: c = "https://api.deepseek.com/v1" } = r;
2020
2070
  if (!o) throw new Error("DeepSeek API key required");
2021
- yield* J(
2071
+ yield* Y(
2022
2072
  `${c}/chat/completions`,
2023
2073
  { "Content-Type": "application/json", Authorization: `Bearer ${o}` },
2024
2074
  {
2025
2075
  model: a,
2026
- messages: G(e),
2076
+ messages: W(e),
2027
2077
  temperature: s,
2028
2078
  stream: !0,
2029
- ...M(t) && { tools: M(t), tool_choice: "auto" }
2079
+ ...C(t) && { tools: C(t), tool_choice: "auto" }
2030
2080
  },
2031
2081
  this.normalizeError
2032
2082
  );
2033
2083
  }
2034
2084
  async generateText(e, r) {
2035
- var l, d, u;
2085
+ var l, u, d;
2036
2086
  const { apiKey: t, model: o = x.deepseek, temperature: a = 0.7, baseUrl: s = "https://api.deepseek.com/v1" } = r;
2037
2087
  if (!t) throw new Error("DeepSeek API key required");
2038
2088
  const c = await fetch(`${s}/chat/completions`, {
@@ -2051,10 +2101,10 @@ class He {
2051
2101
  const m = await c.json();
2052
2102
  throw this.normalizeError(c.status, m);
2053
2103
  }
2054
- return ((u = (d = (l = (await c.json()).choices) == null ? void 0 : l[0]) == null ? void 0 : d.message) == null ? void 0 : u.content) || "";
2104
+ return ((d = (u = (l = (await c.json()).choices) == null ? void 0 : l[0]) == null ? void 0 : u.message) == null ? void 0 : d.content) || "";
2055
2105
  }
2056
2106
  async *streamText(e, r) {
2057
- var u, m, p;
2107
+ var d, m, p;
2058
2108
  const { apiKey: t, model: o = x.deepseek, temperature: a = 0.7, baseUrl: s = "https://api.deepseek.com/v1" } = r;
2059
2109
  if (!t) throw new Error("DeepSeek API key required");
2060
2110
  const c = await fetch(`${s}/chat/completions`, {
@@ -2076,23 +2126,23 @@ class He {
2076
2126
  }
2077
2127
  if (!c.body) throw new Error("No response body for streaming");
2078
2128
  const i = c.body.getReader(), l = new TextDecoder();
2079
- let d = "";
2129
+ let u = "";
2080
2130
  try {
2081
2131
  for (; ; ) {
2082
2132
  const { done: h, value: w } = await i.read();
2083
2133
  if (h) break;
2084
- d += l.decode(w, { stream: !0 });
2085
- const g = d.split(`
2134
+ u += l.decode(w, { stream: !0 });
2135
+ const g = u.split(`
2086
2136
  `);
2087
- d = g.pop() || "";
2137
+ u = g.pop() || "";
2088
2138
  for (const y of g) {
2089
2139
  const A = y.trim();
2090
2140
  if (!A || !A.startsWith("data: ")) continue;
2091
2141
  const S = A.slice(6);
2092
2142
  if (S !== "[DONE]")
2093
2143
  try {
2094
- const k = (p = (m = (u = JSON.parse(S).choices) == null ? void 0 : u[0]) == null ? void 0 : m.delta) == null ? void 0 : p.content;
2095
- k && (yield k);
2144
+ const E = (p = (m = (d = JSON.parse(S).choices) == null ? void 0 : d[0]) == null ? void 0 : m.delta) == null ? void 0 : p.content;
2145
+ E && (yield E);
2096
2146
  } catch {
2097
2147
  }
2098
2148
  }
@@ -2102,7 +2152,7 @@ class He {
2102
2152
  }
2103
2153
  }
2104
2154
  async generateObject(e, r, t) {
2105
- var u, m, p;
2155
+ var d, m, p;
2106
2156
  const { apiKey: o, model: a = x.deepseek, temperature: s = 0.7, baseUrl: c = "https://api.deepseek.com/v1" } = t;
2107
2157
  if (!o) throw new Error("DeepSeek API key required");
2108
2158
  const i = await fetch(`${c}/chat/completions`, {
@@ -2122,11 +2172,11 @@ class He {
2122
2172
  const h = await i.json();
2123
2173
  throw this.normalizeError(i.status, h);
2124
2174
  }
2125
- const d = ((p = (m = (u = (await i.json()).choices) == null ? void 0 : u[0]) == null ? void 0 : m.message) == null ? void 0 : p.content) || "{}";
2126
- return JSON.parse(d);
2175
+ const u = ((p = (m = (d = (await i.json()).choices) == null ? void 0 : d[0]) == null ? void 0 : m.message) == null ? void 0 : p.content) || "{}";
2176
+ return JSON.parse(u);
2127
2177
  }
2128
2178
  async listModels(e, r) {
2129
- return [...B.deepseek];
2179
+ return [...G.deepseek];
2130
2180
  }
2131
2181
  normalizeError(e, r) {
2132
2182
  var a;
@@ -2143,7 +2193,7 @@ class He {
2143
2193
  return o.code = "API_ERROR", o.status = e, o;
2144
2194
  }
2145
2195
  }
2146
- let Ke = class {
2196
+ let Qe = class {
2147
2197
  constructor(e) {
2148
2198
  this.requests = [], this.config = e;
2149
2199
  }
@@ -2161,16 +2211,16 @@ let Ke = class {
2161
2211
  };
2162
2212
  class D {
2163
2213
  constructor() {
2164
- this.rateLimiter = new Ke({
2214
+ this.rateLimiter = new Qe({
2165
2215
  maxRequests: 10,
2166
2216
  windowMs: 6e4
2167
2217
  }), this.adapters = /* @__PURE__ */ new Map([
2168
- ["google-gemini", new Be()],
2169
- ["ollama", new Je()],
2170
- ["anthropic", new Ye()],
2171
- ["openai", new We()],
2172
- ["grok", new Fe()],
2173
- ["deepseek", new He()]
2218
+ ["google-gemini", new Ye()],
2219
+ ["ollama", new We()],
2220
+ ["anthropic", new Fe()],
2221
+ ["openai", new Ve()],
2222
+ ["grok", new Ke()],
2223
+ ["deepseek", new Xe()]
2174
2224
  ]);
2175
2225
  }
2176
2226
  static getInstance() {
@@ -2251,8 +2301,8 @@ class D {
2251
2301
  return o.listModels(r, t);
2252
2302
  }
2253
2303
  }
2254
- const ut = D.getInstance();
2255
- class mt {
2304
+ const ht = D.getInstance();
2305
+ class gt {
2256
2306
  /**
2257
2307
  * Resolve configuration with 3-tier priority:
2258
2308
  * 1. User's localStorage override (highest priority)
@@ -2343,10 +2393,10 @@ class mt {
2343
2393
  } : {};
2344
2394
  }
2345
2395
  }
2346
- const Ve = ([n, e, r]) => n >> 3 << 11 | e >> 2 << 5 | r >> 3, Xe = (n) => {
2396
+ const et = ([n, e, r]) => n >> 3 << 11 | e >> 2 << 5 | r >> 3, tt = (n) => {
2347
2397
  const e = n >> 11 & 31, r = n >> 5 & 63, t = n & 31;
2348
2398
  return [e << 3 | e >> 2, r << 2 | r >> 4, t << 3 | t >> 2];
2349
- }, Y = (n) => Math.ceil(n / 2), ne = (n, e, r) => O.headerBytes + r * 2 + Y(n) * e, pt = (n) => {
2399
+ }, H = (n) => Math.ceil(n / 2), ae = (n, e, r) => O.headerBytes + r * 2 + H(n) * e, ft = (n) => {
2350
2400
  const { width: e, height: r, palette: t, indices: o } = n;
2351
2401
  if (!Number.isInteger(e) || !Number.isInteger(r) || e < 1 || r < 1 || e > 65535 || r > 65535)
2352
2402
  throw new RangeError(`encodeSpr: bad size ${e}x${r}`);
@@ -2354,52 +2404,52 @@ const Ve = ([n, e, r]) => n >> 3 << 11 | e >> 2 << 5 | r >> 3, Xe = (n) => {
2354
2404
  throw new RangeError(`encodeSpr: ${t.length} colours; 1 to ${O.maxColors} allowed`);
2355
2405
  if (o.length !== e * r)
2356
2406
  throw new RangeError(`encodeSpr: ${o.length} indices for ${e}x${r}`);
2357
- const a = new Uint8Array(ne(e, r, t.length)), s = new DataView(a.buffer);
2407
+ const a = new Uint8Array(ae(e, r, t.length)), s = new DataView(a.buffer);
2358
2408
  a.set(O.magic, 0), a[4] = O.version, s.setUint16(5, e, !0), s.setUint16(7, r, !0), a[9] = O.bitsPerPixel, a[10] = t.length;
2359
2409
  let c = O.headerBytes;
2360
2410
  for (const l of t)
2361
- s.setUint16(c, Ve(l), !0), c += 2;
2362
- const i = Y(e);
2411
+ s.setUint16(c, et(l), !0), c += 2;
2412
+ const i = H(e);
2363
2413
  for (let l = 0; l < r; l++)
2364
- for (let d = 0; d < e; d++) {
2365
- const u = o[l * e + d];
2366
- if (!Number.isInteger(u) || u < 0 || u >= t.length)
2367
- throw new RangeError(`encodeSpr: index ${u} at ${d},${l} is outside a ${t.length}-colour palette`);
2368
- const m = c + l * i + (d >> 1);
2369
- a[m] |= d & 1 ? u : u << 4;
2414
+ for (let u = 0; u < e; u++) {
2415
+ const d = o[l * e + u];
2416
+ if (!Number.isInteger(d) || d < 0 || d >= t.length)
2417
+ throw new RangeError(`encodeSpr: index ${d} at ${u},${l} is outside a ${t.length}-colour palette`);
2418
+ const m = c + l * i + (u >> 1);
2419
+ a[m] |= u & 1 ? d : d << 4;
2370
2420
  }
2371
2421
  return a;
2372
- }, ht = (n) => {
2422
+ }, yt = (n) => {
2373
2423
  const e = (m) => ({ ok: !1, reason: m });
2374
2424
  if (n.length < O.headerBytes) return e("shorter than the header");
2375
- if (n.length > W) return e(`${n.length} bytes; at most ${W}`);
2425
+ if (n.length > F) return e(`${n.length} bytes; at most ${F}`);
2376
2426
  if (!O.magic.every((m, p) => n[p] === m)) return e("not an .spr file");
2377
2427
  if (n[4] !== O.version) return e(`version ${n[4]}; this reads ${O.version}`);
2378
2428
  const r = new DataView(n.buffer, n.byteOffset, n.byteLength), t = r.getUint16(5, !0), o = r.getUint16(7, !0), a = n[9], s = n[10];
2379
2429
  if (t < 1 || o < 1) return e(`empty image ${t}x${o}`);
2380
2430
  if (a !== O.bitsPerPixel) return e(`${a} bits a pixel; only ${O.bitsPerPixel} is read`);
2381
2431
  if (s < 1 || s > O.maxColors) return e(`${s} colours; 1 to ${O.maxColors} allowed`);
2382
- const c = ne(t, o, s);
2432
+ const c = ae(t, o, s);
2383
2433
  if (n.length !== c) return e(`${n.length} bytes; ${t}x${o} with ${s} colours is ${c}`);
2384
2434
  const i = [];
2385
2435
  let l = O.headerBytes;
2386
- for (let m = 0; m < s; m++, l += 2) i.push(Xe(r.getUint16(l, !0)));
2387
- const d = Y(t), u = new Uint8Array(t * o);
2436
+ for (let m = 0; m < s; m++, l += 2) i.push(tt(r.getUint16(l, !0)));
2437
+ const u = H(t), d = new Uint8Array(t * o);
2388
2438
  for (let m = 0; m < o; m++)
2389
2439
  for (let p = 0; p < t; p++) {
2390
- const h = n[l + m * d + (p >> 1)], w = p & 1 ? h & 15 : h >> 4;
2391
- u[m * t + p] = w < s ? w : 0;
2440
+ const h = n[l + m * u + (p >> 1)], w = p & 1 ? h & 15 : h >> 4;
2441
+ d[m * t + p] = w < s ? w : 0;
2392
2442
  }
2393
- return { ok: !0, image: { width: t, height: o, palette: i, indices: u } };
2394
- }, Qe = (n) => {
2443
+ return { ok: !0, image: { width: t, height: o, palette: i, indices: d } };
2444
+ }, rt = (n) => {
2395
2445
  let e = "";
2396
2446
  for (const r of n) e += String.fromCharCode(r);
2397
2447
  return btoa(e);
2398
- }, et = (n) => Uint8Array.from(atob(n), (e) => e.charCodeAt(0)), tt = (n) => {
2448
+ }, nt = (n) => Uint8Array.from(atob(n), (e) => e.charCodeAt(0)), ot = (n) => {
2399
2449
  if (n === "." || n === " " || n === "_") return 0;
2400
2450
  const e = parseInt(n, 16);
2401
2451
  return Number.isNaN(e) ? -1 : e;
2402
- }, rt = (n, e) => {
2452
+ }, at = (n, e) => {
2403
2453
  if (e.length === 0) return { ok: !1, error: "palette is empty" };
2404
2454
  if (e.length > 16)
2405
2455
  return { ok: !1, error: `palette has ${e.length} colours and a sprite holds at most 16` };
@@ -2407,10 +2457,10 @@ const Ve = ([n, e, r]) => n >> 3 << 11 | e >> 2 << 5 | r >> 3, Xe = (n) => {
2407
2457
  `).map((i) => i.trim()).filter((i) => i.length > 0);
2408
2458
  if (r.length === 0) return { ok: !1, error: "grid has no rows" };
2409
2459
  const t = r.length, o = r[0].length;
2410
- if (o > C || t > C)
2460
+ if (o > M || t > M)
2411
2461
  return {
2412
2462
  ok: !1,
2413
- error: `grid is ${o}x${t} and the largest sprite is ${C}x${C}`
2463
+ error: `grid is ${o}x${t} and the largest sprite is ${M}x${M}`
2414
2464
  };
2415
2465
  const a = r.map((i, l) => ({ i: l, len: i.length })).filter((i) => i.len !== o);
2416
2466
  if (a.length > 0) {
@@ -2423,23 +2473,23 @@ const Ve = ([n, e, r]) => n >> 3 << 11 | e >> 2 << 5 | r >> 3, Xe = (n) => {
2423
2473
  const s = Math.ceil(o / 2), c = new Uint8Array(s * t);
2424
2474
  for (let i = 0; i < t; i++)
2425
2475
  for (let l = 0; l < o; l++) {
2426
- const d = tt(r[i][l]);
2427
- if (d < 0)
2476
+ const u = ot(r[i][l]);
2477
+ if (u < 0)
2428
2478
  return {
2429
2479
  ok: !1,
2430
2480
  error: `row ${i + 1}, column ${l + 1}: '${r[i][l]}' is not a hex digit 0-f`
2431
2481
  };
2432
- if (d >= e.length)
2482
+ if (u >= e.length)
2433
2483
  return {
2434
2484
  ok: !1,
2435
- error: `row ${i + 1}, column ${l + 1}: index ${d.toString(16)} but the palette has ${e.length} colour(s), so the highest is ${(e.length - 1).toString(16)}`
2485
+ error: `row ${i + 1}, column ${l + 1}: index ${u.toString(16)} but the palette has ${e.length} colour(s), so the highest is ${(e.length - 1).toString(16)}`
2436
2486
  };
2437
- const u = i * s + (l >> 1);
2438
- c[u] |= l & 1 ? d : d << 4;
2487
+ const d = i * s + (l >> 1);
2488
+ c[d] |= l & 1 ? u : u << 4;
2439
2489
  }
2440
- return { ok: !0, sprite: { width: o, height: t, palette: e, pixels: Qe(c) } };
2441
- }, gt = (n) => {
2442
- const e = et(n.pixels), r = Math.ceil(n.width / 2), t = [];
2490
+ return { ok: !0, sprite: { width: o, height: t, palette: e, pixels: rt(c) } };
2491
+ }, wt = (n) => {
2492
+ const e = nt(n.pixels), r = Math.ceil(n.width / 2), t = [];
2443
2493
  for (let o = 0; o < n.height; o++) {
2444
2494
  let a = "";
2445
2495
  for (let s = 0; s < n.width; s++) {
@@ -2450,7 +2500,7 @@ const Ve = ([n, e, r]) => n >> 3 << 11 | e >> 2 << 5 | r >> 3, Xe = (n) => {
2450
2500
  }
2451
2501
  return t.join(`
2452
2502
  `);
2453
- }, ft = (n) => {
2503
+ }, bt = (n) => {
2454
2504
  const e = [];
2455
2505
  if (!n || typeof n != "object") return { value: n, issues: e };
2456
2506
  const r = n.blocks;
@@ -2459,20 +2509,20 @@ const Ve = ([n, e, r]) => n >> 3 << 11 | e >> 2 << 5 | r >> 3, Xe = (n) => {
2459
2509
  if (!o || typeof o != "object") return o;
2460
2510
  const s = o;
2461
2511
  if (Array.isArray(s.children))
2462
- return { ...s, children: s.children.map((u, m) => t(u, [...a, "children", m])) };
2512
+ return { ...s, children: s.children.map((d, m) => t(d, [...a, "children", m])) };
2463
2513
  if (s.type !== "sprite" || typeof s.grid != "string") return o;
2464
- const c = Array.isArray(s.palette) ? s.palette : [], i = rt(s.grid, c);
2514
+ const c = Array.isArray(s.palette) ? s.palette : [], i = at(s.grid, c);
2465
2515
  if (!i.ok)
2466
2516
  return e.push({ path: [...a, "grid"], message: i.error }), o;
2467
- const { grid: l, ...d } = s;
2468
- return { ...d, ...i.sprite };
2517
+ const { grid: l, ...u } = s;
2518
+ return { ...u, ...i.sprite };
2469
2519
  };
2470
2520
  return {
2471
2521
  value: { ...n, blocks: r.map((o, a) => t(o, ["blocks", a])) },
2472
2522
  issues: e
2473
2523
  };
2474
2524
  };
2475
- class nt {
2525
+ class st {
2476
2526
  constructor(e) {
2477
2527
  this.requests = [], this.config = e;
2478
2528
  }
@@ -2488,9 +2538,9 @@ class nt {
2488
2538
  return this.requests.length === 0 ? 0 : this.requests[0] + this.config.windowMs;
2489
2539
  }
2490
2540
  }
2491
- class ot {
2541
+ class it {
2492
2542
  constructor(e = { maxRequests: 10, windowMs: 6e4 }) {
2493
- this.rateLimiter = new nt(e);
2543
+ this.rateLimiter = new st(e);
2494
2544
  }
2495
2545
  async makeRequest(e, r) {
2496
2546
  if (!this.rateLimiter.checkLimit()) {
@@ -2503,32 +2553,33 @@ class ot {
2503
2553
  return this.rateLimiter.getRemainingRequests();
2504
2554
  }
2505
2555
  }
2506
- const yt = new ot({ maxRequests: 10, windowMs: 6e4 });
2556
+ const Et = new it({ maxRequests: 10, windowMs: 6e4 });
2507
2557
  export {
2508
- st as A,
2509
- He as D,
2510
- Be as G,
2511
- Ke as I,
2512
- Je as O,
2513
- B as P,
2558
+ se as A,
2559
+ Xe as D,
2560
+ Ye as G,
2561
+ Qe as I,
2562
+ We as O,
2563
+ G as P,
2514
2564
  D as a,
2515
- ut as b,
2516
- mt as c,
2517
- Ye as d,
2518
- We as e,
2519
- Fe as f,
2520
- ot as g,
2521
- yt as h,
2522
- ht as i,
2523
- pt as j,
2524
- it as k,
2525
- rt as l,
2526
- gt as m,
2527
- ft as n,
2528
- Ve as o,
2529
- Xe as p,
2530
- ct as q,
2531
- ze as r,
2532
- ne as s,
2533
- lt as t
2565
+ ht as b,
2566
+ gt as c,
2567
+ Fe as d,
2568
+ Ve as e,
2569
+ Ke as f,
2570
+ it as g,
2571
+ Et as h,
2572
+ yt as i,
2573
+ ft as j,
2574
+ ae as k,
2575
+ ut as l,
2576
+ at as m,
2577
+ bt as n,
2578
+ wt as o,
2579
+ et as p,
2580
+ tt as q,
2581
+ dt as r,
2582
+ lt as s,
2583
+ mt as t,
2584
+ Ge as u
2534
2585
  };