@pydantic/genai-prices 0.0.42 → 0.0.44

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -1,21 +1,21 @@
1
1
  #!/usr/bin/env node
2
- import de from "yargs";
3
- import { format as he } from "util";
4
- import { resolve as ae, normalize as Ie } from "path";
5
- import { readFileSync as _e, writeFile as Le, statSync as Pe } from "fs";
2
+ import dt from "yargs";
3
+ import { format as ht } from "util";
4
+ import { resolve as at, normalize as It } from "path";
5
+ import { readFileSync as _t, writeFile as Lt, statSync as Pt } from "fs";
6
6
  import "assert";
7
- import { fileURLToPath as Te } from "url";
8
- function Ae() {
9
- return Se() ? 0 : 1;
7
+ import { fileURLToPath as Tt } from "url";
8
+ function At() {
9
+ return St() ? 0 : 1;
10
10
  }
11
- function Se() {
12
- return Ge() && !process.defaultApp;
11
+ function St() {
12
+ return Gt() && !process.defaultApp;
13
13
  }
14
- function Ge() {
14
+ function Gt() {
15
15
  return !!process.versions.electron;
16
16
  }
17
- function Ce(i) {
18
- return i.slice(Ae() + 1);
17
+ function Ct(i) {
18
+ return i.slice(At() + 1);
19
19
  }
20
20
  /**
21
21
  * @license
@@ -26,26 +26,26 @@ function W(i) {
26
26
  if (i !== i.toLowerCase() && i !== i.toUpperCase() || (i = i.toLowerCase()), i.indexOf("-") === -1 && i.indexOf("_") === -1)
27
27
  return i;
28
28
  {
29
- let m = "", s = !1;
29
+ let m = "", n = !1;
30
30
  const u = i.match(/^-+/);
31
31
  for (let k = u ? u[0].length : 0; k < i.length; k++) {
32
32
  let _ = i.charAt(k);
33
- s && (s = !1, _ = _.toUpperCase()), k !== 0 && (_ === "-" || _ === "_") ? s = !0 : _ !== "-" && _ !== "_" && (m += _);
33
+ n && (n = !1, _ = _.toUpperCase()), k !== 0 && (_ === "-" || _ === "_") ? n = !0 : _ !== "-" && _ !== "_" && (m += _);
34
34
  }
35
35
  return m;
36
36
  }
37
37
  }
38
- function Oe(i, n) {
38
+ function Ot(i, s) {
39
39
  const m = i.toLowerCase();
40
- n = n || "-";
41
- let s = "";
40
+ s = s || "-";
41
+ let n = "";
42
42
  for (let u = 0; u < i.length; u++) {
43
43
  const k = m.charAt(u), _ = i.charAt(u);
44
- k !== _ && u > 0 ? s += `${n}${m.charAt(u)}` : s += _;
44
+ k !== _ && u > 0 ? n += `${s}${m.charAt(u)}` : n += _;
45
45
  }
46
- return s;
46
+ return n;
47
47
  }
48
- function Re(i) {
48
+ function Rt(i) {
49
49
  return i == null ? !1 : typeof i == "number" || /^0x[0-9a-f]+$/i.test(i) ? !0 : /^0[^.]/.test(i) ? !1 : /^[-]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(i);
50
50
  }
51
51
  /**
@@ -53,18 +53,18 @@ function Re(i) {
53
53
  * Copyright (c) 2016, Contributors
54
54
  * SPDX-License-Identifier: ISC
55
55
  */
56
- function Ee(i) {
56
+ function Et(i) {
57
57
  if (Array.isArray(i))
58
58
  return i.map((_) => typeof _ != "string" ? _ + "" : _);
59
59
  i = i.trim();
60
- let n = 0, m = null, s = null, u = null;
60
+ let s = 0, m = null, n = null, u = null;
61
61
  const k = [];
62
62
  for (let _ = 0; _ < i.length; _++) {
63
- if (m = s, s = i.charAt(_), s === " " && !u) {
64
- m !== " " && n++;
63
+ if (m = n, n = i.charAt(_), n === " " && !u) {
64
+ m !== " " && s++;
65
65
  continue;
66
66
  }
67
- s === u ? u = null : (s === "'" || s === '"') && !u && (u = s), k[n] || (k[n] = ""), k[n] += s;
67
+ n === u ? u = null : (n === "'" || n === '"') && !u && (u = n), k[s] || (k[s] = ""), k[s] += n;
68
68
  }
69
69
  return k;
70
70
  }
@@ -83,12 +83,12 @@ var I;
83
83
  * SPDX-License-Identifier: ISC
84
84
  */
85
85
  let A;
86
- class Ne {
87
- constructor(n) {
88
- A = n;
86
+ class Nt {
87
+ constructor(s) {
88
+ A = s;
89
89
  }
90
- parse(n, m) {
91
- const s = Object.assign({
90
+ parse(s, m) {
91
+ const n = Object.assign({
92
92
  alias: void 0,
93
93
  array: void 0,
94
94
  boolean: void 0,
@@ -105,7 +105,7 @@ class Ne {
105
105
  number: void 0,
106
106
  __: void 0,
107
107
  key: void 0
108
- }, m), u = Ee(n), k = typeof n == "string", _ = ze(Object.assign(/* @__PURE__ */ Object.create(null), s.alias)), h = Object.assign({
108
+ }, m), u = Et(s), k = typeof s == "string", _ = zt(Object.assign(/* @__PURE__ */ Object.create(null), n.alias)), h = Object.assign({
109
109
  "boolean-negation": !0,
110
110
  "camel-case-expansion": !0,
111
111
  "combine-arrays": !1,
@@ -124,7 +124,7 @@ class Ne {
124
124
  "strip-aliased": !1,
125
125
  "strip-dashed": !1,
126
126
  "unknown-options-as-args": !1
127
- }, s.configuration), f = Object.assign(/* @__PURE__ */ Object.create(null), s.default), y = s.configObjects || [], P = s.envPrefix, S = h["populate--"], G = S ? "--" : "_", Q = /* @__PURE__ */ Object.create(null), oe = /* @__PURE__ */ Object.create(null), C = s.__ || A.format, r = {
127
+ }, n.configuration), f = Object.assign(/* @__PURE__ */ Object.create(null), n.default), y = n.configObjects || [], P = n.envPrefix, S = h["populate--"], G = S ? "--" : "_", Q = /* @__PURE__ */ Object.create(null), ot = /* @__PURE__ */ Object.create(null), C = n.__ || A.format, r = {
128
128
  aliases: /* @__PURE__ */ Object.create(null),
129
129
  arrays: /* @__PURE__ */ Object.create(null),
130
130
  bools: /* @__PURE__ */ Object.create(null),
@@ -137,8 +137,8 @@ class Ne {
137
137
  coercions: /* @__PURE__ */ Object.create(null),
138
138
  keys: []
139
139
  }, L = /^-([0-9]+(\.[0-9]+)?|\.[0-9]+)$/, U = new RegExp("^--" + h["negation-prefix"] + "(.+)");
140
- [].concat(s.array || []).filter(Boolean).forEach(function(e) {
141
- const a = typeof e == "object" ? e.key : e, c = Object.keys(e).map(function(o) {
140
+ [].concat(n.array || []).filter(Boolean).forEach(function(t) {
141
+ const a = typeof t == "object" ? t.key : t, c = Object.keys(t).map(function(o) {
142
142
  return {
143
143
  boolean: "bools",
144
144
  string: "strings",
@@ -146,56 +146,56 @@ class Ne {
146
146
  }[o];
147
147
  }).filter(Boolean).pop();
148
148
  c && (r[c][a] = !0), r.arrays[a] = !0, r.keys.push(a);
149
- }), [].concat(s.boolean || []).filter(Boolean).forEach(function(e) {
150
- r.bools[e] = !0, r.keys.push(e);
151
- }), [].concat(s.string || []).filter(Boolean).forEach(function(e) {
152
- r.strings[e] = !0, r.keys.push(e);
153
- }), [].concat(s.number || []).filter(Boolean).forEach(function(e) {
154
- r.numbers[e] = !0, r.keys.push(e);
155
- }), [].concat(s.count || []).filter(Boolean).forEach(function(e) {
156
- r.counts[e] = !0, r.keys.push(e);
157
- }), [].concat(s.normalize || []).filter(Boolean).forEach(function(e) {
158
- r.normalize[e] = !0, r.keys.push(e);
159
- }), typeof s.narg == "object" && Object.entries(s.narg).forEach(([e, a]) => {
160
- typeof a == "number" && (r.nargs[e] = a, r.keys.push(e));
161
- }), typeof s.coerce == "object" && Object.entries(s.coerce).forEach(([e, a]) => {
162
- typeof a == "function" && (r.coercions[e] = a, r.keys.push(e));
163
- }), typeof s.config < "u" && (Array.isArray(s.config) || typeof s.config == "string" ? [].concat(s.config).filter(Boolean).forEach(function(e) {
164
- r.configs[e] = !0;
165
- }) : typeof s.config == "object" && Object.entries(s.config).forEach(([e, a]) => {
166
- (typeof a == "boolean" || typeof a == "function") && (r.configs[e] = a);
167
- })), qe(s.key, _, s.default, r.arrays), Object.keys(f).forEach(function(e) {
168
- (r.aliases[e] || []).forEach(function(a) {
169
- f[a] = f[e];
149
+ }), [].concat(n.boolean || []).filter(Boolean).forEach(function(t) {
150
+ r.bools[t] = !0, r.keys.push(t);
151
+ }), [].concat(n.string || []).filter(Boolean).forEach(function(t) {
152
+ r.strings[t] = !0, r.keys.push(t);
153
+ }), [].concat(n.number || []).filter(Boolean).forEach(function(t) {
154
+ r.numbers[t] = !0, r.keys.push(t);
155
+ }), [].concat(n.count || []).filter(Boolean).forEach(function(t) {
156
+ r.counts[t] = !0, r.keys.push(t);
157
+ }), [].concat(n.normalize || []).filter(Boolean).forEach(function(t) {
158
+ r.normalize[t] = !0, r.keys.push(t);
159
+ }), typeof n.narg == "object" && Object.entries(n.narg).forEach(([t, a]) => {
160
+ typeof a == "number" && (r.nargs[t] = a, r.keys.push(t));
161
+ }), typeof n.coerce == "object" && Object.entries(n.coerce).forEach(([t, a]) => {
162
+ typeof a == "function" && (r.coercions[t] = a, r.keys.push(t));
163
+ }), typeof n.config < "u" && (Array.isArray(n.config) || typeof n.config == "string" ? [].concat(n.config).filter(Boolean).forEach(function(t) {
164
+ r.configs[t] = !0;
165
+ }) : typeof n.config == "object" && Object.entries(n.config).forEach(([t, a]) => {
166
+ (typeof a == "boolean" || typeof a == "function") && (r.configs[t] = a);
167
+ })), qt(n.key, _, n.default, r.arrays), Object.keys(f).forEach(function(t) {
168
+ (r.aliases[t] || []).forEach(function(a) {
169
+ f[a] = f[t];
170
170
  });
171
171
  });
172
172
  let B = null;
173
- Me();
173
+ Mt();
174
174
  let F = [];
175
- const w = Object.assign(/* @__PURE__ */ Object.create(null), { _: [] }), ne = {};
176
- for (let e = 0; e < u.length; e++) {
177
- const a = u[e], c = a.replace(/^-{3,}/, "---");
178
- let o, t, p, l, d, v;
175
+ const w = Object.assign(/* @__PURE__ */ Object.create(null), { _: [] }), st = {};
176
+ for (let t = 0; t < u.length; t++) {
177
+ const a = u[t], c = a.replace(/^-{3,}/, "---");
178
+ let o, e, p, l, d, v;
179
179
  if (a !== "--" && /^-/.test(a) && H(a))
180
180
  K(a);
181
181
  else if (c.match(/^---+(=|$)/)) {
182
182
  K(a);
183
183
  continue;
184
184
  } else if (a.match(/^--.+=/) || !h["short-option-groups"] && a.match(/^-.+=/))
185
- l = a.match(/^--?([^=]+)=([\s\S]*)$/), l !== null && Array.isArray(l) && l.length >= 3 && (g(l[1], r.arrays) ? e = V(e, l[1], u, l[2]) : g(l[1], r.nargs) !== !1 ? e = D(e, l[1], u, l[2]) : q(l[1], l[2], !0));
185
+ l = a.match(/^--?([^=]+)=([\s\S]*)$/), l !== null && Array.isArray(l) && l.length >= 3 && (g(l[1], r.arrays) ? t = V(t, l[1], u, l[2]) : g(l[1], r.nargs) !== !1 ? t = D(t, l[1], u, l[2]) : q(l[1], l[2], !0));
186
186
  else if (a.match(U) && h["boolean-negation"])
187
- l = a.match(U), l !== null && Array.isArray(l) && l.length >= 2 && (t = l[1], q(t, g(t, r.arrays) ? [!1] : !1));
187
+ l = a.match(U), l !== null && Array.isArray(l) && l.length >= 2 && (e = l[1], q(e, g(e, r.arrays) ? [!1] : !1));
188
188
  else if (a.match(/^--.+/) || !h["short-option-groups"] && a.match(/^-[^-]+/))
189
- l = a.match(/^--?(.+)/), l !== null && Array.isArray(l) && l.length >= 2 && (t = l[1], g(t, r.arrays) ? e = V(e, t, u) : g(t, r.nargs) !== !1 ? e = D(e, t, u) : (d = u[e + 1], d !== void 0 && (!d.match(/^-/) || d.match(L)) && !g(t, r.bools) && !g(t, r.counts) || /^(true|false)$/.test(d) ? (q(t, d), e++) : q(t, R(t))));
189
+ l = a.match(/^--?(.+)/), l !== null && Array.isArray(l) && l.length >= 2 && (e = l[1], g(e, r.arrays) ? t = V(t, e, u) : g(e, r.nargs) !== !1 ? t = D(t, e, u) : (d = u[t + 1], d !== void 0 && (!d.match(/^-/) || d.match(L)) && !g(e, r.bools) && !g(e, r.counts) || /^(true|false)$/.test(d) ? (q(e, d), t++) : q(e, R(e))));
190
190
  else if (a.match(/^-.\..+=/))
191
191
  l = a.match(/^-([^=]+)=([\s\S]*)$/), l !== null && Array.isArray(l) && l.length >= 3 && q(l[1], l[2]);
192
192
  else if (a.match(/^-.\..+/) && !a.match(L))
193
- d = u[e + 1], l = a.match(/^-(.\..+)/), l !== null && Array.isArray(l) && l.length >= 2 && (t = l[1], d !== void 0 && !d.match(/^-/) && !g(t, r.bools) && !g(t, r.counts) ? (q(t, d), e++) : q(t, R(t)));
193
+ d = u[t + 1], l = a.match(/^-(.\..+)/), l !== null && Array.isArray(l) && l.length >= 2 && (e = l[1], d !== void 0 && !d.match(/^-/) && !g(e, r.bools) && !g(e, r.counts) ? (q(e, d), t++) : q(e, R(e)));
194
194
  else if (a.match(/^-[^-]+/) && !a.match(L)) {
195
195
  p = a.slice(1, -1).split(""), o = !1;
196
196
  for (let x = 0; x < p.length; x++) {
197
197
  if (d = a.slice(x + 2), p[x + 1] && p[x + 1] === "=") {
198
- v = a.slice(x + 3), t = p[x], g(t, r.arrays) ? e = V(e, t, u, v) : g(t, r.nargs) !== !1 ? e = D(e, t, u, v) : q(t, v), o = !0;
198
+ v = a.slice(x + 3), e = p[x], g(e, r.arrays) ? t = V(t, e, u, v) : g(e, r.nargs) !== !1 ? t = D(t, e, u, v) : q(e, v), o = !0;
199
199
  break;
200
200
  }
201
201
  if (d === "-") {
@@ -212,82 +212,82 @@ class Ne {
212
212
  } else
213
213
  q(p[x], R(p[x]));
214
214
  }
215
- t = a.slice(-1)[0], !o && t !== "-" && (g(t, r.arrays) ? e = V(e, t, u) : g(t, r.nargs) !== !1 ? e = D(e, t, u) : (d = u[e + 1], d !== void 0 && (!/^(-|--)[^-]/.test(d) || d.match(L)) && !g(t, r.bools) && !g(t, r.counts) || /^(true|false)$/.test(d) ? (q(t, d), e++) : q(t, R(t))));
215
+ e = a.slice(-1)[0], !o && e !== "-" && (g(e, r.arrays) ? t = V(t, e, u) : g(e, r.nargs) !== !1 ? t = D(t, e, u) : (d = u[t + 1], d !== void 0 && (!/^(-|--)[^-]/.test(d) || d.match(L)) && !g(e, r.bools) && !g(e, r.counts) || /^(true|false)$/.test(d) ? (q(e, d), t++) : q(e, R(e))));
216
216
  } else if (a.match(/^-[0-9]$/) && a.match(L) && g(a.slice(1), r.bools))
217
- t = a.slice(1), q(t, R(t));
217
+ e = a.slice(1), q(e, R(e));
218
218
  else if (a === "--") {
219
- F = u.slice(e + 1);
219
+ F = u.slice(t + 1);
220
220
  break;
221
221
  } else if (h["halt-at-non-option"]) {
222
- F = u.slice(e);
222
+ F = u.slice(t);
223
223
  break;
224
224
  } else
225
225
  K(a);
226
226
  }
227
- re(w, !0), re(w, !1), ke(w), ge(), me(w, r.aliases, f, !0), fe(w), h["set-placeholder-key"] && be(w), Object.keys(r.counts).forEach(function(e) {
228
- E(w, e.split(".")) || q(e, 0);
229
- }), S && F.length && (w[G] = []), F.forEach(function(e) {
230
- w[G].push(e);
231
- }), h["camel-case-expansion"] && h["strip-dashed"] && Object.keys(w).filter((e) => e !== "--" && e.includes("-")).forEach((e) => {
232
- delete w[e];
233
- }), h["strip-aliased"] && [].concat(...Object.keys(_).map((e) => _[e])).forEach((e) => {
234
- h["camel-case-expansion"] && e.includes("-") && delete w[e.split(".").map((a) => W(a)).join(".")], delete w[e];
227
+ rt(w, !0), rt(w, !1), kt(w), gt(), mt(w, r.aliases, f, !0), ft(w), h["set-placeholder-key"] && bt(w), Object.keys(r.counts).forEach(function(t) {
228
+ E(w, t.split(".")) || q(t, 0);
229
+ }), S && F.length && (w[G] = []), F.forEach(function(t) {
230
+ w[G].push(t);
231
+ }), h["camel-case-expansion"] && h["strip-dashed"] && Object.keys(w).filter((t) => t !== "--" && t.includes("-")).forEach((t) => {
232
+ delete w[t];
233
+ }), h["strip-aliased"] && [].concat(...Object.keys(_).map((t) => _[t])).forEach((t) => {
234
+ h["camel-case-expansion"] && t.includes("-") && delete w[t.split(".").map((a) => W(a)).join(".")], delete w[t];
235
235
  });
236
- function K(e) {
237
- const a = $("_", e);
236
+ function K(t) {
237
+ const a = $("_", t);
238
238
  (typeof a == "string" || typeof a == "number") && w._.push(a);
239
239
  }
240
- function D(e, a, c, o) {
241
- let t, p = g(a, r.nargs);
240
+ function D(t, a, c, o) {
241
+ let e, p = g(a, r.nargs);
242
242
  if (p = typeof p != "number" || isNaN(p) ? 1 : p, p === 0)
243
- return T(o) || (B = Error(C("Argument unexpected for: %s", a))), q(a, R(a)), e;
243
+ return T(o) || (B = Error(C("Argument unexpected for: %s", a))), q(a, R(a)), t;
244
244
  let l = T(o) ? 0 : 1;
245
245
  if (h["nargs-eats-options"])
246
- c.length - (e + 1) + l < p && (B = Error(C("Not enough arguments following: %s", a))), l = p;
246
+ c.length - (t + 1) + l < p && (B = Error(C("Not enough arguments following: %s", a))), l = p;
247
247
  else {
248
- for (t = e + 1; t < c.length && (!c[t].match(/^-[^0-9]/) || c[t].match(L) || H(c[t])); t++)
248
+ for (e = t + 1; e < c.length && (!c[e].match(/^-[^0-9]/) || c[e].match(L) || H(c[e])); e++)
249
249
  l++;
250
250
  l < p && (B = Error(C("Not enough arguments following: %s", a)));
251
251
  }
252
252
  let d = Math.min(l, p);
253
- for (!T(o) && d > 0 && (q(a, o), d--), t = e + 1; t < d + e + 1; t++)
254
- q(a, c[t]);
255
- return e + d;
253
+ for (!T(o) && d > 0 && (q(a, o), d--), e = t + 1; e < d + t + 1; e++)
254
+ q(a, c[e]);
255
+ return t + d;
256
256
  }
257
- function V(e, a, c, o) {
258
- let t = [], p = o || c[e + 1];
257
+ function V(t, a, c, o) {
258
+ let e = [], p = o || c[t + 1];
259
259
  const l = g(a, r.nargs);
260
260
  if (g(a, r.bools) && !/^(true|false)$/.test(p))
261
- t.push(!0);
261
+ e.push(!0);
262
262
  else if (T(p) || T(o) && /^-/.test(p) && !L.test(p) && !H(p)) {
263
263
  if (f[a] !== void 0) {
264
264
  const d = f[a];
265
- t = Array.isArray(d) ? d : [d];
265
+ e = Array.isArray(d) ? d : [d];
266
266
  }
267
267
  } else {
268
- T(o) || t.push(Y(a, o, !0));
269
- for (let d = e + 1; d < c.length && !(!h["greedy-arrays"] && t.length > 0 || l && typeof l == "number" && t.length >= l || (p = c[d], /^-/.test(p) && !L.test(p) && !H(p))); d++)
270
- e = d, t.push(Y(a, p, k));
268
+ T(o) || e.push(Y(a, o, !0));
269
+ for (let d = t + 1; d < c.length && !(!h["greedy-arrays"] && e.length > 0 || l && typeof l == "number" && e.length >= l || (p = c[d], /^-/.test(p) && !L.test(p) && !H(p))); d++)
270
+ t = d, e.push(Y(a, p, k));
271
271
  }
272
- return typeof l == "number" && (l && t.length < l || isNaN(l) && t.length === 0) && (B = Error(C("Not enough arguments following: %s", a))), q(a, t), e;
272
+ return typeof l == "number" && (l && e.length < l || isNaN(l) && e.length === 0) && (B = Error(C("Not enough arguments following: %s", a))), q(a, e), t;
273
273
  }
274
- function q(e, a, c = k) {
275
- if (/-/.test(e) && h["camel-case-expansion"]) {
276
- const p = e.split(".").map(function(l) {
274
+ function q(t, a, c = k) {
275
+ if (/-/.test(t) && h["camel-case-expansion"]) {
276
+ const p = t.split(".").map(function(l) {
277
277
  return W(l);
278
278
  }).join(".");
279
- se(e, p);
279
+ nt(t, p);
280
280
  }
281
- const o = Y(e, a, c), t = e.split(".");
282
- N(w, t, o), r.aliases[e] && r.aliases[e].forEach(function(p) {
281
+ const o = Y(t, a, c), e = t.split(".");
282
+ N(w, e, o), r.aliases[t] && r.aliases[t].forEach(function(p) {
283
283
  const l = p.split(".");
284
284
  N(w, l, o);
285
- }), t.length > 1 && h["dot-notation"] && (r.aliases[t[0]] || []).forEach(function(p) {
285
+ }), e.length > 1 && h["dot-notation"] && (r.aliases[e[0]] || []).forEach(function(p) {
286
286
  let l = p.split(".");
287
- const d = [].concat(t);
288
- d.shift(), l = l.concat(d), (r.aliases[e] || []).includes(l.join(".")) || N(w, l, o);
289
- }), g(e, r.normalize) && !g(e, r.arrays) && [e].concat(r.aliases[e] || []).forEach(function(l) {
290
- Object.defineProperty(ne, l, {
287
+ const d = [].concat(e);
288
+ d.shift(), l = l.concat(d), (r.aliases[t] || []).includes(l.join(".")) || N(w, l, o);
289
+ }), g(t, r.normalize) && !g(t, r.arrays) && [t].concat(r.aliases[t] || []).forEach(function(l) {
290
+ Object.defineProperty(st, l, {
291
291
  enumerable: !0,
292
292
  get() {
293
293
  return a;
@@ -298,219 +298,219 @@ class Ne {
298
298
  });
299
299
  });
300
300
  }
301
- function se(e, a) {
302
- r.aliases[e] && r.aliases[e].length || (r.aliases[e] = [a], Q[a] = !0), r.aliases[a] && r.aliases[a].length || se(a, e);
301
+ function nt(t, a) {
302
+ r.aliases[t] && r.aliases[t].length || (r.aliases[t] = [a], Q[a] = !0), r.aliases[a] && r.aliases[a].length || nt(a, t);
303
303
  }
304
- function Y(e, a, c) {
305
- c && (a = je(a)), (g(e, r.bools) || g(e, r.counts)) && typeof a == "string" && (a = a === "true");
306
- let o = Array.isArray(a) ? a.map(function(t) {
307
- return $(e, t);
308
- }) : $(e, a);
309
- return g(e, r.counts) && (T(o) || typeof o == "boolean") && (o = Z()), g(e, r.normalize) && g(e, r.arrays) && (Array.isArray(a) ? o = a.map((t) => A.normalize(t)) : o = A.normalize(a)), o;
304
+ function Y(t, a, c) {
305
+ c && (a = jt(a)), (g(t, r.bools) || g(t, r.counts)) && typeof a == "string" && (a = a === "true");
306
+ let o = Array.isArray(a) ? a.map(function(e) {
307
+ return $(t, e);
308
+ }) : $(t, a);
309
+ return g(t, r.counts) && (T(o) || typeof o == "boolean") && (o = Z()), g(t, r.normalize) && g(t, r.arrays) && (Array.isArray(a) ? o = a.map((e) => A.normalize(e)) : o = A.normalize(a)), o;
310
310
  }
311
- function $(e, a) {
312
- return !h["parse-positional-numbers"] && e === "_" || !g(e, r.strings) && !g(e, r.bools) && !Array.isArray(a) && (Re(a) && h["parse-numbers"] && Number.isSafeInteger(Math.floor(parseFloat(`${a}`))) || !T(a) && g(e, r.numbers)) && (a = Number(a)), a;
311
+ function $(t, a) {
312
+ return !h["parse-positional-numbers"] && t === "_" || !g(t, r.strings) && !g(t, r.bools) && !Array.isArray(a) && (Rt(a) && h["parse-numbers"] && Number.isSafeInteger(Math.floor(parseFloat(`${a}`))) || !T(a) && g(t, r.numbers)) && (a = Number(a)), a;
313
313
  }
314
- function ke(e) {
314
+ function kt(t) {
315
315
  const a = /* @__PURE__ */ Object.create(null);
316
- me(a, r.aliases, f), Object.keys(r.configs).forEach(function(c) {
317
- const o = e[c] || a[c];
316
+ mt(a, r.aliases, f), Object.keys(r.configs).forEach(function(c) {
317
+ const o = t[c] || a[c];
318
318
  if (o)
319
319
  try {
320
- let t = null;
320
+ let e = null;
321
321
  const p = A.resolve(A.cwd(), o), l = r.configs[c];
322
322
  if (typeof l == "function") {
323
323
  try {
324
- t = l(p);
324
+ e = l(p);
325
325
  } catch (d) {
326
- t = d;
326
+ e = d;
327
327
  }
328
- if (t instanceof Error) {
329
- B = t;
328
+ if (e instanceof Error) {
329
+ B = e;
330
330
  return;
331
331
  }
332
332
  } else
333
- t = A.require(p);
334
- J(t);
335
- } catch (t) {
336
- t.name === "PermissionDenied" ? B = t : e[c] && (B = Error(C("Invalid JSON config file: %s", o)));
333
+ e = A.require(p);
334
+ J(e);
335
+ } catch (e) {
336
+ e.name === "PermissionDenied" ? B = e : t[c] && (B = Error(C("Invalid JSON config file: %s", o)));
337
337
  }
338
338
  });
339
339
  }
340
- function J(e, a) {
341
- Object.keys(e).forEach(function(c) {
342
- const o = e[c], t = a ? a + "." + c : c;
343
- typeof o == "object" && o !== null && !Array.isArray(o) && h["dot-notation"] ? J(o, t) : (!E(w, t.split(".")) || g(t, r.arrays) && h["combine-arrays"]) && q(t, o);
340
+ function J(t, a) {
341
+ Object.keys(t).forEach(function(c) {
342
+ const o = t[c], e = a ? a + "." + c : c;
343
+ typeof o == "object" && o !== null && !Array.isArray(o) && h["dot-notation"] ? J(o, e) : (!E(w, e.split(".")) || g(e, r.arrays) && h["combine-arrays"]) && q(e, o);
344
344
  });
345
345
  }
346
- function ge() {
347
- typeof y < "u" && y.forEach(function(e) {
348
- J(e);
346
+ function gt() {
347
+ typeof y < "u" && y.forEach(function(t) {
348
+ J(t);
349
349
  });
350
350
  }
351
- function re(e, a) {
351
+ function rt(t, a) {
352
352
  if (typeof P > "u")
353
353
  return;
354
354
  const c = typeof P == "string" ? P : "", o = A.env();
355
- Object.keys(o).forEach(function(t) {
356
- if (c === "" || t.lastIndexOf(c, 0) === 0) {
357
- const p = t.split("__").map(function(l, d) {
355
+ Object.keys(o).forEach(function(e) {
356
+ if (c === "" || e.lastIndexOf(c, 0) === 0) {
357
+ const p = e.split("__").map(function(l, d) {
358
358
  return d === 0 && (l = l.substring(c.length)), W(l);
359
359
  });
360
- (a && r.configs[p.join(".")] || !a) && !E(e, p) && q(p.join("."), o[t]);
360
+ (a && r.configs[p.join(".")] || !a) && !E(t, p) && q(p.join("."), o[e]);
361
361
  }
362
362
  });
363
363
  }
364
- function fe(e) {
364
+ function ft(t) {
365
365
  let a;
366
366
  const c = /* @__PURE__ */ new Set();
367
- Object.keys(e).forEach(function(o) {
367
+ Object.keys(t).forEach(function(o) {
368
368
  if (!c.has(o) && (a = g(o, r.coercions), typeof a == "function"))
369
369
  try {
370
- const t = $(o, a(e[o]));
370
+ const e = $(o, a(t[o]));
371
371
  [].concat(r.aliases[o] || [], o).forEach((p) => {
372
- c.add(p), e[p] = t;
372
+ c.add(p), t[p] = e;
373
373
  });
374
- } catch (t) {
375
- B = t;
374
+ } catch (e) {
375
+ B = e;
376
376
  }
377
377
  });
378
378
  }
379
- function be(e) {
379
+ function bt(t) {
380
380
  return r.keys.forEach((a) => {
381
- ~a.indexOf(".") || typeof e[a] > "u" && (e[a] = void 0);
382
- }), e;
381
+ ~a.indexOf(".") || typeof t[a] > "u" && (t[a] = void 0);
382
+ }), t;
383
383
  }
384
- function me(e, a, c, o = !1) {
385
- Object.keys(c).forEach(function(t) {
386
- E(e, t.split(".")) || (N(e, t.split("."), c[t]), o && (oe[t] = !0), (a[t] || []).forEach(function(p) {
387
- E(e, p.split(".")) || N(e, p.split("."), c[t]);
384
+ function mt(t, a, c, o = !1) {
385
+ Object.keys(c).forEach(function(e) {
386
+ E(t, e.split(".")) || (N(t, e.split("."), c[e]), o && (ot[e] = !0), (a[e] || []).forEach(function(p) {
387
+ E(t, p.split(".")) || N(t, p.split("."), c[e]);
388
388
  }));
389
389
  });
390
390
  }
391
- function E(e, a) {
392
- let c = e;
393
- h["dot-notation"] || (a = [a.join(".")]), a.slice(0, -1).forEach(function(t) {
394
- c = c[t] || {};
391
+ function E(t, a) {
392
+ let c = t;
393
+ h["dot-notation"] || (a = [a.join(".")]), a.slice(0, -1).forEach(function(e) {
394
+ c = c[e] || {};
395
395
  });
396
396
  const o = a[a.length - 1];
397
397
  return typeof c != "object" ? !1 : o in c;
398
398
  }
399
- function N(e, a, c) {
400
- let o = e;
399
+ function N(t, a, c) {
400
+ let o = t;
401
401
  h["dot-notation"] || (a = [a.join(".")]), a.slice(0, -1).forEach(function(v) {
402
- v = ce(v), typeof o == "object" && o[v] === void 0 && (o[v] = {}), typeof o[v] != "object" || Array.isArray(o[v]) ? (Array.isArray(o[v]) ? o[v].push({}) : o[v] = [o[v], {}], o = o[v][o[v].length - 1]) : o = o[v];
402
+ v = ct(v), typeof o == "object" && o[v] === void 0 && (o[v] = {}), typeof o[v] != "object" || Array.isArray(o[v]) ? (Array.isArray(o[v]) ? o[v].push({}) : o[v] = [o[v], {}], o = o[v][o[v].length - 1]) : o = o[v];
403
403
  });
404
- const t = ce(a[a.length - 1]), p = g(a.join("."), r.arrays), l = Array.isArray(c);
404
+ const e = ct(a[a.length - 1]), p = g(a.join("."), r.arrays), l = Array.isArray(c);
405
405
  let d = h["duplicate-arguments-array"];
406
- !d && g(t, r.nargs) && (d = !0, (!T(o[t]) && r.nargs[t] === 1 || Array.isArray(o[t]) && o[t].length === r.nargs[t]) && (o[t] = void 0)), c === Z() ? o[t] = Z(o[t]) : Array.isArray(o[t]) ? d && p && l ? o[t] = h["flatten-duplicate-arrays"] ? o[t].concat(c) : (Array.isArray(o[t][0]) ? o[t] : [o[t]]).concat([c]) : !d && !!p == !!l ? o[t] = c : o[t] = o[t].concat([c]) : o[t] === void 0 && p ? o[t] = l ? c : [c] : d && !(o[t] === void 0 || g(t, r.counts) || g(t, r.bools)) ? o[t] = [o[t], c] : o[t] = c;
406
+ !d && g(e, r.nargs) && (d = !0, (!T(o[e]) && r.nargs[e] === 1 || Array.isArray(o[e]) && o[e].length === r.nargs[e]) && (o[e] = void 0)), c === Z() ? o[e] = Z(o[e]) : Array.isArray(o[e]) ? d && p && l ? o[e] = h["flatten-duplicate-arrays"] ? o[e].concat(c) : (Array.isArray(o[e][0]) ? o[e] : [o[e]]).concat([c]) : !d && !!p == !!l ? o[e] = c : o[e] = o[e].concat([c]) : o[e] === void 0 && p ? o[e] = l ? c : [c] : d && !(o[e] === void 0 || g(e, r.counts) || g(e, r.bools)) ? o[e] = [o[e], c] : o[e] = c;
407
407
  }
408
- function qe(...e) {
409
- e.forEach(function(a) {
408
+ function qt(...t) {
409
+ t.forEach(function(a) {
410
410
  Object.keys(a || {}).forEach(function(c) {
411
411
  r.aliases[c] || (r.aliases[c] = [].concat(_[c] || []), r.aliases[c].concat(c).forEach(function(o) {
412
412
  if (/-/.test(o) && h["camel-case-expansion"]) {
413
- const t = W(o);
414
- t !== c && r.aliases[c].indexOf(t) === -1 && (r.aliases[c].push(t), Q[t] = !0);
413
+ const e = W(o);
414
+ e !== c && r.aliases[c].indexOf(e) === -1 && (r.aliases[c].push(e), Q[e] = !0);
415
415
  }
416
416
  }), r.aliases[c].concat(c).forEach(function(o) {
417
417
  if (o.length > 1 && /[A-Z]/.test(o) && h["camel-case-expansion"]) {
418
- const t = Oe(o, "-");
419
- t !== c && r.aliases[c].indexOf(t) === -1 && (r.aliases[c].push(t), Q[t] = !0);
418
+ const e = Ot(o, "-");
419
+ e !== c && r.aliases[c].indexOf(e) === -1 && (r.aliases[c].push(e), Q[e] = !0);
420
420
  }
421
421
  }), r.aliases[c].forEach(function(o) {
422
- r.aliases[o] = [c].concat(r.aliases[c].filter(function(t) {
423
- return o !== t;
422
+ r.aliases[o] = [c].concat(r.aliases[c].filter(function(e) {
423
+ return o !== e;
424
424
  }));
425
425
  }));
426
426
  });
427
427
  });
428
428
  }
429
- function g(e, a) {
430
- const c = [].concat(r.aliases[e] || [], e), o = Object.keys(a), t = c.find((p) => o.includes(p));
431
- return t ? a[t] : !1;
429
+ function g(t, a) {
430
+ const c = [].concat(r.aliases[t] || [], t), o = Object.keys(a), e = c.find((p) => o.includes(p));
431
+ return e ? a[e] : !1;
432
432
  }
433
- function ue(e) {
433
+ function ut(t) {
434
434
  const a = Object.keys(r);
435
435
  return [].concat(a.map((o) => r[o])).some(function(o) {
436
- return Array.isArray(o) ? o.includes(e) : o[e];
436
+ return Array.isArray(o) ? o.includes(t) : o[t];
437
437
  });
438
438
  }
439
- function we(e, ...a) {
439
+ function wt(t, ...a) {
440
440
  return [].concat(...a).some(function(o) {
441
- const t = e.match(o);
442
- return t && ue(t[1]);
441
+ const e = t.match(o);
442
+ return e && ut(e[1]);
443
443
  });
444
444
  }
445
- function ve(e) {
446
- if (e.match(L) || !e.match(/^-[^-]+/))
445
+ function vt(t) {
446
+ if (t.match(L) || !t.match(/^-[^-]+/))
447
447
  return !1;
448
448
  let a = !0, c;
449
- const o = e.slice(1).split("");
450
- for (let t = 0; t < o.length; t++) {
451
- if (c = e.slice(t + 2), !ue(o[t])) {
449
+ const o = t.slice(1).split("");
450
+ for (let e = 0; e < o.length; e++) {
451
+ if (c = t.slice(e + 2), !ut(o[e])) {
452
452
  a = !1;
453
453
  break;
454
454
  }
455
- if (o[t + 1] && o[t + 1] === "=" || c === "-" || /[A-Za-z]/.test(o[t]) && /^-?\d+(\.\d*)?(e-?\d+)?$/.test(c) || o[t + 1] && o[t + 1].match(/\W/))
455
+ if (o[e + 1] && o[e + 1] === "=" || c === "-" || /[A-Za-z]/.test(o[e]) && /^-?\d+(\.\d*)?(e-?\d+)?$/.test(c) || o[e + 1] && o[e + 1].match(/\W/))
456
456
  break;
457
457
  }
458
458
  return a;
459
459
  }
460
- function H(e) {
461
- return h["unknown-options-as-args"] && xe(e);
460
+ function H(t) {
461
+ return h["unknown-options-as-args"] && xt(t);
462
462
  }
463
- function xe(e) {
464
- return e = e.replace(/^-{3,}/, "--"), e.match(L) || ve(e) ? !1 : !we(e, /^-+([^=]+?)=[\s\S]*$/, U, /^-+([^=]+?)$/, /^-+([^=]+?)-$/, /^-+([^=]+?\d+)$/, /^-+([^=]+?)\W+.*$/);
463
+ function xt(t) {
464
+ return t = t.replace(/^-{3,}/, "--"), t.match(L) || vt(t) ? !1 : !wt(t, /^-+([^=]+?)=[\s\S]*$/, U, /^-+([^=]+?)$/, /^-+([^=]+?)-$/, /^-+([^=]+?\d+)$/, /^-+([^=]+?)\W+.*$/);
465
465
  }
466
- function R(e) {
467
- return !g(e, r.bools) && !g(e, r.counts) && `${e}` in f ? f[e] : ye(Be(e));
466
+ function R(t) {
467
+ return !g(t, r.bools) && !g(t, r.counts) && `${t}` in f ? f[t] : yt(Bt(t));
468
468
  }
469
- function ye(e) {
469
+ function yt(t) {
470
470
  return {
471
471
  [I.BOOLEAN]: !0,
472
472
  [I.STRING]: "",
473
473
  [I.NUMBER]: void 0,
474
474
  [I.ARRAY]: []
475
- }[e];
475
+ }[t];
476
476
  }
477
- function Be(e) {
477
+ function Bt(t) {
478
478
  let a = I.BOOLEAN;
479
- return g(e, r.strings) ? a = I.STRING : g(e, r.numbers) ? a = I.NUMBER : g(e, r.bools) ? a = I.BOOLEAN : g(e, r.arrays) && (a = I.ARRAY), a;
479
+ return g(t, r.strings) ? a = I.STRING : g(t, r.numbers) ? a = I.NUMBER : g(t, r.bools) ? a = I.BOOLEAN : g(t, r.arrays) && (a = I.ARRAY), a;
480
480
  }
481
- function T(e) {
482
- return e === void 0;
481
+ function T(t) {
482
+ return t === void 0;
483
483
  }
484
- function Me() {
485
- Object.keys(r.counts).find((e) => g(e, r.arrays) ? (B = Error(C("Invalid configuration: %s, opts.count excludes opts.array.", e)), !0) : g(e, r.nargs) ? (B = Error(C("Invalid configuration: %s, opts.count excludes opts.narg.", e)), !0) : !1);
484
+ function Mt() {
485
+ Object.keys(r.counts).find((t) => g(t, r.arrays) ? (B = Error(C("Invalid configuration: %s, opts.count excludes opts.array.", t)), !0) : g(t, r.nargs) ? (B = Error(C("Invalid configuration: %s, opts.count excludes opts.narg.", t)), !0) : !1);
486
486
  }
487
487
  return {
488
488
  aliases: Object.assign({}, r.aliases),
489
- argv: Object.assign(ne, w),
489
+ argv: Object.assign(st, w),
490
490
  configuration: h,
491
- defaulted: Object.assign({}, oe),
491
+ defaulted: Object.assign({}, ot),
492
492
  error: B,
493
493
  newAliases: Object.assign({}, Q)
494
494
  };
495
495
  }
496
496
  }
497
- function ze(i) {
498
- const n = [], m = /* @__PURE__ */ Object.create(null);
499
- let s = !0;
497
+ function zt(i) {
498
+ const s = [], m = /* @__PURE__ */ Object.create(null);
499
+ let n = !0;
500
500
  for (Object.keys(i).forEach(function(u) {
501
- n.push([].concat(i[u], u));
502
- }); s; ) {
503
- s = !1;
504
- for (let u = 0; u < n.length; u++)
505
- for (let k = u + 1; k < n.length; k++)
506
- if (n[u].filter(function(h) {
507
- return n[k].indexOf(h) !== -1;
501
+ s.push([].concat(i[u], u));
502
+ }); n; ) {
503
+ n = !1;
504
+ for (let u = 0; u < s.length; u++)
505
+ for (let k = u + 1; k < s.length; k++)
506
+ if (s[u].filter(function(h) {
507
+ return s[k].indexOf(h) !== -1;
508
508
  }).length) {
509
- n[u] = n[u].concat(n[k]), n.splice(k, 1), s = !0;
509
+ s[u] = s[u].concat(s[k]), s.splice(k, 1), n = !0;
510
510
  break;
511
511
  }
512
512
  }
513
- return n.forEach(function(u) {
513
+ return s.forEach(function(u) {
514
514
  u = u.filter(function(_, h, f) {
515
515
  return f.indexOf(_) === h;
516
516
  });
@@ -521,10 +521,10 @@ function ze(i) {
521
521
  function Z(i) {
522
522
  return i !== void 0 ? i + 1 : 1;
523
523
  }
524
- function ce(i) {
524
+ function ct(i) {
525
525
  return i === "__proto__" ? "___proto___" : i;
526
526
  }
527
- function je(i) {
527
+ function jt(i) {
528
528
  return typeof i == "string" && (i[0] === "'" || i[0] === '"') && i[i.length - 1] === i[0] ? i.substring(1, i.length - 1) : i;
529
529
  }
530
530
  /**
@@ -535,132 +535,132 @@ function je(i) {
535
535
  * Copyright (c) 2016, Contributors
536
536
  * SPDX-License-Identifier: ISC
537
537
  */
538
- var X, ee, te;
539
- const le = process && process.env && process.env.YARGS_MIN_NODE_VERSION ? Number(process.env.YARGS_MIN_NODE_VERSION) : 12, pe = (ee = (X = process == null ? void 0 : process.versions) === null || X === void 0 ? void 0 : X.node) !== null && ee !== void 0 ? ee : (te = process == null ? void 0 : process.version) === null || te === void 0 ? void 0 : te.slice(1);
540
- if (pe && Number(pe.match(/^([^.]+)/)[1]) < le)
541
- throw Error(`yargs parser supports a minimum Node.js version of ${le}. Read our version support policy: https://github.com/yargs/yargs-parser#supported-nodejs-versions`);
542
- const Qe = process ? process.env : {};
543
- new Ne({
538
+ var X, tt, et;
539
+ const lt = process && process.env && process.env.YARGS_MIN_NODE_VERSION ? Number(process.env.YARGS_MIN_NODE_VERSION) : 12, pt = (tt = (X = process == null ? void 0 : process.versions) === null || X === void 0 ? void 0 : X.node) !== null && tt !== void 0 ? tt : (et = process == null ? void 0 : process.version) === null || et === void 0 ? void 0 : et.slice(1);
540
+ if (pt && Number(pt.match(/^([^.]+)/)[1]) < lt)
541
+ throw Error(`yargs parser supports a minimum Node.js version of ${lt}. Read our version support policy: https://github.com/yargs/yargs-parser#supported-nodejs-versions`);
542
+ const Qt = process ? process.env : {};
543
+ new Nt({
544
544
  cwd: process.cwd,
545
- env: () => Qe,
546
- format: he,
547
- normalize: Ie,
548
- resolve: ae,
545
+ env: () => Qt,
546
+ format: ht,
547
+ normalize: It,
548
+ resolve: at,
549
549
  // TODO: figure out a way to combine ESM and CJS coverage, such that
550
550
  // we can exercise all the lines below:
551
551
  require: (i) => {
552
552
  if (typeof require < "u")
553
553
  return require(i);
554
554
  if (i.match(/\.json$/))
555
- return JSON.parse(_e(i, "utf8"));
555
+ return JSON.parse(_t(i, "utf8"));
556
556
  throw Error("only .json config files are supported in ESM");
557
557
  }
558
558
  });
559
- const Fe = {
559
+ const Ft = {
560
560
  fs: {
561
- readFileSync: _e,
562
- writeFile: Le
561
+ readFileSync: _t,
562
+ writeFile: Lt
563
563
  },
564
- format: he,
565
- resolve: ae,
564
+ format: ht,
565
+ resolve: at,
566
566
  exists: (i) => {
567
567
  try {
568
- return Pe(i).isFile();
568
+ return Pt(i).isFile();
569
569
  } catch {
570
570
  return !1;
571
571
  }
572
572
  }
573
573
  };
574
574
  let M;
575
- class De {
576
- constructor(n) {
577
- n = n || {}, this.directory = n.directory || "./locales", this.updateFiles = typeof n.updateFiles == "boolean" ? n.updateFiles : !0, this.locale = n.locale || "en", this.fallbackToLanguage = typeof n.fallbackToLanguage == "boolean" ? n.fallbackToLanguage : !0, this.cache = /* @__PURE__ */ Object.create(null), this.writeQueue = [];
575
+ class Dt {
576
+ constructor(s) {
577
+ s = s || {}, this.directory = s.directory || "./locales", this.updateFiles = typeof s.updateFiles == "boolean" ? s.updateFiles : !0, this.locale = s.locale || "en", this.fallbackToLanguage = typeof s.fallbackToLanguage == "boolean" ? s.fallbackToLanguage : !0, this.cache = /* @__PURE__ */ Object.create(null), this.writeQueue = [];
578
578
  }
579
- __(...n) {
579
+ __(...s) {
580
580
  if (typeof arguments[0] != "string")
581
581
  return this._taggedLiteral(arguments[0], ...arguments);
582
- const m = n.shift();
583
- let s = function() {
582
+ const m = s.shift();
583
+ let n = function() {
584
584
  };
585
- return typeof n[n.length - 1] == "function" && (s = n.pop()), s = s || function() {
585
+ return typeof s[s.length - 1] == "function" && (n = s.pop()), n = n || function() {
586
586
  }, this.cache[this.locale] || this._readLocaleFile(), !this.cache[this.locale][m] && this.updateFiles ? (this.cache[this.locale][m] = m, this._enqueueWrite({
587
587
  directory: this.directory,
588
588
  locale: this.locale,
589
- cb: s
590
- })) : s(), M.format.apply(M.format, [this.cache[this.locale][m] || m].concat(n));
589
+ cb: n
590
+ })) : n(), M.format.apply(M.format, [this.cache[this.locale][m] || m].concat(s));
591
591
  }
592
592
  __n() {
593
- const n = Array.prototype.slice.call(arguments), m = n.shift(), s = n.shift(), u = n.shift();
593
+ const s = Array.prototype.slice.call(arguments), m = s.shift(), n = s.shift(), u = s.shift();
594
594
  let k = function() {
595
595
  };
596
- typeof n[n.length - 1] == "function" && (k = n.pop()), this.cache[this.locale] || this._readLocaleFile();
597
- let _ = u === 1 ? m : s;
596
+ typeof s[s.length - 1] == "function" && (k = s.pop()), this.cache[this.locale] || this._readLocaleFile();
597
+ let _ = u === 1 ? m : n;
598
598
  this.cache[this.locale][m] && (_ = this.cache[this.locale][m][u === 1 ? "one" : "other"]), !this.cache[this.locale][m] && this.updateFiles ? (this.cache[this.locale][m] = {
599
599
  one: m,
600
- other: s
600
+ other: n
601
601
  }, this._enqueueWrite({
602
602
  directory: this.directory,
603
603
  locale: this.locale,
604
604
  cb: k
605
605
  })) : k();
606
606
  const h = [_];
607
- return ~_.indexOf("%d") && h.push(u), M.format.apply(M.format, h.concat(n));
607
+ return ~_.indexOf("%d") && h.push(u), M.format.apply(M.format, h.concat(s));
608
608
  }
609
- setLocale(n) {
610
- this.locale = n;
609
+ setLocale(s) {
610
+ this.locale = s;
611
611
  }
612
612
  getLocale() {
613
613
  return this.locale;
614
614
  }
615
- updateLocale(n) {
615
+ updateLocale(s) {
616
616
  this.cache[this.locale] || this._readLocaleFile();
617
- for (const m in n)
618
- Object.prototype.hasOwnProperty.call(n, m) && (this.cache[this.locale][m] = n[m]);
617
+ for (const m in s)
618
+ Object.prototype.hasOwnProperty.call(s, m) && (this.cache[this.locale][m] = s[m]);
619
619
  }
620
- _taggedLiteral(n, ...m) {
621
- let s = "";
622
- return n.forEach(function(u, k) {
620
+ _taggedLiteral(s, ...m) {
621
+ let n = "";
622
+ return s.forEach(function(u, k) {
623
623
  const _ = m[k + 1];
624
- s += u, typeof _ < "u" && (s += "%s");
625
- }), this.__.apply(this, [s].concat([].slice.call(m, 1)));
624
+ n += u, typeof _ < "u" && (n += "%s");
625
+ }), this.__.apply(this, [n].concat([].slice.call(m, 1)));
626
626
  }
627
- _enqueueWrite(n) {
628
- this.writeQueue.push(n), this.writeQueue.length === 1 && this._processWriteQueue();
627
+ _enqueueWrite(s) {
628
+ this.writeQueue.push(s), this.writeQueue.length === 1 && this._processWriteQueue();
629
629
  }
630
630
  _processWriteQueue() {
631
- const n = this, m = this.writeQueue[0], s = m.directory, u = m.locale, k = m.cb, _ = this._resolveLocaleFile(s, u), h = JSON.stringify(this.cache[u], null, 2);
631
+ const s = this, m = this.writeQueue[0], n = m.directory, u = m.locale, k = m.cb, _ = this._resolveLocaleFile(n, u), h = JSON.stringify(this.cache[u], null, 2);
632
632
  M.fs.writeFile(_, h, "utf-8", function(f) {
633
- n.writeQueue.shift(), n.writeQueue.length > 0 && n._processWriteQueue(), k(f);
633
+ s.writeQueue.shift(), s.writeQueue.length > 0 && s._processWriteQueue(), k(f);
634
634
  });
635
635
  }
636
636
  _readLocaleFile() {
637
- let n = {};
637
+ let s = {};
638
638
  const m = this._resolveLocaleFile(this.directory, this.locale);
639
639
  try {
640
- M.fs.readFileSync && (n = JSON.parse(M.fs.readFileSync(m, "utf-8")));
641
- } catch (s) {
642
- if (s instanceof SyntaxError && (s.message = "syntax error in " + m), s.code === "ENOENT")
643
- n = {};
640
+ M.fs.readFileSync && (s = JSON.parse(M.fs.readFileSync(m, "utf-8")));
641
+ } catch (n) {
642
+ if (n instanceof SyntaxError && (n.message = "syntax error in " + m), n.code === "ENOENT")
643
+ s = {};
644
644
  else
645
- throw s;
645
+ throw n;
646
646
  }
647
- this.cache[this.locale] = n;
647
+ this.cache[this.locale] = s;
648
648
  }
649
- _resolveLocaleFile(n, m) {
650
- let s = M.resolve(n, "./", m + ".json");
651
- if (this.fallbackToLanguage && !this._fileExistsSync(s) && ~m.lastIndexOf("_")) {
652
- const u = M.resolve(n, "./", m.split("_")[0] + ".json");
653
- this._fileExistsSync(u) && (s = u);
649
+ _resolveLocaleFile(s, m) {
650
+ let n = M.resolve(s, "./", m + ".json");
651
+ if (this.fallbackToLanguage && !this._fileExistsSync(n) && ~m.lastIndexOf("_")) {
652
+ const u = M.resolve(s, "./", m.split("_")[0] + ".json");
653
+ this._fileExistsSync(u) && (n = u);
654
654
  }
655
- return s;
655
+ return n;
656
656
  }
657
- _fileExistsSync(n) {
658
- return M.exists(n);
657
+ _fileExistsSync(s) {
658
+ return M.exists(s);
659
659
  }
660
660
  }
661
- function Ve(i, n) {
662
- M = n;
663
- const m = new De(i);
661
+ function Vt(i, s) {
662
+ M = s;
663
+ const m = new Dt(i);
664
664
  return {
665
665
  __: m.__.bind(m),
666
666
  __n: m.__n.bind(m),
@@ -670,19 +670,19 @@ function Ve(i, n) {
670
670
  locale: m.locale
671
671
  };
672
672
  }
673
- const $e = (i) => Ve(i, Fe);
673
+ const $t = (i) => Vt(i, Ft);
674
674
  let z;
675
675
  try {
676
- z = Te(import.meta.url);
676
+ z = Tt(import.meta.url);
677
677
  } catch {
678
678
  z = process.cwd();
679
679
  }
680
- const He = z.substring(0, z.lastIndexOf("node_modules"));
681
- He || process.cwd(), process.cwd, process.exit, process.nextTick, typeof process.stdout.columns < "u" && process.stdout.columns, $e({
682
- directory: ae(z, "../../../locales"),
680
+ const Ht = z.substring(0, z.lastIndexOf("node_modules"));
681
+ Ht || process.cwd(), process.cwd, process.exit, process.nextTick, typeof process.stdout.columns < "u" && process.stdout.columns, $t({
682
+ directory: at(z, "../../../locales"),
683
683
  updateFiles: !1
684
684
  });
685
- const ie = [
685
+ const it = [
686
686
  {
687
687
  id: "anthropic",
688
688
  name: "Anthropic",
@@ -731,6 +731,28 @@ const ie = [
731
731
  required: !0
732
732
  }
733
733
  ]
734
+ },
735
+ {
736
+ api_flavor: "chat",
737
+ root: "usage",
738
+ model_path: "model",
739
+ mappings: [
740
+ {
741
+ path: "prompt_tokens",
742
+ dest: "input_tokens",
743
+ required: !0
744
+ },
745
+ {
746
+ path: "cached_tokens",
747
+ dest: "cache_read_tokens",
748
+ required: !1
749
+ },
750
+ {
751
+ path: "completion_tokens",
752
+ dest: "output_tokens",
753
+ required: !0
754
+ }
755
+ ]
734
756
  }
735
757
  ],
736
758
  models: [
@@ -1280,24 +1302,50 @@ const ie = [
1280
1302
  }
1281
1303
  },
1282
1304
  {
1283
- id: "anthropic.claude-3-haiku-20240307-v1:0",
1284
- name: "Claude 3 Haiku",
1305
+ id: "deepseek.r1-v1:0",
1306
+ name: "DeepSeek-R1",
1285
1307
  match: {
1286
- contains: "claude-3-haiku-20240307"
1308
+ contains: "r1"
1287
1309
  },
1288
1310
  prices: {
1289
- input_mtok: 0.25
1311
+ input_mtok: 1.35,
1312
+ output_mtok: 5.4
1290
1313
  }
1291
1314
  },
1292
1315
  {
1293
- id: "deepseek.r1-v1:0",
1294
- name: "DeepSeek-R1",
1316
+ id: "global.anthropic.claude-haiku-4-5-20251001-v1:0",
1295
1317
  match: {
1296
- contains: "r1"
1318
+ starts_with: "global.anthropic.claude-haiku-4-5-20251001-v1"
1297
1319
  },
1298
1320
  prices: {
1299
- input_mtok: 1.35,
1300
- output_mtok: 5.4
1321
+ input_mtok: 1,
1322
+ cache_write_mtok: 1.25,
1323
+ cache_read_mtok: 0.1,
1324
+ output_mtok: 5
1325
+ }
1326
+ },
1327
+ {
1328
+ id: "global.anthropic.claude-sonnet-4-20250514-v1:0",
1329
+ match: {
1330
+ starts_with: "global.anthropic.claude-sonnet-4-20250514-v1"
1331
+ },
1332
+ prices: {
1333
+ input_mtok: 3,
1334
+ cache_write_mtok: 3.75,
1335
+ cache_read_mtok: 0.3,
1336
+ output_mtok: 15
1337
+ }
1338
+ },
1339
+ {
1340
+ id: "global.anthropic.claude-sonnet-4-5-20250929-v1:0",
1341
+ match: {
1342
+ starts_with: "global.anthropic.claude-sonnet-4-5-20250929-v1"
1343
+ },
1344
+ prices: {
1345
+ input_mtok: 3,
1346
+ cache_write_mtok: 3.75,
1347
+ cache_read_mtok: 0.3,
1348
+ output_mtok: 15
1301
1349
  }
1302
1350
  },
1303
1351
  {
@@ -1519,6 +1567,374 @@ const ie = [
1519
1567
  input_mtok: 0.15,
1520
1568
  output_mtok: 0.6
1521
1569
  }
1570
+ },
1571
+ {
1572
+ id: "regional.anthropic.claude-3-5-haiku-20241022-v1:0",
1573
+ match: {
1574
+ or: [
1575
+ {
1576
+ starts_with: "us.anthropic.claude-3-5-haiku-20241022-v1"
1577
+ },
1578
+ {
1579
+ starts_with: "au.anthropic.claude-3-5-haiku-20241022-v1"
1580
+ },
1581
+ {
1582
+ starts_with: "apac.anthropic.claude-3-5-haiku-20241022-v1"
1583
+ },
1584
+ {
1585
+ starts_with: "eu.anthropic.claude-3-5-haiku-20241022-v1"
1586
+ },
1587
+ {
1588
+ starts_with: "us-gov.anthropic.claude-3-5-haiku-20241022-v1"
1589
+ },
1590
+ {
1591
+ starts_with: "jp.anthropic.claude-3-5-haiku-20241022-v1"
1592
+ }
1593
+ ]
1594
+ },
1595
+ prices: {
1596
+ input_mtok: 0.8,
1597
+ cache_write_mtok: 1,
1598
+ cache_read_mtok: 0.08,
1599
+ output_mtok: 4
1600
+ }
1601
+ },
1602
+ {
1603
+ id: "regional.anthropic.claude-3-5-sonnet-20240620-v1:0",
1604
+ match: {
1605
+ or: [
1606
+ {
1607
+ starts_with: "us.anthropic.claude-3-5-sonnet-20240620-v1"
1608
+ },
1609
+ {
1610
+ starts_with: "au.anthropic.claude-3-5-sonnet-20240620-v1"
1611
+ },
1612
+ {
1613
+ starts_with: "apac.anthropic.claude-3-5-sonnet-20240620-v1"
1614
+ },
1615
+ {
1616
+ starts_with: "eu.anthropic.claude-3-5-sonnet-20240620-v1"
1617
+ },
1618
+ {
1619
+ starts_with: "us-gov.anthropic.claude-3-5-sonnet-20240620-v1"
1620
+ },
1621
+ {
1622
+ starts_with: "jp.anthropic.claude-3-5-sonnet-20240620-v1"
1623
+ }
1624
+ ]
1625
+ },
1626
+ prices: {
1627
+ input_mtok: 3,
1628
+ cache_write_mtok: 3.75,
1629
+ cache_read_mtok: 0.3,
1630
+ output_mtok: 15
1631
+ }
1632
+ },
1633
+ {
1634
+ id: "regional.anthropic.claude-3-5-sonnet-20241022-v2:0",
1635
+ match: {
1636
+ or: [
1637
+ {
1638
+ starts_with: "us.anthropic.claude-3-5-sonnet-20241022-v2"
1639
+ },
1640
+ {
1641
+ starts_with: "au.anthropic.claude-3-5-sonnet-20241022-v2"
1642
+ },
1643
+ {
1644
+ starts_with: "apac.anthropic.claude-3-5-sonnet-20241022-v2"
1645
+ },
1646
+ {
1647
+ starts_with: "eu.anthropic.claude-3-5-sonnet-20241022-v2"
1648
+ },
1649
+ {
1650
+ starts_with: "us-gov.anthropic.claude-3-5-sonnet-20241022-v2"
1651
+ },
1652
+ {
1653
+ starts_with: "jp.anthropic.claude-3-5-sonnet-20241022-v2"
1654
+ }
1655
+ ]
1656
+ },
1657
+ prices: {
1658
+ input_mtok: 3,
1659
+ cache_write_mtok: 3.75,
1660
+ cache_read_mtok: 0.3,
1661
+ output_mtok: 15
1662
+ }
1663
+ },
1664
+ {
1665
+ id: "regional.anthropic.claude-3-7-sonnet-20250219-v1:0",
1666
+ match: {
1667
+ or: [
1668
+ {
1669
+ starts_with: "us.anthropic.claude-3-7-sonnet-20250219-v1"
1670
+ },
1671
+ {
1672
+ starts_with: "au.anthropic.claude-3-7-sonnet-20250219-v1"
1673
+ },
1674
+ {
1675
+ starts_with: "apac.anthropic.claude-3-7-sonnet-20250219-v1"
1676
+ },
1677
+ {
1678
+ starts_with: "eu.anthropic.claude-3-7-sonnet-20250219-v1"
1679
+ },
1680
+ {
1681
+ starts_with: "us-gov.anthropic.claude-3-7-sonnet-20250219-v1"
1682
+ },
1683
+ {
1684
+ starts_with: "jp.anthropic.claude-3-7-sonnet-20250219-v1"
1685
+ }
1686
+ ]
1687
+ },
1688
+ prices: {
1689
+ input_mtok: 3,
1690
+ cache_write_mtok: 3.75,
1691
+ cache_read_mtok: 0.3,
1692
+ output_mtok: 15
1693
+ }
1694
+ },
1695
+ {
1696
+ id: "regional.anthropic.claude-3-haiku-20240307-v1:0",
1697
+ match: {
1698
+ or: [
1699
+ {
1700
+ starts_with: "us.anthropic.claude-3-haiku-20240307-v1"
1701
+ },
1702
+ {
1703
+ starts_with: "au.anthropic.claude-3-haiku-20240307-v1"
1704
+ },
1705
+ {
1706
+ starts_with: "apac.anthropic.claude-3-haiku-20240307-v1"
1707
+ },
1708
+ {
1709
+ starts_with: "eu.anthropic.claude-3-haiku-20240307-v1"
1710
+ },
1711
+ {
1712
+ starts_with: "us-gov.anthropic.claude-3-haiku-20240307-v1"
1713
+ },
1714
+ {
1715
+ starts_with: "jp.anthropic.claude-3-haiku-20240307-v1"
1716
+ }
1717
+ ]
1718
+ },
1719
+ prices: {
1720
+ input_mtok: 0.25,
1721
+ output_mtok: 1.25
1722
+ }
1723
+ },
1724
+ {
1725
+ id: "regional.anthropic.claude-3-opus-20240229-v1:0",
1726
+ match: {
1727
+ or: [
1728
+ {
1729
+ starts_with: "us.anthropic.claude-3-opus-20240229-v1"
1730
+ },
1731
+ {
1732
+ starts_with: "au.anthropic.claude-3-opus-20240229-v1"
1733
+ },
1734
+ {
1735
+ starts_with: "apac.anthropic.claude-3-opus-20240229-v1"
1736
+ },
1737
+ {
1738
+ starts_with: "eu.anthropic.claude-3-opus-20240229-v1"
1739
+ },
1740
+ {
1741
+ starts_with: "us-gov.anthropic.claude-3-opus-20240229-v1"
1742
+ },
1743
+ {
1744
+ starts_with: "jp.anthropic.claude-3-opus-20240229-v1"
1745
+ }
1746
+ ]
1747
+ },
1748
+ prices: {
1749
+ input_mtok: 15,
1750
+ output_mtok: 75
1751
+ }
1752
+ },
1753
+ {
1754
+ id: "regional.anthropic.claude-3-sonnet-20240229-v1:0",
1755
+ match: {
1756
+ or: [
1757
+ {
1758
+ starts_with: "us.anthropic.claude-3-sonnet-20240229-v1"
1759
+ },
1760
+ {
1761
+ starts_with: "au.anthropic.claude-3-sonnet-20240229-v1"
1762
+ },
1763
+ {
1764
+ starts_with: "apac.anthropic.claude-3-sonnet-20240229-v1"
1765
+ },
1766
+ {
1767
+ starts_with: "eu.anthropic.claude-3-sonnet-20240229-v1"
1768
+ },
1769
+ {
1770
+ starts_with: "us-gov.anthropic.claude-3-sonnet-20240229-v1"
1771
+ },
1772
+ {
1773
+ starts_with: "jp.anthropic.claude-3-sonnet-20240229-v1"
1774
+ }
1775
+ ]
1776
+ },
1777
+ prices: {
1778
+ input_mtok: 3,
1779
+ cache_write_mtok: 3.75,
1780
+ cache_read_mtok: 0.3,
1781
+ output_mtok: 15
1782
+ }
1783
+ },
1784
+ {
1785
+ id: "regional.anthropic.claude-haiku-4-5-20251001-v1:0",
1786
+ match: {
1787
+ or: [
1788
+ {
1789
+ starts_with: "us.anthropic.claude-haiku-4-5-20251001-v1"
1790
+ },
1791
+ {
1792
+ starts_with: "au.anthropic.claude-haiku-4-5-20251001-v1"
1793
+ },
1794
+ {
1795
+ starts_with: "apac.anthropic.claude-haiku-4-5-20251001-v1"
1796
+ },
1797
+ {
1798
+ starts_with: "eu.anthropic.claude-haiku-4-5-20251001-v1"
1799
+ },
1800
+ {
1801
+ starts_with: "us-gov.anthropic.claude-haiku-4-5-20251001-v1"
1802
+ },
1803
+ {
1804
+ starts_with: "jp.anthropic.claude-haiku-4-5-20251001-v1"
1805
+ }
1806
+ ]
1807
+ },
1808
+ prices: {
1809
+ input_mtok: 1.1,
1810
+ cache_write_mtok: 1.375,
1811
+ cache_read_mtok: 0.11,
1812
+ output_mtok: 5.5
1813
+ }
1814
+ },
1815
+ {
1816
+ id: "regional.anthropic.claude-opus-4-1-20250805-v1:0",
1817
+ match: {
1818
+ or: [
1819
+ {
1820
+ starts_with: "us.anthropic.claude-opus-4-1-20250805-v1"
1821
+ },
1822
+ {
1823
+ starts_with: "au.anthropic.claude-opus-4-1-20250805-v1"
1824
+ },
1825
+ {
1826
+ starts_with: "apac.anthropic.claude-opus-4-1-20250805-v1"
1827
+ },
1828
+ {
1829
+ starts_with: "eu.anthropic.claude-opus-4-1-20250805-v1"
1830
+ },
1831
+ {
1832
+ starts_with: "us-gov.anthropic.claude-opus-4-1-20250805-v1"
1833
+ },
1834
+ {
1835
+ starts_with: "jp.anthropic.claude-opus-4-1-20250805-v1"
1836
+ }
1837
+ ]
1838
+ },
1839
+ prices: {
1840
+ input_mtok: 15,
1841
+ cache_write_mtok: 18.75,
1842
+ cache_read_mtok: 1.5,
1843
+ output_mtok: 75
1844
+ }
1845
+ },
1846
+ {
1847
+ id: "regional.anthropic.claude-opus-4-20250514-v1:0",
1848
+ match: {
1849
+ or: [
1850
+ {
1851
+ starts_with: "us.anthropic.claude-opus-4-20250514-v1"
1852
+ },
1853
+ {
1854
+ starts_with: "au.anthropic.claude-opus-4-20250514-v1"
1855
+ },
1856
+ {
1857
+ starts_with: "apac.anthropic.claude-opus-4-20250514-v1"
1858
+ },
1859
+ {
1860
+ starts_with: "eu.anthropic.claude-opus-4-20250514-v1"
1861
+ },
1862
+ {
1863
+ starts_with: "us-gov.anthropic.claude-opus-4-20250514-v1"
1864
+ },
1865
+ {
1866
+ starts_with: "jp.anthropic.claude-opus-4-20250514-v1"
1867
+ }
1868
+ ]
1869
+ },
1870
+ prices: {
1871
+ input_mtok: 15,
1872
+ cache_write_mtok: 18.75,
1873
+ cache_read_mtok: 1.5,
1874
+ output_mtok: 75
1875
+ }
1876
+ },
1877
+ {
1878
+ id: "regional.anthropic.claude-sonnet-4-20250514-v1:0",
1879
+ match: {
1880
+ or: [
1881
+ {
1882
+ starts_with: "us.anthropic.claude-sonnet-4-20250514-v1"
1883
+ },
1884
+ {
1885
+ starts_with: "au.anthropic.claude-sonnet-4-20250514-v1"
1886
+ },
1887
+ {
1888
+ starts_with: "apac.anthropic.claude-sonnet-4-20250514-v1"
1889
+ },
1890
+ {
1891
+ starts_with: "eu.anthropic.claude-sonnet-4-20250514-v1"
1892
+ },
1893
+ {
1894
+ starts_with: "us-gov.anthropic.claude-sonnet-4-20250514-v1"
1895
+ },
1896
+ {
1897
+ starts_with: "jp.anthropic.claude-sonnet-4-20250514-v1"
1898
+ }
1899
+ ]
1900
+ },
1901
+ prices: {
1902
+ input_mtok: 3,
1903
+ cache_write_mtok: 3.75,
1904
+ cache_read_mtok: 0.3,
1905
+ output_mtok: 15
1906
+ }
1907
+ },
1908
+ {
1909
+ id: "regional.anthropic.claude-sonnet-4-5-20250929-v1:0",
1910
+ match: {
1911
+ or: [
1912
+ {
1913
+ starts_with: "us.anthropic.claude-sonnet-4-5-20250929-v1"
1914
+ },
1915
+ {
1916
+ starts_with: "au.anthropic.claude-sonnet-4-5-20250929-v1"
1917
+ },
1918
+ {
1919
+ starts_with: "apac.anthropic.claude-sonnet-4-5-20250929-v1"
1920
+ },
1921
+ {
1922
+ starts_with: "eu.anthropic.claude-sonnet-4-5-20250929-v1"
1923
+ },
1924
+ {
1925
+ starts_with: "us-gov.anthropic.claude-sonnet-4-5-20250929-v1"
1926
+ },
1927
+ {
1928
+ starts_with: "jp.anthropic.claude-sonnet-4-5-20250929-v1"
1929
+ }
1930
+ ]
1931
+ },
1932
+ prices: {
1933
+ input_mtok: 3.3,
1934
+ cache_write_mtok: 4.125,
1935
+ cache_read_mtok: 0.33,
1936
+ output_mtok: 16.5
1937
+ }
1522
1938
  }
1523
1939
  ]
1524
1940
  },
@@ -1528,6 +1944,111 @@ const ie = [
1528
1944
  pricing_urls: ["https://azure.microsoft.com/en-us/pricing/details/cognitive-services/openai-service/#pricing"],
1529
1945
  api_pattern: "(https?://)?([^.]*\\.)?(?:openai\\.azure\\.com|azure-api\\.net|cognitiveservices\\.azure\\.com)",
1530
1946
  price_comments: 'These are prices for "*-Global" models, prices for "Regional" models are often slightly higher. Retired models are listed at https://learn.microsoft.com/th-th/azure/ai-foundry/openai/concepts/legacy-models',
1947
+ extractors: [
1948
+ {
1949
+ api_flavor: "chat",
1950
+ root: "usage",
1951
+ model_path: "model",
1952
+ mappings: [
1953
+ {
1954
+ path: "prompt_tokens",
1955
+ dest: "input_tokens",
1956
+ required: !0
1957
+ },
1958
+ {
1959
+ path: ["prompt_tokens_details", "cached_tokens"],
1960
+ dest: "cache_read_tokens",
1961
+ required: !1
1962
+ },
1963
+ {
1964
+ path: ["prompt_tokens_details", "audio_tokens"],
1965
+ dest: "input_audio_tokens",
1966
+ required: !1
1967
+ },
1968
+ {
1969
+ path: ["completion_tokens_details", "audio_tokens"],
1970
+ dest: "output_audio_tokens",
1971
+ required: !1
1972
+ },
1973
+ {
1974
+ path: "completion_tokens",
1975
+ dest: "output_tokens",
1976
+ required: !0
1977
+ }
1978
+ ]
1979
+ },
1980
+ {
1981
+ api_flavor: "responses",
1982
+ root: "usage",
1983
+ model_path: "model",
1984
+ mappings: [
1985
+ {
1986
+ path: "input_tokens",
1987
+ dest: "input_tokens",
1988
+ required: !0
1989
+ },
1990
+ {
1991
+ path: ["input_tokens_details", "cached_tokens"],
1992
+ dest: "cache_read_tokens",
1993
+ required: !1
1994
+ },
1995
+ {
1996
+ path: "output_tokens",
1997
+ dest: "output_tokens",
1998
+ required: !0
1999
+ }
2000
+ ]
2001
+ },
2002
+ {
2003
+ api_flavor: "embeddings",
2004
+ root: "usage",
2005
+ model_path: "model",
2006
+ mappings: [
2007
+ {
2008
+ path: "prompt_tokens",
2009
+ dest: "input_tokens",
2010
+ required: !0
2011
+ }
2012
+ ]
2013
+ },
2014
+ {
2015
+ api_flavor: "anthropic",
2016
+ root: "usage",
2017
+ model_path: "model",
2018
+ mappings: [
2019
+ {
2020
+ path: "input_tokens",
2021
+ dest: "input_tokens",
2022
+ required: !0
2023
+ },
2024
+ {
2025
+ path: "cache_creation_input_tokens",
2026
+ dest: "input_tokens",
2027
+ required: !1
2028
+ },
2029
+ {
2030
+ path: "cache_read_input_tokens",
2031
+ dest: "input_tokens",
2032
+ required: !1
2033
+ },
2034
+ {
2035
+ path: "cache_creation_input_tokens",
2036
+ dest: "cache_write_tokens",
2037
+ required: !1
2038
+ },
2039
+ {
2040
+ path: "cache_read_input_tokens",
2041
+ dest: "cache_read_tokens",
2042
+ required: !1
2043
+ },
2044
+ {
2045
+ path: "output_tokens",
2046
+ dest: "output_tokens",
2047
+ required: !0
2048
+ }
2049
+ ]
2050
+ }
2051
+ ],
1531
2052
  models: [
1532
2053
  {
1533
2054
  id: "ada",
@@ -12919,22 +13440,22 @@ Compared to other leading proprietary and open-weights models Command A delivers
12919
13440
  ]
12920
13441
  }
12921
13442
  ];
12922
- function We(i, n) {
12923
- if (n <= 0) return 0;
13443
+ function Wt(i, s) {
13444
+ if (s <= 0) return 0;
12924
13445
  let m = 0;
12925
- const s = [...i.tiers].sort((_, h) => _.start - h.start), u = s[0]?.start ?? n, k = Math.min(n, u);
13446
+ const n = [...i.tiers].sort((_, h) => _.start - h.start), u = n[0]?.start ?? s, k = Math.min(s, u);
12926
13447
  m += k * i.base / 1e6;
12927
- for (let _ = 0; _ < s.length; _++) {
12928
- const h = s[_], f = s[_ + 1]?.start ?? 1 / 0, y = Math.max(0, Math.min(n, f) - h.start);
13448
+ for (let _ = 0; _ < n.length; _++) {
13449
+ const h = n[_], f = n[_ + 1]?.start ?? 1 / 0, y = Math.max(0, Math.min(s, f) - h.start);
12929
13450
  y > 0 && (m += y * h.price / 1e6);
12930
13451
  }
12931
13452
  return m;
12932
13453
  }
12933
- function O(i, n, m) {
12934
- return i === void 0 || n === void 0 ? 0 : typeof i == "number" ? i * n / 1e6 : We(i, n);
13454
+ function O(i, s, m) {
13455
+ return i === void 0 || s === void 0 ? 0 : typeof i == "number" ? i * s / 1e6 : Wt(i, s);
12935
13456
  }
12936
- function Ue(i, n) {
12937
- let m = 0, s = 0;
13457
+ function Ut(i, s) {
13458
+ let m = 0, n = 0;
12938
13459
  const u = i.cache_read_tokens ?? 0, k = i.cache_write_tokens ?? 0, _ = i.cache_audio_read_tokens ?? 0, h = i.output_audio_tokens ?? 0;
12939
13460
  let f = i.input_audio_tokens ?? 0;
12940
13461
  if (f -= _, f < 0)
@@ -12945,65 +13466,65 @@ function Ue(i, n) {
12945
13466
  let P = u;
12946
13467
  if (P -= _, P < 0)
12947
13468
  throw new Error("cache_audio_read_tokens cannot be greater than cache_read_tokens");
12948
- m += O(n.input_mtok, y), m += O(n.cache_read_mtok, P), m += O(n.cache_write_mtok, k), m += O(n.input_audio_mtok, f), m += O(n.cache_audio_read_mtok, _);
13469
+ m += O(s.input_mtok, y), m += O(s.cache_read_mtok, P), m += O(s.cache_write_mtok, k), m += O(s.input_audio_mtok, f), m += O(s.cache_audio_read_mtok, _);
12949
13470
  let S = i.output_tokens ?? 0;
12950
13471
  if (S -= h, S < 0)
12951
13472
  throw new Error("output_audio_tokens cannot be greater than output_tokens");
12952
- s += O(n.output_mtok, S), s += O(n.output_audio_mtok, i.output_audio_tokens);
12953
- let G = m + s;
12954
- return n.requests_kcount !== void 0 && (G += n.requests_kcount / 1e3), {
13473
+ n += O(s.output_mtok, S), n += O(s.output_audio_mtok, i.output_audio_tokens);
13474
+ let G = m + n;
13475
+ return s.requests_kcount !== void 0 && (G += s.requests_kcount / 1e3), {
12955
13476
  input_price: m,
12956
- output_price: s,
13477
+ output_price: n,
12957
13478
  total_price: G
12958
13479
  };
12959
13480
  }
12960
- function Ke(i, n) {
13481
+ function Kt(i, s) {
12961
13482
  if (!Array.isArray(i.prices))
12962
13483
  return i.prices;
12963
13484
  for (let m = i.prices.length - 1; m >= 0; m--) {
12964
- const s = i.prices[m], u = s.constraint;
13485
+ const n = i.prices[m], u = n.constraint;
12965
13486
  if (u === void 0)
12966
- return s.prices;
13487
+ return n.prices;
12967
13488
  if (u.type === "start_date") {
12968
- if (n >= new Date(u.start_date))
12969
- return s.prices;
13489
+ if (s >= new Date(u.start_date))
13490
+ return n.prices;
12970
13491
  } else {
12971
- const k = n.toISOString().slice(11, 19), _ = u.start_time, h = u.end_time;
13492
+ const k = s.toISOString().slice(11, 19), _ = u.start_time, h = u.end_time;
12972
13493
  if (h < _) {
12973
13494
  if (k >= _ || k < h)
12974
- return s.prices;
13495
+ return n.prices;
12975
13496
  } else if (k >= _ && k < h)
12976
- return s.prices;
13497
+ return n.prices;
12977
13498
  }
12978
13499
  }
12979
13500
  return i.prices[0].prices;
12980
13501
  }
12981
- function j(i, n) {
12982
- return "or" in i ? i.or.some((m) => j(m, n)) : "and" in i ? i.and.every((m) => j(m, n)) : "equals" in i ? n === i.equals : "starts_with" in i ? n.startsWith(i.starts_with) : "ends_with" in i ? n.endsWith(i.ends_with) : "contains" in i ? n.includes(i.contains) : "regex" in i ? new RegExp(i.regex).test(n) : !1;
13502
+ function j(i, s) {
13503
+ return "or" in i ? i.or.some((m) => j(m, s)) : "and" in i ? i.and.every((m) => j(m, s)) : "equals" in i ? s === i.equals : "starts_with" in i ? s.startsWith(i.starts_with) : "ends_with" in i ? s.endsWith(i.ends_with) : "contains" in i ? s.includes(i.contains) : "regex" in i ? new RegExp(i.regex).test(s) : !1;
12983
13504
  }
12984
- function Ye(i, n) {
12985
- const m = n.toLowerCase().trim(), s = i.find((u) => u.id === m);
12986
- return s || i.find((u) => u.provider_match && j(u.provider_match, m));
13505
+ function Yt(i, s) {
13506
+ const m = s.toLowerCase().trim(), n = i.find((u) => u.id === m);
13507
+ return n || i.find((u) => u.provider_match && j(u.provider_match, m));
12987
13508
  }
12988
- function Je(i, { modelId: n, providerApiUrl: m, providerId: s }) {
12989
- if (s)
12990
- return Ye(i, s);
13509
+ function Jt(i, { modelId: s, providerApiUrl: m, providerId: n }) {
13510
+ if (n)
13511
+ return Yt(i, n);
12991
13512
  if (m)
12992
13513
  return i.find((u) => new RegExp(u.api_pattern).test(m));
12993
- if (n)
12994
- return i.find((u) => u.model_match && j(u.model_match, n));
13514
+ if (s)
13515
+ return i.find((u) => u.model_match && j(u.model_match, s));
12995
13516
  }
12996
- function Ze(i, n) {
12997
- return i.find((m) => j(m.match, n));
13517
+ function Zt(i, s) {
13518
+ return i.find((m) => j(m.match, s));
12998
13519
  }
12999
- let Xe = ie;
13000
- Promise.resolve(ie);
13001
- function et(i, n, m) {
13002
- const s = n.toLowerCase().trim(), u = m?.provider ?? Je(Xe, { modelId: s, providerApiUrl: m?.providerApiUrl, providerId: m?.providerId });
13520
+ let Xt = it;
13521
+ Promise.resolve(it);
13522
+ function te(i, s, m) {
13523
+ const n = s.toLowerCase().trim(), u = m?.provider ?? Jt(Xt, { modelId: n, providerApiUrl: m?.providerApiUrl, providerId: m?.providerId });
13003
13524
  if (!u) return null;
13004
- const k = Ze(u.models, s);
13525
+ const k = Zt(u.models, n);
13005
13526
  if (!k) return null;
13006
- const _ = m?.timestamp ?? /* @__PURE__ */ new Date(), h = Ke(k, _), f = Ue(i, h);
13527
+ const _ = m?.timestamp ?? /* @__PURE__ */ new Date(), h = Kt(k, _), f = Ut(i, h);
13007
13528
  return {
13008
13529
  auto_update_timestamp: void 0,
13009
13530
  model: k,
@@ -13012,7 +13533,7 @@ function et(i, n, m) {
13012
13533
  ...f
13013
13534
  };
13014
13535
  }
13015
- const b = de(Ce(process.argv)).scriptName("genai-prices").command(
13536
+ const b = dt(Ct(process.argv)).scriptName("genai-prices").command(
13016
13537
  "list [provider]",
13017
13538
  "List providers and models",
13018
13539
  (i) => i.positional("provider", { describe: "Provider ID to filter", type: "string" })
@@ -13021,24 +13542,24 @@ const b = de(Ce(process.argv)).scriptName("genai-prices").command(
13021
13542
  "Calculate price",
13022
13543
  (i) => i.positional("model", { array: !0, describe: "Model(s) (optionally provider:model)", type: "string" }).option("input-tokens", { type: "number" }).option("cache-write-tokens", { type: "number" }).option("cache-read-tokens", { type: "number" }).option("output-tokens", { type: "number" }).option("input-audio-tokens", { type: "number" }).option("cache-audio-read-tokens", { type: "number" }).option("output-audio-tokens", { type: "number" }).option("requests", { type: "number" }).option("provider", { type: "string" }).option("auto-update", { default: !1, type: "boolean" }).option("timestamp", { describe: "RFC3339 timestamp", type: "string" })
13023
13544
  ).option("auto-update", { describe: "Enable auto-update from GitHub", type: "boolean" }).option("input-tokens", { type: "number" }).option("cache-write-tokens", { type: "number" }).option("cache-read-tokens", { type: "number" }).option("output-tokens", { type: "number" }).option("input-audio-tokens", { type: "number" }).option("cache-audio-read-tokens", { type: "number" }).option("output-audio-tokens", { type: "number" }).option("requests", { type: "number" }).option("provider", { type: "string" }).option("timestamp", { describe: "RFC3339 timestamp", type: "string" }).version("0.1.0").help().parseSync();
13024
- function tt() {
13545
+ function ee() {
13025
13546
  if (b._[0] === "list") {
13026
- const m = ie;
13547
+ const m = it;
13027
13548
  if (b.provider) {
13028
- const s = m.find((u) => u.id === b.provider);
13029
- s || (console.error(`Provider ${b.provider} not found.`), process.exit(1)), console.log(`${s.name}: (${s.models.length} models)`);
13030
- for (const u of s.models)
13031
- console.log(` ${s.id}:${u.id}${u.name ? ": " + u.name : ""}`);
13549
+ const n = m.find((u) => u.id === b.provider);
13550
+ n || (console.error(`Provider ${b.provider} not found.`), process.exit(1)), console.log(`${n.name}: (${n.models.length} models)`);
13551
+ for (const u of n.models)
13552
+ console.log(` ${n.id}:${u.id}${u.name ? ": " + u.name : ""}`);
13032
13553
  } else
13033
- for (const s of m) {
13034
- console.log(`${s.name}: (${s.models.length} models)`);
13035
- for (const u of s.models)
13036
- console.log(` ${s.id}:${u.id}${u.name ? ": " + u.name : ""}`);
13554
+ for (const n of m) {
13555
+ console.log(`${n.name}: (${n.models.length} models)`);
13556
+ for (const u of n.models)
13557
+ console.log(` ${n.id}:${u.id}${u.name ? ": " + u.name : ""}`);
13037
13558
  }
13038
13559
  process.exit(0);
13039
13560
  }
13040
- const n = b._[0] === "calc" ? Array.isArray(b.model) ? b.model : [b.model] : b._.filter((m) => typeof m == "string");
13041
- if (n.length > 0) {
13561
+ const s = b._[0] === "calc" ? Array.isArray(b.model) ? b.model : [b.model] : b._.filter((m) => typeof m == "string");
13562
+ if (s.length > 0) {
13042
13563
  const m = {
13043
13564
  cache_audio_read_tokens: b["cache-audio-read-tokens"] !== void 0 ? Number(b["cache-audio-read-tokens"]) : void 0,
13044
13565
  cache_read_tokens: b["cache-read-tokens"] !== void 0 ? Number(b["cache-read-tokens"]) : void 0,
@@ -13048,13 +13569,13 @@ function tt() {
13048
13569
  output_audio_tokens: b["output-audio-tokens"] !== void 0 ? Number(b["output-audio-tokens"]) : void 0,
13049
13570
  output_tokens: b["output-tokens"] !== void 0 ? Number(b["output-tokens"]) : void 0,
13050
13571
  requests: b.requests !== void 0 ? Number(b.requests) : void 0
13051
- }, s = b.timestamp ? new Date(String(b.timestamp)) : void 0;
13572
+ }, n = b.timestamp ? new Date(String(b.timestamp)) : void 0;
13052
13573
  let u = !1;
13053
- for (const k of n) {
13574
+ for (const k of s) {
13054
13575
  let _, h = k;
13055
13576
  h.includes(":") && ([_, h] = h.split(":", 2));
13056
13577
  try {
13057
- const f = et(m, h, { providerId: _, timestamp: s });
13578
+ const f = te(m, h, { providerId: _, timestamp: n });
13058
13579
  if (!f) {
13059
13580
  u = !0, console.error(`No price found for model ${k}`);
13060
13581
  continue;
@@ -13077,6 +13598,6 @@ function tt() {
13077
13598
  }
13078
13599
  process.exit(u ? 1 : 0);
13079
13600
  }
13080
- de().showHelp(), process.exit(1);
13601
+ dt().showHelp(), process.exit(1);
13081
13602
  }
13082
- tt();
13603
+ ee();