@arcadeai/design-system 3.27.5 → 3.27.7

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 (95) hide show
  1. package/dist/assets/icons/attio.js +10 -0
  2. package/dist/assets/icons/claude.js +10 -0
  3. package/dist/assets/icons/cline.js +10 -0
  4. package/dist/assets/icons/cursor-install-dark.js +12 -0
  5. package/dist/assets/icons/cursor-install-light.js +12 -0
  6. package/dist/assets/icons/gemini.js +12 -0
  7. package/dist/assets/icons/goose.js +13 -0
  8. package/dist/assets/icons/openai.js +10 -0
  9. package/dist/assets/icons/vscode.js +12 -0
  10. package/dist/assets/icons/windsurf.js +10 -0
  11. package/dist/components/index.js +416 -396
  12. package/dist/components/ui/atoms/checkbox.d.ts.map +1 -1
  13. package/dist/components/ui/atoms/checkbox.js +100 -100
  14. package/dist/components/ui/atoms/icons/attio.d.ts +4 -0
  15. package/dist/components/ui/atoms/icons/attio.d.ts.map +1 -0
  16. package/dist/components/ui/atoms/icons/attio.js +27 -0
  17. package/dist/components/ui/atoms/icons/claude.d.ts +4 -0
  18. package/dist/components/ui/atoms/icons/claude.d.ts.map +1 -0
  19. package/dist/components/ui/atoms/icons/claude.js +27 -0
  20. package/dist/components/ui/atoms/icons/cline.d.ts +4 -0
  21. package/dist/components/ui/atoms/icons/cline.d.ts.map +1 -0
  22. package/dist/components/ui/atoms/icons/cline.js +23 -0
  23. package/dist/components/ui/atoms/icons/cursor-install-dark.d.ts +4 -0
  24. package/dist/components/ui/atoms/icons/cursor-install-dark.d.ts.map +1 -0
  25. package/dist/components/ui/atoms/icons/cursor-install-dark.js +79 -0
  26. package/dist/components/ui/atoms/icons/cursor-install-light.d.ts +4 -0
  27. package/dist/components/ui/atoms/icons/cursor-install-light.d.ts.map +1 -0
  28. package/dist/components/ui/atoms/icons/cursor-install-light.js +79 -0
  29. package/dist/components/ui/atoms/icons/gemini.d.ts +4 -0
  30. package/dist/components/ui/atoms/icons/gemini.d.ts.map +1 -0
  31. package/dist/components/ui/atoms/icons/gemini.js +234 -0
  32. package/dist/components/ui/atoms/icons/goose.d.ts +4 -0
  33. package/dist/components/ui/atoms/icons/goose.d.ts.map +1 -0
  34. package/dist/components/ui/atoms/icons/goose.js +22 -0
  35. package/dist/components/ui/atoms/icons/index.d.ts +10 -0
  36. package/dist/components/ui/atoms/icons/index.d.ts.map +1 -1
  37. package/dist/components/ui/atoms/icons/index.js +256 -236
  38. package/dist/components/ui/atoms/icons/openai.d.ts +4 -0
  39. package/dist/components/ui/atoms/icons/openai.d.ts.map +1 -0
  40. package/dist/components/ui/atoms/icons/openai.js +26 -0
  41. package/dist/components/ui/atoms/icons/vscode.d.ts +4 -0
  42. package/dist/components/ui/atoms/icons/vscode.d.ts.map +1 -0
  43. package/dist/components/ui/atoms/icons/vscode.js +187 -0
  44. package/dist/components/ui/atoms/icons/windsurf.d.ts +4 -0
  45. package/dist/components/ui/atoms/icons/windsurf.d.ts.map +1 -0
  46. package/dist/components/ui/atoms/icons/windsurf.js +26 -0
  47. package/dist/components/ui/atoms/index.js +399 -379
  48. package/dist/components/ui/index.js +416 -396
  49. package/dist/components/ui/molecules/index.js +1 -1
  50. package/dist/components/ui/molecules/requirement-badges.d.ts +6 -3
  51. package/dist/components/ui/molecules/requirement-badges.d.ts.map +1 -1
  52. package/dist/components/ui/molecules/requirement-badges.js +1 -1
  53. package/dist/components/ui/molecules/tool-card.d.ts.map +1 -1
  54. package/dist/components/ui/molecules/tool-card.js +55 -54
  55. package/dist/components/ui/molecules/toolkit-card.d.ts.map +1 -1
  56. package/dist/components/ui/molecules/toolkit-card.js +1 -1
  57. package/dist/components/ui/molecules/toolkit-picker-trigger.js +34 -34
  58. package/dist/components/ui/molecules/toolkit-selection-summary.d.ts.map +1 -1
  59. package/dist/components/ui/molecules/toolkit-selection-summary.js +5 -5
  60. package/dist/components/ui/organisms/toolkit-picker/components/search-input.js +1 -1
  61. package/dist/components/ui/organisms/toolkit-picker/components/select-button.js +1 -1
  62. package/dist/components/ui/organisms/toolkit-picker/components/toolkit-card-with-selection.js +1 -1
  63. package/dist/components/ui/organisms/toolkit-picker/components/toolkit-list.d.ts.map +1 -1
  64. package/dist/components/ui/organisms/toolkit-picker/components/toolkit-list.js +101 -74
  65. package/dist/components/ui/organisms/toolkit-picker/components/tools-list.d.ts.map +1 -1
  66. package/dist/components/ui/organisms/toolkit-picker/components/tools-list.js +74 -50
  67. package/dist/components/ui/organisms/toolkit-picker/components/unoptimized-toggle.d.ts +21 -0
  68. package/dist/components/ui/organisms/toolkit-picker/components/unoptimized-toggle.d.ts.map +1 -0
  69. package/dist/components/ui/organisms/toolkit-picker/components/unoptimized-toggle.js +29 -0
  70. package/dist/components/ui/organisms/toolkit-picker/hooks/featured-toolkits.d.ts +1 -1
  71. package/dist/components/ui/organisms/toolkit-picker/hooks/use-toolkit-picker.d.ts +8 -0
  72. package/dist/components/ui/organisms/toolkit-picker/hooks/use-toolkit-picker.d.ts.map +1 -1
  73. package/dist/components/ui/organisms/toolkit-picker/hooks/use-toolkit-picker.js +120 -51
  74. package/dist/components/ui/organisms/toolkit-picker/mocks/toolkit-collection.d.ts.map +1 -1
  75. package/dist/components/ui/organisms/toolkit-picker/mocks/toolkit-collection.js +55 -24
  76. package/dist/components/ui/organisms/toolkit-picker/toolkit-picker.js +20 -20
  77. package/dist/hooks/use-is-truncated.d.ts +13 -0
  78. package/dist/hooks/use-is-truncated.d.ts.map +1 -0
  79. package/dist/hooks/use-is-truncated.js +20 -0
  80. package/dist/lib/arcade/arcade.d.ts +0 -24
  81. package/dist/lib/arcade/arcade.d.ts.map +1 -1
  82. package/dist/lib/arcade/arcade.js +258 -421
  83. package/dist/lib/arcade/toolkit-collection.d.ts +15 -0
  84. package/dist/lib/arcade/toolkit-collection.d.ts.map +1 -0
  85. package/dist/lib/arcade/toolkit-collection.js +149 -0
  86. package/dist/main.js +455 -435
  87. package/dist/metadata/oauth-providers.d.ts +2 -0
  88. package/dist/metadata/oauth-providers.d.ts.map +1 -1
  89. package/dist/metadata/oauth-providers.js +84 -72
  90. package/dist/metadata/toolkits.js +7 -7
  91. package/dist/metadata/utils.d.ts +4 -7
  92. package/dist/metadata/utils.d.ts.map +1 -1
  93. package/dist/metadata/utils.js +16 -13
  94. package/dist/{toolkit-card-D6Dqff6p.js → toolkit-card-Cmp_yG03.js} +115 -110
  95. package/package.json +34 -23
@@ -1,27 +1,27 @@
1
- import { k as _e, s as Qe, g as Ge, F as de, f as Je, a as Ye, b as Ze } from "../../web-sgv-FK6q.js";
2
- import { TOOLKIT_CATALOGUE as et } from "../../metadata/toolkits.js";
1
+ import { k as Ae, s as Qe, g as Je, F as de, f as Ge, a as Ye, b as Ze } from "../../web-sgv-FK6q.js";
3
2
  import { r as he } from "../../utils-6KgZuQUR.js";
4
- const J = "RFC3986", Y = {
3
+ import { groupToolsIntoToolkits as et, buildToolkitCollection as tt } from "./toolkit-collection.js";
4
+ const G = "RFC3986", Y = {
5
5
  RFC1738: (t) => String(t).replace(/%20/g, "+"),
6
6
  RFC3986: (t) => String(t)
7
- }, tt = "RFC1738", nt = Array.isArray, _ = (() => {
7
+ }, nt = "RFC1738", rt = Array.isArray, b = (() => {
8
8
  const t = [];
9
9
  for (let e = 0; e < 256; ++e)
10
10
  t.push("%" + ((e < 16 ? "0" : "") + e.toString(16)).toUpperCase());
11
11
  return t;
12
- })(), W = 1024, rt = (t, e, n, r, s) => {
12
+ })(), V = 1024, st = (t, e, n, r, s) => {
13
13
  if (t.length === 0)
14
14
  return t;
15
15
  let o = t;
16
16
  if (typeof t == "symbol" ? o = Symbol.prototype.toString.call(t) : typeof t != "string" && (o = String(t)), n === "iso-8859-1")
17
- return escape(o).replace(/%u[0-9a-f]{4}/gi, function(l) {
18
- return "%26%23" + parseInt(l.slice(2), 16) + "%3B";
17
+ return escape(o).replace(/%u[0-9a-f]{4}/gi, function(u) {
18
+ return "%26%23" + parseInt(u.slice(2), 16) + "%3B";
19
19
  });
20
20
  let i = "";
21
- for (let l = 0; l < o.length; l += W) {
22
- const u = o.length >= W ? o.slice(l, l + W) : o, c = [];
23
- for (let h = 0; h < u.length; ++h) {
24
- let a = u.charCodeAt(h);
21
+ for (let u = 0; u < o.length; u += V) {
22
+ const l = o.length >= V ? o.slice(u, u + V) : o, c = [];
23
+ for (let h = 0; h < l.length; ++h) {
24
+ let a = l.charCodeAt(h);
25
25
  if (a === 45 || // -
26
26
  a === 46 || // .
27
27
  a === 95 || // _
@@ -29,33 +29,33 @@ const J = "RFC3986", Y = {
29
29
  a >= 48 && a <= 57 || // 0-9
30
30
  a >= 65 && a <= 90 || // a-z
31
31
  a >= 97 && a <= 122 || // A-Z
32
- s === tt && (a === 40 || a === 41)) {
33
- c[c.length] = u.charAt(h);
32
+ s === nt && (a === 40 || a === 41)) {
33
+ c[c.length] = l.charAt(h);
34
34
  continue;
35
35
  }
36
36
  if (a < 128) {
37
- c[c.length] = _[a];
37
+ c[c.length] = b[a];
38
38
  continue;
39
39
  }
40
40
  if (a < 2048) {
41
- c[c.length] = _[192 | a >> 6] + _[128 | a & 63];
41
+ c[c.length] = b[192 | a >> 6] + b[128 | a & 63];
42
42
  continue;
43
43
  }
44
44
  if (a < 55296 || a >= 57344) {
45
- c[c.length] = _[224 | a >> 12] + _[128 | a >> 6 & 63] + _[128 | a & 63];
45
+ c[c.length] = b[224 | a >> 12] + b[128 | a >> 6 & 63] + b[128 | a & 63];
46
46
  continue;
47
47
  }
48
- h += 1, a = 65536 + ((a & 1023) << 10 | u.charCodeAt(h) & 1023), c[c.length] = _[240 | a >> 18] + _[128 | a >> 12 & 63] + _[128 | a >> 6 & 63] + _[128 | a & 63];
48
+ h += 1, a = 65536 + ((a & 1023) << 10 | l.charCodeAt(h) & 1023), c[c.length] = b[240 | a >> 18] + b[128 | a >> 12 & 63] + b[128 | a >> 6 & 63] + b[128 | a & 63];
49
49
  }
50
50
  i += c.join("");
51
51
  }
52
52
  return i;
53
53
  };
54
- function st(t) {
54
+ function ot(t) {
55
55
  return !t || typeof t != "object" ? !1 : !!(t.constructor && t.constructor.isBuffer && t.constructor.isBuffer(t));
56
56
  }
57
- function pe(t, e) {
58
- if (nt(t)) {
57
+ function ye(t, e) {
58
+ if (rt(t)) {
59
59
  const n = [];
60
60
  for (let r = 0; r < t.length; r += 1)
61
61
  n.push(e(t[r]));
@@ -63,7 +63,7 @@ function pe(t, e) {
63
63
  }
64
64
  return e(t);
65
65
  }
66
- const ot = Object.prototype.hasOwnProperty, Ae = {
66
+ const it = Object.prototype.hasOwnProperty, _e = {
67
67
  brackets(t) {
68
68
  return String(t) + "[]";
69
69
  },
@@ -74,9 +74,9 @@ const ot = Object.prototype.hasOwnProperty, Ae = {
74
74
  repeat(t) {
75
75
  return String(t);
76
76
  }
77
- }, A = Array.isArray, it = Array.prototype.push, Se = function(t, e) {
78
- it.apply(t, A(e) ? e : [e]);
79
- }, at = Date.prototype.toISOString, y = {
77
+ }, A = Array.isArray, at = Array.prototype.push, Re = function(t, e) {
78
+ at.apply(t, A(e) ? e : [e]);
79
+ }, ct = Date.prototype.toISOString, y = {
80
80
  addQueryPrefix: !1,
81
81
  allowDots: !1,
82
82
  allowEmptyArrays: !1,
@@ -86,103 +86,103 @@ const ot = Object.prototype.hasOwnProperty, Ae = {
86
86
  delimiter: "&",
87
87
  encode: !0,
88
88
  encodeDotInKeys: !1,
89
- encoder: rt,
89
+ encoder: st,
90
90
  encodeValuesOnly: !1,
91
- format: J,
92
- formatter: Y[J],
91
+ format: G,
92
+ formatter: Y[G],
93
93
  /** @deprecated */
94
94
  indices: !1,
95
95
  serializeDate(t) {
96
- return at.call(t);
96
+ return ct.call(t);
97
97
  },
98
98
  skipNulls: !1,
99
99
  strictNullHandling: !1
100
100
  };
101
- function ct(t) {
101
+ function ut(t) {
102
102
  return typeof t == "string" || typeof t == "number" || typeof t == "boolean" || typeof t == "symbol" || typeof t == "bigint";
103
103
  }
104
- const V = {};
105
- function Re(t, e, n, r, s, o, i, l, u, c, h, a, p, m, b, E, S, z) {
106
- let f = t, D = z, U = 0, ce = !1;
107
- for (; (D = D.get(V)) !== void 0 && !ce; ) {
108
- const g = D.get(t);
109
- if (U += 1, typeof g < "u") {
110
- if (g === U)
104
+ const z = {};
105
+ function Se(t, e, n, r, s, o, i, u, l, c, h, a, p, w, _, P, R, X) {
106
+ let f = t, v = X, U = 0, ce = !1;
107
+ for (; (v = v.get(z)) !== void 0 && !ce; ) {
108
+ const m = v.get(t);
109
+ if (U += 1, typeof m < "u") {
110
+ if (m === U)
111
111
  throw new RangeError("Cyclic object value");
112
112
  ce = !0;
113
113
  }
114
- typeof D.get(V) > "u" && (U = 0);
114
+ typeof v.get(z) > "u" && (U = 0);
115
115
  }
116
- if (typeof c == "function" ? f = c(e, f) : f instanceof Date ? f = p?.(f) : n === "comma" && A(f) && (f = pe(f, function(g) {
117
- return g instanceof Date ? p?.(g) : g;
116
+ if (typeof c == "function" ? f = c(e, f) : f instanceof Date ? f = p?.(f) : n === "comma" && A(f) && (f = ye(f, function(m) {
117
+ return m instanceof Date ? p?.(m) : m;
118
118
  })), f === null) {
119
119
  if (o)
120
- return u && !E ? (
120
+ return l && !P ? (
121
121
  // @ts-expect-error
122
- u(e, y.encoder, S, "key", m)
122
+ l(e, y.encoder, R, "key", w)
123
123
  ) : e;
124
124
  f = "";
125
125
  }
126
- if (ct(f) || st(f)) {
127
- if (u) {
128
- const g = E ? e : u(e, y.encoder, S, "key", m);
126
+ if (ut(f) || ot(f)) {
127
+ if (l) {
128
+ const m = P ? e : l(e, y.encoder, R, "key", w);
129
129
  return [
130
- b?.(g) + "=" + // @ts-expect-error
131
- b?.(u(f, y.encoder, S, "value", m))
130
+ _?.(m) + "=" + // @ts-expect-error
131
+ _?.(l(f, y.encoder, R, "value", w))
132
132
  ];
133
133
  }
134
- return [b?.(e) + "=" + b?.(String(f))];
134
+ return [_?.(e) + "=" + _?.(String(f))];
135
135
  }
136
- const X = [];
136
+ const K = [];
137
137
  if (typeof f > "u")
138
- return X;
139
- let I;
138
+ return K;
139
+ let O;
140
140
  if (n === "comma" && A(f))
141
- E && u && (f = pe(f, u)), I = [{ value: f.length > 0 ? f.join(",") || null : void 0 }];
141
+ P && l && (f = ye(f, l)), O = [{ value: f.length > 0 ? f.join(",") || null : void 0 }];
142
142
  else if (A(c))
143
- I = c;
143
+ O = c;
144
144
  else {
145
- const g = Object.keys(f);
146
- I = h ? g.sort(h) : g;
145
+ const m = Object.keys(f);
146
+ O = h ? m.sort(h) : m;
147
147
  }
148
- const ue = l ? String(e).replace(/\./g, "%2E") : String(e), $ = r && A(f) && f.length === 1 ? ue + "[]" : ue;
148
+ const ue = u ? String(e).replace(/\./g, "%2E") : String(e), j = r && A(f) && f.length === 1 ? ue + "[]" : ue;
149
149
  if (s && A(f) && f.length === 0)
150
- return $ + "[]";
151
- for (let g = 0; g < I.length; ++g) {
152
- const k = I[g], le = (
150
+ return j + "[]";
151
+ for (let m = 0; m < O.length; ++m) {
152
+ const k = O[m], le = (
153
153
  // @ts-ignore
154
154
  typeof k == "object" && typeof k.value < "u" ? k.value : f[k]
155
155
  );
156
156
  if (i && le === null)
157
157
  continue;
158
- const K = a && l ? k.replace(/\./g, "%2E") : k, Ve = A(f) ? typeof n == "function" ? n($, K) : $ : $ + (a ? "." + K : "[" + K + "]");
159
- z.set(t, U);
158
+ const W = a && u ? k.replace(/\./g, "%2E") : k, ze = A(f) ? typeof n == "function" ? n(j, W) : j : j + (a ? "." + W : "[" + W + "]");
159
+ X.set(t, U);
160
160
  const fe = /* @__PURE__ */ new WeakMap();
161
- fe.set(V, z), Se(X, Re(
161
+ fe.set(z, X), Re(K, Se(
162
162
  le,
163
- Ve,
163
+ ze,
164
164
  n,
165
165
  r,
166
166
  s,
167
167
  o,
168
168
  i,
169
- l,
169
+ u,
170
170
  // @ts-ignore
171
- n === "comma" && E && A(f) ? null : u,
171
+ n === "comma" && P && A(f) ? null : l,
172
172
  c,
173
173
  h,
174
174
  a,
175
175
  p,
176
- m,
177
- b,
178
- E,
179
- S,
176
+ w,
177
+ _,
178
+ P,
179
+ R,
180
180
  fe
181
181
  ));
182
182
  }
183
- return X;
183
+ return K;
184
184
  }
185
- function ut(t = y) {
185
+ function lt(t = y) {
186
186
  if (typeof t.allowEmptyArrays < "u" && typeof t.allowEmptyArrays != "boolean")
187
187
  throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");
188
188
  if (typeof t.encodeDotInKeys < "u" && typeof t.encodeDotInKeys != "boolean")
@@ -192,9 +192,9 @@ function ut(t = y) {
192
192
  const e = t.charset || y.charset;
193
193
  if (typeof t.charset < "u" && t.charset !== "utf-8" && t.charset !== "iso-8859-1")
194
194
  throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");
195
- let n = J;
195
+ let n = G;
196
196
  if (typeof t.format < "u") {
197
- if (!ot.call(Y, t.format))
197
+ if (!it.call(Y, t.format))
198
198
  throw new TypeError("Unknown format option provided.");
199
199
  n = t.format;
200
200
  }
@@ -202,7 +202,7 @@ function ut(t = y) {
202
202
  let s = y.filter;
203
203
  (typeof t.filter == "function" || A(t.filter)) && (s = t.filter);
204
204
  let o;
205
- if (t.arrayFormat && t.arrayFormat in Ae ? o = t.arrayFormat : "indices" in t ? o = t.indices ? "indices" : "repeat" : o = y.arrayFormat, "commaRoundTrip" in t && typeof t.commaRoundTrip != "boolean")
205
+ if (t.arrayFormat && t.arrayFormat in _e ? o = t.arrayFormat : "indices" in t ? o = t.indices ? "indices" : "repeat" : o = y.arrayFormat, "commaRoundTrip" in t && typeof t.commaRoundTrip != "boolean")
206
206
  throw new TypeError("`commaRoundTrip` must be a boolean, or absent");
207
207
  const i = typeof t.allowDots > "u" ? t.encodeDotInKeys ? !0 : y.allowDots : !!t.allowDots;
208
208
  return {
@@ -229,25 +229,25 @@ function ut(t = y) {
229
229
  strictNullHandling: typeof t.strictNullHandling == "boolean" ? t.strictNullHandling : y.strictNullHandling
230
230
  };
231
231
  }
232
- function lt(t, e = {}) {
232
+ function ft(t, e = {}) {
233
233
  let n = t;
234
- const r = ut(e);
234
+ const r = lt(e);
235
235
  let s, o;
236
236
  typeof r.filter == "function" ? (o = r.filter, n = o("", n)) : A(r.filter) && (o = r.filter, s = o);
237
237
  const i = [];
238
238
  if (typeof n != "object" || n === null)
239
239
  return "";
240
- const l = Ae[r.arrayFormat], u = l === "comma" && r.commaRoundTrip;
240
+ const u = _e[r.arrayFormat], l = u === "comma" && r.commaRoundTrip;
241
241
  s || (s = Object.keys(n)), r.sort && s.sort(r.sort);
242
242
  const c = /* @__PURE__ */ new WeakMap();
243
243
  for (let p = 0; p < s.length; ++p) {
244
- const m = s[p];
245
- r.skipNulls && n[m] === null || Se(i, Re(
246
- n[m],
247
- m,
244
+ const w = s[p];
245
+ r.skipNulls && n[w] === null || Re(i, Se(
246
+ n[w],
247
+ w,
248
248
  // @ts-expect-error
249
- l,
250
249
  u,
250
+ l,
251
251
  r.allowEmptyArrays,
252
252
  r.strictNullHandling,
253
253
  r.skipNulls,
@@ -268,12 +268,12 @@ function lt(t, e = {}) {
268
268
  let a = r.addQueryPrefix === !0 ? "?" : "";
269
269
  return r.charsetSentinel && (r.charset === "iso-8859-1" ? a += "utf8=%26%2310003%3B&" : a += "utf8=%E2%9C%93&"), h.length > 0 ? a + h : "";
270
270
  }
271
- const T = "1.11.1";
272
- class P extends Error {
271
+ const I = "1.11.1";
272
+ class E extends Error {
273
273
  }
274
- class w extends P {
274
+ class g extends E {
275
275
  constructor(e, n, r, s) {
276
- super(`${w.makeMessage(e, n, r)}`), this.status = e, this.headers = s, this.error = n;
276
+ super(`${g.makeMessage(e, n, r)}`), this.status = e, this.headers = s, this.error = n;
277
277
  }
278
278
  static makeMessage(e, n, r) {
279
279
  const s = n?.message ? typeof n.message == "string" ? n.message : JSON.stringify(n.message) : n ? JSON.stringify(n) : r;
@@ -281,58 +281,58 @@ class w extends P {
281
281
  }
282
282
  static generate(e, n, r, s) {
283
283
  if (!e || !s)
284
- return new F({ message: r, cause: ee(n) });
284
+ return new B({ message: r, cause: ee(n) });
285
285
  const o = n;
286
- return e === 400 ? new Pe(e, o, r, s) : e === 401 ? new ke(e, o, r, s) : e === 403 ? new Te(e, o, r, s) : e === 404 ? new Ce(e, o, r, s) : e === 409 ? new ve(e, o, r, s) : e === 422 ? new Ie(e, o, r, s) : e === 429 ? new Le(e, o, r, s) : e >= 500 ? new Oe(e, o, r, s) : new w(e, o, r, s);
286
+ return e === 400 ? new Ee(e, o, r, s) : e === 401 ? new ke(e, o, r, s) : e === 403 ? new Ie(e, o, r, s) : e === 404 ? new Te(e, o, r, s) : e === 409 ? new Ce(e, o, r, s) : e === 422 ? new Oe(e, o, r, s) : e === 429 ? new De(e, o, r, s) : e >= 500 ? new Le(e, o, r, s) : new g(e, o, r, s);
287
287
  }
288
288
  }
289
- class Z extends w {
289
+ class Z extends g {
290
290
  constructor({ message: e } = {}) {
291
291
  super(void 0, void 0, e || "Request was aborted.", void 0);
292
292
  }
293
293
  }
294
- class F extends w {
294
+ class B extends g {
295
295
  constructor({ message: e, cause: n }) {
296
296
  super(void 0, void 0, e || "Connection error.", void 0), n && (this.cause = n);
297
297
  }
298
298
  }
299
- class Ee extends F {
299
+ class Pe extends B {
300
300
  constructor({ message: e } = {}) {
301
301
  super({ message: e ?? "Request timed out." });
302
302
  }
303
303
  }
304
- class Pe extends w {
304
+ class Ee extends g {
305
305
  }
306
- class ke extends w {
306
+ class ke extends g {
307
307
  }
308
- class Te extends w {
308
+ class Ie extends g {
309
309
  }
310
- class Ce extends w {
310
+ class Te extends g {
311
311
  }
312
- class ve extends w {
312
+ class Ce extends g {
313
313
  }
314
- class Ie extends w {
314
+ class Oe extends g {
315
315
  }
316
- class Le extends w {
316
+ class De extends g {
317
317
  }
318
- class Oe extends w {
318
+ class Le extends g {
319
319
  }
320
- const De = () => {
321
- _e || Qe(Ge(), { auto: !0 });
320
+ const ve = () => {
321
+ Ae || Qe(Je(), { auto: !0 });
322
322
  };
323
- De();
324
- const ft = (t) => t != null && typeof t == "object" && typeof t.url == "string" && typeof t.blob == "function", dt = (t) => t != null && typeof t == "object" && typeof t.name == "string" && typeof t.lastModified == "number" && q(t), q = (t) => t != null && typeof t == "object" && typeof t.size == "number" && typeof t.type == "string" && typeof t.text == "function" && typeof t.slice == "function" && typeof t.arrayBuffer == "function";
325
- async function ht(t, e, n) {
326
- if (t = await t, dt(t))
323
+ ve();
324
+ const dt = (t) => t != null && typeof t == "object" && typeof t.url == "string" && typeof t.blob == "function", ht = (t) => t != null && typeof t == "object" && typeof t.name == "string" && typeof t.lastModified == "number" && H(t), H = (t) => t != null && typeof t == "object" && typeof t.size == "number" && typeof t.type == "string" && typeof t.text == "function" && typeof t.slice == "function" && typeof t.arrayBuffer == "function";
325
+ async function yt(t, e, n) {
326
+ if (t = await t, ht(t))
327
327
  return t;
328
- if (ft(t)) {
328
+ if (dt(t)) {
329
329
  const s = await t.blob();
330
330
  e || (e = new URL(t.url).pathname.split(/[\\/]/).pop() ?? "unknown_file");
331
- const o = q(s) ? [await s.arrayBuffer()] : [s];
331
+ const o = H(s) ? [await s.arrayBuffer()] : [s];
332
332
  return new de(o, e, n);
333
333
  }
334
334
  const r = await pt(t);
335
- if (e || (e = mt(t) ?? "unknown_file"), !n?.type) {
335
+ if (e || (e = gt(t) ?? "unknown_file"), !n?.type) {
336
336
  const s = r[0]?.type;
337
337
  typeof s == "string" && (n = { ...n, type: s });
338
338
  }
@@ -343,19 +343,19 @@ async function pt(t) {
343
343
  if (typeof t == "string" || ArrayBuffer.isView(t) || // includes Uint8Array, Buffer, etc.
344
344
  t instanceof ArrayBuffer)
345
345
  e.push(t);
346
- else if (q(t))
346
+ else if (H(t))
347
347
  e.push(await t.arrayBuffer());
348
- else if (gt(t))
348
+ else if (wt(t))
349
349
  for await (const n of t)
350
350
  e.push(n);
351
351
  else
352
- throw new Error(`Unexpected data type: ${typeof t}; constructor: ${t?.constructor?.name}; props: ${yt(t)}`);
352
+ throw new Error(`Unexpected data type: ${typeof t}; constructor: ${t?.constructor?.name}; props: ${mt(t)}`);
353
353
  return e;
354
354
  }
355
- function yt(t) {
355
+ function mt(t) {
356
356
  return `[${Object.getOwnPropertyNames(t).map((n) => `"${n}"`).join(", ")}]`;
357
357
  }
358
- function mt(t) {
358
+ function gt(t) {
359
359
  return Q(t.name) || Q(t.filename) || // For fs.ReadStream
360
360
  Q(t.path)?.split(/[\\/]/).pop();
361
361
  }
@@ -364,19 +364,19 @@ const Q = (t) => {
364
364
  return t;
365
365
  if (typeof Buffer < "u" && t instanceof Buffer)
366
366
  return String(t);
367
- }, gt = (t) => t != null && typeof t == "object" && typeof t[Symbol.asyncIterator] == "function", ye = (t) => t && typeof t == "object" && t.body && t[Symbol.toStringTag] === "MultipartBody";
367
+ }, wt = (t) => t != null && typeof t == "object" && typeof t[Symbol.asyncIterator] == "function", pe = (t) => t && typeof t == "object" && t.body && t[Symbol.toStringTag] === "MultipartBody";
368
368
  var Ue = function(t, e, n, r, s) {
369
369
  if (r === "m") throw new TypeError("Private method is not writable");
370
370
  if (r === "a" && !s) throw new TypeError("Private accessor was defined without a setter");
371
371
  if (typeof e == "function" ? t !== e || !s : !e.has(t)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
372
372
  return r === "a" ? s.call(t, n) : s ? s.value = n : e.set(t, n), n;
373
- }, $e = function(t, e, n, r) {
373
+ }, je = function(t, e, n, r) {
374
374
  if (n === "a" && !r) throw new TypeError("Private accessor was defined without a getter");
375
375
  if (typeof e == "function" ? t !== e || !r : !e.has(t)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
376
376
  return n === "m" ? r : n === "a" ? r.call(t) : r ? r.value : e.get(t);
377
- }, M, j;
378
- De();
379
- async function je(t) {
377
+ }, N, $;
378
+ ve();
379
+ async function $e(t) {
380
380
  const { response: e } = t;
381
381
  if (e.status === 204)
382
382
  return null;
@@ -385,19 +385,19 @@ async function je(t) {
385
385
  const r = e.headers.get("content-type")?.split(";")[0]?.trim();
386
386
  if (r?.includes("application/json") || r?.endsWith("+json")) {
387
387
  const i = await e.json();
388
- return L("response", e.status, e.url, e.headers, i), i;
388
+ return D("response", e.status, e.url, e.headers, i), i;
389
389
  }
390
390
  const o = await e.text();
391
- return L("response", e.status, e.url, e.headers, o), o;
391
+ return D("response", e.status, e.url, e.headers, o), o;
392
392
  }
393
- class B extends Promise {
394
- constructor(e, n = je) {
393
+ class M extends Promise {
394
+ constructor(e, n = $e) {
395
395
  super((r) => {
396
396
  r(null);
397
397
  }), this.responsePromise = e, this.parseResponse = n;
398
398
  }
399
399
  _thenUnwrap(e) {
400
- return new B(this.responsePromise, async (n) => e(await this.parseResponse(n), n));
400
+ return new M(this.responsePromise, async (n) => e(await this.parseResponse(n), n));
401
401
  }
402
402
  /**
403
403
  * Gets the raw `Response` instance instead of parsing the response
@@ -445,7 +445,7 @@ class B extends Promise {
445
445
  return this.parse().finally(e);
446
446
  }
447
447
  }
448
- class wt {
448
+ class xt {
449
449
  constructor({
450
450
  baseURL: e,
451
451
  baseURLOverridden: n,
@@ -455,7 +455,7 @@ class wt {
455
455
  httpAgent: o,
456
456
  fetch: i
457
457
  }) {
458
- M.set(this, void 0), this.baseURL = e, Ue(this, M, n, "f"), this.maxRetries = G("maxRetries", r), this.timeout = G("timeout", s), this.httpAgent = o, this.fetch = i ?? Je;
458
+ N.set(this, void 0), this.baseURL = e, Ue(this, N, n, "f"), this.maxRetries = J("maxRetries", r), this.timeout = J("timeout", s), this.httpAgent = o, this.fetch = i ?? Ge;
459
459
  }
460
460
  authHeaders(e) {
461
461
  return {};
@@ -483,7 +483,7 @@ class wt {
483
483
  validateHeaders(e, n) {
484
484
  }
485
485
  defaultIdempotencyKey() {
486
- return `stainless-node-retry-${vt()}`;
486
+ return `stainless-node-retry-${Ot()}`;
487
487
  }
488
488
  get(e, n) {
489
489
  return this.methodRequest("get", e, n);
@@ -502,7 +502,7 @@ class wt {
502
502
  }
503
503
  methodRequest(e, n, r) {
504
504
  return this.request(Promise.resolve(r).then(async (s) => {
505
- const o = s && q(s?.body) ? new DataView(await s.body.arrayBuffer()) : s?.body instanceof DataView ? s.body : s?.body instanceof ArrayBuffer ? new DataView(s.body) : s && ArrayBuffer.isView(s?.body) ? new DataView(s.body.buffer) : s?.body;
505
+ const o = s && H(s?.body) ? new DataView(await s.body.arrayBuffer()) : s?.body instanceof DataView ? s.body : s?.body instanceof ArrayBuffer ? new DataView(s.body) : s && ArrayBuffer.isView(s?.body) ? new DataView(s.body.buffer) : s?.body;
506
506
  return { method: e, path: n, ...s, body: o };
507
507
  }));
508
508
  }
@@ -520,15 +520,15 @@ class wt {
520
520
  return null;
521
521
  }
522
522
  async buildRequest(e, { retryCount: n = 0 } = {}) {
523
- const r = { ...e }, { method: s, path: o, query: i, defaultBaseURL: l, headers: u = {} } = r, c = ArrayBuffer.isView(r.body) || r.__binaryRequest && typeof r.body == "string" ? r.body : ye(r.body) ? r.body.body : r.body ? JSON.stringify(r.body, null, 2) : null, h = this.calculateContentLength(c), a = this.buildURL(o, i, l);
524
- "timeout" in r && G("timeout", r.timeout), r.timeout = r.timeout ?? this.timeout;
525
- const p = r.httpAgent ?? this.httpAgent ?? Ye(a), m = r.timeout + 1e3;
526
- typeof p?.options?.timeout == "number" && m > (p.options.timeout ?? 0) && (p.options.timeout = m), this.idempotencyHeader && s !== "get" && (e.idempotencyKey || (e.idempotencyKey = this.defaultIdempotencyKey()), u[this.idempotencyHeader] = e.idempotencyKey);
527
- const b = this.buildHeaders({ options: r, headers: u, contentLength: h, retryCount: n });
523
+ const r = { ...e }, { method: s, path: o, query: i, defaultBaseURL: u, headers: l = {} } = r, c = ArrayBuffer.isView(r.body) || r.__binaryRequest && typeof r.body == "string" ? r.body : pe(r.body) ? r.body.body : r.body ? JSON.stringify(r.body, null, 2) : null, h = this.calculateContentLength(c), a = this.buildURL(o, i, u);
524
+ "timeout" in r && J("timeout", r.timeout), r.timeout = r.timeout ?? this.timeout;
525
+ const p = r.httpAgent ?? this.httpAgent ?? Ye(a), w = r.timeout + 1e3;
526
+ typeof p?.options?.timeout == "number" && w > (p.options.timeout ?? 0) && (p.options.timeout = w), this.idempotencyHeader && s !== "get" && (e.idempotencyKey || (e.idempotencyKey = this.defaultIdempotencyKey()), l[this.idempotencyHeader] = e.idempotencyKey);
527
+ const _ = this.buildHeaders({ options: r, headers: l, contentLength: h, retryCount: n });
528
528
  return { req: {
529
529
  method: s,
530
530
  ...c && { body: c },
531
- headers: b,
531
+ headers: _,
532
532
  ...p && { agent: p },
533
533
  // @ts-ignore node-fetch uses a custom AbortSignal type that is
534
534
  // not compatible with standard web types
@@ -539,7 +539,7 @@ class wt {
539
539
  const o = {};
540
540
  r && (o["content-length"] = r);
541
541
  const i = this.defaultHeaders(e);
542
- return be(o, i), be(o, n), ye(e.body) && _e !== "node" && delete o["content-type"], N(i, "x-stainless-retry-count") === void 0 && N(n, "x-stainless-retry-count") === void 0 && (o["x-stainless-retry-count"] = String(s)), N(i, "x-stainless-timeout") === void 0 && N(n, "x-stainless-timeout") === void 0 && e.timeout && (o["x-stainless-timeout"] = String(Math.trunc(e.timeout / 1e3))), this.validateHeaders(o, n), o;
542
+ return be(o, i), be(o, n), pe(e.body) && Ae !== "node" && delete o["content-type"], F(i, "x-stainless-retry-count") === void 0 && F(n, "x-stainless-retry-count") === void 0 && (o["x-stainless-retry-count"] = String(s)), F(i, "x-stainless-timeout") === void 0 && F(n, "x-stainless-timeout") === void 0 && e.timeout && (o["x-stainless-timeout"] = String(Math.trunc(e.timeout / 1e3))), this.validateHeaders(o, n), o;
543
543
  }
544
544
  /**
545
545
  * Used as a callback for mutating the given `FinalRequestOptions` object.
@@ -558,45 +558,45 @@ class wt {
558
558
  return e ? Symbol.iterator in e ? Object.fromEntries(Array.from(e).map((n) => [...n])) : { ...e } : {};
559
559
  }
560
560
  makeStatusError(e, n, r, s) {
561
- return w.generate(e, n, r, s);
561
+ return g.generate(e, n, r, s);
562
562
  }
563
563
  request(e, n = null) {
564
- return new B(this.makeRequest(e, n));
564
+ return new M(this.makeRequest(e, n));
565
565
  }
566
566
  async makeRequest(e, n) {
567
567
  const r = await e, s = r.maxRetries ?? this.maxRetries;
568
568
  n == null && (n = s), await this.prepareOptions(r);
569
- const { req: o, url: i, timeout: l } = await this.buildRequest(r, {
569
+ const { req: o, url: i, timeout: u } = await this.buildRequest(r, {
570
570
  retryCount: s - n
571
571
  });
572
- if (await this.prepareRequest(o, { url: i, options: r }), L("request", i, r, o.headers), r.signal?.aborted)
572
+ if (await this.prepareRequest(o, { url: i, options: r }), D("request", i, r, o.headers), r.signal?.aborted)
573
573
  throw new Z();
574
- const u = new AbortController(), c = await this.fetchWithTimeout(i, o, l, u).catch(ee);
574
+ const l = new AbortController(), c = await this.fetchWithTimeout(i, o, u, l).catch(ee);
575
575
  if (c instanceof Error) {
576
576
  if (r.signal?.aborted)
577
577
  throw new Z();
578
578
  if (n)
579
579
  return this.retryRequest(r, n);
580
- throw c.name === "AbortError" ? new Ee() : new F({ cause: c });
580
+ throw c.name === "AbortError" ? new Pe() : new B({ cause: c });
581
581
  }
582
582
  const h = _t(c.headers);
583
583
  if (!c.ok) {
584
584
  if (n && this.shouldRetry(c)) {
585
- const S = `retrying, ${n} attempts remaining`;
586
- return L(`response (error; ${S})`, c.status, i, h), this.retryRequest(r, n, h);
585
+ const R = `retrying, ${n} attempts remaining`;
586
+ return D(`response (error; ${R})`, c.status, i, h), this.retryRequest(r, n, h);
587
587
  }
588
- const a = await c.text().catch((S) => ee(S).message), p = Pt(a), m = p ? void 0 : a;
589
- throw L(`response (error; ${n ? "(error; no more retries left)" : "(error; not retryable)"})`, c.status, i, h, m), this.makeStatusError(c.status, p, m, h);
588
+ const a = await c.text().catch((R) => ee(R).message), p = kt(a), w = p ? void 0 : a;
589
+ throw D(`response (error; ${n ? "(error; no more retries left)" : "(error; not retryable)"})`, c.status, i, h, w), this.makeStatusError(c.status, p, w, h);
590
590
  }
591
- return { response: c, options: r, controller: u };
591
+ return { response: c, options: r, controller: l };
592
592
  }
593
593
  requestAPIList(e, n) {
594
594
  const r = this.makeRequest(n, null);
595
- return new bt(this, r, e);
595
+ return new At(this, r, e);
596
596
  }
597
597
  buildURL(e, n, r) {
598
- const s = !$e(this, M, "f") && r || this.baseURL, o = Tt(e) ? new URL(e) : new URL(s + (s.endsWith("/") && e.startsWith("/") ? e.slice(1) : e)), i = this.defaultQuery();
599
- return Ne(i) || (n = { ...i, ...n }), typeof n == "object" && n && !Array.isArray(n) && (o.search = this.stringifyQuery(n)), o.toString();
598
+ const s = !je(this, N, "f") && r || this.baseURL, o = Tt(e) ? new URL(e) : new URL(s + (s.endsWith("/") && e.startsWith("/") ? e.slice(1) : e)), i = this.defaultQuery();
599
+ return Fe(i) || (n = { ...i, ...n }), typeof n == "object" && n && !Array.isArray(n) && (o.search = this.stringifyQuery(n)), o.toString();
600
600
  }
601
601
  stringifyQuery(e) {
602
602
  return Object.entries(e).filter(([n, r]) => typeof r < "u").map(([n, r]) => {
@@ -604,19 +604,19 @@ class wt {
604
604
  return `${encodeURIComponent(n)}=${encodeURIComponent(r)}`;
605
605
  if (r === null)
606
606
  return `${encodeURIComponent(n)}=`;
607
- throw new P(`Cannot stringify type ${typeof r}; Expected string, number, boolean, or null. If you need to pass nested query parameters, you can manually encode them, e.g. { query: { 'foo[key1]': value1, 'foo[key2]': value2 } }, and please open a GitHub issue requesting better support for your use case.`);
607
+ throw new E(`Cannot stringify type ${typeof r}; Expected string, number, boolean, or null. If you need to pass nested query parameters, you can manually encode them, e.g. { query: { 'foo[key1]': value1, 'foo[key2]': value2 } }, and please open a GitHub issue requesting better support for your use case.`);
608
608
  }).join("&");
609
609
  }
610
610
  async fetchWithTimeout(e, n, r, s) {
611
611
  const { signal: o, ...i } = n || {};
612
612
  o && o.addEventListener("abort", () => s.abort());
613
- const l = setTimeout(() => s.abort(), r), u = {
613
+ const u = setTimeout(() => s.abort(), r), l = {
614
614
  signal: s.signal,
615
615
  ...i
616
616
  };
617
- return u.method && (u.method = u.method.toUpperCase()), // use undefined this binding; fetch errors if bound to something else in browser/cloudflare
618
- this.fetch.call(void 0, e, u).finally(() => {
619
- clearTimeout(l);
617
+ return l.method && (l.method = l.method.toUpperCase()), // use undefined this binding; fetch errors if bound to something else in browser/cloudflare
618
+ this.fetch.call(void 0, e, l).finally(() => {
619
+ clearTimeout(u);
620
620
  });
621
621
  }
622
622
  shouldRetry(e) {
@@ -627,32 +627,32 @@ class wt {
627
627
  let s;
628
628
  const o = r?.["retry-after-ms"];
629
629
  if (o) {
630
- const l = parseFloat(o);
631
- Number.isNaN(l) || (s = l);
630
+ const u = parseFloat(o);
631
+ Number.isNaN(u) || (s = u);
632
632
  }
633
633
  const i = r?.["retry-after"];
634
634
  if (i && !s) {
635
- const l = parseFloat(i);
636
- Number.isNaN(l) ? s = Date.parse(i) - Date.now() : s = l * 1e3;
635
+ const u = parseFloat(i);
636
+ Number.isNaN(u) ? s = Date.parse(i) - Date.now() : s = u * 1e3;
637
637
  }
638
638
  if (!(s && 0 <= s && s < 60 * 1e3)) {
639
- const l = e.maxRetries ?? this.maxRetries;
640
- s = this.calculateDefaultRetryTimeoutMillis(n, l);
639
+ const u = e.maxRetries ?? this.maxRetries;
640
+ s = this.calculateDefaultRetryTimeoutMillis(n, u);
641
641
  }
642
642
  return await Ct(s), this.makeRequest(e, n - 1);
643
643
  }
644
644
  calculateDefaultRetryTimeoutMillis(e, n) {
645
- const o = n - e, i = Math.min(0.5 * Math.pow(2, o), 8), l = 1 - Math.random() * 0.25;
646
- return i * l * 1e3;
645
+ const o = n - e, i = Math.min(0.5 * Math.pow(2, o), 8), u = 1 - Math.random() * 0.25;
646
+ return i * u * 1e3;
647
647
  }
648
648
  getUserAgent() {
649
- return `${this.constructor.name}/JS ${T}`;
649
+ return `${this.constructor.name}/JS ${I}`;
650
650
  }
651
651
  }
652
- M = /* @__PURE__ */ new WeakMap();
653
- class xt {
652
+ N = /* @__PURE__ */ new WeakMap();
653
+ class bt {
654
654
  constructor(e, n, r, s) {
655
- j.set(this, void 0), Ue(this, j, e, "f"), this.options = s, this.response = n, this.body = r;
655
+ $.set(this, void 0), Ue(this, $, e, "f"), this.options = s, this.response = n, this.body = r;
656
656
  }
657
657
  hasNextPage() {
658
658
  return this.getPaginatedItems().length ? this.nextPageInfo() != null : !1;
@@ -660,7 +660,7 @@ class xt {
660
660
  async getNextPage() {
661
661
  const e = this.nextPageInfo();
662
662
  if (!e)
663
- throw new P("No next page expected; please check `.hasNextPage()` before calling `.getNextPage()`.");
663
+ throw new E("No next page expected; please check `.hasNextPage()` before calling `.getNextPage()`.");
664
664
  const n = { ...this.options };
665
665
  if ("params" in e && typeof n.query == "object")
666
666
  n.query = { ...n.query, ...e.params };
@@ -670,22 +670,22 @@ class xt {
670
670
  e.url.searchParams.set(s, o);
671
671
  n.query = void 0, n.path = e.url.toString();
672
672
  }
673
- return await $e(this, j, "f").requestAPIList(this.constructor, n);
673
+ return await je(this, $, "f").requestAPIList(this.constructor, n);
674
674
  }
675
675
  async *iterPages() {
676
676
  let e = this;
677
677
  for (yield e; e.hasNextPage(); )
678
678
  e = await e.getNextPage(), yield e;
679
679
  }
680
- async *[(j = /* @__PURE__ */ new WeakMap(), Symbol.asyncIterator)]() {
680
+ async *[($ = /* @__PURE__ */ new WeakMap(), Symbol.asyncIterator)]() {
681
681
  for await (const e of this.iterPages())
682
682
  for (const n of e.getPaginatedItems())
683
683
  yield n;
684
684
  }
685
685
  }
686
- class bt extends B {
686
+ class At extends M {
687
687
  constructor(e, n, r) {
688
- super(n, async (s) => new r(e, s.response, await je(s), s.options));
688
+ super(n, async (s) => new r(e, s.response, await $e(s), s.options));
689
689
  }
690
690
  /**
691
691
  * Allow auto-paginating iteration on an unawaited list call, eg:
@@ -708,7 +708,7 @@ const _t = (t) => new Proxy(Object.fromEntries(
708
708
  const r = n.toString();
709
709
  return e[r.toLowerCase()] || e[r];
710
710
  }
711
- }), At = {
711
+ }), Rt = {
712
712
  method: !0,
713
713
  path: !0,
714
714
  query: !0,
@@ -723,11 +723,11 @@ const _t = (t) => new Proxy(Object.fromEntries(
723
723
  idempotencyKey: !0,
724
724
  __binaryRequest: !0,
725
725
  __binaryResponse: !0
726
- }, R = (t) => typeof t == "object" && t !== null && !Ne(t) && Object.keys(t).every((e) => Me(At, e)), St = () => {
726
+ }, S = (t) => typeof t == "object" && t !== null && !Fe(t) && Object.keys(t).every((e) => Ne(Rt, e)), St = () => {
727
727
  if (typeof Deno < "u" && Deno.build != null)
728
728
  return {
729
729
  "X-Stainless-Lang": "js",
730
- "X-Stainless-Package-Version": T,
730
+ "X-Stainless-Package-Version": I,
731
731
  "X-Stainless-OS": ge(Deno.build.os),
732
732
  "X-Stainless-Arch": me(Deno.build.arch),
733
733
  "X-Stainless-Runtime": "deno",
@@ -736,7 +736,7 @@ const _t = (t) => new Proxy(Object.fromEntries(
736
736
  if (typeof EdgeRuntime < "u")
737
737
  return {
738
738
  "X-Stainless-Lang": "js",
739
- "X-Stainless-Package-Version": T,
739
+ "X-Stainless-Package-Version": I,
740
740
  "X-Stainless-OS": "Unknown",
741
741
  "X-Stainless-Arch": `other:${EdgeRuntime}`,
742
742
  "X-Stainless-Runtime": "edge",
@@ -745,30 +745,30 @@ const _t = (t) => new Proxy(Object.fromEntries(
745
745
  if (Object.prototype.toString.call(typeof process < "u" ? process : 0) === "[object process]")
746
746
  return {
747
747
  "X-Stainless-Lang": "js",
748
- "X-Stainless-Package-Version": T,
748
+ "X-Stainless-Package-Version": I,
749
749
  "X-Stainless-OS": ge(process.platform),
750
750
  "X-Stainless-Arch": me(process.arch),
751
751
  "X-Stainless-Runtime": "node",
752
752
  "X-Stainless-Runtime-Version": process.version
753
753
  };
754
- const t = Rt();
754
+ const t = Pt();
755
755
  return t ? {
756
756
  "X-Stainless-Lang": "js",
757
- "X-Stainless-Package-Version": T,
757
+ "X-Stainless-Package-Version": I,
758
758
  "X-Stainless-OS": "Unknown",
759
759
  "X-Stainless-Arch": "unknown",
760
760
  "X-Stainless-Runtime": `browser:${t.browser}`,
761
761
  "X-Stainless-Runtime-Version": t.version
762
762
  } : {
763
763
  "X-Stainless-Lang": "js",
764
- "X-Stainless-Package-Version": T,
764
+ "X-Stainless-Package-Version": I,
765
765
  "X-Stainless-OS": "Unknown",
766
766
  "X-Stainless-Arch": "unknown",
767
767
  "X-Stainless-Runtime": "unknown",
768
768
  "X-Stainless-Runtime-Version": "unknown"
769
769
  };
770
770
  };
771
- function Rt() {
771
+ function Pt() {
772
772
  if (typeof navigator > "u" || !navigator)
773
773
  return null;
774
774
  const t = [
@@ -790,17 +790,17 @@ function Rt() {
790
790
  }
791
791
  const me = (t) => t === "x32" ? "x32" : t === "x86_64" || t === "x64" ? "x64" : t === "arm" ? "arm" : t === "aarch64" || t === "arm64" ? "arm64" : t ? `other:${t}` : "unknown", ge = (t) => (t = t.toLowerCase(), t.includes("ios") ? "iOS" : t === "android" ? "Android" : t === "darwin" ? "MacOS" : t === "win32" ? "Windows" : t === "freebsd" ? "FreeBSD" : t === "openbsd" ? "OpenBSD" : t === "linux" ? "Linux" : t ? `Other:${t}` : "Unknown");
792
792
  let we;
793
- const Et = () => we ?? (we = St()), Pt = (t) => {
793
+ const Et = () => we ?? (we = St()), kt = (t) => {
794
794
  try {
795
795
  return JSON.parse(t);
796
796
  } catch {
797
797
  return;
798
798
  }
799
- }, kt = /^[a-z][a-z0-9+.-]*:/i, Tt = (t) => kt.test(t), Ct = (t) => new Promise((e) => setTimeout(e, t)), G = (t, e) => {
799
+ }, It = /^[a-z][a-z0-9+.-]*:/i, Tt = (t) => It.test(t), Ct = (t) => new Promise((e) => setTimeout(e, t)), J = (t, e) => {
800
800
  if (typeof e != "number" || !Number.isInteger(e))
801
- throw new P(`${t} must be an integer`);
801
+ throw new E(`${t} must be an integer`);
802
802
  if (e < 0)
803
- throw new P(`${t} must be a positive integer`);
803
+ throw new E(`${t} must be a positive integer`);
804
804
  return e;
805
805
  }, ee = (t) => {
806
806
  if (t instanceof Error)
@@ -817,19 +817,19 @@ const Et = () => we ?? (we = St()), Pt = (t) => {
817
817
  if (typeof Deno < "u")
818
818
  return Deno.env?.get?.(t)?.trim();
819
819
  };
820
- function Ne(t) {
820
+ function Fe(t) {
821
821
  if (!t)
822
822
  return !0;
823
823
  for (const e in t)
824
824
  return !1;
825
825
  return !0;
826
826
  }
827
- function Me(t, e) {
827
+ function Ne(t, e) {
828
828
  return Object.prototype.hasOwnProperty.call(t, e);
829
829
  }
830
830
  function be(t, e) {
831
831
  for (const n in e) {
832
- if (!Me(e, n))
832
+ if (!Ne(e, n))
833
833
  continue;
834
834
  const r = n.toLowerCase();
835
835
  if (!r)
@@ -838,15 +838,15 @@ function be(t, e) {
838
838
  s === null ? delete t[r] : s !== void 0 && (t[r] = s);
839
839
  }
840
840
  }
841
- function L(t, ...e) {
841
+ function D(t, ...e) {
842
842
  typeof process < "u" && process?.env?.DEBUG === "true" && console.log(`Arcade:DEBUG:${t}`, ...e);
843
843
  }
844
- const vt = () => "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (t) => {
844
+ const Ot = () => "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (t) => {
845
845
  const e = Math.random() * 16 | 0;
846
846
  return (t === "x" ? e : e & 3 | 8).toString(16);
847
- }), It = (t) => typeof t?.get == "function", N = (t, e) => {
847
+ }), Dt = (t) => typeof t?.get == "function", F = (t, e) => {
848
848
  const n = e.toLowerCase();
849
- if (It(t)) {
849
+ if (Dt(t)) {
850
850
  const r = e[0]?.toUpperCase() + e.substring(1).replace(/([^\w])(\w)/g, (s, o, i) => o + i.toUpperCase());
851
851
  for (const s of [e, n, e.toUpperCase(), r]) {
852
852
  const o = t.get(s);
@@ -858,7 +858,7 @@ const vt = () => "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (t) =>
858
858
  if (r.toLowerCase() === n)
859
859
  return Array.isArray(s) ? (s.length <= 1 || console.warn(`Received ${s.length} entries for the ${e} header, using the first entry.`), s[0]) : s;
860
860
  };
861
- class O extends xt {
861
+ class L extends bt {
862
862
  constructor(e, n, r, s) {
863
863
  super(e, n, r, s), this.items = r.items || [], this.total_count = r.total_count || 0, this.offset = r.offset || 0;
864
864
  }
@@ -888,7 +888,7 @@ class x {
888
888
  this._client = e;
889
889
  }
890
890
  }
891
- class Fe extends x {
891
+ class Be extends x {
892
892
  /**
893
893
  * Create a new auth provider
894
894
  */
@@ -920,7 +920,7 @@ class Fe extends x {
920
920
  return this._client.patch(`/v1/admin/auth_providers/${e}`, { body: n, ...r });
921
921
  }
922
922
  }
923
- class qe extends x {
923
+ class He extends x {
924
924
  /**
925
925
  * List all secrets that are visible to the caller
926
926
  */
@@ -939,7 +939,7 @@ class qe extends x {
939
939
  }
940
940
  class te extends x {
941
941
  list(e = {}, n) {
942
- return R(e) ? this.list({}, e) : this._client.getAPIList("/v1/admin/user_connections", ne, {
942
+ return S(e) ? this.list({}, e) : this._client.getAPIList("/v1/admin/user_connections", ne, {
943
943
  query: e,
944
944
  ...n
945
945
  });
@@ -954,25 +954,25 @@ class te extends x {
954
954
  });
955
955
  }
956
956
  }
957
- class ne extends O {
957
+ class ne extends L {
958
958
  }
959
959
  te.UserConnectionResponsesOffsetPage = ne;
960
- class C extends x {
960
+ class T extends x {
961
961
  constructor() {
962
- super(...arguments), this.userConnections = new te(this._client), this.authProviders = new Fe(this._client), this.secrets = new qe(this._client);
962
+ super(...arguments), this.userConnections = new te(this._client), this.authProviders = new Be(this._client), this.secrets = new He(this._client);
963
963
  }
964
964
  }
965
- C.UserConnections = te;
966
- C.UserConnectionResponsesOffsetPage = ne;
967
- C.AuthProviders = Fe;
968
- C.Secrets = qe;
965
+ T.UserConnections = te;
966
+ T.UserConnectionResponsesOffsetPage = ne;
967
+ T.AuthProviders = Be;
968
+ T.Secrets = He;
969
969
  const Lt = 45;
970
- class Ot extends Error {
970
+ class vt extends Error {
971
971
  constructor(e) {
972
972
  super(e), this.name = "AuthorizationError";
973
973
  }
974
974
  }
975
- class Be extends x {
975
+ class Me extends x {
976
976
  /**
977
977
  * Starts the authorization process for a given provider and scopes.
978
978
  * @param userId - The user ID for which authorization is being requested
@@ -1045,7 +1045,7 @@ class Be extends x {
1045
1045
  n = e, r = { status: "pending" };
1046
1046
  else {
1047
1047
  if (!e.id)
1048
- throw new Ot("Authorization ID is required");
1048
+ throw new vt("Authorization ID is required");
1049
1049
  n = e.id, r = e;
1050
1050
  }
1051
1051
  for (; r.status !== "completed"; )
@@ -1056,7 +1056,7 @@ class Be extends x {
1056
1056
  return r;
1057
1057
  }
1058
1058
  }
1059
- class He extends x {
1059
+ class qe extends x {
1060
1060
  /**
1061
1061
  * Talk to different LLM Chat APIs via OpenAI's API
1062
1062
  */
@@ -1066,11 +1066,11 @@ class He extends x {
1066
1066
  }
1067
1067
  class re extends x {
1068
1068
  constructor() {
1069
- super(...arguments), this.completions = new He(this._client);
1069
+ super(...arguments), this.completions = new qe(this._client);
1070
1070
  }
1071
1071
  }
1072
- re.Completions = He;
1073
- class ze extends x {
1072
+ re.Completions = qe;
1073
+ class Xe extends x {
1074
1074
  /**
1075
1075
  * Engine Health
1076
1076
  */
@@ -1080,21 +1080,21 @@ class ze extends x {
1080
1080
  }
1081
1081
  class se extends x {
1082
1082
  list(e = {}, n) {
1083
- return R(e) ? this.list({}, e) : this._client.getAPIList("/v1/formatted_tools", oe, {
1083
+ return S(e) ? this.list({}, e) : this._client.getAPIList("/v1/formatted_tools", oe, {
1084
1084
  query: e,
1085
1085
  ...n
1086
1086
  });
1087
1087
  }
1088
1088
  get(e, n = {}, r) {
1089
- return R(n) ? this.get(e, {}, n) : this._client.get(`/v1/formatted_tools/${e}`, { query: n, ...r });
1089
+ return S(n) ? this.get(e, {}, n) : this._client.get(`/v1/formatted_tools/${e}`, { query: n, ...r });
1090
1090
  }
1091
1091
  }
1092
- class oe extends O {
1092
+ class oe extends L {
1093
1093
  }
1094
1094
  se.FormattedListResponsesOffsetPage = oe;
1095
- class Xe extends x {
1095
+ class Ke extends x {
1096
1096
  list(e = {}, n) {
1097
- return R(e) ? this.list({}, e) : this._client.getAPIList("/v1/scheduled_tools", Dt, { query: e, ...n });
1097
+ return S(e) ? this.list({}, e) : this._client.getAPIList("/v1/scheduled_tools", Ut, { query: e, ...n });
1098
1098
  }
1099
1099
  /**
1100
1100
  * Returns the details for a specific scheduled tool execution
@@ -1103,12 +1103,12 @@ class Xe extends x {
1103
1103
  return this._client.get(`/v1/scheduled_tools/${e}`, n);
1104
1104
  }
1105
1105
  }
1106
- class v extends x {
1106
+ class C extends x {
1107
1107
  constructor() {
1108
- super(...arguments), this.scheduled = new Xe(this._client), this.formatted = new se(this._client);
1108
+ super(...arguments), this.scheduled = new Ke(this._client), this.formatted = new se(this._client);
1109
1109
  }
1110
1110
  list(e = {}, n) {
1111
- return R(e) ? this.list({}, e) : this._client.getAPIList("/v1/tools", H, { query: e, ...n });
1111
+ return S(e) ? this.list({}, e) : this._client.getAPIList("/v1/tools", q, { query: e, ...n });
1112
1112
  }
1113
1113
  /**
1114
1114
  * Authorizes a user for a specific tool by name
@@ -1123,17 +1123,17 @@ class v extends x {
1123
1123
  return this._client.post("/v1/tools/execute", { body: e, ...n });
1124
1124
  }
1125
1125
  get(e, n = {}, r) {
1126
- return R(n) ? this.get(e, {}, n) : this._client.get(`/v1/tools/${e}`, { query: n, ...r });
1126
+ return S(n) ? this.get(e, {}, n) : this._client.get(`/v1/tools/${e}`, { query: n, ...r });
1127
1127
  }
1128
1128
  }
1129
- class H extends O {
1129
+ class q extends L {
1130
1130
  }
1131
- class Dt extends O {
1131
+ class Ut extends L {
1132
1132
  }
1133
- v.ToolDefinitionsOffsetPage = H;
1134
- v.Scheduled = Xe;
1135
- v.Formatted = se;
1136
- v.FormattedListResponsesOffsetPage = oe;
1133
+ C.ToolDefinitionsOffsetPage = q;
1134
+ C.Scheduled = Ke;
1135
+ C.Formatted = se;
1136
+ C.FormattedListResponsesOffsetPage = oe;
1137
1137
  class ie extends x {
1138
1138
  /**
1139
1139
  * Create a worker
@@ -1148,7 +1148,7 @@ class ie extends x {
1148
1148
  return this._client.patch(`/v1/workers/${e}`, { body: n, ...r });
1149
1149
  }
1150
1150
  list(e = {}, n) {
1151
- return R(e) ? this.list({}, e) : this._client.getAPIList("/v1/workers", ae, { query: e, ...n });
1151
+ return S(e) ? this.list({}, e) : this._client.getAPIList("/v1/workers", ae, { query: e, ...n });
1152
1152
  }
1153
1153
  /**
1154
1154
  * Delete a worker
@@ -1172,17 +1172,17 @@ class ie extends x {
1172
1172
  return this._client.get(`/v1/workers/${e}/health`, n);
1173
1173
  }
1174
1174
  tools(e, n = {}, r) {
1175
- return R(n) ? this.tools(e, {}, n) : this._client.getAPIList(`/v1/workers/${e}/tools`, H, {
1175
+ return S(n) ? this.tools(e, {}, n) : this._client.getAPIList(`/v1/workers/${e}/tools`, q, {
1176
1176
  query: n,
1177
1177
  ...r
1178
1178
  });
1179
1179
  }
1180
1180
  }
1181
- class ae extends O {
1181
+ class ae extends L {
1182
1182
  }
1183
1183
  ie.WorkerResponsesOffsetPage = ae;
1184
- var Ke, We;
1185
- class d extends wt {
1184
+ var We, Ve;
1185
+ class d extends xt {
1186
1186
  /**
1187
1187
  * API Client for interfacing with the Arcade API.
1188
1188
  *
@@ -1197,7 +1197,7 @@ class d extends wt {
1197
1197
  */
1198
1198
  constructor({ baseURL: e = xe("ARCADE_BASE_URL"), apiKey: n = xe("ARCADE_API_KEY"), ...r } = {}) {
1199
1199
  if (n === void 0)
1200
- throw new P("The ARCADE_API_KEY environment variable is missing or empty; either provide it, or instantiate the Arcade client with an apiKey option, like new Arcade({ apiKey: 'My API Key' }).");
1200
+ throw new E("The ARCADE_API_KEY environment variable is missing or empty; either provide it, or instantiate the Arcade client with an apiKey option, like new Arcade({ apiKey: 'My API Key' }).");
1201
1201
  const s = {
1202
1202
  apiKey: n,
1203
1203
  ...r,
@@ -1210,7 +1210,7 @@ class d extends wt {
1210
1210
  httpAgent: s.httpAgent,
1211
1211
  maxRetries: s.maxRetries,
1212
1212
  fetch: s.fetch
1213
- }), Ke.add(this), this.admin = new C(this), this.auth = new Be(this), this.health = new ze(this), this.chat = new re(this), this.tools = new v(this), this.workers = new ie(this), this._options = s, this.idempotencyHeader = "Idempotency-Key", this.apiKey = n;
1213
+ }), We.add(this), this.admin = new T(this), this.auth = new Me(this), this.health = new Xe(this), this.chat = new re(this), this.tools = new C(this), this.workers = new ie(this), this._options = s, this.idempotencyHeader = "Idempotency-Key", this.apiKey = n;
1214
1214
  }
1215
1215
  defaultQuery() {
1216
1216
  return this._options.defaultQuery;
@@ -1225,45 +1225,44 @@ class d extends wt {
1225
1225
  return { Authorization: this.apiKey };
1226
1226
  }
1227
1227
  stringifyQuery(e) {
1228
- return lt(e, { arrayFormat: "comma" });
1228
+ return ft(e, { arrayFormat: "comma" });
1229
1229
  }
1230
1230
  }
1231
- We = d, Ke = /* @__PURE__ */ new WeakSet();
1232
- d.Arcade = We;
1231
+ Ve = d, We = /* @__PURE__ */ new WeakSet();
1232
+ d.Arcade = Ve;
1233
1233
  d.DEFAULT_TIMEOUT = 6e4;
1234
- d.ArcadeError = P;
1235
- d.APIError = w;
1236
- d.APIConnectionError = F;
1237
- d.APIConnectionTimeoutError = Ee;
1234
+ d.ArcadeError = E;
1235
+ d.APIError = g;
1236
+ d.APIConnectionError = B;
1237
+ d.APIConnectionTimeoutError = Pe;
1238
1238
  d.APIUserAbortError = Z;
1239
- d.NotFoundError = Ce;
1240
- d.ConflictError = ve;
1241
- d.RateLimitError = Le;
1242
- d.BadRequestError = Pe;
1239
+ d.NotFoundError = Te;
1240
+ d.ConflictError = Ce;
1241
+ d.RateLimitError = De;
1242
+ d.BadRequestError = Ee;
1243
1243
  d.AuthenticationError = ke;
1244
- d.InternalServerError = Oe;
1245
- d.PermissionDeniedError = Te;
1246
- d.UnprocessableEntityError = Ie;
1247
- d.toFile = ht;
1244
+ d.InternalServerError = Le;
1245
+ d.PermissionDeniedError = Ie;
1246
+ d.UnprocessableEntityError = Oe;
1247
+ d.toFile = yt;
1248
1248
  d.fileFromPath = Ze;
1249
- d.Admin = C;
1250
- d.Auth = Be;
1251
- d.Health = ze;
1249
+ d.Admin = T;
1250
+ d.Auth = Me;
1251
+ d.Health = Xe;
1252
1252
  d.Chat = re;
1253
- d.Tools = v;
1254
- d.ToolDefinitionsOffsetPage = H;
1253
+ d.Tools = C;
1254
+ d.ToolDefinitionsOffsetPage = q;
1255
1255
  d.Workers = ie;
1256
1256
  d.WorkerResponsesOffsetPage = ae;
1257
- const Ut = /[._\-\s]+/, $t = /([a-z])([A-Z])/g, jt = /\s+/;
1258
- class qt extends d {
1257
+ class Nt extends d {
1259
1258
  constructor(e) {
1260
- const { accessToken: n, apiKey: r, arcadeClientId: s, baseURL: o, ...i } = e, l = r ?? he("ARCADE_API_KEY"), u = !!l, c = {};
1261
- s && (c["Arcade-Client-Id"] = s), !u && n && (c.Authorization = `Bearer ${n}`);
1259
+ const { accessToken: n, apiKey: r, arcadeClientId: s, baseURL: o, ...i } = e, u = r ?? he("ARCADE_API_KEY"), l = !!u, c = {};
1260
+ s && (c["Arcade-Client-Id"] = s), !l && n && (c.Authorization = `Bearer ${n}`);
1262
1261
  const h = {
1263
1262
  ...i,
1264
1263
  baseURL: o ?? he("ARCADE_BASE_URL"),
1265
1264
  defaultHeaders: c,
1266
- apiKey: l ?? ""
1265
+ apiKey: u ?? ""
1267
1266
  };
1268
1267
  super(h);
1269
1268
  }
@@ -1287,22 +1286,8 @@ class qt extends d {
1287
1286
  return r;
1288
1287
  }
1289
1288
  async getToolkits() {
1290
- const e = await this.getAllTools(), n = /* @__PURE__ */ new Map();
1291
- for (const r of e) {
1292
- const s = r.toolkit.name;
1293
- let o = n.get(s);
1294
- o || (o = {
1295
- ...r.toolkit,
1296
- tools: [],
1297
- requirements: {
1298
- met: !0,
1299
- secrets: [],
1300
- authorization: [],
1301
- scopes: {}
1302
- }
1303
- }, n.set(s, o)), o.tools.push(r), r.requirements && this.applyToolRequirements(o, r.requirements);
1304
- }
1305
- return n;
1289
+ const e = await this.getAllTools();
1290
+ return et(e);
1306
1291
  }
1307
1292
  async getToolsForToolkit(e) {
1308
1293
  return (await this.tools.list({
@@ -1310,159 +1295,11 @@ class qt extends d {
1310
1295
  limit: 25e3
1311
1296
  })).items;
1312
1297
  }
1313
- applyToolRequirements(e, n) {
1314
- if (!n)
1315
- return;
1316
- e.requirements.secrets = this.mergeSecrets(
1317
- n.secrets ?? [],
1318
- e.requirements.secrets ?? []
1319
- ), e.requirements.authorization = this.mergeAuthorizations(
1320
- n.authorization,
1321
- e.requirements.authorization ?? []
1322
- );
1323
- const r = n.authorization?.provider_id, s = n.authorization?.oauth2?.scopes ?? [];
1324
- r && s.length && (e.requirements.scopes = this.mergeScopes(
1325
- r,
1326
- s,
1327
- e.requirements.scopes ?? {}
1328
- )), e.requirements.met = !!(e.requirements.met && (n.met ?? !0));
1329
- }
1330
- mergeSecrets(e = [], n = []) {
1331
- if (e.length === 0)
1332
- return n;
1333
- const r = /* @__PURE__ */ new Map();
1334
- for (const s of n)
1335
- r.set(s.key, { ...s });
1336
- for (const s of e) {
1337
- const o = r.get(s.key);
1338
- if (!o) {
1339
- r.set(s.key, { ...s });
1340
- continue;
1341
- }
1342
- const i = !!(o.met || s.met), l = s.status_reason ?? o.status_reason;
1343
- r.set(s.key, { key: s.key, met: i, status_reason: l });
1344
- }
1345
- return Array.from(r.values());
1346
- }
1347
- mergeAuthorizations(e, n = []) {
1348
- if (!e?.provider_id)
1349
- return n;
1350
- const r = new Map(n.map((i) => [i.provider_id, { ...i }])), s = r.get(e.provider_id);
1351
- if (!s)
1352
- return r.set(e.provider_id, { ...e }), Array.from(r.values());
1353
- const o = new Set(s.oauth2?.scopes ?? []);
1354
- for (const i of e.oauth2?.scopes ?? [])
1355
- o.add(i);
1356
- return r.set(e.provider_id, {
1357
- ...s,
1358
- oauth2: {
1359
- ...s.oauth2 ?? {},
1360
- scopes: Array.from(o)
1361
- }
1362
- }), Array.from(r.values());
1363
- }
1364
- mergeScopes(e, n = [], r = {}) {
1365
- if (!e || n.length === 0)
1366
- return r;
1367
- const s = new Set(r[e] ?? []);
1368
- for (const o of n)
1369
- s.add(o);
1370
- return { ...r, [e]: Array.from(s) };
1371
- }
1372
- /**
1373
- * Pre-compute requirements summary for optimal UI performance.
1374
- * This eliminates the need for runtime transformation in UI components.
1375
- */
1376
- computeRequirementsSummary(e) {
1377
- const n = e?.secrets?.length ? {
1378
- configured: e.secrets.filter((s) => s.met === !0).map((s) => s.key),
1379
- pending: e.secrets.filter((s) => s.met === !1).map((s) => s.key)
1380
- } : void 0, r = e?.authorization?.length ? {
1381
- providers: e.authorization.filter((s) => s.provider_id || s.id).map((s) => ({
1382
- id: s.provider_id || s.id || "",
1383
- status: s.status,
1384
- scopes: s.oauth2?.scopes || []
1385
- }))
1386
- } : void 0;
1387
- return { secrets: n, oauth: r };
1388
- }
1389
- /**
1390
- * Process raw toolkit data into an optimized collection with pre-computed search indices.
1391
- *
1392
- * @returns ToolkitCollection with:
1393
- * - Pre-computed searchable text for fast filtering
1394
- * - Pre-computed requirement badges (no runtime processing needed)
1395
- * - Search indices for O(1) lookups
1396
- * - Toolkit/tool mapping for quick relationships
1397
- */
1398
1298
  async getProcessedToolkitCollection() {
1399
- const e = await this.getToolkits(), n = [], r = [], s = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map(), i = {
1400
- toolkitsByName: /* @__PURE__ */ new Map(),
1401
- toolsByName: /* @__PURE__ */ new Map()
1402
- };
1403
- for (const [l, u] of e.entries()) {
1404
- const c = this.normalizeText([
1405
- u.name,
1406
- u.description ?? "",
1407
- u.version ?? ""
1408
- ]), h = this.computeRequirementsSummary(
1409
- u.requirements
1410
- ), a = {
1411
- ...u,
1412
- searchableText: c,
1413
- requirementsSummary: h,
1414
- metadata: et[u.name]
1415
- };
1416
- n.push(a), s.set(l, a), i.toolkitsByName.set(l.toLowerCase(), a);
1417
- for (const p of u.tools) {
1418
- const m = this.normalizeText([
1419
- p.name,
1420
- p.fully_qualified_name,
1421
- p.description ?? "",
1422
- u.name,
1423
- u.description ?? ""
1424
- ]), b = {
1425
- ...p,
1426
- searchableText: m
1427
- };
1428
- r.push(b), o.set(p.fully_qualified_name, l), i.toolsByName.set(
1429
- p.fully_qualified_name.toLowerCase(),
1430
- b
1431
- );
1432
- }
1433
- }
1434
- return {
1435
- toolkits: n,
1436
- tools: r,
1437
- toolkitMap: s,
1438
- toolToToolkitMap: o,
1439
- searchIndex: i
1440
- };
1441
- }
1442
- /**
1443
- * Helper function to create normalized searchable text from multiple strings.
1444
- * Separates compound terms (like Gmail.List_emails) into individual searchable components.
1445
- * Handles camelCase, snake_case, kebab-case, and dot.notation.
1446
- */
1447
- normalizeText(e) {
1448
- const n = /* @__PURE__ */ new Set();
1449
- for (const r of e) {
1450
- if (!r)
1451
- continue;
1452
- const s = r.toLowerCase();
1453
- n.add(s);
1454
- const o = r.split(Ut);
1455
- for (const i of o) {
1456
- if (i.length <= 1)
1457
- continue;
1458
- const u = i.replace($t, "$1 $2").split(jt);
1459
- for (const c of u)
1460
- c.length > 1 && n.add(c.toLowerCase());
1461
- }
1462
- }
1463
- return Array.from(n).join(" ");
1299
+ const e = await this.getAllTools();
1300
+ return tt(e);
1464
1301
  }
1465
1302
  }
1466
1303
  export {
1467
- qt as ArcadeClient
1304
+ Nt as ArcadeClient
1468
1305
  };