@pydantic/genai-prices 0.0.49 → 0.0.50
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 +512 -402
- package/dist/index.cjs +3 -3
- package/dist/index.d.cts +5 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +199 -81
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -1,51 +1,51 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import
|
|
3
|
-
import { format as
|
|
4
|
-
import { resolve as
|
|
5
|
-
import { readFileSync as
|
|
2
|
+
import de from "yargs";
|
|
3
|
+
import { format as _e } from "util";
|
|
4
|
+
import { resolve as ae, normalize as Le } from "path";
|
|
5
|
+
import { readFileSync as he, writeFile as Me, statSync as Qe } from "fs";
|
|
6
6
|
import "assert";
|
|
7
|
-
import { fileURLToPath as
|
|
8
|
-
function
|
|
9
|
-
return
|
|
7
|
+
import { fileURLToPath as Ae } from "url";
|
|
8
|
+
function Pe() {
|
|
9
|
+
return Te() ? 0 : 1;
|
|
10
10
|
}
|
|
11
|
-
function
|
|
12
|
-
return
|
|
11
|
+
function Te() {
|
|
12
|
+
return Se() && !process.defaultApp;
|
|
13
13
|
}
|
|
14
|
-
function
|
|
14
|
+
function Se() {
|
|
15
15
|
return !!process.versions.electron;
|
|
16
16
|
}
|
|
17
|
-
function
|
|
18
|
-
return i.slice(
|
|
17
|
+
function Ge(i) {
|
|
18
|
+
return i.slice(Pe() + 1);
|
|
19
19
|
}
|
|
20
20
|
/**
|
|
21
21
|
* @license
|
|
22
22
|
* Copyright (c) 2016, Contributors
|
|
23
23
|
* SPDX-License-Identifier: ISC
|
|
24
24
|
*/
|
|
25
|
-
function
|
|
25
|
+
function $(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
|
|
30
|
-
const
|
|
31
|
-
for (let
|
|
32
|
-
let
|
|
33
|
-
s && (s = !1,
|
|
29
|
+
let u = "", s = !1;
|
|
30
|
+
const r = i.match(/^-+/);
|
|
31
|
+
for (let h = r ? r[0].length : 0; h < i.length; h++) {
|
|
32
|
+
let k = i.charAt(h);
|
|
33
|
+
s && (s = !1, k = k.toUpperCase()), h !== 0 && (k === "-" || k === "_") ? s = !0 : k !== "-" && k !== "_" && (u += k);
|
|
34
34
|
}
|
|
35
|
-
return
|
|
35
|
+
return u;
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
-
function
|
|
39
|
-
const
|
|
38
|
+
function Ce(i, n) {
|
|
39
|
+
const u = i.toLowerCase();
|
|
40
40
|
n = n || "-";
|
|
41
41
|
let s = "";
|
|
42
|
-
for (let
|
|
43
|
-
const
|
|
44
|
-
|
|
42
|
+
for (let r = 0; r < i.length; r++) {
|
|
43
|
+
const h = u.charAt(r), k = i.charAt(r);
|
|
44
|
+
h !== k && r > 0 ? s += `${n}${u.charAt(r)}` : s += k;
|
|
45
45
|
}
|
|
46
46
|
return s;
|
|
47
47
|
}
|
|
48
|
-
function
|
|
48
|
+
function Re(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,20 +53,20 @@ function Rt(i) {
|
|
|
53
53
|
* Copyright (c) 2016, Contributors
|
|
54
54
|
* SPDX-License-Identifier: ISC
|
|
55
55
|
*/
|
|
56
|
-
function
|
|
56
|
+
function ze(i) {
|
|
57
57
|
if (Array.isArray(i))
|
|
58
|
-
return i.map((
|
|
58
|
+
return i.map((k) => typeof k != "string" ? k + "" : k);
|
|
59
59
|
i = i.trim();
|
|
60
|
-
let n = 0,
|
|
61
|
-
const
|
|
62
|
-
for (let
|
|
63
|
-
if (
|
|
64
|
-
|
|
60
|
+
let n = 0, u = null, s = null, r = null;
|
|
61
|
+
const h = [];
|
|
62
|
+
for (let k = 0; k < i.length; k++) {
|
|
63
|
+
if (u = s, s = i.charAt(k), s === " " && !r) {
|
|
64
|
+
u !== " " && n++;
|
|
65
65
|
continue;
|
|
66
66
|
}
|
|
67
|
-
s ===
|
|
67
|
+
s === r ? r = null : (s === "'" || s === '"') && !r && (r = s), h[n] || (h[n] = ""), h[n] += s;
|
|
68
68
|
}
|
|
69
|
-
return
|
|
69
|
+
return h;
|
|
70
70
|
}
|
|
71
71
|
/**
|
|
72
72
|
* @license
|
|
@@ -83,11 +83,11 @@ var L;
|
|
|
83
83
|
* SPDX-License-Identifier: ISC
|
|
84
84
|
*/
|
|
85
85
|
let T;
|
|
86
|
-
class
|
|
86
|
+
class Ne {
|
|
87
87
|
constructor(n) {
|
|
88
88
|
T = n;
|
|
89
89
|
}
|
|
90
|
-
parse(n,
|
|
90
|
+
parse(n, u) {
|
|
91
91
|
const s = Object.assign({
|
|
92
92
|
alias: void 0,
|
|
93
93
|
array: void 0,
|
|
@@ -105,7 +105,7 @@ class Nt {
|
|
|
105
105
|
number: void 0,
|
|
106
106
|
__: void 0,
|
|
107
107
|
key: void 0
|
|
108
|
-
},
|
|
108
|
+
}, u), r = ze(n), h = typeof n == "string", k = Oe(Object.assign(/* @__PURE__ */ Object.create(null), s.alias)), _ = Object.assign({
|
|
109
109
|
"boolean-negation": !0,
|
|
110
110
|
"camel-case-expansion": !0,
|
|
111
111
|
"combine-arrays": !1,
|
|
@@ -124,7 +124,7 @@ class Nt {
|
|
|
124
124
|
"strip-aliased": !1,
|
|
125
125
|
"strip-dashed": !1,
|
|
126
126
|
"unknown-options-as-args": !1
|
|
127
|
-
}, s.configuration), q = Object.assign(/* @__PURE__ */ Object.create(null), s.default),
|
|
127
|
+
}, s.configuration), q = Object.assign(/* @__PURE__ */ Object.create(null), s.default), M = s.configObjects || [], B = s.envPrefix, S = _["populate--"], A = S ? "--" : "_", G = /* @__PURE__ */ Object.create(null), oe = /* @__PURE__ */ Object.create(null), C = s.__ || T.format, m = {
|
|
128
128
|
aliases: /* @__PURE__ */ Object.create(null),
|
|
129
129
|
arrays: /* @__PURE__ */ Object.create(null),
|
|
130
130
|
bools: /* @__PURE__ */ Object.create(null),
|
|
@@ -136,73 +136,73 @@ class Nt {
|
|
|
136
136
|
nargs: /* @__PURE__ */ Object.create(null),
|
|
137
137
|
coercions: /* @__PURE__ */ Object.create(null),
|
|
138
138
|
keys: []
|
|
139
|
-
},
|
|
140
|
-
[].concat(s.array || []).filter(Boolean).forEach(function(
|
|
141
|
-
const a = typeof
|
|
139
|
+
}, Q = /^-([0-9]+(\.[0-9]+)?|\.[0-9]+)$/, W = new RegExp("^--" + _["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) {
|
|
142
142
|
return {
|
|
143
143
|
boolean: "bools",
|
|
144
144
|
string: "strings",
|
|
145
145
|
number: "numbers"
|
|
146
146
|
}[o];
|
|
147
147
|
}).filter(Boolean).pop();
|
|
148
|
-
c && (
|
|
149
|
-
}), [].concat(s.boolean || []).filter(Boolean).forEach(function(
|
|
150
|
-
|
|
151
|
-
}), [].concat(s.string || []).filter(Boolean).forEach(function(
|
|
152
|
-
|
|
153
|
-
}), [].concat(s.number || []).filter(Boolean).forEach(function(
|
|
154
|
-
|
|
155
|
-
}), [].concat(s.count || []).filter(Boolean).forEach(function(
|
|
156
|
-
|
|
157
|
-
}), [].concat(s.normalize || []).filter(Boolean).forEach(function(
|
|
158
|
-
|
|
159
|
-
}), typeof s.narg == "object" && Object.entries(s.narg).forEach(([
|
|
160
|
-
typeof a == "number" && (
|
|
161
|
-
}), typeof s.coerce == "object" && Object.entries(s.coerce).forEach(([
|
|
162
|
-
typeof a == "function" && (
|
|
163
|
-
}), typeof s.config < "u" && (Array.isArray(s.config) || typeof s.config == "string" ? [].concat(s.config).filter(Boolean).forEach(function(
|
|
164
|
-
|
|
165
|
-
}) : typeof s.config == "object" && Object.entries(s.config).forEach(([
|
|
166
|
-
(typeof a == "boolean" || typeof a == "function") && (
|
|
167
|
-
})),
|
|
168
|
-
(
|
|
169
|
-
q[a] = q[
|
|
148
|
+
c && (m[c][a] = !0), m.arrays[a] = !0, m.keys.push(a);
|
|
149
|
+
}), [].concat(s.boolean || []).filter(Boolean).forEach(function(e) {
|
|
150
|
+
m.bools[e] = !0, m.keys.push(e);
|
|
151
|
+
}), [].concat(s.string || []).filter(Boolean).forEach(function(e) {
|
|
152
|
+
m.strings[e] = !0, m.keys.push(e);
|
|
153
|
+
}), [].concat(s.number || []).filter(Boolean).forEach(function(e) {
|
|
154
|
+
m.numbers[e] = !0, m.keys.push(e);
|
|
155
|
+
}), [].concat(s.count || []).filter(Boolean).forEach(function(e) {
|
|
156
|
+
m.counts[e] = !0, m.keys.push(e);
|
|
157
|
+
}), [].concat(s.normalize || []).filter(Boolean).forEach(function(e) {
|
|
158
|
+
m.normalize[e] = !0, m.keys.push(e);
|
|
159
|
+
}), typeof s.narg == "object" && Object.entries(s.narg).forEach(([e, a]) => {
|
|
160
|
+
typeof a == "number" && (m.nargs[e] = a, m.keys.push(e));
|
|
161
|
+
}), typeof s.coerce == "object" && Object.entries(s.coerce).forEach(([e, a]) => {
|
|
162
|
+
typeof a == "function" && (m.coercions[e] = a, m.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
|
+
m.configs[e] = !0;
|
|
165
|
+
}) : typeof s.config == "object" && Object.entries(s.config).forEach(([e, a]) => {
|
|
166
|
+
(typeof a == "boolean" || typeof a == "function") && (m.configs[e] = a);
|
|
167
|
+
})), be(s.key, k, s.default, m.arrays), Object.keys(q).forEach(function(e) {
|
|
168
|
+
(m.aliases[e] || []).forEach(function(a) {
|
|
169
|
+
q[a] = q[e];
|
|
170
170
|
});
|
|
171
171
|
});
|
|
172
172
|
let I = null;
|
|
173
|
-
|
|
173
|
+
ye();
|
|
174
174
|
let j = [];
|
|
175
|
-
const w = Object.assign(/* @__PURE__ */ Object.create(null), { _: [] }),
|
|
176
|
-
for (let
|
|
177
|
-
const a =
|
|
178
|
-
let o,
|
|
179
|
-
if (a !== "--" && /^-/.test(a) &&
|
|
175
|
+
const w = Object.assign(/* @__PURE__ */ Object.create(null), { _: [] }), ne = {};
|
|
176
|
+
for (let e = 0; e < r.length; e++) {
|
|
177
|
+
const a = r[e], c = a.replace(/^-{3,}/, "---");
|
|
178
|
+
let o, t, l, p, d, v;
|
|
179
|
+
if (a !== "--" && /^-/.test(a) && K(a))
|
|
180
180
|
U(a);
|
|
181
181
|
else if (c.match(/^---+(=|$)/)) {
|
|
182
182
|
U(a);
|
|
183
183
|
continue;
|
|
184
184
|
} else if (a.match(/^--.+=/) || !_["short-option-groups"] && a.match(/^-.+=/))
|
|
185
|
-
p = a.match(/^--?([^=]+)=([\s\S]*)$/), p !== null && Array.isArray(p) && p.length >= 3 && (g(p[1],
|
|
185
|
+
p = a.match(/^--?([^=]+)=([\s\S]*)$/), p !== null && Array.isArray(p) && p.length >= 3 && (g(p[1], m.arrays) ? e = F(e, p[1], r, p[2]) : g(p[1], m.nargs) !== !1 ? e = V(e, p[1], r, p[2]) : b(p[1], p[2], !0));
|
|
186
186
|
else if (a.match(W) && _["boolean-negation"])
|
|
187
|
-
p = a.match(W), p !== null && Array.isArray(p) && p.length >= 2 && (
|
|
187
|
+
p = a.match(W), p !== null && Array.isArray(p) && p.length >= 2 && (t = p[1], b(t, g(t, m.arrays) ? [!1] : !1));
|
|
188
188
|
else if (a.match(/^--.+/) || !_["short-option-groups"] && a.match(/^-[^-]+/))
|
|
189
|
-
p = a.match(/^--?(.+)/), p !== null && Array.isArray(p) && p.length >= 2 && (
|
|
189
|
+
p = a.match(/^--?(.+)/), p !== null && Array.isArray(p) && p.length >= 2 && (t = p[1], g(t, m.arrays) ? e = F(e, t, r) : g(t, m.nargs) !== !1 ? e = V(e, t, r) : (d = r[e + 1], d !== void 0 && (!d.match(/^-/) || d.match(Q)) && !g(t, m.bools) && !g(t, m.counts) || /^(true|false)$/.test(d) ? (b(t, d), e++) : b(t, z(t))));
|
|
190
190
|
else if (a.match(/^-.\..+=/))
|
|
191
191
|
p = a.match(/^-([^=]+)=([\s\S]*)$/), p !== null && Array.isArray(p) && p.length >= 3 && b(p[1], p[2]);
|
|
192
|
-
else if (a.match(/^-.\..+/) && !a.match(
|
|
193
|
-
d =
|
|
194
|
-
else if (a.match(/^-[^-]+/) && !a.match(
|
|
192
|
+
else if (a.match(/^-.\..+/) && !a.match(Q))
|
|
193
|
+
d = r[e + 1], p = a.match(/^-(.\..+)/), p !== null && Array.isArray(p) && p.length >= 2 && (t = p[1], d !== void 0 && !d.match(/^-/) && !g(t, m.bools) && !g(t, m.counts) ? (b(t, d), e++) : b(t, z(t)));
|
|
194
|
+
else if (a.match(/^-[^-]+/) && !a.match(Q)) {
|
|
195
195
|
l = a.slice(1, -1).split(""), o = !1;
|
|
196
196
|
for (let x = 0; x < l.length; x++) {
|
|
197
197
|
if (d = a.slice(x + 2), l[x + 1] && l[x + 1] === "=") {
|
|
198
|
-
v = a.slice(x + 3),
|
|
198
|
+
v = a.slice(x + 3), t = l[x], g(t, m.arrays) ? e = F(e, t, r, v) : g(t, m.nargs) !== !1 ? e = V(e, t, r, v) : b(t, v), o = !0;
|
|
199
199
|
break;
|
|
200
200
|
}
|
|
201
201
|
if (d === "-") {
|
|
202
202
|
b(l[x], d);
|
|
203
203
|
continue;
|
|
204
204
|
}
|
|
205
|
-
if (/[A-Za-z]/.test(l[x]) && /^-?\d+(\.\d*)?(e-?\d+)?$/.test(d) && g(d,
|
|
205
|
+
if (/[A-Za-z]/.test(l[x]) && /^-?\d+(\.\d*)?(e-?\d+)?$/.test(d) && g(d, m.bools) === !1) {
|
|
206
206
|
b(l[x], d), o = !0;
|
|
207
207
|
break;
|
|
208
208
|
}
|
|
@@ -210,84 +210,84 @@ class Nt {
|
|
|
210
210
|
b(l[x], d), o = !0;
|
|
211
211
|
break;
|
|
212
212
|
} else
|
|
213
|
-
b(l[x],
|
|
213
|
+
b(l[x], z(l[x]));
|
|
214
214
|
}
|
|
215
|
-
|
|
216
|
-
} else if (a.match(/^-[0-9]$/) && a.match(
|
|
217
|
-
|
|
215
|
+
t = a.slice(-1)[0], !o && t !== "-" && (g(t, m.arrays) ? e = F(e, t, r) : g(t, m.nargs) !== !1 ? e = V(e, t, r) : (d = r[e + 1], d !== void 0 && (!/^(-|--)[^-]/.test(d) || d.match(Q)) && !g(t, m.bools) && !g(t, m.counts) || /^(true|false)$/.test(d) ? (b(t, d), e++) : b(t, z(t))));
|
|
216
|
+
} else if (a.match(/^-[0-9]$/) && a.match(Q) && g(a.slice(1), m.bools))
|
|
217
|
+
t = a.slice(1), b(t, z(t));
|
|
218
218
|
else if (a === "--") {
|
|
219
|
-
j =
|
|
219
|
+
j = r.slice(e + 1);
|
|
220
220
|
break;
|
|
221
221
|
} else if (_["halt-at-non-option"]) {
|
|
222
|
-
j =
|
|
222
|
+
j = r.slice(e);
|
|
223
223
|
break;
|
|
224
224
|
} else
|
|
225
225
|
U(a);
|
|
226
226
|
}
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
}),
|
|
230
|
-
w[
|
|
231
|
-
}), _["camel-case-expansion"] && _["strip-dashed"] && Object.keys(w).filter((
|
|
232
|
-
delete w[
|
|
233
|
-
}), _["strip-aliased"] && [].concat(...Object.keys(
|
|
234
|
-
_["camel-case-expansion"] &&
|
|
227
|
+
re(w, !0), re(w, !1), ke(w), ge(), me(w, m.aliases, q, !0), qe(w), _["set-placeholder-key"] && fe(w), Object.keys(m.counts).forEach(function(e) {
|
|
228
|
+
N(w, e.split(".")) || b(e, 0);
|
|
229
|
+
}), S && j.length && (w[A] = []), j.forEach(function(e) {
|
|
230
|
+
w[A].push(e);
|
|
231
|
+
}), _["camel-case-expansion"] && _["strip-dashed"] && Object.keys(w).filter((e) => e !== "--" && e.includes("-")).forEach((e) => {
|
|
232
|
+
delete w[e];
|
|
233
|
+
}), _["strip-aliased"] && [].concat(...Object.keys(k).map((e) => k[e])).forEach((e) => {
|
|
234
|
+
_["camel-case-expansion"] && e.includes("-") && delete w[e.split(".").map((a) => $(a)).join(".")], delete w[e];
|
|
235
235
|
});
|
|
236
|
-
function U(
|
|
237
|
-
const a = H("_",
|
|
236
|
+
function U(e) {
|
|
237
|
+
const a = H("_", e);
|
|
238
238
|
(typeof a == "string" || typeof a == "number") && w._.push(a);
|
|
239
239
|
}
|
|
240
|
-
function V(
|
|
241
|
-
let
|
|
240
|
+
function V(e, a, c, o) {
|
|
241
|
+
let t, l = g(a, m.nargs);
|
|
242
242
|
if (l = typeof l != "number" || isNaN(l) ? 1 : l, l === 0)
|
|
243
|
-
return
|
|
244
|
-
let p =
|
|
243
|
+
return P(o) || (I = Error(C("Argument unexpected for: %s", a))), b(a, z(a)), e;
|
|
244
|
+
let p = P(o) ? 0 : 1;
|
|
245
245
|
if (_["nargs-eats-options"])
|
|
246
|
-
c.length - (
|
|
246
|
+
c.length - (e + 1) + p < l && (I = Error(C("Not enough arguments following: %s", a))), p = l;
|
|
247
247
|
else {
|
|
248
|
-
for (
|
|
248
|
+
for (t = e + 1; t < c.length && (!c[t].match(/^-[^0-9]/) || c[t].match(Q) || K(c[t])); t++)
|
|
249
249
|
p++;
|
|
250
|
-
p < l && (I = Error(
|
|
250
|
+
p < l && (I = Error(C("Not enough arguments following: %s", a)));
|
|
251
251
|
}
|
|
252
252
|
let d = Math.min(p, l);
|
|
253
|
-
for (!
|
|
254
|
-
b(a, c[
|
|
255
|
-
return
|
|
253
|
+
for (!P(o) && d > 0 && (b(a, o), d--), t = e + 1; t < d + e + 1; t++)
|
|
254
|
+
b(a, c[t]);
|
|
255
|
+
return e + d;
|
|
256
256
|
}
|
|
257
|
-
function F(
|
|
258
|
-
let
|
|
259
|
-
const p = g(a,
|
|
260
|
-
if (g(a,
|
|
261
|
-
|
|
262
|
-
else if (
|
|
257
|
+
function F(e, a, c, o) {
|
|
258
|
+
let t = [], l = o || c[e + 1];
|
|
259
|
+
const p = g(a, m.nargs);
|
|
260
|
+
if (g(a, m.bools) && !/^(true|false)$/.test(l))
|
|
261
|
+
t.push(!0);
|
|
262
|
+
else if (P(l) || P(o) && /^-/.test(l) && !Q.test(l) && !K(l)) {
|
|
263
263
|
if (q[a] !== void 0) {
|
|
264
264
|
const d = q[a];
|
|
265
|
-
|
|
265
|
+
t = Array.isArray(d) ? d : [d];
|
|
266
266
|
}
|
|
267
267
|
} else {
|
|
268
|
-
|
|
269
|
-
for (let d =
|
|
270
|
-
|
|
268
|
+
P(o) || t.push(Y(a, o, !0));
|
|
269
|
+
for (let d = e + 1; d < c.length && !(!_["greedy-arrays"] && t.length > 0 || p && typeof p == "number" && t.length >= p || (l = c[d], /^-/.test(l) && !Q.test(l) && !K(l))); d++)
|
|
270
|
+
e = d, t.push(Y(a, l, h));
|
|
271
271
|
}
|
|
272
|
-
return typeof p == "number" && (p &&
|
|
272
|
+
return typeof p == "number" && (p && t.length < p || isNaN(p) && t.length === 0) && (I = Error(C("Not enough arguments following: %s", a))), b(a, t), e;
|
|
273
273
|
}
|
|
274
|
-
function b(
|
|
275
|
-
if (/-/.test(
|
|
276
|
-
const l =
|
|
277
|
-
return
|
|
274
|
+
function b(e, a, c = h) {
|
|
275
|
+
if (/-/.test(e) && _["camel-case-expansion"]) {
|
|
276
|
+
const l = e.split(".").map(function(p) {
|
|
277
|
+
return $(p);
|
|
278
278
|
}).join(".");
|
|
279
|
-
|
|
279
|
+
se(e, l);
|
|
280
280
|
}
|
|
281
|
-
const o = Y(
|
|
282
|
-
|
|
281
|
+
const o = Y(e, a, c), t = e.split(".");
|
|
282
|
+
O(w, t, o), m.aliases[e] && m.aliases[e].forEach(function(l) {
|
|
283
283
|
const p = l.split(".");
|
|
284
|
-
|
|
285
|
-
}),
|
|
284
|
+
O(w, p, o);
|
|
285
|
+
}), t.length > 1 && _["dot-notation"] && (m.aliases[t[0]] || []).forEach(function(l) {
|
|
286
286
|
let p = l.split(".");
|
|
287
|
-
const d = [].concat(
|
|
288
|
-
d.shift(), p = p.concat(d), (
|
|
289
|
-
}), g(
|
|
290
|
-
Object.defineProperty(
|
|
287
|
+
const d = [].concat(t);
|
|
288
|
+
d.shift(), p = p.concat(d), (m.aliases[e] || []).includes(p.join(".")) || O(w, p, o);
|
|
289
|
+
}), g(e, m.normalize) && !g(e, m.arrays) && [e].concat(m.aliases[e] || []).forEach(function(p) {
|
|
290
|
+
Object.defineProperty(ne, p, {
|
|
291
291
|
enumerable: !0,
|
|
292
292
|
get() {
|
|
293
293
|
return a;
|
|
@@ -298,233 +298,233 @@ class Nt {
|
|
|
298
298
|
});
|
|
299
299
|
});
|
|
300
300
|
}
|
|
301
|
-
function
|
|
302
|
-
|
|
301
|
+
function se(e, a) {
|
|
302
|
+
m.aliases[e] && m.aliases[e].length || (m.aliases[e] = [a], G[a] = !0), m.aliases[a] && m.aliases[a].length || se(a, e);
|
|
303
303
|
}
|
|
304
|
-
function Y(
|
|
305
|
-
c && (a =
|
|
306
|
-
let o = Array.isArray(a) ? a.map(function(
|
|
307
|
-
return H(
|
|
308
|
-
}) : H(
|
|
309
|
-
return g(
|
|
304
|
+
function Y(e, a, c) {
|
|
305
|
+
c && (a = Ee(a)), (g(e, m.bools) || g(e, m.counts)) && typeof a == "string" && (a = a === "true");
|
|
306
|
+
let o = Array.isArray(a) ? a.map(function(t) {
|
|
307
|
+
return H(e, t);
|
|
308
|
+
}) : H(e, a);
|
|
309
|
+
return g(e, m.counts) && (P(o) || typeof o == "boolean") && (o = Z()), g(e, m.normalize) && g(e, m.arrays) && (Array.isArray(a) ? o = a.map((t) => T.normalize(t)) : o = T.normalize(a)), o;
|
|
310
310
|
}
|
|
311
|
-
function H(
|
|
312
|
-
return !_["parse-positional-numbers"] &&
|
|
311
|
+
function H(e, a) {
|
|
312
|
+
return !_["parse-positional-numbers"] && e === "_" || !g(e, m.strings) && !g(e, m.bools) && !Array.isArray(a) && (Re(a) && _["parse-numbers"] && Number.isSafeInteger(Math.floor(parseFloat(`${a}`))) || !P(a) && g(e, m.numbers)) && (a = Number(a)), a;
|
|
313
313
|
}
|
|
314
|
-
function
|
|
314
|
+
function ke(e) {
|
|
315
315
|
const a = /* @__PURE__ */ Object.create(null);
|
|
316
|
-
|
|
317
|
-
const o =
|
|
316
|
+
me(a, m.aliases, q), Object.keys(m.configs).forEach(function(c) {
|
|
317
|
+
const o = e[c] || a[c];
|
|
318
318
|
if (o)
|
|
319
319
|
try {
|
|
320
|
-
let
|
|
321
|
-
const l = T.resolve(T.cwd(), o), p =
|
|
320
|
+
let t = null;
|
|
321
|
+
const l = T.resolve(T.cwd(), o), p = m.configs[c];
|
|
322
322
|
if (typeof p == "function") {
|
|
323
323
|
try {
|
|
324
|
-
|
|
324
|
+
t = p(l);
|
|
325
325
|
} catch (d) {
|
|
326
|
-
|
|
326
|
+
t = d;
|
|
327
327
|
}
|
|
328
|
-
if (
|
|
329
|
-
I =
|
|
328
|
+
if (t instanceof Error) {
|
|
329
|
+
I = t;
|
|
330
330
|
return;
|
|
331
331
|
}
|
|
332
332
|
} else
|
|
333
|
-
|
|
334
|
-
J(
|
|
335
|
-
} catch (
|
|
336
|
-
|
|
333
|
+
t = T.require(l);
|
|
334
|
+
J(t);
|
|
335
|
+
} catch (t) {
|
|
336
|
+
t.name === "PermissionDenied" ? I = t : e[c] && (I = Error(C("Invalid JSON config file: %s", o)));
|
|
337
337
|
}
|
|
338
338
|
});
|
|
339
339
|
}
|
|
340
|
-
function J(
|
|
341
|
-
Object.keys(
|
|
342
|
-
const o =
|
|
343
|
-
typeof o == "object" && o !== null && !Array.isArray(o) && _["dot-notation"] ? J(o,
|
|
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) && _["dot-notation"] ? J(o, t) : (!N(w, t.split(".")) || g(t, m.arrays) && _["combine-arrays"]) && b(t, o);
|
|
344
344
|
});
|
|
345
345
|
}
|
|
346
|
-
function
|
|
347
|
-
typeof
|
|
348
|
-
J(
|
|
346
|
+
function ge() {
|
|
347
|
+
typeof M < "u" && M.forEach(function(e) {
|
|
348
|
+
J(e);
|
|
349
349
|
});
|
|
350
350
|
}
|
|
351
|
-
function
|
|
352
|
-
if (typeof
|
|
351
|
+
function re(e, a) {
|
|
352
|
+
if (typeof B > "u")
|
|
353
353
|
return;
|
|
354
|
-
const c = typeof
|
|
355
|
-
Object.keys(o).forEach(function(
|
|
356
|
-
if (c === "" ||
|
|
357
|
-
const l =
|
|
358
|
-
return d === 0 && (p = p.substring(c.length)),
|
|
354
|
+
const c = typeof B == "string" ? B : "", o = T.env();
|
|
355
|
+
Object.keys(o).forEach(function(t) {
|
|
356
|
+
if (c === "" || t.lastIndexOf(c, 0) === 0) {
|
|
357
|
+
const l = t.split("__").map(function(p, d) {
|
|
358
|
+
return d === 0 && (p = p.substring(c.length)), $(p);
|
|
359
359
|
});
|
|
360
|
-
(a &&
|
|
360
|
+
(a && m.configs[l.join(".")] || !a) && !N(e, l) && b(l.join("."), o[t]);
|
|
361
361
|
}
|
|
362
362
|
});
|
|
363
363
|
}
|
|
364
|
-
function
|
|
364
|
+
function qe(e) {
|
|
365
365
|
let a;
|
|
366
366
|
const c = /* @__PURE__ */ new Set();
|
|
367
|
-
Object.keys(
|
|
368
|
-
if (!c.has(o) && (a = g(o,
|
|
367
|
+
Object.keys(e).forEach(function(o) {
|
|
368
|
+
if (!c.has(o) && (a = g(o, m.coercions), typeof a == "function"))
|
|
369
369
|
try {
|
|
370
|
-
const
|
|
371
|
-
[].concat(
|
|
372
|
-
c.add(l),
|
|
370
|
+
const t = H(o, a(e[o]));
|
|
371
|
+
[].concat(m.aliases[o] || [], o).forEach((l) => {
|
|
372
|
+
c.add(l), e[l] = t;
|
|
373
373
|
});
|
|
374
|
-
} catch (
|
|
375
|
-
I =
|
|
374
|
+
} catch (t) {
|
|
375
|
+
I = t;
|
|
376
376
|
}
|
|
377
377
|
});
|
|
378
378
|
}
|
|
379
|
-
function
|
|
380
|
-
return
|
|
381
|
-
~a.indexOf(".") || typeof
|
|
382
|
-
}),
|
|
379
|
+
function fe(e) {
|
|
380
|
+
return m.keys.forEach((a) => {
|
|
381
|
+
~a.indexOf(".") || typeof e[a] > "u" && (e[a] = void 0);
|
|
382
|
+
}), e;
|
|
383
383
|
}
|
|
384
|
-
function
|
|
385
|
-
Object.keys(c).forEach(function(
|
|
386
|
-
|
|
387
|
-
|
|
384
|
+
function me(e, a, c, o = !1) {
|
|
385
|
+
Object.keys(c).forEach(function(t) {
|
|
386
|
+
N(e, t.split(".")) || (O(e, t.split("."), c[t]), o && (oe[t] = !0), (a[t] || []).forEach(function(l) {
|
|
387
|
+
N(e, l.split(".")) || O(e, l.split("."), c[t]);
|
|
388
388
|
}));
|
|
389
389
|
});
|
|
390
390
|
}
|
|
391
|
-
function
|
|
392
|
-
let c =
|
|
393
|
-
_["dot-notation"] || (a = [a.join(".")]), a.slice(0, -1).forEach(function(
|
|
394
|
-
c = c[
|
|
391
|
+
function N(e, a) {
|
|
392
|
+
let c = e;
|
|
393
|
+
_["dot-notation"] || (a = [a.join(".")]), a.slice(0, -1).forEach(function(t) {
|
|
394
|
+
c = c[t] || {};
|
|
395
395
|
});
|
|
396
396
|
const o = a[a.length - 1];
|
|
397
397
|
return typeof c != "object" ? !1 : o in c;
|
|
398
398
|
}
|
|
399
|
-
function
|
|
400
|
-
let o =
|
|
399
|
+
function O(e, a, c) {
|
|
400
|
+
let o = e;
|
|
401
401
|
_["dot-notation"] || (a = [a.join(".")]), a.slice(0, -1).forEach(function(v) {
|
|
402
|
-
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];
|
|
403
403
|
});
|
|
404
|
-
const
|
|
404
|
+
const t = ce(a[a.length - 1]), l = g(a.join("."), m.arrays), p = Array.isArray(c);
|
|
405
405
|
let d = _["duplicate-arguments-array"];
|
|
406
|
-
!d && g(
|
|
406
|
+
!d && g(t, m.nargs) && (d = !0, (!P(o[t]) && m.nargs[t] === 1 || Array.isArray(o[t]) && o[t].length === m.nargs[t]) && (o[t] = void 0)), c === Z() ? o[t] = Z(o[t]) : Array.isArray(o[t]) ? d && l && p ? o[t] = _["flatten-duplicate-arrays"] ? o[t].concat(c) : (Array.isArray(o[t][0]) ? o[t] : [o[t]]).concat([c]) : !d && !!l == !!p ? o[t] = c : o[t] = o[t].concat([c]) : o[t] === void 0 && l ? o[t] = p ? c : [c] : d && !(o[t] === void 0 || g(t, m.counts) || g(t, m.bools)) ? o[t] = [o[t], c] : o[t] = c;
|
|
407
407
|
}
|
|
408
|
-
function
|
|
409
|
-
|
|
408
|
+
function be(...e) {
|
|
409
|
+
e.forEach(function(a) {
|
|
410
410
|
Object.keys(a || {}).forEach(function(c) {
|
|
411
|
-
|
|
411
|
+
m.aliases[c] || (m.aliases[c] = [].concat(k[c] || []), m.aliases[c].concat(c).forEach(function(o) {
|
|
412
412
|
if (/-/.test(o) && _["camel-case-expansion"]) {
|
|
413
|
-
const
|
|
414
|
-
|
|
413
|
+
const t = $(o);
|
|
414
|
+
t !== c && m.aliases[c].indexOf(t) === -1 && (m.aliases[c].push(t), G[t] = !0);
|
|
415
415
|
}
|
|
416
|
-
}),
|
|
416
|
+
}), m.aliases[c].concat(c).forEach(function(o) {
|
|
417
417
|
if (o.length > 1 && /[A-Z]/.test(o) && _["camel-case-expansion"]) {
|
|
418
|
-
const
|
|
419
|
-
|
|
418
|
+
const t = Ce(o, "-");
|
|
419
|
+
t !== c && m.aliases[c].indexOf(t) === -1 && (m.aliases[c].push(t), G[t] = !0);
|
|
420
420
|
}
|
|
421
|
-
}),
|
|
422
|
-
|
|
423
|
-
return o !==
|
|
421
|
+
}), m.aliases[c].forEach(function(o) {
|
|
422
|
+
m.aliases[o] = [c].concat(m.aliases[c].filter(function(t) {
|
|
423
|
+
return o !== t;
|
|
424
424
|
}));
|
|
425
425
|
}));
|
|
426
426
|
});
|
|
427
427
|
});
|
|
428
428
|
}
|
|
429
|
-
function g(
|
|
430
|
-
const c = [].concat(
|
|
431
|
-
return
|
|
429
|
+
function g(e, a) {
|
|
430
|
+
const c = [].concat(m.aliases[e] || [], e), o = Object.keys(a), t = c.find((l) => o.includes(l));
|
|
431
|
+
return t ? a[t] : !1;
|
|
432
432
|
}
|
|
433
|
-
function
|
|
434
|
-
const a = Object.keys(
|
|
435
|
-
return [].concat(a.map((o) =>
|
|
436
|
-
return Array.isArray(o) ? o.includes(
|
|
433
|
+
function ue(e) {
|
|
434
|
+
const a = Object.keys(m);
|
|
435
|
+
return [].concat(a.map((o) => m[o])).some(function(o) {
|
|
436
|
+
return Array.isArray(o) ? o.includes(e) : o[e];
|
|
437
437
|
});
|
|
438
438
|
}
|
|
439
|
-
function
|
|
439
|
+
function we(e, ...a) {
|
|
440
440
|
return [].concat(...a).some(function(o) {
|
|
441
|
-
const
|
|
442
|
-
return
|
|
441
|
+
const t = e.match(o);
|
|
442
|
+
return t && ue(t[1]);
|
|
443
443
|
});
|
|
444
444
|
}
|
|
445
|
-
function
|
|
446
|
-
if (
|
|
445
|
+
function ve(e) {
|
|
446
|
+
if (e.match(Q) || !e.match(/^-[^-]+/))
|
|
447
447
|
return !1;
|
|
448
448
|
let a = !0, c;
|
|
449
|
-
const o =
|
|
450
|
-
for (let
|
|
451
|
-
if (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])) {
|
|
452
452
|
a = !1;
|
|
453
453
|
break;
|
|
454
454
|
}
|
|
455
|
-
if (o[
|
|
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/))
|
|
456
456
|
break;
|
|
457
457
|
}
|
|
458
458
|
return a;
|
|
459
459
|
}
|
|
460
|
-
function
|
|
461
|
-
return _["unknown-options-as-args"] &&
|
|
460
|
+
function K(e) {
|
|
461
|
+
return _["unknown-options-as-args"] && xe(e);
|
|
462
462
|
}
|
|
463
|
-
function
|
|
464
|
-
return
|
|
463
|
+
function xe(e) {
|
|
464
|
+
return e = e.replace(/^-{3,}/, "--"), e.match(Q) || ve(e) ? !1 : !we(e, /^-+([^=]+?)=[\s\S]*$/, W, /^-+([^=]+?)$/, /^-+([^=]+?)-$/, /^-+([^=]+?\d+)$/, /^-+([^=]+?)\W+.*$/);
|
|
465
465
|
}
|
|
466
|
-
function
|
|
467
|
-
return !g(
|
|
466
|
+
function z(e) {
|
|
467
|
+
return !g(e, m.bools) && !g(e, m.counts) && `${e}` in q ? q[e] : Be(Ie(e));
|
|
468
468
|
}
|
|
469
|
-
function
|
|
469
|
+
function Be(e) {
|
|
470
470
|
return {
|
|
471
471
|
[L.BOOLEAN]: !0,
|
|
472
472
|
[L.STRING]: "",
|
|
473
473
|
[L.NUMBER]: void 0,
|
|
474
474
|
[L.ARRAY]: []
|
|
475
|
-
}[
|
|
475
|
+
}[e];
|
|
476
476
|
}
|
|
477
|
-
function
|
|
477
|
+
function Ie(e) {
|
|
478
478
|
let a = L.BOOLEAN;
|
|
479
|
-
return g(
|
|
479
|
+
return g(e, m.strings) ? a = L.STRING : g(e, m.numbers) ? a = L.NUMBER : g(e, m.bools) ? a = L.BOOLEAN : g(e, m.arrays) && (a = L.ARRAY), a;
|
|
480
480
|
}
|
|
481
|
-
function
|
|
482
|
-
return
|
|
481
|
+
function P(e) {
|
|
482
|
+
return e === void 0;
|
|
483
483
|
}
|
|
484
|
-
function
|
|
485
|
-
Object.keys(
|
|
484
|
+
function ye() {
|
|
485
|
+
Object.keys(m.counts).find((e) => g(e, m.arrays) ? (I = Error(C("Invalid configuration: %s, opts.count excludes opts.array.", e)), !0) : g(e, m.nargs) ? (I = Error(C("Invalid configuration: %s, opts.count excludes opts.narg.", e)), !0) : !1);
|
|
486
486
|
}
|
|
487
487
|
return {
|
|
488
|
-
aliases: Object.assign({},
|
|
489
|
-
argv: Object.assign(
|
|
488
|
+
aliases: Object.assign({}, m.aliases),
|
|
489
|
+
argv: Object.assign(ne, w),
|
|
490
490
|
configuration: _,
|
|
491
|
-
defaulted: Object.assign({},
|
|
491
|
+
defaulted: Object.assign({}, oe),
|
|
492
492
|
error: I,
|
|
493
|
-
newAliases: Object.assign({},
|
|
493
|
+
newAliases: Object.assign({}, G)
|
|
494
494
|
};
|
|
495
495
|
}
|
|
496
496
|
}
|
|
497
|
-
function
|
|
498
|
-
const n = [],
|
|
497
|
+
function Oe(i) {
|
|
498
|
+
const n = [], u = /* @__PURE__ */ Object.create(null);
|
|
499
499
|
let s = !0;
|
|
500
|
-
for (Object.keys(i).forEach(function(
|
|
501
|
-
n.push([].concat(i[
|
|
500
|
+
for (Object.keys(i).forEach(function(r) {
|
|
501
|
+
n.push([].concat(i[r], r));
|
|
502
502
|
}); s; ) {
|
|
503
503
|
s = !1;
|
|
504
|
-
for (let
|
|
505
|
-
for (let
|
|
506
|
-
if (n[
|
|
507
|
-
return n[
|
|
504
|
+
for (let r = 0; r < n.length; r++)
|
|
505
|
+
for (let h = r + 1; h < n.length; h++)
|
|
506
|
+
if (n[r].filter(function(_) {
|
|
507
|
+
return n[h].indexOf(_) !== -1;
|
|
508
508
|
}).length) {
|
|
509
|
-
n[
|
|
509
|
+
n[r] = n[r].concat(n[h]), n.splice(h, 1), s = !0;
|
|
510
510
|
break;
|
|
511
511
|
}
|
|
512
512
|
}
|
|
513
|
-
return n.forEach(function(
|
|
514
|
-
|
|
515
|
-
return q.indexOf(
|
|
513
|
+
return n.forEach(function(r) {
|
|
514
|
+
r = r.filter(function(k, _, q) {
|
|
515
|
+
return q.indexOf(k) === _;
|
|
516
516
|
});
|
|
517
|
-
const
|
|
518
|
-
|
|
519
|
-
}),
|
|
517
|
+
const h = r.pop();
|
|
518
|
+
h !== void 0 && typeof h == "string" && (u[h] = r);
|
|
519
|
+
}), u;
|
|
520
520
|
}
|
|
521
521
|
function Z(i) {
|
|
522
522
|
return i !== void 0 ? i + 1 : 1;
|
|
523
523
|
}
|
|
524
|
-
function
|
|
524
|
+
function ce(i) {
|
|
525
525
|
return i === "__proto__" ? "___proto___" : i;
|
|
526
526
|
}
|
|
527
|
-
function
|
|
527
|
+
function Ee(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,76 +535,76 @@ function Et(i) {
|
|
|
535
535
|
* Copyright (c) 2016, Contributors
|
|
536
536
|
* SPDX-License-Identifier: ISC
|
|
537
537
|
*/
|
|
538
|
-
var X,
|
|
539
|
-
const
|
|
540
|
-
if (
|
|
541
|
-
throw Error(`yargs parser supports a minimum Node.js version of ${
|
|
542
|
-
const
|
|
543
|
-
new
|
|
538
|
+
var X, ee, te;
|
|
539
|
+
const pe = process && process.env && process.env.YARGS_MIN_NODE_VERSION ? Number(process.env.YARGS_MIN_NODE_VERSION) : 12, le = (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 (le && Number(le.match(/^([^.]+)/)[1]) < pe)
|
|
541
|
+
throw Error(`yargs parser supports a minimum Node.js version of ${pe}. Read our version support policy: https://github.com/yargs/yargs-parser#supported-nodejs-versions`);
|
|
542
|
+
const De = process ? process.env : {};
|
|
543
|
+
new Ne({
|
|
544
544
|
cwd: process.cwd,
|
|
545
|
-
env: () =>
|
|
546
|
-
format:
|
|
547
|
-
normalize:
|
|
548
|
-
resolve:
|
|
545
|
+
env: () => De,
|
|
546
|
+
format: _e,
|
|
547
|
+
normalize: Le,
|
|
548
|
+
resolve: ae,
|
|
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(
|
|
555
|
+
return JSON.parse(he(i, "utf8"));
|
|
556
556
|
throw Error("only .json config files are supported in ESM");
|
|
557
557
|
}
|
|
558
558
|
});
|
|
559
|
-
const
|
|
559
|
+
const je = {
|
|
560
560
|
fs: {
|
|
561
|
-
readFileSync:
|
|
562
|
-
writeFile:
|
|
561
|
+
readFileSync: he,
|
|
562
|
+
writeFile: Me
|
|
563
563
|
},
|
|
564
|
-
format:
|
|
565
|
-
resolve:
|
|
564
|
+
format: _e,
|
|
565
|
+
resolve: ae,
|
|
566
566
|
exists: (i) => {
|
|
567
567
|
try {
|
|
568
|
-
return
|
|
568
|
+
return Qe(i).isFile();
|
|
569
569
|
} catch {
|
|
570
570
|
return !1;
|
|
571
571
|
}
|
|
572
572
|
}
|
|
573
573
|
};
|
|
574
574
|
let y;
|
|
575
|
-
class
|
|
575
|
+
class Ve {
|
|
576
576
|
constructor(n) {
|
|
577
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 = [];
|
|
578
578
|
}
|
|
579
579
|
__(...n) {
|
|
580
580
|
if (typeof arguments[0] != "string")
|
|
581
581
|
return this._taggedLiteral(arguments[0], ...arguments);
|
|
582
|
-
const
|
|
582
|
+
const u = n.shift();
|
|
583
583
|
let s = function() {
|
|
584
584
|
};
|
|
585
585
|
return typeof n[n.length - 1] == "function" && (s = n.pop()), s = s || function() {
|
|
586
|
-
}, this.cache[this.locale] || this._readLocaleFile(), !this.cache[this.locale][
|
|
586
|
+
}, this.cache[this.locale] || this._readLocaleFile(), !this.cache[this.locale][u] && this.updateFiles ? (this.cache[this.locale][u] = u, this._enqueueWrite({
|
|
587
587
|
directory: this.directory,
|
|
588
588
|
locale: this.locale,
|
|
589
589
|
cb: s
|
|
590
|
-
})) : s(), y.format.apply(y.format, [this.cache[this.locale][
|
|
590
|
+
})) : s(), y.format.apply(y.format, [this.cache[this.locale][u] || u].concat(n));
|
|
591
591
|
}
|
|
592
592
|
__n() {
|
|
593
|
-
const n = Array.prototype.slice.call(arguments),
|
|
594
|
-
let
|
|
593
|
+
const n = Array.prototype.slice.call(arguments), u = n.shift(), s = n.shift(), r = n.shift();
|
|
594
|
+
let h = function() {
|
|
595
595
|
};
|
|
596
|
-
typeof n[n.length - 1] == "function" && (
|
|
597
|
-
let
|
|
598
|
-
this.cache[this.locale][
|
|
599
|
-
one:
|
|
596
|
+
typeof n[n.length - 1] == "function" && (h = n.pop()), this.cache[this.locale] || this._readLocaleFile();
|
|
597
|
+
let k = r === 1 ? u : s;
|
|
598
|
+
this.cache[this.locale][u] && (k = this.cache[this.locale][u][r === 1 ? "one" : "other"]), !this.cache[this.locale][u] && this.updateFiles ? (this.cache[this.locale][u] = {
|
|
599
|
+
one: u,
|
|
600
600
|
other: s
|
|
601
601
|
}, this._enqueueWrite({
|
|
602
602
|
directory: this.directory,
|
|
603
603
|
locale: this.locale,
|
|
604
|
-
cb:
|
|
605
|
-
})) :
|
|
606
|
-
const _ = [
|
|
607
|
-
return ~
|
|
604
|
+
cb: h
|
|
605
|
+
})) : h();
|
|
606
|
+
const _ = [k];
|
|
607
|
+
return ~k.indexOf("%d") && _.push(r), y.format.apply(y.format, _.concat(n));
|
|
608
608
|
}
|
|
609
609
|
setLocale(n) {
|
|
610
610
|
this.locale = n;
|
|
@@ -614,43 +614,43 @@ class Vt {
|
|
|
614
614
|
}
|
|
615
615
|
updateLocale(n) {
|
|
616
616
|
this.cache[this.locale] || this._readLocaleFile();
|
|
617
|
-
for (const
|
|
618
|
-
Object.prototype.hasOwnProperty.call(n,
|
|
617
|
+
for (const u in n)
|
|
618
|
+
Object.prototype.hasOwnProperty.call(n, u) && (this.cache[this.locale][u] = n[u]);
|
|
619
619
|
}
|
|
620
|
-
_taggedLiteral(n, ...
|
|
620
|
+
_taggedLiteral(n, ...u) {
|
|
621
621
|
let s = "";
|
|
622
|
-
return n.forEach(function(
|
|
623
|
-
const
|
|
624
|
-
s +=
|
|
625
|
-
}), this.__.apply(this, [s].concat([].slice.call(
|
|
622
|
+
return n.forEach(function(r, h) {
|
|
623
|
+
const k = u[h + 1];
|
|
624
|
+
s += r, typeof k < "u" && (s += "%s");
|
|
625
|
+
}), this.__.apply(this, [s].concat([].slice.call(u, 1)));
|
|
626
626
|
}
|
|
627
627
|
_enqueueWrite(n) {
|
|
628
628
|
this.writeQueue.push(n), this.writeQueue.length === 1 && this._processWriteQueue();
|
|
629
629
|
}
|
|
630
630
|
_processWriteQueue() {
|
|
631
|
-
const n = this,
|
|
632
|
-
y.fs.writeFile(
|
|
633
|
-
n.writeQueue.shift(), n.writeQueue.length > 0 && n._processWriteQueue(),
|
|
631
|
+
const n = this, u = this.writeQueue[0], s = u.directory, r = u.locale, h = u.cb, k = this._resolveLocaleFile(s, r), _ = JSON.stringify(this.cache[r], null, 2);
|
|
632
|
+
y.fs.writeFile(k, _, "utf-8", function(q) {
|
|
633
|
+
n.writeQueue.shift(), n.writeQueue.length > 0 && n._processWriteQueue(), h(q);
|
|
634
634
|
});
|
|
635
635
|
}
|
|
636
636
|
_readLocaleFile() {
|
|
637
637
|
let n = {};
|
|
638
|
-
const
|
|
638
|
+
const u = this._resolveLocaleFile(this.directory, this.locale);
|
|
639
639
|
try {
|
|
640
|
-
y.fs.readFileSync && (n = JSON.parse(y.fs.readFileSync(
|
|
640
|
+
y.fs.readFileSync && (n = JSON.parse(y.fs.readFileSync(u, "utf-8")));
|
|
641
641
|
} catch (s) {
|
|
642
|
-
if (s instanceof SyntaxError && (s.message = "syntax error in " +
|
|
642
|
+
if (s instanceof SyntaxError && (s.message = "syntax error in " + u), s.code === "ENOENT")
|
|
643
643
|
n = {};
|
|
644
644
|
else
|
|
645
645
|
throw s;
|
|
646
646
|
}
|
|
647
647
|
this.cache[this.locale] = n;
|
|
648
648
|
}
|
|
649
|
-
_resolveLocaleFile(n,
|
|
650
|
-
let s = y.resolve(n, "./",
|
|
651
|
-
if (this.fallbackToLanguage && !this._fileExistsSync(s) && ~
|
|
652
|
-
const
|
|
653
|
-
this._fileExistsSync(
|
|
649
|
+
_resolveLocaleFile(n, u) {
|
|
650
|
+
let s = y.resolve(n, "./", u + ".json");
|
|
651
|
+
if (this.fallbackToLanguage && !this._fileExistsSync(s) && ~u.lastIndexOf("_")) {
|
|
652
|
+
const r = y.resolve(n, "./", u.split("_")[0] + ".json");
|
|
653
|
+
this._fileExistsSync(r) && (s = r);
|
|
654
654
|
}
|
|
655
655
|
return s;
|
|
656
656
|
}
|
|
@@ -658,31 +658,31 @@ class Vt {
|
|
|
658
658
|
return y.exists(n);
|
|
659
659
|
}
|
|
660
660
|
}
|
|
661
|
-
function
|
|
661
|
+
function Fe(i, n) {
|
|
662
662
|
y = n;
|
|
663
|
-
const
|
|
663
|
+
const u = new Ve(i);
|
|
664
664
|
return {
|
|
665
|
-
__:
|
|
666
|
-
__n:
|
|
667
|
-
setLocale:
|
|
668
|
-
getLocale:
|
|
669
|
-
updateLocale:
|
|
670
|
-
locale:
|
|
665
|
+
__: u.__.bind(u),
|
|
666
|
+
__n: u.__n.bind(u),
|
|
667
|
+
setLocale: u.setLocale.bind(u),
|
|
668
|
+
getLocale: u.getLocale.bind(u),
|
|
669
|
+
updateLocale: u.updateLocale.bind(u),
|
|
670
|
+
locale: u.locale
|
|
671
671
|
};
|
|
672
672
|
}
|
|
673
|
-
const
|
|
674
|
-
let
|
|
673
|
+
const He = (i) => Fe(i, je);
|
|
674
|
+
let E;
|
|
675
675
|
try {
|
|
676
|
-
|
|
676
|
+
E = Ae(import.meta.url);
|
|
677
677
|
} catch {
|
|
678
|
-
|
|
678
|
+
E = process.cwd();
|
|
679
679
|
}
|
|
680
|
-
const
|
|
681
|
-
|
|
682
|
-
directory:
|
|
680
|
+
const Ke = E.substring(0, E.lastIndexOf("node_modules"));
|
|
681
|
+
Ke || process.cwd(), process.cwd, process.exit, process.nextTick, typeof process.stdout.columns < "u" && process.stdout.columns, He({
|
|
682
|
+
directory: ae(E, "../../../locales"),
|
|
683
683
|
updateFiles: !1
|
|
684
684
|
});
|
|
685
|
-
const
|
|
685
|
+
const ie = [
|
|
686
686
|
{
|
|
687
687
|
id: "anthropic",
|
|
688
688
|
name: "Anthropic",
|
|
@@ -3922,6 +3922,51 @@ Compared to other leading proprietary and open-weights models Command A delivers
|
|
|
3922
3922
|
}
|
|
3923
3923
|
}
|
|
3924
3924
|
},
|
|
3925
|
+
{
|
|
3926
|
+
id: "gemini-3-flash-preview",
|
|
3927
|
+
name: "Gemini 3 Flash Preview",
|
|
3928
|
+
description: "Google's ultra-fast frontier model optimized for speed and efficiency. Delivers state-of-the-art performance while maintaining low latency and cost, with improved reasoning and coding capabilities.",
|
|
3929
|
+
match: {
|
|
3930
|
+
or: [
|
|
3931
|
+
{
|
|
3932
|
+
equals: "gemini-3-flash-preview"
|
|
3933
|
+
},
|
|
3934
|
+
{
|
|
3935
|
+
starts_with: "gemini-3-flash-preview-"
|
|
3936
|
+
}
|
|
3937
|
+
]
|
|
3938
|
+
},
|
|
3939
|
+
context_window: 1e6,
|
|
3940
|
+
price_comments: "See https://ai.google.dev/gemini-api/docs/pricing. Standard pricing shown; Batch API offers 50% discount on input/output.",
|
|
3941
|
+
prices: {
|
|
3942
|
+
input_mtok: 0.5,
|
|
3943
|
+
cache_read_mtok: 0.05,
|
|
3944
|
+
output_mtok: 3,
|
|
3945
|
+
input_audio_mtok: 1,
|
|
3946
|
+
cache_audio_read_mtok: 0.1
|
|
3947
|
+
}
|
|
3948
|
+
},
|
|
3949
|
+
{
|
|
3950
|
+
id: "gemini-3-pro-image-preview",
|
|
3951
|
+
name: "Gemini 3 Pro Image Preview",
|
|
3952
|
+
description: "Google's image generation model optimized for high-quality image generation. Supports 1K/2K and 4K resolution outputs with flexible pricing based on image dimensions.",
|
|
3953
|
+
match: {
|
|
3954
|
+
or: [
|
|
3955
|
+
{
|
|
3956
|
+
starts_with: "gemini-3-pro-image-preview"
|
|
3957
|
+
},
|
|
3958
|
+
{
|
|
3959
|
+
equals: "gemini-3-pro-image-preview"
|
|
3960
|
+
}
|
|
3961
|
+
]
|
|
3962
|
+
},
|
|
3963
|
+
context_window: 1e6,
|
|
3964
|
+
price_comments: "See https://ai.google.dev/gemini-api/docs/pricing#gemini-3-pro-image. Image output is priced at $120 per 1M tokens, with each 1K/2K image = 1120 tokens = $0.134/image and each 4K image = 2000 tokens = $0.24/image.",
|
|
3965
|
+
prices: {
|
|
3966
|
+
input_mtok: 2,
|
|
3967
|
+
output_mtok: 120
|
|
3968
|
+
}
|
|
3969
|
+
},
|
|
3925
3970
|
{
|
|
3926
3971
|
id: "gemini-3-pro-preview",
|
|
3927
3972
|
name: "Gemini 3 Pro Preview",
|
|
@@ -3932,7 +3977,7 @@ Compared to other leading proprietary and open-weights models Command A delivers
|
|
|
3932
3977
|
starts_with: "gemini-3-pro-preview"
|
|
3933
3978
|
},
|
|
3934
3979
|
{
|
|
3935
|
-
|
|
3980
|
+
equals: "gemini-3-pro-text-preview"
|
|
3936
3981
|
}
|
|
3937
3982
|
]
|
|
3938
3983
|
},
|
|
@@ -18221,104 +18266,169 @@ Compared to other leading proprietary and open-weights models Command A delivers
|
|
|
18221
18266
|
cache_read_mtok: 0.75,
|
|
18222
18267
|
output_mtok: 15
|
|
18223
18268
|
}
|
|
18269
|
+
},
|
|
18270
|
+
{
|
|
18271
|
+
id: "grok-4-1-fast-non-reasoning",
|
|
18272
|
+
name: "Grok 4.1 Fast Non-Reasoning",
|
|
18273
|
+
description: "A frontier multimodal model optimized specifically for high-performance agentic tool calling.",
|
|
18274
|
+
match: {
|
|
18275
|
+
or: [
|
|
18276
|
+
{
|
|
18277
|
+
equals: "grok-4-1-fast-non-reasoning"
|
|
18278
|
+
},
|
|
18279
|
+
{
|
|
18280
|
+
equals: "grok-4-1-fast-non-reasoning-latest"
|
|
18281
|
+
}
|
|
18282
|
+
]
|
|
18283
|
+
},
|
|
18284
|
+
context_window: 2e6,
|
|
18285
|
+
prices: {
|
|
18286
|
+
input_mtok: 0.2,
|
|
18287
|
+
cache_read_mtok: 0.05,
|
|
18288
|
+
output_mtok: 0.5
|
|
18289
|
+
}
|
|
18290
|
+
},
|
|
18291
|
+
{
|
|
18292
|
+
id: "grok-4-1-fast-reasoning",
|
|
18293
|
+
name: "Grok 4.1 Fast Reasoning",
|
|
18294
|
+
description: "A frontier multimodal model optimized specifically for high-performance agentic tool calling.",
|
|
18295
|
+
match: {
|
|
18296
|
+
or: [
|
|
18297
|
+
{
|
|
18298
|
+
equals: "grok-4-1-fast"
|
|
18299
|
+
},
|
|
18300
|
+
{
|
|
18301
|
+
equals: "grok-4-1-fast-reasoning"
|
|
18302
|
+
},
|
|
18303
|
+
{
|
|
18304
|
+
equals: "grok-4-1-fast-reasoning-latest"
|
|
18305
|
+
}
|
|
18306
|
+
]
|
|
18307
|
+
},
|
|
18308
|
+
context_window: 2e6,
|
|
18309
|
+
prices: {
|
|
18310
|
+
input_mtok: 0.2,
|
|
18311
|
+
cache_read_mtok: 0.05,
|
|
18312
|
+
output_mtok: 0.5
|
|
18313
|
+
}
|
|
18314
|
+
},
|
|
18315
|
+
{
|
|
18316
|
+
id: "grok-code-fast-1",
|
|
18317
|
+
name: "Grok Code Fast 1",
|
|
18318
|
+
description: "A speedy and economical reasoning model that excels at agentic coding.",
|
|
18319
|
+
match: {
|
|
18320
|
+
or: [
|
|
18321
|
+
{
|
|
18322
|
+
equals: "grok-code-fast"
|
|
18323
|
+
},
|
|
18324
|
+
{
|
|
18325
|
+
equals: "grok-code-fast-1"
|
|
18326
|
+
},
|
|
18327
|
+
{
|
|
18328
|
+
equals: "grok-code-fast-1-0825"
|
|
18329
|
+
}
|
|
18330
|
+
]
|
|
18331
|
+
},
|
|
18332
|
+
context_window: 256e3,
|
|
18333
|
+
prices: {
|
|
18334
|
+
input_mtok: 0.2,
|
|
18335
|
+
cache_read_mtok: 0.02,
|
|
18336
|
+
output_mtok: 1.5
|
|
18337
|
+
}
|
|
18224
18338
|
}
|
|
18225
18339
|
]
|
|
18226
18340
|
}
|
|
18227
18341
|
];
|
|
18228
|
-
function
|
|
18342
|
+
function $e(i, n, u) {
|
|
18229
18343
|
if (n <= 0) return 0;
|
|
18230
|
-
let
|
|
18231
|
-
const
|
|
18232
|
-
|
|
18233
|
-
|
|
18234
|
-
const _ = s[h], q = s[h + 1]?.start ?? 1 / 0, B = Math.max(0, Math.min(n, q) - _.start);
|
|
18235
|
-
B > 0 && (m += B * _.price / 1e6);
|
|
18236
|
-
}
|
|
18237
|
-
return m;
|
|
18344
|
+
let s = i.base;
|
|
18345
|
+
for (const r of i.tiers)
|
|
18346
|
+
u > r.start && (s = r.price);
|
|
18347
|
+
return s * n / 1e6;
|
|
18238
18348
|
}
|
|
18239
|
-
function
|
|
18240
|
-
return i === void 0 || n === void 0 ? 0 : typeof i == "number" ? i * n / 1e6 :
|
|
18349
|
+
function R(i, n, u, s) {
|
|
18350
|
+
return i === void 0 || n === void 0 ? 0 : typeof i == "number" ? i * n / 1e6 : $e(i, n, s);
|
|
18241
18351
|
}
|
|
18242
|
-
function
|
|
18243
|
-
let
|
|
18244
|
-
const
|
|
18245
|
-
let
|
|
18246
|
-
if (
|
|
18352
|
+
function We(i, n) {
|
|
18353
|
+
let u = 0, s = 0;
|
|
18354
|
+
const r = i.input_tokens ?? 0, h = i.cache_read_tokens ?? 0, k = i.cache_write_tokens ?? 0, _ = i.cache_audio_read_tokens ?? 0, q = i.output_audio_tokens ?? 0;
|
|
18355
|
+
let M = i.input_audio_tokens ?? 0;
|
|
18356
|
+
if (M -= _, M < 0)
|
|
18247
18357
|
throw new Error("cache_audio_read_tokens cannot be greater than input_audio_tokens");
|
|
18248
18358
|
let B = i.input_tokens ?? 0;
|
|
18249
|
-
if (B -=
|
|
18359
|
+
if (B -= h, B -= k, B -= M, B < 0)
|
|
18250
18360
|
throw new Error("Uncached text input tokens cannot be negative");
|
|
18251
|
-
let
|
|
18252
|
-
if (
|
|
18361
|
+
let S = h;
|
|
18362
|
+
if (S -= _, S < 0)
|
|
18253
18363
|
throw new Error("cache_audio_read_tokens cannot be greater than cache_read_tokens");
|
|
18254
|
-
|
|
18255
|
-
let
|
|
18256
|
-
if (
|
|
18364
|
+
u += R(n.input_mtok, B, "input_mtok", r), u += R(n.cache_read_mtok, S, "cache_read_mtok", r), u += R(n.cache_write_mtok, k, "cache_write_mtok", r), u += R(n.input_audio_mtok, M, "input_audio_mtok", r), u += R(n.cache_audio_read_mtok, _, "cache_audio_read_mtok", r);
|
|
18365
|
+
let A = i.output_tokens ?? 0;
|
|
18366
|
+
if (A -= q, A < 0)
|
|
18257
18367
|
throw new Error("output_audio_tokens cannot be greater than output_tokens");
|
|
18258
|
-
s +=
|
|
18259
|
-
let
|
|
18260
|
-
return n.requests_kcount !== void 0 && (
|
|
18261
|
-
input_price:
|
|
18368
|
+
s += R(n.output_mtok, A, "output_mtok", r), s += R(n.output_audio_mtok, i.output_audio_tokens, "output_audio_mtok", r);
|
|
18369
|
+
let G = u + s;
|
|
18370
|
+
return n.requests_kcount !== void 0 && (G += n.requests_kcount / 1e3), {
|
|
18371
|
+
input_price: u,
|
|
18262
18372
|
output_price: s,
|
|
18263
|
-
total_price:
|
|
18373
|
+
total_price: G
|
|
18264
18374
|
};
|
|
18265
18375
|
}
|
|
18266
|
-
function
|
|
18376
|
+
function Ue(i, n) {
|
|
18267
18377
|
if (!Array.isArray(i.prices))
|
|
18268
18378
|
return i.prices;
|
|
18269
|
-
for (let
|
|
18270
|
-
const s = i.prices[
|
|
18271
|
-
if (
|
|
18379
|
+
for (let u = i.prices.length - 1; u >= 0; u--) {
|
|
18380
|
+
const s = i.prices[u], r = s.constraint;
|
|
18381
|
+
if (r === void 0)
|
|
18272
18382
|
return s.prices;
|
|
18273
|
-
if (
|
|
18274
|
-
if (n >= new Date(
|
|
18383
|
+
if (r.type === "start_date") {
|
|
18384
|
+
if (n >= new Date(r.start_date))
|
|
18275
18385
|
return s.prices;
|
|
18276
18386
|
} else {
|
|
18277
|
-
const
|
|
18278
|
-
if (_ <
|
|
18279
|
-
if (
|
|
18387
|
+
const h = n.toISOString().slice(11, 19), k = r.start_time, _ = r.end_time;
|
|
18388
|
+
if (_ < k) {
|
|
18389
|
+
if (h >= k || h < _)
|
|
18280
18390
|
return s.prices;
|
|
18281
|
-
} else if (
|
|
18391
|
+
} else if (h >= k && h < _)
|
|
18282
18392
|
return s.prices;
|
|
18283
18393
|
}
|
|
18284
18394
|
}
|
|
18285
18395
|
return i.prices[0].prices;
|
|
18286
18396
|
}
|
|
18287
|
-
function
|
|
18288
|
-
return "or" in i ? i.or.some((
|
|
18397
|
+
function D(i, n) {
|
|
18398
|
+
return "or" in i ? i.or.some((u) => D(u, n)) : "and" in i ? i.and.every((u) => D(u, 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;
|
|
18289
18399
|
}
|
|
18290
|
-
function
|
|
18291
|
-
const
|
|
18292
|
-
return s || i.find((
|
|
18400
|
+
function Ye(i, n) {
|
|
18401
|
+
const u = n.toLowerCase().trim(), s = i.find((r) => r.id === u);
|
|
18402
|
+
return s || i.find((r) => r.provider_match && D(r.provider_match, u));
|
|
18293
18403
|
}
|
|
18294
|
-
function
|
|
18404
|
+
function Je(i, { modelId: n, providerApiUrl: u, providerId: s }) {
|
|
18295
18405
|
if (s)
|
|
18296
|
-
return
|
|
18297
|
-
if (
|
|
18298
|
-
return i.find((
|
|
18406
|
+
return Ye(i, s);
|
|
18407
|
+
if (u)
|
|
18408
|
+
return i.find((r) => new RegExp(r.api_pattern).test(u));
|
|
18299
18409
|
if (n)
|
|
18300
|
-
return i.find((
|
|
18410
|
+
return i.find((r) => r.model_match && D(r.model_match, n));
|
|
18301
18411
|
}
|
|
18302
|
-
function
|
|
18303
|
-
return i.find((
|
|
18412
|
+
function Ze(i, n) {
|
|
18413
|
+
return i.find((u) => D(u.match, n));
|
|
18304
18414
|
}
|
|
18305
|
-
let
|
|
18306
|
-
Promise.resolve(
|
|
18307
|
-
function
|
|
18308
|
-
const s = n.toLowerCase().trim(),
|
|
18309
|
-
if (!
|
|
18310
|
-
const
|
|
18311
|
-
if (!
|
|
18312
|
-
const
|
|
18415
|
+
let Xe = ie;
|
|
18416
|
+
Promise.resolve(ie);
|
|
18417
|
+
function et(i, n, u) {
|
|
18418
|
+
const s = n.toLowerCase().trim(), r = u?.provider ?? Je(Xe, { modelId: s, providerApiUrl: u?.providerApiUrl, providerId: u?.providerId });
|
|
18419
|
+
if (!r) return null;
|
|
18420
|
+
const h = Ze(r.models, s);
|
|
18421
|
+
if (!h) return null;
|
|
18422
|
+
const k = u?.timestamp ?? /* @__PURE__ */ new Date(), _ = Ue(h, k), q = We(i, _);
|
|
18313
18423
|
return {
|
|
18314
18424
|
auto_update_timestamp: void 0,
|
|
18315
|
-
model:
|
|
18425
|
+
model: h,
|
|
18316
18426
|
model_price: _,
|
|
18317
|
-
provider:
|
|
18427
|
+
provider: r,
|
|
18318
18428
|
...q
|
|
18319
18429
|
};
|
|
18320
18430
|
}
|
|
18321
|
-
const f =
|
|
18431
|
+
const f = de(Ge(process.argv)).scriptName("genai-prices").command(
|
|
18322
18432
|
"list [provider]",
|
|
18323
18433
|
"List providers and models",
|
|
18324
18434
|
(i) => i.positional("provider", { describe: "Provider ID to filter", type: "string" })
|
|
@@ -18327,25 +18437,25 @@ const f = dt(Gt(process.argv)).scriptName("genai-prices").command(
|
|
|
18327
18437
|
"Calculate price",
|
|
18328
18438
|
(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" })
|
|
18329
18439
|
).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();
|
|
18330
|
-
function
|
|
18440
|
+
function tt() {
|
|
18331
18441
|
if (f._[0] === "list") {
|
|
18332
|
-
const
|
|
18442
|
+
const u = ie;
|
|
18333
18443
|
if (f.provider) {
|
|
18334
|
-
const s =
|
|
18444
|
+
const s = u.find((r) => r.id === f.provider);
|
|
18335
18445
|
s || (console.error(`Provider ${f.provider} not found.`), process.exit(1)), console.log(`${s.name}: (${s.models.length} models)`);
|
|
18336
|
-
for (const
|
|
18337
|
-
console.log(` ${s.id}:${
|
|
18446
|
+
for (const r of s.models)
|
|
18447
|
+
console.log(` ${s.id}:${r.id}${r.name ? ": " + r.name : ""}`);
|
|
18338
18448
|
} else
|
|
18339
|
-
for (const s of
|
|
18449
|
+
for (const s of u) {
|
|
18340
18450
|
console.log(`${s.name}: (${s.models.length} models)`);
|
|
18341
|
-
for (const
|
|
18342
|
-
console.log(` ${s.id}:${
|
|
18451
|
+
for (const r of s.models)
|
|
18452
|
+
console.log(` ${s.id}:${r.id}${r.name ? ": " + r.name : ""}`);
|
|
18343
18453
|
}
|
|
18344
18454
|
process.exit(0);
|
|
18345
18455
|
}
|
|
18346
|
-
const n = f._[0] === "calc" ? Array.isArray(f.model) ? f.model : [f.model] : f._.filter((
|
|
18456
|
+
const n = f._[0] === "calc" ? Array.isArray(f.model) ? f.model : [f.model] : f._.filter((u) => typeof u == "string");
|
|
18347
18457
|
if (n.length > 0) {
|
|
18348
|
-
const
|
|
18458
|
+
const u = {
|
|
18349
18459
|
cache_audio_read_tokens: f["cache-audio-read-tokens"] !== void 0 ? Number(f["cache-audio-read-tokens"]) : void 0,
|
|
18350
18460
|
cache_read_tokens: f["cache-read-tokens"] !== void 0 ? Number(f["cache-read-tokens"]) : void 0,
|
|
18351
18461
|
cache_write_tokens: f["cache-write-tokens"] !== void 0 ? Number(f["cache-write-tokens"]) : void 0,
|
|
@@ -18355,34 +18465,34 @@ function ee() {
|
|
|
18355
18465
|
output_tokens: f["output-tokens"] !== void 0 ? Number(f["output-tokens"]) : void 0,
|
|
18356
18466
|
requests: f.requests !== void 0 ? Number(f.requests) : void 0
|
|
18357
18467
|
}, s = f.timestamp ? new Date(String(f.timestamp)) : void 0;
|
|
18358
|
-
let
|
|
18359
|
-
for (const
|
|
18360
|
-
let
|
|
18361
|
-
_.includes(":") && ([
|
|
18468
|
+
let r = !1;
|
|
18469
|
+
for (const h of n) {
|
|
18470
|
+
let k, _ = h;
|
|
18471
|
+
_.includes(":") && ([k, _] = _.split(":", 2));
|
|
18362
18472
|
try {
|
|
18363
|
-
const q =
|
|
18473
|
+
const q = et(u, _, { providerId: k, timestamp: s });
|
|
18364
18474
|
if (!q) {
|
|
18365
|
-
|
|
18475
|
+
r = !0, console.error(`No price found for model ${h}`);
|
|
18366
18476
|
continue;
|
|
18367
18477
|
}
|
|
18368
|
-
const
|
|
18478
|
+
const M = q.model.context_window, B = [
|
|
18369
18479
|
["Provider", q.provider.name],
|
|
18370
18480
|
["Model", q.model.name ?? q.model.id],
|
|
18371
18481
|
["Model Prices", JSON.stringify(q.model_price)],
|
|
18372
|
-
["Context Window",
|
|
18482
|
+
["Context Window", M !== void 0 ? M.toLocaleString() : void 0],
|
|
18373
18483
|
["Total Price", `$${q.total_price}`],
|
|
18374
18484
|
["Input Price", `$${q.input_price}`],
|
|
18375
18485
|
["Output Price", `$${q.output_price}`]
|
|
18376
18486
|
];
|
|
18377
|
-
for (const [
|
|
18378
|
-
|
|
18487
|
+
for (const [S, A] of B)
|
|
18488
|
+
A !== void 0 && console.log(`${S.padStart(14)}: ${A}`);
|
|
18379
18489
|
console.log("");
|
|
18380
18490
|
} catch (q) {
|
|
18381
|
-
|
|
18491
|
+
r = !0, q instanceof Error && console.error(`Error for model ${h}:`, q.message);
|
|
18382
18492
|
}
|
|
18383
18493
|
}
|
|
18384
|
-
process.exit(
|
|
18494
|
+
process.exit(r ? 1 : 0);
|
|
18385
18495
|
}
|
|
18386
|
-
|
|
18496
|
+
de().showHelp(), process.exit(1);
|
|
18387
18497
|
}
|
|
18388
|
-
|
|
18498
|
+
tt();
|